Lines Matching +full:2 +full:c
3 * Panasonic MN88472 DVB-T/T2/C demodulator driver
5 * Copyright (C) 2013 Antti Palosaari <crope@iki.fi>
21 struct dtv_frontend_properties *c = &fe->dtv_property_cache; in mn88472_read_status() local
31 switch (c->delivery_system) { in mn88472_read_status()
43 ret = regmap_read(dev->regmap[2], 0x92, &utmp); in mn88472_read_status()
74 for (i = 0; i < 2; i++) { in mn88472_read_status()
75 ret = regmap_bulk_read(dev->regmap[2], 0x8e + i, in mn88472_read_status()
81 utmp1 = buf[0] << 8 | buf[1] << 0 | buf[0] >> 2; in mn88472_read_status()
84 c->strength.stat[0].scale = FE_SCALE_RELATIVE; in mn88472_read_status()
85 c->strength.stat[0].uvalue = utmp1; in mn88472_read_status()
87 c->strength.stat[0].scale = FE_SCALE_NOT_AVAILABLE; in mn88472_read_status()
91 if (*status & FE_HAS_VITERBI && c->delivery_system == SYS_DVBT) { in mn88472_read_status()
93 ret = regmap_bulk_read(dev->regmap[0], 0x9c, buf, 2); in mn88472_read_status()
99 /* CNR[dB]: 10 * log10(65536 / value) + 2 */ in mn88472_read_status()
109 c->cnr.stat[0].svalue = stmp; in mn88472_read_status()
110 c->cnr.stat[0].scale = FE_SCALE_DECIBEL; in mn88472_read_status()
112 c->delivery_system == SYS_DVBT2) { in mn88472_read_status()
115 ret = regmap_bulk_read(dev->regmap[2], 0xbc + i, in mn88472_read_status()
121 utmp = buf[1] << 8 | buf[2] << 0; in mn88472_read_status()
122 utmp1 = (buf[0] >> 2) & 0x01; /* 0=SISO, 1=MISO */ in mn88472_read_status()
132 /* CNR[dB]: 10 * log10(65536 / value) + 2 */ in mn88472_read_status()
144 c->cnr.stat[0].svalue = stmp; in mn88472_read_status()
145 c->cnr.stat[0].scale = FE_SCALE_DECIBEL; in mn88472_read_status()
147 c->delivery_system == SYS_DVBC_ANNEX_A) { in mn88472_read_status()
148 /* DVB-C CNR */ in mn88472_read_status()
154 utmp2 = buf[2] << 8 | buf[3] << 0; /* noise */ in mn88472_read_status()
167 c->cnr.stat[0].svalue = stmp; in mn88472_read_status()
168 c->cnr.stat[0].scale = FE_SCALE_DECIBEL; in mn88472_read_status()
170 c->cnr.stat[0].scale = FE_SCALE_NOT_AVAILABLE; in mn88472_read_status()
180 utmp2 = buf[2] << 8 | buf[3] << 0; in mn88472_read_status()
184 c->block_error.stat[0].scale = FE_SCALE_COUNTER; in mn88472_read_status()
185 c->block_error.stat[0].uvalue += utmp1; in mn88472_read_status()
186 c->block_count.stat[0].scale = FE_SCALE_COUNTER; in mn88472_read_status()
187 c->block_count.stat[0].uvalue += utmp2; in mn88472_read_status()
189 c->block_error.stat[0].scale = FE_SCALE_NOT_AVAILABLE; in mn88472_read_status()
190 c->block_count.stat[0].scale = FE_SCALE_NOT_AVAILABLE; in mn88472_read_status()
203 struct dtv_frontend_properties *c = &fe->dtv_property_cache; in mn88472_set_frontend() local
213 c->delivery_system, c->modulation, c->frequency, in mn88472_set_frontend()
214 c->bandwidth_hz, c->symbol_rate, c->inversion, c->stream_id); in mn88472_set_frontend()
221 switch (c->delivery_system) { in mn88472_set_frontend()
248 switch (c->delivery_system) { in mn88472_set_frontend()
251 switch (c->bandwidth_hz) { 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()
319 buf[2] = (utmp >> 0) & 0xff; 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()
349 switch (c->delivery_system) { 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()
371 ret = regmap_write(dev->regmap[2], 0x32, in mn88472_set_frontend()
372 (c->stream_id == NO_STREAM_ID_FILTER) ? 0 : in mn88472_set_frontend()
373 c->stream_id ); in mn88472_set_frontend()
384 ret = regmap_write(dev->regmap[2], 0xf8, 0x9f); in mn88472_set_frontend()
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()
475 ret = regmap_write(dev->regmap[2], 0x08, utmp); in mn88472_init()
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()
580 struct dtv_frontend_properties *c; in mn88472_probe() local
612 * Also, register bank 2 do not support sequential I/O. Only single in mn88472_probe()
628 dev->client[2] = i2c_new_dummy_device(client->adapter, 0x1c); in mn88472_probe()
629 if (IS_ERR(dev->client[2])) { in mn88472_probe()
630 ret = PTR_ERR(dev->client[2]); in mn88472_probe()
631 dev_err(&client->dev, "2nd I2C registration failed\n"); in mn88472_probe()
634 dev->regmap[2] = regmap_init_i2c(dev->client[2], ®map_config); in mn88472_probe()
635 if (IS_ERR(dev->regmap[2])) { in mn88472_probe()
636 ret = PTR_ERR(dev->regmap[2]); in mn88472_probe()
639 i2c_set_clientdata(dev->client[2], dev); in mn88472_probe()
642 ret = regmap_read(dev->regmap[2], 0xff, &utmp); in mn88472_probe()
654 ret = regmap_write(dev->regmap[2], 0x05, 0x3e); in mn88472_probe()
665 c = &dev->fe.dtv_property_cache; in mn88472_probe()
666 c->strength.len = 1; in mn88472_probe()
667 c->cnr.len = 1; in mn88472_probe()
668 c->block_error.len = 1; in mn88472_probe()
669 c->block_count.len = 1; in mn88472_probe()
678 regmap_exit(dev->regmap[2]); in mn88472_probe()
680 i2c_unregister_device(dev->client[2]); in mn88472_probe()
700 regmap_exit(dev->regmap[2]); in mn88472_remove()
701 i2c_unregister_device(dev->client[2]); in mn88472_remove()
730 MODULE_DESCRIPTION("Panasonic MN88472 DVB-T/T2/C demodulator driver");