diff options
author | Mauro Carvalho Chehab <mchehab@redhat.com> | 2011-01-14 10:03:03 -0500 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2011-01-19 08:45:28 -0500 |
commit | ecb71d262b0323981e07ce415da9b7adc917990a (patch) | |
tree | 5534d21db1bf922fdef9a2dde8e9790f63c53408 /drivers/media | |
parent | 6a58bc0f506c1825cb8f8b81a5123e26bf70902c (diff) |
[media] saa7134: Kworld SBTVD: make both analog and digital to work
There are some weird bugs at tda8290/tda18271 initialization, as it
insits do do analog initialization during DVB frontend attach:
DVB: registering new adapter (saa7133[0])
DVB: registering adapter 0 frontend 0 (Fujitsu mb86A20s)...
mb86a20s: mb86a20s_initfe
tda18271_write_regs: [2-0060|M] ERROR: idx = 0x5, len = 1, i2c_transfer returned: -5
tda18271_init: [2-0060|M] error -5 on line 830
tda18271_tune: [2-0060|M] error -5 on line 908
tda18271_write_regs
tda18271_write_regs: [2-0060|M] ERROR: idx = 0x5, len = 1, i2c_transfer returned: -5
tda18271c2_rf_tracking_filters_correction: [2-0060|M] error -5 on line 265
tda18271_write_regs
tda18271_write_regs: [2-0060|M] ERROR: idx = 0x25, len = 1, i2c_transfer returned: -5
tda18271_channel_configuration: [2-0060|M] error -5 on line 119
tda18271_set_analog_params: [2-0060|M] error -5 on line 1045
tda18271_set_analog_params: [2-0060|M] error -5 on line 1045
tda829x 2-004b: tda8295 not locked, no signal?
tda829x 2-004b: tda8295_i2c_bridge: disable i2c gate
tda829x 2-004b: tda8295 not locked, no signal?
tda829x 2-004b: tda8295_i2c_bridge: disable i2c gate
mb86a20s_i2c_writereg: writereg error (rc == -5, reg == 0x29, data == 0x33)
mb86a20s: Init failed. Will try again later
The problem is that mb86a20s is only visible if the analog part is disabled.
However, due to a trick at mb86a20s, it will later initialize properly:
mb86a20s: mb86a20s_initfe: Initialization succeded.
This is hacky and ugly. However, I coldn't find any easy way to fix it.
A proper fix would be to have a resource locking schema, used by both
V4L and DVB parts that would block access to analog registers while
digital registers are in use, but this will probably put tda829x into
a dead lock.
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media')
-rw-r--r-- | drivers/media/common/tuners/tda8290.c | 1 | ||||
-rw-r--r-- | drivers/media/video/saa7134/saa7134-cards.c | 16 | ||||
-rw-r--r-- | drivers/media/video/saa7134/saa7134-dvb.c | 16 |
3 files changed, 16 insertions, 17 deletions
diff --git a/drivers/media/common/tuners/tda8290.c b/drivers/media/common/tuners/tda8290.c index 419d064a0188..bc6a67768af1 100644 --- a/drivers/media/common/tuners/tda8290.c +++ b/drivers/media/common/tuners/tda8290.c | |||
@@ -232,6 +232,7 @@ static void tda8290_set_params(struct dvb_frontend *fe, | |||
232 | tuner_i2c_xfer_send(&priv->i2c_props, pll_bw_nom, 2); | 232 | tuner_i2c_xfer_send(&priv->i2c_props, pll_bw_nom, 2); |
233 | } | 233 | } |
234 | 234 | ||
235 | |||
235 | tda8290_i2c_bridge(fe, 1); | 236 | tda8290_i2c_bridge(fe, 1); |
236 | 237 | ||
237 | if (fe->ops.tuner_ops.set_analog_params) | 238 | if (fe->ops.tuner_ops.set_analog_params) |
diff --git a/drivers/media/video/saa7134/saa7134-cards.c b/drivers/media/video/saa7134/saa7134-cards.c index dea90a19043f..deb8fcf4aa49 100644 --- a/drivers/media/video/saa7134/saa7134-cards.c +++ b/drivers/media/video/saa7134/saa7134-cards.c | |||
@@ -5179,11 +5179,7 @@ struct saa7134_board saa7134_boards[] = { | |||
5179 | [SAA7134_BOARD_KWORLD_PCI_SBTVD_FULLSEG] = { | 5179 | [SAA7134_BOARD_KWORLD_PCI_SBTVD_FULLSEG] = { |
5180 | .name = "Kworld PCI SBTVD/ISDB-T Full-Seg Hybrid", | 5180 | .name = "Kworld PCI SBTVD/ISDB-T Full-Seg Hybrid", |
5181 | .audio_clock = 0x00187de7, | 5181 | .audio_clock = 0x00187de7, |
5182 | #if 0 | ||
5183 | .tuner_type = TUNER_PHILIPS_TDA8290, | 5182 | .tuner_type = TUNER_PHILIPS_TDA8290, |
5184 | #else | ||
5185 | .tuner_type = UNSET, | ||
5186 | #endif | ||
5187 | .tuner_addr = ADDR_UNSET, | 5183 | .tuner_addr = ADDR_UNSET, |
5188 | .radio_type = UNSET, | 5184 | .radio_type = UNSET, |
5189 | .radio_addr = ADDR_UNSET, | 5185 | .radio_addr = ADDR_UNSET, |
@@ -6926,10 +6922,17 @@ static inline int saa7134_kworld_sbtvd_toggle_agc(struct saa7134_dev *dev, | |||
6926 | /* toggle AGC switch through GPIO 27 */ | 6922 | /* toggle AGC switch through GPIO 27 */ |
6927 | switch (mode) { | 6923 | switch (mode) { |
6928 | case TDA18271_ANALOG: | 6924 | case TDA18271_ANALOG: |
6929 | saa7134_set_gpio(dev, 27, 0); | 6925 | saa_writel(SAA7134_GPIO_GPMODE0 >> 2, 0x4000); |
6926 | saa_writel(SAA7134_GPIO_GPSTATUS0 >> 2, 0x4000); | ||
6927 | msleep(20); | ||
6930 | break; | 6928 | break; |
6931 | case TDA18271_DIGITAL: | 6929 | case TDA18271_DIGITAL: |
6932 | saa7134_set_gpio(dev, 27, 1); | 6930 | saa_writel(SAA7134_GPIO_GPMODE0 >> 2, 0x14000); |
6931 | saa_writel(SAA7134_GPIO_GPSTATUS0 >> 2, 0x14000); | ||
6932 | msleep(20); | ||
6933 | saa_writel(SAA7134_GPIO_GPMODE0 >> 2, 0x54000); | ||
6934 | saa_writel(SAA7134_GPIO_GPSTATUS0 >> 2, 0x54000); | ||
6935 | msleep(30); | ||
6933 | break; | 6936 | break; |
6934 | default: | 6937 | default: |
6935 | return -EINVAL; | 6938 | return -EINVAL; |
@@ -6987,6 +6990,7 @@ static int saa7134_tda8290_callback(struct saa7134_dev *dev, | |||
6987 | int saa7134_tuner_callback(void *priv, int component, int command, int arg) | 6990 | int saa7134_tuner_callback(void *priv, int component, int command, int arg) |
6988 | { | 6991 | { |
6989 | struct saa7134_dev *dev = priv; | 6992 | struct saa7134_dev *dev = priv; |
6993 | |||
6990 | if (dev != NULL) { | 6994 | if (dev != NULL) { |
6991 | switch (dev->tuner_type) { | 6995 | switch (dev->tuner_type) { |
6992 | case TUNER_PHILIPS_TDA8290: | 6996 | case TUNER_PHILIPS_TDA8290: |
diff --git a/drivers/media/video/saa7134/saa7134-dvb.c b/drivers/media/video/saa7134/saa7134-dvb.c index d2a12df28af0..f65cad287b83 100644 --- a/drivers/media/video/saa7134/saa7134-dvb.c +++ b/drivers/media/video/saa7134/saa7134-dvb.c | |||
@@ -237,6 +237,8 @@ static struct tda18271_std_map mb86a20s_tda18271_std_map = { | |||
237 | static struct tda18271_config kworld_tda18271_config = { | 237 | static struct tda18271_config kworld_tda18271_config = { |
238 | .std_map = &mb86a20s_tda18271_std_map, | 238 | .std_map = &mb86a20s_tda18271_std_map, |
239 | .gate = TDA18271_GATE_DIGITAL, | 239 | .gate = TDA18271_GATE_DIGITAL, |
240 | .config = 3, /* Use tuner callback for AGC */ | ||
241 | |||
240 | }; | 242 | }; |
241 | 243 | ||
242 | static const struct mb86a20s_config kworld_mb86a20s_config = { | 244 | static const struct mb86a20s_config kworld_mb86a20s_config = { |
@@ -1654,24 +1656,16 @@ static int dvb_init(struct saa7134_dev *dev) | |||
1654 | } | 1656 | } |
1655 | break; | 1657 | break; |
1656 | case SAA7134_BOARD_KWORLD_PCI_SBTVD_FULLSEG: | 1658 | case SAA7134_BOARD_KWORLD_PCI_SBTVD_FULLSEG: |
1657 | saa_writel(SAA7134_GPIO_GPMODE0 >> 2, 0x14000); | 1659 | /* Switch to digital mode */ |
1658 | saa_writel(SAA7134_GPIO_GPSTATUS0 >> 2, 0x14000); | 1660 | saa7134_tuner_callback(dev, 0, |
1659 | msleep(20); | 1661 | TDA18271_CALLBACK_CMD_AGC_ENABLE, 1); |
1660 | saa_writel(SAA7134_GPIO_GPMODE0 >> 2, 0x54000); | ||
1661 | saa_writel(SAA7134_GPIO_GPSTATUS0 >> 2, 0x54000); | ||
1662 | msleep(20); | ||
1663 | fe0->dvb.frontend = dvb_attach(mb86a20s_attach, | 1662 | fe0->dvb.frontend = dvb_attach(mb86a20s_attach, |
1664 | &kworld_mb86a20s_config, | 1663 | &kworld_mb86a20s_config, |
1665 | &dev->i2c_adap); | 1664 | &dev->i2c_adap); |
1666 | if (fe0->dvb.frontend != NULL) { | 1665 | if (fe0->dvb.frontend != NULL) { |
1667 | #if 0 | ||
1668 | dvb_attach(tda829x_attach, fe0->dvb.frontend, | 1666 | dvb_attach(tda829x_attach, fe0->dvb.frontend, |
1669 | &dev->i2c_adap, 0x4b, | 1667 | &dev->i2c_adap, 0x4b, |
1670 | &tda829x_no_probe); | 1668 | &tda829x_no_probe); |
1671 | #else | ||
1672 | dvb_attach(tda829x_attach, fe0->dvb.frontend, | ||
1673 | &dev->i2c_adap, 0x4b, NULL); | ||
1674 | #endif | ||
1675 | dvb_attach(tda18271_attach, fe0->dvb.frontend, | 1669 | dvb_attach(tda18271_attach, fe0->dvb.frontend, |
1676 | 0x60, &dev->i2c_adap, | 1670 | 0x60, &dev->i2c_adap, |
1677 | &kworld_tda18271_config); | 1671 | &kworld_tda18271_config); |