* [PATCH 0/6] Change support for Annex A/C @ 2011-12-18 0:21 Mauro Carvalho Chehab 2011-12-18 0:21 ` [PATCH 1/6] [media] Update documentation to reflect DVB-C Annex A/C support Mauro Carvalho Chehab 0 siblings, 1 reply; 9+ messages in thread From: Mauro Carvalho Chehab @ 2011-12-18 0:21 UTC (permalink / raw) To: linux-media; +Cc: Mauro Carvalho Chehab As discussed at the ML, all existing drivers, except for dvb-k only support DVB-C ITU-T J.83 Annex A. Also, a few dvb-c drivers don't support 0.13 roll-off, requred for Annex C. So, apply Manu's patch that adds a separate delivery system for Annex C, and change a few existing drivers that are known to work with both standards to work properly with both annexes. Mauro Carvalho Chehab (6): [media] Update documentation to reflect DVB-C Annex A/C support [media] Remove Annex A/C selection via roll-off factor [media] drx-k: report the supported delivery systems [media] tda10023: Don't use a magic numbers for QAM modulation [media] tda10023: add support for DVB-C Annex C [media] tda10021: Add support for DVB-C Annex C Documentation/DocBook/media/dvb/dvbproperty.xml | 11 +- Documentation/DocBook/media/dvb/frontend.xml | 4 +- drivers/media/common/tuners/xc5000.c | 137 +++++++++------------- drivers/media/dvb/dvb-core/dvb_frontend.c | 25 ++++- drivers/media/dvb/frontends/drxk_hard.c | 43 ++++++- drivers/media/dvb/frontends/tda10021.c | 83 ++++++++++---- drivers/media/dvb/frontends/tda10023.c | 77 +++++++++---- drivers/media/dvb/frontends/tda18271c2dd.c | 44 +++---- include/linux/dvb/frontend.h | 2 - 9 files changed, 258 insertions(+), 168 deletions(-) -- 1.7.8 ^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH 1/6] [media] Update documentation to reflect DVB-C Annex A/C support 2011-12-18 0:21 [PATCH 0/6] Change support for Annex A/C Mauro Carvalho Chehab @ 2011-12-18 0:21 ` Mauro Carvalho Chehab 2011-12-18 0:21 ` [PATCH 2/6] [media] Remove Annex A/C selection via roll-off factor Mauro Carvalho Chehab 2011-12-18 0:27 ` [PATCH 1/6] [media] Update documentation to reflect DVB-C Annex A/C support Mauro Carvalho Chehab 0 siblings, 2 replies; 9+ messages in thread From: Mauro Carvalho Chehab @ 2011-12-18 0:21 UTC (permalink / raw) To: linux-media; +Cc: Mauro Carvalho Chehab Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com> --- Documentation/DocBook/media/dvb/dvbproperty.xml | 11 +++++------ Documentation/DocBook/media/dvb/frontend.xml | 4 ++-- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/Documentation/DocBook/media/dvb/dvbproperty.xml b/Documentation/DocBook/media/dvb/dvbproperty.xml index b812e31..ffee1fb 100644 --- a/Documentation/DocBook/media/dvb/dvbproperty.xml +++ b/Documentation/DocBook/media/dvb/dvbproperty.xml @@ -311,8 +311,6 @@ typedef enum fe_rolloff { ROLLOFF_20, ROLLOFF_25, ROLLOFF_AUTO, - ROLLOFF_15, /* DVB-C Annex A */ - ROLLOFF_13, /* DVB-C Annex C */ } fe_rolloff_t; </programlisting> </section> @@ -336,9 +334,10 @@ typedef enum fe_rolloff { <title>fe_delivery_system type</title> <para>Possible values: </para> <programlisting> + typedef enum fe_delivery_system { SYS_UNDEFINED, - SYS_DVBC_ANNEX_AC, + SYS_DVBC_ANNEX_A, SYS_DVBC_ANNEX_B, SYS_DVBT, SYS_DSS, @@ -355,6 +354,7 @@ typedef enum fe_delivery_system { SYS_DAB, SYS_DVBT2, SYS_TURBO, + SYS_DVBC_ANNEX_C, } fe_delivery_system_t; </programlisting> </section> @@ -781,7 +781,8 @@ typedef enum fe_hierarchy { <title>Properties used on cable delivery systems</title> <section id="dvbc-params"> <title>DVB-C delivery system</title> - <para>The DVB-C Annex-A/C is the widely used cable standard. Transmission uses QAM modulation.</para> + <para>The DVB-C Annex-A is the widely used cable standard. Transmission uses QAM modulation.</para> + <para>The DVB-C Annex-C is optimized for 6MHz, and is used in Japan. It supports a subset of the Annex A modulation types, and a roll-off of 0.13, instead of 0.15</para> <para>The following parameters are valid for DVB-C Annex A/C:</para> <itemizedlist mark='opencircle'> <listitem><para><link linkend="DTV-API-VERSION"><constant>DTV_API_VERSION</constant></link></para></listitem> @@ -792,10 +793,8 @@ typedef enum fe_hierarchy { <listitem><para><link linkend="DTV-MODULATION"><constant>DTV_MODULATION</constant></link></para></listitem> <listitem><para><link linkend="DTV-INVERSION"><constant>DTV_INVERSION</constant></link></para></listitem> <listitem><para><link linkend="DTV-SYMBOL-RATE"><constant>DTV_SYMBOL_RATE</constant></link></para></listitem> - <listitem><para><link linkend="DTV-ROLLOFF"><constant>DTV_ROLLOFF</constant></link></para></listitem> <listitem><para><link linkend="DTV-INNER-FEC"><constant>DTV_INNER_FEC</constant></link></para></listitem> </itemizedlist> - <para>The Rolloff of 0.15 (ROLLOFF_15) is assumed, as ITU-T J.83 Annex A is more common. For Annex C, rolloff should be 0.13 (ROLLOFF_13). All other values are invalid.</para> </section> <section id="dvbc-annex-b-params"> <title>DVB-C Annex B delivery system</title> diff --git a/Documentation/DocBook/media/dvb/frontend.xml b/Documentation/DocBook/media/dvb/frontend.xml index 61407ea..28d7ea5 100644 --- a/Documentation/DocBook/media/dvb/frontend.xml +++ b/Documentation/DocBook/media/dvb/frontend.xml @@ -45,8 +45,8 @@ transmission. The fontend types are given by fe_type_t type, defined as:</para> </row> <row> <entry id="FE_QAM"><constant>FE_QAM</constant></entry> - <entry>For DVB-C annex A/C standard</entry> - <entry><constant>SYS_DVBC_ANNEX_AC</constant></entry> + <entry>For DVB-C annex A standard</entry> + <entry><constant>SYS_DVBC_ANNEX_A</constant></entry> </row> <row> <entry id="FE_OFDM"><constant>FE_OFDM</constant></entry> -- 1.7.8 ^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 2/6] [media] Remove Annex A/C selection via roll-off factor 2011-12-18 0:21 ` [PATCH 1/6] [media] Update documentation to reflect DVB-C Annex A/C support Mauro Carvalho Chehab @ 2011-12-18 0:21 ` Mauro Carvalho Chehab 2011-12-18 0:21 ` [PATCH 3/6] [media] drx-k: report the supported delivery systems Mauro Carvalho Chehab 2011-12-18 0:27 ` [PATCH 1/6] [media] Update documentation to reflect DVB-C Annex A/C support Mauro Carvalho Chehab 1 sibling, 1 reply; 9+ messages in thread From: Mauro Carvalho Chehab @ 2011-12-18 0:21 UTC (permalink / raw) To: linux-media; +Cc: Mauro Carvalho Chehab Instead of using a roll-off factor, change DRX-K & friends to select the bandwidth filter and the Nyquist half roll-off via delivery system. This provides a cleaner support for Annex A/C switch. Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com> --- drivers/media/common/tuners/xc5000.c | 137 +++++++++++---------------- drivers/media/dvb/dvb-core/dvb_frontend.c | 25 ++++- drivers/media/dvb/frontends/drxk_hard.c | 15 ++- drivers/media/dvb/frontends/tda18271c2dd.c | 44 ++++----- include/linux/dvb/frontend.h | 2 - 5 files changed, 106 insertions(+), 117 deletions(-) diff --git a/drivers/media/common/tuners/xc5000.c b/drivers/media/common/tuners/xc5000.c index 97ad338..5c56d3c 100644 --- a/drivers/media/common/tuners/xc5000.c +++ b/drivers/media/common/tuners/xc5000.c @@ -629,11 +629,13 @@ static void xc_debug_dump(struct xc5000_priv *priv) } static int xc5000_set_params(struct dvb_frontend *fe, - struct dvb_frontend_parameters *params) + struct dvb_frontend_parameters *params) { + int ret, b; struct xc5000_priv *priv = fe->tuner_priv; - int ret; - u32 bw; + u32 bw = fe->dtv_property_cache.bandwidth_hz; + u32 freq = fe->dtv_property_cache.frequency; + u32 delsys = fe->dtv_property_cache.delivery_system; if (xc5000_is_firmware_loaded(fe) != XC_RESULT_SUCCESS) { if (xc_load_fw_and_init_tuner(fe) != XC_RESULT_SUCCESS) { @@ -642,104 +644,77 @@ static int xc5000_set_params(struct dvb_frontend *fe, } } - dprintk(1, "%s() frequency=%d (Hz)\n", __func__, params->frequency); + dprintk(1, "%s() frequency=%d (Hz)\n", __func__, freq); - if (fe->ops.info.type == FE_ATSC) { - dprintk(1, "%s() ATSC\n", __func__); - switch (params->u.vsb.modulation) { - case VSB_8: - case VSB_16: - dprintk(1, "%s() VSB modulation\n", __func__); - priv->rf_mode = XC_RF_MODE_AIR; - priv->freq_hz = params->frequency - 1750000; - priv->bandwidth = BANDWIDTH_6_MHZ; - priv->video_standard = DTV6; - break; - case QAM_64: - case QAM_256: - case QAM_AUTO: - dprintk(1, "%s() QAM modulation\n", __func__); - priv->rf_mode = XC_RF_MODE_CABLE; - priv->freq_hz = params->frequency - 1750000; - priv->bandwidth = BANDWIDTH_6_MHZ; - priv->video_standard = DTV6; - break; - default: - return -EINVAL; - } - } else if (fe->ops.info.type == FE_OFDM) { + switch (delsys) { + case SYS_ATSC: + dprintk(1, "%s() VSB modulation\n", __func__); + priv->rf_mode = XC_RF_MODE_AIR; + priv->freq_hz = freq - 1750000; + priv->bandwidth = BANDWIDTH_6_MHZ; + priv->video_standard = DTV6; + break; + case SYS_DVBC_ANNEX_B: + dprintk(1, "%s() QAM modulation\n", __func__); + priv->rf_mode = XC_RF_MODE_CABLE; + priv->freq_hz = freq - 1750000; + priv->bandwidth = BANDWIDTH_6_MHZ; + priv->video_standard = DTV6; + break; + case SYS_DVBT: + case SYS_DVBT2: dprintk(1, "%s() OFDM\n", __func__); - switch (params->u.ofdm.bandwidth) { - case BANDWIDTH_6_MHZ: + switch (bw) { + case 6000000: priv->bandwidth = BANDWIDTH_6_MHZ; priv->video_standard = DTV6; - priv->freq_hz = params->frequency - 1750000; + priv->freq_hz = freq - 1750000; break; - case BANDWIDTH_7_MHZ: + case 7000000: priv->bandwidth = BANDWIDTH_7_MHZ; priv->video_standard = DTV7; - priv->freq_hz = params->frequency - 2250000; + priv->freq_hz = freq - 2250000; break; - case BANDWIDTH_8_MHZ: + case 8000000: priv->bandwidth = BANDWIDTH_8_MHZ; priv->video_standard = DTV8; - priv->freq_hz = params->frequency - 2750000; + priv->freq_hz = freq - 2750000; break; default: printk(KERN_ERR "xc5000 bandwidth not set!\n"); return -EINVAL; } priv->rf_mode = XC_RF_MODE_AIR; - } else if (fe->ops.info.type == FE_QAM) { - switch (params->u.qam.modulation) { - case QAM_256: - case QAM_AUTO: - case QAM_16: - case QAM_32: - case QAM_64: - case QAM_128: - dprintk(1, "%s() QAM modulation\n", __func__); - priv->rf_mode = XC_RF_MODE_CABLE; - /* - * Using a higher bandwidth at the tuner filter may - * allow inter-carrier interference. - * So, determine the minimal channel spacing, in order - * to better adjust the tuner filter. - * According with ITU-T J.83, the bandwidth is given by: - * bw = Simbol Rate * (1 + roll_off), where the roll_off - * is equal to 0.15 for Annex A, and 0.13 for annex C - */ - if (fe->dtv_property_cache.rolloff == ROLLOFF_13) - bw = (params->u.qam.symbol_rate * 113) / 100; - else - bw = (params->u.qam.symbol_rate * 115) / 100; - if (bw <= 6000000) { - priv->bandwidth = BANDWIDTH_6_MHZ; - priv->video_standard = DTV6; - priv->freq_hz = params->frequency - 1750000; - } else if (bw <= 7000000) { - priv->bandwidth = BANDWIDTH_7_MHZ; - priv->video_standard = DTV7; - priv->freq_hz = params->frequency - 2250000; - } else { - priv->bandwidth = BANDWIDTH_8_MHZ; - priv->video_standard = DTV7_8; - priv->freq_hz = params->frequency - 2750000; - } - dprintk(1, "%s() Bandwidth %dMHz (%d)\n", __func__, - BANDWIDTH_6_MHZ ? 6: 8, bw); - break; - default: - dprintk(1, "%s() Unsupported QAM type\n", __func__); - return -EINVAL; + case SYS_DVBC_ANNEX_A: + case SYS_DVBC_ANNEX_C: + dprintk(1, "%s() QAM modulation\n", __func__); + priv->rf_mode = XC_RF_MODE_CABLE; + if (bw <= 6000000) { + priv->bandwidth = BANDWIDTH_6_MHZ; + priv->video_standard = DTV6; + priv->freq_hz = freq - 1750000; + b = 6; + } else if (bw <= 7000000) { + priv->bandwidth = BANDWIDTH_7_MHZ; + priv->video_standard = DTV7; + priv->freq_hz = freq - 2250000; + b = 7; + } else { + priv->bandwidth = BANDWIDTH_8_MHZ; + priv->video_standard = DTV7_8; + priv->freq_hz = freq - 2750000; + b = 8; } - } else { - printk(KERN_ERR "xc5000 modulation type not supported!\n"); + dprintk(1, "%s() Bandwidth %dMHz (%d)\n", __func__, + b, bw); + break; + default: + printk(KERN_ERR "xc5000: delivery system is not supported!\n"); return -EINVAL; } - dprintk(1, "%s() frequency=%d (compensated)\n", - __func__, priv->freq_hz); + dprintk(1, "%s() frequency=%d (compensated to %d)\n", + __func__, freq, priv->freq_hz); ret = xc_SetSignalSource(priv, priv->rf_mode); if (ret != XC_RESULT_SUCCESS) { diff --git a/drivers/media/dvb/dvb-core/dvb_frontend.c b/drivers/media/dvb/dvb-core/dvb_frontend.c index 821b225..66537b1 100644 --- a/drivers/media/dvb/dvb-core/dvb_frontend.c +++ b/drivers/media/dvb/dvb-core/dvb_frontend.c @@ -1011,7 +1011,7 @@ static void dtv_property_dump(struct dtv_property *tvp) static int is_legacy_delivery_system(fe_delivery_system_t s) { - if((s == SYS_UNDEFINED) || (s == SYS_DVBC_ANNEX_AC) || + if((s == SYS_UNDEFINED) || (s == SYS_DVBC_ANNEX_A) || (s == SYS_DVBC_ANNEX_B) || (s == SYS_DVBT) || (s == SYS_DVBS) || (s == SYS_ATSC)) return 1; @@ -1032,8 +1032,7 @@ static void dtv_property_cache_init(struct dvb_frontend *fe, c->delivery_system = SYS_DVBS; break; case FE_QAM: - c->delivery_system = SYS_DVBC_ANNEX_AC; - c->rolloff = ROLLOFF_15; /* implied for Annex A */ + c->delivery_system = SYS_DVBC_ANNEX_A; break; case FE_OFDM: c->delivery_system = SYS_DVBT; @@ -1144,9 +1143,10 @@ static void dtv_property_legacy_params_sync(struct dvb_frontend *fe) */ static void dtv_property_adv_params_sync(struct dvb_frontend *fe) { - const struct dtv_frontend_properties *c = &fe->dtv_property_cache; + struct dtv_frontend_properties *c = &fe->dtv_property_cache; struct dvb_frontend_private *fepriv = fe->frontend_priv; struct dvb_frontend_parameters *p = &fepriv->parameters_in; + u32 rolloff = 0; p->frequency = c->frequency; p->inversion = c->inversion; @@ -1178,6 +1178,23 @@ static void dtv_property_adv_params_sync(struct dvb_frontend *fe) else p->u.ofdm.bandwidth = BANDWIDTH_AUTO; } + + /* + * On DVB-C, the bandwidth is a function of roll-off and symbol rate. + * The bandwidth is required for DVB-C tuners, in order to avoid + * inter-channel noise. Instead of estimating the minimal required + * bandwidth on every single driver, calculates it here and fills + * it at the cache bandwidth parameter. + * While not officially supported, a side effect of handling it at + * the cache level is that a program could retrieve the bandwidth + * via DTV_BANDWIDTH_HZ, wich may be useful for test programs. + */ + if (c->delivery_system == SYS_DVBC_ANNEX_A) + rolloff = 115; + if (c->delivery_system == SYS_DVBC_ANNEX_C) + rolloff = 113; + if (rolloff) + c->bandwidth_hz = (c->symbol_rate * rolloff) / 100; } static void dtv_property_cache_submit(struct dvb_frontend *fe) diff --git a/drivers/media/dvb/frontends/drxk_hard.c b/drivers/media/dvb/frontends/drxk_hard.c index 038e470..a2c8196 100644 --- a/drivers/media/dvb/frontends/drxk_hard.c +++ b/drivers/media/dvb/frontends/drxk_hard.c @@ -6215,6 +6215,7 @@ static int drxk_set_parameters(struct dvb_frontend *fe, struct dvb_frontend_parameters *p) { struct drxk_state *state = fe->demodulator_priv; + u32 delsys = fe->dtv_property_cache.delivery_system; u32 IF; dprintk(1, "\n"); @@ -6225,11 +6226,15 @@ static int drxk_set_parameters(struct dvb_frontend *fe, return -EINVAL; } - if (fe->ops.info.type == FE_QAM) { - if (fe->dtv_property_cache.rolloff == ROLLOFF_13) - state->m_itut_annex_c = true; - else - state->m_itut_annex_c = false; + switch (delsys) { + case SYS_DVBC_ANNEX_A: + state->m_itut_annex_c = false; + break; + case SYS_DVBC_ANNEX_C: + state->m_itut_annex_c = true; + break; + default: + return -EINVAL; } if (fe->ops.i2c_gate_ctrl) diff --git a/drivers/media/dvb/frontends/tda18271c2dd.c b/drivers/media/dvb/frontends/tda18271c2dd.c index b66ca29..0f8e962 100644 --- a/drivers/media/dvb/frontends/tda18271c2dd.c +++ b/drivers/media/dvb/frontends/tda18271c2dd.c @@ -1130,50 +1130,44 @@ static int set_params(struct dvb_frontend *fe, struct tda_state *state = fe->tuner_priv; int status = 0; int Standard; - u32 bw; + u32 bw = fe->dtv_property_cache.bandwidth_hz; + u32 delsys = fe->dtv_property_cache.delivery_system; - state->m_Frequency = params->frequency; + state->m_Frequency = fe->dtv_property_cache.frequency; - if (fe->ops.info.type == FE_OFDM) - switch (params->u.ofdm.bandwidth) { - case BANDWIDTH_6_MHZ: + switch (delsys) { + case SYS_DVBT: + case SYS_DVBT2: + switch (bw) { + case 6000000: Standard = HF_DVBT_6MHZ; break; - case BANDWIDTH_7_MHZ: + case 7000000: Standard = HF_DVBT_7MHZ; break; - default: - case BANDWIDTH_8_MHZ: + case 8000000: Standard = HF_DVBT_8MHZ; break; + default: + return -EINVAL; } - else if (fe->ops.info.type == FE_QAM) { - /* - * Using a higher bandwidth at the tuner filter may - * allow inter-carrier interference. - * So, determine the minimal channel spacing, in order - * to better adjust the tuner filter. - * According with ITU-T J.83, the bandwidth is given by: - * bw = Simbol Rate * (1 + roll_off), where the roll_off - * is equal to 0.15 for Annex A, and 0.13 for annex C - */ - if (fe->dtv_property_cache.rolloff == ROLLOFF_13) - bw = (params->u.qam.symbol_rate * 113) / 100; - else - bw = (params->u.qam.symbol_rate * 115) / 100; + case SYS_DVBC_ANNEX_A: + case SYS_DVBC_ANNEX_C: if (bw <= 6000000) Standard = HF_DVBC_6MHZ; else if (bw <= 7000000) Standard = HF_DVBC_7MHZ; else Standard = HF_DVBC_8MHZ; - } else + default: return -EINVAL; + } do { - status = RFTrackingFiltersCorrection(state, params->frequency); + status = RFTrackingFiltersCorrection(state, state->m_Frequency); if (status < 0) break; - status = ChannelConfiguration(state, params->frequency, Standard); + status = ChannelConfiguration(state, state->m_Frequency, + Standard); if (status < 0) break; diff --git a/include/linux/dvb/frontend.h b/include/linux/dvb/frontend.h index b2a939f8..a3c7623 100644 --- a/include/linux/dvb/frontend.h +++ b/include/linux/dvb/frontend.h @@ -331,8 +331,6 @@ typedef enum fe_rolloff { ROLLOFF_20, ROLLOFF_25, ROLLOFF_AUTO, - ROLLOFF_15, /* DVB-C Annex A */ - ROLLOFF_13, /* DVB-C Annex C */ } fe_rolloff_t; typedef enum fe_delivery_system { -- 1.7.8 ^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 3/6] [media] drx-k: report the supported delivery systems 2011-12-18 0:21 ` [PATCH 2/6] [media] Remove Annex A/C selection via roll-off factor Mauro Carvalho Chehab @ 2011-12-18 0:21 ` Mauro Carvalho Chehab 2011-12-18 0:21 ` [PATCH 4/6] [media] tda10023: Don't use a magic numbers for QAM modulation Mauro Carvalho Chehab 0 siblings, 1 reply; 9+ messages in thread From: Mauro Carvalho Chehab @ 2011-12-18 0:21 UTC (permalink / raw) To: linux-media; +Cc: Mauro Carvalho Chehab Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com> --- drivers/media/dvb/frontends/drxk_hard.c | 28 ++++++++++++++++++++++++++++ 1 files changed, 28 insertions(+), 0 deletions(-) diff --git a/drivers/media/dvb/frontends/drxk_hard.c b/drivers/media/dvb/frontends/drxk_hard.c index a2c8196..d795898 100644 --- a/drivers/media/dvb/frontends/drxk_hard.c +++ b/drivers/media/dvb/frontends/drxk_hard.c @@ -6364,6 +6364,32 @@ static int drxk_t_get_frontend(struct dvb_frontend *fe, return 0; } +static int drxk_c_get_property(struct dvb_frontend *fe, struct dtv_property *p) +{ + switch (p->cmd) { + case DTV_ENUM_DELSYS: + p->u.buffer.data[0] = SYS_DVBC_ANNEX_A; + p->u.buffer.data[1] = SYS_DVBC_ANNEX_C; + p->u.buffer.len = 2; + break; + default: + break; + } + return 0; +} +static int drxk_t_get_property(struct dvb_frontend *fe, struct dtv_property *p) +{ + switch (p->cmd) { + case DTV_ENUM_DELSYS: + p->u.buffer.data[0] = SYS_DVBT; + p->u.buffer.len = 1; + break; + default: + break; + } + return 0; +} + static struct dvb_frontend_ops drxk_c_ops = { .info = { .name = "DRXK DVB-C", @@ -6382,6 +6408,7 @@ static struct dvb_frontend_ops drxk_c_ops = { .set_frontend = drxk_set_parameters, .get_frontend = drxk_c_get_frontend, + .get_property = drxk_c_get_property, .get_tune_settings = drxk_c_get_tune_settings, .read_status = drxk_read_status, @@ -6414,6 +6441,7 @@ static struct dvb_frontend_ops drxk_t_ops = { .set_frontend = drxk_set_parameters, .get_frontend = drxk_t_get_frontend, + .get_property = drxk_t_get_property, .read_status = drxk_read_status, .read_ber = drxk_read_ber, -- 1.7.8 ^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 4/6] [media] tda10023: Don't use a magic numbers for QAM modulation 2011-12-18 0:21 ` [PATCH 3/6] [media] drx-k: report the supported delivery systems Mauro Carvalho Chehab @ 2011-12-18 0:21 ` Mauro Carvalho Chehab 2011-12-18 0:21 ` [PATCH 5/6] [media] tda10023: add support for DVB-C Annex C Mauro Carvalho Chehab 0 siblings, 1 reply; 9+ messages in thread From: Mauro Carvalho Chehab @ 2011-12-18 0:21 UTC (permalink / raw) To: linux-media; +Cc: Mauro Carvalho Chehab Convert the existing data struct to use the QAM modulation macros, instead of hardcoding it. Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com> --- drivers/media/dvb/frontends/tda10023.c | 34 ++++++++++++++++--------------- 1 files changed, 18 insertions(+), 16 deletions(-) diff --git a/drivers/media/dvb/frontends/tda10023.c b/drivers/media/dvb/frontends/tda10023.c index a3c34ee..dccc74b 100644 --- a/drivers/media/dvb/frontends/tda10023.c +++ b/drivers/media/dvb/frontends/tda10023.c @@ -303,19 +303,21 @@ static int tda10023_set_parameters (struct dvb_frontend *fe, { struct tda10023_state* state = fe->demodulator_priv; - static int qamvals[6][6] = { - // QAM LOCKTHR MSETH AREF AGCREFNYQ ERAGCNYQ_THD - { (5<<2), 0x78, 0x8c, 0x96, 0x78, 0x4c }, // 4 QAM - { (0<<2), 0x87, 0xa2, 0x91, 0x8c, 0x57 }, // 16 QAM - { (1<<2), 0x64, 0x74, 0x96, 0x8c, 0x57 }, // 32 QAM - { (2<<2), 0x46, 0x43, 0x6a, 0x6a, 0x44 }, // 64 QAM - { (3<<2), 0x36, 0x34, 0x7e, 0x78, 0x4c }, // 128 QAM - { (4<<2), 0x26, 0x23, 0x6c, 0x5c, 0x3c }, // 256 QAM + struct qam_params { + u8 qam, lockthr, mseth, aref, agcrefnyq, eragnyq_thd; + } static const qam_params[] = { + /* Modulation QAM LOCKTHR MSETH AREF AGCREFNYQ ERAGCNYQ_THD */ + [QPSK] = { (5<<2), 0x78, 0x8c, 0x96, 0x78, 0x4c }, + [QAM_16] = { (0<<2), 0x87, 0xa2, 0x91, 0x8c, 0x57 }, + [QAM_32] = { (1<<2), 0x64, 0x74, 0x96, 0x8c, 0x57 }, + [QAM_64] = { (2<<2), 0x46, 0x43, 0x6a, 0x6a, 0x44 }, + [QAM_128] = { (3<<2), 0x36, 0x34, 0x7e, 0x78, 0x4c }, + [QAM_256] = { (4<<2), 0x26, 0x23, 0x6c, 0x5c, 0x3c }, }; - int qam = p->u.qam.modulation; + unsigned qam = p->u.qam.modulation; - if (qam < 0 || qam > 5) + if (qam >= ARRAY_SIZE(qam_params)) return -EINVAL; if (fe->ops.tuner_ops.set_params) { @@ -324,16 +326,16 @@ static int tda10023_set_parameters (struct dvb_frontend *fe, } tda10023_set_symbolrate (state, p->u.qam.symbol_rate); - tda10023_writereg (state, 0x05, qamvals[qam][1]); - tda10023_writereg (state, 0x08, qamvals[qam][2]); - tda10023_writereg (state, 0x09, qamvals[qam][3]); - tda10023_writereg (state, 0xb4, qamvals[qam][4]); - tda10023_writereg (state, 0xb6, qamvals[qam][5]); + tda10023_writereg (state, 0x05, qam_params[qam].lockthr); + tda10023_writereg (state, 0x08, qam_params[qam].mseth); + tda10023_writereg (state, 0x09, qam_params[qam].aref); + tda10023_writereg (state, 0xb4, qam_params[qam].agcrefnyq); + tda10023_writereg (state, 0xb6, qam_params[qam].eragnyq_thd); // tda10023_writereg (state, 0x04, (p->inversion?0x12:0x32)); // tda10023_writebit (state, 0x04, 0x60, (p->inversion?0:0x20)); tda10023_writebit (state, 0x04, 0x40, 0x40); - tda10023_setup_reg0 (state, qamvals[qam][0]); + tda10023_setup_reg0 (state, qam_params[qam].qam); return 0; } -- 1.7.8 ^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 5/6] [media] tda10023: add support for DVB-C Annex C 2011-12-18 0:21 ` [PATCH 4/6] [media] tda10023: Don't use a magic numbers for QAM modulation Mauro Carvalho Chehab @ 2011-12-18 0:21 ` Mauro Carvalho Chehab 2011-12-18 0:21 ` [PATCH 6/6] [media] tda10021: Add " Mauro Carvalho Chehab 0 siblings, 1 reply; 9+ messages in thread From: Mauro Carvalho Chehab @ 2011-12-18 0:21 UTC (permalink / raw) To: linux-media; +Cc: Mauro Carvalho Chehab Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com> --- drivers/media/dvb/frontends/tda10023.c | 45 +++++++++++++++++++++++++++---- 1 files changed, 39 insertions(+), 6 deletions(-) diff --git a/drivers/media/dvb/frontends/tda10023.c b/drivers/media/dvb/frontends/tda10023.c index dccc74b..f5f0e73 100644 --- a/drivers/media/dvb/frontends/tda10023.c +++ b/drivers/media/dvb/frontends/tda10023.c @@ -301,8 +301,11 @@ static int tda10023_init (struct dvb_frontend *fe) static int tda10023_set_parameters (struct dvb_frontend *fe, struct dvb_frontend_parameters *p) { + struct dtv_frontend_properties *c = &fe->dtv_property_cache; + u32 delsys = c->delivery_system; + unsigned qam = c->modulation; + bool is_annex_c; struct tda10023_state* state = fe->demodulator_priv; - struct qam_params { u8 qam, lockthr, mseth, aref, agcrefnyq, eragnyq_thd; } static const qam_params[] = { @@ -315,7 +318,16 @@ static int tda10023_set_parameters (struct dvb_frontend *fe, [QAM_256] = { (4<<2), 0x26, 0x23, 0x6c, 0x5c, 0x3c }, }; - unsigned qam = p->u.qam.modulation; + switch (delsys) { + case SYS_DVBC_ANNEX_A: + is_annex_c = false; + break; + case SYS_DVBC_ANNEX_C: + is_annex_c = true; + break; + default: + return -EINVAL; + } if (qam >= ARRAY_SIZE(qam_params)) return -EINVAL; @@ -325,21 +337,42 @@ static int tda10023_set_parameters (struct dvb_frontend *fe, if (fe->ops.i2c_gate_ctrl) fe->ops.i2c_gate_ctrl(fe, 0); } - tda10023_set_symbolrate (state, p->u.qam.symbol_rate); + tda10023_set_symbolrate (state, c->symbol_rate); tda10023_writereg (state, 0x05, qam_params[qam].lockthr); tda10023_writereg (state, 0x08, qam_params[qam].mseth); tda10023_writereg (state, 0x09, qam_params[qam].aref); tda10023_writereg (state, 0xb4, qam_params[qam].agcrefnyq); tda10023_writereg (state, 0xb6, qam_params[qam].eragnyq_thd); -// tda10023_writereg (state, 0x04, (p->inversion?0x12:0x32)); -// tda10023_writebit (state, 0x04, 0x60, (p->inversion?0:0x20)); +// tda10023_writereg (state, 0x04, (c->inversion?0x12:0x32)); +// tda10023_writebit (state, 0x04, 0x60, (c->inversion?0:0x20)); tda10023_writebit (state, 0x04, 0x40, 0x40); + + if (is_annex_c) + tda10023_writebit (state, 0x3d, 0xfc, 0x03); + else + tda10023_writebit (state, 0x3d, 0xfc, 0x02); + tda10023_setup_reg0 (state, qam_params[qam].qam); return 0; } +static int tda10023_get_property(struct dvb_frontend *fe, + struct dtv_property *p) +{ + switch (p->cmd) { + case DTV_ENUM_DELSYS: + p->u.buffer.data[0] = SYS_DVBC_ANNEX_A; + p->u.buffer.data[1] = SYS_DVBC_ANNEX_C; + p->u.buffer.len = 2; + break; + default: + break; + } + return 0; +} + static int tda10023_read_status(struct dvb_frontend* fe, fe_status_t* status) { struct tda10023_state* state = fe->demodulator_priv; @@ -559,7 +592,7 @@ static struct dvb_frontend_ops tda10023_ops = { .set_frontend = tda10023_set_parameters, .get_frontend = tda10023_get_frontend, - + .get_property = tda10023_get_property, .read_status = tda10023_read_status, .read_ber = tda10023_read_ber, .read_signal_strength = tda10023_read_signal_strength, -- 1.7.8 ^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 6/6] [media] tda10021: Add support for DVB-C Annex C 2011-12-18 0:21 ` [PATCH 5/6] [media] tda10023: add support for DVB-C Annex C Mauro Carvalho Chehab @ 2011-12-18 0:21 ` Mauro Carvalho Chehab 0 siblings, 0 replies; 9+ messages in thread From: Mauro Carvalho Chehab @ 2011-12-18 0:21 UTC (permalink / raw) To: linux-media; +Cc: Mauro Carvalho Chehab While tda10021 supports both DVB-C Annex A and C, it is currently hard-coded to Annex A. Add support for Annex C and re-work the code in order to report the delivery systems, thans to Andreas, that passed us the register settings for the Roll-off factor. While here, re-work the per-modulation register settings, in order to avoid the magic test to check if the QAM type is supported. Thanks-to: Andreas Oberriter <obi@linuxtv.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com> --- drivers/media/dvb/frontends/tda10021.c | 83 +++++++++++++++++++++++-------- 1 files changed, 61 insertions(+), 22 deletions(-) diff --git a/drivers/media/dvb/frontends/tda10021.c b/drivers/media/dvb/frontends/tda10021.c index 6ca533e..3d4000d 100644 --- a/drivers/media/dvb/frontends/tda10021.c +++ b/drivers/media/dvb/frontends/tda10021.c @@ -227,26 +227,39 @@ static int tda10021_init (struct dvb_frontend *fe) static int tda10021_set_parameters (struct dvb_frontend *fe, struct dvb_frontend_parameters *p) { + struct dtv_frontend_properties *c = &fe->dtv_property_cache; + u32 delsys = c->delivery_system; + unsigned qam = c->modulation; + bool is_annex_c; + u32 reg0x3d; struct tda10021_state* state = fe->demodulator_priv; + struct qam_params { + u8 conf, agcref, lthr, mseth, aref; + } qam_params[] = { + /* Modulation Conf AGCref LTHR MSETH AREF */ + [QPSK] = { 0x14, 0x78, 0x78, 0x8c, 0x96 }, + [QAM_16] = { 0x00, 0x8c, 0x87, 0xa2, 0x91 }, + [QAM_32] = { 0x04, 0x8c, 0x64, 0x74, 0x96 }, + [QAM_64] = { 0x08, 0x6a, 0x46, 0x43, 0x6a }, + [QAM_128] = { 0x0c, 0x78, 0x36, 0x34, 0x7e }, + [QAM_256] = { 0x10, 0x5c, 0x26, 0x23, 0x6b }, + }; + + switch (delsys) { + case SYS_DVBC_ANNEX_A: + is_annex_c = false; + break; + case SYS_DVBC_ANNEX_C: + is_annex_c = true; + break; + default: + return -EINVAL; + } - //table for QAM4-QAM256 ready QAM4 QAM16 QAM32 QAM64 QAM128 QAM256 - //CONF - static const u8 reg0x00 [] = { 0x14, 0x00, 0x04, 0x08, 0x0c, 0x10 }; - //AGCREF value - static const u8 reg0x01 [] = { 0x78, 0x8c, 0x8c, 0x6a, 0x78, 0x5c }; - //LTHR value - static const u8 reg0x05 [] = { 0x78, 0x87, 0x64, 0x46, 0x36, 0x26 }; - //MSETH - static const u8 reg0x08 [] = { 0x8c, 0xa2, 0x74, 0x43, 0x34, 0x23 }; - //AREF - static const u8 reg0x09 [] = { 0x96, 0x91, 0x96, 0x6a, 0x7e, 0x6b }; - - int qam = p->u.qam.modulation; - - if (qam < 0 || qam > 5) + if (qam >= ARRAY_SIZE(qam_params)) return -EINVAL; - if (p->inversion != INVERSION_ON && p->inversion != INVERSION_OFF) + if (c->inversion != INVERSION_ON && c->inversion != INVERSION_OFF) return -EINVAL; //printk("tda10021: set frequency to %d qam=%d symrate=%d\n", p->frequency,qam,p->u.qam.symbol_rate); @@ -256,15 +269,25 @@ static int tda10021_set_parameters (struct dvb_frontend *fe, if (fe->ops.i2c_gate_ctrl) fe->ops.i2c_gate_ctrl(fe, 0); } - tda10021_set_symbolrate (state, p->u.qam.symbol_rate); + tda10021_set_symbolrate (state, c->symbol_rate); _tda10021_writereg (state, 0x34, state->pwm); - _tda10021_writereg (state, 0x01, reg0x01[qam]); - _tda10021_writereg (state, 0x05, reg0x05[qam]); - _tda10021_writereg (state, 0x08, reg0x08[qam]); - _tda10021_writereg (state, 0x09, reg0x09[qam]); + _tda10021_writereg (state, 0x01, qam_params[qam].agcref); + _tda10021_writereg (state, 0x05, qam_params[qam].lthr); + _tda10021_writereg (state, 0x08, qam_params[qam].mseth); + _tda10021_writereg (state, 0x09, qam_params[qam].aref); + tda10021_setup_reg0 (state, qam_params[qam].conf, p->inversion); + + /* + * Bit 0 == 0 means roll-off = 0.15 (Annex A) + * == 1 means roll-off = 0.13 (Annex C) + */ + reg0x3d = tda10021_readreg (state, 0x3d); + if (is_annex_c) + _tda10021_writereg (state, 0x3d, 0x01 | reg0x3d); + else + _tda10021_writereg (state, 0x3d, 0xfe & reg0x3d); - tda10021_setup_reg0 (state, reg0x00[qam], p->inversion); return 0; } @@ -443,6 +466,21 @@ error: return NULL; } +static int tda10021_get_property(struct dvb_frontend *fe, + struct dtv_property *p) +{ + switch (p->cmd) { + case DTV_ENUM_DELSYS: + p->u.buffer.data[0] = SYS_DVBC_ANNEX_A; + p->u.buffer.data[1] = SYS_DVBC_ANNEX_C; + p->u.buffer.len = 2; + break; + default: + break; + } + return 0; +} + static struct dvb_frontend_ops tda10021_ops = { .info = { @@ -471,6 +509,7 @@ static struct dvb_frontend_ops tda10021_ops = { .set_frontend = tda10021_set_parameters, .get_frontend = tda10021_get_frontend, + .get_property = tda10021_get_property, .read_status = tda10021_read_status, .read_ber = tda10021_read_ber, -- 1.7.8 ^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH 1/6] [media] Update documentation to reflect DVB-C Annex A/C support 2011-12-18 0:21 ` [PATCH 1/6] [media] Update documentation to reflect DVB-C Annex A/C support Mauro Carvalho Chehab 2011-12-18 0:21 ` [PATCH 2/6] [media] Remove Annex A/C selection via roll-off factor Mauro Carvalho Chehab @ 2011-12-18 0:27 ` Mauro Carvalho Chehab 2011-12-18 0:39 ` Mauro Carvalho Chehab 1 sibling, 1 reply; 9+ messages in thread From: Mauro Carvalho Chehab @ 2011-12-18 0:27 UTC (permalink / raw) To: Mauro Carvalho Chehab, Linux Media Mailing List Em 17-12-2011 22:21, Mauro Carvalho Chehab escreveu: > Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com> Gah, not sure what happened here... git send-email did the wrong thing with this patch and a few others... This patch should have a description, a from: Manu Abraham, and his SOB! I'll see what's wrong and I'll resend a new version. Please discard this one! > --- > Documentation/DocBook/media/dvb/dvbproperty.xml | 11 +++++------ > Documentation/DocBook/media/dvb/frontend.xml | 4 ++-- > 2 files changed, 7 insertions(+), 8 deletions(-) > > diff --git a/Documentation/DocBook/media/dvb/dvbproperty.xml b/Documentation/DocBook/media/dvb/dvbproperty.xml > index b812e31..ffee1fb 100644 > --- a/Documentation/DocBook/media/dvb/dvbproperty.xml > +++ b/Documentation/DocBook/media/dvb/dvbproperty.xml > @@ -311,8 +311,6 @@ typedef enum fe_rolloff { > ROLLOFF_20, > ROLLOFF_25, > ROLLOFF_AUTO, > - ROLLOFF_15, /* DVB-C Annex A */ > - ROLLOFF_13, /* DVB-C Annex C */ > } fe_rolloff_t; > </programlisting> > </section> > @@ -336,9 +334,10 @@ typedef enum fe_rolloff { > <title>fe_delivery_system type</title> > <para>Possible values: </para> > <programlisting> > + > typedef enum fe_delivery_system { > SYS_UNDEFINED, > - SYS_DVBC_ANNEX_AC, > + SYS_DVBC_ANNEX_A, > SYS_DVBC_ANNEX_B, > SYS_DVBT, > SYS_DSS, > @@ -355,6 +354,7 @@ typedef enum fe_delivery_system { > SYS_DAB, > SYS_DVBT2, > SYS_TURBO, > + SYS_DVBC_ANNEX_C, > } fe_delivery_system_t; > </programlisting> > </section> > @@ -781,7 +781,8 @@ typedef enum fe_hierarchy { > <title>Properties used on cable delivery systems</title> > <section id="dvbc-params"> > <title>DVB-C delivery system</title> > - <para>The DVB-C Annex-A/C is the widely used cable standard. Transmission uses QAM modulation.</para> > + <para>The DVB-C Annex-A is the widely used cable standard. Transmission uses QAM modulation.</para> > + <para>The DVB-C Annex-C is optimized for 6MHz, and is used in Japan. It supports a subset of the Annex A modulation types, and a roll-off of 0.13, instead of 0.15</para> > <para>The following parameters are valid for DVB-C Annex A/C:</para> > <itemizedlist mark='opencircle'> > <listitem><para><link linkend="DTV-API-VERSION"><constant>DTV_API_VERSION</constant></link></para></listitem> > @@ -792,10 +793,8 @@ typedef enum fe_hierarchy { > <listitem><para><link linkend="DTV-MODULATION"><constant>DTV_MODULATION</constant></link></para></listitem> > <listitem><para><link linkend="DTV-INVERSION"><constant>DTV_INVERSION</constant></link></para></listitem> > <listitem><para><link linkend="DTV-SYMBOL-RATE"><constant>DTV_SYMBOL_RATE</constant></link></para></listitem> > - <listitem><para><link linkend="DTV-ROLLOFF"><constant>DTV_ROLLOFF</constant></link></para></listitem> > <listitem><para><link linkend="DTV-INNER-FEC"><constant>DTV_INNER_FEC</constant></link></para></listitem> > </itemizedlist> > - <para>The Rolloff of 0.15 (ROLLOFF_15) is assumed, as ITU-T J.83 Annex A is more common. For Annex C, rolloff should be 0.13 (ROLLOFF_13). All other values are invalid.</para> > </section> > <section id="dvbc-annex-b-params"> > <title>DVB-C Annex B delivery system</title> > diff --git a/Documentation/DocBook/media/dvb/frontend.xml b/Documentation/DocBook/media/dvb/frontend.xml > index 61407ea..28d7ea5 100644 > --- a/Documentation/DocBook/media/dvb/frontend.xml > +++ b/Documentation/DocBook/media/dvb/frontend.xml > @@ -45,8 +45,8 @@ transmission. The fontend types are given by fe_type_t type, defined as:</para> > </row> > <row> > <entry id="FE_QAM"><constant>FE_QAM</constant></entry> > - <entry>For DVB-C annex A/C standard</entry> > - <entry><constant>SYS_DVBC_ANNEX_AC</constant></entry> > + <entry>For DVB-C annex A standard</entry> > + <entry><constant>SYS_DVBC_ANNEX_A</constant></entry> > </row> > <row> > <entry id="FE_OFDM"><constant>FE_OFDM</constant></entry> ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 1/6] [media] Update documentation to reflect DVB-C Annex A/C support 2011-12-18 0:27 ` [PATCH 1/6] [media] Update documentation to reflect DVB-C Annex A/C support Mauro Carvalho Chehab @ 2011-12-18 0:39 ` Mauro Carvalho Chehab 0 siblings, 0 replies; 9+ messages in thread From: Mauro Carvalho Chehab @ 2011-12-18 0:39 UTC (permalink / raw) To: Linux Media Mailing List Em 17-12-2011 22:27, Mauro Carvalho Chehab escreveu: > Em 17-12-2011 22:21, Mauro Carvalho Chehab escreveu: >> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com> > > > Gah, not sure what happened here... git send-email did the wrong > thing with this patch and a few others... > > This patch should have a description, a from: Manu Abraham, and his SOB! > > I'll see what's wrong and I'll resend a new version. Please discard this one! > I just missed to include the first patch for this series (basically, Manu's patch series v4 - patch 6/10). Re-sent the entire thing. Regards, Mauro. ^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2011-12-18 0:39 UTC | newest] Thread overview: 9+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2011-12-18 0:21 [PATCH 0/6] Change support for Annex A/C Mauro Carvalho Chehab 2011-12-18 0:21 ` [PATCH 1/6] [media] Update documentation to reflect DVB-C Annex A/C support Mauro Carvalho Chehab 2011-12-18 0:21 ` [PATCH 2/6] [media] Remove Annex A/C selection via roll-off factor Mauro Carvalho Chehab 2011-12-18 0:21 ` [PATCH 3/6] [media] drx-k: report the supported delivery systems Mauro Carvalho Chehab 2011-12-18 0:21 ` [PATCH 4/6] [media] tda10023: Don't use a magic numbers for QAM modulation Mauro Carvalho Chehab 2011-12-18 0:21 ` [PATCH 5/6] [media] tda10023: add support for DVB-C Annex C Mauro Carvalho Chehab 2011-12-18 0:21 ` [PATCH 6/6] [media] tda10021: Add " Mauro Carvalho Chehab 2011-12-18 0:27 ` [PATCH 1/6] [media] Update documentation to reflect DVB-C Annex A/C support Mauro Carvalho Chehab 2011-12-18 0:39 ` Mauro Carvalho Chehab
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox