aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOlli Salonen <olli.salonen@iki.fi>2015-03-16 13:14:05 -0400
committerMauro Carvalho Chehab <mchehab@osg.samsung.com>2015-04-02 21:24:01 -0400
commit70769b24d2973428907de3429dd2a5792e4ce317 (patch)
treebb43f7654d3592f075a8a56bfc3b111c63db3c35
parent2c4ffe27d0a45b50ee1c7ed4da37409098483fcd (diff)
[media] dw2102: store i2c client for tuner into dw2102_state
Prepare the dw2102 driver for tuner drivers that are implemented as I2C drivers (such as m88ts2022). The I2C client is stored in to the state and released at disconnect. Signed-off-by: Olli Salonen <olli.salonen@iki.fi> Signed-off-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
-rw-r--r--drivers/media/usb/dvb-usb/dw2102.c19
1 files changed, 18 insertions, 1 deletions
diff --git a/drivers/media/usb/dvb-usb/dw2102.c b/drivers/media/usb/dvb-usb/dw2102.c
index c68a610f9a2c..f7dd973e2c40 100644
--- a/drivers/media/usb/dvb-usb/dw2102.c
+++ b/drivers/media/usb/dvb-usb/dw2102.c
@@ -114,6 +114,7 @@
114 114
115struct dw2102_state { 115struct dw2102_state {
116 u8 initialized; 116 u8 initialized;
117 struct i2c_client *i2c_client_tuner;
117 int (*old_set_voltage)(struct dvb_frontend *f, fe_sec_voltage_t v); 118 int (*old_set_voltage)(struct dvb_frontend *f, fe_sec_voltage_t v);
118}; 119};
119 120
@@ -2138,10 +2139,26 @@ static int dw2102_probe(struct usb_interface *intf,
2138 return -ENODEV; 2139 return -ENODEV;
2139} 2140}
2140 2141
2142static void dw2102_disconnect(struct usb_interface *intf)
2143{
2144 struct dvb_usb_device *d = usb_get_intfdata(intf);
2145 struct dw2102_state *st = (struct dw2102_state *)d->priv;
2146 struct i2c_client *client;
2147
2148 /* remove I2C client for tuner */
2149 client = st->i2c_client_tuner;
2150 if (client) {
2151 module_put(client->dev.driver->owner);
2152 i2c_unregister_device(client);
2153 }
2154
2155 dvb_usb_device_exit(intf);
2156}
2157
2141static struct usb_driver dw2102_driver = { 2158static struct usb_driver dw2102_driver = {
2142 .name = "dw2102", 2159 .name = "dw2102",
2143 .probe = dw2102_probe, 2160 .probe = dw2102_probe,
2144 .disconnect = dvb_usb_device_exit, 2161 .disconnect = dw2102_disconnect,
2145 .id_table = dw2102_table, 2162 .id_table = dw2102_table,
2146}; 2163};
2147 2164