Lines Matching refs:priv
112 static void ascot2e_i2c_debug(struct ascot2e_priv *priv, in ascot2e_i2c_debug() argument
115 dev_dbg(&priv->i2c->dev, "ascot2e: I2C %s reg 0x%02x size %d\n", in ascot2e_i2c_debug()
121 static int ascot2e_write_regs(struct ascot2e_priv *priv, in ascot2e_write_regs() argument
128 .addr = priv->i2c_address, in ascot2e_write_regs()
136 dev_warn(&priv->i2c->dev,"wr reg=%04x: len=%d is too big!\n", in ascot2e_write_regs()
141 ascot2e_i2c_debug(priv, reg, 1, data, len); in ascot2e_write_regs()
144 ret = i2c_transfer(priv->i2c, msg, 1); in ascot2e_write_regs()
148 dev_warn(&priv->i2c->dev, in ascot2e_write_regs()
156 static int ascot2e_write_reg(struct ascot2e_priv *priv, u8 reg, u8 val) in ascot2e_write_reg() argument
158 return ascot2e_write_regs(priv, reg, &val, 1); in ascot2e_write_reg()
161 static int ascot2e_read_regs(struct ascot2e_priv *priv, in ascot2e_read_regs() argument
167 .addr = priv->i2c_address, in ascot2e_read_regs()
172 .addr = priv->i2c_address, in ascot2e_read_regs()
179 ret = i2c_transfer(priv->i2c, &msg[0], 1); in ascot2e_read_regs()
183 dev_warn(&priv->i2c->dev, in ascot2e_read_regs()
185 KBUILD_MODNAME, ret, priv->i2c_address, reg); in ascot2e_read_regs()
188 ret = i2c_transfer(priv->i2c, &msg[1], 1); in ascot2e_read_regs()
192 dev_warn(&priv->i2c->dev, in ascot2e_read_regs()
194 KBUILD_MODNAME, ret, priv->i2c_address, reg); in ascot2e_read_regs()
197 ascot2e_i2c_debug(priv, reg, 0, val, len); in ascot2e_read_regs()
201 static int ascot2e_read_reg(struct ascot2e_priv *priv, u8 reg, u8 *val) in ascot2e_read_reg() argument
203 return ascot2e_read_regs(priv, reg, val, 1); in ascot2e_read_reg()
206 static int ascot2e_set_reg_bits(struct ascot2e_priv *priv, in ascot2e_set_reg_bits() argument
213 res = ascot2e_read_reg(priv, reg, &rdata); in ascot2e_set_reg_bits()
218 return ascot2e_write_reg(priv, reg, data); in ascot2e_set_reg_bits()
221 static int ascot2e_enter_power_save(struct ascot2e_priv *priv) in ascot2e_enter_power_save() argument
225 dev_dbg(&priv->i2c->dev, "%s()\n", __func__); in ascot2e_enter_power_save()
226 if (priv->state == STATE_SLEEP) in ascot2e_enter_power_save()
230 ascot2e_write_regs(priv, 0x14, data, 2); in ascot2e_enter_power_save()
231 ascot2e_write_reg(priv, 0x50, 0x01); in ascot2e_enter_power_save()
232 priv->state = STATE_SLEEP; in ascot2e_enter_power_save()
236 static int ascot2e_leave_power_save(struct ascot2e_priv *priv) in ascot2e_leave_power_save() argument
240 dev_dbg(&priv->i2c->dev, "%s()\n", __func__); in ascot2e_leave_power_save()
241 if (priv->state == STATE_ACTIVE) in ascot2e_leave_power_save()
243 ascot2e_write_regs(priv, 0x14, data, 2); in ascot2e_leave_power_save()
244 ascot2e_write_reg(priv, 0x50, 0x00); in ascot2e_leave_power_save()
245 priv->state = STATE_ACTIVE; in ascot2e_leave_power_save()
251 struct ascot2e_priv *priv = fe->tuner_priv; in ascot2e_init() local
253 dev_dbg(&priv->i2c->dev, "%s()\n", __func__); in ascot2e_init()
254 return ascot2e_leave_power_save(priv); in ascot2e_init()
259 struct ascot2e_priv *priv = fe->tuner_priv; in ascot2e_release() local
261 dev_dbg(&priv->i2c->dev, "%s()\n", __func__); in ascot2e_release()
269 struct ascot2e_priv *priv = fe->tuner_priv; in ascot2e_sleep() local
271 dev_dbg(&priv->i2c->dev, "%s()\n", __func__); in ascot2e_sleep()
272 ascot2e_enter_power_save(priv); in ascot2e_sleep()
280 struct ascot2e_priv *priv = fe->tuner_priv; in ascot2e_get_tv_system() local
314 dev_dbg(&priv->i2c->dev, in ascot2e_get_tv_system()
326 struct ascot2e_priv *priv = fe->tuner_priv; in ascot2e_set_params() local
328 dev_dbg(&priv->i2c->dev, "%s(): tune frequency %dkHz\n", in ascot2e_set_params()
333 dev_dbg(&priv->i2c->dev, "%s(): unknown DTV system\n", in ascot2e_set_params()
337 if (priv->set_tuner) in ascot2e_set_params()
338 priv->set_tuner(priv->set_tuner_data, 1); in ascot2e_set_params()
340 if (priv->state == STATE_SLEEP) in ascot2e_set_params()
341 ascot2e_leave_power_save(priv); in ascot2e_set_params()
356 ascot2e_set_reg_bits(priv, 0x05, data[0], 0x1c); in ascot2e_set_params()
391 ascot2e_write_reg(priv, 0x4E, 0x01); in ascot2e_set_params()
396 ascot2e_write_reg(priv, 0x4E, 0x00); in ascot2e_set_params()
404 ascot2e_write_regs(priv, 0x06, data, 10); in ascot2e_set_params()
420 ascot2e_write_regs(priv, 0x45, data, 3); in ascot2e_set_params()
426 ascot2e_write_regs(priv, 0x49, data, 2); in ascot2e_set_params()
433 ascot2e_set_reg_bits(priv, 0x0c, 0x90, 0xb0); in ascot2e_set_params()
437 ascot2e_write_regs(priv, 0x03, data, 2); in ascot2e_set_params()
447 ascot2e_write_regs(priv, 0x10, data, 5); in ascot2e_set_params()
450 ascot2e_write_reg(priv, 0x04, 0x00); in ascot2e_set_params()
452 ascot2e_write_reg(priv, 0x03, 0xC0); in ascot2e_set_params()
454 ascot2e_set_reg_bits(priv, 0x0C, 0x00, 0x30); in ascot2e_set_params()
455 priv->frequency = frequency; in ascot2e_set_params()
461 struct ascot2e_priv *priv = fe->tuner_priv; in ascot2e_get_frequency() local
463 *frequency = priv->frequency * 1000; in ascot2e_get_frequency()
486 struct ascot2e_priv *priv = NULL; in ascot2e_attach() local
488 priv = kzalloc(sizeof(struct ascot2e_priv), GFP_KERNEL); in ascot2e_attach()
489 if (priv == NULL) in ascot2e_attach()
491 priv->i2c_address = (config->i2c_address >> 1); in ascot2e_attach()
492 priv->i2c = i2c; in ascot2e_attach()
493 priv->set_tuner_data = config->set_tuner_priv; in ascot2e_attach()
494 priv->set_tuner = config->set_tuner_callback; in ascot2e_attach()
506 ascot2e_write_regs(priv, 0x01, data, 4); in ascot2e_attach()
511 ascot2e_write_regs(priv, 0x22, data, 3); in ascot2e_attach()
513 ascot2e_write_reg(priv, 0x28, 0x1e); in ascot2e_attach()
515 ascot2e_write_reg(priv, 0x59, 0x04); in ascot2e_attach()
519 ascot2e_write_reg(priv, 0x4c, 0x01); in ascot2e_attach()
521 ascot2e_write_reg(priv, 0x07, 0x04); in ascot2e_attach()
523 ascot2e_write_reg(priv, 0x04, 0x00); in ascot2e_attach()
525 ascot2e_write_reg(priv, 0x03, 0xc0); in ascot2e_attach()
529 ascot2e_write_regs(priv, 0x14, data, 2); in ascot2e_attach()
530 ascot2e_write_reg(priv, 0x50, 0x01); in ascot2e_attach()
531 priv->state = STATE_SLEEP; in ascot2e_attach()
538 fe->tuner_priv = priv; in ascot2e_attach()
539 dev_info(&priv->i2c->dev, in ascot2e_attach()
541 priv->i2c_address, priv->i2c); in ascot2e_attach()