aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/dvb
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/media/dvb')
-rw-r--r--drivers/media/dvb/dvb-usb/gp8psk-fe.c140
-rw-r--r--drivers/media/dvb/dvb-usb/gp8psk.c16
-rw-r--r--drivers/media/dvb/dvb-usb/gp8psk.h1
3 files changed, 131 insertions, 26 deletions
diff --git a/drivers/media/dvb/dvb-usb/gp8psk-fe.c b/drivers/media/dvb/dvb-usb/gp8psk-fe.c
index 262a858c3068..20eadf9318e0 100644
--- a/drivers/media/dvb/dvb-usb/gp8psk-fe.c
+++ b/drivers/media/dvb/dvb-usb/gp8psk-fe.c
@@ -25,6 +25,20 @@ struct gp8psk_fe_state {
25 unsigned long status_check_interval; 25 unsigned long status_check_interval;
26}; 26};
27 27
28static int gp8psk_tuned_to_DCII(struct dvb_frontend *fe)
29{
30 struct gp8psk_fe_state *st = fe->demodulator_priv;
31 u8 status;
32 gp8psk_usb_in_op(st->d, GET_8PSK_CONFIG, 0, 0, &status, 1);
33 return status & bmDCtuned;
34}
35
36static int gp8psk_set_tuner_mode(struct dvb_frontend *fe, int mode)
37{
38 struct gp8psk_fe_state *state = fe->demodulator_priv;
39 return gp8psk_usb_out_op(state->d, SET_8PSK_CONFIG, mode, 0, NULL, 0);
40}
41
28static int gp8psk_fe_update_status(struct gp8psk_fe_state *st) 42static int gp8psk_fe_update_status(struct gp8psk_fe_state *st)
29{ 43{
30 u8 buf[6]; 44 u8 buf[6];
@@ -99,39 +113,114 @@ static int gp8psk_fe_get_tune_settings(struct dvb_frontend* fe, struct dvb_front
99 return 0; 113 return 0;
100} 114}
101 115
116static int gp8psk_fe_set_property(struct dvb_frontend *fe,
117 struct dtv_property *tvp)
118{
119 deb_fe("%s(..)\n", __func__);
120 return 0;
121}
122
123static int gp8psk_fe_get_property(struct dvb_frontend *fe,
124 struct dtv_property *tvp)
125{
126 deb_fe("%s(..)\n", __func__);
127 return 0;
128}
129
130
102static int gp8psk_fe_set_frontend(struct dvb_frontend* fe, 131static int gp8psk_fe_set_frontend(struct dvb_frontend* fe,
103 struct dvb_frontend_parameters *fep) 132 struct dvb_frontend_parameters *fep)
104{ 133{
105 struct gp8psk_fe_state *state = fe->demodulator_priv; 134 struct gp8psk_fe_state *state = fe->demodulator_priv;
135 struct dtv_frontend_properties *c = &fe->dtv_property_cache;
106 u8 cmd[10]; 136 u8 cmd[10];
107 u32 freq = fep->frequency * 1000; 137 u32 freq = fep->frequency * 1000;
138 int gp_product_id = le16_to_cpu(state->d->udev->descriptor.idProduct);
139
140 deb_fe("%s()\n", __func__);
108 141
109 cmd[4] = freq & 0xff; 142 cmd[4] = freq & 0xff;
110 cmd[5] = (freq >> 8) & 0xff; 143 cmd[5] = (freq >> 8) & 0xff;
111 cmd[6] = (freq >> 16) & 0xff; 144 cmd[6] = (freq >> 16) & 0xff;
112 cmd[7] = (freq >> 24) & 0xff; 145 cmd[7] = (freq >> 24) & 0xff;
113 146
114 switch(fe->ops.info.type) { 147 switch (c->delivery_system) {
115 case FE_QPSK: 148 case SYS_DVBS:
116 cmd[0] = fep->u.qpsk.symbol_rate & 0xff; 149 /* Only QPSK is supported for DVB-S */
117 cmd[1] = (fep->u.qpsk.symbol_rate >> 8) & 0xff; 150 if (c->modulation != QPSK) {
118 cmd[2] = (fep->u.qpsk.symbol_rate >> 16) & 0xff; 151 deb_fe("%s: unsupported modulation selected (%d)\n",
119 cmd[3] = (fep->u.qpsk.symbol_rate >> 24) & 0xff; 152 __func__, c->modulation);
120 cmd[8] = ADV_MOD_DVB_QPSK; 153 return -EOPNOTSUPP;
121 cmd[9] = 0x03; /*ADV_MOD_FEC_XXX*/ 154 }
155 c->fec_inner = FEC_AUTO;
122 break; 156 break;
157 case SYS_DVBS2:
158 deb_fe("%s: DVB-S2 delivery system selected\n", __func__);
159 break;
160
123 default: 161 default:
124 // other modes are unsuported right now 162 deb_fe("%s: unsupported delivery system selected (%d)\n",
125 cmd[0] = 0; 163 __func__, c->delivery_system);
126 cmd[1] = 0; 164 return -EOPNOTSUPP;
127 cmd[2] = 0; 165 }
128 cmd[3] = 0; 166
129 cmd[8] = 0; 167 cmd[0] = c->symbol_rate & 0xff;
168 cmd[1] = (c->symbol_rate >> 8) & 0xff;
169 cmd[2] = (c->symbol_rate >> 16) & 0xff;
170 cmd[3] = (c->symbol_rate >> 24) & 0xff;
171 switch (c->modulation) {
172 case QPSK:
173 if (gp_product_id == USB_PID_GENPIX_8PSK_REV_1_WARM)
174 if (gp8psk_tuned_to_DCII(fe))
175 gp8psk_bcm4500_reload(state->d);
176 switch (c->fec_inner) {
177 case FEC_1_2:
178 cmd[9] = 0; break;
179 case FEC_2_3:
180 cmd[9] = 1; break;
181 case FEC_3_4:
182 cmd[9] = 2; break;
183 case FEC_5_6:
184 cmd[9] = 3; break;
185 case FEC_7_8:
186 cmd[9] = 4; break;
187 case FEC_AUTO:
188 cmd[9] = 5; break;
189 default:
190 cmd[9] = 5; break;
191 }
192 cmd[8] = ADV_MOD_DVB_QPSK;
193 break;
194 case PSK_8: /* PSK_8 is for compatibility with DN */
195 cmd[8] = ADV_MOD_TURBO_8PSK;
196 switch (c->fec_inner) {
197 case FEC_2_3:
198 cmd[9] = 0; break;
199 case FEC_3_4:
200 cmd[9] = 1; break;
201 case FEC_3_5:
202 cmd[9] = 2; break;
203 case FEC_5_6:
204 cmd[9] = 3; break;
205 case FEC_8_9:
206 cmd[9] = 4; break;
207 default:
208 cmd[9] = 0; break;
209 }
210 break;
211 case QAM_16: /* QAM_16 is for compatibility with DN */
212 cmd[8] = ADV_MOD_TURBO_16QAM;
130 cmd[9] = 0; 213 cmd[9] = 0;
131 break; 214 break;
215 default: /* Unknown modulation */
216 deb_fe("%s: unsupported modulation selected (%d)\n",
217 __func__, c->modulation);
218 return -EOPNOTSUPP;
132 } 219 }
133 220
134 gp8psk_usb_out_op(state->d,TUNE_8PSK,0,0,cmd,10); 221 if (gp_product_id == USB_PID_GENPIX_8PSK_REV_1_WARM)
222 gp8psk_set_tuner_mode(fe, 0);
223 gp8psk_usb_out_op(state->d, TUNE_8PSK, 0, 0, cmd, 10);
135 224
136 state->lock = 0; 225 state->lock = 0;
137 state->next_status_check = jiffies; 226 state->next_status_check = jiffies;
@@ -140,13 +229,6 @@ static int gp8psk_fe_set_frontend(struct dvb_frontend* fe,
140 return 0; 229 return 0;
141} 230}
142 231
143static int gp8psk_fe_get_frontend(struct dvb_frontend* fe,
144 struct dvb_frontend_parameters *fep)
145{
146 return 0;
147}
148
149
150static int gp8psk_fe_send_diseqc_msg (struct dvb_frontend* fe, 232static int gp8psk_fe_send_diseqc_msg (struct dvb_frontend* fe,
151 struct dvb_diseqc_master_cmd *m) 233 struct dvb_diseqc_master_cmd *m)
152{ 234{
@@ -261,9 +343,13 @@ static struct dvb_frontend_ops gp8psk_fe_ops = {
261 .symbol_rate_max = 45000000, 343 .symbol_rate_max = 45000000,
262 .symbol_rate_tolerance = 500, /* ppm */ 344 .symbol_rate_tolerance = 500, /* ppm */
263 .caps = FE_CAN_INVERSION_AUTO | 345 .caps = FE_CAN_INVERSION_AUTO |
264 FE_CAN_FEC_1_2 | FE_CAN_FEC_2_3 | FE_CAN_FEC_3_4 | 346 FE_CAN_FEC_1_2 | FE_CAN_FEC_2_3 | FE_CAN_FEC_3_4 |
265 FE_CAN_FEC_5_6 | FE_CAN_FEC_7_8 | FE_CAN_FEC_AUTO | 347 FE_CAN_FEC_5_6 | FE_CAN_FEC_7_8 | FE_CAN_FEC_AUTO |
266 FE_CAN_QPSK 348 /*
349 * FE_CAN_QAM_16 is for compatibility
350 * (Myth incorrectly detects Turbo-QPSK as plain QAM-16)
351 */
352 FE_CAN_QPSK | FE_CAN_QAM_16
267 }, 353 },
268 354
269 .release = gp8psk_fe_release, 355 .release = gp8psk_fe_release,
@@ -271,8 +357,10 @@ static struct dvb_frontend_ops gp8psk_fe_ops = {
271 .init = NULL, 357 .init = NULL,
272 .sleep = NULL, 358 .sleep = NULL,
273 359
360 .set_property = gp8psk_fe_set_property,
361 .get_property = gp8psk_fe_get_property,
274 .set_frontend = gp8psk_fe_set_frontend, 362 .set_frontend = gp8psk_fe_set_frontend,
275 .get_frontend = gp8psk_fe_get_frontend, 363
276 .get_tune_settings = gp8psk_fe_get_tune_settings, 364 .get_tune_settings = gp8psk_fe_get_tune_settings,
277 365
278 .read_status = gp8psk_fe_read_status, 366 .read_status = gp8psk_fe_read_status,
diff --git a/drivers/media/dvb/dvb-usb/gp8psk.c b/drivers/media/dvb/dvb-usb/gp8psk.c
index d965a923f391..c1da962cc886 100644
--- a/drivers/media/dvb/dvb-usb/gp8psk.c
+++ b/drivers/media/dvb/dvb-usb/gp8psk.c
@@ -174,6 +174,22 @@ static int gp8psk_power_ctrl(struct dvb_usb_device *d, int onoff)
174 return 0; 174 return 0;
175} 175}
176 176
177int gp8psk_bcm4500_reload(struct dvb_usb_device *d)
178{
179 u8 buf;
180 int gp_product_id = le16_to_cpu(d->udev->descriptor.idProduct);
181 /* Turn off 8psk power */
182 if (gp8psk_usb_in_op(d, BOOT_8PSK, 0, 0, &buf, 1))
183 return -EINVAL;
184 /* Turn On 8psk power */
185 if (gp8psk_usb_in_op(d, BOOT_8PSK, 1, 0, &buf, 1))
186 return -EINVAL;
187 /* load BCM4500 firmware */
188 if (gp_product_id == USB_PID_GENPIX_8PSK_REV_1_WARM)
189 if (gp8psk_load_bcm4500fw(d))
190 return EINVAL;
191 return 0;
192}
177 193
178static int gp8psk_streaming_ctrl(struct dvb_usb_adapter *adap, int onoff) 194static int gp8psk_streaming_ctrl(struct dvb_usb_adapter *adap, int onoff)
179{ 195{
diff --git a/drivers/media/dvb/dvb-usb/gp8psk.h b/drivers/media/dvb/dvb-usb/gp8psk.h
index e5cd8149c23d..e83a57506cfa 100644
--- a/drivers/media/dvb/dvb-usb/gp8psk.h
+++ b/drivers/media/dvb/dvb-usb/gp8psk.h
@@ -92,5 +92,6 @@ extern struct dvb_frontend * gp8psk_fe_attach(struct dvb_usb_device *d);
92extern int gp8psk_usb_in_op(struct dvb_usb_device *d, u8 req, u16 value, u16 index, u8 *b, int blen); 92extern int gp8psk_usb_in_op(struct dvb_usb_device *d, u8 req, u16 value, u16 index, u8 *b, int blen);
93extern int gp8psk_usb_out_op(struct dvb_usb_device *d, u8 req, u16 value, 93extern int gp8psk_usb_out_op(struct dvb_usb_device *d, u8 req, u16 value,
94 u16 index, u8 *b, int blen); 94 u16 index, u8 *b, int blen);
95extern int gp8psk_bcm4500_reload(struct dvb_usb_device *d);
95 96
96#endif 97#endif