diff options
author | Liu Ying <Ying.Liu@freescale.com> | 2014-05-21 01:36:02 -0400 |
---|---|---|
committer | Liu Ying <Ying.Liu@freescale.com> | 2014-05-21 04:05:40 -0400 |
commit | 38fd110b550358057990d176c7ff27b45fde5939 (patch) | |
tree | ca58b34e89f7c6208ecfa05cf3e18733c0bd828b /drivers/media | |
parent | c8d4855ce8c6669534bfe109d0c6863834f12290 (diff) |
ENGR00313867 media: mxc: ADV7180: Get standard when the chip is locked
The IN_LOCK bit of the ADV7180 register STATUS_1(0x10) indicates if
the chip is locked or not in auto detection mode. We should get
valid standard when the chip is locked, otherwise, invalid standard
should be returned. This patch checks the IN_LOCK bit when we get
standard in auto detection mode.
Conflicts:
drivers/media/video/mxc/capture/adv7180.c
Signed-off-by: Liu Ying <Ying.Liu@freescale.com>
(cherry picked from commit c0d94e51b331002c11ebdfc8a559c8ec878894d6)
Diffstat (limited to 'drivers/media')
-rw-r--r-- | drivers/media/platform/mxc/capture/adv7180.c | 34 |
1 files changed, 16 insertions, 18 deletions
diff --git a/drivers/media/platform/mxc/capture/adv7180.c b/drivers/media/platform/mxc/capture/adv7180.c index ae17d7f25ff6..3e3b5454e92e 100644 --- a/drivers/media/platform/mxc/capture/adv7180.c +++ b/drivers/media/platform/mxc/capture/adv7180.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright 2005-2013 Freescale Semiconductor, Inc. All Rights Reserved. | 2 | * Copyright 2005-2014 Freescale Semiconductor, Inc. All Rights Reserved. |
3 | */ | 3 | */ |
4 | 4 | ||
5 | /* | 5 | /* |
@@ -311,28 +311,26 @@ static int adv7180_write_reg(u8 reg, u8 val) | |||
311 | */ | 311 | */ |
312 | static void adv7180_get_std(v4l2_std_id *std) | 312 | static void adv7180_get_std(v4l2_std_id *std) |
313 | { | 313 | { |
314 | int tmp; | 314 | int status_1, standard, idx; |
315 | int idx; | 315 | bool locked; |
316 | 316 | ||
317 | dev_dbg(&adv7180_data.sen.i2c_client->dev, "In adv7180_get_std\n"); | 317 | dev_dbg(&adv7180_data.sen.i2c_client->dev, "In adv7180_get_std\n"); |
318 | 318 | ||
319 | /* Read the AD_RESULT to get the detect output video standard */ | 319 | status_1 = adv7180_read(ADV7180_STATUS_1); |
320 | tmp = adv7180_read(ADV7180_STATUS_1) & 0x70; | 320 | locked = status_1 & 0x1; |
321 | standard = status_1 & 0x70; | ||
321 | 322 | ||
322 | mutex_lock(&mutex); | 323 | mutex_lock(&mutex); |
323 | if (tmp == 0x40) { | 324 | *std = V4L2_STD_ALL; |
324 | /* PAL */ | 325 | idx = ADV7180_NOT_LOCKED; |
325 | *std = V4L2_STD_PAL; | 326 | if (locked) { |
326 | idx = ADV7180_PAL; | 327 | if (standard == 0x40) { |
327 | } else if (tmp == 0) { | 328 | *std = V4L2_STD_PAL; |
328 | /*NTSC*/ | 329 | idx = ADV7180_PAL; |
329 | *std = V4L2_STD_NTSC; | 330 | } else if (standard == 0) { |
330 | idx = ADV7180_NTSC; | 331 | *std = V4L2_STD_NTSC; |
331 | } else { | 332 | idx = ADV7180_NTSC; |
332 | *std = V4L2_STD_ALL; | 333 | } |
333 | idx = ADV7180_NOT_LOCKED; | ||
334 | dev_dbg(&adv7180_data.sen.i2c_client->dev, | ||
335 | "Got invalid video standard!\n"); | ||
336 | } | 334 | } |
337 | mutex_unlock(&mutex); | 335 | mutex_unlock(&mutex); |
338 | 336 | ||