cx231xx: House cleaning
v2 cover cx231xx: House cleaning
Included in this patch set is:
- Bugfix for a device not working
- Some clean up and value corrections
- Conversion to new dvb i2c helpers
- Update of device from old dvb attach to i2c device
- Dependency fixes
- Style fixes
Changes since v1:
- Style fixes in i2c helper patch
- Some comment cleanup
- Hardware validation of analog tuning
Brad Love (9):
cx231xx: Fix several incorrect demod addresses
cx231xx: Use board profile values for addresses
cx231xx: Style fix for struct zero init
cx231xx: [bug] Ignore an i2c mux adapter
cx231xx: Switch to using new dvb i2c helpers
cx231xx: Update 955Q from dvb attach to i2c device
cx231xx: Remove unnecessary parameter clear
cx231xx: Remove RC_CORE dependency
cx231xx: Add I2C_MUX dependency
drivers/media/usb/cx231xx/Kconfig | 1 - drivers/media/usb/cx231xx/cx231xx-cards.c | 6 +- drivers/media/usb/cx231xx/cx231xx-dvb.c | 365 ++++++++---------------------- 3 files changed, 94 insertions(+), 278 deletions(-)
Signature · 1 line
2.7.4
PATCH v2 1/9 cx231xx: Fix several incorrect demod addresses
Now the board values match the hard coded
constants used in the dvb initialization.
--- drivers/media/usb/cx231xx/cx231xx-cards.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/media/usb/cx231xx/cx231xx-cards.c +3 -3
@@ -715,7 +715,7 @@ struct cx231xx_board cx231xx_boards[] = { .tuner_i2c_master = I2C_1_MUX_3, .demod_i2c_master = I2C_1_MUX_3, .has_dvb = 1, - .demod_addr = 0x0e, + .demod_addr = 0x64, /* 0xc8 >> 1 */ .norm = V4L2_STD_PAL, .input = {{
@@ -754,7 +754,7 @@ struct cx231xx_board cx231xx_boards[] = { .tuner_i2c_master = I2C_1_MUX_3, .demod_i2c_master = I2C_1_MUX_3, .has_dvb = 1, - .demod_addr = 0x0e, + .demod_addr = 0x64, /* 0xc8 >> 1 */ .norm = V4L2_STD_PAL, .input = {{
@@ -793,7 +793,7 @@ struct cx231xx_board cx231xx_boards[] = { .tuner_i2c_master = I2C_1_MUX_3, .demod_i2c_master = I2C_1_MUX_3, .has_dvb = 1, - .demod_addr = 0x0e, + .demod_addr = 0x59, /* 0xb2 >> 1 */ .norm = V4L2_STD_NTSC, .input = {{
Signature · 1 line
2.7.4
PATCH v2 2/9 cx231xx: Use board profile values for addresses
In reply to Brad LoveReplace all usage of hard coded values with
the proper field from the board profile.
--- drivers/media/usb/cx231xx/cx231xx-dvb.c | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-)
drivers/media/usb/cx231xx/cx231xx-dvb.c +9 -10
@@ -728,7 +728,7 @@ static int dvb_init(struct cx231xx *dev) dvb->frontend[0 ]->callback = cx231xx_tuner_callback;if (!dvb_attach (tda18271_attach, dev->dvb->frontend[0 ], -0x60 , tuner_i2c, + dev->board.tuner_addr, tuner_i2c, &cnxt_rde253s_tunerconfig)) { result = -EINVAL ; goto out_free;
@@ -752,7 +752,7 @@ static int dvb_init(struct cx231xx *dev) dvb->frontend[0 ]->callback = cx231xx_tuner_callback;if (!dvb_attach (tda18271_attach, dev->dvb->frontend[0 ], -0x60 , tuner_i2c, + dev->board.tuner_addr, tuner_i2c, &cnxt_rde253s_tunerconfig)) { result = -EINVAL ; goto out_free;
@@ -779,7 +779,7 @@ static int dvb_init(struct cx231xx *dev) dvb->frontend[0 ]->callback = cx231xx_tuner_callback;dvb_attach (tda18271_attach, dev->dvb->frontend[0 ], -0x60 , tuner_i2c, + dev->board.tuner_addr, tuner_i2c, &hcw_tda18271_config);break ;
@@ -797,7 +797,7 @@ static int dvb_init(struct cx231xx *dev)memset (&info,0 ,sizeof (struct i2c_board_info ));strlcpy (info.type,"si2165" ,I2C_NAME_SIZE ); - info.addr =0x64 ; + info.addr = dev->board.demod_addr; info.platform_data = &si2165_pdata;request_module (info.type); client =i2c_new_device (demod_i2c, &info);
@@ -822,8 +822,7 @@ static int dvb_init(struct cx231xx *dev) dvb->frontend[0 ]->callback = cx231xx_tuner_callback;dvb_attach (tda18271_attach, dev->dvb->frontend[0 ], -0x60 , - tuner_i2c, + dev->board.tuner_addr, tuner_i2c, &hcw_tda18271_config); dev->cx231xx_reset_analog_tuner =NULL ;
@@ -844,7 +843,7 @@ static int dvb_init(struct cx231xx *dev)memset (&info,0 ,sizeof (struct i2c_board_info ));strlcpy (info.type,"si2165" ,I2C_NAME_SIZE ); - info.addr =0x64 ; + info.addr = dev->board.demod_addr; info.platform_data = &si2165_pdata;request_module (info.type); client =i2c_new_device (demod_i2c, &info);
@@ -879,7 +878,7 @@ static int dvb_init(struct cx231xx *dev) si2157_config.if_port =1 ; si2157_config.inversion = true;strlcpy (info.type,"si2157" ,I2C_NAME_SIZE ); - info.addr =0x60 ; + info.addr = dev->board.tuner_addr; info.platform_data = &si2157_config;request_module ("si2157" );
@@ -938,7 +937,7 @@ static int dvb_init(struct cx231xx *dev) si2157_config.if_port =1 ; si2157_config.inversion = true;strlcpy (info.type,"si2157" ,I2C_NAME_SIZE ); - info.addr =0x60 ; + info.addr = dev->board.tuner_addr; info.platform_data = &si2157_config;request_module ("si2157" );
@@ -985,7 +984,7 @@ static int dvb_init(struct cx231xx *dev) dvb->frontend[0 ]->callback = cx231xx_tuner_callback;dvb_attach (tda18271_attach, dev->dvb->frontend[0 ], -0x60 , tuner_i2c, + dev->board.tuner_addr, tuner_i2c, &pv_tda18271_config);break ;
Signature · 1 line
2.7.4
PATCH v2 3/9 cx231xx: Style fix for struct zero init
In reply to Brad LoveReplace zero fill memset inits with
equivalent {} in declaration
--- drivers/media/usb/cx231xx/cx231xx-dvb.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-)
drivers/media/usb/cx231xx/cx231xx-dvb.c +4 -8
@@ -787,10 +787,9 @@ static int dvb_init(struct cx231xx *dev) {struct i2c_client *client;struct i2c_board_info info; -struct si2165_platform_data si2165_pdata; +struct si2165_platform_data si2165_pdata = {};/* attach demod */ -memset (&si2165_pdata,0 ,sizeof (si2165_pdata)); si2165_pdata.fe = &dev->dvb->frontend[0 ]; si2165_pdata.chip_mode =SI2165_MODE_PLL_XTAL ; si2165_pdata.ref_freq_hz =16000000 ;
@@ -832,11 +831,10 @@ static int dvb_init(struct cx231xx *dev) {struct i2c_client *client;struct i2c_board_info info; -struct si2165_platform_data si2165_pdata; -struct si2157_config si2157_config; +struct si2165_platform_data si2165_pdata = {}; +struct si2157_config si2157_config = {};/* attach demod */ -memset (&si2165_pdata,0 ,sizeof (si2165_pdata)); si2165_pdata.fe = &dev->dvb->frontend[0 ]; si2165_pdata.chip_mode =SI2165_MODE_PLL_EXT ; si2165_pdata.ref_freq_hz =24000000 ;
@@ -870,7 +868,6 @@ static int dvb_init(struct cx231xx *dev) dvb->frontend[0 ]->callback = cx231xx_tuner_callback;/* attach tuner */ -memset (&si2157_config,0 ,sizeof (si2157_config)); si2157_config.fe = dev->dvb->frontend[0 ];#ifdef CONFIG_MEDIA_CONTROLLER_DVB si2157_config.mdev = dev->media_dev;
@@ -907,7 +904,7 @@ static int dvb_init(struct cx231xx *dev) {struct i2c_client *client;struct i2c_board_info info; -struct si2157_config si2157_config; +struct si2157_config si2157_config = {};memset (&info,0 ,sizeof (struct i2c_board_info ));
@@ -929,7 +926,6 @@ static int dvb_init(struct cx231xx *dev) dvb->frontend[0 ]->callback = cx231xx_tuner_callback;/* attach tuner */ -memset (&si2157_config,0 ,sizeof (si2157_config)); si2157_config.fe = dev->dvb->frontend[0 ];#ifdef CONFIG_MEDIA_CONTROLLER_DVB si2157_config.mdev = dev->media_dev;
Signature · 1 line
2.7.4
PATCH v2 4/9 cx231xx: Ignore an i2c mux adapter
In reply to Brad LoveHauppauge 935C cannot communicate with the si2157 when using the mux adapter returned by the si2168, so disable it to fix the device.
--- drivers/media/usb/cx231xx/cx231xx-dvb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/usb/cx231xx/cx231xx-dvb.c +1 -1
@@ -1146,7 +1146,7 @@ static int dvb_init(struct cx231xx *dev) info.platform_data = &si2157_config;request_module ("si2157" ); - client =i2c_new_device (adapter, &info); + client =i2c_new_device (tuner_i2c, &info);if (client ==NULL || client->dev.driver ==NULL ) {module_put (dvb->i2c_client_demod[0 ]->dev.driver->owner);i2c_unregister_device (dvb->i2c_client_demod[0 ]);
Signature · 1 line
2.7.4
PATCH v2 5/9 cx231xx: Switch to using new dvb i2c helpers
In reply to Brad LoveMostly very straight forward replace of blocks with equivalent code.
Cleanup added at end of dvb_init in case of failure.
---
Changes since v1:
- Un-necessary NULL checks removed
- Pointers NULL'd after release
- 'tuner' removed from probe/init/attach comments
drivers/media/usb/cx231xx/cx231xx-dvb.c | 330 ++++++++------------------------ 1 file changed, 78 insertions(+), 252 deletions(-)
drivers/media/usb/cx231xx/cx231xx-dvb.c +78 -252
@@ -613,23 +613,15 @@ static void unregister_dvb(struct cx231xx_dvb *dvb)dvb_frontend_detach (dvb->frontend[1 ]);dvb_frontend_detach (dvb->frontend[0 ]);dvb_unregister_adapter (&dvb->adapter); +/* remove I2C tuner */ - client = dvb->i2c_client_tuner; -if (client) { -module_put (client->dev.driver->owner); -i2c_unregister_device (client); - } -/* remove I2C demod */ - client = dvb->i2c_client_demod[1 ]; -if (client) { -module_put (client->dev.driver->owner); -i2c_unregister_device (client); - } - client = dvb->i2c_client_demod[0 ]; -if (client) { -module_put (client->dev.driver->owner); -i2c_unregister_device (client); - } +dvb_module_release (dvb->i2c_client_tuner); + dvb->i2c_client_tuner =NULL ; +/* remove I2C demod(s) */ +dvb_module_release (dvb->i2c_client_demod[1 ]); + dvb->i2c_client_demod[1 ] =NULL ; +dvb_module_release (dvb->i2c_client_demod[0 ]); + dvb->i2c_client_demod[0 ] =NULL ; }static int dvb_init (struct cx231xx *dev)
@@ -638,6 +630,8 @@ static int dvb_init(struct cx231xx *dev)struct cx231xx_dvb *dvb;struct i2c_adapter *tuner_i2c;struct i2c_adapter *demod_i2c; +struct i2c_client *client; +struct i2c_adapter *adapter;if (!dev->board.has_dvb) {/* This device does not support the extension */
@@ -785,8 +779,6 @@ static int dvb_init(struct cx231xx *dev)case CX231XX_BOARD_HAUPPAUGE_930C_HD_1113xx: { -struct i2c_client *client; -struct i2c_board_info info;struct si2165_platform_data si2165_pdata = {};/* attach demod */
@@ -794,25 +786,14 @@ static int dvb_init(struct cx231xx *dev) si2165_pdata.chip_mode =SI2165_MODE_PLL_XTAL ; si2165_pdata.ref_freq_hz =16000000 ; -memset (&info,0 ,sizeof (struct i2c_board_info )); -strlcpy (info.type,"si2165" ,I2C_NAME_SIZE ); - info.addr = dev->board.demod_addr; - info.platform_data = &si2165_pdata; -request_module (info.type); - client =i2c_new_device (demod_i2c, &info); -if (!client || !client->dev.driver || !dev->dvb->frontend[0 ]) { -dev_err (dev->dev, -"Failed to attach SI2165 front end\n" ); - result = -EINVAL ; - goto out_free; - } - -if (!try_module_get (client->dev.driver->owner)) { -i2c_unregister_device (client); +/* perform probe/init/attach */ + client =dvb_module_probe ("si2165" ,NULL , demod_i2c, + dev->board.demod_addr, + &si2165_pdata); +if (!client) { result = -ENODEV ; goto out_free; } - dvb->i2c_client_demod[0 ] = client; dev->dvb->frontend[0 ]->ops.i2c_gate_ctrl =NULL ;
@@ -829,8 +810,6 @@ static int dvb_init(struct cx231xx *dev) }case CX231XX_BOARD_HAUPPAUGE_930C_HD_1114xx: { -struct i2c_client *client; -struct i2c_board_info info;struct si2165_platform_data si2165_pdata = {};struct si2157_config si2157_config = {};
@@ -839,29 +818,16 @@ static int dvb_init(struct cx231xx *dev) si2165_pdata.chip_mode =SI2165_MODE_PLL_EXT ; si2165_pdata.ref_freq_hz =24000000 ; -memset (&info,0 ,sizeof (struct i2c_board_info )); -strlcpy (info.type,"si2165" ,I2C_NAME_SIZE ); - info.addr = dev->board.demod_addr; - info.platform_data = &si2165_pdata; -request_module (info.type); - client =i2c_new_device (demod_i2c, &info); -if (!client || !client->dev.driver || !dev->dvb->frontend[0 ]) { -dev_err (dev->dev, -"Failed to attach SI2165 front end\n" ); - result = -EINVAL ; - goto out_free; - } - -if (!try_module_get (client->dev.driver->owner)) { -i2c_unregister_device (client); +/* perform probe/init/attach */ + client =dvb_module_probe ("si2165" ,NULL , demod_i2c, + dev->board.demod_addr, + &si2165_pdata); +if (!client) { result = -ENODEV ; goto out_free; } - dvb->i2c_client_demod[0 ] = client; -memset (&info,0 ,sizeof (struct i2c_board_info )); - dev->dvb->frontend[0 ]->ops.i2c_gate_ctrl =NULL ;/* define general-purpose callback pointer */
@@ -874,27 +840,15 @@ static int dvb_init(struct cx231xx *dev)#endif si2157_config.if_port =1 ; si2157_config.inversion = true; -strlcpy (info.type,"si2157" ,I2C_NAME_SIZE ); - info.addr = dev->board.tuner_addr; - info.platform_data = &si2157_config; -request_module ("si2157" ); - - client =i2c_new_device ( - tuner_i2c, - &info); -if (client ==NULL || client->dev.driver ==NULL ) { -dvb_frontend_detach (dev->dvb->frontend[0 ]); - result = -ENODEV ; - goto out_free; - } -if (!try_module_get (client->dev.driver->owner)) { -i2c_unregister_device (client); -dvb_frontend_detach (dev->dvb->frontend[0 ]); +/* perform probe/init/attach */ + client =dvb_module_probe ("si2157" ,NULL , tuner_i2c, + dev->board.tuner_addr, + &si2157_config); +if (!client) { result = -ENODEV ; goto out_free; } - dev->cx231xx_reset_analog_tuner =NULL ; dev->dvb->i2c_client_tuner = client;
@@ -902,12 +856,8 @@ static int dvb_init(struct cx231xx *dev) }case CX231XX_BOARD_HAUPPAUGE_955Q : { -struct i2c_client *client; -struct i2c_board_info info;struct si2157_config si2157_config = {}; -memset (&info,0 ,sizeof (struct i2c_board_info )); - dev->dvb->frontend[0 ] =dvb_attach (lgdt3306a_attach, &hauppauge_955q_lgdt3306a_config, demod_i2c
@@ -932,27 +882,15 @@ static int dvb_init(struct cx231xx *dev)#endif si2157_config.if_port =1 ; si2157_config.inversion = true; -strlcpy (info.type,"si2157" ,I2C_NAME_SIZE ); - info.addr = dev->board.tuner_addr; - info.platform_data = &si2157_config; -request_module ("si2157" ); - - client =i2c_new_device ( - tuner_i2c, - &info); -if (client ==NULL || client->dev.driver ==NULL ) { -dvb_frontend_detach (dev->dvb->frontend[0 ]); - result = -ENODEV ; - goto out_free; - } -if (!try_module_get (client->dev.driver->owner)) { -i2c_unregister_device (client); -dvb_frontend_detach (dev->dvb->frontend[0 ]); +/* perform probe/init/attach */ + client =dvb_module_probe ("si2157" ,NULL , tuner_i2c, + dev->board.tuner_addr, + &si2157_config); +if (!client) { result = -ENODEV ; goto out_free; } - dev->cx231xx_reset_analog_tuner =NULL ; dev->dvb->i2c_client_tuner = client;
@@ -988,9 +926,6 @@ static int dvb_init(struct cx231xx *dev) {struct si2157_config si2157_config = {};struct si2168_config si2168_config = {}; -struct i2c_board_info info = {}; -struct i2c_client *client; -struct i2c_adapter *adapter;/* attach demodulator chip */ si2168_config.ts_mode =SI2168_TS_SERIAL ;/* from *.inf file */
@@ -998,24 +933,14 @@ static int dvb_init(struct cx231xx *dev) si2168_config.i2c_adapter = &adapter; si2168_config.ts_clock_inv = true; -strlcpy (info.type,"si2168" ,sizeof (info.type)); - info.addr = dev->board.demod_addr; - info.platform_data = &si2168_config; - -request_module (info.type); - client =i2c_new_device (demod_i2c, &info); - -if (client ==NULL || client->dev.driver ==NULL ) { +/* perform probe/init/attach */ + client =dvb_module_probe ("si2168" ,NULL , demod_i2c, + dev->board.demod_addr, + &si2168_config); +if (!client) { result = -ENODEV ; goto out_free; } - -if (!try_module_get (client->dev.driver->owner)) { -i2c_unregister_device (client); - result = -ENODEV ; - goto out_free; - } - dvb->i2c_client_demod[0 ] = client;/* attach tuner chip */
@@ -1026,37 +951,20 @@ static int dvb_init(struct cx231xx *dev) si2157_config.if_port =1 ; si2157_config.inversion = false; -memset (&info,0 ,sizeof (info)); -strlcpy (info.type,"si2157" ,sizeof (info.type)); - info.addr = dev->board.tuner_addr; - info.platform_data = &si2157_config; - -request_module (info.type); - client =i2c_new_device (tuner_i2c, &info); - -if (client ==NULL || client->dev.driver ==NULL ) { -module_put (dvb->i2c_client_demod[0 ]->dev.driver->owner); -i2c_unregister_device (dvb->i2c_client_demod[0 ]); - result = -ENODEV ; - goto out_free; - } - -if (!try_module_get (client->dev.driver->owner)) { -i2c_unregister_device (client); -module_put (dvb->i2c_client_demod[0 ]->dev.driver->owner); -i2c_unregister_device (dvb->i2c_client_demod[0 ]); +/* perform probe/init/attach */ + client =dvb_module_probe ("si2157" ,NULL , tuner_i2c, + dev->board.tuner_addr, + &si2157_config); +if (!client) { result = -ENODEV ; goto out_free; } - dev->cx231xx_reset_analog_tuner =NULL ; dev->dvb->i2c_client_tuner = client;break ; }case CX231XX_BOARD_ASTROMETA_T2HYBRID : { -struct i2c_client *client; -struct i2c_board_info info = {};struct mn88473_config mn88473_config = {};/* attach demodulator chip */
@@ -1064,24 +972,14 @@ static int dvb_init(struct cx231xx *dev) mn88473_config.xtal =25000000 ; mn88473_config.fe = &dev->dvb->frontend[0 ]; -strlcpy (info.type,"mn88473" ,sizeof (info.type)); - info.addr = dev->board.demod_addr; - info.platform_data = &mn88473_config; - -request_module (info.type); - client =i2c_new_device (demod_i2c, &info); - -if (client ==NULL || client->dev.driver ==NULL ) { - result = -ENODEV ; - goto out_free; - } - -if (!try_module_get (client->dev.driver->owner)) { -i2c_unregister_device (client); +/* perform probe/init/attach */ + client =dvb_module_probe ("mn88473" ,NULL , demod_i2c, + dev->board.demod_addr, + &mn88473_config); +if (!client) { result = -ENODEV ; goto out_free; } - dvb->i2c_client_demod[0 ] = client;/* define general-purpose callback pointer */
@@ -1095,9 +993,6 @@ static int dvb_init(struct cx231xx *dev) }case CX231XX_BOARD_HAUPPAUGE_935C : { -struct i2c_client *client; -struct i2c_adapter *adapter; -struct i2c_board_info info = {};struct si2157_config si2157_config = {};struct si2168_config si2168_config = {};
@@ -1107,25 +1002,14 @@ static int dvb_init(struct cx231xx *dev) si2168_config.i2c_adapter = &adapter; si2168_config.ts_clock_inv = true; -strlcpy (info.type,"si2168" ,sizeof (info.type)); - info.addr = dev->board.demod_addr; - info.platform_data = &si2168_config; - -request_module (info.type); - client =i2c_new_device (demod_i2c, &info); -if (client ==NULL || client->dev.driver ==NULL ) { +/* perform probe/init/attach */ + client =dvb_module_probe ("si2168" ,NULL , demod_i2c, + dev->board.demod_addr, + &si2168_config); +if (!client) { result = -ENODEV ; goto out_free; } - -if (!try_module_get (client->dev.driver->owner)) { -dev_err (dev->dev, -"Failed to attach %s frontend.\n" , info.type); -i2c_unregister_device (client); - result = -ENODEV ; - goto out_free; - } - dvb->i2c_client_demod[0 ] = client; dev->dvb->frontend[0 ]->ops.i2c_gate_ctrl =NULL ;
@@ -1140,40 +1024,21 @@ static int dvb_init(struct cx231xx *dev) si2157_config.if_port =1 ; si2157_config.inversion = true; -memset (&info,0 ,sizeof (struct i2c_board_info )); -strlcpy (info.type,"si2157" ,I2C_NAME_SIZE ); - info.addr = dev->board.tuner_addr; - info.platform_data = &si2157_config; -request_module ("si2157" ); - - client =i2c_new_device (tuner_i2c, &info); -if (client ==NULL || client->dev.driver ==NULL ) { -module_put (dvb->i2c_client_demod[0 ]->dev.driver->owner); -i2c_unregister_device (dvb->i2c_client_demod[0 ]); - result = -ENODEV ; - goto out_free; - } - -if (!try_module_get (client->dev.driver->owner)) { -dev_err (dev->dev, -"Failed to obtain %s tuner.\n" , info.type); -i2c_unregister_device (client); -module_put (dvb->i2c_client_demod[0 ]->dev.driver->owner); -i2c_unregister_device (dvb->i2c_client_demod[0 ]); +/* perform probe/init/attach */ + client =dvb_module_probe ("si2157" ,NULL , tuner_i2c, + dev->board.tuner_addr, + &si2157_config); +if (!client) { result = -ENODEV ; goto out_free; } - dev->cx231xx_reset_analog_tuner =NULL ; dev->dvb->i2c_client_tuner = client;break ; }case CX231XX_BOARD_HAUPPAUGE_975 : { -struct i2c_client *client; -struct i2c_adapter *adapter;struct i2c_adapter *adapter2; -struct i2c_board_info info = {};struct si2157_config si2157_config = {};struct lgdt3306a_config lgdt3306a_config = {};struct si2168_config si2168_config = {};
@@ -1184,25 +1049,14 @@ static int dvb_init(struct cx231xx *dev) lgdt3306a_config.i2c_adapter = &adapter; lgdt3306a_config.deny_i2c_rptr =0 ; -strlcpy (info.type,"lgdt3306a" ,sizeof (info.type)); - info.addr = dev->board.demod_addr; - info.platform_data = &lgdt3306a_config; - -request_module (info.type); - client =i2c_new_device (demod_i2c, &info); -if (client ==NULL || client->dev.driver ==NULL ) { +/* perform probe/init/attach */ + client =dvb_module_probe ("lgdt3306a" ,NULL , demod_i2c, + dev->board.demod_addr, + &lgdt3306a_config); +if (!client) { result = -ENODEV ; goto out_free; } - -if (!try_module_get (client->dev.driver->owner)) { -dev_err (dev->dev, -"Failed to attach %s frontend.\n" , info.type); -i2c_unregister_device (client); - result = -ENODEV ; - goto out_free; - } - dvb->i2c_client_demod[0 ] = client;/* attach second demodulator chip */
@@ -1211,30 +1065,14 @@ static int dvb_init(struct cx231xx *dev) si2168_config.i2c_adapter = &adapter2; si2168_config.ts_clock_inv = true; -memset (&info,0 ,sizeof (struct i2c_board_info )); -strlcpy (info.type,"si2168" ,sizeof (info.type)); - info.addr = dev->board.demod_addr2; - info.platform_data = &si2168_config; - -request_module (info.type); - client =i2c_new_device (adapter, &info); -if (client ==NULL || client->dev.driver ==NULL ) { -dev_err (dev->dev, -"Failed to attach %s frontend.\n" , info.type); -module_put (dvb->i2c_client_demod[0 ]->dev.driver->owner); -i2c_unregister_device (dvb->i2c_client_demod[0 ]); - result = -ENODEV ; - goto out_free; - } - -if (!try_module_get (client->dev.driver->owner)) { -i2c_unregister_device (client); -module_put (dvb->i2c_client_demod[0 ]->dev.driver->owner); -i2c_unregister_device (dvb->i2c_client_demod[0 ]); +/* perform probe/init/attach */ + client =dvb_module_probe ("si2168" ,NULL , adapter, + dev->board.demod_addr2, + &si2168_config); +if (!client) { result = -ENODEV ; goto out_free; } - dvb->i2c_client_demod[1 ] = client; dvb->frontend[1 ]->id =1 ;
@@ -1250,34 +1088,14 @@ static int dvb_init(struct cx231xx *dev) si2157_config.if_port =1 ; si2157_config.inversion = true; -memset (&info,0 ,sizeof (struct i2c_board_info )); -strlcpy (info.type,"si2157" ,I2C_NAME_SIZE ); - info.addr = dev->board.tuner_addr; - info.platform_data = &si2157_config; -request_module ("si2157" ); - - client =i2c_new_device (adapter, &info); -if (client ==NULL || client->dev.driver ==NULL ) { -module_put (dvb->i2c_client_demod[1 ]->dev.driver->owner); -i2c_unregister_device (dvb->i2c_client_demod[1 ]); -module_put (dvb->i2c_client_demod[0 ]->dev.driver->owner); -i2c_unregister_device (dvb->i2c_client_demod[0 ]); - result = -ENODEV ; - goto out_free; - } - -if (!try_module_get (client->dev.driver->owner)) { -dev_err (dev->dev, -"Failed to obtain %s tuner.\n" , info.type); -i2c_unregister_device (client); -module_put (dvb->i2c_client_demod[1 ]->dev.driver->owner); -i2c_unregister_device (dvb->i2c_client_demod[1 ]); -module_put (dvb->i2c_client_demod[0 ]->dev.driver->owner); -i2c_unregister_device (dvb->i2c_client_demod[0 ]); +/* perform probe/init/attach */ + client =dvb_module_probe ("si2157" ,NULL , adapter, + dev->board.tuner_addr, + &si2157_config); +if (!client) { result = -ENODEV ; goto out_free; } - dev->cx231xx_reset_analog_tuner =NULL ; dvb->i2c_client_tuner = client;
@@ -1316,6 +1134,14 @@ static int dvb_init(struct cx231xx *dev)return result; out_free: +/* remove I2C tuner */ +dvb_module_release (dvb->i2c_client_tuner); + dvb->i2c_client_tuner =NULL ; +/* remove I2C demod(s) */ +dvb_module_release (dvb->i2c_client_demod[1 ]); + dvb->i2c_client_demod[1 ] =NULL ; +dvb_module_release (dvb->i2c_client_demod[0 ]); + dvb->i2c_client_demod[0 ] =NULL ;kfree (dvb); dev->dvb =NULL ; goto ret;
Signature · 1 line
2.7.4
PATCH v2 6/9 cx231xx: Update 955Q from dvb attach to i2c device
In reply to Brad LoveTrim out some unused config params. Use the i2c mux adapter returned by frontend with the tuner.
---
Changes since v1:
- Deleted one comment and removed 'tuner' from other
drivers/media/usb/cx231xx/cx231xx-dvb.c | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-)
drivers/media/usb/cx231xx/cx231xx-dvb.c +11 -10
@@ -156,10 +156,8 @@ static struct tda18271_config pv_tda18271_config = { };static struct lgdt3306a_config hauppauge_955q_lgdt3306a_config = { - .i2c_addr =0x59 , .qam_if_khz =4000 , .vsb_if_khz =3250 , - .deny_i2c_rptr =1 , .spectral_inversion =1 , .mpeg_mode =LGDT3306A_MPEG_SERIAL , .tpclk_edge =LGDT3306A_TPCLK_RISING_EDGE ,
@@ -857,18 +855,21 @@ static int dvb_init(struct cx231xx *dev)case CX231XX_BOARD_HAUPPAUGE_955Q : {struct si2157_config si2157_config = {}; +struct lgdt3306a_config lgdt3306a_config = {}; - dev->dvb->frontend[0 ] =dvb_attach (lgdt3306a_attach, - &hauppauge_955q_lgdt3306a_config, - demod_i2c - ); + lgdt3306a_config = hauppauge_955q_lgdt3306a_config; + lgdt3306a_config.fe = &dev->dvb->frontend[0 ]; + lgdt3306a_config.i2c_adapter = &adapter; -if (!dev->dvb->frontend[0 ]) { -dev_err (dev->dev, -"Failed to attach LGDT3306A frontend.\n" ); - result = -EINVAL ; +/* perform probe/init/attach */ + client =dvb_module_probe ("lgdt3306a" ,NULL , demod_i2c, + dev->board.demod_addr, + &lgdt3306a_config); +if (!client) { + result = -ENODEV ; goto out_free; } + dvb->i2c_client_demod[0 ] = client; dev->dvb->frontend[0 ]->ops.i2c_gate_ctrl =NULL ;
Signature · 1 line
2.7.4
PATCH v2 7/9 cx231xx: Remove unnecessary parameter clear
In reply to Brad LoveThe default is now 0, no need to override
---
Changes since v1:
- regen
drivers/media/usb/cx231xx/cx231xx-dvb.c | 1 - 1 file changed, 1 deletion(-)
drivers/media/usb/cx231xx/cx231xx-dvb.c +0 -1
@@ -1048,7 +1048,6 @@ static int dvb_init(struct cx231xx *dev) lgdt3306a_config = hauppauge_955q_lgdt3306a_config; lgdt3306a_config.fe = &dev->dvb->frontend[0 ]; lgdt3306a_config.i2c_adapter = &adapter; - lgdt3306a_config.deny_i2c_rptr =0 ;/* perform probe/init/attach */ client = dvb_module_probe("lgdt3306a", NULL, demod_i2c,
Signature · 1 line
2.7.4
PATCH v2 8/9 cx231xx: Remove RC_CORE dependency
In reply to Brad LoveVIDEO_CX231XX_RC requires RC_CORE, but VIDEO_CX231XX does not require RC to compile or function.
--- drivers/media/usb/cx231xx/Kconfig | 1 - 1 file changed, 1 deletion(-)
drivers/media/usb/cx231xx/Kconfig +0 -1
@@ -3,7 +3,6 @@ config VIDEO_CX231XX depends on VIDEO_DEV && I2C select VIDEO_TUNER select VIDEO_TVEEPROM - depends on RC_CORE select VIDEOBUF_VMALLOC select VIDEO_CX25840 select VIDEO_CX2341X
Signature · 1 line
2.7.4
PATCH v2 9/9 cx231xx: Add I2C_MUX dependency
In reply to Brad Lovecx231xx requires i2c mux adapter capability.
--- drivers/media/usb/cx231xx/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/usb/cx231xx/Kconfig +1 -1
@@ -1,6 +1,6 @@ config VIDEO_CX231XX tristate "Conexant cx231xx USB video capture support" - depends on VIDEO_DEV && I2C + depends on VIDEO_DEV && I2C && I2C_MUX select VIDEO_TUNER select VIDEO_TVEEPROM select VIDEOBUF_VMALLOC
Signature · 1 line
2.7.4
kbuild test robot
build botRe: [PATCH v2 9/9] cx231xx: Add I2C_MUX dependency
Thank you for the patch! Yet something to improve:
Hi Brad,
Thank you for the patch! Yet something to improve:
[auto build test ERROR on linuxtv-media/master]
[also build test ERROR on v4.17-rc3 next-20180504]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
url: https://github.com/0day-ci/linux/commits/Brad-Love/cx231xx-House-cleaning/20180505-040333 base: git://linuxtv.org/media_tree.git master config: x86_64-lkp (attached as .config) compiler: gcc-7 (Debian 7.3.0-16) 7.3.0 reproduce: # save the attached .config to linux build tree make ARCH=x86_64
All errors (new ones prefixed by >>):
>> drivers/i2c/Kconfig:61:error: recursive dependency detected! >> drivers/i2c/Kconfig:61: symbol I2C_MUX is selected by VIDEO_CX231XX >> drivers/media/usb/cx231xx/Kconfig:1: symbol VIDEO_CX231XX depends on I2C_MUX
For a resolution refer to Documentation/kbuild/kconfig-language.txt subsection "Kconfig recursive dependency limitations"
vim +61 drivers/i2c/Kconfig
16538e6b Jan Engelhardt 2007-05-01 37 9c1600ed David Brownell 2007-05-01 38 config I2C_BOARDINFO 6341e62b Christoph Jaeger 2014-12-20 39 bool 9c1600ed David Brownell 2007-05-01 40 default y 9c1600ed David Brownell 2007-05-01 41 2bb5095a Jean Delvare 2009-09-18 42 config I2C_COMPAT 6341e62b Christoph Jaeger 2014-12-20 43 bool "Enable compatibility bits for old user-space" 2bb5095a Jean Delvare 2009-09-18 44 default y 2bb5095a Jean Delvare 2009-09-18 45 help 2bb5095a Jean Delvare 2009-09-18 46 Say Y here if you intend to run lm-sensors 3.1.1 or older, or any 2bb5095a Jean Delvare 2009-09-18 47 other user-space package which expects i2c adapters to be class 2bb5095a Jean Delvare 2009-09-18 48 devices. If you don't know, say Y. 2bb5095a Jean Delvare 2009-09-18 49 ^1da177e Linus Torvalds 2005-04-16 50 config I2C_CHARDEV ^1da177e Linus Torvalds 2005-04-16 51 tristate "I2C device interface" ^1da177e Linus Torvalds 2005-04-16 52 help ^1da177e Linus Torvalds 2005-04-16 53 Say Y here to use i2c-* device files, usually found in the /dev ^1da177e Linus Torvalds 2005-04-16 54 directory on your system. They make it possible to have user-space ^1da177e Linus Torvalds 2005-04-16 55 programs use the I2C bus. Information on how to do this is ^1da177e Linus Torvalds 2005-04-16 56 contained in the file <file:Documentation/i2c/dev-interface>. ^1da177e Linus Torvalds 2005-04-16 57 ^1da177e Linus Torvalds 2005-04-16 58 This support is also available as a module. If so, the module ^1da177e Linus Torvalds 2005-04-16 59 will be called i2c-dev. ^1da177e Linus Torvalds 2005-04-16 60 0826374b Michael Lawnick 2010-08-11 @61 config I2C_MUX 0826374b Michael Lawnick 2010-08-11 62 tristate "I2C bus multiplexing support" 0826374b Michael Lawnick 2010-08-11 63 help 0826374b Michael Lawnick 2010-08-11 64 Say Y here if you want the I2C core to support the ability to 0826374b Michael Lawnick 2010-08-11 65 handle multiplexed I2C bus topologies, by presenting each 0826374b Michael Lawnick 2010-08-11 66 multiplexed segment as a I2C adapter. 0826374b Michael Lawnick 2010-08-11 67 0826374b Michael Lawnick 2010-08-11 68 This support is also available as a module. If so, the module 0826374b Michael Lawnick 2010-08-11 69 will be called i2c-mux. 0826374b Michael Lawnick 2010-08-11 70
:::::: The code at line 61 was first introduced by commit
:::::: 0826374bff57411d239f2fcb15da3c35af0a93cd i2c: Multiplexed I2C bus core support
:::::: TO: Michael Lawnick <[email protected]> :::::: CC: Jean Delvare <[email protected]>
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
Hi Brad,
Quoted 24 lines · Brad Love
Included in this patch set is:
- Bugfix for a device not working
- Some clean up and value corrections
- Conversion to new dvb i2c helpers
- Update of device from old dvb attach to i2c device
- Dependency fixes
- Style fixesChanges since v1:
- Style fixes in i2c helper patch
- Some comment cleanup
- Hardware validation of analog tuningBrad Love (9):
cx231xx: Fix several incorrect demod addresses
cx231xx: Use board profile values for addresses
cx231xx: Style fix for struct zero init
cx231xx: [bug] Ignore an i2c mux adapter
cx231xx: Switch to using new dvb i2c helpers
cx231xx: Update 955Q from dvb attach to i2c device
cx231xx: Remove unnecessary parameter clear
cx231xx: RemoveRC_COREdependency
cx231xx: AddI2C_MUXdependency
Quoted 5 lines
drivers/media/usb/cx231xx/Kconfig | 1 - drivers/media/usb/cx231xx/cx231xx-cards.c | 6 +- drivers/media/usb/cx231xx/cx231xx-dvb.c | 365 ++++++++---------------------- 3 files changed, 94 insertions(+), 278 deletions(-)
In case you are ever interested in converting this driver to vb2, I made an attempt back in 2015:
https://git.linuxtv.org/hverkuil/media_tree.git/log/?h=cx231xx
I never got it to work (I think it was mainly the DVB part that didn't work, but I'm not certain anymore as it is such a long time ago). I ran out of time and haven't continued with it, but it would be really nice if someone could finish this vb2 conversion.
Regards,
Hans
Hi Hans,
Quoted 37 lines · Hans Verkuil
Hi Brad,
Quoted 24 lines · Brad Love
Included in this patch set is:
- Bugfix for a device not working
- Some clean up and value corrections
- Conversion to new dvb i2c helpers
- Update of device from old dvb attach to i2c device
- Dependency fixes
- Style fixesChanges since v1:
- Style fixes in i2c helper patch
- Some comment cleanup
- Hardware validation of analog tuningBrad Love (9):
cx231xx: Fix several incorrect demod addresses
cx231xx: Use board profile values for addresses
cx231xx: Style fix for struct zero init
cx231xx: [bug] Ignore an i2c mux adapter
cx231xx: Switch to using new dvb i2c helpers
cx231xx: Update 955Q from dvb attach to i2c device
cx231xx: Remove unnecessary parameter clear
cx231xx: RemoveRC_COREdependency
cx231xx: AddI2C_MUXdependencyQuoted 5 lines
drivers/media/usb/cx231xx/Kconfig | 1 - drivers/media/usb/cx231xx/cx231xx-cards.c | 6 +- drivers/media/usb/cx231xx/cx231xx-dvb.c | 365 ++++++++---------------------- 3 files changed, 94 insertions(+), 278 deletions(-)In case you are ever interested in converting this driver to vb2, I made an attempt back in 2015:
https://git.linuxtv.org/hverkuil/media_tree.git/log/?h=cx231xx
Quoted 8 lines
I never got it to work (I think it was mainly the DVB part that didn't work, but I'm not certain anymore as it is such a long time ago). I ran out of time and haven't continued with it, but it would be really nice if someone could finish this vb2 conversion.
Regards,
Hans
I'll check this out and add it to my queue.
Cheers,
Brad