From 53ccd1ca69c14e29ce927c4992e5b5ceae379d64 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Wed, 21 Dec 2011 08:39:44 -0300 Subject: [media] tda827x: use DVBv5 parameters on set_params() Instead of using DVBv3 parameters, rely on DVBv5 parameters to set the tuner. Signed-off-by: Mauro Carvalho Chehab --- drivers/media/common/tuners/tda827x.c | 49 ++++++++++++++++++++--------------- 1 file changed, 28 insertions(+), 21 deletions(-) (limited to 'drivers/media/common/tuners/tda827x.c') diff --git a/drivers/media/common/tuners/tda827x.c b/drivers/media/common/tuners/tda827x.c index e0d5b43772b8..7316308d9388 100644 --- a/drivers/media/common/tuners/tda827x.c +++ b/drivers/media/common/tuners/tda827x.c @@ -155,9 +155,11 @@ static int tuner_transfer(struct dvb_frontend *fe, static int tda827xo_set_params(struct dvb_frontend *fe, struct dvb_frontend_parameters *params) { + struct dtv_frontend_properties *c = &fe->dtv_property_cache; struct tda827x_priv *priv = fe->tuner_priv; u8 buf[14]; int rc; + u32 band; struct i2c_msg msg = { .addr = priv->i2c_addr, .flags = 0, .buf = buf, .len = sizeof(buf) }; @@ -165,18 +167,20 @@ static int tda827xo_set_params(struct dvb_frontend *fe, u32 N; dprintk("%s:\n", __func__); - switch (params->u.ofdm.bandwidth) { - case BANDWIDTH_6_MHZ: + if (c->bandwidth_hz == 0) { + if_freq = 5000000; + band = BANDWIDTH_8_MHZ; + } else if (c->bandwidth_hz <= 6000000) { if_freq = 4000000; - break; - case BANDWIDTH_7_MHZ: + band = BANDWIDTH_6_MHZ; + } else if (c->bandwidth_hz <= 7000000) { if_freq = 4500000; - break; - default: /* 8 MHz or Auto */ + band = BANDWIDTH_7_MHZ; + } else { /* 8 MHz */ if_freq = 5000000; - break; + band = BANDWIDTH_8_MHZ; } - tuner_freq = params->frequency; + tuner_freq = c->frequency; i = 0; while (tda827x_table[i].lomax < tuner_freq) { @@ -220,8 +224,8 @@ static int tda827xo_set_params(struct dvb_frontend *fe, if (rc < 0) goto err; - priv->frequency = params->frequency; - priv->bandwidth = (fe->ops.info.type == FE_OFDM) ? params->u.ofdm.bandwidth : 0; + priv->frequency = c->frequency; + priv->bandwidth = band; return 0; @@ -516,9 +520,11 @@ static void tda827xa_lna_gain(struct dvb_frontend *fe, int high, static int tda827xa_set_params(struct dvb_frontend *fe, struct dvb_frontend_parameters *params) { + struct dtv_frontend_properties *c = &fe->dtv_property_cache; struct tda827x_priv *priv = fe->tuner_priv; struct tda827xa_data *frequency_map = tda827xa_dvbt; u8 buf[11]; + u32 band; struct i2c_msg msg = { .addr = priv->i2c_addr, .flags = 0, .buf = buf, .len = sizeof(buf) }; @@ -531,18 +537,20 @@ static int tda827xa_set_params(struct dvb_frontend *fe, tda827xa_lna_gain(fe, 1, NULL); msleep(20); - switch (params->u.ofdm.bandwidth) { - case BANDWIDTH_6_MHZ: + if (c->bandwidth_hz == 0) { + if_freq = 5000000; + band = BANDWIDTH_8_MHZ; + } else if (c->bandwidth_hz <= 6000000) { if_freq = 4000000; - break; - case BANDWIDTH_7_MHZ: + band = BANDWIDTH_6_MHZ; + } else if (c->bandwidth_hz <= 7000000) { if_freq = 4500000; - break; - default: /* 8 MHz or Auto */ + band = BANDWIDTH_7_MHZ; + } else { /* 8 MHz */ if_freq = 5000000; - break; + band = BANDWIDTH_8_MHZ; } - tuner_freq = params->frequency; + tuner_freq = c->frequency; if (fe->ops.info.type == FE_QAM) { dprintk("%s select tda827xa_dvbc\n", __func__); @@ -645,9 +653,8 @@ static int tda827xa_set_params(struct dvb_frontend *fe, if (rc < 0) goto err; - priv->frequency = params->frequency; - priv->bandwidth = (fe->ops.info.type == FE_OFDM) ? params->u.ofdm.bandwidth : 0; - + priv->frequency = c->frequency; + priv->bandwidth = band; return 0; -- cgit From 14d24d148c7521b2b88b396652e36f55d061e195 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Sat, 24 Dec 2011 12:24:33 -0300 Subject: [media] tuners: remove dvb_frontend_parameters from set_params() This is a big patch, yet trivial: now that all tuners use the DVBv5 way to pass parameters (e. g. via fe->dtv_property_cache), the extra parameter can be removed from set_params() call. After this change, very few DVBv3 specific stuff are left at the tuners. Signed-off-by: Mauro Carvalho Chehab --- drivers/media/common/tuners/tda827x.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'drivers/media/common/tuners/tda827x.c') diff --git a/drivers/media/common/tuners/tda827x.c b/drivers/media/common/tuners/tda827x.c index 7316308d9388..d96d0b9e1899 100644 --- a/drivers/media/common/tuners/tda827x.c +++ b/drivers/media/common/tuners/tda827x.c @@ -152,8 +152,7 @@ static int tuner_transfer(struct dvb_frontend *fe, return rc; } -static int tda827xo_set_params(struct dvb_frontend *fe, - struct dvb_frontend_parameters *params) +static int tda827xo_set_params(struct dvb_frontend *fe) { struct dtv_frontend_properties *c = &fe->dtv_property_cache; struct tda827x_priv *priv = fe->tuner_priv; @@ -517,8 +516,7 @@ static void tda827xa_lna_gain(struct dvb_frontend *fe, int high, } } -static int tda827xa_set_params(struct dvb_frontend *fe, - struct dvb_frontend_parameters *params) +static int tda827xa_set_params(struct dvb_frontend *fe) { struct dtv_frontend_properties *c = &fe->dtv_property_cache; struct tda827x_priv *priv = fe->tuner_priv; -- cgit From c6f56e7d794cba022353d464dfa3383d1b3e0125 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Mon, 26 Dec 2011 20:02:28 -0300 Subject: [media] dvb: don't use DVBv3 bandwidth macros Every frontend now uses DVBv5 way. So, let's not use the DVBv3 macros internally anymore. Signed-off-by: Mauro Carvalho Chehab --- drivers/media/common/tuners/tda827x.c | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) (limited to 'drivers/media/common/tuners/tda827x.c') diff --git a/drivers/media/common/tuners/tda827x.c b/drivers/media/common/tuners/tda827x.c index d96d0b9e1899..e180def0a657 100644 --- a/drivers/media/common/tuners/tda827x.c +++ b/drivers/media/common/tuners/tda827x.c @@ -158,7 +158,6 @@ static int tda827xo_set_params(struct dvb_frontend *fe) struct tda827x_priv *priv = fe->tuner_priv; u8 buf[14]; int rc; - u32 band; struct i2c_msg msg = { .addr = priv->i2c_addr, .flags = 0, .buf = buf, .len = sizeof(buf) }; @@ -168,16 +167,12 @@ static int tda827xo_set_params(struct dvb_frontend *fe) dprintk("%s:\n", __func__); if (c->bandwidth_hz == 0) { if_freq = 5000000; - band = BANDWIDTH_8_MHZ; } else if (c->bandwidth_hz <= 6000000) { if_freq = 4000000; - band = BANDWIDTH_6_MHZ; } else if (c->bandwidth_hz <= 7000000) { if_freq = 4500000; - band = BANDWIDTH_7_MHZ; } else { /* 8 MHz */ if_freq = 5000000; - band = BANDWIDTH_8_MHZ; } tuner_freq = c->frequency; @@ -224,7 +219,7 @@ static int tda827xo_set_params(struct dvb_frontend *fe) goto err; priv->frequency = c->frequency; - priv->bandwidth = band; + priv->bandwidth = c->bandwidth_hz; return 0; @@ -522,7 +517,6 @@ static int tda827xa_set_params(struct dvb_frontend *fe) struct tda827x_priv *priv = fe->tuner_priv; struct tda827xa_data *frequency_map = tda827xa_dvbt; u8 buf[11]; - u32 band; struct i2c_msg msg = { .addr = priv->i2c_addr, .flags = 0, .buf = buf, .len = sizeof(buf) }; @@ -537,16 +531,12 @@ static int tda827xa_set_params(struct dvb_frontend *fe) if (c->bandwidth_hz == 0) { if_freq = 5000000; - band = BANDWIDTH_8_MHZ; } else if (c->bandwidth_hz <= 6000000) { if_freq = 4000000; - band = BANDWIDTH_6_MHZ; } else if (c->bandwidth_hz <= 7000000) { if_freq = 4500000; - band = BANDWIDTH_7_MHZ; } else { /* 8 MHz */ if_freq = 5000000; - band = BANDWIDTH_8_MHZ; } tuner_freq = c->frequency; @@ -652,7 +642,7 @@ static int tda827xa_set_params(struct dvb_frontend *fe) goto err; priv->frequency = c->frequency; - priv->bandwidth = band; + priv->bandwidth = c->bandwidth_hz; return 0; -- cgit From 6225f18b88b9ba6c6643aa8c1c96f51a9ad24380 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Wed, 4 Jan 2012 23:10:19 -0200 Subject: [media] Don't test for ops->info.type inside drivers Now, ops->info.type is handled inside the dvb_frontend core, only for DVBv3 calls, and according with the delivery system. So, drivers should not care or use it, otherwise, it may have issues with DVBv5 calls. The drivers that were still using it were detected via this small temporary hack: --- a/include/linux/dvb/frontend.h +++ b/include/linux/dvb/frontend.h @@ -29,13 +29,16 @@ #include typedef enum fe_type { +#if defined(__DVB_CORE__) || !defined (__KERNEL__) FE_QPSK, FE_QAM, FE_OFDM, FE_ATSC +#else +FE_FOOO +#endif } fe_type_t; - typedef enum fe_caps { FE_IS_STUPID = 0, FE_CAN_INVERSION_AUTO = 0x1, Signed-off-by: Mauro Carvalho Chehab --- drivers/media/common/tuners/tda827x.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'drivers/media/common/tuners/tda827x.c') diff --git a/drivers/media/common/tuners/tda827x.c b/drivers/media/common/tuners/tda827x.c index e180def0a657..a0d176267470 100644 --- a/drivers/media/common/tuners/tda827x.c +++ b/drivers/media/common/tuners/tda827x.c @@ -540,9 +540,14 @@ static int tda827xa_set_params(struct dvb_frontend *fe) } tuner_freq = c->frequency; - if (fe->ops.info.type == FE_QAM) { + switch (c->delivery_system) { + case SYS_DVBC_ANNEX_A: + case SYS_DVBC_ANNEX_C: dprintk("%s select tda827xa_dvbc\n", __func__); frequency_map = tda827xa_dvbc; + break; + default: + break; } i = 0; -- cgit