diff options
author | Mauro Carvalho Chehab <mchehab@redhat.com> | 2009-03-03 11:31:36 -0500 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2009-04-06 20:44:02 -0400 |
commit | cde4362f0244a70bab73e37e24f167186bb9a8be (patch) | |
tree | 17a52f26a6d14c9742c698b2b7e109fad6ac8695 /drivers/media/video | |
parent | 84b5dbf39ed2f51224841bbbf08439158d69d427 (diff) |
V4L/DVB (10956): cx231xx: First series of manual CodingStyle fixes
This patch cleans up CodingStyle on the following source files:
There are still much more to be fixed on later patches
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video')
-rw-r--r-- | drivers/media/video/cx231xx/cx231xx-audio.c | 37 | ||||
-rw-r--r-- | drivers/media/video/cx231xx/cx231xx-avcore.c | 2107 | ||||
-rw-r--r-- | drivers/media/video/cx231xx/cx231xx-vbi.c | 86 | ||||
-rw-r--r-- | drivers/media/video/cx231xx/cx231xx-video.c | 595 | ||||
-rw-r--r-- | drivers/media/video/cx231xx/cx231xx.h | 60 |
5 files changed, 1257 insertions, 1628 deletions
diff --git a/drivers/media/video/cx231xx/cx231xx-audio.c b/drivers/media/video/cx231xx/cx231xx-audio.c index cee64879c4f0..3810b0fd2d61 100644 --- a/drivers/media/video/cx231xx/cx231xx-audio.c +++ b/drivers/media/video/cx231xx/cx231xx-audio.c | |||
@@ -70,7 +70,6 @@ static int cx231xx_isoc_audio_deinit(struct cx231xx *dev) | |||
70 | 70 | ||
71 | kfree(dev->adev.transfer_buffer[i]); | 71 | kfree(dev->adev.transfer_buffer[i]); |
72 | dev->adev.transfer_buffer[i] = NULL; | 72 | dev->adev.transfer_buffer[i] = NULL; |
73 | |||
74 | } | 73 | } |
75 | } | 74 | } |
76 | 75 | ||
@@ -108,18 +107,19 @@ static void cx231xx_audio_isocirq(struct urb *urb) | |||
108 | stride = runtime->frame_bits >> 3; | 107 | stride = runtime->frame_bits >> 3; |
109 | 108 | ||
110 | for (i = 0; i < urb->number_of_packets; i++) { | 109 | for (i = 0; i < urb->number_of_packets; i++) { |
111 | int length = | 110 | int length = urb->iso_frame_desc[i].actual_length / |
112 | urb->iso_frame_desc[i].actual_length / stride; | 111 | stride; |
113 | cp = (unsigned char *)urb->transfer_buffer + | 112 | cp = (unsigned char *)urb->transfer_buffer + |
114 | urb->iso_frame_desc[i].offset; | 113 | urb->iso_frame_desc[i].offset; |
115 | 114 | ||
116 | if (!length) | 115 | if (!length) |
117 | continue; | 116 | continue; |
118 | 117 | ||
119 | oldptr = dev->adev.hwptr_done_capture; | 118 | oldptr = dev->adev.hwptr_done_capture; |
120 | if (oldptr + length >= runtime->buffer_size) { | 119 | if (oldptr + length >= runtime->buffer_size) { |
121 | unsigned int cnt = | 120 | unsigned int cnt; |
122 | runtime->buffer_size - oldptr; | 121 | |
122 | cnt = runtime->buffer_size - oldptr; | ||
123 | memcpy(runtime->dma_area + oldptr * stride, cp, | 123 | memcpy(runtime->dma_area + oldptr * stride, cp, |
124 | cnt * stride); | 124 | cnt * stride); |
125 | memcpy(runtime->dma_area, cp + cnt * stride, | 125 | memcpy(runtime->dma_area, cp + cnt * stride, |
@@ -132,16 +132,12 @@ 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 >= | 135 | if (dev->adev.hwptr_done_capture >= runtime->buffer_size) |
136 | runtime->buffer_size) | 136 | dev->adev.hwptr_done_capture -= runtime->buffer_size; |
137 | dev->adev.hwptr_done_capture -= | ||
138 | runtime->buffer_size; | ||
139 | 137 | ||
140 | dev->adev.capture_transfer_done += length; | 138 | dev->adev.capture_transfer_done += length; |
141 | if (dev->adev.capture_transfer_done >= | 139 | if (dev->adev.capture_transfer_done >= runtime->period_size) { |
142 | runtime->period_size) { | 140 | dev->adev.capture_transfer_done -= runtime->period_size; |
143 | dev->adev.capture_transfer_done -= | ||
144 | runtime->period_size; | ||
145 | period_elapsed = 1; | 141 | period_elapsed = 1; |
146 | } | 142 | } |
147 | snd_pcm_stream_unlock(substream); | 143 | snd_pcm_stream_unlock(substream); |
@@ -189,8 +185,7 @@ static int cx231xx_init_audio_isoc(struct cx231xx *dev) | |||
189 | 185 | ||
190 | urb->dev = dev->udev; | 186 | urb->dev = dev->udev; |
191 | urb->context = dev; | 187 | urb->context = dev; |
192 | urb->pipe = | 188 | urb->pipe = usb_rcvisocpipe(dev->udev, dev->adev.end_point_addr); |
193 | usb_rcvisocpipe(dev->udev, dev->adev.end_point_addr); | ||
194 | urb->transfer_flags = URB_ISO_ASAP; | 189 | urb->transfer_flags = URB_ISO_ASAP; |
195 | urb->transfer_buffer = dev->adev.transfer_buffer[i]; | 190 | urb->transfer_buffer = dev->adev.transfer_buffer[i]; |
196 | urb->interval = 1; | 191 | urb->interval = 1; |
@@ -198,8 +193,7 @@ static int cx231xx_init_audio_isoc(struct cx231xx *dev) | |||
198 | urb->number_of_packets = CX231XX_NUM_AUDIO_PACKETS; | 193 | urb->number_of_packets = CX231XX_NUM_AUDIO_PACKETS; |
199 | urb->transfer_buffer_length = sb_size; | 194 | urb->transfer_buffer_length = sb_size; |
200 | 195 | ||
201 | for (j = k = 0; j < CX231XX_NUM_AUDIO_PACKETS; | 196 | for (j = k = 0; j < CX231XX_NUM_AUDIO_PACKETS; j++, k += dev->adev.max_pkt_size) { |
202 | j++, k += dev->adev.max_pkt_size) { | ||
203 | urb->iso_frame_desc[j].offset = k; | 197 | urb->iso_frame_desc[j].offset = k; |
204 | urb->iso_frame_desc[j].length = dev->adev.max_pkt_size; | 198 | urb->iso_frame_desc[j].length = dev->adev.max_pkt_size; |
205 | } | 199 | } |
@@ -275,10 +269,10 @@ static struct snd_pcm_hardware snd_cx231xx_hw_capture = { | |||
275 | .channels_min = 2, | 269 | .channels_min = 2, |
276 | .channels_max = 2, | 270 | .channels_max = 2, |
277 | .buffer_bytes_max = 62720 * 8, /* just about the value in usbaudio.c */ | 271 | .buffer_bytes_max = 62720 * 8, /* just about the value in usbaudio.c */ |
278 | .period_bytes_min = 64, /* 12544/2, */ | 272 | .period_bytes_min = 64, /* 12544/2, */ |
279 | .period_bytes_max = 12544, | 273 | .period_bytes_max = 12544, |
280 | .periods_min = 2, | 274 | .periods_min = 2, |
281 | .periods_max = 98, /* 12544, */ | 275 | .periods_max = 98, /* 12544, */ |
282 | }; | 276 | }; |
283 | 277 | ||
284 | static int snd_cx231xx_capture_open(struct snd_pcm_substream *substream) | 278 | static int snd_cx231xx_capture_open(struct snd_pcm_substream *substream) |
@@ -477,9 +471,8 @@ static int cx231xx_audio_init(struct cx231xx *dev) | |||
477 | "non standard usbaudio\n"); | 471 | "non standard usbaudio\n"); |
478 | 472 | ||
479 | card = snd_card_new(index[devnr], "Cx231xx Audio", THIS_MODULE, 0); | 473 | card = snd_card_new(index[devnr], "Cx231xx Audio", THIS_MODULE, 0); |
480 | if (card == NULL) { | 474 | if (card == NULL) |
481 | return -ENOMEM; | 475 | return -ENOMEM; |
482 | } | ||
483 | 476 | ||
484 | spin_lock_init(&adev->slock); | 477 | spin_lock_init(&adev->slock); |
485 | err = snd_pcm_new(card, "Cx231xx Audio", 0, 0, 1, &pcm); | 478 | err = snd_pcm_new(card, "Cx231xx Audio", 0, 0, 1, &pcm); |
diff --git a/drivers/media/video/cx231xx/cx231xx-avcore.c b/drivers/media/video/cx231xx/cx231xx-avcore.c index 3c09b9473843..bbfc78ebd94b 100644 --- a/drivers/media/video/cx231xx/cx231xx-avcore.c +++ b/drivers/media/video/cx231xx/cx231xx-avcore.c | |||
@@ -1,5 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | cx231xx_avcore.c - driver for Conexant Cx23100/101/102 USB video capture devices | 2 | cx231xx_avcore.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 | 6 | ||
@@ -38,9 +39,9 @@ | |||
38 | 39 | ||
39 | #include "cx231xx.h" | 40 | #include "cx231xx.h" |
40 | 41 | ||
41 | /************************************************************************************* | 42 | /****************************************************************************** |
42 | * C O L I B R I - B L O C K C O N T R O L functions * | 43 | * C O L I B R I - B L O C K C O N T R O L functions * |
43 | *************************************************************************************/ | 44 | ********************************************************************* ********/ |
44 | int cx231xx_colibri_init_super_block(struct cx231xx *dev, u32 ref_count) | 45 | int cx231xx_colibri_init_super_block(struct cx231xx *dev, u32 ref_count) |
45 | { | 46 | { |
46 | int status = 0; | 47 | int status = 0; |
@@ -50,42 +51,35 @@ int cx231xx_colibri_init_super_block(struct cx231xx *dev, u32 ref_count) | |||
50 | 51 | ||
51 | /* super block initialize */ | 52 | /* super block initialize */ |
52 | temp = (u8) (ref_count & 0xff); | 53 | temp = (u8) (ref_count & 0xff); |
53 | status = | 54 | status = cx231xx_write_i2c_data(dev, Colibri_DEVICE_ADDRESS, |
54 | cx231xx_write_i2c_data(dev, Colibri_DEVICE_ADDRESS, SUP_BLK_TUNE2, | 55 | SUP_BLK_TUNE2, 2, temp, 1); |
55 | 2, temp, 1); | ||
56 | 56 | ||
57 | status = | 57 | status = cx231xx_read_i2c_data(dev, Colibri_DEVICE_ADDRESS, |
58 | cx231xx_read_i2c_data(dev, Colibri_DEVICE_ADDRESS, SUP_BLK_TUNE2, 2, | 58 | SUP_BLK_TUNE2, 2, |
59 | &colibri_power_status, 1); | 59 | &colibri_power_status, 1); |
60 | 60 | ||
61 | temp = (u8) ((ref_count & 0x300) >> 8); | 61 | temp = (u8) ((ref_count & 0x300) >> 8); |
62 | temp |= 0x40; | 62 | temp |= 0x40; |
63 | status = | 63 | status = cx231xx_write_i2c_data(dev, Colibri_DEVICE_ADDRESS, |
64 | cx231xx_write_i2c_data(dev, Colibri_DEVICE_ADDRESS, SUP_BLK_TUNE1, | 64 | SUP_BLK_TUNE1, 2, temp, 1); |
65 | 2, temp, 1); | 65 | status = cx231xx_write_i2c_data(dev, Colibri_DEVICE_ADDRESS, |
66 | status = | 66 | SUP_BLK_PLL2, 2, 0x0f, 1); |
67 | cx231xx_write_i2c_data(dev, Colibri_DEVICE_ADDRESS, SUP_BLK_PLL2, 2, | ||
68 | 0x0f, 1); | ||
69 | 67 | ||
70 | /* enable pll */ | 68 | /* enable pll */ |
71 | while (colibri_power_status != 0x18) { | 69 | while (colibri_power_status != 0x18) { |
72 | status = | 70 | status = cx231xx_write_i2c_data(dev, Colibri_DEVICE_ADDRESS, |
73 | cx231xx_write_i2c_data(dev, Colibri_DEVICE_ADDRESS, | 71 | SUP_BLK_PWRDN, 2, 0x18, 1); |
74 | SUP_BLK_PWRDN, 2, 0x18, 1); | 72 | status = cx231xx_read_i2c_data(dev, Colibri_DEVICE_ADDRESS, |
75 | status = | 73 | SUP_BLK_PWRDN, 2, |
76 | cx231xx_read_i2c_data(dev, Colibri_DEVICE_ADDRESS, | 74 | &colibri_power_status, 1); |
77 | SUP_BLK_PWRDN, 2, | ||
78 | &colibri_power_status, 1); | ||
79 | colibri_power_status &= 0xff; | 75 | colibri_power_status &= 0xff; |
80 | if (status < 0) { | 76 | if (status < 0) { |
81 | cx231xx_info | 77 | cx231xx_info(": Init Super Block failed in sending/receiving cmds\n"); |
82 | (": Init Super Block failed in sending/receiving cmds\n"); | ||
83 | break; | 78 | break; |
84 | } | 79 | } |
85 | i++; | 80 | i++; |
86 | if (i == 10) { | 81 | if (i == 10) { |
87 | cx231xx_info | 82 | cx231xx_info(": Init Super Block force break in loop !!!!\n"); |
88 | (": Init Super Block force break in loop !!!!\n"); | ||
89 | status = -1; | 83 | status = -1; |
90 | break; | 84 | break; |
91 | } | 85 | } |
@@ -95,9 +89,8 @@ int cx231xx_colibri_init_super_block(struct cx231xx *dev, u32 ref_count) | |||
95 | return status; | 89 | return status; |
96 | 90 | ||
97 | /* start tuning filter */ | 91 | /* start tuning filter */ |
98 | status = | 92 | status = cx231xx_write_i2c_data(dev, Colibri_DEVICE_ADDRESS, |
99 | cx231xx_write_i2c_data(dev, Colibri_DEVICE_ADDRESS, SUP_BLK_TUNE3, | 93 | SUP_BLK_TUNE3, 2, 0x40, 1); |
100 | 2, 0x40, 1); | ||
101 | msleep(5); | 94 | msleep(5); |
102 | 95 | ||
103 | /* exit tuning */ | 96 | /* exit tuning */ |
@@ -113,86 +106,64 @@ int cx231xx_colibri_init_channels(struct cx231xx *dev) | |||
113 | int status = 0; | 106 | int status = 0; |
114 | 107 | ||
115 | /* power up all 3 channels, clear pd_buffer */ | 108 | /* power up all 3 channels, clear pd_buffer */ |
116 | status = | 109 | status = cx231xx_write_i2c_data(dev, Colibri_DEVICE_ADDRESS, |
117 | cx231xx_write_i2c_data(dev, Colibri_DEVICE_ADDRESS, | ||
118 | ADC_PWRDN_CLAMP_CH1, 2, 0x00, 1); | 110 | ADC_PWRDN_CLAMP_CH1, 2, 0x00, 1); |
119 | status = | 111 | status = cx231xx_write_i2c_data(dev, Colibri_DEVICE_ADDRESS, |
120 | cx231xx_write_i2c_data(dev, Colibri_DEVICE_ADDRESS, | ||
121 | ADC_PWRDN_CLAMP_CH2, 2, 0x00, 1); | 112 | ADC_PWRDN_CLAMP_CH2, 2, 0x00, 1); |
122 | status = | 113 | status = cx231xx_write_i2c_data(dev, Colibri_DEVICE_ADDRESS, |
123 | cx231xx_write_i2c_data(dev, Colibri_DEVICE_ADDRESS, | ||
124 | ADC_PWRDN_CLAMP_CH3, 2, 0x00, 1); | 114 | ADC_PWRDN_CLAMP_CH3, 2, 0x00, 1); |
125 | 115 | ||
126 | /* Enable quantizer calibration */ | 116 | /* Enable quantizer calibration */ |
127 | status = | 117 | status = cx231xx_write_i2c_data(dev, Colibri_DEVICE_ADDRESS, |
128 | cx231xx_write_i2c_data(dev, Colibri_DEVICE_ADDRESS, ADC_COM_QUANT, | 118 | ADC_COM_QUANT, 2, 0x02, 1); |
129 | 2, 0x02, 1); | ||
130 | 119 | ||
131 | /* channel initialize, force modulator (fb) reset */ | 120 | /* channel initialize, force modulator (fb) reset */ |
132 | status = | 121 | status = cx231xx_write_i2c_data(dev, Colibri_DEVICE_ADDRESS, |
133 | cx231xx_write_i2c_data(dev, Colibri_DEVICE_ADDRESS, | ||
134 | ADC_FB_FRCRST_CH1, 2, 0x17, 1); | 122 | ADC_FB_FRCRST_CH1, 2, 0x17, 1); |
135 | status = | 123 | status = cx231xx_write_i2c_data(dev, Colibri_DEVICE_ADDRESS, |
136 | cx231xx_write_i2c_data(dev, Colibri_DEVICE_ADDRESS, | ||
137 | ADC_FB_FRCRST_CH2, 2, 0x17, 1); | 124 | ADC_FB_FRCRST_CH2, 2, 0x17, 1); |
138 | status = | 125 | status = cx231xx_write_i2c_data(dev, Colibri_DEVICE_ADDRESS, |
139 | cx231xx_write_i2c_data(dev, Colibri_DEVICE_ADDRESS, | ||
140 | ADC_FB_FRCRST_CH3, 2, 0x17, 1); | 126 | ADC_FB_FRCRST_CH3, 2, 0x17, 1); |
141 | 127 | ||
142 | /* start quantilizer calibration */ | 128 | /* start quantilizer calibration */ |
143 | status = | 129 | status = cx231xx_write_i2c_data(dev, Colibri_DEVICE_ADDRESS, |
144 | cx231xx_write_i2c_data(dev, Colibri_DEVICE_ADDRESS, | ||
145 | ADC_CAL_ATEST_CH1, 2, 0x10, 1); | 130 | ADC_CAL_ATEST_CH1, 2, 0x10, 1); |
146 | status = | 131 | status = cx231xx_write_i2c_data(dev, Colibri_DEVICE_ADDRESS, |
147 | cx231xx_write_i2c_data(dev, Colibri_DEVICE_ADDRESS, | ||
148 | ADC_CAL_ATEST_CH2, 2, 0x10, 1); | 132 | ADC_CAL_ATEST_CH2, 2, 0x10, 1); |
149 | status = | 133 | status = cx231xx_write_i2c_data(dev, Colibri_DEVICE_ADDRESS, |
150 | cx231xx_write_i2c_data(dev, Colibri_DEVICE_ADDRESS, | ||
151 | ADC_CAL_ATEST_CH3, 2, 0x10, 1); | 134 | ADC_CAL_ATEST_CH3, 2, 0x10, 1); |
152 | msleep(5); | 135 | msleep(5); |
153 | 136 | ||
154 | /* exit modulator (fb) reset */ | 137 | /* exit modulator (fb) reset */ |
155 | status = | 138 | status = cx231xx_write_i2c_data(dev, Colibri_DEVICE_ADDRESS, |
156 | cx231xx_write_i2c_data(dev, Colibri_DEVICE_ADDRESS, | ||
157 | ADC_FB_FRCRST_CH1, 2, 0x07, 1); | 139 | ADC_FB_FRCRST_CH1, 2, 0x07, 1); |
158 | status = | 140 | status = cx231xx_write_i2c_data(dev, Colibri_DEVICE_ADDRESS, |
159 | cx231xx_write_i2c_data(dev, Colibri_DEVICE_ADDRESS, | ||
160 | ADC_FB_FRCRST_CH2, 2, 0x07, 1); | 141 | ADC_FB_FRCRST_CH2, 2, 0x07, 1); |
161 | status = | 142 | status = cx231xx_write_i2c_data(dev, Colibri_DEVICE_ADDRESS, |
162 | cx231xx_write_i2c_data(dev, Colibri_DEVICE_ADDRESS, | ||
163 | ADC_FB_FRCRST_CH3, 2, 0x07, 1); | 143 | ADC_FB_FRCRST_CH3, 2, 0x07, 1); |
164 | 144 | ||
165 | /* enable the pre_clamp in each channel for single-ended input */ | 145 | /* enable the pre_clamp in each channel for single-ended input */ |
166 | status = | 146 | status = cx231xx_write_i2c_data(dev, Colibri_DEVICE_ADDRESS, |
167 | cx231xx_write_i2c_data(dev, Colibri_DEVICE_ADDRESS, | ||
168 | ADC_NTF_PRECLMP_EN_CH1, 2, 0xf0, 1); | 147 | ADC_NTF_PRECLMP_EN_CH1, 2, 0xf0, 1); |
169 | status = | 148 | status = cx231xx_write_i2c_data(dev, Colibri_DEVICE_ADDRESS, |
170 | cx231xx_write_i2c_data(dev, Colibri_DEVICE_ADDRESS, | ||
171 | ADC_NTF_PRECLMP_EN_CH2, 2, 0xf0, 1); | 149 | ADC_NTF_PRECLMP_EN_CH2, 2, 0xf0, 1); |
172 | status = | 150 | status = cx231xx_write_i2c_data(dev, Colibri_DEVICE_ADDRESS, |
173 | cx231xx_write_i2c_data(dev, Colibri_DEVICE_ADDRESS, | ||
174 | ADC_NTF_PRECLMP_EN_CH3, 2, 0xf0, 1); | 151 | ADC_NTF_PRECLMP_EN_CH3, 2, 0xf0, 1); |
175 | 152 | ||
176 | /* use diode instead of resistor, so set term_en to 0, res_en to 0 */ | 153 | /* use diode instead of resistor, so set term_en to 0, res_en to 0 */ |
177 | status = | 154 | status = cx231xx_reg_mask_write(dev, Colibri_DEVICE_ADDRESS, 8, |
178 | cx231xx_reg_mask_write(dev, Colibri_DEVICE_ADDRESS, 8, | ||
179 | ADC_QGAIN_RES_TRM_CH1, 3, 7, 0x00); | 155 | ADC_QGAIN_RES_TRM_CH1, 3, 7, 0x00); |
180 | status = | 156 | status = cx231xx_reg_mask_write(dev, Colibri_DEVICE_ADDRESS, 8, |
181 | cx231xx_reg_mask_write(dev, Colibri_DEVICE_ADDRESS, 8, | ||
182 | ADC_QGAIN_RES_TRM_CH2, 3, 7, 0x00); | 157 | ADC_QGAIN_RES_TRM_CH2, 3, 7, 0x00); |
183 | status = | 158 | status = cx231xx_reg_mask_write(dev, Colibri_DEVICE_ADDRESS, 8, |
184 | cx231xx_reg_mask_write(dev, Colibri_DEVICE_ADDRESS, 8, | ||
185 | ADC_QGAIN_RES_TRM_CH3, 3, 7, 0x00); | 159 | ADC_QGAIN_RES_TRM_CH3, 3, 7, 0x00); |
186 | 160 | ||
187 | /* dynamic element matching off */ | 161 | /* dynamic element matching off */ |
188 | status = | 162 | status = cx231xx_write_i2c_data(dev, Colibri_DEVICE_ADDRESS, |
189 | cx231xx_write_i2c_data(dev, Colibri_DEVICE_ADDRESS, | ||
190 | ADC_DCSERVO_DEM_CH1, 2, 0x03, 1); | 163 | ADC_DCSERVO_DEM_CH1, 2, 0x03, 1); |
191 | status = | 164 | status = cx231xx_write_i2c_data(dev, Colibri_DEVICE_ADDRESS, |
192 | cx231xx_write_i2c_data(dev, Colibri_DEVICE_ADDRESS, | ||
193 | ADC_DCSERVO_DEM_CH2, 2, 0x03, 1); | 165 | ADC_DCSERVO_DEM_CH2, 2, 0x03, 1); |
194 | status = | 166 | status = cx231xx_write_i2c_data(dev, Colibri_DEVICE_ADDRESS, |
195 | cx231xx_write_i2c_data(dev, Colibri_DEVICE_ADDRESS, | ||
196 | ADC_DCSERVO_DEM_CH3, 2, 0x03, 1); | 167 | ADC_DCSERVO_DEM_CH3, 2, 0x03, 1); |
197 | 168 | ||
198 | return status; | 169 | return status; |
@@ -235,8 +206,7 @@ int cx231xx_colibri_set_input_mux(struct cx231xx *dev, u32 input_mux) | |||
235 | value &= (!INPUT_SEL_MASK); | 206 | value &= (!INPUT_SEL_MASK); |
236 | value |= (ch1_setting - 1) << 4; | 207 | value |= (ch1_setting - 1) << 4; |
237 | value &= 0xff; | 208 | value &= 0xff; |
238 | status = | 209 | status = cx231xx_write_i2c_data(dev, Colibri_DEVICE_ADDRESS, |
239 | cx231xx_write_i2c_data(dev, Colibri_DEVICE_ADDRESS, | ||
240 | ADC_INPUT_CH1, 2, value, 1); | 210 | ADC_INPUT_CH1, 2, value, 1); |
241 | } | 211 | } |
242 | 212 | ||
@@ -247,21 +217,19 @@ int cx231xx_colibri_set_input_mux(struct cx231xx *dev, u32 input_mux) | |||
247 | value &= (!INPUT_SEL_MASK); | 217 | value &= (!INPUT_SEL_MASK); |
248 | value |= (ch2_setting - 1) << 4; | 218 | value |= (ch2_setting - 1) << 4; |
249 | value &= 0xff; | 219 | value &= 0xff; |
250 | status = | 220 | status = cx231xx_write_i2c_data(dev, Colibri_DEVICE_ADDRESS, |
251 | cx231xx_write_i2c_data(dev, Colibri_DEVICE_ADDRESS, | ||
252 | ADC_INPUT_CH2, 2, value, 1); | 221 | ADC_INPUT_CH2, 2, value, 1); |
253 | } | 222 | } |
254 | 223 | ||
255 | /* For ch3_setting, the value to put in the register is 7 less than the input number */ | 224 | /* For ch3_setting, the value to put in the register is |
225 | 7 less than the input number */ | ||
256 | if (ch3_setting != 0) { | 226 | if (ch3_setting != 0) { |
257 | status = | 227 | status = cx231xx_read_i2c_data(dev, Colibri_DEVICE_ADDRESS, |
258 | cx231xx_read_i2c_data(dev, Colibri_DEVICE_ADDRESS, | ||
259 | ADC_INPUT_CH3, 2, &value, 1); | 228 | ADC_INPUT_CH3, 2, &value, 1); |
260 | value &= (!INPUT_SEL_MASK); | 229 | value &= (!INPUT_SEL_MASK); |
261 | value |= (ch3_setting - 1) << 4; | 230 | value |= (ch3_setting - 1) << 4; |
262 | value &= 0xff; | 231 | value &= 0xff; |
263 | status = | 232 | status = cx231xx_write_i2c_data(dev, Colibri_DEVICE_ADDRESS, |
264 | cx231xx_write_i2c_data(dev, Colibri_DEVICE_ADDRESS, | ||
265 | ADC_INPUT_CH3, 2, value, 1); | 233 | ADC_INPUT_CH3, 2, value, 1); |
266 | } | 234 | } |
267 | 235 | ||
@@ -290,12 +258,9 @@ int cx231xx_colibri_set_mode(struct cx231xx *dev, enum AFE_MODE mode) | |||
290 | break; | 258 | break; |
291 | } | 259 | } |
292 | 260 | ||
293 | if ((mode != dev->colibri_mode) | 261 | if ((mode != dev->colibri_mode) && (dev->video_input == CX231XX_VMUX_TELEVISION)) |
294 | && (dev->video_input == CX231XX_VMUX_TELEVISION)) { | 262 | status = cx231xx_colibri_adjust_ref_count(dev, |
295 | status = | ||
296 | cx231xx_colibri_adjust_ref_count(dev, | ||
297 | CX231XX_VMUX_TELEVISION); | 263 | CX231XX_VMUX_TELEVISION); |
298 | } | ||
299 | 264 | ||
300 | dev->colibri_mode = mode; | 265 | dev->colibri_mode = mode; |
301 | 266 | ||
@@ -314,84 +279,80 @@ int cx231xx_colibri_update_power_control(struct cx231xx *dev, AV_MODE avmode) | |||
314 | 279 | ||
315 | if (avmode == POLARIS_AVMODE_ANALOGT_TV) { | 280 | if (avmode == POLARIS_AVMODE_ANALOGT_TV) { |
316 | while (colibri_power_status != 0x18) { | 281 | while (colibri_power_status != 0x18) { |
317 | status = | 282 | status = cx231xx_write_i2c_data(dev, |
318 | cx231xx_write_i2c_data(dev, | 283 | Colibri_DEVICE_ADDRESS, |
319 | Colibri_DEVICE_ADDRESS, | 284 | SUP_BLK_PWRDN, 2, |
320 | SUP_BLK_PWRDN, 2, | 285 | 0x18, 1); |
321 | 0x18, 1); | 286 | status = cx231xx_read_i2c_data(dev, |
322 | status = | 287 | Colibri_DEVICE_ADDRESS, |
323 | cx231xx_read_i2c_data(dev, | 288 | SUP_BLK_PWRDN, 2, |
324 | Colibri_DEVICE_ADDRESS, | 289 | &colibri_power_status, |
325 | SUP_BLK_PWRDN, 2, | 290 | 1); |
326 | &colibri_power_status, | ||
327 | 1); | ||
328 | if (status < 0) | 291 | if (status < 0) |
329 | break; | 292 | break; |
330 | } | 293 | } |
331 | 294 | ||
332 | status = | 295 | status = cx231xx_write_i2c_data(dev, |
333 | cx231xx_write_i2c_data(dev, Colibri_DEVICE_ADDRESS, | 296 | Colibri_DEVICE_ADDRESS, |
334 | ADC_PWRDN_CLAMP_CH1, 2, 0x00, | 297 | ADC_PWRDN_CLAMP_CH1, 2, 0x00, |
335 | 1); | 298 | 1); |
336 | status = | 299 | status = cx231xx_write_i2c_data(dev, |
337 | cx231xx_write_i2c_data(dev, Colibri_DEVICE_ADDRESS, | 300 | Colibri_DEVICE_ADDRESS, |
338 | ADC_PWRDN_CLAMP_CH2, 2, 0x00, | 301 | ADC_PWRDN_CLAMP_CH2, 2, 0x00, |
339 | 1); | 302 | 1); |
340 | status = | 303 | status = cx231xx_write_i2c_data(dev, |
341 | cx231xx_write_i2c_data(dev, Colibri_DEVICE_ADDRESS, | 304 | Colibri_DEVICE_ADDRESS, |
342 | ADC_PWRDN_CLAMP_CH3, 2, 0x00, | 305 | ADC_PWRDN_CLAMP_CH3, 2, 0x00, |
343 | 1); | 306 | 1); |
344 | } else if (avmode == POLARIS_AVMODE_DIGITAL) { | 307 | } else if (avmode == POLARIS_AVMODE_DIGITAL) { |
345 | status = | 308 | status = cx231xx_write_i2c_data(dev, |
346 | cx231xx_write_i2c_data(dev, Colibri_DEVICE_ADDRESS, | 309 | Colibri_DEVICE_ADDRESS, |
347 | ADC_PWRDN_CLAMP_CH1, 2, 0x70, | 310 | ADC_PWRDN_CLAMP_CH1, 2, 0x70, |
348 | 1); | 311 | 1); |
349 | status = | 312 | status = cx231xx_write_i2c_data(dev, |
350 | cx231xx_write_i2c_data(dev, Colibri_DEVICE_ADDRESS, | 313 | Colibri_DEVICE_ADDRESS, |
351 | ADC_PWRDN_CLAMP_CH2, 2, 0x70, | 314 | ADC_PWRDN_CLAMP_CH2, 2, 0x70, |
352 | 1); | 315 | 1); |
353 | status = | 316 | status = cx231xx_write_i2c_data(dev, |
354 | cx231xx_write_i2c_data(dev, Colibri_DEVICE_ADDRESS, | 317 | Colibri_DEVICE_ADDRESS, |
355 | ADC_PWRDN_CLAMP_CH3, 2, 0x70, | 318 | ADC_PWRDN_CLAMP_CH3, 2, 0x70, |
356 | 1); | 319 | 1); |
357 | 320 | ||
358 | status = | 321 | status = cx231xx_read_i2c_data(dev, |
359 | cx231xx_read_i2c_data(dev, Colibri_DEVICE_ADDRESS, | 322 | Colibri_DEVICE_ADDRESS, |
360 | SUP_BLK_PWRDN, 2, | 323 | SUP_BLK_PWRDN, 2, |
361 | &colibri_power_status, 1); | 324 | &colibri_power_status, 1); |
362 | colibri_power_status |= 0x07; | 325 | colibri_power_status |= 0x07; |
363 | status = | 326 | status = cx231xx_write_i2c_data(dev, |
364 | cx231xx_write_i2c_data(dev, Colibri_DEVICE_ADDRESS, | 327 | Colibri_DEVICE_ADDRESS, |
365 | SUP_BLK_PWRDN, 2, | 328 | SUP_BLK_PWRDN, 2, |
366 | colibri_power_status, 1); | 329 | colibri_power_status, 1); |
367 | } else if (avmode == POLARIS_AVMODE_ENXTERNAL_AV) { | 330 | } else if (avmode == POLARIS_AVMODE_ENXTERNAL_AV) { |
368 | 331 | ||
369 | while (colibri_power_status != 0x18) { | 332 | while (colibri_power_status != 0x18) { |
370 | status = | 333 | status = cx231xx_write_i2c_data(dev, |
371 | cx231xx_write_i2c_data(dev, | 334 | Colibri_DEVICE_ADDRESS, |
372 | Colibri_DEVICE_ADDRESS, | 335 | SUP_BLK_PWRDN, 2, |
373 | SUP_BLK_PWRDN, 2, | 336 | 0x18, 1); |
374 | 0x18, 1); | 337 | status = cx231xx_read_i2c_data(dev, |
375 | status = | 338 | Colibri_DEVICE_ADDRESS, |
376 | cx231xx_read_i2c_data(dev, | 339 | SUP_BLK_PWRDN, 2, |
377 | Colibri_DEVICE_ADDRESS, | 340 | &colibri_power_status, |
378 | SUP_BLK_PWRDN, 2, | 341 | 1); |
379 | &colibri_power_status, | ||
380 | 1); | ||
381 | if (status < 0) | 342 | if (status < 0) |
382 | break; | 343 | break; |
383 | } | 344 | } |
384 | 345 | ||
385 | status = | 346 | status = cx231xx_write_i2c_data(dev, |
386 | cx231xx_write_i2c_data(dev, Colibri_DEVICE_ADDRESS, | 347 | Colibri_DEVICE_ADDRESS, |
387 | ADC_PWRDN_CLAMP_CH1, 2, 0x00, | 348 | ADC_PWRDN_CLAMP_CH1, 2, 0x00, |
388 | 1); | 349 | 1); |
389 | status = | 350 | status = cx231xx_write_i2c_data(dev, |
390 | cx231xx_write_i2c_data(dev, Colibri_DEVICE_ADDRESS, | 351 | Colibri_DEVICE_ADDRESS, |
391 | ADC_PWRDN_CLAMP_CH2, 2, 0x00, | 352 | ADC_PWRDN_CLAMP_CH2, 2, 0x00, |
392 | 1); | 353 | 1); |
393 | status = | 354 | status = cx231xx_write_i2c_data(dev, |
394 | cx231xx_write_i2c_data(dev, Colibri_DEVICE_ADDRESS, | 355 | Colibri_DEVICE_ADDRESS, |
395 | ADC_PWRDN_CLAMP_CH3, 2, 0x00, | 356 | ADC_PWRDN_CLAMP_CH3, 2, 0x00, |
396 | 1); | 357 | 1); |
397 | } else { | 358 | } else { |
@@ -402,85 +363,83 @@ int cx231xx_colibri_update_power_control(struct cx231xx *dev, AV_MODE avmode) | |||
402 | default: | 363 | default: |
403 | if (avmode == POLARIS_AVMODE_ANALOGT_TV) { | 364 | if (avmode == POLARIS_AVMODE_ANALOGT_TV) { |
404 | while (colibri_power_status != 0x18) { | 365 | while (colibri_power_status != 0x18) { |
405 | status = | 366 | status = cx231xx_write_i2c_data(dev, |
406 | cx231xx_write_i2c_data(dev, | 367 | Colibri_DEVICE_ADDRESS, |
407 | Colibri_DEVICE_ADDRESS, | 368 | SUP_BLK_PWRDN, 2, |
408 | SUP_BLK_PWRDN, 2, | 369 | 0x18, 1); |
409 | 0x18, 1); | 370 | status = cx231xx_read_i2c_data(dev, |
410 | status = | 371 | Colibri_DEVICE_ADDRESS, |
411 | cx231xx_read_i2c_data(dev, | 372 | SUP_BLK_PWRDN, 2, |
412 | Colibri_DEVICE_ADDRESS, | 373 | &colibri_power_status, |
413 | SUP_BLK_PWRDN, 2, | 374 | 1); |
414 | &colibri_power_status, | ||
415 | 1); | ||
416 | if (status < 0) | 375 | if (status < 0) |
417 | break; | 376 | break; |
418 | } | 377 | } |
419 | 378 | ||
420 | status = | 379 | status = cx231xx_write_i2c_data(dev, |
421 | cx231xx_write_i2c_data(dev, Colibri_DEVICE_ADDRESS, | 380 | Colibri_DEVICE_ADDRESS, |
422 | ADC_PWRDN_CLAMP_CH1, 2, 0x40, | 381 | ADC_PWRDN_CLAMP_CH1, 2, |
423 | 1); | 382 | 0x40, 1); |
424 | status = | 383 | status = cx231xx_write_i2c_data(dev, |
425 | cx231xx_write_i2c_data(dev, Colibri_DEVICE_ADDRESS, | 384 | Colibri_DEVICE_ADDRESS, |
426 | ADC_PWRDN_CLAMP_CH2, 2, 0x40, | 385 | ADC_PWRDN_CLAMP_CH2, 2, |
427 | 1); | 386 | 0x40, 1); |
428 | status = | 387 | status = cx231xx_write_i2c_data(dev, |
429 | cx231xx_write_i2c_data(dev, Colibri_DEVICE_ADDRESS, | 388 | Colibri_DEVICE_ADDRESS, |
430 | ADC_PWRDN_CLAMP_CH3, 2, 0x00, | 389 | ADC_PWRDN_CLAMP_CH3, 2, |
431 | 1); | 390 | 0x00, 1); |
432 | } else if (avmode == POLARIS_AVMODE_DIGITAL) { | 391 | } else if (avmode == POLARIS_AVMODE_DIGITAL) { |
433 | status = | 392 | status = cx231xx_write_i2c_data(dev, |
434 | cx231xx_write_i2c_data(dev, Colibri_DEVICE_ADDRESS, | 393 | Colibri_DEVICE_ADDRESS, |
435 | ADC_PWRDN_CLAMP_CH1, 2, 0x70, | 394 | ADC_PWRDN_CLAMP_CH1, 2, |
436 | 1); | 395 | 0x70, 1); |
437 | status = | 396 | status = cx231xx_write_i2c_data(dev, |
438 | cx231xx_write_i2c_data(dev, Colibri_DEVICE_ADDRESS, | 397 | Colibri_DEVICE_ADDRESS, |
439 | ADC_PWRDN_CLAMP_CH2, 2, 0x70, | 398 | ADC_PWRDN_CLAMP_CH2, 2, |
440 | 1); | 399 | 0x70, 1); |
441 | status = | 400 | status = cx231xx_write_i2c_data(dev, |
442 | cx231xx_write_i2c_data(dev, Colibri_DEVICE_ADDRESS, | 401 | Colibri_DEVICE_ADDRESS, |
443 | ADC_PWRDN_CLAMP_CH3, 2, 0x70, | 402 | ADC_PWRDN_CLAMP_CH3, 2, |
444 | 1); | 403 | 0x70, 1); |
445 | 404 | ||
446 | status = | 405 | status = cx231xx_read_i2c_data(dev, |
447 | cx231xx_read_i2c_data(dev, Colibri_DEVICE_ADDRESS, | 406 | Colibri_DEVICE_ADDRESS, |
448 | SUP_BLK_PWRDN, 2, | 407 | SUP_BLK_PWRDN, 2, |
449 | &colibri_power_status, 1); | 408 | &colibri_power_status, |
409 | 1); | ||
450 | colibri_power_status |= 0x07; | 410 | colibri_power_status |= 0x07; |
451 | status = | 411 | status = cx231xx_write_i2c_data(dev, |
452 | cx231xx_write_i2c_data(dev, Colibri_DEVICE_ADDRESS, | 412 | Colibri_DEVICE_ADDRESS, |
453 | SUP_BLK_PWRDN, 2, | 413 | SUP_BLK_PWRDN, 2, |
454 | colibri_power_status, 1); | 414 | colibri_power_status, |
415 | 1); | ||
455 | } else if (avmode == POLARIS_AVMODE_ENXTERNAL_AV) { | 416 | } else if (avmode == POLARIS_AVMODE_ENXTERNAL_AV) { |
456 | while (colibri_power_status != 0x18) { | 417 | while (colibri_power_status != 0x18) { |
457 | status = | 418 | status = cx231xx_write_i2c_data(dev, |
458 | cx231xx_write_i2c_data(dev, | 419 | Colibri_DEVICE_ADDRESS, |
459 | Colibri_DEVICE_ADDRESS, | 420 | SUP_BLK_PWRDN, 2, |
460 | SUP_BLK_PWRDN, 2, | 421 | 0x18, 1); |
461 | 0x18, 1); | 422 | status = cx231xx_read_i2c_data(dev, |
462 | status = | 423 | Colibri_DEVICE_ADDRESS, |
463 | cx231xx_read_i2c_data(dev, | 424 | SUP_BLK_PWRDN, 2, |
464 | Colibri_DEVICE_ADDRESS, | 425 | &colibri_power_status, |
465 | SUP_BLK_PWRDN, 2, | 426 | 1); |
466 | &colibri_power_status, | ||
467 | 1); | ||
468 | if (status < 0) | 427 | if (status < 0) |
469 | break; | 428 | break; |
470 | } | 429 | } |
471 | 430 | ||
472 | status = | 431 | status = cx231xx_write_i2c_data(dev, |
473 | cx231xx_write_i2c_data(dev, Colibri_DEVICE_ADDRESS, | 432 | Colibri_DEVICE_ADDRESS, |
474 | ADC_PWRDN_CLAMP_CH1, 2, 0x00, | 433 | ADC_PWRDN_CLAMP_CH1, 2, |
475 | 1); | 434 | 0x00, 1); |
476 | status = | 435 | status = cx231xx_write_i2c_data(dev, |
477 | cx231xx_write_i2c_data(dev, Colibri_DEVICE_ADDRESS, | 436 | Colibri_DEVICE_ADDRESS, |
478 | ADC_PWRDN_CLAMP_CH2, 2, 0x00, | 437 | ADC_PWRDN_CLAMP_CH2, 2, |
479 | 1); | 438 | 0x00, 1); |
480 | status = | 439 | status = cx231xx_write_i2c_data(dev, |
481 | cx231xx_write_i2c_data(dev, Colibri_DEVICE_ADDRESS, | 440 | Colibri_DEVICE_ADDRESS, |
482 | ADC_PWRDN_CLAMP_CH3, 2, 0x40, | 441 | ADC_PWRDN_CLAMP_CH3, 2, |
483 | 1); | 442 | 0x40, 1); |
484 | } else { | 443 | } else { |
485 | cx231xx_info("Invalid AV mode input\n"); | 444 | cx231xx_info("Invalid AV mode input\n"); |
486 | status = -1; | 445 | status = -1; |
@@ -499,19 +458,15 @@ int cx231xx_colibri_adjust_ref_count(struct cx231xx *dev, u32 video_input) | |||
499 | dev->video_input = video_input; | 458 | dev->video_input = video_input; |
500 | 459 | ||
501 | if (video_input == CX231XX_VMUX_TELEVISION) { | 460 | if (video_input == CX231XX_VMUX_TELEVISION) { |
502 | status = | 461 | status = cx231xx_read_i2c_data(dev, Colibri_DEVICE_ADDRESS, |
503 | cx231xx_read_i2c_data(dev, Colibri_DEVICE_ADDRESS, | ||
504 | ADC_INPUT_CH3, 2, &input_mode, 1); | 462 | ADC_INPUT_CH3, 2, &input_mode, 1); |
505 | status = | 463 | status = cx231xx_read_i2c_data(dev, Colibri_DEVICE_ADDRESS, |
506 | cx231xx_read_i2c_data(dev, Colibri_DEVICE_ADDRESS, | ||
507 | ADC_NTF_PRECLMP_EN_CH3, 2, &ntf_mode, | 464 | ADC_NTF_PRECLMP_EN_CH3, 2, &ntf_mode, |
508 | 1); | 465 | 1); |
509 | } else { | 466 | } else { |
510 | status = | 467 | status = cx231xx_read_i2c_data(dev, Colibri_DEVICE_ADDRESS, |
511 | cx231xx_read_i2c_data(dev, Colibri_DEVICE_ADDRESS, | ||
512 | ADC_INPUT_CH1, 2, &input_mode, 1); | 468 | ADC_INPUT_CH1, 2, &input_mode, 1); |
513 | status = | 469 | status = cx231xx_read_i2c_data(dev, Colibri_DEVICE_ADDRESS, |
514 | cx231xx_read_i2c_data(dev, Colibri_DEVICE_ADDRESS, | ||
515 | ADC_NTF_PRECLMP_EN_CH1, 2, &ntf_mode, | 470 | ADC_NTF_PRECLMP_EN_CH1, 2, &ntf_mode, |
516 | 1); | 471 | 1); |
517 | } | 472 | } |
@@ -540,9 +495,9 @@ int cx231xx_colibri_adjust_ref_count(struct cx231xx *dev, u32 video_input) | |||
540 | return status; | 495 | return status; |
541 | } | 496 | } |
542 | 497 | ||
543 | /************************************************************************************* | 498 | /****************************************************************************** |
544 | * V I D E O / A U D I O D E C O D E R C O N T R O L functions * | 499 | * V I D E O / A U D I O D E C O D E R C O N T R O L functions * |
545 | *************************************************************************************/ | 500 | ******************************************++**********************************/ |
546 | int cx231xx_set_video_input_mux(struct cx231xx *dev, u8 input) | 501 | int cx231xx_set_video_input_mux(struct cx231xx *dev, u8 input) |
547 | { | 502 | { |
548 | int status = 0; | 503 | int status = 0; |
@@ -552,38 +507,38 @@ int cx231xx_set_video_input_mux(struct cx231xx *dev, u8 input) | |||
552 | case CX231XX_VMUX_SVIDEO: | 507 | case CX231XX_VMUX_SVIDEO: |
553 | if ((dev->current_pcb_config.type == USB_BUS_POWER) && | 508 | if ((dev->current_pcb_config.type == USB_BUS_POWER) && |
554 | (dev->power_mode != POLARIS_AVMODE_ENXTERNAL_AV)) { | 509 | (dev->power_mode != POLARIS_AVMODE_ENXTERNAL_AV)) { |
555 | status = cx231xx_set_power_mode(dev, POLARIS_AVMODE_ENXTERNAL_AV); /* External AV */ | 510 | /* External AV */ |
511 | status = cx231xx_set_power_mode(dev, | ||
512 | POLARIS_AVMODE_ENXTERNAL_AV); | ||
556 | if (status < 0) { | 513 | if (status < 0) { |
557 | cx231xx_errdev | 514 | cx231xx_errdev("%s: cx231xx_set_power_mode : Failed to set Power - errCode [%d]!\n", |
558 | ("%s: cx231xx_set_power_mode : Failed to set Power - errCode [%d]!\n", | ||
559 | __func__, status); | 515 | __func__, status); |
560 | return status; | 516 | return status; |
561 | } | 517 | } |
562 | } | 518 | } |
563 | status = | 519 | status = cx231xx_set_decoder_video_input(dev, |
564 | cx231xx_set_decoder_video_input(dev, INPUT(input)->type, | 520 | INPUT(input)->type, |
565 | INPUT(input)->vmux); | 521 | INPUT(input)->vmux); |
566 | break; | 522 | break; |
567 | case CX231XX_VMUX_TELEVISION: | 523 | case CX231XX_VMUX_TELEVISION: |
568 | case CX231XX_VMUX_CABLE: | 524 | case CX231XX_VMUX_CABLE: |
569 | if ((dev->current_pcb_config.type == USB_BUS_POWER) && | 525 | if ((dev->current_pcb_config.type == USB_BUS_POWER) && |
570 | (dev->power_mode != POLARIS_AVMODE_ANALOGT_TV)) { | 526 | (dev->power_mode != POLARIS_AVMODE_ANALOGT_TV)) { |
571 | status = cx231xx_set_power_mode(dev, POLARIS_AVMODE_ANALOGT_TV); /* Tuner */ | 527 | /* Tuner */ |
528 | status = cx231xx_set_power_mode(dev, | ||
529 | POLARIS_AVMODE_ANALOGT_TV); | ||
572 | if (status < 0) { | 530 | if (status < 0) { |
573 | cx231xx_errdev | 531 | cx231xx_errdev("%s: cx231xx_set_power_mode : Failed to set Power - errCode [%d]!\n", |
574 | ("%s: cx231xx_set_power_mode : Failed to set Power - errCode [%d]!\n", | ||
575 | __func__, status); | 532 | __func__, status); |
576 | return status; | 533 | return status; |
577 | } | 534 | } |
578 | } | 535 | } |
579 | status = | 536 | status = cx231xx_set_decoder_video_input(dev, |
580 | cx231xx_set_decoder_video_input(dev, | 537 | CX231XX_VMUX_COMPOSITE1, |
581 | CX231XX_VMUX_COMPOSITE1, | 538 | INPUT(input)->vmux); |
582 | INPUT(input)->vmux); | ||
583 | break; | 539 | break; |
584 | default: | 540 | default: |
585 | cx231xx_errdev | 541 | cx231xx_errdev("%s: cx231xx_set_power_mode : Unknown Input %d !\n", |
586 | ("%s: cx231xx_set_power_mode : Unknown Input %d !\n", | ||
587 | __func__, INPUT(input)->type); | 542 | __func__, INPUT(input)->type); |
588 | break; | 543 | break; |
589 | } | 544 | } |
@@ -602,8 +557,7 @@ int cx231xx_set_decoder_video_input(struct cx231xx *dev, u8 pin_type, u8 input) | |||
602 | if (pin_type != dev->video_input) { | 557 | if (pin_type != dev->video_input) { |
603 | status = cx231xx_colibri_adjust_ref_count(dev, pin_type); | 558 | status = cx231xx_colibri_adjust_ref_count(dev, pin_type); |
604 | if (status < 0) { | 559 | if (status < 0) { |
605 | cx231xx_errdev | 560 | cx231xx_errdev("%s: cx231xx_colibri_adjust_ref_count :Failed to set Colibri input mux - errCode [%d]!\n", |
606 | ("%s: cx231xx_colibri_adjust_ref_count :Failed to set Colibri input mux - errCode [%d]!\n", | ||
607 | __func__, status); | 561 | __func__, status); |
608 | return status; | 562 | return status; |
609 | } | 563 | } |
@@ -612,57 +566,190 @@ int cx231xx_set_decoder_video_input(struct cx231xx *dev, u8 pin_type, u8 input) | |||
612 | /* call colibri block to set video inputs */ | 566 | /* call colibri block to set video inputs */ |
613 | status = cx231xx_colibri_set_input_mux(dev, input); | 567 | status = cx231xx_colibri_set_input_mux(dev, input); |
614 | if (status < 0) { | 568 | if (status < 0) { |
615 | cx231xx_errdev | 569 | cx231xx_errdev("%s: cx231xx_colibri_set_input_mux :Failed to set Colibri input mux - errCode [%d]!\n", |
616 | ("%s: cx231xx_colibri_set_input_mux :Failed to set Colibri input mux - errCode [%d]!\n", | ||
617 | __func__, status); | 570 | __func__, status); |
618 | return status; | 571 | return status; |
619 | } | 572 | } |
620 | 573 | ||
621 | switch (pin_type) { | 574 | switch (pin_type) { |
622 | case CX231XX_VMUX_COMPOSITE1: | 575 | case CX231XX_VMUX_COMPOSITE1: |
623 | { | 576 | status = cx231xx_read_i2c_data(dev, |
624 | status = | 577 | HAMMERHEAD_I2C_ADDRESS, |
625 | cx231xx_read_i2c_data(dev, HAMMERHEAD_I2C_ADDRESS, | 578 | AFE_CTRL, 2, &value, 4); |
626 | AFE_CTRL, 2, &value, 4); | 579 | value |= (0 << 13) | (1 << 4); |
580 | value &= ~(1 << 5); | ||
581 | |||
582 | value &= (~(0x1ff8000)); /* set [24:23] [22:15] to 0 */ | ||
583 | value |= 0x1000000; /* set FUNC_MODE[24:23] = 2 IF_MOD[22:15] = 0 */ | ||
584 | status = cx231xx_write_i2c_data(dev, HAMMERHEAD_I2C_ADDRESS, | ||
585 | AFE_CTRL, 2, value, 4); | ||
586 | |||
587 | status = cx231xx_read_i2c_data(dev, HAMMERHEAD_I2C_ADDRESS, | ||
588 | OUT_CTRL1, 2, &value, 4); | ||
589 | value |= (1 << 7); | ||
590 | status = cx231xx_write_i2c_data(dev, HAMMERHEAD_I2C_ADDRESS, | ||
591 | OUT_CTRL1, 2, value, 4); | ||
592 | |||
593 | /* Set vip 1.1 output mode */ | ||
594 | status = cx231xx_read_modify_write_i2c_dword(dev, | ||
595 | HAMMERHEAD_I2C_ADDRESS, | ||
596 | OUT_CTRL1, | ||
597 | FLD_OUT_MODE, | ||
598 | OUT_MODE_VIP11); | ||
599 | |||
600 | /* Tell DIF object to go to baseband mode */ | ||
601 | status = cx231xx_dif_set_standard(dev, DIF_USE_BASEBAND); | ||
602 | if (status < 0) { | ||
603 | cx231xx_errdev("%s: cx231xx_dif set to By pass mode - errCode [%d]!\n", | ||
604 | __func__, status); | ||
605 | return status; | ||
606 | } | ||
607 | |||
608 | /* Read the DFE_CTRL1 register */ | ||
609 | status = cx231xx_read_i2c_data(dev, HAMMERHEAD_I2C_ADDRESS, | ||
610 | DFE_CTRL1, 2, &value, 4); | ||
611 | |||
612 | /* enable the VBI_GATE_EN */ | ||
613 | value |= FLD_VBI_GATE_EN; | ||
614 | |||
615 | /* Enable the auto-VGA enable */ | ||
616 | value |= FLD_VGA_AUTO_EN; | ||
617 | |||
618 | /* Write it back */ | ||
619 | status = cx231xx_write_i2c_data(dev, HAMMERHEAD_I2C_ADDRESS, | ||
620 | DFE_CTRL1, 2, value, 4); | ||
621 | |||
622 | /* Disable auto config of registers */ | ||
623 | status = cx231xx_read_modify_write_i2c_dword(dev, | ||
624 | HAMMERHEAD_I2C_ADDRESS, | ||
625 | MODE_CTRL, FLD_ACFG_DIS, | ||
626 | cx231xx_set_field(FLD_ACFG_DIS, 1)); | ||
627 | |||
628 | /* Set CVBS input mode */ | ||
629 | status = cx231xx_read_modify_write_i2c_dword(dev, | ||
630 | HAMMERHEAD_I2C_ADDRESS, | ||
631 | MODE_CTRL, FLD_INPUT_MODE, | ||
632 | cx231xx_set_field(FLD_INPUT_MODE, INPUT_MODE_CVBS_0)); | ||
633 | break; | ||
634 | case CX231XX_VMUX_SVIDEO: | ||
635 | /* Disable the use of DIF */ | ||
636 | |||
637 | status = cx231xx_read_i2c_data(dev, HAMMERHEAD_I2C_ADDRESS, | ||
638 | AFE_CTRL, 2, &value, 4); | ||
639 | |||
640 | value &= (~(0x1ff8000)); /* set [24:23] [22:15] to 0 */ | ||
641 | value |= 0x1000010; /* set FUNC_MODE[24:23] = 2 | ||
642 | IF_MOD[22:15] = 0 DCR_BYP_CH2[4:4] = 1; */ | ||
643 | status = cx231xx_write_i2c_data(dev, | ||
644 | HAMMERHEAD_I2C_ADDRESS, | ||
645 | AFE_CTRL, 2, value, 4); | ||
646 | |||
647 | /* Tell DIF object to go to baseband mode */ | ||
648 | status = cx231xx_dif_set_standard(dev, DIF_USE_BASEBAND); | ||
649 | if (status < 0) { | ||
650 | cx231xx_errdev("%s: cx231xx_dif set to By pass mode - errCode [%d]!\n", | ||
651 | __func__, status); | ||
652 | return status; | ||
653 | } | ||
654 | |||
655 | /* Read the DFE_CTRL1 register */ | ||
656 | status = cx231xx_read_i2c_data(dev, | ||
657 | HAMMERHEAD_I2C_ADDRESS, | ||
658 | DFE_CTRL1, 2, &value, 4); | ||
659 | |||
660 | /* enable the VBI_GATE_EN */ | ||
661 | value |= FLD_VBI_GATE_EN; | ||
662 | |||
663 | /* Enable the auto-VGA enable */ | ||
664 | value |= FLD_VGA_AUTO_EN; | ||
665 | |||
666 | /* Write it back */ | ||
667 | status = cx231xx_write_i2c_data(dev, | ||
668 | HAMMERHEAD_I2C_ADDRESS, | ||
669 | DFE_CTRL1, 2, value, 4); | ||
670 | |||
671 | /* Disable auto config of registers */ | ||
672 | status = cx231xx_read_modify_write_i2c_dword(dev, | ||
673 | HAMMERHEAD_I2C_ADDRESS, | ||
674 | MODE_CTRL, FLD_ACFG_DIS, | ||
675 | cx231xx_set_field(FLD_ACFG_DIS, 1)); | ||
676 | |||
677 | /* Set YC input mode */ | ||
678 | status = cx231xx_read_modify_write_i2c_dword(dev, | ||
679 | HAMMERHEAD_I2C_ADDRESS, | ||
680 | MODE_CTRL, | ||
681 | FLD_INPUT_MODE, | ||
682 | cx231xx_set_field(FLD_INPUT_MODE, INPUT_MODE_YC_1)); | ||
683 | |||
684 | /* Chroma to ADC2 */ | ||
685 | status = cx231xx_read_i2c_data(dev, | ||
686 | HAMMERHEAD_I2C_ADDRESS, | ||
687 | AFE_CTRL, 2, &value, 4); | ||
688 | value |= FLD_CHROMA_IN_SEL; /* set the chroma in select */ | ||
689 | |||
690 | /* Clear VGA_SEL_CH2 and VGA_SEL_CH3 (bits 7 and 8) | ||
691 | This sets them to use video | ||
692 | rather than audio. Only one of the two will be in use. */ | ||
693 | value &= ~(FLD_VGA_SEL_CH2 | FLD_VGA_SEL_CH3); | ||
694 | |||
695 | status = cx231xx_write_i2c_data(dev, | ||
696 | HAMMERHEAD_I2C_ADDRESS, | ||
697 | AFE_CTRL, 2, value, 4); | ||
698 | |||
699 | status = cx231xx_colibri_set_mode(dev, AFE_MODE_BASEBAND); | ||
700 | break; | ||
701 | case CX231XX_VMUX_TELEVISION: | ||
702 | case CX231XX_VMUX_CABLE: | ||
703 | default: | ||
704 | switch (dev->model) { | ||
705 | case CX231XX_BOARD_CNXT_RDE_250: | ||
706 | case CX231XX_BOARD_CNXT_RDU_250: | ||
707 | /* Disable the use of DIF */ | ||
708 | |||
709 | status = cx231xx_read_i2c_data(dev, | ||
710 | HAMMERHEAD_I2C_ADDRESS, | ||
711 | AFE_CTRL, 2, | ||
712 | &value, 4); | ||
627 | value |= (0 << 13) | (1 << 4); | 713 | value |= (0 << 13) | (1 << 4); |
628 | value &= ~(1 << 5); | 714 | value &= ~(1 << 5); |
629 | 715 | ||
630 | value &= (~(0x1FF8000)); /* set [24:23] [22:15] to 0 */ | 716 | value &= (~(0x1FF8000)); /* set [24:23] [22:15] to 0 */ |
631 | value |= 0x1000000; /* set FUNC_MODE[24:23] = 2 IF_MOD[22:15] = 0 */ | 717 | value |= 0x1000000; /* set FUNC_MODE[24:23] = 2 IF_MOD[22:15] = 0 */ |
632 | status = | 718 | status = cx231xx_write_i2c_data(dev, |
633 | cx231xx_write_i2c_data(dev, HAMMERHEAD_I2C_ADDRESS, | 719 | HAMMERHEAD_I2C_ADDRESS, |
634 | AFE_CTRL, 2, value, 4); | 720 | AFE_CTRL, 2, |
721 | value, 4); | ||
635 | 722 | ||
636 | status = | 723 | status = cx231xx_read_i2c_data(dev, |
637 | cx231xx_read_i2c_data(dev, HAMMERHEAD_I2C_ADDRESS, | 724 | HAMMERHEAD_I2C_ADDRESS, |
638 | OUT_CTRL1, 2, &value, 4); | 725 | OUT_CTRL1, 2, |
726 | &value, 4); | ||
639 | value |= (1 << 7); | 727 | value |= (1 << 7); |
640 | status = | 728 | status = cx231xx_write_i2c_data(dev, |
641 | cx231xx_write_i2c_data(dev, HAMMERHEAD_I2C_ADDRESS, | 729 | HAMMERHEAD_I2C_ADDRESS, |
642 | OUT_CTRL1, 2, value, 4); | 730 | OUT_CTRL1, 2, |
731 | value, 4); | ||
643 | 732 | ||
644 | /* Set vip 1.1 output mode */ | 733 | /* Set vip 1.1 output mode */ |
645 | status = | 734 | status = cx231xx_read_modify_write_i2c_dword(dev, |
646 | cx231xx_read_modify_write_i2c_dword(dev, | 735 | HAMMERHEAD_I2C_ADDRESS, |
647 | HAMMERHEAD_I2C_ADDRESS, | 736 | OUT_CTRL1, FLD_OUT_MODE, |
648 | OUT_CTRL1, | 737 | OUT_MODE_VIP11); |
649 | FLD_OUT_MODE, | ||
650 | OUT_MODE_VIP11); | ||
651 | 738 | ||
652 | /* Tell DIF object to go to baseband mode */ | 739 | /* Tell DIF object to go to baseband mode */ |
653 | status = | 740 | status = cx231xx_dif_set_standard(dev, |
654 | cx231xx_dif_set_standard(dev, DIF_USE_BASEBAND); | 741 | DIF_USE_BASEBAND); |
655 | if (status < 0) { | 742 | if (status < 0) { |
656 | cx231xx_errdev | 743 | cx231xx_errdev("%s: cx231xx_dif set to By pass mode - errCode [%d]!\n", |
657 | ("%s: cx231xx_dif set to By pass mode - errCode [%d]!\n", | 744 | __func__, status); |
658 | __func__, status); | ||
659 | return status; | 745 | return status; |
660 | } | 746 | } |
661 | 747 | ||
662 | /* Read the DFE_CTRL1 register */ | 748 | /* Read the DFE_CTRL1 register */ |
663 | status = | 749 | status = cx231xx_read_i2c_data(dev, |
664 | cx231xx_read_i2c_data(dev, HAMMERHEAD_I2C_ADDRESS, | 750 | HAMMERHEAD_I2C_ADDRESS, |
665 | DFE_CTRL1, 2, &value, 4); | 751 | DFE_CTRL1, 2, |
752 | &value, 4); | ||
666 | 753 | ||
667 | /* enable the VBI_GATE_EN */ | 754 | /* enable the VBI_GATE_EN */ |
668 | value |= FLD_VBI_GATE_EN; | 755 | value |= FLD_VBI_GATE_EN; |
@@ -671,349 +758,144 @@ int cx231xx_set_decoder_video_input(struct cx231xx *dev, u8 pin_type, u8 input) | |||
671 | value |= FLD_VGA_AUTO_EN; | 758 | value |= FLD_VGA_AUTO_EN; |
672 | 759 | ||
673 | /* Write it back */ | 760 | /* Write it back */ |
674 | status = | 761 | status = cx231xx_write_i2c_data(dev, |
675 | cx231xx_write_i2c_data(dev, HAMMERHEAD_I2C_ADDRESS, | 762 | HAMMERHEAD_I2C_ADDRESS, |
676 | DFE_CTRL1, 2, value, 4); | 763 | DFE_CTRL1, 2, |
764 | value, 4); | ||
677 | 765 | ||
678 | /* Disable auto config of registers */ | 766 | /* Disable auto config of registers */ |
679 | status = | 767 | status = cx231xx_read_modify_write_i2c_dword(dev, |
680 | cx231xx_read_modify_write_i2c_dword(dev, | 768 | HAMMERHEAD_I2C_ADDRESS, |
681 | HAMMERHEAD_I2C_ADDRESS, | 769 | MODE_CTRL, FLD_ACFG_DIS, |
682 | MODE_CTRL, | 770 | cx231xx_set_field(FLD_ACFG_DIS, 1)); |
683 | FLD_ACFG_DIS, | ||
684 | cx231xx_set_field | ||
685 | (FLD_ACFG_DIS, | ||
686 | 1)); | ||
687 | 771 | ||
688 | /* Set CVBS input mode */ | 772 | /* Set CVBS input mode */ |
689 | status = | 773 | status = cx231xx_read_modify_write_i2c_dword(dev, |
690 | cx231xx_read_modify_write_i2c_dword(dev, | 774 | HAMMERHEAD_I2C_ADDRESS, |
691 | HAMMERHEAD_I2C_ADDRESS, | 775 | MODE_CTRL, FLD_INPUT_MODE, |
692 | MODE_CTRL, | 776 | cx231xx_set_field(FLD_INPUT_MODE, INPUT_MODE_CVBS_0)); |
693 | FLD_INPUT_MODE, | 777 | break; |
694 | cx231xx_set_field | 778 | default: |
695 | (FLD_INPUT_MODE, | 779 | /* Enable the DIF for the tuner */ |
696 | INPUT_MODE_CVBS_0)); | ||
697 | } | ||
698 | break; | ||
699 | case CX231XX_VMUX_SVIDEO: | ||
700 | { | ||
701 | /* Disable the use of DIF */ | ||
702 | |||
703 | status = | ||
704 | cx231xx_read_i2c_data(dev, HAMMERHEAD_I2C_ADDRESS, | ||
705 | AFE_CTRL, 2, &value, 4); | ||
706 | |||
707 | value &= (~(0x1FF8000)); /* set [24:23] [22:15] to 0 */ | ||
708 | value |= 0x1000010; /* set FUNC_MODE[24:23] = 2 | ||
709 | IF_MOD[22:15] = 0 DCR_BYP_CH2[4:4] = 1; */ | ||
710 | status = | ||
711 | cx231xx_write_i2c_data(dev, HAMMERHEAD_I2C_ADDRESS, | ||
712 | AFE_CTRL, 2, value, 4); | ||
713 | 780 | ||
714 | /* Tell DIF object to go to baseband mode */ | 781 | /* Reinitialize the DIF */ |
715 | status = | 782 | status = cx231xx_dif_set_standard(dev, dev->norm); |
716 | cx231xx_dif_set_standard(dev, DIF_USE_BASEBAND); | ||
717 | if (status < 0) { | 783 | if (status < 0) { |
718 | cx231xx_errdev | 784 | cx231xx_errdev("%s: cx231xx_dif set to By pass mode - errCode [%d]!\n", |
719 | ("%s: cx231xx_dif set to By pass mode - errCode [%d]!\n", | 785 | __func__, status); |
720 | __func__, status); | ||
721 | return status; | 786 | return status; |
722 | } | 787 | } |
723 | 788 | ||
789 | /* Make sure bypass is cleared */ | ||
790 | status = cx231xx_read_i2c_data(dev, | ||
791 | HAMMERHEAD_I2C_ADDRESS, | ||
792 | DIF_MISC_CTRL, | ||
793 | 2, &value, 4); | ||
794 | |||
795 | /* Clear the bypass bit */ | ||
796 | value &= ~FLD_DIF_DIF_BYPASS; | ||
797 | |||
798 | /* Enable the use of the DIF block */ | ||
799 | status = cx231xx_write_i2c_data(dev, | ||
800 | HAMMERHEAD_I2C_ADDRESS, | ||
801 | DIF_MISC_CTRL, | ||
802 | 2, value, 4); | ||
803 | |||
724 | /* Read the DFE_CTRL1 register */ | 804 | /* Read the DFE_CTRL1 register */ |
725 | status = | 805 | status = cx231xx_read_i2c_data(dev, |
726 | cx231xx_read_i2c_data(dev, HAMMERHEAD_I2C_ADDRESS, | 806 | HAMMERHEAD_I2C_ADDRESS, |
727 | DFE_CTRL1, 2, &value, 4); | 807 | DFE_CTRL1, 2, |
808 | &value, 4); | ||
728 | 809 | ||
729 | /* enable the VBI_GATE_EN */ | 810 | /* Disable the VBI_GATE_EN */ |
730 | value |= FLD_VBI_GATE_EN; | 811 | value &= ~FLD_VBI_GATE_EN; |
731 | 812 | ||
732 | /* Enable the auto-VGA enable */ | 813 | /* Enable the auto-VGA enable, AGC, and |
733 | value |= FLD_VGA_AUTO_EN; | 814 | set the skip count to 2 */ |
815 | value |= FLD_VGA_AUTO_EN | FLD_AGC_AUTO_EN | 0x00200000; | ||
734 | 816 | ||
735 | /* Write it back */ | 817 | /* Write it back */ |
736 | status = | 818 | status = cx231xx_write_i2c_data(dev, |
737 | cx231xx_write_i2c_data(dev, HAMMERHEAD_I2C_ADDRESS, | 819 | HAMMERHEAD_I2C_ADDRESS, |
738 | DFE_CTRL1, 2, value, 4); | 820 | DFE_CTRL1, 2, |
821 | value, 4); | ||
739 | 822 | ||
740 | /* Disable auto config of registers */ | 823 | /* Wait 15 ms */ |
741 | status = | 824 | msleep(1); |
742 | cx231xx_read_modify_write_i2c_dword(dev, | ||
743 | HAMMERHEAD_I2C_ADDRESS, | ||
744 | MODE_CTRL, | ||
745 | FLD_ACFG_DIS, | ||
746 | cx231xx_set_field | ||
747 | (FLD_ACFG_DIS, | ||
748 | 1)); | ||
749 | |||
750 | /* Set YC input mode */ | ||
751 | status = | ||
752 | cx231xx_read_modify_write_i2c_dword(dev, | ||
753 | HAMMERHEAD_I2C_ADDRESS, | ||
754 | MODE_CTRL, | ||
755 | FLD_INPUT_MODE, | ||
756 | cx231xx_set_field | ||
757 | (FLD_INPUT_MODE, | ||
758 | INPUT_MODE_YC_1)); | ||
759 | |||
760 | /* Chroma to ADC2 */ | ||
761 | status = | ||
762 | cx231xx_read_i2c_data(dev, HAMMERHEAD_I2C_ADDRESS, | ||
763 | AFE_CTRL, 2, &value, 4); | ||
764 | value |= FLD_CHROMA_IN_SEL; /* set the chroma in select */ | ||
765 | 825 | ||
766 | /* Clear VGA_SEL_CH2 and VGA_SEL_CH3 (bits 7 and 8) This sets them to use video | 826 | /* Disable the auto-VGA enable AGC */ |
767 | rather than audio. Only one of the two will be in use. */ | 827 | value &= ~(FLD_VGA_AUTO_EN); |
768 | value &= ~(FLD_VGA_SEL_CH2 | FLD_VGA_SEL_CH3); | ||
769 | 828 | ||
770 | status = | 829 | /* Write it back */ |
771 | cx231xx_write_i2c_data(dev, HAMMERHEAD_I2C_ADDRESS, | 830 | status = cx231xx_write_i2c_data(dev, |
772 | AFE_CTRL, 2, value, 4); | 831 | HAMMERHEAD_I2C_ADDRESS, |
832 | DFE_CTRL1, 2, | ||
833 | value, 4); | ||
773 | 834 | ||
774 | status = | 835 | /* Enable Polaris B0 AGC output */ |
775 | cx231xx_colibri_set_mode(dev, AFE_MODE_BASEBAND); | 836 | status = cx231xx_read_i2c_data(dev, |
776 | } | 837 | HAMMERHEAD_I2C_ADDRESS, |
777 | break; | 838 | PIN_CTRL, 2, |
778 | case CX231XX_VMUX_TELEVISION: | 839 | &value, 4); |
779 | case CX231XX_VMUX_CABLE: | 840 | value |= (FLD_OEF_AGC_RF) | |
780 | default: | 841 | (FLD_OEF_AGC_IFVGA) | |
781 | { | 842 | (FLD_OEF_AGC_IF); |
782 | switch (dev->model) { | 843 | status = cx231xx_write_i2c_data(dev, |
783 | case CX231XX_BOARD_CNXT_RDE_250: | 844 | HAMMERHEAD_I2C_ADDRESS, |
784 | case CX231XX_BOARD_CNXT_RDU_250: | 845 | PIN_CTRL, 2, |
785 | { | 846 | value, 4); |
786 | /* Disable the use of DIF */ | 847 | |
787 | 848 | /* Set vip 1.1 output mode */ | |
788 | status = | 849 | status = cx231xx_read_modify_write_i2c_dword(dev, |
789 | cx231xx_read_i2c_data(dev, | 850 | HAMMERHEAD_I2C_ADDRESS, |
790 | HAMMERHEAD_I2C_ADDRESS, | 851 | OUT_CTRL1, FLD_OUT_MODE, |
791 | AFE_CTRL, 2, | 852 | OUT_MODE_VIP11); |
792 | &value, 4); | 853 | |
793 | value |= (0 << 13) | (1 << 4); | 854 | /* Disable auto config of registers */ |
794 | value &= ~(1 << 5); | 855 | status = cx231xx_read_modify_write_i2c_dword(dev, |
795 | 856 | HAMMERHEAD_I2C_ADDRESS, | |
796 | value &= (~(0x1FF8000)); /* set [24:23] [22:15] to 0 */ | 857 | MODE_CTRL, FLD_ACFG_DIS, |
797 | value |= 0x1000000; /* set FUNC_MODE[24:23] = 2 IF_MOD[22:15] = 0 */ | 858 | cx231xx_set_field(FLD_ACFG_DIS, 1)); |
798 | status = | 859 | |
799 | cx231xx_write_i2c_data(dev, | 860 | /* Set CVBS input mode */ |
800 | HAMMERHEAD_I2C_ADDRESS, | 861 | status = cx231xx_read_modify_write_i2c_dword(dev, |
801 | AFE_CTRL, 2, | 862 | HAMMERHEAD_I2C_ADDRESS, |
802 | value, 4); | 863 | MODE_CTRL, FLD_INPUT_MODE, |
803 | 864 | cx231xx_set_field(FLD_INPUT_MODE, INPUT_MODE_CVBS_0)); | |
804 | status = | 865 | |
805 | cx231xx_read_i2c_data(dev, | 866 | /* Set some bits in AFE_CTRL so that channel 2 or 3 is ready to receive audio */ |
806 | HAMMERHEAD_I2C_ADDRESS, | 867 | /* Clear clamp for channels 2 and 3 (bit 16-17) */ |
807 | OUT_CTRL1, 2, | 868 | /* Clear droop comp (bit 19-20) */ |
808 | &value, 4); | 869 | /* Set VGA_SEL (for audio control) (bit 7-8) */ |
809 | value |= (1 << 7); | 870 | status = cx231xx_read_i2c_data(dev, |
810 | status = | 871 | HAMMERHEAD_I2C_ADDRESS, |
811 | cx231xx_write_i2c_data(dev, | 872 | AFE_CTRL, 2, |
812 | HAMMERHEAD_I2C_ADDRESS, | 873 | &value, 4); |
813 | OUT_CTRL1, 2, | 874 | |
814 | value, 4); | 875 | value |= FLD_VGA_SEL_CH3 | FLD_VGA_SEL_CH2; |
815 | 876 | ||
816 | /* Set vip 1.1 output mode */ | 877 | status = cx231xx_write_i2c_data(dev, |
817 | status = | 878 | HAMMERHEAD_I2C_ADDRESS, |
818 | cx231xx_read_modify_write_i2c_dword | 879 | AFE_CTRL, 2, |
819 | (dev, HAMMERHEAD_I2C_ADDRESS, | 880 | value, 4); |
820 | OUT_CTRL1, FLD_OUT_MODE, | 881 | break; |
821 | OUT_MODE_VIP11); | ||
822 | |||
823 | /* Tell DIF object to go to baseband mode */ | ||
824 | status = | ||
825 | cx231xx_dif_set_standard(dev, | ||
826 | DIF_USE_BASEBAND); | ||
827 | if (status < 0) { | ||
828 | cx231xx_errdev | ||
829 | ("%s: cx231xx_dif set to By pass mode - errCode [%d]!\n", | ||
830 | __func__, status); | ||
831 | return status; | ||
832 | } | ||
833 | |||
834 | /* Read the DFE_CTRL1 register */ | ||
835 | status = | ||
836 | cx231xx_read_i2c_data(dev, | ||
837 | HAMMERHEAD_I2C_ADDRESS, | ||
838 | DFE_CTRL1, 2, | ||
839 | &value, 4); | ||
840 | |||
841 | /* enable the VBI_GATE_EN */ | ||
842 | value |= FLD_VBI_GATE_EN; | ||
843 | |||
844 | /* Enable the auto-VGA enable */ | ||
845 | value |= FLD_VGA_AUTO_EN; | ||
846 | |||
847 | /* Write it back */ | ||
848 | status = | ||
849 | cx231xx_write_i2c_data(dev, | ||
850 | HAMMERHEAD_I2C_ADDRESS, | ||
851 | DFE_CTRL1, 2, | ||
852 | value, 4); | ||
853 | |||
854 | /* Disable auto config of registers */ | ||
855 | status = | ||
856 | cx231xx_read_modify_write_i2c_dword | ||
857 | (dev, HAMMERHEAD_I2C_ADDRESS, | ||
858 | MODE_CTRL, FLD_ACFG_DIS, | ||
859 | cx231xx_set_field(FLD_ACFG_DIS, | ||
860 | 1)); | ||
861 | |||
862 | /* Set CVBS input mode */ | ||
863 | status = | ||
864 | cx231xx_read_modify_write_i2c_dword | ||
865 | (dev, HAMMERHEAD_I2C_ADDRESS, | ||
866 | MODE_CTRL, FLD_INPUT_MODE, | ||
867 | cx231xx_set_field(FLD_INPUT_MODE, | ||
868 | INPUT_MODE_CVBS_0)); | ||
869 | } | ||
870 | break; | ||
871 | default: | ||
872 | { | ||
873 | /* Enable the DIF for the tuner */ | ||
874 | |||
875 | /* Reinitialize the DIF */ | ||
876 | status = | ||
877 | cx231xx_dif_set_standard(dev, | ||
878 | dev->norm); | ||
879 | if (status < 0) { | ||
880 | cx231xx_errdev | ||
881 | ("%s: cx231xx_dif set to By pass mode - errCode [%d]!\n", | ||
882 | __func__, status); | ||
883 | return status; | ||
884 | } | ||
885 | |||
886 | /* Make sure bypass is cleared */ | ||
887 | status = | ||
888 | cx231xx_read_i2c_data(dev, | ||
889 | HAMMERHEAD_I2C_ADDRESS, | ||
890 | DIF_MISC_CTRL, | ||
891 | 2, &value, 4); | ||
892 | |||
893 | /* Clear the bypass bit */ | ||
894 | value &= ~FLD_DIF_DIF_BYPASS; | ||
895 | |||
896 | /* Enable the use of the DIF block */ | ||
897 | status = | ||
898 | cx231xx_write_i2c_data(dev, | ||
899 | HAMMERHEAD_I2C_ADDRESS, | ||
900 | DIF_MISC_CTRL, | ||
901 | 2, value, 4); | ||
902 | |||
903 | /* Read the DFE_CTRL1 register */ | ||
904 | status = | ||
905 | cx231xx_read_i2c_data(dev, | ||
906 | HAMMERHEAD_I2C_ADDRESS, | ||
907 | DFE_CTRL1, 2, | ||
908 | &value, 4); | ||
909 | |||
910 | /* Disable the VBI_GATE_EN */ | ||
911 | value &= ~FLD_VBI_GATE_EN; | ||
912 | |||
913 | /* Enable the auto-VGA enable, AGC, and set the skip count to 2 */ | ||
914 | value |= | ||
915 | FLD_VGA_AUTO_EN | FLD_AGC_AUTO_EN | | ||
916 | 0x00200000; | ||
917 | |||
918 | /* Write it back */ | ||
919 | status = | ||
920 | cx231xx_write_i2c_data(dev, | ||
921 | HAMMERHEAD_I2C_ADDRESS, | ||
922 | DFE_CTRL1, 2, | ||
923 | value, 4); | ||
924 | |||
925 | /* Wait 15 ms */ | ||
926 | msleep(1); | ||
927 | |||
928 | /* Disable the auto-VGA enable AGC */ | ||
929 | value &= ~(FLD_VGA_AUTO_EN); | ||
930 | |||
931 | /* Write it back */ | ||
932 | status = | ||
933 | cx231xx_write_i2c_data(dev, | ||
934 | HAMMERHEAD_I2C_ADDRESS, | ||
935 | DFE_CTRL1, 2, | ||
936 | value, 4); | ||
937 | |||
938 | /* Enable Polaris B0 AGC output */ | ||
939 | status = | ||
940 | cx231xx_read_i2c_data(dev, | ||
941 | HAMMERHEAD_I2C_ADDRESS, | ||
942 | PIN_CTRL, 2, | ||
943 | &value, 4); | ||
944 | value |= | ||
945 | (FLD_OEF_AGC_RF) | | ||
946 | (FLD_OEF_AGC_IFVGA) | | ||
947 | (FLD_OEF_AGC_IF); | ||
948 | status = | ||
949 | cx231xx_write_i2c_data(dev, | ||
950 | HAMMERHEAD_I2C_ADDRESS, | ||
951 | PIN_CTRL, 2, | ||
952 | value, 4); | ||
953 | |||
954 | /* Set vip 1.1 output mode */ | ||
955 | status = | ||
956 | cx231xx_read_modify_write_i2c_dword | ||
957 | (dev, HAMMERHEAD_I2C_ADDRESS, | ||
958 | OUT_CTRL1, FLD_OUT_MODE, | ||
959 | OUT_MODE_VIP11); | ||
960 | |||
961 | /* Disable auto config of registers */ | ||
962 | status = | ||
963 | cx231xx_read_modify_write_i2c_dword | ||
964 | (dev, HAMMERHEAD_I2C_ADDRESS, | ||
965 | MODE_CTRL, FLD_ACFG_DIS, | ||
966 | cx231xx_set_field(FLD_ACFG_DIS, | ||
967 | 1)); | ||
968 | |||
969 | /* Set CVBS input mode */ | ||
970 | status = | ||
971 | cx231xx_read_modify_write_i2c_dword | ||
972 | (dev, HAMMERHEAD_I2C_ADDRESS, | ||
973 | MODE_CTRL, FLD_INPUT_MODE, | ||
974 | cx231xx_set_field(FLD_INPUT_MODE, | ||
975 | INPUT_MODE_CVBS_0)); | ||
976 | |||
977 | /* Set some bits in AFE_CTRL so that channel 2 or 3 is ready to receive audio */ | ||
978 | /* Clear clamp for channels 2 and 3 (bit 16-17) */ | ||
979 | /* Clear droop comp (bit 19-20) */ | ||
980 | /* Set VGA_SEL (for audio control) (bit 7-8) */ | ||
981 | status = | ||
982 | cx231xx_read_i2c_data(dev, | ||
983 | HAMMERHEAD_I2C_ADDRESS, | ||
984 | AFE_CTRL, 2, | ||
985 | &value, 4); | ||
986 | |||
987 | value |= | ||
988 | FLD_VGA_SEL_CH3 | FLD_VGA_SEL_CH2; | ||
989 | |||
990 | status = | ||
991 | cx231xx_write_i2c_data(dev, | ||
992 | HAMMERHEAD_I2C_ADDRESS, | ||
993 | AFE_CTRL, 2, | ||
994 | value, 4); | ||
995 | } | ||
996 | break; | ||
997 | 882 | ||
998 | } | ||
999 | } | 883 | } |
1000 | break; | 884 | break; |
1001 | } | 885 | } |
1002 | 886 | ||
1003 | /* Set raw VBI mode */ | 887 | /* Set raw VBI mode */ |
1004 | status = | 888 | status = cx231xx_read_modify_write_i2c_dword(dev, |
1005 | cx231xx_read_modify_write_i2c_dword(dev, HAMMERHEAD_I2C_ADDRESS, | 889 | HAMMERHEAD_I2C_ADDRESS, |
1006 | OUT_CTRL1, FLD_VBIHACTRAW_EN, | 890 | OUT_CTRL1, FLD_VBIHACTRAW_EN, |
1007 | cx231xx_set_field | 891 | cx231xx_set_field(FLD_VBIHACTRAW_EN, 1)); |
1008 | (FLD_VBIHACTRAW_EN, 1)); | ||
1009 | 892 | ||
1010 | status = | 893 | status = cx231xx_read_i2c_data(dev, HAMMERHEAD_I2C_ADDRESS, |
1011 | cx231xx_read_i2c_data(dev, HAMMERHEAD_I2C_ADDRESS, OUT_CTRL1, 2, | 894 | OUT_CTRL1, 2, |
1012 | &value, 4); | 895 | &value, 4); |
1013 | if (value & 0x02) { | 896 | if (value & 0x02) { |
1014 | value |= (1 << 19); | 897 | value |= (1 << 19); |
1015 | status = | 898 | status = cx231xx_write_i2c_data(dev, HAMMERHEAD_I2C_ADDRESS, |
1016 | cx231xx_write_i2c_data(dev, HAMMERHEAD_I2C_ADDRESS, | ||
1017 | OUT_CTRL1, 2, value, 4); | 899 | OUT_CTRL1, 2, value, 4); |
1018 | } | 900 | } |
1019 | 901 | ||
@@ -1032,70 +914,62 @@ int cx231xx_do_mode_ctrl_overrides(struct cx231xx *dev) | |||
1032 | (unsigned int)dev->norm); | 914 | (unsigned int)dev->norm); |
1033 | 915 | ||
1034 | /* Change the DFE_CTRL3 bp_percent to fix flagging */ | 916 | /* Change the DFE_CTRL3 bp_percent to fix flagging */ |
1035 | status = | 917 | status = cx231xx_write_i2c_data(dev, HAMMERHEAD_I2C_ADDRESS, |
1036 | cx231xx_write_i2c_data(dev, HAMMERHEAD_I2C_ADDRESS, DFE_CTRL3, 2, | 918 | DFE_CTRL3, 2, |
1037 | 0xCD3F0280, 4); | 919 | 0xCD3F0280, 4); |
1038 | 920 | ||
1039 | if (dev->norm & (V4L2_STD_NTSC_M | V4L2_STD_NTSC_M_JP | V4L2_STD_PAL_M)) { | 921 | if (dev->norm & (V4L2_STD_NTSC_M | V4L2_STD_NTSC_M_JP | V4L2_STD_PAL_M)) { |
1040 | cx231xx_info("do_mode_ctrl_overrides NTSC\n"); | 922 | cx231xx_info("do_mode_ctrl_overrides NTSC\n"); |
1041 | 923 | ||
1042 | /* Move the close caption lines out of active video, adjust the active video start point */ | 924 | /* Move the close caption lines out of active video, |
1043 | status = | 925 | adjust the active video start point */ |
1044 | cx231xx_read_modify_write_i2c_dword(dev, | 926 | status = cx231xx_read_modify_write_i2c_dword(dev, |
1045 | HAMMERHEAD_I2C_ADDRESS, | 927 | HAMMERHEAD_I2C_ADDRESS, |
1046 | VERT_TIM_CTRL, | 928 | VERT_TIM_CTRL, |
1047 | FLD_VBLANK_CNT, 0x18); | 929 | FLD_VBLANK_CNT, 0x18); |
1048 | status = | 930 | status = cx231xx_read_modify_write_i2c_dword(dev, |
1049 | cx231xx_read_modify_write_i2c_dword(dev, | ||
1050 | HAMMERHEAD_I2C_ADDRESS, | 931 | HAMMERHEAD_I2C_ADDRESS, |
1051 | VERT_TIM_CTRL, | 932 | VERT_TIM_CTRL, |
1052 | FLD_VACTIVE_CNT, | 933 | FLD_VACTIVE_CNT, |
1053 | 0x1E6000); | 934 | 0x1E6000); |
1054 | status = | 935 | status = cx231xx_read_modify_write_i2c_dword(dev, |
1055 | cx231xx_read_modify_write_i2c_dword(dev, | ||
1056 | HAMMERHEAD_I2C_ADDRESS, | 936 | HAMMERHEAD_I2C_ADDRESS, |
1057 | VERT_TIM_CTRL, | 937 | VERT_TIM_CTRL, |
1058 | FLD_V656BLANK_CNT, | 938 | FLD_V656BLANK_CNT, |
1059 | 0x1E000000); | 939 | 0x1E000000); |
1060 | 940 | ||
1061 | status = | 941 | status = cx231xx_read_modify_write_i2c_dword(dev, |
1062 | cx231xx_read_modify_write_i2c_dword(dev, | ||
1063 | HAMMERHEAD_I2C_ADDRESS, | 942 | HAMMERHEAD_I2C_ADDRESS, |
1064 | HORIZ_TIM_CTRL, | 943 | HORIZ_TIM_CTRL, |
1065 | FLD_HBLANK_CNT, | 944 | FLD_HBLANK_CNT, |
1066 | cx231xx_set_field | 945 | cx231xx_set_field |
1067 | (FLD_HBLANK_CNT, 0x79)); | 946 | (FLD_HBLANK_CNT, 0x79)); |
1068 | } else if (dev-> | 947 | } else if (dev->norm & (V4L2_STD_PAL_B | V4L2_STD_PAL_G | |
1069 | norm & (V4L2_STD_PAL_B | V4L2_STD_PAL_G | V4L2_STD_PAL_D | | 948 | V4L2_STD_PAL_D | V4L2_STD_PAL_I | |
1070 | V4L2_STD_PAL_I | V4L2_STD_PAL_N | V4L2_STD_PAL_Nc)) { | 949 | V4L2_STD_PAL_N | V4L2_STD_PAL_Nc)) { |
1071 | cx231xx_info("do_mode_ctrl_overrides PAL\n"); | 950 | cx231xx_info("do_mode_ctrl_overrides PAL\n"); |
1072 | status = | 951 | status = cx231xx_read_modify_write_i2c_dword(dev, |
1073 | cx231xx_read_modify_write_i2c_dword(dev, | ||
1074 | HAMMERHEAD_I2C_ADDRESS, | 952 | HAMMERHEAD_I2C_ADDRESS, |
1075 | VERT_TIM_CTRL, | 953 | VERT_TIM_CTRL, |
1076 | FLD_VBLANK_CNT, 0x24); | 954 | FLD_VBLANK_CNT, 0x24); |
1077 | /* Adjust the active video horizontal start point */ | 955 | /* Adjust the active video horizontal start point */ |
1078 | status = | 956 | status = cx231xx_read_modify_write_i2c_dword(dev, |
1079 | cx231xx_read_modify_write_i2c_dword(dev, | ||
1080 | HAMMERHEAD_I2C_ADDRESS, | 957 | HAMMERHEAD_I2C_ADDRESS, |
1081 | HORIZ_TIM_CTRL, | 958 | HORIZ_TIM_CTRL, |
1082 | FLD_HBLANK_CNT, | 959 | FLD_HBLANK_CNT, |
1083 | cx231xx_set_field | 960 | cx231xx_set_field |
1084 | (FLD_HBLANK_CNT, 0x85)); | 961 | (FLD_HBLANK_CNT, 0x85)); |
1085 | } else if (dev-> | 962 | } else if (dev->norm & (V4L2_STD_SECAM_B | V4L2_STD_SECAM_D | |
1086 | norm & (V4L2_STD_SECAM_B | V4L2_STD_SECAM_D | | 963 | V4L2_STD_SECAM_G | V4L2_STD_SECAM_K | |
1087 | V4L2_STD_SECAM_G | V4L2_STD_SECAM_K | | 964 | V4L2_STD_SECAM_K1 | V4L2_STD_SECAM_L | |
1088 | V4L2_STD_SECAM_K1 | V4L2_STD_SECAM_L | | 965 | V4L2_STD_SECAM_LC)) { |
1089 | V4L2_STD_SECAM_LC)) { | ||
1090 | cx231xx_info("do_mode_ctrl_overrides SECAM\n"); | 966 | cx231xx_info("do_mode_ctrl_overrides SECAM\n"); |
1091 | status = | 967 | status = cx231xx_read_modify_write_i2c_dword(dev, |
1092 | cx231xx_read_modify_write_i2c_dword(dev, | ||
1093 | HAMMERHEAD_I2C_ADDRESS, | 968 | HAMMERHEAD_I2C_ADDRESS, |
1094 | VERT_TIM_CTRL, | 969 | VERT_TIM_CTRL, |
1095 | FLD_VBLANK_CNT, 0x24); | 970 | FLD_VBLANK_CNT, 0x24); |
1096 | /* Adjust the active video horizontal start point */ | 971 | /* Adjust the active video horizontal start point */ |
1097 | status = | 972 | status = cx231xx_read_modify_write_i2c_dword(dev, |
1098 | cx231xx_read_modify_write_i2c_dword(dev, | ||
1099 | HAMMERHEAD_I2C_ADDRESS, | 973 | HAMMERHEAD_I2C_ADDRESS, |
1100 | HORIZ_TIM_CTRL, | 974 | HORIZ_TIM_CTRL, |
1101 | FLD_HBLANK_CNT, | 975 | FLD_HBLANK_CNT, |
@@ -1137,69 +1011,57 @@ int cx231xx_set_audio_decoder_input(struct cx231xx *dev, | |||
1137 | u32 value = 0; | 1011 | u32 value = 0; |
1138 | 1012 | ||
1139 | /* Put it in soft reset */ | 1013 | /* Put it in soft reset */ |
1140 | status = | 1014 | status = cx231xx_read_i2c_data(dev, HAMMERHEAD_I2C_ADDRESS, |
1141 | cx231xx_read_i2c_data(dev, HAMMERHEAD_I2C_ADDRESS, GENERAL_CTL, 2, | 1015 | GENERAL_CTL, 2, &gen_ctrl, 1); |
1142 | &gen_ctrl, 1); | ||
1143 | gen_ctrl |= 1; | 1016 | gen_ctrl |= 1; |
1144 | status = | 1017 | status = cx231xx_write_i2c_data(dev, HAMMERHEAD_I2C_ADDRESS, |
1145 | cx231xx_write_i2c_data(dev, HAMMERHEAD_I2C_ADDRESS, GENERAL_CTL, 2, | 1018 | GENERAL_CTL, 2, gen_ctrl, 1); |
1146 | gen_ctrl, 1); | ||
1147 | 1019 | ||
1148 | switch (audio_input) { | 1020 | switch (audio_input) { |
1149 | case AUDIO_INPUT_LINE: | 1021 | case AUDIO_INPUT_LINE: |
1150 | |||
1151 | /* setup AUD_IO control from Merlin paralle output */ | 1022 | /* setup AUD_IO control from Merlin paralle output */ |
1152 | value = | 1023 | value = cx231xx_set_field(FLD_AUD_CHAN1_SRC, |
1153 | cx231xx_set_field(FLD_AUD_CHAN1_SRC, AUD_CHAN_SRC_PARALLEL); | 1024 | AUD_CHAN_SRC_PARALLEL); |
1154 | status = | 1025 | status = cx231xx_write_i2c_data(dev, |
1155 | cx231xx_write_i2c_data(dev, HAMMERHEAD_I2C_ADDRESS, | 1026 | HAMMERHEAD_I2C_ADDRESS, |
1156 | AUD_IO_CTRL, 2, value, 4); | 1027 | AUD_IO_CTRL, 2, value, 4); |
1157 | 1028 | ||
1158 | /* setup input to Merlin, SRC2 connect to AC97 | 1029 | /* setup input to Merlin, SRC2 connect to AC97 |
1159 | bypass upsample-by-2, slave mode, sony mode, left justify | 1030 | bypass upsample-by-2, slave mode, sony mode, left justify |
1160 | adr 091c, dat 01000000 */ | 1031 | adr 091c, dat 01000000 */ |
1161 | status = | 1032 | status = cx231xx_read_i2c_data(dev, HAMMERHEAD_I2C_ADDRESS, |
1162 | cx231xx_read_i2c_data(dev, HAMMERHEAD_I2C_ADDRESS, AC97_CTL, | 1033 | AC97_CTL, |
1163 | 2, &dwval, 4); | 1034 | 2, &dwval, 4); |
1164 | 1035 | ||
1165 | status = | 1036 | status = cx231xx_write_i2c_data(dev, HAMMERHEAD_I2C_ADDRESS, |
1166 | cx231xx_write_i2c_data(dev, HAMMERHEAD_I2C_ADDRESS, | ||
1167 | AC97_CTL, 2, | 1037 | AC97_CTL, 2, |
1168 | (dwval | FLD_AC97_UP2X_BYPASS), 4); | 1038 | (dwval | FLD_AC97_UP2X_BYPASS), 4); |
1169 | 1039 | ||
1170 | /* select the parallel1 and SRC3 */ | 1040 | /* select the parallel1 and SRC3 */ |
1171 | status = | 1041 | status = cx231xx_write_i2c_data(dev, HAMMERHEAD_I2C_ADDRESS, |
1172 | cx231xx_write_i2c_data(dev, HAMMERHEAD_I2C_ADDRESS, | 1042 | BAND_OUT_SEL, 2, |
1173 | BAND_OUT_SEL, 2, | 1043 | cx231xx_set_field(FLD_SRC3_IN_SEL, 0x0) | |
1174 | cx231xx_set_field(FLD_SRC3_IN_SEL, | 1044 | cx231xx_set_field(FLD_SRC3_CLK_SEL, 0x0) | |
1175 | 0x0) | | 1045 | cx231xx_set_field(FLD_PARALLEL1_SRC_SEL, 0x0), |
1176 | cx231xx_set_field(FLD_SRC3_CLK_SEL, | 1046 | 4); |
1177 | 0x0) | | ||
1178 | cx231xx_set_field | ||
1179 | (FLD_PARALLEL1_SRC_SEL, 0x0), 4); | ||
1180 | 1047 | ||
1181 | /* unmute all, AC97 in, independence mode | 1048 | /* unmute all, AC97 in, independence mode |
1182 | adr 08d0, data 0x00063073 */ | 1049 | adr 08d0, data 0x00063073 */ |
1183 | status = | 1050 | status = cx231xx_write_i2c_data(dev, HAMMERHEAD_I2C_ADDRESS, |
1184 | cx231xx_write_i2c_data(dev, HAMMERHEAD_I2C_ADDRESS, | ||
1185 | PATH1_CTL1, 2, 0x00063073, 4); | 1051 | PATH1_CTL1, 2, 0x00063073, 4); |
1186 | 1052 | ||
1187 | /* set AVC maximum threshold, adr 08d4, dat ffff0024 */ | 1053 | /* set AVC maximum threshold, adr 08d4, dat ffff0024 */ |
1188 | status = | 1054 | status = cx231xx_read_i2c_data(dev, HAMMERHEAD_I2C_ADDRESS, |
1189 | cx231xx_read_i2c_data(dev, HAMMERHEAD_I2C_ADDRESS, | ||
1190 | PATH1_VOL_CTL, 2, &dwval, 4); | 1055 | PATH1_VOL_CTL, 2, &dwval, 4); |
1191 | status = | 1056 | status = cx231xx_write_i2c_data(dev, HAMMERHEAD_I2C_ADDRESS, |
1192 | cx231xx_write_i2c_data(dev, HAMMERHEAD_I2C_ADDRESS, | ||
1193 | PATH1_VOL_CTL, 2, | 1057 | PATH1_VOL_CTL, 2, |
1194 | (dwval | FLD_PATH1_AVC_THRESHOLD), | 1058 | (dwval | FLD_PATH1_AVC_THRESHOLD), |
1195 | 4); | 1059 | 4); |
1196 | 1060 | ||
1197 | /* set SC maximum threshold, adr 08ec, dat ffffb3a3 */ | 1061 | /* set SC maximum threshold, adr 08ec, dat ffffb3a3 */ |
1198 | status = | 1062 | status = cx231xx_read_i2c_data(dev, HAMMERHEAD_I2C_ADDRESS, |
1199 | cx231xx_read_i2c_data(dev, HAMMERHEAD_I2C_ADDRESS, | ||
1200 | PATH1_SC_CTL, 2, &dwval, 4); | 1063 | PATH1_SC_CTL, 2, &dwval, 4); |
1201 | status = | 1064 | status = cx231xx_write_i2c_data(dev, HAMMERHEAD_I2C_ADDRESS, |
1202 | cx231xx_write_i2c_data(dev, HAMMERHEAD_I2C_ADDRESS, | ||
1203 | PATH1_SC_CTL, 2, | 1065 | PATH1_SC_CTL, 2, |
1204 | (dwval | FLD_PATH1_SC_THRESHOLD), 4); | 1066 | (dwval | FLD_PATH1_SC_THRESHOLD), 4); |
1205 | break; | 1067 | break; |
@@ -1208,73 +1070,46 @@ int cx231xx_set_audio_decoder_input(struct cx231xx *dev, | |||
1208 | default: | 1070 | default: |
1209 | 1071 | ||
1210 | /* Setup SRC sources and clocks */ | 1072 | /* Setup SRC sources and clocks */ |
1211 | status = | 1073 | status = cx231xx_write_i2c_data(dev, HAMMERHEAD_I2C_ADDRESS, |
1212 | cx231xx_write_i2c_data(dev, HAMMERHEAD_I2C_ADDRESS, | 1074 | BAND_OUT_SEL, 2, |
1213 | BAND_OUT_SEL, 2, | 1075 | cx231xx_set_field(FLD_SRC6_IN_SEL, 0x00) | |
1214 | cx231xx_set_field(FLD_SRC6_IN_SEL, | 1076 | cx231xx_set_field(FLD_SRC6_CLK_SEL, 0x01) | |
1215 | 0x00) | | 1077 | cx231xx_set_field(FLD_SRC5_IN_SEL, 0x00) | |
1216 | cx231xx_set_field(FLD_SRC6_CLK_SEL, | 1078 | cx231xx_set_field(FLD_SRC5_CLK_SEL, 0x02) | |
1217 | 0x01) | | 1079 | cx231xx_set_field(FLD_SRC4_IN_SEL, 0x02) | |
1218 | cx231xx_set_field(FLD_SRC5_IN_SEL, | 1080 | cx231xx_set_field(FLD_SRC4_CLK_SEL, 0x03) | |
1219 | 0x00) | | 1081 | cx231xx_set_field(FLD_SRC3_IN_SEL, 0x00) | |
1220 | cx231xx_set_field(FLD_SRC5_CLK_SEL, | 1082 | cx231xx_set_field(FLD_SRC3_CLK_SEL, 0x00) | |
1221 | 0x02) | | 1083 | cx231xx_set_field(FLD_BASEBAND_BYPASS_CTL, 0x00) | |
1222 | cx231xx_set_field(FLD_SRC4_IN_SEL, | 1084 | cx231xx_set_field(FLD_AC97_SRC_SEL, 0x03) | |
1223 | 0x02) | | 1085 | cx231xx_set_field(FLD_I2S_SRC_SEL, 0x00) | |
1224 | cx231xx_set_field(FLD_SRC4_CLK_SEL, | 1086 | cx231xx_set_field(FLD_PARALLEL2_SRC_SEL, 0x02) | |
1225 | 0x03) | | 1087 | cx231xx_set_field(FLD_PARALLEL1_SRC_SEL, 0x01), 4); |
1226 | cx231xx_set_field(FLD_SRC3_IN_SEL, | ||
1227 | 0x00) | | ||
1228 | cx231xx_set_field(FLD_SRC3_CLK_SEL, | ||
1229 | 0x00) | | ||
1230 | cx231xx_set_field | ||
1231 | (FLD_BASEBAND_BYPASS_CTL, | ||
1232 | 0x00) | | ||
1233 | cx231xx_set_field(FLD_AC97_SRC_SEL, | ||
1234 | 0x03) | | ||
1235 | cx231xx_set_field(FLD_I2S_SRC_SEL, | ||
1236 | 0x00) | | ||
1237 | cx231xx_set_field | ||
1238 | (FLD_PARALLEL2_SRC_SEL, | ||
1239 | 0x02) | | ||
1240 | cx231xx_set_field | ||
1241 | (FLD_PARALLEL1_SRC_SEL, 0x01), 4); | ||
1242 | 1088 | ||
1243 | /* Setup the AUD_IO control */ | 1089 | /* Setup the AUD_IO control */ |
1244 | status = | 1090 | status = cx231xx_write_i2c_data(dev, HAMMERHEAD_I2C_ADDRESS, |
1245 | cx231xx_write_i2c_data(dev, HAMMERHEAD_I2C_ADDRESS, | 1091 | AUD_IO_CTRL, 2, |
1246 | AUD_IO_CTRL, 2, | 1092 | cx231xx_set_field(FLD_I2S_PORT_DIR, 0x00) | |
1247 | cx231xx_set_field(FLD_I2S_PORT_DIR, | 1093 | cx231xx_set_field(FLD_I2S_OUT_SRC, 0x00) | |
1248 | 0x00) | | 1094 | cx231xx_set_field(FLD_AUD_CHAN3_SRC, 0x00) | |
1249 | cx231xx_set_field(FLD_I2S_OUT_SRC, | 1095 | cx231xx_set_field(FLD_AUD_CHAN2_SRC, 0x00) | |
1250 | 0x00) | | 1096 | cx231xx_set_field(FLD_AUD_CHAN1_SRC, 0x03), 4); |
1251 | cx231xx_set_field(FLD_AUD_CHAN3_SRC, | ||
1252 | 0x00) | | ||
1253 | cx231xx_set_field(FLD_AUD_CHAN2_SRC, | ||
1254 | 0x00) | | ||
1255 | cx231xx_set_field(FLD_AUD_CHAN1_SRC, | ||
1256 | 0x03), 4); | ||
1257 | 1097 | ||
1258 | status = | 1098 | status = cx231xx_write_i2c_data(dev, HAMMERHEAD_I2C_ADDRESS, |
1259 | cx231xx_write_i2c_data(dev, HAMMERHEAD_I2C_ADDRESS, | ||
1260 | PATH1_CTL1, 2, 0x1F063870, 4); | 1099 | PATH1_CTL1, 2, 0x1F063870, 4); |
1261 | 1100 | ||
1262 | /* setAudioStandard(_audio_standard); */ | 1101 | /* setAudioStandard(_audio_standard); */ |
1263 | 1102 | ||
1264 | status = | 1103 | status = cx231xx_write_i2c_data(dev, HAMMERHEAD_I2C_ADDRESS, |
1265 | cx231xx_write_i2c_data(dev, HAMMERHEAD_I2C_ADDRESS, | ||
1266 | PATH1_CTL1, 2, 0x00063870, 4); | 1104 | PATH1_CTL1, 2, 0x00063870, 4); |
1267 | switch (dev->model) { | 1105 | switch (dev->model) { |
1268 | case CX231XX_BOARD_CNXT_RDE_250: | 1106 | case CX231XX_BOARD_CNXT_RDE_250: |
1269 | case CX231XX_BOARD_CNXT_RDU_250: | 1107 | case CX231XX_BOARD_CNXT_RDU_250: |
1270 | status = | 1108 | status = cx231xx_read_modify_write_i2c_dword(dev, |
1271 | cx231xx_read_modify_write_i2c_dword(dev, | 1109 | HAMMERHEAD_I2C_ADDRESS, |
1272 | HAMMERHEAD_I2C_ADDRESS, | 1110 | CHIP_CTRL, |
1273 | CHIP_CTRL, | 1111 | FLD_SIF_EN, |
1274 | FLD_SIF_EN, | 1112 | cx231xx_set_field(FLD_SIF_EN, 1)); |
1275 | cx231xx_set_field | ||
1276 | (FLD_SIF_EN, | ||
1277 | 1)); | ||
1278 | break; | 1113 | break; |
1279 | default: | 1114 | default: |
1280 | break; | 1115 | break; |
@@ -1289,20 +1124,17 @@ int cx231xx_set_audio_decoder_input(struct cx231xx *dev, | |||
1289 | break; | 1124 | break; |
1290 | 1125 | ||
1291 | case AUDIO_INPUT_MUTE: | 1126 | case AUDIO_INPUT_MUTE: |
1292 | status = | 1127 | status = cx231xx_write_i2c_data(dev, HAMMERHEAD_I2C_ADDRESS, |
1293 | cx231xx_write_i2c_data(dev, HAMMERHEAD_I2C_ADDRESS, | ||
1294 | PATH1_CTL1, 2, 0x1F011012, 4); | 1128 | PATH1_CTL1, 2, 0x1F011012, 4); |
1295 | break; | 1129 | break; |
1296 | } | 1130 | } |
1297 | 1131 | ||
1298 | /* Take it out of soft reset */ | 1132 | /* Take it out of soft reset */ |
1299 | status = | 1133 | status = cx231xx_read_i2c_data(dev, HAMMERHEAD_I2C_ADDRESS, |
1300 | cx231xx_read_i2c_data(dev, HAMMERHEAD_I2C_ADDRESS, GENERAL_CTL, 2, | 1134 | GENERAL_CTL, 2, &gen_ctrl, 1); |
1301 | &gen_ctrl, 1); | ||
1302 | gen_ctrl &= ~1; | 1135 | gen_ctrl &= ~1; |
1303 | status = | 1136 | status = cx231xx_write_i2c_data(dev, HAMMERHEAD_I2C_ADDRESS, |
1304 | cx231xx_write_i2c_data(dev, HAMMERHEAD_I2C_ADDRESS, GENERAL_CTL, 2, | 1137 | GENERAL_CTL, 2, gen_ctrl, 1); |
1305 | gen_ctrl, 1); | ||
1306 | 1138 | ||
1307 | return status; | 1139 | return status; |
1308 | } | 1140 | } |
@@ -1320,33 +1152,29 @@ int cx231xx_resolution_set(struct cx231xx *dev) | |||
1320 | get_scale(dev, width, height, &hscale, &vscale); | 1152 | get_scale(dev, width, height, &hscale, &vscale); |
1321 | 1153 | ||
1322 | /* set horzontal scale */ | 1154 | /* set horzontal scale */ |
1323 | status = | 1155 | status = cx231xx_write_i2c_data(dev, HAMMERHEAD_I2C_ADDRESS, |
1324 | cx231xx_write_i2c_data(dev, HAMMERHEAD_I2C_ADDRESS, HSCALE_CTRL, 2, | 1156 | HSCALE_CTRL, 2, hscale, 4); |
1325 | hscale, 4); | ||
1326 | 1157 | ||
1327 | /* set vertical scale */ | 1158 | /* set vertical scale */ |
1328 | status = | 1159 | status = cx231xx_write_i2c_data(dev, HAMMERHEAD_I2C_ADDRESS, |
1329 | cx231xx_write_i2c_data(dev, HAMMERHEAD_I2C_ADDRESS, VSCALE_CTRL, 2, | 1160 | VSCALE_CTRL, 2, vscale, 4); |
1330 | vscale, 4); | ||
1331 | 1161 | ||
1332 | return status; | 1162 | return status; |
1333 | } | 1163 | } |
1334 | 1164 | ||
1335 | /************************************************************************************* | 1165 | /****************************************************************************** |
1336 | * C H I P Specific C O N T R O L functions * | 1166 | * C H I P Specific C O N T R O L functions * |
1337 | *************************************************************************************/ | 1167 | ******************************************************************************/ |
1338 | int cx231xx_init_ctrl_pin_status(struct cx231xx *dev) | 1168 | int cx231xx_init_ctrl_pin_status(struct cx231xx *dev) |
1339 | { | 1169 | { |
1340 | u32 value; | 1170 | u32 value; |
1341 | int status = 0; | 1171 | int status = 0; |
1342 | 1172 | ||
1343 | status = | 1173 | status = cx231xx_read_i2c_data(dev, HAMMERHEAD_I2C_ADDRESS, PIN_CTRL, |
1344 | cx231xx_read_i2c_data(dev, HAMMERHEAD_I2C_ADDRESS, PIN_CTRL, 2, | 1174 | 2, &value, 4); |
1345 | &value, 4); | ||
1346 | value |= (~dev->board.ctl_pin_status_mask); | 1175 | value |= (~dev->board.ctl_pin_status_mask); |
1347 | status = | 1176 | status = cx231xx_write_i2c_data(dev, HAMMERHEAD_I2C_ADDRESS, PIN_CTRL, |
1348 | cx231xx_write_i2c_data(dev, HAMMERHEAD_I2C_ADDRESS, PIN_CTRL, 2, | 1177 | 2, value, 4); |
1349 | value, 4); | ||
1350 | 1178 | ||
1351 | return status; | 1179 | return status; |
1352 | } | 1180 | } |
@@ -1357,14 +1185,12 @@ int cx231xx_set_agc_analog_digital_mux_select(struct cx231xx *dev, | |||
1357 | int status = 0; | 1185 | int status = 0; |
1358 | 1186 | ||
1359 | /* first set the direction to output */ | 1187 | /* first set the direction to output */ |
1360 | status = | 1188 | status = cx231xx_set_gpio_direction(dev, |
1361 | cx231xx_set_gpio_direction(dev, | 1189 | dev->board. |
1362 | dev->board. | 1190 | agc_analog_digital_select_gpio, 1); |
1363 | agc_analog_digital_select_gpio, 1); | ||
1364 | 1191 | ||
1365 | /* 0 - demod ; 1 - Analog mode */ | 1192 | /* 0 - demod ; 1 - Analog mode */ |
1366 | status = | 1193 | status = cx231xx_set_gpio_value(dev, |
1367 | cx231xx_set_gpio_value(dev, | ||
1368 | dev->board.agc_analog_digital_select_gpio, | 1194 | dev->board.agc_analog_digital_select_gpio, |
1369 | analog_or_digital); | 1195 | analog_or_digital); |
1370 | 1196 | ||
@@ -1378,23 +1204,21 @@ int cx231xx_enable_i2c_for_tuner(struct cx231xx *dev, u8 I2CIndex) | |||
1378 | 1204 | ||
1379 | cx231xx_info("Changing the i2c port for tuner to %d\n", I2CIndex); | 1205 | cx231xx_info("Changing the i2c port for tuner to %d\n", I2CIndex); |
1380 | 1206 | ||
1381 | status = | 1207 | status = cx231xx_read_ctrl_reg(dev, VRT_GET_REGISTER, |
1382 | cx231xx_read_ctrl_reg(dev, VRT_GET_REGISTER, PWR_CTL_EN, value, 4); | 1208 | PWR_CTL_EN, value, 4); |
1383 | if (status < 0) | 1209 | if (status < 0) |
1384 | return status; | 1210 | return status; |
1385 | 1211 | ||
1386 | if (I2CIndex == I2C_1) { | 1212 | if (I2CIndex == I2C_1) { |
1387 | if (value[0] & I2C_DEMOD_EN) { | 1213 | if (value[0] & I2C_DEMOD_EN) { |
1388 | value[0] &= ~I2C_DEMOD_EN; | 1214 | value[0] &= ~I2C_DEMOD_EN; |
1389 | status = | 1215 | status = cx231xx_write_ctrl_reg(dev, VRT_SET_REGISTER, |
1390 | cx231xx_write_ctrl_reg(dev, VRT_SET_REGISTER, | ||
1391 | PWR_CTL_EN, value, 4); | 1216 | PWR_CTL_EN, value, 4); |
1392 | } | 1217 | } |
1393 | } else { | 1218 | } else { |
1394 | if (!(value[0] & I2C_DEMOD_EN)) { | 1219 | if (!(value[0] & I2C_DEMOD_EN)) { |
1395 | value[0] |= I2C_DEMOD_EN; | 1220 | value[0] |= I2C_DEMOD_EN; |
1396 | status = | 1221 | status = cx231xx_write_ctrl_reg(dev, VRT_SET_REGISTER, |
1397 | cx231xx_write_ctrl_reg(dev, VRT_SET_REGISTER, | ||
1398 | PWR_CTL_EN, value, 4); | 1222 | PWR_CTL_EN, value, 4); |
1399 | } | 1223 | } |
1400 | } | 1224 | } |
@@ -1403,9 +1227,9 @@ int cx231xx_enable_i2c_for_tuner(struct cx231xx *dev, u8 I2CIndex) | |||
1403 | 1227 | ||
1404 | } | 1228 | } |
1405 | 1229 | ||
1406 | /************************************************************************************* | 1230 | /****************************************************************************** |
1407 | * D I F - B L O C K C O N T R O L functions * | 1231 | * D I F - B L O C K C O N T R O L functions * |
1408 | *************************************************************************************/ | 1232 | ******************************************************************************/ |
1409 | int cx231xx_dif_configure_C2HH_for_low_IF(struct cx231xx *dev, u32 mode, | 1233 | int cx231xx_dif_configure_C2HH_for_low_IF(struct cx231xx *dev, u32 mode, |
1410 | u32 function_mode, u32 standard) | 1234 | u32 function_mode, u32 standard) |
1411 | { | 1235 | { |
@@ -1413,10 +1237,14 @@ int cx231xx_dif_configure_C2HH_for_low_IF(struct cx231xx *dev, u32 mode, | |||
1413 | 1237 | ||
1414 | if (mode == V4L2_TUNER_RADIO) { | 1238 | if (mode == V4L2_TUNER_RADIO) { |
1415 | /* C2HH */ | 1239 | /* C2HH */ |
1416 | status = cx231xx_reg_mask_write(dev, HAMMERHEAD_I2C_ADDRESS, 32, AFE_CTRL_C2HH_SRC_CTRL, 30, 31, 0x1); /* lo if big signal */ | 1240 | status = cx231xx_reg_mask_write(dev, HAMMERHEAD_I2C_ADDRESS, 32, |
1417 | status = cx231xx_reg_mask_write(dev, HAMMERHEAD_I2C_ADDRESS, 32, AFE_CTRL_C2HH_SRC_CTRL, 23, 24, function_mode); /* FUNC_MODE = DIF */ | 1241 | AFE_CTRL_C2HH_SRC_CTRL, 30, 31, 0x1); /* lo if big signal */ |
1418 | status = cx231xx_reg_mask_write(dev, HAMMERHEAD_I2C_ADDRESS, 32, AFE_CTRL_C2HH_SRC_CTRL, 15, 22, 0xFF); /* IF_MODE */ | 1242 | status = cx231xx_reg_mask_write(dev, HAMMERHEAD_I2C_ADDRESS, 32, |
1419 | status = cx231xx_reg_mask_write(dev, HAMMERHEAD_I2C_ADDRESS, 32, AFE_CTRL_C2HH_SRC_CTRL, 9, 9, 0x1); /* no inv */ | 1243 | AFE_CTRL_C2HH_SRC_CTRL, 23, 24, function_mode); /* FUNC_MODE = DIF */ |
1244 | status = cx231xx_reg_mask_write(dev, HAMMERHEAD_I2C_ADDRESS, 32, | ||
1245 | AFE_CTRL_C2HH_SRC_CTRL, 15, 22, 0xFF); /* IF_MODE */ | ||
1246 | status = cx231xx_reg_mask_write(dev, HAMMERHEAD_I2C_ADDRESS, 32, | ||
1247 | AFE_CTRL_C2HH_SRC_CTRL, 9, 9, 0x1); /* no inv */ | ||
1420 | } else { | 1248 | } else { |
1421 | switch (standard) { | 1249 | switch (standard) { |
1422 | case V4L2_STD_NTSC_M: /* 75 IRE Setup */ | 1250 | case V4L2_STD_NTSC_M: /* 75 IRE Setup */ |
@@ -1424,20 +1252,40 @@ int cx231xx_dif_configure_C2HH_for_low_IF(struct cx231xx *dev, u32 mode, | |||
1424 | case V4L2_STD_PAL_M: | 1252 | case V4L2_STD_PAL_M: |
1425 | case V4L2_STD_PAL_N: | 1253 | case V4L2_STD_PAL_N: |
1426 | case V4L2_STD_PAL_Nc: | 1254 | case V4L2_STD_PAL_Nc: |
1427 | status = cx231xx_reg_mask_write(dev, HAMMERHEAD_I2C_ADDRESS, 32, AFE_CTRL_C2HH_SRC_CTRL, 30, 31, 0x1); /* lo if big signal */ | 1255 | status = cx231xx_reg_mask_write(dev, |
1428 | status = cx231xx_reg_mask_write(dev, HAMMERHEAD_I2C_ADDRESS, 32, AFE_CTRL_C2HH_SRC_CTRL, 23, 24, function_mode); /* FUNC_MODE = DIF */ | 1256 | HAMMERHEAD_I2C_ADDRESS, 32, |
1429 | status = cx231xx_reg_mask_write(dev, HAMMERHEAD_I2C_ADDRESS, 32, AFE_CTRL_C2HH_SRC_CTRL, 15, 22, 0xb); /* IF_MODE */ | 1257 | AFE_CTRL_C2HH_SRC_CTRL, 30, 31, 0x1); /* lo if big signal */ |
1430 | status = cx231xx_reg_mask_write(dev, HAMMERHEAD_I2C_ADDRESS, 32, AFE_CTRL_C2HH_SRC_CTRL, 9, 9, 0x1); /* no inv */ | 1258 | status = cx231xx_reg_mask_write(dev, |
1431 | status = cx231xx_reg_mask_write(dev, HAMMERHEAD_I2C_ADDRESS, 32, AUD_IO_CTRL, 0, 31, 0x00000003); /* 0x124, AUD_CHAN1_SRC = 0x3 */ | 1259 | HAMMERHEAD_I2C_ADDRESS, 32, |
1260 | AFE_CTRL_C2HH_SRC_CTRL, 23, 24, | ||
1261 | function_mode); /* FUNC_MODE = DIF */ | ||
1262 | status = cx231xx_reg_mask_write(dev, | ||
1263 | HAMMERHEAD_I2C_ADDRESS, 32, | ||
1264 | AFE_CTRL_C2HH_SRC_CTRL, 15, 22, 0xb); /* IF_MODE */ | ||
1265 | status = cx231xx_reg_mask_write(dev, | ||
1266 | HAMMERHEAD_I2C_ADDRESS, 32, | ||
1267 | AFE_CTRL_C2HH_SRC_CTRL, 9, 9, 0x1); /* no inv */ | ||
1268 | status = cx231xx_reg_mask_write(dev, | ||
1269 | HAMMERHEAD_I2C_ADDRESS, 32, | ||
1270 | AUD_IO_CTRL, 0, 31, 0x00000003); /* 0x124, AUD_CHAN1_SRC = 0x3 */ | ||
1432 | break; | 1271 | break; |
1433 | 1272 | ||
1434 | case V4L2_STD_PAL_B: | 1273 | case V4L2_STD_PAL_B: |
1435 | case V4L2_STD_PAL_G: | 1274 | case V4L2_STD_PAL_G: |
1436 | /* C2HH setup */ | 1275 | /* C2HH setup */ |
1437 | status = cx231xx_reg_mask_write(dev, HAMMERHEAD_I2C_ADDRESS, 32, AFE_CTRL_C2HH_SRC_CTRL, 30, 31, 0x1); /* lo if big signal */ | 1276 | status = cx231xx_reg_mask_write(dev, |
1438 | status = cx231xx_reg_mask_write(dev, HAMMERHEAD_I2C_ADDRESS, 32, AFE_CTRL_C2HH_SRC_CTRL, 23, 24, function_mode); /* FUNC_MODE = DIF */ | 1277 | HAMMERHEAD_I2C_ADDRESS, 32, |
1439 | status = cx231xx_reg_mask_write(dev, HAMMERHEAD_I2C_ADDRESS, 32, AFE_CTRL_C2HH_SRC_CTRL, 15, 22, 0xE); /* IF_MODE */ | 1278 | AFE_CTRL_C2HH_SRC_CTRL, 30, 31, 0x1); /* lo if big signal */ |
1440 | status = cx231xx_reg_mask_write(dev, HAMMERHEAD_I2C_ADDRESS, 32, AFE_CTRL_C2HH_SRC_CTRL, 9, 9, 0x1); /* no inv */ | 1279 | status = cx231xx_reg_mask_write(dev, |
1280 | HAMMERHEAD_I2C_ADDRESS, 32, | ||
1281 | AFE_CTRL_C2HH_SRC_CTRL, 23, 24, | ||
1282 | function_mode); /* FUNC_MODE = DIF */ | ||
1283 | status = cx231xx_reg_mask_write(dev, | ||
1284 | HAMMERHEAD_I2C_ADDRESS, 32, | ||
1285 | AFE_CTRL_C2HH_SRC_CTRL, 15, 22, 0xE); /* IF_MODE */ | ||
1286 | status = cx231xx_reg_mask_write(dev, | ||
1287 | HAMMERHEAD_I2C_ADDRESS, 32, | ||
1288 | AFE_CTRL_C2HH_SRC_CTRL, 9, 9, 0x1); /* no inv */ | ||
1441 | break; | 1289 | break; |
1442 | 1290 | ||
1443 | case V4L2_STD_PAL_D: | 1291 | case V4L2_STD_PAL_D: |
@@ -1450,10 +1298,19 @@ int cx231xx_dif_configure_C2HH_for_low_IF(struct cx231xx *dev, u32 mode, | |||
1450 | case V4L2_STD_SECAM_K: | 1298 | case V4L2_STD_SECAM_K: |
1451 | case V4L2_STD_SECAM_K1: | 1299 | case V4L2_STD_SECAM_K1: |
1452 | /* C2HH setup */ | 1300 | /* C2HH setup */ |
1453 | status = cx231xx_reg_mask_write(dev, HAMMERHEAD_I2C_ADDRESS, 32, AFE_CTRL_C2HH_SRC_CTRL, 30, 31, 0x1); /* lo if big signal */ | 1301 | status = cx231xx_reg_mask_write(dev, |
1454 | status = cx231xx_reg_mask_write(dev, HAMMERHEAD_I2C_ADDRESS, 32, AFE_CTRL_C2HH_SRC_CTRL, 23, 24, function_mode); /* FUNC_MODE = DIF */ | 1302 | HAMMERHEAD_I2C_ADDRESS, 32, |
1455 | status = cx231xx_reg_mask_write(dev, HAMMERHEAD_I2C_ADDRESS, 32, AFE_CTRL_C2HH_SRC_CTRL, 15, 22, 0xF); /* IF_MODE */ | 1303 | AFE_CTRL_C2HH_SRC_CTRL, 30, 31, 0x1); /* lo if big signal */ |
1456 | status = cx231xx_reg_mask_write(dev, HAMMERHEAD_I2C_ADDRESS, 32, AFE_CTRL_C2HH_SRC_CTRL, 9, 9, 0x1); /* no inv */ | 1304 | status = cx231xx_reg_mask_write(dev, |
1305 | HAMMERHEAD_I2C_ADDRESS, 32, | ||
1306 | AFE_CTRL_C2HH_SRC_CTRL, 23, 24, | ||
1307 | function_mode); /* FUNC_MODE = DIF */ | ||
1308 | status = cx231xx_reg_mask_write(dev, | ||
1309 | HAMMERHEAD_I2C_ADDRESS, 32, | ||
1310 | AFE_CTRL_C2HH_SRC_CTRL, 15, 22, 0xF); /* IF_MODE */ | ||
1311 | status = cx231xx_reg_mask_write(dev, | ||
1312 | HAMMERHEAD_I2C_ADDRESS, 32, | ||
1313 | AFE_CTRL_C2HH_SRC_CTRL, 9, 9, 0x1); /* no inv */ | ||
1457 | break; | 1314 | break; |
1458 | 1315 | ||
1459 | case DIF_USE_BASEBAND: | 1316 | case DIF_USE_BASEBAND: |
@@ -1489,20 +1346,18 @@ int cx231xx_dif_set_standard(struct cx231xx *dev, u32 standard) | |||
1489 | func_mode = 0x01; | 1346 | func_mode = 0x01; |
1490 | } | 1347 | } |
1491 | 1348 | ||
1492 | status = | 1349 | status = cx231xx_dif_configure_C2HH_for_low_IF(dev, dev->active_mode, |
1493 | cx231xx_dif_configure_C2HH_for_low_IF(dev, dev->active_mode, | ||
1494 | func_mode, standard); | 1350 | func_mode, standard); |
1495 | 1351 | ||
1496 | if (standard == DIF_USE_BASEBAND) { /* base band */ | 1352 | if (standard == DIF_USE_BASEBAND) { /* base band */ |
1497 | 1353 | /* There is a different SRC_PHASE_INC value | |
1498 | /* There is a different SRC_PHASE_INC value for baseband vs. DIF */ | 1354 | for baseband vs. DIF */ |
1499 | status = cx231xx_write_i2c_data(dev, HAMMERHEAD_I2C_ADDRESS, | 1355 | status = cx231xx_write_i2c_data(dev, HAMMERHEAD_I2C_ADDRESS, |
1500 | DIF_SRC_PHASE_INC, 2, 0xDF7DF83, | 1356 | DIF_SRC_PHASE_INC, 2, 0xDF7DF83, |
1501 | 4); | 1357 | 4); |
1502 | status = | 1358 | status = cx231xx_read_i2c_data(dev, HAMMERHEAD_I2C_ADDRESS, |
1503 | cx231xx_read_i2c_data(dev, HAMMERHEAD_I2C_ADDRESS, | 1359 | DIF_MISC_CTRL, 2, |
1504 | DIF_MISC_CTRL, 2, | 1360 | &dif_misc_ctrl_value, 4); |
1505 | &dif_misc_ctrl_value, 4); | ||
1506 | dif_misc_ctrl_value |= FLD_DIF_DIF_BYPASS; | 1361 | dif_misc_ctrl_value |= FLD_DIF_DIF_BYPASS; |
1507 | status = cx231xx_write_i2c_data(dev, HAMMERHEAD_I2C_ADDRESS, | 1362 | status = cx231xx_write_i2c_data(dev, HAMMERHEAD_I2C_ADDRESS, |
1508 | DIF_MISC_CTRL, 2, | 1363 | DIF_MISC_CTRL, 2, |
@@ -1510,127 +1365,92 @@ int cx231xx_dif_set_standard(struct cx231xx *dev, u32 standard) | |||
1510 | 1365 | ||
1511 | } else if (standard & (V4L2_STD_PAL_B | V4L2_STD_PAL_G)) { | 1366 | } else if (standard & (V4L2_STD_PAL_B | V4L2_STD_PAL_G)) { |
1512 | 1367 | ||
1513 | status = | 1368 | status = cx231xx_reg_mask_write(dev, HAMMERHEAD_I2C_ADDRESS, 32, |
1514 | cx231xx_reg_mask_write(dev, HAMMERHEAD_I2C_ADDRESS, 32, | ||
1515 | DIF_PLL_CTRL, 0, 31, 0x6503bc0c); | 1369 | DIF_PLL_CTRL, 0, 31, 0x6503bc0c); |
1516 | status = | 1370 | status = cx231xx_reg_mask_write(dev, HAMMERHEAD_I2C_ADDRESS, 32, |
1517 | cx231xx_reg_mask_write(dev, HAMMERHEAD_I2C_ADDRESS, 32, | ||
1518 | DIF_PLL_CTRL1, 0, 31, 0xbd038c85); | 1371 | DIF_PLL_CTRL1, 0, 31, 0xbd038c85); |
1519 | status = | 1372 | status = cx231xx_reg_mask_write(dev, HAMMERHEAD_I2C_ADDRESS, 32, |
1520 | cx231xx_reg_mask_write(dev, HAMMERHEAD_I2C_ADDRESS, 32, | ||
1521 | DIF_PLL_CTRL2, 0, 31, 0x1db4640a); | 1373 | DIF_PLL_CTRL2, 0, 31, 0x1db4640a); |
1522 | status = | 1374 | status = cx231xx_reg_mask_write(dev, HAMMERHEAD_I2C_ADDRESS, 32, |
1523 | cx231xx_reg_mask_write(dev, HAMMERHEAD_I2C_ADDRESS, 32, | ||
1524 | DIF_PLL_CTRL3, 0, 31, 0x00008800); | 1375 | DIF_PLL_CTRL3, 0, 31, 0x00008800); |
1525 | status = | 1376 | status = cx231xx_reg_mask_write(dev, HAMMERHEAD_I2C_ADDRESS, 32, |
1526 | cx231xx_reg_mask_write(dev, HAMMERHEAD_I2C_ADDRESS, 32, | ||
1527 | DIF_AGC_IF_REF, 0, 31, 0x444C1380); | 1377 | DIF_AGC_IF_REF, 0, 31, 0x444C1380); |
1528 | status = | 1378 | status = cx231xx_reg_mask_write(dev, HAMMERHEAD_I2C_ADDRESS, 32, |
1529 | cx231xx_reg_mask_write(dev, HAMMERHEAD_I2C_ADDRESS, 32, | ||
1530 | DIF_AGC_CTRL_IF, 0, 31, 0xDA302600); | 1379 | DIF_AGC_CTRL_IF, 0, 31, 0xDA302600); |
1531 | status = | 1380 | status = cx231xx_reg_mask_write(dev, HAMMERHEAD_I2C_ADDRESS, 32, |
1532 | cx231xx_reg_mask_write(dev, HAMMERHEAD_I2C_ADDRESS, 32, | ||
1533 | DIF_AGC_CTRL_INT, 0, 31, 0xDA261700); | 1381 | DIF_AGC_CTRL_INT, 0, 31, 0xDA261700); |
1534 | status = | 1382 | status = cx231xx_reg_mask_write(dev, HAMMERHEAD_I2C_ADDRESS, 32, |
1535 | cx231xx_reg_mask_write(dev, HAMMERHEAD_I2C_ADDRESS, 32, | ||
1536 | DIF_AGC_CTRL_RF, 0, 31, 0xDA262600); | 1383 | DIF_AGC_CTRL_RF, 0, 31, 0xDA262600); |
1537 | status = | 1384 | status = cx231xx_reg_mask_write(dev, HAMMERHEAD_I2C_ADDRESS, 32, |
1538 | cx231xx_reg_mask_write(dev, HAMMERHEAD_I2C_ADDRESS, 32, | ||
1539 | DIF_AGC_IF_INT_CURRENT, 0, 31, | 1385 | DIF_AGC_IF_INT_CURRENT, 0, 31, |
1540 | 0x26001700); | 1386 | 0x26001700); |
1541 | status = | 1387 | status = cx231xx_reg_mask_write(dev, HAMMERHEAD_I2C_ADDRESS, 32, |
1542 | cx231xx_reg_mask_write(dev, HAMMERHEAD_I2C_ADDRESS, 32, | ||
1543 | DIF_AGC_RF_CURRENT, 0, 31, | 1388 | DIF_AGC_RF_CURRENT, 0, 31, |
1544 | 0x00002660); | 1389 | 0x00002660); |
1545 | status = | 1390 | status = cx231xx_reg_mask_write(dev, HAMMERHEAD_I2C_ADDRESS, 32, |
1546 | cx231xx_reg_mask_write(dev, HAMMERHEAD_I2C_ADDRESS, 32, | ||
1547 | DIF_VIDEO_AGC_CTRL, 0, 31, | 1391 | DIF_VIDEO_AGC_CTRL, 0, 31, |
1548 | 0x72500800); | 1392 | 0x72500800); |
1549 | status = | 1393 | status = cx231xx_reg_mask_write(dev, HAMMERHEAD_I2C_ADDRESS, 32, |
1550 | cx231xx_reg_mask_write(dev, HAMMERHEAD_I2C_ADDRESS, 32, | ||
1551 | DIF_VID_AUD_OVERRIDE, 0, 31, | 1394 | DIF_VID_AUD_OVERRIDE, 0, 31, |
1552 | 0x27000100); | 1395 | 0x27000100); |
1553 | status = | 1396 | status = cx231xx_reg_mask_write(dev, HAMMERHEAD_I2C_ADDRESS, 32, |
1554 | cx231xx_reg_mask_write(dev, HAMMERHEAD_I2C_ADDRESS, 32, | ||
1555 | DIF_AV_SEP_CTRL, 0, 31, 0x3F3530EC); | 1397 | DIF_AV_SEP_CTRL, 0, 31, 0x3F3530EC); |
1556 | status = | 1398 | status = cx231xx_reg_mask_write(dev, HAMMERHEAD_I2C_ADDRESS, 32, |
1557 | cx231xx_reg_mask_write(dev, HAMMERHEAD_I2C_ADDRESS, 32, | ||
1558 | DIF_COMP_FLT_CTRL, 0, 31, | 1399 | DIF_COMP_FLT_CTRL, 0, 31, |
1559 | 0x00A653A8); | 1400 | 0x00A653A8); |
1560 | status = | 1401 | status = cx231xx_reg_mask_write(dev, HAMMERHEAD_I2C_ADDRESS, 32, |
1561 | cx231xx_reg_mask_write(dev, HAMMERHEAD_I2C_ADDRESS, 32, | ||
1562 | DIF_SRC_PHASE_INC, 0, 31, | 1402 | DIF_SRC_PHASE_INC, 0, 31, |
1563 | 0x1befbf06); | 1403 | 0x1befbf06); |
1564 | status = | 1404 | status = cx231xx_reg_mask_write(dev, HAMMERHEAD_I2C_ADDRESS, 32, |
1565 | cx231xx_reg_mask_write(dev, HAMMERHEAD_I2C_ADDRESS, 32, | ||
1566 | DIF_SRC_GAIN_CONTROL, 0, 31, | 1405 | DIF_SRC_GAIN_CONTROL, 0, 31, |
1567 | 0x000035e8); | 1406 | 0x000035e8); |
1568 | status = | 1407 | status = cx231xx_reg_mask_write(dev, HAMMERHEAD_I2C_ADDRESS, 32, |
1569 | cx231xx_reg_mask_write(dev, HAMMERHEAD_I2C_ADDRESS, 32, | ||
1570 | DIF_RPT_VARIANCE, 0, 31, 0x00000000); | 1408 | DIF_RPT_VARIANCE, 0, 31, 0x00000000); |
1571 | /* Save the Spec Inversion value */ | 1409 | /* Save the Spec Inversion value */ |
1572 | dif_misc_ctrl_value &= FLD_DIF_SPEC_INV; | 1410 | dif_misc_ctrl_value &= FLD_DIF_SPEC_INV; |
1573 | dif_misc_ctrl_value |= 0x3a013F11; | 1411 | dif_misc_ctrl_value |= 0x3a013F11; |
1574 | 1412 | ||
1575 | } else if (standard & V4L2_STD_PAL_D) { | 1413 | } else if (standard & V4L2_STD_PAL_D) { |
1576 | 1414 | status = cx231xx_reg_mask_write(dev, HAMMERHEAD_I2C_ADDRESS, 32, | |
1577 | status = | ||
1578 | cx231xx_reg_mask_write(dev, HAMMERHEAD_I2C_ADDRESS, 32, | ||
1579 | DIF_PLL_CTRL, 0, 31, 0x6503bc0c); | 1415 | DIF_PLL_CTRL, 0, 31, 0x6503bc0c); |
1580 | status = | 1416 | status = cx231xx_reg_mask_write(dev, HAMMERHEAD_I2C_ADDRESS, 32, |
1581 | cx231xx_reg_mask_write(dev, HAMMERHEAD_I2C_ADDRESS, 32, | ||
1582 | DIF_PLL_CTRL1, 0, 31, 0xbd038c85); | 1417 | DIF_PLL_CTRL1, 0, 31, 0xbd038c85); |
1583 | status = | 1418 | status = cx231xx_reg_mask_write(dev, HAMMERHEAD_I2C_ADDRESS, 32, |
1584 | cx231xx_reg_mask_write(dev, HAMMERHEAD_I2C_ADDRESS, 32, | ||
1585 | DIF_PLL_CTRL2, 0, 31, 0x1db4640a); | 1419 | DIF_PLL_CTRL2, 0, 31, 0x1db4640a); |
1586 | status = | 1420 | status = cx231xx_reg_mask_write(dev, HAMMERHEAD_I2C_ADDRESS, 32, |
1587 | cx231xx_reg_mask_write(dev, HAMMERHEAD_I2C_ADDRESS, 32, | ||
1588 | DIF_PLL_CTRL3, 0, 31, 0x00008800); | 1421 | DIF_PLL_CTRL3, 0, 31, 0x00008800); |
1589 | status = | 1422 | status = cx231xx_reg_mask_write(dev, HAMMERHEAD_I2C_ADDRESS, 32, |
1590 | cx231xx_reg_mask_write(dev, HAMMERHEAD_I2C_ADDRESS, 32, | ||
1591 | DIF_AGC_IF_REF, 0, 31, 0x444C1380); | 1423 | DIF_AGC_IF_REF, 0, 31, 0x444C1380); |
1592 | status = | 1424 | status = cx231xx_reg_mask_write(dev, HAMMERHEAD_I2C_ADDRESS, 32, |
1593 | cx231xx_reg_mask_write(dev, HAMMERHEAD_I2C_ADDRESS, 32, | ||
1594 | DIF_AGC_CTRL_IF, 0, 31, 0xDA302600); | 1425 | DIF_AGC_CTRL_IF, 0, 31, 0xDA302600); |
1595 | status = | 1426 | status = cx231xx_reg_mask_write(dev, HAMMERHEAD_I2C_ADDRESS, 32, |
1596 | cx231xx_reg_mask_write(dev, HAMMERHEAD_I2C_ADDRESS, 32, | ||
1597 | DIF_AGC_CTRL_INT, 0, 31, 0xDA261700); | 1427 | DIF_AGC_CTRL_INT, 0, 31, 0xDA261700); |
1598 | status = | 1428 | status = cx231xx_reg_mask_write(dev, HAMMERHEAD_I2C_ADDRESS, 32, |
1599 | cx231xx_reg_mask_write(dev, HAMMERHEAD_I2C_ADDRESS, 32, | ||
1600 | DIF_AGC_CTRL_RF, 0, 31, 0xDA262600); | 1429 | DIF_AGC_CTRL_RF, 0, 31, 0xDA262600); |
1601 | status = | 1430 | status = cx231xx_reg_mask_write(dev, HAMMERHEAD_I2C_ADDRESS, 32, |
1602 | cx231xx_reg_mask_write(dev, HAMMERHEAD_I2C_ADDRESS, 32, | ||
1603 | DIF_AGC_IF_INT_CURRENT, 0, 31, | 1431 | DIF_AGC_IF_INT_CURRENT, 0, 31, |
1604 | 0x26001700); | 1432 | 0x26001700); |
1605 | status = | 1433 | status = cx231xx_reg_mask_write(dev, HAMMERHEAD_I2C_ADDRESS, 32, |
1606 | cx231xx_reg_mask_write(dev, HAMMERHEAD_I2C_ADDRESS, 32, | ||
1607 | DIF_AGC_RF_CURRENT, 0, 31, | 1434 | DIF_AGC_RF_CURRENT, 0, 31, |
1608 | 0x00002660); | 1435 | 0x00002660); |
1609 | status = | 1436 | status = cx231xx_reg_mask_write(dev, HAMMERHEAD_I2C_ADDRESS, 32, |
1610 | cx231xx_reg_mask_write(dev, HAMMERHEAD_I2C_ADDRESS, 32, | ||
1611 | DIF_VIDEO_AGC_CTRL, 0, 31, | 1437 | DIF_VIDEO_AGC_CTRL, 0, 31, |
1612 | 0x72500800); | 1438 | 0x72500800); |
1613 | status = | 1439 | status = cx231xx_reg_mask_write(dev, HAMMERHEAD_I2C_ADDRESS, 32, |
1614 | cx231xx_reg_mask_write(dev, HAMMERHEAD_I2C_ADDRESS, 32, | ||
1615 | DIF_VID_AUD_OVERRIDE, 0, 31, | 1440 | DIF_VID_AUD_OVERRIDE, 0, 31, |
1616 | 0x27000100); | 1441 | 0x27000100); |
1617 | status = | 1442 | status = cx231xx_reg_mask_write(dev, HAMMERHEAD_I2C_ADDRESS, 32, |
1618 | cx231xx_reg_mask_write(dev, HAMMERHEAD_I2C_ADDRESS, 32, | ||
1619 | DIF_AV_SEP_CTRL, 0, 31, 0x3F3934EA); | 1443 | DIF_AV_SEP_CTRL, 0, 31, 0x3F3934EA); |
1620 | status = | 1444 | status = cx231xx_reg_mask_write(dev, HAMMERHEAD_I2C_ADDRESS, 32, |
1621 | cx231xx_reg_mask_write(dev, HAMMERHEAD_I2C_ADDRESS, 32, | ||
1622 | DIF_COMP_FLT_CTRL, 0, 31, | 1445 | DIF_COMP_FLT_CTRL, 0, 31, |
1623 | 0x00000000); | 1446 | 0x00000000); |
1624 | status = | 1447 | status = cx231xx_reg_mask_write(dev, HAMMERHEAD_I2C_ADDRESS, 32, |
1625 | cx231xx_reg_mask_write(dev, HAMMERHEAD_I2C_ADDRESS, 32, | ||
1626 | DIF_SRC_PHASE_INC, 0, 31, | 1448 | DIF_SRC_PHASE_INC, 0, 31, |
1627 | 0x1befbf06); | 1449 | 0x1befbf06); |
1628 | status = | 1450 | status = cx231xx_reg_mask_write(dev, HAMMERHEAD_I2C_ADDRESS, 32, |
1629 | cx231xx_reg_mask_write(dev, HAMMERHEAD_I2C_ADDRESS, 32, | ||
1630 | DIF_SRC_GAIN_CONTROL, 0, 31, | 1451 | DIF_SRC_GAIN_CONTROL, 0, 31, |
1631 | 0x000035e8); | 1452 | 0x000035e8); |
1632 | status = | 1453 | status = cx231xx_reg_mask_write(dev, HAMMERHEAD_I2C_ADDRESS, 32, |
1633 | cx231xx_reg_mask_write(dev, HAMMERHEAD_I2C_ADDRESS, 32, | ||
1634 | DIF_RPT_VARIANCE, 0, 31, 0x00000000); | 1454 | DIF_RPT_VARIANCE, 0, 31, 0x00000000); |
1635 | /* Save the Spec Inversion value */ | 1455 | /* Save the Spec Inversion value */ |
1636 | dif_misc_ctrl_value &= FLD_DIF_SPEC_INV; | 1456 | dif_misc_ctrl_value &= FLD_DIF_SPEC_INV; |
@@ -1638,116 +1458,86 @@ int cx231xx_dif_set_standard(struct cx231xx *dev, u32 standard) | |||
1638 | 1458 | ||
1639 | } else if (standard & V4L2_STD_PAL_I) { | 1459 | } else if (standard & V4L2_STD_PAL_I) { |
1640 | 1460 | ||
1641 | status = | 1461 | status = cx231xx_reg_mask_write(dev, HAMMERHEAD_I2C_ADDRESS, 32, |
1642 | cx231xx_reg_mask_write(dev, HAMMERHEAD_I2C_ADDRESS, 32, | ||
1643 | DIF_PLL_CTRL, 0, 31, 0x6503bc0c); | 1462 | DIF_PLL_CTRL, 0, 31, 0x6503bc0c); |
1644 | status = | 1463 | status = cx231xx_reg_mask_write(dev, HAMMERHEAD_I2C_ADDRESS, 32, |
1645 | cx231xx_reg_mask_write(dev, HAMMERHEAD_I2C_ADDRESS, 32, | ||
1646 | DIF_PLL_CTRL1, 0, 31, 0xbd038c85); | 1464 | DIF_PLL_CTRL1, 0, 31, 0xbd038c85); |
1647 | status = | 1465 | status = cx231xx_reg_mask_write(dev, HAMMERHEAD_I2C_ADDRESS, 32, |
1648 | cx231xx_reg_mask_write(dev, HAMMERHEAD_I2C_ADDRESS, 32, | ||
1649 | DIF_PLL_CTRL2, 0, 31, 0x1db4640a); | 1466 | DIF_PLL_CTRL2, 0, 31, 0x1db4640a); |
1650 | status = | 1467 | status = cx231xx_reg_mask_write(dev, HAMMERHEAD_I2C_ADDRESS, 32, |
1651 | cx231xx_reg_mask_write(dev, HAMMERHEAD_I2C_ADDRESS, 32, | ||
1652 | DIF_PLL_CTRL3, 0, 31, 0x00008800); | 1468 | DIF_PLL_CTRL3, 0, 31, 0x00008800); |
1653 | status = | 1469 | status = cx231xx_reg_mask_write(dev, HAMMERHEAD_I2C_ADDRESS, 32, |
1654 | cx231xx_reg_mask_write(dev, HAMMERHEAD_I2C_ADDRESS, 32, | ||
1655 | DIF_AGC_IF_REF, 0, 31, 0x444C1380); | 1470 | DIF_AGC_IF_REF, 0, 31, 0x444C1380); |
1656 | status = | 1471 | status = cx231xx_reg_mask_write(dev, HAMMERHEAD_I2C_ADDRESS, 32, |
1657 | cx231xx_reg_mask_write(dev, HAMMERHEAD_I2C_ADDRESS, 32, | ||
1658 | DIF_AGC_CTRL_IF, 0, 31, 0xDA302600); | 1472 | DIF_AGC_CTRL_IF, 0, 31, 0xDA302600); |
1659 | status = | 1473 | status = cx231xx_reg_mask_write(dev, HAMMERHEAD_I2C_ADDRESS, 32, |
1660 | cx231xx_reg_mask_write(dev, HAMMERHEAD_I2C_ADDRESS, 32, | ||
1661 | DIF_AGC_CTRL_INT, 0, 31, 0xDA261700); | 1474 | DIF_AGC_CTRL_INT, 0, 31, 0xDA261700); |
1662 | status = | 1475 | status = cx231xx_reg_mask_write(dev, HAMMERHEAD_I2C_ADDRESS, 32, |
1663 | cx231xx_reg_mask_write(dev, HAMMERHEAD_I2C_ADDRESS, 32, | ||
1664 | DIF_AGC_CTRL_RF, 0, 31, 0xDA262600); | 1476 | DIF_AGC_CTRL_RF, 0, 31, 0xDA262600); |
1665 | status = | 1477 | status = cx231xx_reg_mask_write(dev, HAMMERHEAD_I2C_ADDRESS, 32, |
1666 | cx231xx_reg_mask_write(dev, HAMMERHEAD_I2C_ADDRESS, 32, | ||
1667 | DIF_AGC_IF_INT_CURRENT, 0, 31, | 1478 | DIF_AGC_IF_INT_CURRENT, 0, 31, |
1668 | 0x26001700); | 1479 | 0x26001700); |
1669 | status = | 1480 | status = cx231xx_reg_mask_write(dev, HAMMERHEAD_I2C_ADDRESS, 32, |
1670 | cx231xx_reg_mask_write(dev, HAMMERHEAD_I2C_ADDRESS, 32, | ||
1671 | DIF_AGC_RF_CURRENT, 0, 31, | 1481 | DIF_AGC_RF_CURRENT, 0, 31, |
1672 | 0x00002660); | 1482 | 0x00002660); |
1673 | status = | 1483 | status = cx231xx_reg_mask_write(dev, HAMMERHEAD_I2C_ADDRESS, 32, |
1674 | cx231xx_reg_mask_write(dev, HAMMERHEAD_I2C_ADDRESS, 32, | ||
1675 | DIF_VIDEO_AGC_CTRL, 0, 31, | 1484 | DIF_VIDEO_AGC_CTRL, 0, 31, |
1676 | 0x72500800); | 1485 | 0x72500800); |
1677 | status = | 1486 | status = cx231xx_reg_mask_write(dev, HAMMERHEAD_I2C_ADDRESS, 32, |
1678 | cx231xx_reg_mask_write(dev, HAMMERHEAD_I2C_ADDRESS, 32, | ||
1679 | DIF_VID_AUD_OVERRIDE, 0, 31, | 1487 | DIF_VID_AUD_OVERRIDE, 0, 31, |
1680 | 0x27000100); | 1488 | 0x27000100); |
1681 | status = | 1489 | status = cx231xx_reg_mask_write(dev, HAMMERHEAD_I2C_ADDRESS, 32, |
1682 | cx231xx_reg_mask_write(dev, HAMMERHEAD_I2C_ADDRESS, 32, | ||
1683 | DIF_AV_SEP_CTRL, 0, 31, 0x5F39A934); | 1490 | DIF_AV_SEP_CTRL, 0, 31, 0x5F39A934); |
1684 | status = | 1491 | status = cx231xx_reg_mask_write(dev, HAMMERHEAD_I2C_ADDRESS, 32, |
1685 | cx231xx_reg_mask_write(dev, HAMMERHEAD_I2C_ADDRESS, 32, | ||
1686 | DIF_COMP_FLT_CTRL, 0, 31, | 1492 | DIF_COMP_FLT_CTRL, 0, 31, |
1687 | 0x00000000); | 1493 | 0x00000000); |
1688 | status = | 1494 | status = cx231xx_reg_mask_write(dev, HAMMERHEAD_I2C_ADDRESS, 32, |
1689 | cx231xx_reg_mask_write(dev, HAMMERHEAD_I2C_ADDRESS, 32, | ||
1690 | DIF_SRC_PHASE_INC, 0, 31, | 1495 | DIF_SRC_PHASE_INC, 0, 31, |
1691 | 0x1befbf06); | 1496 | 0x1befbf06); |
1692 | status = | 1497 | status = cx231xx_reg_mask_write(dev, HAMMERHEAD_I2C_ADDRESS, 32, |
1693 | cx231xx_reg_mask_write(dev, HAMMERHEAD_I2C_ADDRESS, 32, | ||
1694 | DIF_SRC_GAIN_CONTROL, 0, 31, | 1498 | DIF_SRC_GAIN_CONTROL, 0, 31, |
1695 | 0x000035e8); | 1499 | 0x000035e8); |
1696 | status = | 1500 | status = cx231xx_reg_mask_write(dev, HAMMERHEAD_I2C_ADDRESS, 32, |
1697 | cx231xx_reg_mask_write(dev, HAMMERHEAD_I2C_ADDRESS, 32, | ||
1698 | DIF_RPT_VARIANCE, 0, 31, 0x00000000); | 1501 | DIF_RPT_VARIANCE, 0, 31, 0x00000000); |
1699 | /* Save the Spec Inversion value */ | 1502 | /* Save the Spec Inversion value */ |
1700 | dif_misc_ctrl_value &= FLD_DIF_SPEC_INV; | 1503 | dif_misc_ctrl_value &= FLD_DIF_SPEC_INV; |
1701 | dif_misc_ctrl_value |= 0x3a033F11; | 1504 | dif_misc_ctrl_value |= 0x3a033F11; |
1702 | 1505 | ||
1703 | } else if (standard & V4L2_STD_PAL_M) { | 1506 | } else if (standard & V4L2_STD_PAL_M) { |
1704 | |||
1705 | /* improved Low Frequency Phase Noise */ | 1507 | /* improved Low Frequency Phase Noise */ |
1706 | status = cx231xx_write_i2c_data(dev, HAMMERHEAD_I2C_ADDRESS, | 1508 | status = cx231xx_write_i2c_data(dev, HAMMERHEAD_I2C_ADDRESS, |
1707 | DIF_PLL_CTRL, 2, 0xFF01FF0C, 4); | 1509 | DIF_PLL_CTRL, 2, 0xFF01FF0C, 4); |
1708 | status = cx231xx_write_i2c_data(dev, HAMMERHEAD_I2C_ADDRESS, | 1510 | status = cx231xx_write_i2c_data(dev, HAMMERHEAD_I2C_ADDRESS, |
1709 | DIF_PLL_CTRL1, 2, 0xbd038c85, | 1511 | DIF_PLL_CTRL1, 2, 0xbd038c85, |
1710 | 4); | 1512 | 4); |
1711 | status = | 1513 | status = cx231xx_write_i2c_data(dev, HAMMERHEAD_I2C_ADDRESS, |
1712 | cx231xx_write_i2c_data(dev, HAMMERHEAD_I2C_ADDRESS, | ||
1713 | DIF_PLL_CTRL2, 2, 0x1db4640a, 4); | 1514 | DIF_PLL_CTRL2, 2, 0x1db4640a, 4); |
1714 | status = | 1515 | status = cx231xx_write_i2c_data(dev, HAMMERHEAD_I2C_ADDRESS, |
1715 | cx231xx_write_i2c_data(dev, HAMMERHEAD_I2C_ADDRESS, | ||
1716 | DIF_PLL_CTRL3, 2, 0x00008800, 4); | 1516 | DIF_PLL_CTRL3, 2, 0x00008800, 4); |
1717 | status = | 1517 | status = cx231xx_write_i2c_data(dev, HAMMERHEAD_I2C_ADDRESS, |
1718 | cx231xx_write_i2c_data(dev, HAMMERHEAD_I2C_ADDRESS, | ||
1719 | DIF_AGC_IF_REF, 2, 0x444C1380, 4); | 1518 | DIF_AGC_IF_REF, 2, 0x444C1380, 4); |
1720 | status = | 1519 | status = cx231xx_write_i2c_data(dev, HAMMERHEAD_I2C_ADDRESS, |
1721 | cx231xx_write_i2c_data(dev, HAMMERHEAD_I2C_ADDRESS, | ||
1722 | DIF_AGC_IF_INT_CURRENT, 2, | 1520 | DIF_AGC_IF_INT_CURRENT, 2, |
1723 | 0x26001700, 4); | 1521 | 0x26001700, 4); |
1724 | status = | 1522 | status = cx231xx_write_i2c_data(dev, HAMMERHEAD_I2C_ADDRESS, |
1725 | cx231xx_write_i2c_data(dev, HAMMERHEAD_I2C_ADDRESS, | ||
1726 | DIF_AGC_RF_CURRENT, 2, 0x00002660, | 1523 | DIF_AGC_RF_CURRENT, 2, 0x00002660, |
1727 | 4); | 1524 | 4); |
1728 | status = | 1525 | status = cx231xx_write_i2c_data(dev, HAMMERHEAD_I2C_ADDRESS, |
1729 | cx231xx_write_i2c_data(dev, HAMMERHEAD_I2C_ADDRESS, | ||
1730 | DIF_VIDEO_AGC_CTRL, 2, 0x72500800, | 1526 | DIF_VIDEO_AGC_CTRL, 2, 0x72500800, |
1731 | 4); | 1527 | 4); |
1732 | status = | 1528 | status = cx231xx_write_i2c_data(dev, HAMMERHEAD_I2C_ADDRESS, |
1733 | cx231xx_write_i2c_data(dev, HAMMERHEAD_I2C_ADDRESS, | ||
1734 | DIF_VID_AUD_OVERRIDE, 2, 0x27000100, | 1529 | DIF_VID_AUD_OVERRIDE, 2, 0x27000100, |
1735 | 4); | 1530 | 4); |
1736 | status = | 1531 | status = cx231xx_write_i2c_data(dev, HAMMERHEAD_I2C_ADDRESS, |
1737 | cx231xx_write_i2c_data(dev, HAMMERHEAD_I2C_ADDRESS, | ||
1738 | DIF_AV_SEP_CTRL, 2, 0x012c405d, 4); | 1532 | DIF_AV_SEP_CTRL, 2, 0x012c405d, 4); |
1739 | status = | 1533 | status = cx231xx_write_i2c_data(dev, HAMMERHEAD_I2C_ADDRESS, |
1740 | cx231xx_write_i2c_data(dev, HAMMERHEAD_I2C_ADDRESS, | ||
1741 | DIF_COMP_FLT_CTRL, 2, 0x009f50c1, 4); | 1534 | DIF_COMP_FLT_CTRL, 2, 0x009f50c1, 4); |
1742 | status = | 1535 | status = cx231xx_write_i2c_data(dev, HAMMERHEAD_I2C_ADDRESS, |
1743 | cx231xx_write_i2c_data(dev, HAMMERHEAD_I2C_ADDRESS, | ||
1744 | DIF_SRC_PHASE_INC, 2, 0x1befbf06, 4); | 1536 | DIF_SRC_PHASE_INC, 2, 0x1befbf06, 4); |
1745 | status = | 1537 | status = cx231xx_write_i2c_data(dev, HAMMERHEAD_I2C_ADDRESS, |
1746 | cx231xx_write_i2c_data(dev, HAMMERHEAD_I2C_ADDRESS, | ||
1747 | DIF_SRC_GAIN_CONTROL, 2, 0x000035e8, | 1538 | DIF_SRC_GAIN_CONTROL, 2, 0x000035e8, |
1748 | 4); | 1539 | 4); |
1749 | status = | 1540 | status = cx231xx_write_i2c_data(dev, HAMMERHEAD_I2C_ADDRESS, |
1750 | cx231xx_write_i2c_data(dev, HAMMERHEAD_I2C_ADDRESS, | ||
1751 | DIF_SOFT_RST_CTRL_REVB, 2, | 1541 | DIF_SOFT_RST_CTRL_REVB, 2, |
1752 | 0x00000000, 4); | 1542 | 0x00000000, 4); |
1753 | 1543 | ||
@@ -1758,52 +1548,38 @@ int cx231xx_dif_set_standard(struct cx231xx *dev, u32 standard) | |||
1758 | } else if (standard & (V4L2_STD_PAL_N | V4L2_STD_PAL_Nc)) { | 1548 | } else if (standard & (V4L2_STD_PAL_N | V4L2_STD_PAL_Nc)) { |
1759 | 1549 | ||
1760 | /* improved Low Frequency Phase Noise */ | 1550 | /* improved Low Frequency Phase Noise */ |
1761 | status = | 1551 | status = cx231xx_write_i2c_data(dev, HAMMERHEAD_I2C_ADDRESS, |
1762 | cx231xx_write_i2c_data(dev, HAMMERHEAD_I2C_ADDRESS, | ||
1763 | DIF_PLL_CTRL, 2, 0xFF01FF0C, 4); | 1552 | DIF_PLL_CTRL, 2, 0xFF01FF0C, 4); |
1764 | status = | 1553 | status = cx231xx_write_i2c_data(dev, HAMMERHEAD_I2C_ADDRESS, |
1765 | cx231xx_write_i2c_data(dev, HAMMERHEAD_I2C_ADDRESS, | ||
1766 | DIF_PLL_CTRL1, 2, 0xbd038c85, 4); | 1554 | DIF_PLL_CTRL1, 2, 0xbd038c85, 4); |
1767 | status = | 1555 | status = cx231xx_write_i2c_data(dev, HAMMERHEAD_I2C_ADDRESS, |
1768 | cx231xx_write_i2c_data(dev, HAMMERHEAD_I2C_ADDRESS, | ||
1769 | DIF_PLL_CTRL2, 2, 0x1db4640a, 4); | 1556 | DIF_PLL_CTRL2, 2, 0x1db4640a, 4); |
1770 | status = | 1557 | status = cx231xx_write_i2c_data(dev, HAMMERHEAD_I2C_ADDRESS, |
1771 | cx231xx_write_i2c_data(dev, HAMMERHEAD_I2C_ADDRESS, | ||
1772 | DIF_PLL_CTRL3, 2, 0x00008800, 4); | 1558 | DIF_PLL_CTRL3, 2, 0x00008800, 4); |
1773 | status = | 1559 | status = cx231xx_write_i2c_data(dev, HAMMERHEAD_I2C_ADDRESS, |
1774 | cx231xx_write_i2c_data(dev, HAMMERHEAD_I2C_ADDRESS, | ||
1775 | DIF_AGC_IF_REF, 2, 0x444C1380, 4); | 1560 | DIF_AGC_IF_REF, 2, 0x444C1380, 4); |
1776 | status = | 1561 | status = cx231xx_write_i2c_data(dev, HAMMERHEAD_I2C_ADDRESS, |
1777 | cx231xx_write_i2c_data(dev, HAMMERHEAD_I2C_ADDRESS, | ||
1778 | DIF_AGC_IF_INT_CURRENT, 2, | 1562 | DIF_AGC_IF_INT_CURRENT, 2, |
1779 | 0x26001700, 4); | 1563 | 0x26001700, 4); |
1780 | status = | 1564 | status = cx231xx_write_i2c_data(dev, HAMMERHEAD_I2C_ADDRESS, |
1781 | cx231xx_write_i2c_data(dev, HAMMERHEAD_I2C_ADDRESS, | ||
1782 | DIF_AGC_RF_CURRENT, 2, 0x00002660, | 1565 | DIF_AGC_RF_CURRENT, 2, 0x00002660, |
1783 | 4); | 1566 | 4); |
1784 | status = | 1567 | status = cx231xx_write_i2c_data(dev, HAMMERHEAD_I2C_ADDRESS, |
1785 | cx231xx_write_i2c_data(dev, HAMMERHEAD_I2C_ADDRESS, | ||
1786 | DIF_VIDEO_AGC_CTRL, 2, 0x72500800, | 1568 | DIF_VIDEO_AGC_CTRL, 2, 0x72500800, |
1787 | 4); | 1569 | 4); |
1788 | status = | 1570 | status = cx231xx_write_i2c_data(dev, HAMMERHEAD_I2C_ADDRESS, |
1789 | cx231xx_write_i2c_data(dev, HAMMERHEAD_I2C_ADDRESS, | ||
1790 | DIF_VID_AUD_OVERRIDE, 2, 0x27000100, | 1571 | DIF_VID_AUD_OVERRIDE, 2, 0x27000100, |
1791 | 4); | 1572 | 4); |
1792 | status = | 1573 | status = cx231xx_write_i2c_data(dev, HAMMERHEAD_I2C_ADDRESS, |
1793 | cx231xx_write_i2c_data(dev, HAMMERHEAD_I2C_ADDRESS, | ||
1794 | DIF_AV_SEP_CTRL, 2, 0x012c405d, 4); | 1574 | DIF_AV_SEP_CTRL, 2, 0x012c405d, 4); |
1795 | status = | 1575 | status = cx231xx_write_i2c_data(dev, HAMMERHEAD_I2C_ADDRESS, |
1796 | cx231xx_write_i2c_data(dev, HAMMERHEAD_I2C_ADDRESS, | ||
1797 | DIF_COMP_FLT_CTRL, 2, 0x009f50c1, 4); | 1576 | DIF_COMP_FLT_CTRL, 2, 0x009f50c1, 4); |
1798 | status = | 1577 | status = cx231xx_write_i2c_data(dev, HAMMERHEAD_I2C_ADDRESS, |
1799 | cx231xx_write_i2c_data(dev, HAMMERHEAD_I2C_ADDRESS, | ||
1800 | DIF_SRC_PHASE_INC, 2, 0x1befbf06, 4); | 1578 | DIF_SRC_PHASE_INC, 2, 0x1befbf06, 4); |
1801 | status = | 1579 | status = cx231xx_write_i2c_data(dev, HAMMERHEAD_I2C_ADDRESS, |
1802 | cx231xx_write_i2c_data(dev, HAMMERHEAD_I2C_ADDRESS, | ||
1803 | DIF_SRC_GAIN_CONTROL, 2, 0x000035e8, | 1580 | DIF_SRC_GAIN_CONTROL, 2, 0x000035e8, |
1804 | 4); | 1581 | 4); |
1805 | status = | 1582 | status = cx231xx_write_i2c_data(dev, HAMMERHEAD_I2C_ADDRESS, |
1806 | cx231xx_write_i2c_data(dev, HAMMERHEAD_I2C_ADDRESS, | ||
1807 | DIF_SOFT_RST_CTRL_REVB, 2, | 1583 | DIF_SOFT_RST_CTRL_REVB, 2, |
1808 | 0x00000000, 4); | 1584 | 0x00000000, 4); |
1809 | 1585 | ||
@@ -1815,62 +1591,45 @@ int cx231xx_dif_set_standard(struct cx231xx *dev, u32 standard) | |||
1815 | (V4L2_STD_SECAM_B | V4L2_STD_SECAM_D | V4L2_STD_SECAM_G | | 1591 | (V4L2_STD_SECAM_B | V4L2_STD_SECAM_D | V4L2_STD_SECAM_G | |
1816 | V4L2_STD_SECAM_K | V4L2_STD_SECAM_K1)) { | 1592 | V4L2_STD_SECAM_K | V4L2_STD_SECAM_K1)) { |
1817 | 1593 | ||
1818 | status = | 1594 | status = cx231xx_reg_mask_write(dev, HAMMERHEAD_I2C_ADDRESS, 32, |
1819 | cx231xx_reg_mask_write(dev, HAMMERHEAD_I2C_ADDRESS, 32, | ||
1820 | DIF_PLL_CTRL, 0, 31, 0x6503bc0c); | 1595 | DIF_PLL_CTRL, 0, 31, 0x6503bc0c); |
1821 | status = | 1596 | status = cx231xx_reg_mask_write(dev, HAMMERHEAD_I2C_ADDRESS, 32, |
1822 | cx231xx_reg_mask_write(dev, HAMMERHEAD_I2C_ADDRESS, 32, | ||
1823 | DIF_PLL_CTRL1, 0, 31, 0xbd038c85); | 1597 | DIF_PLL_CTRL1, 0, 31, 0xbd038c85); |
1824 | status = | 1598 | status = cx231xx_reg_mask_write(dev, HAMMERHEAD_I2C_ADDRESS, 32, |
1825 | cx231xx_reg_mask_write(dev, HAMMERHEAD_I2C_ADDRESS, 32, | ||
1826 | DIF_PLL_CTRL2, 0, 31, 0x1db4640a); | 1599 | DIF_PLL_CTRL2, 0, 31, 0x1db4640a); |
1827 | status = | 1600 | status = cx231xx_reg_mask_write(dev, HAMMERHEAD_I2C_ADDRESS, 32, |
1828 | cx231xx_reg_mask_write(dev, HAMMERHEAD_I2C_ADDRESS, 32, | ||
1829 | DIF_PLL_CTRL3, 0, 31, 0x00008800); | 1601 | DIF_PLL_CTRL3, 0, 31, 0x00008800); |
1830 | status = | 1602 | status = cx231xx_reg_mask_write(dev, HAMMERHEAD_I2C_ADDRESS, 32, |
1831 | cx231xx_reg_mask_write(dev, HAMMERHEAD_I2C_ADDRESS, 32, | ||
1832 | DIF_AGC_IF_REF, 0, 31, 0x888C0380); | 1603 | DIF_AGC_IF_REF, 0, 31, 0x888C0380); |
1833 | status = | 1604 | status = cx231xx_reg_mask_write(dev, HAMMERHEAD_I2C_ADDRESS, 32, |
1834 | cx231xx_reg_mask_write(dev, HAMMERHEAD_I2C_ADDRESS, 32, | ||
1835 | DIF_AGC_CTRL_IF, 0, 31, 0xe0262600); | 1605 | DIF_AGC_CTRL_IF, 0, 31, 0xe0262600); |
1836 | status = | 1606 | status = cx231xx_reg_mask_write(dev, HAMMERHEAD_I2C_ADDRESS, 32, |
1837 | cx231xx_reg_mask_write(dev, HAMMERHEAD_I2C_ADDRESS, 32, | ||
1838 | DIF_AGC_CTRL_INT, 0, 31, 0xc2171700); | 1607 | DIF_AGC_CTRL_INT, 0, 31, 0xc2171700); |
1839 | status = | 1608 | status = cx231xx_reg_mask_write(dev, HAMMERHEAD_I2C_ADDRESS, 32, |
1840 | cx231xx_reg_mask_write(dev, HAMMERHEAD_I2C_ADDRESS, 32, | ||
1841 | DIF_AGC_CTRL_RF, 0, 31, 0xc2262600); | 1609 | DIF_AGC_CTRL_RF, 0, 31, 0xc2262600); |
1842 | status = | 1610 | status = cx231xx_reg_mask_write(dev, HAMMERHEAD_I2C_ADDRESS, 32, |
1843 | cx231xx_reg_mask_write(dev, HAMMERHEAD_I2C_ADDRESS, 32, | ||
1844 | DIF_AGC_IF_INT_CURRENT, 0, 31, | 1611 | DIF_AGC_IF_INT_CURRENT, 0, 31, |
1845 | 0x26001700); | 1612 | 0x26001700); |
1846 | status = | 1613 | status = cx231xx_reg_mask_write(dev, HAMMERHEAD_I2C_ADDRESS, 32, |
1847 | cx231xx_reg_mask_write(dev, HAMMERHEAD_I2C_ADDRESS, 32, | ||
1848 | DIF_AGC_RF_CURRENT, 0, 31, | 1614 | DIF_AGC_RF_CURRENT, 0, 31, |
1849 | 0x00002660); | 1615 | 0x00002660); |
1850 | status = | 1616 | status = cx231xx_reg_mask_write(dev, HAMMERHEAD_I2C_ADDRESS, 32, |
1851 | cx231xx_reg_mask_write(dev, HAMMERHEAD_I2C_ADDRESS, 32, | ||
1852 | DIF_VID_AUD_OVERRIDE, 0, 31, | 1617 | DIF_VID_AUD_OVERRIDE, 0, 31, |
1853 | 0x27000100); | 1618 | 0x27000100); |
1854 | status = | 1619 | status = cx231xx_reg_mask_write(dev, HAMMERHEAD_I2C_ADDRESS, 32, |
1855 | cx231xx_reg_mask_write(dev, HAMMERHEAD_I2C_ADDRESS, 32, | ||
1856 | DIF_AV_SEP_CTRL, 0, 31, 0x3F3530ec); | 1620 | DIF_AV_SEP_CTRL, 0, 31, 0x3F3530ec); |
1857 | status = | 1621 | status = cx231xx_reg_mask_write(dev, HAMMERHEAD_I2C_ADDRESS, 32, |
1858 | cx231xx_reg_mask_write(dev, HAMMERHEAD_I2C_ADDRESS, 32, | ||
1859 | DIF_COMP_FLT_CTRL, 0, 31, | 1622 | DIF_COMP_FLT_CTRL, 0, 31, |
1860 | 0x00000000); | 1623 | 0x00000000); |
1861 | status = | 1624 | status = cx231xx_reg_mask_write(dev, HAMMERHEAD_I2C_ADDRESS, 32, |
1862 | cx231xx_reg_mask_write(dev, HAMMERHEAD_I2C_ADDRESS, 32, | ||
1863 | DIF_SRC_PHASE_INC, 0, 31, | 1625 | DIF_SRC_PHASE_INC, 0, 31, |
1864 | 0x1befbf06); | 1626 | 0x1befbf06); |
1865 | status = | 1627 | status = cx231xx_reg_mask_write(dev, HAMMERHEAD_I2C_ADDRESS, 32, |
1866 | cx231xx_reg_mask_write(dev, HAMMERHEAD_I2C_ADDRESS, 32, | ||
1867 | DIF_SRC_GAIN_CONTROL, 0, 31, | 1628 | DIF_SRC_GAIN_CONTROL, 0, 31, |
1868 | 0x000035e8); | 1629 | 0x000035e8); |
1869 | status = | 1630 | status = cx231xx_reg_mask_write(dev, HAMMERHEAD_I2C_ADDRESS, 32, |
1870 | cx231xx_reg_mask_write(dev, HAMMERHEAD_I2C_ADDRESS, 32, | ||
1871 | DIF_RPT_VARIANCE, 0, 31, 0x00000000); | 1631 | DIF_RPT_VARIANCE, 0, 31, 0x00000000); |
1872 | status = | 1632 | status = cx231xx_reg_mask_write(dev, HAMMERHEAD_I2C_ADDRESS, 32, |
1873 | cx231xx_reg_mask_write(dev, HAMMERHEAD_I2C_ADDRESS, 32, | ||
1874 | DIF_VIDEO_AGC_CTRL, 0, 31, | 1633 | DIF_VIDEO_AGC_CTRL, 0, 31, |
1875 | 0xf4000000); | 1634 | 0xf4000000); |
1876 | 1635 | ||
@@ -1881,62 +1640,45 @@ int cx231xx_dif_set_standard(struct cx231xx *dev, u32 standard) | |||
1881 | } else if (standard & (V4L2_STD_SECAM_L | V4L2_STD_SECAM_LC)) { | 1640 | } else if (standard & (V4L2_STD_SECAM_L | V4L2_STD_SECAM_LC)) { |
1882 | 1641 | ||
1883 | /* Is it SECAM_L1? */ | 1642 | /* Is it SECAM_L1? */ |
1884 | status = | 1643 | status = cx231xx_reg_mask_write(dev, HAMMERHEAD_I2C_ADDRESS, 32, |
1885 | cx231xx_reg_mask_write(dev, HAMMERHEAD_I2C_ADDRESS, 32, | ||
1886 | DIF_PLL_CTRL, 0, 31, 0x6503bc0c); | 1644 | DIF_PLL_CTRL, 0, 31, 0x6503bc0c); |
1887 | status = | 1645 | status = cx231xx_reg_mask_write(dev, HAMMERHEAD_I2C_ADDRESS, 32, |
1888 | cx231xx_reg_mask_write(dev, HAMMERHEAD_I2C_ADDRESS, 32, | ||
1889 | DIF_PLL_CTRL1, 0, 31, 0xbd038c85); | 1646 | DIF_PLL_CTRL1, 0, 31, 0xbd038c85); |
1890 | status = | 1647 | status = cx231xx_reg_mask_write(dev, HAMMERHEAD_I2C_ADDRESS, 32, |
1891 | cx231xx_reg_mask_write(dev, HAMMERHEAD_I2C_ADDRESS, 32, | ||
1892 | DIF_PLL_CTRL2, 0, 31, 0x1db4640a); | 1648 | DIF_PLL_CTRL2, 0, 31, 0x1db4640a); |
1893 | status = | 1649 | status = cx231xx_reg_mask_write(dev, HAMMERHEAD_I2C_ADDRESS, 32, |
1894 | cx231xx_reg_mask_write(dev, HAMMERHEAD_I2C_ADDRESS, 32, | ||
1895 | DIF_PLL_CTRL3, 0, 31, 0x00008800); | 1650 | DIF_PLL_CTRL3, 0, 31, 0x00008800); |
1896 | status = | 1651 | status = cx231xx_reg_mask_write(dev, HAMMERHEAD_I2C_ADDRESS, 32, |
1897 | cx231xx_reg_mask_write(dev, HAMMERHEAD_I2C_ADDRESS, 32, | ||
1898 | DIF_AGC_IF_REF, 0, 31, 0x888C0380); | 1652 | DIF_AGC_IF_REF, 0, 31, 0x888C0380); |
1899 | status = | 1653 | status = cx231xx_reg_mask_write(dev, HAMMERHEAD_I2C_ADDRESS, 32, |
1900 | cx231xx_reg_mask_write(dev, HAMMERHEAD_I2C_ADDRESS, 32, | ||
1901 | DIF_AGC_CTRL_IF, 0, 31, 0xe0262600); | 1654 | DIF_AGC_CTRL_IF, 0, 31, 0xe0262600); |
1902 | status = | 1655 | status = cx231xx_reg_mask_write(dev, HAMMERHEAD_I2C_ADDRESS, 32, |
1903 | cx231xx_reg_mask_write(dev, HAMMERHEAD_I2C_ADDRESS, 32, | ||
1904 | DIF_AGC_CTRL_INT, 0, 31, 0xc2171700); | 1656 | DIF_AGC_CTRL_INT, 0, 31, 0xc2171700); |
1905 | status = | 1657 | status = cx231xx_reg_mask_write(dev, HAMMERHEAD_I2C_ADDRESS, 32, |
1906 | cx231xx_reg_mask_write(dev, HAMMERHEAD_I2C_ADDRESS, 32, | ||
1907 | DIF_AGC_CTRL_RF, 0, 31, 0xc2262600); | 1658 | DIF_AGC_CTRL_RF, 0, 31, 0xc2262600); |
1908 | status = | 1659 | status = cx231xx_reg_mask_write(dev, HAMMERHEAD_I2C_ADDRESS, 32, |
1909 | cx231xx_reg_mask_write(dev, HAMMERHEAD_I2C_ADDRESS, 32, | ||
1910 | DIF_AGC_IF_INT_CURRENT, 0, 31, | 1660 | DIF_AGC_IF_INT_CURRENT, 0, 31, |
1911 | 0x26001700); | 1661 | 0x26001700); |
1912 | status = | 1662 | status = cx231xx_reg_mask_write(dev, HAMMERHEAD_I2C_ADDRESS, 32, |
1913 | cx231xx_reg_mask_write(dev, HAMMERHEAD_I2C_ADDRESS, 32, | ||
1914 | DIF_AGC_RF_CURRENT, 0, 31, | 1663 | DIF_AGC_RF_CURRENT, 0, 31, |
1915 | 0x00002660); | 1664 | 0x00002660); |
1916 | status = | 1665 | status = cx231xx_reg_mask_write(dev, HAMMERHEAD_I2C_ADDRESS, 32, |
1917 | cx231xx_reg_mask_write(dev, HAMMERHEAD_I2C_ADDRESS, 32, | ||
1918 | DIF_VID_AUD_OVERRIDE, 0, 31, | 1666 | DIF_VID_AUD_OVERRIDE, 0, 31, |
1919 | 0x27000100); | 1667 | 0x27000100); |
1920 | status = | 1668 | status = cx231xx_reg_mask_write(dev, HAMMERHEAD_I2C_ADDRESS, 32, |
1921 | cx231xx_reg_mask_write(dev, HAMMERHEAD_I2C_ADDRESS, 32, | ||
1922 | DIF_AV_SEP_CTRL, 0, 31, 0x3F3530ec); | 1669 | DIF_AV_SEP_CTRL, 0, 31, 0x3F3530ec); |
1923 | status = | 1670 | status = cx231xx_reg_mask_write(dev, HAMMERHEAD_I2C_ADDRESS, 32, |
1924 | cx231xx_reg_mask_write(dev, HAMMERHEAD_I2C_ADDRESS, 32, | ||
1925 | DIF_COMP_FLT_CTRL, 0, 31, | 1671 | DIF_COMP_FLT_CTRL, 0, 31, |
1926 | 0x00000000); | 1672 | 0x00000000); |
1927 | status = | 1673 | status = cx231xx_reg_mask_write(dev, HAMMERHEAD_I2C_ADDRESS, 32, |
1928 | cx231xx_reg_mask_write(dev, HAMMERHEAD_I2C_ADDRESS, 32, | ||
1929 | DIF_SRC_PHASE_INC, 0, 31, | 1674 | DIF_SRC_PHASE_INC, 0, 31, |
1930 | 0x1befbf06); | 1675 | 0x1befbf06); |
1931 | status = | 1676 | status = cx231xx_reg_mask_write(dev, HAMMERHEAD_I2C_ADDRESS, 32, |
1932 | cx231xx_reg_mask_write(dev, HAMMERHEAD_I2C_ADDRESS, 32, | ||
1933 | DIF_SRC_GAIN_CONTROL, 0, 31, | 1677 | DIF_SRC_GAIN_CONTROL, 0, 31, |
1934 | 0x000035e8); | 1678 | 0x000035e8); |
1935 | status = | 1679 | status = cx231xx_reg_mask_write(dev, HAMMERHEAD_I2C_ADDRESS, 32, |
1936 | cx231xx_reg_mask_write(dev, HAMMERHEAD_I2C_ADDRESS, 32, | ||
1937 | DIF_RPT_VARIANCE, 0, 31, 0x00000000); | 1680 | DIF_RPT_VARIANCE, 0, 31, 0x00000000); |
1938 | status = | 1681 | status = cx231xx_reg_mask_write(dev, HAMMERHEAD_I2C_ADDRESS, 32, |
1939 | cx231xx_reg_mask_write(dev, HAMMERHEAD_I2C_ADDRESS, 32, | ||
1940 | DIF_VIDEO_AGC_CTRL, 0, 31, | 1682 | DIF_VIDEO_AGC_CTRL, 0, 31, |
1941 | 0xf2560000); | 1683 | 0xf2560000); |
1942 | 1684 | ||
@@ -1944,67 +1686,54 @@ int cx231xx_dif_set_standard(struct cx231xx *dev, u32 standard) | |||
1944 | dif_misc_ctrl_value &= FLD_DIF_SPEC_INV; | 1686 | dif_misc_ctrl_value &= FLD_DIF_SPEC_INV; |
1945 | dif_misc_ctrl_value |= 0x3a023F11; | 1687 | dif_misc_ctrl_value |= 0x3a023F11; |
1946 | 1688 | ||
1947 | } else { /* V4L2_STD_NTSC_M (75 IRE Setup) Or V4L2_STD_NTSC_M_JP (Japan, 0 IRE Setup) */ | 1689 | } else { |
1690 | /* V4L2_STD_NTSC_M (75 IRE Setup) Or | ||
1691 | V4L2_STD_NTSC_M_JP (Japan, 0 IRE Setup) */ | ||
1948 | 1692 | ||
1949 | /* For NTSC the centre frequency of video coming out of sidewinder is | 1693 | /* For NTSC the centre frequency of video coming out of |
1950 | around 7.1MHz or 3.6MHz depending on the spectral inversion. | 1694 | sidewinder is around 7.1MHz or 3.6MHz depending on the |
1951 | so for a non spectrally inverted channel the pll freq word is 0x03420c49 | 1695 | spectral inversion. so for a non spectrally inverted channel |
1696 | the pll freq word is 0x03420c49 | ||
1952 | */ | 1697 | */ |
1953 | 1698 | ||
1954 | status = | 1699 | status = cx231xx_write_i2c_data(dev, HAMMERHEAD_I2C_ADDRESS, |
1955 | cx231xx_write_i2c_data(dev, HAMMERHEAD_I2C_ADDRESS, | ||
1956 | DIF_PLL_CTRL, 2, 0x6503BC0C, 4); | 1700 | DIF_PLL_CTRL, 2, 0x6503BC0C, 4); |
1957 | status = | 1701 | status = cx231xx_write_i2c_data(dev, HAMMERHEAD_I2C_ADDRESS, |
1958 | cx231xx_write_i2c_data(dev, HAMMERHEAD_I2C_ADDRESS, | ||
1959 | DIF_PLL_CTRL1, 2, 0xBD038C85, 4); | 1702 | DIF_PLL_CTRL1, 2, 0xBD038C85, 4); |
1960 | status = | 1703 | status = cx231xx_write_i2c_data(dev, HAMMERHEAD_I2C_ADDRESS, |
1961 | cx231xx_write_i2c_data(dev, HAMMERHEAD_I2C_ADDRESS, | ||
1962 | DIF_PLL_CTRL2, 2, 0x1DB4640A, 4); | 1704 | DIF_PLL_CTRL2, 2, 0x1DB4640A, 4); |
1963 | status = | 1705 | status = cx231xx_write_i2c_data(dev, HAMMERHEAD_I2C_ADDRESS, |
1964 | cx231xx_write_i2c_data(dev, HAMMERHEAD_I2C_ADDRESS, | ||
1965 | DIF_PLL_CTRL3, 2, 0x00008800, 4); | 1706 | DIF_PLL_CTRL3, 2, 0x00008800, 4); |
1966 | status = | 1707 | status = cx231xx_write_i2c_data(dev, HAMMERHEAD_I2C_ADDRESS, |
1967 | cx231xx_write_i2c_data(dev, HAMMERHEAD_I2C_ADDRESS, | ||
1968 | DIF_AGC_IF_REF, 2, 0x444C0380, 4); | 1708 | DIF_AGC_IF_REF, 2, 0x444C0380, 4); |
1969 | status = | 1709 | status = cx231xx_write_i2c_data(dev, HAMMERHEAD_I2C_ADDRESS, |
1970 | cx231xx_write_i2c_data(dev, HAMMERHEAD_I2C_ADDRESS, | ||
1971 | DIF_AGC_IF_INT_CURRENT, 2, | 1710 | DIF_AGC_IF_INT_CURRENT, 2, |
1972 | 0x26001700, 4); | 1711 | 0x26001700, 4); |
1973 | status = | 1712 | status = cx231xx_write_i2c_data(dev, HAMMERHEAD_I2C_ADDRESS, |
1974 | cx231xx_write_i2c_data(dev, HAMMERHEAD_I2C_ADDRESS, | ||
1975 | DIF_AGC_RF_CURRENT, 2, 0x00002660, | 1713 | DIF_AGC_RF_CURRENT, 2, 0x00002660, |
1976 | 4); | 1714 | 4); |
1977 | status = | 1715 | status = cx231xx_write_i2c_data(dev, HAMMERHEAD_I2C_ADDRESS, |
1978 | cx231xx_write_i2c_data(dev, HAMMERHEAD_I2C_ADDRESS, | ||
1979 | DIF_VIDEO_AGC_CTRL, 2, 0x04000800, | 1716 | DIF_VIDEO_AGC_CTRL, 2, 0x04000800, |
1980 | 4); | 1717 | 4); |
1981 | status = | 1718 | status = cx231xx_write_i2c_data(dev, HAMMERHEAD_I2C_ADDRESS, |
1982 | cx231xx_write_i2c_data(dev, HAMMERHEAD_I2C_ADDRESS, | ||
1983 | DIF_VID_AUD_OVERRIDE, 2, 0x27000100, | 1719 | DIF_VID_AUD_OVERRIDE, 2, 0x27000100, |
1984 | 4); | 1720 | 4); |
1985 | status = | 1721 | status = cx231xx_write_i2c_data(dev, HAMMERHEAD_I2C_ADDRESS, |
1986 | cx231xx_write_i2c_data(dev, HAMMERHEAD_I2C_ADDRESS, | ||
1987 | DIF_AV_SEP_CTRL, 2, 0x01296e1f, 4); | 1722 | DIF_AV_SEP_CTRL, 2, 0x01296e1f, 4); |
1988 | 1723 | ||
1989 | status = | 1724 | status = cx231xx_write_i2c_data(dev, HAMMERHEAD_I2C_ADDRESS, |
1990 | cx231xx_write_i2c_data(dev, HAMMERHEAD_I2C_ADDRESS, | ||
1991 | DIF_COMP_FLT_CTRL, 2, 0x009f50c1, 4); | 1725 | DIF_COMP_FLT_CTRL, 2, 0x009f50c1, 4); |
1992 | status = | 1726 | status = cx231xx_write_i2c_data(dev, HAMMERHEAD_I2C_ADDRESS, |
1993 | cx231xx_write_i2c_data(dev, HAMMERHEAD_I2C_ADDRESS, | ||
1994 | DIF_SRC_PHASE_INC, 2, 0x1befbf06, 4); | 1727 | DIF_SRC_PHASE_INC, 2, 0x1befbf06, 4); |
1995 | status = | 1728 | status = cx231xx_write_i2c_data(dev, HAMMERHEAD_I2C_ADDRESS, |
1996 | cx231xx_write_i2c_data(dev, HAMMERHEAD_I2C_ADDRESS, | ||
1997 | DIF_SRC_GAIN_CONTROL, 2, 0x000035e8, | 1729 | DIF_SRC_GAIN_CONTROL, 2, 0x000035e8, |
1998 | 4); | 1730 | 4); |
1999 | 1731 | ||
2000 | status = | 1732 | status = cx231xx_write_i2c_data(dev, HAMMERHEAD_I2C_ADDRESS, |
2001 | cx231xx_write_i2c_data(dev, HAMMERHEAD_I2C_ADDRESS, | ||
2002 | DIF_AGC_CTRL_IF, 2, 0xC2262600, 4); | 1733 | DIF_AGC_CTRL_IF, 2, 0xC2262600, 4); |
2003 | status = | 1734 | status = cx231xx_write_i2c_data(dev, HAMMERHEAD_I2C_ADDRESS, |
2004 | cx231xx_write_i2c_data(dev, HAMMERHEAD_I2C_ADDRESS, | ||
2005 | DIF_AGC_CTRL_INT, 2, 0xC2262600, 4); | 1735 | DIF_AGC_CTRL_INT, 2, 0xC2262600, 4); |
2006 | status = | 1736 | status = cx231xx_write_i2c_data(dev, HAMMERHEAD_I2C_ADDRESS, |
2007 | cx231xx_write_i2c_data(dev, HAMMERHEAD_I2C_ADDRESS, | ||
2008 | DIF_AGC_CTRL_RF, 2, 0xC2262600, 4); | 1737 | DIF_AGC_CTRL_RF, 2, 0xC2262600, 4); |
2009 | 1738 | ||
2010 | /* Save the Spec Inversion value */ | 1739 | /* Save the Spec Inversion value */ |
@@ -2017,7 +1746,8 @@ int cx231xx_dif_set_standard(struct cx231xx *dev, u32 standard) | |||
2017 | AUD_SRC_SEL[19] should always be disabled */ | 1746 | AUD_SRC_SEL[19] should always be disabled */ |
2018 | dif_misc_ctrl_value &= ~FLD_DIF_AUD_SRC_SEL; | 1747 | dif_misc_ctrl_value &= ~FLD_DIF_AUD_SRC_SEL; |
2019 | 1748 | ||
2020 | /* It is still possible to get Set Standard calls even when we are in FM mode | 1749 | /* It is still possible to get Set Standard calls even when we |
1750 | are in FM mode. | ||
2021 | This is done to override the value for FM. */ | 1751 | This is done to override the value for FM. */ |
2022 | if (dev->active_mode == V4L2_TUNER_RADIO) | 1752 | if (dev->active_mode == V4L2_TUNER_RADIO) |
2023 | dif_misc_ctrl_value = 0x7a080000; | 1753 | dif_misc_ctrl_value = 0x7a080000; |
@@ -2057,12 +1787,11 @@ int cx231xx_tuner_post_channel_change(struct cx231xx *dev) | |||
2057 | DIF_AGC_IF_REF, 2, &dwval, 4); | 1787 | DIF_AGC_IF_REF, 2, &dwval, 4); |
2058 | dwval &= ~(FLD_DIF_K_AGC_RF | FLD_DIF_K_AGC_IF); | 1788 | dwval &= ~(FLD_DIF_K_AGC_RF | FLD_DIF_K_AGC_IF); |
2059 | 1789 | ||
2060 | if (dev-> | 1790 | if (dev->norm & (V4L2_STD_SECAM_L | V4L2_STD_SECAM_B | |
2061 | norm & (V4L2_STD_SECAM_L | V4L2_STD_SECAM_B | V4L2_STD_SECAM_D)) { | 1791 | V4L2_STD_SECAM_D)) |
2062 | dwval |= 0x88000000; | 1792 | dwval |= 0x88000000; |
2063 | } else { | 1793 | else |
2064 | dwval |= 0x44000000; | 1794 | dwval |= 0x44000000; |
2065 | } | ||
2066 | 1795 | ||
2067 | status = cx231xx_write_i2c_data(dev, HAMMERHEAD_I2C_ADDRESS, | 1796 | status = cx231xx_write_i2c_data(dev, HAMMERHEAD_I2C_ADDRESS, |
2068 | DIF_AGC_IF_REF, 2, dwval, 4); | 1797 | DIF_AGC_IF_REF, 2, dwval, 4); |
@@ -2070,17 +1799,16 @@ int cx231xx_tuner_post_channel_change(struct cx231xx *dev) | |||
2070 | return status; | 1799 | return status; |
2071 | } | 1800 | } |
2072 | 1801 | ||
2073 | /************************************************************************************* | 1802 | /****************************************************************************** |
2074 | * F L A T I R O N - B L O C K C O N T R O L functions * | 1803 | * F L A T I R O N - B L O C K C O N T R O L functions * |
2075 | *************************************************************************************/ | 1804 | ******************************************************************************/ |
2076 | int cx231xx_flatiron_initialize(struct cx231xx *dev) | 1805 | int cx231xx_flatiron_initialize(struct cx231xx *dev) |
2077 | { | 1806 | { |
2078 | int status = 0; | 1807 | int status = 0; |
2079 | u32 value; | 1808 | u32 value; |
2080 | 1809 | ||
2081 | status = | 1810 | status = cx231xx_read_i2c_data(dev, Flatrion_DEVICE_ADDRESS, |
2082 | cx231xx_read_i2c_data(dev, Flatrion_DEVICE_ADDRESS, CH_PWR_CTRL1, 1, | 1811 | CH_PWR_CTRL1, 1, &value, 1); |
2083 | &value, 1); | ||
2084 | /* enables clock to delta-sigma and decimation filter */ | 1812 | /* enables clock to delta-sigma and decimation filter */ |
2085 | value |= 0x80; | 1813 | value |= 0x80; |
2086 | status = cx231xx_write_i2c_data(dev, Flatrion_DEVICE_ADDRESS, | 1814 | status = cx231xx_write_i2c_data(dev, Flatrion_DEVICE_ADDRESS, |
@@ -2098,8 +1826,7 @@ int cx231xx_flatiron_update_power_control(struct cx231xx *dev, AV_MODE avmode) | |||
2098 | u32 value = 0; | 1826 | u32 value = 0; |
2099 | 1827 | ||
2100 | if (avmode != POLARIS_AVMODE_ENXTERNAL_AV) { | 1828 | if (avmode != POLARIS_AVMODE_ENXTERNAL_AV) { |
2101 | status = | 1829 | status = cx231xx_read_i2c_data(dev, Flatrion_DEVICE_ADDRESS, |
2102 | cx231xx_read_i2c_data(dev, Flatrion_DEVICE_ADDRESS, | ||
2103 | CH_PWR_CTRL2, 1, &value, 1); | 1830 | CH_PWR_CTRL2, 1, &value, 1); |
2104 | value |= 0xfe; | 1831 | value |= 0xfe; |
2105 | status = cx231xx_write_i2c_data(dev, Flatrion_DEVICE_ADDRESS, | 1832 | status = cx231xx_write_i2c_data(dev, Flatrion_DEVICE_ADDRESS, |
@@ -2119,7 +1846,6 @@ int cx231xx_flatiron_set_audio_input(struct cx231xx *dev, u8 audio_input) | |||
2119 | 1846 | ||
2120 | switch (audio_input) { | 1847 | switch (audio_input) { |
2121 | case CX231XX_AMUX_LINE_IN: | 1848 | case CX231XX_AMUX_LINE_IN: |
2122 | |||
2123 | status = cx231xx_write_i2c_data(dev, Flatrion_DEVICE_ADDRESS, | 1849 | status = cx231xx_write_i2c_data(dev, Flatrion_DEVICE_ADDRESS, |
2124 | CH_PWR_CTRL2, 1, 0x00, 1); | 1850 | CH_PWR_CTRL2, 1, 0x00, 1); |
2125 | status = cx231xx_write_i2c_data(dev, Flatrion_DEVICE_ADDRESS, | 1851 | status = cx231xx_write_i2c_data(dev, Flatrion_DEVICE_ADDRESS, |
@@ -2135,9 +1861,9 @@ int cx231xx_flatiron_set_audio_input(struct cx231xx *dev, u8 audio_input) | |||
2135 | return status; | 1861 | return status; |
2136 | } | 1862 | } |
2137 | 1863 | ||
2138 | /************************************************************************************* | 1864 | /****************************************************************************** |
2139 | * P O W E R C O N T R O L functions * | 1865 | * P O W E R C O N T R O L functions * |
2140 | *************************************************************************************/ | 1866 | ******************************************************************************/ |
2141 | int cx231xx_set_power_mode(struct cx231xx *dev, AV_MODE mode) | 1867 | int cx231xx_set_power_mode(struct cx231xx *dev, AV_MODE mode) |
2142 | { | 1868 | { |
2143 | u8 value[4] = { 0, 0, 0, 0 }; | 1869 | u8 value[4] = { 0, 0, 0, 0 }; |
@@ -2154,8 +1880,8 @@ int cx231xx_set_power_mode(struct cx231xx *dev, AV_MODE mode) | |||
2154 | 1880 | ||
2155 | cx231xx_info(" setPowerMode::mode = %d\n", mode); | 1881 | cx231xx_info(" setPowerMode::mode = %d\n", mode); |
2156 | 1882 | ||
2157 | status = | 1883 | status = cx231xx_read_ctrl_reg(dev, VRT_GET_REGISTER, PWR_CTL_EN, value, |
2158 | cx231xx_read_ctrl_reg(dev, VRT_GET_REGISTER, PWR_CTL_EN, value, 4); | 1884 | 4); |
2159 | if (status < 0) | 1885 | if (status < 0) |
2160 | return status; | 1886 | return status; |
2161 | 1887 | ||
@@ -2171,9 +1897,8 @@ int cx231xx_set_power_mode(struct cx231xx *dev, AV_MODE mode) | |||
2171 | value[1] = (u8) (tmp >> 8); | 1897 | value[1] = (u8) (tmp >> 8); |
2172 | value[2] = (u8) (tmp >> 16); | 1898 | value[2] = (u8) (tmp >> 16); |
2173 | value[3] = (u8) (tmp >> 24); | 1899 | value[3] = (u8) (tmp >> 24); |
2174 | status = | 1900 | status = cx231xx_write_ctrl_reg(dev, VRT_SET_REGISTER, |
2175 | cx231xx_write_ctrl_reg(dev, VRT_SET_REGISTER, PWR_CTL_EN, | 1901 | PWR_CTL_EN, value, 4); |
2176 | value, 4); | ||
2177 | msleep(PWR_SLEEP_INTERVAL); | 1902 | msleep(PWR_SLEEP_INTERVAL); |
2178 | 1903 | ||
2179 | tmp |= PWR_ISO_EN; | 1904 | tmp |= PWR_ISO_EN; |
@@ -2191,9 +1916,8 @@ int cx231xx_set_power_mode(struct cx231xx *dev, AV_MODE mode) | |||
2191 | value[1] = (u8) (tmp >> 8); | 1916 | value[1] = (u8) (tmp >> 8); |
2192 | value[2] = (u8) (tmp >> 16); | 1917 | value[2] = (u8) (tmp >> 16); |
2193 | value[3] = (u8) (tmp >> 24); | 1918 | value[3] = (u8) (tmp >> 24); |
2194 | status = | 1919 | status = cx231xx_write_ctrl_reg(dev, VRT_SET_REGISTER, |
2195 | cx231xx_write_ctrl_reg(dev, VRT_SET_REGISTER, PWR_CTL_EN, | 1920 | PWR_CTL_EN, value, 4); |
2196 | value, 4); | ||
2197 | 1921 | ||
2198 | dev->xc_fw_load_done = 0; /* reset state of xceive tuner */ | 1922 | dev->xc_fw_load_done = 0; /* reset state of xceive tuner */ |
2199 | break; | 1923 | break; |
@@ -2206,9 +1930,8 @@ int cx231xx_set_power_mode(struct cx231xx *dev, AV_MODE mode) | |||
2206 | value[1] = (u8) (tmp >> 8); | 1930 | value[1] = (u8) (tmp >> 8); |
2207 | value[2] = (u8) (tmp >> 16); | 1931 | value[2] = (u8) (tmp >> 16); |
2208 | value[3] = (u8) (tmp >> 24); | 1932 | value[3] = (u8) (tmp >> 24); |
2209 | status = | 1933 | status = cx231xx_write_ctrl_reg(dev, VRT_SET_REGISTER, |
2210 | cx231xx_write_ctrl_reg(dev, VRT_SET_REGISTER, PWR_CTL_EN, | 1934 | PWR_CTL_EN, value, 4); |
2211 | value, 4); | ||
2212 | msleep(PWR_SLEEP_INTERVAL); | 1935 | msleep(PWR_SLEEP_INTERVAL); |
2213 | 1936 | ||
2214 | if (!(tmp & PWR_TUNER_EN)) { | 1937 | if (!(tmp & PWR_TUNER_EN)) { |
@@ -2217,9 +1940,8 @@ int cx231xx_set_power_mode(struct cx231xx *dev, AV_MODE mode) | |||
2217 | value[1] = (u8) (tmp >> 8); | 1940 | value[1] = (u8) (tmp >> 8); |
2218 | value[2] = (u8) (tmp >> 16); | 1941 | value[2] = (u8) (tmp >> 16); |
2219 | value[3] = (u8) (tmp >> 24); | 1942 | value[3] = (u8) (tmp >> 24); |
2220 | status = | 1943 | status = cx231xx_write_ctrl_reg(dev, VRT_SET_REGISTER, |
2221 | cx231xx_write_ctrl_reg(dev, VRT_SET_REGISTER, | 1944 | PWR_CTL_EN, value, 4); |
2222 | PWR_CTL_EN, value, 4); | ||
2223 | msleep(PWR_SLEEP_INTERVAL); | 1945 | msleep(PWR_SLEEP_INTERVAL); |
2224 | } | 1946 | } |
2225 | 1947 | ||
@@ -2229,9 +1951,8 @@ int cx231xx_set_power_mode(struct cx231xx *dev, AV_MODE mode) | |||
2229 | value[1] = (u8) (tmp >> 8); | 1951 | value[1] = (u8) (tmp >> 8); |
2230 | value[2] = (u8) (tmp >> 16); | 1952 | value[2] = (u8) (tmp >> 16); |
2231 | value[3] = (u8) (tmp >> 24); | 1953 | value[3] = (u8) (tmp >> 24); |
2232 | status = | 1954 | status = cx231xx_write_ctrl_reg(dev, VRT_SET_REGISTER, |
2233 | cx231xx_write_ctrl_reg(dev, VRT_SET_REGISTER, | 1955 | PWR_CTL_EN, value, 4); |
2234 | PWR_CTL_EN, value, 4); | ||
2235 | msleep(PWR_SLEEP_INTERVAL); | 1956 | msleep(PWR_SLEEP_INTERVAL); |
2236 | } | 1957 | } |
2237 | if (!(tmp & PWR_ISO_EN)) { | 1958 | if (!(tmp & PWR_ISO_EN)) { |
@@ -2240,9 +1961,8 @@ int cx231xx_set_power_mode(struct cx231xx *dev, AV_MODE mode) | |||
2240 | value[1] = (u8) (tmp >> 8); | 1961 | value[1] = (u8) (tmp >> 8); |
2241 | value[2] = (u8) (tmp >> 16); | 1962 | value[2] = (u8) (tmp >> 16); |
2242 | value[3] = (u8) (tmp >> 24); | 1963 | value[3] = (u8) (tmp >> 24); |
2243 | status = | 1964 | status = cx231xx_write_ctrl_reg(dev, VRT_SET_REGISTER, |
2244 | cx231xx_write_ctrl_reg(dev, VRT_SET_REGISTER, | 1965 | PWR_CTL_EN, value, 4); |
2245 | PWR_CTL_EN, value, 4); | ||
2246 | msleep(PWR_SLEEP_INTERVAL); | 1966 | msleep(PWR_SLEEP_INTERVAL); |
2247 | } | 1967 | } |
2248 | 1968 | ||
@@ -2252,15 +1972,13 @@ int cx231xx_set_power_mode(struct cx231xx *dev, AV_MODE mode) | |||
2252 | value[1] = (u8) (tmp >> 8); | 1972 | value[1] = (u8) (tmp >> 8); |
2253 | value[2] = (u8) (tmp >> 16); | 1973 | value[2] = (u8) (tmp >> 16); |
2254 | value[3] = (u8) (tmp >> 24); | 1974 | value[3] = (u8) (tmp >> 24); |
2255 | status = | 1975 | status = cx231xx_write_ctrl_reg(dev, VRT_SET_REGISTER, |
2256 | cx231xx_write_ctrl_reg(dev, VRT_SET_REGISTER, | 1976 | PWR_CTL_EN, value, 4); |
2257 | PWR_CTL_EN, value, 4); | ||
2258 | msleep(PWR_SLEEP_INTERVAL); | 1977 | msleep(PWR_SLEEP_INTERVAL); |
2259 | } | 1978 | } |
2260 | 1979 | ||
2261 | if ((dev->model == CX231XX_BOARD_CNXT_RDE_250) || | 1980 | if ((dev->model == CX231XX_BOARD_CNXT_RDE_250) || |
2262 | (dev->model == CX231XX_BOARD_CNXT_RDU_250)) { | 1981 | (dev->model == CX231XX_BOARD_CNXT_RDU_250)) { |
2263 | |||
2264 | /* tuner path to channel 1 from port 3 */ | 1982 | /* tuner path to channel 1 from port 3 */ |
2265 | cx231xx_enable_i2c_for_tuner(dev, I2C_3); | 1983 | cx231xx_enable_i2c_for_tuner(dev, I2C_3); |
2266 | 1984 | ||
@@ -2270,16 +1988,14 @@ int cx231xx_set_power_mode(struct cx231xx *dev, AV_MODE mode) | |||
2270 | break; | 1988 | break; |
2271 | 1989 | ||
2272 | case POLARIS_AVMODE_DIGITAL: | 1990 | case POLARIS_AVMODE_DIGITAL: |
2273 | |||
2274 | if (!(tmp & PWR_TUNER_EN)) { | 1991 | if (!(tmp & PWR_TUNER_EN)) { |
2275 | tmp |= (PWR_TUNER_EN); | 1992 | tmp |= (PWR_TUNER_EN); |
2276 | value[0] = (u8) tmp; | 1993 | value[0] = (u8) tmp; |
2277 | value[1] = (u8) (tmp >> 8); | 1994 | value[1] = (u8) (tmp >> 8); |
2278 | value[2] = (u8) (tmp >> 16); | 1995 | value[2] = (u8) (tmp >> 16); |
2279 | value[3] = (u8) (tmp >> 24); | 1996 | value[3] = (u8) (tmp >> 24); |
2280 | status = | 1997 | status = cx231xx_write_ctrl_reg(dev, VRT_SET_REGISTER, |
2281 | cx231xx_write_ctrl_reg(dev, VRT_SET_REGISTER, | 1998 | PWR_CTL_EN, value, 4); |
2282 | PWR_CTL_EN, value, 4); | ||
2283 | msleep(PWR_SLEEP_INTERVAL); | 1999 | msleep(PWR_SLEEP_INTERVAL); |
2284 | } | 2000 | } |
2285 | if (!(tmp & PWR_AV_EN)) { | 2001 | if (!(tmp & PWR_AV_EN)) { |
@@ -2288,9 +2004,8 @@ int cx231xx_set_power_mode(struct cx231xx *dev, AV_MODE mode) | |||
2288 | value[1] = (u8) (tmp >> 8); | 2004 | value[1] = (u8) (tmp >> 8); |
2289 | value[2] = (u8) (tmp >> 16); | 2005 | value[2] = (u8) (tmp >> 16); |
2290 | value[3] = (u8) (tmp >> 24); | 2006 | value[3] = (u8) (tmp >> 24); |
2291 | status = | 2007 | status = cx231xx_write_ctrl_reg(dev, VRT_SET_REGISTER, |
2292 | cx231xx_write_ctrl_reg(dev, VRT_SET_REGISTER, | 2008 | PWR_CTL_EN, value, 4); |
2293 | PWR_CTL_EN, value, 4); | ||
2294 | msleep(PWR_SLEEP_INTERVAL); | 2009 | msleep(PWR_SLEEP_INTERVAL); |
2295 | } | 2010 | } |
2296 | if (!(tmp & PWR_ISO_EN)) { | 2011 | if (!(tmp & PWR_ISO_EN)) { |
@@ -2299,9 +2014,8 @@ int cx231xx_set_power_mode(struct cx231xx *dev, AV_MODE mode) | |||
2299 | value[1] = (u8) (tmp >> 8); | 2014 | value[1] = (u8) (tmp >> 8); |
2300 | value[2] = (u8) (tmp >> 16); | 2015 | value[2] = (u8) (tmp >> 16); |
2301 | value[3] = (u8) (tmp >> 24); | 2016 | value[3] = (u8) (tmp >> 24); |
2302 | status = | 2017 | status = cx231xx_write_ctrl_reg(dev, VRT_SET_REGISTER, |
2303 | cx231xx_write_ctrl_reg(dev, VRT_SET_REGISTER, | 2018 | PWR_CTL_EN, value, 4); |
2304 | PWR_CTL_EN, value, 4); | ||
2305 | msleep(PWR_SLEEP_INTERVAL); | 2019 | msleep(PWR_SLEEP_INTERVAL); |
2306 | } | 2020 | } |
2307 | 2021 | ||
@@ -2310,9 +2024,8 @@ int cx231xx_set_power_mode(struct cx231xx *dev, AV_MODE mode) | |||
2310 | value[1] = (u8) (tmp >> 8); | 2024 | value[1] = (u8) (tmp >> 8); |
2311 | value[2] = (u8) (tmp >> 16); | 2025 | value[2] = (u8) (tmp >> 16); |
2312 | value[3] = (u8) (tmp >> 24); | 2026 | value[3] = (u8) (tmp >> 24); |
2313 | status = | 2027 | status = cx231xx_write_ctrl_reg(dev, VRT_SET_REGISTER, |
2314 | cx231xx_write_ctrl_reg(dev, VRT_SET_REGISTER, PWR_CTL_EN, | 2028 | PWR_CTL_EN, value, 4); |
2315 | value, 4); | ||
2316 | msleep(PWR_SLEEP_INTERVAL); | 2029 | msleep(PWR_SLEEP_INTERVAL); |
2317 | 2030 | ||
2318 | if (!(tmp & PWR_DEMOD_EN)) { | 2031 | if (!(tmp & PWR_DEMOD_EN)) { |
@@ -2321,15 +2034,13 @@ int cx231xx_set_power_mode(struct cx231xx *dev, AV_MODE mode) | |||
2321 | value[1] = (u8) (tmp >> 8); | 2034 | value[1] = (u8) (tmp >> 8); |
2322 | value[2] = (u8) (tmp >> 16); | 2035 | value[2] = (u8) (tmp >> 16); |
2323 | value[3] = (u8) (tmp >> 24); | 2036 | value[3] = (u8) (tmp >> 24); |
2324 | status = | 2037 | status = cx231xx_write_ctrl_reg(dev, VRT_SET_REGISTER, |
2325 | cx231xx_write_ctrl_reg(dev, VRT_SET_REGISTER, | 2038 | PWR_CTL_EN, value, 4); |
2326 | PWR_CTL_EN, value, 4); | ||
2327 | msleep(PWR_SLEEP_INTERVAL); | 2039 | msleep(PWR_SLEEP_INTERVAL); |
2328 | } | 2040 | } |
2329 | 2041 | ||
2330 | if ((dev->model == CX231XX_BOARD_CNXT_RDE_250) || | 2042 | if ((dev->model == CX231XX_BOARD_CNXT_RDE_250) || |
2331 | (dev->model == CX231XX_BOARD_CNXT_RDU_250)) { | 2043 | (dev->model == CX231XX_BOARD_CNXT_RDU_250)) { |
2332 | |||
2333 | /* tuner path to channel 1 from port 3 */ | 2044 | /* tuner path to channel 1 from port 3 */ |
2334 | cx231xx_enable_i2c_for_tuner(dev, I2C_3); | 2045 | cx231xx_enable_i2c_for_tuner(dev, I2C_3); |
2335 | 2046 | ||
@@ -2344,16 +2055,16 @@ int cx231xx_set_power_mode(struct cx231xx *dev, AV_MODE mode) | |||
2344 | 2055 | ||
2345 | msleep(PWR_SLEEP_INTERVAL); | 2056 | msleep(PWR_SLEEP_INTERVAL); |
2346 | 2057 | ||
2347 | /* For power saving, only enable Pwr_resetout_n when digital TV is selected. */ | 2058 | /* For power saving, only enable Pwr_resetout_n |
2059 | when digital TV is selected. */ | ||
2348 | if (mode == POLARIS_AVMODE_DIGITAL) { | 2060 | if (mode == POLARIS_AVMODE_DIGITAL) { |
2349 | tmp |= PWR_RESETOUT_EN; | 2061 | tmp |= PWR_RESETOUT_EN; |
2350 | value[0] = (u8) tmp; | 2062 | value[0] = (u8) tmp; |
2351 | value[1] = (u8) (tmp >> 8); | 2063 | value[1] = (u8) (tmp >> 8); |
2352 | value[2] = (u8) (tmp >> 16); | 2064 | value[2] = (u8) (tmp >> 16); |
2353 | value[3] = (u8) (tmp >> 24); | 2065 | value[3] = (u8) (tmp >> 24); |
2354 | status = | 2066 | status = cx231xx_write_ctrl_reg(dev, VRT_SET_REGISTER, |
2355 | cx231xx_write_ctrl_reg(dev, VRT_SET_REGISTER, PWR_CTL_EN, | 2067 | PWR_CTL_EN, value, 4); |
2356 | value, 4); | ||
2357 | msleep(PWR_SLEEP_INTERVAL); | 2068 | msleep(PWR_SLEEP_INTERVAL); |
2358 | } | 2069 | } |
2359 | 2070 | ||
@@ -2363,11 +2074,10 @@ int cx231xx_set_power_mode(struct cx231xx *dev, AV_MODE mode) | |||
2363 | /* update power control for flatiron */ | 2074 | /* update power control for flatiron */ |
2364 | status = cx231xx_flatiron_update_power_control(dev, mode); | 2075 | status = cx231xx_flatiron_update_power_control(dev, mode); |
2365 | 2076 | ||
2366 | status = | 2077 | status = cx231xx_read_ctrl_reg(dev, VRT_GET_REGISTER, PWR_CTL_EN, value, |
2367 | cx231xx_read_ctrl_reg(dev, VRT_GET_REGISTER, PWR_CTL_EN, value, 4); | 2078 | 4); |
2368 | cx231xx_info | 2079 | cx231xx_info(" The data of PWR_CTL_EN register 0x74=0x%0x,0x%0x,0x%0x,0x%0x\n", |
2369 | (" The data of PWR_CTL_EN register 0x74=0x%0x,0x%0x,0x%0x,0x%0x\n", | 2080 | value[0], value[1], value[2], value[3]); |
2370 | value[0], value[1], value[2], value[3]); | ||
2371 | 2081 | ||
2372 | return status; | 2082 | return status; |
2373 | } | 2083 | } |
@@ -2378,8 +2088,8 @@ int cx231xx_power_suspend(struct cx231xx *dev) | |||
2378 | u32 tmp = 0; | 2088 | u32 tmp = 0; |
2379 | int status = 0; | 2089 | int status = 0; |
2380 | 2090 | ||
2381 | status = | 2091 | status = cx231xx_read_ctrl_reg(dev, VRT_GET_REGISTER, PWR_CTL_EN, |
2382 | cx231xx_read_ctrl_reg(dev, VRT_GET_REGISTER, PWR_CTL_EN, value, 4); | 2092 | value, 4); |
2383 | if (status > 0) | 2093 | if (status > 0) |
2384 | return status; | 2094 | return status; |
2385 | 2095 | ||
@@ -2390,15 +2100,15 @@ int cx231xx_power_suspend(struct cx231xx *dev) | |||
2390 | value[1] = (u8) (tmp >> 8); | 2100 | value[1] = (u8) (tmp >> 8); |
2391 | value[2] = (u8) (tmp >> 16); | 2101 | value[2] = (u8) (tmp >> 16); |
2392 | value[3] = (u8) (tmp >> 24); | 2102 | value[3] = (u8) (tmp >> 24); |
2393 | status = | 2103 | status = cx231xx_write_ctrl_reg(dev, VRT_SET_REGISTER, PWR_CTL_EN, |
2394 | cx231xx_write_ctrl_reg(dev, VRT_SET_REGISTER, PWR_CTL_EN, value, 4); | 2104 | value, 4); |
2395 | 2105 | ||
2396 | return status; | 2106 | return status; |
2397 | } | 2107 | } |
2398 | 2108 | ||
2399 | /************************************************************************************* | 2109 | /****************************************************************************** |
2400 | * S T R E A M C O N T R O L functions * | 2110 | * S T R E A M C O N T R O L functions * |
2401 | *************************************************************************************/ | 2111 | ******************************************************************************/ |
2402 | int cx231xx_start_stream(struct cx231xx *dev, u32 ep_mask) | 2112 | int cx231xx_start_stream(struct cx231xx *dev, u32 ep_mask) |
2403 | { | 2113 | { |
2404 | u8 value[4] = { 0x0, 0x0, 0x0, 0x0 }; | 2114 | u8 value[4] = { 0x0, 0x0, 0x0, 0x0 }; |
@@ -2406,8 +2116,8 @@ int cx231xx_start_stream(struct cx231xx *dev, u32 ep_mask) | |||
2406 | int status = 0; | 2116 | int status = 0; |
2407 | 2117 | ||
2408 | cx231xx_info("cx231xx_start_stream():: ep_mask = %x\n", ep_mask); | 2118 | cx231xx_info("cx231xx_start_stream():: ep_mask = %x\n", ep_mask); |
2409 | status = | 2119 | status = cx231xx_read_ctrl_reg(dev, VRT_GET_REGISTER, EP_MODE_SET, |
2410 | cx231xx_read_ctrl_reg(dev, VRT_GET_REGISTER, EP_MODE_SET, value, 4); | 2120 | value, 4); |
2411 | if (status < 0) | 2121 | if (status < 0) |
2412 | return status; | 2122 | return status; |
2413 | 2123 | ||
@@ -2418,9 +2128,8 @@ int cx231xx_start_stream(struct cx231xx *dev, u32 ep_mask) | |||
2418 | value[2] = (u8) (tmp >> 16); | 2128 | value[2] = (u8) (tmp >> 16); |
2419 | value[3] = (u8) (tmp >> 24); | 2129 | value[3] = (u8) (tmp >> 24); |
2420 | 2130 | ||
2421 | status = | 2131 | status = cx231xx_write_ctrl_reg(dev, VRT_SET_REGISTER, EP_MODE_SET, |
2422 | cx231xx_write_ctrl_reg(dev, VRT_SET_REGISTER, EP_MODE_SET, value, | 2132 | value, 4); |
2423 | 4); | ||
2424 | 2133 | ||
2425 | return status; | 2134 | return status; |
2426 | } | 2135 | } |
@@ -2444,9 +2153,8 @@ int cx231xx_stop_stream(struct cx231xx *dev, u32 ep_mask) | |||
2444 | value[2] = (u8) (tmp >> 16); | 2153 | value[2] = (u8) (tmp >> 16); |
2445 | value[3] = (u8) (tmp >> 24); | 2154 | value[3] = (u8) (tmp >> 24); |
2446 | 2155 | ||
2447 | status = | 2156 | status = cx231xx_write_ctrl_reg(dev, VRT_SET_REGISTER, EP_MODE_SET, |
2448 | cx231xx_write_ctrl_reg(dev, VRT_SET_REGISTER, EP_MODE_SET, value, | 2157 | value, 4); |
2449 | 4); | ||
2450 | 2158 | ||
2451 | return status; | 2159 | return status; |
2452 | } | 2160 | } |
@@ -2558,9 +2266,8 @@ int cx231xx_capture_start(struct cx231xx *dev, int start, u8 media_type) | |||
2558 | if (start) { | 2266 | if (start) { |
2559 | rc = cx231xx_initialize_stream_xfer(dev, media_type); | 2267 | rc = cx231xx_initialize_stream_xfer(dev, media_type); |
2560 | 2268 | ||
2561 | if (rc < 0) { | 2269 | if (rc < 0) |
2562 | return rc; | 2270 | return rc; |
2563 | } | ||
2564 | 2271 | ||
2565 | /* enable video capture */ | 2272 | /* enable video capture */ |
2566 | if (ep_mask > 0) | 2273 | if (ep_mask > 0) |
@@ -2571,20 +2278,14 @@ int cx231xx_capture_start(struct cx231xx *dev, int start, u8 media_type) | |||
2571 | rc = cx231xx_stop_stream(dev, ep_mask); | 2278 | rc = cx231xx_stop_stream(dev, ep_mask); |
2572 | } | 2279 | } |
2573 | 2280 | ||
2574 | if (dev->mode == CX231XX_ANALOG_MODE) { | ||
2575 | /* do any in Analog mode */ | ||
2576 | } else { | ||
2577 | /* do any in digital mode */ | ||
2578 | } | ||
2579 | 2281 | ||
2580 | return rc; | 2282 | return rc; |
2581 | } | 2283 | } |
2582 | |||
2583 | EXPORT_SYMBOL_GPL(cx231xx_capture_start); | 2284 | EXPORT_SYMBOL_GPL(cx231xx_capture_start); |
2584 | 2285 | ||
2585 | /************************************************************************************ | 2286 | /***************************************************************************** |
2586 | * G P I O B I T control functions * | 2287 | * G P I O B I T control functions * |
2587 | *************************************************************************************/ | 2288 | ******************************************************************************/ |
2588 | int cx231xx_set_gpio_bit(struct cx231xx *dev, u32 gpio_bit, u8 * gpio_val) | 2289 | int cx231xx_set_gpio_bit(struct cx231xx *dev, u32 gpio_bit, u8 * gpio_val) |
2589 | { | 2290 | { |
2590 | int status = 0; | 2291 | int status = 0; |
@@ -2621,17 +2322,16 @@ int cx231xx_set_gpio_direction(struct cx231xx *dev, | |||
2621 | u32 value = 0; | 2322 | u32 value = 0; |
2622 | 2323 | ||
2623 | /* Check for valid pin_number - if 32 , bail out */ | 2324 | /* Check for valid pin_number - if 32 , bail out */ |
2624 | if (pin_number >= 32) { | 2325 | if (pin_number >= 32) |
2625 | return -EINVAL; | 2326 | return -EINVAL; |
2626 | } | ||
2627 | 2327 | ||
2628 | if (pin_value == 0) { /* input */ | 2328 | /* input */ |
2329 | if (pin_value == 0) | ||
2629 | value = dev->gpio_dir & (~(1 << pin_number)); /* clear */ | 2330 | value = dev->gpio_dir & (~(1 << pin_number)); /* clear */ |
2630 | } else { | 2331 | else |
2631 | value = dev->gpio_dir | (1 << pin_number); | 2332 | value = dev->gpio_dir | (1 << pin_number); |
2632 | } | ||
2633 | 2333 | ||
2634 | status = cx231xx_set_gpio_bit(dev, value, (u8 *) & dev->gpio_val); | 2334 | status = cx231xx_set_gpio_bit(dev, value, (u8 *) &dev->gpio_val); |
2635 | 2335 | ||
2636 | /* cache the value for future */ | 2336 | /* cache the value for future */ |
2637 | dev->gpio_dir = value; | 2337 | dev->gpio_dir = value; |
@@ -2664,31 +2364,28 @@ int cx231xx_set_gpio_value(struct cx231xx *dev, int pin_number, int pin_value) | |||
2664 | /* It was in input mode */ | 2364 | /* It was in input mode */ |
2665 | value = dev->gpio_dir | (1 << pin_number); | 2365 | value = dev->gpio_dir | (1 << pin_number); |
2666 | dev->gpio_dir = value; | 2366 | dev->gpio_dir = value; |
2667 | status = | 2367 | status = cx231xx_set_gpio_bit(dev, dev->gpio_dir, |
2668 | cx231xx_set_gpio_bit(dev, dev->gpio_dir, | 2368 | (u8 *) &dev->gpio_val); |
2669 | (u8 *) & dev->gpio_val); | ||
2670 | value = 0; | 2369 | value = 0; |
2671 | } | 2370 | } |
2672 | 2371 | ||
2673 | if (pin_value == 0) { | 2372 | if (pin_value == 0) |
2674 | value = dev->gpio_val & (~(1 << pin_number)); | 2373 | value = dev->gpio_val & (~(1 << pin_number)); |
2675 | } else { | 2374 | else |
2676 | value = dev->gpio_val | (1 << pin_number); | 2375 | value = dev->gpio_val | (1 << pin_number); |
2677 | } | ||
2678 | 2376 | ||
2679 | /* store the value */ | 2377 | /* store the value */ |
2680 | dev->gpio_val = value; | 2378 | dev->gpio_val = value; |
2681 | 2379 | ||
2682 | /* toggle bit0 of GP_IO */ | 2380 | /* toggle bit0 of GP_IO */ |
2683 | status = | 2381 | status = cx231xx_set_gpio_bit(dev, dev->gpio_dir, (u8 *)&dev->gpio_val); |
2684 | cx231xx_set_gpio_bit(dev, dev->gpio_dir, (u8 *) & dev->gpio_val); | ||
2685 | 2382 | ||
2686 | return status; | 2383 | return status; |
2687 | } | 2384 | } |
2688 | 2385 | ||
2689 | /************************************************************************************ | 2386 | /***************************************************************************** |
2690 | * G P I O I2C related functions * | 2387 | * G P I O I2C related functions * |
2691 | *************************************************************************************/ | 2388 | ******************************************************************************/ |
2692 | int cx231xx_gpio_i2c_start(struct cx231xx *dev) | 2389 | int cx231xx_gpio_i2c_start(struct cx231xx *dev) |
2693 | { | 2390 | { |
2694 | int status = 0; | 2391 | int status = 0; |
@@ -2699,31 +2396,25 @@ int cx231xx_gpio_i2c_start(struct cx231xx *dev) | |||
2699 | dev->gpio_val |= 1 << dev->board.tuner_scl_gpio; | 2396 | dev->gpio_val |= 1 << dev->board.tuner_scl_gpio; |
2700 | dev->gpio_val |= 1 << dev->board.tuner_sda_gpio; | 2397 | dev->gpio_val |= 1 << dev->board.tuner_sda_gpio; |
2701 | 2398 | ||
2702 | status = | 2399 | status = cx231xx_set_gpio_bit(dev, dev->gpio_dir, (u8 *)&dev->gpio_val); |
2703 | cx231xx_set_gpio_bit(dev, dev->gpio_dir, (u8 *) & dev->gpio_val); | 2400 | if (status < 0) |
2704 | if (status < 0) { | ||
2705 | return -EINVAL; | 2401 | return -EINVAL; |
2706 | } | ||
2707 | 2402 | ||
2708 | /* set SCL to output 1; set SDA to output 0 */ | 2403 | /* set SCL to output 1; set SDA to output 0 */ |
2709 | dev->gpio_val |= 1 << dev->board.tuner_scl_gpio; | 2404 | dev->gpio_val |= 1 << dev->board.tuner_scl_gpio; |
2710 | dev->gpio_val &= ~(1 << dev->board.tuner_sda_gpio); | 2405 | dev->gpio_val &= ~(1 << dev->board.tuner_sda_gpio); |
2711 | 2406 | ||
2712 | status = | 2407 | status = cx231xx_set_gpio_bit(dev, dev->gpio_dir, (u8 *)&dev->gpio_val); |
2713 | cx231xx_set_gpio_bit(dev, dev->gpio_dir, (u8 *) & dev->gpio_val); | 2408 | if (status < 0) |
2714 | if (status < 0) { | ||
2715 | return -EINVAL; | 2409 | return -EINVAL; |
2716 | } | ||
2717 | 2410 | ||
2718 | /* set SCL to output 0; set SDA to output 0 */ | 2411 | /* set SCL to output 0; set SDA to output 0 */ |
2719 | dev->gpio_val &= ~(1 << dev->board.tuner_scl_gpio); | 2412 | dev->gpio_val &= ~(1 << dev->board.tuner_scl_gpio); |
2720 | dev->gpio_val &= ~(1 << dev->board.tuner_sda_gpio); | 2413 | dev->gpio_val &= ~(1 << dev->board.tuner_sda_gpio); |
2721 | 2414 | ||
2722 | status = | 2415 | status = cx231xx_set_gpio_bit(dev, dev->gpio_dir, (u8 *)&dev->gpio_val); |
2723 | cx231xx_set_gpio_bit(dev, dev->gpio_dir, (u8 *) & dev->gpio_val); | 2416 | if (status < 0) |
2724 | if (status < 0) { | ||
2725 | return -EINVAL; | 2417 | return -EINVAL; |
2726 | } | ||
2727 | 2418 | ||
2728 | return status; | 2419 | return status; |
2729 | } | 2420 | } |
@@ -2739,21 +2430,17 @@ int cx231xx_gpio_i2c_end(struct cx231xx *dev) | |||
2739 | dev->gpio_val &= ~(1 << dev->board.tuner_scl_gpio); | 2430 | dev->gpio_val &= ~(1 << dev->board.tuner_scl_gpio); |
2740 | dev->gpio_val &= ~(1 << dev->board.tuner_sda_gpio); | 2431 | dev->gpio_val &= ~(1 << dev->board.tuner_sda_gpio); |
2741 | 2432 | ||
2742 | status = | 2433 | status = cx231xx_set_gpio_bit(dev, dev->gpio_dir, (u8 *)&dev->gpio_val); |
2743 | cx231xx_set_gpio_bit(dev, dev->gpio_dir, (u8 *) & dev->gpio_val); | 2434 | if (status < 0) |
2744 | if (status < 0) { | ||
2745 | return -EINVAL; | 2435 | return -EINVAL; |
2746 | } | ||
2747 | 2436 | ||
2748 | /* set SCL to output 1; set SDA to output 0 */ | 2437 | /* set SCL to output 1; set SDA to output 0 */ |
2749 | dev->gpio_val |= 1 << dev->board.tuner_scl_gpio; | 2438 | dev->gpio_val |= 1 << dev->board.tuner_scl_gpio; |
2750 | dev->gpio_val &= ~(1 << dev->board.tuner_sda_gpio); | 2439 | dev->gpio_val &= ~(1 << dev->board.tuner_sda_gpio); |
2751 | 2440 | ||
2752 | status = | 2441 | status = cx231xx_set_gpio_bit(dev, dev->gpio_dir, (u8 *)&dev->gpio_val); |
2753 | cx231xx_set_gpio_bit(dev, dev->gpio_dir, (u8 *) & dev->gpio_val); | 2442 | if (status < 0) |
2754 | if (status < 0) { | ||
2755 | return -EINVAL; | 2443 | return -EINVAL; |
2756 | } | ||
2757 | 2444 | ||
2758 | /* set SCL to input ,release SCL cable control | 2445 | /* set SCL to input ,release SCL cable control |
2759 | set SDA to input ,release SDA cable control */ | 2446 | set SDA to input ,release SDA cable control */ |
@@ -2761,10 +2448,10 @@ int cx231xx_gpio_i2c_end(struct cx231xx *dev) | |||
2761 | dev->gpio_dir &= ~(1 << dev->board.tuner_sda_gpio); | 2448 | dev->gpio_dir &= ~(1 << dev->board.tuner_sda_gpio); |
2762 | 2449 | ||
2763 | status = | 2450 | status = |
2764 | cx231xx_set_gpio_bit(dev, dev->gpio_dir, (u8 *) & dev->gpio_val); | 2451 | cx231xx_set_gpio_bit(dev, dev->gpio_dir, (u8 *)&dev->gpio_val); |
2765 | if (status < 0) { | 2452 | if (status < 0) |
2766 | return -EINVAL; | 2453 | return -EINVAL; |
2767 | } | 2454 | |
2768 | return status; | 2455 | return status; |
2769 | } | 2456 | } |
2770 | 2457 | ||
@@ -2782,40 +2469,34 @@ int cx231xx_gpio_i2c_write_byte(struct cx231xx *dev, u8 data) | |||
2782 | /* set SCL to output 0; set SDA to output 0 */ | 2469 | /* set SCL to output 0; set SDA to output 0 */ |
2783 | dev->gpio_val &= ~(1 << dev->board.tuner_scl_gpio); | 2470 | dev->gpio_val &= ~(1 << dev->board.tuner_scl_gpio); |
2784 | dev->gpio_val &= ~(1 << dev->board.tuner_sda_gpio); | 2471 | dev->gpio_val &= ~(1 << dev->board.tuner_sda_gpio); |
2785 | status = | 2472 | status = cx231xx_set_gpio_bit(dev, dev->gpio_dir, |
2786 | cx231xx_set_gpio_bit(dev, dev->gpio_dir, | 2473 | (u8 *)&dev->gpio_val); |
2787 | (u8 *) & dev->gpio_val); | ||
2788 | 2474 | ||
2789 | /* set SCL to output 1; set SDA to output 0 */ | 2475 | /* set SCL to output 1; set SDA to output 0 */ |
2790 | dev->gpio_val |= 1 << dev->board.tuner_scl_gpio; | 2476 | dev->gpio_val |= 1 << dev->board.tuner_scl_gpio; |
2791 | status = | 2477 | status = cx231xx_set_gpio_bit(dev, dev->gpio_dir, |
2792 | cx231xx_set_gpio_bit(dev, dev->gpio_dir, | 2478 | (u8 *)&dev->gpio_val); |
2793 | (u8 *) & dev->gpio_val); | ||
2794 | 2479 | ||
2795 | /* set SCL to output 0; set SDA to output 0 */ | 2480 | /* set SCL to output 0; set SDA to output 0 */ |
2796 | dev->gpio_val &= ~(1 << dev->board.tuner_scl_gpio); | 2481 | dev->gpio_val &= ~(1 << dev->board.tuner_scl_gpio); |
2797 | status = | 2482 | status = cx231xx_set_gpio_bit(dev, dev->gpio_dir, |
2798 | cx231xx_set_gpio_bit(dev, dev->gpio_dir, | 2483 | (u8 *)&dev->gpio_val); |
2799 | (u8 *) & dev->gpio_val); | ||
2800 | } else { | 2484 | } else { |
2801 | /* set SCL to output 0; set SDA to output 1 */ | 2485 | /* set SCL to output 0; set SDA to output 1 */ |
2802 | dev->gpio_val &= ~(1 << dev->board.tuner_scl_gpio); | 2486 | dev->gpio_val &= ~(1 << dev->board.tuner_scl_gpio); |
2803 | dev->gpio_val |= 1 << dev->board.tuner_sda_gpio; | 2487 | dev->gpio_val |= 1 << dev->board.tuner_sda_gpio; |
2804 | status = | 2488 | status = cx231xx_set_gpio_bit(dev, dev->gpio_dir, |
2805 | cx231xx_set_gpio_bit(dev, dev->gpio_dir, | 2489 | (u8 *)&dev->gpio_val); |
2806 | (u8 *) & dev->gpio_val); | ||
2807 | 2490 | ||
2808 | /* set SCL to output 1; set SDA to output 1 */ | 2491 | /* set SCL to output 1; set SDA to output 1 */ |
2809 | dev->gpio_val |= 1 << dev->board.tuner_scl_gpio; | 2492 | dev->gpio_val |= 1 << dev->board.tuner_scl_gpio; |
2810 | status = | 2493 | status = cx231xx_set_gpio_bit(dev, dev->gpio_dir, |
2811 | cx231xx_set_gpio_bit(dev, dev->gpio_dir, | 2494 | (u8 *)&dev->gpio_val); |
2812 | (u8 *) & dev->gpio_val); | ||
2813 | 2495 | ||
2814 | /* set SCL to output 0; set SDA to output 1 */ | 2496 | /* set SCL to output 0; set SDA to output 1 */ |
2815 | dev->gpio_val &= ~(1 << dev->board.tuner_scl_gpio); | 2497 | dev->gpio_val &= ~(1 << dev->board.tuner_scl_gpio); |
2816 | status = | 2498 | status = cx231xx_set_gpio_bit(dev, dev->gpio_dir, |
2817 | cx231xx_set_gpio_bit(dev, dev->gpio_dir, | 2499 | (u8 *)&dev->gpio_val); |
2818 | (u8 *) & dev->gpio_val); | ||
2819 | } | 2500 | } |
2820 | } | 2501 | } |
2821 | return status; | 2502 | return status; |
@@ -2833,33 +2514,29 @@ int cx231xx_gpio_i2c_read_byte(struct cx231xx *dev, u8 * buf) | |||
2833 | 2514 | ||
2834 | /* set SCL to output 0; set SDA to input */ | 2515 | /* set SCL to output 0; set SDA to input */ |
2835 | dev->gpio_val &= ~(1 << dev->board.tuner_scl_gpio); | 2516 | dev->gpio_val &= ~(1 << dev->board.tuner_scl_gpio); |
2836 | status = | 2517 | status = cx231xx_set_gpio_bit(dev, dev->gpio_dir, |
2837 | cx231xx_set_gpio_bit(dev, dev->gpio_dir, | 2518 | (u8 *)&dev->gpio_val); |
2838 | (u8 *) & dev->gpio_val); | ||
2839 | 2519 | ||
2840 | /* set SCL to output 1; set SDA to input */ | 2520 | /* set SCL to output 1; set SDA to input */ |
2841 | dev->gpio_val |= 1 << dev->board.tuner_scl_gpio; | 2521 | dev->gpio_val |= 1 << dev->board.tuner_scl_gpio; |
2842 | status = | 2522 | status = cx231xx_set_gpio_bit(dev, dev->gpio_dir, |
2843 | cx231xx_set_gpio_bit(dev, dev->gpio_dir, | 2523 | (u8 *)&dev->gpio_val); |
2844 | (u8 *) & dev->gpio_val); | ||
2845 | 2524 | ||
2846 | /* get SDA data bit */ | 2525 | /* get SDA data bit */ |
2847 | gpio_logic_value = dev->gpio_val; | 2526 | gpio_logic_value = dev->gpio_val; |
2848 | status = | 2527 | status = cx231xx_get_gpio_bit(dev, dev->gpio_dir, |
2849 | cx231xx_get_gpio_bit(dev, dev->gpio_dir, | 2528 | (u8 *)&dev->gpio_val); |
2850 | (u8 *) & dev->gpio_val); | 2529 | if ((dev->gpio_val & (1 << dev->board.tuner_sda_gpio)) != 0) |
2851 | if ((dev->gpio_val & (1 << dev->board.tuner_sda_gpio)) != 0) { | ||
2852 | value |= (1 << (8 - i - 1)); | 2530 | value |= (1 << (8 - i - 1)); |
2853 | } | ||
2854 | 2531 | ||
2855 | dev->gpio_val = gpio_logic_value; | 2532 | dev->gpio_val = gpio_logic_value; |
2856 | } | 2533 | } |
2857 | 2534 | ||
2858 | /* set SCL to output 0,finish the read latest SCL signal. | 2535 | /* set SCL to output 0,finish the read latest SCL signal. |
2859 | !!!set SDA to input,never to modify SDA direction at the same times */ | 2536 | !!!set SDA to input, never to modify SDA direction at |
2537 | the same times */ | ||
2860 | dev->gpio_val &= ~(1 << dev->board.tuner_scl_gpio); | 2538 | dev->gpio_val &= ~(1 << dev->board.tuner_scl_gpio); |
2861 | status = | 2539 | status = cx231xx_set_gpio_bit(dev, dev->gpio_dir, (u8 *)&dev->gpio_val); |
2862 | cx231xx_set_gpio_bit(dev, dev->gpio_dir, (u8 *) & dev->gpio_val); | ||
2863 | 2540 | ||
2864 | /* store the value */ | 2541 | /* store the value */ |
2865 | *buf = value & 0xff; | 2542 | *buf = value & 0xff; |
@@ -2874,33 +2551,29 @@ int cx231xx_gpio_i2c_read_ack(struct cx231xx *dev) | |||
2874 | int nCnt = 10; | 2551 | int nCnt = 10; |
2875 | int nInit = nCnt; | 2552 | int nInit = nCnt; |
2876 | 2553 | ||
2877 | /* clock stretch; set SCL to input; set SDA to input; get SCL value till SCL = 1 */ | 2554 | /* clock stretch; set SCL to input; set SDA to input; |
2555 | get SCL value till SCL = 1 */ | ||
2878 | dev->gpio_dir &= ~(1 << dev->board.tuner_sda_gpio); | 2556 | dev->gpio_dir &= ~(1 << dev->board.tuner_sda_gpio); |
2879 | dev->gpio_dir &= ~(1 << dev->board.tuner_scl_gpio); | 2557 | dev->gpio_dir &= ~(1 << dev->board.tuner_scl_gpio); |
2880 | 2558 | ||
2881 | gpio_logic_value = dev->gpio_val; | 2559 | gpio_logic_value = dev->gpio_val; |
2882 | status = | 2560 | status = cx231xx_set_gpio_bit(dev, dev->gpio_dir, (u8 *)&dev->gpio_val); |
2883 | cx231xx_set_gpio_bit(dev, dev->gpio_dir, (u8 *) & dev->gpio_val); | ||
2884 | 2561 | ||
2885 | do { | 2562 | do { |
2886 | msleep(2); | 2563 | msleep(2); |
2887 | status = | 2564 | status = cx231xx_get_gpio_bit(dev, dev->gpio_dir, |
2888 | cx231xx_get_gpio_bit(dev, dev->gpio_dir, | 2565 | (u8 *)&dev->gpio_val); |
2889 | (u8 *) & dev->gpio_val); | ||
2890 | nCnt--; | 2566 | nCnt--; |
2891 | } while (((dev->gpio_val & (1 << dev->board.tuner_scl_gpio)) == 0) | 2567 | } while (((dev->gpio_val & (1 << dev->board.tuner_scl_gpio)) == 0) && (nCnt > 0)); |
2892 | && (nCnt > 0)); | ||
2893 | 2568 | ||
2894 | if (nCnt == 0) { | 2569 | if (nCnt == 0) |
2895 | cx231xx_info | 2570 | cx231xx_info("No ACK after %d msec for clock stretch. GPIO I2C operation failed!", |
2896 | ("No ACK after %d msec for clock stretch. GPIO I2C operation failed!", | 2571 | nInit * 10); |
2897 | nInit * 10); | ||
2898 | } | ||
2899 | 2572 | ||
2900 | /* readAck | 2573 | /* readAck |
2901 | throuth clock stretch ,slave has given a SCL signal,so the SDA data can be directly read. */ | 2574 | throuth clock stretch ,slave has given a SCL signal, |
2902 | status = | 2575 | so the SDA data can be directly read. */ |
2903 | cx231xx_get_gpio_bit(dev, dev->gpio_dir, (u8 *) & dev->gpio_val); | 2576 | status = cx231xx_get_gpio_bit(dev, dev->gpio_dir, (u8 *)&dev->gpio_val); |
2904 | 2577 | ||
2905 | if ((dev->gpio_val & 1 << dev->board.tuner_sda_gpio) == 0) { | 2578 | if ((dev->gpio_val & 1 << dev->board.tuner_sda_gpio) == 0) { |
2906 | dev->gpio_val = gpio_logic_value; | 2579 | dev->gpio_val = gpio_logic_value; |
@@ -2911,12 +2584,12 @@ int cx231xx_gpio_i2c_read_ack(struct cx231xx *dev) | |||
2911 | dev->gpio_val |= (1 << dev->board.tuner_sda_gpio); | 2584 | dev->gpio_val |= (1 << dev->board.tuner_sda_gpio); |
2912 | } | 2585 | } |
2913 | 2586 | ||
2914 | /* read SDA end, set the SCL to output 0, after this operation, SDA direction can be changed. */ | 2587 | /* read SDA end, set the SCL to output 0, after this operation, |
2588 | SDA direction can be changed. */ | ||
2915 | dev->gpio_val = gpio_logic_value; | 2589 | dev->gpio_val = gpio_logic_value; |
2916 | dev->gpio_dir |= (1 << dev->board.tuner_scl_gpio); | 2590 | dev->gpio_dir |= (1 << dev->board.tuner_scl_gpio); |
2917 | dev->gpio_val &= ~(1 << dev->board.tuner_scl_gpio); | 2591 | dev->gpio_val &= ~(1 << dev->board.tuner_scl_gpio); |
2918 | status = | 2592 | status = cx231xx_set_gpio_bit(dev, dev->gpio_dir, (u8 *)&dev->gpio_val); |
2919 | cx231xx_set_gpio_bit(dev, dev->gpio_dir, (u8 *) & dev->gpio_val); | ||
2920 | 2593 | ||
2921 | return status; | 2594 | return status; |
2922 | } | 2595 | } |
@@ -2927,29 +2600,24 @@ int cx231xx_gpio_i2c_write_ack(struct cx231xx *dev) | |||
2927 | 2600 | ||
2928 | /* set SDA to ouput */ | 2601 | /* set SDA to ouput */ |
2929 | dev->gpio_dir |= 1 << dev->board.tuner_sda_gpio; | 2602 | dev->gpio_dir |= 1 << dev->board.tuner_sda_gpio; |
2930 | status = | 2603 | status = cx231xx_set_gpio_bit(dev, dev->gpio_dir, (u8 *)&dev->gpio_val); |
2931 | cx231xx_set_gpio_bit(dev, dev->gpio_dir, (u8 *) & dev->gpio_val); | ||
2932 | 2604 | ||
2933 | /* set SCL = 0 (output); set SDA = 0 (output) */ | 2605 | /* set SCL = 0 (output); set SDA = 0 (output) */ |
2934 | dev->gpio_val &= ~(1 << dev->board.tuner_sda_gpio); | 2606 | dev->gpio_val &= ~(1 << dev->board.tuner_sda_gpio); |
2935 | dev->gpio_val &= ~(1 << dev->board.tuner_scl_gpio); | 2607 | dev->gpio_val &= ~(1 << dev->board.tuner_scl_gpio); |
2936 | status = | 2608 | status = cx231xx_set_gpio_bit(dev, dev->gpio_dir, (u8 *)&dev->gpio_val); |
2937 | cx231xx_set_gpio_bit(dev, dev->gpio_dir, (u8 *) & dev->gpio_val); | ||
2938 | 2609 | ||
2939 | /* set SCL = 1 (output); set SDA = 0 (output) */ | 2610 | /* set SCL = 1 (output); set SDA = 0 (output) */ |
2940 | dev->gpio_val |= 1 << dev->board.tuner_scl_gpio; | 2611 | dev->gpio_val |= 1 << dev->board.tuner_scl_gpio; |
2941 | status = | 2612 | status = cx231xx_set_gpio_bit(dev, dev->gpio_dir, (u8 *)&dev->gpio_val); |
2942 | cx231xx_set_gpio_bit(dev, dev->gpio_dir, (u8 *) & dev->gpio_val); | ||
2943 | 2613 | ||
2944 | /* set SCL = 0 (output); set SDA = 0 (output) */ | 2614 | /* set SCL = 0 (output); set SDA = 0 (output) */ |
2945 | dev->gpio_val &= ~(1 << dev->board.tuner_scl_gpio); | 2615 | dev->gpio_val &= ~(1 << dev->board.tuner_scl_gpio); |
2946 | status = | 2616 | status = cx231xx_set_gpio_bit(dev, dev->gpio_dir, (u8 *)&dev->gpio_val); |
2947 | cx231xx_set_gpio_bit(dev, dev->gpio_dir, (u8 *) & dev->gpio_val); | ||
2948 | 2617 | ||
2949 | /* set SDA to input,and then the slave will read data from SDA. */ | 2618 | /* set SDA to input,and then the slave will read data from SDA. */ |
2950 | dev->gpio_dir &= ~(1 << dev->board.tuner_sda_gpio); | 2619 | dev->gpio_dir &= ~(1 << dev->board.tuner_sda_gpio); |
2951 | status = | 2620 | status = cx231xx_set_gpio_bit(dev, dev->gpio_dir, (u8 *)&dev->gpio_val); |
2952 | cx231xx_set_gpio_bit(dev, dev->gpio_dir, (u8 *) & dev->gpio_val); | ||
2953 | 2621 | ||
2954 | return status; | 2622 | return status; |
2955 | } | 2623 | } |
@@ -2961,25 +2629,22 @@ int cx231xx_gpio_i2c_write_nak(struct cx231xx *dev) | |||
2961 | /* set scl to output ; set sda to input */ | 2629 | /* set scl to output ; set sda to input */ |
2962 | dev->gpio_dir |= 1 << dev->board.tuner_scl_gpio; | 2630 | dev->gpio_dir |= 1 << dev->board.tuner_scl_gpio; |
2963 | dev->gpio_dir &= ~(1 << dev->board.tuner_sda_gpio); | 2631 | dev->gpio_dir &= ~(1 << dev->board.tuner_sda_gpio); |
2964 | status = | 2632 | status = cx231xx_set_gpio_bit(dev, dev->gpio_dir, (u8 *)&dev->gpio_val); |
2965 | cx231xx_set_gpio_bit(dev, dev->gpio_dir, (u8 *) & dev->gpio_val); | ||
2966 | 2633 | ||
2967 | /* set scl to output 0; set sda to input */ | 2634 | /* set scl to output 0; set sda to input */ |
2968 | dev->gpio_val &= ~(1 << dev->board.tuner_scl_gpio); | 2635 | dev->gpio_val &= ~(1 << dev->board.tuner_scl_gpio); |
2969 | status = | 2636 | status = cx231xx_set_gpio_bit(dev, dev->gpio_dir, (u8 *)&dev->gpio_val); |
2970 | cx231xx_set_gpio_bit(dev, dev->gpio_dir, (u8 *) & dev->gpio_val); | ||
2971 | 2637 | ||
2972 | /* set scl to output 1; set sda to input */ | 2638 | /* set scl to output 1; set sda to input */ |
2973 | dev->gpio_val |= 1 << dev->board.tuner_scl_gpio; | 2639 | dev->gpio_val |= 1 << dev->board.tuner_scl_gpio; |
2974 | status = | 2640 | status = cx231xx_set_gpio_bit(dev, dev->gpio_dir, (u8 *)&dev->gpio_val); |
2975 | cx231xx_set_gpio_bit(dev, dev->gpio_dir, (u8 *) & dev->gpio_val); | ||
2976 | 2641 | ||
2977 | return status; | 2642 | return status; |
2978 | } | 2643 | } |
2979 | 2644 | ||
2980 | /************************************************************************************ | 2645 | /***************************************************************************** |
2981 | * G P I O I2C related functions * | 2646 | * G P I O I2C related functions * |
2982 | *************************************************************************************/ | 2647 | ******************************************************************************/ |
2983 | /* cx231xx_gpio_i2c_read | 2648 | /* cx231xx_gpio_i2c_read |
2984 | * Function to read data from gpio based I2C interface | 2649 | * Function to read data from gpio based I2C interface |
2985 | */ | 2650 | */ |
diff --git a/drivers/media/video/cx231xx/cx231xx-vbi.c b/drivers/media/video/cx231xx/cx231xx-vbi.c index 87a77d53faa6..03059043744c 100644 --- a/drivers/media/video/cx231xx/cx231xx-vbi.c +++ b/drivers/media/video/cx231xx/cx231xx-vbi.c | |||
@@ -109,27 +109,29 @@ static inline int cx231xx_isoc_vbi_copy(struct cx231xx *dev, struct urb *urb) | |||
109 | buffer_size = urb->actual_length; | 109 | buffer_size = urb->actual_length; |
110 | 110 | ||
111 | if (buffer_size > 0) { | 111 | if (buffer_size > 0) { |
112 | |||
113 | bytes_parsed = 0; | 112 | bytes_parsed = 0; |
114 | 113 | ||
115 | if (dma_q->is_partial_line) { | 114 | if (dma_q->is_partial_line) { |
116 | /* Handle the case where we were working on a partial line */ | 115 | /* Handle the case where we were working on a partial |
116 | line */ | ||
117 | sav_eav = dma_q->last_sav; | 117 | sav_eav = dma_q->last_sav; |
118 | } else { | 118 | } else { |
119 | /* Check for a SAV/EAV overlapping the buffer boundary */ | 119 | /* Check for a SAV/EAV overlapping the |
120 | sav_eav = | 120 | buffer boundary */ |
121 | cx231xx_find_boundary_SAV_EAV(p_buffer, | 121 | |
122 | sav_eav = cx231xx_find_boundary_SAV_EAV(p_buffer, | ||
122 | dma_q->partial_buf, | 123 | dma_q->partial_buf, |
123 | &bytes_parsed); | 124 | &bytes_parsed); |
124 | } | 125 | } |
125 | 126 | ||
126 | sav_eav &= 0xF0; | 127 | sav_eav &= 0xF0; |
127 | /* Get the first line if we have some portion of an SAV/EAV from the last buffer | 128 | /* Get the first line if we have some portion of an SAV/EAV from |
128 | or a partial line */ | 129 | the last buffer or a partial line */ |
129 | if (sav_eav) { | 130 | if (sav_eav) { |
130 | bytes_parsed += cx231xx_get_vbi_line(dev, dma_q, sav_eav, /* SAV/EAV */ | 131 | bytes_parsed += cx231xx_get_vbi_line(dev, dma_q, |
131 | p_buffer + bytes_parsed, /* p_buffer */ | 132 | sav_eav, /* SAV/EAV */ |
132 | buffer_size - bytes_parsed); /* buffer size */ | 133 | p_buffer + bytes_parsed, /* p_buffer */ |
134 | buffer_size - bytes_parsed); /* buffer size */ | ||
133 | } | 135 | } |
134 | 136 | ||
135 | /* Now parse data that is completely in this buffer */ | 137 | /* Now parse data that is completely in this buffer */ |
@@ -139,16 +141,17 @@ static inline int cx231xx_isoc_vbi_copy(struct cx231xx *dev, struct urb *urb) | |||
139 | u32 bytes_used = 0; | 141 | u32 bytes_used = 0; |
140 | 142 | ||
141 | sav_eav = cx231xx_find_next_SAV_EAV(p_buffer + bytes_parsed, /* p_buffer */ | 143 | sav_eav = cx231xx_find_next_SAV_EAV(p_buffer + bytes_parsed, /* p_buffer */ |
142 | buffer_size - bytes_parsed, /* buffer size */ | 144 | buffer_size - bytes_parsed, /* buffer size */ |
143 | &bytes_used); /* Receives bytes used to get SAV/EAV */ | 145 | &bytes_used); /* Receives bytes used to get SAV/EAV */ |
144 | 146 | ||
145 | bytes_parsed += bytes_used; | 147 | bytes_parsed += bytes_used; |
146 | 148 | ||
147 | sav_eav &= 0xF0; | 149 | sav_eav &= 0xF0; |
148 | if (sav_eav && (bytes_parsed < buffer_size)) { | 150 | if (sav_eav && (bytes_parsed < buffer_size)) { |
149 | bytes_parsed += cx231xx_get_vbi_line(dev, dma_q, sav_eav, /* SAV/EAV */ | 151 | bytes_parsed += cx231xx_get_vbi_line(dev, |
150 | p_buffer + bytes_parsed, /* p_buffer */ | 152 | dma_q, sav_eav, /* SAV/EAV */ |
151 | buffer_size - bytes_parsed); /* buffer size */ | 153 | p_buffer + bytes_parsed, /* p_buffer */ |
154 | buffer_size - bytes_parsed); /* buffer size */ | ||
152 | } | 155 | } |
153 | } | 156 | } |
154 | 157 | ||
@@ -261,7 +264,7 @@ vbi_buffer_prepare(struct videobuf_queue *vq, struct videobuf_buffer *vb, | |||
261 | buf->vb.state = VIDEOBUF_PREPARED; | 264 | buf->vb.state = VIDEOBUF_PREPARED; |
262 | return 0; | 265 | return 0; |
263 | 266 | ||
264 | fail: | 267 | fail: |
265 | free_buffer(vq, buf); | 268 | free_buffer(vq, buf); |
266 | return rc; | 269 | return rc; |
267 | } | 270 | } |
@@ -285,20 +288,15 @@ static void vbi_buffer_release(struct videobuf_queue *vq, | |||
285 | { | 288 | { |
286 | struct cx231xx_buffer *buf = | 289 | struct cx231xx_buffer *buf = |
287 | container_of(vb, struct cx231xx_buffer, vb); | 290 | container_of(vb, struct cx231xx_buffer, vb); |
288 | /* | ||
289 | struct cx231xx_fh *fh = vq->priv_data; | ||
290 | struct cx231xx *dev = (struct cx231xx *)fh->dev; | ||
291 | 291 | ||
292 | cx231xx_info(DRIVER_NAME "cx231xx: called vbi_buffer_release\n"); | ||
293 | */ | ||
294 | 292 | ||
295 | free_buffer(vq, buf); | 293 | free_buffer(vq, buf); |
296 | } | 294 | } |
297 | 295 | ||
298 | struct videobuf_queue_ops cx231xx_vbi_qops = { | 296 | struct videobuf_queue_ops cx231xx_vbi_qops = { |
299 | .buf_setup = vbi_buffer_setup, | 297 | .buf_setup = vbi_buffer_setup, |
300 | .buf_prepare = vbi_buffer_prepare, | 298 | .buf_prepare = vbi_buffer_prepare, |
301 | .buf_queue = vbi_buffer_queue, | 299 | .buf_queue = vbi_buffer_queue, |
302 | .buf_release = vbi_buffer_release, | 300 | .buf_release = vbi_buffer_release, |
303 | }; | 301 | }; |
304 | 302 | ||
@@ -387,7 +385,6 @@ void cx231xx_uninit_vbi_isoc(struct cx231xx *dev) | |||
387 | 385 | ||
388 | cx231xx_capture_start(dev, 0, Vbi); | 386 | cx231xx_capture_start(dev, 0, Vbi); |
389 | } | 387 | } |
390 | |||
391 | EXPORT_SYMBOL_GPL(cx231xx_uninit_vbi_isoc); | 388 | EXPORT_SYMBOL_GPL(cx231xx_uninit_vbi_isoc); |
392 | 389 | ||
393 | /* | 390 | /* |
@@ -395,8 +392,8 @@ EXPORT_SYMBOL_GPL(cx231xx_uninit_vbi_isoc); | |||
395 | */ | 392 | */ |
396 | int cx231xx_init_vbi_isoc(struct cx231xx *dev, int max_packets, | 393 | int cx231xx_init_vbi_isoc(struct cx231xx *dev, int max_packets, |
397 | int num_bufs, int max_pkt_size, | 394 | int num_bufs, int max_pkt_size, |
398 | int (*isoc_copy) (struct cx231xx * dev, | 395 | int (*isoc_copy) (struct cx231xx *dev, |
399 | struct urb * urb)) | 396 | struct urb *urb)) |
400 | { | 397 | { |
401 | struct cx231xx_dmaqueue *dma_q = &dev->vbi_mode.vidq; | 398 | struct cx231xx_dmaqueue *dma_q = &dev->vbi_mode.vidq; |
402 | int i; | 399 | int i; |
@@ -427,8 +424,8 @@ int cx231xx_init_vbi_isoc(struct cx231xx *dev, int max_packets, | |||
427 | for (i = 0; i < 8; i++) | 424 | for (i = 0; i < 8; i++) |
428 | dma_q->partial_buf[i] = 0; | 425 | dma_q->partial_buf[i] = 0; |
429 | 426 | ||
430 | dev->vbi_mode.isoc_ctl.urb = | 427 | dev->vbi_mode.isoc_ctl.urb = kzalloc(sizeof(void *) * num_bufs, |
431 | kzalloc(sizeof(void *) * num_bufs, GFP_KERNEL); | 428 | GFP_KERNEL); |
432 | if (!dev->vbi_mode.isoc_ctl.urb) { | 429 | if (!dev->vbi_mode.isoc_ctl.urb) { |
433 | cx231xx_errdev("cannot alloc memory for usb buffers\n"); | 430 | cx231xx_errdev("cannot alloc memory for usb buffers\n"); |
434 | return -ENOMEM; | 431 | return -ENOMEM; |
@@ -466,7 +463,7 @@ int cx231xx_init_vbi_isoc(struct cx231xx *dev, int max_packets, | |||
466 | cx231xx_err(DRIVER_NAME | 463 | cx231xx_err(DRIVER_NAME |
467 | ": unable to allocate %i bytes for transfer" | 464 | ": unable to allocate %i bytes for transfer" |
468 | " buffer %i%s\n", sb_size, i, | 465 | " buffer %i%s\n", sb_size, i, |
469 | in_interrupt()? " while in int" : ""); | 466 | in_interrupt() ? " while in int" : ""); |
470 | cx231xx_uninit_vbi_isoc(dev); | 467 | cx231xx_uninit_vbi_isoc(dev); |
471 | return -ENOMEM; | 468 | return -ENOMEM; |
472 | } | 469 | } |
@@ -495,11 +492,10 @@ int cx231xx_init_vbi_isoc(struct cx231xx *dev, int max_packets, | |||
495 | 492 | ||
496 | return 0; | 493 | return 0; |
497 | } | 494 | } |
498 | |||
499 | EXPORT_SYMBOL_GPL(cx231xx_init_vbi_isoc); | 495 | EXPORT_SYMBOL_GPL(cx231xx_init_vbi_isoc); |
500 | 496 | ||
501 | u32 cx231xx_get_vbi_line(struct cx231xx * dev, struct cx231xx_dmaqueue * dma_q, | 497 | u32 cx231xx_get_vbi_line(struct cx231xx *dev, struct cx231xx_dmaqueue *dma_q, |
502 | u8 sav_eav, u8 * p_buffer, u32 buffer_size) | 498 | u8 sav_eav, u8 *p_buffer, u32 buffer_size) |
503 | { | 499 | { |
504 | u32 bytes_copied = 0; | 500 | u32 bytes_copied = 0; |
505 | int current_field = -1; | 501 | int current_field = -1; |
@@ -550,15 +546,14 @@ static inline void vbi_buffer_filled(struct cx231xx *dev, | |||
550 | } | 546 | } |
551 | 547 | ||
552 | u32 cx231xx_copy_vbi_line(struct cx231xx *dev, struct cx231xx_dmaqueue *dma_q, | 548 | u32 cx231xx_copy_vbi_line(struct cx231xx *dev, struct cx231xx_dmaqueue *dma_q, |
553 | u8 * p_line, u32 length, int field_number) | 549 | u8 *p_line, u32 length, int field_number) |
554 | { | 550 | { |
555 | u32 bytes_to_copy; | 551 | u32 bytes_to_copy; |
556 | struct cx231xx_buffer *buf; | 552 | struct cx231xx_buffer *buf; |
557 | u32 _line_size = dev->width * 2; | 553 | u32 _line_size = dev->width * 2; |
558 | 554 | ||
559 | if (dma_q->current_field != field_number) { | 555 | if (dma_q->current_field != field_number) |
560 | cx231xx_reset_vbi_buffer(dev, dma_q); | 556 | cx231xx_reset_vbi_buffer(dev, dma_q); |
561 | } | ||
562 | 557 | ||
563 | /* get the buffer pointer */ | 558 | /* get the buffer pointer */ |
564 | buf = dev->vbi_mode.isoc_ctl.buf; | 559 | buf = dev->vbi_mode.isoc_ctl.buf; |
@@ -651,7 +646,6 @@ void cx231xx_reset_vbi_buffer(struct cx231xx *dev, | |||
651 | buf = dev->vbi_mode.isoc_ctl.buf; | 646 | buf = dev->vbi_mode.isoc_ctl.buf; |
652 | 647 | ||
653 | if (buf == NULL) { | 648 | if (buf == NULL) { |
654 | |||
655 | /* first try to get the buffer */ | 649 | /* first try to get the buffer */ |
656 | get_next_vbi_buf(dma_q, &buf); | 650 | get_next_vbi_buf(dma_q, &buf); |
657 | 651 | ||
@@ -664,7 +658,7 @@ void cx231xx_reset_vbi_buffer(struct cx231xx *dev, | |||
664 | } | 658 | } |
665 | 659 | ||
666 | int cx231xx_do_vbi_copy(struct cx231xx *dev, struct cx231xx_dmaqueue *dma_q, | 660 | int cx231xx_do_vbi_copy(struct cx231xx *dev, struct cx231xx_dmaqueue *dma_q, |
667 | u8 * p_buffer, u32 bytes_to_copy) | 661 | u8 *p_buffer, u32 bytes_to_copy) |
668 | { | 662 | { |
669 | u8 *p_out_buffer = NULL; | 663 | u8 *p_out_buffer = NULL; |
670 | u32 current_line_bytes_copied = 0; | 664 | u32 current_line_bytes_copied = 0; |
@@ -675,9 +669,8 @@ int cx231xx_do_vbi_copy(struct cx231xx *dev, struct cx231xx_dmaqueue *dma_q, | |||
675 | 669 | ||
676 | buf = dev->vbi_mode.isoc_ctl.buf; | 670 | buf = dev->vbi_mode.isoc_ctl.buf; |
677 | 671 | ||
678 | if (buf == NULL) { | 672 | if (buf == NULL) |
679 | return -1; | 673 | return -EINVAL; |
680 | } | ||
681 | 674 | ||
682 | p_out_buffer = videobuf_to_vmalloc(&buf->vb); | 675 | p_out_buffer = videobuf_to_vmalloc(&buf->vb); |
683 | 676 | ||
@@ -686,23 +679,22 @@ int cx231xx_do_vbi_copy(struct cx231xx *dev, struct cx231xx_dmaqueue *dma_q, | |||
686 | _line_size - dma_q->bytes_left_in_line; | 679 | _line_size - dma_q->bytes_left_in_line; |
687 | } | 680 | } |
688 | 681 | ||
689 | offset = | 682 | offset = (dma_q->lines_completed * _line_size) + |
690 | (dma_q->lines_completed * _line_size) + current_line_bytes_copied; | 683 | current_line_bytes_copied; |
691 | 684 | ||
692 | /* prepare destination address */ | 685 | /* prepare destination address */ |
693 | startwrite = p_out_buffer + offset; | 686 | startwrite = p_out_buffer + offset; |
694 | 687 | ||
695 | lencopy = | 688 | lencopy = dma_q->bytes_left_in_line > bytes_to_copy ? |
696 | dma_q->bytes_left_in_line > | 689 | bytes_to_copy : dma_q->bytes_left_in_line; |
697 | bytes_to_copy ? bytes_to_copy : dma_q->bytes_left_in_line; | ||
698 | 690 | ||
699 | memcpy(startwrite, p_buffer, lencopy); | 691 | memcpy(startwrite, p_buffer, lencopy); |
700 | 692 | ||
701 | return 0; | 693 | return 0; |
702 | } | 694 | } |
703 | 695 | ||
704 | u8 cx231xx_is_vbi_buffer_done(struct cx231xx * dev, | 696 | u8 cx231xx_is_vbi_buffer_done(struct cx231xx *dev, |
705 | struct cx231xx_dmaqueue * dma_q) | 697 | struct cx231xx_dmaqueue *dma_q) |
706 | { | 698 | { |
707 | u32 height = 0; | 699 | u32 height = 0; |
708 | 700 | ||
diff --git a/drivers/media/video/cx231xx/cx231xx-video.c b/drivers/media/video/cx231xx/cx231xx-video.c index 18919e0f0194..89cf57c5056a 100644 --- a/drivers/media/video/cx231xx/cx231xx-video.c +++ b/drivers/media/video/cx231xx/cx231xx-video.c | |||
@@ -1,5 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | cx231xx-video.c - driver for Conexant Cx23100/101/102 USB video capture devices | 2 | cx231xx-video.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 |
@@ -109,91 +110,91 @@ static const struct v4l2_queryctrl no_ctl = { | |||
109 | static struct cx231xx_ctrl cx231xx_ctls[] = { | 110 | static struct cx231xx_ctrl cx231xx_ctls[] = { |
110 | /* --- video --- */ | 111 | /* --- video --- */ |
111 | { | 112 | { |
112 | .v = { | 113 | .v = { |
113 | .id = V4L2_CID_BRIGHTNESS, | 114 | .id = V4L2_CID_BRIGHTNESS, |
114 | .name = "Brightness", | 115 | .name = "Brightness", |
115 | .minimum = 0x00, | 116 | .minimum = 0x00, |
116 | .maximum = 0xff, | 117 | .maximum = 0xff, |
117 | .step = 1, | 118 | .step = 1, |
118 | .default_value = 0x7f, | 119 | .default_value = 0x7f, |
119 | .type = V4L2_CTRL_TYPE_INTEGER, | 120 | .type = V4L2_CTRL_TYPE_INTEGER, |
120 | }, | 121 | }, |
121 | .off = 128, | 122 | .off = 128, |
122 | .reg = LUMA_CTRL, | 123 | .reg = LUMA_CTRL, |
123 | .mask = 0x00ff, | 124 | .mask = 0x00ff, |
124 | .shift = 0, | 125 | .shift = 0, |
125 | }, { | 126 | }, { |
126 | .v = { | 127 | .v = { |
127 | .id = V4L2_CID_CONTRAST, | 128 | .id = V4L2_CID_CONTRAST, |
128 | .name = "Contrast", | 129 | .name = "Contrast", |
129 | .minimum = 0, | 130 | .minimum = 0, |
130 | .maximum = 0xff, | 131 | .maximum = 0xff, |
131 | .step = 1, | 132 | .step = 1, |
132 | .default_value = 0x3f, | 133 | .default_value = 0x3f, |
133 | .type = V4L2_CTRL_TYPE_INTEGER, | 134 | .type = V4L2_CTRL_TYPE_INTEGER, |
134 | }, | 135 | }, |
135 | .off = 0, | 136 | .off = 0, |
136 | .reg = LUMA_CTRL, | 137 | .reg = LUMA_CTRL, |
137 | .mask = 0xff00, | 138 | .mask = 0xff00, |
138 | .shift = 8, | 139 | .shift = 8, |
139 | }, { | 140 | }, { |
140 | .v = { | 141 | .v = { |
141 | .id = V4L2_CID_HUE, | 142 | .id = V4L2_CID_HUE, |
142 | .name = "Hue", | 143 | .name = "Hue", |
143 | .minimum = 0, | 144 | .minimum = 0, |
144 | .maximum = 0xff, | 145 | .maximum = 0xff, |
145 | .step = 1, | 146 | .step = 1, |
146 | .default_value = 0x7f, | 147 | .default_value = 0x7f, |
147 | .type = V4L2_CTRL_TYPE_INTEGER, | 148 | .type = V4L2_CTRL_TYPE_INTEGER, |
148 | }, | 149 | }, |
149 | .off = 128, | 150 | .off = 128, |
150 | .reg = CHROMA_CTRL, | 151 | .reg = CHROMA_CTRL, |
151 | .mask = 0xff0000, | 152 | .mask = 0xff0000, |
152 | .shift = 16, | 153 | .shift = 16, |
153 | }, { | 154 | }, { |
154 | /* strictly, this only describes only U saturation. | 155 | /* strictly, this only describes only U saturation. |
155 | * V saturation is handled specially through code. | 156 | * V saturation is handled specially through code. |
156 | */ | 157 | */ |
157 | .v = { | 158 | .v = { |
158 | .id = V4L2_CID_SATURATION, | 159 | .id = V4L2_CID_SATURATION, |
159 | .name = "Saturation", | 160 | .name = "Saturation", |
160 | .minimum = 0, | 161 | .minimum = 0, |
161 | .maximum = 0xff, | 162 | .maximum = 0xff, |
162 | .step = 1, | 163 | .step = 1, |
163 | .default_value = 0x7f, | 164 | .default_value = 0x7f, |
164 | .type = V4L2_CTRL_TYPE_INTEGER, | 165 | .type = V4L2_CTRL_TYPE_INTEGER, |
165 | }, | 166 | }, |
166 | .off = 0, | 167 | .off = 0, |
167 | .reg = CHROMA_CTRL, | 168 | .reg = CHROMA_CTRL, |
168 | .mask = 0x00ff, | 169 | .mask = 0x00ff, |
169 | .shift = 0, | 170 | .shift = 0, |
170 | }, { | 171 | }, { |
171 | /* --- audio --- */ | 172 | /* --- audio --- */ |
172 | .v = { | 173 | .v = { |
173 | .id = V4L2_CID_AUDIO_MUTE, | 174 | .id = V4L2_CID_AUDIO_MUTE, |
174 | .name = "Mute", | 175 | .name = "Mute", |
175 | .minimum = 0, | 176 | .minimum = 0, |
176 | .maximum = 1, | 177 | .maximum = 1, |
177 | .default_value = 1, | 178 | .default_value = 1, |
178 | .type = V4L2_CTRL_TYPE_BOOLEAN, | 179 | .type = V4L2_CTRL_TYPE_BOOLEAN, |
179 | }, | 180 | }, |
180 | .reg = PATH1_CTL1, | 181 | .reg = PATH1_CTL1, |
181 | .mask = (0x1f << 24), | 182 | .mask = (0x1f << 24), |
182 | .shift = 24, | 183 | .shift = 24, |
183 | }, { | 184 | }, { |
184 | .v = { | 185 | .v = { |
185 | .id = V4L2_CID_AUDIO_VOLUME, | 186 | .id = V4L2_CID_AUDIO_VOLUME, |
186 | .name = "Volume", | 187 | .name = "Volume", |
187 | .minimum = 0, | 188 | .minimum = 0, |
188 | .maximum = 0x3f, | 189 | .maximum = 0x3f, |
189 | .step = 1, | 190 | .step = 1, |
190 | .default_value = 0x3f, | 191 | .default_value = 0x3f, |
191 | .type = V4L2_CTRL_TYPE_INTEGER, | 192 | .type = V4L2_CTRL_TYPE_INTEGER, |
192 | }, | 193 | }, |
193 | .reg = PATH1_VOL_CTL, | 194 | .reg = PATH1_VOL_CTL, |
194 | .mask = 0xff, | 195 | .mask = 0xff, |
195 | .shift = 0, | 196 | .shift = 0, |
196 | } | 197 | } |
197 | }; | 198 | }; |
198 | static const int CX231XX_CTLS = ARRAY_SIZE(cx231xx_ctls); | 199 | static const int CX231XX_CTLS = ARRAY_SIZE(cx231xx_ctls); |
199 | 200 | ||
@@ -373,12 +374,13 @@ static inline int cx231xx_isoc_copy(struct cx231xx *dev, struct urb *urb) | |||
373 | } | 374 | } |
374 | 375 | ||
375 | sav_eav &= 0xF0; | 376 | sav_eav &= 0xF0; |
376 | /* Get the first line if we have some portion of an SAV/EAV from the last buffer | 377 | /* Get the first line if we have some portion of an SAV/EAV from |
377 | or a partial line */ | 378 | the last buffer or a partial line */ |
378 | if (sav_eav) { | 379 | if (sav_eav) { |
379 | bytes_parsed += cx231xx_get_video_line(dev, dma_q, sav_eav, /* SAV/EAV */ | 380 | bytes_parsed += cx231xx_get_video_line(dev, dma_q, |
380 | p_buffer + bytes_parsed, /* p_buffer */ | 381 | sav_eav, /* SAV/EAV */ |
381 | buffer_size - bytes_parsed); /* buffer size */ | 382 | p_buffer + bytes_parsed, /* p_buffer */ |
383 | buffer_size - bytes_parsed); /* buffer size */ | ||
382 | } | 384 | } |
383 | 385 | ||
384 | /* Now parse data that is completely in this buffer */ | 386 | /* Now parse data that is completely in this buffer */ |
@@ -388,21 +390,22 @@ static inline int cx231xx_isoc_copy(struct cx231xx *dev, struct urb *urb) | |||
388 | u32 bytes_used = 0; | 390 | u32 bytes_used = 0; |
389 | 391 | ||
390 | sav_eav = cx231xx_find_next_SAV_EAV(p_buffer + bytes_parsed, /* p_buffer */ | 392 | sav_eav = cx231xx_find_next_SAV_EAV(p_buffer + bytes_parsed, /* p_buffer */ |
391 | buffer_size - bytes_parsed, /* buffer size */ | 393 | buffer_size - bytes_parsed, /* buffer size */ |
392 | &bytes_used); /* Receives bytes used to get SAV/EAV */ | 394 | &bytes_used); /* Receives bytes used to get SAV/EAV */ |
393 | 395 | ||
394 | bytes_parsed += bytes_used; | 396 | bytes_parsed += bytes_used; |
395 | 397 | ||
396 | sav_eav &= 0xF0; | 398 | sav_eav &= 0xF0; |
397 | if (sav_eav && (bytes_parsed < buffer_size)) { | 399 | if (sav_eav && (bytes_parsed < buffer_size)) { |
398 | bytes_parsed += cx231xx_get_video_line(dev, dma_q, sav_eav, /* SAV/EAV */ | 400 | bytes_parsed += cx231xx_get_video_line(dev, |
399 | p_buffer + bytes_parsed, /* p_buffer */ | 401 | dma_q, sav_eav, /* SAV/EAV */ |
400 | buffer_size - bytes_parsed); /* buffer size */ | 402 | p_buffer + bytes_parsed, /* p_buffer */ |
403 | buffer_size - bytes_parsed); /* buffer size */ | ||
401 | } | 404 | } |
402 | } | 405 | } |
403 | 406 | ||
404 | /* Save the last four bytes of the buffer so we can check the buffer boundary | 407 | /* Save the last four bytes of the buffer so we can check the |
405 | condition next time */ | 408 | buffer boundary condition next time */ |
406 | memcpy(dma_q->partial_buf, p_buffer + buffer_size - 4, 4); | 409 | memcpy(dma_q->partial_buf, p_buffer + buffer_size - 4, 4); |
407 | bytes_parsed = 0; | 410 | bytes_parsed = 0; |
408 | 411 | ||
@@ -410,8 +413,8 @@ static inline int cx231xx_isoc_copy(struct cx231xx *dev, struct urb *urb) | |||
410 | return rc; | 413 | return rc; |
411 | } | 414 | } |
412 | 415 | ||
413 | u8 cx231xx_find_boundary_SAV_EAV(u8 * p_buffer, u8 * partial_buf, | 416 | u8 cx231xx_find_boundary_SAV_EAV(u8 *p_buffer, u8 *partial_buf, |
414 | u32 * p_bytes_used) | 417 | u32 *p_bytes_used) |
415 | { | 418 | { |
416 | u32 bytes_used; | 419 | u32 bytes_used; |
417 | u8 boundary_bytes[8]; | 420 | u8 boundary_bytes[8]; |
@@ -426,8 +429,8 @@ u8 cx231xx_find_boundary_SAV_EAV(u8 * p_buffer, u8 * partial_buf, | |||
426 | memcpy(boundary_bytes + 4, p_buffer, 4); | 429 | memcpy(boundary_bytes + 4, p_buffer, 4); |
427 | 430 | ||
428 | /* Check for the SAV/EAV in the boundary buffer */ | 431 | /* Check for the SAV/EAV in the boundary buffer */ |
429 | sav_eav = | 432 | sav_eav = cx231xx_find_next_SAV_EAV((u8 *)&boundary_bytes, 8, |
430 | cx231xx_find_next_SAV_EAV((u8 *) & boundary_bytes, 8, &bytes_used); | 433 | &bytes_used); |
431 | 434 | ||
432 | if (sav_eav) { | 435 | if (sav_eav) { |
433 | /* found a boundary SAV/EAV. Updates the bytes used to reflect | 436 | /* found a boundary SAV/EAV. Updates the bytes used to reflect |
@@ -438,13 +441,16 @@ u8 cx231xx_find_boundary_SAV_EAV(u8 * p_buffer, u8 * partial_buf, | |||
438 | return sav_eav; | 441 | return sav_eav; |
439 | } | 442 | } |
440 | 443 | ||
441 | u8 cx231xx_find_next_SAV_EAV(u8 * p_buffer, u32 buffer_size, u32 * p_bytes_used) | 444 | u8 cx231xx_find_next_SAV_EAV(u8 *p_buffer, u32 buffer_size, u32 *p_bytes_used) |
442 | { | 445 | { |
443 | u32 i; | 446 | u32 i; |
444 | u8 sav_eav = 0; | 447 | u8 sav_eav = 0; |
445 | 448 | ||
446 | /* Don't search if the buffer size is less than 4. It causes a page fault since | 449 | /* |
447 | buffer_size - 4 evaluates to a large number in that case. */ | 450 | * Don't search if the buffer size is less than 4. It causes a page |
451 | * fault since buffer_size - 4 evaluates to a large number in that | ||
452 | * case. | ||
453 | */ | ||
448 | if (buffer_size < 4) { | 454 | if (buffer_size < 4) { |
449 | *p_bytes_used = buffer_size; | 455 | *p_bytes_used = buffer_size; |
450 | return 0; | 456 | return 0; |
@@ -465,69 +471,61 @@ u8 cx231xx_find_next_SAV_EAV(u8 * p_buffer, u32 buffer_size, u32 * p_bytes_used) | |||
465 | return 0; | 471 | return 0; |
466 | } | 472 | } |
467 | 473 | ||
468 | u32 cx231xx_get_video_line(struct cx231xx * dev, | 474 | u32 cx231xx_get_video_line(struct cx231xx *dev, |
469 | struct cx231xx_dmaqueue * dma_q, u8 sav_eav, | 475 | struct cx231xx_dmaqueue *dma_q, u8 sav_eav, |
470 | u8 * p_buffer, u32 buffer_size) | 476 | u8 *p_buffer, u32 buffer_size) |
471 | { | 477 | { |
472 | u32 bytes_copied = 0; | 478 | u32 bytes_copied = 0; |
473 | int current_field = -1; | 479 | int current_field = -1; |
474 | 480 | ||
475 | switch (sav_eav) { | 481 | switch (sav_eav) { |
476 | case SAV_ACTIVE_VIDEO_FIELD1: | 482 | case SAV_ACTIVE_VIDEO_FIELD1: |
477 | /* looking for skipped line which occurred in PAL 720x480 mode. In this case, | 483 | /* looking for skipped line which occurred in PAL 720x480 mode. |
478 | there will be no active data contained between the SAV and EAV */ | 484 | In this case, there will be no active data contained |
479 | if ((buffer_size > 3) && | 485 | between the SAV and EAV */ |
480 | (p_buffer[0] == 0xFF) && (p_buffer[1] == 0x00) | 486 | if ((buffer_size > 3) && (p_buffer[0] == 0xFF) && |
481 | && (p_buffer[2] == 0x00) | 487 | (p_buffer[1] == 0x00) && (p_buffer[2] == 0x00) && |
482 | && ((p_buffer[3] == EAV_ACTIVE_VIDEO_FIELD1) | 488 | ((p_buffer[3] == EAV_ACTIVE_VIDEO_FIELD1) || |
483 | || (p_buffer[3] == EAV_ACTIVE_VIDEO_FIELD2) | 489 | (p_buffer[3] == EAV_ACTIVE_VIDEO_FIELD2) || |
484 | || (p_buffer[3] == EAV_VBLANK_FIELD1) | 490 | (p_buffer[3] == EAV_VBLANK_FIELD1) || |
485 | || (p_buffer[3] == EAV_VBLANK_FIELD2) | 491 | (p_buffer[3] == EAV_VBLANK_FIELD2))) |
486 | ) | ||
487 | ) { | ||
488 | return bytes_copied; | 492 | return bytes_copied; |
489 | } | ||
490 | current_field = 1; | 493 | current_field = 1; |
491 | break; | 494 | break; |
492 | 495 | ||
493 | case SAV_ACTIVE_VIDEO_FIELD2: | 496 | case SAV_ACTIVE_VIDEO_FIELD2: |
494 | /* looking for skipped line which occurred in PAL 720x480 mode. In this case, | 497 | /* looking for skipped line which occurred in PAL 720x480 mode. |
495 | there will be no active data contained between the SAV and EAV */ | 498 | In this case, there will be no active data contained between |
496 | if ((buffer_size > 3) && | 499 | the SAV and EAV */ |
497 | (p_buffer[0] == 0xFF) && (p_buffer[1] == 0x00) | 500 | if ((buffer_size > 3) && (p_buffer[0] == 0xFF) && |
498 | && (p_buffer[2] == 0x00) | 501 | (p_buffer[1] == 0x00) && (p_buffer[2] == 0x00) && |
499 | && ((p_buffer[3] == EAV_ACTIVE_VIDEO_FIELD1) | 502 | ((p_buffer[3] == EAV_ACTIVE_VIDEO_FIELD1) || |
500 | || (p_buffer[3] == EAV_ACTIVE_VIDEO_FIELD2) | 503 | (p_buffer[3] == EAV_ACTIVE_VIDEO_FIELD2) || |
501 | || (p_buffer[3] == EAV_VBLANK_FIELD1) | 504 | (p_buffer[3] == EAV_VBLANK_FIELD1) || |
502 | || (p_buffer[3] == EAV_VBLANK_FIELD2) | 505 | (p_buffer[3] == EAV_VBLANK_FIELD2))) |
503 | ) | ||
504 | ) { | ||
505 | return bytes_copied; | 506 | return bytes_copied; |
506 | } | ||
507 | current_field = 2; | 507 | current_field = 2; |
508 | break; | 508 | break; |
509 | } | 509 | } |
510 | 510 | ||
511 | dma_q->last_sav = sav_eav; | 511 | dma_q->last_sav = sav_eav; |
512 | 512 | ||
513 | bytes_copied = | 513 | bytes_copied = cx231xx_copy_video_line(dev, dma_q, p_buffer, |
514 | cx231xx_copy_video_line(dev, dma_q, p_buffer, buffer_size, | 514 | buffer_size, current_field); |
515 | current_field); | ||
516 | 515 | ||
517 | return bytes_copied; | 516 | return bytes_copied; |
518 | } | 517 | } |
519 | 518 | ||
520 | u32 cx231xx_copy_video_line(struct cx231xx * dev, | 519 | u32 cx231xx_copy_video_line(struct cx231xx *dev, |
521 | struct cx231xx_dmaqueue * dma_q, u8 * p_line, | 520 | struct cx231xx_dmaqueue *dma_q, u8 *p_line, |
522 | u32 length, int field_number) | 521 | u32 length, int field_number) |
523 | { | 522 | { |
524 | u32 bytes_to_copy; | 523 | u32 bytes_to_copy; |
525 | struct cx231xx_buffer *buf; | 524 | struct cx231xx_buffer *buf; |
526 | u32 _line_size = dev->width * 2; | 525 | u32 _line_size = dev->width * 2; |
527 | 526 | ||
528 | if (dma_q->current_field != field_number) { | 527 | if (dma_q->current_field != field_number) |
529 | cx231xx_reset_video_buffer(dev, dma_q); | 528 | cx231xx_reset_video_buffer(dev, dma_q); |
530 | } | ||
531 | 529 | ||
532 | /* get the buffer pointer */ | 530 | /* get the buffer pointer */ |
533 | buf = dev->video_mode.isoc_ctl.buf; | 531 | buf = dev->video_mode.isoc_ctl.buf; |
@@ -541,8 +539,8 @@ u32 cx231xx_copy_video_line(struct cx231xx * dev, | |||
541 | 539 | ||
542 | if (dma_q->lines_completed >= dma_q->lines_per_field) { | 540 | if (dma_q->lines_completed >= dma_q->lines_per_field) { |
543 | dma_q->bytes_left_in_line -= bytes_to_copy; | 541 | dma_q->bytes_left_in_line -= bytes_to_copy; |
544 | dma_q->is_partial_line = | 542 | dma_q->is_partial_line = (dma_q->bytes_left_in_line == 0) ? |
545 | (dma_q->bytes_left_in_line == 0) ? 0 : 1; | 543 | 0 : 1; |
546 | return 0; | 544 | return 0; |
547 | } | 545 | } |
548 | 546 | ||
@@ -552,8 +550,8 @@ u32 cx231xx_copy_video_line(struct cx231xx * dev, | |||
552 | have copied if we had a buffer. */ | 550 | have copied if we had a buffer. */ |
553 | if (!buf) { | 551 | if (!buf) { |
554 | dma_q->bytes_left_in_line -= bytes_to_copy; | 552 | dma_q->bytes_left_in_line -= bytes_to_copy; |
555 | dma_q->is_partial_line = | 553 | dma_q->is_partial_line = (dma_q->bytes_left_in_line == 0) |
556 | (dma_q->bytes_left_in_line == 0) ? 0 : 1; | 554 | ? 0 : 1; |
557 | return bytes_to_copy; | 555 | return bytes_to_copy; |
558 | } | 556 | } |
559 | 557 | ||
@@ -564,13 +562,11 @@ u32 cx231xx_copy_video_line(struct cx231xx * dev, | |||
564 | dma_q->bytes_left_in_line -= bytes_to_copy; | 562 | dma_q->bytes_left_in_line -= bytes_to_copy; |
565 | 563 | ||
566 | if (dma_q->bytes_left_in_line == 0) { | 564 | if (dma_q->bytes_left_in_line == 0) { |
567 | |||
568 | dma_q->bytes_left_in_line = _line_size; | 565 | dma_q->bytes_left_in_line = _line_size; |
569 | dma_q->lines_completed++; | 566 | dma_q->lines_completed++; |
570 | dma_q->is_partial_line = 0; | 567 | dma_q->is_partial_line = 0; |
571 | 568 | ||
572 | if (cx231xx_is_buffer_done(dev, dma_q) && buf) { | 569 | if (cx231xx_is_buffer_done(dev, dma_q) && buf) { |
573 | |||
574 | buffer_filled(dev, dma_q, buf); | 570 | buffer_filled(dev, dma_q, buf); |
575 | 571 | ||
576 | dma_q->pos = 0; | 572 | dma_q->pos = 0; |
@@ -589,11 +585,10 @@ void cx231xx_reset_video_buffer(struct cx231xx *dev, | |||
589 | 585 | ||
590 | /* handle the switch from field 1 to field 2 */ | 586 | /* handle the switch from field 1 to field 2 */ |
591 | if (dma_q->current_field == 1) { | 587 | if (dma_q->current_field == 1) { |
592 | if (dma_q->lines_completed >= dma_q->lines_per_field) { | 588 | if (dma_q->lines_completed >= dma_q->lines_per_field) |
593 | dma_q->field1_done = 1; | 589 | dma_q->field1_done = 1; |
594 | } else { | 590 | else |
595 | dma_q->field1_done = 0; | 591 | dma_q->field1_done = 0; |
596 | } | ||
597 | } | 592 | } |
598 | 593 | ||
599 | buf = dev->video_mode.isoc_ctl.buf; | 594 | buf = dev->video_mode.isoc_ctl.buf; |
@@ -617,7 +612,7 @@ void cx231xx_reset_video_buffer(struct cx231xx *dev, | |||
617 | } | 612 | } |
618 | 613 | ||
619 | int cx231xx_do_copy(struct cx231xx *dev, struct cx231xx_dmaqueue *dma_q, | 614 | int cx231xx_do_copy(struct cx231xx *dev, struct cx231xx_dmaqueue *dma_q, |
620 | u8 * p_buffer, u32 bytes_to_copy) | 615 | u8 *p_buffer, u32 bytes_to_copy) |
621 | { | 616 | { |
622 | u8 *p_out_buffer = NULL; | 617 | u8 *p_out_buffer = NULL; |
623 | u32 current_line_bytes_copied = 0; | 618 | u32 current_line_bytes_copied = 0; |
@@ -647,14 +642,11 @@ int cx231xx_do_copy(struct cx231xx *dev, struct cx231xx_dmaqueue *dma_q, | |||
647 | /* bytes already completed in the current line */ | 642 | /* bytes already completed in the current line */ |
648 | startwrite += current_line_bytes_copied; | 643 | startwrite += current_line_bytes_copied; |
649 | 644 | ||
650 | lencopy = | 645 | lencopy = dma_q->bytes_left_in_line > bytes_to_copy ? |
651 | dma_q->bytes_left_in_line > | 646 | bytes_to_copy : dma_q->bytes_left_in_line; |
652 | bytes_to_copy ? bytes_to_copy : dma_q->bytes_left_in_line; | ||
653 | 647 | ||
654 | if ((u8 *) (startwrite + lencopy) > | 648 | if ((u8 *)(startwrite + lencopy) > (u8 *)(p_out_buffer + buf->vb.size)) |
655 | (u8 *) (p_out_buffer + buf->vb.size)) { | ||
656 | return 0; | 649 | return 0; |
657 | } | ||
658 | 650 | ||
659 | /* The below copies the UYVY data straight into video buffer */ | 651 | /* The below copies the UYVY data straight into video buffer */ |
660 | cx231xx_swab((u16 *) p_buffer, (u16 *) startwrite, (u16) lencopy); | 652 | cx231xx_swab((u16 *) p_buffer, (u16 *) startwrite, (u16) lencopy); |
@@ -662,16 +654,15 @@ int cx231xx_do_copy(struct cx231xx *dev, struct cx231xx_dmaqueue *dma_q, | |||
662 | return 0; | 654 | return 0; |
663 | } | 655 | } |
664 | 656 | ||
665 | void cx231xx_swab(u16 * from, u16 * to, u16 len) | 657 | void cx231xx_swab(u16 *from, u16 *to, u16 len) |
666 | { | 658 | { |
667 | u16 i; | 659 | u16 i; |
668 | 660 | ||
669 | if (len <= 0) | 661 | if (len <= 0) |
670 | return; | 662 | return; |
671 | 663 | ||
672 | for (i = 0; i < len / 2; i++) { | 664 | for (i = 0; i < len / 2; i++) |
673 | to[i] = (from[i] << 8) | (from[i] >> 8); | 665 | to[i] = (from[i] << 8) | (from[i] >> 8); |
674 | } | ||
675 | } | 666 | } |
676 | 667 | ||
677 | u8 cx231xx_is_buffer_done(struct cx231xx *dev, struct cx231xx_dmaqueue *dma_q) | 668 | u8 cx231xx_is_buffer_done(struct cx231xx *dev, struct cx231xx_dmaqueue *dma_q) |
@@ -679,10 +670,9 @@ u8 cx231xx_is_buffer_done(struct cx231xx *dev, struct cx231xx_dmaqueue *dma_q) | |||
679 | u8 buffer_complete = 0; | 670 | u8 buffer_complete = 0; |
680 | 671 | ||
681 | /* Dual field stream */ | 672 | /* Dual field stream */ |
682 | buffer_complete = | 673 | buffer_complete = ((dma_q->current_field == 2) && |
683 | ((dma_q->current_field == 2) && | 674 | (dma_q->lines_completed >= dma_q->lines_per_field) && |
684 | (dma_q->lines_completed >= dma_q->lines_per_field) && | 675 | dma_q->field1_done); |
685 | dma_q->field1_done); | ||
686 | 676 | ||
687 | return buffer_complete; | 677 | return buffer_complete; |
688 | } | 678 | } |
@@ -698,8 +688,7 @@ buffer_setup(struct videobuf_queue *vq, unsigned int *count, unsigned int *size) | |||
698 | struct cx231xx *dev = fh->dev; | 688 | struct cx231xx *dev = fh->dev; |
699 | struct v4l2_frequency f; | 689 | struct v4l2_frequency f; |
700 | 690 | ||
701 | *size = | 691 | *size = (fh->dev->width * fh->dev->height * dev->format->depth + 7)>>3; |
702 | (fh->dev->width * fh->dev->height * dev->format->depth + 7) >> 3; | ||
703 | if (0 == *count) | 692 | if (0 == *count) |
704 | *count = CX231XX_DEF_BUF; | 693 | *count = CX231XX_DEF_BUF; |
705 | 694 | ||
@@ -722,6 +711,7 @@ static void free_buffer(struct videobuf_queue *vq, struct cx231xx_buffer *buf) | |||
722 | struct cx231xx_fh *fh = vq->priv_data; | 711 | struct cx231xx_fh *fh = vq->priv_data; |
723 | struct cx231xx *dev = fh->dev; | 712 | struct cx231xx *dev = fh->dev; |
724 | unsigned long flags = 0; | 713 | unsigned long flags = 0; |
714 | |||
725 | if (in_interrupt()) | 715 | if (in_interrupt()) |
726 | BUG(); | 716 | BUG(); |
727 | 717 | ||
@@ -754,9 +744,8 @@ buffer_prepare(struct videobuf_queue *vq, struct videobuf_buffer *vb, | |||
754 | int rc = 0, urb_init = 0; | 744 | int rc = 0, urb_init = 0; |
755 | 745 | ||
756 | /* The only currently supported format is 16 bits/pixel */ | 746 | /* The only currently supported format is 16 bits/pixel */ |
757 | buf->vb.size = | 747 | buf->vb.size = (fh->dev->width * fh->dev->height * dev->format->depth |
758 | (fh->dev->width * fh->dev->height * dev->format->depth + 7) >> 3; | 748 | + 7) >> 3; |
759 | |||
760 | if (0 != buf->vb.baddr && buf->vb.bsize < buf->vb.size) | 749 | if (0 != buf->vb.baddr && buf->vb.bsize < buf->vb.size) |
761 | return -EINVAL; | 750 | return -EINVAL; |
762 | 751 | ||
@@ -785,7 +774,7 @@ buffer_prepare(struct videobuf_queue *vq, struct videobuf_buffer *vb, | |||
785 | buf->vb.state = VIDEOBUF_PREPARED; | 774 | buf->vb.state = VIDEOBUF_PREPARED; |
786 | return 0; | 775 | return 0; |
787 | 776 | ||
788 | fail: | 777 | fail: |
789 | free_buffer(vq, buf); | 778 | free_buffer(vq, buf); |
790 | return rc; | 779 | return rc; |
791 | } | 780 | } |
@@ -876,7 +865,7 @@ static int res_get(struct cx231xx_fh *fh) | |||
876 | 865 | ||
877 | static int res_check(struct cx231xx_fh *fh) | 866 | static int res_check(struct cx231xx_fh *fh) |
878 | { | 867 | { |
879 | return (fh->stream_on); | 868 | return fh->stream_on; |
880 | } | 869 | } |
881 | 870 | ||
882 | static void res_free(struct cx231xx_fh *fh) | 871 | static void res_free(struct cx231xx_fh *fh) |
@@ -948,6 +937,7 @@ static int vidioc_g_fmt_vid_cap(struct file *file, void *priv, | |||
948 | f->fmt.pix.field = V4L2_FIELD_INTERLACED; | 937 | f->fmt.pix.field = V4L2_FIELD_INTERLACED; |
949 | 938 | ||
950 | mutex_unlock(&dev->lock); | 939 | mutex_unlock(&dev->lock); |
940 | |||
951 | return 0; | 941 | return 0; |
952 | } | 942 | } |
953 | 943 | ||
@@ -1056,7 +1046,7 @@ static int vidioc_s_fmt_vid_cap(struct file *file, void *priv, | |||
1056 | /* Set the correct alternate setting for this resolution */ | 1046 | /* Set the correct alternate setting for this resolution */ |
1057 | cx231xx_resolution_set(dev); | 1047 | cx231xx_resolution_set(dev); |
1058 | 1048 | ||
1059 | out: | 1049 | out: |
1060 | mutex_unlock(&dev->lock); | 1050 | mutex_unlock(&dev->lock); |
1061 | return rc; | 1051 | return rc; |
1062 | } | 1052 | } |
@@ -1110,11 +1100,11 @@ static int vidioc_s_std(struct file *file, void *priv, v4l2_std_id * norm) | |||
1110 | 1100 | ||
1111 | static const char *iname[] = { | 1101 | static const char *iname[] = { |
1112 | [CX231XX_VMUX_COMPOSITE1] = "Composite1", | 1102 | [CX231XX_VMUX_COMPOSITE1] = "Composite1", |
1113 | [CX231XX_VMUX_SVIDEO] = "S-Video", | 1103 | [CX231XX_VMUX_SVIDEO] = "S-Video", |
1114 | [CX231XX_VMUX_TELEVISION] = "Television", | 1104 | [CX231XX_VMUX_TELEVISION] = "Television", |
1115 | [CX231XX_VMUX_CABLE] = "Cable TV", | 1105 | [CX231XX_VMUX_CABLE] = "Cable TV", |
1116 | [CX231XX_VMUX_DVB] = "DVB", | 1106 | [CX231XX_VMUX_DVB] = "DVB", |
1117 | [CX231XX_VMUX_DEBUG] = "for debug only", | 1107 | [CX231XX_VMUX_DEBUG] = "for debug only", |
1118 | }; | 1108 | }; |
1119 | 1109 | ||
1120 | static int vidioc_enum_input(struct file *file, void *priv, | 1110 | static int vidioc_enum_input(struct file *file, void *priv, |
@@ -1386,12 +1376,11 @@ static int vidioc_s_frequency(struct file *file, void *priv, | |||
1386 | dev->ctl_freq = f->frequency; | 1376 | dev->ctl_freq = f->frequency; |
1387 | 1377 | ||
1388 | if (dev->tuner_type == TUNER_XC5000) { | 1378 | if (dev->tuner_type == TUNER_XC5000) { |
1389 | if (dev->cx231xx_set_analog_freq != NULL) { | 1379 | if (dev->cx231xx_set_analog_freq != NULL) |
1390 | dev->cx231xx_set_analog_freq(dev, f->frequency); | 1380 | dev->cx231xx_set_analog_freq(dev, f->frequency); |
1391 | } | ||
1392 | } else { | 1381 | } else { |
1393 | cx231xx_i2c_call_clients(&dev->i2c_bus[1], VIDIOC_S_FREQUENCY, | 1382 | cx231xx_i2c_call_clients(&dev->i2c_bus[1], |
1394 | f); | 1383 | VIDIOC_S_FREQUENCY, f); |
1395 | } | 1384 | } |
1396 | 1385 | ||
1397 | mutex_unlock(&dev->lock); | 1386 | mutex_unlock(&dev->lock); |
@@ -1430,47 +1419,42 @@ static int vidioc_g_register(struct file *file, void *priv, | |||
1430 | case V4L2_CHIP_MATCH_HOST: | 1419 | case V4L2_CHIP_MATCH_HOST: |
1431 | switch (reg->match.addr) { | 1420 | switch (reg->match.addr) { |
1432 | case 0: /* Cx231xx - internal registers */ | 1421 | case 0: /* Cx231xx - internal registers */ |
1433 | ret = | 1422 | ret = cx231xx_read_ctrl_reg(dev, VRT_GET_REGISTER, |
1434 | cx231xx_read_ctrl_reg(dev, VRT_GET_REGISTER, | 1423 | (u16)reg->reg, value, 4); |
1435 | (u16) reg->reg, value, 4); | 1424 | reg->val = value[0] | value[1] << 8 | |
1436 | reg->val = | 1425 | value[2] << 16 | value[3] << 24; |
1437 | value[0] | value[1] << 8 | value[2] << 16 | value[3] | ||
1438 | << 24; | ||
1439 | break; | 1426 | break; |
1440 | case 1: /* Colibri - read byte */ | 1427 | case 1: /* Colibri - read byte */ |
1441 | ret = | 1428 | ret = cx231xx_read_i2c_data(dev, Colibri_DEVICE_ADDRESS, |
1442 | cx231xx_read_i2c_data(dev, Colibri_DEVICE_ADDRESS, | 1429 | (u16)reg->reg, 2, &data, 1); |
1443 | (u16) reg->reg, 2, &data, 1); | ||
1444 | reg->val = le32_to_cpu(data & 0xff); | 1430 | reg->val = le32_to_cpu(data & 0xff); |
1445 | break; | 1431 | break; |
1446 | case 14: /* Colibri - read dword */ | 1432 | case 14: /* Colibri - read dword */ |
1447 | ret = | 1433 | ret = cx231xx_read_i2c_data(dev, Colibri_DEVICE_ADDRESS, |
1448 | cx231xx_read_i2c_data(dev, Colibri_DEVICE_ADDRESS, | 1434 | (u16)reg->reg, 2, &data, 4); |
1449 | (u16) reg->reg, 2, &data, 4); | ||
1450 | reg->val = le32_to_cpu(data); | 1435 | reg->val = le32_to_cpu(data); |
1451 | break; | 1436 | break; |
1452 | case 2: /* Hammerhead - read byte */ | 1437 | case 2: /* Hammerhead - read byte */ |
1453 | ret = | 1438 | ret = cx231xx_read_i2c_data(dev, HAMMERHEAD_I2C_ADDRESS, |
1454 | cx231xx_read_i2c_data(dev, HAMMERHEAD_I2C_ADDRESS, | 1439 | (u16)reg->reg, 2, &data, 1); |
1455 | (u16) reg->reg, 2, &data, 1); | ||
1456 | reg->val = le32_to_cpu(data & 0xff); | 1440 | reg->val = le32_to_cpu(data & 0xff); |
1457 | break; | 1441 | break; |
1458 | case 24: /* Hammerhead - read dword */ | 1442 | case 24: /* Hammerhead - read dword */ |
1459 | ret = | 1443 | ret = cx231xx_read_i2c_data(dev, HAMMERHEAD_I2C_ADDRESS, |
1460 | cx231xx_read_i2c_data(dev, HAMMERHEAD_I2C_ADDRESS, | 1444 | (u16)reg->reg, 2, &data, 4); |
1461 | (u16) reg->reg, 2, &data, 4); | ||
1462 | reg->val = le32_to_cpu(data); | 1445 | reg->val = le32_to_cpu(data); |
1463 | break; | 1446 | break; |
1464 | case 3: /* flatiron - read byte */ | 1447 | case 3: /* flatiron - read byte */ |
1465 | ret = | 1448 | ret = cx231xx_read_i2c_data(dev, |
1466 | cx231xx_read_i2c_data(dev, Flatrion_DEVICE_ADDRESS, | 1449 | Flatrion_DEVICE_ADDRESS, |
1467 | (u16) reg->reg, 1, &data, 1); | 1450 | (u16)reg->reg, 1, |
1451 | &data, 1); | ||
1468 | reg->val = le32_to_cpu(data & 0xff); | 1452 | reg->val = le32_to_cpu(data & 0xff); |
1469 | break; | 1453 | break; |
1470 | case 34: /* flatiron - read dword */ | 1454 | case 34: /* flatiron - read dword */ |
1471 | ret = | 1455 | ret = |
1472 | cx231xx_read_i2c_data(dev, Flatrion_DEVICE_ADDRESS, | 1456 | cx231xx_read_i2c_data(dev, Flatrion_DEVICE_ADDRESS, |
1473 | (u16) reg->reg, 1, &data, 4); | 1457 | (u16)reg->reg, 1, &data, 4); |
1474 | reg->val = le32_to_cpu(data); | 1458 | reg->val = le32_to_cpu(data); |
1475 | break; | 1459 | break; |
1476 | } | 1460 | } |
@@ -1489,9 +1473,7 @@ static int vidioc_g_register(struct file *file, void *priv, | |||
1489 | } | 1473 | } |
1490 | 1474 | ||
1491 | mutex_lock(&dev->lock); | 1475 | mutex_lock(&dev->lock); |
1492 | |||
1493 | cx231xx_i2c_call_clients(&dev->i2c_bus[0], VIDIOC_DBG_G_REGISTER, reg); | 1476 | cx231xx_i2c_call_clients(&dev->i2c_bus[0], VIDIOC_DBG_G_REGISTER, reg); |
1494 | |||
1495 | mutex_unlock(&dev->lock); | 1477 | mutex_unlock(&dev->lock); |
1496 | 1478 | ||
1497 | return ret; | 1479 | return ret; |
@@ -1520,53 +1502,50 @@ static int vidioc_s_register(struct file *file, void *priv, | |||
1520 | data[1] = (u8) (value >> 8); | 1502 | data[1] = (u8) (value >> 8); |
1521 | data[2] = (u8) (value >> 16); | 1503 | data[2] = (u8) (value >> 16); |
1522 | data[3] = (u8) (value >> 24); | 1504 | data[3] = (u8) (value >> 24); |
1523 | ret = | 1505 | ret = cx231xx_write_ctrl_reg(dev, |
1524 | cx231xx_write_ctrl_reg(dev, | ||
1525 | VRT_SET_REGISTER, | 1506 | VRT_SET_REGISTER, |
1526 | (u16) reg->reg, data, | 1507 | (u16)reg->reg, data, |
1527 | 4); | 1508 | 4); |
1528 | break; | 1509 | break; |
1529 | case 1: /* Colibri - read byte */ | 1510 | case 1: /* Colibri - read byte */ |
1530 | ret = | 1511 | ret = cx231xx_write_i2c_data(dev, |
1531 | cx231xx_write_i2c_data(dev, | 1512 | Colibri_DEVICE_ADDRESS, |
1532 | Colibri_DEVICE_ADDRESS, | 1513 | (u16)reg->reg, 2, |
1533 | (u16) reg->reg, 2, | 1514 | value, 1); |
1534 | value, 1); | ||
1535 | break; | 1515 | break; |
1536 | case 14: /* Colibri - read dword */ | 1516 | case 14: /* Colibri - read dword */ |
1537 | ret = | 1517 | ret = cx231xx_write_i2c_data(dev, |
1538 | cx231xx_write_i2c_data(dev, | 1518 | Colibri_DEVICE_ADDRESS, |
1539 | Colibri_DEVICE_ADDRESS, | 1519 | (u16)reg->reg, 2, |
1540 | (u16) reg->reg, 2, | 1520 | value, 4); |
1541 | value, 4); | ||
1542 | break; | 1521 | break; |
1543 | case 2: /* Hammerhead - read byte */ | 1522 | case 2: /* Hammerhead - read byte */ |
1544 | ret = | 1523 | ret = |
1545 | cx231xx_write_i2c_data(dev, | 1524 | cx231xx_write_i2c_data(dev, |
1546 | HAMMERHEAD_I2C_ADDRESS, | 1525 | HAMMERHEAD_I2C_ADDRESS, |
1547 | (u16) reg->reg, 2, | 1526 | (u16)reg->reg, 2, |
1548 | value, 1); | 1527 | value, 1); |
1549 | break; | 1528 | break; |
1550 | case 24: /* Hammerhead - read dword */ | 1529 | case 24: /* Hammerhead - read dword */ |
1551 | ret = | 1530 | ret = |
1552 | cx231xx_write_i2c_data(dev, | 1531 | cx231xx_write_i2c_data(dev, |
1553 | HAMMERHEAD_I2C_ADDRESS, | 1532 | HAMMERHEAD_I2C_ADDRESS, |
1554 | (u16) reg->reg, 2, | 1533 | (u16)reg->reg, 2, |
1555 | value, 4); | 1534 | value, 4); |
1556 | break; | 1535 | break; |
1557 | case 3: /* flatiron - read byte */ | 1536 | case 3: /* flatiron - read byte */ |
1558 | ret = | 1537 | ret = |
1559 | cx231xx_write_i2c_data(dev, | 1538 | cx231xx_write_i2c_data(dev, |
1560 | Flatrion_DEVICE_ADDRESS, | 1539 | Flatrion_DEVICE_ADDRESS, |
1561 | (u16) reg->reg, 1, | 1540 | (u16)reg->reg, 1, |
1562 | value, 1); | 1541 | value, 1); |
1563 | break; | 1542 | break; |
1564 | case 34: /* flatiron - read dword */ | 1543 | case 34: /* flatiron - read dword */ |
1565 | ret = | 1544 | ret = |
1566 | cx231xx_write_i2c_data(dev, | 1545 | cx231xx_write_i2c_data(dev, |
1567 | Flatrion_DEVICE_ADDRESS, | 1546 | Flatrion_DEVICE_ADDRESS, |
1568 | (u16) reg->reg, 1, | 1547 | (u16)reg->reg, 1, |
1569 | value, 4); | 1548 | value, 4); |
1570 | break; | 1549 | break; |
1571 | } | 1550 | } |
1572 | } | 1551 | } |
@@ -1805,7 +1784,7 @@ static int vidioc_reqbufs(struct file *file, void *priv, | |||
1805 | if (rc < 0) | 1784 | if (rc < 0) |
1806 | return rc; | 1785 | return rc; |
1807 | 1786 | ||
1808 | return (videobuf_reqbufs(&fh->vb_vidq, rb)); | 1787 | return videobuf_reqbufs(&fh->vb_vidq, rb); |
1809 | } | 1788 | } |
1810 | 1789 | ||
1811 | static int vidioc_querybuf(struct file *file, void *priv, struct v4l2_buffer *b) | 1790 | static int vidioc_querybuf(struct file *file, void *priv, struct v4l2_buffer *b) |
@@ -1818,7 +1797,7 @@ static int vidioc_querybuf(struct file *file, void *priv, struct v4l2_buffer *b) | |||
1818 | if (rc < 0) | 1797 | if (rc < 0) |
1819 | return rc; | 1798 | return rc; |
1820 | 1799 | ||
1821 | return (videobuf_querybuf(&fh->vb_vidq, b)); | 1800 | return videobuf_querybuf(&fh->vb_vidq, b); |
1822 | } | 1801 | } |
1823 | 1802 | ||
1824 | static int vidioc_qbuf(struct file *file, void *priv, struct v4l2_buffer *b) | 1803 | static int vidioc_qbuf(struct file *file, void *priv, struct v4l2_buffer *b) |
@@ -1831,7 +1810,7 @@ static int vidioc_qbuf(struct file *file, void *priv, struct v4l2_buffer *b) | |||
1831 | if (rc < 0) | 1810 | if (rc < 0) |
1832 | return rc; | 1811 | return rc; |
1833 | 1812 | ||
1834 | return (videobuf_qbuf(&fh->vb_vidq, b)); | 1813 | return videobuf_qbuf(&fh->vb_vidq, b); |
1835 | } | 1814 | } |
1836 | 1815 | ||
1837 | static int vidioc_dqbuf(struct file *file, void *priv, struct v4l2_buffer *b) | 1816 | static int vidioc_dqbuf(struct file *file, void *priv, struct v4l2_buffer *b) |
@@ -1844,7 +1823,7 @@ static int vidioc_dqbuf(struct file *file, void *priv, struct v4l2_buffer *b) | |||
1844 | if (rc < 0) | 1823 | if (rc < 0) |
1845 | return rc; | 1824 | return rc; |
1846 | 1825 | ||
1847 | return (videobuf_dqbuf(&fh->vb_vidq, b, file->f_flags & O_NONBLOCK)); | 1826 | return videobuf_dqbuf(&fh->vb_vidq, b, file->f_flags & O_NONBLOCK); |
1848 | } | 1827 | } |
1849 | 1828 | ||
1850 | #ifdef CONFIG_VIDEO_V4L1_COMPAT | 1829 | #ifdef CONFIG_VIDEO_V4L1_COMPAT |
@@ -2030,17 +2009,19 @@ static int cx231xx_v4l2_open(struct file *filp) | |||
2030 | 2009 | ||
2031 | dev->users++; | 2010 | dev->users++; |
2032 | 2011 | ||
2033 | if (fh->type == V4L2_BUF_TYPE_VIDEO_CAPTURE) { | 2012 | if (fh->type == V4L2_BUF_TYPE_VIDEO_CAPTURE) |
2034 | videobuf_queue_vmalloc_init(&fh->vb_vidq, &cx231xx_video_qops, NULL, &dev->video_mode.slock, fh->type, V4L2_FIELD_INTERLACED, /* V4L2_FIELD_SEQ_TB, */ | 2013 | videobuf_queue_vmalloc_init(&fh->vb_vidq, &cx231xx_video_qops, |
2014 | NULL, &dev->video_mode.slock, | ||
2015 | fh->type, V4L2_FIELD_INTERLACED, | ||
2035 | sizeof(struct cx231xx_buffer), fh); | 2016 | sizeof(struct cx231xx_buffer), fh); |
2036 | } | ||
2037 | |||
2038 | if (fh->type == V4L2_BUF_TYPE_VBI_CAPTURE) { | 2017 | if (fh->type == V4L2_BUF_TYPE_VBI_CAPTURE) { |
2039 | 2018 | /* Set the required alternate setting VBI interface works in | |
2040 | /* Set the required alternate setting VBI interface works in Bulk mode only */ | 2019 | Bulk mode only */ |
2041 | cx231xx_set_alt_setting(dev, INDEX_VANC, 0); | 2020 | cx231xx_set_alt_setting(dev, INDEX_VANC, 0); |
2042 | 2021 | ||
2043 | videobuf_queue_vmalloc_init(&fh->vb_vidq, &cx231xx_vbi_qops, NULL, &dev->vbi_mode.slock, fh->type, V4L2_FIELD_SEQ_TB, /* V4L2_FIELD_INTERLACED, */ | 2022 | videobuf_queue_vmalloc_init(&fh->vb_vidq, &cx231xx_vbi_qops, |
2023 | NULL, &dev->vbi_mode.slock, | ||
2024 | fh->type, V4L2_FIELD_SEQ_TB, | ||
2044 | sizeof(struct cx231xx_buffer), fh); | 2025 | sizeof(struct cx231xx_buffer), fh); |
2045 | } | 2026 | } |
2046 | 2027 | ||
@@ -2120,11 +2101,10 @@ static int cx231xx_v4l2_close(struct file *filp) | |||
2120 | cx231xx_uninit_vbi_isoc(dev); | 2101 | cx231xx_uninit_vbi_isoc(dev); |
2121 | 2102 | ||
2122 | /* set alternate 0 */ | 2103 | /* set alternate 0 */ |
2123 | if (!dev->vbi_or_sliced_cc_mode) { | 2104 | if (!dev->vbi_or_sliced_cc_mode) |
2124 | cx231xx_set_alt_setting(dev, INDEX_VANC, 0); | 2105 | cx231xx_set_alt_setting(dev, INDEX_VANC, 0); |
2125 | } else { | 2106 | else |
2126 | cx231xx_set_alt_setting(dev, INDEX_HANC, 0); | 2107 | cx231xx_set_alt_setting(dev, INDEX_HANC, 0); |
2127 | } | ||
2128 | 2108 | ||
2129 | kfree(fh); | 2109 | kfree(fh); |
2130 | dev->users--; | 2110 | dev->users--; |
@@ -2169,8 +2149,8 @@ static int cx231xx_v4l2_close(struct file *filp) | |||
2169 | * will allocate buffers when called for the first time | 2149 | * will allocate buffers when called for the first time |
2170 | */ | 2150 | */ |
2171 | static ssize_t | 2151 | static ssize_t |
2172 | cx231xx_v4l2_read(struct file *filp, char __user * buf, size_t count, | 2152 | cx231xx_v4l2_read(struct file *filp, char __user *buf, size_t count, |
2173 | loff_t * pos) | 2153 | loff_t *pos) |
2174 | { | 2154 | { |
2175 | struct cx231xx_fh *fh = filp->private_data; | 2155 | struct cx231xx_fh *fh = filp->private_data; |
2176 | struct cx231xx *dev = fh->dev; | 2156 | struct cx231xx *dev = fh->dev; |
@@ -2254,98 +2234,98 @@ static int cx231xx_v4l2_mmap(struct file *filp, struct vm_area_struct *vma) | |||
2254 | } | 2234 | } |
2255 | 2235 | ||
2256 | static const struct v4l2_file_operations cx231xx_v4l_fops = { | 2236 | static const struct v4l2_file_operations cx231xx_v4l_fops = { |
2257 | .owner = THIS_MODULE, | 2237 | .owner = THIS_MODULE, |
2258 | .open = cx231xx_v4l2_open, | 2238 | .open = cx231xx_v4l2_open, |
2259 | .release = cx231xx_v4l2_close, | 2239 | .release = cx231xx_v4l2_close, |
2260 | .read = cx231xx_v4l2_read, | 2240 | .read = cx231xx_v4l2_read, |
2261 | .poll = cx231xx_v4l2_poll, | 2241 | .poll = cx231xx_v4l2_poll, |
2262 | .mmap = cx231xx_v4l2_mmap, | 2242 | .mmap = cx231xx_v4l2_mmap, |
2263 | .ioctl = video_ioctl2, | 2243 | .ioctl = video_ioctl2, |
2264 | }; | 2244 | }; |
2265 | 2245 | ||
2266 | static const struct v4l2_ioctl_ops video_ioctl_ops = { | 2246 | static const struct v4l2_ioctl_ops video_ioctl_ops = { |
2267 | .vidioc_querycap = vidioc_querycap, | 2247 | .vidioc_querycap = vidioc_querycap, |
2268 | .vidioc_enum_fmt_vid_cap = vidioc_enum_fmt_vid_cap, | 2248 | .vidioc_enum_fmt_vid_cap = vidioc_enum_fmt_vid_cap, |
2269 | .vidioc_g_fmt_vid_cap = vidioc_g_fmt_vid_cap, | 2249 | .vidioc_g_fmt_vid_cap = vidioc_g_fmt_vid_cap, |
2270 | .vidioc_try_fmt_vid_cap = vidioc_try_fmt_vid_cap, | 2250 | .vidioc_try_fmt_vid_cap = vidioc_try_fmt_vid_cap, |
2271 | .vidioc_s_fmt_vid_cap = vidioc_s_fmt_vid_cap, | 2251 | .vidioc_s_fmt_vid_cap = vidioc_s_fmt_vid_cap, |
2272 | .vidioc_g_fmt_vbi_cap = vidioc_g_fmt_vbi_cap, | 2252 | .vidioc_g_fmt_vbi_cap = vidioc_g_fmt_vbi_cap, |
2273 | .vidioc_try_fmt_vbi_cap = vidioc_try_fmt_vbi_cap, | 2253 | .vidioc_try_fmt_vbi_cap = vidioc_try_fmt_vbi_cap, |
2274 | .vidioc_s_fmt_vbi_cap = vidioc_try_fmt_vbi_cap, | 2254 | .vidioc_s_fmt_vbi_cap = vidioc_try_fmt_vbi_cap, |
2275 | .vidioc_g_audio = vidioc_g_audio, | 2255 | .vidioc_g_audio = vidioc_g_audio, |
2276 | .vidioc_s_audio = vidioc_s_audio, | 2256 | .vidioc_s_audio = vidioc_s_audio, |
2277 | .vidioc_cropcap = vidioc_cropcap, | 2257 | .vidioc_cropcap = vidioc_cropcap, |
2278 | .vidioc_g_fmt_sliced_vbi_cap = vidioc_g_fmt_sliced_vbi_cap, | 2258 | .vidioc_g_fmt_sliced_vbi_cap = vidioc_g_fmt_sliced_vbi_cap, |
2279 | .vidioc_try_fmt_sliced_vbi_cap = vidioc_try_set_sliced_vbi_cap, | 2259 | .vidioc_try_fmt_sliced_vbi_cap = vidioc_try_set_sliced_vbi_cap, |
2280 | .vidioc_reqbufs = vidioc_reqbufs, | 2260 | .vidioc_reqbufs = vidioc_reqbufs, |
2281 | .vidioc_querybuf = vidioc_querybuf, | 2261 | .vidioc_querybuf = vidioc_querybuf, |
2282 | .vidioc_qbuf = vidioc_qbuf, | 2262 | .vidioc_qbuf = vidioc_qbuf, |
2283 | .vidioc_dqbuf = vidioc_dqbuf, | 2263 | .vidioc_dqbuf = vidioc_dqbuf, |
2284 | .vidioc_s_std = vidioc_s_std, | 2264 | .vidioc_s_std = vidioc_s_std, |
2285 | .vidioc_g_std = vidioc_g_std, | 2265 | .vidioc_g_std = vidioc_g_std, |
2286 | .vidioc_enum_input = vidioc_enum_input, | 2266 | .vidioc_enum_input = vidioc_enum_input, |
2287 | .vidioc_g_input = vidioc_g_input, | 2267 | .vidioc_g_input = vidioc_g_input, |
2288 | .vidioc_s_input = vidioc_s_input, | 2268 | .vidioc_s_input = vidioc_s_input, |
2289 | .vidioc_queryctrl = vidioc_queryctrl, | 2269 | .vidioc_queryctrl = vidioc_queryctrl, |
2290 | .vidioc_g_ctrl = vidioc_g_ctrl, | 2270 | .vidioc_g_ctrl = vidioc_g_ctrl, |
2291 | .vidioc_s_ctrl = vidioc_s_ctrl, | 2271 | .vidioc_s_ctrl = vidioc_s_ctrl, |
2292 | .vidioc_streamon = vidioc_streamon, | 2272 | .vidioc_streamon = vidioc_streamon, |
2293 | .vidioc_streamoff = vidioc_streamoff, | 2273 | .vidioc_streamoff = vidioc_streamoff, |
2294 | .vidioc_g_tuner = vidioc_g_tuner, | 2274 | .vidioc_g_tuner = vidioc_g_tuner, |
2295 | .vidioc_s_tuner = vidioc_s_tuner, | 2275 | .vidioc_s_tuner = vidioc_s_tuner, |
2296 | .vidioc_g_frequency = vidioc_g_frequency, | 2276 | .vidioc_g_frequency = vidioc_g_frequency, |
2297 | .vidioc_s_frequency = vidioc_s_frequency, | 2277 | .vidioc_s_frequency = vidioc_s_frequency, |
2298 | #ifdef CONFIG_VIDEO_ADV_DEBUG | 2278 | #ifdef CONFIG_VIDEO_ADV_DEBUG |
2299 | .vidioc_g_register = vidioc_g_register, | 2279 | .vidioc_g_register = vidioc_g_register, |
2300 | .vidioc_s_register = vidioc_s_register, | 2280 | .vidioc_s_register = vidioc_s_register, |
2301 | #endif | 2281 | #endif |
2302 | #ifdef CONFIG_VIDEO_V4L1_COMPAT | 2282 | #ifdef CONFIG_VIDEO_V4L1_COMPAT |
2303 | .vidiocgmbuf = vidiocgmbuf, | 2283 | .vidiocgmbuf = vidiocgmbuf, |
2304 | #endif | 2284 | #endif |
2305 | }; | 2285 | }; |
2306 | 2286 | ||
2307 | static struct video_device cx231xx_vbi_template; | 2287 | static struct video_device cx231xx_vbi_template; |
2308 | 2288 | ||
2309 | static const struct video_device cx231xx_video_template = { | 2289 | static const struct video_device cx231xx_video_template = { |
2310 | .fops = &cx231xx_v4l_fops, | 2290 | .fops = &cx231xx_v4l_fops, |
2311 | .release = video_device_release, | 2291 | .release = video_device_release, |
2312 | .ioctl_ops = &video_ioctl_ops, | 2292 | .ioctl_ops = &video_ioctl_ops, |
2313 | .minor = -1, | 2293 | .minor = -1, |
2314 | .tvnorms = V4L2_STD_ALL, | 2294 | .tvnorms = V4L2_STD_ALL, |
2315 | .current_norm = V4L2_STD_PAL, | 2295 | .current_norm = V4L2_STD_PAL, |
2316 | }; | 2296 | }; |
2317 | 2297 | ||
2318 | static const struct v4l2_file_operations radio_fops = { | 2298 | static const struct v4l2_file_operations radio_fops = { |
2319 | .owner = THIS_MODULE, | 2299 | .owner = THIS_MODULE, |
2320 | .open = cx231xx_v4l2_open, | 2300 | .open = cx231xx_v4l2_open, |
2321 | .release = cx231xx_v4l2_close, | 2301 | .release = cx231xx_v4l2_close, |
2322 | .ioctl = video_ioctl2, | 2302 | .ioctl = video_ioctl2, |
2323 | }; | 2303 | }; |
2324 | 2304 | ||
2325 | static const struct v4l2_ioctl_ops radio_ioctl_ops = { | 2305 | static const struct v4l2_ioctl_ops radio_ioctl_ops = { |
2326 | .vidioc_querycap = radio_querycap, | 2306 | .vidioc_querycap = radio_querycap, |
2327 | .vidioc_g_tuner = radio_g_tuner, | 2307 | .vidioc_g_tuner = radio_g_tuner, |
2328 | .vidioc_enum_input = radio_enum_input, | 2308 | .vidioc_enum_input = radio_enum_input, |
2329 | .vidioc_g_audio = radio_g_audio, | 2309 | .vidioc_g_audio = radio_g_audio, |
2330 | .vidioc_s_tuner = radio_s_tuner, | 2310 | .vidioc_s_tuner = radio_s_tuner, |
2331 | .vidioc_s_audio = radio_s_audio, | 2311 | .vidioc_s_audio = radio_s_audio, |
2332 | .vidioc_s_input = radio_s_input, | 2312 | .vidioc_s_input = radio_s_input, |
2333 | .vidioc_queryctrl = radio_queryctrl, | 2313 | .vidioc_queryctrl = radio_queryctrl, |
2334 | .vidioc_g_ctrl = vidioc_g_ctrl, | 2314 | .vidioc_g_ctrl = vidioc_g_ctrl, |
2335 | .vidioc_s_ctrl = vidioc_s_ctrl, | 2315 | .vidioc_s_ctrl = vidioc_s_ctrl, |
2336 | .vidioc_g_frequency = vidioc_g_frequency, | 2316 | .vidioc_g_frequency = vidioc_g_frequency, |
2337 | .vidioc_s_frequency = vidioc_s_frequency, | 2317 | .vidioc_s_frequency = vidioc_s_frequency, |
2338 | #ifdef CONFIG_VIDEO_ADV_DEBUG | 2318 | #ifdef CONFIG_VIDEO_ADV_DEBUG |
2339 | .vidioc_g_register = vidioc_g_register, | 2319 | .vidioc_g_register = vidioc_g_register, |
2340 | .vidioc_s_register = vidioc_s_register, | 2320 | .vidioc_s_register = vidioc_s_register, |
2341 | #endif | 2321 | #endif |
2342 | }; | 2322 | }; |
2343 | 2323 | ||
2344 | static struct video_device cx231xx_radio_template = { | 2324 | static struct video_device cx231xx_radio_template = { |
2345 | .name = "cx231xx-radio", | 2325 | .name = "cx231xx-radio", |
2346 | .fops = &radio_fops, | 2326 | .fops = &radio_fops, |
2347 | .ioctl_ops = &radio_ioctl_ops, | 2327 | .ioctl_ops = &radio_ioctl_ops, |
2348 | .minor = -1, | 2328 | .minor = -1, |
2349 | }; | 2329 | }; |
2350 | 2330 | ||
2351 | /******************************** usb interface ******************************/ | 2331 | /******************************** usb interface ******************************/ |
@@ -2358,6 +2338,7 @@ static struct video_device *cx231xx_vdev_init(struct cx231xx *dev, const struct | |||
2358 | vfd = video_device_alloc(); | 2338 | vfd = video_device_alloc(); |
2359 | if (NULL == vfd) | 2339 | if (NULL == vfd) |
2360 | return NULL; | 2340 | return NULL; |
2341 | |||
2361 | *vfd = *template; | 2342 | *vfd = *template; |
2362 | vfd->minor = -1; | 2343 | vfd->minor = -1; |
2363 | vfd->parent = &dev->udev->dev; | 2344 | vfd->parent = &dev->udev->dev; |
@@ -2439,8 +2420,8 @@ int cx231xx_register_analog_devices(struct cx231xx *dev) | |||
2439 | dev->name, dev->vbi_dev->num); | 2420 | dev->name, dev->vbi_dev->num); |
2440 | 2421 | ||
2441 | if (cx231xx_boards[dev->model].radio.type == CX231XX_RADIO) { | 2422 | if (cx231xx_boards[dev->model].radio.type == CX231XX_RADIO) { |
2442 | dev->radio_dev = | 2423 | dev->radio_dev = cx231xx_vdev_init(dev, &cx231xx_radio_template, |
2443 | cx231xx_vdev_init(dev, &cx231xx_radio_template, "radio"); | 2424 | "radio"); |
2444 | if (!dev->radio_dev) { | 2425 | if (!dev->radio_dev) { |
2445 | cx231xx_errdev("cannot allocate video_device.\n"); | 2426 | cx231xx_errdev("cannot allocate video_device.\n"); |
2446 | return -ENODEV; | 2427 | return -ENODEV; |
diff --git a/drivers/media/video/cx231xx/cx231xx.h b/drivers/media/video/cx231xx/cx231xx.h index 1f6c5be65a55..d98b36d772bd 100644 --- a/drivers/media/video/cx231xx/cx231xx.h +++ b/drivers/media/video/cx231xx/cx231xx.h | |||
@@ -140,8 +140,7 @@ struct cx231xx_usb_isoc_ctl { | |||
140 | int nfields; | 140 | int nfields; |
141 | 141 | ||
142 | /* isoc urb callback */ | 142 | /* isoc urb callback */ |
143 | int (*isoc_copy) (struct cx231xx * dev, struct urb * urb); | 143 | int (*isoc_copy) (struct cx231xx *dev, struct urb *urb); |
144 | |||
145 | }; | 144 | }; |
146 | 145 | ||
147 | struct cx231xx_fmt { | 146 | struct cx231xx_fmt { |
@@ -497,20 +496,19 @@ struct cx231xx { | |||
497 | char urb_buf[URB_MAX_CTRL_SIZE]; /* urb control msg buffer */ | 496 | char urb_buf[URB_MAX_CTRL_SIZE]; /* urb control msg buffer */ |
498 | 497 | ||
499 | /* helper funcs that call usb_control_msg */ | 498 | /* helper funcs that call usb_control_msg */ |
500 | int (*cx231xx_read_ctrl_reg) (struct cx231xx * dev, u8 req, u16 reg, | 499 | int (*cx231xx_read_ctrl_reg) (struct cx231xx *dev, u8 req, u16 reg, |
501 | char *buf, int len); | 500 | char *buf, int len); |
502 | int (*cx231xx_write_ctrl_reg) (struct cx231xx * dev, u8 req, u16 reg, | 501 | int (*cx231xx_write_ctrl_reg) (struct cx231xx *dev, u8 req, u16 reg, |
503 | char *buf, int len); | 502 | char *buf, int len); |
504 | int (*cx231xx_send_usb_command) (struct cx231xx_i2c * i2c_bus, | 503 | int (*cx231xx_send_usb_command) (struct cx231xx_i2c *i2c_bus, |
505 | struct cx231xx_i2c_xfer_data * | 504 | struct cx231xx_i2c_xfer_data *req_data); |
506 | req_data); | 505 | int (*cx231xx_gpio_i2c_read) (struct cx231xx *dev, u8 dev_addr, |
507 | int (*cx231xx_gpio_i2c_read) (struct cx231xx * dev, u8 dev_addr, | 506 | u8 *buf, u8 len); |
508 | u8 * buf, u8 len); | 507 | int (*cx231xx_gpio_i2c_write) (struct cx231xx *dev, u8 dev_addr, |
509 | int (*cx231xx_gpio_i2c_write) (struct cx231xx * dev, u8 dev_addr, | 508 | u8 *buf, u8 len); |
510 | u8 * buf, u8 len); | ||
511 | 509 | ||
512 | int (*cx231xx_set_analog_freq) (struct cx231xx * dev, u32 freq); | 510 | int (*cx231xx_set_analog_freq) (struct cx231xx *dev, u32 freq); |
513 | int (*cx231xx_reset_analog_tuner) (struct cx231xx * dev); | 511 | int (*cx231xx_reset_analog_tuner) (struct cx231xx *dev); |
514 | 512 | ||
515 | enum cx231xx_mode mode; | 513 | enum cx231xx_mode mode; |
516 | 514 | ||
@@ -562,7 +560,7 @@ int cx231xx_i2c_unregister(struct cx231xx_i2c *bus); | |||
562 | 560 | ||
563 | /* Internal block control functions */ | 561 | /* Internal block control functions */ |
564 | int cx231xx_read_i2c_data(struct cx231xx *dev, u8 dev_addr, | 562 | int cx231xx_read_i2c_data(struct cx231xx *dev, u8 dev_addr, |
565 | u16 saddr, u8 saddr_len, u32 * data, u8 data_len); | 563 | u16 saddr, u8 saddr_len, u32 *data, u8 data_len); |
566 | int cx231xx_write_i2c_data(struct cx231xx *dev, u8 dev_addr, | 564 | int cx231xx_write_i2c_data(struct cx231xx *dev, u8 dev_addr, |
567 | u16 saddr, u8 saddr_len, u32 data, u8 data_len); | 565 | u16 saddr, u8 saddr_len, u32 data, u8 data_len); |
568 | int cx231xx_reg_mask_write(struct cx231xx *dev, u8 dev_addr, u8 size, | 566 | int cx231xx_reg_mask_write(struct cx231xx *dev, u8 dev_addr, u8 size, |
@@ -594,20 +592,20 @@ int cx231xx_tuner_pre_channel_change(struct cx231xx *dev); | |||
594 | int cx231xx_tuner_post_channel_change(struct cx231xx *dev); | 592 | int cx231xx_tuner_post_channel_change(struct cx231xx *dev); |
595 | 593 | ||
596 | /* video parser functions */ | 594 | /* video parser functions */ |
597 | u8 cx231xx_find_next_SAV_EAV(u8 * p_buffer, u32 buffer_size, | 595 | u8 cx231xx_find_next_SAV_EAV(u8 *p_buffer, u32 buffer_size, |
598 | u32 * p_bytes_used); | 596 | u32 *p_bytes_used); |
599 | u8 cx231xx_find_boundary_SAV_EAV(u8 * p_buffer, u8 * partial_buf, | 597 | u8 cx231xx_find_boundary_SAV_EAV(u8 *p_buffer, u8 *partial_buf, |
600 | u32 * p_bytes_used); | 598 | u32 *p_bytes_used); |
601 | int cx231xx_do_copy(struct cx231xx *dev, struct cx231xx_dmaqueue *dma_q, | 599 | int cx231xx_do_copy(struct cx231xx *dev, struct cx231xx_dmaqueue *dma_q, |
602 | u8 * p_buffer, u32 bytes_to_copy); | 600 | u8 *p_buffer, u32 bytes_to_copy); |
603 | void cx231xx_reset_video_buffer(struct cx231xx *dev, | 601 | void cx231xx_reset_video_buffer(struct cx231xx *dev, |
604 | struct cx231xx_dmaqueue *dma_q); | 602 | struct cx231xx_dmaqueue *dma_q); |
605 | u8 cx231xx_is_buffer_done(struct cx231xx *dev, struct cx231xx_dmaqueue *dma_q); | 603 | u8 cx231xx_is_buffer_done(struct cx231xx *dev, struct cx231xx_dmaqueue *dma_q); |
606 | u32 cx231xx_copy_video_line(struct cx231xx *dev, struct cx231xx_dmaqueue *dma_q, | 604 | u32 cx231xx_copy_video_line(struct cx231xx *dev, struct cx231xx_dmaqueue *dma_q, |
607 | u8 * p_line, u32 length, int field_number); | 605 | u8 *p_line, u32 length, int field_number); |
608 | u32 cx231xx_get_video_line(struct cx231xx *dev, struct cx231xx_dmaqueue *dma_q, | 606 | u32 cx231xx_get_video_line(struct cx231xx *dev, struct cx231xx_dmaqueue *dma_q, |
609 | u8 sav_eav, u8 * p_buffer, u32 buffer_size); | 607 | u8 sav_eav, u8 *p_buffer, u32 buffer_size); |
610 | void cx231xx_swab(u16 * from, u16 * to, u16 len); | 608 | void cx231xx_swab(u16 *from, u16 *to, u16 len); |
611 | 609 | ||
612 | /* Provided by cx231xx-core.c */ | 610 | /* Provided by cx231xx-core.c */ |
613 | 611 | ||
@@ -624,15 +622,15 @@ int cx231xx_write_ctrl_reg(struct cx231xx *dev, u8 req, u16 reg, | |||
624 | char *buf, int len); | 622 | char *buf, int len); |
625 | int cx231xx_mode_register(struct cx231xx *dev, u16 address, u32 mode); | 623 | int cx231xx_mode_register(struct cx231xx *dev, u16 address, u32 mode); |
626 | 624 | ||
627 | int cx231xx_send_vendor_cmd(struct cx231xx *dev, VENDOR_REQUEST_IN * ven_req); | 625 | int cx231xx_send_vendor_cmd(struct cx231xx *dev, VENDOR_REQUEST_IN *ven_req); |
628 | int cx231xx_send_usb_command(struct cx231xx_i2c *i2c_bus, | 626 | int cx231xx_send_usb_command(struct cx231xx_i2c *i2c_bus, |
629 | struct cx231xx_i2c_xfer_data *req_data); | 627 | struct cx231xx_i2c_xfer_data *req_data); |
630 | 628 | ||
631 | /* Gpio related functions */ | 629 | /* Gpio related functions */ |
632 | int cx231xx_send_gpio_cmd(struct cx231xx *dev, u32 gpio_bit, u8 * gpio_val, | 630 | int cx231xx_send_gpio_cmd(struct cx231xx *dev, u32 gpio_bit, u8 *gpio_val, |
633 | u8 len, u8 request, u8 direction); | 631 | u8 len, u8 request, u8 direction); |
634 | int cx231xx_set_gpio_bit(struct cx231xx *dev, u32 gpio_bit, u8 * gpio_val); | 632 | int cx231xx_set_gpio_bit(struct cx231xx *dev, u32 gpio_bit, u8 *gpio_val); |
635 | int cx231xx_get_gpio_bit(struct cx231xx *dev, u32 gpio_bit, u8 * gpio_val); | 633 | int cx231xx_get_gpio_bit(struct cx231xx *dev, u32 gpio_bit, u8 *gpio_val); |
636 | int cx231xx_set_gpio_value(struct cx231xx *dev, int pin_number, int pin_value); | 634 | int cx231xx_set_gpio_value(struct cx231xx *dev, int pin_number, int pin_value); |
637 | int cx231xx_set_gpio_direction(struct cx231xx *dev, int pin_number, | 635 | int cx231xx_set_gpio_direction(struct cx231xx *dev, int pin_number, |
638 | int pin_value); | 636 | int pin_value); |
@@ -640,13 +638,13 @@ int cx231xx_set_gpio_direction(struct cx231xx *dev, int pin_number, | |||
640 | int cx231xx_gpio_i2c_start(struct cx231xx *dev); | 638 | int cx231xx_gpio_i2c_start(struct cx231xx *dev); |
641 | int cx231xx_gpio_i2c_end(struct cx231xx *dev); | 639 | int cx231xx_gpio_i2c_end(struct cx231xx *dev); |
642 | int cx231xx_gpio_i2c_write_byte(struct cx231xx *dev, u8 data); | 640 | int cx231xx_gpio_i2c_write_byte(struct cx231xx *dev, u8 data); |
643 | int cx231xx_gpio_i2c_read_byte(struct cx231xx *dev, u8 * buf); | 641 | int cx231xx_gpio_i2c_read_byte(struct cx231xx *dev, u8 *buf); |
644 | int cx231xx_gpio_i2c_read_ack(struct cx231xx *dev); | 642 | int cx231xx_gpio_i2c_read_ack(struct cx231xx *dev); |
645 | int cx231xx_gpio_i2c_write_ack(struct cx231xx *dev); | 643 | int cx231xx_gpio_i2c_write_ack(struct cx231xx *dev); |
646 | int cx231xx_gpio_i2c_write_nak(struct cx231xx *dev); | 644 | int cx231xx_gpio_i2c_write_nak(struct cx231xx *dev); |
647 | 645 | ||
648 | int cx231xx_gpio_i2c_read(struct cx231xx *dev, u8 dev_addr, u8 * buf, u8 len); | 646 | int cx231xx_gpio_i2c_read(struct cx231xx *dev, u8 dev_addr, u8 *buf, u8 len); |
649 | int cx231xx_gpio_i2c_write(struct cx231xx *dev, u8 dev_addr, u8 * buf, u8 len); | 647 | int cx231xx_gpio_i2c_write(struct cx231xx *dev, u8 dev_addr, u8 *buf, u8 len); |
650 | 648 | ||
651 | /* audio related functions */ | 649 | /* audio related functions */ |
652 | int cx231xx_set_audio_decoder_input(struct cx231xx *dev, | 650 | int cx231xx_set_audio_decoder_input(struct cx231xx *dev, |
@@ -658,8 +656,8 @@ int cx231xx_set_video_alternate(struct cx231xx *dev); | |||
658 | int cx231xx_set_alt_setting(struct cx231xx *dev, u8 index, u8 alt); | 656 | int cx231xx_set_alt_setting(struct cx231xx *dev, u8 index, u8 alt); |
659 | int cx231xx_init_isoc(struct cx231xx *dev, int max_packets, | 657 | int cx231xx_init_isoc(struct cx231xx *dev, int max_packets, |
660 | int num_bufs, int max_pkt_size, | 658 | int num_bufs, int max_pkt_size, |
661 | int (*isoc_copy) (struct cx231xx * dev, | 659 | int (*isoc_copy) (struct cx231xx *dev, |
662 | struct urb * urb)); | 660 | struct urb *urb)); |
663 | void cx231xx_uninit_isoc(struct cx231xx *dev); | 661 | void cx231xx_uninit_isoc(struct cx231xx *dev); |
664 | int cx231xx_set_mode(struct cx231xx *dev, enum cx231xx_mode set_mode); | 662 | int cx231xx_set_mode(struct cx231xx *dev, enum cx231xx_mode set_mode); |
665 | int cx231xx_gpio_set(struct cx231xx *dev, struct cx231xx_reg_seq *gpio); | 663 | int cx231xx_gpio_set(struct cx231xx *dev, struct cx231xx_reg_seq *gpio); |