aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/dvb/frontends/drxk_hard.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/media/dvb/frontends/drxk_hard.c')
-rw-r--r--drivers/media/dvb/frontends/drxk_hard.c192
1 files changed, 81 insertions, 111 deletions
diff --git a/drivers/media/dvb/frontends/drxk_hard.c b/drivers/media/dvb/frontends/drxk_hard.c
index 77e78f459842..a95fb44cbba3 100644
--- a/drivers/media/dvb/frontends/drxk_hard.c
+++ b/drivers/media/dvb/frontends/drxk_hard.c
@@ -6174,7 +6174,7 @@ error:
6174 return status; 6174 return status;
6175} 6175}
6176 6176
6177static void drxk_c_release(struct dvb_frontend *fe) 6177static void drxk_release(struct dvb_frontend *fe)
6178{ 6178{
6179 struct drxk_state *state = fe->demodulator_priv; 6179 struct drxk_state *state = fe->demodulator_priv;
6180 6180
@@ -6182,21 +6182,7 @@ static void drxk_c_release(struct dvb_frontend *fe)
6182 kfree(state); 6182 kfree(state);
6183} 6183}
6184 6184
6185static int drxk_c_init(struct dvb_frontend *fe) 6185static int drxk_sleep(struct dvb_frontend *fe)
6186{
6187 struct drxk_state *state = fe->demodulator_priv;
6188
6189 dprintk(1, "\n");
6190 if (mutex_trylock(&state->ctlock) == 0)
6191 return -EBUSY;
6192 if (state->m_itut_annex_c)
6193 SetOperationMode(state, OM_QAM_ITU_C);
6194 else
6195 SetOperationMode(state, OM_QAM_ITU_A);
6196 return 0;
6197}
6198
6199static int drxk_c_sleep(struct dvb_frontend *fe)
6200{ 6186{
6201 struct drxk_state *state = fe->demodulator_priv; 6187 struct drxk_state *state = fe->demodulator_priv;
6202 6188
@@ -6229,24 +6215,36 @@ static int drxk_set_parameters(struct dvb_frontend *fe)
6229 return -EINVAL; 6215 return -EINVAL;
6230 } 6216 }
6231 6217
6218 if (fe->ops.i2c_gate_ctrl)
6219 fe->ops.i2c_gate_ctrl(fe, 1);
6220 if (fe->ops.tuner_ops.set_params)
6221 fe->ops.tuner_ops.set_params(fe);
6222 if (fe->ops.i2c_gate_ctrl)
6223 fe->ops.i2c_gate_ctrl(fe, 0);
6224 state->props = *p;
6225
6232 switch (delsys) { 6226 switch (delsys) {
6233 case SYS_DVBC_ANNEX_A: 6227 case SYS_DVBC_ANNEX_A:
6234 state->m_itut_annex_c = false;
6235 break;
6236 case SYS_DVBC_ANNEX_C: 6228 case SYS_DVBC_ANNEX_C:
6229 if (!state->m_hasDVBC)
6230 return -EINVAL;
6231 state->m_itut_annex_c = (delsys == SYS_DVBC_ANNEX_C) ? true : false;
6232 if (state->m_itut_annex_c)
6233 SetOperationMode(state, OM_QAM_ITU_C);
6234 else
6235 SetOperationMode(state, OM_QAM_ITU_A);
6236 break;
6237 state->m_itut_annex_c = true; 6237 state->m_itut_annex_c = true;
6238 break; 6238 break;
6239 case SYS_DVBT:
6240 if (!state->m_hasDVBT)
6241 return -EINVAL;
6242 SetOperationMode(state, OM_DVBT);
6243 break;
6239 default: 6244 default:
6240 return -EINVAL; 6245 return -EINVAL;
6241 } 6246 }
6242 6247
6243 if (fe->ops.i2c_gate_ctrl)
6244 fe->ops.i2c_gate_ctrl(fe, 1);
6245 if (fe->ops.tuner_ops.set_params)
6246 fe->ops.tuner_ops.set_params(fe);
6247 if (fe->ops.i2c_gate_ctrl)
6248 fe->ops.i2c_gate_ctrl(fe, 0);
6249 state->props = *p;
6250 fe->ops.tuner_ops.get_if_frequency(fe, &IF); 6248 fe->ops.tuner_ops.get_if_frequency(fe, &IF);
6251 Start(state, 0, IF); 6249 Start(state, 0, IF);
6252 6250
@@ -6314,91 +6312,54 @@ static int drxk_read_ucblocks(struct dvb_frontend *fe, u32 *ucblocks)
6314 return 0; 6312 return 0;
6315} 6313}
6316 6314
6317static int drxk_c_get_tune_settings(struct dvb_frontend *fe, struct dvb_frontend_tune_settings 6315static int drxk_get_tune_settings(struct dvb_frontend *fe, struct dvb_frontend_tune_settings
6318 *sets) 6316 *sets)
6319{ 6317{
6320 dprintk(1, "\n"); 6318 struct dtv_frontend_properties *p = &fe->dtv_property_cache;
6321 sets->min_delay_ms = 3000;
6322 sets->max_drift = 0;
6323 sets->step_size = 0;
6324 return 0;
6325}
6326
6327static void drxk_t_release(struct dvb_frontend *fe)
6328{
6329 /*
6330 * There's nothing to release here, as the state struct
6331 * is already freed by drxk_c_release.
6332 */
6333}
6334
6335static int drxk_t_init(struct dvb_frontend *fe)
6336{
6337 struct drxk_state *state = fe->demodulator_priv;
6338
6339 dprintk(1, "\n");
6340 if (mutex_trylock(&state->ctlock) == 0)
6341 return -EBUSY;
6342 SetOperationMode(state, OM_DVBT);
6343 return 0;
6344}
6345
6346static int drxk_t_sleep(struct dvb_frontend *fe)
6347{
6348 struct drxk_state *state = fe->demodulator_priv;
6349 6319
6350 dprintk(1, "\n"); 6320 dprintk(1, "\n");
6351 mutex_unlock(&state->ctlock); 6321 switch (p->delivery_system) {
6352 return 0; 6322 case SYS_DVBC_ANNEX_A:
6323 case SYS_DVBC_ANNEX_C:
6324 sets->min_delay_ms = 3000;
6325 sets->max_drift = 0;
6326 sets->step_size = 0;
6327 return 0;
6328 default:
6329 /*
6330 * For DVB-T, let it use the default DVB core way, that is:
6331 * fepriv->step_size = fe->ops.info.frequency_stepsize * 2
6332 */
6333 return -EINVAL;
6334 }
6353} 6335}
6354 6336
6355static struct dvb_frontend_ops drxk_c_ops = { 6337static struct dvb_frontend_ops drxk_ops = {
6356 .delsys = { SYS_DVBC_ANNEX_A, SYS_DVBC_ANNEX_C }, 6338 /* .delsys will be filled dynamically */
6357 .info = {
6358 .name = "DRXK DVB-C",
6359 .frequency_min = 47000000,
6360 .frequency_max = 862000000,
6361 .symbol_rate_min = 870000,
6362 .symbol_rate_max = 11700000,
6363 .caps = FE_CAN_QAM_16 | FE_CAN_QAM_32 | FE_CAN_QAM_64 |
6364 FE_CAN_QAM_128 | FE_CAN_QAM_256 | FE_CAN_FEC_AUTO},
6365 .release = drxk_c_release,
6366 .init = drxk_c_init,
6367 .sleep = drxk_c_sleep,
6368 .i2c_gate_ctrl = drxk_gate_ctrl,
6369
6370 .set_frontend = drxk_set_parameters,
6371 .get_tune_settings = drxk_c_get_tune_settings,
6372
6373 .read_status = drxk_read_status,
6374 .read_ber = drxk_read_ber,
6375 .read_signal_strength = drxk_read_signal_strength,
6376 .read_snr = drxk_read_snr,
6377 .read_ucblocks = drxk_read_ucblocks,
6378};
6379
6380static struct dvb_frontend_ops drxk_t_ops = {
6381 .delsys = { SYS_DVBT },
6382 .info = { 6339 .info = {
6383 .name = "DRXK DVB-T", 6340 .name = "DRXK",
6384 .frequency_min = 47125000, 6341 .frequency_min = 47000000,
6385 .frequency_max = 865000000, 6342 .frequency_max = 865000000,
6386 .frequency_stepsize = 166667, 6343 /* For DVB-C */
6387 .frequency_tolerance = 0, 6344 .symbol_rate_min = 870000,
6388 .caps = FE_CAN_FEC_1_2 | FE_CAN_FEC_2_3 | 6345 .symbol_rate_max = 11700000,
6389 FE_CAN_FEC_3_4 | FE_CAN_FEC_5_6 | FE_CAN_FEC_7_8 | 6346 /* For DVB-T */
6390 FE_CAN_FEC_AUTO | 6347 .frequency_stepsize = 166667,
6391 FE_CAN_QAM_16 | FE_CAN_QAM_64 | 6348
6392 FE_CAN_QAM_AUTO | 6349 .caps = FE_CAN_QAM_16 | FE_CAN_QAM_32 | FE_CAN_QAM_64 |
6393 FE_CAN_TRANSMISSION_MODE_AUTO | 6350 FE_CAN_QAM_128 | FE_CAN_QAM_256 | FE_CAN_FEC_AUTO |
6394 FE_CAN_GUARD_INTERVAL_AUTO | 6351 FE_CAN_FEC_1_2 | FE_CAN_FEC_2_3 | FE_CAN_FEC_3_4 |
6395 FE_CAN_HIERARCHY_AUTO | FE_CAN_RECOVER | FE_CAN_MUTE_TS}, 6352 FE_CAN_FEC_5_6 | FE_CAN_FEC_7_8 | FE_CAN_MUTE_TS |
6396 .release = drxk_t_release, 6353 FE_CAN_TRANSMISSION_MODE_AUTO | FE_CAN_RECOVER |
6397 .init = drxk_t_init, 6354 FE_CAN_GUARD_INTERVAL_AUTO | FE_CAN_HIERARCHY_AUTO
6398 .sleep = drxk_t_sleep, 6355 },
6356
6357 .release = drxk_release,
6358 .sleep = drxk_sleep,
6399 .i2c_gate_ctrl = drxk_gate_ctrl, 6359 .i2c_gate_ctrl = drxk_gate_ctrl,
6400 6360
6401 .set_frontend = drxk_set_parameters, 6361 .set_frontend = drxk_set_parameters,
6362 .get_tune_settings = drxk_get_tune_settings,
6402 6363
6403 .read_status = drxk_read_status, 6364 .read_status = drxk_read_status,
6404 .read_ber = drxk_read_ber, 6365 .read_ber = drxk_read_ber,
@@ -6408,9 +6369,10 @@ static struct dvb_frontend_ops drxk_t_ops = {
6408}; 6369};
6409 6370
6410struct dvb_frontend *drxk_attach(const struct drxk_config *config, 6371struct dvb_frontend *drxk_attach(const struct drxk_config *config,
6411 struct i2c_adapter *i2c, 6372 struct i2c_adapter *i2c)
6412 struct dvb_frontend **fe_t)
6413{ 6373{
6374 int n;
6375
6414 struct drxk_state *state = NULL; 6376 struct drxk_state *state = NULL;
6415 u8 adr = config->adr; 6377 u8 adr = config->adr;
6416 6378
@@ -6445,21 +6407,29 @@ struct dvb_frontend *drxk_attach(const struct drxk_config *config,
6445 mutex_init(&state->mutex); 6407 mutex_init(&state->mutex);
6446 mutex_init(&state->ctlock); 6408 mutex_init(&state->ctlock);
6447 6409
6448 memcpy(&state->c_frontend.ops, &drxk_c_ops, 6410 memcpy(&state->frontend.ops, &drxk_ops, sizeof(drxk_ops));
6449 sizeof(struct dvb_frontend_ops)); 6411 state->frontend.demodulator_priv = state;
6450 memcpy(&state->t_frontend.ops, &drxk_t_ops,
6451 sizeof(struct dvb_frontend_ops));
6452 state->c_frontend.demodulator_priv = state;
6453 state->t_frontend.demodulator_priv = state;
6454 6412
6455 init_state(state); 6413 init_state(state);
6456 if (init_drxk(state) < 0) 6414 if (init_drxk(state) < 0)
6457 goto error; 6415 goto error;
6458 *fe_t = &state->t_frontend;
6459 6416
6460 printk(KERN_INFO "drxk: frontend initialized.\n"); 6417 /* Initialize the supported delivery systems */
6418 n = 0;
6419 if (state->m_hasDVBC) {
6420 state->frontend.ops.delsys[n++] = SYS_DVBC_ANNEX_A;
6421 state->frontend.ops.delsys[n++] = SYS_DVBC_ANNEX_C;
6422 strlcat(state->frontend.ops.info.name, " DVB-C",
6423 sizeof(state->frontend.ops.info.name));
6424 }
6425 if (state->m_hasDVBT) {
6426 state->frontend.ops.delsys[n++] = SYS_DVBT;
6427 strlcat(state->frontend.ops.info.name, " DVB-T",
6428 sizeof(state->frontend.ops.info.name));
6429 }
6461 6430
6462 return &state->c_frontend; 6431 printk(KERN_INFO "drxk: frontend initialized.\n");
6432 return &state->frontend;
6463 6433
6464error: 6434error:
6465 printk(KERN_ERR "drxk: not found\n"); 6435 printk(KERN_ERR "drxk: not found\n");