aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/cx25840
diff options
context:
space:
mode:
authorSven Barth <pascaldragon@googlemail.com>2010-07-10 14:02:21 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2010-10-21 07:41:45 -0400
commit5af79f86db6a29a158510b5dc255d8844d95c4e9 (patch)
tree0ed6cee8b57b40fcdacb0ca0dd2c3150f281cdd2 /drivers/media/video/cx25840
parent94399431379dfc77565c9861013f41ab0078c18b (diff)
[media] Add support for AUX_PLL on cx2583x chips
This adds support for the AUX_PLL in cx2583x chips which is available in those although the audio part of the chip is not. The AUX_PLL is used at least by Terratec in their Grabster AV400 device. Signed-off-by: Sven Barth <pascaldragon@googlemail.com> Acked-by: Mike Isely <isely@pobox.com> Reviewed-by: Andy Walls <awalls@md.metrocast.net> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video/cx25840')
-rw-r--r--drivers/media/video/cx25840/cx25840-audio.c54
-rw-r--r--drivers/media/video/cx25840/cx25840-core.c16
2 files changed, 37 insertions, 33 deletions
diff --git a/drivers/media/video/cx25840/cx25840-audio.c b/drivers/media/video/cx25840/cx25840-audio.c
index 6faad34df3ac..34b96c7cfd62 100644
--- a/drivers/media/video/cx25840/cx25840-audio.c
+++ b/drivers/media/video/cx25840/cx25840-audio.c
@@ -437,41 +437,45 @@ void cx25840_audio_set_path(struct i2c_client *client)
437{ 437{
438 struct cx25840_state *state = to_state(i2c_get_clientdata(client)); 438 struct cx25840_state *state = to_state(i2c_get_clientdata(client));
439 439
440 /* assert soft reset */ 440 if (!is_cx2583x(state)) {
441 cx25840_and_or(client, 0x810, ~0x1, 0x01); 441 /* assert soft reset */
442 cx25840_and_or(client, 0x810, ~0x1, 0x01);
442 443
443 /* stop microcontroller */ 444 /* stop microcontroller */
444 cx25840_and_or(client, 0x803, ~0x10, 0); 445 cx25840_and_or(client, 0x803, ~0x10, 0);
445 446
446 /* Mute everything to prevent the PFFT! */ 447 /* Mute everything to prevent the PFFT! */
447 cx25840_write(client, 0x8d3, 0x1f); 448 cx25840_write(client, 0x8d3, 0x1f);
448 449
449 if (state->aud_input == CX25840_AUDIO_SERIAL) { 450 if (state->aud_input == CX25840_AUDIO_SERIAL) {
450 /* Set Path1 to Serial Audio Input */ 451 /* Set Path1 to Serial Audio Input */
451 cx25840_write4(client, 0x8d0, 0x01011012); 452 cx25840_write4(client, 0x8d0, 0x01011012);
452 453
453 /* The microcontroller should not be started for the 454 /* The microcontroller should not be started for the
454 * non-tuner inputs: autodetection is specific for 455 * non-tuner inputs: autodetection is specific for
455 * TV audio. */ 456 * TV audio. */
456 } else { 457 } else {
457 /* Set Path1 to Analog Demod Main Channel */ 458 /* Set Path1 to Analog Demod Main Channel */
458 cx25840_write4(client, 0x8d0, 0x1f063870); 459 cx25840_write4(client, 0x8d0, 0x1f063870);
460 }
459 } 461 }
460 462
461 set_audclk_freq(client, state->audclk_freq); 463 set_audclk_freq(client, state->audclk_freq);
462 464
463 if (state->aud_input != CX25840_AUDIO_SERIAL) { 465 if (!is_cx2583x(state)) {
464 /* When the microcontroller detects the 466 if (state->aud_input != CX25840_AUDIO_SERIAL) {
465 * audio format, it will unmute the lines */ 467 /* When the microcontroller detects the
466 cx25840_and_or(client, 0x803, ~0x10, 0x10); 468 * audio format, it will unmute the lines */
467 } 469 cx25840_and_or(client, 0x803, ~0x10, 0x10);
470 }
468 471
469 /* deassert soft reset */ 472 /* deassert soft reset */
470 cx25840_and_or(client, 0x810, ~0x1, 0x00); 473 cx25840_and_or(client, 0x810, ~0x1, 0x00);
471 474
472 /* Ensure the controller is running when we exit */ 475 /* Ensure the controller is running when we exit */
473 if (is_cx2388x(state) || is_cx231xx(state)) 476 if (is_cx2388x(state) || is_cx231xx(state))
474 cx25840_and_or(client, 0x803, ~0x10, 0x10); 477 cx25840_and_or(client, 0x803, ~0x10, 0x10);
478 }
475} 479}
476 480
477static void set_volume(struct i2c_client *client, int volume) 481static void set_volume(struct i2c_client *client, int volume)
diff --git a/drivers/media/video/cx25840/cx25840-core.c b/drivers/media/video/cx25840/cx25840-core.c
index f26f9da24c8c..af1eea03dd11 100644
--- a/drivers/media/video/cx25840/cx25840-core.c
+++ b/drivers/media/video/cx25840/cx25840-core.c
@@ -870,6 +870,11 @@ static void input_change(struct i2c_client *client)
870 } 870 }
871 cx25840_and_or(client, 0x401, ~0x60, 0); 871 cx25840_and_or(client, 0x401, ~0x60, 0);
872 cx25840_and_or(client, 0x401, ~0x60, 0x60); 872 cx25840_and_or(client, 0x401, ~0x60, 0x60);
873
874 /* Don't write into audio registers on cx2583x chips */
875 if (is_cx2583x(state))
876 return;
877
873 cx25840_and_or(client, 0x810, ~0x01, 1); 878 cx25840_and_or(client, 0x810, ~0x01, 1);
874 879
875 if (state->radio) { 880 if (state->radio) {
@@ -1028,10 +1033,8 @@ static int set_input(struct i2c_client *client, enum cx25840_video_input vid_inp
1028 1033
1029 state->vid_input = vid_input; 1034 state->vid_input = vid_input;
1030 state->aud_input = aud_input; 1035 state->aud_input = aud_input;
1031 if (!is_cx2583x(state)) { 1036 cx25840_audio_set_path(client);
1032 cx25840_audio_set_path(client); 1037 input_change(client);
1033 input_change(client);
1034 }
1035 1038
1036 if (is_cx2388x(state)) { 1039 if (is_cx2388x(state)) {
1037 /* Audio channel 1 src : Parallel 1 */ 1040 /* Audio channel 1 src : Parallel 1 */
@@ -1552,8 +1555,6 @@ static int cx25840_s_audio_routing(struct v4l2_subdev *sd,
1552 struct cx25840_state *state = to_state(sd); 1555 struct cx25840_state *state = to_state(sd);
1553 struct i2c_client *client = v4l2_get_subdevdata(sd); 1556 struct i2c_client *client = v4l2_get_subdevdata(sd);
1554 1557
1555 if (is_cx2583x(state))
1556 return -EINVAL;
1557 return set_input(client, state->vid_input, input); 1558 return set_input(client, state->vid_input, input);
1558} 1559}
1559 1560
@@ -1562,8 +1563,7 @@ static int cx25840_s_frequency(struct v4l2_subdev *sd, struct v4l2_frequency *fr
1562 struct cx25840_state *state = to_state(sd); 1563 struct cx25840_state *state = to_state(sd);
1563 struct i2c_client *client = v4l2_get_subdevdata(sd); 1564 struct i2c_client *client = v4l2_get_subdevdata(sd);
1564 1565
1565 if (!is_cx2583x(state)) 1566 input_change(client);
1566 input_change(client);
1567 return 0; 1567 return 0;
1568} 1568}
1569 1569