diff options
author | Sri Deevi <Srinivasa.Deevi@conexant.com> | 2009-03-04 17:49:01 -0300 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2009-04-06 21:44:03 -0300 |
commit | b9255176453086b2531c5559350bd5c92b771cc5 (patch) | |
tree | b448774588b137e6efb9fad0ce8902b00a8d4788 /drivers/media/video/cx231xx | |
parent | 818fdf341369110ff91296843797a9431a3d9b31 (diff) |
V4L/DVB (10957): cx231xx: Fix CodingStyle
Fixes several CodingStyle issues on the driver.
Signed-off-by: Srinivasa Deevi <srinivasa.deevi@conexant.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video/cx231xx')
-rw-r--r-- | drivers/media/video/cx231xx/cx231xx-audio.c | 24 | ||||
-rw-r--r-- | drivers/media/video/cx231xx/cx231xx-avcore.c | 172 | ||||
-rw-r--r-- | drivers/media/video/cx231xx/cx231xx-cards.c | 33 | ||||
-rw-r--r-- | drivers/media/video/cx231xx/cx231xx-core.c | 138 | ||||
-rw-r--r-- | drivers/media/video/cx231xx/cx231xx-dvb.c | 18 | ||||
-rw-r--r-- | drivers/media/video/cx231xx/cx231xx-i2c.c | 44 | ||||
-rw-r--r-- | drivers/media/video/cx231xx/cx231xx-input.c | 8 | ||||
-rw-r--r-- | drivers/media/video/cx231xx/cx231xx-reg.h | 17 | ||||
-rw-r--r-- | drivers/media/video/cx231xx/cx231xx-vbi.c | 17 | ||||
-rw-r--r-- | drivers/media/video/cx231xx/cx231xx-vbi.h | 30 | ||||
-rw-r--r-- | drivers/media/video/cx231xx/cx231xx-video.c | 35 | ||||
-rw-r--r-- | drivers/media/video/cx231xx/cx231xx.h | 47 |
12 files changed, 326 insertions, 257 deletions
diff --git a/drivers/media/video/cx231xx/cx231xx-audio.c b/drivers/media/video/cx231xx/cx231xx-audio.c index 3810b0fd2d6..044edbc2d84 100644 --- a/drivers/media/video/cx231xx/cx231xx-audio.c +++ b/drivers/media/video/cx231xx/cx231xx-audio.c @@ -132,12 +132,16 @@ static void cx231xx_audio_isocirq(struct urb *urb) snd_pcm_stream_lock(substream); dev->adev.hwptr_done_capture += length; - if (dev->adev.hwptr_done_capture >= runtime->buffer_size) - dev->adev.hwptr_done_capture -= runtime->buffer_size; + if (dev->adev.hwptr_done_capture >= + runtime->buffer_size) + dev->adev.hwptr_done_capture -= + runtime->buffer_size; dev->adev.capture_transfer_done += length; - if (dev->adev.capture_transfer_done >= runtime->period_size) { - dev->adev.capture_transfer_done -= runtime->period_size; + if (dev->adev.capture_transfer_done >= + runtime->period_size) { + dev->adev.capture_transfer_done -= + runtime->period_size; period_elapsed = 1; } snd_pcm_stream_unlock(substream); @@ -185,7 +189,8 @@ static int cx231xx_init_audio_isoc(struct cx231xx *dev) urb->dev = dev->udev; urb->context = dev; - urb->pipe = usb_rcvisocpipe(dev->udev, dev->adev.end_point_addr); + urb->pipe = usb_rcvisocpipe(dev->udev, + dev->adev.end_point_addr); urb->transfer_flags = URB_ISO_ASAP; urb->transfer_buffer = dev->adev.transfer_buffer[i]; urb->interval = 1; @@ -193,7 +198,8 @@ static int cx231xx_init_audio_isoc(struct cx231xx *dev) urb->number_of_packets = CX231XX_NUM_AUDIO_PACKETS; urb->transfer_buffer_length = sb_size; - for (j = k = 0; j < CX231XX_NUM_AUDIO_PACKETS; j++, k += dev->adev.max_pkt_size) { + for (j = k = 0; j < CX231XX_NUM_AUDIO_PACKETS; + j++, k += dev->adev.max_pkt_size) { urb->iso_frame_desc[j].offset = k; urb->iso_frame_desc[j].length = dev->adev.max_pkt_size; } @@ -293,7 +299,8 @@ static int snd_cx231xx_capture_open(struct snd_pcm_substream *substream) dev->mute = 0; /* set alternate setting for audio interface */ - ret = cx231xx_set_alt_setting(dev, INDEX_AUDIO, 1); /* 1 - 48000 samples per sec */ + /* 1 - 48000 samples per sec */ + ret = cx231xx_set_alt_setting(dev, INDEX_AUDIO, 1); if (ret < 0) { cx231xx_errdev("failed to set alternate setting !\n"); @@ -324,7 +331,8 @@ static int snd_cx231xx_pcm_close(struct snd_pcm_substream *substream) dprintk("closing device\n"); /* set alternate setting for audio interface */ - ret = cx231xx_set_alt_setting(dev, INDEX_AUDIO, 0); /* 1 - 48000 samples per sec */ + /* 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"); diff --git a/drivers/media/video/cx231xx/cx231xx-avcore.c b/drivers/media/video/cx231xx/cx231xx-avcore.c index bbfc78ebd94..8bbe518f483 100644 --- a/drivers/media/video/cx231xx/cx231xx-avcore.c +++ b/drivers/media/video/cx231xx/cx231xx-avcore.c @@ -74,12 +74,14 @@ int cx231xx_colibri_init_super_block(struct cx231xx *dev, u32 ref_count) &colibri_power_status, 1); colibri_power_status &= 0xff; if (status < 0) { - cx231xx_info(": Init Super Block failed in sending/receiving cmds\n"); + cx231xx_info( + ": Init Super Block failed in send/receive cmds\n"); break; } i++; if (i == 10) { - cx231xx_info(": Init Super Block force break in loop !!!!\n"); + cx231xx_info( + ": Init Super Block force break in loop !!!!\n"); status = -1; break; } @@ -258,7 +260,8 @@ int cx231xx_colibri_set_mode(struct cx231xx *dev, enum AFE_MODE mode) break; } - if ((mode != dev->colibri_mode) && (dev->video_input == CX231XX_VMUX_TELEVISION)) + if ((mode != dev->colibri_mode) && + (dev->video_input == CX231XX_VMUX_TELEVISION)) status = cx231xx_colibri_adjust_ref_count(dev, CX231XX_VMUX_TELEVISION); @@ -511,8 +514,9 @@ int cx231xx_set_video_input_mux(struct cx231xx *dev, u8 input) status = cx231xx_set_power_mode(dev, POLARIS_AVMODE_ENXTERNAL_AV); if (status < 0) { - cx231xx_errdev("%s: cx231xx_set_power_mode : Failed to set Power - errCode [%d]!\n", - __func__, status); + cx231xx_errdev("%s: set_power_mode : Failed to" + " set Power - errCode [%d]!\n", + __func__, status); return status; } } @@ -528,8 +532,9 @@ int cx231xx_set_video_input_mux(struct cx231xx *dev, u8 input) status = cx231xx_set_power_mode(dev, POLARIS_AVMODE_ANALOGT_TV); if (status < 0) { - cx231xx_errdev("%s: cx231xx_set_power_mode : Failed to set Power - errCode [%d]!\n", - __func__, status); + cx231xx_errdev("%s: set_power_mode:Failed" + " to set Power - errCode [%d]!\n", + __func__, status); return status; } } @@ -538,7 +543,7 @@ int cx231xx_set_video_input_mux(struct cx231xx *dev, u8 input) INPUT(input)->vmux); break; default: - cx231xx_errdev("%s: cx231xx_set_power_mode : Unknown Input %d !\n", + cx231xx_errdev("%s: set_power_mode : Unknown Input %d !\n", __func__, INPUT(input)->type); break; } @@ -549,7 +554,8 @@ int cx231xx_set_video_input_mux(struct cx231xx *dev, u8 input) return status; } -int cx231xx_set_decoder_video_input(struct cx231xx *dev, u8 pin_type, u8 input) +int cx231xx_set_decoder_video_input(struct cx231xx *dev, + u8 pin_type, u8 input) { int status = 0; u32 value = 0; @@ -557,8 +563,9 @@ int cx231xx_set_decoder_video_input(struct cx231xx *dev, u8 pin_type, u8 input) if (pin_type != dev->video_input) { status = cx231xx_colibri_adjust_ref_count(dev, pin_type); if (status < 0) { - cx231xx_errdev("%s: cx231xx_colibri_adjust_ref_count :Failed to set Colibri input mux - errCode [%d]!\n", - __func__, status); + cx231xx_errdev("%s: adjust_ref_count :Failed to set" + "Colibri input mux - errCode [%d]!\n", + __func__, status); return status; } } @@ -566,8 +573,9 @@ int cx231xx_set_decoder_video_input(struct cx231xx *dev, u8 pin_type, u8 input) /* call colibri block to set video inputs */ status = cx231xx_colibri_set_input_mux(dev, input); if (status < 0) { - cx231xx_errdev("%s: cx231xx_colibri_set_input_mux :Failed to set Colibri input mux - errCode [%d]!\n", - __func__, status); + cx231xx_errdev("%s: set_input_mux :Failed to set" + " Colibri input mux - errCode [%d]!\n", + __func__, status); return status; } @@ -579,8 +587,10 @@ int cx231xx_set_decoder_video_input(struct cx231xx *dev, u8 pin_type, u8 input) value |= (0 << 13) | (1 << 4); value &= ~(1 << 5); - value &= (~(0x1ff8000)); /* set [24:23] [22:15] to 0 */ - value |= 0x1000000; /* set FUNC_MODE[24:23] = 2 IF_MOD[22:15] = 0 */ + /* set [24:23] [22:15] to 0 */ + value &= (~(0x1ff8000)); + /* set FUNC_MODE[24:23] = 2 IF_MOD[22:15] = 0 */ + value |= 0x1000000; status = cx231xx_write_i2c_data(dev, HAMMERHEAD_I2C_ADDRESS, AFE_CTRL, 2, value, 4); @@ -600,7 +610,8 @@ int cx231xx_set_decoder_video_input(struct cx231xx *dev, u8 pin_type, u8 input) /* Tell DIF object to go to baseband mode */ status = cx231xx_dif_set_standard(dev, DIF_USE_BASEBAND); if (status < 0) { - cx231xx_errdev("%s: cx231xx_dif set to By pass mode - errCode [%d]!\n", + cx231xx_errdev("%s: cx231xx_dif set to By pass" + " mode- errCode [%d]!\n", __func__, status); return status; } @@ -637,9 +648,11 @@ int cx231xx_set_decoder_video_input(struct cx231xx *dev, u8 pin_type, u8 input) status = cx231xx_read_i2c_data(dev, HAMMERHEAD_I2C_ADDRESS, AFE_CTRL, 2, &value, 4); - value &= (~(0x1ff8000)); /* set [24:23] [22:15] to 0 */ - value |= 0x1000010; /* set FUNC_MODE[24:23] = 2 - IF_MOD[22:15] = 0 DCR_BYP_CH2[4:4] = 1; */ + /* set [24:23] [22:15] to 0 */ + value &= (~(0x1ff8000)); + /* set FUNC_MODE[24:23] = 2 + IF_MOD[22:15] = 0 DCR_BYP_CH2[4:4] = 1; */ + value |= 0x1000010; status = cx231xx_write_i2c_data(dev, HAMMERHEAD_I2C_ADDRESS, AFE_CTRL, 2, value, 4); @@ -647,7 +660,8 @@ int cx231xx_set_decoder_video_input(struct cx231xx *dev, u8 pin_type, u8 input) /* Tell DIF object to go to baseband mode */ status = cx231xx_dif_set_standard(dev, DIF_USE_BASEBAND); if (status < 0) { - cx231xx_errdev("%s: cx231xx_dif set to By pass mode - errCode [%d]!\n", + cx231xx_errdev("%s: cx231xx_dif set to By pass" + " mode- errCode [%d]!\n", __func__, status); return status; } @@ -713,8 +727,10 @@ int cx231xx_set_decoder_video_input(struct cx231xx *dev, u8 pin_type, u8 input) value |= (0 << 13) | (1 << 4); value &= ~(1 << 5); - value &= (~(0x1FF8000)); /* set [24:23] [22:15] to 0 */ - value |= 0x1000000; /* set FUNC_MODE[24:23] = 2 IF_MOD[22:15] = 0 */ + /* set [24:23] [22:15] to 0 */ + value &= (~(0x1FF8000)); + /* set FUNC_MODE[24:23] = 2 IF_MOD[22:15] = 0 */ + value |= 0x1000000; status = cx231xx_write_i2c_data(dev, HAMMERHEAD_I2C_ADDRESS, AFE_CTRL, 2, @@ -740,8 +756,9 @@ int cx231xx_set_decoder_video_input(struct cx231xx *dev, u8 pin_type, u8 input) status = cx231xx_dif_set_standard(dev, DIF_USE_BASEBAND); if (status < 0) { - cx231xx_errdev("%s: cx231xx_dif set to By pass mode - errCode [%d]!\n", - __func__, status); + cx231xx_errdev("%s: cx231xx_dif set to By pass" + " mode- errCode [%d]!\n", + __func__, status); return status; } @@ -773,7 +790,8 @@ int cx231xx_set_decoder_video_input(struct cx231xx *dev, u8 pin_type, u8 input) status = cx231xx_read_modify_write_i2c_dword(dev, HAMMERHEAD_I2C_ADDRESS, MODE_CTRL, FLD_INPUT_MODE, - cx231xx_set_field(FLD_INPUT_MODE, INPUT_MODE_CVBS_0)); + cx231xx_set_field(FLD_INPUT_MODE, + INPUT_MODE_CVBS_0)); break; default: /* Enable the DIF for the tuner */ @@ -781,8 +799,9 @@ int cx231xx_set_decoder_video_input(struct cx231xx *dev, u8 pin_type, u8 input) /* Reinitialize the DIF */ status = cx231xx_dif_set_standard(dev, dev->norm); if (status < 0) { - cx231xx_errdev("%s: cx231xx_dif set to By pass mode - errCode [%d]!\n", - __func__, status); + cx231xx_errdev("%s: cx231xx_dif set to By pass" + " mode- errCode [%d]!\n", + __func__, status); return status; } @@ -861,9 +880,11 @@ int cx231xx_set_decoder_video_input(struct cx231xx *dev, u8 pin_type, u8 input) status = cx231xx_read_modify_write_i2c_dword(dev, HAMMERHEAD_I2C_ADDRESS, MODE_CTRL, FLD_INPUT_MODE, - cx231xx_set_field(FLD_INPUT_MODE, INPUT_MODE_CVBS_0)); + cx231xx_set_field(FLD_INPUT_MODE, + INPUT_MODE_CVBS_0)); - /* Set some bits in AFE_CTRL so that channel 2 or 3 is ready to receive audio */ + /* Set some bits in AFE_CTRL so that channel 2 or 3 + * is ready to receive audio */ /* Clear clamp for channels 2 and 3 (bit 16-17) */ /* Clear droop comp (bit 19-20) */ /* Set VGA_SEL (for audio control) (bit 7-8) */ @@ -903,8 +924,9 @@ int cx231xx_set_decoder_video_input(struct cx231xx *dev, u8 pin_type, u8 input) } /* - * Handle any video-mode specific overrides that are different on a per video standards - * basis after touching the MODE_CTRL register which resets many values for autodetect + * Handle any video-mode specific overrides that are different + * on a per video standards basis after touching the MODE_CTRL + * register which resets many values for autodetect */ int cx231xx_do_mode_ctrl_overrides(struct cx231xx *dev) { @@ -918,7 +940,8 @@ int cx231xx_do_mode_ctrl_overrides(struct cx231xx *dev) DFE_CTRL3, 2, 0xCD3F0280, 4); - if (dev->norm & (V4L2_STD_NTSC_M | V4L2_STD_NTSC_M_JP | V4L2_STD_PAL_M)) { + if (dev->norm & (V4L2_STD_NTSC_M | V4L2_STD_NTSC_M_JP | + V4L2_STD_PAL_M)) { cx231xx_info("do_mode_ctrl_overrides NTSC\n"); /* Move the close caption lines out of active video, @@ -1237,55 +1260,72 @@ int cx231xx_dif_configure_C2HH_for_low_IF(struct cx231xx *dev, u32 mode, if (mode == V4L2_TUNER_RADIO) { /* C2HH */ - status = cx231xx_reg_mask_write(dev, HAMMERHEAD_I2C_ADDRESS, 32, - AFE_CTRL_C2HH_SRC_CTRL, 30, 31, 0x1); /* lo if big signal */ - status = cx231xx_reg_mask_write(dev, HAMMERHEAD_I2C_ADDRESS, 32, - AFE_CTRL_C2HH_SRC_CTRL, 23, 24, function_mode); /* FUNC_MODE = DIF */ - status = cx231xx_reg_mask_write(dev, HAMMERHEAD_I2C_ADDRESS, 32, - AFE_CTRL_C2HH_SRC_CTRL, 15, 22, 0xFF); /* IF_MODE */ - status = cx231xx_reg_mask_write(dev, HAMMERHEAD_I2C_ADDRESS, 32, - AFE_CTRL_C2HH_SRC_CTRL, 9, 9, 0x1); /* no inv */ + /* lo if big signal */ + status = cx231xx_reg_mask_write(dev, + HAMMERHEAD_I2C_ADDRESS, 32, + AFE_CTRL_C2HH_SRC_CTRL, 30, 31, 0x1); + /* FUNC_MODE = DIF */ + status = cx231xx_reg_mask_write(dev, + HAMMERHEAD_I2C_ADDRESS, 32, + AFE_CTRL_C2HH_SRC_CTRL, 23, 24, function_mode); + /* IF_MODE */ + status = cx231xx_reg_mask_write(dev, + HAMMERHEAD_I2C_ADDRESS, 32, + AFE_CTRL_C2HH_SRC_CTRL, 15, 22, 0xFF); + /* no inv */ + status = cx231xx_reg_mask_write(dev, + HAMMERHEAD_I2C_ADDRESS, 32, + AFE_CTRL_C2HH_SRC_CTRL, 9, 9, 0x1); } else { switch (standard) { case V4L2_STD_NTSC_M: /* 75 IRE Setup */ - case V4L2_STD_NTSC_M_JP: /* Japan, 0 IRE Setup */ + case V4L2_STD_NTSC_M_JP:/* Japan, 0 IRE Setup */ case V4L2_STD_PAL_M: case V4L2_STD_PAL_N: case V4L2_STD_PAL_Nc: + /* lo if big signal */ status = cx231xx_reg_mask_write(dev, HAMMERHEAD_I2C_ADDRESS, 32, - AFE_CTRL_C2HH_SRC_CTRL, 30, 31, 0x1); /* lo if big signal */ + AFE_CTRL_C2HH_SRC_CTRL, 30, 31, 0x1); + /* FUNC_MODE = DIF */ status = cx231xx_reg_mask_write(dev, HAMMERHEAD_I2C_ADDRESS, 32, AFE_CTRL_C2HH_SRC_CTRL, 23, 24, - function_mode); /* FUNC_MODE = DIF */ + function_mode); + /* IF_MODE */ status = cx231xx_reg_mask_write(dev, HAMMERHEAD_I2C_ADDRESS, 32, - AFE_CTRL_C2HH_SRC_CTRL, 15, 22, 0xb); /* IF_MODE */ + AFE_CTRL_C2HH_SRC_CTRL, 15, 22, 0xb); + /* no inv */ status = cx231xx_reg_mask_write(dev, HAMMERHEAD_I2C_ADDRESS, 32, - AFE_CTRL_C2HH_SRC_CTRL, 9, 9, 0x1); /* no inv */ + AFE_CTRL_C2HH_SRC_CTRL, 9, 9, 0x1); + /* 0x124, AUD_CHAN1_SRC = 0x3 */ status = cx231xx_reg_mask_write(dev, HAMMERHEAD_I2C_ADDRESS, 32, - AUD_IO_CTRL, 0, 31, 0x00000003); /* 0x124, AUD_CHAN1_SRC = 0x3 */ + AUD_IO_CTRL, 0, 31, 0x00000003); break; case V4L2_STD_PAL_B: case V4L2_STD_PAL_G: /* C2HH setup */ + /* lo if big signal */ status = cx231xx_reg_mask_write(dev, HAMMERHEAD_I2C_ADDRESS, 32, - AFE_CTRL_C2HH_SRC_CTRL, 30, 31, 0x1); /* lo if big signal */ + AFE_CTRL_C2HH_SRC_CTRL, 30, 31, 0x1); + /* FUNC_MODE = DIF */ status = cx231xx_reg_mask_write(dev, HAMMERHEAD_I2C_ADDRESS, 32, AFE_CTRL_C2HH_SRC_CTRL, 23, 24, - function_mode); /* FUNC_MODE = DIF */ + function_mode); + /* IF_MODE */ status = cx231xx_reg_mask_write(dev, HAMMERHEAD_I2C_ADDRESS, 32, - AFE_CTRL_C2HH_SRC_CTRL, 15, 22, 0xE); /* IF_MODE */ + AFE_CTRL_C2HH_SRC_CTRL, 15, 22, 0xE); + /* no inv */ status = cx231xx_reg_mask_write(dev, HAMMERHEAD_I2C_ADDRESS, 32, - AFE_CTRL_C2HH_SRC_CTRL, 9, 9, 0x1); /* no inv */ + AFE_CTRL_C2HH_SRC_CTRL, 9, 9, 0x1); break; case V4L2_STD_PAL_D: @@ -1298,19 +1338,23 @@ int cx231xx_dif_configure_C2HH_for_low_IF(struct cx231xx *dev, u32 mode, case V4L2_STD_SECAM_K: case V4L2_STD_SECAM_K1: /* C2HH setup */ + /* lo if big signal */ status = cx231xx_reg_mask_write(dev, HAMMERHEAD_I2C_ADDRESS, 32, - AFE_CTRL_C2HH_SRC_CTRL, 30, 31, 0x1); /* lo if big signal */ + AFE_CTRL_C2HH_SRC_CTRL, 30, 31, 0x1); + /* FUNC_MODE = DIF */ status = cx231xx_reg_mask_write(dev, HAMMERHEAD_I2C_ADDRESS, 32, AFE_CTRL_C2HH_SRC_CTRL, 23, 24, - function_mode); /* FUNC_MODE = DIF */ + function_mode); + /* IF_MODE */ status = cx231xx_reg_mask_write(dev, HAMMERHEAD_I2C_ADDRESS, 32, - AFE_CTRL_C2HH_SRC_CTRL, 15, 22, 0xF); /* IF_MODE */ + AFE_CTRL_C2HH_SRC_CTRL, 15, 22, 0xF); + /* no inv */ status = cx231xx_reg_mask_write(dev, HAMMERHEAD_I2C_ADDRESS, 32, - AFE_CTRL_C2HH_SRC_CTRL, 9, 9, 0x1); /* no inv */ + AFE_CTRL_C2HH_SRC_CTRL, 9, 9, 0x1); break; case DIF_USE_BASEBAND: @@ -1919,7 +1963,8 @@ int cx231xx_set_power_mode(struct cx231xx *dev, AV_MODE mode) status = cx231xx_write_ctrl_reg(dev, VRT_SET_REGISTER, PWR_CTL_EN, value, 4); - dev->xc_fw_load_done = 0; /* reset state of xceive tuner */ + /* reset state of xceive tuner */ + dev->xc_fw_load_done = 0; break; case POLARIS_AVMODE_ANALOGT_TV: @@ -2076,7 +2121,8 @@ int cx231xx_set_power_mode(struct cx231xx *dev, AV_MODE mode) status = cx231xx_read_ctrl_reg(dev, VRT_GET_REGISTER, PWR_CTL_EN, value, 4); - cx231xx_info(" The data of PWR_CTL_EN register 0x74=0x%0x,0x%0x,0x%0x,0x%0x\n", + cx231xx_info(" The data of PWR_CTL_EN register 0x74" + "=0x%0x,0x%0x,0x%0x,0x%0x\n", value[0], value[1], value[2], value[3]); return status; @@ -2210,10 +2256,10 @@ int cx231xx_capture_start(struct cx231xx *dev, int start, u8 media_type) { int rc; u32 ep_mask = -1; - PPCB_CONFIG pcb_config; + struct pcb_config *pcb_config; /* get EP for media type */ - pcb_config = &dev->current_pcb_config; + pcb_config = (struct pcb_config *)&dev->current_pcb_config; if (pcb_config->config_num == 1) { switch (media_type) { @@ -2278,6 +2324,10 @@ int cx231xx_capture_start(struct cx231xx *dev, int start, u8 media_type) rc = cx231xx_stop_stream(dev, ep_mask); } + if (dev->mode == CX231XX_ANALOG_MODE) + ;/* do any in Analog mode */ + else + ;/* do any in digital mode */ return rc; } @@ -2564,10 +2614,12 @@ int cx231xx_gpio_i2c_read_ack(struct cx231xx *dev) status = cx231xx_get_gpio_bit(dev, dev->gpio_dir, (u8 *)&dev->gpio_val); nCnt--; - } while (((dev->gpio_val & (1 << dev->board.tuner_scl_gpio)) == 0) && (nCnt > 0)); + } while (((dev->gpio_val & + (1 << dev->board.tuner_scl_gpio)) == 0) && + (nCnt > 0)); if (nCnt == 0) - cx231xx_info("No ACK after %d msec for clock stretch. GPIO I2C operation failed!", + cx231xx_info("No ACK after %d msec -GPIO I2C failed!", nInit * 10); /* readAck diff --git a/drivers/media/video/cx231xx/cx231xx-cards.c b/drivers/media/video/cx231xx/cx231xx-cards.c index 27cf51b78d6..f18d0c11de7 100644 --- a/drivers/media/video/cx231xx/cx231xx-cards.c +++ b/drivers/media/video/cx231xx/cx231xx-cards.c @@ -1,8 +1,9 @@ /* - cx231xx-cards.c - driver for Conexant Cx23100/101/102 USB video capture devices + cx231xx-cards.c - driver for Conexant Cx23100/101/102 + USB video capture devices Copyright (C) 2008 <srinivasa.deevi at conexant dot com> - Based on em28xx driver + Based on em28xx driver This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -85,7 +86,7 @@ struct cx231xx_board cx231xx_boards[] = { .amux = CX231XX_AMUX_LINE_IN, .gpio = 0, - }}, + } }, }, [CX231XX_BOARD_CNXT_RDE_250] = { @@ -132,7 +133,7 @@ struct cx231xx_board cx231xx_boards[] = { .amux = CX231XX_AMUX_LINE_IN, .gpio = 0, - }}, + } }, }, [CX231XX_BOARD_CNXT_RDU_250] = { @@ -179,7 +180,7 @@ struct cx231xx_board cx231xx_boards[] = { .amux = CX231XX_AMUX_LINE_IN, .gpio = 0, - }}, + } }, }, }; const unsigned int cx231xx_bcount = ARRAY_SIZE(cx231xx_boards); @@ -209,9 +210,8 @@ int cx231xx_tuner_callback(void *ptr, int component, int command, int arg) if (dev->tuner_type == TUNER_XC5000) { if (command == XC5000_TUNER_RESET) { cx231xx_info - ("Tuner Call back : RESET : command %d : tuner type %d \n", - command, dev->tuner_type); - + ("Tuner CB: RESET: cmd %d : tuner type %d \n", + command, dev->tuner_type); cx231xx_set_gpio_value(dev, dev->board.tuner_gpio->bit, 1); msleep(10); @@ -225,10 +225,9 @@ int cx231xx_tuner_callback(void *ptr, int component, int command, int arg) } return rc; } - EXPORT_SYMBOL_GPL(cx231xx_tuner_callback); -static void inline cx231xx_set_model(struct cx231xx *dev) +static inline void cx231xx_set_model(struct cx231xx *dev) { memcpy(&dev->board, &cx231xx_boards[dev->model], sizeof(dev->board)); } @@ -542,7 +541,7 @@ static int cx231xx_init_dev(struct cx231xx **devhandle, struct usb_device *udev, return 0; - fail_reg_devices: +fail_reg_devices: mutex_unlock(&dev->lock); return retval; } @@ -628,12 +627,13 @@ static int cx231xx_usb_probe(struct usb_interface *interface, dev->has_alsa_audio = 1; dev->power_mode = -1; - dev->vbi_or_sliced_cc_mode = 0; /* 0 - vbi ; 1 -sliced cc mode */ + /* 0 - vbi ; 1 -sliced cc mode */ + dev->vbi_or_sliced_cc_mode = 0; /* get maximum no.of IAD interfaces */ assoc_desc = udev->actconfig->intf_assoc[0]; dev->max_iad_interface_count = assoc_desc->bInterfaceCount; - cx231xx_info(": Found IAD interface count %d\n", + cx231xx_info("Found IAD interface count %d\n", dev->max_iad_interface_count); /* init CIR module TBD */ @@ -662,10 +662,9 @@ static int cx231xx_usb_probe(struct usb_interface *interface, assoc_desc = udev->actconfig->intf_assoc[0]; if (assoc_desc->bFirstInterface == ifnum) { cx231xx_info - (": Found IAD interface match: AV Descriptor Start!! \n"); + ("Found IAD interface match: AV Desc Start!! \n"); } else { - cx231xx_err(DRIVER_NAME - " Not found matching interface\n"); + cx231xx_err(" Not found matching interface\n"); return -ENODEV; } @@ -691,7 +690,7 @@ static int cx231xx_usb_probe(struct usb_interface *interface, skip_interface = 1; /* set skipping */ else { cx231xx_info - (": Found IAD interface number match with AV Device number!! \n"); + ("Found IAD interface no. match with AV Device no.!\n"); } } diff --git a/drivers/media/video/cx231xx/cx231xx-core.c b/drivers/media/video/cx231xx/cx231xx-core.c index 874fc5b3986..2dda863dd3c 100644 --- a/drivers/media/video/cx231xx/cx231xx-core.c +++ b/drivers/media/video/cx231xx/cx231xx-core.c @@ -1,8 +1,9 @@ /* - cx231xx-core.c - driver for Conexant Cx23100/101/102 USB video capture devices + cx231xx-core.c - driver for Conexant Cx23100/101/102 + USB video capture devices Copyright (C) 2008 <srinivasa.deevi at conexant dot com> - Based on em28xx driver + Based on em28xx driver This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -59,9 +60,9 @@ MODULE_PARM_DESC(alt, "alternate setting to use for video endpoint"); printk(KERN_INFO "%s %s :"fmt, \ dev->name, __func__ , ##arg); } while (0) -/************************************************************************************ -* Device control list functions * -*************************************************************************************/ +/***************************************************************** +* Device control list functions * +******************************************************************/ static LIST_HEAD(cx231xx_devlist); static DEFINE_MUTEX(cx231xx_devlist_mutex); @@ -130,7 +131,6 @@ int cx231xx_register_extension(struct cx231xx_ops *ops) mutex_unlock(&cx231xx_devlist_mutex); return 0; } - EXPORT_SYMBOL(cx231xx_register_extension); void cx231xx_unregister_extension(struct cx231xx_ops *ops) @@ -149,7 +149,6 @@ void cx231xx_unregister_extension(struct cx231xx_ops *ops) mutex_unlock(&cx231xx_extension_devlist_lock); mutex_unlock(&cx231xx_devlist_mutex); } - EXPORT_SYMBOL(cx231xx_unregister_extension); void cx231xx_init_extension(struct cx231xx *dev) @@ -180,15 +179,15 @@ void cx231xx_close_extension(struct cx231xx *dev) mutex_unlock(&cx231xx_extension_devlist_lock); } -/************************************************************************************ -* U S B related functions * -*************************************************************************************/ +/**************************************************************** +* U S B related functions * +*****************************************************************/ int cx231xx_send_usb_command(struct cx231xx_i2c *i2c_bus, struct cx231xx_i2c_xfer_data *req_data) { int status = 0; struct cx231xx *dev = i2c_bus->dev; - VENDOR_REQUEST_IN ven_req; + struct VENDOR_REQUEST_IN ven_req; u8 saddr_len = 0; u8 _i2c_period = 0; @@ -215,10 +214,10 @@ int cx231xx_send_usb_command(struct cx231xx_i2c *i2c_bus, _i2c_nostop << 1 | I2C_SYNC | _i2c_reserve << 6; /* set channel number */ - if (req_data->direction & I2C_M_RD) - ven_req.bRequest = i2c_bus->nr + 4; /* channel number, for read, - spec required channel_num +4 */ - else + if (req_data->direction & I2C_M_RD) { + /* channel number, for read,spec required channel_num +4 */ + ven_req.bRequest = i2c_bus->nr + 4; + } else ven_req.bRequest = i2c_bus->nr; /* channel number, */ /* set index value */ @@ -255,14 +254,14 @@ int cx231xx_send_usb_command(struct cx231xx_i2c *i2c_bus, status = cx231xx_send_vendor_cmd(dev, &ven_req); if (status < 0) { cx231xx_info - ("UsbInterface::sendCommand, output buffer failed with status -%d\n", + ("UsbInterface::sendCommand, failed with status -%d\n", status); } return status; } - EXPORT_SYMBOL_GPL(cx231xx_send_usb_command); + /* * cx231xx_read_ctrl_reg() * reads data from the usb device specifying bRequest and wValue @@ -336,7 +335,8 @@ int cx231xx_read_ctrl_reg(struct cx231xx *dev, u8 req, u16 reg, return ret; } -int cx231xx_send_vendor_cmd(struct cx231xx *dev, VENDOR_REQUEST_IN * ven_req) +int cx231xx_send_vendor_cmd(struct cx231xx *dev, + struct VENDOR_REQUEST_IN *ven_req) { int ret; int pipe = 0; @@ -421,11 +421,11 @@ int cx231xx_write_ctrl_reg(struct cx231xx *dev, u8 req, u16 reg, char *buf, int byte; cx231xx_isocdbg("(pipe 0x%08x): " - "OUT: %02x %02x %02x %02x %02x %02x %02x %02x >>>", - pipe, - USB_DIR_OUT | USB_TYPE_VENDOR | - USB_RECIP_DEVICE, req, 0, val, reg & 0xff, - reg >> 8, len & 0xff, len >> 8); + "OUT: %02x %02x %02x %02x %02x %02x %02x %02x >>>", + pipe, + USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE, + req, 0, val, reg & 0xff, + reg >> 8, len & 0xff, len >> 8); for (byte = 0; byte < len; byte++) cx231xx_isocdbg(" %02x", (unsigned char)buf[byte]); @@ -442,9 +442,9 @@ int cx231xx_write_ctrl_reg(struct cx231xx *dev, u8 req, u16 reg, char *buf, return ret; } -/************************************************************************************ -* USB Alternate Setting functions * -*************************************************************************************/ +/**************************************************************** +* USB Alternate Setting functions * +*****************************************************************/ int cx231xx_set_video_alternate(struct cx231xx *dev) { @@ -487,7 +487,7 @@ int cx231xx_set_video_alternate(struct cx231xx *dev) dev->video_mode.alt, dev->video_mode.max_pkt_size); cx231xx_info - (" setting alternate %d with wMaxPacketSize=%u , Interface = %d\n", + (" setting alt %d with wMaxPktSize=%u , Interface = %d\n", dev->video_mode.alt, dev->video_mode.max_pkt_size, usb_interface_index); errCode = @@ -495,7 +495,7 @@ int cx231xx_set_video_alternate(struct cx231xx *dev) dev->video_mode.alt); if (errCode < 0) { cx231xx_errdev - ("cannot change alternate number to %d (error=%i)\n", + ("cannot change alt number to %d (error=%i)\n", dev->video_mode.alt, errCode); return errCode; } @@ -569,8 +569,8 @@ int cx231xx_set_alt_setting(struct cx231xx *dev, u8 index, u8 alt) if (alt > 0 && max_pkt_size == 0) { cx231xx_errdev - ("cannot change interface %d alternate number to %d : Max. Pkt size is ZERO\n", - usb_interface_index, alt); + ("can't change interface %d alt no. to %d: Max. Pkt size = 0\n", + usb_interface_index, alt); return -1; } @@ -582,15 +582,14 @@ int cx231xx_set_alt_setting(struct cx231xx *dev, u8 index, u8 alt) status = usb_set_interface(dev->udev, usb_interface_index, alt); if (status < 0) { cx231xx_errdev - ("cannot change interface %d alternate number to %d (error=%i)\n", - usb_interface_index, alt, status); + ("can't change interface %d alt no. to %d (err=%i)\n", + usb_interface_index, alt, status); return status; } } return status; } - EXPORT_SYMBOL_GPL(cx231xx_set_alt_setting); int cx231xx_gpio_set(struct cx231xx *dev, struct cx231xx_reg_seq *gpio) @@ -630,19 +629,18 @@ int cx231xx_set_mode(struct cx231xx *dev, enum cx231xx_mode set_mode) dev->mode = set_mode; - if (dev->mode == CX231XX_DIGITAL_MODE) { - /* Set Digital power mode */ - } else { - /* Set Analog Power mode */ - } + if (dev->mode == CX231XX_DIGITAL_MODE) + ;/* Set Digital power mode */ + else + ;/* Set Analog Power mode */ + return 0; } - EXPORT_SYMBOL_GPL(cx231xx_set_mode); -/************************************************************************************ -* URB Streaming functions * -*************************************************************************************/ +/***************************************************************** +* URB Streaming functions * +******************************************************************/ /* * IRQ callback, called by URB callback @@ -728,7 +726,6 @@ void cx231xx_uninit_isoc(struct cx231xx *dev) cx231xx_capture_start(dev, 0, Raw_Video); } - EXPORT_SYMBOL_GPL(cx231xx_uninit_isoc); /* @@ -736,7 +733,7 @@ EXPORT_SYMBOL_GPL(cx231xx_uninit_isoc); */ int cx231xx_init_isoc(struct cx231xx *dev, int max_packets, int num_bufs, int max_pkt_size, - int (*isoc_copy) (struct cx231xx * dev, struct urb * urb)) + int (*isoc_copy) (struct cx231xx *dev, struct urb *urb)) { struct cx231xx_dmaqueue *dma_q = &dev->video_mode.vidq; int i; @@ -805,7 +802,7 @@ int cx231xx_init_isoc(struct cx231xx *dev, int max_packets, cx231xx_err("unable to allocate %i bytes for transfer" " buffer %i%s\n", sb_size, i, - in_interrupt()? " while in int" : ""); + in_interrupt() ? " while in int" : ""); cx231xx_uninit_isoc(dev); return -ENOMEM; } @@ -848,12 +845,11 @@ int cx231xx_init_isoc(struct cx231xx *dev, int max_packets, return 0; } - EXPORT_SYMBOL_GPL(cx231xx_init_isoc); -/************************************************************************************ -* Device Init/UnInit functions * -*************************************************************************************/ +/***************************************************************** +* Device Init/UnInit functions * +******************************************************************/ int cx231xx_dev_init(struct cx231xx *dev) { int errCode = 0; @@ -887,11 +883,12 @@ int cx231xx_dev_init(struct cx231xx *dev) cx231xx_i2c_register(&dev->i2c_bus[2]); /* init hardware */ - /* Note : with out calling set power mode function, colibri can not be set up correctly */ + /* Note : with out calling set power mode function, + colibri can not be set up correctly */ errCode = cx231xx_set_power_mode(dev, POLARIS_AVMODE_ANALOGT_TV); if (errCode < 0) { cx231xx_errdev - ("%s: cx231xx_set_power_mode : Failed to set Power - errCode [%d]!\n", + ("%s: Failed to set Power - errCode [%d]!\n", __func__, errCode); return errCode; } @@ -959,7 +956,6 @@ int cx231xx_dev_init(struct cx231xx *dev) return errCode; } - EXPORT_SYMBOL_GPL(cx231xx_dev_init); void cx231xx_dev_uninit(struct cx231xx *dev) @@ -969,17 +965,16 @@ void cx231xx_dev_uninit(struct cx231xx *dev) cx231xx_i2c_unregister(&dev->i2c_bus[1]); cx231xx_i2c_unregister(&dev->i2c_bus[0]); } - EXPORT_SYMBOL_GPL(cx231xx_dev_uninit); -/************************************************************************************ -* G P I O related functions * -*************************************************************************************/ +/***************************************************************** +* G P I O related functions * +******************************************************************/ int cx231xx_send_gpio_cmd(struct cx231xx *dev, u32 gpio_bit, u8 * gpio_val, u8 len, u8 request, u8 direction) { int status = 0; - VENDOR_REQUEST_IN ven_req; + struct VENDOR_REQUEST_IN ven_req; /* Set wValue */ ven_req.wValue = (u16) (gpio_bit >> 16 & 0xffff); @@ -1021,18 +1016,17 @@ int cx231xx_send_gpio_cmd(struct cx231xx *dev, u32 gpio_bit, u8 * gpio_val, status = cx231xx_send_vendor_cmd(dev, &ven_req); if (status < 0) { cx231xx_info - ("UsbInterface::sendCommand, output buffer failed with status -%d\n", + ("UsbInterface::sendCommand, failed with status -%d\n", status); } return status; } - EXPORT_SYMBOL_GPL(cx231xx_send_gpio_cmd); -/************************************************************************************* - * C O N T R O L - Register R E A D / W R I T E functions * - *************************************************************************************/ +/***************************************************************** + * C O N T R O L - Register R E A D / W R I T E functions * + *****************************************************************/ int cx231xx_mode_register(struct cx231xx *dev, u16 address, u32 mode) { u8 value[4] = { 0x0, 0x0, 0x0, 0x0 }; @@ -1058,11 +1052,11 @@ int cx231xx_mode_register(struct cx231xx *dev, u16 address, u32 mode) return status; } -/************************************************************************************* - * I 2 C Internal C O N T R O L functions * - *************************************************************************************/ +/***************************************************************** + * I 2 C Internal C O N T R O L functions * + *****************************************************************/ int cx231xx_read_i2c_data(struct cx231xx *dev, u8 dev_addr, u16 saddr, - u8 saddr_len, u32 * data, u8 data_len) + u8 saddr_len, u32 *data, u8 data_len) { int status = 0; struct cx231xx_i2c_xfer_data req_data; @@ -1137,9 +1131,8 @@ int cx231xx_reg_mask_write(struct cx231xx *dev, u8 dev_addr, u8 size, u32 mask = 0; int i; - if (bit_start > (size - 1) || bit_end > (size - 1)) { + if (bit_start > (size - 1) || bit_end > (size - 1)) return -1; - } if (size == 8) { status = @@ -1151,14 +1144,12 @@ int cx231xx_reg_mask_write(struct cx231xx *dev, u8 dev_addr, u8 size, &tmp, 4); } - if (status < 0) { + if (status < 0) return status; - } mask = 1 << bit_end; - for (i = bit_end; i > bit_start && i > 0; i--) { + for (i = bit_end; i > bit_start && i > 0; i--) mask = mask + (1 << (i - 1)); - } value <<= bit_start; @@ -1203,9 +1194,8 @@ u32 cx231xx_set_field(u32 field_mask, u32 data) { u32 temp; - for (temp = field_mask; (temp & 1) == 0; temp >>= 1) { + for (temp = field_mask; (temp & 1) == 0; temp >>= 1) data <<= 1; - } return data; } diff --git a/drivers/media/video/cx231xx/cx231xx-dvb.c b/drivers/media/video/cx231xx/cx231xx-dvb.c index 85bee8c35e0..c5082a4e8ce 100644 --- a/drivers/media/video/cx231xx/cx231xx-dvb.c +++ b/drivers/media/video/cx231xx/cx231xx-dvb.c @@ -2,7 +2,7 @@ DVB device driver for cx231xx Copyright (C) 2008 <srinivasa.deevi at conexant dot com> - Based on em28xx driver + Based on em28xx driver This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -395,20 +395,20 @@ static int register_dvb(struct cx231xx_dvb *dvb, dvb_net_init(&dvb->adapter, &dvb->net, &dvb->demux.dmx); return 0; - fail_fe_conn: +fail_fe_conn: dvb->demux.dmx.remove_frontend(&dvb->demux.dmx, &dvb->fe_mem); - fail_fe_mem: +fail_fe_mem: dvb->demux.dmx.remove_frontend(&dvb->demux.dmx, &dvb->fe_hw); - fail_fe_hw: +fail_fe_hw: dvb_dmxdev_release(&dvb->dmxdev); - fail_dmxdev: +fail_dmxdev: dvb_dmx_release(&dvb->demux); - fail_dmx: +fail_dmx: dvb_unregister_frontend(dvb->frontend); - fail_frontend: +fail_frontend: dvb_frontend_detach(dvb->frontend); dvb_unregister_adapter(&dvb->adapter); - fail_adapter: +fail_adapter: return result; } @@ -516,7 +516,7 @@ static int dvb_init(struct cx231xx *dev) printk(KERN_INFO "Successfully loaded cx231xx-dvb\n"); return 0; - out_free: +out_free: cx231xx_set_mode(dev, CX231XX_SUSPEND); kfree(dvb); dev->dvb = NULL; diff --git a/drivers/media/video/cx231xx/cx231xx-i2c.c b/drivers/media/video/cx231xx/cx231xx-i2c.c index c250ad27e1d..1af87579ab4 100644 --- a/drivers/media/video/cx231xx/cx231xx-i2c.c +++ b/drivers/media/video/cx231xx/cx231xx-i2c.c @@ -2,8 +2,8 @@ cx231xx-i2c.c - driver for Conexant Cx23100/101/102 USB video capture devices Copyright (C) 2008 <srinivasa.deevi at conexant dot com> - Based on em28xx driver - Based on Cx23885 driver + Based on em28xx driver + Based on Cx23885 driver This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -42,8 +42,8 @@ MODULE_PARM_DESC(i2c_debug, "enable debug messages [i2c]"); #define dprintk1(lvl, fmt, args...) \ do { \ if (i2c_debug >= lvl) { \ - printk(fmt, ##args); \ - } \ + printk(fmt, ##args); \ + } \ } while (0) #define dprintk2(lvl, fmt, args...) \ @@ -78,8 +78,8 @@ int cx231xx_i2c_send_bytes(struct i2c_adapter *i2c_adap, if (size == 2) { /* register write sub addr */ - /* Just writing sub address will cause problem to XC5000 - So ignore the request */ + /* Just writing sub address will cause problem to XC5000 + So ignore the request */ return 0; } else if (size == 4) { /* register write with sub addr */ @@ -92,7 +92,8 @@ int cx231xx_i2c_send_bytes(struct i2c_adapter *i2c_adap, switch (saddr) { case 0x0000: /* start tuner calibration mode */ need_gpio = 1; - dev->xc_fw_load_done = 1; /* FW Loading is done */ + /* FW Loading is done */ + dev->xc_fw_load_done = 1; break; case 0x000D: /* Set signal source */ case 0x0001: /* Set TV standard - Video */ @@ -108,8 +109,8 @@ int cx231xx_i2c_send_bytes(struct i2c_adapter *i2c_adap, if (need_gpio) { dprintk1(1, - " GPIO W R I T E : addr 0x%x, len %d, saddr 0x%x\n", - msg->addr, msg->len, saddr); + "GPIO WRITE: addr 0x%x, len %d, saddr 0x%x\n", + msg->addr, msg->len, saddr); return dev->cx231xx_gpio_i2c_write(dev, msg->addr, @@ -196,8 +197,8 @@ static int cx231xx_i2c_recv_bytes(struct i2c_adapter *i2c_adap, switch (saddr) { case 0x0009: /* BUSY check */ dprintk1(1, - " GPIO R E A D : Special case BUSY check \n"); - /* Try to read BUSY register, just set it to zero */ + "GPIO R E A D: Special case BUSY check \n"); + /*Try read BUSY register, just set it to zero*/ msg->buf[0] = 0; if (msg->len == 2) msg->buf[1] = 0; @@ -209,12 +210,14 @@ static int cx231xx_i2c_recv_bytes(struct i2c_adapter *i2c_adap, } if (need_gpio) { - /* this is a special case to handle Xceive tuner clock stretch issue - with gpio based I2C interface */ + /* this is a special case to handle Xceive tuner + clock stretch issue with gpio based I2C */ + dprintk1(1, - " GPIO R E A D : addr 0x%x, len %d, saddr 0x%x\n", - msg->addr, msg->len, - msg->buf[0] << 8 | msg->buf[1]); + "GPIO R E A D: addr 0x%x, len %d, saddr 0x%x\n", + msg->addr, msg->len, + msg->buf[0] << 8 | msg->buf[1]); + status = dev->cx231xx_gpio_i2c_write(dev, msg->addr, msg->buf, @@ -281,8 +284,8 @@ static int cx231xx_i2c_recv_bytes_with_saddr(struct i2c_adapter *i2c_adap, if ((msg2->len < 16)) { dprintk1(1, - " i2c_read : addr 0x%x, len %d, subaddr 0x%x, leng %d\n", - msg2->addr, msg2->len, saddr, msg1->len); + "i2c_read: addr 0x%x, len %d, saddr 0x%x, len %d\n", + msg2->addr, msg2->len, saddr, msg1->len); switch (saddr) { case 0x0008: /* read FW load status */ @@ -368,7 +371,8 @@ static int cx231xx_i2c_xfer(struct i2c_adapter *i2c_adap, dprintk2(2, "%s %s addr=%x len=%d:", (msgs[i].flags & I2C_M_RD) ? "read" : "write", i == num - 1 ? "stop" : "nonstop", addr, msgs[i].len); - if (!msgs[i].len) { /* no len: check only for device presence */ + if (!msgs[i].len) { + /* no len: check only for device presence */ rc = cx231xx_i2c_check_for_device(i2c_adap, &msgs[i]); if (rc < 0) { dprintk2(2, " no device\n"); @@ -409,7 +413,7 @@ static int cx231xx_i2c_xfer(struct i2c_adapter *i2c_adap, } return num; - err: +err: dprintk2(2, " ERROR: %i\n", rc); return rc; } diff --git a/drivers/media/video/cx231xx/cx231xx-input.c b/drivers/media/video/cx231xx/cx231xx-input.c index 68e95ea03b1..97e304c3c79 100644 --- a/drivers/media/video/cx231xx/cx231xx-input.c +++ b/drivers/media/video/cx231xx/cx231xx-input.c @@ -2,9 +2,9 @@ handle cx231xx IR remotes via linux kernel input layer. Copyright (C) 2008 <srinivasa.deevi at conexant dot com> - Based on em28xx driver + Based on em28xx driver - < This is a place holder for IR now.> + < This is a place holder for IR now.> This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -219,10 +219,10 @@ int cx231xx_ir_init(struct cx231xx *dev) goto err_out_stop; return 0; - err_out_stop: +err_out_stop: cx231xx_ir_stop(ir); dev->ir = NULL; - err_out_free: +err_out_free: input_free_device(input_dev); kfree(ir); return err; diff --git a/drivers/media/video/cx231xx/cx231xx-reg.h b/drivers/media/video/cx231xx/cx231xx-reg.h index 7c8ba4e053e..d2d325b21d4 100644 --- a/drivers/media/video/cx231xx/cx231xx-reg.h +++ b/drivers/media/video/cx231xx/cx231xx-reg.h @@ -1,5 +1,6 @@ /* - cx231xx-reg.h - driver for Conexant Cx23100/101/102 USB video capture devices + cx231xx-reg.h - driver for Conexant Cx23100/101/102 + USB video capture devices Copyright (C) 2008 <srinivasa.deevi at conexant dot com> @@ -22,7 +23,7 @@ #define _CX231XX_REG_H /***************************************************************************** - * VBI codes * + * VBI codes * *****************************************************************************/ #define SAV_ACTIVE_VIDEO_FIELD1 0x80 @@ -1533,13 +1534,13 @@ #define INPUT_MODE_YC2_2 2 /* INPUT_MODE_VALUE(2) */ #define INPUT_MODE_YUV_3 3 /* INPUT_MODE_VALUE(3) */ -#define LUMA_LPF_LOW_BANDPASS 0 /* 0.6Mhz lowpass filter bandwidth */ -#define LUMA_LPF_MEDIUM_BANDPASS 1 /* 1.0Mhz lowpass filter bandwidth */ -#define LUMA_LPF_HIGH_BANDPASS 2 /* 1.5Mhz lowpass filter bandwidth */ +#define LUMA_LPF_LOW_BANDPASS 0 /* 0.6Mhz LPF BW */ +#define LUMA_LPF_MEDIUM_BANDPASS 1 /* 1.0Mhz LPF BW */ +#define LUMA_LPF_HIGH_BANDPASS 2 /* 1.5Mhz LPF BW */ -#define UV_LPF_LOW_BANDPASS 0 /* 0.6Mhz lowpass filter bandwidth */ -#define UV_LPF_MEDIUM_BANDPASS 1 /* 1.0Mhz lowpass filter bandwidth */ -#define UV_LPF_HIGH_BANDPASS 2 /* 1.5Mhz lowpass filter bandwidth */ +#define UV_LPF_LOW_BANDPASS 0 /* 0.6Mhz LPF BW */ +#define UV_LPF_MEDIUM_BANDPASS 1 /* 1.0Mhz LPF BW */ +#define UV_LPF_HIGH_BANDPASS 2 /* 1.5Mhz LPF BW */ #define TWO_TAP_FILT 0 #define THREE_TAP_FILT 1 diff --git a/drivers/media/video/cx231xx/cx231xx-vbi.c b/drivers/media/video/cx231xx/cx231xx-vbi.c index 03059043744..82db39d339e 100644 --- a/drivers/media/video/cx231xx/cx231xx-vbi.c +++ b/drivers/media/video/cx231xx/cx231xx-vbi.c @@ -140,23 +140,24 @@ static inline int cx231xx_isoc_vbi_copy(struct cx231xx *dev, struct urb *urb) while (bytes_parsed < buffer_size) { u32 bytes_used = 0; - sav_eav = cx231xx_find_next_SAV_EAV(p_buffer + bytes_parsed, /* p_buffer */ - buffer_size - bytes_parsed, /* buffer size */ - &bytes_used); /* Receives bytes used to get SAV/EAV */ + sav_eav = cx231xx_find_next_SAV_EAV( + p_buffer + bytes_parsed, /* p_buffer */ + buffer_size - bytes_parsed, /* buffer size */ + &bytes_used); /* bytes used to get SAV/EAV */ bytes_parsed += bytes_used; sav_eav &= 0xF0; if (sav_eav && (bytes_parsed < buffer_size)) { bytes_parsed += cx231xx_get_vbi_line(dev, - dma_q, sav_eav, /* SAV/EAV */ - p_buffer + bytes_parsed, /* p_buffer */ - buffer_size - bytes_parsed); /* buffer size */ + dma_q, sav_eav, /* SAV/EAV */ + p_buffer+bytes_parsed, /* p_buffer */ + buffer_size-bytes_parsed);/*buf size*/ } } - /* Save the last four bytes of the buffer so we can check the buffer boundary - condition next time */ + /* Save the last four bytes of the buffer so we can + check the buffer boundary condition next time */ memcpy(dma_q->partial_buf, p_buffer + buffer_size - 4, 4); bytes_parsed = 0; } diff --git a/drivers/media/video/cx231xx/cx231xx-vbi.h b/drivers/media/video/cx231xx/cx231xx-vbi.h index c0d89b1e272..89c7fe80b26 100644 --- a/drivers/media/video/cx231xx/cx231xx-vbi.h +++ b/drivers/media/video/cx231xx/cx231xx-vbi.h @@ -2,7 +2,7 @@ cx231xx_vbi.h - driver for Conexant Cx23100/101/102 USB video capture devices Copyright (C) 2008 <srinivasa.deevi at conexant dot com> - Based on cx88 driver + Based on cx88 driver This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -24,16 +24,16 @@ extern struct videobuf_queue_ops cx231xx_vbi_qops; -#define NTSC_VBI_START_LINE 10 /* line 10 - 21 */ -#define NTSC_VBI_END_LINE 21 -#define NTSC_VBI_LINES (NTSC_VBI_END_LINE - NTSC_VBI_START_LINE + 1) +#define NTSC_VBI_START_LINE 10 /* line 10 - 21 */ +#define NTSC_VBI_END_LINE 21 +#define NTSC_VBI_LINES (NTSC_VBI_END_LINE-NTSC_VBI_START_LINE+1) -#define PAL_VBI_START_LINE 6 -#define PAL_VBI_END_LINE 23 -#define PAL_VBI_LINES (PAL_VBI_END_LINE - PAL_VBI_START_LINE + 1) +#define PAL_VBI_START_LINE 6 +#define PAL_VBI_END_LINE 23 +#define PAL_VBI_LINES (PAL_VBI_END_LINE-PAL_VBI_START_LINE+1) -#define VBI_STRIDE 1440 -#define VBI_SAMPLES_PER_LINE 1440 +#define VBI_STRIDE 1440 +#define VBI_SAMPLES_PER_LINE 1440 #define CX231XX_NUM_VBI_PACKETS 4 #define CX231XX_NUM_VBI_BUFS 5 @@ -41,21 +41,23 @@ extern struct videobuf_queue_ops cx231xx_vbi_qops; /* stream functions */ int cx231xx_init_vbi_isoc(struct cx231xx *dev, int max_packets, int num_bufs, int max_pkt_size, - int (*isoc_copy) (struct cx231xx * dev, - struct urb * urb)); + int (*isoc_copy) (struct cx231xx *dev, + struct urb *urb)); void cx231xx_uninit_vbi_isoc(struct cx231xx *dev); /* vbi data copy functions */ u32 cx231xx_get_vbi_line(struct cx231xx *dev, struct cx231xx_dmaqueue *dma_q, - u8 sav_eav, u8 * p_buffer, u32 buffer_size); + u8 sav_eav, u8 *p_buffer, u32 buffer_size); + u32 cx231xx_copy_vbi_line(struct cx231xx *dev, struct cx231xx_dmaqueue *dma_q, - u8 * p_line, u32 length, int field_number); + u8 *p_line, u32 length, int field_number); + void cx231xx_reset_vbi_buffer(struct cx231xx *dev, struct cx231xx_dmaqueue *dma_q); int cx231xx_do_vbi_copy(struct cx231xx *dev, struct cx231xx_dmaqueue *dma_q, - u8 * p_buffer, u32 bytes_to_copy); + u8 *p_buffer, u32 bytes_to_copy); u8 cx231xx_is_vbi_buffer_done(struct cx231xx *dev, struct cx231xx_dmaqueue *dma_q); diff --git a/drivers/media/video/cx231xx/cx231xx-video.c b/drivers/media/video/cx231xx/cx231xx-video.c index 47e2da8ae19..fc7260a71e8 100644 --- a/drivers/media/video/cx231xx/cx231xx-video.c +++ b/drivers/media/video/cx231xx/cx231xx-video.c @@ -365,10 +365,11 @@ static inline int cx231xx_isoc_copy(struct cx231xx *dev, struct urb *urb) bytes_parsed = 0; if (dma_q->is_partial_line) { - /* Handle the case where we were working on a partial line */ + /* Handle the case of a partial line */ sav_eav = dma_q->last_sav; } else { - /* Check for a SAV/EAV overlapping the buffer boundary */ + /* Check for a SAV/EAV overlapping + the buffer boundary */ sav_eav = cx231xx_find_boundary_SAV_EAV(p_buffer, dma_q->partial_buf, @@ -380,9 +381,9 @@ static inline int cx231xx_isoc_copy(struct cx231xx *dev, struct urb *urb) the last buffer or a partial line */ if (sav_eav) { bytes_parsed += cx231xx_get_video_line(dev, dma_q, - sav_eav, /* SAV/EAV */ - p_buffer + bytes_parsed, /* p_buffer */ - buffer_size - bytes_parsed); /* buffer size */ + sav_eav, /* SAV/EAV */ + p_buffer + bytes_parsed, /* p_buffer */ + buffer_size - bytes_parsed);/* buf size */ } /* Now parse data that is completely in this buffer */ @@ -391,18 +392,19 @@ static inline int cx231xx_isoc_copy(struct cx231xx *dev, struct urb *urb) while (bytes_parsed < buffer_size) { u32 bytes_used = 0; - sav_eav = cx231xx_find_next_SAV_EAV(p_buffer + bytes_parsed, /* p_buffer */ - buffer_size - bytes_parsed, /* buffer size */ - &bytes_used); /* Receives bytes used to get SAV/EAV */ + sav_eav = cx231xx_find_next_SAV_EAV( + p_buffer + bytes_parsed, /* p_buffer */ + buffer_size - bytes_parsed, /* buf size */ + &bytes_used);/* bytes used to get SAV/EAV */ bytes_parsed += bytes_used; sav_eav &= 0xF0; if (sav_eav && (bytes_parsed < buffer_size)) { bytes_parsed += cx231xx_get_video_line(dev, - dma_q, sav_eav, /* SAV/EAV */ - p_buffer + bytes_parsed, /* p_buffer */ - buffer_size - bytes_parsed); /* buffer size */ + dma_q, sav_eav, /* SAV/EAV */ + p_buffer + bytes_parsed,/* p_buffer */ + buffer_size - bytes_parsed);/*buf size*/ } } @@ -1398,9 +1400,11 @@ static int vidioc_s_frequency(struct file *file, void *priv, #ifdef CONFIG_VIDEO_ADV_DEBUG /* - -R, --list-registers=type=<host/i2cdrv/i2caddr>,chip=<chip>[,min=<addr>,max=<addr>] + -R, --list-registers=type=<host/i2cdrv/i2caddr>, + chip=<chip>[,min=<addr>,max=<addr>] dump registers from <min> to <max> [VIDIOC_DBG_G_REGISTER] - -r, --set-register=type=<host/i2cdrv/i2caddr>,chip=<chip>,reg=<addr>,val=<val> + -r, --set-register=type=<host/i2cdrv/i2caddr>, + chip=<chip>,reg=<addr>,val=<val> set the register [VIDIOC_DBG_S_REGISTER] if type == host, then <chip> is the hosts chip ID (default 0) @@ -2332,8 +2336,9 @@ static struct video_device cx231xx_radio_template = { /******************************** usb interface ******************************/ -static struct video_device *cx231xx_vdev_init(struct cx231xx *dev, const struct video_device - *template, const char *type_name) +static struct video_device *cx231xx_vdev_init(struct cx231xx *dev, + const struct video_device + *template, const char *type_name) { struct video_device *vfd; diff --git a/drivers/media/video/cx231xx/cx231xx.h b/drivers/media/video/cx231xx/cx231xx.h index d4fba028db4..f6e34a6de78 100644 --- a/drivers/media/video/cx231xx/cx231xx.h +++ b/drivers/media/video/cx231xx/cx231xx.h @@ -29,7 +29,8 @@ #include <linux/i2c-algo-bit.h> #include <linux/mutex.h> #include <media/ir-kbd-i2c.h> -#if defined(CONFIG_VIDEO_CX231XX_DVB) || defined(CONFIG_VIDEO_CX231XX_DVB_MODULE) +#if defined(CONFIG_VIDEO_CX231XX_DVB) || \ + defined(CONFIG_VIDEO_CX231XX_DVB_MODULE) #include <media/videobuf-dvb.h> #endif @@ -87,7 +88,8 @@ #define CX231XX_INTERLACED_DEFAULT 1 /* time to wait when stopping the isoc transfer */ -#define CX231XX_URB_TIMEOUT msecs_to_jiffies(CX231XX_NUM_BUFS * CX231XX_NUM_PACKETS) +#define CX231XX_URB_TIMEOUT \ + msecs_to_jiffies(CX231XX_NUM_BUFS * CX231XX_NUM_PACKETS) enum cx231xx_mode { CX231XX_SUSPEND, @@ -231,12 +233,12 @@ enum cx231xx_decoder { CX231XX_AVDECODER }; -typedef enum _I2C_MASTER_PORT { +enum CX231XX_I2C_MASTER_PORT { I2C_0 = 0, I2C_1 = 1, I2C_2 = 2, I2C_3 = 3 -} CX231XX_I2C_MASTER_PORT; +}; struct cx231xx_board { char *name; @@ -346,16 +348,20 @@ struct cx231xx_fh { enum v4l2_buf_type type; }; -/**********************************************************************************/ +/*****************************************************************/ /* set/get i2c */ -#define I2C_SPEED_1M 0x0 /* 00--1Mb/s, 01-400kb/s, 10--100kb/s, 11--5Mb/s */ -#define I2C_SPEED_400K 0x1 /* 00--1Mb/s, 01-400kb/s, 10--100kb/s, 11--5Mb/s */ -#define I2C_SPEED_100K 0x2 /* 00--1Mb/s, 01-400kb/s, 10--100kb/s, 11--5Mb/s */ -#define I2C_SPEED_5M 0x3 /* 00--1Mb/s, 01-400kb/s, 10--100kb/s, 11--5Mb/s */ - -#define I2C_STOP 0x0 /* 0-- STOP transaction */ -#define I2C_NOSTOP 0x1 /* 1-- do not transmit STOP at end of transaction */ -#define I2C_SYNC 0x1 /* 1--alllow slave to insert clock wait states */ +/* 00--1Mb/s, 01-400kb/s, 10--100kb/s, 11--5Mb/s */ +#define I2C_SPEED_1M 0x0 +#define I2C_SPEED_400K 0x1 +#define I2C_SPEED_100K 0x2 +#define I2C_SPEED_5M 0x3 + +/* 0-- STOP transaction */ +#define I2C_STOP 0x0 +/* 1-- do not transmit STOP at end of transaction */ +#define I2C_NOSTOP 0x1 +/* 1--alllow slave to insert clock wait states */ +#define I2C_SYNC 0x1 struct cx231xx_i2c { struct cx231xx *dev; @@ -383,7 +389,7 @@ struct cx231xx_i2c_xfer_data { u8 *p_buffer; /* pointer to the buffer */ }; -typedef struct _VENDOR_REQUEST_IN { +struct VENDOR_REQUEST_IN{ u8 bRequest; u16 wValue; u16 wIndex; @@ -391,7 +397,7 @@ typedef struct _VENDOR_REQUEST_IN { u8 direction; u8 bData; u8 *pBuff; -} VENDOR_REQUEST_IN, *PVENDOR_REQUEST_IN; +}; struct cx231xx_ctrl { struct v4l2_queryctrl v; @@ -401,7 +407,7 @@ struct cx231xx_ctrl { u32 shift; }; -typedef enum { +enum TRANSFER_TYPE{ Raw_Video = 0, Audio, Vbi, /* VANC */ @@ -409,7 +415,7 @@ typedef enum { TS1_serial_mode, TS2, TS1_parallel_mode -} TRANSFER_TYPE; +} ; struct cx231xx_video_mode { /* Isoc control struct */ @@ -500,7 +506,7 @@ struct cx231xx { int (*cx231xx_write_ctrl_reg) (struct cx231xx *dev, u8 req, u16 reg, char *buf, int len); int (*cx231xx_send_usb_command) (struct cx231xx_i2c *i2c_bus, - struct cx231xx_i2c_xfer_data *req_data); + struct cx231xx_i2c_xfer_data *req_data); int (*cx231xx_gpio_i2c_read) (struct cx231xx *dev, u8 dev_addr, u8 *buf, u8 len); int (*cx231xx_gpio_i2c_write) (struct cx231xx *dev, u8 dev_addr, @@ -621,9 +627,10 @@ int cx231xx_write_ctrl_reg(struct cx231xx *dev, u8 req, u16 reg, char *buf, int len); int cx231xx_mode_register(struct cx231xx *dev, u16 address, u32 mode); -int cx231xx_send_vendor_cmd(struct cx231xx *dev, VENDOR_REQUEST_IN *ven_req); +int cx231xx_send_vendor_cmd(struct cx231xx *dev, + struct VENDOR_REQUEST_IN *ven_req); int cx231xx_send_usb_command(struct cx231xx_i2c *i2c_bus, - struct cx231xx_i2c_xfer_data *req_data); + struct cx231xx_i2c_xfer_data *req_data); /* Gpio related functions */ int cx231xx_send_gpio_cmd(struct cx231xx *dev, u32 gpio_bit, u8 *gpio_val, |