aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthias Schwarzott <zzam@gentoo.org>2016-07-26 03:09:05 -0400
committerMauro Carvalho Chehab <mchehab@s-opensource.com>2016-09-22 11:55:08 -0400
commit773028fefcede683f68d138e5ead3d2e96b32387 (patch)
treeeacc01ba6c09944f01797dd7dcb7ae4235e09fd6
parentd28d7f852ee4028e41932891e55664abe75f00de (diff)
[media] cx231xx: attach si2165 driver via i2c_client
Use new style attach. Signed-off-by: Matthias Schwarzott <zzam@gentoo.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
-rw-r--r--drivers/media/usb/cx231xx/cx231xx-dvb.c73
1 files changed, 48 insertions, 25 deletions
diff --git a/drivers/media/usb/cx231xx/cx231xx-dvb.c b/drivers/media/usb/cx231xx/cx231xx-dvb.c
index f03034588343..1417515d30eb 100644
--- a/drivers/media/usb/cx231xx/cx231xx-dvb.c
+++ b/drivers/media/usb/cx231xx/cx231xx-dvb.c
@@ -151,18 +151,6 @@ static struct tda18271_config pv_tda18271_config = {
151 .small_i2c = TDA18271_03_BYTE_CHUNK_INIT, 151 .small_i2c = TDA18271_03_BYTE_CHUNK_INIT,
152}; 152};
153 153
154static const struct si2165_config hauppauge_930C_HD_1113xx_si2165_config = {
155 .i2c_addr = 0x64,
156 .chip_mode = SI2165_MODE_PLL_XTAL,
157 .ref_freq_Hz = 16000000,
158};
159
160static const struct si2165_config pctv_quatro_stick_1114xx_si2165_config = {
161 .i2c_addr = 0x64,
162 .chip_mode = SI2165_MODE_PLL_EXT,
163 .ref_freq_Hz = 24000000,
164};
165
166static struct lgdt3306a_config hauppauge_955q_lgdt3306a_config = { 154static struct lgdt3306a_config hauppauge_955q_lgdt3306a_config = {
167 .i2c_addr = 0x59, 155 .i2c_addr = 0x59,
168 .qam_if_khz = 4000, 156 .qam_if_khz = 4000,
@@ -756,19 +744,38 @@ static int dvb_init(struct cx231xx *dev)
756 break; 744 break;
757 745
758 case CX231XX_BOARD_HAUPPAUGE_930C_HD_1113xx: 746 case CX231XX_BOARD_HAUPPAUGE_930C_HD_1113xx:
747 {
748 struct i2c_client *client;
749 struct i2c_board_info info;
750 struct si2165_platform_data si2165_pdata;
759 751
760 dev->dvb->frontend = dvb_attach(si2165_attach, 752 /* attach demod */
761 &hauppauge_930C_HD_1113xx_si2165_config, 753 memset(&si2165_pdata, 0, sizeof(si2165_pdata));
762 demod_i2c 754 si2165_pdata.fe = &dev->dvb->frontend;
763 ); 755 si2165_pdata.chip_mode = SI2165_MODE_PLL_XTAL,
756 si2165_pdata.ref_freq_Hz = 16000000,
764 757
765 if (dev->dvb->frontend == NULL) { 758 memset(&info, 0, sizeof(struct i2c_board_info));
759 strlcpy(info.type, "si2165", I2C_NAME_SIZE);
760 info.addr = 0x64;
761 info.platform_data = &si2165_pdata;
762 request_module(info.type);
763 client = i2c_new_device(demod_i2c, &info);
764 if (client == NULL || client->dev.driver == NULL || dev->dvb->frontend == NULL) {
766 dev_err(dev->dev, 765 dev_err(dev->dev,
767 "Failed to attach SI2165 front end\n"); 766 "Failed to attach SI2165 front end\n");
768 result = -EINVAL; 767 result = -EINVAL;
769 goto out_free; 768 goto out_free;
770 } 769 }
771 770
771 if (!try_module_get(client->dev.driver->owner)) {
772 i2c_unregister_device(client);
773 result = -ENODEV;
774 goto out_free;
775 }
776
777 dvb->i2c_client_demod = client;
778
772 dev->dvb->frontend->ops.i2c_gate_ctrl = NULL; 779 dev->dvb->frontend->ops.i2c_gate_ctrl = NULL;
773 780
774 /* define general-purpose callback pointer */ 781 /* define general-purpose callback pointer */
@@ -781,27 +788,43 @@ static int dvb_init(struct cx231xx *dev)
781 788
782 dev->cx231xx_reset_analog_tuner = NULL; 789 dev->cx231xx_reset_analog_tuner = NULL;
783 break; 790 break;
784 791 }
785 case CX231XX_BOARD_HAUPPAUGE_930C_HD_1114xx: 792 case CX231XX_BOARD_HAUPPAUGE_930C_HD_1114xx:
786 { 793 {
787 struct i2c_client *client; 794 struct i2c_client *client;
788 struct i2c_board_info info; 795 struct i2c_board_info info;
796 struct si2165_platform_data si2165_pdata;
789 struct si2157_config si2157_config; 797 struct si2157_config si2157_config;
790 798
791 memset(&info, 0, sizeof(struct i2c_board_info)); 799 /* attach demod */
800 memset(&si2165_pdata, 0, sizeof(si2165_pdata));
801 si2165_pdata.fe = &dev->dvb->frontend;
802 si2165_pdata.chip_mode = SI2165_MODE_PLL_EXT,
803 si2165_pdata.ref_freq_Hz = 24000000,
792 804
793 dev->dvb->frontend = dvb_attach(si2165_attach, 805 memset(&info, 0, sizeof(struct i2c_board_info));
794 &pctv_quatro_stick_1114xx_si2165_config, 806 strlcpy(info.type, "si2165", I2C_NAME_SIZE);
795 demod_i2c 807 info.addr = 0x64;
796 ); 808 info.platform_data = &si2165_pdata;
797 809 request_module(info.type);
798 if (dev->dvb->frontend == NULL) { 810 client = i2c_new_device(demod_i2c, &info);
811 if (client == NULL || client->dev.driver == NULL || dev->dvb->frontend == NULL) {
799 dev_err(dev->dev, 812 dev_err(dev->dev,
800 "Failed to attach SI2165 front end\n"); 813 "Failed to attach SI2165 front end\n");
801 result = -EINVAL; 814 result = -EINVAL;
802 goto out_free; 815 goto out_free;
803 } 816 }
804 817
818 if (!try_module_get(client->dev.driver->owner)) {
819 i2c_unregister_device(client);
820 result = -ENODEV;
821 goto out_free;
822 }
823
824 dvb->i2c_client_demod = client;
825
826 memset(&info, 0, sizeof(struct i2c_board_info));
827
805 dev->dvb->frontend->ops.i2c_gate_ctrl = NULL; 828 dev->dvb->frontend->ops.i2c_gate_ctrl = NULL;
806 829
807 /* define general-purpose callback pointer */ 830 /* define general-purpose callback pointer */