media: cx231xx: Fix the S-Video capture on August VGB100
authorFabio Luongo <f.langufo.l@gmail.com>
Fri, 27 Sep 2024 13:38:41 +0000 (15:38 +0200)
committerHans Verkuil <hverkuil-cisco@xs4all.nl>
Sat, 12 Oct 2024 14:28:26 +0000 (16:28 +0200)
There are three separate issues preventing color capture with S-Video
on August VGB100 with the cx231xx driver (same vid/pid as OTG102):

1. `cx231xx_set_decoder_video_input` is called with a u32 passed
   as its third argument, yet this functions expects a u8 instead.
   Some information about the configuration of the video mux is lost
   in the conversion, so that ch2 and ch3 do not get set by
   `cx231xx_afe_set_input_mux` (expecting a u32 but being passed a u8).

2. The input pin for the chroma signal is not correctly specified
   in cx231xx-cards.c, which can be verified by looking at the inf file
   coming with the VGB100 and OTG102' drivers for Windows.
   The mistake in the cx231xx driver likely stems from a wrong comment
   in the same file, suggesting VIN1_2 for chroma,
   while VIN3_2 is actually used.

3. Even after fixing the two issues above, the captured stream remains
   essentially B&W (although acquiring some pale green shades, suggesting
   we're moving in the right direction).
   After tests with somewhat random changes, it was found that removing
   `CX25840_SVIDEO_ON` from the vmux configuration in cx231xx-cards.c
   results in a captured stream with the expected colors.

Signed-off-by: Fabio Luongo <f.langufo.l@gmail.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
drivers/media/usb/cx231xx/cx231xx-avcore.c
drivers/media/usb/cx231xx/cx231xx-cards.c
drivers/media/usb/cx231xx/cx231xx.h

index 3d3c881c8e587a66778085563cc8e43af09c5ce8..9025693bc29503f4c0221bc605b58ef566623277 100644 (file)
@@ -623,7 +623,7 @@ int cx231xx_set_video_input_mux(struct cx231xx *dev, u8 input)
 }
 
 int cx231xx_set_decoder_video_input(struct cx231xx *dev,
-                               u8 pin_type, u8 input)
+                               u8 pin_type, u32 input)
 {
        int status = 0;
        u32 value = 0;
index 92efe6c1f47bae122a114916be50ced0564a8f62..f68a6ab9d5aa71c1f075c463635d26ff107f6a90 100644 (file)
@@ -679,8 +679,7 @@ struct cx231xx_board cx231xx_boards[] = {
                        }, {
                                .type = CX231XX_VMUX_SVIDEO,
                                .vmux = CX231XX_VIN_1_1 |
-                                       (CX231XX_VIN_1_2 << 8) |
-                                       CX25840_SVIDEO_ON,
+                                       (CX231XX_VIN_3_2 << 8),
                                .amux = CX231XX_AMUX_LINE_IN,
                                .gpio = NULL,
                        }
index 74339a6a2f718436dc4c13889eef5017e630959b..228ecea4cfe4694be1b891e3a6a345a71e791ce6 100644 (file)
@@ -916,7 +916,7 @@ int cx231xx_enable_i2c_port_3(struct cx231xx *dev, bool is_port_3);
 /* video audio decoder related functions */
 void video_mux(struct cx231xx *dev, int index);
 int cx231xx_set_video_input_mux(struct cx231xx *dev, u8 input);
-int cx231xx_set_decoder_video_input(struct cx231xx *dev, u8 pin_type, u8 input);
+int cx231xx_set_decoder_video_input(struct cx231xx *dev, u8 pin_type, u32 input);
 int cx231xx_do_mode_ctrl_overrides(struct cx231xx *dev);
 int cx231xx_set_audio_input(struct cx231xx *dev, u8 input);