summaryrefslogtreecommitdiffstats
path: root/drivers/media/usb
diff options
context:
space:
mode:
authorOlli Salonen <olli.salonen@iki.fi>2015-03-16 14:14:05 -0300
committerMauro Carvalho Chehab <mchehab@osg.samsung.com>2015-04-02 22:24:01 -0300
commit70769b24d2973428907de3429dd2a5792e4ce317 (patch)
treebb43f7654d3592f075a8a56bfc3b111c63db3c35 /drivers/media/usb
parent2c4ffe27d0a45b50ee1c7ed4da37409098483fcd (diff)
downloadop-kernel-dev-70769b24d2973428907de3429dd2a5792e4ce317.zip
op-kernel-dev-70769b24d2973428907de3429dd2a5792e4ce317.tar.gz
[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>
Diffstat (limited to 'drivers/media/usb')
-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 c68a610..f7dd973 100644
--- a/drivers/media/usb/dvb-usb/dw2102.c
+++ b/drivers/media/usb/dvb-usb/dw2102.c
@@ -114,6 +114,7 @@
struct dw2102_state {
u8 initialized;
+ struct i2c_client *i2c_client_tuner;
int (*old_set_voltage)(struct dvb_frontend *f, fe_sec_voltage_t v);
};
@@ -2138,10 +2139,26 @@ static int dw2102_probe(struct usb_interface *intf,
return -ENODEV;
}
+static void dw2102_disconnect(struct usb_interface *intf)
+{
+ struct dvb_usb_device *d = usb_get_intfdata(intf);
+ struct dw2102_state *st = (struct dw2102_state *)d->priv;
+ struct i2c_client *client;
+
+ /* remove I2C client for tuner */
+ client = st->i2c_client_tuner;
+ if (client) {
+ module_put(client->dev.driver->owner);
+ i2c_unregister_device(client);
+ }
+
+ dvb_usb_device_exit(intf);
+}
+
static struct usb_driver dw2102_driver = {
.name = "dw2102",
.probe = dw2102_probe,
- .disconnect = dvb_usb_device_exit,
+ .disconnect = dw2102_disconnect,
.id_table = dw2102_table,
};
OpenPOWER on IntegriCloud