add DTMB support for DVB API
RFC PATCH v2 1/1 add DTMB support for DVB API
Version 2. I have made some changes from feedback got and what I myself found better. I will add documentation later after API issues are resolved.
Thanks to Andreas, Patrick and Mauro.
--- drivers/media/dvb/dvb-core/dvb_frontend.c | 14 +++++++++++--- drivers/media/dvb/dvb-core/dvb_frontend.h | 2 ++ drivers/media/dvb/frontends/atbm8830.c | 2 +- drivers/media/dvb/frontends/lgs8gl5.c | 2 +- drivers/media/dvb/frontends/lgs8gxx.c | 2 +- include/linux/dvb/frontend.h | 22 +++++++++++++++++++--- include/linux/dvb/version.h | 2 +- 7 files changed, 36 insertions(+), 10 deletions(-)
drivers/media/dvb/dvb-core/dvb_frontend.c +11 -3
@@ -177,7 +177,7 @@ static enum dvbv3_emulation_type dvbv3_type(u32 delivery_system)case SYS_DVBT :case SYS_DVBT2 :case SYS_ISDBT : -case SYS_DMBTH : +case SYS_DTMB :return DVBV3_OFDM ;case SYS_ATSC :case SYS_DVBC_ANNEX_B :
@@ -989,6 +989,7 @@ static struct dtv_cmds_h dtv_cmds[DTV_MAX_COMMAND + 1] = {_DTV_CMD (DTV_CODE_RATE_LP ,1 ,0 ),_DTV_CMD (DTV_GUARD_INTERVAL ,1 ,0 ),_DTV_CMD (DTV_TRANSMISSION_MODE ,1 ,0 ), +_DTV_CMD (DTV_INTERLEAVING ,1 ,0 ),_DTV_CMD (DTV_ISDBT_PARTIAL_RECEPTION ,1 ,0 ), _DTV_CMD(DTV_ISDBT_SOUND_BROADCASTING, 1, 0),
@@ -1039,6 +1040,7 @@ static struct dtv_cmds_h dtv_cmds[DTV_MAX_COMMAND + 1] = {_DTV_CMD (DTV_GUARD_INTERVAL ,0 ,0 ),_DTV_CMD (DTV_TRANSMISSION_MODE ,0 ,0 ),_DTV_CMD (DTV_HIERARCHY ,0 ,0 ), +_DTV_CMD (DTV_INTERLEAVING ,0 ,0 ), _DTV_CMD(DTV_ENUM_DELSYS, 0, 0), };
@@ -1316,6 +1318,9 @@ static int dtv_property_process_get(struct dvb_frontend *fe,case DTV_HIERARCHY : tvp->u.data = c->hierarchy;break ; +case DTV_INTERLEAVING : + tvp->u.data = c->interleaving; +break ;/* ISDB-T Support here */ case DTV_ISDBT_PARTIAL_RECEPTION :
@@ -1503,7 +1508,7 @@ static int set_delivery_system(struct dvb_frontend *fe, u32 desired_system)* The DVBv3 or DVBv5 call is requesting a different system. So, * emulation is needed. * -* Emulate newer delivery systems like ISDBT, DVBT and DMBTH +* Emulate newer delivery systems like ISDBT, DVBT and DTMB * for older DVBv5 applications. The emulation will try to use * the auto mode for most things, and will assume that the desired * delivery system is the last one at the ops.delsys[] array
@@ -1625,6 +1630,9 @@ static int dtv_property_process_set(struct dvb_frontend *fe,case DTV_HIERARCHY : c->hierarchy = tvp->u.data;break ; +case DTV_INTERLEAVING : + c->interleaving = tvp->u.data; +break ;/* ISDB-T Support here */ case DTV_ISDBT_PARTIAL_RECEPTION :
@@ -1896,7 +1904,7 @@ static int dtv_set_frontend(struct dvb_frontend *fe)case SYS_DVBT :case SYS_DVBT2 :case SYS_ISDBT : -case SYS_DMBTH : +case SYS_DTMB : fepriv->min_delay =HZ /20 ; fepriv->step_size = fe->ops.info.frequency_stepsize *2 ; fepriv->max_drift = (fe->ops.info.frequency_stepsize *2 ) +1 ;
drivers/media/dvb/dvb-core/dvb_frontend.h +2 -0
@@ -353,6 +353,8 @@ struct dtv_frontend_properties {fe_delivery_system_t delivery_system; +fe_interleaving_t interleaving; +/* ISDB-T specifics */ u8 isdbt_partial_reception;u8 isdbt_sb_mode;
drivers/media/dvb/frontends/atbm8830.c +1 -1
@@ -428,7 +428,7 @@ static int atbm8830_i2c_gate_ctrl(struct dvb_frontend *fe, int enable) }static struct dvb_frontend_ops atbm8830_ops = { - .delsys = {SYS_DMBTH }, + .delsys = {SYS_DTMB }, .info = { .name ="AltoBeam ATBM8830/8831 DMB-TH" , .frequency_min =474000000 ,
drivers/media/dvb/frontends/lgs8gl5.c +1 -1
@@ -412,7 +412,7 @@ EXPORT_SYMBOL(lgs8gl5_attach);static struct dvb_frontend_ops lgs8gl5_ops = { - .delsys = {SYS_DMBTH }, + .delsys = {SYS_DTMB }, .info = { .name ="Legend Silicon LGS-8GL5 DMB-TH" , .frequency_min =474000000 ,
drivers/media/dvb/frontends/lgs8gxx.c +1 -1
@@ -994,7 +994,7 @@ static int lgs8gxx_i2c_gate_ctrl(struct dvb_frontend *fe, int enable) }static struct dvb_frontend_ops lgs8gxx_ops = { - .delsys = {SYS_DMBTH }, + .delsys = {SYS_DTMB }, .info = { .name ="Legend Silicon LGS8913/LGS8GXX DMB-TH" , .frequency_min =474000000 ,
include/linux/dvb/frontend.h +19 -3
@@ -152,6 +152,9 @@ typedef enum fe_code_rate {FEC_AUTO ,FEC_3_5 ,FEC_9_10 , +FEC_04 , +FEC_06 , +FEC_08 , } fe_code_rate_t;
@@ -169,6 +172,7 @@ typedef enum fe_modulation {APSK_16 ,APSK_32 ,DQPSK , +QAM_4_NR , } fe_modulation_t; typedef enum fe_transmit_mode {
@@ -179,6 +183,8 @@ typedef enum fe_transmit_mode {TRANSMISSION_MODE_1K ,TRANSMISSION_MODE_16K ,TRANSMISSION_MODE_32K , +TRANSMISSION_MODE_C1 , +TRANSMISSION_MODE_C3780 , } fe_transmit_mode_t;#if defined(__DVB_CORE__) || !defined (__KERNEL__)
@@ -202,6 +208,9 @@ typedef enum fe_guard_interval {GUARD_INTERVAL_1_128 ,GUARD_INTERVAL_19_128 ,GUARD_INTERVAL_19_256 , +GUARD_INTERVAL_PN420 , +GUARD_INTERVAL_PN595 , +GUARD_INTERVAL_PN945 , } fe_guard_interval_t;
@@ -213,6 +222,11 @@ typedef enum fe_hierarchy {HIERARCHY_AUTO } fe_hierarchy_t; +typedef enum fe_interleaving { +INTERLEAVING_NONE , +INTERLEAVING_240 , +INTERLEAVING_720 , +}fe_interleaving_t ;#if defined(__DVB_CORE__) || !defined (__KERNEL__) struct dvb_qpsk_parameters {
@@ -319,8 +333,9 @@ struct dvb_frontend_event {#define DTV_DVBT2_PLP_ID 43#define DTV_ENUM_DELSYS 44 +#define DTV_INTERLEAVING 45 -#define DTV_MAX_COMMAND DTV_ENUM_DELSYS +#define DTV_MAX_COMMAND DTV_INTERLEAVING typedef enum fe_pilot { PILOT_ON,
@@ -349,7 +364,7 @@ typedef enum fe_delivery_system {SYS_ISDBC ,SYS_ATSC ,SYS_ATSCMH , -SYS_DMBTH , +SYS_DTMB ,SYS_CMMB ,SYS_DAB , SYS_DVBT2,
@@ -357,8 +372,9 @@ typedef enum fe_delivery_system {SYS_DVBC_ANNEX_C , } fe_delivery_system_t; - +/* backward compatibility */ #define SYS_DVBC_ANNEX_AC SYS_DVBC_ANNEX_A +#define SYS_DMBTH SYS_DTMB/* DMB-TH is legacy name, use DTMB instead */ struct dtv_cmds_h {
include/linux/dvb/version.h +1 -1
@@ -24,6 +24,6 @@#define _DVBVERSION_H_#define DVB_API_VERSION 5 -#define DVB_API_VERSION_MINOR 5 +#define DVB_API_VERSION_MINOR 6#endif /*_DVBVERSION_H_*/
Signature · 1 line
1.7.4.4
include/linux/dvb/frontend.h typedef enum fe_hierarchy { · line 229
Quoted 5 lines · Antti Palosaari
include/linux/dvb/frontend.h +5
-0+typedef enum fe_interleaving { +INTERLEAVING_NONE , +INTERLEAVING_240 , +INTERLEAVING_720 , +}fe_interleaving_t ;
Checkpatch didn't like that, but I left it as all the others are similar. I am happy to fix it too if there is idea what it should be.
WARNING: do not add new typedefs
#165: FILE: include/linux/dvb/frontend.h:225:
+typedef enum fe_interleaving {
Antti
Signature · 1 line
http://palosaari.fi/
Em 14-01-2012 13:35, Antti Palosaari escreveu:
Quoted 9 lines · Antti Palosaari
include/linux/dvb/frontend.h typedef enum fe_hierarchy { · line 229
Quoted 5 lines
include/linux/dvb/frontend.h +5
-0+typedef enum fe_interleaving { +INTERLEAVING_NONE , +INTERLEAVING_240 , +INTERLEAVING_720 , +}fe_interleaving_t ;Checkpatch didn't like that, but I left it as all the others are similar. I am happy to fix it too if there is idea what it should be.
Quoted 3 lines
WARNING: do not add new typedefs
#165: FILE:include/linux/dvb/frontend.h:225:
+typedef enumfe_interleaving{
Just use:
enum fe_interleaving {
...
};having a typedef here won't help at all, as the DVBv5 API uses "u32" for the types. So, a typecast will happen anyway every time this is used.
Regards,
Mauro.
Quoted 86 lines · On Saturday 14 January 2012 16:31:16 Antti Palosaari wrote:
Version 2. I have made some changes from feedback got and what I myself found better. I will add documentation later after API issues are resolved.
Thanks to Andreas, Patrick and Mauro.Cc Patrick Boettcher <[email protected]>Cc Andreas Oberritter <[email protected]>Cc Mauro Carvalho Chehab <[email protected]>Signed-off-by Antti Palosaari <[email protected]>--- drivers/media/dvb/dvb-core/dvb_frontend.c | 14 +++++++++++--- drivers/media/dvb/dvb-core/dvb_frontend.h | 2 ++ drivers/media/dvb/frontends/atbm8830.c | 2 +- drivers/media/dvb/frontends/lgs8gl5.c | 2 +- drivers/media/dvb/frontends/lgs8gxx.c | 2 +- include/linux/dvb/frontend.h | 22 +++++++++++++++++++--- include/linux/dvb/version.h | 2 +- 7 files changed, 36 insertions(+), 10 deletions(-)drivers/media/dvb/dvb-core/dvb_frontend.c +1
-1@@ -177,7 +177,7 @@ static enum dvbv3_emulation_type dvbv3_type(u32 delivery_system)case SYS_DVBT :case SYS_DVBT2 :case SYS_ISDBT : -case SYS_DMBTH : +case SYS_DTMB :return DVBV3_OFDM ;case SYS_ATSC :case
SYS_DVBC_ANNEX_B:drivers/media/dvb/dvb-core/dvb_frontend.c +3
-0@@ -989,6 +989,7 @@ static struct dtv_cmds_h dtv_cmds[DTV_MAX_COMMAND + 1] = {_DTV_CMD (DTV_CODE_RATE_LP ,1 ,0 ),_DTV_CMD (DTV_GUARD_INTERVAL ,1 ,0 ),_DTV_CMD (DTV_TRANSMISSION_MODE ,1 ,0 ), +_DTV_CMD (DTV_INTERLEAVING ,1 ,0 ),_DTV_CMD (DTV_ISDBT_PARTIAL_RECEPTION ,1 ,0 ), _DTV_CMD(DTV_ISDBT_SOUND_BROADCASTING, 1, 0),@@ -1039,6 +1040,7 @@ static struct dtv_cmds_h dtv_cmds[DTV_MAX_COMMAND + 1] = {_DTV_CMD (DTV_GUARD_INTERVAL ,0 ,0 ),_DTV_CMD (DTV_TRANSMISSION_MODE ,0 ,0 ),_DTV_CMD (DTV_HIERARCHY ,0 ,0 ), +_DTV_CMD (DTV_INTERLEAVING ,0 ,0 ), _DTV_CMD(DTV_ENUM_DELSYS, 0, 0),};drivers/media/dvb/dvb-core/dvb_frontend.c +3
-0@@ -1316,6 +1318,9 @@ static int dtv_property_process_get(structdvb_frontend *fe, case DTV_HIERARCHY: tvp->u.data = c->hierarchy;break ; +case DTV_INTERLEAVING : + tvp->u.data = c->interleaving; +break ;/* ISDB-T Support here */ case
DTV_ISDBT_PARTIAL_RECEPTION:drivers/media/dvb/dvb-core/dvb_frontend.c +1
-1@@ -1503,7 +1508,7 @@ static int set_delivery_system(struct dvb_frontend *fe, u32 desired_system) * The DVBv3 or DVBv5 call is requesting a different system. So, * emulation is needed. * - * Emulate newer delivery systems like ISDBT, DVBT and DMBTH + * Emulate newer delivery systems like ISDBT, DVBT and DTMB * for older DVBv5 applications. The emulation will try to use * the auto mode for most things, and will assume that the desired* delivery system is the last one at the ops.delsys[] array
drivers/media/dvb/dvb-core/dvb_frontend.c +3
-0@@ -1625,6 +1630,9 @@ static int dtv_property_process_set(structdvb_frontend *fe, case DTV_HIERARCHY: c->hierarchy = tvp->u.data;break ; +case DTV_INTERLEAVING : + c->interleaving = tvp->u.data; +break ;/* ISDB-T Support here */ case
DTV_ISDBT_PARTIAL_RECEPTION:
drivers/media/dvb/dvb-core/dvb_frontend.c static int dtv_set_frontend(struct dvb_frontend · line 1910
Quoted 8 lines
drivers/media/dvb/dvb-core/dvb_frontend.c +1
-1@@ -1896,7 +1904,7 @@ static int dtv_set_frontend(struct dvb_frontend *fe) case SYS_DVBT:case SYS_DVBT2 :case SYS_ISDBT : -case SYS_DMBTH : +case SYS_DTMB : fepriv->min_delay =HZ /20 ; fepriv->step_size = fe->ops.info.frequency_stepsize *2 ; fepriv->max_drift = (fe->ops.info.frequency_stepsize * 2) +
1;
Quoted 148 lines
drivers/media/dvb/dvb-core/dvb_frontend.h +2
-0@@ -353,6 +353,8 @@ struct dtv_frontend_properties {fe_delivery_system_t delivery_system; +fe_interleaving_t interleaving; +/* ISDB-T specifics */ u8 isdbt_partial_reception;u8 isdbt_sb_mode;drivers/media/dvb/frontends/atbm8830.c +1
-1@@ -428,7 +428,7 @@ static int atbm8830_i2c_gate_ctrl(struct dvb_frontend *fe, int enable) }static struct dvb_frontend_ops atbm8830_ops = { - .delsys = {SYS_DMBTH }, + .delsys = {SYS_DTMB }, .info = { .name ="AltoBeam ATBM8830/8831 DMB-TH" ,.frequency_min = 474000000,
drivers/media/dvb/frontends/lgs8gl5.c +1
-1@@ -412,7 +412,7 @@ EXPORT_SYMBOL(lgs8gl5_attach);static struct dvb_frontend_ops lgs8gl5_ops = { - .delsys = {SYS_DMBTH }, + .delsys = {SYS_DTMB }, .info = { .name ="Legend Silicon LGS-8GL5 DMB-TH" , .frequency_min =474000000 ,drivers/media/dvb/frontends/lgs8gxx.c +1
-1@@ -994,7 +994,7 @@ static int lgs8gxx_i2c_gate_ctrl(struct dvb_frontend *fe, int enable) }static struct dvb_frontend_ops lgs8gxx_ops = { - .delsys = {SYS_DMBTH }, + .delsys = {SYS_DTMB }, .info = { .name ="Legend Silicon LGS8913/LGS8GXX DMB-TH" ,.frequency_min = 474000000,
(quoted diff) +0
-0
b/include/linux/dvb/frontend.hindex cb4428a..1835c11 100644include/linux/dvb/frontend.h +19
-3@@ -152,6 +152,9 @@ typedef enum fe_code_rate {FEC_AUTO ,FEC_3_5 ,FEC_9_10 , +FEC_04 , +FEC_06 , +FEC_08 , } fe_code_rate_t;@@ -169,6 +172,7 @@ typedef enum fe_modulation {APSK_16 ,APSK_32 ,DQPSK , +QAM_4_NR , } fe_modulation_t; typedef enum fe_transmit_mode {@@ -179,6 +183,8 @@ typedef enum fe_transmit_mode {TRANSMISSION_MODE_1K ,TRANSMISSION_MODE_16K ,TRANSMISSION_MODE_32K , +TRANSMISSION_MODE_C1 , +TRANSMISSION_MODE_C3780 , } fe_transmit_mode_t;#if defined(__DVB_CORE__) || !defined (__KERNEL__)@@ -202,6 +208,9 @@ typedef enum fe_guard_interval {GUARD_INTERVAL_1_128 ,GUARD_INTERVAL_19_128 ,GUARD_INTERVAL_19_256 , +GUARD_INTERVAL_PN420 , +GUARD_INTERVAL_PN595 , +GUARD_INTERVAL_PN945 , } fe_guard_interval_t;@@ -213,6 +222,11 @@ typedef enum fe_hierarchy {HIERARCHY_AUTO } fe_hierarchy_t; +typedef enum fe_interleaving { +INTERLEAVING_NONE , +INTERLEAVING_240 , +INTERLEAVING_720 , +}fe_interleaving_t ;#if defined(__DVB_CORE__) || !defined (__KERNEL__) struct dvb_qpsk_parameters {@@ -319,8 +333,9 @@ struct dvb_frontend_event {#define DTV_DVBT2_PLP_ID 43#define DTV_ENUM_DELSYS 44 +#define DTV_INTERLEAVING 45 -#define DTV_MAX_COMMAND DTV_ENUM_DELSYS +#define DTV_MAX_COMMAND DTV_INTERLEAVING typedef enum fe_pilot { PILOT_ON,@@ -349,7 +364,7 @@ typedef enum fe_delivery_system {SYS_ISDBC ,SYS_ATSC ,SYS_ATSCMH , -SYS_DMBTH , +SYS_DTMB ,SYS_CMMB ,SYS_DAB , SYS_DVBT2,@@ -357,8 +372,9 @@ typedef enum fe_delivery_system {SYS_DVBC_ANNEX_C , } fe_delivery_system_t; - +/* backward compatibility */ #define SYS_DVBC_ANNEX_AC SYS_DVBC_ANNEX_A +#define SYS_DMBTH SYS_DTMB/* DMB-TH is legacy name, use DTMB instead */
struct
dtv_cmds_h{(quoted diff) +0
-0
b/include/linux/dvb/version.hindex 0559e2b..43d9e8d 100644
include/linux/dvb/version.h line 29
Quoted 7 lines
include/linux/dvb/version.h +1
-1@@ -24,6 +24,6 @@#define _DVBVERSION_H_#define DVB_API_VERSION 5 -#define DVB_API_VERSION_MINOR 5 +#define DVB_API_VERSION_MINOR 6#endif /*_DVBVERSION_H_*/
If you like you can add, good work.
--
Patrick Boettcher
Kernel Labs Inc.
http://www.kernellabs.com/