Commit 6b73eeaf authored by Steven Toth's avatar Steven Toth Committed by Mauro Carvalho Chehab

V4L/DVB (8985): S2API: Added dvb frontend changes to support a newer tuning API

This is an experimental patch to add a new tuning mechanism for
dvb frontends. Rather than passing fixed structures across the
user/kernel boundary, which need to be revised for each new modulation
type (or feature the kernel developers want to add), this implements
a simpler message based approach, allowing fe commands to be broken
down into a series of small fixed size transactions, presented
in an array.

The goal is to avoid changing the user/kernel ABI in the future, by
simply creating new frontend commands (and sequencies of commands) that
help us add support for brand new demodulator, delivery system or
statistics related commmands.

known issues:
checkpatch voilations
feedback from various developers yet to be implemented, relating
to namespace conventions, variable length array passing conventions,
and generally some optimization.

This patch should support all existing tuning mechanisms through the
new API, as well as adding 8PSK, DVB-S2 NBC-QPSK and ISDB-T API support.

For testing and exercise purposes, see the latest tune.c tool
available from http://www.steventoth.net/linux/s2Signed-off-by: default avatarSteven Toth <stoth@linuxtv.org>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent 05c1cab5
This diff is collapsed.
...@@ -169,6 +169,10 @@ struct dvb_frontend_ops { ...@@ -169,6 +169,10 @@ struct dvb_frontend_ops {
struct dvb_tuner_ops tuner_ops; struct dvb_tuner_ops tuner_ops;
struct analog_demod_ops analog_ops; struct analog_demod_ops analog_ops;
int (*set_property)(struct dvb_frontend* fe, tv_property_t* tvp);
int (*get_property)(struct dvb_frontend* fe, tv_property_t* tvp);
int (*set_params)(struct dvb_frontend* fe);
}; };
#define MAX_EVENT 8 #define MAX_EVENT 8
...@@ -182,6 +186,45 @@ struct dvb_fe_events { ...@@ -182,6 +186,45 @@ struct dvb_fe_events {
struct mutex mtx; struct mutex mtx;
}; };
struct tv_frontend_properties {
/* Cache State */
u32 state;
u32 frequency;
fe_modulation_t modulation;
fe_sec_voltage_t voltage;
fe_sec_tone_mode_t sectone;
fe_spectral_inversion_t inversion;
fe_code_rate_t fec_inner;
fe_transmit_mode_t transmission_mode;
fe_bandwidth_t bandwidth;
fe_guard_interval_t guard_interval;
fe_hierarchy_t hierarchy;
u32 symbol_rate;
fe_code_rate_t code_rate_HP;
fe_code_rate_t code_rate_LP;
fe_pilot_t pilot;
fe_rolloff_t rolloff;
fe_delivery_system_t delivery_system;
/* ISDB-T specifics */
u32 isdb_segment_num;
u32 isdb_segment_width;
fe_code_rate_t isdb_layera_fec;
fe_modulation_t isdb_layera_modulation;
u32 isdb_layera_segment_width;
fe_code_rate_t isdb_layerb_fec;
fe_modulation_t isdb_layerb_modulation;
u32 isdb_layerb_segment_width;
fe_code_rate_t isdb_layerc_fec;
fe_modulation_t isdb_layerc_modulation;
u32 isdb_layerc_segment_width;
};
struct dvb_frontend { struct dvb_frontend {
struct dvb_frontend_ops ops; struct dvb_frontend_ops ops;
struct dvb_adapter *dvb; struct dvb_adapter *dvb;
...@@ -190,6 +233,7 @@ struct dvb_frontend { ...@@ -190,6 +233,7 @@ struct dvb_frontend {
void *frontend_priv; void *frontend_priv;
void *sec_priv; void *sec_priv;
void *analog_demod_priv; void *analog_demod_priv;
struct tv_frontend_properties tv_property_cache;
}; };
extern int dvb_register_frontend(struct dvb_adapter *dvb, extern int dvb_register_frontend(struct dvb_adapter *dvb,
......
...@@ -62,6 +62,7 @@ typedef enum fe_caps { ...@@ -62,6 +62,7 @@ typedef enum fe_caps {
FE_CAN_HIERARCHY_AUTO = 0x100000, FE_CAN_HIERARCHY_AUTO = 0x100000,
FE_CAN_8VSB = 0x200000, FE_CAN_8VSB = 0x200000,
FE_CAN_16VSB = 0x400000, FE_CAN_16VSB = 0x400000,
FE_HAS_EXTENDED_CAPS = 0x800000, // We need more bitspace for newer APIs, indicate this.
FE_NEEDS_BENDING = 0x20000000, // not supported anymore, don't use (frontend requires frequency bending) FE_NEEDS_BENDING = 0x20000000, // not supported anymore, don't use (frontend requires frequency bending)
FE_CAN_RECOVER = 0x40000000, // frontend can recover from a cable unplug automatically FE_CAN_RECOVER = 0x40000000, // frontend can recover from a cable unplug automatically
FE_CAN_MUTE_TS = 0x80000000 // frontend can stop spurious TS data output FE_CAN_MUTE_TS = 0x80000000 // frontend can stop spurious TS data output
...@@ -147,7 +148,9 @@ typedef enum fe_code_rate { ...@@ -147,7 +148,9 @@ typedef enum fe_code_rate {
FEC_6_7, FEC_6_7,
FEC_7_8, FEC_7_8,
FEC_8_9, FEC_8_9,
FEC_AUTO FEC_AUTO,
FEC_3_5,
FEC_9_10,
} fe_code_rate_t; } fe_code_rate_t;
...@@ -160,7 +163,11 @@ typedef enum fe_modulation { ...@@ -160,7 +163,11 @@ typedef enum fe_modulation {
QAM_256, QAM_256,
QAM_AUTO, QAM_AUTO,
VSB_8, VSB_8,
VSB_16 VSB_16,
_8PSK,
_16APSK,
NBC_QPSK,
DQPSK,
} fe_modulation_t; } fe_modulation_t;
typedef enum fe_transmit_mode { typedef enum fe_transmit_mode {
...@@ -239,6 +246,125 @@ struct dvb_frontend_event { ...@@ -239,6 +246,125 @@ struct dvb_frontend_event {
struct dvb_frontend_parameters parameters; struct dvb_frontend_parameters parameters;
}; };
/* TODO: Turn this into a series of defines, so future maintainers
* don't insert random new commands and break backwards
* binary compatability.
*/
typedef enum tv_cmd_types {
TV_SEQ_UNDEFINED,
TV_SEQ_START,
TV_SEQ_CONTINUE,
TV_SEQ_COMPLETE,
TV_SEQ_TERMINATE,
TV_SET_FREQUENCY,
TV_SET_MODULATION,
TV_SET_BANDWIDTH,
TV_SET_INVERSION,
TV_SET_DISEQC_MASTER,
TV_SET_SYMBOLRATE,
TV_SET_INNERFEC,
TV_SET_VOLTAGE,
TV_SET_TONE,
TV_SET_PILOT,
TV_SET_ROLLOFF,
TV_GET_FREQUENCY,
TV_GET_MODULATION,
TV_GET_BANDWIDTH,
TV_GET_INVERSION,
TV_GET_DISEQC_SLAVE_REPLY,
TV_GET_SYMBOLRATE,
TV_GET_INNERFEC,
TV_GET_VOLTAGE,
TV_GET_TONE,
TV_GET_PILOT,
TV_GET_ROLLOFF,
/* Basic enumeration set for querying unlimited capabilities */
TV_GET_FE_CAPABILITY_COUNT,
TV_GET_FE_CAPABILITY,
/* New commands are always appended */
TV_SET_DELIVERY_SYSTEM,
TV_GET_DELIVERY_SYSTEM,
/* ISDB-T */
TV_SET_ISDB_SEGMENT_NUM,
TV_GET_ISDB_SEGMENT_NUM,
TV_SET_ISDB_SEGMENT_WIDTH,
TV_GET_ISDB_SEGMENT_WIDTH,
TV_GET_ISDB_LAYERA_FEC,
TV_GET_ISDB_LAYERA_MODULATION,
TV_GET_ISDB_LAYERA_SEGMENT_WIDTH,
TV_GET_ISDB_LAYERB_FEC,
TV_GET_ISDB_LAYERB_MODULATION,
TV_GET_ISDB_LAYERB_SEGMENT_WIDTH,
TV_GET_ISDB_LAYERC_FEC,
TV_GET_ISDB_LAYERC_MODULATION,
TV_GET_ISDB_LAYERC_SEGMENT_WIDTH,
} tv_cmd_types_t;
typedef enum fe_pilot {
PILOT_ON,
PILOT_OFF,
PILOT_AUTO,
} fe_pilot_t;
typedef enum fe_rolloff {
ROLLOFF_20,
ROLLOFF_25,
ROLLOFF_35,
ROLLOFF_AUTO,
} fe_rolloff_t;
typedef enum fe_delivery_system {
SYS_UNDEFINED,
SYS_DVBC_ANNEX_AC,
SYS_DVBC_ANNEX_B,
SYS_DVBT,
SYS_DVBS,
SYS_DVBS2,
SYS_DVBH,
SYS_ISDBT,
SYS_ISDBS,
SYS_ISDBC,
SYS_ATSC,
SYS_ATSCMH,
SYS_DMBTH,
SYS_CMMB,
SYS_DAB,
} fe_delivery_system_t;
struct tv_cmds_h {
char *name; /* A display name for debugging purposes */
__u32 cmd; /* A unique ID */
/* Flags */
__u32 set:1; /* Either a set or get property */
__u32 buffer:1; /* Does this property use the buffer? */
__u32 reserved:30; /* Align */
};
typedef struct {
__u32 cmd;
union {
__u32 data;
struct {
__u8 data[32];
__u32 len;
} buffer;
} u;
} tv_property_t;
/* No more than 16 properties during any given ioctl */
typedef tv_property_t tv_properties_t[16];
#define FE_SET_PROPERTY _IOW('o', 82, tv_properties_t)
#define FE_GET_PROPERTY _IOR('o', 83, tv_properties_t)
/** /**
* When set, this flag will disable any zigzagging or other "normal" tuning * When set, this flag will disable any zigzagging or other "normal" tuning
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment