From 73c0b7c386beae392cff568e08914582ed6329d1 Mon Sep 17 00:00:00 2001 From: Manu Abraham <abraham.manu@xxxxxxxxx> Date: Sat, 19 Nov 2011 21:01:03 +0530 Subject: [PATCH 05/13] TDA18271c2dd: Allow frontend to set DELSYS, rather than querying fe->ops.info.type With any tuner that can tune to multiple delivery systems/standards, it does query fe->ops.info.type to determine frontend type and set the delivery system type. fe->ops.info.type can handle only 4 delivery systems, viz FE_QPSK, FE_QAM, FE_OFDM and FE_ATSC. Signed-off-by: Manu Abraham <abraham.manu@xxxxxxxxx> --- drivers/media/dvb/frontends/tda18271c2dd.c | 56 ++++++++++++++++++++++++++++ 1 files changed, 56 insertions(+), 0 deletions(-) diff --git a/drivers/media/dvb/frontends/tda18271c2dd.c b/drivers/media/dvb/frontends/tda18271c2dd.c index 1b1bf20..6077674 100644 --- a/drivers/media/dvb/frontends/tda18271c2dd.c +++ b/drivers/media/dvb/frontends/tda18271c2dd.c @@ -1180,6 +1180,61 @@ static int set_params(struct dvb_frontend *fe, return status; } +static int set_state(struct dvb_frontend *fe, enum tuner_param param, struct tuner_state *tuner) +{ + struct tda_state *state = fe->tuner_priv; + fe_delivery_system_t delsys = SYS_UNDEFINED; + u32 bandwidth = 0; + int status = 0; + int Standard = 0; + + if (param & DVBFE_TUNER_DELSYS) + delsys = tuner->delsys; + if (param & DVBFE_TUNER_FREQUENCY) + state->m_Frequency = tuner->frequency; + if (param & DVBFE_TUNER_BANDWIDTH) + bandwidth = tuner->bandwidth; + + switch (delsys) { + case SYS_DVBT: + switch (bandwidth) { + case 6000000: + Standard = HF_DVBT_6MHZ; + break; + case 7000000: + Standard = HF_DVBT_7MHZ; + break; + case 8000000: + Standard = HF_DVBT_8MHZ; + break; + } + break; + case SYS_DVBC_ANNEX_AC: + /* + * FIXME! API BUG! DVB-C ANNEX A & C are different + * This should have been simply DVBC_ANNEX_A + */ + Standard = HF_DVBC_6MHZ; + break; + default: + status = -EINVAL; + goto err; + } + + do { + status = RFTrackingFiltersCorrection(state, state->m_Frequency); + if (status < 0) + break; + status = ChannelConfiguration(state, state->m_Frequency, Standard); + if (status < 0) + break; + + msleep(state->m_SettlingTime); /* Allow AGC's to settle down */ + } while (0); +err: + return status; +} + #if 0 static int GetSignalStrength(s32 *pSignalStrength, u32 RFAgc, u32 IFAgc) { @@ -1221,6 +1276,7 @@ static struct dvb_tuner_ops tuner_ops = { .init = init, .sleep = sleep, .set_params = set_params, + .set_state = set_state, .release = release, .get_if_frequency = get_if_frequency, .get_bandwidth = get_bandwidth, -- 1.7.1