diff options
| author | Manu Abraham <abraham.manu@gmail.com> | 2009-12-04 03:57:28 -0500 |
|---|---|---|
| committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2010-01-17 08:55:43 -0500 |
| commit | bc832fa2c0310c25ed60204616ccef4f8db088f3 (patch) | |
| tree | 4544c2e786cc462d2b9d143b3c3a0ad7cd74a424 | |
| parent | 3e978a8284080d801d20cda377d9cf7c12fe68b9 (diff) | |
V4L/DVB (13798): [Mantis] Enable power for all cards, use byte mode only on relevant devices
Signed-off-by: Manu Abraham <manu@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
| -rw-r--r-- | drivers/media/dvb/mantis/hopper_vp3028.c | 27 | ||||
| -rw-r--r-- | drivers/media/dvb/mantis/mantis_common.h | 13 | ||||
| -rw-r--r-- | drivers/media/dvb/mantis/mantis_i2c.c | 47 | ||||
| -rw-r--r-- | drivers/media/dvb/mantis/mantis_vp1033.c | 36 | ||||
| -rw-r--r-- | drivers/media/dvb/mantis/mantis_vp1034.c | 32 | ||||
| -rw-r--r-- | drivers/media/dvb/mantis/mantis_vp2033.c | 50 | ||||
| -rw-r--r-- | drivers/media/dvb/mantis/mantis_vp2040.c | 51 | ||||
| -rw-r--r-- | drivers/media/dvb/mantis/mantis_vp3030.c | 22 |
8 files changed, 203 insertions, 75 deletions
diff --git a/drivers/media/dvb/mantis/hopper_vp3028.c b/drivers/media/dvb/mantis/hopper_vp3028.c index ba0c7e58b7a6..16b39d3b9ace 100644 --- a/drivers/media/dvb/mantis/hopper_vp3028.c +++ b/drivers/media/dvb/mantis/hopper_vp3028.c | |||
| @@ -45,17 +45,30 @@ struct zl10353_config hopper_vp3028_config = { | |||
| 45 | static int vp3028_frontend_init(struct mantis_pci *mantis, struct dvb_frontend *fe) | 45 | static int vp3028_frontend_init(struct mantis_pci *mantis, struct dvb_frontend *fe) |
| 46 | { | 46 | { |
| 47 | struct i2c_adapter *adapter = &mantis->adapter; | 47 | struct i2c_adapter *adapter = &mantis->adapter; |
| 48 | struct mantis_hwconfig *config = mantis->hwconfig; | ||
| 48 | int err = 0; | 49 | int err = 0; |
| 49 | 50 | ||
| 51 | gpio_set_bits(mantis, config->reset, 0); | ||
| 52 | msleep(100); | ||
| 50 | err = mantis_frontend_power(mantis, POWER_ON); | 53 | err = mantis_frontend_power(mantis, POWER_ON); |
| 51 | mantis_frontend_soft_reset(mantis); | 54 | msleep(100); |
| 52 | 55 | gpio_set_bits(mantis, config->reset, 1); | |
| 53 | dprintk(MANTIS_ERROR, 1, "Probing for 10353 (DVB-T)"); | ||
| 54 | fe = zl10353_attach(&hopper_vp3028_config, adapter); | ||
| 55 | |||
| 56 | if (!fe) | ||
| 57 | return -1; | ||
| 58 | 56 | ||
| 57 | err = mantis_frontend_power(mantis, POWER_ON); | ||
| 58 | if (err == 0) { | ||
| 59 | msleep(250); | ||
| 60 | dprintk(MANTIS_ERROR, 1, "Probing for 10353 (DVB-T)"); | ||
| 61 | fe = zl10353_attach(&hopper_vp3028_config, adapter); | ||
| 62 | |||
| 63 | if (!fe) | ||
| 64 | return -1; | ||
| 65 | } else { | ||
| 66 | dprintk(MANTIS_ERROR, 1, "Frontend on <%s> POWER ON failed! <%d>", | ||
| 67 | adapter->name, | ||
| 68 | err); | ||
| 69 | |||
| 70 | return -EIO; | ||
| 71 | } | ||
| 59 | dprintk(MANTIS_ERROR, 1, "Done!"); | 72 | dprintk(MANTIS_ERROR, 1, "Done!"); |
| 60 | 73 | ||
| 61 | return 0; | 74 | return 0; |
diff --git a/drivers/media/dvb/mantis/mantis_common.h b/drivers/media/dvb/mantis/mantis_common.h index e912c5962e3a..6ae3aabe5604 100644 --- a/drivers/media/dvb/mantis/mantis_common.h +++ b/drivers/media/dvb/mantis/mantis_common.h | |||
| @@ -32,6 +32,7 @@ | |||
| 32 | #define MANTIS_NOTICE 1 | 32 | #define MANTIS_NOTICE 1 |
| 33 | #define MANTIS_INFO 2 | 33 | #define MANTIS_INFO 2 |
| 34 | #define MANTIS_DEBUG 3 | 34 | #define MANTIS_DEBUG 3 |
| 35 | #define MANTIS_TMG 9 | ||
| 35 | 36 | ||
| 36 | #define dprintk(y, z, format, arg...) do { \ | 37 | #define dprintk(y, z, format, arg...) do { \ |
| 37 | if (z) { \ | 38 | if (z) { \ |
| @@ -43,6 +44,8 @@ | |||
| 43 | printk(KERN_INFO "%s (%d): " format "\n" , __func__ , mantis->num , ##arg); \ | 44 | printk(KERN_INFO "%s (%d): " format "\n" , __func__ , mantis->num , ##arg); \ |
| 44 | else if ((mantis->verbose > MANTIS_DEBUG) && (mantis->verbose > y)) \ | 45 | else if ((mantis->verbose > MANTIS_DEBUG) && (mantis->verbose > y)) \ |
| 45 | printk(KERN_DEBUG "%s (%d): " format "\n" , __func__ , mantis->num , ##arg); \ | 46 | printk(KERN_DEBUG "%s (%d): " format "\n" , __func__ , mantis->num , ##arg); \ |
| 47 | else if ((mantis->verbose > MANTIS_TMG) && (mantis->verbose > y)) \ | ||
| 48 | printk(KERN_DEBUG "%s (%d): " format "\n" , __func__ , mantis->num , ##arg); \ | ||
| 46 | } else { \ | 49 | } else { \ |
| 47 | if (mantis->verbose > y) \ | 50 | if (mantis->verbose > y) \ |
| 48 | printk(format , ##arg); \ | 51 | printk(format , ##arg); \ |
| @@ -54,9 +57,6 @@ | |||
| 54 | 57 | ||
| 55 | #define mmwrite(dat, addr) mwrite((dat), (mantis->mmio + (addr))) | 58 | #define mmwrite(dat, addr) mwrite((dat), (mantis->mmio + (addr))) |
| 56 | #define mmread(addr) mread(mantis->mmio + (addr)) | 59 | #define mmread(addr) mread(mantis->mmio + (addr)) |
| 57 | #define mmand(dat, addr) mmwrite((dat) & mmread(addr), addr) | ||
| 58 | #define mmor(dat, addr) mmwrite((dat) | mmread(addr), addr) | ||
| 59 | #define mmaor(dat, addr) mmwrite((dat) | ((mask) & mmread(addr)), addr) | ||
| 60 | 60 | ||
| 61 | #define MANTIS_TS_188 0 | 61 | #define MANTIS_TS_188 0 |
| 62 | #define MANTIS_TS_204 1 | 62 | #define MANTIS_TS_204 1 |
| @@ -75,6 +75,11 @@ | |||
| 75 | .driver_data = (unsigned long) (__configptr) \ | 75 | .driver_data = (unsigned long) (__configptr) \ |
| 76 | } | 76 | } |
| 77 | 77 | ||
| 78 | enum mantis_i2c_mode { | ||
| 79 | MANTIS_PAGE_MODE = 0, | ||
| 80 | MANTIS_BYTE_MODE, | ||
| 81 | }; | ||
| 82 | |||
| 78 | struct mantis_pci; | 83 | struct mantis_pci; |
| 79 | 84 | ||
| 80 | struct mantis_hwconfig { | 85 | struct mantis_hwconfig { |
| @@ -91,6 +96,8 @@ struct mantis_hwconfig { | |||
| 91 | 96 | ||
| 92 | u8 power; | 97 | u8 power; |
| 93 | u8 reset; | 98 | u8 reset; |
| 99 | |||
| 100 | enum mantis_i2c_mode i2c_mode; | ||
| 94 | }; | 101 | }; |
| 95 | 102 | ||
| 96 | struct mantis_pci { | 103 | struct mantis_pci { |
diff --git a/drivers/media/dvb/mantis/mantis_i2c.c b/drivers/media/dvb/mantis/mantis_i2c.c index 16b9e7e77b82..758f32a63b2f 100644 --- a/drivers/media/dvb/mantis/mantis_i2c.c +++ b/drivers/media/dvb/mantis/mantis_i2c.c | |||
| @@ -35,6 +35,8 @@ | |||
| 35 | 35 | ||
| 36 | #define I2C_HW_B_MANTIS 0x1c | 36 | #define I2C_HW_B_MANTIS 0x1c |
| 37 | 37 | ||
| 38 | #define TRIALS 10000 | ||
| 39 | |||
| 38 | static int mantis_i2c_read(struct mantis_pci *mantis, const struct i2c_msg *msg) | 40 | static int mantis_i2c_read(struct mantis_pci *mantis, const struct i2c_msg *msg) |
| 39 | { | 41 | { |
| 40 | u32 rxd, i, stat, trials; | 42 | u32 rxd, i, stat, trials; |
| @@ -55,13 +57,25 @@ static int mantis_i2c_read(struct mantis_pci *mantis, const struct i2c_msg *msg) | |||
| 55 | mmwrite(rxd, MANTIS_I2CDATA_CTL); | 57 | mmwrite(rxd, MANTIS_I2CDATA_CTL); |
| 56 | 58 | ||
| 57 | /* wait for xfer completion */ | 59 | /* wait for xfer completion */ |
| 58 | for (trials = 0; trials < 100; trials++) { | 60 | for (trials = 0; trials < TRIALS; trials++) { |
| 59 | udelay(500); | 61 | msleep(1); |
| 60 | stat = mmread(MANTIS_INT_STAT); | 62 | stat = mmread(MANTIS_INT_STAT); |
| 61 | if (stat & MANTIS_INT_I2CDONE) | 63 | if (stat & MANTIS_INT_I2CDONE) |
| 62 | break; | 64 | break; |
| 63 | } | 65 | } |
| 64 | 66 | ||
| 67 | dprintk(MANTIS_TMG, 0, "I2CDONE: trials=%d\n", trials); | ||
| 68 | |||
| 69 | /* wait for xfer completion */ | ||
| 70 | for (trials = 0; trials < TRIALS; trials++) { | ||
| 71 | stat = mmread(MANTIS_INT_STAT); | ||
| 72 | if (stat & MANTIS_INT_I2CRACK) | ||
| 73 | break; | ||
| 74 | msleep(1); | ||
| 75 | } | ||
| 76 | |||
| 77 | dprintk(MANTIS_TMG, 0, "I2CRACK: trials=%d\n", trials); | ||
| 78 | |||
| 65 | rxd = mmread(MANTIS_I2CDATA_CTL); | 79 | rxd = mmread(MANTIS_I2CDATA_CTL); |
| 66 | msg->buf[i] = (u8)((rxd >> 8) & 0xFF); | 80 | msg->buf[i] = (u8)((rxd >> 8) & 0xFF); |
| 67 | dprintk(MANTIS_INFO, 0, "%02x ", msg->buf[i]); | 81 | dprintk(MANTIS_INFO, 0, "%02x ", msg->buf[i]); |
| @@ -93,12 +107,24 @@ static int mantis_i2c_write(struct mantis_pci *mantis, const struct i2c_msg *msg | |||
| 93 | mmwrite(txd, MANTIS_I2CDATA_CTL); | 107 | mmwrite(txd, MANTIS_I2CDATA_CTL); |
| 94 | 108 | ||
| 95 | /* wait for xfer completion */ | 109 | /* wait for xfer completion */ |
| 96 | for (trials = 0; trials < 100; trials++) { | 110 | for (trials = 0; trials < TRIALS; trials++) { |
| 97 | udelay(500); | 111 | msleep(1); |
| 98 | stat = mmread(MANTIS_INT_STAT); | 112 | stat = mmread(MANTIS_INT_STAT); |
| 99 | if (stat & MANTIS_INT_I2CDONE) | 113 | if (stat & MANTIS_INT_I2CDONE) |
| 100 | break; | 114 | break; |
| 101 | } | 115 | } |
| 116 | |||
| 117 | dprintk(MANTIS_TMG, 0, "I2CDONE: trials=%d\n", trials); | ||
| 118 | |||
| 119 | /* wait for xfer completion */ | ||
| 120 | for (trials = 0; trials < TRIALS; trials++) { | ||
| 121 | stat = mmread(MANTIS_INT_STAT); | ||
| 122 | if (stat & MANTIS_INT_I2CRACK) | ||
| 123 | break; | ||
| 124 | msleep(1); | ||
| 125 | } | ||
| 126 | |||
| 127 | dprintk(MANTIS_TMG, 0, "I2CRACK: trials=%d\n", trials); | ||
| 102 | } | 128 | } |
| 103 | dprintk(MANTIS_INFO, 0, "]\n"); | 129 | dprintk(MANTIS_INFO, 0, "]\n"); |
| 104 | 130 | ||
| @@ -122,10 +148,11 @@ static int mantis_i2c_xfer(struct i2c_adapter *adapter, struct i2c_msg *msgs, in | |||
| 122 | 148 | ||
| 123 | while (i < num) { | 149 | while (i < num) { |
| 124 | /* Byte MODE */ | 150 | /* Byte MODE */ |
| 125 | if (((i + 1) < num) && | 151 | if ((config->i2c_mode & MANTIS_BYTE_MODE) && |
| 126 | (msgs[i].len < 2) && | 152 | ((i + 1) < num) && |
| 127 | (msgs[i + 1].len < 2) && | 153 | (msgs[i].len < 2) && |
| 128 | (msgs[i + 1].flags & I2C_M_RD)) { | 154 | (msgs[i + 1].len < 2) && |
| 155 | (msgs[i + 1].flags & I2C_M_RD)) { | ||
| 129 | 156 | ||
| 130 | dprintk(MANTIS_DEBUG, 0, " Byte MODE:\n"); | 157 | dprintk(MANTIS_DEBUG, 0, " Byte MODE:\n"); |
| 131 | 158 | ||
| @@ -136,8 +163,8 @@ static int mantis_i2c_xfer(struct i2c_adapter *adapter, struct i2c_msg *msgs, in | |||
| 136 | 163 | ||
| 137 | mmwrite(txd, MANTIS_I2CDATA_CTL); | 164 | mmwrite(txd, MANTIS_I2CDATA_CTL); |
| 138 | /* wait for xfer completion */ | 165 | /* wait for xfer completion */ |
| 139 | for (trials = 0; trials < 100; trials++) { | 166 | for (trials = 0; trials < TRIALS; trials++) { |
| 140 | udelay(500); | 167 | msleep(1); |
| 141 | stat = mmread(MANTIS_INT_STAT); | 168 | stat = mmread(MANTIS_INT_STAT); |
| 142 | if (stat & MANTIS_INT_I2CDONE) | 169 | if (stat & MANTIS_INT_I2CDONE) |
| 143 | break; | 170 | break; |
diff --git a/drivers/media/dvb/mantis/mantis_vp1033.c b/drivers/media/dvb/mantis/mantis_vp1033.c index f2092ce9c4be..0bea6e89f551 100644 --- a/drivers/media/dvb/mantis/mantis_vp1033.c +++ b/drivers/media/dvb/mantis/mantis_vp1033.c | |||
| @@ -31,7 +31,10 @@ | |||
| 31 | 31 | ||
| 32 | #include "stv0299.h" | 32 | #include "stv0299.h" |
| 33 | #include "mantis_common.h" | 33 | #include "mantis_common.h" |
| 34 | #include "mantis_ioc.h" | ||
| 35 | #include "mantis_dvb.h" | ||
| 34 | #include "mantis_vp1033.h" | 36 | #include "mantis_vp1033.h" |
| 37 | #include "mantis_reg.h" | ||
| 35 | 38 | ||
| 36 | u8 lgtdqcs001f_inittab[] = { | 39 | u8 lgtdqcs001f_inittab[] = { |
| 37 | 0x01, 0x15, | 40 | 0x01, 0x15, |
| @@ -163,19 +166,32 @@ static int vp1033_frontend_init(struct mantis_pci *mantis, struct dvb_frontend * | |||
| 163 | { | 166 | { |
| 164 | struct i2c_adapter *adapter = &mantis->adapter; | 167 | struct i2c_adapter *adapter = &mantis->adapter; |
| 165 | 168 | ||
| 166 | dprintk(MANTIS_ERROR, 1, "Probing for STV0299 (DVB-S)"); | 169 | int err = 0; |
| 167 | fe = stv0299_attach(&lgtdqcs001f_config, adapter); | ||
| 168 | 170 | ||
| 169 | if (fe) { | 171 | err = mantis_frontend_power(mantis, POWER_ON); |
| 170 | fe->ops.tuner_ops.set_params = lgtdqcs001f_tuner_set; | 172 | if (err == 0) { |
| 171 | dprintk(MANTIS_ERROR, 1, "found STV0299 DVB-S frontend @ 0x%02x", | 173 | mantis_frontend_soft_reset(mantis); |
| 172 | lgtdqcs001f_config.demod_address); | 174 | msleep(250); |
| 173 | 175 | ||
| 174 | dprintk(MANTIS_ERROR, 1, "Mantis DVB-S STV0299 frontend attach success"); | 176 | dprintk(MANTIS_ERROR, 1, "Probing for STV0299 (DVB-S)"); |
| 177 | fe = stv0299_attach(&lgtdqcs001f_config, adapter); | ||
| 178 | |||
| 179 | if (fe) { | ||
| 180 | fe->ops.tuner_ops.set_params = lgtdqcs001f_tuner_set; | ||
| 181 | dprintk(MANTIS_ERROR, 1, "found STV0299 DVB-S frontend @ 0x%02x", | ||
| 182 | lgtdqcs001f_config.demod_address); | ||
| 183 | |||
| 184 | dprintk(MANTIS_ERROR, 1, "Mantis DVB-S STV0299 frontend attach success"); | ||
| 185 | } else { | ||
| 186 | return -1; | ||
| 187 | } | ||
| 175 | } else { | 188 | } else { |
| 176 | return -1; | 189 | dprintk(MANTIS_ERROR, 1, "Frontend on <%s> POWER ON failed! <%d>", |
| 177 | } | 190 | adapter->name, |
| 191 | err); | ||
| 178 | 192 | ||
| 193 | return -EIO; | ||
| 194 | } | ||
| 179 | mantis->fe = fe; | 195 | mantis->fe = fe; |
| 180 | dprintk(MANTIS_ERROR, 1, "Done!"); | 196 | dprintk(MANTIS_ERROR, 1, "Done!"); |
| 181 | 197 | ||
| @@ -192,4 +208,6 @@ struct mantis_hwconfig vp1033_config = { | |||
| 192 | .bytes = 0, | 208 | .bytes = 0, |
| 193 | 209 | ||
| 194 | .frontend_init = vp1033_frontend_init, | 210 | .frontend_init = vp1033_frontend_init, |
| 211 | .power = GPIF_A12, | ||
| 212 | .reset = GPIF_A13, | ||
| 195 | }; | 213 | }; |
diff --git a/drivers/media/dvb/mantis/mantis_vp1034.c b/drivers/media/dvb/mantis/mantis_vp1034.c index 40778ec8f460..98a4ec89f048 100644 --- a/drivers/media/dvb/mantis/mantis_vp1034.c +++ b/drivers/media/dvb/mantis/mantis_vp1034.c | |||
| @@ -32,6 +32,7 @@ | |||
| 32 | #include "mb86a16.h" | 32 | #include "mb86a16.h" |
| 33 | #include "mantis_common.h" | 33 | #include "mantis_common.h" |
| 34 | #include "mantis_ioc.h" | 34 | #include "mantis_ioc.h" |
| 35 | #include "mantis_dvb.h" | ||
| 35 | #include "mantis_vp1034.h" | 36 | #include "mantis_vp1034.h" |
| 36 | #include "mantis_reg.h" | 37 | #include "mantis_reg.h" |
| 37 | 38 | ||
| @@ -74,17 +75,30 @@ static int vp1034_frontend_init(struct mantis_pci *mantis, struct dvb_frontend * | |||
| 74 | { | 75 | { |
| 75 | struct i2c_adapter *adapter = &mantis->adapter; | 76 | struct i2c_adapter *adapter = &mantis->adapter; |
| 76 | 77 | ||
| 77 | dprintk(MANTIS_ERROR, 1, "Probing for MB86A16 (DVB-S/DSS)"); | 78 | int err = 0; |
| 78 | fe = mb86a16_attach(&vp1034_mb86a16_config, adapter); | ||
| 79 | if (fe) { | ||
| 80 | dprintk(MANTIS_ERROR, 1, | ||
| 81 | "found MB86A16 DVB-S/DSS frontend @0x%02x", | ||
| 82 | vp1034_mb86a16_config.demod_address); | ||
| 83 | 79 | ||
| 80 | err = mantis_frontend_power(mantis, POWER_ON); | ||
| 81 | if (err == 0) { | ||
| 82 | mantis_frontend_soft_reset(mantis); | ||
| 83 | msleep(250); | ||
| 84 | |||
| 85 | dprintk(MANTIS_ERROR, 1, "Probing for MB86A16 (DVB-S/DSS)"); | ||
| 86 | fe = mb86a16_attach(&vp1034_mb86a16_config, adapter); | ||
| 87 | if (fe) { | ||
| 88 | dprintk(MANTIS_ERROR, 1, | ||
| 89 | "found MB86A16 DVB-S/DSS frontend @0x%02x", | ||
| 90 | vp1034_mb86a16_config.demod_address); | ||
| 91 | |||
| 92 | } else { | ||
| 93 | return -1; | ||
| 94 | } | ||
| 84 | } else { | 95 | } else { |
| 85 | return -1; | 96 | dprintk(MANTIS_ERROR, 1, "Frontend on <%s> POWER ON failed! <%d>", |
| 86 | } | 97 | adapter->name, |
| 98 | err); | ||
| 87 | 99 | ||
| 100 | return -EIO; | ||
| 101 | } | ||
| 88 | mantis->fe = fe; | 102 | mantis->fe = fe; |
| 89 | dprintk(MANTIS_ERROR, 1, "Done!"); | 103 | dprintk(MANTIS_ERROR, 1, "Done!"); |
| 90 | 104 | ||
| @@ -101,4 +115,6 @@ struct mantis_hwconfig vp1034_config = { | |||
| 101 | .bytes = 0, | 115 | .bytes = 0, |
| 102 | 116 | ||
| 103 | .frontend_init = vp1034_frontend_init, | 117 | .frontend_init = vp1034_frontend_init, |
| 118 | .power = GPIF_A12, | ||
| 119 | .reset = GPIF_A13, | ||
| 104 | }; | 120 | }; |
diff --git a/drivers/media/dvb/mantis/mantis_vp2033.c b/drivers/media/dvb/mantis/mantis_vp2033.c index 877329175d0f..cef108c5ffc7 100644 --- a/drivers/media/dvb/mantis/mantis_vp2033.c +++ b/drivers/media/dvb/mantis/mantis_vp2033.c | |||
| @@ -31,6 +31,8 @@ | |||
| 31 | 31 | ||
| 32 | #include "tda1002x.h" | 32 | #include "tda1002x.h" |
| 33 | #include "mantis_common.h" | 33 | #include "mantis_common.h" |
| 34 | #include "mantis_ioc.h" | ||
| 35 | #include "mantis_dvb.h" | ||
| 34 | #include "mantis_vp2033.h" | 36 | #include "mantis_vp2033.h" |
| 35 | 37 | ||
| 36 | #define MANTIS_MODEL_NAME "VP-2033" | 38 | #define MANTIS_MODEL_NAME "VP-2033" |
| @@ -123,32 +125,46 @@ static int vp2033_frontend_init(struct mantis_pci *mantis, struct dvb_frontend * | |||
| 123 | { | 125 | { |
| 124 | struct i2c_adapter *adapter = &mantis->adapter; | 126 | struct i2c_adapter *adapter = &mantis->adapter; |
| 125 | 127 | ||
| 126 | dprintk(MANTIS_ERROR, 1, "Probing for CU1216 (DVB-C)"); | 128 | int err = 0; |
| 127 | fe = tda10021_attach(&vp2033_tda1002x_cu1216_config, | ||
| 128 | adapter, | ||
| 129 | read_pwm(mantis)); | ||
| 130 | 129 | ||
| 131 | if (fe) { | 130 | err = mantis_frontend_power(mantis, POWER_ON); |
| 132 | dprintk(MANTIS_ERROR, 1, | 131 | if (err == 0) { |
| 133 | "found Philips CU1216 DVB-C frontend (TDA10021) @ 0x%02x", | 132 | mantis_frontend_soft_reset(mantis); |
| 134 | vp2033_tda1002x_cu1216_config.demod_address); | 133 | msleep(250); |
| 135 | } else { | 134 | |
| 136 | fe = tda10023_attach(&vp2033_tda10023_cu1216_config, | 135 | dprintk(MANTIS_ERROR, 1, "Probing for CU1216 (DVB-C)"); |
| 136 | fe = tda10021_attach(&vp2033_tda1002x_cu1216_config, | ||
| 137 | adapter, | 137 | adapter, |
| 138 | read_pwm(mantis)); | 138 | read_pwm(mantis)); |
| 139 | 139 | ||
| 140 | if (fe) { | 140 | if (fe) { |
| 141 | dprintk(MANTIS_ERROR, 1, | 141 | dprintk(MANTIS_ERROR, 1, |
| 142 | "found Philips CU1216 DVB-C frontend (TDA10023) @ 0x%02x", | 142 | "found Philips CU1216 DVB-C frontend (TDA10021) @ 0x%02x", |
| 143 | vp2033_tda1002x_cu1216_config.demod_address); | 143 | vp2033_tda1002x_cu1216_config.demod_address); |
| 144 | } else { | ||
| 145 | fe = tda10023_attach(&vp2033_tda10023_cu1216_config, | ||
| 146 | adapter, | ||
| 147 | read_pwm(mantis)); | ||
| 148 | |||
| 149 | if (fe) { | ||
| 150 | dprintk(MANTIS_ERROR, 1, | ||
| 151 | "found Philips CU1216 DVB-C frontend (TDA10023) @ 0x%02x", | ||
| 152 | vp2033_tda1002x_cu1216_config.demod_address); | ||
| 153 | } | ||
| 144 | } | 154 | } |
| 145 | } | ||
| 146 | 155 | ||
| 147 | if (fe) { | 156 | if (fe) { |
| 148 | fe->ops.tuner_ops.set_params = tda1002x_cu1216_tuner_set; | 157 | fe->ops.tuner_ops.set_params = tda1002x_cu1216_tuner_set; |
| 149 | dprintk(MANTIS_ERROR, 1, "Mantis DVB-C Philips CU1216 frontend attach success"); | 158 | dprintk(MANTIS_ERROR, 1, "Mantis DVB-C Philips CU1216 frontend attach success"); |
| 159 | } else { | ||
| 160 | return -1; | ||
| 161 | } | ||
| 150 | } else { | 162 | } else { |
| 151 | return -1; | 163 | dprintk(MANTIS_ERROR, 1, "Frontend on <%s> POWER ON failed! <%d>", |
| 164 | adapter->name, | ||
| 165 | err); | ||
| 166 | |||
| 167 | return -EIO; | ||
| 152 | } | 168 | } |
| 153 | 169 | ||
| 154 | mantis->fe = fe; | 170 | mantis->fe = fe; |
| @@ -167,4 +183,6 @@ struct mantis_hwconfig vp2033_config = { | |||
| 167 | .bytes = 0, | 183 | .bytes = 0, |
| 168 | 184 | ||
| 169 | .frontend_init = vp2033_frontend_init, | 185 | .frontend_init = vp2033_frontend_init, |
| 186 | .power = GPIF_A12, | ||
| 187 | .reset = GPIF_A13, | ||
| 170 | }; | 188 | }; |
diff --git a/drivers/media/dvb/mantis/mantis_vp2040.c b/drivers/media/dvb/mantis/mantis_vp2040.c index 51b082f7f917..e2019884ac3a 100644 --- a/drivers/media/dvb/mantis/mantis_vp2040.c +++ b/drivers/media/dvb/mantis/mantis_vp2040.c | |||
| @@ -31,6 +31,8 @@ | |||
| 31 | 31 | ||
| 32 | #include "tda1002x.h" | 32 | #include "tda1002x.h" |
| 33 | #include "mantis_common.h" | 33 | #include "mantis_common.h" |
| 34 | #include "mantis_ioc.h" | ||
| 35 | #include "mantis_dvb.h" | ||
| 34 | #include "mantis_vp2040.h" | 36 | #include "mantis_vp2040.h" |
| 35 | 37 | ||
| 36 | #define MANTIS_MODEL_NAME "VP-2040" | 38 | #define MANTIS_MODEL_NAME "VP-2040" |
| @@ -123,34 +125,47 @@ static int vp2040_frontend_init(struct mantis_pci *mantis, struct dvb_frontend * | |||
| 123 | { | 125 | { |
| 124 | struct i2c_adapter *adapter = &mantis->adapter; | 126 | struct i2c_adapter *adapter = &mantis->adapter; |
| 125 | 127 | ||
| 126 | dprintk(MANTIS_ERROR, 1, "Probing for CU1216 (DVB-C)"); | 128 | int err = 0; |
| 127 | fe = tda10021_attach(&vp2040_tda1002x_cu1216_config, | ||
| 128 | adapter, | ||
| 129 | read_pwm(mantis)); | ||
| 130 | 129 | ||
| 131 | if (fe) { | 130 | err = mantis_frontend_power(mantis, POWER_ON); |
| 132 | dprintk(MANTIS_ERROR, 1, | 131 | if (err == 0) { |
| 133 | "found Philips CU1216 DVB-C frontend (TDA10021) @ 0x%02x", | 132 | mantis_frontend_soft_reset(mantis); |
| 134 | vp2040_tda1002x_cu1216_config.demod_address); | 133 | msleep(250); |
| 135 | } else { | 134 | |
| 136 | fe = tda10023_attach(&vp2040_tda10023_cu1216_config, | 135 | dprintk(MANTIS_ERROR, 1, "Probing for CU1216 (DVB-C)"); |
| 136 | fe = tda10021_attach(&vp2040_tda1002x_cu1216_config, | ||
| 137 | adapter, | 137 | adapter, |
| 138 | read_pwm(mantis)); | 138 | read_pwm(mantis)); |
| 139 | 139 | ||
| 140 | if (fe) { | 140 | if (fe) { |
| 141 | dprintk(MANTIS_ERROR, 1, | 141 | dprintk(MANTIS_ERROR, 1, |
| 142 | "found Philips CU1216 DVB-C frontend (TDA10023) @ 0x%02x", | 142 | "found Philips CU1216 DVB-C frontend (TDA10021) @ 0x%02x", |
| 143 | vp2040_tda1002x_cu1216_config.demod_address); | 143 | vp2040_tda1002x_cu1216_config.demod_address); |
| 144 | } else { | ||
| 145 | fe = tda10023_attach(&vp2040_tda10023_cu1216_config, | ||
| 146 | adapter, | ||
| 147 | read_pwm(mantis)); | ||
| 148 | |||
| 149 | if (fe) { | ||
| 150 | dprintk(MANTIS_ERROR, 1, | ||
| 151 | "found Philips CU1216 DVB-C frontend (TDA10023) @ 0x%02x", | ||
| 152 | vp2040_tda1002x_cu1216_config.demod_address); | ||
| 153 | } | ||
| 144 | } | 154 | } |
| 145 | } | ||
| 146 | 155 | ||
| 147 | if (fe) { | 156 | if (fe) { |
| 148 | fe->ops.tuner_ops.set_params = tda1002x_cu1216_tuner_set; | 157 | fe->ops.tuner_ops.set_params = tda1002x_cu1216_tuner_set; |
| 149 | dprintk(MANTIS_ERROR, 1, "Mantis DVB-C Philips CU1216 frontend attach success"); | 158 | dprintk(MANTIS_ERROR, 1, "Mantis DVB-C Philips CU1216 frontend attach success"); |
| 159 | } else { | ||
| 160 | return -1; | ||
| 161 | } | ||
| 150 | } else { | 162 | } else { |
| 151 | return -1; | 163 | dprintk(MANTIS_ERROR, 1, "Frontend on <%s> POWER ON failed! <%d>", |
| 152 | } | 164 | adapter->name, |
| 165 | err); | ||
| 153 | 166 | ||
| 167 | return -EIO; | ||
| 168 | } | ||
| 154 | mantis->fe = fe; | 169 | mantis->fe = fe; |
| 155 | dprintk(MANTIS_DEBUG, 1, "Done!"); | 170 | dprintk(MANTIS_DEBUG, 1, "Done!"); |
| 156 | 171 | ||
| @@ -167,4 +182,6 @@ struct mantis_hwconfig vp2040_config = { | |||
| 167 | .bytes = 0, | 182 | .bytes = 0, |
| 168 | 183 | ||
| 169 | .frontend_init = vp2040_frontend_init, | 184 | .frontend_init = vp2040_frontend_init, |
| 185 | .power = GPIF_A12, | ||
| 186 | .reset = GPIF_A13, | ||
| 170 | }; | 187 | }; |
diff --git a/drivers/media/dvb/mantis/mantis_vp3030.c b/drivers/media/dvb/mantis/mantis_vp3030.c index 9efcfa7b8ab4..a44fac3aabc6 100644 --- a/drivers/media/dvb/mantis/mantis_vp3030.c +++ b/drivers/media/dvb/mantis/mantis_vp3030.c | |||
| @@ -66,13 +66,23 @@ static int vp3030_frontend_init(struct mantis_pci *mantis, struct dvb_frontend * | |||
| 66 | msleep(100); | 66 | msleep(100); |
| 67 | gpio_set_bits(mantis, config->reset, 1); | 67 | gpio_set_bits(mantis, config->reset, 1); |
| 68 | 68 | ||
| 69 | dprintk(MANTIS_ERROR, 1, "Probing for 10353 (DVB-T)"); | 69 | if (err == 0) { |
| 70 | fe = zl10353_attach(&mantis_vp3030_config, adapter); | 70 | msleep(250); |
| 71 | dprintk(MANTIS_ERROR, 1, "Probing for 10353 (DVB-T)"); | ||
| 72 | fe = zl10353_attach(&mantis_vp3030_config, adapter); | ||
| 71 | 73 | ||
| 72 | if (!fe) | 74 | if (!fe) |
| 73 | return -1; | 75 | return -1; |
| 74 | 76 | ||
| 75 | tda665x_attach(fe, &env57h12d5_config, adapter); | 77 | tda665x_attach(fe, &env57h12d5_config, adapter); |
| 78 | } else { | ||
| 79 | dprintk(MANTIS_ERROR, 1, "Frontend on <%s> POWER ON failed! <%d>", | ||
| 80 | adapter->name, | ||
| 81 | err); | ||
| 82 | |||
| 83 | return -EIO; | ||
| 84 | |||
| 85 | } | ||
| 76 | mantis->fe = fe; | 86 | mantis->fe = fe; |
| 77 | dprintk(MANTIS_ERROR, 1, "Done!"); | 87 | dprintk(MANTIS_ERROR, 1, "Done!"); |
| 78 | 88 | ||
| @@ -91,4 +101,6 @@ struct mantis_hwconfig vp3030_config = { | |||
| 91 | .frontend_init = vp3030_frontend_init, | 101 | .frontend_init = vp3030_frontend_init, |
| 92 | .power = GPIF_A12, | 102 | .power = GPIF_A12, |
| 93 | .reset = GPIF_A13, | 103 | .reset = GPIF_A13, |
| 104 | |||
| 105 | .i2c_mode = MANTIS_BYTE_MODE | ||
| 94 | }; | 106 | }; |
