Lines Matching refs:priv
200 static int cxd2841er_freeze_regs(struct cxd2841er_priv *priv);
201 static int cxd2841er_unfreeze_regs(struct cxd2841er_priv *priv);
203 static void cxd2841er_i2c_debug(struct cxd2841er_priv *priv, in cxd2841er_i2c_debug() argument
207 dev_dbg(&priv->i2c->dev, in cxd2841er_i2c_debug()
212 static int cxd2841er_write_regs(struct cxd2841er_priv *priv, in cxd2841er_write_regs() argument
218 priv->i2c_addr_slvx : priv->i2c_addr_slvt); in cxd2841er_write_regs()
229 dev_warn(&priv->i2c->dev, "wr reg=%04x: len=%d is too big!\n", in cxd2841er_write_regs()
234 cxd2841er_i2c_debug(priv, i2c_addr, reg, 1, data, len); in cxd2841er_write_regs()
238 ret = i2c_transfer(priv->i2c, msg, 1); in cxd2841er_write_regs()
242 dev_warn(&priv->i2c->dev, in cxd2841er_write_regs()
250 static int cxd2841er_write_reg(struct cxd2841er_priv *priv, in cxd2841er_write_reg() argument
255 return cxd2841er_write_regs(priv, addr, reg, &tmp, 1); in cxd2841er_write_reg()
258 static int cxd2841er_read_regs(struct cxd2841er_priv *priv, in cxd2841er_read_regs() argument
263 priv->i2c_addr_slvx : priv->i2c_addr_slvt); in cxd2841er_read_regs()
278 ret = i2c_transfer(priv->i2c, msg, 2); in cxd2841er_read_regs()
282 dev_warn(&priv->i2c->dev, in cxd2841er_read_regs()
287 cxd2841er_i2c_debug(priv, i2c_addr, reg, 0, val, len); in cxd2841er_read_regs()
291 static int cxd2841er_read_reg(struct cxd2841er_priv *priv, in cxd2841er_read_reg() argument
294 return cxd2841er_read_regs(priv, addr, reg, val, 1); in cxd2841er_read_reg()
297 static int cxd2841er_set_reg_bits(struct cxd2841er_priv *priv, in cxd2841er_set_reg_bits() argument
304 res = cxd2841er_read_reg(priv, addr, reg, &rdata); in cxd2841er_set_reg_bits()
309 return cxd2841er_write_reg(priv, addr, reg, data); in cxd2841er_set_reg_bits()
327 static int cxd2841er_get_if_hz(struct cxd2841er_priv *priv, u32 def_hz) in cxd2841er_get_if_hz() argument
331 if (priv->frontend.ops.tuner_ops.get_if_frequency in cxd2841er_get_if_hz()
332 && (priv->flags & CXD2841ER_AUTO_IFHZ)) in cxd2841er_get_if_hz()
333 priv->frontend.ops.tuner_ops.get_if_frequency( in cxd2841er_get_if_hz()
334 &priv->frontend, &hz); in cxd2841er_get_if_hz()
343 struct cxd2841er_priv *priv = fe->demodulator_priv; in cxd2841er_tuner_set() local
345 if ((priv->flags & CXD2841ER_USE_GATECTRL) && fe->ops.i2c_gate_ctrl) in cxd2841er_tuner_set()
349 if ((priv->flags & CXD2841ER_USE_GATECTRL) && fe->ops.i2c_gate_ctrl) in cxd2841er_tuner_set()
355 static int cxd2841er_dvbs2_set_symbol_rate(struct cxd2841er_priv *priv, in cxd2841er_dvbs2_set_symbol_rate() argument
361 dev_dbg(&priv->i2c->dev, "%s()\n", __func__); in cxd2841er_dvbs2_set_symbol_rate()
369 dev_err(&priv->i2c->dev, in cxd2841er_dvbs2_set_symbol_rate()
377 cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0xae); in cxd2841er_dvbs2_set_symbol_rate()
378 cxd2841er_write_regs(priv, I2C_SLVT, 0x20, data, 3); in cxd2841er_dvbs2_set_symbol_rate()
382 static void cxd2841er_set_ts_clock_mode(struct cxd2841er_priv *priv,
385 static int cxd2841er_sleep_s_to_active_s(struct cxd2841er_priv *priv, in cxd2841er_sleep_s_to_active_s() argument
391 if (priv->state != STATE_SLEEP_S) { in cxd2841er_sleep_s_to_active_s()
392 dev_err(&priv->i2c->dev, "%s(): invalid state %d\n", in cxd2841er_sleep_s_to_active_s()
393 __func__, (int)priv->state); in cxd2841er_sleep_s_to_active_s()
396 dev_dbg(&priv->i2c->dev, "%s()\n", __func__); in cxd2841er_sleep_s_to_active_s()
397 cxd2841er_set_ts_clock_mode(priv, SYS_DVBS); in cxd2841er_sleep_s_to_active_s()
404 dev_err(&priv->i2c->dev, "%s(): invalid delsys %d\n", in cxd2841er_sleep_s_to_active_s()
409 cxd2841er_write_reg(priv, I2C_SLVX, 0x00, 0x00); in cxd2841er_sleep_s_to_active_s()
410 cxd2841er_write_reg(priv, I2C_SLVX, 0x17, data[0]); in cxd2841er_sleep_s_to_active_s()
414 cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x00); in cxd2841er_sleep_s_to_active_s()
416 cxd2841er_write_reg(priv, I2C_SLVT, 0x2d, data[0]); in cxd2841er_sleep_s_to_active_s()
418 cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0xae); in cxd2841er_sleep_s_to_active_s()
420 cxd2841er_write_reg(priv, I2C_SLVT, 0x30, data[0]); in cxd2841er_sleep_s_to_active_s()
422 cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x00); in cxd2841er_sleep_s_to_active_s()
424 cxd2841er_write_reg(priv, I2C_SLVT, 0x2c, 0x01); in cxd2841er_sleep_s_to_active_s()
426 cxd2841er_write_reg(priv, I2C_SLVT, 0x31, 0x01); in cxd2841er_sleep_s_to_active_s()
428 cxd2841er_write_reg(priv, I2C_SLVT, 0x63, 0x16); in cxd2841er_sleep_s_to_active_s()
430 cxd2841er_write_reg(priv, I2C_SLVT, 0x65, 0x3f); in cxd2841er_sleep_s_to_active_s()
432 cxd2841er_write_reg(priv, I2C_SLVX, 0x00, 0x00); in cxd2841er_sleep_s_to_active_s()
434 cxd2841er_write_reg(priv, I2C_SLVX, 0x18, 0x00); in cxd2841er_sleep_s_to_active_s()
436 cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0xa3); in cxd2841er_sleep_s_to_active_s()
437 cxd2841er_write_reg(priv, I2C_SLVT, 0xac, 0x00); in cxd2841er_sleep_s_to_active_s()
443 cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0xab); in cxd2841er_sleep_s_to_active_s()
444 cxd2841er_write_regs(priv, I2C_SLVT, 0x98, data, 4); in cxd2841er_sleep_s_to_active_s()
449 cxd2841er_write_regs(priv, I2C_SLVT, 0xa8, data, 4); in cxd2841er_sleep_s_to_active_s()
452 cxd2841er_write_regs(priv, I2C_SLVT, 0xc3, data, 2); in cxd2841er_sleep_s_to_active_s()
454 ret = cxd2841er_dvbs2_set_symbol_rate(priv, symbol_rate); in cxd2841er_sleep_s_to_active_s()
458 cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x00); in cxd2841er_sleep_s_to_active_s()
460 cxd2841er_write_reg(priv, I2C_SLVT, 0x80, 0x10); in cxd2841er_sleep_s_to_active_s()
462 cxd2841er_write_reg(priv, I2C_SLVT, 0x81, 0x00); in cxd2841er_sleep_s_to_active_s()
463 priv->state = STATE_ACTIVE_S; in cxd2841er_sleep_s_to_active_s()
467 static int cxd2841er_sleep_tc_to_active_t_band(struct cxd2841er_priv *priv,
470 static int cxd2841er_sleep_tc_to_active_t2_band(struct cxd2841er_priv *priv,
473 static int cxd2841er_sleep_tc_to_active_c_band(struct cxd2841er_priv *priv,
476 static int cxd2841er_sleep_tc_to_active_i(struct cxd2841er_priv *priv,
479 static int cxd2841er_active_i_to_sleep_tc(struct cxd2841er_priv *priv);
481 static int cxd2841er_sleep_tc_to_shutdown(struct cxd2841er_priv *priv);
483 static int cxd2841er_shutdown_to_sleep_tc(struct cxd2841er_priv *priv);
487 static int cxd2841er_retune_active(struct cxd2841er_priv *priv, in cxd2841er_retune_active() argument
490 dev_dbg(&priv->i2c->dev, "%s()\n", __func__); in cxd2841er_retune_active()
491 if (priv->state != STATE_ACTIVE_S && in cxd2841er_retune_active()
492 priv->state != STATE_ACTIVE_TC) { in cxd2841er_retune_active()
493 dev_dbg(&priv->i2c->dev, "%s(): invalid state %d\n", in cxd2841er_retune_active()
494 __func__, priv->state); in cxd2841er_retune_active()
498 cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x00); in cxd2841er_retune_active()
500 cxd2841er_write_reg(priv, I2C_SLVT, 0xc3, 0x01); in cxd2841er_retune_active()
501 if (priv->state == STATE_ACTIVE_S) in cxd2841er_retune_active()
503 priv, p->symbol_rate / 1000); in cxd2841er_retune_active()
504 else if (priv->state == STATE_ACTIVE_TC) { in cxd2841er_retune_active()
505 switch (priv->system) { in cxd2841er_retune_active()
508 priv, p->bandwidth_hz); in cxd2841er_retune_active()
511 priv, p->bandwidth_hz); in cxd2841er_retune_active()
514 priv, p->bandwidth_hz); in cxd2841er_retune_active()
516 cxd2841er_active_i_to_sleep_tc(priv); in cxd2841er_retune_active()
517 cxd2841er_sleep_tc_to_shutdown(priv); in cxd2841er_retune_active()
518 cxd2841er_shutdown_to_sleep_tc(priv); in cxd2841er_retune_active()
520 priv, p->bandwidth_hz); in cxd2841er_retune_active()
523 dev_dbg(&priv->i2c->dev, "%s(): invalid delivery system %d\n", in cxd2841er_retune_active()
524 __func__, priv->system); in cxd2841er_retune_active()
528 static int cxd2841er_active_s_to_sleep_s(struct cxd2841er_priv *priv) in cxd2841er_active_s_to_sleep_s() argument
530 dev_dbg(&priv->i2c->dev, "%s()\n", __func__); in cxd2841er_active_s_to_sleep_s()
531 if (priv->state != STATE_ACTIVE_S) { in cxd2841er_active_s_to_sleep_s()
532 dev_err(&priv->i2c->dev, "%s(): invalid state %d\n", in cxd2841er_active_s_to_sleep_s()
533 __func__, priv->state); in cxd2841er_active_s_to_sleep_s()
537 cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x00); in cxd2841er_active_s_to_sleep_s()
539 cxd2841er_write_reg(priv, I2C_SLVT, 0xc3, 0x01); in cxd2841er_active_s_to_sleep_s()
541 cxd2841er_write_reg(priv, I2C_SLVT, 0x80, 0x1f); in cxd2841er_active_s_to_sleep_s()
543 cxd2841er_write_reg(priv, I2C_SLVT, 0x81, 0xff); in cxd2841er_active_s_to_sleep_s()
545 cxd2841er_write_reg(priv, I2C_SLVX, 0x00, 0x00); in cxd2841er_active_s_to_sleep_s()
547 cxd2841er_write_reg(priv, I2C_SLVX, 0x18, 0x01); in cxd2841er_active_s_to_sleep_s()
549 cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x00); in cxd2841er_active_s_to_sleep_s()
551 cxd2841er_write_reg(priv, I2C_SLVT, 0x31, 0x00); in cxd2841er_active_s_to_sleep_s()
553 cxd2841er_write_reg(priv, I2C_SLVT, 0x63, 0x16); in cxd2841er_active_s_to_sleep_s()
555 cxd2841er_write_reg(priv, I2C_SLVT, 0x65, 0x27); in cxd2841er_active_s_to_sleep_s()
557 cxd2841er_write_reg(priv, I2C_SLVT, 0x69, 0x06); in cxd2841er_active_s_to_sleep_s()
559 cxd2841er_write_reg(priv, I2C_SLVT, 0x2c, 0x00); in cxd2841er_active_s_to_sleep_s()
561 cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0xae); in cxd2841er_active_s_to_sleep_s()
563 cxd2841er_write_reg(priv, I2C_SLVT, 0x30, 0x00); in cxd2841er_active_s_to_sleep_s()
565 cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x00); in cxd2841er_active_s_to_sleep_s()
567 cxd2841er_write_reg(priv, I2C_SLVT, 0x2d, 0x00); in cxd2841er_active_s_to_sleep_s()
568 priv->state = STATE_SLEEP_S; in cxd2841er_active_s_to_sleep_s()
572 static int cxd2841er_sleep_s_to_shutdown(struct cxd2841er_priv *priv) in cxd2841er_sleep_s_to_shutdown() argument
574 dev_dbg(&priv->i2c->dev, "%s()\n", __func__); in cxd2841er_sleep_s_to_shutdown()
575 if (priv->state != STATE_SLEEP_S) { in cxd2841er_sleep_s_to_shutdown()
576 dev_dbg(&priv->i2c->dev, "%s(): invalid demod state %d\n", in cxd2841er_sleep_s_to_shutdown()
577 __func__, priv->state); in cxd2841er_sleep_s_to_shutdown()
581 cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x00); in cxd2841er_sleep_s_to_shutdown()
583 cxd2841er_write_reg(priv, I2C_SLVT, 0x80, 0x3f); in cxd2841er_sleep_s_to_shutdown()
585 cxd2841er_write_reg(priv, I2C_SLVT, 0x9c, 0x00); in cxd2841er_sleep_s_to_shutdown()
587 cxd2841er_write_reg(priv, I2C_SLVX, 0x00, 0x00); in cxd2841er_sleep_s_to_shutdown()
589 cxd2841er_write_reg(priv, I2C_SLVX, 0x15, 0x01); in cxd2841er_sleep_s_to_shutdown()
591 cxd2841er_write_reg(priv, I2C_SLVX, 0x17, 0x01); in cxd2841er_sleep_s_to_shutdown()
592 priv->state = STATE_SHUTDOWN; in cxd2841er_sleep_s_to_shutdown()
596 static int cxd2841er_sleep_tc_to_shutdown(struct cxd2841er_priv *priv) in cxd2841er_sleep_tc_to_shutdown() argument
598 dev_dbg(&priv->i2c->dev, "%s()\n", __func__); in cxd2841er_sleep_tc_to_shutdown()
599 if (priv->state != STATE_SLEEP_TC) { in cxd2841er_sleep_tc_to_shutdown()
600 dev_dbg(&priv->i2c->dev, "%s(): invalid demod state %d\n", in cxd2841er_sleep_tc_to_shutdown()
601 __func__, priv->state); in cxd2841er_sleep_tc_to_shutdown()
605 cxd2841er_write_reg(priv, I2C_SLVX, 0x00, 0x00); in cxd2841er_sleep_tc_to_shutdown()
607 cxd2841er_write_reg(priv, I2C_SLVX, 0x15, 0x01); in cxd2841er_sleep_tc_to_shutdown()
609 cxd2841er_write_reg(priv, I2C_SLVX, 0x17, 0x01); in cxd2841er_sleep_tc_to_shutdown()
610 priv->state = STATE_SHUTDOWN; in cxd2841er_sleep_tc_to_shutdown()
614 static int cxd2841er_active_t_to_sleep_tc(struct cxd2841er_priv *priv) in cxd2841er_active_t_to_sleep_tc() argument
616 dev_dbg(&priv->i2c->dev, "%s()\n", __func__); in cxd2841er_active_t_to_sleep_tc()
617 if (priv->state != STATE_ACTIVE_TC) { in cxd2841er_active_t_to_sleep_tc()
618 dev_err(&priv->i2c->dev, "%s(): invalid state %d\n", in cxd2841er_active_t_to_sleep_tc()
619 __func__, priv->state); in cxd2841er_active_t_to_sleep_tc()
623 cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x00); in cxd2841er_active_t_to_sleep_tc()
625 cxd2841er_write_reg(priv, I2C_SLVT, 0xc3, 0x01); in cxd2841er_active_t_to_sleep_tc()
627 cxd2841er_write_reg(priv, I2C_SLVT, 0x80, 0x3f); in cxd2841er_active_t_to_sleep_tc()
629 cxd2841er_write_reg(priv, I2C_SLVT, 0x81, 0xff); in cxd2841er_active_t_to_sleep_tc()
631 cxd2841er_write_reg(priv, I2C_SLVX, 0x00, 0x00); in cxd2841er_active_t_to_sleep_tc()
633 cxd2841er_write_reg(priv, I2C_SLVX, 0x18, 0x01); in cxd2841er_active_t_to_sleep_tc()
635 cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x00); in cxd2841er_active_t_to_sleep_tc()
637 cxd2841er_write_reg(priv, I2C_SLVT, 0x43, 0x0a); in cxd2841er_active_t_to_sleep_tc()
639 cxd2841er_write_reg(priv, I2C_SLVT, 0x41, 0x0a); in cxd2841er_active_t_to_sleep_tc()
641 cxd2841er_write_reg(priv, I2C_SLVT, 0x30, 0x00); in cxd2841er_active_t_to_sleep_tc()
643 cxd2841er_write_reg(priv, I2C_SLVT, 0x2f, 0x00); in cxd2841er_active_t_to_sleep_tc()
645 cxd2841er_write_reg(priv, I2C_SLVT, 0x2c, 0x00); in cxd2841er_active_t_to_sleep_tc()
646 priv->state = STATE_SLEEP_TC; in cxd2841er_active_t_to_sleep_tc()
650 static int cxd2841er_active_t2_to_sleep_tc(struct cxd2841er_priv *priv) in cxd2841er_active_t2_to_sleep_tc() argument
652 dev_dbg(&priv->i2c->dev, "%s()\n", __func__); in cxd2841er_active_t2_to_sleep_tc()
653 if (priv->state != STATE_ACTIVE_TC) { in cxd2841er_active_t2_to_sleep_tc()
654 dev_err(&priv->i2c->dev, "%s(): invalid state %d\n", in cxd2841er_active_t2_to_sleep_tc()
655 __func__, priv->state); in cxd2841er_active_t2_to_sleep_tc()
659 cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x00); in cxd2841er_active_t2_to_sleep_tc()
661 cxd2841er_write_reg(priv, I2C_SLVT, 0xc3, 0x01); in cxd2841er_active_t2_to_sleep_tc()
663 cxd2841er_write_reg(priv, I2C_SLVT, 0x80, 0x3f); in cxd2841er_active_t2_to_sleep_tc()
665 cxd2841er_write_reg(priv, I2C_SLVT, 0x81, 0xff); in cxd2841er_active_t2_to_sleep_tc()
667 cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x13); in cxd2841er_active_t2_to_sleep_tc()
668 cxd2841er_write_reg(priv, I2C_SLVT, 0x83, 0x40); in cxd2841er_active_t2_to_sleep_tc()
669 cxd2841er_write_reg(priv, I2C_SLVT, 0x86, 0x21); in cxd2841er_active_t2_to_sleep_tc()
670 cxd2841er_set_reg_bits(priv, I2C_SLVT, 0x9e, 0x09, 0x0f); in cxd2841er_active_t2_to_sleep_tc()
671 cxd2841er_write_reg(priv, I2C_SLVT, 0x9f, 0xfb); in cxd2841er_active_t2_to_sleep_tc()
672 cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x2a); in cxd2841er_active_t2_to_sleep_tc()
673 cxd2841er_set_reg_bits(priv, I2C_SLVT, 0x38, 0x00, 0x0f); in cxd2841er_active_t2_to_sleep_tc()
674 cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x2b); in cxd2841er_active_t2_to_sleep_tc()
675 cxd2841er_set_reg_bits(priv, I2C_SLVT, 0x11, 0x00, 0x3f); in cxd2841er_active_t2_to_sleep_tc()
677 cxd2841er_write_reg(priv, I2C_SLVX, 0x00, 0x00); in cxd2841er_active_t2_to_sleep_tc()
679 cxd2841er_write_reg(priv, I2C_SLVX, 0x18, 0x01); in cxd2841er_active_t2_to_sleep_tc()
681 cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x00); in cxd2841er_active_t2_to_sleep_tc()
683 cxd2841er_write_reg(priv, I2C_SLVT, 0x43, 0x0a); in cxd2841er_active_t2_to_sleep_tc()
685 cxd2841er_write_reg(priv, I2C_SLVT, 0x41, 0x0a); in cxd2841er_active_t2_to_sleep_tc()
687 cxd2841er_write_reg(priv, I2C_SLVT, 0x30, 0x00); in cxd2841er_active_t2_to_sleep_tc()
689 cxd2841er_write_reg(priv, I2C_SLVT, 0x2f, 0x00); in cxd2841er_active_t2_to_sleep_tc()
691 cxd2841er_write_reg(priv, I2C_SLVT, 0x2c, 0x00); in cxd2841er_active_t2_to_sleep_tc()
692 priv->state = STATE_SLEEP_TC; in cxd2841er_active_t2_to_sleep_tc()
696 static int cxd2841er_active_c_to_sleep_tc(struct cxd2841er_priv *priv) in cxd2841er_active_c_to_sleep_tc() argument
698 dev_dbg(&priv->i2c->dev, "%s()\n", __func__); in cxd2841er_active_c_to_sleep_tc()
699 if (priv->state != STATE_ACTIVE_TC) { in cxd2841er_active_c_to_sleep_tc()
700 dev_err(&priv->i2c->dev, "%s(): invalid state %d\n", in cxd2841er_active_c_to_sleep_tc()
701 __func__, priv->state); in cxd2841er_active_c_to_sleep_tc()
705 cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x00); in cxd2841er_active_c_to_sleep_tc()
707 cxd2841er_write_reg(priv, I2C_SLVT, 0xc3, 0x01); in cxd2841er_active_c_to_sleep_tc()
709 cxd2841er_write_reg(priv, I2C_SLVT, 0x80, 0x3f); in cxd2841er_active_c_to_sleep_tc()
711 cxd2841er_write_reg(priv, I2C_SLVT, 0x81, 0xff); in cxd2841er_active_c_to_sleep_tc()
713 cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x11); in cxd2841er_active_c_to_sleep_tc()
714 cxd2841er_set_reg_bits(priv, I2C_SLVT, 0xa3, 0x00, 0x1f); in cxd2841er_active_c_to_sleep_tc()
716 cxd2841er_write_reg(priv, I2C_SLVX, 0x00, 0x00); in cxd2841er_active_c_to_sleep_tc()
718 cxd2841er_write_reg(priv, I2C_SLVX, 0x18, 0x01); in cxd2841er_active_c_to_sleep_tc()
720 cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x00); in cxd2841er_active_c_to_sleep_tc()
722 cxd2841er_write_reg(priv, I2C_SLVT, 0x43, 0x0a); in cxd2841er_active_c_to_sleep_tc()
724 cxd2841er_write_reg(priv, I2C_SLVT, 0x41, 0x0a); in cxd2841er_active_c_to_sleep_tc()
726 cxd2841er_write_reg(priv, I2C_SLVT, 0x30, 0x00); in cxd2841er_active_c_to_sleep_tc()
728 cxd2841er_write_reg(priv, I2C_SLVT, 0x2f, 0x00); in cxd2841er_active_c_to_sleep_tc()
730 cxd2841er_write_reg(priv, I2C_SLVT, 0x2c, 0x00); in cxd2841er_active_c_to_sleep_tc()
731 priv->state = STATE_SLEEP_TC; in cxd2841er_active_c_to_sleep_tc()
735 static int cxd2841er_active_i_to_sleep_tc(struct cxd2841er_priv *priv) in cxd2841er_active_i_to_sleep_tc() argument
737 dev_dbg(&priv->i2c->dev, "%s()\n", __func__); in cxd2841er_active_i_to_sleep_tc()
738 if (priv->state != STATE_ACTIVE_TC) { in cxd2841er_active_i_to_sleep_tc()
739 dev_err(&priv->i2c->dev, "%s(): invalid state %d\n", in cxd2841er_active_i_to_sleep_tc()
740 __func__, priv->state); in cxd2841er_active_i_to_sleep_tc()
744 cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x00); in cxd2841er_active_i_to_sleep_tc()
746 cxd2841er_write_reg(priv, I2C_SLVT, 0xc3, 0x01); in cxd2841er_active_i_to_sleep_tc()
748 cxd2841er_write_reg(priv, I2C_SLVT, 0x80, 0x3f); in cxd2841er_active_i_to_sleep_tc()
750 cxd2841er_write_reg(priv, I2C_SLVT, 0x81, 0xff); in cxd2841er_active_i_to_sleep_tc()
755 cxd2841er_write_reg(priv, I2C_SLVX, 0x00, 0x00); in cxd2841er_active_i_to_sleep_tc()
757 cxd2841er_write_reg(priv, I2C_SLVX, 0x18, 0x01); in cxd2841er_active_i_to_sleep_tc()
759 cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x00); in cxd2841er_active_i_to_sleep_tc()
761 cxd2841er_write_reg(priv, I2C_SLVT, 0x43, 0x0a); in cxd2841er_active_i_to_sleep_tc()
763 cxd2841er_write_reg(priv, I2C_SLVT, 0x41, 0x0a); in cxd2841er_active_i_to_sleep_tc()
765 cxd2841er_write_reg(priv, I2C_SLVT, 0x30, 0x00); in cxd2841er_active_i_to_sleep_tc()
767 cxd2841er_write_reg(priv, I2C_SLVT, 0x2f, 0x00); in cxd2841er_active_i_to_sleep_tc()
769 cxd2841er_write_reg(priv, I2C_SLVT, 0x2c, 0x00); in cxd2841er_active_i_to_sleep_tc()
770 priv->state = STATE_SLEEP_TC; in cxd2841er_active_i_to_sleep_tc()
774 static int cxd2841er_shutdown_to_sleep_s(struct cxd2841er_priv *priv) in cxd2841er_shutdown_to_sleep_s() argument
776 dev_dbg(&priv->i2c->dev, "%s()\n", __func__); in cxd2841er_shutdown_to_sleep_s()
777 if (priv->state != STATE_SHUTDOWN) { in cxd2841er_shutdown_to_sleep_s()
778 dev_dbg(&priv->i2c->dev, "%s(): invalid demod state %d\n", in cxd2841er_shutdown_to_sleep_s()
779 __func__, priv->state); in cxd2841er_shutdown_to_sleep_s()
783 cxd2841er_write_reg(priv, I2C_SLVX, 0x00, 0x00); in cxd2841er_shutdown_to_sleep_s()
785 cxd2841er_write_reg(priv, I2C_SLVX, 0x02, 0x00); in cxd2841er_shutdown_to_sleep_s()
788 cxd2841er_write_reg(priv, I2C_SLVX, 0x00, 0x00); in cxd2841er_shutdown_to_sleep_s()
790 cxd2841er_write_reg(priv, I2C_SLVX, 0x10, 0x01); in cxd2841er_shutdown_to_sleep_s()
792 switch (priv->xtal) { in cxd2841er_shutdown_to_sleep_s()
794 cxd2841er_write_reg(priv, I2C_SLVX, 0x14, 0x00); in cxd2841er_shutdown_to_sleep_s()
798 cxd2841er_write_reg(priv, I2C_SLVX, 0x12, 0x00); in cxd2841er_shutdown_to_sleep_s()
799 cxd2841er_write_reg(priv, I2C_SLVX, 0x14, 0x03); in cxd2841er_shutdown_to_sleep_s()
802 cxd2841er_write_reg(priv, I2C_SLVX, 0x14, 0x01); in cxd2841er_shutdown_to_sleep_s()
805 dev_dbg(&priv->i2c->dev, "%s(): invalid demod xtal %d\n", in cxd2841er_shutdown_to_sleep_s()
806 __func__, priv->xtal); in cxd2841er_shutdown_to_sleep_s()
811 cxd2841er_write_reg(priv, I2C_SLVX, 0x17, 0x0a); in cxd2841er_shutdown_to_sleep_s()
813 cxd2841er_write_reg(priv, I2C_SLVX, 0x10, 0x00); in cxd2841er_shutdown_to_sleep_s()
816 cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x00); in cxd2841er_shutdown_to_sleep_s()
818 cxd2841er_write_reg(priv, I2C_SLVT, 0x80, 0x1F); in cxd2841er_shutdown_to_sleep_s()
820 cxd2841er_write_reg(priv, I2C_SLVT, 0x9C, 0x40); in cxd2841er_shutdown_to_sleep_s()
822 cxd2841er_write_reg(priv, I2C_SLVT, 0x43, 0x0a); in cxd2841er_shutdown_to_sleep_s()
823 cxd2841er_write_reg(priv, I2C_SLVT, 0x41, 0x0a); in cxd2841er_shutdown_to_sleep_s()
825 cxd2841er_write_reg(priv, I2C_SLVT, 0x63, 0x16); in cxd2841er_shutdown_to_sleep_s()
826 cxd2841er_write_reg(priv, I2C_SLVT, 0x65, 0x27); in cxd2841er_shutdown_to_sleep_s()
827 cxd2841er_write_reg(priv, I2C_SLVT, 0x69, 0x06); in cxd2841er_shutdown_to_sleep_s()
828 priv->state = STATE_SLEEP_S; in cxd2841er_shutdown_to_sleep_s()
832 static int cxd2841er_shutdown_to_sleep_tc(struct cxd2841er_priv *priv) in cxd2841er_shutdown_to_sleep_tc() argument
836 dev_dbg(&priv->i2c->dev, "%s()\n", __func__); in cxd2841er_shutdown_to_sleep_tc()
837 if (priv->state != STATE_SHUTDOWN) { in cxd2841er_shutdown_to_sleep_tc()
838 dev_dbg(&priv->i2c->dev, "%s(): invalid demod state %d\n", in cxd2841er_shutdown_to_sleep_tc()
839 __func__, priv->state); in cxd2841er_shutdown_to_sleep_tc()
843 cxd2841er_write_reg(priv, I2C_SLVX, 0x00, 0x00); in cxd2841er_shutdown_to_sleep_tc()
845 cxd2841er_write_reg(priv, I2C_SLVX, 0x02, 0x00); in cxd2841er_shutdown_to_sleep_tc()
848 cxd2841er_write_reg(priv, I2C_SLVX, 0x00, 0x00); in cxd2841er_shutdown_to_sleep_tc()
850 cxd2841er_write_reg(priv, I2C_SLVX, 0x10, 0x01); in cxd2841er_shutdown_to_sleep_tc()
852 cxd2841er_write_reg(priv, I2C_SLVX, 0x13, 0x00); in cxd2841er_shutdown_to_sleep_tc()
854 switch (priv->xtal) { in cxd2841er_shutdown_to_sleep_tc()
860 cxd2841er_write_reg(priv, I2C_SLVX, 0x12, 0x00); in cxd2841er_shutdown_to_sleep_tc()
864 cxd2841er_write_reg(priv, I2C_SLVX, 0x12, 0x00); in cxd2841er_shutdown_to_sleep_tc()
868 cxd2841er_write_reg(priv, I2C_SLVX, 0x14, data); in cxd2841er_shutdown_to_sleep_tc()
870 cxd2841er_write_reg(priv, I2C_SLVX, 0x10, 0x00); in cxd2841er_shutdown_to_sleep_tc()
873 cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x00); in cxd2841er_shutdown_to_sleep_tc()
875 cxd2841er_write_reg(priv, I2C_SLVT, 0x43, 0x0a); in cxd2841er_shutdown_to_sleep_tc()
876 cxd2841er_write_reg(priv, I2C_SLVT, 0x41, 0x0a); in cxd2841er_shutdown_to_sleep_tc()
878 cxd2841er_write_reg(priv, I2C_SLVT, 0x63, 0x16); in cxd2841er_shutdown_to_sleep_tc()
879 cxd2841er_write_reg(priv, I2C_SLVT, 0x65, 0x27); in cxd2841er_shutdown_to_sleep_tc()
880 cxd2841er_write_reg(priv, I2C_SLVT, 0x69, 0x06); in cxd2841er_shutdown_to_sleep_tc()
881 priv->state = STATE_SLEEP_TC; in cxd2841er_shutdown_to_sleep_tc()
885 static int cxd2841er_tune_done(struct cxd2841er_priv *priv) in cxd2841er_tune_done() argument
887 dev_dbg(&priv->i2c->dev, "%s()\n", __func__); in cxd2841er_tune_done()
889 cxd2841er_write_reg(priv, I2C_SLVT, 0, 0); in cxd2841er_tune_done()
891 cxd2841er_write_reg(priv, I2C_SLVT, 0xfe, 0x01); in cxd2841er_tune_done()
893 cxd2841er_write_reg(priv, I2C_SLVT, 0xc3, 0x00); in cxd2841er_tune_done()
898 static void cxd2841er_set_ts_clock_mode(struct cxd2841er_priv *priv, in cxd2841er_set_ts_clock_mode() argument
903 dev_dbg(&priv->i2c->dev, "%s()\n", __func__); in cxd2841er_set_ts_clock_mode()
905 cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x00); in cxd2841er_set_ts_clock_mode()
906 cxd2841er_read_reg(priv, I2C_SLVT, 0xc4, &serial_ts); in cxd2841er_set_ts_clock_mode()
907 cxd2841er_read_reg(priv, I2C_SLVT, 0xd3, &ts_rate_ctrl_off); in cxd2841er_set_ts_clock_mode()
908 cxd2841er_read_reg(priv, I2C_SLVT, 0xde, &ts_in_off); in cxd2841er_set_ts_clock_mode()
909 dev_dbg(&priv->i2c->dev, "%s(): ser_ts=0x%02x rate_ctrl_off=0x%02x in_off=0x%02x\n", in cxd2841er_set_ts_clock_mode()
916 cxd2841er_set_reg_bits(priv, I2C_SLVT, 0xc4, in cxd2841er_set_ts_clock_mode()
917 ((priv->flags & CXD2841ER_TS_SERIAL) ? 0x01 : 0x00), 0x03); in cxd2841er_set_ts_clock_mode()
922 cxd2841er_set_reg_bits(priv, I2C_SLVT, 0xd1, in cxd2841er_set_ts_clock_mode()
923 ((priv->flags & CXD2841ER_TS_SERIAL) ? 0x01 : 0x00), 0x03); in cxd2841er_set_ts_clock_mode()
928 cxd2841er_write_reg(priv, I2C_SLVT, 0xd9, 0x08); in cxd2841er_set_ts_clock_mode()
934 cxd2841er_set_reg_bits(priv, I2C_SLVT, 0x32, 0x00, 0x01); in cxd2841er_set_ts_clock_mode()
939 cxd2841er_set_reg_bits(priv, I2C_SLVT, 0x33, in cxd2841er_set_ts_clock_mode()
940 ((priv->flags & CXD2841ER_TS_SERIAL) ? 0x01 : 0x00), 0x03); in cxd2841er_set_ts_clock_mode()
946 cxd2841er_set_reg_bits(priv, I2C_SLVT, 0x32, 0x01, 0x01); in cxd2841er_set_ts_clock_mode()
950 cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x10); in cxd2841er_set_ts_clock_mode()
951 cxd2841er_set_reg_bits(priv, I2C_SLVT, 0x66, 0x01, 0x01); in cxd2841er_set_ts_clock_mode()
954 cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x40); in cxd2841er_set_ts_clock_mode()
955 cxd2841er_set_reg_bits(priv, I2C_SLVT, 0x66, 0x01, 0x01); in cxd2841er_set_ts_clock_mode()
959 static u8 cxd2841er_chip_id(struct cxd2841er_priv *priv) in cxd2841er_chip_id() argument
963 dev_dbg(&priv->i2c->dev, "%s()\n", __func__); in cxd2841er_chip_id()
964 if (cxd2841er_write_reg(priv, I2C_SLVT, 0, 0) == 0) in cxd2841er_chip_id()
965 cxd2841er_read_reg(priv, I2C_SLVT, 0xfd, &chip_id); in cxd2841er_chip_id()
966 else if (cxd2841er_write_reg(priv, I2C_SLVX, 0, 0) == 0) in cxd2841er_chip_id()
967 cxd2841er_read_reg(priv, I2C_SLVX, 0xfd, &chip_id); in cxd2841er_chip_id()
976 struct cxd2841er_priv *priv = fe->demodulator_priv; in cxd2841er_read_status_s() local
978 dev_dbg(&priv->i2c->dev, "%s()\n", __func__); in cxd2841er_read_status_s()
980 if (priv->state != STATE_ACTIVE_S) { in cxd2841er_read_status_s()
981 dev_err(&priv->i2c->dev, "%s(): invalid state %d\n", in cxd2841er_read_status_s()
982 __func__, priv->state); in cxd2841er_read_status_s()
986 cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0xa0); in cxd2841er_read_status_s()
991 cxd2841er_read_reg(priv, I2C_SLVT, 0x11, ®); in cxd2841er_read_status_s()
999 dev_dbg(&priv->i2c->dev, "%s(): result 0x%x\n", __func__, *status); in cxd2841er_read_status_s()
1003 static int cxd2841er_read_status_t_t2(struct cxd2841er_priv *priv, in cxd2841er_read_status_t_t2() argument
1008 dev_dbg(&priv->i2c->dev, "%s()\n", __func__); in cxd2841er_read_status_t_t2()
1009 if (priv->state != STATE_ACTIVE_TC) in cxd2841er_read_status_t_t2()
1011 if (priv->system == SYS_DVBT) { in cxd2841er_read_status_t_t2()
1013 cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x10); in cxd2841er_read_status_t_t2()
1016 cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x20); in cxd2841er_read_status_t_t2()
1018 cxd2841er_read_reg(priv, I2C_SLVT, 0x10, &data); in cxd2841er_read_status_t_t2()
1020 dev_dbg(&priv->i2c->dev, in cxd2841er_read_status_t_t2()
1033 static int cxd2841er_read_status_c(struct cxd2841er_priv *priv, u8 *tslock) in cxd2841er_read_status_c() argument
1037 dev_dbg(&priv->i2c->dev, "%s()\n", __func__); in cxd2841er_read_status_c()
1038 if (priv->state != STATE_ACTIVE_TC) in cxd2841er_read_status_c()
1040 cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x40); in cxd2841er_read_status_c()
1041 cxd2841er_read_reg(priv, I2C_SLVT, 0x88, &data); in cxd2841er_read_status_c()
1045 cxd2841er_read_reg(priv, I2C_SLVT, 0x10, &data); in cxd2841er_read_status_c()
1051 static int cxd2841er_read_status_i(struct cxd2841er_priv *priv, in cxd2841er_read_status_i() argument
1056 dev_dbg(&priv->i2c->dev, "%s()\n", __func__); in cxd2841er_read_status_i()
1057 if (priv->state != STATE_ACTIVE_TC) in cxd2841er_read_status_i()
1060 cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x60); in cxd2841er_read_status_i()
1061 cxd2841er_read_reg(priv, I2C_SLVT, 0x10, &data); in cxd2841er_read_status_i()
1062 dev_dbg(&priv->i2c->dev, in cxd2841er_read_status_i()
1077 struct cxd2841er_priv *priv = fe->demodulator_priv; in cxd2841er_read_status_tc() local
1080 if (priv->state == STATE_ACTIVE_TC) { in cxd2841er_read_status_tc()
1081 if (priv->system == SYS_DVBT || priv->system == SYS_DVBT2) { in cxd2841er_read_status_tc()
1083 priv, &sync, &tslock, &unlock); in cxd2841er_read_status_tc()
1095 } else if (priv->system == SYS_ISDBT) { in cxd2841er_read_status_tc()
1097 priv, &sync, &tslock, &unlock); in cxd2841er_read_status_tc()
1109 } else if (priv->system == SYS_DVBC_ANNEX_A) { in cxd2841er_read_status_tc()
1110 ret = cxd2841er_read_status_c(priv, &tslock); in cxd2841er_read_status_tc()
1122 dev_dbg(&priv->i2c->dev, "%s(): status 0x%x\n", __func__, *status); in cxd2841er_read_status_tc()
1126 static int cxd2841er_get_carrier_offset_s_s2(struct cxd2841er_priv *priv, in cxd2841er_get_carrier_offset_s_s2() argument
1134 if (priv->state != STATE_ACTIVE_S) { in cxd2841er_get_carrier_offset_s_s2()
1135 dev_dbg(&priv->i2c->dev, "%s(): invalid state %d\n", in cxd2841er_get_carrier_offset_s_s2()
1136 __func__, priv->state); in cxd2841er_get_carrier_offset_s_s2()
1144 cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0xa0); in cxd2841er_get_carrier_offset_s_s2()
1145 cxd2841er_read_reg(priv, I2C_SLVT, 0x10, &data[0]); in cxd2841er_get_carrier_offset_s_s2()
1151 cxd2841er_read_reg(priv, I2C_SLVT, 0x50, &data[0]); in cxd2841er_get_carrier_offset_s_s2()
1154 dev_dbg(&priv->i2c->dev, in cxd2841er_get_carrier_offset_s_s2()
1165 cxd2841er_read_regs(priv, I2C_SLVT, 0x45, data, 3); in cxd2841er_get_carrier_offset_s_s2()
1185 static int cxd2841er_get_carrier_offset_i(struct cxd2841er_priv *priv, in cxd2841er_get_carrier_offset_i() argument
1190 dev_dbg(&priv->i2c->dev, "%s()\n", __func__); in cxd2841er_get_carrier_offset_i()
1191 if (priv->state != STATE_ACTIVE_TC) { in cxd2841er_get_carrier_offset_i()
1192 dev_dbg(&priv->i2c->dev, "%s(): invalid state %d\n", in cxd2841er_get_carrier_offset_i()
1193 __func__, priv->state); in cxd2841er_get_carrier_offset_i()
1196 if (priv->system != SYS_ISDBT) { in cxd2841er_get_carrier_offset_i()
1197 dev_dbg(&priv->i2c->dev, "%s(): invalid delivery system %d\n", in cxd2841er_get_carrier_offset_i()
1198 __func__, priv->system); in cxd2841er_get_carrier_offset_i()
1201 cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x60); in cxd2841er_get_carrier_offset_i()
1202 cxd2841er_read_regs(priv, I2C_SLVT, 0x4c, data, sizeof(data)); in cxd2841er_get_carrier_offset_i()
1218 dev_dbg(&priv->i2c->dev, "%s(): invalid bandwidth %d\n", in cxd2841er_get_carrier_offset_i()
1223 dev_dbg(&priv->i2c->dev, "%s(): bandwidth %d offset %d\n", in cxd2841er_get_carrier_offset_i()
1229 static int cxd2841er_get_carrier_offset_t(struct cxd2841er_priv *priv, in cxd2841er_get_carrier_offset_t() argument
1234 dev_dbg(&priv->i2c->dev, "%s()\n", __func__); in cxd2841er_get_carrier_offset_t()
1235 if (priv->state != STATE_ACTIVE_TC) { in cxd2841er_get_carrier_offset_t()
1236 dev_dbg(&priv->i2c->dev, "%s(): invalid state %d\n", in cxd2841er_get_carrier_offset_t()
1237 __func__, priv->state); in cxd2841er_get_carrier_offset_t()
1240 if (priv->system != SYS_DVBT) { in cxd2841er_get_carrier_offset_t()
1241 dev_dbg(&priv->i2c->dev, "%s(): invalid delivery system %d\n", in cxd2841er_get_carrier_offset_t()
1242 __func__, priv->system); in cxd2841er_get_carrier_offset_t()
1245 cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x10); in cxd2841er_get_carrier_offset_t()
1246 cxd2841er_read_regs(priv, I2C_SLVT, 0x4c, data, sizeof(data)); in cxd2841er_get_carrier_offset_t()
1255 static int cxd2841er_get_carrier_offset_t2(struct cxd2841er_priv *priv, in cxd2841er_get_carrier_offset_t2() argument
1260 dev_dbg(&priv->i2c->dev, "%s()\n", __func__); in cxd2841er_get_carrier_offset_t2()
1261 if (priv->state != STATE_ACTIVE_TC) { in cxd2841er_get_carrier_offset_t2()
1262 dev_dbg(&priv->i2c->dev, "%s(): invalid state %d\n", in cxd2841er_get_carrier_offset_t2()
1263 __func__, priv->state); in cxd2841er_get_carrier_offset_t2()
1266 if (priv->system != SYS_DVBT2) { in cxd2841er_get_carrier_offset_t2()
1267 dev_dbg(&priv->i2c->dev, "%s(): invalid delivery system %d\n", in cxd2841er_get_carrier_offset_t2()
1268 __func__, priv->system); in cxd2841er_get_carrier_offset_t2()
1271 cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x20); in cxd2841er_get_carrier_offset_t2()
1272 cxd2841er_read_regs(priv, I2C_SLVT, 0x4c, data, sizeof(data)); in cxd2841er_get_carrier_offset_t2()
1288 dev_dbg(&priv->i2c->dev, "%s(): invalid bandwidth %d\n", in cxd2841er_get_carrier_offset_t2()
1295 static int cxd2841er_get_carrier_offset_c(struct cxd2841er_priv *priv, in cxd2841er_get_carrier_offset_c() argument
1300 dev_dbg(&priv->i2c->dev, "%s()\n", __func__); in cxd2841er_get_carrier_offset_c()
1301 if (priv->state != STATE_ACTIVE_TC) { in cxd2841er_get_carrier_offset_c()
1302 dev_dbg(&priv->i2c->dev, "%s(): invalid state %d\n", in cxd2841er_get_carrier_offset_c()
1303 __func__, priv->state); in cxd2841er_get_carrier_offset_c()
1306 if (priv->system != SYS_DVBC_ANNEX_A) { in cxd2841er_get_carrier_offset_c()
1307 dev_dbg(&priv->i2c->dev, "%s(): invalid delivery system %d\n", in cxd2841er_get_carrier_offset_c()
1308 __func__, priv->system); in cxd2841er_get_carrier_offset_c()
1311 cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x40); in cxd2841er_get_carrier_offset_c()
1312 cxd2841er_read_regs(priv, I2C_SLVT, 0x15, data, sizeof(data)); in cxd2841er_get_carrier_offset_c()
1319 struct cxd2841er_priv *priv, u32 *penum) in cxd2841er_read_packet_errors_c() argument
1324 if (priv->state != STATE_ACTIVE_TC) { in cxd2841er_read_packet_errors_c()
1325 dev_dbg(&priv->i2c->dev, "%s(): invalid state %d\n", in cxd2841er_read_packet_errors_c()
1326 __func__, priv->state); in cxd2841er_read_packet_errors_c()
1329 cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x40); in cxd2841er_read_packet_errors_c()
1330 cxd2841er_read_regs(priv, I2C_SLVT, 0xea, data, sizeof(data)); in cxd2841er_read_packet_errors_c()
1337 struct cxd2841er_priv *priv, u32 *penum) in cxd2841er_read_packet_errors_t() argument
1342 if (priv->state != STATE_ACTIVE_TC) { in cxd2841er_read_packet_errors_t()
1343 dev_dbg(&priv->i2c->dev, "%s(): invalid state %d\n", in cxd2841er_read_packet_errors_t()
1344 __func__, priv->state); in cxd2841er_read_packet_errors_t()
1347 cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x10); in cxd2841er_read_packet_errors_t()
1348 cxd2841er_read_regs(priv, I2C_SLVT, 0xea, data, sizeof(data)); in cxd2841er_read_packet_errors_t()
1355 struct cxd2841er_priv *priv, u32 *penum) in cxd2841er_read_packet_errors_t2() argument
1360 if (priv->state != STATE_ACTIVE_TC) { in cxd2841er_read_packet_errors_t2()
1361 dev_dbg(&priv->i2c->dev, "%s(): invalid state %d\n", in cxd2841er_read_packet_errors_t2()
1362 __func__, priv->state); in cxd2841er_read_packet_errors_t2()
1365 cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x24); in cxd2841er_read_packet_errors_t2()
1366 cxd2841er_read_regs(priv, I2C_SLVT, 0xfd, data, sizeof(data)); in cxd2841er_read_packet_errors_t2()
1373 struct cxd2841er_priv *priv, u32 *penum) in cxd2841er_read_packet_errors_i() argument
1378 if (priv->state != STATE_ACTIVE_TC) { in cxd2841er_read_packet_errors_i()
1379 dev_dbg(&priv->i2c->dev, "%s(): invalid state %d\n", in cxd2841er_read_packet_errors_i()
1380 __func__, priv->state); in cxd2841er_read_packet_errors_i()
1383 cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x60); in cxd2841er_read_packet_errors_i()
1384 cxd2841er_read_regs(priv, I2C_SLVT, 0xA1, data, 1); in cxd2841er_read_packet_errors_i()
1390 cxd2841er_read_regs(priv, I2C_SLVT, 0xA2, data, sizeof(data)); in cxd2841er_read_packet_errors_i()
1394 cxd2841er_read_regs(priv, I2C_SLVT, 0xA4, data, sizeof(data)); in cxd2841er_read_packet_errors_i()
1398 cxd2841er_read_regs(priv, I2C_SLVT, 0xA6, data, sizeof(data)); in cxd2841er_read_packet_errors_i()
1404 static int cxd2841er_read_ber_c(struct cxd2841er_priv *priv, in cxd2841er_read_ber_c() argument
1410 dev_dbg(&priv->i2c->dev, "%s()\n", __func__); in cxd2841er_read_ber_c()
1411 if (priv->state != STATE_ACTIVE_TC) { in cxd2841er_read_ber_c()
1412 dev_dbg(&priv->i2c->dev, "%s(): invalid state %d\n", in cxd2841er_read_ber_c()
1413 __func__, priv->state); in cxd2841er_read_ber_c()
1416 cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x40); in cxd2841er_read_ber_c()
1417 cxd2841er_read_regs(priv, I2C_SLVT, 0x62, data, sizeof(data)); in cxd2841er_read_ber_c()
1419 dev_dbg(&priv->i2c->dev, in cxd2841er_read_ber_c()
1426 cxd2841er_read_reg(priv, I2C_SLVT, 0x60, data); in cxd2841er_read_ber_c()
1430 dev_dbg(&priv->i2c->dev, in cxd2841er_read_ber_c()
1436 dev_dbg(&priv->i2c->dev, in cxd2841er_read_ber_c()
1447 static int cxd2841er_read_ber_i(struct cxd2841er_priv *priv, in cxd2841er_read_ber_i() argument
1453 dev_dbg(&priv->i2c->dev, "%s()\n", __func__); in cxd2841er_read_ber_i()
1454 if (priv->state != STATE_ACTIVE_TC) { in cxd2841er_read_ber_i()
1455 dev_dbg(&priv->i2c->dev, "%s(): invalid state %d\n", in cxd2841er_read_ber_i()
1456 __func__, priv->state); in cxd2841er_read_ber_i()
1460 cxd2841er_freeze_regs(priv); in cxd2841er_read_ber_i()
1461 cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x60); in cxd2841er_read_ber_i()
1462 cxd2841er_read_regs(priv, I2C_SLVT, 0x5B, pktnum, sizeof(pktnum)); in cxd2841er_read_ber_i()
1463 cxd2841er_read_regs(priv, I2C_SLVT, 0x16, data, sizeof(data)); in cxd2841er_read_ber_i()
1464 cxd2841er_unfreeze_regs(priv); in cxd2841er_read_ber_i()
1467 dev_dbg(&priv->i2c->dev, in cxd2841er_read_ber_i()
1475 dev_dbg(&priv->i2c->dev, "%s(): bit_error=%u bit_count=%u\n", in cxd2841er_read_ber_i()
1481 static int cxd2841er_mon_read_ber_s(struct cxd2841er_priv *priv, in cxd2841er_mon_read_ber_s() argument
1487 cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0xa0); in cxd2841er_mon_read_ber_s()
1498 cxd2841er_read_regs(priv, I2C_SLVT, 0x35, data, 11); in cxd2841er_mon_read_ber_s()
1507 dev_dbg(&priv->i2c->dev, in cxd2841er_mon_read_ber_s()
1514 dev_dbg(&priv->i2c->dev, "%s(): no data available\n", __func__); in cxd2841er_mon_read_ber_s()
1519 static int cxd2841er_mon_read_ber_s2(struct cxd2841er_priv *priv, in cxd2841er_mon_read_ber_s2() argument
1526 cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0xb2); in cxd2841er_mon_read_ber_s2()
1535 cxd2841er_read_regs(priv, I2C_SLVT, 0x30, data, 5); in cxd2841er_mon_read_ber_s2()
1544 cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0xa0); in cxd2841er_mon_read_ber_s2()
1545 cxd2841er_read_reg(priv, I2C_SLVT, 0x7a, data); in cxd2841er_mon_read_ber_s2()
1549 dev_dbg(&priv->i2c->dev, in cxd2841er_mon_read_ber_s2()
1554 dev_dbg(&priv->i2c->dev, in cxd2841er_mon_read_ber_s2()
1563 dev_dbg(&priv->i2c->dev, in cxd2841er_mon_read_ber_s2()
1569 static int cxd2841er_read_ber_t2(struct cxd2841er_priv *priv, in cxd2841er_read_ber_t2() argument
1575 if (priv->state != STATE_ACTIVE_TC) { in cxd2841er_read_ber_t2()
1576 dev_dbg(&priv->i2c->dev, in cxd2841er_read_ber_t2()
1577 "%s(): invalid state %d\n", __func__, priv->state); in cxd2841er_read_ber_t2()
1580 cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x20); in cxd2841er_read_ber_t2()
1581 cxd2841er_read_regs(priv, I2C_SLVT, 0x39, data, sizeof(data)); in cxd2841er_read_ber_t2()
1583 dev_dbg(&priv->i2c->dev, in cxd2841er_read_ber_t2()
1591 cxd2841er_read_reg(priv, I2C_SLVT, 0x6f, data); in cxd2841er_read_ber_t2()
1593 cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x22); in cxd2841er_read_ber_t2()
1594 cxd2841er_read_reg(priv, I2C_SLVT, 0x5e, data); in cxd2841er_read_ber_t2()
1597 dev_dbg(&priv->i2c->dev, in cxd2841er_read_ber_t2()
1617 static int cxd2841er_read_ber_t(struct cxd2841er_priv *priv, in cxd2841er_read_ber_t() argument
1623 if (priv->state != STATE_ACTIVE_TC) { in cxd2841er_read_ber_t()
1624 dev_dbg(&priv->i2c->dev, in cxd2841er_read_ber_t()
1625 "%s(): invalid state %d\n", __func__, priv->state); in cxd2841er_read_ber_t()
1628 cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x10); in cxd2841er_read_ber_t()
1629 cxd2841er_read_reg(priv, I2C_SLVT, 0x39, data); in cxd2841er_read_ber_t()
1631 dev_dbg(&priv->i2c->dev, in cxd2841er_read_ber_t()
1635 cxd2841er_read_regs(priv, I2C_SLVT, 0x22, data, sizeof(data)); in cxd2841er_read_ber_t()
1637 cxd2841er_read_reg(priv, I2C_SLVT, 0x6f, data); in cxd2841er_read_ber_t()
1650 static int cxd2841er_freeze_regs(struct cxd2841er_priv *priv) in cxd2841er_freeze_regs() argument
1656 cxd2841er_write_reg(priv, I2C_SLVT, 0x01, 0x01); in cxd2841er_freeze_regs()
1660 static int cxd2841er_unfreeze_regs(struct cxd2841er_priv *priv) in cxd2841er_unfreeze_regs() argument
1665 cxd2841er_write_reg(priv, I2C_SLVT, 0x01, 0x00); in cxd2841er_unfreeze_regs()
1669 static u32 cxd2841er_dvbs_read_snr(struct cxd2841er_priv *priv, in cxd2841er_dvbs_read_snr() argument
1677 cxd2841er_freeze_regs(priv); in cxd2841er_dvbs_read_snr()
1679 cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0xa1); in cxd2841er_dvbs_read_snr()
1686 cxd2841er_read_regs(priv, I2C_SLVT, 0x10, data, 3); in cxd2841er_dvbs_read_snr()
1687 cxd2841er_unfreeze_regs(priv); in cxd2841er_dvbs_read_snr()
1727 dev_dbg(&priv->i2c->dev, in cxd2841er_dvbs_read_snr()
1741 static int cxd2841er_read_snr_c(struct cxd2841er_priv *priv, u32 *snr) in cxd2841er_read_snr_c() argument
1748 if (priv->state != STATE_ACTIVE_TC) { in cxd2841er_read_snr_c()
1749 dev_dbg(&priv->i2c->dev, in cxd2841er_read_snr_c()
1751 __func__, priv->state); in cxd2841er_read_snr_c()
1755 cxd2841er_freeze_regs(priv); in cxd2841er_read_snr_c()
1756 cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x40); in cxd2841er_read_snr_c()
1757 cxd2841er_read_regs(priv, I2C_SLVT, 0x19, data, 1); in cxd2841er_read_snr_c()
1759 cxd2841er_read_regs(priv, I2C_SLVT, 0x4C, data, 2); in cxd2841er_read_snr_c()
1760 cxd2841er_unfreeze_regs(priv); in cxd2841er_read_snr_c()
1764 dev_dbg(&priv->i2c->dev, in cxd2841er_read_snr_c()
1792 static int cxd2841er_read_snr_t(struct cxd2841er_priv *priv, u32 *snr) in cxd2841er_read_snr_t() argument
1798 if (priv->state != STATE_ACTIVE_TC) { in cxd2841er_read_snr_t()
1799 dev_dbg(&priv->i2c->dev, in cxd2841er_read_snr_t()
1800 "%s(): invalid state %d\n", __func__, priv->state); in cxd2841er_read_snr_t()
1804 cxd2841er_freeze_regs(priv); in cxd2841er_read_snr_t()
1805 cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x10); in cxd2841er_read_snr_t()
1806 cxd2841er_read_regs(priv, I2C_SLVT, 0x28, data, sizeof(data)); in cxd2841er_read_snr_t()
1807 cxd2841er_unfreeze_regs(priv); in cxd2841er_read_snr_t()
1811 dev_dbg(&priv->i2c->dev, in cxd2841er_read_snr_t()
1821 static int cxd2841er_read_snr_t2(struct cxd2841er_priv *priv, u32 *snr) in cxd2841er_read_snr_t2() argument
1827 if (priv->state != STATE_ACTIVE_TC) { in cxd2841er_read_snr_t2()
1828 dev_dbg(&priv->i2c->dev, in cxd2841er_read_snr_t2()
1829 "%s(): invalid state %d\n", __func__, priv->state); in cxd2841er_read_snr_t2()
1833 cxd2841er_freeze_regs(priv); in cxd2841er_read_snr_t2()
1834 cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x20); in cxd2841er_read_snr_t2()
1835 cxd2841er_read_regs(priv, I2C_SLVT, 0x28, data, sizeof(data)); in cxd2841er_read_snr_t2()
1836 cxd2841er_unfreeze_regs(priv); in cxd2841er_read_snr_t2()
1840 dev_dbg(&priv->i2c->dev, in cxd2841er_read_snr_t2()
1850 static int cxd2841er_read_snr_i(struct cxd2841er_priv *priv, u32 *snr) in cxd2841er_read_snr_i() argument
1856 if (priv->state != STATE_ACTIVE_TC) { in cxd2841er_read_snr_i()
1857 dev_dbg(&priv->i2c->dev, in cxd2841er_read_snr_i()
1859 priv->state); in cxd2841er_read_snr_i()
1863 cxd2841er_freeze_regs(priv); in cxd2841er_read_snr_i()
1864 cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x60); in cxd2841er_read_snr_i()
1865 cxd2841er_read_regs(priv, I2C_SLVT, 0x28, data, sizeof(data)); in cxd2841er_read_snr_i()
1866 cxd2841er_unfreeze_regs(priv); in cxd2841er_read_snr_i()
1870 dev_dbg(&priv->i2c->dev, in cxd2841er_read_snr_i()
1878 static u16 cxd2841er_read_agc_gain_c(struct cxd2841er_priv *priv, in cxd2841er_read_agc_gain_c() argument
1884 priv, I2C_SLVT, 0x00, 0x40); in cxd2841er_read_agc_gain_c()
1885 cxd2841er_read_regs(priv, I2C_SLVT, 0x49, data, 2); in cxd2841er_read_agc_gain_c()
1886 dev_dbg(&priv->i2c->dev, in cxd2841er_read_agc_gain_c()
1893 static u16 cxd2841er_read_agc_gain_t_t2(struct cxd2841er_priv *priv, in cxd2841er_read_agc_gain_t_t2() argument
1899 priv, I2C_SLVT, 0x00, (delsys == SYS_DVBT ? 0x10 : 0x20)); in cxd2841er_read_agc_gain_t_t2()
1900 cxd2841er_read_regs(priv, I2C_SLVT, 0x26, data, 2); in cxd2841er_read_agc_gain_t_t2()
1901 dev_dbg(&priv->i2c->dev, in cxd2841er_read_agc_gain_t_t2()
1908 static u16 cxd2841er_read_agc_gain_i(struct cxd2841er_priv *priv, in cxd2841er_read_agc_gain_i() argument
1914 priv, I2C_SLVT, 0x00, 0x60); in cxd2841er_read_agc_gain_i()
1915 cxd2841er_read_regs(priv, I2C_SLVT, 0x26, data, 2); in cxd2841er_read_agc_gain_i()
1917 dev_dbg(&priv->i2c->dev, in cxd2841er_read_agc_gain_i()
1924 static u16 cxd2841er_read_agc_gain_s(struct cxd2841er_priv *priv) in cxd2841er_read_agc_gain_s() argument
1929 cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0xa0); in cxd2841er_read_agc_gain_s()
1935 cxd2841er_read_regs(priv, I2C_SLVT, 0x1f, data, 2); in cxd2841er_read_agc_gain_s()
1942 struct cxd2841er_priv *priv = fe->demodulator_priv; in cxd2841er_read_ber() local
1945 dev_dbg(&priv->i2c->dev, "%s()\n", __func__); in cxd2841er_read_ber()
1950 ret = cxd2841er_read_ber_c(priv, &bit_error, &bit_count); in cxd2841er_read_ber()
1953 ret = cxd2841er_read_ber_i(priv, &bit_error, &bit_count); in cxd2841er_read_ber()
1956 ret = cxd2841er_mon_read_ber_s(priv, &bit_error, &bit_count); in cxd2841er_read_ber()
1959 ret = cxd2841er_mon_read_ber_s2(priv, &bit_error, &bit_count); in cxd2841er_read_ber()
1962 ret = cxd2841er_read_ber_t(priv, &bit_error, &bit_count); in cxd2841er_read_ber()
1965 ret = cxd2841er_read_ber_t2(priv, &bit_error, &bit_count); in cxd2841er_read_ber()
1987 struct cxd2841er_priv *priv = fe->demodulator_priv; in cxd2841er_read_signal_strength() local
1990 dev_dbg(&priv->i2c->dev, "%s()\n", __func__); in cxd2841er_read_signal_strength()
1994 strength = cxd2841er_read_agc_gain_t_t2(priv, in cxd2841er_read_signal_strength()
2003 strength = cxd2841er_read_agc_gain_c(priv, in cxd2841er_read_signal_strength()
2014 strength = cxd2841er_read_agc_gain_i(priv, p->delivery_system); in cxd2841er_read_signal_strength()
2024 strength = 65535 - cxd2841er_read_agc_gain_s(priv); in cxd2841er_read_signal_strength()
2039 struct cxd2841er_priv *priv = fe->demodulator_priv; in cxd2841er_read_snr() local
2041 dev_dbg(&priv->i2c->dev, "%s()\n", __func__); in cxd2841er_read_snr()
2046 ret = cxd2841er_read_snr_c(priv, &tmp); in cxd2841er_read_snr()
2049 ret = cxd2841er_read_snr_t(priv, &tmp); in cxd2841er_read_snr()
2052 ret = cxd2841er_read_snr_t2(priv, &tmp); in cxd2841er_read_snr()
2055 ret = cxd2841er_read_snr_i(priv, &tmp); in cxd2841er_read_snr()
2059 ret = cxd2841er_dvbs_read_snr(priv, p->delivery_system, &tmp); in cxd2841er_read_snr()
2062 dev_dbg(&priv->i2c->dev, "%s(): unknown delivery system %d\n", in cxd2841er_read_snr()
2068 dev_dbg(&priv->i2c->dev, "%s(): snr=%d\n", in cxd2841er_read_snr()
2082 struct cxd2841er_priv *priv = fe->demodulator_priv; in cxd2841er_read_ucblocks() local
2085 dev_dbg(&priv->i2c->dev, "%s()\n", __func__); in cxd2841er_read_ucblocks()
2090 cxd2841er_read_packet_errors_c(priv, &ucblocks); in cxd2841er_read_ucblocks()
2093 cxd2841er_read_packet_errors_t(priv, &ucblocks); in cxd2841er_read_ucblocks()
2096 cxd2841er_read_packet_errors_t2(priv, &ucblocks); in cxd2841er_read_ucblocks()
2099 cxd2841er_read_packet_errors_i(priv, &ucblocks); in cxd2841er_read_ucblocks()
2105 dev_dbg(&priv->i2c->dev, "%s() ucblocks=%u\n", __func__, ucblocks); in cxd2841er_read_ucblocks()
2112 struct cxd2841er_priv *priv, enum cxd2841er_dvbt2_profile_t profile) in cxd2841er_dvbt2_set_profile() argument
2117 dev_dbg(&priv->i2c->dev, "%s()\n", __func__); in cxd2841er_dvbt2_set_profile()
2122 seq_not2d_time = (priv->xtal == SONY_XTAL_24000)?0x0E:0x0C; in cxd2841er_dvbt2_set_profile()
2127 seq_not2d_time = (priv->xtal == SONY_XTAL_24000)?0x2E:0x28; in cxd2841er_dvbt2_set_profile()
2132 seq_not2d_time = (priv->xtal == SONY_XTAL_24000)?0x2E:0x28; in cxd2841er_dvbt2_set_profile()
2138 cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x2e); in cxd2841er_dvbt2_set_profile()
2140 cxd2841er_set_reg_bits(priv, I2C_SLVT, 0x10, tune_mode, 0x07); in cxd2841er_dvbt2_set_profile()
2142 cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x2b); in cxd2841er_dvbt2_set_profile()
2144 cxd2841er_write_reg(priv, I2C_SLVT, 0x9d, seq_not2d_time); in cxd2841er_dvbt2_set_profile()
2148 static int cxd2841er_dvbt2_set_plp_config(struct cxd2841er_priv *priv, in cxd2841er_dvbt2_set_plp_config() argument
2152 dev_dbg(&priv->i2c->dev, in cxd2841er_dvbt2_set_plp_config()
2155 dev_dbg(&priv->i2c->dev, in cxd2841er_dvbt2_set_plp_config()
2160 cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x23); in cxd2841er_dvbt2_set_plp_config()
2163 cxd2841er_write_reg(priv, I2C_SLVT, 0xaf, plp_id); in cxd2841er_dvbt2_set_plp_config()
2166 cxd2841er_write_reg(priv, I2C_SLVT, 0xad, (is_auto ? 0x00 : 0x01)); in cxd2841er_dvbt2_set_plp_config()
2170 static int cxd2841er_sleep_tc_to_active_t2_band(struct cxd2841er_priv *priv, in cxd2841er_sleep_tc_to_active_t2_band() argument
2257 cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x20); in cxd2841er_sleep_tc_to_active_t2_band()
2262 cxd2841er_write_regs(priv, I2C_SLVT, in cxd2841er_sleep_tc_to_active_t2_band()
2263 0x9F, nominalRate8bw[priv->xtal], 5); in cxd2841er_sleep_tc_to_active_t2_band()
2266 cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x27); in cxd2841er_sleep_tc_to_active_t2_band()
2267 cxd2841er_set_reg_bits(priv, I2C_SLVT, in cxd2841er_sleep_tc_to_active_t2_band()
2271 cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x10); in cxd2841er_sleep_tc_to_active_t2_band()
2276 if (priv->flags & CXD2841ER_ASCOT) in cxd2841er_sleep_tc_to_active_t2_band()
2277 cxd2841er_write_regs(priv, I2C_SLVT, in cxd2841er_sleep_tc_to_active_t2_band()
2278 0xA6, itbCoef8bw[priv->xtal], 14); in cxd2841er_sleep_tc_to_active_t2_band()
2280 ifhz = cxd2841er_get_if_hz(priv, 4800000); in cxd2841er_sleep_tc_to_active_t2_band()
2281 iffreq = cxd2841er_calc_iffreq_xtal(priv->xtal, ifhz); in cxd2841er_sleep_tc_to_active_t2_band()
2285 cxd2841er_write_regs(priv, I2C_SLVT, 0xB6, data, 3); in cxd2841er_sleep_tc_to_active_t2_band()
2288 priv, I2C_SLVT, 0xD7, 0x00, 0x07); in cxd2841er_sleep_tc_to_active_t2_band()
2292 cxd2841er_write_regs(priv, I2C_SLVT, in cxd2841er_sleep_tc_to_active_t2_band()
2293 0x9F, nominalRate7bw[priv->xtal], 5); in cxd2841er_sleep_tc_to_active_t2_band()
2296 cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x27); in cxd2841er_sleep_tc_to_active_t2_band()
2297 cxd2841er_set_reg_bits(priv, I2C_SLVT, in cxd2841er_sleep_tc_to_active_t2_band()
2301 cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x10); in cxd2841er_sleep_tc_to_active_t2_band()
2306 if (priv->flags & CXD2841ER_ASCOT) in cxd2841er_sleep_tc_to_active_t2_band()
2307 cxd2841er_write_regs(priv, I2C_SLVT, in cxd2841er_sleep_tc_to_active_t2_band()
2308 0xA6, itbCoef7bw[priv->xtal], 14); in cxd2841er_sleep_tc_to_active_t2_band()
2310 ifhz = cxd2841er_get_if_hz(priv, 4200000); in cxd2841er_sleep_tc_to_active_t2_band()
2311 iffreq = cxd2841er_calc_iffreq_xtal(priv->xtal, ifhz); in cxd2841er_sleep_tc_to_active_t2_band()
2315 cxd2841er_write_regs(priv, I2C_SLVT, 0xB6, data, 3); in cxd2841er_sleep_tc_to_active_t2_band()
2318 priv, I2C_SLVT, 0xD7, 0x02, 0x07); in cxd2841er_sleep_tc_to_active_t2_band()
2322 cxd2841er_write_regs(priv, I2C_SLVT, in cxd2841er_sleep_tc_to_active_t2_band()
2323 0x9F, nominalRate6bw[priv->xtal], 5); in cxd2841er_sleep_tc_to_active_t2_band()
2326 cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x27); in cxd2841er_sleep_tc_to_active_t2_band()
2327 cxd2841er_set_reg_bits(priv, I2C_SLVT, in cxd2841er_sleep_tc_to_active_t2_band()
2331 cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x10); in cxd2841er_sleep_tc_to_active_t2_band()
2336 if (priv->flags & CXD2841ER_ASCOT) in cxd2841er_sleep_tc_to_active_t2_band()
2337 cxd2841er_write_regs(priv, I2C_SLVT, in cxd2841er_sleep_tc_to_active_t2_band()
2338 0xA6, itbCoef6bw[priv->xtal], 14); in cxd2841er_sleep_tc_to_active_t2_band()
2340 ifhz = cxd2841er_get_if_hz(priv, 3600000); in cxd2841er_sleep_tc_to_active_t2_band()
2341 iffreq = cxd2841er_calc_iffreq_xtal(priv->xtal, ifhz); in cxd2841er_sleep_tc_to_active_t2_band()
2345 cxd2841er_write_regs(priv, I2C_SLVT, 0xB6, data, 3); in cxd2841er_sleep_tc_to_active_t2_band()
2348 priv, I2C_SLVT, 0xD7, 0x04, 0x07); in cxd2841er_sleep_tc_to_active_t2_band()
2352 cxd2841er_write_regs(priv, I2C_SLVT, in cxd2841er_sleep_tc_to_active_t2_band()
2353 0x9F, nominalRate5bw[priv->xtal], 5); in cxd2841er_sleep_tc_to_active_t2_band()
2356 cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x27); in cxd2841er_sleep_tc_to_active_t2_band()
2357 cxd2841er_set_reg_bits(priv, I2C_SLVT, in cxd2841er_sleep_tc_to_active_t2_band()
2361 cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x10); in cxd2841er_sleep_tc_to_active_t2_band()
2366 if (priv->flags & CXD2841ER_ASCOT) in cxd2841er_sleep_tc_to_active_t2_band()
2367 cxd2841er_write_regs(priv, I2C_SLVT, in cxd2841er_sleep_tc_to_active_t2_band()
2368 0xA6, itbCoef5bw[priv->xtal], 14); in cxd2841er_sleep_tc_to_active_t2_band()
2370 ifhz = cxd2841er_get_if_hz(priv, 3600000); in cxd2841er_sleep_tc_to_active_t2_band()
2371 iffreq = cxd2841er_calc_iffreq_xtal(priv->xtal, ifhz); in cxd2841er_sleep_tc_to_active_t2_band()
2375 cxd2841er_write_regs(priv, I2C_SLVT, 0xB6, data, 3); in cxd2841er_sleep_tc_to_active_t2_band()
2378 priv, I2C_SLVT, 0xD7, 0x06, 0x07); in cxd2841er_sleep_tc_to_active_t2_band()
2382 cxd2841er_write_regs(priv, I2C_SLVT, in cxd2841er_sleep_tc_to_active_t2_band()
2383 0x9F, nominalRate17bw[priv->xtal], 5); in cxd2841er_sleep_tc_to_active_t2_band()
2386 cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x27); in cxd2841er_sleep_tc_to_active_t2_band()
2387 cxd2841er_set_reg_bits(priv, I2C_SLVT, in cxd2841er_sleep_tc_to_active_t2_band()
2391 cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x10); in cxd2841er_sleep_tc_to_active_t2_band()
2396 if (priv->flags & CXD2841ER_ASCOT) in cxd2841er_sleep_tc_to_active_t2_band()
2397 cxd2841er_write_regs(priv, I2C_SLVT, in cxd2841er_sleep_tc_to_active_t2_band()
2398 0xA6, itbCoef17bw[priv->xtal], 14); in cxd2841er_sleep_tc_to_active_t2_band()
2400 ifhz = cxd2841er_get_if_hz(priv, 3500000); in cxd2841er_sleep_tc_to_active_t2_band()
2401 iffreq = cxd2841er_calc_iffreq_xtal(priv->xtal, ifhz); in cxd2841er_sleep_tc_to_active_t2_band()
2405 cxd2841er_write_regs(priv, I2C_SLVT, 0xB6, data, 3); in cxd2841er_sleep_tc_to_active_t2_band()
2408 priv, I2C_SLVT, 0xD7, 0x03, 0x07); in cxd2841er_sleep_tc_to_active_t2_band()
2417 struct cxd2841er_priv *priv, u32 bandwidth) in cxd2841er_sleep_tc_to_active_t_band() argument
2480 cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x13); in cxd2841er_sleep_tc_to_active_t_band()
2484 cxd2841er_write_regs(priv, I2C_SLVT, 0x9C, data, 2); in cxd2841er_sleep_tc_to_active_t_band()
2487 cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x10); in cxd2841er_sleep_tc_to_active_t_band()
2492 cxd2841er_write_regs(priv, I2C_SLVT, in cxd2841er_sleep_tc_to_active_t_band()
2493 0x9F, nominalRate8bw[priv->xtal], 5); in cxd2841er_sleep_tc_to_active_t_band()
2497 if (priv->flags & CXD2841ER_ASCOT) in cxd2841er_sleep_tc_to_active_t_band()
2498 cxd2841er_write_regs(priv, I2C_SLVT, in cxd2841er_sleep_tc_to_active_t_band()
2499 0xA6, itbCoef8bw[priv->xtal], 14); in cxd2841er_sleep_tc_to_active_t_band()
2501 ifhz = cxd2841er_get_if_hz(priv, 4800000); in cxd2841er_sleep_tc_to_active_t_band()
2502 iffreq = cxd2841er_calc_iffreq_xtal(priv->xtal, ifhz); in cxd2841er_sleep_tc_to_active_t_band()
2506 cxd2841er_write_regs(priv, I2C_SLVT, 0xB6, data, 3); in cxd2841er_sleep_tc_to_active_t_band()
2509 priv, I2C_SLVT, 0xD7, 0x00, 0x07); in cxd2841er_sleep_tc_to_active_t_band()
2512 if (priv->xtal == SONY_XTAL_24000) { in cxd2841er_sleep_tc_to_active_t_band()
2519 cxd2841er_write_regs(priv, I2C_SLVT, 0xD9, data, 2); in cxd2841er_sleep_tc_to_active_t_band()
2524 cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x17); in cxd2841er_sleep_tc_to_active_t_band()
2525 cxd2841er_write_regs(priv, I2C_SLVT, 0x38, data, 2); in cxd2841er_sleep_tc_to_active_t_band()
2529 cxd2841er_write_regs(priv, I2C_SLVT, in cxd2841er_sleep_tc_to_active_t_band()
2530 0x9F, nominalRate7bw[priv->xtal], 5); in cxd2841er_sleep_tc_to_active_t_band()
2534 if (priv->flags & CXD2841ER_ASCOT) in cxd2841er_sleep_tc_to_active_t_band()
2535 cxd2841er_write_regs(priv, I2C_SLVT, in cxd2841er_sleep_tc_to_active_t_band()
2536 0xA6, itbCoef7bw[priv->xtal], 14); in cxd2841er_sleep_tc_to_active_t_band()
2538 ifhz = cxd2841er_get_if_hz(priv, 4200000); in cxd2841er_sleep_tc_to_active_t_band()
2539 iffreq = cxd2841er_calc_iffreq_xtal(priv->xtal, ifhz); in cxd2841er_sleep_tc_to_active_t_band()
2543 cxd2841er_write_regs(priv, I2C_SLVT, 0xB6, data, 3); in cxd2841er_sleep_tc_to_active_t_band()
2546 priv, I2C_SLVT, 0xD7, 0x02, 0x07); in cxd2841er_sleep_tc_to_active_t_band()
2549 if (priv->xtal == SONY_XTAL_24000) { in cxd2841er_sleep_tc_to_active_t_band()
2556 cxd2841er_write_regs(priv, I2C_SLVT, 0xD9, data, 2); in cxd2841er_sleep_tc_to_active_t_band()
2561 cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x17); in cxd2841er_sleep_tc_to_active_t_band()
2562 cxd2841er_write_regs(priv, I2C_SLVT, 0x38, data, 2); in cxd2841er_sleep_tc_to_active_t_band()
2566 cxd2841er_write_regs(priv, I2C_SLVT, in cxd2841er_sleep_tc_to_active_t_band()
2567 0x9F, nominalRate6bw[priv->xtal], 5); in cxd2841er_sleep_tc_to_active_t_band()
2571 if (priv->flags & CXD2841ER_ASCOT) in cxd2841er_sleep_tc_to_active_t_band()
2572 cxd2841er_write_regs(priv, I2C_SLVT, in cxd2841er_sleep_tc_to_active_t_band()
2573 0xA6, itbCoef6bw[priv->xtal], 14); in cxd2841er_sleep_tc_to_active_t_band()
2575 ifhz = cxd2841er_get_if_hz(priv, 3600000); in cxd2841er_sleep_tc_to_active_t_band()
2576 iffreq = cxd2841er_calc_iffreq_xtal(priv->xtal, ifhz); in cxd2841er_sleep_tc_to_active_t_band()
2580 cxd2841er_write_regs(priv, I2C_SLVT, 0xB6, data, 3); in cxd2841er_sleep_tc_to_active_t_band()
2583 priv, I2C_SLVT, 0xD7, 0x04, 0x07); in cxd2841er_sleep_tc_to_active_t_band()
2586 if (priv->xtal == SONY_XTAL_24000) { in cxd2841er_sleep_tc_to_active_t_band()
2593 cxd2841er_write_regs(priv, I2C_SLVT, 0xD9, data, 2); in cxd2841er_sleep_tc_to_active_t_band()
2598 cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x17); in cxd2841er_sleep_tc_to_active_t_band()
2599 cxd2841er_write_regs(priv, I2C_SLVT, 0x38, data, 2); in cxd2841er_sleep_tc_to_active_t_band()
2603 cxd2841er_write_regs(priv, I2C_SLVT, in cxd2841er_sleep_tc_to_active_t_band()
2604 0x9F, nominalRate5bw[priv->xtal], 5); in cxd2841er_sleep_tc_to_active_t_band()
2608 if (priv->flags & CXD2841ER_ASCOT) in cxd2841er_sleep_tc_to_active_t_band()
2609 cxd2841er_write_regs(priv, I2C_SLVT, in cxd2841er_sleep_tc_to_active_t_band()
2610 0xA6, itbCoef5bw[priv->xtal], 14); in cxd2841er_sleep_tc_to_active_t_band()
2612 ifhz = cxd2841er_get_if_hz(priv, 3600000); in cxd2841er_sleep_tc_to_active_t_band()
2613 iffreq = cxd2841er_calc_iffreq_xtal(priv->xtal, ifhz); in cxd2841er_sleep_tc_to_active_t_band()
2617 cxd2841er_write_regs(priv, I2C_SLVT, 0xB6, data, 3); in cxd2841er_sleep_tc_to_active_t_band()
2620 priv, I2C_SLVT, 0xD7, 0x06, 0x07); in cxd2841er_sleep_tc_to_active_t_band()
2623 if (priv->xtal == SONY_XTAL_24000) { in cxd2841er_sleep_tc_to_active_t_band()
2630 cxd2841er_write_regs(priv, I2C_SLVT, 0xD9, data, 2); in cxd2841er_sleep_tc_to_active_t_band()
2635 cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x17); in cxd2841er_sleep_tc_to_active_t_band()
2636 cxd2841er_write_regs(priv, I2C_SLVT, 0x38, data, 2); in cxd2841er_sleep_tc_to_active_t_band()
2644 struct cxd2841er_priv *priv, u32 bandwidth) in cxd2841er_sleep_tc_to_active_i_band() argument
2691 dev_dbg(&priv->i2c->dev, "%s() bandwidth=%u\n", __func__, bandwidth); in cxd2841er_sleep_tc_to_active_i_band()
2693 cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x10); in cxd2841er_sleep_tc_to_active_i_band()
2698 if (priv->xtal != SONY_XTAL_24000 && bandwidth > 6000000) { in cxd2841er_sleep_tc_to_active_i_band()
2699 dev_err(&priv->i2c->dev, in cxd2841er_sleep_tc_to_active_i_band()
2708 cxd2841er_write_regs(priv, I2C_SLVT, in cxd2841er_sleep_tc_to_active_i_band()
2709 0x9F, nominalRate8bw[priv->xtal], 5); in cxd2841er_sleep_tc_to_active_i_band()
2711 if (priv->flags & CXD2841ER_ASCOT) in cxd2841er_sleep_tc_to_active_i_band()
2712 cxd2841er_write_regs(priv, I2C_SLVT, in cxd2841er_sleep_tc_to_active_i_band()
2713 0xA6, itbCoef8bw[priv->xtal], 14); in cxd2841er_sleep_tc_to_active_i_band()
2716 ifhz = cxd2841er_get_if_hz(priv, 4750000); in cxd2841er_sleep_tc_to_active_i_band()
2717 iffreq = cxd2841er_calc_iffreq_xtal(priv->xtal, ifhz); in cxd2841er_sleep_tc_to_active_i_band()
2721 cxd2841er_write_regs(priv, I2C_SLVT, 0xB6, data, 3); in cxd2841er_sleep_tc_to_active_i_band()
2724 cxd2841er_set_reg_bits(priv, I2C_SLVT, 0xd7, 0x0, 0x7); in cxd2841er_sleep_tc_to_active_i_band()
2729 cxd2841er_write_regs(priv, I2C_SLVT, 0xD9, data, 2); in cxd2841er_sleep_tc_to_active_i_band()
2732 cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x12); in cxd2841er_sleep_tc_to_active_i_band()
2733 cxd2841er_set_reg_bits(priv, I2C_SLVT, 0x71, 0x03, 0x07); in cxd2841er_sleep_tc_to_active_i_band()
2734 cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x15); in cxd2841er_sleep_tc_to_active_i_band()
2735 cxd2841er_write_reg(priv, I2C_SLVT, 0xBE, 0x03); in cxd2841er_sleep_tc_to_active_i_band()
2739 cxd2841er_write_regs(priv, I2C_SLVT, in cxd2841er_sleep_tc_to_active_i_band()
2740 0x9F, nominalRate7bw[priv->xtal], 5); in cxd2841er_sleep_tc_to_active_i_band()
2742 if (priv->flags & CXD2841ER_ASCOT) in cxd2841er_sleep_tc_to_active_i_band()
2743 cxd2841er_write_regs(priv, I2C_SLVT, in cxd2841er_sleep_tc_to_active_i_band()
2744 0xA6, itbCoef7bw[priv->xtal], 14); in cxd2841er_sleep_tc_to_active_i_band()
2747 ifhz = cxd2841er_get_if_hz(priv, 4150000); in cxd2841er_sleep_tc_to_active_i_band()
2748 iffreq = cxd2841er_calc_iffreq_xtal(priv->xtal, ifhz); in cxd2841er_sleep_tc_to_active_i_band()
2752 cxd2841er_write_regs(priv, I2C_SLVT, 0xB6, data, 3); in cxd2841er_sleep_tc_to_active_i_band()
2755 cxd2841er_set_reg_bits(priv, I2C_SLVT, 0xd7, 0x02, 0x7); in cxd2841er_sleep_tc_to_active_i_band()
2760 cxd2841er_write_regs(priv, I2C_SLVT, 0xD9, data, 2); in cxd2841er_sleep_tc_to_active_i_band()
2763 cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x12); in cxd2841er_sleep_tc_to_active_i_band()
2764 cxd2841er_set_reg_bits(priv, I2C_SLVT, 0x71, 0x03, 0x07); in cxd2841er_sleep_tc_to_active_i_band()
2765 cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x15); in cxd2841er_sleep_tc_to_active_i_band()
2766 cxd2841er_write_reg(priv, I2C_SLVT, 0xBE, 0x02); in cxd2841er_sleep_tc_to_active_i_band()
2770 cxd2841er_write_regs(priv, I2C_SLVT, in cxd2841er_sleep_tc_to_active_i_band()
2771 0x9F, nominalRate6bw[priv->xtal], 5); in cxd2841er_sleep_tc_to_active_i_band()
2773 if (priv->flags & CXD2841ER_ASCOT) in cxd2841er_sleep_tc_to_active_i_band()
2774 cxd2841er_write_regs(priv, I2C_SLVT, in cxd2841er_sleep_tc_to_active_i_band()
2775 0xA6, itbCoef6bw[priv->xtal], 14); in cxd2841er_sleep_tc_to_active_i_band()
2778 ifhz = cxd2841er_get_if_hz(priv, 3550000); in cxd2841er_sleep_tc_to_active_i_band()
2779 iffreq = cxd2841er_calc_iffreq_xtal(priv->xtal, ifhz); in cxd2841er_sleep_tc_to_active_i_band()
2783 cxd2841er_write_regs(priv, I2C_SLVT, 0xB6, data, 3); in cxd2841er_sleep_tc_to_active_i_band()
2786 cxd2841er_set_reg_bits(priv, I2C_SLVT, 0xd7, 0x04, 0x7); in cxd2841er_sleep_tc_to_active_i_band()
2789 if (priv->xtal == SONY_XTAL_24000) { in cxd2841er_sleep_tc_to_active_i_band()
2796 cxd2841er_write_regs(priv, I2C_SLVT, 0xD9, data, 2); in cxd2841er_sleep_tc_to_active_i_band()
2799 cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x12); in cxd2841er_sleep_tc_to_active_i_band()
2800 cxd2841er_set_reg_bits(priv, I2C_SLVT, 0x71, 0x07, 0x07); in cxd2841er_sleep_tc_to_active_i_band()
2801 cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x15); in cxd2841er_sleep_tc_to_active_i_band()
2802 cxd2841er_write_reg(priv, I2C_SLVT, 0xBE, 0x02); in cxd2841er_sleep_tc_to_active_i_band()
2805 dev_dbg(&priv->i2c->dev, "%s(): invalid bandwidth %d\n", in cxd2841er_sleep_tc_to_active_i_band()
2812 static int cxd2841er_sleep_tc_to_active_c_band(struct cxd2841er_priv *priv, in cxd2841er_sleep_tc_to_active_c_band() argument
2827 dev_info(&priv->i2c->dev, "%s(): unsupported bandwidth %d. Forcing 8Mhz!\n", in cxd2841er_sleep_tc_to_active_c_band()
2832 dev_dbg(&priv->i2c->dev, "%s() bw=%d\n", __func__, bandwidth); in cxd2841er_sleep_tc_to_active_c_band()
2833 cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x10); in cxd2841er_sleep_tc_to_active_c_band()
2837 if (priv->flags & CXD2841ER_ASCOT) in cxd2841er_sleep_tc_to_active_c_band()
2839 priv, I2C_SLVT, 0xa6, in cxd2841er_sleep_tc_to_active_c_band()
2841 ifhz = cxd2841er_get_if_hz(priv, 4900000); in cxd2841er_sleep_tc_to_active_c_band()
2845 if (priv->flags & CXD2841ER_ASCOT) in cxd2841er_sleep_tc_to_active_c_band()
2847 priv, I2C_SLVT, 0xa6, in cxd2841er_sleep_tc_to_active_c_band()
2849 ifhz = cxd2841er_get_if_hz(priv, 3700000); in cxd2841er_sleep_tc_to_active_c_band()
2853 dev_err(&priv->i2c->dev, "%s(): unsupported bandwidth %d\n", in cxd2841er_sleep_tc_to_active_c_band()
2861 cxd2841er_write_regs(priv, I2C_SLVT, 0xb6, b10_b6, sizeof(b10_b6)); in cxd2841er_sleep_tc_to_active_c_band()
2863 cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x11); in cxd2841er_sleep_tc_to_active_c_band()
2868 priv, I2C_SLVT, 0xa3, 0x00, 0x1f); in cxd2841er_sleep_tc_to_active_c_band()
2872 priv, I2C_SLVT, 0xa3, 0x14, 0x1f); in cxd2841er_sleep_tc_to_active_c_band()
2876 cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x40); in cxd2841er_sleep_tc_to_active_c_band()
2880 priv, I2C_SLVT, 0x26, 0x0b, 0x0f); in cxd2841er_sleep_tc_to_active_c_band()
2881 cxd2841er_write_reg(priv, I2C_SLVT, 0x27, 0x3e); in cxd2841er_sleep_tc_to_active_c_band()
2885 priv, I2C_SLVT, 0x26, 0x09, 0x0f); in cxd2841er_sleep_tc_to_active_c_band()
2886 cxd2841er_write_reg(priv, I2C_SLVT, 0x27, 0xd6); in cxd2841er_sleep_tc_to_active_c_band()
2890 priv, I2C_SLVT, 0x26, 0x08, 0x0f); in cxd2841er_sleep_tc_to_active_c_band()
2891 cxd2841er_write_reg(priv, I2C_SLVT, 0x27, 0x6e); in cxd2841er_sleep_tc_to_active_c_band()
2897 static int cxd2841er_sleep_tc_to_active_t(struct cxd2841er_priv *priv, in cxd2841er_sleep_tc_to_active_t() argument
2903 dev_dbg(&priv->i2c->dev, "%s()\n", __func__); in cxd2841er_sleep_tc_to_active_t()
2904 cxd2841er_set_ts_clock_mode(priv, SYS_DVBT); in cxd2841er_sleep_tc_to_active_t()
2906 cxd2841er_write_reg(priv, I2C_SLVX, 0x00, 0x00); in cxd2841er_sleep_tc_to_active_t()
2908 cxd2841er_write_reg(priv, I2C_SLVX, 0x17, 0x01); in cxd2841er_sleep_tc_to_active_t()
2910 cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x00); in cxd2841er_sleep_tc_to_active_t()
2912 cxd2841er_write_reg(priv, I2C_SLVT, 0x2c, 0x01); in cxd2841er_sleep_tc_to_active_t()
2914 cxd2841er_write_reg(priv, I2C_SLVT, 0x2f, 0x00); in cxd2841er_sleep_tc_to_active_t()
2916 cxd2841er_write_reg(priv, I2C_SLVT, 0x30, 0x00); in cxd2841er_sleep_tc_to_active_t()
2918 cxd2841er_write_reg(priv, I2C_SLVT, 0x41, 0x1a); in cxd2841er_sleep_tc_to_active_t()
2920 if (priv->xtal == SONY_XTAL_41000) { in cxd2841er_sleep_tc_to_active_t()
2924 cxd2841er_write_regs(priv, I2C_SLVT, 0x43, data, 2); in cxd2841er_sleep_tc_to_active_t()
2926 cxd2841er_write_reg(priv, I2C_SLVX, 0x18, 0x00); in cxd2841er_sleep_tc_to_active_t()
2928 cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x10); in cxd2841er_sleep_tc_to_active_t()
2930 cxd2841er_set_reg_bits(priv, I2C_SLVT, 0xd2, 0x0c, 0x1f); in cxd2841er_sleep_tc_to_active_t()
2932 cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x11); in cxd2841er_sleep_tc_to_active_t()
2934 cxd2841er_write_reg(priv, I2C_SLVT, 0x6a, 0x50); in cxd2841er_sleep_tc_to_active_t()
2936 cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x10); in cxd2841er_sleep_tc_to_active_t()
2938 cxd2841er_set_reg_bits(priv, I2C_SLVT, 0xa5, in cxd2841er_sleep_tc_to_active_t()
2939 ((priv->flags & CXD2841ER_ASCOT) ? 0x01 : 0x00), 0x01); in cxd2841er_sleep_tc_to_active_t()
2941 cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x18); in cxd2841er_sleep_tc_to_active_t()
2943 cxd2841er_set_reg_bits(priv, I2C_SLVT, 0x36, 0x40, 0x07); in cxd2841er_sleep_tc_to_active_t()
2945 cxd2841er_set_reg_bits(priv, I2C_SLVT, 0x30, 0x01, 0x01); in cxd2841er_sleep_tc_to_active_t()
2946 cxd2841er_set_reg_bits(priv, I2C_SLVT, 0x31, 0x01, 0x01); in cxd2841er_sleep_tc_to_active_t()
2948 cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x00); in cxd2841er_sleep_tc_to_active_t()
2950 cxd2841er_set_reg_bits(priv, I2C_SLVT, 0xce, 0x01, 0x01); in cxd2841er_sleep_tc_to_active_t()
2951 cxd2841er_set_reg_bits(priv, I2C_SLVT, 0xcf, 0x01, 0x01); in cxd2841er_sleep_tc_to_active_t()
2953 if (priv->xtal == SONY_XTAL_24000) { in cxd2841er_sleep_tc_to_active_t()
2955 cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x10); in cxd2841er_sleep_tc_to_active_t()
2956 cxd2841er_write_reg(priv, I2C_SLVT, 0xBF, 0x60); in cxd2841er_sleep_tc_to_active_t()
2957 cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x18); in cxd2841er_sleep_tc_to_active_t()
2958 cxd2841er_write_regs(priv, I2C_SLVT, 0x24, data24m, 3); in cxd2841er_sleep_tc_to_active_t()
2961 cxd2841er_sleep_tc_to_active_t_band(priv, bandwidth); in cxd2841er_sleep_tc_to_active_t()
2963 cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x00); in cxd2841er_sleep_tc_to_active_t()
2965 cxd2841er_write_reg(priv, I2C_SLVT, 0x80, 0x28); in cxd2841er_sleep_tc_to_active_t()
2967 cxd2841er_write_reg(priv, I2C_SLVT, 0x81, 0x00); in cxd2841er_sleep_tc_to_active_t()
2968 priv->state = STATE_ACTIVE_TC; in cxd2841er_sleep_tc_to_active_t()
2972 static int cxd2841er_sleep_tc_to_active_t2(struct cxd2841er_priv *priv, in cxd2841er_sleep_tc_to_active_t2() argument
2977 dev_dbg(&priv->i2c->dev, "%s()\n", __func__); in cxd2841er_sleep_tc_to_active_t2()
2978 cxd2841er_set_ts_clock_mode(priv, SYS_DVBT2); in cxd2841er_sleep_tc_to_active_t2()
2980 cxd2841er_write_reg(priv, I2C_SLVX, 0x00, 0x00); in cxd2841er_sleep_tc_to_active_t2()
2982 cxd2841er_write_reg(priv, I2C_SLVX, 0x17, 0x02); in cxd2841er_sleep_tc_to_active_t2()
2984 cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x00); in cxd2841er_sleep_tc_to_active_t2()
2986 cxd2841er_write_reg(priv, I2C_SLVT, 0x2c, 0x01); in cxd2841er_sleep_tc_to_active_t2()
2988 cxd2841er_write_reg(priv, I2C_SLVT, 0x59, 0x00); in cxd2841er_sleep_tc_to_active_t2()
2989 cxd2841er_write_reg(priv, I2C_SLVT, 0x2f, 0x00); in cxd2841er_sleep_tc_to_active_t2()
2991 cxd2841er_write_reg(priv, I2C_SLVT, 0x30, 0x00); in cxd2841er_sleep_tc_to_active_t2()
2993 cxd2841er_write_reg(priv, I2C_SLVT, 0x41, 0x1a); in cxd2841er_sleep_tc_to_active_t2()
2995 if (priv->xtal == SONY_XTAL_41000) { in cxd2841er_sleep_tc_to_active_t2()
3003 cxd2841er_write_regs(priv, I2C_SLVT, 0x43, data, 2); in cxd2841er_sleep_tc_to_active_t2()
3005 cxd2841er_write_reg(priv, I2C_SLVX, 0x18, 0x00); in cxd2841er_sleep_tc_to_active_t2()
3007 cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x10); in cxd2841er_sleep_tc_to_active_t2()
3009 cxd2841er_set_reg_bits(priv, I2C_SLVT, 0xd2, 0x0c, 0x1f); in cxd2841er_sleep_tc_to_active_t2()
3011 cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x11); in cxd2841er_sleep_tc_to_active_t2()
3013 cxd2841er_write_reg(priv, I2C_SLVT, 0x6a, 0x50); in cxd2841er_sleep_tc_to_active_t2()
3015 cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x10); in cxd2841er_sleep_tc_to_active_t2()
3017 cxd2841er_set_reg_bits(priv, I2C_SLVT, 0xa5, in cxd2841er_sleep_tc_to_active_t2()
3018 ((priv->flags & CXD2841ER_ASCOT) ? 0x01 : 0x00), 0x01); in cxd2841er_sleep_tc_to_active_t2()
3020 cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x20); in cxd2841er_sleep_tc_to_active_t2()
3022 cxd2841er_write_reg(priv, I2C_SLVT, 0x8b, 0x3c); in cxd2841er_sleep_tc_to_active_t2()
3024 cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x2b); in cxd2841er_sleep_tc_to_active_t2()
3025 cxd2841er_set_reg_bits(priv, I2C_SLVT, 0x76, 0x20, 0x70); in cxd2841er_sleep_tc_to_active_t2()
3027 cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x23); in cxd2841er_sleep_tc_to_active_t2()
3029 cxd2841er_set_reg_bits(priv, I2C_SLVT, 0xE6, 0x00, 0x03); in cxd2841er_sleep_tc_to_active_t2()
3031 cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x00); in cxd2841er_sleep_tc_to_active_t2()
3033 cxd2841er_set_reg_bits(priv, I2C_SLVT, 0xce, 0x01, 0x01); in cxd2841er_sleep_tc_to_active_t2()
3034 cxd2841er_set_reg_bits(priv, I2C_SLVT, 0xcf, 0x01, 0x01); in cxd2841er_sleep_tc_to_active_t2()
3036 cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x13); in cxd2841er_sleep_tc_to_active_t2()
3037 cxd2841er_write_reg(priv, I2C_SLVT, 0x83, 0x10); in cxd2841er_sleep_tc_to_active_t2()
3038 cxd2841er_write_reg(priv, I2C_SLVT, 0x86, 0x34); in cxd2841er_sleep_tc_to_active_t2()
3039 cxd2841er_set_reg_bits(priv, I2C_SLVT, 0x9e, 0x09, 0x0f); in cxd2841er_sleep_tc_to_active_t2()
3040 cxd2841er_write_reg(priv, I2C_SLVT, 0x9f, 0xd8); in cxd2841er_sleep_tc_to_active_t2()
3042 cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x2a); in cxd2841er_sleep_tc_to_active_t2()
3043 cxd2841er_set_reg_bits(priv, I2C_SLVT, 0x38, 0x04, 0x0f); in cxd2841er_sleep_tc_to_active_t2()
3045 cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x2b); in cxd2841er_sleep_tc_to_active_t2()
3046 cxd2841er_set_reg_bits(priv, I2C_SLVT, 0x11, 0x20, 0x3f); in cxd2841er_sleep_tc_to_active_t2()
3049 if (priv->xtal == SONY_XTAL_24000) { in cxd2841er_sleep_tc_to_active_t2()
3051 cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x11); in cxd2841er_sleep_tc_to_active_t2()
3055 cxd2841er_write_regs(priv, I2C_SLVT, 0x33, data, 3); in cxd2841er_sleep_tc_to_active_t2()
3058 cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x20); in cxd2841er_sleep_tc_to_active_t2()
3062 cxd2841er_write_regs(priv, I2C_SLVT, 0x95, data, 3); in cxd2841er_sleep_tc_to_active_t2()
3064 cxd2841er_write_reg(priv, I2C_SLVT, 0x99, 0x18); in cxd2841er_sleep_tc_to_active_t2()
3068 cxd2841er_write_regs(priv, I2C_SLVT, 0xD9, data, 2); in cxd2841er_sleep_tc_to_active_t2()
3071 cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x24); in cxd2841er_sleep_tc_to_active_t2()
3074 cxd2841er_write_regs(priv, I2C_SLVT, 0x34, data, 2); in cxd2841er_sleep_tc_to_active_t2()
3079 cxd2841er_write_regs(priv, I2C_SLVT, 0xD2, data, 3); in cxd2841er_sleep_tc_to_active_t2()
3084 cxd2841er_write_regs(priv, I2C_SLVT, 0xDD, data, 3); in cxd2841er_sleep_tc_to_active_t2()
3086 cxd2841er_write_reg(priv, I2C_SLVT, 0xE0, 0x00); in cxd2841er_sleep_tc_to_active_t2()
3089 cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x25); in cxd2841er_sleep_tc_to_active_t2()
3090 cxd2841er_write_reg(priv, I2C_SLVT, 0xED, 0x60); in cxd2841er_sleep_tc_to_active_t2()
3093 cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x27); in cxd2841er_sleep_tc_to_active_t2()
3094 cxd2841er_write_reg(priv, I2C_SLVT, 0xFA, 0x34); in cxd2841er_sleep_tc_to_active_t2()
3097 cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x2B); in cxd2841er_sleep_tc_to_active_t2()
3098 cxd2841er_write_reg(priv, I2C_SLVT, 0x4B, 0x2F); in cxd2841er_sleep_tc_to_active_t2()
3099 cxd2841er_write_reg(priv, I2C_SLVT, 0x9E, 0x0E); in cxd2841er_sleep_tc_to_active_t2()
3102 cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x2D); in cxd2841er_sleep_tc_to_active_t2()
3105 cxd2841er_write_regs(priv, I2C_SLVT, 0x24, data, 2); in cxd2841er_sleep_tc_to_active_t2()
3108 cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x5E); in cxd2841er_sleep_tc_to_active_t2()
3111 cxd2841er_write_regs(priv, I2C_SLVT, 0x8C, data, 2); in cxd2841er_sleep_tc_to_active_t2()
3114 cxd2841er_sleep_tc_to_active_t2_band(priv, bandwidth); in cxd2841er_sleep_tc_to_active_t2()
3117 cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x00); in cxd2841er_sleep_tc_to_active_t2()
3119 cxd2841er_write_reg(priv, I2C_SLVT, 0x80, 0x28); in cxd2841er_sleep_tc_to_active_t2()
3121 cxd2841er_write_reg(priv, I2C_SLVT, 0x81, 0x00); in cxd2841er_sleep_tc_to_active_t2()
3122 priv->state = STATE_ACTIVE_TC; in cxd2841er_sleep_tc_to_active_t2()
3127 static int cxd2841er_sleep_tc_to_active_i(struct cxd2841er_priv *priv, in cxd2841er_sleep_tc_to_active_i() argument
3134 dev_dbg(&priv->i2c->dev, "%s()\n", __func__); in cxd2841er_sleep_tc_to_active_i()
3135 cxd2841er_set_ts_clock_mode(priv, SYS_DVBT); in cxd2841er_sleep_tc_to_active_i()
3137 cxd2841er_write_reg(priv, I2C_SLVX, 0x00, 0x00); in cxd2841er_sleep_tc_to_active_i()
3139 cxd2841er_write_reg(priv, I2C_SLVX, 0x17, 0x06); in cxd2841er_sleep_tc_to_active_i()
3141 cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x00); in cxd2841er_sleep_tc_to_active_i()
3143 cxd2841er_write_reg(priv, I2C_SLVT, 0x2c, 0x01); in cxd2841er_sleep_tc_to_active_i()
3145 cxd2841er_write_reg(priv, I2C_SLVT, 0x2f, 0x01); in cxd2841er_sleep_tc_to_active_i()
3146 cxd2841er_write_reg(priv, I2C_SLVT, 0x59, 0x01); in cxd2841er_sleep_tc_to_active_i()
3148 cxd2841er_write_reg(priv, I2C_SLVT, 0x30, 0x00); in cxd2841er_sleep_tc_to_active_i()
3150 cxd2841er_write_reg(priv, I2C_SLVT, 0x41, 0x1a); in cxd2841er_sleep_tc_to_active_i()
3152 cxd2841er_write_regs(priv, I2C_SLVT, 0x43, data, 2); in cxd2841er_sleep_tc_to_active_i()
3154 cxd2841er_write_reg(priv, I2C_SLVX, 0x18, 0x00); in cxd2841er_sleep_tc_to_active_i()
3156 cxd2841er_set_reg_bits(priv, I2C_SLVT, 0xa5, in cxd2841er_sleep_tc_to_active_i()
3157 ((priv->flags & CXD2841ER_ASCOT) ? 0x01 : 0x00), 0x01); in cxd2841er_sleep_tc_to_active_i()
3159 cxd2841er_set_reg_bits(priv, I2C_SLVT, 0x30, 0x01, 0x01); in cxd2841er_sleep_tc_to_active_i()
3160 cxd2841er_set_reg_bits(priv, I2C_SLVT, 0x31, 0x00, 0x01); in cxd2841er_sleep_tc_to_active_i()
3163 cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x00); in cxd2841er_sleep_tc_to_active_i()
3164 cxd2841er_set_reg_bits(priv, I2C_SLVT, 0xce, 0x00, 0x01); in cxd2841er_sleep_tc_to_active_i()
3165 cxd2841er_set_reg_bits(priv, I2C_SLVT, 0xcf, 0x00, 0x01); in cxd2841er_sleep_tc_to_active_i()
3167 cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x10); in cxd2841er_sleep_tc_to_active_i()
3168 cxd2841er_set_reg_bits(priv, I2C_SLVT, 0x69, 0x04, 0x07); in cxd2841er_sleep_tc_to_active_i()
3169 cxd2841er_set_reg_bits(priv, I2C_SLVT, 0x6B, 0x03, 0x07); in cxd2841er_sleep_tc_to_active_i()
3170 cxd2841er_set_reg_bits(priv, I2C_SLVT, 0x9D, 0x50, 0xFF); in cxd2841er_sleep_tc_to_active_i()
3171 cxd2841er_set_reg_bits(priv, I2C_SLVT, 0xD3, 0x06, 0x1F); in cxd2841er_sleep_tc_to_active_i()
3172 cxd2841er_set_reg_bits(priv, I2C_SLVT, 0xED, 0x00, 0x01); in cxd2841er_sleep_tc_to_active_i()
3173 cxd2841er_set_reg_bits(priv, I2C_SLVT, 0xE2, 0xCE, 0x80); in cxd2841er_sleep_tc_to_active_i()
3174 cxd2841er_set_reg_bits(priv, I2C_SLVT, 0xF2, 0x13, 0x10); in cxd2841er_sleep_tc_to_active_i()
3175 cxd2841er_set_reg_bits(priv, I2C_SLVT, 0xDE, 0x2E, 0x3F); in cxd2841er_sleep_tc_to_active_i()
3177 cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x15); in cxd2841er_sleep_tc_to_active_i()
3178 cxd2841er_set_reg_bits(priv, I2C_SLVT, 0xDE, 0x02, 0x03); in cxd2841er_sleep_tc_to_active_i()
3180 cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x1E); in cxd2841er_sleep_tc_to_active_i()
3181 cxd2841er_set_reg_bits(priv, I2C_SLVT, 0x73, 0x68, 0xFF); in cxd2841er_sleep_tc_to_active_i()
3183 cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x63); in cxd2841er_sleep_tc_to_active_i()
3184 cxd2841er_set_reg_bits(priv, I2C_SLVT, 0x81, 0x00, 0x01); in cxd2841er_sleep_tc_to_active_i()
3188 cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x10); in cxd2841er_sleep_tc_to_active_i()
3189 cxd2841er_write_regs(priv, I2C_SLVT, 0xBF, data24m, 2); in cxd2841er_sleep_tc_to_active_i()
3191 cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x60); in cxd2841er_sleep_tc_to_active_i()
3192 cxd2841er_write_regs(priv, I2C_SLVT, 0xA8, data24m2, 3); in cxd2841er_sleep_tc_to_active_i()
3194 cxd2841er_sleep_tc_to_active_i_band(priv, bandwidth); in cxd2841er_sleep_tc_to_active_i()
3196 cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x00); in cxd2841er_sleep_tc_to_active_i()
3198 cxd2841er_write_reg(priv, I2C_SLVT, 0x80, 0x28); in cxd2841er_sleep_tc_to_active_i()
3200 cxd2841er_write_reg(priv, I2C_SLVT, 0x81, 0x00); in cxd2841er_sleep_tc_to_active_i()
3201 priv->state = STATE_ACTIVE_TC; in cxd2841er_sleep_tc_to_active_i()
3205 static int cxd2841er_sleep_tc_to_active_c(struct cxd2841er_priv *priv, in cxd2841er_sleep_tc_to_active_c() argument
3210 dev_dbg(&priv->i2c->dev, "%s()\n", __func__); in cxd2841er_sleep_tc_to_active_c()
3211 cxd2841er_set_ts_clock_mode(priv, SYS_DVBC_ANNEX_A); in cxd2841er_sleep_tc_to_active_c()
3213 cxd2841er_write_reg(priv, I2C_SLVX, 0x00, 0x00); in cxd2841er_sleep_tc_to_active_c()
3215 cxd2841er_write_reg(priv, I2C_SLVX, 0x17, 0x04); in cxd2841er_sleep_tc_to_active_c()
3217 cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x00); in cxd2841er_sleep_tc_to_active_c()
3219 cxd2841er_write_reg(priv, I2C_SLVT, 0x2c, 0x01); in cxd2841er_sleep_tc_to_active_c()
3221 cxd2841er_write_reg(priv, I2C_SLVT, 0x59, 0x00); in cxd2841er_sleep_tc_to_active_c()
3222 cxd2841er_write_reg(priv, I2C_SLVT, 0x2f, 0x00); in cxd2841er_sleep_tc_to_active_c()
3224 cxd2841er_write_reg(priv, I2C_SLVT, 0x30, 0x00); in cxd2841er_sleep_tc_to_active_c()
3226 cxd2841er_write_reg(priv, I2C_SLVT, 0x41, 0x1a); in cxd2841er_sleep_tc_to_active_c()
3228 cxd2841er_write_regs(priv, I2C_SLVT, 0x43, data, 2); in cxd2841er_sleep_tc_to_active_c()
3230 cxd2841er_write_reg(priv, I2C_SLVX, 0x18, 0x00); in cxd2841er_sleep_tc_to_active_c()
3232 cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x10); in cxd2841er_sleep_tc_to_active_c()
3234 cxd2841er_set_reg_bits(priv, I2C_SLVT, 0xd2, 0x09, 0x1f); in cxd2841er_sleep_tc_to_active_c()
3236 cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x11); in cxd2841er_sleep_tc_to_active_c()
3238 cxd2841er_write_reg(priv, I2C_SLVT, 0x6a, 0x48); in cxd2841er_sleep_tc_to_active_c()
3240 cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x10); in cxd2841er_sleep_tc_to_active_c()
3242 cxd2841er_set_reg_bits(priv, I2C_SLVT, 0xa5, in cxd2841er_sleep_tc_to_active_c()
3243 ((priv->flags & CXD2841ER_ASCOT) ? 0x01 : 0x00), 0x01); in cxd2841er_sleep_tc_to_active_c()
3245 cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x40); in cxd2841er_sleep_tc_to_active_c()
3247 cxd2841er_set_reg_bits(priv, I2C_SLVT, 0xc3, 0x00, 0x04); in cxd2841er_sleep_tc_to_active_c()
3249 cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x00); in cxd2841er_sleep_tc_to_active_c()
3251 cxd2841er_set_reg_bits(priv, I2C_SLVT, 0xce, 0x01, 0x01); in cxd2841er_sleep_tc_to_active_c()
3252 cxd2841er_set_reg_bits(priv, I2C_SLVT, 0xcf, 0x01, 0x01); in cxd2841er_sleep_tc_to_active_c()
3254 cxd2841er_sleep_tc_to_active_c_band(priv, bandwidth); in cxd2841er_sleep_tc_to_active_c()
3256 cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x00); in cxd2841er_sleep_tc_to_active_c()
3258 cxd2841er_write_reg(priv, I2C_SLVT, 0x80, 0x28); in cxd2841er_sleep_tc_to_active_c()
3260 cxd2841er_write_reg(priv, I2C_SLVT, 0x81, 0x00); in cxd2841er_sleep_tc_to_active_c()
3261 priv->state = STATE_ACTIVE_TC; in cxd2841er_sleep_tc_to_active_c()
3269 struct cxd2841er_priv *priv = fe->demodulator_priv; in cxd2841er_get_frontend() local
3271 dev_dbg(&priv->i2c->dev, "%s()\n", __func__); in cxd2841er_get_frontend()
3272 if (priv->state == STATE_ACTIVE_S) in cxd2841er_get_frontend()
3274 else if (priv->state == STATE_ACTIVE_TC) in cxd2841er_get_frontend()
3277 if (priv->state == STATE_ACTIVE_TC || priv->state == STATE_ACTIVE_S) in cxd2841er_get_frontend()
3283 if (priv->stats_time && in cxd2841er_get_frontend()
3284 (!time_after(jiffies, priv->stats_time))) in cxd2841er_get_frontend()
3288 priv->stats_time = jiffies + msecs_to_jiffies(1000); in cxd2841er_get_frontend()
3306 struct cxd2841er_priv *priv = fe->demodulator_priv; in cxd2841er_set_frontend_s() local
3310 dev_dbg(&priv->i2c->dev, "%s(): %s frequency=%d symbol_rate=%d xtal=%d\n", in cxd2841er_set_frontend_s()
3313 p->frequency, symbol_rate, priv->xtal); in cxd2841er_set_frontend_s()
3315 if (priv->flags & CXD2841ER_EARLY_TUNE) in cxd2841er_set_frontend_s()
3318 switch (priv->state) { in cxd2841er_set_frontend_s()
3321 priv, p->delivery_system, symbol_rate); in cxd2841er_set_frontend_s()
3324 ret = cxd2841er_retune_active(priv, p); in cxd2841er_set_frontend_s()
3327 dev_dbg(&priv->i2c->dev, "%s(): invalid state %d\n", in cxd2841er_set_frontend_s()
3328 __func__, priv->state); in cxd2841er_set_frontend_s()
3333 dev_dbg(&priv->i2c->dev, "%s(): tune failed\n", __func__); in cxd2841er_set_frontend_s()
3337 if (!(priv->flags & CXD2841ER_EARLY_TUNE)) in cxd2841er_set_frontend_s()
3340 cxd2841er_tune_done(priv); in cxd2841er_set_frontend_s()
3355 priv, &carr_offset)) { in cxd2841er_set_frontend_s()
3359 dev_dbg(&priv->i2c->dev, "%s(): carrier_offset=%d\n", in cxd2841er_set_frontend_s()
3371 priv->stats_time = 0; in cxd2841er_set_frontend_s()
3380 struct cxd2841er_priv *priv = fe->demodulator_priv; in cxd2841er_set_frontend_tc() local
3383 dev_dbg(&priv->i2c->dev, "%s() delivery_system=%d bandwidth_hz=%d\n", in cxd2841er_set_frontend_tc()
3386 if (priv->flags & CXD2841ER_EARLY_TUNE) in cxd2841er_set_frontend_tc()
3390 if (priv->state == STATE_ACTIVE_TC && in cxd2841er_set_frontend_tc()
3391 priv->system != p->delivery_system) { in cxd2841er_set_frontend_tc()
3392 dev_dbg(&priv->i2c->dev, "%s(): old_delsys=%d, new_delsys=%d -> sleep\n", in cxd2841er_set_frontend_tc()
3393 __func__, priv->system, p->delivery_system); in cxd2841er_set_frontend_tc()
3398 priv->system = SYS_DVBT; in cxd2841er_set_frontend_tc()
3399 switch (priv->state) { in cxd2841er_set_frontend_tc()
3402 priv, p->bandwidth_hz); in cxd2841er_set_frontend_tc()
3405 ret = cxd2841er_retune_active(priv, p); in cxd2841er_set_frontend_tc()
3408 dev_dbg(&priv->i2c->dev, "%s(): invalid state %d\n", in cxd2841er_set_frontend_tc()
3409 __func__, priv->state); in cxd2841er_set_frontend_tc()
3413 priv->system = SYS_DVBT2; in cxd2841er_set_frontend_tc()
3414 cxd2841er_dvbt2_set_plp_config(priv, in cxd2841er_set_frontend_tc()
3416 cxd2841er_dvbt2_set_profile(priv, DVBT2_PROFILE_BASE); in cxd2841er_set_frontend_tc()
3417 switch (priv->state) { in cxd2841er_set_frontend_tc()
3419 ret = cxd2841er_sleep_tc_to_active_t2(priv, in cxd2841er_set_frontend_tc()
3423 ret = cxd2841er_retune_active(priv, p); in cxd2841er_set_frontend_tc()
3426 dev_dbg(&priv->i2c->dev, "%s(): invalid state %d\n", in cxd2841er_set_frontend_tc()
3427 __func__, priv->state); in cxd2841er_set_frontend_tc()
3431 priv->system = SYS_ISDBT; in cxd2841er_set_frontend_tc()
3432 switch (priv->state) { in cxd2841er_set_frontend_tc()
3435 priv, p->bandwidth_hz); in cxd2841er_set_frontend_tc()
3438 ret = cxd2841er_retune_active(priv, p); in cxd2841er_set_frontend_tc()
3441 dev_dbg(&priv->i2c->dev, "%s(): invalid state %d\n", in cxd2841er_set_frontend_tc()
3442 __func__, priv->state); in cxd2841er_set_frontend_tc()
3447 priv->system = SYS_DVBC_ANNEX_A; in cxd2841er_set_frontend_tc()
3453 dev_dbg(&priv->i2c->dev, "%s(): forcing bandwidth to %d\n", in cxd2841er_set_frontend_tc()
3457 switch (priv->state) { in cxd2841er_set_frontend_tc()
3460 priv, p->bandwidth_hz); in cxd2841er_set_frontend_tc()
3463 ret = cxd2841er_retune_active(priv, p); in cxd2841er_set_frontend_tc()
3466 dev_dbg(&priv->i2c->dev, "%s(): invalid state %d\n", in cxd2841er_set_frontend_tc()
3467 __func__, priv->state); in cxd2841er_set_frontend_tc()
3471 dev_dbg(&priv->i2c->dev, in cxd2841er_set_frontend_tc()
3479 if (!(priv->flags & CXD2841ER_EARLY_TUNE)) in cxd2841er_set_frontend_tc()
3482 cxd2841er_tune_done(priv); in cxd2841er_set_frontend_tc()
3484 if (priv->flags & CXD2841ER_NO_WAIT_LOCK) in cxd2841er_set_frontend_tc()
3498 dev_dbg(&priv->i2c->dev, in cxd2841er_set_frontend_tc()
3511 struct cxd2841er_priv *priv = fe->demodulator_priv; in cxd2841er_tune_s() local
3514 dev_dbg(&priv->i2c->dev, "%s() re_tune=%d\n", __func__, re_tune); in cxd2841er_tune_s()
3522 priv, &carrier_offset)) in cxd2841er_tune_s()
3541 struct cxd2841er_priv *priv = fe->demodulator_priv; in cxd2841er_tune_tc() local
3544 dev_dbg(&priv->i2c->dev, "%s(): re_tune %d bandwidth=%d\n", __func__, in cxd2841er_tune_tc()
3552 switch (priv->system) { in cxd2841er_tune_tc()
3555 priv, p->bandwidth_hz, in cxd2841er_tune_tc()
3562 priv, p->bandwidth_hz, in cxd2841er_tune_tc()
3569 priv, p->bandwidth_hz, in cxd2841er_tune_tc()
3576 priv, &carrier_offset); in cxd2841er_tune_tc()
3581 dev_dbg(&priv->i2c->dev, in cxd2841er_tune_tc()
3583 __func__, priv->system); in cxd2841er_tune_tc()
3586 dev_dbg(&priv->i2c->dev, "%s(): carrier offset %d\n", in cxd2841er_tune_tc()
3600 struct cxd2841er_priv *priv = fe->demodulator_priv; in cxd2841er_sleep_s() local
3602 dev_dbg(&priv->i2c->dev, "%s()\n", __func__); in cxd2841er_sleep_s()
3610 struct cxd2841er_priv *priv = fe->demodulator_priv; in cxd2841er_sleep_tc() local
3612 dev_dbg(&priv->i2c->dev, "%s()\n", __func__); in cxd2841er_sleep_tc()
3614 if (priv->state == STATE_ACTIVE_TC) { in cxd2841er_sleep_tc()
3615 switch (priv->system) { in cxd2841er_sleep_tc()
3617 cxd2841er_active_t_to_sleep_tc(priv); in cxd2841er_sleep_tc()
3620 cxd2841er_active_t2_to_sleep_tc(priv); in cxd2841er_sleep_tc()
3623 cxd2841er_active_i_to_sleep_tc(priv); in cxd2841er_sleep_tc()
3626 cxd2841er_active_c_to_sleep_tc(priv); in cxd2841er_sleep_tc()
3629 dev_warn(&priv->i2c->dev, in cxd2841er_sleep_tc()
3631 __func__, priv->system); in cxd2841er_sleep_tc()
3634 if (priv->state != STATE_SLEEP_TC) { in cxd2841er_sleep_tc()
3635 dev_err(&priv->i2c->dev, "%s(): invalid state %d\n", in cxd2841er_sleep_tc()
3636 __func__, priv->state); in cxd2841er_sleep_tc()
3644 struct cxd2841er_priv *priv = fe->demodulator_priv; in cxd2841er_shutdown_tc() local
3646 dev_dbg(&priv->i2c->dev, "%s()\n", __func__); in cxd2841er_shutdown_tc()
3649 cxd2841er_sleep_tc_to_shutdown(priv); in cxd2841er_shutdown_tc()
3657 struct cxd2841er_priv *priv = fe->demodulator_priv; in cxd2841er_send_burst() local
3659 dev_dbg(&priv->i2c->dev, "%s(): burst mode %s\n", __func__, in cxd2841er_send_burst()
3661 if (priv->state != STATE_SLEEP_S && in cxd2841er_send_burst()
3662 priv->state != STATE_ACTIVE_S) { in cxd2841er_send_burst()
3663 dev_err(&priv->i2c->dev, "%s(): invalid demod state %d\n", in cxd2841er_send_burst()
3664 __func__, priv->state); in cxd2841er_send_burst()
3668 cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0xbb); in cxd2841er_send_burst()
3669 cxd2841er_write_reg(priv, I2C_SLVT, 0x34, 0x01); in cxd2841er_send_burst()
3670 cxd2841er_write_reg(priv, I2C_SLVT, 0x35, data); in cxd2841er_send_burst()
3678 struct cxd2841er_priv *priv = fe->demodulator_priv; in cxd2841er_set_tone() local
3680 dev_dbg(&priv->i2c->dev, "%s(): tone %s\n", __func__, in cxd2841er_set_tone()
3682 if (priv->state != STATE_SLEEP_S && in cxd2841er_set_tone()
3683 priv->state != STATE_ACTIVE_S) { in cxd2841er_set_tone()
3684 dev_err(&priv->i2c->dev, "%s(): invalid demod state %d\n", in cxd2841er_set_tone()
3685 __func__, priv->state); in cxd2841er_set_tone()
3689 cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0xbb); in cxd2841er_set_tone()
3690 cxd2841er_write_reg(priv, I2C_SLVT, 0x36, data); in cxd2841er_set_tone()
3699 struct cxd2841er_priv *priv = fe->demodulator_priv; in cxd2841er_send_diseqc_msg() local
3701 if (priv->state != STATE_SLEEP_S && in cxd2841er_send_diseqc_msg()
3702 priv->state != STATE_ACTIVE_S) { in cxd2841er_send_diseqc_msg()
3703 dev_err(&priv->i2c->dev, "%s(): invalid demod state %d\n", in cxd2841er_send_diseqc_msg()
3704 __func__, priv->state); in cxd2841er_send_diseqc_msg()
3707 dev_dbg(&priv->i2c->dev, in cxd2841er_send_diseqc_msg()
3709 cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0xbb); in cxd2841er_send_diseqc_msg()
3711 cxd2841er_write_reg(priv, I2C_SLVT, 0x33, 0x01); in cxd2841er_send_diseqc_msg()
3713 cxd2841er_write_reg(priv, I2C_SLVT, 0x3d, cmd->msg_len); in cxd2841er_send_diseqc_msg()
3717 cxd2841er_write_regs(priv, I2C_SLVT, 0x3e, data, sizeof(data)); in cxd2841er_send_diseqc_msg()
3719 cxd2841er_write_reg(priv, I2C_SLVT, 0x37, 1); in cxd2841er_send_diseqc_msg()
3721 cxd2841er_write_reg(priv, I2C_SLVT, 0x38, 0); in cxd2841er_send_diseqc_msg()
3723 cxd2841er_write_reg(priv, I2C_SLVT, 0x32, 0x01); in cxd2841er_send_diseqc_msg()
3726 cxd2841er_read_reg(priv, I2C_SLVT, 0x10, data); in cxd2841er_send_diseqc_msg()
3728 dev_dbg(&priv->i2c->dev, in cxd2841er_send_diseqc_msg()
3734 dev_dbg(&priv->i2c->dev, in cxd2841er_send_diseqc_msg()
3741 struct cxd2841er_priv *priv = fe->demodulator_priv; in cxd2841er_release() local
3743 dev_dbg(&priv->i2c->dev, "%s()\n", __func__); in cxd2841er_release()
3744 kfree(priv); in cxd2841er_release()
3749 struct cxd2841er_priv *priv = fe->demodulator_priv; in cxd2841er_i2c_gate_ctrl() local
3751 dev_dbg(&priv->i2c->dev, "%s(): enable=%d\n", __func__, enable); in cxd2841er_i2c_gate_ctrl()
3753 priv, I2C_SLVX, 0x8, (enable ? 0x01 : 0x00), 0x01); in cxd2841er_i2c_gate_ctrl()
3759 struct cxd2841er_priv *priv = fe->demodulator_priv; in cxd2841er_get_algo() local
3761 dev_dbg(&priv->i2c->dev, "%s()\n", __func__); in cxd2841er_get_algo()
3784 struct cxd2841er_priv *priv = fe->demodulator_priv; in cxd2841er_init_s() local
3787 if (priv->state == STATE_SLEEP_S) { in cxd2841er_init_s()
3788 dev_dbg(&priv->i2c->dev, "%s() forcing sleep->shutdown\n", in cxd2841er_init_s()
3790 cxd2841er_sleep_s_to_shutdown(priv); in cxd2841er_init_s()
3791 } else if (priv->state == STATE_ACTIVE_S) { in cxd2841er_init_s()
3792 dev_dbg(&priv->i2c->dev, "%s() forcing active->sleep->shutdown\n", in cxd2841er_init_s()
3794 cxd2841er_active_s_to_sleep_s(priv); in cxd2841er_init_s()
3795 cxd2841er_sleep_s_to_shutdown(priv); in cxd2841er_init_s()
3798 dev_dbg(&priv->i2c->dev, "%s()\n", __func__); in cxd2841er_init_s()
3799 cxd2841er_shutdown_to_sleep_s(priv); in cxd2841er_init_s()
3801 cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0xa0); in cxd2841er_init_s()
3802 cxd2841er_set_reg_bits(priv, I2C_SLVT, 0xb9, 0x01, 0x01); in cxd2841er_init_s()
3811 struct cxd2841er_priv *priv = fe->demodulator_priv; in cxd2841er_init_tc() local
3814 dev_dbg(&priv->i2c->dev, "%s() bandwidth_hz=%d\n", in cxd2841er_init_tc()
3816 cxd2841er_shutdown_to_sleep_tc(priv); in cxd2841er_init_tc()
3818 cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x10); in cxd2841er_init_tc()
3819 cxd2841er_set_reg_bits(priv, I2C_SLVT, 0xcb, in cxd2841er_init_tc()
3820 ((priv->flags & CXD2841ER_NO_AGCNEG) ? 0x00 : 0x40), 0x40); in cxd2841er_init_tc()
3822 cxd2841er_write_reg(priv, I2C_SLVT, 0xcd, 0x50); in cxd2841er_init_tc()
3824 cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x00); in cxd2841er_init_tc()
3825 cxd2841er_set_reg_bits(priv, I2C_SLVT, 0xc4, in cxd2841er_init_tc()
3826 ((priv->flags & CXD2841ER_TS_SERIAL) ? 0x80 : 0x00), 0x80); in cxd2841er_init_tc()
3829 if (priv->flags & CXD2841ER_TSBITS) in cxd2841er_init_tc()
3830 cxd2841er_set_reg_bits(priv, I2C_SLVT, 0xc4, 0x00, 0x18); in cxd2841er_init_tc()
3847 struct cxd2841er_priv *priv = NULL; in cxd2841er_attach() local
3850 priv = kzalloc(sizeof(struct cxd2841er_priv), GFP_KERNEL); in cxd2841er_attach()
3851 if (!priv) in cxd2841er_attach()
3853 priv->i2c = i2c; in cxd2841er_attach()
3854 priv->config = cfg; in cxd2841er_attach()
3855 priv->i2c_addr_slvx = (cfg->i2c_addr + 4) >> 1; in cxd2841er_attach()
3856 priv->i2c_addr_slvt = (cfg->i2c_addr) >> 1; in cxd2841er_attach()
3857 priv->xtal = cfg->xtal; in cxd2841er_attach()
3858 priv->flags = cfg->flags; in cxd2841er_attach()
3859 priv->frontend.demodulator_priv = priv; in cxd2841er_attach()
3860 dev_info(&priv->i2c->dev, in cxd2841er_attach()
3862 __func__, priv->i2c, in cxd2841er_attach()
3863 priv->i2c_addr_slvx, priv->i2c_addr_slvt); in cxd2841er_attach()
3864 chip_id = cxd2841er_chip_id(priv); in cxd2841er_attach()
3901 dev_err(&priv->i2c->dev, "%s(): invalid chip ID 0x%02x\n", in cxd2841er_attach()
3903 priv->frontend.demodulator_priv = NULL; in cxd2841er_attach()
3904 kfree(priv); in cxd2841er_attach()
3910 memcpy(&priv->frontend.ops, in cxd2841er_attach()
3915 memcpy(&priv->frontend.ops, in cxd2841er_attach()
3920 dev_info(&priv->i2c->dev, in cxd2841er_attach()
3923 dev_info(&priv->i2c->dev, "%s(): chip ID 0x%02x OK.\n", in cxd2841er_attach()
3925 return &priv->frontend; in cxd2841er_attach()