aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/i2c
diff options
context:
space:
mode:
authorLars-Peter Clausen <lars@metafoo.de>2015-01-23 10:52:25 -0500
committerMauro Carvalho Chehab <mchehab@osg.samsung.com>2015-02-02 08:40:50 -0500
commitc18818e99067ea084e07cbb9a590389180252b7e (patch)
treeeb509326979a6e561b0d1a7d6b0d142ea315bbc4 /drivers/media/i2c
parent3999e5d01da74f1a22afbb0b61b3992fea301478 (diff)
[media] adv7180: Reset the device before initialization
Reset the device when initializing it so it is in a good known state and the assumed register settings matches the actual register settings. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Acked-by: Federico Vaga <federico.vaga@gmail.com> Acked-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Diffstat (limited to 'drivers/media/i2c')
-rw-r--r--drivers/media/i2c/adv7180.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/drivers/media/i2c/adv7180.c b/drivers/media/i2c/adv7180.c
index 432a756f8e1d..44a2832d8d11 100644
--- a/drivers/media/i2c/adv7180.c
+++ b/drivers/media/i2c/adv7180.c
@@ -30,6 +30,7 @@
30#include <media/v4l2-device.h> 30#include <media/v4l2-device.h>
31#include <media/v4l2-ctrls.h> 31#include <media/v4l2-ctrls.h>
32#include <linux/mutex.h> 32#include <linux/mutex.h>
33#include <linux/delay.h>
33 34
34#define ADV7180_REG_INPUT_CONTROL 0x0000 35#define ADV7180_REG_INPUT_CONTROL 0x0000
35#define ADV7180_INPUT_CONTROL_AD_PAL_BG_NTSC_J_SECAM 0x00 36#define ADV7180_INPUT_CONTROL_AD_PAL_BG_NTSC_J_SECAM 0x00
@@ -523,6 +524,9 @@ static int init_device(struct adv7180_state *state)
523 524
524 mutex_lock(&state->mutex); 525 mutex_lock(&state->mutex);
525 526
527 adv7180_write(state, ADV7180_REG_PWR_MAN, ADV7180_PWR_MAN_RES);
528 usleep_range(2000, 10000);
529
526 /* Initialize adv7180 */ 530 /* Initialize adv7180 */
527 /* Enable autodetection */ 531 /* Enable autodetection */
528 if (state->autodetect) { 532 if (state->autodetect) {
@@ -692,14 +696,14 @@ static int adv7180_resume(struct device *dev)
692 struct adv7180_state *state = to_state(sd); 696 struct adv7180_state *state = to_state(sd);
693 int ret; 697 int ret;
694 698
695 if (state->powered) {
696 ret = adv7180_set_power(state, true);
697 if (ret)
698 return ret;
699 }
700 ret = init_device(state); 699 ret = init_device(state);
701 if (ret < 0) 700 if (ret < 0)
702 return ret; 701 return ret;
702
703 ret = adv7180_set_power(state, state->powered);
704 if (ret)
705 return ret;
706
703 return 0; 707 return 0;
704} 708}
705 709