aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/msp3400-driver.c
diff options
context:
space:
mode:
authorHans Verkuil <hverkuil@xs4all.nl>2006-01-09 15:21:37 -0500
committerMauro Carvalho Chehab <mchehab@brturbo.com.br>2006-01-09 15:21:37 -0500
commit5af0c8f6a09534ebc6c56b4e5d79d0d521364750 (patch)
treeabc3f4ed2281d5113c053997b1fa2e6b44283b38 /drivers/media/video/msp3400-driver.c
parent5b0fa4fff17d944b6a0d4cb35d8e8b5ad0ac3669 (diff)
V4L/DVB (3326): Fix stereo and standard reporting of msp3400 (esp. for radio)
- Add VIDIOC_LOG_STATUS to the radio device ioctl list. - Reduce the confusion between modes and standards - Fix stereo reporting for radio. - Don't set i2c configuration if the chip doesn't support it. - Fix reporting of current standard for radio. Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@brturbo.com.br>
Diffstat (limited to 'drivers/media/video/msp3400-driver.c')
-rw-r--r--drivers/media/video/msp3400-driver.c62
1 files changed, 48 insertions, 14 deletions
diff --git a/drivers/media/video/msp3400-driver.c b/drivers/media/video/msp3400-driver.c
index 04a05d7dd470..aa8c556b6ba1 100644
--- a/drivers/media/video/msp3400-driver.c
+++ b/drivers/media/video/msp3400-driver.c
@@ -345,7 +345,7 @@ int msp_modus(struct i2c_client *client)
345 return 0x0003; 345 return 0x0003;
346 } 346 }
347 347
348 if (state->std & V4L2_STD_PAL) { 348 if (state->v4l2_std & V4L2_STD_PAL) {
349 v4l_dbg(1, client, "video mode selected to PAL\n"); 349 v4l_dbg(1, client, "video mode selected to PAL\n");
350 350
351#if 1 351#if 1
@@ -356,11 +356,11 @@ int msp_modus(struct i2c_client *client)
356 return 0x1003; 356 return 0x1003;
357#endif 357#endif
358 } 358 }
359 if (state->std & V4L2_STD_NTSC) { 359 if (state->v4l2_std & V4L2_STD_NTSC) {
360 v4l_dbg(1, client, "video mode selected to NTSC\n"); 360 v4l_dbg(1, client, "video mode selected to NTSC\n");
361 return 0x2003; 361 return 0x2003;
362 } 362 }
363 if (state->std & V4L2_STD_SECAM) { 363 if (state->v4l2_std & V4L2_STD_SECAM) {
364 v4l_dbg(1, client, "video mode selected to SECAM\n"); 364 v4l_dbg(1, client, "video mode selected to SECAM\n");
365 return 0x0003; 365 return 0x0003;
366 } 366 }
@@ -663,6 +663,8 @@ static int msp_command(struct i2c_client *client, unsigned int cmd, void *arg)
663 break; 663 break;
664 664
665 case AUDC_SET_RADIO: 665 case AUDC_SET_RADIO:
666 if (state->radio)
667 return 0;
666 state->radio = 1; 668 state->radio = 1;
667 v4l_dbg(1, client, "switching to radio mode\n"); 669 v4l_dbg(1, client, "switching to radio mode\n");
668 state->watch_stereo = 0; 670 state->watch_stereo = 0;
@@ -701,6 +703,8 @@ static int msp_command(struct i2c_client *client, unsigned int cmd, void *arg)
701 va->bass = state->bass; 703 va->bass = state->bass;
702 va->treble = state->treble; 704 va->treble = state->treble;
703 705
706 if (state->radio)
707 break;
704 if (state->opmode == OPMODE_AUTOSELECT) 708 if (state->opmode == OPMODE_AUTOSELECT)
705 msp_any_detect_stereo(client); 709 msp_any_detect_stereo(client);
706 va->mode = msp_mode_v4l2_to_v4l1(state->rxsubchans); 710 va->mode = msp_mode_v4l2_to_v4l1(state->rxsubchans);
@@ -738,8 +742,8 @@ static int msp_command(struct i2c_client *client, unsigned int cmd, void *arg)
738 std = V4L2_STD_SECAM; 742 std = V4L2_STD_SECAM;
739 else 743 else
740 std = V4L2_STD_NTSC; 744 std = V4L2_STD_NTSC;
741 if (std != state->std) { 745 if (std != state->v4l2_std) {
742 state->std = std; 746 state->v4l2_std = std;
743 update = 1; 747 update = 1;
744 } 748 }
745 if (update) 749 if (update)
@@ -768,9 +772,9 @@ static int msp_command(struct i2c_client *client, unsigned int cmd, void *arg)
768 case VIDIOC_S_STD: 772 case VIDIOC_S_STD:
769 { 773 {
770 v4l2_std_id *id = arg; 774 v4l2_std_id *id = arg;
771 int update = state->radio || state->std != *id; 775 int update = state->radio || state->v4l2_std != *id;
772 776
773 state->std = *id; 777 state->v4l2_std = *id;
774 state->radio = 0; 778 state->radio = 0;
775 if (update) 779 if (update)
776 msp_wake_thread(client); 780 msp_wake_thread(client);
@@ -879,6 +883,8 @@ static int msp_command(struct i2c_client *client, unsigned int cmd, void *arg)
879 { 883 {
880 struct v4l2_tuner *vt = arg; 884 struct v4l2_tuner *vt = arg;
881 885
886 if (state->radio)
887 break;
882 if (state->opmode == OPMODE_AUTOSELECT) 888 if (state->opmode == OPMODE_AUTOSELECT)
883 msp_any_detect_stereo(client); 889 msp_any_detect_stereo(client);
884 vt->audmode = state->audmode; 890 vt->audmode = state->audmode;
@@ -892,6 +898,8 @@ static int msp_command(struct i2c_client *client, unsigned int cmd, void *arg)
892 { 898 {
893 struct v4l2_tuner *vt = (struct v4l2_tuner *)arg; 899 struct v4l2_tuner *vt = (struct v4l2_tuner *)arg;
894 900
901 if (state->radio)
902 break;
895 /* only set audmode */ 903 /* only set audmode */
896 if (vt->audmode != -1 && vt->audmode != 0) 904 if (vt->audmode != -1 && vt->audmode != 0)
897 msp_any_set_audmode(client, vt->audmode); 905 msp_any_set_audmode(client, vt->audmode);
@@ -981,22 +989,46 @@ static int msp_command(struct i2c_client *client, unsigned int cmd, void *arg)
981 return msp_set_ctrl(client, arg); 989 return msp_set_ctrl(client, arg);
982 990
983 case VIDIOC_LOG_STATUS: 991 case VIDIOC_LOG_STATUS:
992 {
993 const char *p;
994
984 if (state->opmode == OPMODE_AUTOSELECT) 995 if (state->opmode == OPMODE_AUTOSELECT)
985 msp_any_detect_stereo(client); 996 msp_any_detect_stereo(client);
986 v4l_info(client, "%s rev1 = 0x%04x rev2 = 0x%04x\n", 997 v4l_info(client, "%s rev1 = 0x%04x rev2 = 0x%04x\n",
987 client->name, state->rev1, state->rev2); 998 client->name, state->rev1, state->rev2);
988 v4l_info(client, "Audio: volume %d%s\n", 999 v4l_info(client, "Audio: volume %d%s\n",
989 state->volume, state->muted ? " (muted)" : ""); 1000 state->volume, state->muted ? " (muted)" : "");
990 if (state->has_sound_processing) { 1001 if (state->has_sound_processing) {
991 v4l_info(client, "Audio: balance %d bass %d treble %d loudness %s\n", 1002 v4l_info(client, "Audio: balance %d bass %d treble %d loudness %s\n",
992 state->balance, state->bass, state->treble, 1003 state->balance, state->bass, state->treble,
993 state->loudness ? "on" : "off"); 1004 state->loudness ? "on" : "off");
994 } 1005 }
995 v4l_info(client, "Mode: %s (%s%s)\n", msp_standard_mode_name(state->mode), 1006 switch (state->mode) {
996 (state->rxsubchans & V4L2_TUNER_SUB_STEREO) ? "stereo" : "mono", 1007 case MSP_MODE_AM_DETECT: p = "AM (for carrier detect)"; break;
997 (state->rxsubchans & V4L2_TUNER_SUB_LANG2) ? ", dual" : ""); 1008 case MSP_MODE_FM_RADIO: p = "FM Radio"; break;
998 v4l_info(client, "ACB: 0x%04x\n", state->acb); 1009 case MSP_MODE_FM_TERRA: p = "Terrestial FM-mono + FM-stereo"; break;
1010 case MSP_MODE_FM_SAT: p = "Satellite FM-mono"; break;
1011 case MSP_MODE_FM_NICAM1: p = "NICAM/FM (B/G, D/K)"; break;
1012 case MSP_MODE_FM_NICAM2: p = "NICAM/FM (I)"; break;
1013 case MSP_MODE_AM_NICAM: p = "NICAM/AM (L)"; break;
1014 case MSP_MODE_BTSC: p = "BTSC"; break;
1015 case MSP_MODE_EXTERN: p = "External input"; break;
1016 default: p = "unknown"; break;
1017 }
1018 if (state->opmode == OPMODE_MANUAL) {
1019 v4l_info(client, "Mode: %s (%s%s)\n", p,
1020 (state->rxsubchans & V4L2_TUNER_SUB_STEREO) ? "stereo" : "mono",
1021 (state->rxsubchans & V4L2_TUNER_SUB_LANG2) ? ", dual" : "");
1022 } else {
1023 v4l_info(client, "Mode: %s\n", p);
1024 v4l_info(client, "Standard: %s (%s%s)\n",
1025 msp_standard_std_name(state->std),
1026 (state->rxsubchans & V4L2_TUNER_SUB_STEREO) ? "stereo" : "mono",
1027 (state->rxsubchans & V4L2_TUNER_SUB_LANG2) ? ", dual" : "");
1028 }
1029 v4l_info(client, "ACB: 0x%04x\n", state->acb);
999 break; 1030 break;
1031 }
1000 1032
1001 default: 1033 default:
1002 /* nothing */ 1034 /* nothing */
@@ -1061,7 +1093,7 @@ static int msp_attach(struct i2c_adapter *adapter, int address, int kind)
1061 i2c_set_clientdata(client, state); 1093 i2c_set_clientdata(client, state);
1062 1094
1063 memset(state, 0, sizeof(*state)); 1095 memset(state, 0, sizeof(*state));
1064 state->std = V4L2_STD_NTSC; 1096 state->v4l2_std = V4L2_STD_NTSC;
1065 state->volume = 58880; /* 0db gain */ 1097 state->volume = 58880; /* 0db gain */
1066 state->balance = 32768; /* 0db gain */ 1098 state->balance = 32768; /* 0db gain */
1067 state->bass = 32768; 1099 state->bass = 32768;
@@ -1109,6 +1141,8 @@ static int msp_attach(struct i2c_adapter *adapter, int address, int kind)
1109 state->has_scart23_in_scart2_out = msp_family >= 4 || msp_prod_lo < 5; 1141 state->has_scart23_in_scart2_out = msp_family >= 4 || msp_prod_lo < 5;
1110 /* Has scart2 a volume control? Not in pre-D revisions. */ 1142 /* Has scart2 a volume control? Not in pre-D revisions. */
1111 state->has_scart2_out_volume = msp_revision > 'C' && state->has_scart23_in_scart2_out; 1143 state->has_scart2_out_volume = msp_revision > 'C' && state->has_scart23_in_scart2_out;
1144 /* Has a configurable i2s out? */
1145 state->has_i2s_conf = msp_revision >= 'G' && msp_prod_lo < 7;
1112 /* Has subwoofer output: not in pre-D revs and not in stripped down products */ 1146 /* Has subwoofer output: not in pre-D revs and not in stripped down products */
1113 state->has_subwoofer = msp_revision >= 'D' && msp_prod_lo < 5; 1147 state->has_subwoofer = msp_revision >= 'D' && msp_prod_lo < 5;
1114 /* Has soundprocessing (bass/treble/balance/loudness/equalizer): not in 1148 /* Has soundprocessing (bass/treble/balance/loudness/equalizer): not in