diff options
author | Antti Palosaari <crope@iki.fi> | 2014-12-02 09:00:23 -0500 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@osg.samsung.com> | 2015-01-27 07:57:18 -0500 |
commit | 83b2f84957373683164e3780d040b3c007e06b05 (patch) | |
tree | 16156db4a5683987d028d8c9e9638edd587e1b9a /drivers/media/usb | |
parent | c2c8386f825bebd383d78263d6d4757abd21d182 (diff) |
[media] rtl28xxu: switch rtl2832 demod attach to I2C binding
As rtl2832 driver support now I2C binding we will switch to that one.
Tested-by: Benjamin Larsson <benjamin@southpole.se>
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-v2/rtl28xxu.c | 29 | ||||
-rw-r--r-- | drivers/media/usb/dvb-usb-v2/rtl28xxu.h | 1 |
2 files changed, 27 insertions, 3 deletions
diff --git a/drivers/media/usb/dvb-usb-v2/rtl28xxu.c b/drivers/media/usb/dvb-usb-v2/rtl28xxu.c index 73580f8d5a17..21657341ce35 100644 --- a/drivers/media/usb/dvb-usb-v2/rtl28xxu.c +++ b/drivers/media/usb/dvb-usb-v2/rtl28xxu.c | |||
@@ -790,7 +790,10 @@ static int rtl2832u_frontend_attach(struct dvb_usb_adapter *adap) | |||
790 | int ret; | 790 | int ret; |
791 | struct dvb_usb_device *d = adap_to_d(adap); | 791 | struct dvb_usb_device *d = adap_to_d(adap); |
792 | struct rtl28xxu_priv *priv = d_to_priv(d); | 792 | struct rtl28xxu_priv *priv = d_to_priv(d); |
793 | struct rtl2832_platform_data platform_data; | ||
793 | const struct rtl2832_config *rtl2832_config; | 794 | const struct rtl2832_config *rtl2832_config; |
795 | struct i2c_board_info board_info = {}; | ||
796 | struct i2c_client *client; | ||
794 | 797 | ||
795 | dev_dbg(&d->udev->dev, "%s:\n", __func__); | 798 | dev_dbg(&d->udev->dev, "%s:\n", __func__); |
796 | 799 | ||
@@ -823,12 +826,26 @@ static int rtl2832u_frontend_attach(struct dvb_usb_adapter *adap) | |||
823 | } | 826 | } |
824 | 827 | ||
825 | /* attach demodulator */ | 828 | /* attach demodulator */ |
826 | adap->fe[0] = dvb_attach(rtl2832_attach, rtl2832_config, &d->i2c_adap); | 829 | platform_data.config = rtl2832_config; |
827 | if (!adap->fe[0]) { | 830 | platform_data.dvb_frontend = &adap->fe[0]; |
831 | strlcpy(board_info.type, "rtl2832", I2C_NAME_SIZE); | ||
832 | board_info.addr = 0x10; | ||
833 | board_info.platform_data = &platform_data; | ||
834 | request_module("%s", board_info.type); | ||
835 | client = i2c_new_device(&d->i2c_adap, &board_info); | ||
836 | if (client == NULL || client->dev.driver == NULL) { | ||
837 | ret = -ENODEV; | ||
838 | goto err; | ||
839 | } | ||
840 | |||
841 | if (!try_module_get(client->dev.driver->owner)) { | ||
842 | i2c_unregister_device(client); | ||
828 | ret = -ENODEV; | 843 | ret = -ENODEV; |
829 | goto err; | 844 | goto err; |
830 | } | 845 | } |
831 | 846 | ||
847 | priv->i2c_client_demod = client; | ||
848 | |||
832 | /* RTL2832 I2C repeater */ | 849 | /* RTL2832 I2C repeater */ |
833 | priv->demod_i2c_adapter = rtl2832_get_i2c_adapter(adap->fe[0]); | 850 | priv->demod_i2c_adapter = rtl2832_get_i2c_adapter(adap->fe[0]); |
834 | 851 | ||
@@ -837,7 +854,6 @@ static int rtl2832u_frontend_attach(struct dvb_usb_adapter *adap) | |||
837 | 854 | ||
838 | if (priv->slave_demod) { | 855 | if (priv->slave_demod) { |
839 | struct i2c_board_info info = {}; | 856 | struct i2c_board_info info = {}; |
840 | struct i2c_client *client; | ||
841 | 857 | ||
842 | /* | 858 | /* |
843 | * We continue on reduced mode, without DVB-T2/C, using master | 859 | * We continue on reduced mode, without DVB-T2/C, using master |
@@ -1190,6 +1206,13 @@ static void rtl28xxu_exit(struct dvb_usb_device *d) | |||
1190 | i2c_unregister_device(client); | 1206 | i2c_unregister_device(client); |
1191 | } | 1207 | } |
1192 | 1208 | ||
1209 | /* remove I2C demod */ | ||
1210 | client = priv->i2c_client_demod; | ||
1211 | if (client) { | ||
1212 | module_put(client->dev.driver->owner); | ||
1213 | i2c_unregister_device(client); | ||
1214 | } | ||
1215 | |||
1193 | return; | 1216 | return; |
1194 | } | 1217 | } |
1195 | 1218 | ||
diff --git a/drivers/media/usb/dvb-usb-v2/rtl28xxu.h b/drivers/media/usb/dvb-usb-v2/rtl28xxu.h index 3e3ea9d64a38..e52a2b731b92 100644 --- a/drivers/media/usb/dvb-usb-v2/rtl28xxu.h +++ b/drivers/media/usb/dvb-usb-v2/rtl28xxu.h | |||
@@ -57,6 +57,7 @@ struct rtl28xxu_priv { | |||
57 | u8 page; /* integrated demod active register page */ | 57 | u8 page; /* integrated demod active register page */ |
58 | struct i2c_adapter *demod_i2c_adapter; | 58 | struct i2c_adapter *demod_i2c_adapter; |
59 | bool rc_active; | 59 | bool rc_active; |
60 | struct i2c_client *i2c_client_demod; | ||
60 | struct i2c_client *i2c_client_tuner; | 61 | struct i2c_client *i2c_client_tuner; |
61 | struct i2c_client *i2c_client_slave_demod; | 62 | struct i2c_client *i2c_client_slave_demod; |
62 | #define SLAVE_DEMOD_NONE 0 | 63 | #define SLAVE_DEMOD_NONE 0 |