diff options
-rw-r--r-- | drivers/media/video/cx25840/cx25840-core.c | 42 |
1 files changed, 24 insertions, 18 deletions
diff --git a/drivers/media/video/cx25840/cx25840-core.c b/drivers/media/video/cx25840/cx25840-core.c index aea3f038cff6..5b93723a1768 100644 --- a/drivers/media/video/cx25840/cx25840-core.c +++ b/drivers/media/video/cx25840/cx25840-core.c | |||
@@ -333,24 +333,30 @@ static int set_input(struct i2c_client *client, enum cx25840_input input) | |||
333 | 333 | ||
334 | static int set_v4lstd(struct i2c_client *client, v4l2_std_id std) | 334 | static int set_v4lstd(struct i2c_client *client, v4l2_std_id std) |
335 | { | 335 | { |
336 | u8 fmt; | 336 | u8 fmt=0; /* zero is autodetect */ |
337 | 337 | ||
338 | switch (std) { | 338 | /* First tests should be against specific std */ |
339 | /* zero is autodetect */ | 339 | if (std & V4L2_STD_NTSC_M_JP) { |
340 | case 0: fmt = 0x0; break; | 340 | fmt=0x2; |
341 | /* default ntsc to ntsc-m */ | 341 | } else if (std & V4L2_STD_NTSC_443) { |
342 | case V4L2_STD_NTSC: | 342 | fmt=0x3; |
343 | case V4L2_STD_NTSC_M: fmt = 0x1; break; | 343 | } else if (std & V4L2_STD_PAL_M) { |
344 | case V4L2_STD_NTSC_M_JP: fmt = 0x2; break; | 344 | fmt=0x5; |
345 | case V4L2_STD_NTSC_443: fmt = 0x3; break; | 345 | } else if (std & V4L2_STD_PAL_N) { |
346 | case V4L2_STD_PAL: fmt = 0x4; break; | 346 | fmt=0x6; |
347 | case V4L2_STD_PAL_M: fmt = 0x5; break; | 347 | } else if (std & V4L2_STD_PAL_Nc) { |
348 | case V4L2_STD_PAL_N: fmt = 0x6; break; | 348 | fmt=0x7; |
349 | case V4L2_STD_PAL_Nc: fmt = 0x7; break; | 349 | } else if (std & V4L2_STD_PAL_60) { |
350 | case V4L2_STD_PAL_60: fmt = 0x8; break; | 350 | fmt=0x8; |
351 | case V4L2_STD_SECAM: fmt = 0xc; break; | 351 | } else { |
352 | default: | 352 | /* Then, test against generic ones */ |
353 | return -ERANGE; | 353 | if (std & V4L2_STD_NTSC) { |
354 | fmt=0x1; | ||
355 | } else if (std & V4L2_STD_PAL) { | ||
356 | fmt=0x4; | ||
357 | } else if (std & V4L2_STD_SECAM) { | ||
358 | fmt=0xc; | ||
359 | } | ||
354 | } | 360 | } |
355 | 361 | ||
356 | cx25840_and_or(client, 0x400, ~0xf, fmt); | 362 | cx25840_and_or(client, 0x400, ~0xf, fmt); |