]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
[media] cx23885: add i2c client handling into dvb_unregister and state
authorOlli Salonen <olli.salonen@iki.fi>
Mon, 11 Aug 2014 19:58:13 +0000 (16:58 -0300)
committerMauro Carvalho Chehab <mchehab@osg.samsung.com>
Wed, 24 Sep 2014 00:30:24 +0000 (21:30 -0300)
Prepare cx23885 driver for handling I2C client that is needed for certain demodulators and tuners (for example Si2168 and Si2157). I2C client for tuner and demod stored in state and unregistering of the I2C devices added into dvb_unregister.

Signed-off-by: Olli Salonen <olli.salonen@iki.fi>
Reviewed-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
drivers/media/pci/cx23885/cx23885-dvb.c
drivers/media/pci/cx23885/cx23885.h

index 332e6facc095d126cf2b98b0aec727bb9fddade7..3e72c95a1d599e0d826b023349f7fecc490577e4 100644 (file)
@@ -1688,15 +1688,24 @@ int cx23885_dvb_register(struct cx23885_tsport *port)
 int cx23885_dvb_unregister(struct cx23885_tsport *port)
 {
        struct vb2_dvb_frontend *fe0;
+       struct i2c_client *client;
+
+       /* remove I2C client for tuner */
+       client = port->i2c_client_tuner;
+       if (client) {
+               module_put(client->dev.driver->owner);
+               i2c_unregister_device(client);
+       }
+
+       /* remove I2C client for demodulator */
+       client = port->i2c_client_demod;
+       if (client) {
+               module_put(client->dev.driver->owner);
+               i2c_unregister_device(client);
+       }
 
-       /* FIXME: in an error condition where the we have
-        * an expected number of frontends (attach problem)
-        * then this might not clean up correctly, if 1
-        * is invalid.
-        * This comment only applies to future boards IF they
-        * implement MFE support.
-        */
        fe0 = vb2_dvb_get_frontend(&port->frontends, 1);
+
        if (fe0 && fe0->dvb.frontend)
                vb2_dvb_unregister_bus(&port->frontends);
 
index 39a89855d1d56e5de590a47a6ec2d036d51b087c..458d180cf96d5e8c99cfdbcf1bf278655e9f6219 100644 (file)
@@ -293,6 +293,9 @@ struct cx23885_tsport {
        /* Workaround for a temp dvb_frontend that the tuner can attached to */
        struct dvb_frontend analog_fe;
 
+       struct i2c_client *i2c_client_demod;
+       struct i2c_client *i2c_client_tuner;
+
        int (*set_frontend)(struct dvb_frontend *fe);
 };