Lines Matching refs:priv

192 static void cxd2841er_i2c_debug(struct cxd2841er_priv *priv,  in cxd2841er_i2c_debug()  argument
196 dev_dbg(&priv->i2c->dev, in cxd2841er_i2c_debug()
203 static int cxd2841er_write_regs(struct cxd2841er_priv *priv, in cxd2841er_write_regs() argument
209 priv->i2c_addr_slvx : priv->i2c_addr_slvt); in cxd2841er_write_regs()
220 dev_warn(&priv->i2c->dev,"wr reg=%04x: len=%d is too big!\n", in cxd2841er_write_regs()
225 cxd2841er_i2c_debug(priv, i2c_addr, reg, 1, data, len); in cxd2841er_write_regs()
229 ret = i2c_transfer(priv->i2c, msg, 1); in cxd2841er_write_regs()
233 dev_warn(&priv->i2c->dev, in cxd2841er_write_regs()
241 static int cxd2841er_write_reg(struct cxd2841er_priv *priv, in cxd2841er_write_reg() argument
244 return cxd2841er_write_regs(priv, addr, reg, &val, 1); in cxd2841er_write_reg()
247 static int cxd2841er_read_regs(struct cxd2841er_priv *priv, in cxd2841er_read_regs() argument
252 priv->i2c_addr_slvx : priv->i2c_addr_slvt); in cxd2841er_read_regs()
267 ret = i2c_transfer(priv->i2c, &msg[0], 1); in cxd2841er_read_regs()
271 dev_warn(&priv->i2c->dev, in cxd2841er_read_regs()
276 ret = i2c_transfer(priv->i2c, &msg[1], 1); in cxd2841er_read_regs()
280 dev_warn(&priv->i2c->dev, in cxd2841er_read_regs()
288 static int cxd2841er_read_reg(struct cxd2841er_priv *priv, in cxd2841er_read_reg() argument
291 return cxd2841er_read_regs(priv, addr, reg, val, 1); in cxd2841er_read_reg()
294 static int cxd2841er_set_reg_bits(struct cxd2841er_priv *priv, in cxd2841er_set_reg_bits() argument
301 res = cxd2841er_read_reg(priv, addr, reg, &rdata); in cxd2841er_set_reg_bits()
306 return cxd2841er_write_reg(priv, addr, reg, data); in cxd2841er_set_reg_bits()
309 static int cxd2841er_dvbs2_set_symbol_rate(struct cxd2841er_priv *priv, in cxd2841er_dvbs2_set_symbol_rate() argument
315 dev_dbg(&priv->i2c->dev, "%s()\n", __func__); in cxd2841er_dvbs2_set_symbol_rate()
323 dev_err(&priv->i2c->dev, in cxd2841er_dvbs2_set_symbol_rate()
331 cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0xae); in cxd2841er_dvbs2_set_symbol_rate()
332 cxd2841er_write_regs(priv, I2C_SLVT, 0x20, data, 3); in cxd2841er_dvbs2_set_symbol_rate()
336 static void cxd2841er_set_ts_clock_mode(struct cxd2841er_priv *priv,
339 static int cxd2841er_sleep_s_to_active_s(struct cxd2841er_priv *priv, in cxd2841er_sleep_s_to_active_s() argument
345 if (priv->state != STATE_SLEEP_S) { in cxd2841er_sleep_s_to_active_s()
346 dev_err(&priv->i2c->dev, "%s(): invalid state %d\n", in cxd2841er_sleep_s_to_active_s()
347 __func__, (int)priv->state); in cxd2841er_sleep_s_to_active_s()
350 dev_dbg(&priv->i2c->dev, "%s()\n", __func__); in cxd2841er_sleep_s_to_active_s()
351 cxd2841er_set_ts_clock_mode(priv, SYS_DVBS); in cxd2841er_sleep_s_to_active_s()
358 dev_err(&priv->i2c->dev, "%s(): invalid delsys %d\n", in cxd2841er_sleep_s_to_active_s()
363 cxd2841er_write_reg(priv, I2C_SLVX, 0x00, 0x00); in cxd2841er_sleep_s_to_active_s()
364 cxd2841er_write_reg(priv, I2C_SLVX, 0x17, data[0]); in cxd2841er_sleep_s_to_active_s()
368 cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x00); in cxd2841er_sleep_s_to_active_s()
370 cxd2841er_write_reg(priv, I2C_SLVT, 0x2d, data[0]); in cxd2841er_sleep_s_to_active_s()
372 cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0xae); in cxd2841er_sleep_s_to_active_s()
374 cxd2841er_write_reg(priv, I2C_SLVT, 0x30, data[0]); in cxd2841er_sleep_s_to_active_s()
376 cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x00); in cxd2841er_sleep_s_to_active_s()
378 cxd2841er_write_reg(priv, I2C_SLVT, 0x2c, 0x01); in cxd2841er_sleep_s_to_active_s()
380 cxd2841er_write_reg(priv, I2C_SLVT, 0x31, 0x01); in cxd2841er_sleep_s_to_active_s()
382 cxd2841er_write_reg(priv, I2C_SLVT, 0x63, 0x16); in cxd2841er_sleep_s_to_active_s()
384 cxd2841er_write_reg(priv, I2C_SLVT, 0x65, 0x3f); in cxd2841er_sleep_s_to_active_s()
386 cxd2841er_write_reg(priv, I2C_SLVX, 0x00, 0x00); in cxd2841er_sleep_s_to_active_s()
388 cxd2841er_write_reg(priv, I2C_SLVX, 0x18, 0x00); in cxd2841er_sleep_s_to_active_s()
390 cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0xa3); in cxd2841er_sleep_s_to_active_s()
391 cxd2841er_write_reg(priv, I2C_SLVT, 0xac, 0x00); in cxd2841er_sleep_s_to_active_s()
397 cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0xab); in cxd2841er_sleep_s_to_active_s()
398 cxd2841er_write_regs(priv, I2C_SLVT, 0x98, data, 4); in cxd2841er_sleep_s_to_active_s()
403 cxd2841er_write_regs(priv, I2C_SLVT, 0xa8, data, 4); in cxd2841er_sleep_s_to_active_s()
406 cxd2841er_write_regs(priv, I2C_SLVT, 0xc3, data, 2); in cxd2841er_sleep_s_to_active_s()
408 ret = cxd2841er_dvbs2_set_symbol_rate(priv, symbol_rate); in cxd2841er_sleep_s_to_active_s()
412 cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x00); in cxd2841er_sleep_s_to_active_s()
414 cxd2841er_write_reg(priv, I2C_SLVT, 0x80, 0x10); in cxd2841er_sleep_s_to_active_s()
416 cxd2841er_write_reg(priv, I2C_SLVT, 0x81, 0x00); in cxd2841er_sleep_s_to_active_s()
417 priv->state = STATE_ACTIVE_S; in cxd2841er_sleep_s_to_active_s()
421 static int cxd2841er_sleep_tc_to_active_t_band(struct cxd2841er_priv *priv,
424 static int cxd2841er_sleep_tc_to_active_t2_band(struct cxd2841er_priv *priv,
427 static int cxd2841er_sleep_tc_to_active_c_band(struct cxd2841er_priv *priv,
430 static int cxd2841er_retune_active(struct cxd2841er_priv *priv, in cxd2841er_retune_active() argument
433 dev_dbg(&priv->i2c->dev, "%s()\n", __func__); in cxd2841er_retune_active()
434 if (priv->state != STATE_ACTIVE_S && in cxd2841er_retune_active()
435 priv->state != STATE_ACTIVE_TC) { in cxd2841er_retune_active()
436 dev_dbg(&priv->i2c->dev, "%s(): invalid state %d\n", in cxd2841er_retune_active()
437 __func__, priv->state); in cxd2841er_retune_active()
441 cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x00); in cxd2841er_retune_active()
443 cxd2841er_write_reg(priv, I2C_SLVT, 0xc3, 0x01); in cxd2841er_retune_active()
444 if (priv->state == STATE_ACTIVE_S) in cxd2841er_retune_active()
446 priv, p->symbol_rate / 1000); in cxd2841er_retune_active()
447 else if (priv->state == STATE_ACTIVE_TC) { in cxd2841er_retune_active()
448 switch (priv->system) { in cxd2841er_retune_active()
451 priv, p->bandwidth_hz); in cxd2841er_retune_active()
454 priv, p->bandwidth_hz); in cxd2841er_retune_active()
457 priv, 8000000); in cxd2841er_retune_active()
460 dev_dbg(&priv->i2c->dev, "%s(): invalid delivery system %d\n", in cxd2841er_retune_active()
461 __func__, priv->system); in cxd2841er_retune_active()
465 static int cxd2841er_active_s_to_sleep_s(struct cxd2841er_priv *priv) in cxd2841er_active_s_to_sleep_s() argument
467 dev_dbg(&priv->i2c->dev, "%s()\n", __func__); in cxd2841er_active_s_to_sleep_s()
468 if (priv->state != STATE_ACTIVE_S) { in cxd2841er_active_s_to_sleep_s()
469 dev_err(&priv->i2c->dev, "%s(): invalid state %d\n", in cxd2841er_active_s_to_sleep_s()
470 __func__, priv->state); in cxd2841er_active_s_to_sleep_s()
474 cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x00); in cxd2841er_active_s_to_sleep_s()
476 cxd2841er_write_reg(priv, I2C_SLVT, 0xc3, 0x01); in cxd2841er_active_s_to_sleep_s()
478 cxd2841er_write_reg(priv, I2C_SLVT, 0x80, 0x1f); in cxd2841er_active_s_to_sleep_s()
480 cxd2841er_write_reg(priv, I2C_SLVT, 0x81, 0xff); in cxd2841er_active_s_to_sleep_s()
482 cxd2841er_write_reg(priv, I2C_SLVX, 0x00, 0x00); in cxd2841er_active_s_to_sleep_s()
484 cxd2841er_write_reg(priv, I2C_SLVX, 0x18, 0x01); in cxd2841er_active_s_to_sleep_s()
486 cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x00); in cxd2841er_active_s_to_sleep_s()
488 cxd2841er_write_reg(priv, I2C_SLVT, 0x31, 0x00); in cxd2841er_active_s_to_sleep_s()
490 cxd2841er_write_reg(priv, I2C_SLVT, 0x63, 0x16); in cxd2841er_active_s_to_sleep_s()
492 cxd2841er_write_reg(priv, I2C_SLVT, 0x65, 0x27); in cxd2841er_active_s_to_sleep_s()
494 cxd2841er_write_reg(priv, I2C_SLVT, 0x69, 0x06); in cxd2841er_active_s_to_sleep_s()
496 cxd2841er_write_reg(priv, I2C_SLVT, 0x2c, 0x00); in cxd2841er_active_s_to_sleep_s()
498 cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0xae); in cxd2841er_active_s_to_sleep_s()
500 cxd2841er_write_reg(priv, I2C_SLVT, 0x30, 0x00); in cxd2841er_active_s_to_sleep_s()
502 cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x00); in cxd2841er_active_s_to_sleep_s()
504 cxd2841er_write_reg(priv, I2C_SLVT, 0x2d, 0x00); in cxd2841er_active_s_to_sleep_s()
505 priv->state = STATE_SLEEP_S; in cxd2841er_active_s_to_sleep_s()
509 static int cxd2841er_sleep_s_to_shutdown(struct cxd2841er_priv *priv) in cxd2841er_sleep_s_to_shutdown() argument
511 dev_dbg(&priv->i2c->dev, "%s()\n", __func__); in cxd2841er_sleep_s_to_shutdown()
512 if (priv->state != STATE_SLEEP_S) { in cxd2841er_sleep_s_to_shutdown()
513 dev_dbg(&priv->i2c->dev, "%s(): invalid demod state %d\n", in cxd2841er_sleep_s_to_shutdown()
514 __func__, priv->state); in cxd2841er_sleep_s_to_shutdown()
518 cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x00); in cxd2841er_sleep_s_to_shutdown()
520 cxd2841er_write_reg(priv, I2C_SLVT, 0x80, 0x3f); in cxd2841er_sleep_s_to_shutdown()
522 cxd2841er_write_reg(priv, I2C_SLVT, 0x9c, 0x00); in cxd2841er_sleep_s_to_shutdown()
524 cxd2841er_write_reg(priv, I2C_SLVX, 0x00, 0x00); in cxd2841er_sleep_s_to_shutdown()
526 cxd2841er_write_reg(priv, I2C_SLVX, 0x15, 0x01); in cxd2841er_sleep_s_to_shutdown()
528 cxd2841er_write_reg(priv, I2C_SLVX, 0x17, 0x01); in cxd2841er_sleep_s_to_shutdown()
529 priv->state = STATE_SHUTDOWN; in cxd2841er_sleep_s_to_shutdown()
533 static int cxd2841er_sleep_tc_to_shutdown(struct cxd2841er_priv *priv) in cxd2841er_sleep_tc_to_shutdown() argument
535 dev_dbg(&priv->i2c->dev, "%s()\n", __func__); in cxd2841er_sleep_tc_to_shutdown()
536 if (priv->state != STATE_SLEEP_TC) { in cxd2841er_sleep_tc_to_shutdown()
537 dev_dbg(&priv->i2c->dev, "%s(): invalid demod state %d\n", in cxd2841er_sleep_tc_to_shutdown()
538 __func__, priv->state); in cxd2841er_sleep_tc_to_shutdown()
542 cxd2841er_write_reg(priv, I2C_SLVX, 0x00, 0x00); in cxd2841er_sleep_tc_to_shutdown()
544 cxd2841er_write_reg(priv, I2C_SLVX, 0x15, 0x01); in cxd2841er_sleep_tc_to_shutdown()
546 cxd2841er_write_reg(priv, I2C_SLVX, 0x17, 0x01); in cxd2841er_sleep_tc_to_shutdown()
547 priv->state = STATE_SHUTDOWN; in cxd2841er_sleep_tc_to_shutdown()
551 static int cxd2841er_active_t_to_sleep_tc(struct cxd2841er_priv *priv) in cxd2841er_active_t_to_sleep_tc() argument
553 dev_dbg(&priv->i2c->dev, "%s()\n", __func__); in cxd2841er_active_t_to_sleep_tc()
554 if (priv->state != STATE_ACTIVE_TC) { in cxd2841er_active_t_to_sleep_tc()
555 dev_err(&priv->i2c->dev, "%s(): invalid state %d\n", in cxd2841er_active_t_to_sleep_tc()
556 __func__, priv->state); in cxd2841er_active_t_to_sleep_tc()
560 cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x00); in cxd2841er_active_t_to_sleep_tc()
562 cxd2841er_write_reg(priv, I2C_SLVT, 0xc3, 0x01); in cxd2841er_active_t_to_sleep_tc()
564 cxd2841er_write_reg(priv, I2C_SLVT, 0x80, 0x3f); in cxd2841er_active_t_to_sleep_tc()
566 cxd2841er_write_reg(priv, I2C_SLVT, 0x81, 0xff); in cxd2841er_active_t_to_sleep_tc()
568 cxd2841er_write_reg(priv, I2C_SLVX, 0x00, 0x00); in cxd2841er_active_t_to_sleep_tc()
570 cxd2841er_write_reg(priv, I2C_SLVX, 0x18, 0x01); in cxd2841er_active_t_to_sleep_tc()
572 cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x00); in cxd2841er_active_t_to_sleep_tc()
574 cxd2841er_write_reg(priv, I2C_SLVT, 0x43, 0x0a); in cxd2841er_active_t_to_sleep_tc()
576 cxd2841er_write_reg(priv, I2C_SLVT, 0x41, 0x0a); in cxd2841er_active_t_to_sleep_tc()
578 cxd2841er_write_reg(priv, I2C_SLVT, 0x30, 0x00); in cxd2841er_active_t_to_sleep_tc()
580 cxd2841er_write_reg(priv, I2C_SLVT, 0x2f, 0x00); in cxd2841er_active_t_to_sleep_tc()
582 cxd2841er_write_reg(priv, I2C_SLVT, 0x2c, 0x00); in cxd2841er_active_t_to_sleep_tc()
583 priv->state = STATE_SLEEP_TC; in cxd2841er_active_t_to_sleep_tc()
587 static int cxd2841er_active_t2_to_sleep_tc(struct cxd2841er_priv *priv) in cxd2841er_active_t2_to_sleep_tc() argument
589 dev_dbg(&priv->i2c->dev, "%s()\n", __func__); in cxd2841er_active_t2_to_sleep_tc()
590 if (priv->state != STATE_ACTIVE_TC) { in cxd2841er_active_t2_to_sleep_tc()
591 dev_err(&priv->i2c->dev, "%s(): invalid state %d\n", in cxd2841er_active_t2_to_sleep_tc()
592 __func__, priv->state); in cxd2841er_active_t2_to_sleep_tc()
596 cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x00); in cxd2841er_active_t2_to_sleep_tc()
598 cxd2841er_write_reg(priv, I2C_SLVT, 0xc3, 0x01); in cxd2841er_active_t2_to_sleep_tc()
600 cxd2841er_write_reg(priv, I2C_SLVT, 0x80, 0x3f); in cxd2841er_active_t2_to_sleep_tc()
602 cxd2841er_write_reg(priv, I2C_SLVT, 0x81, 0xff); in cxd2841er_active_t2_to_sleep_tc()
604 cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x13); in cxd2841er_active_t2_to_sleep_tc()
605 cxd2841er_write_reg(priv, I2C_SLVT, 0x83, 0x40); in cxd2841er_active_t2_to_sleep_tc()
606 cxd2841er_write_reg(priv, I2C_SLVT, 0x86, 0x21); in cxd2841er_active_t2_to_sleep_tc()
607 cxd2841er_set_reg_bits(priv, I2C_SLVT, 0x9e, 0x09, 0x0f); in cxd2841er_active_t2_to_sleep_tc()
608 cxd2841er_write_reg(priv, I2C_SLVT, 0x9f, 0xfb); in cxd2841er_active_t2_to_sleep_tc()
609 cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x2a); in cxd2841er_active_t2_to_sleep_tc()
610 cxd2841er_set_reg_bits(priv, I2C_SLVT, 0x38, 0x00, 0x0f); in cxd2841er_active_t2_to_sleep_tc()
611 cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x2b); in cxd2841er_active_t2_to_sleep_tc()
612 cxd2841er_set_reg_bits(priv, I2C_SLVT, 0x11, 0x00, 0x3f); in cxd2841er_active_t2_to_sleep_tc()
614 cxd2841er_write_reg(priv, I2C_SLVX, 0x00, 0x00); in cxd2841er_active_t2_to_sleep_tc()
616 cxd2841er_write_reg(priv, I2C_SLVX, 0x18, 0x01); in cxd2841er_active_t2_to_sleep_tc()
618 cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x00); in cxd2841er_active_t2_to_sleep_tc()
620 cxd2841er_write_reg(priv, I2C_SLVT, 0x43, 0x0a); in cxd2841er_active_t2_to_sleep_tc()
622 cxd2841er_write_reg(priv, I2C_SLVT, 0x41, 0x0a); in cxd2841er_active_t2_to_sleep_tc()
624 cxd2841er_write_reg(priv, I2C_SLVT, 0x30, 0x00); in cxd2841er_active_t2_to_sleep_tc()
626 cxd2841er_write_reg(priv, I2C_SLVT, 0x2f, 0x00); in cxd2841er_active_t2_to_sleep_tc()
628 cxd2841er_write_reg(priv, I2C_SLVT, 0x2c, 0x00); in cxd2841er_active_t2_to_sleep_tc()
629 priv->state = STATE_SLEEP_TC; in cxd2841er_active_t2_to_sleep_tc()
633 static int cxd2841er_active_c_to_sleep_tc(struct cxd2841er_priv *priv) in cxd2841er_active_c_to_sleep_tc() argument
635 dev_dbg(&priv->i2c->dev, "%s()\n", __func__); in cxd2841er_active_c_to_sleep_tc()
636 if (priv->state != STATE_ACTIVE_TC) { in cxd2841er_active_c_to_sleep_tc()
637 dev_err(&priv->i2c->dev, "%s(): invalid state %d\n", in cxd2841er_active_c_to_sleep_tc()
638 __func__, priv->state); in cxd2841er_active_c_to_sleep_tc()
642 cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x00); in cxd2841er_active_c_to_sleep_tc()
644 cxd2841er_write_reg(priv, I2C_SLVT, 0xc3, 0x01); in cxd2841er_active_c_to_sleep_tc()
646 cxd2841er_write_reg(priv, I2C_SLVT, 0x80, 0x3f); in cxd2841er_active_c_to_sleep_tc()
648 cxd2841er_write_reg(priv, I2C_SLVT, 0x81, 0xff); in cxd2841er_active_c_to_sleep_tc()
650 cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x11); in cxd2841er_active_c_to_sleep_tc()
651 cxd2841er_set_reg_bits(priv, I2C_SLVT, 0xa3, 0x00, 0x1f); in cxd2841er_active_c_to_sleep_tc()
653 cxd2841er_write_reg(priv, I2C_SLVX, 0x00, 0x00); in cxd2841er_active_c_to_sleep_tc()
655 cxd2841er_write_reg(priv, I2C_SLVX, 0x18, 0x01); in cxd2841er_active_c_to_sleep_tc()
657 cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x00); in cxd2841er_active_c_to_sleep_tc()
659 cxd2841er_write_reg(priv, I2C_SLVT, 0x43, 0x0a); in cxd2841er_active_c_to_sleep_tc()
661 cxd2841er_write_reg(priv, I2C_SLVT, 0x41, 0x0a); in cxd2841er_active_c_to_sleep_tc()
663 cxd2841er_write_reg(priv, I2C_SLVT, 0x30, 0x00); in cxd2841er_active_c_to_sleep_tc()
665 cxd2841er_write_reg(priv, I2C_SLVT, 0x2f, 0x00); in cxd2841er_active_c_to_sleep_tc()
667 cxd2841er_write_reg(priv, I2C_SLVT, 0x2c, 0x00); in cxd2841er_active_c_to_sleep_tc()
668 priv->state = STATE_SLEEP_TC; in cxd2841er_active_c_to_sleep_tc()
672 static int cxd2841er_shutdown_to_sleep_s(struct cxd2841er_priv *priv) in cxd2841er_shutdown_to_sleep_s() argument
674 dev_dbg(&priv->i2c->dev, "%s()\n", __func__); in cxd2841er_shutdown_to_sleep_s()
675 if (priv->state != STATE_SHUTDOWN) { in cxd2841er_shutdown_to_sleep_s()
676 dev_dbg(&priv->i2c->dev, "%s(): invalid demod state %d\n", in cxd2841er_shutdown_to_sleep_s()
677 __func__, priv->state); in cxd2841er_shutdown_to_sleep_s()
681 cxd2841er_write_reg(priv, I2C_SLVX, 0x00, 0x00); in cxd2841er_shutdown_to_sleep_s()
683 cxd2841er_write_reg(priv, I2C_SLVX, 0x02, 0x00); in cxd2841er_shutdown_to_sleep_s()
686 cxd2841er_write_reg(priv, I2C_SLVX, 0x00, 0x00); in cxd2841er_shutdown_to_sleep_s()
688 cxd2841er_write_reg(priv, I2C_SLVX, 0x10, 0x01); in cxd2841er_shutdown_to_sleep_s()
690 cxd2841er_write_reg(priv, I2C_SLVX, 0x14, 0x00); in cxd2841er_shutdown_to_sleep_s()
692 cxd2841er_write_reg(priv, I2C_SLVX, 0x17, 0x0a); in cxd2841er_shutdown_to_sleep_s()
694 cxd2841er_write_reg(priv, I2C_SLVX, 0x10, 0x00); in cxd2841er_shutdown_to_sleep_s()
697 cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x00); in cxd2841er_shutdown_to_sleep_s()
699 cxd2841er_write_reg(priv, I2C_SLVT, 0x80, 0x1F); in cxd2841er_shutdown_to_sleep_s()
701 cxd2841er_write_reg(priv, I2C_SLVT, 0x9C, 0x40); in cxd2841er_shutdown_to_sleep_s()
703 cxd2841er_write_reg(priv, I2C_SLVT, 0x43, 0x0a); in cxd2841er_shutdown_to_sleep_s()
704 cxd2841er_write_reg(priv, I2C_SLVT, 0x41, 0x0a); in cxd2841er_shutdown_to_sleep_s()
706 cxd2841er_write_reg(priv, I2C_SLVT, 0x63, 0x16); in cxd2841er_shutdown_to_sleep_s()
707 cxd2841er_write_reg(priv, I2C_SLVT, 0x65, 0x27); in cxd2841er_shutdown_to_sleep_s()
708 cxd2841er_write_reg(priv, I2C_SLVT, 0x69, 0x06); in cxd2841er_shutdown_to_sleep_s()
709 priv->state = STATE_SLEEP_S; in cxd2841er_shutdown_to_sleep_s()
713 static int cxd2841er_shutdown_to_sleep_tc(struct cxd2841er_priv *priv) in cxd2841er_shutdown_to_sleep_tc() argument
715 dev_dbg(&priv->i2c->dev, "%s()\n", __func__); in cxd2841er_shutdown_to_sleep_tc()
716 if (priv->state != STATE_SHUTDOWN) { in cxd2841er_shutdown_to_sleep_tc()
717 dev_dbg(&priv->i2c->dev, "%s(): invalid demod state %d\n", in cxd2841er_shutdown_to_sleep_tc()
718 __func__, priv->state); in cxd2841er_shutdown_to_sleep_tc()
722 cxd2841er_write_reg(priv, I2C_SLVX, 0x00, 0x00); in cxd2841er_shutdown_to_sleep_tc()
724 cxd2841er_write_reg(priv, I2C_SLVX, 0x02, 0x00); in cxd2841er_shutdown_to_sleep_tc()
727 cxd2841er_write_reg(priv, I2C_SLVX, 0x00, 0x00); in cxd2841er_shutdown_to_sleep_tc()
729 cxd2841er_write_reg(priv, I2C_SLVX, 0x10, 0x01); in cxd2841er_shutdown_to_sleep_tc()
731 cxd2841er_write_reg(priv, I2C_SLVX, 0x13, 0x00); in cxd2841er_shutdown_to_sleep_tc()
732 cxd2841er_write_reg(priv, I2C_SLVX, 0x14, 0x00); in cxd2841er_shutdown_to_sleep_tc()
734 cxd2841er_write_reg(priv, I2C_SLVX, 0x10, 0x00); in cxd2841er_shutdown_to_sleep_tc()
737 cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x00); in cxd2841er_shutdown_to_sleep_tc()
739 cxd2841er_write_reg(priv, I2C_SLVT, 0x43, 0x0a); in cxd2841er_shutdown_to_sleep_tc()
740 cxd2841er_write_reg(priv, I2C_SLVT, 0x41, 0x0a); in cxd2841er_shutdown_to_sleep_tc()
742 cxd2841er_write_reg(priv, I2C_SLVT, 0x63, 0x16); in cxd2841er_shutdown_to_sleep_tc()
743 cxd2841er_write_reg(priv, I2C_SLVT, 0x65, 0x27); in cxd2841er_shutdown_to_sleep_tc()
744 cxd2841er_write_reg(priv, I2C_SLVT, 0x69, 0x06); in cxd2841er_shutdown_to_sleep_tc()
745 priv->state = STATE_SLEEP_TC; in cxd2841er_shutdown_to_sleep_tc()
749 static int cxd2841er_tune_done(struct cxd2841er_priv *priv) in cxd2841er_tune_done() argument
751 dev_dbg(&priv->i2c->dev, "%s()\n", __func__); in cxd2841er_tune_done()
753 cxd2841er_write_reg(priv, I2C_SLVT, 0, 0); in cxd2841er_tune_done()
755 cxd2841er_write_reg(priv, I2C_SLVT, 0xfe, 0x01); in cxd2841er_tune_done()
757 cxd2841er_write_reg(priv, I2C_SLVT, 0xc3, 0x00); in cxd2841er_tune_done()
762 static void cxd2841er_set_ts_clock_mode(struct cxd2841er_priv *priv, in cxd2841er_set_ts_clock_mode() argument
767 dev_dbg(&priv->i2c->dev, "%s()\n", __func__); in cxd2841er_set_ts_clock_mode()
769 cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x00); in cxd2841er_set_ts_clock_mode()
770 cxd2841er_read_reg(priv, I2C_SLVT, 0xc4, &serial_ts); in cxd2841er_set_ts_clock_mode()
771 cxd2841er_read_reg(priv, I2C_SLVT, 0xd3, &ts_rate_ctrl_off); in cxd2841er_set_ts_clock_mode()
772 cxd2841er_read_reg(priv, I2C_SLVT, 0xde, &ts_in_off); in cxd2841er_set_ts_clock_mode()
773 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()
780 cxd2841er_write_reg(priv, I2C_SLVT, 0xd9, 0x08); in cxd2841er_set_ts_clock_mode()
786 cxd2841er_set_reg_bits(priv, I2C_SLVT, 0x32, 0x00, 0x01); in cxd2841er_set_ts_clock_mode()
791 cxd2841er_set_reg_bits(priv, I2C_SLVT, 0x33, 0x00, 0x03); in cxd2841er_set_ts_clock_mode()
797 cxd2841er_set_reg_bits(priv, I2C_SLVT, 0x32, 0x01, 0x01); in cxd2841er_set_ts_clock_mode()
801 cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x10); in cxd2841er_set_ts_clock_mode()
802 cxd2841er_set_reg_bits(priv, I2C_SLVT, 0x66, 0x01, 0x01); in cxd2841er_set_ts_clock_mode()
805 cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x40); in cxd2841er_set_ts_clock_mode()
806 cxd2841er_set_reg_bits(priv, I2C_SLVT, 0x66, 0x01, 0x01); in cxd2841er_set_ts_clock_mode()
810 static u8 cxd2841er_chip_id(struct cxd2841er_priv *priv) in cxd2841er_chip_id() argument
814 dev_dbg(&priv->i2c->dev, "%s()\n", __func__); in cxd2841er_chip_id()
815 cxd2841er_write_reg(priv, I2C_SLVT, 0, 0); in cxd2841er_chip_id()
816 cxd2841er_read_reg(priv, I2C_SLVT, 0xfd, &chip_id); in cxd2841er_chip_id()
824 struct cxd2841er_priv *priv = fe->demodulator_priv; in cxd2841er_read_status_s() local
826 dev_dbg(&priv->i2c->dev, "%s()\n", __func__); in cxd2841er_read_status_s()
828 if (priv->state != STATE_ACTIVE_S) { in cxd2841er_read_status_s()
829 dev_err(&priv->i2c->dev, "%s(): invalid state %d\n", in cxd2841er_read_status_s()
830 __func__, priv->state); in cxd2841er_read_status_s()
834 cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0xa0); in cxd2841er_read_status_s()
839 cxd2841er_read_reg(priv, I2C_SLVT, 0x11, &reg); in cxd2841er_read_status_s()
847 dev_dbg(&priv->i2c->dev, "%s(): result 0x%x\n", __func__, *status); in cxd2841er_read_status_s()
851 static int cxd2841er_read_status_t_t2(struct cxd2841er_priv *priv, in cxd2841er_read_status_t_t2() argument
856 dev_dbg(&priv->i2c->dev, "%s()\n", __func__); in cxd2841er_read_status_t_t2()
857 if (priv->state != STATE_ACTIVE_TC) in cxd2841er_read_status_t_t2()
859 if (priv->system == SYS_DVBT) { in cxd2841er_read_status_t_t2()
861 cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x10); in cxd2841er_read_status_t_t2()
864 cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x20); in cxd2841er_read_status_t_t2()
866 cxd2841er_read_reg(priv, I2C_SLVT, 0x10, &data); in cxd2841er_read_status_t_t2()
868 dev_dbg(&priv->i2c->dev, in cxd2841er_read_status_t_t2()
881 static int cxd2841er_read_status_c(struct cxd2841er_priv *priv, u8 *tslock) in cxd2841er_read_status_c() argument
885 dev_dbg(&priv->i2c->dev, "%s()\n", __func__); in cxd2841er_read_status_c()
886 if (priv->state != STATE_ACTIVE_TC) in cxd2841er_read_status_c()
888 cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x40); in cxd2841er_read_status_c()
889 cxd2841er_read_reg(priv, I2C_SLVT, 0x88, &data); in cxd2841er_read_status_c()
893 cxd2841er_read_reg(priv, I2C_SLVT, 0x10, &data); in cxd2841er_read_status_c()
906 struct cxd2841er_priv *priv = fe->demodulator_priv; in cxd2841er_read_status_tc() local
909 if (priv->state == STATE_ACTIVE_TC) { in cxd2841er_read_status_tc()
910 if (priv->system == SYS_DVBT || priv->system == SYS_DVBT2) { in cxd2841er_read_status_tc()
912 priv, &sync, &tslock, &unlock); in cxd2841er_read_status_tc()
924 } else if (priv->system == SYS_DVBC_ANNEX_A) { in cxd2841er_read_status_tc()
925 ret = cxd2841er_read_status_c(priv, &tslock); in cxd2841er_read_status_tc()
937 dev_dbg(&priv->i2c->dev, "%s(): status 0x%x\n", __func__, *status); in cxd2841er_read_status_tc()
941 static int cxd2841er_get_carrier_offset_s_s2(struct cxd2841er_priv *priv, in cxd2841er_get_carrier_offset_s_s2() argument
949 if (priv->state != STATE_ACTIVE_S) { in cxd2841er_get_carrier_offset_s_s2()
950 dev_dbg(&priv->i2c->dev, "%s(): invalid state %d\n", in cxd2841er_get_carrier_offset_s_s2()
951 __func__, priv->state); in cxd2841er_get_carrier_offset_s_s2()
959 cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0xa0); in cxd2841er_get_carrier_offset_s_s2()
960 cxd2841er_read_reg(priv, I2C_SLVT, 0x10, &data[0]); in cxd2841er_get_carrier_offset_s_s2()
966 cxd2841er_read_reg(priv, I2C_SLVT, 0x50, &data[0]); in cxd2841er_get_carrier_offset_s_s2()
969 dev_dbg(&priv->i2c->dev, in cxd2841er_get_carrier_offset_s_s2()
980 cxd2841er_read_regs(priv, I2C_SLVT, 0x45, data, 3); in cxd2841er_get_carrier_offset_s_s2()
1000 static int cxd2841er_get_carrier_offset_t2(struct cxd2841er_priv *priv, in cxd2841er_get_carrier_offset_t2() argument
1005 dev_dbg(&priv->i2c->dev, "%s()\n", __func__); in cxd2841er_get_carrier_offset_t2()
1006 if (priv->state != STATE_ACTIVE_TC) { in cxd2841er_get_carrier_offset_t2()
1007 dev_dbg(&priv->i2c->dev, "%s(): invalid state %d\n", in cxd2841er_get_carrier_offset_t2()
1008 __func__, priv->state); in cxd2841er_get_carrier_offset_t2()
1011 if (priv->system != SYS_DVBT2) { in cxd2841er_get_carrier_offset_t2()
1012 dev_dbg(&priv->i2c->dev, "%s(): invalid delivery system %d\n", in cxd2841er_get_carrier_offset_t2()
1013 __func__, priv->system); in cxd2841er_get_carrier_offset_t2()
1016 cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x20); in cxd2841er_get_carrier_offset_t2()
1017 cxd2841er_read_regs(priv, I2C_SLVT, 0x4c, data, sizeof(data)); in cxd2841er_get_carrier_offset_t2()
1033 dev_dbg(&priv->i2c->dev, "%s(): invalid bandwidth %d\n", in cxd2841er_get_carrier_offset_t2()
1040 static int cxd2841er_get_carrier_offset_c(struct cxd2841er_priv *priv, in cxd2841er_get_carrier_offset_c() argument
1045 dev_dbg(&priv->i2c->dev, "%s()\n", __func__); in cxd2841er_get_carrier_offset_c()
1046 if (priv->state != STATE_ACTIVE_TC) { in cxd2841er_get_carrier_offset_c()
1047 dev_dbg(&priv->i2c->dev, "%s(): invalid state %d\n", in cxd2841er_get_carrier_offset_c()
1048 __func__, priv->state); in cxd2841er_get_carrier_offset_c()
1051 if (priv->system != SYS_DVBC_ANNEX_A) { in cxd2841er_get_carrier_offset_c()
1052 dev_dbg(&priv->i2c->dev, "%s(): invalid delivery system %d\n", in cxd2841er_get_carrier_offset_c()
1053 __func__, priv->system); in cxd2841er_get_carrier_offset_c()
1056 cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x40); in cxd2841er_get_carrier_offset_c()
1057 cxd2841er_read_regs(priv, I2C_SLVT, 0x15, data, sizeof(data)); in cxd2841er_get_carrier_offset_c()
1064 struct cxd2841er_priv *priv, u32 *penum) in cxd2841er_read_packet_errors_t() argument
1069 if (priv->state != STATE_ACTIVE_TC) { in cxd2841er_read_packet_errors_t()
1070 dev_dbg(&priv->i2c->dev, "%s(): invalid state %d\n", in cxd2841er_read_packet_errors_t()
1071 __func__, priv->state); in cxd2841er_read_packet_errors_t()
1074 cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x10); in cxd2841er_read_packet_errors_t()
1075 cxd2841er_read_regs(priv, I2C_SLVT, 0xea, data, sizeof(data)); in cxd2841er_read_packet_errors_t()
1082 struct cxd2841er_priv *priv, u32 *penum) in cxd2841er_read_packet_errors_t2() argument
1087 if (priv->state != STATE_ACTIVE_TC) { in cxd2841er_read_packet_errors_t2()
1088 dev_dbg(&priv->i2c->dev, "%s(): invalid state %d\n", in cxd2841er_read_packet_errors_t2()
1089 __func__, priv->state); in cxd2841er_read_packet_errors_t2()
1092 cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x24); in cxd2841er_read_packet_errors_t2()
1093 cxd2841er_read_regs(priv, I2C_SLVT, 0xfd, data, sizeof(data)); in cxd2841er_read_packet_errors_t2()
1099 static u32 cxd2841er_mon_read_ber_s(struct cxd2841er_priv *priv) in cxd2841er_mon_read_ber_s() argument
1106 cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0xa0); in cxd2841er_mon_read_ber_s()
1117 cxd2841er_read_regs(priv, I2C_SLVT, 0x35, data, 11); in cxd2841er_mon_read_ber_s()
1131 dev_dbg(&priv->i2c->dev, in cxd2841er_mon_read_ber_s()
1142 dev_dbg(&priv->i2c->dev, "%s(): no data available\n", __func__); in cxd2841er_mon_read_ber_s()
1147 static u32 cxd2841er_mon_read_ber_s2(struct cxd2841er_priv *priv) in cxd2841er_mon_read_ber_s2() argument
1155 cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0xb2); in cxd2841er_mon_read_ber_s2()
1164 cxd2841er_read_regs(priv, I2C_SLVT, 0x30, data, 5); in cxd2841er_mon_read_ber_s2()
1173 cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0xa0); in cxd2841er_mon_read_ber_s2()
1174 cxd2841er_read_reg(priv, I2C_SLVT, 0x7a, data); in cxd2841er_mon_read_ber_s2()
1178 dev_dbg(&priv->i2c->dev, in cxd2841er_mon_read_ber_s2()
1183 dev_dbg(&priv->i2c->dev, in cxd2841er_mon_read_ber_s2()
1201 dev_dbg(&priv->i2c->dev, in cxd2841er_mon_read_ber_s2()
1207 static int cxd2841er_read_ber_t2(struct cxd2841er_priv *priv, u32 *ber) in cxd2841er_read_ber_t2() argument
1214 if (priv->state != STATE_ACTIVE_TC) { in cxd2841er_read_ber_t2()
1215 dev_dbg(&priv->i2c->dev, in cxd2841er_read_ber_t2()
1216 "%s(): invalid state %d\n", __func__, priv->state); in cxd2841er_read_ber_t2()
1219 cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x20); in cxd2841er_read_ber_t2()
1220 cxd2841er_read_regs(priv, I2C_SLVT, 0x39, data, sizeof(data)); in cxd2841er_read_ber_t2()
1222 dev_dbg(&priv->i2c->dev, in cxd2841er_read_ber_t2()
1230 cxd2841er_read_reg(priv, I2C_SLVT, 0x6f, data); in cxd2841er_read_ber_t2()
1232 cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x22); in cxd2841er_read_ber_t2()
1233 cxd2841er_read_reg(priv, I2C_SLVT, 0x5e, data); in cxd2841er_read_ber_t2()
1236 dev_dbg(&priv->i2c->dev, in cxd2841er_read_ber_t2()
1251 static int cxd2841er_read_ber_t(struct cxd2841er_priv *priv, u32 *ber) in cxd2841er_read_ber_t() argument
1258 if (priv->state != STATE_ACTIVE_TC) { in cxd2841er_read_ber_t()
1259 dev_dbg(&priv->i2c->dev, in cxd2841er_read_ber_t()
1260 "%s(): invalid state %d\n", __func__, priv->state); in cxd2841er_read_ber_t()
1263 cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x10); in cxd2841er_read_ber_t()
1264 cxd2841er_read_reg(priv, I2C_SLVT, 0x39, data); in cxd2841er_read_ber_t()
1266 dev_dbg(&priv->i2c->dev, in cxd2841er_read_ber_t()
1270 cxd2841er_read_regs(priv, I2C_SLVT, 0x22, data, sizeof(data)); in cxd2841er_read_ber_t()
1272 cxd2841er_read_reg(priv, I2C_SLVT, 0x6f, data); in cxd2841er_read_ber_t()
1280 static u32 cxd2841er_dvbs_read_snr(struct cxd2841er_priv *priv, u8 delsys) in cxd2841er_dvbs_read_snr() argument
1288 cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0xa1); in cxd2841er_dvbs_read_snr()
1295 cxd2841er_read_regs(priv, I2C_SLVT, 0x10, data, 3); in cxd2841er_dvbs_read_snr()
1336 dev_dbg(&priv->i2c->dev, in cxd2841er_dvbs_read_snr()
1343 static int cxd2841er_read_snr_t(struct cxd2841er_priv *priv, u32 *snr) in cxd2841er_read_snr_t() argument
1349 if (priv->state != STATE_ACTIVE_TC) { in cxd2841er_read_snr_t()
1350 dev_dbg(&priv->i2c->dev, in cxd2841er_read_snr_t()
1351 "%s(): invalid state %d\n", __func__, priv->state); in cxd2841er_read_snr_t()
1354 cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x10); in cxd2841er_read_snr_t()
1355 cxd2841er_read_regs(priv, I2C_SLVT, 0x28, data, sizeof(data)); in cxd2841er_read_snr_t()
1358 dev_dbg(&priv->i2c->dev, in cxd2841er_read_snr_t()
1368 static int cxd2841er_read_snr_t2(struct cxd2841er_priv *priv, u32 *snr) in cxd2841er_read_snr_t2() argument
1374 if (priv->state != STATE_ACTIVE_TC) { in cxd2841er_read_snr_t2()
1375 dev_dbg(&priv->i2c->dev, in cxd2841er_read_snr_t2()
1376 "%s(): invalid state %d\n", __func__, priv->state); in cxd2841er_read_snr_t2()
1379 cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x20); in cxd2841er_read_snr_t2()
1380 cxd2841er_read_regs(priv, I2C_SLVT, 0x28, data, sizeof(data)); in cxd2841er_read_snr_t2()
1383 dev_dbg(&priv->i2c->dev, in cxd2841er_read_snr_t2()
1394 static u16 cxd2841er_read_agc_gain_t_t2(struct cxd2841er_priv *priv, in cxd2841er_read_agc_gain_t_t2() argument
1400 priv, I2C_SLVT, 0x00, (delsys == SYS_DVBT ? 0x10 : 0x20)); in cxd2841er_read_agc_gain_t_t2()
1401 cxd2841er_read_regs(priv, I2C_SLVT, 0x26, data, 2); in cxd2841er_read_agc_gain_t_t2()
1405 static u16 cxd2841er_read_agc_gain_s(struct cxd2841er_priv *priv) in cxd2841er_read_agc_gain_s() argument
1410 cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0xa0); in cxd2841er_read_agc_gain_s()
1416 cxd2841er_read_regs(priv, I2C_SLVT, 0x1f, data, 2); in cxd2841er_read_agc_gain_s()
1423 struct cxd2841er_priv *priv = fe->demodulator_priv; in cxd2841er_read_ber() local
1425 dev_dbg(&priv->i2c->dev, "%s()\n", __func__); in cxd2841er_read_ber()
1429 *ber = cxd2841er_mon_read_ber_s(priv); in cxd2841er_read_ber()
1432 *ber = cxd2841er_mon_read_ber_s2(priv); in cxd2841er_read_ber()
1435 return cxd2841er_read_ber_t(priv, ber); in cxd2841er_read_ber()
1437 return cxd2841er_read_ber_t2(priv, ber); in cxd2841er_read_ber()
1449 struct cxd2841er_priv *priv = fe->demodulator_priv; in cxd2841er_read_signal_strength() local
1451 dev_dbg(&priv->i2c->dev, "%s()\n", __func__); in cxd2841er_read_signal_strength()
1456 priv, p->delivery_system); in cxd2841er_read_signal_strength()
1460 *strength = 65535 - cxd2841er_read_agc_gain_s(priv); in cxd2841er_read_signal_strength()
1473 struct cxd2841er_priv *priv = fe->demodulator_priv; in cxd2841er_read_snr() local
1475 dev_dbg(&priv->i2c->dev, "%s()\n", __func__); in cxd2841er_read_snr()
1478 cxd2841er_read_snr_t(priv, &tmp); in cxd2841er_read_snr()
1481 cxd2841er_read_snr_t2(priv, &tmp); in cxd2841er_read_snr()
1485 tmp = cxd2841er_dvbs_read_snr(priv, p->delivery_system); in cxd2841er_read_snr()
1488 dev_dbg(&priv->i2c->dev, "%s(): unknown delivery system %d\n", in cxd2841er_read_snr()
1499 struct cxd2841er_priv *priv = fe->demodulator_priv; in cxd2841er_read_ucblocks() local
1501 dev_dbg(&priv->i2c->dev, "%s()\n", __func__); in cxd2841er_read_ucblocks()
1504 cxd2841er_read_packet_errors_t(priv, ucblocks); in cxd2841er_read_ucblocks()
1507 cxd2841er_read_packet_errors_t2(priv, ucblocks); in cxd2841er_read_ucblocks()
1513 dev_dbg(&priv->i2c->dev, "%s()\n", __func__); in cxd2841er_read_ucblocks()
1518 struct cxd2841er_priv *priv, enum cxd2841er_dvbt2_profile_t profile) in cxd2841er_dvbt2_set_profile() argument
1523 dev_dbg(&priv->i2c->dev, "%s()\n", __func__); in cxd2841er_dvbt2_set_profile()
1541 cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x2e); in cxd2841er_dvbt2_set_profile()
1543 cxd2841er_set_reg_bits(priv, I2C_SLVT, 0x10, tune_mode, 0x07); in cxd2841er_dvbt2_set_profile()
1545 cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x2b); in cxd2841er_dvbt2_set_profile()
1547 cxd2841er_write_reg(priv, I2C_SLVT, 0x9d, seq_not2d_time); in cxd2841er_dvbt2_set_profile()
1551 static int cxd2841er_dvbt2_set_plp_config(struct cxd2841er_priv *priv, in cxd2841er_dvbt2_set_plp_config() argument
1555 dev_dbg(&priv->i2c->dev, in cxd2841er_dvbt2_set_plp_config()
1558 dev_dbg(&priv->i2c->dev, in cxd2841er_dvbt2_set_plp_config()
1563 cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x23); in cxd2841er_dvbt2_set_plp_config()
1566 cxd2841er_write_reg(priv, I2C_SLVT, 0xaf, plp_id); in cxd2841er_dvbt2_set_plp_config()
1569 cxd2841er_write_reg(priv, I2C_SLVT, 0xad, (is_auto ? 0x00 : 0x01)); in cxd2841er_dvbt2_set_plp_config()
1573 static int cxd2841er_sleep_tc_to_active_t2_band(struct cxd2841er_priv *priv, in cxd2841er_sleep_tc_to_active_t2_band() argument
1582 dev_dbg(&priv->i2c->dev, "%s()\n", __func__); in cxd2841er_sleep_tc_to_active_t2_band()
1713 cxd2841er_write_reg(priv, I2C_SLVX, 0x00, 0x20); in cxd2841er_sleep_tc_to_active_t2_band()
1714 cxd2841er_write_regs(priv, I2C_SLVT, 0x9f, b20_9f, sizeof(b20_9f)); in cxd2841er_sleep_tc_to_active_t2_band()
1716 cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x27); in cxd2841er_sleep_tc_to_active_t2_band()
1718 priv, I2C_SLVT, 0x7a, in cxd2841er_sleep_tc_to_active_t2_band()
1721 cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x10); in cxd2841er_sleep_tc_to_active_t2_band()
1723 cxd2841er_write_regs(priv, I2C_SLVT, 0xa6, b10_a6, sizeof(b10_a6)); in cxd2841er_sleep_tc_to_active_t2_band()
1728 cxd2841er_write_regs(priv, I2C_SLVT, 0xb6, b10_b6, sizeof(b10_b6)); in cxd2841er_sleep_tc_to_active_t2_band()
1730 cxd2841er_set_reg_bits(priv, I2C_SLVT, 0xd7, b10_d7, 0x07); in cxd2841er_sleep_tc_to_active_t2_band()
1735 struct cxd2841er_priv *priv, u32 bandwidth) in cxd2841er_sleep_tc_to_active_t_band() argument
1766 dev_dbg(&priv->i2c->dev, "%s()\n", __func__); in cxd2841er_sleep_tc_to_active_t_band()
1767 cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x13); in cxd2841er_sleep_tc_to_active_t_band()
1769 cxd2841er_write_regs(priv, I2C_SLVT, 0x9c, b13_9c, sizeof(b13_9c)); in cxd2841er_sleep_tc_to_active_t_band()
1770 cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x10); in cxd2841er_sleep_tc_to_active_t_band()
1806 dev_dbg(&priv->i2c->dev, "%s(): invalid bandwidth %d\n", in cxd2841er_sleep_tc_to_active_t_band()
1815 priv, I2C_SLVT, 0x9f, b10_9f, sizeof(bw8mhz_b10_9f)); in cxd2841er_sleep_tc_to_active_t_band()
1817 priv, I2C_SLVT, 0xa6, b10_a6, sizeof(bw8mhz_b10_a6)); in cxd2841er_sleep_tc_to_active_t_band()
1818 cxd2841er_write_regs(priv, I2C_SLVT, 0xb6, b10_b6, sizeof(b10_b6)); in cxd2841er_sleep_tc_to_active_t_band()
1819 cxd2841er_set_reg_bits(priv, I2C_SLVT, 0xd7, d7val, 0x7); in cxd2841er_sleep_tc_to_active_t_band()
1821 priv, I2C_SLVT, 0xd9, b10_d9, sizeof(bw8mhz_b10_d9)); in cxd2841er_sleep_tc_to_active_t_band()
1822 cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x17); in cxd2841er_sleep_tc_to_active_t_band()
1824 priv, I2C_SLVT, 0x38, b17_38, sizeof(bw8mhz_b17_38)); in cxd2841er_sleep_tc_to_active_t_band()
1828 static int cxd2841er_sleep_tc_to_active_c_band(struct cxd2841er_priv *priv, in cxd2841er_sleep_tc_to_active_c_band() argument
1840 dev_dbg(&priv->i2c->dev, "%s()\n", __func__); in cxd2841er_sleep_tc_to_active_c_band()
1841 cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x10); in cxd2841er_sleep_tc_to_active_c_band()
1846 priv, I2C_SLVT, 0xa6, in cxd2841er_sleep_tc_to_active_c_band()
1852 priv, I2C_SLVT, 0xa6, in cxd2841er_sleep_tc_to_active_c_band()
1857 dev_dbg(&priv->i2c->dev, "%s(): unsupported bandwidth %d\n", in cxd2841er_sleep_tc_to_active_c_band()
1865 cxd2841er_write_regs(priv, I2C_SLVT, 0xb6, b10_b6, sizeof(b10_b6)); in cxd2841er_sleep_tc_to_active_c_band()
1867 cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x11); in cxd2841er_sleep_tc_to_active_c_band()
1872 priv, I2C_SLVT, 0xa3, 0x00, 0x1f); in cxd2841er_sleep_tc_to_active_c_band()
1876 priv, I2C_SLVT, 0xa3, 0x14, 0x1f); in cxd2841er_sleep_tc_to_active_c_band()
1880 cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x40); in cxd2841er_sleep_tc_to_active_c_band()
1884 priv, I2C_SLVT, 0x26, 0x0b, 0x0f); in cxd2841er_sleep_tc_to_active_c_band()
1885 cxd2841er_write_reg(priv, I2C_SLVT, 0x27, 0x3e); in cxd2841er_sleep_tc_to_active_c_band()
1889 priv, I2C_SLVT, 0x26, 0x09, 0x0f); in cxd2841er_sleep_tc_to_active_c_band()
1890 cxd2841er_write_reg(priv, I2C_SLVT, 0x27, 0xd6); in cxd2841er_sleep_tc_to_active_c_band()
1894 priv, I2C_SLVT, 0x26, 0x08, 0x0f); in cxd2841er_sleep_tc_to_active_c_band()
1895 cxd2841er_write_reg(priv, I2C_SLVT, 0x27, 0x6e); in cxd2841er_sleep_tc_to_active_c_band()
1901 static int cxd2841er_sleep_tc_to_active_t(struct cxd2841er_priv *priv, in cxd2841er_sleep_tc_to_active_t() argument
1906 dev_dbg(&priv->i2c->dev, "%s()\n", __func__); in cxd2841er_sleep_tc_to_active_t()
1907 cxd2841er_set_ts_clock_mode(priv, SYS_DVBT); in cxd2841er_sleep_tc_to_active_t()
1909 cxd2841er_write_reg(priv, I2C_SLVX, 0x00, 0x00); in cxd2841er_sleep_tc_to_active_t()
1911 cxd2841er_write_reg(priv, I2C_SLVX, 0x17, 0x01); in cxd2841er_sleep_tc_to_active_t()
1913 cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x00); in cxd2841er_sleep_tc_to_active_t()
1915 cxd2841er_write_reg(priv, I2C_SLVT, 0x2c, 0x01); in cxd2841er_sleep_tc_to_active_t()
1917 cxd2841er_write_reg(priv, I2C_SLVT, 0x2f, 0x00); in cxd2841er_sleep_tc_to_active_t()
1919 cxd2841er_write_reg(priv, I2C_SLVT, 0x30, 0x00); in cxd2841er_sleep_tc_to_active_t()
1921 cxd2841er_write_reg(priv, I2C_SLVT, 0x41, 0x1a); in cxd2841er_sleep_tc_to_active_t()
1923 cxd2841er_write_regs(priv, I2C_SLVT, 0x43, data, 2); in cxd2841er_sleep_tc_to_active_t()
1925 cxd2841er_write_reg(priv, I2C_SLVX, 0x18, 0x00); in cxd2841er_sleep_tc_to_active_t()
1927 cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x10); in cxd2841er_sleep_tc_to_active_t()
1929 cxd2841er_set_reg_bits(priv, I2C_SLVT, 0xd2, 0x0c, 0x1f); in cxd2841er_sleep_tc_to_active_t()
1931 cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x11); in cxd2841er_sleep_tc_to_active_t()
1933 cxd2841er_write_reg(priv, I2C_SLVT, 0x6a, 0x50); in cxd2841er_sleep_tc_to_active_t()
1935 cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x10); in cxd2841er_sleep_tc_to_active_t()
1937 cxd2841er_set_reg_bits(priv, I2C_SLVT, 0xa5, 0x01, 0x01); in cxd2841er_sleep_tc_to_active_t()
1939 cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x18); in cxd2841er_sleep_tc_to_active_t()
1941 cxd2841er_set_reg_bits(priv, I2C_SLVT, 0x36, 0x40, 0x07); in cxd2841er_sleep_tc_to_active_t()
1943 cxd2841er_set_reg_bits(priv, I2C_SLVT, 0x30, 0x01, 0x01); in cxd2841er_sleep_tc_to_active_t()
1944 cxd2841er_set_reg_bits(priv, I2C_SLVT, 0x31, 0x01, 0x01); in cxd2841er_sleep_tc_to_active_t()
1946 cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x00); in cxd2841er_sleep_tc_to_active_t()
1948 cxd2841er_set_reg_bits(priv, I2C_SLVT, 0xce, 0x01, 0x01); in cxd2841er_sleep_tc_to_active_t()
1949 cxd2841er_set_reg_bits(priv, I2C_SLVT, 0xcf, 0x01, 0x01); in cxd2841er_sleep_tc_to_active_t()
1950 cxd2841er_sleep_tc_to_active_t_band(priv, bandwidth); in cxd2841er_sleep_tc_to_active_t()
1952 cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x00); in cxd2841er_sleep_tc_to_active_t()
1954 cxd2841er_write_reg(priv, I2C_SLVT, 0x80, 0x28); in cxd2841er_sleep_tc_to_active_t()
1956 cxd2841er_write_reg(priv, I2C_SLVT, 0x81, 0x00); in cxd2841er_sleep_tc_to_active_t()
1957 priv->state = STATE_ACTIVE_TC; in cxd2841er_sleep_tc_to_active_t()
1961 static int cxd2841er_sleep_tc_to_active_t2(struct cxd2841er_priv *priv, in cxd2841er_sleep_tc_to_active_t2() argument
1966 dev_dbg(&priv->i2c->dev, "%s()\n", __func__); in cxd2841er_sleep_tc_to_active_t2()
1967 cxd2841er_set_ts_clock_mode(priv, SYS_DVBT2); in cxd2841er_sleep_tc_to_active_t2()
1969 cxd2841er_write_reg(priv, I2C_SLVX, 0x00, 0x00); in cxd2841er_sleep_tc_to_active_t2()
1971 cxd2841er_write_reg(priv, I2C_SLVX, 0x17, 0x02); in cxd2841er_sleep_tc_to_active_t2()
1973 cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x00); in cxd2841er_sleep_tc_to_active_t2()
1975 cxd2841er_write_reg(priv, I2C_SLVT, 0x2c, 0x01); in cxd2841er_sleep_tc_to_active_t2()
1977 cxd2841er_write_reg(priv, I2C_SLVT, 0x2f, 0x00); in cxd2841er_sleep_tc_to_active_t2()
1979 cxd2841er_write_reg(priv, I2C_SLVT, 0x30, 0x00); in cxd2841er_sleep_tc_to_active_t2()
1981 cxd2841er_write_reg(priv, I2C_SLVT, 0x41, 0x1a); in cxd2841er_sleep_tc_to_active_t2()
1983 cxd2841er_write_regs(priv, I2C_SLVT, 0x43, data, 2); in cxd2841er_sleep_tc_to_active_t2()
1985 cxd2841er_write_reg(priv, I2C_SLVX, 0x18, 0x00); in cxd2841er_sleep_tc_to_active_t2()
1987 cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x10); in cxd2841er_sleep_tc_to_active_t2()
1989 cxd2841er_set_reg_bits(priv, I2C_SLVT, 0xd2, 0x0c, 0x1f); in cxd2841er_sleep_tc_to_active_t2()
1991 cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x11); in cxd2841er_sleep_tc_to_active_t2()
1993 cxd2841er_write_reg(priv, I2C_SLVT, 0x6a, 0x50); in cxd2841er_sleep_tc_to_active_t2()
1995 cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x10); in cxd2841er_sleep_tc_to_active_t2()
1997 cxd2841er_set_reg_bits(priv, I2C_SLVT, 0xa5, 0x01, 0x01); in cxd2841er_sleep_tc_to_active_t2()
1999 cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x20); in cxd2841er_sleep_tc_to_active_t2()
2001 cxd2841er_write_reg(priv, I2C_SLVT, 0x8b, 0x3c); in cxd2841er_sleep_tc_to_active_t2()
2003 cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x2b); in cxd2841er_sleep_tc_to_active_t2()
2004 cxd2841er_set_reg_bits(priv, I2C_SLVT, 0x76, 0x20, 0x70); in cxd2841er_sleep_tc_to_active_t2()
2006 cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x00); in cxd2841er_sleep_tc_to_active_t2()
2008 cxd2841er_set_reg_bits(priv, I2C_SLVT, 0xce, 0x01, 0x01); in cxd2841er_sleep_tc_to_active_t2()
2009 cxd2841er_set_reg_bits(priv, I2C_SLVT, 0xcf, 0x01, 0x01); in cxd2841er_sleep_tc_to_active_t2()
2011 cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x13); in cxd2841er_sleep_tc_to_active_t2()
2012 cxd2841er_write_reg(priv, I2C_SLVT, 0x83, 0x10); in cxd2841er_sleep_tc_to_active_t2()
2013 cxd2841er_write_reg(priv, I2C_SLVT, 0x86, 0x34); in cxd2841er_sleep_tc_to_active_t2()
2014 cxd2841er_set_reg_bits(priv, I2C_SLVT, 0x9e, 0x09, 0x0f); in cxd2841er_sleep_tc_to_active_t2()
2015 cxd2841er_write_reg(priv, I2C_SLVT, 0x9f, 0xd8); in cxd2841er_sleep_tc_to_active_t2()
2017 cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x2a); in cxd2841er_sleep_tc_to_active_t2()
2018 cxd2841er_set_reg_bits(priv, I2C_SLVT, 0x38, 0x04, 0x0f); in cxd2841er_sleep_tc_to_active_t2()
2020 cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x2b); in cxd2841er_sleep_tc_to_active_t2()
2021 cxd2841er_set_reg_bits(priv, I2C_SLVT, 0x11, 0x20, 0x3f); in cxd2841er_sleep_tc_to_active_t2()
2023 cxd2841er_sleep_tc_to_active_t2_band(priv, bandwidth); in cxd2841er_sleep_tc_to_active_t2()
2026 cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x00); in cxd2841er_sleep_tc_to_active_t2()
2028 cxd2841er_write_reg(priv, I2C_SLVT, 0x80, 0x28); in cxd2841er_sleep_tc_to_active_t2()
2030 cxd2841er_write_reg(priv, I2C_SLVT, 0x81, 0x00); in cxd2841er_sleep_tc_to_active_t2()
2031 priv->state = STATE_ACTIVE_TC; in cxd2841er_sleep_tc_to_active_t2()
2035 static int cxd2841er_sleep_tc_to_active_c(struct cxd2841er_priv *priv, in cxd2841er_sleep_tc_to_active_c() argument
2040 dev_dbg(&priv->i2c->dev, "%s()\n", __func__); in cxd2841er_sleep_tc_to_active_c()
2041 cxd2841er_set_ts_clock_mode(priv, SYS_DVBC_ANNEX_A); in cxd2841er_sleep_tc_to_active_c()
2043 cxd2841er_write_reg(priv, I2C_SLVX, 0x00, 0x00); in cxd2841er_sleep_tc_to_active_c()
2045 cxd2841er_write_reg(priv, I2C_SLVX, 0x17, 0x04); in cxd2841er_sleep_tc_to_active_c()
2047 cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x00); in cxd2841er_sleep_tc_to_active_c()
2049 cxd2841er_write_reg(priv, I2C_SLVT, 0x2c, 0x01); in cxd2841er_sleep_tc_to_active_c()
2051 cxd2841er_write_reg(priv, I2C_SLVT, 0x2f, 0x00); in cxd2841er_sleep_tc_to_active_c()
2053 cxd2841er_write_reg(priv, I2C_SLVT, 0x30, 0x00); in cxd2841er_sleep_tc_to_active_c()
2055 cxd2841er_write_reg(priv, I2C_SLVT, 0x41, 0x1a); in cxd2841er_sleep_tc_to_active_c()
2057 cxd2841er_write_regs(priv, I2C_SLVT, 0x43, data, 2); in cxd2841er_sleep_tc_to_active_c()
2059 cxd2841er_write_reg(priv, I2C_SLVX, 0x18, 0x00); in cxd2841er_sleep_tc_to_active_c()
2061 cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x10); in cxd2841er_sleep_tc_to_active_c()
2063 cxd2841er_set_reg_bits(priv, I2C_SLVT, 0xd2, 0x09, 0x1f); in cxd2841er_sleep_tc_to_active_c()
2065 cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x11); in cxd2841er_sleep_tc_to_active_c()
2067 cxd2841er_write_reg(priv, I2C_SLVT, 0x6a, 0x48); in cxd2841er_sleep_tc_to_active_c()
2069 cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x10); in cxd2841er_sleep_tc_to_active_c()
2071 cxd2841er_set_reg_bits(priv, I2C_SLVT, 0xa5, 0x01, 0x01); in cxd2841er_sleep_tc_to_active_c()
2073 cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x40); in cxd2841er_sleep_tc_to_active_c()
2075 cxd2841er_set_reg_bits(priv, I2C_SLVT, 0xc3, 0x00, 0x04); in cxd2841er_sleep_tc_to_active_c()
2077 cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x00); in cxd2841er_sleep_tc_to_active_c()
2079 cxd2841er_set_reg_bits(priv, I2C_SLVT, 0xce, 0x01, 0x01); in cxd2841er_sleep_tc_to_active_c()
2080 cxd2841er_set_reg_bits(priv, I2C_SLVT, 0xcf, 0x01, 0x01); in cxd2841er_sleep_tc_to_active_c()
2082 cxd2841er_sleep_tc_to_active_c_band(priv, 8000000); in cxd2841er_sleep_tc_to_active_c()
2084 cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x00); in cxd2841er_sleep_tc_to_active_c()
2086 cxd2841er_write_reg(priv, I2C_SLVT, 0x80, 0x28); in cxd2841er_sleep_tc_to_active_c()
2088 cxd2841er_write_reg(priv, I2C_SLVT, 0x81, 0x00); in cxd2841er_sleep_tc_to_active_c()
2089 priv->state = STATE_ACTIVE_TC; in cxd2841er_sleep_tc_to_active_c()
2098 struct cxd2841er_priv *priv = fe->demodulator_priv; in cxd2841er_get_frontend() local
2101 dev_dbg(&priv->i2c->dev, "%s()\n", __func__); in cxd2841er_get_frontend()
2102 if (priv->state == STATE_ACTIVE_S) in cxd2841er_get_frontend()
2104 else if (priv->state == STATE_ACTIVE_TC) in cxd2841er_get_frontend()
2141 struct cxd2841er_priv *priv = fe->demodulator_priv; in cxd2841er_set_frontend_s() local
2145 dev_dbg(&priv->i2c->dev, "%s(): %s frequency=%d symbol_rate=%d\n", in cxd2841er_set_frontend_s()
2149 switch (priv->state) { in cxd2841er_set_frontend_s()
2152 priv, p->delivery_system, symbol_rate); in cxd2841er_set_frontend_s()
2155 ret = cxd2841er_retune_active(priv, p); in cxd2841er_set_frontend_s()
2158 dev_dbg(&priv->i2c->dev, "%s(): invalid state %d\n", in cxd2841er_set_frontend_s()
2159 __func__, priv->state); in cxd2841er_set_frontend_s()
2164 dev_dbg(&priv->i2c->dev, "%s(): tune failed\n", __func__); in cxd2841er_set_frontend_s()
2173 cxd2841er_tune_done(priv); in cxd2841er_set_frontend_s()
2184 priv, &carr_offset)) { in cxd2841er_set_frontend_s()
2188 dev_dbg(&priv->i2c->dev, "%s(): carrier_offset=%d\n", in cxd2841er_set_frontend_s()
2199 struct cxd2841er_priv *priv = fe->demodulator_priv; in cxd2841er_set_frontend_tc() local
2202 dev_dbg(&priv->i2c->dev, "%s()\n", __func__); in cxd2841er_set_frontend_tc()
2204 priv->system = SYS_DVBT; in cxd2841er_set_frontend_tc()
2205 switch (priv->state) { in cxd2841er_set_frontend_tc()
2208 priv, p->bandwidth_hz); in cxd2841er_set_frontend_tc()
2211 ret = cxd2841er_retune_active(priv, p); in cxd2841er_set_frontend_tc()
2214 dev_dbg(&priv->i2c->dev, "%s(): invalid state %d\n", in cxd2841er_set_frontend_tc()
2215 __func__, priv->state); in cxd2841er_set_frontend_tc()
2219 priv->system = SYS_DVBT2; in cxd2841er_set_frontend_tc()
2220 cxd2841er_dvbt2_set_plp_config(priv, in cxd2841er_set_frontend_tc()
2222 cxd2841er_dvbt2_set_profile(priv, DVBT2_PROFILE_BASE); in cxd2841er_set_frontend_tc()
2223 switch (priv->state) { in cxd2841er_set_frontend_tc()
2225 ret = cxd2841er_sleep_tc_to_active_t2(priv, in cxd2841er_set_frontend_tc()
2229 ret = cxd2841er_retune_active(priv, p); in cxd2841er_set_frontend_tc()
2232 dev_dbg(&priv->i2c->dev, "%s(): invalid state %d\n", in cxd2841er_set_frontend_tc()
2233 __func__, priv->state); in cxd2841er_set_frontend_tc()
2238 priv->system = SYS_DVBC_ANNEX_A; in cxd2841er_set_frontend_tc()
2239 switch (priv->state) { in cxd2841er_set_frontend_tc()
2242 priv, p->bandwidth_hz); in cxd2841er_set_frontend_tc()
2245 ret = cxd2841er_retune_active(priv, p); in cxd2841er_set_frontend_tc()
2248 dev_dbg(&priv->i2c->dev, "%s(): invalid state %d\n", in cxd2841er_set_frontend_tc()
2249 __func__, priv->state); in cxd2841er_set_frontend_tc()
2253 dev_dbg(&priv->i2c->dev, in cxd2841er_set_frontend_tc()
2266 cxd2841er_tune_done(priv); in cxd2841er_set_frontend_tc()
2278 dev_dbg(&priv->i2c->dev, in cxd2841er_set_frontend_tc()
2291 struct cxd2841er_priv *priv = fe->demodulator_priv; in cxd2841er_tune_s() local
2294 dev_dbg(&priv->i2c->dev, "%s() re_tune=%d\n", __func__, re_tune); in cxd2841er_tune_s()
2302 priv, &carrier_offset)) in cxd2841er_tune_s()
2321 struct cxd2841er_priv *priv = fe->demodulator_priv; in cxd2841er_tune_tc() local
2324 dev_dbg(&priv->i2c->dev, "%s(): re_tune %d\n", __func__, re_tune); in cxd2841er_tune_tc()
2331 switch (priv->system) { in cxd2841er_tune_tc()
2335 priv, p->bandwidth_hz, in cxd2841er_tune_tc()
2340 priv, &carrier_offset); in cxd2841er_tune_tc()
2343 dev_dbg(&priv->i2c->dev, in cxd2841er_tune_tc()
2345 __func__, priv->system); in cxd2841er_tune_tc()
2350 dev_dbg(&priv->i2c->dev, "%s(): carrier offset %d\n", in cxd2841er_tune_tc()
2364 struct cxd2841er_priv *priv = fe->demodulator_priv; in cxd2841er_sleep_s() local
2366 dev_dbg(&priv->i2c->dev, "%s()\n", __func__); in cxd2841er_sleep_s()
2374 struct cxd2841er_priv *priv = fe->demodulator_priv; in cxd2841er_sleep_tc() local
2376 dev_dbg(&priv->i2c->dev, "%s()\n", __func__); in cxd2841er_sleep_tc()
2377 if (priv->state == STATE_ACTIVE_TC) { in cxd2841er_sleep_tc()
2378 switch (priv->system) { in cxd2841er_sleep_tc()
2380 cxd2841er_active_t_to_sleep_tc(priv); in cxd2841er_sleep_tc()
2383 cxd2841er_active_t2_to_sleep_tc(priv); in cxd2841er_sleep_tc()
2386 cxd2841er_active_c_to_sleep_tc(priv); in cxd2841er_sleep_tc()
2389 dev_warn(&priv->i2c->dev, in cxd2841er_sleep_tc()
2391 __func__, priv->system); in cxd2841er_sleep_tc()
2394 if (priv->state != STATE_SLEEP_TC) { in cxd2841er_sleep_tc()
2395 dev_err(&priv->i2c->dev, "%s(): invalid state %d\n", in cxd2841er_sleep_tc()
2396 __func__, priv->state); in cxd2841er_sleep_tc()
2399 cxd2841er_sleep_tc_to_shutdown(priv); in cxd2841er_sleep_tc()
2407 struct cxd2841er_priv *priv = fe->demodulator_priv; in cxd2841er_send_burst() local
2409 dev_dbg(&priv->i2c->dev, "%s(): burst mode %s\n", __func__, in cxd2841er_send_burst()
2411 if (priv->state != STATE_SLEEP_S && in cxd2841er_send_burst()
2412 priv->state != STATE_ACTIVE_S) { in cxd2841er_send_burst()
2413 dev_err(&priv->i2c->dev, "%s(): invalid demod state %d\n", in cxd2841er_send_burst()
2414 __func__, priv->state); in cxd2841er_send_burst()
2418 cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0xbb); in cxd2841er_send_burst()
2419 cxd2841er_write_reg(priv, I2C_SLVT, 0x34, 0x01); in cxd2841er_send_burst()
2420 cxd2841er_write_reg(priv, I2C_SLVT, 0x35, data); in cxd2841er_send_burst()
2428 struct cxd2841er_priv *priv = fe->demodulator_priv; in cxd2841er_set_tone() local
2430 dev_dbg(&priv->i2c->dev, "%s(): tone %s\n", __func__, in cxd2841er_set_tone()
2432 if (priv->state != STATE_SLEEP_S && in cxd2841er_set_tone()
2433 priv->state != STATE_ACTIVE_S) { in cxd2841er_set_tone()
2434 dev_err(&priv->i2c->dev, "%s(): invalid demod state %d\n", in cxd2841er_set_tone()
2435 __func__, priv->state); in cxd2841er_set_tone()
2439 cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0xbb); in cxd2841er_set_tone()
2440 cxd2841er_write_reg(priv, I2C_SLVT, 0x36, data); in cxd2841er_set_tone()
2449 struct cxd2841er_priv *priv = fe->demodulator_priv; in cxd2841er_send_diseqc_msg() local
2451 if (priv->state != STATE_SLEEP_S && in cxd2841er_send_diseqc_msg()
2452 priv->state != STATE_ACTIVE_S) { in cxd2841er_send_diseqc_msg()
2453 dev_err(&priv->i2c->dev, "%s(): invalid demod state %d\n", in cxd2841er_send_diseqc_msg()
2454 __func__, priv->state); in cxd2841er_send_diseqc_msg()
2457 dev_dbg(&priv->i2c->dev, in cxd2841er_send_diseqc_msg()
2459 cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0xbb); in cxd2841er_send_diseqc_msg()
2461 cxd2841er_write_reg(priv, I2C_SLVT, 0x33, 0x01); in cxd2841er_send_diseqc_msg()
2463 cxd2841er_write_reg(priv, I2C_SLVT, 0x3d, cmd->msg_len); in cxd2841er_send_diseqc_msg()
2467 cxd2841er_write_regs(priv, I2C_SLVT, 0x3e, data, sizeof(data)); in cxd2841er_send_diseqc_msg()
2469 cxd2841er_write_reg(priv, I2C_SLVT, 0x37, 1); in cxd2841er_send_diseqc_msg()
2471 cxd2841er_write_reg(priv, I2C_SLVT, 0x38, 0); in cxd2841er_send_diseqc_msg()
2473 cxd2841er_write_reg(priv, I2C_SLVT, 0x32, 0x01); in cxd2841er_send_diseqc_msg()
2476 cxd2841er_read_reg(priv, I2C_SLVT, 0x10, data); in cxd2841er_send_diseqc_msg()
2478 dev_dbg(&priv->i2c->dev, in cxd2841er_send_diseqc_msg()
2484 dev_dbg(&priv->i2c->dev, in cxd2841er_send_diseqc_msg()
2491 struct cxd2841er_priv *priv = fe->demodulator_priv; in cxd2841er_release() local
2493 dev_dbg(&priv->i2c->dev, "%s()\n", __func__); in cxd2841er_release()
2494 kfree(priv); in cxd2841er_release()
2499 struct cxd2841er_priv *priv = fe->demodulator_priv; in cxd2841er_i2c_gate_ctrl() local
2501 dev_dbg(&priv->i2c->dev, "%s(): enable=%d\n", __func__, enable); in cxd2841er_i2c_gate_ctrl()
2503 priv, I2C_SLVX, 0x8, (enable ? 0x01 : 0x00), 0x01); in cxd2841er_i2c_gate_ctrl()
2509 struct cxd2841er_priv *priv = fe->demodulator_priv; in cxd2841er_get_algo() local
2511 dev_dbg(&priv->i2c->dev, "%s()\n", __func__); in cxd2841er_get_algo()
2517 struct cxd2841er_priv *priv = fe->demodulator_priv; in cxd2841er_init_s() local
2519 dev_dbg(&priv->i2c->dev, "%s()\n", __func__); in cxd2841er_init_s()
2520 cxd2841er_shutdown_to_sleep_s(priv); in cxd2841er_init_s()
2522 cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0xa0); in cxd2841er_init_s()
2523 cxd2841er_set_reg_bits(priv, I2C_SLVT, 0xb9, 0x01, 0x01); in cxd2841er_init_s()
2529 struct cxd2841er_priv *priv = fe->demodulator_priv; in cxd2841er_init_tc() local
2531 dev_dbg(&priv->i2c->dev, "%s()\n", __func__); in cxd2841er_init_tc()
2532 cxd2841er_shutdown_to_sleep_tc(priv); in cxd2841er_init_tc()
2534 cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x10); in cxd2841er_init_tc()
2535 cxd2841er_set_reg_bits(priv, I2C_SLVT, 0xcb, 0x40, 0x40); in cxd2841er_init_tc()
2537 cxd2841er_write_reg(priv, I2C_SLVT, 0xcd, 0x50); in cxd2841er_init_tc()
2539 cxd2841er_write_reg(priv, I2C_SLVT, 0x00, 0x00); in cxd2841er_init_tc()
2540 cxd2841er_set_reg_bits(priv, I2C_SLVT, 0xc4, 0x00, 0x80); in cxd2841er_init_tc()
2554 struct cxd2841er_priv *priv = NULL; in cxd2841er_attach() local
2557 priv = kzalloc(sizeof(struct cxd2841er_priv), GFP_KERNEL); in cxd2841er_attach()
2558 if (!priv) in cxd2841er_attach()
2560 priv->i2c = i2c; in cxd2841er_attach()
2561 priv->config = cfg; in cxd2841er_attach()
2562 priv->i2c_addr_slvx = (cfg->i2c_addr + 4) >> 1; in cxd2841er_attach()
2563 priv->i2c_addr_slvt = (cfg->i2c_addr) >> 1; in cxd2841er_attach()
2567 memcpy(&priv->frontend.ops, in cxd2841er_attach()
2573 memcpy(&priv->frontend.ops, in cxd2841er_attach()
2579 memcpy(&priv->frontend.ops, in cxd2841er_attach()
2585 kfree(priv); in cxd2841er_attach()
2588 priv->frontend.demodulator_priv = priv; in cxd2841er_attach()
2589 dev_info(&priv->i2c->dev, in cxd2841er_attach()
2592 dev_info(&priv->i2c->dev, in cxd2841er_attach()
2594 __func__, priv->i2c, in cxd2841er_attach()
2595 priv->i2c_addr_slvx, priv->i2c_addr_slvt); in cxd2841er_attach()
2596 chip_id = cxd2841er_chip_id(priv); in cxd2841er_attach()
2598 dev_err(&priv->i2c->dev, "%s(): invalid chip ID 0x%02x\n", in cxd2841er_attach()
2600 priv->frontend.demodulator_priv = NULL; in cxd2841er_attach()
2601 kfree(priv); in cxd2841er_attach()
2604 dev_info(&priv->i2c->dev, "%s(): chip ID 0x%02x OK.\n", in cxd2841er_attach()
2606 return &priv->frontend; in cxd2841er_attach()