diff options
author | Andrew de Quincey <adq_dvb@lidskialf.net> | 2006-08-08 08:10:08 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@infradead.org> | 2006-09-26 10:53:23 -0400 |
commit | 13fef9335f4fe2a73e1733f8807e69711736faef (patch) | |
tree | 499ccb23b708e265517388cfce80d4b25a2e315d | |
parent | 94cbae5a1a1537ef5a402199f597e84dc5dd92cb (diff) |
V4L/DVB (4383): Convert SEC drivers to new frontend API
Convert SEC drivers to new frontend API
Signed-off-by: Andrew de Quincey <adq_dvb@lidskialf.net>
Acked-by: Michael Krufky <mkrufky@linuxtv.org>
Acked-by: Trent Piepho <xyzzy@speakeasy.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
-rw-r--r-- | drivers/media/dvb/dvb-core/dvb_frontend.c | 2 | ||||
-rw-r--r-- | drivers/media/dvb/frontends/isl6421.c | 28 | ||||
-rw-r--r-- | drivers/media/dvb/frontends/isl6421.h | 2 | ||||
-rw-r--r-- | drivers/media/dvb/frontends/lnbp21.c | 28 | ||||
-rw-r--r-- | drivers/media/dvb/frontends/lnbp21.h | 2 | ||||
-rw-r--r-- | drivers/media/dvb/ttpci/av7110.c | 2 | ||||
-rw-r--r-- | drivers/media/dvb/ttpci/budget-ci.c | 2 | ||||
-rw-r--r-- | drivers/media/dvb/ttpci/budget.c | 2 |
8 files changed, 27 insertions, 41 deletions
diff --git a/drivers/media/dvb/dvb-core/dvb_frontend.c b/drivers/media/dvb/dvb-core/dvb_frontend.c index 57b34cda99f5..832116d09256 100644 --- a/drivers/media/dvb/dvb-core/dvb_frontend.c +++ b/drivers/media/dvb/dvb-core/dvb_frontend.c | |||
@@ -1105,6 +1105,8 @@ int dvb_unregister_frontend(struct dvb_frontend* fe) | |||
1105 | mutex_lock(&frontend_mutex); | 1105 | mutex_lock(&frontend_mutex); |
1106 | dvb_unregister_device (fepriv->dvbdev); | 1106 | dvb_unregister_device (fepriv->dvbdev); |
1107 | dvb_frontend_stop (fe); | 1107 | dvb_frontend_stop (fe); |
1108 | if (fe->ops.release_sec) | ||
1109 | fe->ops.release_sec(fe); | ||
1108 | if (fe->ops.tuner_ops.release) { | 1110 | if (fe->ops.tuner_ops.release) { |
1109 | fe->ops.tuner_ops.release(fe); | 1111 | fe->ops.tuner_ops.release(fe); |
1110 | if (fe->ops.i2c_gate_ctrl) | 1112 | if (fe->ops.i2c_gate_ctrl) |
diff --git a/drivers/media/dvb/frontends/isl6421.c b/drivers/media/dvb/frontends/isl6421.c index 58c34db31071..0fc18f5a7167 100644 --- a/drivers/media/dvb/frontends/isl6421.c +++ b/drivers/media/dvb/frontends/isl6421.c | |||
@@ -42,12 +42,11 @@ struct isl6421 { | |||
42 | u8 override_and; | 42 | u8 override_and; |
43 | struct i2c_adapter *i2c; | 43 | struct i2c_adapter *i2c; |
44 | u8 i2c_addr; | 44 | u8 i2c_addr; |
45 | void (*release_chain)(struct dvb_frontend* fe); | ||
46 | }; | 45 | }; |
47 | 46 | ||
48 | static int isl6421_set_voltage(struct dvb_frontend *fe, fe_sec_voltage_t voltage) | 47 | static int isl6421_set_voltage(struct dvb_frontend *fe, fe_sec_voltage_t voltage) |
49 | { | 48 | { |
50 | struct isl6421 *isl6421 = (struct isl6421 *) fe->misc_priv; | 49 | struct isl6421 *isl6421 = (struct isl6421 *) fe->sec_priv; |
51 | struct i2c_msg msg = { .addr = isl6421->i2c_addr, .flags = 0, | 50 | struct i2c_msg msg = { .addr = isl6421->i2c_addr, .flags = 0, |
52 | .buf = &isl6421->config, | 51 | .buf = &isl6421->config, |
53 | .len = sizeof(isl6421->config) }; | 52 | .len = sizeof(isl6421->config) }; |
@@ -75,7 +74,7 @@ static int isl6421_set_voltage(struct dvb_frontend *fe, fe_sec_voltage_t voltage | |||
75 | 74 | ||
76 | static int isl6421_enable_high_lnb_voltage(struct dvb_frontend *fe, long arg) | 75 | static int isl6421_enable_high_lnb_voltage(struct dvb_frontend *fe, long arg) |
77 | { | 76 | { |
78 | struct isl6421 *isl6421 = (struct isl6421 *) fe->misc_priv; | 77 | struct isl6421 *isl6421 = (struct isl6421 *) fe->sec_priv; |
79 | struct i2c_msg msg = { .addr = isl6421->i2c_addr, .flags = 0, | 78 | struct i2c_msg msg = { .addr = isl6421->i2c_addr, .flags = 0, |
80 | .buf = &isl6421->config, | 79 | .buf = &isl6421->config, |
81 | .len = sizeof(isl6421->config) }; | 80 | .len = sizeof(isl6421->config) }; |
@@ -93,31 +92,26 @@ static int isl6421_enable_high_lnb_voltage(struct dvb_frontend *fe, long arg) | |||
93 | 92 | ||
94 | static void isl6421_release(struct dvb_frontend *fe) | 93 | static void isl6421_release(struct dvb_frontend *fe) |
95 | { | 94 | { |
96 | struct isl6421 *isl6421 = (struct isl6421 *) fe->misc_priv; | ||
97 | |||
98 | /* power off */ | 95 | /* power off */ |
99 | isl6421_set_voltage(fe, SEC_VOLTAGE_OFF); | 96 | isl6421_set_voltage(fe, SEC_VOLTAGE_OFF); |
100 | 97 | ||
101 | /* free data & call next release routine */ | 98 | /* free */ |
102 | fe->ops.release = isl6421->release_chain; | 99 | kfree(fe->sec_priv); |
103 | kfree(fe->misc_priv); | 100 | fe->sec_priv = NULL; |
104 | fe->misc_priv = NULL; | ||
105 | if (fe->ops.release) | ||
106 | fe->ops.release(fe); | ||
107 | } | 101 | } |
108 | 102 | ||
109 | int isl6421_attach(struct dvb_frontend *fe, struct i2c_adapter *i2c, u8 i2c_addr, | 103 | struct dvb_frontend *isl6421_attach(struct dvb_frontend *fe, struct i2c_adapter *i2c, u8 i2c_addr, |
110 | u8 override_set, u8 override_clear) | 104 | u8 override_set, u8 override_clear) |
111 | { | 105 | { |
112 | struct isl6421 *isl6421 = kmalloc(sizeof(struct isl6421), GFP_KERNEL); | 106 | struct isl6421 *isl6421 = kmalloc(sizeof(struct isl6421), GFP_KERNEL); |
113 | if (!isl6421) | 107 | if (!isl6421) |
114 | return -ENOMEM; | 108 | return NULL; |
115 | 109 | ||
116 | /* default configuration */ | 110 | /* default configuration */ |
117 | isl6421->config = ISL6421_ISEL1; | 111 | isl6421->config = ISL6421_ISEL1; |
118 | isl6421->i2c = i2c; | 112 | isl6421->i2c = i2c; |
119 | isl6421->i2c_addr = i2c_addr; | 113 | isl6421->i2c_addr = i2c_addr; |
120 | fe->misc_priv = isl6421; | 114 | fe->sec_priv = isl6421; |
121 | 115 | ||
122 | /* bits which should be forced to '1' */ | 116 | /* bits which should be forced to '1' */ |
123 | isl6421->override_or = override_set; | 117 | isl6421->override_or = override_set; |
@@ -128,19 +122,17 @@ int isl6421_attach(struct dvb_frontend *fe, struct i2c_adapter *i2c, u8 i2c_addr | |||
128 | /* detect if it is present or not */ | 122 | /* detect if it is present or not */ |
129 | if (isl6421_set_voltage(fe, SEC_VOLTAGE_OFF)) { | 123 | if (isl6421_set_voltage(fe, SEC_VOLTAGE_OFF)) { |
130 | kfree(isl6421); | 124 | kfree(isl6421); |
131 | fe->misc_priv = NULL; | 125 | return NULL; |
132 | return -EIO; | ||
133 | } | 126 | } |
134 | 127 | ||
135 | /* install release callback */ | 128 | /* install release callback */ |
136 | isl6421->release_chain = fe->ops.release; | ||
137 | fe->ops.release = isl6421_release; | 129 | fe->ops.release = isl6421_release; |
138 | 130 | ||
139 | /* override frontend ops */ | 131 | /* override frontend ops */ |
140 | fe->ops.set_voltage = isl6421_set_voltage; | 132 | fe->ops.set_voltage = isl6421_set_voltage; |
141 | fe->ops.enable_high_lnb_voltage = isl6421_enable_high_lnb_voltage; | 133 | fe->ops.enable_high_lnb_voltage = isl6421_enable_high_lnb_voltage; |
142 | 134 | ||
143 | return 0; | 135 | return fe; |
144 | } | 136 | } |
145 | EXPORT_SYMBOL(isl6421_attach); | 137 | EXPORT_SYMBOL(isl6421_attach); |
146 | 138 | ||
diff --git a/drivers/media/dvb/frontends/isl6421.h b/drivers/media/dvb/frontends/isl6421.h index 675f80a19b99..b5deacfe6d2f 100644 --- a/drivers/media/dvb/frontends/isl6421.h +++ b/drivers/media/dvb/frontends/isl6421.h | |||
@@ -40,7 +40,7 @@ | |||
40 | #define ISL6421_DCL 0x40 | 40 | #define ISL6421_DCL 0x40 |
41 | 41 | ||
42 | /* override_set and override_clear control which system register bits (above) to always set & clear */ | 42 | /* override_set and override_clear control which system register bits (above) to always set & clear */ |
43 | extern int isl6421_attach(struct dvb_frontend *fe, struct i2c_adapter *i2c, u8 i2c_addr, | 43 | extern struct dvb_frontend *isl6421_attach(struct dvb_frontend *fe, struct i2c_adapter *i2c, u8 i2c_addr, |
44 | u8 override_set, u8 override_clear); | 44 | u8 override_set, u8 override_clear); |
45 | 45 | ||
46 | #endif | 46 | #endif |
diff --git a/drivers/media/dvb/frontends/lnbp21.c b/drivers/media/dvb/frontends/lnbp21.c index e933edc8dd29..37bba32f29a5 100644 --- a/drivers/media/dvb/frontends/lnbp21.c +++ b/drivers/media/dvb/frontends/lnbp21.c | |||
@@ -40,12 +40,11 @@ struct lnbp21 { | |||
40 | u8 override_or; | 40 | u8 override_or; |
41 | u8 override_and; | 41 | u8 override_and; |
42 | struct i2c_adapter *i2c; | 42 | struct i2c_adapter *i2c; |
43 | void (*release_chain)(struct dvb_frontend* fe); | ||
44 | }; | 43 | }; |
45 | 44 | ||
46 | static int lnbp21_set_voltage(struct dvb_frontend *fe, fe_sec_voltage_t voltage) | 45 | static int lnbp21_set_voltage(struct dvb_frontend *fe, fe_sec_voltage_t voltage) |
47 | { | 46 | { |
48 | struct lnbp21 *lnbp21 = (struct lnbp21 *) fe->misc_priv; | 47 | struct lnbp21 *lnbp21 = (struct lnbp21 *) fe->sec_priv; |
49 | struct i2c_msg msg = { .addr = 0x08, .flags = 0, | 48 | struct i2c_msg msg = { .addr = 0x08, .flags = 0, |
50 | .buf = &lnbp21->config, | 49 | .buf = &lnbp21->config, |
51 | .len = sizeof(lnbp21->config) }; | 50 | .len = sizeof(lnbp21->config) }; |
@@ -73,7 +72,7 @@ static int lnbp21_set_voltage(struct dvb_frontend *fe, fe_sec_voltage_t voltage) | |||
73 | 72 | ||
74 | static int lnbp21_enable_high_lnb_voltage(struct dvb_frontend *fe, long arg) | 73 | static int lnbp21_enable_high_lnb_voltage(struct dvb_frontend *fe, long arg) |
75 | { | 74 | { |
76 | struct lnbp21 *lnbp21 = (struct lnbp21 *) fe->misc_priv; | 75 | struct lnbp21 *lnbp21 = (struct lnbp21 *) fe->sec_priv; |
77 | struct i2c_msg msg = { .addr = 0x08, .flags = 0, | 76 | struct i2c_msg msg = { .addr = 0x08, .flags = 0, |
78 | .buf = &lnbp21->config, | 77 | .buf = &lnbp21->config, |
79 | .len = sizeof(lnbp21->config) }; | 78 | .len = sizeof(lnbp21->config) }; |
@@ -91,29 +90,24 @@ static int lnbp21_enable_high_lnb_voltage(struct dvb_frontend *fe, long arg) | |||
91 | 90 | ||
92 | static void lnbp21_release(struct dvb_frontend *fe) | 91 | static void lnbp21_release(struct dvb_frontend *fe) |
93 | { | 92 | { |
94 | struct lnbp21 *lnbp21 = (struct lnbp21 *) fe->misc_priv; | ||
95 | |||
96 | /* LNBP power off */ | 93 | /* LNBP power off */ |
97 | lnbp21_set_voltage(fe, SEC_VOLTAGE_OFF); | 94 | lnbp21_set_voltage(fe, SEC_VOLTAGE_OFF); |
98 | 95 | ||
99 | /* free data & call next release routine */ | 96 | /* free data */ |
100 | fe->ops.release = lnbp21->release_chain; | 97 | kfree(fe->sec_priv); |
101 | kfree(fe->misc_priv); | 98 | fe->sec_priv = NULL; |
102 | fe->misc_priv = NULL; | ||
103 | if (fe->ops.release) | ||
104 | fe->ops.release(fe); | ||
105 | } | 99 | } |
106 | 100 | ||
107 | int lnbp21_attach(struct dvb_frontend *fe, struct i2c_adapter *i2c, u8 override_set, u8 override_clear) | 101 | struct dvb_frontend *lnbp21_attach(struct dvb_frontend *fe, struct i2c_adapter *i2c, u8 override_set, u8 override_clear) |
108 | { | 102 | { |
109 | struct lnbp21 *lnbp21 = kmalloc(sizeof(struct lnbp21), GFP_KERNEL); | 103 | struct lnbp21 *lnbp21 = kmalloc(sizeof(struct lnbp21), GFP_KERNEL); |
110 | if (!lnbp21) | 104 | if (!lnbp21) |
111 | return -ENOMEM; | 105 | return NULL; |
112 | 106 | ||
113 | /* default configuration */ | 107 | /* default configuration */ |
114 | lnbp21->config = LNBP21_ISEL; | 108 | lnbp21->config = LNBP21_ISEL; |
115 | lnbp21->i2c = i2c; | 109 | lnbp21->i2c = i2c; |
116 | fe->misc_priv = lnbp21; | 110 | fe->sec_priv = lnbp21; |
117 | 111 | ||
118 | /* bits which should be forced to '1' */ | 112 | /* bits which should be forced to '1' */ |
119 | lnbp21->override_or = override_set; | 113 | lnbp21->override_or = override_set; |
@@ -124,19 +118,17 @@ int lnbp21_attach(struct dvb_frontend *fe, struct i2c_adapter *i2c, u8 override_ | |||
124 | /* detect if it is present or not */ | 118 | /* detect if it is present or not */ |
125 | if (lnbp21_set_voltage(fe, SEC_VOLTAGE_OFF)) { | 119 | if (lnbp21_set_voltage(fe, SEC_VOLTAGE_OFF)) { |
126 | kfree(lnbp21); | 120 | kfree(lnbp21); |
127 | fe->misc_priv = NULL; | 121 | return NULL; |
128 | return -EIO; | ||
129 | } | 122 | } |
130 | 123 | ||
131 | /* install release callback */ | 124 | /* install release callback */ |
132 | lnbp21->release_chain = fe->ops.release; | ||
133 | fe->ops.release = lnbp21_release; | 125 | fe->ops.release = lnbp21_release; |
134 | 126 | ||
135 | /* override frontend ops */ | 127 | /* override frontend ops */ |
136 | fe->ops.set_voltage = lnbp21_set_voltage; | 128 | fe->ops.set_voltage = lnbp21_set_voltage; |
137 | fe->ops.enable_high_lnb_voltage = lnbp21_enable_high_lnb_voltage; | 129 | fe->ops.enable_high_lnb_voltage = lnbp21_enable_high_lnb_voltage; |
138 | 130 | ||
139 | return 0; | 131 | return fe; |
140 | } | 132 | } |
141 | EXPORT_SYMBOL(lnbp21_attach); | 133 | EXPORT_SYMBOL(lnbp21_attach); |
142 | 134 | ||
diff --git a/drivers/media/dvb/frontends/lnbp21.h b/drivers/media/dvb/frontends/lnbp21.h index 047a4ab68c01..8c2df67d81ee 100644 --- a/drivers/media/dvb/frontends/lnbp21.h +++ b/drivers/media/dvb/frontends/lnbp21.h | |||
@@ -40,6 +40,6 @@ | |||
40 | #include <linux/dvb/frontend.h> | 40 | #include <linux/dvb/frontend.h> |
41 | 41 | ||
42 | /* override_set and override_clear control which system register bits (above) to always set & clear */ | 42 | /* override_set and override_clear control which system register bits (above) to always set & clear */ |
43 | extern int lnbp21_attach(struct dvb_frontend *fe, struct i2c_adapter *i2c, u8 override_set, u8 override_clear); | 43 | extern struct dvb_frontend *lnbp21_attach(struct dvb_frontend *fe, struct i2c_adapter *i2c, u8 override_set, u8 override_clear); |
44 | 44 | ||
45 | #endif | 45 | #endif |
diff --git a/drivers/media/dvb/ttpci/av7110.c b/drivers/media/dvb/ttpci/av7110.c index 4506165c5de2..fa0bed6779b5 100644 --- a/drivers/media/dvb/ttpci/av7110.c +++ b/drivers/media/dvb/ttpci/av7110.c | |||
@@ -2219,7 +2219,7 @@ static int frontend_init(struct av7110 *av7110) | |||
2219 | av7110->fe->ops.tuner_ops.set_params = alps_bsbe1_tuner_set_params; | 2219 | av7110->fe->ops.tuner_ops.set_params = alps_bsbe1_tuner_set_params; |
2220 | av7110->fe->tuner_priv = &av7110->i2c_adap; | 2220 | av7110->fe->tuner_priv = &av7110->i2c_adap; |
2221 | 2221 | ||
2222 | if (lnbp21_attach(av7110->fe, &av7110->i2c_adap, 0, 0)) { | 2222 | if (lnbp21_attach(av7110->fe, &av7110->i2c_adap, 0, 0) == NULL) { |
2223 | printk("dvb-ttpci: LNBP21 not found!\n"); | 2223 | printk("dvb-ttpci: LNBP21 not found!\n"); |
2224 | if (av7110->fe->ops.release) | 2224 | if (av7110->fe->ops.release) |
2225 | av7110->fe->ops.release(av7110->fe); | 2225 | av7110->fe->ops.release(av7110->fe); |
diff --git a/drivers/media/dvb/ttpci/budget-ci.c b/drivers/media/dvb/ttpci/budget-ci.c index ffbbb3e34be4..3d9a8db61f1f 100644 --- a/drivers/media/dvb/ttpci/budget-ci.c +++ b/drivers/media/dvb/ttpci/budget-ci.c | |||
@@ -1044,7 +1044,7 @@ static void frontend_init(struct budget_ci *budget_ci) | |||
1044 | budget_ci->budget.dvb_frontend->tuner_priv = &budget_ci->budget.i2c_adap; | 1044 | budget_ci->budget.dvb_frontend->tuner_priv = &budget_ci->budget.i2c_adap; |
1045 | 1045 | ||
1046 | budget_ci->budget.dvb_frontend->ops.dishnetwork_send_legacy_command = NULL; | 1046 | budget_ci->budget.dvb_frontend->ops.dishnetwork_send_legacy_command = NULL; |
1047 | if (lnbp21_attach(budget_ci->budget.dvb_frontend, &budget_ci->budget.i2c_adap, LNBP21_LLC, 0)) { | 1047 | if (lnbp21_attach(budget_ci->budget.dvb_frontend, &budget_ci->budget.i2c_adap, LNBP21_LLC, 0) == NULL) { |
1048 | printk("%s: No LNBP21 found!\n", __FUNCTION__); | 1048 | printk("%s: No LNBP21 found!\n", __FUNCTION__); |
1049 | if (budget_ci->budget.dvb_frontend->ops.release) | 1049 | if (budget_ci->budget.dvb_frontend->ops.release) |
1050 | budget_ci->budget.dvb_frontend->ops.release(budget_ci->budget.dvb_frontend); | 1050 | budget_ci->budget.dvb_frontend->ops.release(budget_ci->budget.dvb_frontend); |
diff --git a/drivers/media/dvb/ttpci/budget.c b/drivers/media/dvb/ttpci/budget.c index 863dffb4ed8e..c21ee5a05fe8 100644 --- a/drivers/media/dvb/ttpci/budget.c +++ b/drivers/media/dvb/ttpci/budget.c | |||
@@ -420,7 +420,7 @@ static void frontend_init(struct budget *budget) | |||
420 | budget->dvb_frontend = s5h1420_attach(&s5h1420_config, &budget->i2c_adap); | 420 | budget->dvb_frontend = s5h1420_attach(&s5h1420_config, &budget->i2c_adap); |
421 | if (budget->dvb_frontend) { | 421 | if (budget->dvb_frontend) { |
422 | budget->dvb_frontend->ops.tuner_ops.set_params = s5h1420_tuner_set_params; | 422 | budget->dvb_frontend->ops.tuner_ops.set_params = s5h1420_tuner_set_params; |
423 | if (lnbp21_attach(budget->dvb_frontend, &budget->i2c_adap, 0, 0)) { | 423 | if (lnbp21_attach(budget->dvb_frontend, &budget->i2c_adap, 0, 0) == NULL) { |
424 | printk("%s: No LNBP21 found!\n", __FUNCTION__); | 424 | printk("%s: No LNBP21 found!\n", __FUNCTION__); |
425 | goto error_out; | 425 | goto error_out; |
426 | } | 426 | } |