V4L/DVB (8019): New for I2S on for MPEG of saa7134_empress
authorDmitry Belimov <d.belimov@gmail.com>
Tue, 10 Jun 2008 15:43:58 +0000 (12:43 -0300)
committerMauro Carvalho Chehab <mchehab@infradead.org>
Sun, 20 Jul 2008 10:09:03 +0000 (07:09 -0300)
Rework saa7134_enable_i2s function. Remove vendor specific data.
Configure I2S output port specific for model of SAA7133/5-SAA7134.
I think it is more good.
Renamed definition of I2S audio output control register. It`s SAA7133/5 register
Start video port after configuring procedure.

Signed-off-by: Beholder Intl. Ltd. Dmitry Belimov <d.belimov@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
drivers/media/video/saa7134/saa7134-reg.h
drivers/media/video/saa7134/saa7134-tvaudio.c
drivers/media/video/saa7134/saa7134-video.c

index 258792c1784e180c07771ea279e198622bbe015e..cf89d96d7295221c77189d8e24799f7555a4d232 100644 (file)
 
 /* I2S output */
 #define SAA7134_I2S_AUDIO_OUTPUT                0x1c0
-#define SAA7134_I2S_AUDIO_CONTROL               0x591
 
 /* test modes */
 #define SAA7134_SPECIAL_MODE                    0x1d0
 #define SAA7135_DSP_RWCLEAR                    0x586
 #define SAA7135_DSP_RWCLEAR_RERR                   1
 
+#define SAA7133_I2S_AUDIO_CONTROL               0x591
 /* ------------------------------------------------------------------ */
 /*
  * Local variables:
index 460d4a35e5f109e540baa5a56aa3d787f06cbdd2..4cc3741c54725dc6b9aeca4d1574ee39bb8eb8d5 100644 (file)
@@ -874,23 +874,32 @@ void saa7134_enable_i2s(struct saa7134_dev *dev)
        if (!card_is_empress(dev))
                return;
 
-       switch (dev->board) {
-       case SAA7134_BOARD_BEHOLD_M6:
-           /* configure GPIO for out audio */
-           saa_andorl(SAA7134_GPIO_GPMODE0 >> 2, 0x0E000000, 0x00000000);
-           /* Set I2S format  */
-           saa_writeb(SAA7134_I2S_AUDIO_CONTROL,  0x00);
+       if (dev->pci->device == PCI_DEVICE_ID_PHILIPS_SAA7130)
+               return;
+
+       /* configure GPIO for out */
+       saa_andorl(SAA7134_GPIO_GPMODE0 >> 2, 0x0E000000, 0x00000000);
+
+       switch (dev->pci->device) {
+       case PCI_DEVICE_ID_PHILIPS_SAA7133:
+       case PCI_DEVICE_ID_PHILIPS_SAA7135:
+           /* Set I2S format (SONY)  */
+           saa_writeb(SAA7133_I2S_AUDIO_CONTROL, 0x00);
            /* Start I2S */
-           saa_writeb(SAA7134_I2S_AUDIO_OUTPUT,   0x11);
+           saa_writeb(SAA7134_I2S_AUDIO_OUTPUT, 0x11);
            break;
-       default:
+
+       case PCI_DEVICE_ID_PHILIPS_SAA7134:
            i2s_format = (dev->input->amux == TV) ? 0x00 : 0x01;
 
            /* enable I2S audio output for the mpeg encoder */
-           saa_writeb(SAA7134_I2S_OUTPUT_SELECT,  0x80);
-           saa_writeb(SAA7134_I2S_OUTPUT_FORMAT,  i2s_format);
-           saa_writeb(SAA7134_I2S_OUTPUT_LEVEL,   0x0F);
-           saa_writeb(SAA7134_I2S_AUDIO_OUTPUT,   0x01);
+           saa_writeb(SAA7134_I2S_OUTPUT_SELECT, 0x80);
+           saa_writeb(SAA7134_I2S_OUTPUT_FORMAT, i2s_format);
+           saa_writeb(SAA7134_I2S_OUTPUT_LEVEL,  0x0F);
+           saa_writeb(SAA7134_I2S_AUDIO_OUTPUT,  0x01);
+
+       default:
+           break;
        }
 }
 
index bba23219ce945db96f3f7f7713bd3cc696c77836..8a8b3e118f8bd18935b3fb9ae8846e611c57cbf8 100644 (file)
@@ -2458,13 +2458,14 @@ int saa7134_videoport_init(struct saa7134_dev *dev)
        int vo = saa7134_boards[dev->board].video_out;
        int video_reg;
        unsigned int vid_port_opts = saa7134_boards[dev->board].vid_port_opts;
+
+       /* Configure videoport */
        saa_writeb(SAA7134_VIDEO_PORT_CTRL0, video_out[vo][0]);
        video_reg = video_out[vo][1];
        if (vid_port_opts & SET_T_CODE_POLARITY_NON_INVERTED)
                video_reg &= ~VP_T_CODE_P_INVERTED;
        saa_writeb(SAA7134_VIDEO_PORT_CTRL1, video_reg);
        saa_writeb(SAA7134_VIDEO_PORT_CTRL2, video_out[vo][2]);
-       saa_writeb(SAA7134_VIDEO_PORT_CTRL3, video_out[vo][3]);
        saa_writeb(SAA7134_VIDEO_PORT_CTRL4, video_out[vo][4]);
        video_reg = video_out[vo][5];
        if (vid_port_opts & SET_CLOCK_NOT_DELAYED)
@@ -2481,6 +2482,9 @@ int saa7134_videoport_init(struct saa7134_dev *dev)
        saa_writeb(SAA7134_VIDEO_PORT_CTRL7, video_out[vo][7]);
        saa_writeb(SAA7134_VIDEO_PORT_CTRL8, video_out[vo][8]);
 
+       /* Start videoport */
+       saa_writeb(SAA7134_VIDEO_PORT_CTRL3, video_out[vo][3]);
+
        return 0;
 }