Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[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>

authored by

Matthias Schwarzott and committed by
Mauro Carvalho Chehab
773028fe d28d7f85

+48 -25
+48 -25
drivers/media/usb/cx231xx/cx231xx-dvb.c
··· 151 151 .small_i2c = TDA18271_03_BYTE_CHUNK_INIT, 152 152 }; 153 153 154 - static 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 - 160 - static 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 - 166 154 static struct lgdt3306a_config hauppauge_955q_lgdt3306a_config = { 167 155 .i2c_addr = 0x59, 168 156 .qam_if_khz = 4000, ··· 744 756 break; 745 757 746 758 case CX231XX_BOARD_HAUPPAUGE_930C_HD_1113xx: 759 + { 760 + struct i2c_client *client; 761 + struct i2c_board_info info; 762 + struct si2165_platform_data si2165_pdata; 747 763 748 - dev->dvb->frontend = dvb_attach(si2165_attach, 749 - &hauppauge_930C_HD_1113xx_si2165_config, 750 - demod_i2c 751 - ); 764 + /* attach demod */ 765 + memset(&si2165_pdata, 0, sizeof(si2165_pdata)); 766 + si2165_pdata.fe = &dev->dvb->frontend; 767 + si2165_pdata.chip_mode = SI2165_MODE_PLL_XTAL, 768 + si2165_pdata.ref_freq_Hz = 16000000, 752 769 753 - if (dev->dvb->frontend == NULL) { 770 + memset(&info, 0, sizeof(struct i2c_board_info)); 771 + strlcpy(info.type, "si2165", I2C_NAME_SIZE); 772 + info.addr = 0x64; 773 + info.platform_data = &si2165_pdata; 774 + request_module(info.type); 775 + client = i2c_new_device(demod_i2c, &info); 776 + if (client == NULL || client->dev.driver == NULL || dev->dvb->frontend == NULL) { 754 777 dev_err(dev->dev, 755 778 "Failed to attach SI2165 front end\n"); 756 779 result = -EINVAL; 757 780 goto out_free; 758 781 } 782 + 783 + if (!try_module_get(client->dev.driver->owner)) { 784 + i2c_unregister_device(client); 785 + result = -ENODEV; 786 + goto out_free; 787 + } 788 + 789 + dvb->i2c_client_demod = client; 759 790 760 791 dev->dvb->frontend->ops.i2c_gate_ctrl = NULL; 761 792 ··· 788 781 789 782 dev->cx231xx_reset_analog_tuner = NULL; 790 783 break; 791 - 784 + } 792 785 case CX231XX_BOARD_HAUPPAUGE_930C_HD_1114xx: 793 786 { 794 787 struct i2c_client *client; 795 788 struct i2c_board_info info; 789 + struct si2165_platform_data si2165_pdata; 796 790 struct si2157_config si2157_config; 797 791 792 + /* attach demod */ 793 + memset(&si2165_pdata, 0, sizeof(si2165_pdata)); 794 + si2165_pdata.fe = &dev->dvb->frontend; 795 + si2165_pdata.chip_mode = SI2165_MODE_PLL_EXT, 796 + si2165_pdata.ref_freq_Hz = 24000000, 797 + 798 798 memset(&info, 0, sizeof(struct i2c_board_info)); 799 - 800 - dev->dvb->frontend = dvb_attach(si2165_attach, 801 - &pctv_quatro_stick_1114xx_si2165_config, 802 - demod_i2c 803 - ); 804 - 805 - if (dev->dvb->frontend == NULL) { 799 + strlcpy(info.type, "si2165", I2C_NAME_SIZE); 800 + info.addr = 0x64; 801 + info.platform_data = &si2165_pdata; 802 + request_module(info.type); 803 + client = i2c_new_device(demod_i2c, &info); 804 + if (client == NULL || client->dev.driver == NULL || dev->dvb->frontend == NULL) { 806 805 dev_err(dev->dev, 807 806 "Failed to attach SI2165 front end\n"); 808 807 result = -EINVAL; 809 808 goto out_free; 810 809 } 810 + 811 + if (!try_module_get(client->dev.driver->owner)) { 812 + i2c_unregister_device(client); 813 + result = -ENODEV; 814 + goto out_free; 815 + } 816 + 817 + dvb->i2c_client_demod = client; 818 + 819 + memset(&info, 0, sizeof(struct i2c_board_info)); 811 820 812 821 dev->dvb->frontend->ops.i2c_gate_ctrl = NULL; 813 822