Commit 468a0a54 authored by Mauro Carvalho Chehab's avatar Mauro Carvalho Chehab

[PATCH] V4L/DVB (3189): Fix a broken logic that didn't cover all standards.

- Fix a broken logic that didn't cover all standards.
- Fix compilation failure with gcc 2.95.3.
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@brturbo.com.br>
parent 60edb137
...@@ -333,24 +333,30 @@ static int set_input(struct i2c_client *client, enum cx25840_input input) ...@@ -333,24 +333,30 @@ static int set_input(struct i2c_client *client, enum cx25840_input input)
static int set_v4lstd(struct i2c_client *client, v4l2_std_id std) static int set_v4lstd(struct i2c_client *client, v4l2_std_id std)
{ {
u8 fmt; u8 fmt=0; /* zero is autodetect */
switch (std) { /* First tests should be against specific std */
/* zero is autodetect */ if (std & V4L2_STD_NTSC_M_JP) {
case 0: fmt = 0x0; break; fmt=0x2;
/* default ntsc to ntsc-m */ } else if (std & V4L2_STD_NTSC_443) {
case V4L2_STD_NTSC: fmt=0x3;
case V4L2_STD_NTSC_M: fmt = 0x1; break; } else if (std & V4L2_STD_PAL_M) {
case V4L2_STD_NTSC_M_JP: fmt = 0x2; break; fmt=0x5;
case V4L2_STD_NTSC_443: fmt = 0x3; break; } else if (std & V4L2_STD_PAL_N) {
case V4L2_STD_PAL: fmt = 0x4; break; fmt=0x6;
case V4L2_STD_PAL_M: fmt = 0x5; break; } else if (std & V4L2_STD_PAL_Nc) {
case V4L2_STD_PAL_N: fmt = 0x6; break; fmt=0x7;
case V4L2_STD_PAL_Nc: fmt = 0x7; break; } else if (std & V4L2_STD_PAL_60) {
case V4L2_STD_PAL_60: fmt = 0x8; break; fmt=0x8;
case V4L2_STD_SECAM: fmt = 0xc; break; } else {
default: /* Then, test against generic ones */
return -ERANGE; if (std & V4L2_STD_NTSC) {
fmt=0x1;
} else if (std & V4L2_STD_PAL) {
fmt=0x4;
} else if (std & V4L2_STD_SECAM) {
fmt=0xc;
}
} }
cx25840_and_or(client, 0x400, ~0xf, fmt); cx25840_and_or(client, 0x400, ~0xf, fmt);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment