diff options
author | Hans Verkuil <hverkuil@xs4all.nl> | 2006-01-23 14:11:09 -0500 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@brturbo.com.br> | 2006-01-23 14:11:09 -0500 |
commit | 8a4b275f9c192921797f45c2d4b5e4bc3875500a (patch) | |
tree | da12ba774968078df22718a58221e87b71387fca /drivers/media/video/msp3400-driver.c | |
parent | 9aeb4b051b65c0248ea6589096950413c4da9d63 (diff) |
V4L/DVB (3427): audmode and rxsubchans fixes (VIDIOC_G/S_TUNER)
- Audmode and rxsubchans fixes in msp3400, tuner, tvaudio and cx25840.
- msp3400 cleanups
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers/media/video/msp3400-driver.c')
-rw-r--r-- | drivers/media/video/msp3400-driver.c | 59 |
1 files changed, 15 insertions, 44 deletions
diff --git a/drivers/media/video/msp3400-driver.c b/drivers/media/video/msp3400-driver.c index 994c340f9d02..11ea9765769c 100644 --- a/drivers/media/video/msp3400-driver.c +++ b/drivers/media/video/msp3400-driver.c | |||
@@ -411,9 +411,9 @@ static int msp_mode_v4l2_to_v4l1(int rxsubchans) | |||
411 | if (rxsubchans & V4L2_TUNER_SUB_STEREO) | 411 | if (rxsubchans & V4L2_TUNER_SUB_STEREO) |
412 | mode |= VIDEO_SOUND_STEREO; | 412 | mode |= VIDEO_SOUND_STEREO; |
413 | if (rxsubchans & V4L2_TUNER_SUB_LANG2) | 413 | if (rxsubchans & V4L2_TUNER_SUB_LANG2) |
414 | mode |= VIDEO_SOUND_LANG2; | 414 | mode |= VIDEO_SOUND_LANG2 | VIDEO_SOUND_STEREO; |
415 | if (rxsubchans & V4L2_TUNER_SUB_LANG1) | 415 | if (rxsubchans & V4L2_TUNER_SUB_LANG1) |
416 | mode |= VIDEO_SOUND_LANG1; | 416 | mode |= VIDEO_SOUND_LANG1 | VIDEO_SOUND_STEREO; |
417 | if (mode == 0) | 417 | if (mode == 0) |
418 | mode |= VIDEO_SOUND_MONO; | 418 | mode |= VIDEO_SOUND_MONO; |
419 | return mode; | 419 | return mode; |
@@ -430,21 +430,6 @@ static int msp_mode_v4l1_to_v4l2(int mode) | |||
430 | return V4L2_TUNER_MODE_MONO; | 430 | return V4L2_TUNER_MODE_MONO; |
431 | } | 431 | } |
432 | 432 | ||
433 | static void msp_any_detect_stereo(struct i2c_client *client) | ||
434 | { | ||
435 | struct msp_state *state = i2c_get_clientdata(client); | ||
436 | |||
437 | switch (state->opmode) { | ||
438 | case OPMODE_MANUAL: | ||
439 | case OPMODE_AUTODETECT: | ||
440 | autodetect_stereo(client); | ||
441 | break; | ||
442 | case OPMODE_AUTOSELECT: | ||
443 | msp34xxg_detect_stereo(client); | ||
444 | break; | ||
445 | } | ||
446 | } | ||
447 | |||
448 | static struct v4l2_queryctrl msp_qctrl_std[] = { | 433 | static struct v4l2_queryctrl msp_qctrl_std[] = { |
449 | { | 434 | { |
450 | .id = V4L2_CID_AUDIO_VOLUME, | 435 | .id = V4L2_CID_AUDIO_VOLUME, |
@@ -506,22 +491,6 @@ static struct v4l2_queryctrl msp_qctrl_sound_processing[] = { | |||
506 | }; | 491 | }; |
507 | 492 | ||
508 | 493 | ||
509 | static void msp_any_set_audmode(struct i2c_client *client, int audmode) | ||
510 | { | ||
511 | struct msp_state *state = i2c_get_clientdata(client); | ||
512 | |||
513 | switch (state->opmode) { | ||
514 | case OPMODE_MANUAL: | ||
515 | case OPMODE_AUTODETECT: | ||
516 | state->watch_stereo = 0; | ||
517 | msp3400c_setstereo(client, audmode); | ||
518 | break; | ||
519 | case OPMODE_AUTOSELECT: | ||
520 | msp34xxg_set_audmode(client, audmode); | ||
521 | break; | ||
522 | } | ||
523 | } | ||
524 | |||
525 | static int msp_get_ctrl(struct i2c_client *client, struct v4l2_control *ctrl) | 494 | static int msp_get_ctrl(struct i2c_client *client, struct v4l2_control *ctrl) |
526 | { | 495 | { |
527 | struct msp_state *state = i2c_get_clientdata(client); | 496 | struct msp_state *state = i2c_get_clientdata(client); |
@@ -656,7 +625,7 @@ static int msp_command(struct i2c_client *client, unsigned int cmd, void *arg) | |||
656 | msp_set_scart(client, scart, 0); | 625 | msp_set_scart(client, scart, 0); |
657 | msp_write_dsp(client, 0x000d, 0x1900); | 626 | msp_write_dsp(client, 0x000d, 0x1900); |
658 | if (state->opmode != OPMODE_AUTOSELECT) | 627 | if (state->opmode != OPMODE_AUTOSELECT) |
659 | msp3400c_setstereo(client, state->audmode); | 628 | msp_set_audmode(client); |
660 | } | 629 | } |
661 | msp_wake_thread(client); | 630 | msp_wake_thread(client); |
662 | break; | 631 | break; |
@@ -670,8 +639,8 @@ static int msp_command(struct i2c_client *client, unsigned int cmd, void *arg) | |||
670 | switch (state->opmode) { | 639 | switch (state->opmode) { |
671 | case OPMODE_MANUAL: | 640 | case OPMODE_MANUAL: |
672 | /* set msp3400 to FM radio mode */ | 641 | /* set msp3400 to FM radio mode */ |
673 | msp3400c_setmode(client, MSP_MODE_FM_RADIO); | 642 | msp3400c_set_mode(client, MSP_MODE_FM_RADIO); |
674 | msp3400c_setcarrier(client, MSP_CARRIER(10.7), | 643 | msp3400c_set_carrier(client, MSP_CARRIER(10.7), |
675 | MSP_CARRIER(10.7)); | 644 | MSP_CARRIER(10.7)); |
676 | msp_set_audio(client); | 645 | msp_set_audio(client); |
677 | break; | 646 | break; |
@@ -705,7 +674,7 @@ static int msp_command(struct i2c_client *client, unsigned int cmd, void *arg) | |||
705 | if (state->radio) | 674 | if (state->radio) |
706 | break; | 675 | break; |
707 | if (state->opmode == OPMODE_AUTOSELECT) | 676 | if (state->opmode == OPMODE_AUTOSELECT) |
708 | msp_any_detect_stereo(client); | 677 | msp_detect_stereo(client); |
709 | va->mode = msp_mode_v4l2_to_v4l1(state->rxsubchans); | 678 | va->mode = msp_mode_v4l2_to_v4l1(state->rxsubchans); |
710 | break; | 679 | break; |
711 | } | 680 | } |
@@ -721,8 +690,9 @@ static int msp_command(struct i2c_client *client, unsigned int cmd, void *arg) | |||
721 | state->treble = va->treble; | 690 | state->treble = va->treble; |
722 | msp_set_audio(client); | 691 | msp_set_audio(client); |
723 | 692 | ||
724 | if (va->mode != 0 && state->radio == 0) | 693 | if (va->mode != 0 && state->radio == 0) { |
725 | msp_any_set_audmode(client, msp_mode_v4l1_to_v4l2(va->mode)); | 694 | state->audmode = msp_mode_v4l1_to_v4l2(va->mode); |
695 | } | ||
726 | break; | 696 | break; |
727 | } | 697 | } |
728 | 698 | ||
@@ -864,7 +834,7 @@ static int msp_command(struct i2c_client *client, unsigned int cmd, void *arg) | |||
864 | msp_set_scart(client, scart, 0); | 834 | msp_set_scart(client, scart, 0); |
865 | msp_write_dsp(client, 0x000d, 0x1900); | 835 | msp_write_dsp(client, 0x000d, 0x1900); |
866 | } | 836 | } |
867 | msp_any_set_audmode(client, state->audmode); | 837 | msp_set_audmode(client); |
868 | msp_wake_thread(client); | 838 | msp_wake_thread(client); |
869 | break; | 839 | break; |
870 | } | 840 | } |
@@ -876,7 +846,7 @@ static int msp_command(struct i2c_client *client, unsigned int cmd, void *arg) | |||
876 | if (state->radio) | 846 | if (state->radio) |
877 | break; | 847 | break; |
878 | if (state->opmode == OPMODE_AUTOSELECT) | 848 | if (state->opmode == OPMODE_AUTOSELECT) |
879 | msp_any_detect_stereo(client); | 849 | msp_detect_stereo(client); |
880 | vt->audmode = state->audmode; | 850 | vt->audmode = state->audmode; |
881 | vt->rxsubchans = state->rxsubchans; | 851 | vt->rxsubchans = state->rxsubchans; |
882 | vt->capability = V4L2_TUNER_CAP_STEREO | | 852 | vt->capability = V4L2_TUNER_CAP_STEREO | |
@@ -890,8 +860,9 @@ static int msp_command(struct i2c_client *client, unsigned int cmd, void *arg) | |||
890 | 860 | ||
891 | if (state->radio) /* TODO: add mono/stereo support for radio */ | 861 | if (state->radio) /* TODO: add mono/stereo support for radio */ |
892 | break; | 862 | break; |
863 | state->audmode = vt->audmode; | ||
893 | /* only set audmode */ | 864 | /* only set audmode */ |
894 | msp_any_set_audmode(client, vt->audmode); | 865 | msp_set_audmode(client); |
895 | break; | 866 | break; |
896 | } | 867 | } |
897 | 868 | ||
@@ -981,7 +952,7 @@ static int msp_command(struct i2c_client *client, unsigned int cmd, void *arg) | |||
981 | const char *p; | 952 | const char *p; |
982 | 953 | ||
983 | if (state->opmode == OPMODE_AUTOSELECT) | 954 | if (state->opmode == OPMODE_AUTOSELECT) |
984 | msp_any_detect_stereo(client); | 955 | msp_detect_stereo(client); |
985 | v4l_info(client, "%s rev1 = 0x%04x rev2 = 0x%04x\n", | 956 | v4l_info(client, "%s rev1 = 0x%04x rev2 = 0x%04x\n", |
986 | client->name, state->rev1, state->rev2); | 957 | client->name, state->rev1, state->rev2); |
987 | v4l_info(client, "Audio: volume %d%s\n", | 958 | v4l_info(client, "Audio: volume %d%s\n", |
@@ -1082,7 +1053,7 @@ static int msp_attach(struct i2c_adapter *adapter, int address, int kind) | |||
1082 | 1053 | ||
1083 | memset(state, 0, sizeof(*state)); | 1054 | memset(state, 0, sizeof(*state)); |
1084 | state->v4l2_std = V4L2_STD_NTSC; | 1055 | state->v4l2_std = V4L2_STD_NTSC; |
1085 | state->audmode = V4L2_TUNER_MODE_STEREO; | 1056 | state->audmode = V4L2_TUNER_MODE_LANG1; |
1086 | state->volume = 58880; /* 0db gain */ | 1057 | state->volume = 58880; /* 0db gain */ |
1087 | state->balance = 32768; /* 0db gain */ | 1058 | state->balance = 32768; /* 0db gain */ |
1088 | state->bass = 32768; | 1059 | state->bass = 32768; |