diff options
author | Sri Deevi <Srinivasa.Deevi@conexant.com> | 2009-03-04 15:49:01 -0500 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2009-04-06 20:44:03 -0400 |
commit | b9255176453086b2531c5559350bd5c92b771cc5 (patch) | |
tree | b448774588b137e6efb9fad0ce8902b00a8d4788 | |
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>
-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 3810b0fd2d61..044edbc2d844 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) | |||
132 | snd_pcm_stream_lock(substream); | 132 | snd_pcm_stream_lock(substream); |
133 | 133 | ||
134 | dev->adev.hwptr_done_capture += length; | 134 | dev->adev.hwptr_done_capture += length; |
135 | if (dev->adev.hwptr_done_capture >= runtime->buffer_size) | 135 | if (dev->adev.hwptr_done_capture >= |
136 | dev->adev.hwptr_done_capture -= runtime->buffer_size; | 136 | runtime->buffer_size) |
137 | dev->adev.hwptr_done_capture -= | ||
138 | runtime->buffer_size; | ||
137 | 139 | ||
138 | dev->adev.capture_transfer_done += length; | 140 | dev->adev.capture_transfer_done += length; |
139 | if (dev->adev.capture_transfer_done >= runtime->period_size) { | 141 | if (dev->adev.capture_transfer_done >= |
140 | dev->adev.capture_transfer_done -= runtime->period_size; | 142 | runtime->period_size) { |
143 | dev->adev.capture_transfer_done -= | ||
144 | runtime->period_size; | ||
141 | period_elapsed = 1; | 145 | period_elapsed = 1; |
142 | } | 146 | } |
143 | snd_pcm_stream_unlock(substream); | 147 | snd_pcm_stream_unlock(substream); |
@@ -185,7 +189,8 @@ static int cx231xx_init_audio_isoc(struct cx231xx *dev) | |||
185 | 189 | ||
186 | urb->dev = dev->udev; | 190 | urb->dev = dev->udev; |
187 | urb->context = dev; | 191 | urb->context = dev; |
188 | urb->pipe = usb_rcvisocpipe(dev->udev, dev->adev.end_point_addr); | 192 | urb->pipe = usb_rcvisocpipe(dev->udev, |
193 | dev->adev.end_point_addr); | ||
189 | urb->transfer_flags = URB_ISO_ASAP; | 194 | urb->transfer_flags = URB_ISO_ASAP; |
190 | urb->transfer_buffer = dev->adev.transfer_buffer[i]; | 195 | urb->transfer_buffer = dev->adev.transfer_buffer[i]; |
191 | urb->interval = 1; | 196 | urb->interval = 1; |
@@ -193,7 +198,8 @@ static int cx231xx_init_audio_isoc(struct cx231xx *dev) | |||
193 | urb->number_of_packets = CX231XX_NUM_AUDIO_PACKETS; | 198 | urb->number_of_packets = CX231XX_NUM_AUDIO_PACKETS; |
194 | urb->transfer_buffer_length = sb_size; | 199 | urb->transfer_buffer_length = sb_size; |
195 | 200 | ||
196 | for (j = k = 0; j < CX231XX_NUM_AUDIO_PACKETS; j++, k += dev->adev.max_pkt_size) { | 201 | for (j = k = 0; j < CX231XX_NUM_AUDIO_PACKETS; |
202 | j++, k += dev->adev.max_pkt_size) { | ||
197 | urb->iso_frame_desc[j].offset = k; | 203 | urb->iso_frame_desc[j].offset = k; |
198 | urb->iso_frame_desc[j].length = dev->adev.max_pkt_size; | 204 | urb->iso_frame_desc[j].length = dev->adev.max_pkt_size; |
199 | } | 205 | } |
@@ -293,7 +299,8 @@ static int snd_cx231xx_capture_open(struct snd_pcm_substream *substream) | |||
293 | dev->mute = 0; | 299 | dev->mute = 0; |
294 | 300 | ||
295 | /* set alternate setting for audio interface */ | 301 | /* set alternate setting for audio interface */ |
296 | ret = cx231xx_set_alt_setting(dev, INDEX_AUDIO, 1); /* 1 - 48000 samples per sec */ | 302 | /* 1 - 48000 samples per sec */ |
303 | ret = cx231xx_set_alt_setting(dev, INDEX_AUDIO, 1); | ||
297 | if (ret < 0) { | 304 | if (ret < 0) { |
298 | cx231xx_errdev("failed to set alternate setting !\n"); | 305 | cx231xx_errdev("failed to set alternate setting !\n"); |
299 | 306 | ||
@@ -324,7 +331,8 @@ static int snd_cx231xx_pcm_close(struct snd_pcm_substream *substream) | |||
324 | dprintk("closing device\n"); | 331 | dprintk("closing device\n"); |
325 | 332 | ||
326 | /* set alternate setting for audio interface */ | 333 | /* set alternate setting for audio interface */ |
327 | ret = cx231xx_set_alt_setting(dev, INDEX_AUDIO, 0); /* 1 - 48000 samples per sec */ | 334 | /* 1 - 48000 samples per sec */ |
335 | ret = cx231xx_set_alt_setting(dev, INDEX_AUDIO, 0); | ||
328 | if (ret < 0) { | 336 | if (ret < 0) { |
329 | cx231xx_errdev("failed to set alternate setting !\n"); | 337 | cx231xx_errdev("failed to set alternate setting !\n"); |
330 | 338 | ||
diff --git a/drivers/media/video/cx231xx/cx231xx-avcore.c b/drivers/media/video/cx231xx/cx231xx-avcore.c index bbfc78ebd94b..8bbe518f4837 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) | |||
74 | &colibri_power_status, 1); | 74 | &colibri_power_status, 1); |
75 | colibri_power_status &= 0xff; | 75 | colibri_power_status &= 0xff; |
76 | if (status < 0) { | 76 | if (status < 0) { |
77 | cx231xx_info(": Init Super Block failed in sending/receiving cmds\n"); | 77 | cx231xx_info( |
78 | ": Init Super Block failed in send/receive cmds\n"); | ||
78 | break; | 79 | break; |
79 | } | 80 | } |
80 | i++; | 81 | i++; |
81 | if (i == 10) { | 82 | if (i == 10) { |
82 | cx231xx_info(": Init Super Block force break in loop !!!!\n"); | 83 | cx231xx_info( |
84 | ": Init Super Block force break in loop !!!!\n"); | ||
83 | status = -1; | 85 | status = -1; |
84 | break; | 86 | break; |
85 | } | 87 | } |
@@ -258,7 +260,8 @@ int cx231xx_colibri_set_mode(struct cx231xx *dev, enum AFE_MODE mode) | |||
258 | break; | 260 | break; |
259 | } | 261 | } |
260 | 262 | ||
261 | if ((mode != dev->colibri_mode) && (dev->video_input == CX231XX_VMUX_TELEVISION)) | 263 | if ((mode != dev->colibri_mode) && |
264 | (dev->video_input == CX231XX_VMUX_TELEVISION)) | ||
262 | status = cx231xx_colibri_adjust_ref_count(dev, | 265 | status = cx231xx_colibri_adjust_ref_count(dev, |
263 | CX231XX_VMUX_TELEVISION); | 266 | CX231XX_VMUX_TELEVISION); |
264 | 267 | ||
@@ -511,8 +514,9 @@ int cx231xx_set_video_input_mux(struct cx231xx *dev, u8 input) | |||
511 | status = cx231xx_set_power_mode(dev, | 514 | status = cx231xx_set_power_mode(dev, |
512 | POLARIS_AVMODE_ENXTERNAL_AV); | 515 | POLARIS_AVMODE_ENXTERNAL_AV); |
513 | if (status < 0) { | 516 | if (status < 0) { |
514 | cx231xx_errdev("%s: cx231xx_set_power_mode : Failed to set Power - errCode [%d]!\n", | 517 | cx231xx_errdev("%s: set_power_mode : Failed to" |
515 | __func__, status); | 518 | " set Power - errCode [%d]!\n", |
519 | __func__, status); | ||
516 | return status; | 520 | return status; |
517 | } | 521 | } |
518 | } | 522 | } |
@@ -528,8 +532,9 @@ int cx231xx_set_video_input_mux(struct cx231xx *dev, u8 input) | |||
528 | status = cx231xx_set_power_mode(dev, | 532 | status = cx231xx_set_power_mode(dev, |
529 | POLARIS_AVMODE_ANALOGT_TV); | 533 | POLARIS_AVMODE_ANALOGT_TV); |
530 | if (status < 0) { | 534 | if (status < 0) { |
531 | cx231xx_errdev("%s: cx231xx_set_power_mode : Failed to set Power - errCode [%d]!\n", | 535 | cx231xx_errdev("%s: set_power_mode:Failed" |
532 | __func__, status); | 536 | " to set Power - errCode [%d]!\n", |
537 | __func__, status); | ||
533 | return status; | 538 | return status; |
534 | } | 539 | } |
535 | } | 540 | } |
@@ -538,7 +543,7 @@ int cx231xx_set_video_input_mux(struct cx231xx *dev, u8 input) | |||
538 | INPUT(input)->vmux); | 543 | INPUT(input)->vmux); |
539 | break; | 544 | break; |
540 | default: | 545 | default: |
541 | cx231xx_errdev("%s: cx231xx_set_power_mode : Unknown Input %d !\n", | 546 | cx231xx_errdev("%s: set_power_mode : Unknown Input %d !\n", |
542 | __func__, INPUT(input)->type); | 547 | __func__, INPUT(input)->type); |
543 | break; | 548 | break; |
544 | } | 549 | } |
@@ -549,7 +554,8 @@ int cx231xx_set_video_input_mux(struct cx231xx *dev, u8 input) | |||
549 | return status; | 554 | return status; |
550 | } | 555 | } |
551 | 556 | ||
552 | int cx231xx_set_decoder_video_input(struct cx231xx *dev, u8 pin_type, u8 input) | 557 | int cx231xx_set_decoder_video_input(struct cx231xx *dev, |
558 | u8 pin_type, u8 input) | ||
553 | { | 559 | { |
554 | int status = 0; | 560 | int status = 0; |
555 | u32 value = 0; | 561 | u32 value = 0; |
@@ -557,8 +563,9 @@ int cx231xx_set_decoder_video_input(struct cx231xx *dev, u8 pin_type, u8 input) | |||
557 | if (pin_type != dev->video_input) { | 563 | if (pin_type != dev->video_input) { |
558 | status = cx231xx_colibri_adjust_ref_count(dev, pin_type); | 564 | status = cx231xx_colibri_adjust_ref_count(dev, pin_type); |
559 | if (status < 0) { | 565 | if (status < 0) { |
560 | cx231xx_errdev("%s: cx231xx_colibri_adjust_ref_count :Failed to set Colibri input mux - errCode [%d]!\n", | 566 | cx231xx_errdev("%s: adjust_ref_count :Failed to set" |
561 | __func__, status); | 567 | "Colibri input mux - errCode [%d]!\n", |
568 | __func__, status); | ||
562 | return status; | 569 | return status; |
563 | } | 570 | } |
564 | } | 571 | } |
@@ -566,8 +573,9 @@ int cx231xx_set_decoder_video_input(struct cx231xx *dev, u8 pin_type, u8 input) | |||
566 | /* call colibri block to set video inputs */ | 573 | /* call colibri block to set video inputs */ |
567 | status = cx231xx_colibri_set_input_mux(dev, input); | 574 | status = cx231xx_colibri_set_input_mux(dev, input); |
568 | if (status < 0) { | 575 | if (status < 0) { |
569 | cx231xx_errdev("%s: cx231xx_colibri_set_input_mux :Failed to set Colibri input mux - errCode [%d]!\n", | 576 | cx231xx_errdev("%s: set_input_mux :Failed to set" |
570 | __func__, status); | 577 | " Colibri input mux - errCode [%d]!\n", |
578 | __func__, status); | ||
571 | return status; | 579 | return status; |
572 | } | 580 | } |
573 | 581 | ||
@@ -579,8 +587,10 @@ int cx231xx_set_decoder_video_input(struct cx231xx *dev, u8 pin_type, u8 input) | |||
579 | value |= (0 << 13) | (1 << 4); | 587 | value |= (0 << 13) | (1 << 4); |
580 | value &= ~(1 << 5); | 588 | value &= ~(1 << 5); |
581 | 589 | ||
582 | value &= (~(0x1ff8000)); /* set [24:23] [22:15] to 0 */ | 590 | /* set [24:23] [22:15] to 0 */ |
583 | value |= 0x1000000; /* set FUNC_MODE[24:23] = 2 IF_MOD[22:15] = 0 */ | 591 | value &= (~(0x1ff8000)); |
592 | /* set FUNC_MODE[24:23] = 2 IF_MOD[22:15] = 0 */ | ||
593 | value |= 0x1000000; | ||
584 | status = cx231xx_write_i2c_data(dev, HAMMERHEAD_I2C_ADDRESS, | 594 | status = cx231xx_write_i2c_data(dev, HAMMERHEAD_I2C_ADDRESS, |
585 | AFE_CTRL, 2, value, 4); | 595 | AFE_CTRL, 2, value, 4); |
586 | 596 | ||
@@ -600,7 +610,8 @@ int cx231xx_set_decoder_video_input(struct cx231xx *dev, u8 pin_type, u8 input) | |||
600 | /* Tell DIF object to go to baseband mode */ | 610 | /* Tell DIF object to go to baseband mode */ |
601 | status = cx231xx_dif_set_standard(dev, DIF_USE_BASEBAND); | 611 | status = cx231xx_dif_set_standard(dev, DIF_USE_BASEBAND); |
602 | if (status < 0) { | 612 | if (status < 0) { |
603 | cx231xx_errdev("%s: cx231xx_dif set to By pass mode - errCode [%d]!\n", | 613 | cx231xx_errdev("%s: cx231xx_dif set to By pass" |
614 | " mode- errCode [%d]!\n", | ||
604 | __func__, status); | 615 | __func__, status); |
605 | return status; | 616 | return status; |
606 | } | 617 | } |
@@ -637,9 +648,11 @@ int cx231xx_set_decoder_video_input(struct cx231xx *dev, u8 pin_type, u8 input) | |||
637 | status = cx231xx_read_i2c_data(dev, HAMMERHEAD_I2C_ADDRESS, | 648 | status = cx231xx_read_i2c_data(dev, HAMMERHEAD_I2C_ADDRESS, |
638 | AFE_CTRL, 2, &value, 4); | 649 | AFE_CTRL, 2, &value, 4); |
639 | 650 | ||
640 | value &= (~(0x1ff8000)); /* set [24:23] [22:15] to 0 */ | 651 | /* set [24:23] [22:15] to 0 */ |
641 | value |= 0x1000010; /* set FUNC_MODE[24:23] = 2 | 652 | value &= (~(0x1ff8000)); |
642 | IF_MOD[22:15] = 0 DCR_BYP_CH2[4:4] = 1; */ | 653 | /* set FUNC_MODE[24:23] = 2 |
654 | IF_MOD[22:15] = 0 DCR_BYP_CH2[4:4] = 1; */ | ||
655 | value |= 0x1000010; | ||
643 | status = cx231xx_write_i2c_data(dev, | 656 | status = cx231xx_write_i2c_data(dev, |
644 | HAMMERHEAD_I2C_ADDRESS, | 657 | HAMMERHEAD_I2C_ADDRESS, |
645 | AFE_CTRL, 2, value, 4); | 658 | AFE_CTRL, 2, value, 4); |
@@ -647,7 +660,8 @@ int cx231xx_set_decoder_video_input(struct cx231xx *dev, u8 pin_type, u8 input) | |||
647 | /* Tell DIF object to go to baseband mode */ | 660 | /* Tell DIF object to go to baseband mode */ |
648 | status = cx231xx_dif_set_standard(dev, DIF_USE_BASEBAND); | 661 | status = cx231xx_dif_set_standard(dev, DIF_USE_BASEBAND); |
649 | if (status < 0) { | 662 | if (status < 0) { |
650 | cx231xx_errdev("%s: cx231xx_dif set to By pass mode - errCode [%d]!\n", | 663 | cx231xx_errdev("%s: cx231xx_dif set to By pass" |
664 | " mode- errCode [%d]!\n", | ||
651 | __func__, status); | 665 | __func__, status); |
652 | return status; | 666 | return status; |
653 | } | 667 | } |
@@ -713,8 +727,10 @@ int cx231xx_set_decoder_video_input(struct cx231xx *dev, u8 pin_type, u8 input) | |||
713 | value |= (0 << 13) | (1 << 4); | 727 | value |= (0 << 13) | (1 << 4); |
714 | value &= ~(1 << 5); | 728 | value &= ~(1 << 5); |
715 | 729 | ||
716 | value &= (~(0x1FF8000)); /* set [24:23] [22:15] to 0 */ | 730 | /* set [24:23] [22:15] to 0 */ |
717 | value |= 0x1000000; /* set FUNC_MODE[24:23] = 2 IF_MOD[22:15] = 0 */ | 731 | value &= (~(0x1FF8000)); |
732 | /* set FUNC_MODE[24:23] = 2 IF_MOD[22:15] = 0 */ | ||
733 | value |= 0x1000000; | ||
718 | status = cx231xx_write_i2c_data(dev, | 734 | status = cx231xx_write_i2c_data(dev, |
719 | HAMMERHEAD_I2C_ADDRESS, | 735 | HAMMERHEAD_I2C_ADDRESS, |
720 | AFE_CTRL, 2, | 736 | AFE_CTRL, 2, |
@@ -740,8 +756,9 @@ int cx231xx_set_decoder_video_input(struct cx231xx *dev, u8 pin_type, u8 input) | |||
740 | status = cx231xx_dif_set_standard(dev, | 756 | status = cx231xx_dif_set_standard(dev, |
741 | DIF_USE_BASEBAND); | 757 | DIF_USE_BASEBAND); |
742 | if (status < 0) { | 758 | if (status < 0) { |
743 | cx231xx_errdev("%s: cx231xx_dif set to By pass mode - errCode [%d]!\n", | 759 | cx231xx_errdev("%s: cx231xx_dif set to By pass" |
744 | __func__, status); | 760 | " mode- errCode [%d]!\n", |
761 | __func__, status); | ||
745 | return status; | 762 | return status; |
746 | } | 763 | } |
747 | 764 | ||
@@ -773,7 +790,8 @@ int cx231xx_set_decoder_video_input(struct cx231xx *dev, u8 pin_type, u8 input) | |||
773 | status = cx231xx_read_modify_write_i2c_dword(dev, | 790 | status = cx231xx_read_modify_write_i2c_dword(dev, |
774 | HAMMERHEAD_I2C_ADDRESS, | 791 | HAMMERHEAD_I2C_ADDRESS, |
775 | MODE_CTRL, FLD_INPUT_MODE, | 792 | MODE_CTRL, FLD_INPUT_MODE, |
776 | cx231xx_set_field(FLD_INPUT_MODE, INPUT_MODE_CVBS_0)); | 793 | cx231xx_set_field(FLD_INPUT_MODE, |
794 | INPUT_MODE_CVBS_0)); | ||
777 | break; | 795 | break; |
778 | default: | 796 | default: |
779 | /* Enable the DIF for the tuner */ | 797 | /* Enable the DIF for the tuner */ |
@@ -781,8 +799,9 @@ int cx231xx_set_decoder_video_input(struct cx231xx *dev, u8 pin_type, u8 input) | |||
781 | /* Reinitialize the DIF */ | 799 | /* Reinitialize the DIF */ |
782 | status = cx231xx_dif_set_standard(dev, dev->norm); | 800 | status = cx231xx_dif_set_standard(dev, dev->norm); |
783 | if (status < 0) { | 801 | if (status < 0) { |
784 | cx231xx_errdev("%s: cx231xx_dif set to By pass mode - errCode [%d]!\n", | 802 | cx231xx_errdev("%s: cx231xx_dif set to By pass" |
785 | __func__, status); | 803 | " mode- errCode [%d]!\n", |
804 | __func__, status); | ||
786 | return status; | 805 | return status; |
787 | } | 806 | } |
788 | 807 | ||
@@ -861,9 +880,11 @@ int cx231xx_set_decoder_video_input(struct cx231xx *dev, u8 pin_type, u8 input) | |||
861 | status = cx231xx_read_modify_write_i2c_dword(dev, | 880 | status = cx231xx_read_modify_write_i2c_dword(dev, |
862 | HAMMERHEAD_I2C_ADDRESS, | 881 | HAMMERHEAD_I2C_ADDRESS, |
863 | MODE_CTRL, FLD_INPUT_MODE, | 882 | MODE_CTRL, FLD_INPUT_MODE, |
864 | cx231xx_set_field(FLD_INPUT_MODE, INPUT_MODE_CVBS_0)); | 883 | cx231xx_set_field(FLD_INPUT_MODE, |
884 | INPUT_MODE_CVBS_0)); | ||
865 | 885 | ||
866 | /* Set some bits in AFE_CTRL so that channel 2 or 3 is ready to receive audio */ | 886 | /* Set some bits in AFE_CTRL so that channel 2 or 3 |
887 | * is ready to receive audio */ | ||
867 | /* Clear clamp for channels 2 and 3 (bit 16-17) */ | 888 | /* Clear clamp for channels 2 and 3 (bit 16-17) */ |
868 | /* Clear droop comp (bit 19-20) */ | 889 | /* Clear droop comp (bit 19-20) */ |
869 | /* Set VGA_SEL (for audio control) (bit 7-8) */ | 890 | /* 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) | |||
903 | } | 924 | } |
904 | 925 | ||
905 | /* | 926 | /* |
906 | * Handle any video-mode specific overrides that are different on a per video standards | 927 | * Handle any video-mode specific overrides that are different |
907 | * basis after touching the MODE_CTRL register which resets many values for autodetect | 928 | * on a per video standards basis after touching the MODE_CTRL |
929 | * register which resets many values for autodetect | ||
908 | */ | 930 | */ |
909 | int cx231xx_do_mode_ctrl_overrides(struct cx231xx *dev) | 931 | int cx231xx_do_mode_ctrl_overrides(struct cx231xx *dev) |
910 | { | 932 | { |
@@ -918,7 +940,8 @@ int cx231xx_do_mode_ctrl_overrides(struct cx231xx *dev) | |||
918 | DFE_CTRL3, 2, | 940 | DFE_CTRL3, 2, |
919 | 0xCD3F0280, 4); | 941 | 0xCD3F0280, 4); |
920 | 942 | ||
921 | if (dev->norm & (V4L2_STD_NTSC_M | V4L2_STD_NTSC_M_JP | V4L2_STD_PAL_M)) { | 943 | if (dev->norm & (V4L2_STD_NTSC_M | V4L2_STD_NTSC_M_JP | |
944 | V4L2_STD_PAL_M)) { | ||
922 | cx231xx_info("do_mode_ctrl_overrides NTSC\n"); | 945 | cx231xx_info("do_mode_ctrl_overrides NTSC\n"); |
923 | 946 | ||
924 | /* Move the close caption lines out of active video, | 947 | /* 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, | |||
1237 | 1260 | ||
1238 | if (mode == V4L2_TUNER_RADIO) { | 1261 | if (mode == V4L2_TUNER_RADIO) { |
1239 | /* C2HH */ | 1262 | /* C2HH */ |
1240 | status = cx231xx_reg_mask_write(dev, HAMMERHEAD_I2C_ADDRESS, 32, | 1263 | /* lo if big signal */ |
1241 | AFE_CTRL_C2HH_SRC_CTRL, 30, 31, 0x1); /* lo if big signal */ | 1264 | status = cx231xx_reg_mask_write(dev, |
1242 | status = cx231xx_reg_mask_write(dev, HAMMERHEAD_I2C_ADDRESS, 32, | 1265 | HAMMERHEAD_I2C_ADDRESS, 32, |
1243 | AFE_CTRL_C2HH_SRC_CTRL, 23, 24, function_mode); /* FUNC_MODE = DIF */ | 1266 | AFE_CTRL_C2HH_SRC_CTRL, 30, 31, 0x1); |
1244 | status = cx231xx_reg_mask_write(dev, HAMMERHEAD_I2C_ADDRESS, 32, | 1267 | /* FUNC_MODE = DIF */ |
1245 | AFE_CTRL_C2HH_SRC_CTRL, 15, 22, 0xFF); /* IF_MODE */ | 1268 | status = cx231xx_reg_mask_write(dev, |
1246 | status = cx231xx_reg_mask_write(dev, HAMMERHEAD_I2C_ADDRESS, 32, | 1269 | HAMMERHEAD_I2C_ADDRESS, 32, |
1247 | AFE_CTRL_C2HH_SRC_CTRL, 9, 9, 0x1); /* no inv */ | 1270 | AFE_CTRL_C2HH_SRC_CTRL, 23, 24, function_mode); |
1271 | /* IF_MODE */ | ||
1272 | status = cx231xx_reg_mask_write(dev, | ||
1273 | HAMMERHEAD_I2C_ADDRESS, 32, | ||
1274 | AFE_CTRL_C2HH_SRC_CTRL, 15, 22, 0xFF); | ||
1275 | /* no inv */ | ||
1276 | status = cx231xx_reg_mask_write(dev, | ||
1277 | HAMMERHEAD_I2C_ADDRESS, 32, | ||
1278 | AFE_CTRL_C2HH_SRC_CTRL, 9, 9, 0x1); | ||
1248 | } else { | 1279 | } else { |
1249 | switch (standard) { | 1280 | switch (standard) { |
1250 | case V4L2_STD_NTSC_M: /* 75 IRE Setup */ | 1281 | case V4L2_STD_NTSC_M: /* 75 IRE Setup */ |
1251 | case V4L2_STD_NTSC_M_JP: /* Japan, 0 IRE Setup */ | 1282 | case V4L2_STD_NTSC_M_JP:/* Japan, 0 IRE Setup */ |
1252 | case V4L2_STD_PAL_M: | 1283 | case V4L2_STD_PAL_M: |
1253 | case V4L2_STD_PAL_N: | 1284 | case V4L2_STD_PAL_N: |
1254 | case V4L2_STD_PAL_Nc: | 1285 | case V4L2_STD_PAL_Nc: |
1286 | /* lo if big signal */ | ||
1255 | status = cx231xx_reg_mask_write(dev, | 1287 | status = cx231xx_reg_mask_write(dev, |
1256 | HAMMERHEAD_I2C_ADDRESS, 32, | 1288 | HAMMERHEAD_I2C_ADDRESS, 32, |
1257 | AFE_CTRL_C2HH_SRC_CTRL, 30, 31, 0x1); /* lo if big signal */ | 1289 | AFE_CTRL_C2HH_SRC_CTRL, 30, 31, 0x1); |
1290 | /* FUNC_MODE = DIF */ | ||
1258 | status = cx231xx_reg_mask_write(dev, | 1291 | status = cx231xx_reg_mask_write(dev, |
1259 | HAMMERHEAD_I2C_ADDRESS, 32, | 1292 | HAMMERHEAD_I2C_ADDRESS, 32, |
1260 | AFE_CTRL_C2HH_SRC_CTRL, 23, 24, | 1293 | AFE_CTRL_C2HH_SRC_CTRL, 23, 24, |
1261 | function_mode); /* FUNC_MODE = DIF */ | 1294 | function_mode); |
1295 | /* IF_MODE */ | ||
1262 | status = cx231xx_reg_mask_write(dev, | 1296 | status = cx231xx_reg_mask_write(dev, |
1263 | HAMMERHEAD_I2C_ADDRESS, 32, | 1297 | HAMMERHEAD_I2C_ADDRESS, 32, |
1264 | AFE_CTRL_C2HH_SRC_CTRL, 15, 22, 0xb); /* IF_MODE */ | 1298 | AFE_CTRL_C2HH_SRC_CTRL, 15, 22, 0xb); |
1299 | /* no inv */ | ||
1265 | status = cx231xx_reg_mask_write(dev, | 1300 | status = cx231xx_reg_mask_write(dev, |
1266 | HAMMERHEAD_I2C_ADDRESS, 32, | 1301 | HAMMERHEAD_I2C_ADDRESS, 32, |
1267 | AFE_CTRL_C2HH_SRC_CTRL, 9, 9, 0x1); /* no inv */ | 1302 | AFE_CTRL_C2HH_SRC_CTRL, 9, 9, 0x1); |
1303 | /* 0x124, AUD_CHAN1_SRC = 0x3 */ | ||
1268 | status = cx231xx_reg_mask_write(dev, | 1304 | status = cx231xx_reg_mask_write(dev, |
1269 | HAMMERHEAD_I2C_ADDRESS, 32, | 1305 | HAMMERHEAD_I2C_ADDRESS, 32, |
1270 | AUD_IO_CTRL, 0, 31, 0x00000003); /* 0x124, AUD_CHAN1_SRC = 0x3 */ | 1306 | AUD_IO_CTRL, 0, 31, 0x00000003); |
1271 | break; | 1307 | break; |
1272 | 1308 | ||
1273 | case V4L2_STD_PAL_B: | 1309 | case V4L2_STD_PAL_B: |
1274 | case V4L2_STD_PAL_G: | 1310 | case V4L2_STD_PAL_G: |
1275 | /* C2HH setup */ | 1311 | /* C2HH setup */ |
1312 | /* lo if big signal */ | ||
1276 | status = cx231xx_reg_mask_write(dev, | 1313 | status = cx231xx_reg_mask_write(dev, |
1277 | HAMMERHEAD_I2C_ADDRESS, 32, | 1314 | HAMMERHEAD_I2C_ADDRESS, 32, |
1278 | AFE_CTRL_C2HH_SRC_CTRL, 30, 31, 0x1); /* lo if big signal */ | 1315 | AFE_CTRL_C2HH_SRC_CTRL, 30, 31, 0x1); |
1316 | /* FUNC_MODE = DIF */ | ||
1279 | status = cx231xx_reg_mask_write(dev, | 1317 | status = cx231xx_reg_mask_write(dev, |
1280 | HAMMERHEAD_I2C_ADDRESS, 32, | 1318 | HAMMERHEAD_I2C_ADDRESS, 32, |
1281 | AFE_CTRL_C2HH_SRC_CTRL, 23, 24, | 1319 | AFE_CTRL_C2HH_SRC_CTRL, 23, 24, |
1282 | function_mode); /* FUNC_MODE = DIF */ | 1320 | function_mode); |
1321 | /* IF_MODE */ | ||
1283 | status = cx231xx_reg_mask_write(dev, | 1322 | status = cx231xx_reg_mask_write(dev, |
1284 | HAMMERHEAD_I2C_ADDRESS, 32, | 1323 | HAMMERHEAD_I2C_ADDRESS, 32, |
1285 | AFE_CTRL_C2HH_SRC_CTRL, 15, 22, 0xE); /* IF_MODE */ | 1324 | AFE_CTRL_C2HH_SRC_CTRL, 15, 22, 0xE); |
1325 | /* no inv */ | ||
1286 | status = cx231xx_reg_mask_write(dev, | 1326 | status = cx231xx_reg_mask_write(dev, |
1287 | HAMMERHEAD_I2C_ADDRESS, 32, | 1327 | HAMMERHEAD_I2C_ADDRESS, 32, |
1288 | AFE_CTRL_C2HH_SRC_CTRL, 9, 9, 0x1); /* no inv */ | 1328 | AFE_CTRL_C2HH_SRC_CTRL, 9, 9, 0x1); |
1289 | break; | 1329 | break; |
1290 | 1330 | ||
1291 | case V4L2_STD_PAL_D: | 1331 | case V4L2_STD_PAL_D: |
@@ -1298,19 +1338,23 @@ int cx231xx_dif_configure_C2HH_for_low_IF(struct cx231xx *dev, u32 mode, | |||
1298 | case V4L2_STD_SECAM_K: | 1338 | case V4L2_STD_SECAM_K: |
1299 | case V4L2_STD_SECAM_K1: | 1339 | case V4L2_STD_SECAM_K1: |
1300 | /* C2HH setup */ | 1340 | /* C2HH setup */ |
1341 | /* lo if big signal */ | ||
1301 | status = cx231xx_reg_mask_write(dev, | 1342 | status = cx231xx_reg_mask_write(dev, |
1302 | HAMMERHEAD_I2C_ADDRESS, 32, | 1343 | HAMMERHEAD_I2C_ADDRESS, 32, |
1303 | AFE_CTRL_C2HH_SRC_CTRL, 30, 31, 0x1); /* lo if big signal */ | 1344 | AFE_CTRL_C2HH_SRC_CTRL, 30, 31, 0x1); |
1345 | /* FUNC_MODE = DIF */ | ||
1304 | status = cx231xx_reg_mask_write(dev, | 1346 | status = cx231xx_reg_mask_write(dev, |
1305 | HAMMERHEAD_I2C_ADDRESS, 32, | 1347 | HAMMERHEAD_I2C_ADDRESS, 32, |
1306 | AFE_CTRL_C2HH_SRC_CTRL, 23, 24, | 1348 | AFE_CTRL_C2HH_SRC_CTRL, 23, 24, |
1307 | function_mode); /* FUNC_MODE = DIF */ | 1349 | function_mode); |
1350 | /* IF_MODE */ | ||
1308 | status = cx231xx_reg_mask_write(dev, | 1351 | status = cx231xx_reg_mask_write(dev, |
1309 | HAMMERHEAD_I2C_ADDRESS, 32, | 1352 | HAMMERHEAD_I2C_ADDRESS, 32, |
1310 | AFE_CTRL_C2HH_SRC_CTRL, 15, 22, 0xF); /* IF_MODE */ | 1353 | AFE_CTRL_C2HH_SRC_CTRL, 15, 22, 0xF); |
1354 | /* no inv */ | ||
1311 | status = cx231xx_reg_mask_write(dev, | 1355 | status = cx231xx_reg_mask_write(dev, |
1312 | HAMMERHEAD_I2C_ADDRESS, 32, | 1356 | HAMMERHEAD_I2C_ADDRESS, 32, |
1313 | AFE_CTRL_C2HH_SRC_CTRL, 9, 9, 0x1); /* no inv */ | 1357 | AFE_CTRL_C2HH_SRC_CTRL, 9, 9, 0x1); |
1314 | break; | 1358 | break; |
1315 | 1359 | ||
1316 | case DIF_USE_BASEBAND: | 1360 | case DIF_USE_BASEBAND: |
@@ -1919,7 +1963,8 @@ int cx231xx_set_power_mode(struct cx231xx *dev, AV_MODE mode) | |||
1919 | status = cx231xx_write_ctrl_reg(dev, VRT_SET_REGISTER, | 1963 | status = cx231xx_write_ctrl_reg(dev, VRT_SET_REGISTER, |
1920 | PWR_CTL_EN, value, 4); | 1964 | PWR_CTL_EN, value, 4); |
1921 | 1965 | ||
1922 | dev->xc_fw_load_done = 0; /* reset state of xceive tuner */ | 1966 | /* reset state of xceive tuner */ |
1967 | dev->xc_fw_load_done = 0; | ||
1923 | break; | 1968 | break; |
1924 | 1969 | ||
1925 | case POLARIS_AVMODE_ANALOGT_TV: | 1970 | case POLARIS_AVMODE_ANALOGT_TV: |
@@ -2076,7 +2121,8 @@ int cx231xx_set_power_mode(struct cx231xx *dev, AV_MODE mode) | |||
2076 | 2121 | ||
2077 | status = cx231xx_read_ctrl_reg(dev, VRT_GET_REGISTER, PWR_CTL_EN, value, | 2122 | status = cx231xx_read_ctrl_reg(dev, VRT_GET_REGISTER, PWR_CTL_EN, value, |
2078 | 4); | 2123 | 4); |
2079 | cx231xx_info(" The data of PWR_CTL_EN register 0x74=0x%0x,0x%0x,0x%0x,0x%0x\n", | 2124 | cx231xx_info(" The data of PWR_CTL_EN register 0x74" |
2125 | "=0x%0x,0x%0x,0x%0x,0x%0x\n", | ||
2080 | value[0], value[1], value[2], value[3]); | 2126 | value[0], value[1], value[2], value[3]); |
2081 | 2127 | ||
2082 | return status; | 2128 | return status; |
@@ -2210,10 +2256,10 @@ int cx231xx_capture_start(struct cx231xx *dev, int start, u8 media_type) | |||
2210 | { | 2256 | { |
2211 | int rc; | 2257 | int rc; |
2212 | u32 ep_mask = -1; | 2258 | u32 ep_mask = -1; |
2213 | PPCB_CONFIG pcb_config; | 2259 | struct pcb_config *pcb_config; |
2214 | 2260 | ||
2215 | /* get EP for media type */ | 2261 | /* get EP for media type */ |
2216 | pcb_config = &dev->current_pcb_config; | 2262 | pcb_config = (struct pcb_config *)&dev->current_pcb_config; |
2217 | 2263 | ||
2218 | if (pcb_config->config_num == 1) { | 2264 | if (pcb_config->config_num == 1) { |
2219 | switch (media_type) { | 2265 | switch (media_type) { |
@@ -2278,6 +2324,10 @@ int cx231xx_capture_start(struct cx231xx *dev, int start, u8 media_type) | |||
2278 | rc = cx231xx_stop_stream(dev, ep_mask); | 2324 | rc = cx231xx_stop_stream(dev, ep_mask); |
2279 | } | 2325 | } |
2280 | 2326 | ||
2327 | if (dev->mode == CX231XX_ANALOG_MODE) | ||
2328 | ;/* do any in Analog mode */ | ||
2329 | else | ||
2330 | ;/* do any in digital mode */ | ||
2281 | 2331 | ||
2282 | return rc; | 2332 | return rc; |
2283 | } | 2333 | } |
@@ -2564,10 +2614,12 @@ int cx231xx_gpio_i2c_read_ack(struct cx231xx *dev) | |||
2564 | status = cx231xx_get_gpio_bit(dev, dev->gpio_dir, | 2614 | status = cx231xx_get_gpio_bit(dev, dev->gpio_dir, |
2565 | (u8 *)&dev->gpio_val); | 2615 | (u8 *)&dev->gpio_val); |
2566 | nCnt--; | 2616 | nCnt--; |
2567 | } while (((dev->gpio_val & (1 << dev->board.tuner_scl_gpio)) == 0) && (nCnt > 0)); | 2617 | } while (((dev->gpio_val & |
2618 | (1 << dev->board.tuner_scl_gpio)) == 0) && | ||
2619 | (nCnt > 0)); | ||
2568 | 2620 | ||
2569 | if (nCnt == 0) | 2621 | if (nCnt == 0) |
2570 | cx231xx_info("No ACK after %d msec for clock stretch. GPIO I2C operation failed!", | 2622 | cx231xx_info("No ACK after %d msec -GPIO I2C failed!", |
2571 | nInit * 10); | 2623 | nInit * 10); |
2572 | 2624 | ||
2573 | /* readAck | 2625 | /* readAck |
diff --git a/drivers/media/video/cx231xx/cx231xx-cards.c b/drivers/media/video/cx231xx/cx231xx-cards.c index 27cf51b78d6d..f18d0c11de7d 100644 --- a/drivers/media/video/cx231xx/cx231xx-cards.c +++ b/drivers/media/video/cx231xx/cx231xx-cards.c | |||
@@ -1,8 +1,9 @@ | |||
1 | /* | 1 | /* |
2 | cx231xx-cards.c - driver for Conexant Cx23100/101/102 USB video capture devices | 2 | cx231xx-cards.c - driver for Conexant Cx23100/101/102 |
3 | USB video capture devices | ||
3 | 4 | ||
4 | Copyright (C) 2008 <srinivasa.deevi at conexant dot com> | 5 | Copyright (C) 2008 <srinivasa.deevi at conexant dot com> |
5 | Based on em28xx driver | 6 | Based on em28xx driver |
6 | 7 | ||
7 | This program is free software; you can redistribute it and/or modify | 8 | This program is free software; you can redistribute it and/or modify |
8 | it under the terms of the GNU General Public License as published by | 9 | it under the terms of the GNU General Public License as published by |
@@ -85,7 +86,7 @@ struct cx231xx_board cx231xx_boards[] = { | |||
85 | .amux = | 86 | .amux = |
86 | CX231XX_AMUX_LINE_IN, | 87 | CX231XX_AMUX_LINE_IN, |
87 | .gpio = 0, | 88 | .gpio = 0, |
88 | }}, | 89 | } }, |
89 | }, | 90 | }, |
90 | 91 | ||
91 | [CX231XX_BOARD_CNXT_RDE_250] = { | 92 | [CX231XX_BOARD_CNXT_RDE_250] = { |
@@ -132,7 +133,7 @@ struct cx231xx_board cx231xx_boards[] = { | |||
132 | .amux = | 133 | .amux = |
133 | CX231XX_AMUX_LINE_IN, | 134 | CX231XX_AMUX_LINE_IN, |
134 | .gpio = 0, | 135 | .gpio = 0, |
135 | }}, | 136 | } }, |
136 | }, | 137 | }, |
137 | 138 | ||
138 | [CX231XX_BOARD_CNXT_RDU_250] = { | 139 | [CX231XX_BOARD_CNXT_RDU_250] = { |
@@ -179,7 +180,7 @@ struct cx231xx_board cx231xx_boards[] = { | |||
179 | .amux = | 180 | .amux = |
180 | CX231XX_AMUX_LINE_IN, | 181 | CX231XX_AMUX_LINE_IN, |
181 | .gpio = 0, | 182 | .gpio = 0, |
182 | }}, | 183 | } }, |
183 | }, | 184 | }, |
184 | }; | 185 | }; |
185 | const unsigned int cx231xx_bcount = ARRAY_SIZE(cx231xx_boards); | 186 | 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) | |||
209 | if (dev->tuner_type == TUNER_XC5000) { | 210 | if (dev->tuner_type == TUNER_XC5000) { |
210 | if (command == XC5000_TUNER_RESET) { | 211 | if (command == XC5000_TUNER_RESET) { |
211 | cx231xx_info | 212 | cx231xx_info |
212 | ("Tuner Call back : RESET : command %d : tuner type %d \n", | 213 | ("Tuner CB: RESET: cmd %d : tuner type %d \n", |
213 | command, dev->tuner_type); | 214 | command, dev->tuner_type); |
214 | |||
215 | cx231xx_set_gpio_value(dev, dev->board.tuner_gpio->bit, | 215 | cx231xx_set_gpio_value(dev, dev->board.tuner_gpio->bit, |
216 | 1); | 216 | 1); |
217 | msleep(10); | 217 | msleep(10); |
@@ -225,10 +225,9 @@ int cx231xx_tuner_callback(void *ptr, int component, int command, int arg) | |||
225 | } | 225 | } |
226 | return rc; | 226 | return rc; |
227 | } | 227 | } |
228 | |||
229 | EXPORT_SYMBOL_GPL(cx231xx_tuner_callback); | 228 | EXPORT_SYMBOL_GPL(cx231xx_tuner_callback); |
230 | 229 | ||
231 | static void inline cx231xx_set_model(struct cx231xx *dev) | 230 | static inline void cx231xx_set_model(struct cx231xx *dev) |
232 | { | 231 | { |
233 | memcpy(&dev->board, &cx231xx_boards[dev->model], sizeof(dev->board)); | 232 | memcpy(&dev->board, &cx231xx_boards[dev->model], sizeof(dev->board)); |
234 | } | 233 | } |
@@ -542,7 +541,7 @@ static int cx231xx_init_dev(struct cx231xx **devhandle, struct usb_device *udev, | |||
542 | 541 | ||
543 | return 0; | 542 | return 0; |
544 | 543 | ||
545 | fail_reg_devices: | 544 | fail_reg_devices: |
546 | mutex_unlock(&dev->lock); | 545 | mutex_unlock(&dev->lock); |
547 | return retval; | 546 | return retval; |
548 | } | 547 | } |
@@ -628,12 +627,13 @@ static int cx231xx_usb_probe(struct usb_interface *interface, | |||
628 | dev->has_alsa_audio = 1; | 627 | dev->has_alsa_audio = 1; |
629 | dev->power_mode = -1; | 628 | dev->power_mode = -1; |
630 | 629 | ||
631 | dev->vbi_or_sliced_cc_mode = 0; /* 0 - vbi ; 1 -sliced cc mode */ | 630 | /* 0 - vbi ; 1 -sliced cc mode */ |
631 | dev->vbi_or_sliced_cc_mode = 0; | ||
632 | 632 | ||
633 | /* get maximum no.of IAD interfaces */ | 633 | /* get maximum no.of IAD interfaces */ |
634 | assoc_desc = udev->actconfig->intf_assoc[0]; | 634 | assoc_desc = udev->actconfig->intf_assoc[0]; |
635 | dev->max_iad_interface_count = assoc_desc->bInterfaceCount; | 635 | dev->max_iad_interface_count = assoc_desc->bInterfaceCount; |
636 | cx231xx_info(": Found IAD interface count %d\n", | 636 | cx231xx_info("Found IAD interface count %d\n", |
637 | dev->max_iad_interface_count); | 637 | dev->max_iad_interface_count); |
638 | 638 | ||
639 | /* init CIR module TBD */ | 639 | /* init CIR module TBD */ |
@@ -662,10 +662,9 @@ static int cx231xx_usb_probe(struct usb_interface *interface, | |||
662 | assoc_desc = udev->actconfig->intf_assoc[0]; | 662 | assoc_desc = udev->actconfig->intf_assoc[0]; |
663 | if (assoc_desc->bFirstInterface == ifnum) { | 663 | if (assoc_desc->bFirstInterface == ifnum) { |
664 | cx231xx_info | 664 | cx231xx_info |
665 | (": Found IAD interface match: AV Descriptor Start!! \n"); | 665 | ("Found IAD interface match: AV Desc Start!! \n"); |
666 | } else { | 666 | } else { |
667 | cx231xx_err(DRIVER_NAME | 667 | cx231xx_err(" Not found matching interface\n"); |
668 | " Not found matching interface\n"); | ||
669 | return -ENODEV; | 668 | return -ENODEV; |
670 | } | 669 | } |
671 | 670 | ||
@@ -691,7 +690,7 @@ static int cx231xx_usb_probe(struct usb_interface *interface, | |||
691 | skip_interface = 1; /* set skipping */ | 690 | skip_interface = 1; /* set skipping */ |
692 | else { | 691 | else { |
693 | cx231xx_info | 692 | cx231xx_info |
694 | (": Found IAD interface number match with AV Device number!! \n"); | 693 | ("Found IAD interface no. match with AV Device no.!\n"); |
695 | } | 694 | } |
696 | } | 695 | } |
697 | 696 | ||
diff --git a/drivers/media/video/cx231xx/cx231xx-core.c b/drivers/media/video/cx231xx/cx231xx-core.c index 874fc5b39863..2dda863dd3c4 100644 --- a/drivers/media/video/cx231xx/cx231xx-core.c +++ b/drivers/media/video/cx231xx/cx231xx-core.c | |||
@@ -1,8 +1,9 @@ | |||
1 | /* | 1 | /* |
2 | cx231xx-core.c - driver for Conexant Cx23100/101/102 USB video capture devices | 2 | cx231xx-core.c - driver for Conexant Cx23100/101/102 |
3 | USB video capture devices | ||
3 | 4 | ||
4 | Copyright (C) 2008 <srinivasa.deevi at conexant dot com> | 5 | Copyright (C) 2008 <srinivasa.deevi at conexant dot com> |
5 | Based on em28xx driver | 6 | Based on em28xx driver |
6 | 7 | ||
7 | This program is free software; you can redistribute it and/or modify | 8 | This program is free software; you can redistribute it and/or modify |
8 | it under the terms of the GNU General Public License as published by | 9 | 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"); | |||
59 | printk(KERN_INFO "%s %s :"fmt, \ | 60 | printk(KERN_INFO "%s %s :"fmt, \ |
60 | dev->name, __func__ , ##arg); } while (0) | 61 | dev->name, __func__ , ##arg); } while (0) |
61 | 62 | ||
62 | /************************************************************************************ | 63 | /***************************************************************** |
63 | * Device control list functions * | 64 | * Device control list functions * |
64 | *************************************************************************************/ | 65 | ******************************************************************/ |
65 | 66 | ||
66 | static LIST_HEAD(cx231xx_devlist); | 67 | static LIST_HEAD(cx231xx_devlist); |
67 | static DEFINE_MUTEX(cx231xx_devlist_mutex); | 68 | static DEFINE_MUTEX(cx231xx_devlist_mutex); |
@@ -130,7 +131,6 @@ int cx231xx_register_extension(struct cx231xx_ops *ops) | |||
130 | mutex_unlock(&cx231xx_devlist_mutex); | 131 | mutex_unlock(&cx231xx_devlist_mutex); |
131 | return 0; | 132 | return 0; |
132 | } | 133 | } |
133 | |||
134 | EXPORT_SYMBOL(cx231xx_register_extension); | 134 | EXPORT_SYMBOL(cx231xx_register_extension); |
135 | 135 | ||
136 | void cx231xx_unregister_extension(struct cx231xx_ops *ops) | 136 | void cx231xx_unregister_extension(struct cx231xx_ops *ops) |
@@ -149,7 +149,6 @@ void cx231xx_unregister_extension(struct cx231xx_ops *ops) | |||
149 | mutex_unlock(&cx231xx_extension_devlist_lock); | 149 | mutex_unlock(&cx231xx_extension_devlist_lock); |
150 | mutex_unlock(&cx231xx_devlist_mutex); | 150 | mutex_unlock(&cx231xx_devlist_mutex); |
151 | } | 151 | } |
152 | |||
153 | EXPORT_SYMBOL(cx231xx_unregister_extension); | 152 | EXPORT_SYMBOL(cx231xx_unregister_extension); |
154 | 153 | ||
155 | void cx231xx_init_extension(struct cx231xx *dev) | 154 | void cx231xx_init_extension(struct cx231xx *dev) |
@@ -180,15 +179,15 @@ void cx231xx_close_extension(struct cx231xx *dev) | |||
180 | mutex_unlock(&cx231xx_extension_devlist_lock); | 179 | mutex_unlock(&cx231xx_extension_devlist_lock); |
181 | } | 180 | } |
182 | 181 | ||
183 | /************************************************************************************ | 182 | /**************************************************************** |
184 | * U S B related functions * | 183 | * U S B related functions * |
185 | *************************************************************************************/ | 184 | *****************************************************************/ |
186 | int cx231xx_send_usb_command(struct cx231xx_i2c *i2c_bus, | 185 | int cx231xx_send_usb_command(struct cx231xx_i2c *i2c_bus, |
187 | struct cx231xx_i2c_xfer_data *req_data) | 186 | struct cx231xx_i2c_xfer_data *req_data) |
188 | { | 187 | { |
189 | int status = 0; | 188 | int status = 0; |
190 | struct cx231xx *dev = i2c_bus->dev; | 189 | struct cx231xx *dev = i2c_bus->dev; |
191 | VENDOR_REQUEST_IN ven_req; | 190 | struct VENDOR_REQUEST_IN ven_req; |
192 | 191 | ||
193 | u8 saddr_len = 0; | 192 | u8 saddr_len = 0; |
194 | u8 _i2c_period = 0; | 193 | u8 _i2c_period = 0; |
@@ -215,10 +214,10 @@ int cx231xx_send_usb_command(struct cx231xx_i2c *i2c_bus, | |||
215 | _i2c_nostop << 1 | I2C_SYNC | _i2c_reserve << 6; | 214 | _i2c_nostop << 1 | I2C_SYNC | _i2c_reserve << 6; |
216 | 215 | ||
217 | /* set channel number */ | 216 | /* set channel number */ |
218 | if (req_data->direction & I2C_M_RD) | 217 | if (req_data->direction & I2C_M_RD) { |
219 | ven_req.bRequest = i2c_bus->nr + 4; /* channel number, for read, | 218 | /* channel number, for read,spec required channel_num +4 */ |
220 | spec required channel_num +4 */ | 219 | ven_req.bRequest = i2c_bus->nr + 4; |
221 | else | 220 | } else |
222 | ven_req.bRequest = i2c_bus->nr; /* channel number, */ | 221 | ven_req.bRequest = i2c_bus->nr; /* channel number, */ |
223 | 222 | ||
224 | /* set index value */ | 223 | /* set index value */ |
@@ -255,14 +254,14 @@ int cx231xx_send_usb_command(struct cx231xx_i2c *i2c_bus, | |||
255 | status = cx231xx_send_vendor_cmd(dev, &ven_req); | 254 | status = cx231xx_send_vendor_cmd(dev, &ven_req); |
256 | if (status < 0) { | 255 | if (status < 0) { |
257 | cx231xx_info | 256 | cx231xx_info |
258 | ("UsbInterface::sendCommand, output buffer failed with status -%d\n", | 257 | ("UsbInterface::sendCommand, failed with status -%d\n", |
259 | status); | 258 | status); |
260 | } | 259 | } |
261 | 260 | ||
262 | return status; | 261 | return status; |
263 | } | 262 | } |
264 | |||
265 | EXPORT_SYMBOL_GPL(cx231xx_send_usb_command); | 263 | EXPORT_SYMBOL_GPL(cx231xx_send_usb_command); |
264 | |||
266 | /* | 265 | /* |
267 | * cx231xx_read_ctrl_reg() | 266 | * cx231xx_read_ctrl_reg() |
268 | * reads data from the usb device specifying bRequest and wValue | 267 | * 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, | |||
336 | return ret; | 335 | return ret; |
337 | } | 336 | } |
338 | 337 | ||
339 | int cx231xx_send_vendor_cmd(struct cx231xx *dev, VENDOR_REQUEST_IN * ven_req) | 338 | int cx231xx_send_vendor_cmd(struct cx231xx *dev, |
339 | struct VENDOR_REQUEST_IN *ven_req) | ||
340 | { | 340 | { |
341 | int ret; | 341 | int ret; |
342 | int pipe = 0; | 342 | int pipe = 0; |
@@ -421,11 +421,11 @@ int cx231xx_write_ctrl_reg(struct cx231xx *dev, u8 req, u16 reg, char *buf, | |||
421 | int byte; | 421 | int byte; |
422 | 422 | ||
423 | cx231xx_isocdbg("(pipe 0x%08x): " | 423 | cx231xx_isocdbg("(pipe 0x%08x): " |
424 | "OUT: %02x %02x %02x %02x %02x %02x %02x %02x >>>", | 424 | "OUT: %02x %02x %02x %02x %02x %02x %02x %02x >>>", |
425 | pipe, | 425 | pipe, |
426 | USB_DIR_OUT | USB_TYPE_VENDOR | | 426 | USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE, |
427 | USB_RECIP_DEVICE, req, 0, val, reg & 0xff, | 427 | req, 0, val, reg & 0xff, |
428 | reg >> 8, len & 0xff, len >> 8); | 428 | reg >> 8, len & 0xff, len >> 8); |
429 | 429 | ||
430 | for (byte = 0; byte < len; byte++) | 430 | for (byte = 0; byte < len; byte++) |
431 | cx231xx_isocdbg(" %02x", (unsigned char)buf[byte]); | 431 | 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, | |||
442 | return ret; | 442 | return ret; |
443 | } | 443 | } |
444 | 444 | ||
445 | /************************************************************************************ | 445 | /**************************************************************** |
446 | * USB Alternate Setting functions * | 446 | * USB Alternate Setting functions * |
447 | *************************************************************************************/ | 447 | *****************************************************************/ |
448 | 448 | ||
449 | int cx231xx_set_video_alternate(struct cx231xx *dev) | 449 | int cx231xx_set_video_alternate(struct cx231xx *dev) |
450 | { | 450 | { |
@@ -487,7 +487,7 @@ int cx231xx_set_video_alternate(struct cx231xx *dev) | |||
487 | dev->video_mode.alt, | 487 | dev->video_mode.alt, |
488 | dev->video_mode.max_pkt_size); | 488 | dev->video_mode.max_pkt_size); |
489 | cx231xx_info | 489 | cx231xx_info |
490 | (" setting alternate %d with wMaxPacketSize=%u , Interface = %d\n", | 490 | (" setting alt %d with wMaxPktSize=%u , Interface = %d\n", |
491 | dev->video_mode.alt, dev->video_mode.max_pkt_size, | 491 | dev->video_mode.alt, dev->video_mode.max_pkt_size, |
492 | usb_interface_index); | 492 | usb_interface_index); |
493 | errCode = | 493 | errCode = |
@@ -495,7 +495,7 @@ int cx231xx_set_video_alternate(struct cx231xx *dev) | |||
495 | dev->video_mode.alt); | 495 | dev->video_mode.alt); |
496 | if (errCode < 0) { | 496 | if (errCode < 0) { |
497 | cx231xx_errdev | 497 | cx231xx_errdev |
498 | ("cannot change alternate number to %d (error=%i)\n", | 498 | ("cannot change alt number to %d (error=%i)\n", |
499 | dev->video_mode.alt, errCode); | 499 | dev->video_mode.alt, errCode); |
500 | return errCode; | 500 | return errCode; |
501 | } | 501 | } |
@@ -569,8 +569,8 @@ int cx231xx_set_alt_setting(struct cx231xx *dev, u8 index, u8 alt) | |||
569 | 569 | ||
570 | if (alt > 0 && max_pkt_size == 0) { | 570 | if (alt > 0 && max_pkt_size == 0) { |
571 | cx231xx_errdev | 571 | cx231xx_errdev |
572 | ("cannot change interface %d alternate number to %d : Max. Pkt size is ZERO\n", | 572 | ("can't change interface %d alt no. to %d: Max. Pkt size = 0\n", |
573 | usb_interface_index, alt); | 573 | usb_interface_index, alt); |
574 | return -1; | 574 | return -1; |
575 | } | 575 | } |
576 | 576 | ||
@@ -582,15 +582,14 @@ int cx231xx_set_alt_setting(struct cx231xx *dev, u8 index, u8 alt) | |||
582 | status = usb_set_interface(dev->udev, usb_interface_index, alt); | 582 | status = usb_set_interface(dev->udev, usb_interface_index, alt); |
583 | if (status < 0) { | 583 | if (status < 0) { |
584 | cx231xx_errdev | 584 | cx231xx_errdev |
585 | ("cannot change interface %d alternate number to %d (error=%i)\n", | 585 | ("can't change interface %d alt no. to %d (err=%i)\n", |
586 | usb_interface_index, alt, status); | 586 | usb_interface_index, alt, status); |
587 | return status; | 587 | return status; |
588 | } | 588 | } |
589 | } | 589 | } |
590 | 590 | ||
591 | return status; | 591 | return status; |
592 | } | 592 | } |
593 | |||
594 | EXPORT_SYMBOL_GPL(cx231xx_set_alt_setting); | 593 | EXPORT_SYMBOL_GPL(cx231xx_set_alt_setting); |
595 | 594 | ||
596 | int cx231xx_gpio_set(struct cx231xx *dev, struct cx231xx_reg_seq *gpio) | 595 | 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) | |||
630 | 629 | ||
631 | dev->mode = set_mode; | 630 | dev->mode = set_mode; |
632 | 631 | ||
633 | if (dev->mode == CX231XX_DIGITAL_MODE) { | 632 | if (dev->mode == CX231XX_DIGITAL_MODE) |
634 | /* Set Digital power mode */ | 633 | ;/* Set Digital power mode */ |
635 | } else { | 634 | else |
636 | /* Set Analog Power mode */ | 635 | ;/* Set Analog Power mode */ |
637 | } | 636 | |
638 | return 0; | 637 | return 0; |
639 | } | 638 | } |
640 | |||
641 | EXPORT_SYMBOL_GPL(cx231xx_set_mode); | 639 | EXPORT_SYMBOL_GPL(cx231xx_set_mode); |
642 | 640 | ||
643 | /************************************************************************************ | 641 | /***************************************************************** |
644 | * URB Streaming functions * | 642 | * URB Streaming functions * |
645 | *************************************************************************************/ | 643 | ******************************************************************/ |
646 | 644 | ||
647 | /* | 645 | /* |
648 | * IRQ callback, called by URB callback | 646 | * IRQ callback, called by URB callback |
@@ -728,7 +726,6 @@ void cx231xx_uninit_isoc(struct cx231xx *dev) | |||
728 | 726 | ||
729 | cx231xx_capture_start(dev, 0, Raw_Video); | 727 | cx231xx_capture_start(dev, 0, Raw_Video); |
730 | } | 728 | } |
731 | |||
732 | EXPORT_SYMBOL_GPL(cx231xx_uninit_isoc); | 729 | EXPORT_SYMBOL_GPL(cx231xx_uninit_isoc); |
733 | 730 | ||
734 | /* | 731 | /* |
@@ -736,7 +733,7 @@ EXPORT_SYMBOL_GPL(cx231xx_uninit_isoc); | |||
736 | */ | 733 | */ |
737 | int cx231xx_init_isoc(struct cx231xx *dev, int max_packets, | 734 | int cx231xx_init_isoc(struct cx231xx *dev, int max_packets, |
738 | int num_bufs, int max_pkt_size, | 735 | int num_bufs, int max_pkt_size, |
739 | int (*isoc_copy) (struct cx231xx * dev, struct urb * urb)) | 736 | int (*isoc_copy) (struct cx231xx *dev, struct urb *urb)) |
740 | { | 737 | { |
741 | struct cx231xx_dmaqueue *dma_q = &dev->video_mode.vidq; | 738 | struct cx231xx_dmaqueue *dma_q = &dev->video_mode.vidq; |
742 | int i; | 739 | int i; |
@@ -805,7 +802,7 @@ int cx231xx_init_isoc(struct cx231xx *dev, int max_packets, | |||
805 | cx231xx_err("unable to allocate %i bytes for transfer" | 802 | cx231xx_err("unable to allocate %i bytes for transfer" |
806 | " buffer %i%s\n", | 803 | " buffer %i%s\n", |
807 | sb_size, i, | 804 | sb_size, i, |
808 | in_interrupt()? " while in int" : ""); | 805 | in_interrupt() ? " while in int" : ""); |
809 | cx231xx_uninit_isoc(dev); | 806 | cx231xx_uninit_isoc(dev); |
810 | return -ENOMEM; | 807 | return -ENOMEM; |
811 | } | 808 | } |
@@ -848,12 +845,11 @@ int cx231xx_init_isoc(struct cx231xx *dev, int max_packets, | |||
848 | 845 | ||
849 | return 0; | 846 | return 0; |
850 | } | 847 | } |
851 | |||
852 | EXPORT_SYMBOL_GPL(cx231xx_init_isoc); | 848 | EXPORT_SYMBOL_GPL(cx231xx_init_isoc); |
853 | 849 | ||
854 | /************************************************************************************ | 850 | /***************************************************************** |
855 | * Device Init/UnInit functions * | 851 | * Device Init/UnInit functions * |
856 | *************************************************************************************/ | 852 | ******************************************************************/ |
857 | int cx231xx_dev_init(struct cx231xx *dev) | 853 | int cx231xx_dev_init(struct cx231xx *dev) |
858 | { | 854 | { |
859 | int errCode = 0; | 855 | int errCode = 0; |
@@ -887,11 +883,12 @@ int cx231xx_dev_init(struct cx231xx *dev) | |||
887 | cx231xx_i2c_register(&dev->i2c_bus[2]); | 883 | cx231xx_i2c_register(&dev->i2c_bus[2]); |
888 | 884 | ||
889 | /* init hardware */ | 885 | /* init hardware */ |
890 | /* Note : with out calling set power mode function, colibri can not be set up correctly */ | 886 | /* Note : with out calling set power mode function, |
887 | colibri can not be set up correctly */ | ||
891 | errCode = cx231xx_set_power_mode(dev, POLARIS_AVMODE_ANALOGT_TV); | 888 | errCode = cx231xx_set_power_mode(dev, POLARIS_AVMODE_ANALOGT_TV); |
892 | if (errCode < 0) { | 889 | if (errCode < 0) { |
893 | cx231xx_errdev | 890 | cx231xx_errdev |
894 | ("%s: cx231xx_set_power_mode : Failed to set Power - errCode [%d]!\n", | 891 | ("%s: Failed to set Power - errCode [%d]!\n", |
895 | __func__, errCode); | 892 | __func__, errCode); |
896 | return errCode; | 893 | return errCode; |
897 | } | 894 | } |
@@ -959,7 +956,6 @@ int cx231xx_dev_init(struct cx231xx *dev) | |||
959 | 956 | ||
960 | return errCode; | 957 | return errCode; |
961 | } | 958 | } |
962 | |||
963 | EXPORT_SYMBOL_GPL(cx231xx_dev_init); | 959 | EXPORT_SYMBOL_GPL(cx231xx_dev_init); |
964 | 960 | ||
965 | void cx231xx_dev_uninit(struct cx231xx *dev) | 961 | void cx231xx_dev_uninit(struct cx231xx *dev) |
@@ -969,17 +965,16 @@ void cx231xx_dev_uninit(struct cx231xx *dev) | |||
969 | cx231xx_i2c_unregister(&dev->i2c_bus[1]); | 965 | cx231xx_i2c_unregister(&dev->i2c_bus[1]); |
970 | cx231xx_i2c_unregister(&dev->i2c_bus[0]); | 966 | cx231xx_i2c_unregister(&dev->i2c_bus[0]); |
971 | } | 967 | } |
972 | |||
973 | EXPORT_SYMBOL_GPL(cx231xx_dev_uninit); | 968 | EXPORT_SYMBOL_GPL(cx231xx_dev_uninit); |
974 | 969 | ||
975 | /************************************************************************************ | 970 | /***************************************************************** |
976 | * G P I O related functions * | 971 | * G P I O related functions * |
977 | *************************************************************************************/ | 972 | ******************************************************************/ |
978 | int cx231xx_send_gpio_cmd(struct cx231xx *dev, u32 gpio_bit, u8 * gpio_val, | 973 | int cx231xx_send_gpio_cmd(struct cx231xx *dev, u32 gpio_bit, u8 * gpio_val, |
979 | u8 len, u8 request, u8 direction) | 974 | u8 len, u8 request, u8 direction) |
980 | { | 975 | { |
981 | int status = 0; | 976 | int status = 0; |
982 | VENDOR_REQUEST_IN ven_req; | 977 | struct VENDOR_REQUEST_IN ven_req; |
983 | 978 | ||
984 | /* Set wValue */ | 979 | /* Set wValue */ |
985 | ven_req.wValue = (u16) (gpio_bit >> 16 & 0xffff); | 980 | 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, | |||
1021 | status = cx231xx_send_vendor_cmd(dev, &ven_req); | 1016 | status = cx231xx_send_vendor_cmd(dev, &ven_req); |
1022 | if (status < 0) { | 1017 | if (status < 0) { |
1023 | cx231xx_info | 1018 | cx231xx_info |
1024 | ("UsbInterface::sendCommand, output buffer failed with status -%d\n", | 1019 | ("UsbInterface::sendCommand, failed with status -%d\n", |
1025 | status); | 1020 | status); |
1026 | } | 1021 | } |
1027 | 1022 | ||
1028 | return status; | 1023 | return status; |
1029 | } | 1024 | } |
1030 | |||
1031 | EXPORT_SYMBOL_GPL(cx231xx_send_gpio_cmd); | 1025 | EXPORT_SYMBOL_GPL(cx231xx_send_gpio_cmd); |
1032 | 1026 | ||
1033 | /************************************************************************************* | 1027 | /***************************************************************** |
1034 | * C O N T R O L - Register R E A D / W R I T E functions * | 1028 | * C O N T R O L - Register R E A D / W R I T E functions * |
1035 | *************************************************************************************/ | 1029 | *****************************************************************/ |
1036 | int cx231xx_mode_register(struct cx231xx *dev, u16 address, u32 mode) | 1030 | int cx231xx_mode_register(struct cx231xx *dev, u16 address, u32 mode) |
1037 | { | 1031 | { |
1038 | u8 value[4] = { 0x0, 0x0, 0x0, 0x0 }; | 1032 | u8 value[4] = { 0x0, 0x0, 0x0, 0x0 }; |
@@ -1058,11 +1052,11 @@ int cx231xx_mode_register(struct cx231xx *dev, u16 address, u32 mode) | |||
1058 | return status; | 1052 | return status; |
1059 | } | 1053 | } |
1060 | 1054 | ||
1061 | /************************************************************************************* | 1055 | /***************************************************************** |
1062 | * I 2 C Internal C O N T R O L functions * | 1056 | * I 2 C Internal C O N T R O L functions * |
1063 | *************************************************************************************/ | 1057 | *****************************************************************/ |
1064 | int cx231xx_read_i2c_data(struct cx231xx *dev, u8 dev_addr, u16 saddr, | 1058 | int cx231xx_read_i2c_data(struct cx231xx *dev, u8 dev_addr, u16 saddr, |
1065 | u8 saddr_len, u32 * data, u8 data_len) | 1059 | u8 saddr_len, u32 *data, u8 data_len) |
1066 | { | 1060 | { |
1067 | int status = 0; | 1061 | int status = 0; |
1068 | struct cx231xx_i2c_xfer_data req_data; | 1062 | struct cx231xx_i2c_xfer_data req_data; |
@@ -1137,9 +1131,8 @@ int cx231xx_reg_mask_write(struct cx231xx *dev, u8 dev_addr, u8 size, | |||
1137 | u32 mask = 0; | 1131 | u32 mask = 0; |
1138 | int i; | 1132 | int i; |
1139 | 1133 | ||
1140 | if (bit_start > (size - 1) || bit_end > (size - 1)) { | 1134 | if (bit_start > (size - 1) || bit_end > (size - 1)) |
1141 | return -1; | 1135 | return -1; |
1142 | } | ||
1143 | 1136 | ||
1144 | if (size == 8) { | 1137 | if (size == 8) { |
1145 | status = | 1138 | status = |
@@ -1151,14 +1144,12 @@ int cx231xx_reg_mask_write(struct cx231xx *dev, u8 dev_addr, u8 size, | |||
1151 | &tmp, 4); | 1144 | &tmp, 4); |
1152 | } | 1145 | } |
1153 | 1146 | ||
1154 | if (status < 0) { | 1147 | if (status < 0) |
1155 | return status; | 1148 | return status; |
1156 | } | ||
1157 | 1149 | ||
1158 | mask = 1 << bit_end; | 1150 | mask = 1 << bit_end; |
1159 | for (i = bit_end; i > bit_start && i > 0; i--) { | 1151 | for (i = bit_end; i > bit_start && i > 0; i--) |
1160 | mask = mask + (1 << (i - 1)); | 1152 | mask = mask + (1 << (i - 1)); |
1161 | } | ||
1162 | 1153 | ||
1163 | value <<= bit_start; | 1154 | value <<= bit_start; |
1164 | 1155 | ||
@@ -1203,9 +1194,8 @@ u32 cx231xx_set_field(u32 field_mask, u32 data) | |||
1203 | { | 1194 | { |
1204 | u32 temp; | 1195 | u32 temp; |
1205 | 1196 | ||
1206 | for (temp = field_mask; (temp & 1) == 0; temp >>= 1) { | 1197 | for (temp = field_mask; (temp & 1) == 0; temp >>= 1) |
1207 | data <<= 1; | 1198 | data <<= 1; |
1208 | } | ||
1209 | 1199 | ||
1210 | return data; | 1200 | return data; |
1211 | } | 1201 | } |
diff --git a/drivers/media/video/cx231xx/cx231xx-dvb.c b/drivers/media/video/cx231xx/cx231xx-dvb.c index 85bee8c35e0e..c5082a4e8ced 100644 --- a/drivers/media/video/cx231xx/cx231xx-dvb.c +++ b/drivers/media/video/cx231xx/cx231xx-dvb.c | |||
@@ -2,7 +2,7 @@ | |||
2 | DVB device driver for cx231xx | 2 | DVB device driver for cx231xx |
3 | 3 | ||
4 | Copyright (C) 2008 <srinivasa.deevi at conexant dot com> | 4 | Copyright (C) 2008 <srinivasa.deevi at conexant dot com> |
5 | Based on em28xx driver | 5 | Based on em28xx driver |
6 | 6 | ||
7 | This program is free software; you can redistribute it and/or modify | 7 | This program is free software; you can redistribute it and/or modify |
8 | it under the terms of the GNU General Public License as published by | 8 | 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, | |||
395 | dvb_net_init(&dvb->adapter, &dvb->net, &dvb->demux.dmx); | 395 | dvb_net_init(&dvb->adapter, &dvb->net, &dvb->demux.dmx); |
396 | return 0; | 396 | return 0; |
397 | 397 | ||
398 | fail_fe_conn: | 398 | fail_fe_conn: |
399 | dvb->demux.dmx.remove_frontend(&dvb->demux.dmx, &dvb->fe_mem); | 399 | dvb->demux.dmx.remove_frontend(&dvb->demux.dmx, &dvb->fe_mem); |
400 | fail_fe_mem: | 400 | fail_fe_mem: |
401 | dvb->demux.dmx.remove_frontend(&dvb->demux.dmx, &dvb->fe_hw); | 401 | dvb->demux.dmx.remove_frontend(&dvb->demux.dmx, &dvb->fe_hw); |
402 | fail_fe_hw: | 402 | fail_fe_hw: |
403 | dvb_dmxdev_release(&dvb->dmxdev); | 403 | dvb_dmxdev_release(&dvb->dmxdev); |
404 | fail_dmxdev: | 404 | fail_dmxdev: |
405 | dvb_dmx_release(&dvb->demux); | 405 | dvb_dmx_release(&dvb->demux); |
406 | fail_dmx: | 406 | fail_dmx: |
407 | dvb_unregister_frontend(dvb->frontend); | 407 | dvb_unregister_frontend(dvb->frontend); |
408 | fail_frontend: | 408 | fail_frontend: |
409 | dvb_frontend_detach(dvb->frontend); | 409 | dvb_frontend_detach(dvb->frontend); |
410 | dvb_unregister_adapter(&dvb->adapter); | 410 | dvb_unregister_adapter(&dvb->adapter); |
411 | fail_adapter: | 411 | fail_adapter: |
412 | return result; | 412 | return result; |
413 | } | 413 | } |
414 | 414 | ||
@@ -516,7 +516,7 @@ static int dvb_init(struct cx231xx *dev) | |||
516 | printk(KERN_INFO "Successfully loaded cx231xx-dvb\n"); | 516 | printk(KERN_INFO "Successfully loaded cx231xx-dvb\n"); |
517 | return 0; | 517 | return 0; |
518 | 518 | ||
519 | out_free: | 519 | out_free: |
520 | cx231xx_set_mode(dev, CX231XX_SUSPEND); | 520 | cx231xx_set_mode(dev, CX231XX_SUSPEND); |
521 | kfree(dvb); | 521 | kfree(dvb); |
522 | dev->dvb = NULL; | 522 | dev->dvb = NULL; |
diff --git a/drivers/media/video/cx231xx/cx231xx-i2c.c b/drivers/media/video/cx231xx/cx231xx-i2c.c index c250ad27e1d2..1af87579ab49 100644 --- a/drivers/media/video/cx231xx/cx231xx-i2c.c +++ b/drivers/media/video/cx231xx/cx231xx-i2c.c | |||
@@ -2,8 +2,8 @@ | |||
2 | cx231xx-i2c.c - driver for Conexant Cx23100/101/102 USB video capture devices | 2 | cx231xx-i2c.c - driver for Conexant Cx23100/101/102 USB video capture devices |
3 | 3 | ||
4 | Copyright (C) 2008 <srinivasa.deevi at conexant dot com> | 4 | Copyright (C) 2008 <srinivasa.deevi at conexant dot com> |
5 | Based on em28xx driver | 5 | Based on em28xx driver |
6 | Based on Cx23885 driver | 6 | Based on Cx23885 driver |
7 | 7 | ||
8 | This program is free software; you can redistribute it and/or modify | 8 | This program is free software; you can redistribute it and/or modify |
9 | it under the terms of the GNU General Public License as published by | 9 | 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]"); | |||
42 | #define dprintk1(lvl, fmt, args...) \ | 42 | #define dprintk1(lvl, fmt, args...) \ |
43 | do { \ | 43 | do { \ |
44 | if (i2c_debug >= lvl) { \ | 44 | if (i2c_debug >= lvl) { \ |
45 | printk(fmt, ##args); \ | 45 | printk(fmt, ##args); \ |
46 | } \ | 46 | } \ |
47 | } while (0) | 47 | } while (0) |
48 | 48 | ||
49 | #define dprintk2(lvl, fmt, args...) \ | 49 | #define dprintk2(lvl, fmt, args...) \ |
@@ -78,8 +78,8 @@ int cx231xx_i2c_send_bytes(struct i2c_adapter *i2c_adap, | |||
78 | 78 | ||
79 | if (size == 2) { /* register write sub addr */ | 79 | if (size == 2) { /* register write sub addr */ |
80 | 80 | ||
81 | /* Just writing sub address will cause problem to XC5000 | 81 | /* Just writing sub address will cause problem to XC5000 |
82 | So ignore the request */ | 82 | So ignore the request */ |
83 | return 0; | 83 | return 0; |
84 | 84 | ||
85 | } else if (size == 4) { /* register write with sub addr */ | 85 | } else if (size == 4) { /* register write with sub addr */ |
@@ -92,7 +92,8 @@ int cx231xx_i2c_send_bytes(struct i2c_adapter *i2c_adap, | |||
92 | switch (saddr) { | 92 | switch (saddr) { |
93 | case 0x0000: /* start tuner calibration mode */ | 93 | case 0x0000: /* start tuner calibration mode */ |
94 | need_gpio = 1; | 94 | need_gpio = 1; |
95 | dev->xc_fw_load_done = 1; /* FW Loading is done */ | 95 | /* FW Loading is done */ |
96 | dev->xc_fw_load_done = 1; | ||
96 | break; | 97 | break; |
97 | case 0x000D: /* Set signal source */ | 98 | case 0x000D: /* Set signal source */ |
98 | case 0x0001: /* Set TV standard - Video */ | 99 | case 0x0001: /* Set TV standard - Video */ |
@@ -108,8 +109,8 @@ int cx231xx_i2c_send_bytes(struct i2c_adapter *i2c_adap, | |||
108 | 109 | ||
109 | if (need_gpio) { | 110 | if (need_gpio) { |
110 | dprintk1(1, | 111 | dprintk1(1, |
111 | " GPIO W R I T E : addr 0x%x, len %d, saddr 0x%x\n", | 112 | "GPIO WRITE: addr 0x%x, len %d, saddr 0x%x\n", |
112 | msg->addr, msg->len, saddr); | 113 | msg->addr, msg->len, saddr); |
113 | 114 | ||
114 | return dev->cx231xx_gpio_i2c_write(dev, | 115 | return dev->cx231xx_gpio_i2c_write(dev, |
115 | msg->addr, | 116 | msg->addr, |
@@ -196,8 +197,8 @@ static int cx231xx_i2c_recv_bytes(struct i2c_adapter *i2c_adap, | |||
196 | switch (saddr) { | 197 | switch (saddr) { |
197 | case 0x0009: /* BUSY check */ | 198 | case 0x0009: /* BUSY check */ |
198 | dprintk1(1, | 199 | dprintk1(1, |
199 | " GPIO R E A D : Special case BUSY check \n"); | 200 | "GPIO R E A D: Special case BUSY check \n"); |
200 | /* Try to read BUSY register, just set it to zero */ | 201 | /*Try read BUSY register, just set it to zero*/ |
201 | msg->buf[0] = 0; | 202 | msg->buf[0] = 0; |
202 | if (msg->len == 2) | 203 | if (msg->len == 2) |
203 | msg->buf[1] = 0; | 204 | msg->buf[1] = 0; |
@@ -209,12 +210,14 @@ static int cx231xx_i2c_recv_bytes(struct i2c_adapter *i2c_adap, | |||
209 | } | 210 | } |
210 | 211 | ||
211 | if (need_gpio) { | 212 | if (need_gpio) { |
212 | /* this is a special case to handle Xceive tuner clock stretch issue | 213 | /* this is a special case to handle Xceive tuner |
213 | with gpio based I2C interface */ | 214 | clock stretch issue with gpio based I2C */ |
215 | |||
214 | dprintk1(1, | 216 | dprintk1(1, |
215 | " GPIO R E A D : addr 0x%x, len %d, saddr 0x%x\n", | 217 | "GPIO R E A D: addr 0x%x, len %d, saddr 0x%x\n", |
216 | msg->addr, msg->len, | 218 | msg->addr, msg->len, |
217 | msg->buf[0] << 8 | msg->buf[1]); | 219 | msg->buf[0] << 8 | msg->buf[1]); |
220 | |||
218 | status = | 221 | status = |
219 | dev->cx231xx_gpio_i2c_write(dev, msg->addr, | 222 | dev->cx231xx_gpio_i2c_write(dev, msg->addr, |
220 | msg->buf, | 223 | msg->buf, |
@@ -281,8 +284,8 @@ static int cx231xx_i2c_recv_bytes_with_saddr(struct i2c_adapter *i2c_adap, | |||
281 | if ((msg2->len < 16)) { | 284 | if ((msg2->len < 16)) { |
282 | 285 | ||
283 | dprintk1(1, | 286 | dprintk1(1, |
284 | " i2c_read : addr 0x%x, len %d, subaddr 0x%x, leng %d\n", | 287 | "i2c_read: addr 0x%x, len %d, saddr 0x%x, len %d\n", |
285 | msg2->addr, msg2->len, saddr, msg1->len); | 288 | msg2->addr, msg2->len, saddr, msg1->len); |
286 | 289 | ||
287 | switch (saddr) { | 290 | switch (saddr) { |
288 | case 0x0008: /* read FW load status */ | 291 | case 0x0008: /* read FW load status */ |
@@ -368,7 +371,8 @@ static int cx231xx_i2c_xfer(struct i2c_adapter *i2c_adap, | |||
368 | dprintk2(2, "%s %s addr=%x len=%d:", | 371 | dprintk2(2, "%s %s addr=%x len=%d:", |
369 | (msgs[i].flags & I2C_M_RD) ? "read" : "write", | 372 | (msgs[i].flags & I2C_M_RD) ? "read" : "write", |
370 | i == num - 1 ? "stop" : "nonstop", addr, msgs[i].len); | 373 | i == num - 1 ? "stop" : "nonstop", addr, msgs[i].len); |
371 | if (!msgs[i].len) { /* no len: check only for device presence */ | 374 | if (!msgs[i].len) { |
375 | /* no len: check only for device presence */ | ||
372 | rc = cx231xx_i2c_check_for_device(i2c_adap, &msgs[i]); | 376 | rc = cx231xx_i2c_check_for_device(i2c_adap, &msgs[i]); |
373 | if (rc < 0) { | 377 | if (rc < 0) { |
374 | dprintk2(2, " no device\n"); | 378 | dprintk2(2, " no device\n"); |
@@ -409,7 +413,7 @@ static int cx231xx_i2c_xfer(struct i2c_adapter *i2c_adap, | |||
409 | } | 413 | } |
410 | 414 | ||
411 | return num; | 415 | return num; |
412 | err: | 416 | err: |
413 | dprintk2(2, " ERROR: %i\n", rc); | 417 | dprintk2(2, " ERROR: %i\n", rc); |
414 | return rc; | 418 | return rc; |
415 | } | 419 | } |
diff --git a/drivers/media/video/cx231xx/cx231xx-input.c b/drivers/media/video/cx231xx/cx231xx-input.c index 68e95ea03b17..97e304c3c799 100644 --- a/drivers/media/video/cx231xx/cx231xx-input.c +++ b/drivers/media/video/cx231xx/cx231xx-input.c | |||
@@ -2,9 +2,9 @@ | |||
2 | handle cx231xx IR remotes via linux kernel input layer. | 2 | handle cx231xx IR remotes via linux kernel input layer. |
3 | 3 | ||
4 | Copyright (C) 2008 <srinivasa.deevi at conexant dot com> | 4 | Copyright (C) 2008 <srinivasa.deevi at conexant dot com> |
5 | Based on em28xx driver | 5 | Based on em28xx driver |
6 | 6 | ||
7 | < This is a place holder for IR now.> | 7 | < This is a place holder for IR now.> |
8 | 8 | ||
9 | This program is free software; you can redistribute it and/or modify | 9 | This program is free software; you can redistribute it and/or modify |
10 | it under the terms of the GNU General Public License as published by | 10 | it under the terms of the GNU General Public License as published by |
@@ -219,10 +219,10 @@ int cx231xx_ir_init(struct cx231xx *dev) | |||
219 | goto err_out_stop; | 219 | goto err_out_stop; |
220 | 220 | ||
221 | return 0; | 221 | return 0; |
222 | err_out_stop: | 222 | err_out_stop: |
223 | cx231xx_ir_stop(ir); | 223 | cx231xx_ir_stop(ir); |
224 | dev->ir = NULL; | 224 | dev->ir = NULL; |
225 | err_out_free: | 225 | err_out_free: |
226 | input_free_device(input_dev); | 226 | input_free_device(input_dev); |
227 | kfree(ir); | 227 | kfree(ir); |
228 | return err; | 228 | return err; |
diff --git a/drivers/media/video/cx231xx/cx231xx-reg.h b/drivers/media/video/cx231xx/cx231xx-reg.h index 7c8ba4e053e7..d2d325b21d4f 100644 --- a/drivers/media/video/cx231xx/cx231xx-reg.h +++ b/drivers/media/video/cx231xx/cx231xx-reg.h | |||
@@ -1,5 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | cx231xx-reg.h - driver for Conexant Cx23100/101/102 USB video capture devices | 2 | cx231xx-reg.h - driver for Conexant Cx23100/101/102 |
3 | USB video capture devices | ||
3 | 4 | ||
4 | Copyright (C) 2008 <srinivasa.deevi at conexant dot com> | 5 | Copyright (C) 2008 <srinivasa.deevi at conexant dot com> |
5 | 6 | ||
@@ -22,7 +23,7 @@ | |||
22 | #define _CX231XX_REG_H | 23 | #define _CX231XX_REG_H |
23 | 24 | ||
24 | /***************************************************************************** | 25 | /***************************************************************************** |
25 | * VBI codes * | 26 | * VBI codes * |
26 | *****************************************************************************/ | 27 | *****************************************************************************/ |
27 | 28 | ||
28 | #define SAV_ACTIVE_VIDEO_FIELD1 0x80 | 29 | #define SAV_ACTIVE_VIDEO_FIELD1 0x80 |
@@ -1533,13 +1534,13 @@ | |||
1533 | #define INPUT_MODE_YC2_2 2 /* INPUT_MODE_VALUE(2) */ | 1534 | #define INPUT_MODE_YC2_2 2 /* INPUT_MODE_VALUE(2) */ |
1534 | #define INPUT_MODE_YUV_3 3 /* INPUT_MODE_VALUE(3) */ | 1535 | #define INPUT_MODE_YUV_3 3 /* INPUT_MODE_VALUE(3) */ |
1535 | 1536 | ||
1536 | #define LUMA_LPF_LOW_BANDPASS 0 /* 0.6Mhz lowpass filter bandwidth */ | 1537 | #define LUMA_LPF_LOW_BANDPASS 0 /* 0.6Mhz LPF BW */ |
1537 | #define LUMA_LPF_MEDIUM_BANDPASS 1 /* 1.0Mhz lowpass filter bandwidth */ | 1538 | #define LUMA_LPF_MEDIUM_BANDPASS 1 /* 1.0Mhz LPF BW */ |
1538 | #define LUMA_LPF_HIGH_BANDPASS 2 /* 1.5Mhz lowpass filter bandwidth */ | 1539 | #define LUMA_LPF_HIGH_BANDPASS 2 /* 1.5Mhz LPF BW */ |
1539 | 1540 | ||
1540 | #define UV_LPF_LOW_BANDPASS 0 /* 0.6Mhz lowpass filter bandwidth */ | 1541 | #define UV_LPF_LOW_BANDPASS 0 /* 0.6Mhz LPF BW */ |
1541 | #define UV_LPF_MEDIUM_BANDPASS 1 /* 1.0Mhz lowpass filter bandwidth */ | 1542 | #define UV_LPF_MEDIUM_BANDPASS 1 /* 1.0Mhz LPF BW */ |
1542 | #define UV_LPF_HIGH_BANDPASS 2 /* 1.5Mhz lowpass filter bandwidth */ | 1543 | #define UV_LPF_HIGH_BANDPASS 2 /* 1.5Mhz LPF BW */ |
1543 | 1544 | ||
1544 | #define TWO_TAP_FILT 0 | 1545 | #define TWO_TAP_FILT 0 |
1545 | #define THREE_TAP_FILT 1 | 1546 | #define THREE_TAP_FILT 1 |
diff --git a/drivers/media/video/cx231xx/cx231xx-vbi.c b/drivers/media/video/cx231xx/cx231xx-vbi.c index 03059043744c..82db39d339e1 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) | |||
140 | while (bytes_parsed < buffer_size) { | 140 | while (bytes_parsed < buffer_size) { |
141 | u32 bytes_used = 0; | 141 | u32 bytes_used = 0; |
142 | 142 | ||
143 | sav_eav = cx231xx_find_next_SAV_EAV(p_buffer + bytes_parsed, /* p_buffer */ | 143 | sav_eav = cx231xx_find_next_SAV_EAV( |
144 | buffer_size - bytes_parsed, /* buffer size */ | 144 | p_buffer + bytes_parsed, /* p_buffer */ |
145 | &bytes_used); /* Receives bytes used to get SAV/EAV */ | 145 | buffer_size - bytes_parsed, /* buffer size */ |
146 | &bytes_used); /* bytes used to get SAV/EAV */ | ||
146 | 147 | ||
147 | bytes_parsed += bytes_used; | 148 | bytes_parsed += bytes_used; |
148 | 149 | ||
149 | sav_eav &= 0xF0; | 150 | sav_eav &= 0xF0; |
150 | if (sav_eav && (bytes_parsed < buffer_size)) { | 151 | if (sav_eav && (bytes_parsed < buffer_size)) { |
151 | bytes_parsed += cx231xx_get_vbi_line(dev, | 152 | bytes_parsed += cx231xx_get_vbi_line(dev, |
152 | dma_q, sav_eav, /* SAV/EAV */ | 153 | dma_q, sav_eav, /* SAV/EAV */ |
153 | p_buffer + bytes_parsed, /* p_buffer */ | 154 | p_buffer+bytes_parsed, /* p_buffer */ |
154 | buffer_size - bytes_parsed); /* buffer size */ | 155 | buffer_size-bytes_parsed);/*buf size*/ |
155 | } | 156 | } |
156 | } | 157 | } |
157 | 158 | ||
158 | /* Save the last four bytes of the buffer so we can check the buffer boundary | 159 | /* Save the last four bytes of the buffer so we can |
159 | condition next time */ | 160 | check the buffer boundary condition next time */ |
160 | memcpy(dma_q->partial_buf, p_buffer + buffer_size - 4, 4); | 161 | memcpy(dma_q->partial_buf, p_buffer + buffer_size - 4, 4); |
161 | bytes_parsed = 0; | 162 | bytes_parsed = 0; |
162 | } | 163 | } |
diff --git a/drivers/media/video/cx231xx/cx231xx-vbi.h b/drivers/media/video/cx231xx/cx231xx-vbi.h index c0d89b1e2725..89c7fe80b261 100644 --- a/drivers/media/video/cx231xx/cx231xx-vbi.h +++ b/drivers/media/video/cx231xx/cx231xx-vbi.h | |||
@@ -2,7 +2,7 @@ | |||
2 | cx231xx_vbi.h - driver for Conexant Cx23100/101/102 USB video capture devices | 2 | cx231xx_vbi.h - driver for Conexant Cx23100/101/102 USB video capture devices |
3 | 3 | ||
4 | Copyright (C) 2008 <srinivasa.deevi at conexant dot com> | 4 | Copyright (C) 2008 <srinivasa.deevi at conexant dot com> |
5 | Based on cx88 driver | 5 | Based on cx88 driver |
6 | 6 | ||
7 | This program is free software; you can redistribute it and/or modify | 7 | This program is free software; you can redistribute it and/or modify |
8 | it under the terms of the GNU General Public License as published by | 8 | it under the terms of the GNU General Public License as published by |
@@ -24,16 +24,16 @@ | |||
24 | 24 | ||
25 | extern struct videobuf_queue_ops cx231xx_vbi_qops; | 25 | extern struct videobuf_queue_ops cx231xx_vbi_qops; |
26 | 26 | ||
27 | #define NTSC_VBI_START_LINE 10 /* line 10 - 21 */ | 27 | #define NTSC_VBI_START_LINE 10 /* line 10 - 21 */ |
28 | #define NTSC_VBI_END_LINE 21 | 28 | #define NTSC_VBI_END_LINE 21 |
29 | #define NTSC_VBI_LINES (NTSC_VBI_END_LINE - NTSC_VBI_START_LINE + 1) | 29 | #define NTSC_VBI_LINES (NTSC_VBI_END_LINE-NTSC_VBI_START_LINE+1) |
30 | 30 | ||
31 | #define PAL_VBI_START_LINE 6 | 31 | #define PAL_VBI_START_LINE 6 |
32 | #define PAL_VBI_END_LINE 23 | 32 | #define PAL_VBI_END_LINE 23 |
33 | #define PAL_VBI_LINES (PAL_VBI_END_LINE - PAL_VBI_START_LINE + 1) | 33 | #define PAL_VBI_LINES (PAL_VBI_END_LINE-PAL_VBI_START_LINE+1) |
34 | 34 | ||
35 | #define VBI_STRIDE 1440 | 35 | #define VBI_STRIDE 1440 |
36 | #define VBI_SAMPLES_PER_LINE 1440 | 36 | #define VBI_SAMPLES_PER_LINE 1440 |
37 | 37 | ||
38 | #define CX231XX_NUM_VBI_PACKETS 4 | 38 | #define CX231XX_NUM_VBI_PACKETS 4 |
39 | #define CX231XX_NUM_VBI_BUFS 5 | 39 | #define CX231XX_NUM_VBI_BUFS 5 |
@@ -41,21 +41,23 @@ extern struct videobuf_queue_ops cx231xx_vbi_qops; | |||
41 | /* stream functions */ | 41 | /* stream functions */ |
42 | int cx231xx_init_vbi_isoc(struct cx231xx *dev, int max_packets, | 42 | int cx231xx_init_vbi_isoc(struct cx231xx *dev, int max_packets, |
43 | int num_bufs, int max_pkt_size, | 43 | int num_bufs, int max_pkt_size, |
44 | int (*isoc_copy) (struct cx231xx * dev, | 44 | int (*isoc_copy) (struct cx231xx *dev, |
45 | struct urb * urb)); | 45 | struct urb *urb)); |
46 | 46 | ||
47 | void cx231xx_uninit_vbi_isoc(struct cx231xx *dev); | 47 | void cx231xx_uninit_vbi_isoc(struct cx231xx *dev); |
48 | 48 | ||
49 | /* vbi data copy functions */ | 49 | /* vbi data copy functions */ |
50 | u32 cx231xx_get_vbi_line(struct cx231xx *dev, struct cx231xx_dmaqueue *dma_q, | 50 | u32 cx231xx_get_vbi_line(struct cx231xx *dev, struct cx231xx_dmaqueue *dma_q, |
51 | u8 sav_eav, u8 * p_buffer, u32 buffer_size); | 51 | u8 sav_eav, u8 *p_buffer, u32 buffer_size); |
52 | |||
52 | u32 cx231xx_copy_vbi_line(struct cx231xx *dev, struct cx231xx_dmaqueue *dma_q, | 53 | u32 cx231xx_copy_vbi_line(struct cx231xx *dev, struct cx231xx_dmaqueue *dma_q, |
53 | u8 * p_line, u32 length, int field_number); | 54 | u8 *p_line, u32 length, int field_number); |
55 | |||
54 | void cx231xx_reset_vbi_buffer(struct cx231xx *dev, | 56 | void cx231xx_reset_vbi_buffer(struct cx231xx *dev, |
55 | struct cx231xx_dmaqueue *dma_q); | 57 | struct cx231xx_dmaqueue *dma_q); |
56 | 58 | ||
57 | int cx231xx_do_vbi_copy(struct cx231xx *dev, struct cx231xx_dmaqueue *dma_q, | 59 | int cx231xx_do_vbi_copy(struct cx231xx *dev, struct cx231xx_dmaqueue *dma_q, |
58 | u8 * p_buffer, u32 bytes_to_copy); | 60 | u8 *p_buffer, u32 bytes_to_copy); |
59 | 61 | ||
60 | u8 cx231xx_is_vbi_buffer_done(struct cx231xx *dev, | 62 | u8 cx231xx_is_vbi_buffer_done(struct cx231xx *dev, |
61 | struct cx231xx_dmaqueue *dma_q); | 63 | struct cx231xx_dmaqueue *dma_q); |
diff --git a/drivers/media/video/cx231xx/cx231xx-video.c b/drivers/media/video/cx231xx/cx231xx-video.c index 47e2da8ae19a..fc7260a71e8e 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) | |||
365 | bytes_parsed = 0; | 365 | bytes_parsed = 0; |
366 | 366 | ||
367 | if (dma_q->is_partial_line) { | 367 | if (dma_q->is_partial_line) { |
368 | /* Handle the case where we were working on a partial line */ | 368 | /* Handle the case of a partial line */ |
369 | sav_eav = dma_q->last_sav; | 369 | sav_eav = dma_q->last_sav; |
370 | } else { | 370 | } else { |
371 | /* Check for a SAV/EAV overlapping the buffer boundary */ | 371 | /* Check for a SAV/EAV overlapping |
372 | the buffer boundary */ | ||
372 | sav_eav = | 373 | sav_eav = |
373 | cx231xx_find_boundary_SAV_EAV(p_buffer, | 374 | cx231xx_find_boundary_SAV_EAV(p_buffer, |
374 | dma_q->partial_buf, | 375 | dma_q->partial_buf, |
@@ -380,9 +381,9 @@ static inline int cx231xx_isoc_copy(struct cx231xx *dev, struct urb *urb) | |||
380 | the last buffer or a partial line */ | 381 | the last buffer or a partial line */ |
381 | if (sav_eav) { | 382 | if (sav_eav) { |
382 | bytes_parsed += cx231xx_get_video_line(dev, dma_q, | 383 | bytes_parsed += cx231xx_get_video_line(dev, dma_q, |
383 | sav_eav, /* SAV/EAV */ | 384 | sav_eav, /* SAV/EAV */ |
384 | p_buffer + bytes_parsed, /* p_buffer */ | 385 | p_buffer + bytes_parsed, /* p_buffer */ |
385 | buffer_size - bytes_parsed); /* buffer size */ | 386 | buffer_size - bytes_parsed);/* buf size */ |
386 | } | 387 | } |
387 | 388 | ||
388 | /* Now parse data that is completely in this buffer */ | 389 | /* 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) | |||
391 | while (bytes_parsed < buffer_size) { | 392 | while (bytes_parsed < buffer_size) { |
392 | u32 bytes_used = 0; | 393 | u32 bytes_used = 0; |
393 | 394 | ||
394 | sav_eav = cx231xx_find_next_SAV_EAV(p_buffer + bytes_parsed, /* p_buffer */ | 395 | sav_eav = cx231xx_find_next_SAV_EAV( |
395 | buffer_size - bytes_parsed, /* buffer size */ | 396 | p_buffer + bytes_parsed, /* p_buffer */ |
396 | &bytes_used); /* Receives bytes used to get SAV/EAV */ | 397 | buffer_size - bytes_parsed, /* buf size */ |
398 | &bytes_used);/* bytes used to get SAV/EAV */ | ||
397 | 399 | ||
398 | bytes_parsed += bytes_used; | 400 | bytes_parsed += bytes_used; |
399 | 401 | ||
400 | sav_eav &= 0xF0; | 402 | sav_eav &= 0xF0; |
401 | if (sav_eav && (bytes_parsed < buffer_size)) { | 403 | if (sav_eav && (bytes_parsed < buffer_size)) { |
402 | bytes_parsed += cx231xx_get_video_line(dev, | 404 | bytes_parsed += cx231xx_get_video_line(dev, |
403 | dma_q, sav_eav, /* SAV/EAV */ | 405 | dma_q, sav_eav, /* SAV/EAV */ |
404 | p_buffer + bytes_parsed, /* p_buffer */ | 406 | p_buffer + bytes_parsed,/* p_buffer */ |
405 | buffer_size - bytes_parsed); /* buffer size */ | 407 | buffer_size - bytes_parsed);/*buf size*/ |
406 | } | 408 | } |
407 | } | 409 | } |
408 | 410 | ||
@@ -1398,9 +1400,11 @@ static int vidioc_s_frequency(struct file *file, void *priv, | |||
1398 | #ifdef CONFIG_VIDEO_ADV_DEBUG | 1400 | #ifdef CONFIG_VIDEO_ADV_DEBUG |
1399 | 1401 | ||
1400 | /* | 1402 | /* |
1401 | -R, --list-registers=type=<host/i2cdrv/i2caddr>,chip=<chip>[,min=<addr>,max=<addr>] | 1403 | -R, --list-registers=type=<host/i2cdrv/i2caddr>, |
1404 | chip=<chip>[,min=<addr>,max=<addr>] | ||
1402 | dump registers from <min> to <max> [VIDIOC_DBG_G_REGISTER] | 1405 | dump registers from <min> to <max> [VIDIOC_DBG_G_REGISTER] |
1403 | -r, --set-register=type=<host/i2cdrv/i2caddr>,chip=<chip>,reg=<addr>,val=<val> | 1406 | -r, --set-register=type=<host/i2cdrv/i2caddr>, |
1407 | chip=<chip>,reg=<addr>,val=<val> | ||
1404 | set the register [VIDIOC_DBG_S_REGISTER] | 1408 | set the register [VIDIOC_DBG_S_REGISTER] |
1405 | 1409 | ||
1406 | if type == host, then <chip> is the hosts chip ID (default 0) | 1410 | if type == host, then <chip> is the hosts chip ID (default 0) |
@@ -2332,8 +2336,9 @@ static struct video_device cx231xx_radio_template = { | |||
2332 | 2336 | ||
2333 | /******************************** usb interface ******************************/ | 2337 | /******************************** usb interface ******************************/ |
2334 | 2338 | ||
2335 | static struct video_device *cx231xx_vdev_init(struct cx231xx *dev, const struct video_device | 2339 | static struct video_device *cx231xx_vdev_init(struct cx231xx *dev, |
2336 | *template, const char *type_name) | 2340 | const struct video_device |
2341 | *template, const char *type_name) | ||
2337 | { | 2342 | { |
2338 | struct video_device *vfd; | 2343 | struct video_device *vfd; |
2339 | 2344 | ||
diff --git a/drivers/media/video/cx231xx/cx231xx.h b/drivers/media/video/cx231xx/cx231xx.h index d4fba028db4a..f6e34a6de783 100644 --- a/drivers/media/video/cx231xx/cx231xx.h +++ b/drivers/media/video/cx231xx/cx231xx.h | |||
@@ -29,7 +29,8 @@ | |||
29 | #include <linux/i2c-algo-bit.h> | 29 | #include <linux/i2c-algo-bit.h> |
30 | #include <linux/mutex.h> | 30 | #include <linux/mutex.h> |
31 | #include <media/ir-kbd-i2c.h> | 31 | #include <media/ir-kbd-i2c.h> |
32 | #if defined(CONFIG_VIDEO_CX231XX_DVB) || defined(CONFIG_VIDEO_CX231XX_DVB_MODULE) | 32 | #if defined(CONFIG_VIDEO_CX231XX_DVB) || \ |
33 | defined(CONFIG_VIDEO_CX231XX_DVB_MODULE) | ||
33 | #include <media/videobuf-dvb.h> | 34 | #include <media/videobuf-dvb.h> |
34 | #endif | 35 | #endif |
35 | 36 | ||
@@ -87,7 +88,8 @@ | |||
87 | #define CX231XX_INTERLACED_DEFAULT 1 | 88 | #define CX231XX_INTERLACED_DEFAULT 1 |
88 | 89 | ||
89 | /* time to wait when stopping the isoc transfer */ | 90 | /* time to wait when stopping the isoc transfer */ |
90 | #define CX231XX_URB_TIMEOUT msecs_to_jiffies(CX231XX_NUM_BUFS * CX231XX_NUM_PACKETS) | 91 | #define CX231XX_URB_TIMEOUT \ |
92 | msecs_to_jiffies(CX231XX_NUM_BUFS * CX231XX_NUM_PACKETS) | ||
91 | 93 | ||
92 | enum cx231xx_mode { | 94 | enum cx231xx_mode { |
93 | CX231XX_SUSPEND, | 95 | CX231XX_SUSPEND, |
@@ -231,12 +233,12 @@ enum cx231xx_decoder { | |||
231 | CX231XX_AVDECODER | 233 | CX231XX_AVDECODER |
232 | }; | 234 | }; |
233 | 235 | ||
234 | typedef enum _I2C_MASTER_PORT { | 236 | enum CX231XX_I2C_MASTER_PORT { |
235 | I2C_0 = 0, | 237 | I2C_0 = 0, |
236 | I2C_1 = 1, | 238 | I2C_1 = 1, |
237 | I2C_2 = 2, | 239 | I2C_2 = 2, |
238 | I2C_3 = 3 | 240 | I2C_3 = 3 |
239 | } CX231XX_I2C_MASTER_PORT; | 241 | }; |
240 | 242 | ||
241 | struct cx231xx_board { | 243 | struct cx231xx_board { |
242 | char *name; | 244 | char *name; |
@@ -346,16 +348,20 @@ struct cx231xx_fh { | |||
346 | enum v4l2_buf_type type; | 348 | enum v4l2_buf_type type; |
347 | }; | 349 | }; |
348 | 350 | ||
349 | /**********************************************************************************/ | 351 | /*****************************************************************/ |
350 | /* set/get i2c */ | 352 | /* set/get i2c */ |
351 | #define I2C_SPEED_1M 0x0 /* 00--1Mb/s, 01-400kb/s, 10--100kb/s, 11--5Mb/s */ | 353 | /* 00--1Mb/s, 01-400kb/s, 10--100kb/s, 11--5Mb/s */ |
352 | #define I2C_SPEED_400K 0x1 /* 00--1Mb/s, 01-400kb/s, 10--100kb/s, 11--5Mb/s */ | 354 | #define I2C_SPEED_1M 0x0 |
353 | #define I2C_SPEED_100K 0x2 /* 00--1Mb/s, 01-400kb/s, 10--100kb/s, 11--5Mb/s */ | 355 | #define I2C_SPEED_400K 0x1 |
354 | #define I2C_SPEED_5M 0x3 /* 00--1Mb/s, 01-400kb/s, 10--100kb/s, 11--5Mb/s */ | 356 | #define I2C_SPEED_100K 0x2 |
355 | 357 | #define I2C_SPEED_5M 0x3 | |
356 | #define I2C_STOP 0x0 /* 0-- STOP transaction */ | 358 | |
357 | #define I2C_NOSTOP 0x1 /* 1-- do not transmit STOP at end of transaction */ | 359 | /* 0-- STOP transaction */ |
358 | #define I2C_SYNC 0x1 /* 1--alllow slave to insert clock wait states */ | 360 | #define I2C_STOP 0x0 |
361 | /* 1-- do not transmit STOP at end of transaction */ | ||
362 | #define I2C_NOSTOP 0x1 | ||
363 | /* 1--alllow slave to insert clock wait states */ | ||
364 | #define I2C_SYNC 0x1 | ||
359 | 365 | ||
360 | struct cx231xx_i2c { | 366 | struct cx231xx_i2c { |
361 | struct cx231xx *dev; | 367 | struct cx231xx *dev; |
@@ -383,7 +389,7 @@ struct cx231xx_i2c_xfer_data { | |||
383 | u8 *p_buffer; /* pointer to the buffer */ | 389 | u8 *p_buffer; /* pointer to the buffer */ |
384 | }; | 390 | }; |
385 | 391 | ||
386 | typedef struct _VENDOR_REQUEST_IN { | 392 | struct VENDOR_REQUEST_IN{ |
387 | u8 bRequest; | 393 | u8 bRequest; |
388 | u16 wValue; | 394 | u16 wValue; |
389 | u16 wIndex; | 395 | u16 wIndex; |
@@ -391,7 +397,7 @@ typedef struct _VENDOR_REQUEST_IN { | |||
391 | u8 direction; | 397 | u8 direction; |
392 | u8 bData; | 398 | u8 bData; |
393 | u8 *pBuff; | 399 | u8 *pBuff; |
394 | } VENDOR_REQUEST_IN, *PVENDOR_REQUEST_IN; | 400 | }; |
395 | 401 | ||
396 | struct cx231xx_ctrl { | 402 | struct cx231xx_ctrl { |
397 | struct v4l2_queryctrl v; | 403 | struct v4l2_queryctrl v; |
@@ -401,7 +407,7 @@ struct cx231xx_ctrl { | |||
401 | u32 shift; | 407 | u32 shift; |
402 | }; | 408 | }; |
403 | 409 | ||
404 | typedef enum { | 410 | enum TRANSFER_TYPE{ |
405 | Raw_Video = 0, | 411 | Raw_Video = 0, |
406 | Audio, | 412 | Audio, |
407 | Vbi, /* VANC */ | 413 | Vbi, /* VANC */ |
@@ -409,7 +415,7 @@ typedef enum { | |||
409 | TS1_serial_mode, | 415 | TS1_serial_mode, |
410 | TS2, | 416 | TS2, |
411 | TS1_parallel_mode | 417 | TS1_parallel_mode |
412 | } TRANSFER_TYPE; | 418 | } ; |
413 | 419 | ||
414 | struct cx231xx_video_mode { | 420 | struct cx231xx_video_mode { |
415 | /* Isoc control struct */ | 421 | /* Isoc control struct */ |
@@ -500,7 +506,7 @@ struct cx231xx { | |||
500 | int (*cx231xx_write_ctrl_reg) (struct cx231xx *dev, u8 req, u16 reg, | 506 | int (*cx231xx_write_ctrl_reg) (struct cx231xx *dev, u8 req, u16 reg, |
501 | char *buf, int len); | 507 | char *buf, int len); |
502 | int (*cx231xx_send_usb_command) (struct cx231xx_i2c *i2c_bus, | 508 | int (*cx231xx_send_usb_command) (struct cx231xx_i2c *i2c_bus, |
503 | struct cx231xx_i2c_xfer_data *req_data); | 509 | struct cx231xx_i2c_xfer_data *req_data); |
504 | int (*cx231xx_gpio_i2c_read) (struct cx231xx *dev, u8 dev_addr, | 510 | int (*cx231xx_gpio_i2c_read) (struct cx231xx *dev, u8 dev_addr, |
505 | u8 *buf, u8 len); | 511 | u8 *buf, u8 len); |
506 | int (*cx231xx_gpio_i2c_write) (struct cx231xx *dev, u8 dev_addr, | 512 | 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, | |||
621 | char *buf, int len); | 627 | char *buf, int len); |
622 | int cx231xx_mode_register(struct cx231xx *dev, u16 address, u32 mode); | 628 | int cx231xx_mode_register(struct cx231xx *dev, u16 address, u32 mode); |
623 | 629 | ||
624 | int cx231xx_send_vendor_cmd(struct cx231xx *dev, VENDOR_REQUEST_IN *ven_req); | 630 | int cx231xx_send_vendor_cmd(struct cx231xx *dev, |
631 | struct VENDOR_REQUEST_IN *ven_req); | ||
625 | int cx231xx_send_usb_command(struct cx231xx_i2c *i2c_bus, | 632 | int cx231xx_send_usb_command(struct cx231xx_i2c *i2c_bus, |
626 | struct cx231xx_i2c_xfer_data *req_data); | 633 | struct cx231xx_i2c_xfer_data *req_data); |
627 | 634 | ||
628 | /* Gpio related functions */ | 635 | /* Gpio related functions */ |
629 | int cx231xx_send_gpio_cmd(struct cx231xx *dev, u32 gpio_bit, u8 *gpio_val, | 636 | int cx231xx_send_gpio_cmd(struct cx231xx *dev, u32 gpio_bit, u8 *gpio_val, |