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

[media] rtl28xxu: bind tua9001 using I2C binding

Change tua9001 driver from media binding to I2C client binding.

Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>

authored by

Antti Palosaari and committed by
Mauro Carvalho Chehab
88ffe55a b6c5fe70

+19 -8
+19 -8
drivers/media/usb/dvb-usb-v2/rtl28xxu.c
··· 1100 1100 return ret; 1101 1101 } 1102 1102 1103 - static struct tua9001_config rtl2832u_tua9001_config = { 1104 - .i2c_addr = 0x60, 1105 - }; 1106 - 1107 1103 static const struct fc0012_config rtl2832u_fc0012_config = { 1108 1104 .i2c_address = 0x63, /* 0xc6 >> 1 */ 1109 1105 .xtal_freq = FC_XTAL_28_8_MHZ, ··· 1199 1203 dev->i2c_client_tuner = client; 1200 1204 } 1201 1205 break; 1202 - case TUNER_RTL2832_TUA9001: 1206 + case TUNER_RTL2832_TUA9001: { 1207 + struct tua9001_platform_data tua9001_pdata = { 1208 + .dvb_frontend = adap->fe[0], 1209 + }; 1210 + struct i2c_board_info board_info = {}; 1211 + 1203 1212 /* enable GPIO1 and GPIO4 as output */ 1204 1213 ret = rtl28xxu_wr_reg_mask(d, SYS_GPIO_DIR, 0x00, 0x12); 1205 1214 if (ret) ··· 1214 1213 if (ret) 1215 1214 goto err; 1216 1215 1217 - fe = dvb_attach(tua9001_attach, adap->fe[0], 1218 - dev->demod_i2c_adapter, 1219 - &rtl2832u_tua9001_config); 1216 + strlcpy(board_info.type, "tua9001", I2C_NAME_SIZE); 1217 + board_info.addr = 0x60; 1218 + board_info.platform_data = &tua9001_pdata; 1219 + request_module("tua9001"); 1220 + client = i2c_new_device(dev->demod_i2c_adapter, &board_info); 1221 + if (client == NULL || client->dev.driver == NULL) 1222 + break; 1223 + if (!try_module_get(client->dev.driver->owner)) { 1224 + i2c_unregister_device(client); 1225 + break; 1226 + } 1227 + dev->i2c_client_tuner = client; 1220 1228 break; 1229 + } 1221 1230 case TUNER_RTL2832_R820T: 1222 1231 fe = dvb_attach(r820t_attach, adap->fe[0], 1223 1232 dev->demod_i2c_adapter,