aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorAndreas Regel <andreas.regel@gmx.de>2012-03-11 13:11:45 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2013-01-24 15:31:00 -0500
commit6b9e50c463efc5c361496ae6a895cc966ff8025b (patch)
tree9c41eefc32d03617871a5c1caf4db7028f981cd0 /drivers
parentf67102c49a123b32a4469b28407feb52b37144f5 (diff)
[media] stv090x: On STV0903 do not set registers of the second path
Sometimes there is a problem when trying to access the non-existing registers of the second demodulator path on the STV0903. This change removes the calls in case the driver is used on a STV0903. Signed-off-by: Andreas Regel <andreas.regel@gmx.de> Acked-by: Manu Abraham <manu@linuxtv.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/media/dvb-frontends/stv090x.c141
1 files changed, 132 insertions, 9 deletions
diff --git a/drivers/media/dvb-frontends/stv090x.c b/drivers/media/dvb-frontends/stv090x.c
index 13caec013902..f36eeefb76a6 100644
--- a/drivers/media/dvb-frontends/stv090x.c
+++ b/drivers/media/dvb-frontends/stv090x.c
@@ -4267,7 +4267,7 @@ err:
4267 return -1; 4267 return -1;
4268} 4268}
4269 4269
4270static int stv090x_set_tspath(struct stv090x_state *state) 4270static int stv0900_set_tspath(struct stv090x_state *state)
4271{ 4271{
4272 u32 reg; 4272 u32 reg;
4273 4273
@@ -4538,6 +4538,121 @@ err:
4538 return -1; 4538 return -1;
4539} 4539}
4540 4540
4541static int stv0903_set_tspath(struct stv090x_state *state)
4542{
4543 u32 reg;
4544
4545 if (state->internal->dev_ver >= 0x20) {
4546 switch (state->config->ts1_mode) {
4547 case STV090x_TSMODE_PARALLEL_PUNCTURED:
4548 case STV090x_TSMODE_DVBCI:
4549 stv090x_write_reg(state, STV090x_TSGENERAL, 0x00);
4550 break;
4551
4552 case STV090x_TSMODE_SERIAL_PUNCTURED:
4553 case STV090x_TSMODE_SERIAL_CONTINUOUS:
4554 default:
4555 stv090x_write_reg(state, STV090x_TSGENERAL, 0x0c);
4556 break;
4557 }
4558 } else {
4559 switch (state->config->ts1_mode) {
4560 case STV090x_TSMODE_PARALLEL_PUNCTURED:
4561 case STV090x_TSMODE_DVBCI:
4562 stv090x_write_reg(state, STV090x_TSGENERAL1X, 0x10);
4563 break;
4564
4565 case STV090x_TSMODE_SERIAL_PUNCTURED:
4566 case STV090x_TSMODE_SERIAL_CONTINUOUS:
4567 default:
4568 stv090x_write_reg(state, STV090x_TSGENERAL1X, 0x14);
4569 break;
4570 }
4571 }
4572
4573 switch (state->config->ts1_mode) {
4574 case STV090x_TSMODE_PARALLEL_PUNCTURED:
4575 reg = stv090x_read_reg(state, STV090x_P1_TSCFGH);
4576 STV090x_SETFIELD_Px(reg, TSFIFO_SERIAL_FIELD, 0x00);
4577 STV090x_SETFIELD_Px(reg, TSFIFO_DVBCI_FIELD, 0x00);
4578 if (stv090x_write_reg(state, STV090x_P1_TSCFGH, reg) < 0)
4579 goto err;
4580 break;
4581
4582 case STV090x_TSMODE_DVBCI:
4583 reg = stv090x_read_reg(state, STV090x_P1_TSCFGH);
4584 STV090x_SETFIELD_Px(reg, TSFIFO_SERIAL_FIELD, 0x00);
4585 STV090x_SETFIELD_Px(reg, TSFIFO_DVBCI_FIELD, 0x01);
4586 if (stv090x_write_reg(state, STV090x_P1_TSCFGH, reg) < 0)
4587 goto err;
4588 break;
4589
4590 case STV090x_TSMODE_SERIAL_PUNCTURED:
4591 reg = stv090x_read_reg(state, STV090x_P1_TSCFGH);
4592 STV090x_SETFIELD_Px(reg, TSFIFO_SERIAL_FIELD, 0x01);
4593 STV090x_SETFIELD_Px(reg, TSFIFO_DVBCI_FIELD, 0x00);
4594 if (stv090x_write_reg(state, STV090x_P1_TSCFGH, reg) < 0)
4595 goto err;
4596 break;
4597
4598 case STV090x_TSMODE_SERIAL_CONTINUOUS:
4599 reg = stv090x_read_reg(state, STV090x_P1_TSCFGH);
4600 STV090x_SETFIELD_Px(reg, TSFIFO_SERIAL_FIELD, 0x01);
4601 STV090x_SETFIELD_Px(reg, TSFIFO_DVBCI_FIELD, 0x01);
4602 if (stv090x_write_reg(state, STV090x_P1_TSCFGH, reg) < 0)
4603 goto err;
4604 break;
4605
4606 default:
4607 break;
4608 }
4609
4610 if (state->config->ts1_clk > 0) {
4611 u32 speed;
4612
4613 switch (state->config->ts1_mode) {
4614 case STV090x_TSMODE_PARALLEL_PUNCTURED:
4615 case STV090x_TSMODE_DVBCI:
4616 default:
4617 speed = state->internal->mclk /
4618 (state->config->ts1_clk / 4);
4619 if (speed < 0x08)
4620 speed = 0x08;
4621 if (speed > 0xFF)
4622 speed = 0xFF;
4623 break;
4624 case STV090x_TSMODE_SERIAL_PUNCTURED:
4625 case STV090x_TSMODE_SERIAL_CONTINUOUS:
4626 speed = state->internal->mclk /
4627 (state->config->ts1_clk / 32);
4628 if (speed < 0x20)
4629 speed = 0x20;
4630 if (speed > 0xFF)
4631 speed = 0xFF;
4632 break;
4633 }
4634 reg = stv090x_read_reg(state, STV090x_P1_TSCFGM);
4635 STV090x_SETFIELD_Px(reg, TSFIFO_MANSPEED_FIELD, 3);
4636 if (stv090x_write_reg(state, STV090x_P1_TSCFGM, reg) < 0)
4637 goto err;
4638 if (stv090x_write_reg(state, STV090x_P1_TSSPEED, speed) < 0)
4639 goto err;
4640 }
4641
4642 reg = stv090x_read_reg(state, STV090x_P1_TSCFGH);
4643 STV090x_SETFIELD_Px(reg, RST_HWARE_FIELD, 0x01);
4644 if (stv090x_write_reg(state, STV090x_P1_TSCFGH, reg) < 0)
4645 goto err;
4646 STV090x_SETFIELD_Px(reg, RST_HWARE_FIELD, 0x00);
4647 if (stv090x_write_reg(state, STV090x_P1_TSCFGH, reg) < 0)
4648 goto err;
4649
4650 return 0;
4651err:
4652 dprintk(FE_ERROR, 1, "I/O error");
4653 return -1;
4654}
4655
4541static int stv090x_init(struct dvb_frontend *fe) 4656static int stv090x_init(struct dvb_frontend *fe)
4542{ 4657{
4543 struct stv090x_state *state = fe->demodulator_priv; 4658 struct stv090x_state *state = fe->demodulator_priv;
@@ -4600,8 +4715,13 @@ static int stv090x_init(struct dvb_frontend *fe)
4600 if (stv090x_i2c_gate_ctrl(state, 0) < 0) 4715 if (stv090x_i2c_gate_ctrl(state, 0) < 0)
4601 goto err; 4716 goto err;
4602 4717
4603 if (stv090x_set_tspath(state) < 0) 4718 if (state->device == STV0900) {
4604 goto err; 4719 if (stv0900_set_tspath(state) < 0)
4720 goto err;
4721 } else {
4722 if (stv0903_set_tspath(state) < 0)
4723 goto err;
4724 }
4605 4725
4606 return 0; 4726 return 0;
4607 4727
@@ -4642,23 +4762,26 @@ static int stv090x_setup(struct dvb_frontend *fe)
4642 /* Stop Demod */ 4762 /* Stop Demod */
4643 if (stv090x_write_reg(state, STV090x_P1_DMDISTATE, 0x5c) < 0) 4763 if (stv090x_write_reg(state, STV090x_P1_DMDISTATE, 0x5c) < 0)
4644 goto err; 4764 goto err;
4645 if (stv090x_write_reg(state, STV090x_P2_DMDISTATE, 0x5c) < 0) 4765 if (state->device == STV0900)
4646 goto err; 4766 if (stv090x_write_reg(state, STV090x_P2_DMDISTATE, 0x5c) < 0)
4767 goto err;
4647 4768
4648 msleep(5); 4769 msleep(5);
4649 4770
4650 /* Set No Tuner Mode */ 4771 /* Set No Tuner Mode */
4651 if (stv090x_write_reg(state, STV090x_P1_TNRCFG, 0x6c) < 0) 4772 if (stv090x_write_reg(state, STV090x_P1_TNRCFG, 0x6c) < 0)
4652 goto err; 4773 goto err;
4653 if (stv090x_write_reg(state, STV090x_P2_TNRCFG, 0x6c) < 0) 4774 if (state->device == STV0900)
4654 goto err; 4775 if (stv090x_write_reg(state, STV090x_P2_TNRCFG, 0x6c) < 0)
4776 goto err;
4655 4777
4656 /* I2C repeater OFF */ 4778 /* I2C repeater OFF */
4657 STV090x_SETFIELD_Px(reg, ENARPT_LEVEL_FIELD, config->repeater_level); 4779 STV090x_SETFIELD_Px(reg, ENARPT_LEVEL_FIELD, config->repeater_level);
4658 if (stv090x_write_reg(state, STV090x_P1_I2CRPT, reg) < 0) 4780 if (stv090x_write_reg(state, STV090x_P1_I2CRPT, reg) < 0)
4659 goto err; 4781 goto err;
4660 if (stv090x_write_reg(state, STV090x_P2_I2CRPT, reg) < 0) 4782 if (state->device == STV0900)
4661 goto err; 4783 if (stv090x_write_reg(state, STV090x_P2_I2CRPT, reg) < 0)
4784 goto err;
4662 4785
4663 if (stv090x_write_reg(state, STV090x_NCOARSE, 0x13) < 0) /* set PLL divider */ 4786 if (stv090x_write_reg(state, STV090x_NCOARSE, 0x13) < 0) /* set PLL divider */
4664 goto err; 4787 goto err;