summaryrefslogtreecommitdiff
path: root/linux/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'linux/drivers')
-rw-r--r--linux/drivers/media/dvb/dvb-core/dvb_frontend.c80
-rw-r--r--linux/drivers/media/dvb/dvb-core/dvb_frontend.h9
2 files changed, 86 insertions, 3 deletions
diff --git a/linux/drivers/media/dvb/dvb-core/dvb_frontend.c b/linux/drivers/media/dvb/dvb-core/dvb_frontend.c
index bc752929f..5d980ee9d 100644
--- a/linux/drivers/media/dvb/dvb-core/dvb_frontend.c
+++ b/linux/drivers/media/dvb/dvb-core/dvb_frontend.c
@@ -94,6 +94,8 @@ struct dvb_frontend_private {
/* thread/frontend values */
struct dvb_device *dvbdev;
struct dvb_frontend_parameters parameters;
+ struct dvb_frontend_params params;
+ struct dvb_frontend_cap caps;
struct dvb_fe_events events;
struct semaphore sem;
struct list_head list_head;
@@ -124,6 +126,62 @@ struct dvb_frontend_private {
unsigned int check_wrapped;
};
+struct modcod_table {
+ __u32 modcod;
+ __u32 modulation;
+ __u32 fecrate;
+};
+
+struct modcod_table dvbs2_modcod_lookup[] = {
+ { FE_MODCOD_DUMMY_PLFRAME, FE_MOD_NONE, FE_FECRATE_NONE },
+ { FE_MODCOD_QPSK_1_4, FE_MOD_QPSK, FE_FECRATE_1_4 },
+ { FE_MODCOD_QPSK_1_3, FE_MOD_QPSK, FE_FECRATE_1_3 },
+ { FE_MODCOD_QPSK_2_5, FE_MOD_QPSK, FE_FECRATE_2_5 },
+ { FE_MODCOD_QPSK_1_2, FE_MOD_QPSK, FE_FECRATE_1_2 },
+ { FE_MODCOD_QPSK_3_5, FE_MOD_QPSK, FE_FECRATE_3_5 },
+ { FE_MODCOD_QPSK_2_3, FE_MOD_QPSK, FE_FECRATE_2_3 },
+ { FE_MODCOD_QPSK_3_4, FE_MOD_QPSK, FE_FECRATE_3_4 },
+ { FE_MODCOD_QPSK_4_5, FE_MOD_QPSK, FE_FECRATE_4_5 },
+ { FE_MODCOD_QPSK_5_6, FE_MOD_QPSK, FE_FECRATE_5_6 },
+ { FE_MODCOD_QPSK_8_9, FE_MOD_QPSK, FE_FECRATE_8_9 },
+ { FE_MODCOD_QPSK_9_10, FE_MOD_QPSK, FE_FECRATE_9_10 },
+ { FE_MODCOD_8PSK_3_5, FE_MOD_8PSK, FE_FECRATE_3_5 },
+ { FE_MODCOD_8PSK_2_3, FE_MOD_8PSK, FE_FECRATE_2_3 },
+ { FE_MODCOD_8PSK_3_4, FE_MOD_8PSK, FE_FECRATE_3_4 },
+ { FE_MODCOD_8PSK_5_6, FE_MOD_8PSK, FE_FECRATE_5_6 },
+ { FE_MODCOD_8PSK_8_9, FE_MOD_8PSK, FE_FECRATE_8_9 },
+ { FE_MODCOD_8PSK_9_10, FE_MOD_8PSK, FE_FECRATE_9_10 },
+ { FE_MODCOD_16APSK_2_3, FE_MOD_16APSK, FE_FECRATE_2_3 },
+ { FE_MODCOD_16APSK_3_4, FE_MOD_16APSK, FE_FECRATE_3_4 },
+ { FE_MODCOD_16APSK_4_5, FE_MOD_16APSK, FE_FECRATE_4_5 },
+ { FE_MODCOD_16APSK_5_6, FE_MOD_16APSK, FE_FECRATE_5_6 },
+ { FE_MODCOD_16APSK_8_9, FE_MOD_16APSK, FE_FECRATE_8_9 },
+ { FE_MODCOD_16APSK_9_10, FE_MOD_16APSK, FE_FECRATE_9_10 },
+ { FE_MODCOD_32APSK_3_4, FE_MOD_32APSK, FE_FECRATE_3_4 },
+ { FE_MODCOD_32APSK_4_5, FE_MOD_32APSK, FE_FECRATE_4_5 },
+ { FE_MODCOD_32APSK_5_6, FE_MOD_32APSK, FE_FECRATE_5_6 },
+ { FE_MODCOD_32APSK_8_9, FE_MOD_32APSK, FE_FECRATE_8_9 },
+ { FE_MODCOD_32APSK_9_10, FE_MOD_32APSK, FE_FECRATE_9_10 },
+ { FE_MODCOD_RESERVED_1, FE_MOD_RSVD, FE_FECRATE_RSVD },
+ { FE_MODCOD_BPSK_1_3, FE_MOD_BPSK, FE_FECRATE_1_3 },
+ { FE_MODCOD_BPSK_1_4, FE_MOD_BPSK, FE_FECRATE_1_4 },
+ { FE_MODCOD_RESERVED_2, FE_MOD_RSVD, FE_FECRATE_RSVD }
+};
+
+int decode_dvbs2_modcod(struct dvb_frontend *fe, enum fe_modcod modcod)
+{
+ struct modcod_table *table = dvbs2_modcod_lookup;
+ struct dvb_frontend_private *fepriv = fe->frontend_priv;
+ struct dvb_frontend_params *params = &fepriv->params;
+
+ table += modcod;
+ params->delsys.dvbs2.modulation = table->modulation;
+ params->delsys.dvbs2.fecrate = table->fecrate;
+
+ return 0;
+}
+EXPORT_SYMBOL(decode_dvbs2_modcod);
+
static void dvb_frontend_wakeup(struct dvb_frontend *fe);
static void dvb_frontend_add_event(struct dvb_frontend *fe, fe_status_t status)
@@ -508,7 +566,7 @@ static int dvb_frontend_thread(void *data)
unsigned long timeout;
char name [15];
fe_status_t s;
- struct dvb_frontend_parameters *params;
+ struct dvb_frontend_params *params;
dprintk("%s\n", __FUNCTION__);
@@ -564,7 +622,7 @@ static int dvb_frontend_thread(void *data)
/* have we been asked to retune? */
params = NULL;
if (fepriv->state & FESTATE_RETUNE) {
- params = &fepriv->parameters;
+ params = &fepriv->params;
fepriv->state = FESTATE_TUNED;
}
@@ -977,6 +1035,24 @@ static int dvb_frontend_ioctl(struct inode *inode, struct file *file,
case FE_SET_FRONTEND_TUNE_MODE:
fepriv->tune_mode_flags = (unsigned long) parg;
break;
+
+ case FE_GET_CAPS:
+ if (fe->ops->get_caps) {
+ memcpy(parg, &fepriv->caps, sizeof (struct dvb_frontend_cap));
+ err = fe->ops->get_caps(fe, (struct dvb_frontend_cap*) parg);
+ }
+ break;
+
+ case FE_SET_PARAMS:
+ if (fe->ops->set_params)
+ err = fe->ops->set_params(fe, (struct dvb_frontend_params*) parg);
+ break;
+
+ case FE_GET_PARAMS:
+ if (fe->ops->get_params){
+ memcpy(parg, &fepriv->params, sizeof (struct dvb_frontend_params));
+ err = fe->ops->get_params(fe, (struct dvb_frontend_params*) parg);
+ }
};
up (&fepriv->sem);
diff --git a/linux/drivers/media/dvb/dvb-core/dvb_frontend.h b/linux/drivers/media/dvb/dvb-core/dvb_frontend.h
index 05ec9954b..4d1b45be0 100644
--- a/linux/drivers/media/dvb/dvb-core/dvb_frontend.h
+++ b/linux/drivers/media/dvb/dvb-core/dvb_frontend.h
@@ -98,7 +98,7 @@ struct dvb_frontend_ops {
/* if this is set, it overrides the default swzigzag */
int (*tune)(struct dvb_frontend* fe,
- struct dvb_frontend_parameters* params,
+ struct dvb_frontend_params* params,
unsigned int mode_flags,
int *delay,
fe_status_t *status);
@@ -125,6 +125,11 @@ struct dvb_frontend_ops {
int (*dishnetwork_send_legacy_command)(struct dvb_frontend* fe, unsigned long cmd);
int (*i2c_gate_ctrl)(struct dvb_frontend* fe, int enable);
+ /* New callbacks based on the new IOCTL's */
+ int (*get_caps)(struct dvb_frontend* fe, struct dvb_frontend_cap* caps);
+ int (*set_params)(struct dvb_frontend* fe, struct dvb_frontend_params* params);
+ int (*get_params)(struct dvb_frontend* fe, struct dvb_frontend_params* params);
+
struct dvb_tuner_ops tuner_ops;
};
@@ -158,4 +163,6 @@ extern void dvb_frontend_reinitialise(struct dvb_frontend *fe);
extern void dvb_frontend_sleep_until(struct timeval *waketime, u32 add_usec);
extern s32 timeval_usec_diff(struct timeval lasttime, struct timeval curtime);
+extern int decode_dvbs2_modcod(struct dvb_frontend *fe, enum fe_modcod modcod);
+
#endif