Commit 13fef933 authored by Andrew de Quincey's avatar Andrew de Quincey Committed by Mauro Carvalho Chehab

V4L/DVB (4383): Convert SEC drivers to new frontend API

Convert SEC drivers to new frontend API
Signed-off-by: default avatarAndrew de Quincey <adq_dvb@lidskialf.net>
Acked-by: default avatarMichael Krufky <mkrufky@linuxtv.org>
Acked-by: default avatarTrent Piepho <xyzzy@speakeasy.org>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@infradead.org>
parent 94cbae5a
...@@ -1105,6 +1105,8 @@ int dvb_unregister_frontend(struct dvb_frontend* fe) ...@@ -1105,6 +1105,8 @@ int dvb_unregister_frontend(struct dvb_frontend* fe)
mutex_lock(&frontend_mutex); mutex_lock(&frontend_mutex);
dvb_unregister_device (fepriv->dvbdev); dvb_unregister_device (fepriv->dvbdev);
dvb_frontend_stop (fe); dvb_frontend_stop (fe);
if (fe->ops.release_sec)
fe->ops.release_sec(fe);
if (fe->ops.tuner_ops.release) { if (fe->ops.tuner_ops.release) {
fe->ops.tuner_ops.release(fe); fe->ops.tuner_ops.release(fe);
if (fe->ops.i2c_gate_ctrl) if (fe->ops.i2c_gate_ctrl)
......
...@@ -42,12 +42,11 @@ struct isl6421 { ...@@ -42,12 +42,11 @@ struct isl6421 {
u8 override_and; u8 override_and;
struct i2c_adapter *i2c; struct i2c_adapter *i2c;
u8 i2c_addr; u8 i2c_addr;
void (*release_chain)(struct dvb_frontend* fe);
}; };
static int isl6421_set_voltage(struct dvb_frontend *fe, fe_sec_voltage_t voltage) static int isl6421_set_voltage(struct dvb_frontend *fe, fe_sec_voltage_t voltage)
{ {
struct isl6421 *isl6421 = (struct isl6421 *) fe->misc_priv; struct isl6421 *isl6421 = (struct isl6421 *) fe->sec_priv;
struct i2c_msg msg = { .addr = isl6421->i2c_addr, .flags = 0, struct i2c_msg msg = { .addr = isl6421->i2c_addr, .flags = 0,
.buf = &isl6421->config, .buf = &isl6421->config,
.len = sizeof(isl6421->config) }; .len = sizeof(isl6421->config) };
...@@ -75,7 +74,7 @@ static int isl6421_set_voltage(struct dvb_frontend *fe, fe_sec_voltage_t voltage ...@@ -75,7 +74,7 @@ static int isl6421_set_voltage(struct dvb_frontend *fe, fe_sec_voltage_t voltage
static int isl6421_enable_high_lnb_voltage(struct dvb_frontend *fe, long arg) static int isl6421_enable_high_lnb_voltage(struct dvb_frontend *fe, long arg)
{ {
struct isl6421 *isl6421 = (struct isl6421 *) fe->misc_priv; struct isl6421 *isl6421 = (struct isl6421 *) fe->sec_priv;
struct i2c_msg msg = { .addr = isl6421->i2c_addr, .flags = 0, struct i2c_msg msg = { .addr = isl6421->i2c_addr, .flags = 0,
.buf = &isl6421->config, .buf = &isl6421->config,
.len = sizeof(isl6421->config) }; .len = sizeof(isl6421->config) };
...@@ -93,31 +92,26 @@ static int isl6421_enable_high_lnb_voltage(struct dvb_frontend *fe, long arg) ...@@ -93,31 +92,26 @@ static int isl6421_enable_high_lnb_voltage(struct dvb_frontend *fe, long arg)
static void isl6421_release(struct dvb_frontend *fe) static void isl6421_release(struct dvb_frontend *fe)
{ {
struct isl6421 *isl6421 = (struct isl6421 *) fe->misc_priv;
/* power off */ /* power off */
isl6421_set_voltage(fe, SEC_VOLTAGE_OFF); isl6421_set_voltage(fe, SEC_VOLTAGE_OFF);
/* free data & call next release routine */ /* free */
fe->ops.release = isl6421->release_chain; kfree(fe->sec_priv);
kfree(fe->misc_priv); fe->sec_priv = NULL;
fe->misc_priv = NULL;
if (fe->ops.release)
fe->ops.release(fe);
} }
int isl6421_attach(struct dvb_frontend *fe, struct i2c_adapter *i2c, u8 i2c_addr, struct dvb_frontend *isl6421_attach(struct dvb_frontend *fe, struct i2c_adapter *i2c, u8 i2c_addr,
u8 override_set, u8 override_clear) u8 override_set, u8 override_clear)
{ {
struct isl6421 *isl6421 = kmalloc(sizeof(struct isl6421), GFP_KERNEL); struct isl6421 *isl6421 = kmalloc(sizeof(struct isl6421), GFP_KERNEL);
if (!isl6421) if (!isl6421)
return -ENOMEM; return NULL;
/* default configuration */ /* default configuration */
isl6421->config = ISL6421_ISEL1; isl6421->config = ISL6421_ISEL1;
isl6421->i2c = i2c; isl6421->i2c = i2c;
isl6421->i2c_addr = i2c_addr; isl6421->i2c_addr = i2c_addr;
fe->misc_priv = isl6421; fe->sec_priv = isl6421;
/* bits which should be forced to '1' */ /* bits which should be forced to '1' */
isl6421->override_or = override_set; isl6421->override_or = override_set;
...@@ -128,19 +122,17 @@ int isl6421_attach(struct dvb_frontend *fe, struct i2c_adapter *i2c, u8 i2c_addr ...@@ -128,19 +122,17 @@ int isl6421_attach(struct dvb_frontend *fe, struct i2c_adapter *i2c, u8 i2c_addr
/* detect if it is present or not */ /* detect if it is present or not */
if (isl6421_set_voltage(fe, SEC_VOLTAGE_OFF)) { if (isl6421_set_voltage(fe, SEC_VOLTAGE_OFF)) {
kfree(isl6421); kfree(isl6421);
fe->misc_priv = NULL; return NULL;
return -EIO;
} }
/* install release callback */ /* install release callback */
isl6421->release_chain = fe->ops.release;
fe->ops.release = isl6421_release; fe->ops.release = isl6421_release;
/* override frontend ops */ /* override frontend ops */
fe->ops.set_voltage = isl6421_set_voltage; fe->ops.set_voltage = isl6421_set_voltage;
fe->ops.enable_high_lnb_voltage = isl6421_enable_high_lnb_voltage; fe->ops.enable_high_lnb_voltage = isl6421_enable_high_lnb_voltage;
return 0; return fe;
} }
EXPORT_SYMBOL(isl6421_attach); EXPORT_SYMBOL(isl6421_attach);
......
...@@ -40,7 +40,7 @@ ...@@ -40,7 +40,7 @@
#define ISL6421_DCL 0x40 #define ISL6421_DCL 0x40
/* override_set and override_clear control which system register bits (above) to always set & clear */ /* override_set and override_clear control which system register bits (above) to always set & clear */
extern int isl6421_attach(struct dvb_frontend *fe, struct i2c_adapter *i2c, u8 i2c_addr, extern struct dvb_frontend *isl6421_attach(struct dvb_frontend *fe, struct i2c_adapter *i2c, u8 i2c_addr,
u8 override_set, u8 override_clear); u8 override_set, u8 override_clear);
#endif #endif
...@@ -40,12 +40,11 @@ struct lnbp21 { ...@@ -40,12 +40,11 @@ struct lnbp21 {
u8 override_or; u8 override_or;
u8 override_and; u8 override_and;
struct i2c_adapter *i2c; struct i2c_adapter *i2c;
void (*release_chain)(struct dvb_frontend* fe);
}; };
static int lnbp21_set_voltage(struct dvb_frontend *fe, fe_sec_voltage_t voltage) static int lnbp21_set_voltage(struct dvb_frontend *fe, fe_sec_voltage_t voltage)
{ {
struct lnbp21 *lnbp21 = (struct lnbp21 *) fe->misc_priv; struct lnbp21 *lnbp21 = (struct lnbp21 *) fe->sec_priv;
struct i2c_msg msg = { .addr = 0x08, .flags = 0, struct i2c_msg msg = { .addr = 0x08, .flags = 0,
.buf = &lnbp21->config, .buf = &lnbp21->config,
.len = sizeof(lnbp21->config) }; .len = sizeof(lnbp21->config) };
...@@ -73,7 +72,7 @@ static int lnbp21_set_voltage(struct dvb_frontend *fe, fe_sec_voltage_t voltage) ...@@ -73,7 +72,7 @@ static int lnbp21_set_voltage(struct dvb_frontend *fe, fe_sec_voltage_t voltage)
static int lnbp21_enable_high_lnb_voltage(struct dvb_frontend *fe, long arg) static int lnbp21_enable_high_lnb_voltage(struct dvb_frontend *fe, long arg)
{ {
struct lnbp21 *lnbp21 = (struct lnbp21 *) fe->misc_priv; struct lnbp21 *lnbp21 = (struct lnbp21 *) fe->sec_priv;
struct i2c_msg msg = { .addr = 0x08, .flags = 0, struct i2c_msg msg = { .addr = 0x08, .flags = 0,
.buf = &lnbp21->config, .buf = &lnbp21->config,
.len = sizeof(lnbp21->config) }; .len = sizeof(lnbp21->config) };
...@@ -91,29 +90,24 @@ static int lnbp21_enable_high_lnb_voltage(struct dvb_frontend *fe, long arg) ...@@ -91,29 +90,24 @@ static int lnbp21_enable_high_lnb_voltage(struct dvb_frontend *fe, long arg)
static void lnbp21_release(struct dvb_frontend *fe) static void lnbp21_release(struct dvb_frontend *fe)
{ {
struct lnbp21 *lnbp21 = (struct lnbp21 *) fe->misc_priv;
/* LNBP power off */ /* LNBP power off */
lnbp21_set_voltage(fe, SEC_VOLTAGE_OFF); lnbp21_set_voltage(fe, SEC_VOLTAGE_OFF);
/* free data & call next release routine */ /* free data */
fe->ops.release = lnbp21->release_chain; kfree(fe->sec_priv);
kfree(fe->misc_priv); fe->sec_priv = NULL;
fe->misc_priv = NULL;
if (fe->ops.release)
fe->ops.release(fe);
} }
int lnbp21_attach(struct dvb_frontend *fe, struct i2c_adapter *i2c, u8 override_set, u8 override_clear) struct dvb_frontend *lnbp21_attach(struct dvb_frontend *fe, struct i2c_adapter *i2c, u8 override_set, u8 override_clear)
{ {
struct lnbp21 *lnbp21 = kmalloc(sizeof(struct lnbp21), GFP_KERNEL); struct lnbp21 *lnbp21 = kmalloc(sizeof(struct lnbp21), GFP_KERNEL);
if (!lnbp21) if (!lnbp21)
return -ENOMEM; return NULL;
/* default configuration */ /* default configuration */
lnbp21->config = LNBP21_ISEL; lnbp21->config = LNBP21_ISEL;
lnbp21->i2c = i2c; lnbp21->i2c = i2c;
fe->misc_priv = lnbp21; fe->sec_priv = lnbp21;
/* bits which should be forced to '1' */ /* bits which should be forced to '1' */
lnbp21->override_or = override_set; lnbp21->override_or = override_set;
...@@ -124,19 +118,17 @@ int lnbp21_attach(struct dvb_frontend *fe, struct i2c_adapter *i2c, u8 override_ ...@@ -124,19 +118,17 @@ int lnbp21_attach(struct dvb_frontend *fe, struct i2c_adapter *i2c, u8 override_
/* detect if it is present or not */ /* detect if it is present or not */
if (lnbp21_set_voltage(fe, SEC_VOLTAGE_OFF)) { if (lnbp21_set_voltage(fe, SEC_VOLTAGE_OFF)) {
kfree(lnbp21); kfree(lnbp21);
fe->misc_priv = NULL; return NULL;
return -EIO;
} }
/* install release callback */ /* install release callback */
lnbp21->release_chain = fe->ops.release;
fe->ops.release = lnbp21_release; fe->ops.release = lnbp21_release;
/* override frontend ops */ /* override frontend ops */
fe->ops.set_voltage = lnbp21_set_voltage; fe->ops.set_voltage = lnbp21_set_voltage;
fe->ops.enable_high_lnb_voltage = lnbp21_enable_high_lnb_voltage; fe->ops.enable_high_lnb_voltage = lnbp21_enable_high_lnb_voltage;
return 0; return fe;
} }
EXPORT_SYMBOL(lnbp21_attach); EXPORT_SYMBOL(lnbp21_attach);
......
...@@ -40,6 +40,6 @@ ...@@ -40,6 +40,6 @@
#include <linux/dvb/frontend.h> #include <linux/dvb/frontend.h>
/* override_set and override_clear control which system register bits (above) to always set & clear */ /* override_set and override_clear control which system register bits (above) to always set & clear */
extern int lnbp21_attach(struct dvb_frontend *fe, struct i2c_adapter *i2c, u8 override_set, u8 override_clear); extern struct dvb_frontend *lnbp21_attach(struct dvb_frontend *fe, struct i2c_adapter *i2c, u8 override_set, u8 override_clear);
#endif #endif
...@@ -2219,7 +2219,7 @@ static int frontend_init(struct av7110 *av7110) ...@@ -2219,7 +2219,7 @@ static int frontend_init(struct av7110 *av7110)
av7110->fe->ops.tuner_ops.set_params = alps_bsbe1_tuner_set_params; av7110->fe->ops.tuner_ops.set_params = alps_bsbe1_tuner_set_params;
av7110->fe->tuner_priv = &av7110->i2c_adap; av7110->fe->tuner_priv = &av7110->i2c_adap;
if (lnbp21_attach(av7110->fe, &av7110->i2c_adap, 0, 0)) { if (lnbp21_attach(av7110->fe, &av7110->i2c_adap, 0, 0) == NULL) {
printk("dvb-ttpci: LNBP21 not found!\n"); printk("dvb-ttpci: LNBP21 not found!\n");
if (av7110->fe->ops.release) if (av7110->fe->ops.release)
av7110->fe->ops.release(av7110->fe); av7110->fe->ops.release(av7110->fe);
......
...@@ -1044,7 +1044,7 @@ static void frontend_init(struct budget_ci *budget_ci) ...@@ -1044,7 +1044,7 @@ static void frontend_init(struct budget_ci *budget_ci)
budget_ci->budget.dvb_frontend->tuner_priv = &budget_ci->budget.i2c_adap; budget_ci->budget.dvb_frontend->tuner_priv = &budget_ci->budget.i2c_adap;
budget_ci->budget.dvb_frontend->ops.dishnetwork_send_legacy_command = NULL; budget_ci->budget.dvb_frontend->ops.dishnetwork_send_legacy_command = NULL;
if (lnbp21_attach(budget_ci->budget.dvb_frontend, &budget_ci->budget.i2c_adap, LNBP21_LLC, 0)) { if (lnbp21_attach(budget_ci->budget.dvb_frontend, &budget_ci->budget.i2c_adap, LNBP21_LLC, 0) == NULL) {
printk("%s: No LNBP21 found!\n", __FUNCTION__); printk("%s: No LNBP21 found!\n", __FUNCTION__);
if (budget_ci->budget.dvb_frontend->ops.release) if (budget_ci->budget.dvb_frontend->ops.release)
budget_ci->budget.dvb_frontend->ops.release(budget_ci->budget.dvb_frontend); budget_ci->budget.dvb_frontend->ops.release(budget_ci->budget.dvb_frontend);
......
...@@ -420,7 +420,7 @@ static void frontend_init(struct budget *budget) ...@@ -420,7 +420,7 @@ static void frontend_init(struct budget *budget)
budget->dvb_frontend = s5h1420_attach(&s5h1420_config, &budget->i2c_adap); budget->dvb_frontend = s5h1420_attach(&s5h1420_config, &budget->i2c_adap);
if (budget->dvb_frontend) { if (budget->dvb_frontend) {
budget->dvb_frontend->ops.tuner_ops.set_params = s5h1420_tuner_set_params; budget->dvb_frontend->ops.tuner_ops.set_params = s5h1420_tuner_set_params;
if (lnbp21_attach(budget->dvb_frontend, &budget->i2c_adap, 0, 0)) { if (lnbp21_attach(budget->dvb_frontend, &budget->i2c_adap, 0, 0) == NULL) {
printk("%s: No LNBP21 found!\n", __FUNCTION__); printk("%s: No LNBP21 found!\n", __FUNCTION__);
goto error_out; goto error_out;
} }
......
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