diff options
author | Hans Verkuil <hverkuil@xs4all.nl> | 2007-08-07 06:16:07 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@infradead.org> | 2007-10-09 21:05:38 -0400 |
commit | 8267761881d6bb91c168ba4d629b778cf106c485 (patch) | |
tree | df19f79da1116ab86cf10f3147412e556dcef0c5 /drivers/media/video/cx25840 | |
parent | e17a06badaedba89fad989eed409661c89a22e04 (diff) |
V4L/DVB (6051): cx25840: make proper use of SOFT_RESET
Whenever the 0x80b register is used the microcontroller should be reset.
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers/media/video/cx25840')
-rw-r--r-- | drivers/media/video/cx25840/cx25840-audio.c | 22 | ||||
-rw-r--r-- | drivers/media/video/cx25840/cx25840-core.c | 7 |
2 files changed, 12 insertions, 17 deletions
diff --git a/drivers/media/video/cx25840/cx25840-audio.c b/drivers/media/video/cx25840/cx25840-audio.c index f93b5160bb4f..3d46a776df36 100644 --- a/drivers/media/video/cx25840/cx25840-audio.c +++ b/drivers/media/video/cx25840/cx25840-audio.c | |||
@@ -157,13 +157,12 @@ void cx25840_audio_set_path(struct i2c_client *client) | |||
157 | { | 157 | { |
158 | struct cx25840_state *state = i2c_get_clientdata(client); | 158 | struct cx25840_state *state = i2c_get_clientdata(client); |
159 | 159 | ||
160 | /* assert soft reset */ | ||
161 | cx25840_and_or(client, 0x810, ~0x1, 0x01); | ||
162 | |||
160 | /* stop microcontroller */ | 163 | /* stop microcontroller */ |
161 | cx25840_and_or(client, 0x803, ~0x10, 0); | 164 | cx25840_and_or(client, 0x803, ~0x10, 0); |
162 | 165 | ||
163 | /* assert soft reset */ | ||
164 | if (!state->is_cx25836) | ||
165 | cx25840_and_or(client, 0x810, ~0x1, 0x01); | ||
166 | |||
167 | /* Mute everything to prevent the PFFT! */ | 166 | /* Mute everything to prevent the PFFT! */ |
168 | cx25840_write(client, 0x8d3, 0x1f); | 167 | cx25840_write(client, 0x8d3, 0x1f); |
169 | 168 | ||
@@ -181,15 +180,14 @@ void cx25840_audio_set_path(struct i2c_client *client) | |||
181 | 180 | ||
182 | set_audclk_freq(client, state->audclk_freq); | 181 | set_audclk_freq(client, state->audclk_freq); |
183 | 182 | ||
184 | /* deassert soft reset */ | ||
185 | if (!state->is_cx25836) | ||
186 | cx25840_and_or(client, 0x810, ~0x1, 0x00); | ||
187 | |||
188 | if (state->aud_input != CX25840_AUDIO_SERIAL) { | 183 | if (state->aud_input != CX25840_AUDIO_SERIAL) { |
189 | /* When the microcontroller detects the | 184 | /* When the microcontroller detects the |
190 | * audio format, it will unmute the lines */ | 185 | * audio format, it will unmute the lines */ |
191 | cx25840_and_or(client, 0x803, ~0x10, 0x10); | 186 | cx25840_and_or(client, 0x803, ~0x10, 0x10); |
192 | } | 187 | } |
188 | |||
189 | /* deassert soft reset */ | ||
190 | cx25840_and_or(client, 0x810, ~0x1, 0x00); | ||
193 | } | 191 | } |
194 | 192 | ||
195 | static int get_volume(struct i2c_client *client) | 193 | static int get_volume(struct i2c_client *client) |
@@ -330,18 +328,18 @@ int cx25840_audio(struct i2c_client *client, unsigned int cmd, void *arg) | |||
330 | 328 | ||
331 | switch (cmd) { | 329 | switch (cmd) { |
332 | case VIDIOC_INT_AUDIO_CLOCK_FREQ: | 330 | case VIDIOC_INT_AUDIO_CLOCK_FREQ: |
331 | if (!state->is_cx25836) | ||
332 | cx25840_and_or(client, 0x810, ~0x1, 1); | ||
333 | if (state->aud_input != CX25840_AUDIO_SERIAL) { | 333 | if (state->aud_input != CX25840_AUDIO_SERIAL) { |
334 | cx25840_and_or(client, 0x803, ~0x10, 0); | 334 | cx25840_and_or(client, 0x803, ~0x10, 0); |
335 | cx25840_write(client, 0x8d3, 0x1f); | 335 | cx25840_write(client, 0x8d3, 0x1f); |
336 | } | 336 | } |
337 | if (!state->is_cx25836) | ||
338 | cx25840_and_or(client, 0x810, ~0x1, 1); | ||
339 | retval = set_audclk_freq(client, *(u32 *)arg); | 337 | retval = set_audclk_freq(client, *(u32 *)arg); |
340 | if (!state->is_cx25836) | ||
341 | cx25840_and_or(client, 0x810, ~0x1, 0); | ||
342 | if (state->aud_input != CX25840_AUDIO_SERIAL) { | 338 | if (state->aud_input != CX25840_AUDIO_SERIAL) { |
343 | cx25840_and_or(client, 0x803, ~0x10, 0x10); | 339 | cx25840_and_or(client, 0x803, ~0x10, 0x10); |
344 | } | 340 | } |
341 | if (!state->is_cx25836) | ||
342 | cx25840_and_or(client, 0x810, ~0x1, 0); | ||
345 | return retval; | 343 | return retval; |
346 | 344 | ||
347 | case VIDIOC_G_CTRL: | 345 | case VIDIOC_G_CTRL: |
diff --git a/drivers/media/video/cx25840/cx25840-core.c b/drivers/media/video/cx25840/cx25840-core.c index 8f9c32613b45..ae90d1c3d12b 100644 --- a/drivers/media/video/cx25840/cx25840-core.c +++ b/drivers/media/video/cx25840/cx25840-core.c | |||
@@ -250,6 +250,7 @@ static void input_change(struct i2c_client *client) | |||
250 | } | 250 | } |
251 | cx25840_and_or(client, 0x401, ~0x60, 0); | 251 | cx25840_and_or(client, 0x401, ~0x60, 0); |
252 | cx25840_and_or(client, 0x401, ~0x60, 0x60); | 252 | cx25840_and_or(client, 0x401, ~0x60, 0x60); |
253 | cx25840_and_or(client, 0x810, ~0x01, 1); | ||
253 | 254 | ||
254 | if (state->radio) { | 255 | if (state->radio) { |
255 | cx25840_write(client, 0x808, 0xf9); | 256 | cx25840_write(client, 0x808, 0xf9); |
@@ -284,11 +285,7 @@ static void input_change(struct i2c_client *client) | |||
284 | cx25840_write(client, 0x80b, 0x10); | 285 | cx25840_write(client, 0x80b, 0x10); |
285 | } | 286 | } |
286 | 287 | ||
287 | if (cx25840_read(client, 0x803) & 0x10) { | 288 | cx25840_and_or(client, 0x810, ~0x01, 0); |
288 | /* restart audio decoder microcontroller */ | ||
289 | cx25840_and_or(client, 0x803, ~0x10, 0x00); | ||
290 | cx25840_and_or(client, 0x803, ~0x10, 0x10); | ||
291 | } | ||
292 | } | 289 | } |
293 | 290 | ||
294 | static int set_input(struct i2c_client *client, enum cx25840_video_input vid_input, | 291 | static int set_input(struct i2c_client *client, enum cx25840_video_input vid_input, |