From patchwork Fri Jan 23 15:52:25 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lars-Peter Clausen X-Patchwork-Id: 5695141 Return-Path: X-Original-To: patchwork-linux-media@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 6481FC058D for ; Fri, 23 Jan 2015 15:53:10 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 736A6200E5 for ; Fri, 23 Jan 2015 15:53:09 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 3210520109 for ; Fri, 23 Jan 2015 15:53:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755839AbbAWPxF (ORCPT ); Fri, 23 Jan 2015 10:53:05 -0500 Received: from smtp-out-190.synserver.de ([212.40.185.190]:1123 "EHLO smtp-out-190.synserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755595AbbAWPwn (ORCPT ); Fri, 23 Jan 2015 10:52:43 -0500 Received: (qmail 16323 invoked by uid 0); 23 Jan 2015 15:52:41 -0000 X-SynServer-TrustedSrc: 1 X-SynServer-AuthUser: lars@metafoo.de X-SynServer-PPID: 15834 Received: from p4fc46056.dip0.t-ipconnect.de (HELO lars-adi-laptop.analog.com) [79.196.96.86] by 217.119.54.81 with SMTP; 23 Jan 2015 15:52:40 -0000 From: Lars-Peter Clausen To: Hans Verkuil Cc: Sergei Shtylyov , Vladimir Barinov , =?UTF-8?q?Richard=20R=C3=B6jfors?= , Federico Vaga , linux-media@vger.kernel.org, Lars-Peter Clausen Subject: [PATCH v2 06/15] [media] adv7180: Reset the device before initialization Date: Fri, 23 Jan 2015 16:52:25 +0100 Message-Id: <1422028354-31891-7-git-send-email-lars@metafoo.de> X-Mailer: git-send-email 1.8.0 In-Reply-To: <1422028354-31891-1-git-send-email-lars@metafoo.de> References: <1422028354-31891-1-git-send-email-lars@metafoo.de> Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Reset the device when initializing it so it is in a good known state and the assumed register settings matche the actual register settings. Signed-off-by: Lars-Peter Clausen Acked-by: Hans Verkuil --- drivers/media/i2c/adv7180.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/drivers/media/i2c/adv7180.c b/drivers/media/i2c/adv7180.c index cc05db9..eeb5a4a 100644 --- a/drivers/media/i2c/adv7180.c +++ b/drivers/media/i2c/adv7180.c @@ -30,6 +30,7 @@ #include #include #include +#include #define ADV7180_REG_INPUT_CONTROL 0x0000 #define ADV7180_INPUT_CONTROL_AD_PAL_BG_NTSC_J_SECAM 0x00 @@ -524,6 +525,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) { @@ -696,14 +700,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; }