Lines Matching refs:dev

28 	struct it913x_dev *dev = fe->tuner_priv;  in it913x_init()  local
29 struct platform_device *pdev = dev->pdev; in it913x_init()
36 dev_dbg(&pdev->dev, "role %u\n", dev->role); in it913x_init()
38 ret = regmap_write(dev->regmap, 0x80ec4c, 0x68); in it913x_init()
44 ret = regmap_read(dev->regmap, 0x80ec86, &utmp); in it913x_init()
51 dev->clk_mode = utmp; in it913x_init()
52 dev->xtal = 2000; in it913x_init()
53 dev->fdiv = 3; in it913x_init()
58 dev->clk_mode = utmp; in it913x_init()
59 dev->xtal = 640; in it913x_init()
60 dev->fdiv = 1; in it913x_init()
64 dev_err(&pdev->dev, "unknown clock identifier %d\n", utmp); in it913x_init()
69 ret = regmap_read(dev->regmap, 0x80ed03, &utmp); in it913x_init()
81 ret = regmap_bulk_read(dev->regmap, 0x80ed23, buf, 2); in it913x_init()
90 dev_dbg(&pdev->dev, "r_fbc_m_bdry took %u ms, val %u\n", in it913x_init()
94 dev->fn_min = dev->xtal * utmp; in it913x_init()
95 dev->fn_min /= (dev->fdiv * nv_val); in it913x_init()
96 dev->fn_min *= 1000; in it913x_init()
97 dev_dbg(&pdev->dev, "fn_min %u\n", dev->fn_min); in it913x_init()
105 if (dev->chip_ver == 1) { in it913x_init()
109 ret = regmap_read(dev->regmap, 0x80ec82, &utmp); in it913x_init()
117 dev_dbg(&pdev->dev, "p_tsm_init_mode took %u ms, val %u\n", in it913x_init()
124 ret = regmap_write(dev->regmap, 0x80ed81, iqik_m_cal); in it913x_init()
128 ret = regmap_write(dev->regmap, 0x80ec57, 0x00); in it913x_init()
132 ret = regmap_write(dev->regmap, 0x80ec58, 0x00); in it913x_init()
136 ret = regmap_write(dev->regmap, 0x80ec40, 0x01); in it913x_init()
140 dev->active = true; in it913x_init()
144 dev_dbg(&pdev->dev, "failed %d\n", ret); in it913x_init()
150 struct it913x_dev *dev = fe->tuner_priv; in it913x_sleep() local
151 struct platform_device *pdev = dev->pdev; in it913x_sleep()
154 dev_dbg(&pdev->dev, "role %u\n", dev->role); in it913x_sleep()
156 dev->active = false; in it913x_sleep()
158 ret = regmap_bulk_write(dev->regmap, 0x80ec40, "\x00", 1); in it913x_sleep()
166 if (dev->role == IT913X_ROLE_DUAL_MASTER) in it913x_sleep()
171 dev_dbg(&pdev->dev, "role %u, len %d\n", dev->role, len); in it913x_sleep()
173 ret = regmap_bulk_write(dev->regmap, 0x80ec02, in it913x_sleep()
179 ret = regmap_bulk_write(dev->regmap, 0x80ec12, "\x00\x00\x00\x00", 4); in it913x_sleep()
183 ret = regmap_bulk_write(dev->regmap, 0x80ec17, in it913x_sleep()
188 ret = regmap_bulk_write(dev->regmap, 0x80ec22, in it913x_sleep()
193 ret = regmap_bulk_write(dev->regmap, 0x80ec20, "\x00", 1); in it913x_sleep()
197 ret = regmap_bulk_write(dev->regmap, 0x80ec3f, "\x01", 1); in it913x_sleep()
203 dev_dbg(&pdev->dev, "failed %d\n", ret); in it913x_sleep()
209 struct it913x_dev *dev = fe->tuner_priv; in it913x_set_params() local
210 struct platform_device *pdev = dev->pdev; in it913x_set_params()
218 dev_dbg(&pdev->dev, "role=%u, frequency %u, bandwidth_hz %u\n", in it913x_set_params()
219 dev->role, c->frequency, c->bandwidth_hz); in it913x_set_params()
221 if (!dev->active) { in it913x_set_params()
244 } else if (c->frequency <= dev->fn_min) { in it913x_set_params()
255 ret = regmap_read(dev->regmap, 0x80ed81, &utmp); in it913x_set_params()
262 if (dev->clk_mode == 0) in it913x_set_params()
268 if (dev->clk_mode == 0) in it913x_set_params()
274 t_cal_freq = (c->frequency / 1000) * n_div * dev->fdiv; in it913x_set_params()
275 pre_lo_freq = t_cal_freq / dev->xtal; in it913x_set_params()
276 utmp = pre_lo_freq * dev->xtal; in it913x_set_params()
278 if ((t_cal_freq - utmp) >= (dev->xtal >> 1)) in it913x_set_params()
284 dev_dbg(&pdev->dev, "t_cal_freq %u, pre_lo_freq %u\n", in it913x_set_params()
323 ret = regmap_write(dev->regmap, 0x80ee06, lna_band); in it913x_set_params()
336 ret = regmap_write(dev->regmap, 0x80ec56, u8tmp); in it913x_set_params()
341 ret = regmap_write(dev->regmap, 0x80ec4c, 0xa0 | (l_band << 3)); in it913x_set_params()
345 ret = regmap_write(dev->regmap, 0x80ec4d, (t_cal_freq >> 0) & 0xff); in it913x_set_params()
349 ret = regmap_write(dev->regmap, 0x80ec4e, (t_cal_freq >> 8) & 0xff); in it913x_set_params()
353 ret = regmap_write(dev->regmap, 0x80011e, (pre_lo_freq >> 0) & 0xff); in it913x_set_params()
357 ret = regmap_write(dev->regmap, 0x80011f, (pre_lo_freq >> 8) & 0xff); in it913x_set_params()
363 dev_dbg(&pdev->dev, "failed %d\n", ret); in it913x_set_params()
381 struct it913x_platform_data *pdata = pdev->dev.platform_data; in it913x_probe()
383 struct it913x_dev *dev; in it913x_probe() local
388 dev = kzalloc(sizeof(struct it913x_dev), GFP_KERNEL); in it913x_probe()
389 if (dev == NULL) { in it913x_probe()
391 dev_err(&pdev->dev, "kzalloc() failed\n"); in it913x_probe()
395 dev->pdev = pdev; in it913x_probe()
396 dev->regmap = pdata->regmap; in it913x_probe()
397 dev->fe = pdata->fe; in it913x_probe()
398 dev->chip_ver = id->driver_data; in it913x_probe()
399 dev->role = pdata->role; in it913x_probe()
401 fe->tuner_priv = dev; in it913x_probe()
404 platform_set_drvdata(pdev, dev); in it913x_probe()
406 if (dev->chip_ver == 1) in it913x_probe()
408 else if (dev->chip_ver == 2) in it913x_probe()
413 dev_info(&pdev->dev, "ITE IT913X %s successfully attached\n", in it913x_probe()
415 dev_dbg(&pdev->dev, "chip_ver %u, role %u\n", dev->chip_ver, dev->role); in it913x_probe()
418 dev_dbg(&pdev->dev, "failed %d\n", ret); in it913x_probe()
424 struct it913x_dev *dev = platform_get_drvdata(pdev); in it913x_remove() local
425 struct dvb_frontend *fe = dev->fe; in it913x_remove()
427 dev_dbg(&pdev->dev, "\n"); in it913x_remove()
431 kfree(dev); in it913x_remove()