V4L/DVB (3578): Make scart definitions easier to handle
authorHans Verkuil <hverkuil@xs4all.nl>
Sun, 19 Mar 2006 09:48:51 +0000 (06:48 -0300)
committerMauro Carvalho Chehab <mchehab@infradead.org>
Fri, 24 Mar 2006 19:26:56 +0000 (16:26 -0300)
For the new routing implementation it is easier if all the 'normal'
scart inputs (IN1-IN4) are consecutive.

Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
drivers/media/video/msp3400-driver.c
drivers/media/video/msp3400.h

index bd0b036c5cab25cf912745bda11450a9594a0062..db6a52771c1b361998bf4bc45823d38dea55589a 100644 (file)
@@ -245,31 +245,31 @@ int msp_write_dsp(struct i2c_client *client, int addr, int val)
  * ----------------------------------------------------------------------- */
 
 static int scarts[3][9] = {
-       /* MASK    IN1     IN2     IN1_DA  IN2_DA  IN3     IN4     MONO    MUTE   */
+       /* MASK   IN1     IN2     IN3     IN4     IN1_DA  IN2_DA  MONO    MUTE   */
        /* SCART DSP Input select */
-       { 0x0320, 0x0000, 0x0200, -1,     -1,     0x0300, 0x0020, 0x0100, 0x0320 },
+       { 0x0320, 0x0000, 0x0200, 0x0300, 0x0020, -1,     -1,     0x0100, 0x0320 },
        /* SCART1 Output select */
-       { 0x0c40, 0x0440, 0x0400, 0x0c00, 0x0040, 0x0000, 0x0840, 0x0800, 0x0c40 },
+       { 0x0c40, 0x0440, 0x0400, 0x0000, 0x0840, 0x0c00, 0x0040, 0x0800, 0x0c40 },
        /* SCART2 Output select */
-       { 0x3080, 0x1000, 0x1080, 0x0000, 0x0080, 0x2080, 0x3080, 0x2000, 0x3000 },
+       { 0x3080, 0x1000, 0x1080, 0x2080, 0x3080, 0x0000, 0x0080, 0x2000, 0x3000 },
 };
 
 static char *scart_names[] = {
-       "mask", "in1", "in2", "in1 da", "in2 da", "in3", "in4", "mono", "mute"
+       "in1", "in2", "in3", "in4", "in1 da", "in2 da", "mono", "mute"
 };
 
 void msp_set_scart(struct i2c_client *client, int in, int out)
 {
        struct msp_state *state = i2c_get_clientdata(client);
 
-       state->in_scart=in;
+       state->in_scart = in;
 
-       if (in >= 1 && in <= 8 && out >= 0 && out <= 2) {
-               if (-1 == scarts[out][in])
+       if (in >= 0 && in <= 7 && out >= 0 && out <= 2) {
+               if (-1 == scarts[out][in + 1])
                        return;
 
-               state->acb &= ~scarts[out][SCART_MASK];
-               state->acb |=  scarts[out][in];
+               state->acb &= ~scarts[out][0];
+               state->acb |=  scarts[out][in + 1];
        } else
                state->acb = 0xf60; /* Mute Input and SCART 1 Output */
 
@@ -585,7 +585,7 @@ static int msp_set_ctrl(struct i2c_client *client, struct v4l2_control *ctrl)
 static int msp_command(struct i2c_client *client, unsigned int cmd, void *arg)
 {
        struct msp_state *state = i2c_get_clientdata(client);
-       int scart = 0;
+       int scart = -1;
 
        if (msp_debug >= 2)
                v4l_i2c_print_ioctl(client, cmd);
@@ -694,7 +694,7 @@ static int msp_command(struct i2c_client *client, unsigned int cmd, void *arg)
        {
                struct msp_matrix *mspm = arg;
 
-               msp_set_scart(client, mspm->input, mspm->output);
+               msp_set_scart(client, mspm->input - 1, mspm->output);
                break;
        }
 
@@ -735,7 +735,7 @@ static int msp_command(struct i2c_client *client, unsigned int cmd, void *arg)
                        state->mode = -1;
                        break;
                }
-               if (scart) {
+               if (scart >= 0) {
                        state->rxsubchans = V4L2_TUNER_SUB_STEREO;
                        msp_set_scart(client, scart, 0);
                        msp_write_dsp(client, 0x000d, 0x1900);
@@ -885,12 +885,14 @@ static int msp_command(struct i2c_client *client, unsigned int cmd, void *arg)
                                (state->rxsubchans & V4L2_TUNER_SUB_STEREO) ? "stereo" : "mono",
                                (state->rxsubchans & V4L2_TUNER_SUB_LANG2) ? ", dual" : "");
                } else {
-                       v4l_info(client, "Mode:     %s\n", p);
+                       if (state->opmode == OPMODE_AUTODETECT)
+                               v4l_info(client, "Mode:     %s\n", p);
                        v4l_info(client, "Standard: %s (%s%s)\n",
                                msp_standard_std_name(state->std),
                                (state->rxsubchans & V4L2_TUNER_SUB_STEREO) ? "stereo" : "mono",
                                (state->rxsubchans & V4L2_TUNER_SUB_LANG2) ? ", dual" : "");
                }
+               v4l_info(client, "Audmode:  0x%04x\n", state->audmode);
                v4l_info(client, "ACB:      0x%04x\n", state->acb);
                break;
        }
index 6fb5c8c994e7dbbca4d34f071f7b90ee43084fdc..7fac3ad6228d8a3083170b8f55eb6d3ef4b3e9a0 100644 (file)
 #define MSP_MODE_BTSC        8
 #define MSP_MODE_EXTERN      9
 
-#define SCART_MASK    0
-#define SCART_IN1     1
-#define SCART_IN2     2
-#define SCART_IN1_DA  3
-#define SCART_IN2_DA  4
-#define SCART_IN3     5
-#define SCART_IN4     6
-#define SCART_MONO    7
-#define SCART_MUTE    8
+#define SCART_IN1     0
+#define SCART_IN2     1
+#define SCART_IN3     2
+#define SCART_IN4     3
+#define SCART_IN1_DA  4
+#define SCART_IN2_DA  5
+#define SCART_MONO    6
+#define SCART_MUTE    7
 
 #define SCART_DSP_IN  0
 #define SCART1_OUT    1