Lines Matching refs:dev
20 struct mn88472_dev *dev = i2c_get_clientdata(client); in mn88472_read_status() local
26 if (!dev->active) { in mn88472_read_status()
33 ret = regmap_read(dev->regmap[0], 0x7f, &utmp); in mn88472_read_status()
43 ret = regmap_read(dev->regmap[2], 0x92, &utmp); in mn88472_read_status()
58 ret = regmap_read(dev->regmap[1], 0x84, &utmp); in mn88472_read_status()
75 ret = regmap_bulk_read(dev->regmap[2], 0x8e + i, in mn88472_read_status()
82 dev_dbg(&client->dev, "strength=%u\n", utmp1); in mn88472_read_status()
93 ret = regmap_bulk_read(dev->regmap[0], 0x9c, buf, 2); in mn88472_read_status()
104 dev_dbg(&client->dev, "cnr=%d value=%u\n", stmp, utmp); in mn88472_read_status()
115 ret = regmap_bulk_read(dev->regmap[2], 0xbc + i, in mn88472_read_status()
129 dev_dbg(&client->dev, "cnr=%d value=%u MISO\n", in mn88472_read_status()
137 dev_dbg(&client->dev, "cnr=%d value=%u SISO\n", in mn88472_read_status()
149 ret = regmap_bulk_read(dev->regmap[1], 0xa1, buf, 4); in mn88472_read_status()
161 dev_dbg(&client->dev, "cnr=%d signal=%u noise=%u\n", in mn88472_read_status()
175 ret = regmap_bulk_read(dev->regmap[0], 0xe1, buf, 4); in mn88472_read_status()
181 dev_dbg(&client->dev, "block_error=%u block_count=%u\n", in mn88472_read_status()
195 dev_dbg(&client->dev, "failed=%d\n", ret); in mn88472_read_status()
202 struct mn88472_dev *dev = i2c_get_clientdata(client); in mn88472_set_frontend() local
211 dev_dbg(&client->dev, in mn88472_set_frontend()
216 if (!dev->active) { in mn88472_set_frontend()
293 dev_dbg(&client->dev, "get_if_frequency=%d\n", if_frequency); in mn88472_set_frontend()
299 ret = regmap_write(dev->regmap[2], 0x00, 0x66); in mn88472_set_frontend()
302 ret = regmap_write(dev->regmap[2], 0x01, 0x00); in mn88472_set_frontend()
305 ret = regmap_write(dev->regmap[2], 0x02, 0x01); in mn88472_set_frontend()
308 ret = regmap_write(dev->regmap[2], 0x03, delivery_system_val); in mn88472_set_frontend()
311 ret = regmap_write(dev->regmap[2], 0x04, bandwidth_val); in mn88472_set_frontend()
316 utmp = DIV_ROUND_CLOSEST_ULL((u64)if_frequency * 0x1000000, dev->clk); in mn88472_set_frontend()
321 ret = regmap_write(dev->regmap[2], 0x10 + i, buf[i]); in mn88472_set_frontend()
329 ret = regmap_write(dev->regmap[2], 0x13 + i, in mn88472_set_frontend()
336 ret = regmap_write(dev->regmap[0], 0xb4, reg_bank0_b4_val); in mn88472_set_frontend()
339 ret = regmap_write(dev->regmap[0], 0xcd, reg_bank0_cd_val); in mn88472_set_frontend()
342 ret = regmap_write(dev->regmap[0], 0xd4, reg_bank0_d4_val); in mn88472_set_frontend()
345 ret = regmap_write(dev->regmap[0], 0xd6, reg_bank0_d6_val); in mn88472_set_frontend()
351 ret = regmap_write(dev->regmap[0], 0x07, 0x26); in mn88472_set_frontend()
354 ret = regmap_write(dev->regmap[0], 0x00, 0xba); in mn88472_set_frontend()
357 ret = regmap_write(dev->regmap[0], 0x01, 0x13); in mn88472_set_frontend()
362 ret = regmap_write(dev->regmap[2], 0x2b, 0x13); in mn88472_set_frontend()
365 ret = regmap_write(dev->regmap[2], 0x4f, 0x05); in mn88472_set_frontend()
368 ret = regmap_write(dev->regmap[1], 0xf6, 0x05); in mn88472_set_frontend()
371 ret = regmap_write(dev->regmap[2], 0x32, in mn88472_set_frontend()
384 ret = regmap_write(dev->regmap[2], 0xf8, 0x9f); in mn88472_set_frontend()
390 dev_dbg(&client->dev, "failed=%d\n", ret); in mn88472_set_frontend()
397 struct mn88472_dev *dev = i2c_get_clientdata(client); in mn88472_init() local
403 dev_dbg(&client->dev, "\n"); in mn88472_init()
406 ret = regmap_write(dev->regmap[2], 0x05, 0x00); in mn88472_init()
409 ret = regmap_write(dev->regmap[2], 0x0b, 0x00); in mn88472_init()
412 ret = regmap_write(dev->regmap[2], 0x0c, 0x00); in mn88472_init()
417 ret = regmap_read(dev->regmap[0], 0xf5, &utmp); in mn88472_init()
423 ret = request_firmware(&firmware, name, &client->dev); in mn88472_init()
425 dev_err(&client->dev, "firmware file '%s' not found\n", name); in mn88472_init()
429 dev_info(&client->dev, "downloading firmware from file '%s'\n", name); in mn88472_init()
431 ret = regmap_write(dev->regmap[0], 0xf5, 0x03); in mn88472_init()
435 for (rem = firmware->size; rem > 0; rem -= (dev->i2c_write_max - 1)) { in mn88472_init()
436 len = min(dev->i2c_write_max - 1, rem); in mn88472_init()
437 ret = regmap_bulk_write(dev->regmap[0], 0xf6, in mn88472_init()
441 dev_err(&client->dev, "firmware download failed %d\n", in mn88472_init()
448 ret = regmap_read(dev->regmap[0], 0xf8, &utmp); in mn88472_init()
453 dev_err(&client->dev, "firmware did not run\n"); in mn88472_init()
457 ret = regmap_write(dev->regmap[0], 0xf5, 0x00); in mn88472_init()
464 switch (dev->ts_mode) { in mn88472_init()
475 ret = regmap_write(dev->regmap[2], 0x08, utmp); in mn88472_init()
479 switch (dev->ts_clk) { in mn88472_init()
490 ret = regmap_write(dev->regmap[0], 0xd9, utmp); in mn88472_init()
494 dev->active = true; in mn88472_init()
500 dev_dbg(&client->dev, "failed=%d\n", ret); in mn88472_init()
507 struct mn88472_dev *dev = i2c_get_clientdata(client); in mn88472_sleep() local
510 dev_dbg(&client->dev, "\n"); in mn88472_sleep()
513 ret = regmap_write(dev->regmap[2], 0x0c, 0x30); in mn88472_sleep()
516 ret = regmap_write(dev->regmap[2], 0x0b, 0x30); in mn88472_sleep()
519 ret = regmap_write(dev->regmap[2], 0x05, 0x3e); in mn88472_sleep()
525 dev_dbg(&client->dev, "failed=%d\n", ret); in mn88472_sleep()
568 struct mn88472_dev *dev = i2c_get_clientdata(client); in mn88472_get_dvb_frontend() local
570 dev_dbg(&client->dev, "\n"); in mn88472_get_dvb_frontend()
572 return &dev->fe; in mn88472_get_dvb_frontend()
577 struct mn88472_config *pdata = client->dev.platform_data; in mn88472_probe()
578 struct mn88472_dev *dev; in mn88472_probe() local
587 dev_dbg(&client->dev, "\n"); in mn88472_probe()
589 dev = kzalloc(sizeof(*dev), GFP_KERNEL); in mn88472_probe()
590 if (!dev) { in mn88472_probe()
595 dev->i2c_write_max = pdata->i2c_wr_max ? pdata->i2c_wr_max : ~0; in mn88472_probe()
596 dev->clk = pdata->xtal; in mn88472_probe()
597 dev->ts_mode = pdata->ts_mode; in mn88472_probe()
598 dev->ts_clk = pdata->ts_clock; in mn88472_probe()
599 dev->client[0] = client; in mn88472_probe()
600 dev->regmap[0] = regmap_init_i2c(dev->client[0], ®map_config); in mn88472_probe()
601 if (IS_ERR(dev->regmap[0])) { in mn88472_probe()
602 ret = PTR_ERR(dev->regmap[0]); in mn88472_probe()
614 dev->client[1] = i2c_new_dummy_device(client->adapter, 0x1a); in mn88472_probe()
615 if (IS_ERR(dev->client[1])) { in mn88472_probe()
616 ret = PTR_ERR(dev->client[1]); in mn88472_probe()
617 dev_err(&client->dev, "I2C registration failed\n"); in mn88472_probe()
620 dev->regmap[1] = regmap_init_i2c(dev->client[1], ®map_config); in mn88472_probe()
621 if (IS_ERR(dev->regmap[1])) { in mn88472_probe()
622 ret = PTR_ERR(dev->regmap[1]); in mn88472_probe()
625 i2c_set_clientdata(dev->client[1], dev); in mn88472_probe()
627 dev->client[2] = i2c_new_dummy_device(client->adapter, 0x1c); in mn88472_probe()
628 if (IS_ERR(dev->client[2])) { in mn88472_probe()
629 ret = PTR_ERR(dev->client[2]); in mn88472_probe()
630 dev_err(&client->dev, "2nd I2C registration failed\n"); in mn88472_probe()
633 dev->regmap[2] = regmap_init_i2c(dev->client[2], ®map_config); in mn88472_probe()
634 if (IS_ERR(dev->regmap[2])) { in mn88472_probe()
635 ret = PTR_ERR(dev->regmap[2]); in mn88472_probe()
638 i2c_set_clientdata(dev->client[2], dev); in mn88472_probe()
641 ret = regmap_read(dev->regmap[2], 0xff, &utmp); in mn88472_probe()
645 dev_dbg(&client->dev, "chip id=%02x\n", utmp); in mn88472_probe()
653 ret = regmap_write(dev->regmap[2], 0x05, 0x3e); in mn88472_probe()
658 memcpy(&dev->fe.ops, &mn88472_ops, sizeof(struct dvb_frontend_ops)); in mn88472_probe()
659 dev->fe.demodulator_priv = client; in mn88472_probe()
660 *pdata->fe = &dev->fe; in mn88472_probe()
661 i2c_set_clientdata(client, dev); in mn88472_probe()
664 c = &dev->fe.dtv_property_cache; in mn88472_probe()
673 dev_info(&client->dev, "Panasonic MN88472 successfully identified\n"); in mn88472_probe()
677 regmap_exit(dev->regmap[2]); in mn88472_probe()
679 i2c_unregister_device(dev->client[2]); in mn88472_probe()
681 regmap_exit(dev->regmap[1]); in mn88472_probe()
683 i2c_unregister_device(dev->client[1]); in mn88472_probe()
685 regmap_exit(dev->regmap[0]); in mn88472_probe()
687 kfree(dev); in mn88472_probe()
689 dev_dbg(&client->dev, "failed=%d\n", ret); in mn88472_probe()
695 struct mn88472_dev *dev = i2c_get_clientdata(client); in mn88472_remove() local
697 dev_dbg(&client->dev, "\n"); in mn88472_remove()
699 regmap_exit(dev->regmap[2]); in mn88472_remove()
700 i2c_unregister_device(dev->client[2]); in mn88472_remove()
702 regmap_exit(dev->regmap[1]); in mn88472_remove()
703 i2c_unregister_device(dev->client[1]); in mn88472_remove()
705 regmap_exit(dev->regmap[0]); in mn88472_remove()
707 kfree(dev); in mn88472_remove()