summaryrefslogtreecommitdiffstats
path: root/drivers/media/i2c
diff options
context:
space:
mode:
authorLars-Peter Clausen <lars@metafoo.de>2015-01-23 16:52:25 +0100
committerMauro Carvalho Chehab <mchehab@osg.samsung.com>2015-02-02 14:40:50 +0100
commitc18818e99067ea084e07cbb9a590389180252b7e (patch)
treeeb509326979a6e561b0d1a7d6b0d142ea315bbc4 /drivers/media/i2c
parent[media] adv7180: Do implicit register paging (diff)
downloadlinux-c18818e99067ea084e07cbb9a590389180252b7e.tar.xz
linux-c18818e99067ea084e07cbb9a590389180252b7e.zip
[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 @@
#include <media/v4l2-device.h>
#include <media/v4l2-ctrls.h>
#include <linux/mutex.h>
+#include <linux/delay.h>
#define ADV7180_REG_INPUT_CONTROL 0x0000
#define ADV7180_INPUT_CONTROL_AD_PAL_BG_NTSC_J_SECAM 0x00
@@ -523,6 +524,9 @@ static int init_device(struct adv7180_state *state)
mutex_lock(&state->mutex);
+ adv7180_write(state, ADV7180_REG_PWR_MAN, ADV7180_PWR_MAN_RES);
+ usleep_range(2000, 10000);
+
/* Initialize adv7180 */
/* Enable autodetection */
if (state->autodetect) {
@@ -692,14 +696,14 @@ static int adv7180_resume(struct device *dev)
struct adv7180_state *state = to_state(sd);
int ret;
- if (state->powered) {
- ret = adv7180_set_power(state, true);
- if (ret)
- return ret;
- }
ret = init_device(state);
if (ret < 0)
return ret;
+
+ ret = adv7180_set_power(state, state->powered);
+ if (ret)
+ return ret;
+
return 0;
}