media: pvrusb2: Add i2c client demod/tuner support
authorBrad Love <brad@nextdimension.cc>
Thu, 20 Dec 2018 20:14:25 +0000 (15:14 -0500)
committerMauro Carvalho Chehab <mchehab+samsung@kernel.org>
Thu, 13 Jun 2019 18:29:37 +0000 (14:29 -0400)
i2c client device is the "new" method to attach to dvb modules, include
support for this functionality. Cleanup code has been added to init in
case of failure, as well as to frontend exit.

Required by Hauppauge HVR-1975

Signed-off-by: Brad Love <brad@nextdimension.cc>
Reviewed-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
drivers/media/usb/pvrusb2/pvrusb2-dvb.c
drivers/media/usb/pvrusb2/pvrusb2-dvb.h

index f302f1e..7f5df5c 100644 (file)
@@ -404,6 +404,9 @@ fail_tuner:
 fail_frontend0:
        dvb_frontend_detach(adap->fe[0]);
        adap->fe[0] = NULL;
+       dvb_module_release(adap->i2c_client_tuner);
+       dvb_module_release(adap->i2c_client_demod[1]);
+       dvb_module_release(adap->i2c_client_demod[0]);
 
        return ret;
 }
@@ -420,6 +423,14 @@ static int pvr2_dvb_frontend_exit(struct pvr2_dvb_adapter *adap)
                dvb_frontend_detach(adap->fe[0]);
                adap->fe[0] = NULL;
        }
+
+       dvb_module_release(adap->i2c_client_tuner);
+       adap->i2c_client_tuner = NULL;
+       dvb_module_release(adap->i2c_client_demod[1]);
+       adap->i2c_client_demod[1] = NULL;
+       dvb_module_release(adap->i2c_client_demod[0]);
+       adap->i2c_client_demod[0] = NULL;
+
        return 0;
 }
 
index 91bff57..c0b27f5 100644 (file)
@@ -20,6 +20,9 @@ struct pvr2_dvb_adapter {
        struct dvb_net          dvb_net;
        struct dvb_frontend     *fe[2];
 
+       struct i2c_client       *i2c_client_demod[2];
+       struct i2c_client       *i2c_client_tuner;
+
        int                     feedcount;
        int                     max_feed_count;