Lines Matching +full:xtal +full:- +full:load +full:- +full:pf
1 // SPDX-License-Identifier: GPL-2.0-or-later
5 * Sony HELENE DVB-S/S2 DVB-T/T2 DVB-C/C2 ISDB-T/S tuner driver (CXD2858ER)
34 enum helene_xtal xtal; member
54 /**< System-M (Japan) (IF: Fp=5.75MHz in default) */
56 /**< System-M (US) (IF: Fp=5.75MHz in default) */
58 /**< System-M (Korea) (IF: Fp=5.9MHz in default) */
60 /**< System-B/G (IF: Fp=7.3MHz in default) */
62 /**< System-I (IF: Fp=7.85MHz in default) */
64 /**< System-D/K (IF: Fp=7.85MHz in default) */
66 /**< System-L (IF: Fp=7.85MHz in default) */
68 /**< System-L DASH (IF: Fp=2.2MHz in default) */
75 /**< ISDB-T 6MHzBW (IF: Fc=3.55MHz in default) */
77 /**< ISDB-T 7MHzBW (IF: Fc=4.15MHz in default) */
79 /**< ISDB-T 8MHzBW (IF: Fc=4.75MHz in default) */
81 /**< DVB-T 5MHzBW (IF: Fc=3.6MHz in default) */
83 /**< DVB-T 6MHzBW (IF: Fc=3.6MHz in default) */
85 /**< DVB-T 7MHzBW (IF: Fc=4.2MHz in default) */
87 /**< DVB-T 8MHzBW (IF: Fc=4.8MHz in default) */
89 /**< DVB-T2 1.7MHzBW (IF: Fc=3.5MHz in default) */
91 /**< DVB-T2 5MHzBW (IF: Fc=3.6MHz in default) */
93 /**< DVB-T2 6MHzBW (IF: Fc=3.6MHz in default) */
95 /**< DVB-T2 7MHzBW (IF: Fc=4.2MHz in default) */
97 /**< DVB-T2 8MHzBW (IF: Fc=4.8MHz in default) */
99 /**< DVB-C 6MHzBW (IF: Fc=3.7MHz in default) */
101 /**< DVB-C 8MHzBW (IF: Fc=4.9MHz in default) */
103 /**< DVB-C2 6MHzBW (IF: Fc=3.7MHz in default) */
105 /**< DVB-C2 8MHzBW (IF: Fc=4.9MHz in default) */
110 /**< ISDB-S */
112 /**< DVB-S */
114 /**< DVB-S2 */
194 /**< SONY_HELENE_ATV_MN_EIAJ (System-M (Japan)) */
197 /**< SONY_HELENE_ATV_MN_SAP (System-M (US)) */
202 /**< SONY_HELENE_ATV_MN_A2 (System-M (Korea)) */
205 /**< SONY_HELENE_ATV_BG (System-B/G) */
207 HELENE_BW_8, HELENE_OFFSET(2), HELENE_OFFSET(-3), 0x00},
208 /**< SONY_HELENE_ATV_I (System-I) */
210 HELENE_BW_8, HELENE_OFFSET(2), HELENE_OFFSET(-3), 0x00},
211 /**< SONY_HELENE_ATV_DK (System-D/K) */
213 HELENE_BW_8, HELENE_OFFSET(2), HELENE_OFFSET(-3), 0x00},
214 /**< SONY_HELENE_ATV_L (System-L) */
216 HELENE_BW_8, HELENE_OFFSET(-1), HELENE_OFFSET(4), 0x00},
217 /**< SONY_HELENE_ATV_L_DASH (System-L DASH) */
220 HELENE_BW_6, HELENE_OFFSET(-6), HELENE_OFFSET(-3), 0x00},
223 HELENE_BW_6, HELENE_OFFSET(-6), HELENE_OFFSET(-3), 0x00},
226 HELENE_BW_6, HELENE_OFFSET(-9), HELENE_OFFSET(-5), 0x00},
227 /**< SONY_HELENE_DTV_ISDBT_6 (ISDB-T 6MHzBW) */
229 HELENE_BW_7, HELENE_OFFSET(-7), HELENE_OFFSET(-6), 0x00},
230 /**< SONY_HELENE_DTV_ISDBT_7 (ISDB-T 7MHzBW) */
232 HELENE_BW_8, HELENE_OFFSET(-5), HELENE_OFFSET(-7), 0x00},
233 /**< SONY_HELENE_DTV_ISDBT_8 (ISDB-T 8MHzBW) */
235 HELENE_BW_6, HELENE_OFFSET(-8), HELENE_OFFSET(-3), 0x00},
236 /**< SONY_HELENE_DTV_DVBT_5 (DVB-T 5MHzBW) */
238 HELENE_BW_6, HELENE_OFFSET(-8), HELENE_OFFSET(-3), 0x00},
239 /**< SONY_HELENE_DTV_DVBT_6 (DVB-T 6MHzBW) */
241 HELENE_BW_7, HELENE_OFFSET(-6), HELENE_OFFSET(-5), 0x00},
242 /**< SONY_HELENE_DTV_DVBT_7 (DVB-T 7MHzBW) */
244 HELENE_BW_8, HELENE_OFFSET(-4), HELENE_OFFSET(-6), 0x00},
245 /**< SONY_HELENE_DTV_DVBT_8 (DVB-T 8MHzBW) */
247 HELENE_BW_1_7, HELENE_OFFSET(-10), HELENE_OFFSET(-10), 0x00},
248 /**< SONY_HELENE_DTV_DVBT2_1_7 (DVB-T2 1.7MHzBW) */
250 HELENE_BW_6, HELENE_OFFSET(-8), HELENE_OFFSET(-3), 0x00},
251 /**< SONY_HELENE_DTV_DVBT2_5 (DVB-T2 5MHzBW) */
253 HELENE_BW_6, HELENE_OFFSET(-8), HELENE_OFFSET(-3), 0x00},
254 /**< SONY_HELENE_DTV_DVBT2_6 (DVB-T2 6MHzBW) */
256 HELENE_BW_7, HELENE_OFFSET(-6), HELENE_OFFSET(-5), 0x00},
257 /**< SONY_HELENE_DTV_DVBT2_7 (DVB-T2 7MHzBW) */
259 HELENE_BW_8, HELENE_OFFSET(-4), HELENE_OFFSET(-6), 0x00},
260 /**< SONY_HELENE_DTV_DVBT2_8 (DVB-T2 8MHzBW) */
262 HELENE_BW_6, HELENE_OFFSET(-6), HELENE_OFFSET(-4), 0x00},
263 /**< SONY_HELENE_DTV_DVBC_6 (DVB-C 6MHzBW) */
265 HELENE_BW_8, HELENE_OFFSET(-2), HELENE_OFFSET(-3), 0x00},
266 /**< SONY_HELENE_DTV_DVBC_8 (DVB-C 8MHzBW) */
268 HELENE_BW_6, HELENE_OFFSET(-6), HELENE_OFFSET(-2), 0x00},
269 /**< SONY_HELENE_DTV_DVBC2_6 (DVB-C2 6MHzBW) */
271 HELENE_BW_8, HELENE_OFFSET(-2), HELENE_OFFSET(0), 0x00},
272 /**< SONY_HELENE_DTV_DVBC2_8 (DVB-C2 8MHzBW) */
281 dev_dbg(&priv->i2c->dev, "helene: I2C %s reg 0x%02x size %d\n", in helene_i2c_debug()
294 .addr = priv->i2c_address, in helene_write_regs()
302 dev_warn(&priv->i2c->dev, in helene_write_regs()
305 return -E2BIG; in helene_write_regs()
311 ret = i2c_transfer(priv->i2c, msg, 1); in helene_write_regs()
313 ret = -EREMOTEIO; in helene_write_regs()
315 dev_warn(&priv->i2c->dev, in helene_write_regs()
336 .addr = priv->i2c_address, in helene_read_regs()
341 .addr = priv->i2c_address, in helene_read_regs()
348 ret = i2c_transfer(priv->i2c, &msg[0], 1); in helene_read_regs()
350 ret = -EREMOTEIO; in helene_read_regs()
352 dev_warn(&priv->i2c->dev, in helene_read_regs()
354 KBUILD_MODNAME, ret, priv->i2c_address, reg); in helene_read_regs()
357 ret = i2c_transfer(priv->i2c, &msg[1], 1); in helene_read_regs()
359 ret = -EREMOTEIO; in helene_read_regs()
361 dev_warn(&priv->i2c->dev, in helene_read_regs()
363 KBUILD_MODNAME, ret, priv->i2c_address, reg); in helene_read_regs()
392 dev_dbg(&priv->i2c->dev, "%s()\n", __func__); in helene_enter_power_save()
393 if (priv->state == STATE_SLEEP) in helene_enter_power_save()
402 priv->state = STATE_SLEEP; in helene_enter_power_save()
408 dev_dbg(&priv->i2c->dev, "%s()\n", __func__); in helene_leave_power_save()
409 if (priv->state == STATE_ACTIVE) in helene_leave_power_save()
418 priv->state = STATE_ACTIVE; in helene_leave_power_save()
424 struct helene_priv *priv = fe->tuner_priv; in helene_init()
426 dev_dbg(&priv->i2c->dev, "%s()\n", __func__); in helene_init()
432 struct helene_priv *priv = fe->tuner_priv; in helene_release()
434 dev_dbg(&priv->i2c->dev, "%s()\n", __func__); in helene_release()
435 kfree(fe->tuner_priv); in helene_release()
436 fe->tuner_priv = NULL; in helene_release()
441 struct helene_priv *priv = fe->tuner_priv; in helene_sleep()
443 dev_dbg(&priv->i2c->dev, "%s()\n", __func__); in helene_sleep()
451 struct dtv_frontend_properties *p = &fe->dtv_property_cache; in helene_get_tv_system()
452 struct helene_priv *priv = fe->tuner_priv; in helene_get_tv_system()
454 if (p->delivery_system == SYS_DVBT) { in helene_get_tv_system()
455 if (p->bandwidth_hz <= 5000000) in helene_get_tv_system()
457 else if (p->bandwidth_hz <= 6000000) in helene_get_tv_system()
459 else if (p->bandwidth_hz <= 7000000) in helene_get_tv_system()
461 else if (p->bandwidth_hz <= 8000000) in helene_get_tv_system()
465 p->bandwidth_hz = 8000000; in helene_get_tv_system()
467 } else if (p->delivery_system == SYS_DVBT2) { in helene_get_tv_system()
468 if (p->bandwidth_hz <= 5000000) in helene_get_tv_system()
470 else if (p->bandwidth_hz <= 6000000) in helene_get_tv_system()
472 else if (p->bandwidth_hz <= 7000000) in helene_get_tv_system()
474 else if (p->bandwidth_hz <= 8000000) in helene_get_tv_system()
478 p->bandwidth_hz = 8000000; in helene_get_tv_system()
480 } else if (p->delivery_system == SYS_DVBS) { in helene_get_tv_system()
482 } else if (p->delivery_system == SYS_DVBS2) { in helene_get_tv_system()
484 } else if (p->delivery_system == SYS_ISDBS) { in helene_get_tv_system()
486 } else if (p->delivery_system == SYS_ISDBT) { in helene_get_tv_system()
487 if (p->bandwidth_hz <= 6000000) in helene_get_tv_system()
489 else if (p->bandwidth_hz <= 7000000) in helene_get_tv_system()
491 else if (p->bandwidth_hz <= 8000000) in helene_get_tv_system()
495 p->bandwidth_hz = 8000000; in helene_get_tv_system()
497 } else if (p->delivery_system == SYS_DVBC_ANNEX_A) { in helene_get_tv_system()
498 if (p->bandwidth_hz <= 6000000) in helene_get_tv_system()
500 else if (p->bandwidth_hz <= 8000000) in helene_get_tv_system()
503 dev_dbg(&priv->i2c->dev, in helene_get_tv_system()
505 __func__, (int)system, p->delivery_system, in helene_get_tv_system()
506 p->bandwidth_hz); in helene_get_tv_system()
515 struct dtv_frontend_properties *p = &fe->dtv_property_cache; in helene_set_params_s()
516 struct helene_priv *priv = fe->tuner_priv; in helene_set_params_s()
517 int frequencykHz = p->frequency; in helene_set_params_s()
519 u32 symbol_rate = p->symbol_rate/1000; in helene_set_params_s()
521 dev_dbg(&priv->i2c->dev, "%s(): tune frequency %dkHz sr=%uKsps\n", in helene_set_params_s()
526 dev_err(&priv->i2c->dev, "%s(): unknown DTV system\n", in helene_set_params_s()
528 return -EINVAL; in helene_set_params_s()
531 if (priv->set_tuner) in helene_set_params_s()
532 priv->set_tuner(priv->set_tuner_data, 0); in helene_set_params_s()
533 frequency = roundup(p->frequency / 1000, 1); in helene_set_params_s()
554 /* Clock enable for internal logic block, CPU wake-up (0x04, 0x05) */ in helene_set_params_s()
558 switch (priv->xtal) { in helene_set_params_s()
572 dev_err(&priv->i2c->dev, "%s(): unknown xtal %d\n", in helene_set_params_s()
573 __func__, priv->xtal); in helene_set_params_s()
574 return -EINVAL; in helene_set_params_s()
583 if (priv->xtal == SONY_HELENE_XTAL_20500) in helene_set_params_s()
608 + (40000-1)) / 40000); in helene_set_params_s()
611 + (40000-1)) / 40000 + 5); in helene_set_params_s()
621 + (10000-1)) / 10000); in helene_set_params_s()
624 + (5000-1)) / 5000 + 5); in helene_set_params_s()
630 dev_err(&priv->i2c->dev, "%s(): unknown standard %d\n", in helene_set_params_s()
632 return -EINVAL; in helene_set_params_s()
653 dev_dbg(&priv->i2c->dev, "%s(): tune done\n", in helene_set_params_s()
656 priv->frequency = frequency; in helene_set_params_s()
665 struct dtv_frontend_properties *p = &fe->dtv_property_cache; in helene_set_params_t()
666 struct helene_priv *priv = fe->tuner_priv; in helene_set_params_t()
667 int frequencykHz = p->frequency / 1000; in helene_set_params_t()
669 dev_dbg(&priv->i2c->dev, "%s(): tune frequency %dkHz\n", in helene_set_params_t()
674 dev_dbg(&priv->i2c->dev, "%s(): unknown DTV system\n", in helene_set_params_t()
676 return -EINVAL; in helene_set_params_t()
678 if (priv->set_tuner) in helene_set_params_t()
679 priv->set_tuner(priv->set_tuner_data, 1); in helene_set_params_t()
680 frequency = roundup(p->frequency / 1000, 25); in helene_set_params_t()
688 if (priv->state == STATE_SLEEP) in helene_set_params_t()
718 /* Setting for PLL reference divider for xtal=24MHz */ in helene_set_params_t()
822 dev_dbg(&priv->i2c->dev, "%s(): tune done\n", in helene_set_params_t()
825 priv->frequency = frequency; in helene_set_params_t()
831 struct dtv_frontend_properties *p = &fe->dtv_property_cache; in helene_set_params()
833 if (p->delivery_system == SYS_DVBT || in helene_set_params()
834 p->delivery_system == SYS_DVBT2 || in helene_set_params()
835 p->delivery_system == SYS_ISDBT || in helene_set_params()
836 p->delivery_system == SYS_DVBC_ANNEX_A) in helene_set_params()
844 struct helene_priv *priv = fe->tuner_priv; in helene_get_frequency()
846 *frequency = priv->frequency * 1000; in helene_get_frequency()
892 /* power-on tuner
917 /* 0x81 - 0x94 */ in helene_x_pon()
918 if (priv->xtal == SONY_HELENE_XTAL_16000) in helene_x_pon()
919 data[0] = 0x10; /* xtal 16 MHz */ in helene_x_pon()
921 data[0] = 0x18; /* xtal 24 MHz */ in helene_x_pon()
923 data[2] = (uint8_t)(0x80 | (0x26 & 0x7F)); /* 38 x 0.25 = 9.5pF */ in helene_x_pon()
928 data[7] = 0x40; /* Start CPU boot-up */ in helene_x_pon()
929 data[8] = 0x10; /* For burst-write */ in helene_x_pon()
958 dev_err(&priv->i2c->dev, in helene_x_pon()
960 return -EIO; in helene_x_pon()
980 /* Load capacitance control setting for crystal oscillator */ in helene_x_pon()
988 dev_info(&priv->i2c->dev, in helene_x_pon()
1003 priv->i2c_address = (config->i2c_address >> 1); in helene_attach_s()
1004 priv->i2c = i2c; in helene_attach_s()
1005 priv->set_tuner_data = config->set_tuner_priv; in helene_attach_s()
1006 priv->set_tuner = config->set_tuner_callback; in helene_attach_s()
1007 priv->xtal = config->xtal; in helene_attach_s()
1009 if (fe->ops.i2c_gate_ctrl) in helene_attach_s()
1010 fe->ops.i2c_gate_ctrl(fe, 1); in helene_attach_s()
1017 if (fe->ops.i2c_gate_ctrl) in helene_attach_s()
1018 fe->ops.i2c_gate_ctrl(fe, 0); in helene_attach_s()
1020 memcpy(&fe->ops.tuner_ops, &helene_tuner_ops_s, in helene_attach_s()
1022 fe->tuner_priv = priv; in helene_attach_s()
1023 dev_info(&priv->i2c->dev, in helene_attach_s()
1025 priv->i2c_address, priv->i2c); in helene_attach_s()
1039 priv->i2c_address = (config->i2c_address >> 1); in helene_attach()
1040 priv->i2c = i2c; in helene_attach()
1041 priv->set_tuner_data = config->set_tuner_priv; in helene_attach()
1042 priv->set_tuner = config->set_tuner_callback; in helene_attach()
1043 priv->xtal = config->xtal; in helene_attach()
1045 if (fe->ops.i2c_gate_ctrl) in helene_attach()
1046 fe->ops.i2c_gate_ctrl(fe, 1); in helene_attach()
1053 if (fe->ops.i2c_gate_ctrl) in helene_attach()
1054 fe->ops.i2c_gate_ctrl(fe, 0); in helene_attach()
1056 memcpy(&fe->ops.tuner_ops, &helene_tuner_ops_t, in helene_attach()
1058 fe->tuner_priv = priv; in helene_attach()
1059 dev_info(&priv->i2c->dev, in helene_attach()
1061 priv->i2c_address, priv->i2c); in helene_attach()
1068 struct helene_config *config = client->dev.platform_data; in helene_probe()
1069 struct dvb_frontend *fe = config->fe; in helene_probe()
1070 struct device *dev = &client->dev; in helene_probe()
1075 return -ENOMEM; in helene_probe()
1077 priv->i2c_address = client->addr; in helene_probe()
1078 priv->i2c = client->adapter; in helene_probe()
1079 priv->set_tuner_data = config->set_tuner_priv; in helene_probe()
1080 priv->set_tuner = config->set_tuner_callback; in helene_probe()
1081 priv->xtal = config->xtal; in helene_probe()
1083 if (fe->ops.i2c_gate_ctrl) in helene_probe()
1084 fe->ops.i2c_gate_ctrl(fe, 1); in helene_probe()
1087 return -EINVAL; in helene_probe()
1089 if (fe->ops.i2c_gate_ctrl) in helene_probe()
1090 fe->ops.i2c_gate_ctrl(fe, 0); in helene_probe()
1092 memcpy(&fe->ops.tuner_ops, &helene_tuner_ops, in helene_probe()
1094 fe->tuner_priv = priv; in helene_probe()
1098 priv->i2c_address, priv->i2c); in helene_probe()