Reduce cx231xx verbosity and do some cleanups
v2 cover Reduce cx231xx verbosity and do some cleanups
The cx231xx driver is too verbose. Several debug messages are sent to dmesg. Do some cleanup and fix i2c_scan.
After this patch, it will now produce:
[ 608.359255] usb 1-2: New device Conexant Corporation Polaris AV Capturb @ 480 Mbps (1554:5010) with 7 interfaces [ 608.360009] usb 1-2: Identified as Pixelview PlayTV USB Hybrid (card=10) [ 608.363129] i2c i2c-8: Added multiplexed i2c bus 10 [ 608.363201] i2c i2c-8: Added multiplexed i2c bus 11 [ 610.968904] cx25840 7-0044: loaded v4l-cx231xx-avcore-01.fw firmware (16382 bytes) [ 611.041317] Chip ID is not zero. It is not a TEA5767 [ 611.041351] tuner 9-0060: Tuner -1 found with type(s) Radio TV. [ 611.041429] tda18271 9-0060: creating new instance [ 611.044096] TDA18271HD/C2 detected @ 9-0060 [ 611.239460] tda18271: performing RF tracking filter calibration [ 612.800569] tda18271: RF tracking filter calibration complete [ 612.835365] usb 1-2: v4l2 driver version 0.0.3 [ 613.055006] usb 1-2: Registered video device video0 [v4l2] [ 613.055461] usb 1-2: Registered VBI device vbi0 [ 613.110279] Registered IR keymap rc-pixelview-002t [ 613.110574] input: i2c IR (Pixelview PlayTV USB Hy as /devices/virtual/rc/rc0/input12 [ 613.111398] rc0: i2c IR (Pixelview PlayTV USB Hy as /devices/virtual/rc/rc0 [ 613.111409] ir-kbd-i2c: i2c IR (Pixelview PlayTV USB Hy detected at i2c-9/9-0030/ir0 [cx231xx #0-2] [ 613.111444] usb 1-2: video EndPoint Addr 0x84, Alternate settings: 5 [ 613.111454] usb 1-2: VBI EndPoint Addr 0x85, Alternate settings: 2 [ 613.111465] usb 1-2: sliced CC EndPoint Addr 0x86, Alternate settings: 2 [ 613.111474] usb 1-2: TS EndPoint Addr 0x81, Alternate settings: 6 [ 613.111654] usbcore: registered new interface driver cx231xx [ 613.136510] usb 1-2: audio EndPoint Addr 0x83, Alternate settings: 3 [ 613.136521] usb 1-2: Cx231xx Audio Extension initialized [ 613.199085] usb 1-2: dvb_init: looking for demod on i2c bus: 9 [ 613.232349] i2c i2c-11: Detected a Fujitsu mb86a20s frontend [ 613.232385] tda18271 9-0060: attaching existing instance [ 613.232392] DVB: registering new adapter (cx231xx #0) [ 613.232402] usb 1-2: DVB: registering adapter 0 frontend 0 (Fujitsu mb86A20s)... [ 613.234528] usb 1-2: Successfully loaded cx231xx-dvb [ 613.234618] usb 1-2: Cx231xx dvb Extension initialized
Still verbose, but at least it doesn't produce extra logs during normal work.
I2C scan is now fixed and not too verbose:
[ 608.371656] usb 1-2: i2c scan: found device @ port 0 addr 0x40 [???] [ 608.374750] usb 1-2: i2c scan: found device @ port 0 addr 0x60 [colibri] [ 608.378433] usb 1-2: i2c scan: found device @ port 0 addr 0x88 [hammerhead] [ 608.380226] usb 1-2: i2c scan: found device @ port 0 addr 0x98 [???] [ 608.405747] usb 1-2: i2c scan: found device @ port 3 addr 0xa0 [eeprom] [ 608.422310] usb 1-2: i2c scan: found device @ port 2 addr 0x60 [colibri] [ 608.430229] usb 1-2: i2c scan: found device @ port 2 addr 0xc0 [tuner] [ 608.438793] usb 1-2: i2c scan: found device @ port 4 addr 0x20 [demod] [ 608.560247] cx25840 7-0044: cx23102 A/V decoder found @ 0x88 (cx231xx #0-0)
Tested with a Pixelview PlayTV USB Hybrid SBTVD.
-
v2:
- The i2c scan fix patch got replaced by the one sent by Matthias;
- Converted to dev_foo() instead of pr_foo();
- Some minor CodingStyle cleanups;
- Be a little less verbose on i2c_scan;
- Bumped version string.
Matthias Schwarzott (1):
[media] cx231xx: use 1 byte read for i2c scan
Mauro Carvalho Chehab (13):
[media] cx231xx: get rid of driver-defined printk macros [media] cx231xx: Fix identation
[media] cx231xx: Cleanup printk at the driver [media] cx25840: Don't report an error if max size is adjusted [media] cx25840: convert max_buf_size var to lowercase [media] cx231xx: disable I2C errors during i2c_scan [media] cx231xx: convert from pr_foo to dev_foo [media] cx231xx: get rid of audio debug parameter [media] cx231xx: use dev_foo instead of printk [media] cx231xx: add addr for demod and make i2c_devs const [media] cx231xx: use dev_info() for extension load/unload [media] cx231xx: too much changes. Bump version number [media] cx231xx: simplify I2C scan debug messages
drivers/media/i2c/cx25840/cx25840-firmware.c | 11 +- drivers/media/usb/cx231xx/cx231xx-417.c | 53 +++-- drivers/media/usb/cx231xx/cx231xx-audio.c | 93 +++++---- drivers/media/usb/cx231xx/cx231xx-avcore.c | 292 +++++++++++++++------------ drivers/media/usb/cx231xx/cx231xx-cards.c | 158 ++++++++------- drivers/media/usb/cx231xx/cx231xx-core.c | 150 +++++++------- drivers/media/usb/cx231xx/cx231xx-dvb.c | 114 ++++++----- drivers/media/usb/cx231xx/cx231xx-i2c.c | 37 ++-- drivers/media/usb/cx231xx/cx231xx-input.c | 1 - drivers/media/usb/cx231xx/cx231xx-pcb-cfg.c | 47 +++-- drivers/media/usb/cx231xx/cx231xx-vbi.c | 48 +++-- drivers/media/usb/cx231xx/cx231xx-video.c | 85 ++++---- drivers/media/usb/cx231xx/cx231xx.h | 21 +- 13 files changed, 583 insertions(+), 527 deletions(-)
Signature · 1 line
1.9.3
PATCH v2 1/14 cx231xx: get rid of driver-defined printk macros
It currently does just like what pr_foo() macros do. So, replace them.
A deeper cleanup is needed, as there are lots of debug macros printed with pr_info.
drivers/media/usb/cx231xx/cx231xx-417.c +3 -3
@@ -24,6 +24,8 @@* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ +#include "cx231xx.h" +#include <linux/module.h> #include <linux/moduleparam.h> #include <linux/init.h>
@@ -39,8 +41,6 @@#include <media/tuner.h> #include <linux/usb.h> -#include "cx231xx.h" -#define CX231xx_FIRM_IMAGE_SIZE 376836#define CX231xx_FIRM_IMAGE_NAME "v4l-cx23885-enc.fw"
@@ -1416,7 +1416,7 @@ static int bb_buf_prepare(struct videobuf_queue *q,if (!dev->video_mode.bulk_ctl.num_bufs) urb_init =1 ; } -/*cx231xx_info("urb_init=%d dev->video_mode.max_pkt_size=%d\n", +/*pr_info("urb_init=%d dev->video_mode.max_pkt_size=%d\n", urb_init, dev->video_mode.max_pkt_size);*/ dev->mode_tv =1 ;
drivers/media/usb/cx231xx/cx231xx-audio.c +15 -15
@@ -20,6 +20,7 @@* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ +#include "cx231xx.h" #include <linux/kernel.h> #include <linux/usb.h> #include <linux/init.h>
@@ -37,7 +38,6 @@#include <sound/initval.h> #include <sound/control.h> #include <media/v4l2-common.h> -#include "cx231xx.h" static int debug;module_param (debug, int,0644 );
@@ -182,7 +182,7 @@ static void cx231xx_audio_isocirq(struct urb *urb) status =usb_submit_urb (urb,GFP_ATOMIC );if (status <0 ) { -cx231xx_errdev ("resubmit of audio urb failed (error=%i)\n" , +pr_err ("resubmit of audio urb failed (error=%i)\n" , status); }return ;
@@ -266,7 +266,7 @@ static void cx231xx_audio_bulkirq(struct urb *urb) status =usb_submit_urb (urb,GFP_ATOMIC );if (status <0 ) { -cx231xx_errdev ("resubmit of audio urb failed (error=%i)\n" , +pr_err ("resubmit of audio urb failed (error=%i)\n" , status); }return ;
@@ -277,7 +277,7 @@ static int cx231xx_init_audio_isoc(struct cx231xx *dev)int i, errCode;int sb_size; -cx231xx_info ("%s: Starting ISO AUDIO transfers\n" , __func__); +pr_info ("%s: Starting ISO AUDIO transfers\n" , __func__);if (dev->state &DEV_DISCONNECTED )return -ENODEV ;
@@ -295,7 +295,7 @@ static int cx231xx_init_audio_isoc(struct cx231xx *dev)memset (dev->adev.transfer_buffer[i],0x80 , sb_size); urb =usb_alloc_urb (CX231XX_ISO_NUM_AUDIO_PACKETS ,GFP_ATOMIC );if (!urb) { -cx231xx_errdev ("usb_alloc_urb failed!\n" ); +pr_err ("usb_alloc_urb failed!\n" );for (j =0 ; j < i; j++) {usb_free_urb (dev->adev.urb[j]);kfree (dev->adev.transfer_buffer[j]);
@@ -338,7 +338,7 @@ static int cx231xx_init_audio_bulk(struct cx231xx *dev)int i, errCode;int sb_size; -cx231xx_info ("%s: Starting BULK AUDIO transfers\n" , __func__); +pr_info ("%s: Starting BULK AUDIO transfers\n" , __func__);if (dev->state &DEV_DISCONNECTED )return -ENODEV ;
@@ -356,7 +356,7 @@ static int cx231xx_init_audio_bulk(struct cx231xx *dev)memset (dev->adev.transfer_buffer[i],0x80 , sb_size); urb =usb_alloc_urb (CX231XX_NUM_AUDIO_PACKETS ,GFP_ATOMIC );if (!urb) { -cx231xx_errdev ("usb_alloc_urb failed!\n" ); +pr_err ("usb_alloc_urb failed!\n" );for (j =0 ; j < i; j++) {usb_free_urb (dev->adev.urb[j]);kfree (dev->adev.transfer_buffer[j]);
@@ -439,13 +439,13 @@ static int snd_cx231xx_capture_open(struct snd_pcm_substream *substream)dprintk ("opening device and trying to acquire exclusive lock\n" );if (!dev) { -cx231xx_errdev ("BUG: cx231xx can't find device struct." +pr_err ("BUG: cx231xx can't find device struct." " Can't proceed with open\n" );return -ENODEV ; }if (dev->state &DEV_DISCONNECTED ) { -cx231xx_errdev ("Can't open. the device was removed.\n" ); +pr_err ("Can't open. the device was removed.\n" );return -ENODEV ; }
@@ -458,7 +458,7 @@ static int snd_cx231xx_capture_open(struct snd_pcm_substream *substream) ret =cx231xx_set_alt_setting (dev,INDEX_AUDIO ,0 );mutex_unlock (&dev->lock);if (ret <0 ) { -cx231xx_errdev ("failed to set alternate setting !\n" ); +pr_err ("failed to set alternate setting !\n" );return ret; }
@@ -494,7 +494,7 @@ static int snd_cx231xx_pcm_close(struct snd_pcm_substream *substream)/* 1 - 48000 samples per sec */ ret =cx231xx_set_alt_setting (dev,INDEX_AUDIO ,0 );if (ret <0 ) { -cx231xx_errdev ("failed to set alternate setting !\n" ); +pr_err ("failed to set alternate setting !\n" );mutex_unlock (&dev->lock);return ret;
@@ -662,7 +662,7 @@ static int cx231xx_audio_init(struct cx231xx *dev)return 0 ; } -cx231xx_info ("cx231xx-audio.c: probing for cx231xx " +pr_info ("cx231xx-audio.c: probing for cx231xx " "non standard usbaudio\n" ); err = snd_card_new(&dev->udev->dev, index[devnr], "Cx231xx Audio",
@@ -707,12 +707,12 @@ static int cx231xx_audio_init(struct cx231xx *dev) bEndpointAddress; adev->num_alt = uif->num_altsetting; -cx231xx_info ("EndPoint Addr 0x%x, Alternate settings: %i\n" , +pr_info ("EndPoint Addr 0x%x, Alternate settings: %i\n" , adev->end_point_addr, adev->num_alt); adev->alt_max_pkt_size =kmalloc (32 * adev->num_alt,GFP_KERNEL );if (adev->alt_max_pkt_size ==NULL ) { -cx231xx_errdev ("out of memory!\n" ); +pr_err ("out of memory!\n" );return -ENOMEM ; }
@@ -722,7 +722,7 @@ static int cx231xx_audio_init(struct cx231xx *dev) wMaxPacketSize); adev->alt_max_pkt_size[i] = (tmp &0x07ff ) * (((tmp &0x1800 ) >>11 ) +1 ); -cx231xx_info ("Alternate setting %i, max size= %i\n" , i, +pr_info ("Alternate setting %i, max size= %i\n" , i, adev->alt_max_pkt_size[i]); }
drivers/media/usb/cx231xx/cx231xx-avcore.c +63 -63
436 lines not on this page · raw message
drivers/media/usb/cx231xx/cx231xx-cards.c +36 -36
290 lines not on this page · raw message
drivers/media/usb/cx231xx/cx231xx-core.c +27 -27
222 lines not on this page · raw message
drivers/media/usb/cx231xx/cx231xx-dvb.c +6 -6
@@ -19,11 +19,11 @@Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ +#include "cx231xx.h" #include <linux/kernel.h> #include <linux/slab.h> #include <linux/usb.h> -#include "cx231xx.h" #include <media/v4l2-common.h> #include <media/videobuf-vmalloc.h>
@@ -265,7 +265,7 @@ static int start_streaming(struct cx231xx_dvb *dvb)struct cx231xx *dev = dvb->adapter.priv;if (dev->USE_ISO) { -cx231xx_info ("DVB transfer mode is ISO.\n" ); +pr_info ("DVB transfer mode is ISO.\n" );cx231xx_set_alt_setting (dev,INDEX_TS1 ,4 ); rc =cx231xx_set_mode (dev,CX231XX_DIGITAL_MODE );if (rc <0 )
@@ -276,7 +276,7 @@ static int start_streaming(struct cx231xx_dvb *dvb) dev->ts1_mode.max_pkt_size, dvb_isoc_copy); }else { -cx231xx_info ("DVB transfer mode is BULK.\n" ); +pr_info ("DVB transfer mode is BULK.\n" );cx231xx_set_alt_setting (dev,INDEX_TS1 ,0 ); rc =cx231xx_set_mode (dev,CX231XX_DIGITAL_MODE );if (rc <0 )
@@ -430,15 +430,15 @@ int cx231xx_reset_analog_tuner(struct cx231xx *dev)if (dops->init !=NULL && !dev->xc_fw_load_done) { -cx231xx_info ("Reloading firmware for XC5000\n" ); +pr_info ("Reloading firmware for XC5000\n" ); status = dops->init (dev->dvb->frontend);if (status ==0 ) { dev->xc_fw_load_done =1 ; -cx231xx_info +pr_info ("XC5000 firmware download completed\n" ); }else { dev->xc_fw_load_done =0 ; -cx231xx_info +pr_info ("XC5000 firmware download failed !!!\n" ); } }
drivers/media/usb/cx231xx/cx231xx-i2c.c +6 -6
@@ -20,6 +20,7 @@Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ +#include "cx231xx.h" #include <linux/module.h> #include <linux/kernel.h> #include <linux/usb.h>
@@ -28,7 +29,6 @@#include <media/v4l2-common.h> #include <media/tuner.h> -#include "cx231xx.h" /* ----------------------------------------------------------- */
@@ -498,17 +498,17 @@ void cx231xx_do_i2c_scan(struct cx231xx *dev, int i2c_port)memset (&client,0 ,sizeof (client)); client.adapter =cx231xx_get_i2c_adap (dev, i2c_port); -cx231xx_info (": Checking for I2C devices on port=%d ..\n" , i2c_port); +pr_info (": Checking for I2C devices on port=%d ..\n" , i2c_port);for (i =0 ; i <128 ; i++) { client.addr = i; rc =i2c_master_recv (&client, &buf,0 );if (rc <0 )continue ; -cx231xx_info ("%s: i2c scan: found device @ 0x%x [%s]\n" , +pr_info ("%s: i2c scan: found device @ 0x%x [%s]\n" , dev->name, i <<1 , i2c_devs[i] ? i2c_devs[i] :"???" ); } -cx231xx_info (": Completed Checking for I2C devices on port=%d.\n" , +pr_info (": Completed Checking for I2C devices on port=%d.\n" , i2c_port); }
@@ -532,7 +532,7 @@ int cx231xx_i2c_register(struct cx231xx_i2c *bus)i2c_add_adapter (&bus->i2c_adap);if (0 != bus->i2c_rc) -cx231xx_warn ("%s: i2c bus %d register FAILED\n" , +pr_warn ("%s: i2c bus %d register FAILED\n" , dev->name, bus->nr);return bus->i2c_rc;
@@ -576,7 +576,7 @@ int cx231xx_i2c_mux_register(struct cx231xx *dev, int mux_no) NULL);if (!dev->i2c_mux_adap[mux_no]) -cx231xx_warn ("%s: i2c mux %d register FAILED\n" , +pr_warn ("%s: i2c mux %d register FAILED\n" , dev->name, mux_no);return 0 ;
drivers/media/usb/cx231xx/cx231xx-pcb-cfg.c +12 -12
@@ -703,8 +703,8 @@ int initialize_cx231xx(struct cx231xx *dev) _current_scenario_idx =INDEX_BUSPOWER_DIF_ONLY ;break ;default : -cx231xx_info ("bad config in buspower!!!!\n" ); -cx231xx_info ("config_info=%x\n" , +pr_info ("bad config in buspower!!!!\n" ); +pr_info ("config_info=%x\n" , (config_info &BUSPOWER_MASK ));return 1 ; }
@@ -768,8 +768,8 @@ int initialize_cx231xx(struct cx231xx *dev) _current_scenario_idx =INDEX_SELFPOWER_COMPRESSOR ;break ;default : -cx231xx_info ("bad senario!!!!!\n" ); -cx231xx_info ("config_info=%x\n" , +pr_info ("bad senario!!!!!\n" ); +pr_info ("config_info=%x\n" , (config_info &SELFPOWER_MASK ));return -ENODEV ; }
@@ -781,17 +781,17 @@ int initialize_cx231xx(struct cx231xx *dev) sizeof(struct pcb_config));if (pcb_debug) { -cx231xx_info ("SC(0x00) register = 0x%x\n" , config_info); -cx231xx_info ("scenario %d\n" , +pr_info ("SC(0x00) register = 0x%x\n" , config_info); +pr_info ("scenario %d\n" , (dev->current_pcb_config.index) +1 ); -cx231xx_info ("type=%x\n" , dev->current_pcb_config.type); -cx231xx_info ("mode=%x\n" , dev->current_pcb_config.mode); -cx231xx_info ("speed=%x\n" , dev->current_pcb_config.speed); -cx231xx_info ("ts1_source=%x\n" , +pr_info ("type=%x\n" , dev->current_pcb_config.type); +pr_info ("mode=%x\n" , dev->current_pcb_config.mode); +pr_info ("speed=%x\n" , dev->current_pcb_config.speed); +pr_info ("ts1_source=%x\n" , dev->current_pcb_config.ts1_source); -cx231xx_info ("ts2_source=%x\n" , +pr_info ("ts2_source=%x\n" , dev->current_pcb_config.ts2_source); -cx231xx_info ("analog_source=%x\n" , +pr_info ("analog_source=%x\n" , dev->current_pcb_config.analog_source); }
drivers/media/usb/cx231xx/cx231xx-vbi.c +14 -14
@@ -19,6 +19,7 @@Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ +#include "cx231xx.h" #include <linux/init.h> #include <linux/list.h> #include <linux/module.h>
@@ -35,7 +36,6 @@#include <media/msp3400.h> #include <media/tuner.h> -#include "cx231xx.h" #include "cx231xx-vbi.h" static inline void print_err_status (struct cx231xx *dev,int packet,int status)
@@ -69,10 +69,10 @@ static inline void print_err_status(struct cx231xx *dev, int packet, int status)break ; }if (packet <0 ) { -cx231xx_err ("URB status %d [%s].\n" , status, +pr_err ("URB status %d [%s].\n" , status, errmsg); }else { -cx231xx_err ("URB packet %d, status %d [%s].\n" , +pr_err ("URB packet %d, status %d [%s].\n" , packet, status, errmsg); } }
@@ -316,7 +316,7 @@ static void cx231xx_irq_vbi_callback(struct urb *urb)case -ESHUTDOWN :return ;default :/* error */ -cx231xx_err ("urb completition error %d.\n" , +pr_err ("urb completition error %d.\n" , urb->status);break ; }
@@ -331,7 +331,7 @@ static void cx231xx_irq_vbi_callback(struct urb *urb) urb->status =usb_submit_urb (urb,GFP_ATOMIC );if (urb->status) { -cx231xx_err ("urb resubmit failed (error=%i)\n" , +pr_err ("urb resubmit failed (error=%i)\n" , urb->status); } }
@@ -344,7 +344,7 @@ void cx231xx_uninit_vbi_isoc(struct cx231xx *dev)struct urb *urb;int i; -cx231xx_info ("called cx231xx_uninit_vbi_isoc\n" ); +pr_info ("called cx231xx_uninit_vbi_isoc\n" ); dev->vbi_mode.bulk_ctl.nfields =-1 ;for (i =0 ; i < dev->vbi_mode.bulk_ctl.num_bufs; i++) {
@@ -393,7 +393,7 @@ int cx231xx_init_vbi_isoc(struct cx231xx *dev, int max_packets,struct urb *urb;int rc; -cx231xx_info ("called cx231xx_vbi_isoc\n" ); +pr_info ("called cx231xx_vbi_isoc\n" );/* De-allocates all pending stuff */ cx231xx_uninit_vbi_isoc (dev);
@@ -419,14 +419,14 @@ int cx231xx_init_vbi_isoc(struct cx231xx *dev, int max_packets, dev->vbi_mode.bulk_ctl.urb =kzalloc (sizeof (void *) * num_bufs,GFP_KERNEL );if (!dev->vbi_mode.bulk_ctl.urb) { -cx231xx_errdev ("cannot alloc memory for usb buffers\n" ); +pr_err ("cannot alloc memory for usb buffers\n" );return -ENOMEM ; } dev->vbi_mode.bulk_ctl.transfer_buffer =kzalloc (sizeof (void *) * num_bufs,GFP_KERNEL );if (!dev->vbi_mode.bulk_ctl.transfer_buffer) { -cx231xx_errdev ("cannot allocate memory for usbtransfer\n" ); +pr_err ("cannot allocate memory for usbtransfer\n" );kfree (dev->vbi_mode.bulk_ctl.urb);return -ENOMEM ; }
@@ -441,7 +441,7 @@ int cx231xx_init_vbi_isoc(struct cx231xx *dev, int max_packets, urb =usb_alloc_urb (0 ,GFP_KERNEL );if (!urb) { -cx231xx_err ("cannot alloc bulk_ctl.urb %i\n" , i); +pr_err ("cannot alloc bulk_ctl.urb %i\n" , i);cx231xx_uninit_vbi_isoc (dev);return -ENOMEM ; }
@@ -451,7 +451,7 @@ int cx231xx_init_vbi_isoc(struct cx231xx *dev, int max_packets, dev->vbi_mode.bulk_ctl.transfer_buffer[i] =kzalloc (sb_size,GFP_KERNEL );if (!dev->vbi_mode.bulk_ctl.transfer_buffer[i]) { -cx231xx_err ("unable to allocate %i bytes for transfer" +pr_err ("unable to allocate %i bytes for transfer" " buffer %i%s\n" , sb_size, i,in_interrupt () ?" while in int" :"" );cx231xx_uninit_vbi_isoc (dev);
@@ -470,7 +470,7 @@ int cx231xx_init_vbi_isoc(struct cx231xx *dev, int max_packets,for (i =0 ; i < dev->vbi_mode.bulk_ctl.num_bufs; i++) { rc =usb_submit_urb (dev->vbi_mode.bulk_ctl.urb[i],GFP_ATOMIC );if (rc) { -cx231xx_err ("submit of urb %i failed (error=%i)\n" , i, +pr_err ("submit of urb %i failed (error=%i)\n" , i, rc);cx231xx_uninit_vbi_isoc (dev);return rc;
@@ -522,7 +522,7 @@ static inline void vbi_buffer_filled(struct cx231xx *dev, struct cx231xx_buffer *buf) {/* Advice that buffer was filled */ -/* cx231xx_info("[%p/%d] wakeup\n", buf, buf->vb.i); */ +/* pr_info("[%p/%d] wakeup\n", buf, buf->vb.i); */ buf->vb.state =VIDEOBUF_DONE ; buf->vb.field_count++;
@@ -614,7 +614,7 @@ static inline void get_next_vbi_buf(struct cx231xx_dmaqueue *dma_q,char *outp;if (list_empty (&dma_q->active)) { -cx231xx_err ("No active queue to serve\n" ); +pr_err ("No active queue to serve\n" ); dev->vbi_mode.bulk_ctl.buf =NULL ; *buf =NULL ;return ;
drivers/media/usb/cx231xx/cx231xx-video.c +26 -26
194 lines not on this page · raw message
drivers/media/usb/cx231xx/cx231xx.h +2 -17
@@ -22,6 +22,8 @@#ifndef _CX231XX_H#define _CX231XX_H +#define pr_fmt (fmt) KBUILD_MODNAME ": " fmt +#include <linux/videodev2.h> #include <linux/types.h> #include <linux/ioctl.h>
@@ -981,23 +983,6 @@ void cx231xx_ir_exit(struct cx231xx *dev);#define cx231xx_ir_exit (dev) (0)#endif - -/* printk macros */ - -#define cx231xx_err(fmt, arg...) do {\ - printk(KERN_ERR fmt , ##arg); } while (0) - -#define cx231xx_errdev(fmt, arg...) do {\ - printk(KERN_ERR "%s: "fmt,\ - dev->name , ##arg); } while (0) - -#define cx231xx_info(fmt, arg...) do {\ - printk(KERN_INFO "%s: "fmt,\ - dev->name , ##arg); } while (0) -#define cx231xx_warn(fmt, arg...) do {\ - printk(KERN_WARNING "%s: "fmt,\ - dev->name , ##arg); } while (0) -static inline unsigned int norm_maxw (struct cx231xx *dev) {if (dev->board.max_range_640_480)
Signature · 1 line
1.9.3
PATCH v2 2/14 cx231xx: Fix identation
In reply to Mauro Carvalho ChehabOne of the identation blocks is wrong. Fix it.
While here, replace pr_info by pr_debug inside such block and add the function name to the print messages, as otherwise they will not help much.
drivers/media/usb/cx231xx/cx231xx-avcore.c +28 -24
@@ -2534,34 +2534,38 @@ int cx231xx_initialize_stream_xfer(struct cx231xx *dev, u32 media_type)break ;case TS1_serial_mode: -pr_info ("%s: set ts1 registers" , __func__); +pr_debug ("%s: set ts1 registers" , __func__); -if (dev->board.has_417) { -pr_info (" MPEG\n" ); - value &=0xFFFFFFFC ; - value |=0x3 ; +if (dev->board.has_417) { +pr_debug ("%s: MPEG\n" , __func__); + value &=0xFFFFFFFC ; + value |=0x3 ; - status =cx231xx_mode_register (dev,TS_MODE_REG , value); + status =cx231xx_mode_register (dev, +TS_MODE_REG , value); - val[0 ] =0x04 ; - val[1 ] =0xA3 ; - val[2 ] =0x3B ; - val[3 ] =0x00 ; - status =cx231xx_write_ctrl_reg (dev,VRT_SET_REGISTER , -TS1_CFG_REG , val,4 ); + val[0 ] =0x04 ; + val[1 ] =0xA3 ; + val[2 ] =0x3B ; + val[3 ] =0x00 ; + status =cx231xx_write_ctrl_reg (dev, +VRT_SET_REGISTER , +TS1_CFG_REG , val,4 ); - val[0 ] =0x00 ; - val[1 ] =0x08 ; - val[2 ] =0x00 ; - val[3 ] =0x08 ; - status =cx231xx_write_ctrl_reg (dev,VRT_SET_REGISTER , -TS1_LENGTH_REG , val,4 ); - - }else { -pr_info (" BDA\n" ); - status =cx231xx_mode_register (dev,TS_MODE_REG ,0x101 ); - status =cx231xx_mode_register (dev,TS1_CFG_REG ,0x010 ); - } + val[0 ] =0x00 ; + val[1 ] =0x08 ; + val[2 ] =0x00 ; + val[3 ] =0x08 ; + status =cx231xx_write_ctrl_reg (dev, +VRT_SET_REGISTER , +TS1_LENGTH_REG , val,4 ); + }else { +pr_debug ("%s: BDA\n" , __func__); + status =cx231xx_mode_register (dev, +TS_MODE_REG ,0x101 ); + status =cx231xx_mode_register (dev, +TS1_CFG_REG ,0x010 ); + }break ;case TS1_parallel_mode:
Signature · 1 line
1.9.3
PATCH v2 3/14 cx231xx: Cleanup printk at the driver
In reply to Mauro Carvalho ChehabThere are lots of debug printks printed with pr_info. Also, the printk's data are not too coherent:
- there are duplicated driver name at the print format;
- function name format string differs from function to function;
- long strings broken into multiple lines;
- some printks just produce ugly reports, being almost useless as-is.
Do a cleanup on that.
Still, there are much to be done in order to do a better printk job on this driver, but, at least it will now be a way less verbose, if debug printks are disabled, and some logs might actually be useful.
drivers/media/usb/cx231xx/cx231xx-417.c +7 -8
@@ -90,10 +90,10 @@ static unsigned int v4l_debug = 1;module_param (v4l_debug, int,0644 );MODULE_PARM_DESC (v4l_debug,"enable V4L debug messages" ); -#define dprintk(level, fmt, arg...)\ - do { if (v4l_debug >= level) \ - pr_info("%s: " fmt, \ - (dev) ? dev->name : "cx231xx[?]", ## arg); \ +#define dprintk(level, fmt, arg...) \ + do { \ + if (v4l_debug >= level) \ + printk(KERN_DEBUG pr_fmt(fmt), ## arg); \ } while (0)static struct cx231xx_tvnorm cx231xx_tvnorms[] = {
@@ -1114,15 +1114,15 @@ static int cx231xx_initialize_codec(struct cx231xx *dev)cx231xx_disable656 (dev); retval =cx231xx_api_cmd (dev,CX2341X_ENC_PING_FW ,0 ,0 );/* ping */ if (retval <0 ) { -dprintk (2 ,"%s() PING OK\n" , __func__); +dprintk (2 ,"%s: PING OK\n" , __func__); retval =cx231xx_load_firmware (dev);if (retval <0 ) { -pr_err ("%s() f/w load failed\n" , __func__); +pr_err ("%s: f/w load failed\n" , __func__);return retval; } retval =cx231xx_find_mailbox (dev);if (retval <0 ) { -pr_err ("%s() mailbox < 0, error\n" , +pr_err ("%s: mailbox < 0, error\n" , __func__);return -1 ; }
@@ -1798,7 +1798,6 @@ static unsigned int mpeg_poll(struct file *file,static int mpeg_mmap (struct file *file,struct vm_area_struct *vma) {struct cx231xx_fh *fh = file->private_data; -struct cx231xx *dev = fh->dev;dprintk (2 ,"%s()\n" , __func__);
drivers/media/usb/cx231xx/cx231xx-audio.c +8 -12
@@ -277,7 +277,7 @@ static int cx231xx_init_audio_isoc(struct cx231xx *dev)int i, errCode;int sb_size; -pr_info ("%s: Starting ISO AUDIO transfers\n" , __func__); +pr_debug ("%s: Starting ISO AUDIO transfers\n" , __func__);if (dev->state &DEV_DISCONNECTED )return -ENODEV ;
@@ -338,7 +338,7 @@ static int cx231xx_init_audio_bulk(struct cx231xx *dev)int i, errCode;int sb_size; -pr_info ("%s: Starting BULK AUDIO transfers\n" , __func__); +pr_debug ("%s: Starting BULK AUDIO transfers\n" , __func__);if (dev->state &DEV_DISCONNECTED )return -ENODEV ;
@@ -439,8 +439,7 @@ static int snd_cx231xx_capture_open(struct snd_pcm_substream *substream)dprintk ("opening device and trying to acquire exclusive lock\n" );if (!dev) { -pr_err ("BUG: cx231xx can't find device struct." -" Can't proceed with open\n" ); +pr_err ("BUG: cx231xx can't find device struct. Can't proceed with open\n" );return -ENODEV ; }
@@ -662,8 +661,7 @@ static int cx231xx_audio_init(struct cx231xx *dev)return 0 ; } -pr_info ("cx231xx-audio.c: probing for cx231xx " -"non standard usbaudio\n" ); +pr_debug ("probing for cx231xx non standard usbaudio\n" ); err =snd_card_new (&dev->udev->dev, index[devnr],"Cx231xx Audio" ,THIS_MODULE ,0 , &card);
@@ -707,14 +705,12 @@ static int cx231xx_audio_init(struct cx231xx *dev) bEndpointAddress; adev->num_alt = uif->num_altsetting; -pr_info ("EndPoint Addr 0x%x, Alternate settings: %i\n" , - adev->end_point_addr, adev->num_alt); +pr_info ("audio EndPoint Addr 0x%x, Alternate settings: %i\n" , + adev->end_point_addr, adev->num_alt); adev->alt_max_pkt_size =kmalloc (32 * adev->num_alt,GFP_KERNEL ); -if (adev->alt_max_pkt_size ==NULL ) { -pr_err ("out of memory!\n" ); +if (adev->alt_max_pkt_size ==NULL )return -ENOMEM ; - }for (i =0 ; i < adev->num_alt; i++) { u16 tmp =
@@ -722,7 +718,7 @@ static int cx231xx_audio_init(struct cx231xx *dev) wMaxPacketSize); adev->alt_max_pkt_size[i] = (tmp &0x07ff ) * (((tmp &0x1800 ) >>11 ) +1 ); -pr_info ("Alternate setting %i, max size= %i\n" , i, +pr_debug ("audio alternate setting %i, max size= %i\n" , i, adev->alt_max_pkt_size[i]); }
drivers/media/usb/cx231xx/cx231xx-avcore.c +68 -74
409 lines not on this page · raw message
drivers/media/usb/cx231xx/cx231xx-cards.c +33 -48
209 lines not on this page · raw message
drivers/media/usb/cx231xx/cx231xx-core.c +36 -57
213 lines not on this page · raw message
drivers/media/usb/cx231xx/cx231xx-dvb.c +5 -7
@@ -265,7 +265,7 @@ static int start_streaming(struct cx231xx_dvb *dvb)struct cx231xx *dev = dvb->adapter.priv;if (dev->USE_ISO) { -pr_info ("DVB transfer mode is ISO.\n" ); +pr_debug ("DVB transfer mode is ISO.\n" );cx231xx_set_alt_setting (dev,INDEX_TS1 ,4 ); rc =cx231xx_set_mode (dev,CX231XX_DIGITAL_MODE );if (rc <0 )
@@ -276,7 +276,7 @@ static int start_streaming(struct cx231xx_dvb *dvb) dev->ts1_mode.max_pkt_size, dvb_isoc_copy); }else { -pr_info ("DVB transfer mode is BULK.\n" ); +pr_debug ("DVB transfer mode is BULK.\n" );cx231xx_set_alt_setting (dev,INDEX_TS1 ,0 ); rc =cx231xx_set_mode (dev,CX231XX_DIGITAL_MODE );if (rc <0 )
@@ -430,16 +430,14 @@ int cx231xx_reset_analog_tuner(struct cx231xx *dev)if (dops->init !=NULL && !dev->xc_fw_load_done) { -pr_info ("Reloading firmware for XC5000\n" ); +pr_debug ("Reloading firmware for XC5000\n" ); status = dops->init (dev->dvb->frontend);if (status ==0 ) { dev->xc_fw_load_done =1 ; -pr_info - ("XC5000 firmware download completed\n" ); +pr_debug ("XC5000 firmware download completed\n" ); }else { dev->xc_fw_load_done =0 ; -pr_info - ("XC5000 firmware download failed !!!\n" ); +pr_debug ("XC5000 firmware download failed !!!\n" ); } }
drivers/media/usb/cx231xx/cx231xx-i2c.c +8 -9
@@ -498,17 +498,18 @@ void cx231xx_do_i2c_scan(struct cx231xx *dev, int i2c_port)memset (&client,0 ,sizeof (client)); client.adapter =cx231xx_get_i2c_adap (dev, i2c_port); -pr_info (": Checking for I2C devices on port=%d ..\n" , i2c_port); +pr_info ("i2c_scan: checking for I2C devices on port=%d ..\n" , + i2c_port);for (i =0 ; i <128 ; i++) { client.addr = i; rc =i2c_master_recv (&client, &buf,0 );if (rc <0 )continue ; -pr_info ("%s: i2c scan: found device @ 0x%x [%s]\n" , - dev->name, i <<1 , - i2c_devs[i] ? i2c_devs[i] :"???" ); +pr_info ("i2c scan: found device @ 0x%x [%s]\n" , + i <<1 , + i2c_devs[i] ? i2c_devs[i] :"???" ); } -pr_info (": Completed Checking for I2C devices on port=%d.\n" , +pr_info ("i2c scan: Completed Checking for I2C devices on port=%d.\n" , i2c_port); }
@@ -532,8 +533,7 @@ int cx231xx_i2c_register(struct cx231xx_i2c *bus)i2c_add_adapter (&bus->i2c_adap);if (0 != bus->i2c_rc) -pr_warn ("%s: i2c bus %d register FAILED\n" , - dev->name, bus->nr); +pr_warn ("i2c bus %d register FAILED\n" , bus->nr);return bus->i2c_rc; }
@@ -576,8 +576,7 @@ int cx231xx_i2c_mux_register(struct cx231xx *dev, int mux_no) NULL);if (!dev->i2c_mux_adap[mux_no]) -pr_warn ("%s: i2c mux %d register FAILED\n" , - dev->name, mux_no); +pr_warn ("i2c mux %d register FAILED\n" , mux_no);return 0 ; }
drivers/media/usb/cx231xx/cx231xx-pcb-cfg.c +6 -6
@@ -703,9 +703,9 @@ int initialize_cx231xx(struct cx231xx *dev) _current_scenario_idx =INDEX_BUSPOWER_DIF_ONLY ;break ;default : -pr_info ("bad config in buspower!!!!\n" ); -pr_info ("config_info=%x\n" , - (config_info &BUSPOWER_MASK )); +pr_err ("bad config in buspower!!!!\n" ); +pr_err ("config_info=%x\n" , + config_info &BUSPOWER_MASK );return 1 ; } }else {/* self-power */
@@ -768,9 +768,9 @@ int initialize_cx231xx(struct cx231xx *dev) _current_scenario_idx =INDEX_SELFPOWER_COMPRESSOR ;break ;default : -pr_info ("bad senario!!!!!\n" ); -pr_info ("config_info=%x\n" , - (config_info &SELFPOWER_MASK )); +pr_err ("bad senario!!!!!\n" ); +pr_err ("config_info=%x\n" , + config_info &SELFPOWER_MASK );return -ENODEV ; } }
drivers/media/usb/cx231xx/cx231xx-vbi.c +11 -13
@@ -69,11 +69,10 @@ static inline void print_err_status(struct cx231xx *dev, int packet, int status)break ; }if (packet <0 ) { -pr_err ("URB status %d [%s].\n" , status, - errmsg); +pr_err ("URB status %d [%s].\n" , status, errmsg); }else {pr_err ("URB packet %d, status %d [%s].\n" , - packet, status, errmsg); + packet, status, errmsg); } }
@@ -317,7 +316,7 @@ static void cx231xx_irq_vbi_callback(struct urb *urb)return ;default :/* error */ pr_err ("urb completition error %d.\n" , - urb->status); + urb->status);break ; }
@@ -332,7 +331,7 @@ static void cx231xx_irq_vbi_callback(struct urb *urb) urb->status =usb_submit_urb (urb,GFP_ATOMIC );if (urb->status) {pr_err ("urb resubmit failed (error=%i)\n" , - urb->status); + urb->status); } }
@@ -344,7 +343,7 @@ void cx231xx_uninit_vbi_isoc(struct cx231xx *dev)struct urb *urb;int i; -pr_info ("called cx231xx_uninit_vbi_isoc\n" ); +pr_debug ("called cx231xx_uninit_vbi_isoc\n" ); dev->vbi_mode.bulk_ctl.nfields =-1 ;for (i =0 ; i < dev->vbi_mode.bulk_ctl.num_bufs; i++) {
@@ -393,7 +392,7 @@ int cx231xx_init_vbi_isoc(struct cx231xx *dev, int max_packets,struct urb *urb;int rc; -pr_info ("called cx231xx_vbi_isoc\n" ); +pr_debug ("called cx231xx_vbi_isoc\n" );/* De-allocates all pending stuff */ cx231xx_uninit_vbi_isoc (dev);
@@ -451,9 +450,9 @@ int cx231xx_init_vbi_isoc(struct cx231xx *dev, int max_packets, dev->vbi_mode.bulk_ctl.transfer_buffer[i] =kzalloc (sb_size,GFP_KERNEL );if (!dev->vbi_mode.bulk_ctl.transfer_buffer[i]) { -pr_err ("unable to allocate %i bytes for transfer" -" buffer %i%s\n" , sb_size, i, -in_interrupt () ?" while in int" :"" ); +pr_err ("unable to allocate %i bytes for transfer buffer %i%s\n" , + sb_size, i, +in_interrupt () ?" while in int" :"" );cx231xx_uninit_vbi_isoc (dev);return -ENOMEM ; }
@@ -470,8 +469,7 @@ int cx231xx_init_vbi_isoc(struct cx231xx *dev, int max_packets,for (i =0 ; i < dev->vbi_mode.bulk_ctl.num_bufs; i++) { rc =usb_submit_urb (dev->vbi_mode.bulk_ctl.urb[i],GFP_ATOMIC );if (rc) { -pr_err ("submit of urb %i failed (error=%i)\n" , i, - rc); +pr_err ("submit of urb %i failed (error=%i)\n" , i, rc);cx231xx_uninit_vbi_isoc (dev);return rc; }
@@ -522,7 +520,7 @@ static inline void vbi_buffer_filled(struct cx231xx *dev, struct cx231xx_buffer *buf) {/* Advice that buffer was filled */ -/* pr_info("[%p/%d] wakeup\n", buf, buf->vb.i); */ +/* pr_debug("[%p/%d] wakeup\n", buf, buf->vb.i); */ buf->vb.state =VIDEOBUF_DONE ; buf->vb.field_count++;
drivers/media/usb/cx231xx/cx231xx-video.c +17 -24
127 lines not on this page · raw message
drivers/media/usb/cx231xx/cx231xx.h +0 -1
@@ -809,7 +809,6 @@ void cx231xx_Setup_AFE_for_LowIF(struct cx231xx *dev);void reset_s5h1432_demod (struct cx231xx *dev);void cx231xx_dump_HH_reg (struct cx231xx *dev);void update_HH_register_after_set_DIF (struct cx231xx *dev); -void cx231xx_dump_SC_reg (struct cx231xx *dev);
Signature · 1 line
1.9.3
PATCH v2 4/14 cx25840: Don't report an error if max size is adjusted
In reply to Mauro Carvalho ChehabThere's no reason to report:
cx25840 7-0044: Firmware download size changed to 16 bytes max length
If the driver needs to adjust the buffer's maximum size.
drivers/media/i2c/cx25840/cx25840-firmware.c +3 -4
@@ -122,10 +122,9 @@ int cx25840_loadfw(struct i2c_client *client) gpio_da =cx25840_read (client,0x164 ); } -if (is_cx231xx (state) &&MAX_BUF_SIZE >16 ) { -v4l_err (client," Firmware download size changed to 16 bytes max length\n" ); -MAX_BUF_SIZE =16 ;/* cx231xx cannot accept more than 16 bytes at a time */ - } +/* cx231xx cannot accept more than 16 bytes at a time */ +if (is_cx231xx (state) &&MAX_BUF_SIZE >16 ) +MAX_BUF_SIZE =16 ;if (request_firmware (&fw, fwname,FWDEV (client)) !=0 ) {v4l_err (client,"unable to open firmware %s\n" , fwname);
Signature · 1 line
1.9.3
PATCH v2 5/14 cx25840: convert max_buf_size var to lowercase
In reply to Mauro Carvalho ChehabCodingStyle fix: vars should be in lowercase.
drivers/media/i2c/cx25840/cx25840-firmware.c +4 -4
@@ -113,7 +113,7 @@ int cx25840_loadfw(struct i2c_client *client)const u8 *ptr;const char *fwname =get_fw_name (client);int size, retval; -int MAX_BUF_SIZE =FWSEND ; +int max_buf_size =FWSEND ;u32 gpio_oe =0 , gpio_da =0 ;if (is_cx2388x (state)) {
@@ -123,8 +123,8 @@ int cx25840_loadfw(struct i2c_client *client) }/* cx231xx cannot accept more than 16 bytes at a time */ -if (is_cx231xx (state) &&MAX_BUF_SIZE >16 ) -MAX_BUF_SIZE =16 ; +if (is_cx231xx (state) && max_buf_size >16 ) + max_buf_size =16 ;if (request_firmware (&fw, fwname,FWDEV (client)) !=0 ) {v4l_err (client,"unable to open firmware %s\n" , fwname);
@@ -139,7 +139,7 @@ int cx25840_loadfw(struct i2c_client *client) size = fw->size; ptr = fw->data;while (size >0 ) { -int len =min (MAX_BUF_SIZE -2 , size); +int len =min (max_buf_size -2 , size);memcpy (buffer +2 , ptr, len);
Signature · 1 line
1.9.3
PATCH v2 6/14 cx231xx: use 1 byte read for i2c scan
In reply to Mauro Carvalho ChehabFrom: Matthias Schwarzott <[email protected]>
Now cx231xx_i2c_check_for_device works like i2c_check_for_device of em28xx driver.
For me this fixes scanning of all ports but port 2.
drivers/media/usb/cx231xx/cx231xx-i2c.c +4 -3
@@ -350,14 +350,15 @@ static int cx231xx_i2c_check_for_device(struct i2c_adapter *i2c_adap,struct cx231xx *dev = bus->dev;struct cx231xx_i2c_xfer_data req_data;int status =0 ; +u8 buf[1 ];/* prepare xfer_data struct */ req_data.dev_addr = msg->addr; - req_data.direction = msg->flags; + req_data.direction =I2C_M_RD ; req_data.saddr_len =0 ; req_data.saddr_dat =0 ; - req_data.buf_size =0 ; - req_data.p_buffer =NULL ; + req_data.buf_size =1 ; + req_data.p_buffer = buf;/* usb send command */ status = dev->cx231xx_send_usb_command (bus, &req_data);
Signature · 1 line
1.9.3
PATCH v2 7/14 cx231xx: disable I2C errors during i2c_scan
In reply to Mauro Carvalho ChehabOtherwise, it would produce lots of useless messages like:
cx231xx: cx231xx_send_usb_command: failed with status --32
After this patch, I2C scan will produce an useful report:
[ 9494.050807] cx231xx: i2c_scan: checking for I2C devices on port=0 .. [ 9494.074928] cx231xx: i2c scan: Completed Checking for I2C devices on port=0. [ 9494.074936] cx231xx: i2c_scan: checking for I2C devices on port=3 .. [ 9494.098934] cx231xx: i2c scan: Completed Checking for I2C devices on port=3. [ 9494.098942] cx231xx: i2c_scan: checking for I2C devices on port=2 .. [ 9494.118440] cx231xx: i2c scan: Completed Checking for I2C devices on port=2. [ 9494.118448] cx231xx: i2c_scan: checking for I2C devices on port=4 .. [ 9494.141889] cx231xx: i2c scan: Completed Checking for I2C devices on port=4.
[ 9494.060182] cx231xx: i2c scan: found device @ 0x40 [???] [ 9494.062953] cx231xx: i2c scan: found device @ 0x60 [colibri] [ 9494.066071] cx231xx: i2c scan: found device @ 0x88 [hammerhead] [ 9494.067383] cx231xx: i2c scan: found device @ 0x98 [???] [ 9494.090113] cx231xx: i2c scan: found device @ 0xa0 [eeprom] [ 9494.106463] cx231xx: i2c scan: found device @ 0x60 [colibri] [ 9494.113762] cx231xx: i2c scan: found device @ 0xc0 [tuner] [ 9494.121882] cx231xx: i2c scan: found device @ 0x20 [???]
drivers/media/usb/cx231xx/cx231xx-core.c +1 -1
@@ -227,7 +227,7 @@ int cx231xx_send_usb_command(struct cx231xx_i2c *i2c_bus,/* call common vendor command request */ status =cx231xx_send_vendor_cmd (dev, &ven_req); -if (status <0 ) { +if (status <0 && !dev->i2c_scan_running) {pr_err ("%s: failed with status -%d\n" , __func__, status); }
drivers/media/usb/cx231xx/cx231xx-i2c.c +5 -0
@@ -496,6 +496,9 @@ void cx231xx_do_i2c_scan(struct cx231xx *dev, int i2c_port)if (!i2c_scan)return ; +/* Don't generate I2C errors during scan */ + dev->i2c_scan_running = true; +memset (&client,0 ,sizeof (client)); client.adapter =cx231xx_get_i2c_adap (dev, i2c_port);
@@ -512,6 +515,8 @@ void cx231xx_do_i2c_scan(struct cx231xx *dev, int i2c_port) }pr_info ("i2c scan: Completed Checking for I2C devices on port=%d.\n" , i2c_port); + + dev->i2c_scan_running = false; }/*
drivers/media/usb/cx231xx/cx231xx.h +2 -0
@@ -610,6 +610,8 @@ struct cx231xx { unsigned int has_audio_class:1; unsigned int has_alsa_audio:1; + unsigned int i2c_scan_running:1; /* true only during i2c_scan */ +struct cx231xx_fmt *format;struct v4l2_device v4l2_dev;
Signature · 1 line
1.9.3
PATCH v2 8/14 cx231xx: convert from pr_foo to dev_foo
In reply to Mauro Carvalho ChehabReplace all pr_foo occurrences by dev_foo, as this is the recommended way for drivers.
drivers/media/usb/cx231xx/cx231xx-417.c +24 -14
@@ -39,7 +39,6 @@#include <media/v4l2-event.h> #include <media/cx2341x.h> #include <media/tuner.h> -#include <linux/usb.h> #define CX231xx_FIRM_IMAGE_SIZE 376836#define CX231xx_FIRM_IMAGE_NAME "v4l-cx23885-enc.fw"
@@ -988,7 +987,8 @@ static int cx231xx_load_firmware(struct cx231xx *dev) IVTV_REG_APU, 0);if (retval !=0 ) { -pr_err ("%s: Error with mc417_register_write\n" , __func__); +dev_err (&dev->udev->dev, +"%s: Error with mc417_register_write\n" , __func__);return -1 ; }
@@ -996,21 +996,25 @@ static int cx231xx_load_firmware(struct cx231xx *dev) &dev->udev->dev);if (retval !=0 ) { -pr_err ("ERROR: Hotplug firmware request failed (%s).\n" , +dev_err (&dev->udev->dev, +"ERROR: Hotplug firmware request failed (%s).\n" , CX231xx_FIRM_IMAGE_NAME); -pr_err ("Please fix your hotplug setup, the board will not work without firmware loaded!\n" ); +dev_err (&dev->udev->dev, +"Please fix your hotplug setup, the board will not work without firmware loaded!\n" );return -1 ; }if (firmware->size != CX231xx_FIRM_IMAGE_SIZE) { -pr_err ("ERROR: Firmware size mismatch (have %zd, expected %d)\n" , +dev_err (&dev->udev->dev, +"ERROR: Firmware size mismatch (have %zd, expected %d)\n" , firmware->size, CX231xx_FIRM_IMAGE_SIZE);release_firmware (firmware);return -1 ; }if (0 !=memcmp (firmware->data, magic,8 )) { -pr_err ("ERROR: Firmware magic mismatch, wrong file?\n" ); +dev_err (&dev->udev->dev, +"ERROR: Firmware magic mismatch, wrong file?\n" );release_firmware (firmware);return -1 ; }
@@ -1057,7 +1061,8 @@ static int cx231xx_load_firmware(struct cx231xx *dev) retval |=mc417_register_write (dev,IVTV_REG_HW_BLOCKS ,IVTV_CMD_HW_BLOCKS_RST );if (retval <0 ) { -pr_err ("%s: Error with mc417_register_write\n" , +dev_err (&dev->udev->dev, +"%s: Error with mc417_register_write\n" , __func__);return retval; }
@@ -1069,7 +1074,8 @@ static int cx231xx_load_firmware(struct cx231xx *dev) retval |=mc417_register_write (dev,IVTV_REG_VPU , value &0xFFFFFFE8 );if (retval <0 ) { -pr_err ("%s: Error with mc417_register_write\n" , +dev_err (&dev->udev->dev, +"%s: Error with mc417_register_write\n" , __func__);return retval; }
@@ -1117,25 +1123,28 @@ static int cx231xx_initialize_codec(struct cx231xx *dev)dprintk (2 ,"%s: PING OK\n" , __func__); retval =cx231xx_load_firmware (dev);if (retval <0 ) { -pr_err ("%s: f/w load failed\n" , __func__); +dev_err (&dev->udev->dev, +"%s: f/w load failed\n" , __func__);return retval; } retval =cx231xx_find_mailbox (dev);if (retval <0 ) { -pr_err ("%s: mailbox < 0, error\n" , +dev_err (&dev->udev->dev,"%s: mailbox < 0, error\n" , __func__);return -1 ; } dev->cx23417_mailbox = retval; retval =cx231xx_api_cmd (dev,CX2341X_ENC_PING_FW ,0 ,0 );if (retval <0 ) { -pr_err ("ERROR: cx23417 firmware ping failed!\n" ); +dev_err (&dev->udev->dev, +"ERROR: cx23417 firmware ping failed!\n" );return -1 ; } retval =cx231xx_api_cmd (dev,CX2341X_ENC_GET_VERSION ,0 ,1 , &version);if (retval <0 ) { -pr_err ("ERROR: cx23417 firmware get encoder: version failed!\n" ); +dev_err (&dev->udev->dev, +"ERROR: cx23417 firmware get encoder: version failed!\n" );return -1 ; }dprintk (1 ,"cx23417 firmware version is 0x%08x\n" , version);
@@ -1416,8 +1425,9 @@ static int bb_buf_prepare(struct videobuf_queue *q,if (!dev->video_mode.bulk_ctl.num_bufs) urb_init =1 ; } -/*pr_info("urb_init=%d dev->video_mode.max_pkt_size=%d\n", -urb_init, dev->video_mode.max_pkt_size);*/ +dev_dbg (&dev->udev->dev, +"urb_init=%d dev->video_mode.max_pkt_size=%d\n" , + urb_init, dev->video_mode.max_pkt_size); dev->mode_tv =1 ;if (urb_init) {
drivers/media/usb/cx231xx/cx231xx-audio.c +27 -17
126 lines not on this page · raw message
drivers/media/usb/cx231xx/cx231xx-avcore.c +123 -90
501 lines not on this page · raw message
drivers/media/usb/cx231xx/cx231xx-cards.c +72 -53
313 lines not on this page · raw message
drivers/media/usb/cx231xx/cx231xx-core.c +47 -26
222 lines not on this page · raw message
drivers/media/usb/cx231xx/cx231xx-dvb.c +8 -6
@@ -22,7 +22,6 @@#include "cx231xx.h" #include <linux/kernel.h> #include <linux/slab.h> -#include <linux/usb.h> #include <media/v4l2-common.h> #include <media/videobuf-vmalloc.h>
@@ -265,7 +264,7 @@ static int start_streaming(struct cx231xx_dvb *dvb)struct cx231xx *dev = dvb->adapter.priv;if (dev->USE_ISO) { -pr_debug ("DVB transfer mode is ISO.\n" ); +dev_dbg (&dev->udev->dev,"DVB transfer mode is ISO.\n" );cx231xx_set_alt_setting (dev,INDEX_TS1 ,4 ); rc =cx231xx_set_mode (dev,CX231XX_DIGITAL_MODE );if (rc <0 )
@@ -276,7 +275,7 @@ static int start_streaming(struct cx231xx_dvb *dvb) dev->ts1_mode.max_pkt_size, dvb_isoc_copy); }else { -pr_debug ("DVB transfer mode is BULK.\n" ); +dev_dbg (&dev->udev->dev,"DVB transfer mode is BULK.\n" );cx231xx_set_alt_setting (dev,INDEX_TS1 ,0 ); rc =cx231xx_set_mode (dev,CX231XX_DIGITAL_MODE );if (rc <0 )
@@ -430,14 +429,17 @@ int cx231xx_reset_analog_tuner(struct cx231xx *dev)if (dops->init !=NULL && !dev->xc_fw_load_done) { -pr_debug ("Reloading firmware for XC5000\n" ); +dev_dbg (&dev->udev->dev, +"Reloading firmware for XC5000\n" ); status = dops->init (dev->dvb->frontend);if (status ==0 ) { dev->xc_fw_load_done =1 ; -pr_debug ("XC5000 firmware download completed\n" ); +dev_dbg (&dev->udev->dev, +"XC5000 firmware download completed\n" ); }else { dev->xc_fw_load_done =0 ; -pr_debug ("XC5000 firmware download failed !!!\n" ); +dev_dbg (&dev->udev->dev, +"XC5000 firmware download failed !!!\n" ); } }
drivers/media/usb/cx231xx/cx231xx-i2c.c +11 -8
@@ -23,7 +23,6 @@#include "cx231xx.h" #include <linux/module.h> #include <linux/kernel.h> -#include <linux/usb.h> #include <linux/i2c.h> #include <linux/i2c-mux.h> #include <media/v4l2-common.h>
@@ -502,18 +501,20 @@ void cx231xx_do_i2c_scan(struct cx231xx *dev, int i2c_port)memset (&client,0 ,sizeof (client)); client.adapter =cx231xx_get_i2c_adap (dev, i2c_port); -pr_info ("i2c_scan: checking for I2C devices on port=%d ..\n" , +dev_info (&dev->udev->dev, +"i2c_scan: checking for I2C devices on port=%d ..\n" , i2c_port);for (i =0 ; i <128 ; i++) { client.addr = i; rc =i2c_master_recv (&client, &buf,0 );if (rc <0 )continue ; -pr_info ("i2c scan: found device @ 0x%x [%s]\n" , - i <<1 , - i2c_devs[i] ? i2c_devs[i] :"???" ); +dev_info (&dev->udev->dev, +"i2c scan: found device @ 0x%x [%s]\n" , + i <<1 , + i2c_devs[i] ? i2c_devs[i] :"???" ); } -pr_info ("i2c scan: Completed Checking for I2C devices on port=%d.\n" , +dev_info (&dev->udev->dev,"i2c scan: Completed Checking for I2C devices on port=%d.\n" , i2c_port); dev->i2c_scan_running = false;
@@ -539,7 +540,8 @@ int cx231xx_i2c_register(struct cx231xx_i2c *bus)i2c_add_adapter (&bus->i2c_adap);if (0 != bus->i2c_rc) -pr_warn ("i2c bus %d register FAILED\n" , bus->nr); +dev_warn (&dev->udev->dev, +"i2c bus %d register FAILED\n" , bus->nr);return bus->i2c_rc; }
@@ -582,7 +584,8 @@ int cx231xx_i2c_mux_register(struct cx231xx *dev, int mux_no) NULL);if (!dev->i2c_mux_adap[mux_no]) -pr_warn ("i2c mux %d register FAILED\n" , mux_no); +dev_warn (&dev->udev->dev, +"i2c mux %d register FAILED\n" , mux_no);return 0 ; }
drivers/media/usb/cx231xx/cx231xx-input.c +0 -1
@@ -19,7 +19,6 @@*/ #include "cx231xx.h" -#include <linux/usb.h> #include <linux/slab.h> #include <linux/bitrev.h>
drivers/media/usb/cx231xx/cx231xx-pcb-cfg.c +27 -16
61 lines not on this page · raw message
drivers/media/usb/cx231xx/cx231xx-vbi.c +21 -15
@@ -25,7 +25,6 @@#include <linux/module.h> #include <linux/kernel.h> #include <linux/bitmap.h> -#include <linux/usb.h> #include <linux/i2c.h> #include <linux/mm.h> #include <linux/mutex.h>
@@ -69,9 +68,11 @@ static inline void print_err_status(struct cx231xx *dev, int packet, int status)break ; }if (packet <0 ) { -pr_err ("URB status %d [%s].\n" , status, errmsg); +dev_err (&dev->udev->dev, +"URB status %d [%s].\n" , status, errmsg); }else { -pr_err ("URB packet %d, status %d [%s].\n" , +dev_err (&dev->udev->dev, +"URB packet %d, status %d [%s].\n" , packet, status, errmsg); } }
@@ -315,8 +316,8 @@ static void cx231xx_irq_vbi_callback(struct urb *urb)case -ESHUTDOWN :return ;default :/* error */ -pr_err ("urb completition error %d.\n" , - urb->status); +dev_err (&dev->udev->dev, +"urb completition error %d.\n" , urb->status);break ; }
@@ -330,7 +331,7 @@ static void cx231xx_irq_vbi_callback(struct urb *urb) urb->status =usb_submit_urb (urb,GFP_ATOMIC );if (urb->status) { -pr_err ("urb resubmit failed (error=%i)\n" , +dev_err (&dev->udev->dev,"urb resubmit failed (error=%i)\n" , urb->status); } }
@@ -343,7 +344,7 @@ void cx231xx_uninit_vbi_isoc(struct cx231xx *dev)struct urb *urb;int i; -pr_debug ("called cx231xx_uninit_vbi_isoc\n" ); +dev_dbg (&dev->udev->dev,"called cx231xx_uninit_vbi_isoc\n" ); dev->vbi_mode.bulk_ctl.nfields =-1 ;for (i =0 ; i < dev->vbi_mode.bulk_ctl.num_bufs; i++) {
@@ -392,7 +393,7 @@ int cx231xx_init_vbi_isoc(struct cx231xx *dev, int max_packets,struct urb *urb;int rc; -pr_debug ("called cx231xx_vbi_isoc\n" ); +dev_dbg (&dev->udev->dev,"called cx231xx_vbi_isoc\n" );/* De-allocates all pending stuff */ cx231xx_uninit_vbi_isoc (dev);
@@ -418,14 +419,16 @@ int cx231xx_init_vbi_isoc(struct cx231xx *dev, int max_packets, dev->vbi_mode.bulk_ctl.urb =kzalloc (sizeof (void *) * num_bufs,GFP_KERNEL );if (!dev->vbi_mode.bulk_ctl.urb) { -pr_err ("cannot alloc memory for usb buffers\n" ); +dev_err (&dev->udev->dev, +"cannot alloc memory for usb buffers\n" );return -ENOMEM ; } dev->vbi_mode.bulk_ctl.transfer_buffer =kzalloc (sizeof (void *) * num_bufs,GFP_KERNEL );if (!dev->vbi_mode.bulk_ctl.transfer_buffer) { -pr_err ("cannot allocate memory for usbtransfer\n" ); +dev_err (&dev->udev->dev, +"cannot allocate memory for usbtransfer\n" );kfree (dev->vbi_mode.bulk_ctl.urb);return -ENOMEM ; }
@@ -440,7 +443,8 @@ int cx231xx_init_vbi_isoc(struct cx231xx *dev, int max_packets, urb =usb_alloc_urb (0 ,GFP_KERNEL );if (!urb) { -pr_err ("cannot alloc bulk_ctl.urb %i\n" , i); +dev_err (&dev->udev->dev, +"cannot alloc bulk_ctl.urb %i\n" , i);cx231xx_uninit_vbi_isoc (dev);return -ENOMEM ; }
@@ -450,7 +454,8 @@ int cx231xx_init_vbi_isoc(struct cx231xx *dev, int max_packets, dev->vbi_mode.bulk_ctl.transfer_buffer[i] =kzalloc (sb_size,GFP_KERNEL );if (!dev->vbi_mode.bulk_ctl.transfer_buffer[i]) { -pr_err ("unable to allocate %i bytes for transfer buffer %i%s\n" , +dev_err (&dev->udev->dev, +"unable to allocate %i bytes for transfer buffer %i%s\n" , sb_size, i,in_interrupt () ?" while in int" :"" );cx231xx_uninit_vbi_isoc (dev);
@@ -469,7 +474,8 @@ int cx231xx_init_vbi_isoc(struct cx231xx *dev, int max_packets,for (i =0 ; i < dev->vbi_mode.bulk_ctl.num_bufs; i++) { rc =usb_submit_urb (dev->vbi_mode.bulk_ctl.urb[i],GFP_ATOMIC );if (rc) { -pr_err ("submit of urb %i failed (error=%i)\n" , i, rc); +dev_err (&dev->udev->dev, +"submit of urb %i failed (error=%i)\n" , i, rc);cx231xx_uninit_vbi_isoc (dev);return rc; }
@@ -520,7 +526,7 @@ static inline void vbi_buffer_filled(struct cx231xx *dev, struct cx231xx_buffer *buf) {/* Advice that buffer was filled */ -/* pr_debug("[%p/%d] wakeup\n", buf, buf->vb.i); */ +/* dev_dbg(&dev->udev->dev, "[%p/%d] wakeup\n", buf, buf->vb.i); */ buf->vb.state =VIDEOBUF_DONE ; buf->vb.field_count++;
@@ -612,7 +618,7 @@ static inline void get_next_vbi_buf(struct cx231xx_dmaqueue *dma_q,char *outp;if (list_empty (&dma_q->active)) { -pr_err ("No active queue to serve\n" ); +dev_err (&dev->udev->dev,"No active queue to serve\n" ); dev->vbi_mode.bulk_ctl.buf =NULL ; *buf =NULL ;return ;
drivers/media/usb/cx231xx/cx231xx-video.c +34 -28
194 lines not on this page · raw message
drivers/media/usb/cx231xx/cx231xx.h +1 -2
@@ -22,14 +22,13 @@#ifndef _CX231XX_H#define _CX231XX_H -#define pr_fmt (fmt) KBUILD_MODNAME ": " fmt -#include <linux/videodev2.h> #include <linux/types.h> #include <linux/ioctl.h> #include <linux/i2c.h> #include <linux/workqueue.h> #include <linux/mutex.h> +#include <linux/usb.h> #include <media/cx2341x.h>
Signature · 1 line
1.9.3
PATCH v2 9/14 cx231xx: get rid of audio debug parameter
In reply to Mauro Carvalho ChehabThere's just one debug level on cx231xx-audio. So, converting it to dev_dbg() is easy.
drivers/media/usb/cx231xx/cx231xx-audio.c +19 -20
@@ -42,19 +42,13 @@ static int debug;module_param (debug, int,0644 );MODULE_PARM_DESC (debug,"activates debug info" ); -#define dprintk(fmt, arg...) do { \ - if (debug) \ - printk(KERN_INFO "cx231xx-audio %s: " fmt, \ - __func__, ##arg); \ - } while (0) -static int index[SNDRV_CARDS ] =SNDRV_DEFAULT_IDX ;static int cx231xx_isoc_audio_deinit (struct cx231xx *dev) {int i; -dprintk ("Stopping isoc\n" ); +dev_dbg (&dev->udev->dev,"Stopping isoc\n" );for (i =0 ; i <CX231XX_AUDIO_BUFS ; i++) {if (dev->adev.urb[i]) {
@@ -78,7 +72,7 @@ static int cx231xx_bulk_audio_deinit(struct cx231xx *dev) {int i; -dprintk ("Stopping bulk\n" ); +dev_dbg (&dev->udev->dev,"Stopping bulk\n" );for (i =0 ; i <CX231XX_AUDIO_BUFS ; i++) {if (dev->adev.urb[i]) {
@@ -122,7 +116,8 @@ static void cx231xx_audio_isocirq(struct urb *urb)case -ESHUTDOWN :return ;default :/* error */ -dprintk ("urb completition error %d.\n" , urb->status); +dev_dbg (&dev->udev->dev,"urb completition error %d.\n" , + urb->status);break ; }
@@ -211,7 +206,8 @@ static void cx231xx_audio_bulkirq(struct urb *urb)case -ESHUTDOWN :return ;default :/* error */ -dprintk ("urb completition error %d.\n" , urb->status); +dev_dbg (&dev->udev->dev,"urb completition error %d.\n" , + urb->status);break ; }
@@ -395,8 +391,9 @@ static int snd_pcm_alloc_vmalloc_buffer(struct snd_pcm_substream *subs, size_t size) {struct snd_pcm_runtime *runtime = subs->runtime; +struct cx231xx *dev =snd_pcm_substream_chip (subs); -dprintk ("Allocating vbuffer\n" ); +dev_dbg (&dev->udev->dev,"Allocating vbuffer\n" );if (runtime->dma_area) {if (runtime->dma_bytes > size)return 0 ;
@@ -439,7 +436,8 @@ static int snd_cx231xx_capture_open(struct snd_pcm_substream *substream)struct snd_pcm_runtime *runtime = substream->runtime;int ret =0 ; -dprintk ("opening device and trying to acquire exclusive lock\n" ); +dev_dbg (&dev->udev->dev, +"opening device and trying to acquire exclusive lock\n" );if (!dev) { dev_err(&dev->udev->dev,
@@ -489,7 +487,7 @@ static int snd_cx231xx_pcm_close(struct snd_pcm_substream *substream)int ret;struct cx231xx *dev =snd_pcm_substream_chip (substream); -dprintk ("closing device\n" ); +dev_dbg (&dev->udev->dev,"closing device\n" );/* inform hardware to stop streaming */ mutex_lock (&dev->lock);
@@ -510,10 +508,10 @@ static int snd_cx231xx_pcm_close(struct snd_pcm_substream *substream)mutex_unlock (&dev->lock);if (dev->adev.users ==0 && dev->adev.shutdown ==1 ) { -dprintk ("audio users: %d\n" , dev->adev.users); -dprintk ("disabling audio stream!\n" ); +dev_dbg (&dev->udev->dev,"audio users: %d\n" , dev->adev.users); +dev_dbg (&dev->udev->dev,"disabling audio stream!\n" ); dev->adev.shutdown =0 ; -dprintk ("released lock\n" ); +dev_dbg (&dev->udev->dev,"released lock\n" );if (atomic_read (&dev->stream_started) >0 ) {atomic_set (&dev->stream_started,0 );schedule_work (&dev->wq_trigger);
@@ -525,9 +523,10 @@ static int snd_cx231xx_pcm_close(struct snd_pcm_substream *substream)static int snd_cx231xx_hw_capture_params (struct snd_pcm_substream *substream,struct snd_pcm_hw_params *hw_params) { +struct cx231xx *dev =snd_pcm_substream_chip (substream);int ret; -dprintk ("Setting capture parameters\n" ); +dev_dbg (&dev->udev->dev,"Setting capture parameters\n" ); ret =snd_pcm_alloc_vmalloc_buffer (substream,params_buffer_bytes (hw_params));
@@ -549,7 +548,7 @@ static int snd_cx231xx_hw_capture_free(struct snd_pcm_substream *substream) {struct cx231xx *dev =snd_pcm_substream_chip (substream); -dprintk ("Stop capture, if needed\n" ); +dev_dbg (&dev->udev->dev,"Stop capture, if needed\n" );if (atomic_read (&dev->stream_started) >0 ) {atomic_set (&dev->stream_started,0 );
@@ -574,7 +573,7 @@ static void audio_trigger(struct work_struct *work) struct cx231xx *dev = container_of(work, struct cx231xx, wq_trigger);if (atomic_read (&dev->stream_started)) { -dprintk ("starting capture" ); +dev_dbg (&dev->udev->dev,"starting capture" );if (is_fw_load (dev) ==0 )cx25840_call (dev, core, load_fw);if (dev->USE_ISO)
@@ -582,7 +581,7 @@ static void audio_trigger(struct work_struct *work)else cx231xx_init_audio_bulk (dev); }else { -dprintk ("stopping capture" ); +dev_dbg (&dev->udev->dev,"stopping capture" );cx231xx_isoc_audio_deinit (dev); } }
Signature · 1 line
1.9.3
PATCH v2 10/14 cx231xx: use dev_foo instead of printk
In reply to Mauro Carvalho ChehabThere are several places at cx231xx that uses printk without any special reason. Change all of them to use dev_foo().
drivers/media/usb/cx231xx/cx231xx-avcore.c +2 -1
@@ -1208,7 +1208,8 @@ int cx231xx_set_audio_decoder_input(struct cx231xx *dev,/* This is just a casual suggestion to people adding new boards in case they use a tuner type we don't currently know about */ -printk (KERN_INFO "Unknown tuner type configuring SIF" ); +dev_info (&dev->udev->dev, +"Unknown tuner type configuring SIF" );break ; }break ;
drivers/media/usb/cx231xx/cx231xx-cards.c +3 -3
@@ -1216,11 +1216,11 @@ static int cx231xx_init_dev(struct cx231xx *dev, struct usb_device *udev,cx231xx_add_into_devlist (dev);if (dev->board.has_417) { -printk (KERN_INFO "attach 417 %d\n" , dev->model); +dev_info (&udev->dev,"attach 417 %d\n" , dev->model);if (cx231xx_417_register (dev) <0 ) { -printk (KERN_ERR +dev_err (&udev->dev,"%s() Failed to register 417 on VID_B\n" , - __func__); + __func__); } }
drivers/media/usb/cx231xx/cx231xx-dvb.c +50 -46
248 lines not on this page · raw message
Signature · 1 line
1.9.3
PATCH v2 11/14 cx231xx: add addr for demod and make i2c_devs const
In reply to Mauro Carvalho ChehabI2C address 0x10 is the demod. While here, make the array const.
drivers/media/usb/cx231xx/cx231xx-i2c.c +2 -1
@@ -471,7 +471,8 @@ static struct i2c_adapter cx231xx_adap_template = {* i2c_devs * incomplete list of known devices */ -static char *i2c_devs[128 ] = { +static const char *i2c_devs[128 ] = { + [0x20 >>1 ] ="demod" , [0x60 >>1 ] ="colibri" , [0x88 >>1 ] ="hammerhead" , [0x8e >>1 ] ="CIR" ,
Signature · 1 line
1.9.3
PATCH v2 12/14 cx231xx: use dev_info() for extension load/unload
In reply to Mauro Carvalho ChehabNow that we're using dev_foo, the logs become like:
usb 1-2: DVB: registering adapter 0 frontend 0 (Fujitsu mb86A20s)... usb 1-2: Successfully loaded cx231xx-dvb
cx231xx: Cx231xx dvb Extension initialized
It is not clear, by the logs, that usb 1-2 name is an alias for cx231xx. So, we also need to use dvb_info() at extension load/unload.
After the patch, it will print:
usb 1-2: Cx231xx dvb Extension initialized
With is coherent with the other logs.
drivers/media/usb/cx231xx/cx231xx-core.c +6 -6
@@ -98,10 +98,10 @@ int cx231xx_register_extension(struct cx231xx_ops *ops)mutex_lock (&cx231xx_devlist_mutex);list_add_tail (&ops->next, &cx231xx_extension_devlist); -list_for_each_entry (dev, &cx231xx_devlist, devlist) +list_for_each_entry (dev, &cx231xx_devlist, devlist) { ops->init (dev); - - printk(KERN_INFO DRIVER_NAME ": %s initialized\n", ops->name); +dev_info (&dev->udev->dev,"%s initialized\n" , ops->name); + }mutex_unlock (&cx231xx_devlist_mutex);return 0 ; }
@@ -112,11 +112,11 @@ void cx231xx_unregister_extension(struct cx231xx_ops *ops)struct cx231xx *dev =NULL ;mutex_lock (&cx231xx_devlist_mutex); -list_for_each_entry (dev, &cx231xx_devlist, devlist) +list_for_each_entry (dev, &cx231xx_devlist, devlist) { ops->fini (dev); +dev_info (&dev->udev->dev,"%s removed\n" , ops->name); + } - - printk(KERN_INFO DRIVER_NAME ": %s removed\n", ops->name);list_del (&ops->next);mutex_unlock (&cx231xx_devlist_mutex); }
Signature · 1 line
1.9.3
Re: [PATCHv2 12/14] [media] cx231xx: use dev_info() for extension load/unload
Quoted 6 lines · Mauro Carvalho Chehab
Now that we're using
dev_foo, the logs become like:usb 1-2: DVB: registering adapter 0 frontend 0 (Fujitsu mb86A20s)... usb 1-2: Successfully loaded cx231xx-dvb
cx231xx: Cx231xx dvb Extension initialized
Quoted 7 lines
It is not clear, by the logs, that usb 1-2 name is an alias for cx231xx. So, we also need to use
dvb_info()at extension load/unload.After the patch, it will print:
usb 1-2: Cx231xx dvb Extension initializedWith is coherent with the other logs.
That is not correct as wrong device pointer passed to dev_. Go cx231xx usb driver probe function and add following test log to see how is should look like:dev_info(&intf->dev, "Hello World\n");
It prints something like
cx231xx 1-2-1: Hello World
regards
Antti
Quoted 37 lines
Signed-off-by Mauro Carvalho Chehab <[email protected]>drivers/media/usb/cx231xx/cx231xx-core.c +6
-6@@ -98,10 +98,10 @@ int cx231xx_register_extension(struct cx231xx_ops *ops)mutex_lock (&cx231xx_devlist_mutex);list_add_tail (&ops->next, &cx231xx_extension_devlist); -list_for_each_entry (dev, &cx231xx_devlist, devlist) +list_for_each_entry (dev, &cx231xx_devlist, devlist) { ops->init (dev); - - printk(KERN_INFO DRIVER_NAME ": %s initialized\n", ops->name); +dev_info (&dev->udev->dev,"%s initialized\n" , ops->name); + }mutex_unlock (&cx231xx_devlist_mutex);return 0 ; }@@ -112,11 +112,11 @@ void cx231xx_unregister_extension(struct cx231xx_ops *ops)struct cx231xx *dev =NULL ;mutex_lock (&cx231xx_devlist_mutex); -list_for_each_entry (dev, &cx231xx_devlist, devlist) +list_for_each_entry (dev, &cx231xx_devlist, devlist) { ops->fini (dev); +dev_info (&dev->udev->dev,"%s removed\n" , ops->name); + } - - printk(KERN_INFO DRIVER_NAME ": %s removed\n", ops->name);list_del (&ops->next);mutex_unlock (&cx231xx_devlist_mutex); }
Signature · 1 line
http://palosaari.fi/
Re: [PATCHv2 12/14] [media] cx231xx: use dev_info() for extension load/unload
Em Sun, 02 Nov 2014 19:32:37 +0200
Antti Palosaari <[email protected]> escreveu:
Quoted 15 lines · Mauro Carvalho Chehab
Quoted 12 lines
Now that we're using
dev_foo, the logs become like:usb 1-2: DVB: registering adapter 0 frontend 0 (Fujitsu mb86A20s)... usb 1-2: Successfully loaded cx231xx-dvb
cx231xx: Cx231xx dvb Extension initializedIt is not clear, by the logs, that usb 1-2 name is an alias for cx231xx. So, we also need to use
dvb_info()at extension load/unload.After the patch, it will print:
usb 1-2: Cx231xx dvb Extension initialized
Quoted 7 lines
Quoted 1 line
With is coherent with the other logs.
That is not correct as wrong device pointer passed to
dev_. Go cx231xx usb driver probe function and add following test log to see how is should look like:dev_info(&intf->dev, "Hello World\n");
I changed the probe to be:
static int cx231xx_usb_probe(struct usb_interface *interface,
const struct usb_device_id *id)
{
struct usb_device *udev;
...
struct usb_interface_assoc_descriptor *assoc_desc;
udev = usb_get_dev(interface_to_usbdev(interface));
ifnum = interface->altsetting[0].desc.bInterfaceNumber;
dev_info(&interface->dev, "intf Hello World\n");
dev_info(&udev->dev, "udev Hello World\n");The result is:
[54915.036082] cx231xx 1-2:1.2: intf Hello World [54915.036090] usb 1-2: udev Hello World [54915.036163] cx231xx 1-2:1.3: intf Hello World [54915.036171] usb 1-2: udev Hello World [54915.036197] cx231xx 1-2:1.4: intf Hello World [54915.036204] usb 1-2: udev Hello World [54915.036228] cx231xx 1-2:1.5: intf Hello World [54915.036234] usb 1-2: udev Hello World [54915.036258] cx231xx 1-2:1.6: intf Hello World [54915.036264] usb 1-2: udev Hello World
Devices with multiple interfaces seem to have intf->dev filled with a different device than udev->dev. The cx231xx is likely the most complex device we have at media, as it has lots of interfaces, each with lots of alternates, plus its 3 I2C physical buses and one I2C mux internally.
I may work on a patch that would be storing intf->dev into cx231xx dev struct. That's probably the easiest way for this device.
Do you have any other idea?
Regards,
Mauro
PATCH v2 13/14 cx231xx: too much changes. Bump version number
In reply to Mauro Carvalho ChehabThe I2C mux changes are significant. Bump version number.
drivers/media/usb/cx231xx/cx231xx-video.c +1 -1
@@ -43,7 +43,7 @@#include "cx231xx-vbi.h" -#define CX231XX_VERSION "0.0.2" +#define CX231XX_VERSION "0.0.3"#define DRIVER_AUTHOR "Srinivasa Deevi <[email protected]>"#define DRIVER_DESC "Conexant cx231xx based USB video device driver"
Signature · 1 line
1.9.3
Em Sun, 02 Nov 2014 10:32:23 -0200
Mauro Carvalho Chehab <[email protected]> escreveu:
Quoted 53 lines
The cx231xx driver is too verbose. Several debug messages are sent to dmesg. Do some cleanup and fix
i2c_scan.After this patch, it will now produce:
[ 608.359255] usb 1-2: New device Conexant Corporation Polaris AV Capturb @ 480 Mbps (1554:5010) with 7 interfaces [ 608.360009] usb 1-2: Identified as Pixelview PlayTV USB Hybrid (card=10) [ 608.363129] i2c i2c-8: Added multiplexed i2c bus 10 [ 608.363201] i2c i2c-8: Added multiplexed i2c bus 11 [ 610.968904] cx25840 7-0044: loaded v4l-cx231xx-avcore-01.fw firmware (16382 bytes) [ 611.041317] Chip ID is not zero. It is not a TEA5767 [ 611.041351] tuner 9-0060: Tuner -1 found with type(s) Radio TV. [ 611.041429] tda18271 9-0060: creating new instance [ 611.044096] TDA18271HD/C2 detected @ 9-0060 [ 611.239460] tda18271: performing RF tracking filter calibration [ 612.800569] tda18271: RF tracking filter calibration complete [ 612.835365] usb 1-2: v4l2 driver version 0.0.3 [ 613.055006] usb 1-2: Registered video device video0 [v4l2] [ 613.055461] usb 1-2: Registered VBI device vbi0 [ 613.110279] Registered IR keymap rc-pixelview-002t [ 613.110574] input: i2c IR (Pixelview PlayTV USB Hy as /devices/virtual/rc/rc0/input12 [ 613.111398] rc0: i2c IR (Pixelview PlayTV USB Hy as /devices/virtual/rc/rc0 [ 613.111409] ir-kbd-i2c: i2c IR (Pixelview PlayTV USB Hy detected at i2c-9/9-0030/ir0 [cx231xx #0-2] [ 613.111444] usb 1-2: video EndPoint Addr 0x84, Alternate settings: 5 [ 613.111454] usb 1-2: VBI EndPoint Addr 0x85, Alternate settings: 2 [ 613.111465] usb 1-2: sliced CC EndPoint Addr 0x86, Alternate settings: 2 [ 613.111474] usb 1-2: TS EndPoint Addr 0x81, Alternate settings: 6 [ 613.111654] usbcore: registered new interface driver cx231xx [ 613.136510] usb 1-2: audio EndPoint Addr 0x83, Alternate settings: 3 [ 613.136521] usb 1-2: Cx231xx Audio Extension initialized [ 613.199085] usb 1-2: dvb_init: looking for demod on i2c bus: 9 [ 613.232349] i2c i2c-11: Detected a Fujitsu mb86a20s frontend [ 613.232385] tda18271 9-0060: attaching existing instance [ 613.232392] DVB: registering new adapter (cx231xx #0) [ 613.232402] usb 1-2: DVB: registering adapter 0 frontend 0 (Fujitsu mb86A20s)... [ 613.234528] usb 1-2: Successfully loaded cx231xx-dvb [ 613.234618] usb 1-2: Cx231xx dvb Extension initializedStill verbose, but at least it doesn't produce extra logs during normal work.
I2C scan is now fixed and not too verbose:
[ 608.371656] usb 1-2: i2c scan: found device @ port 0 addr 0x40 [???] [ 608.374750] usb 1-2: i2c scan: found device @ port 0 addr 0x60 [colibri] [ 608.378433] usb 1-2: i2c scan: found device @ port 0 addr 0x88 [hammerhead] [ 608.380226] usb 1-2: i2c scan: found device @ port 0 addr 0x98 [???] [ 608.405747] usb 1-2: i2c scan: found device @ port 3 addr 0xa0 [eeprom] [ 608.422310] usb 1-2: i2c scan: found device @ port 2 addr 0x60 [colibri] [ 608.430229] usb 1-2: i2c scan: found device @ port 2 addr 0xc0 [tuner] [ 608.438793] usb 1-2: i2c scan: found device @ port 4 addr 0x20 [demod]
Quoted 1 line
[ 608.560247] cx25840 7-0044: cx23102 A/V decoder found @ 0x88 (cx231xx #0-0)
In time:
Too much cut-and-paste... the above line is shown even if i2c_scan parameter is not used ;)
Regards,
Mauro
PATCH v2 14/14 cx231xx: simplify I2C scan debug messages
In reply to Mauro Carvalho ChehabDon't need to show when it starts or stops. Just print lines when devices are found.
After the changes, the output for i2c scan will be like:
usb 1-2: i2c scan: found device @ port 0 addr 0x40 [???] usb 1-2: i2c scan: found device @ port 0 addr 0x60 [colibri] usb 1-2: i2c scan: found device @ port 0 addr 0x88 [hammerhead] usb 1-2: i2c scan: found device @ port 0 addr 0x98 [???] usb 1-2: i2c scan: found device @ port 3 addr 0xa0 [eeprom] usb 1-2: i2c scan: found device @ port 2 addr 0x60 [colibri] usb 1-2: i2c scan: found device @ port 2 addr 0xc0 [tuner] usb 1-2: i2c scan: found device @ port 4 addr 0x20 [demod]
drivers/media/usb/cx231xx/cx231xx-i2c.c +2 -6
@@ -502,21 +502,17 @@ void cx231xx_do_i2c_scan(struct cx231xx *dev, int i2c_port)memset (&client,0 ,sizeof (client)); client.adapter =cx231xx_get_i2c_adap (dev, i2c_port); -dev_info (&dev->udev->dev, -"i2c_scan: checking for I2C devices on port=%d ..\n" , - i2c_port);for (i =0 ; i <128 ; i++) { client.addr = i; rc =i2c_master_recv (&client, &buf,0 );if (rc <0 )continue ;dev_info (&dev->udev->dev, -"i2c scan: found device @ 0x%x [%s]\n" , +"i2c scan: found device @ port %d addr 0x%x [%s]\n" , + i2c_port, i <<1 , i2c_devs[i] ? i2c_devs[i] :"???" ); } -dev_info (&dev->udev->dev,"i2c scan: Completed Checking for I2C devices on port=%d.\n" , - i2c_port); dev->i2c_scan_running = false; }
Signature · 1 line
1.9.3