]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/blobdiff - drivers/media/video/tvp5150.c
V4L/DVB (7094): static memory
[mirror_ubuntu-bionic-kernel.git] / drivers / media / video / tvp5150.c
index 25d0aef88ef51392c69e15992cbc0fbcb93414f9..6a3af1005f03e365f654e826890b7c1b8524474e 100644 (file)
@@ -27,7 +27,7 @@ static unsigned short normal_i2c[] = {
 
 I2C_CLIENT_INSMOD;
 
-static int debug = 0;
+static int debug;
 module_param(debug, int, 0);
 MODULE_PARM_DESC(debug, "Debug level (0-1)");
 
@@ -290,6 +290,7 @@ static inline void tvp5150_selmux(struct i2c_client *c)
        int opmode=0;
        struct tvp5150 *decoder = i2c_get_clientdata(c);
        int input = 0;
+       unsigned char val;
 
        if ((decoder->route.output & TVP5150_BLACK_SCREEN) || !decoder->enable)
                input = 8;
@@ -315,6 +316,16 @@ static inline void tvp5150_selmux(struct i2c_client *c)
 
        tvp5150_write(c, TVP5150_OP_MODE_CTL, opmode);
        tvp5150_write(c, TVP5150_VD_IN_SRC_SEL_1, input);
+
+       /* Svideo should enable YCrCb output and disable GPCL output
+        * For Composite and TV, it should be the reverse
+        */
+       val = tvp5150_read(c, TVP5150_MISC_CTL);
+       if (decoder->route.input == TVP5150_SVIDEO)
+               val = (val & ~0x40) | 0x10;
+       else
+               val = (val & ~0x10) | 0x40;
+       tvp5150_write(c, TVP5150_MISC_CTL, val);
 };
 
 struct i2c_reg_value {
@@ -661,7 +672,7 @@ static int tvp5150_set_vbi(struct i2c_client *c,
        if (std == V4L2_STD_ALL) {
                tvp5150_err("VBI can't be configured without knowing number of lines\n");
                return 0;
-       } else if (std && V4L2_STD_625_50) {
+       } else if (std & V4L2_STD_625_50) {
                /* Don't follow NTSC Line number convension */
                line += 3;
        }
@@ -708,7 +719,7 @@ static int tvp5150_get_vbi(struct i2c_client *c,
        if (std == V4L2_STD_ALL) {
                tvp5150_err("VBI can't be configured without knowing number of lines\n");
                return 0;
-       } else if (std && V4L2_STD_625_50) {
+       } else if (std & V4L2_STD_625_50) {
                /* Don't follow NTSC Line number convension */
                line += 3;
        }
@@ -1061,12 +1072,12 @@ static int tvp5150_detect_client(struct i2c_adapter *adapter,
                return 0;
 
        c = kmalloc(sizeof(struct i2c_client), GFP_KERNEL);
-       if (c == 0)
+       if (!c)
                return -ENOMEM;
        memcpy(c, &client_template, sizeof(struct i2c_client));
 
        core = kzalloc(sizeof(struct tvp5150), GFP_KERNEL);
-       if (core == 0) {
+       if (!core) {
                kfree(c);
                return -ENOMEM;
        }