From patchwork Tue Jul 25 02:34:01 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jacob Chen X-Patchwork-Id: 9861061 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 0278060385 for ; Tue, 25 Jul 2017 02:35:03 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E2A60205F8 for ; Tue, 25 Jul 2017 02:35:02 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D36F825F3E; Tue, 25 Jul 2017 02:35:02 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.4 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DBE8524B44 for ; Tue, 25 Jul 2017 02:35:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755638AbdGYCe5 (ORCPT ); Mon, 24 Jul 2017 22:34:57 -0400 Received: from mail-pf0-f195.google.com ([209.85.192.195]:35592 "EHLO mail-pf0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755484AbdGYCe5 (ORCPT ); Mon, 24 Jul 2017 22:34:57 -0400 Received: by mail-pf0-f195.google.com with SMTP id q85so11832812pfq.2; Mon, 24 Jul 2017 19:34:56 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=xkqiyV5z83E40Rsog5pBmVZdjIwLhJnbd1bH7m2ZK+Y=; b=aqlwAoVavsVkSkh8hTD7zlilKpQ4HwU5UyQ0HwoZlyIbDBA60+e6R249pL04J9chTm tPWD/n5KAUPZRLKCvjyafeb5d1AZwDTcvPRr9IauKPRFuiIlgDLQtRN9/eLm8zGGMQmu Fn5a2QNlmQKlgy00nSxdgpWGplRDzwiP++meV3osiSOiLBd+TNG+36t6crfh4kJUPx1W FmloUb93nj2x1f8L/LSytZWji9UkaOEu82fMcFtTgvVTTb//D17JdMFn5Ajuvlt8YrmW +XRbivK5aqKtGm962UIP4WIwxpLlmnfQq1MlVPmr+FlL06zJThJ4f7s3LGcnascYlWfq T0Jw== X-Gm-Message-State: AIVw110Rr5cI0Ho9IKDtFsDkpLWhRFr2Yp/Dyv21v2k4c26h5oPWuHsp q3cAy417GYKbdK70 X-Received: by 10.98.29.72 with SMTP id d69mr11679678pfd.226.1500950096426; Mon, 24 Jul 2017 19:34:56 -0700 (PDT) Received: from localhost.localdomain ([103.29.142.67]) by smtp.gmail.com with ESMTPSA id f15sm24491144pfj.127.2017.07.24.19.34.52 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 24 Jul 2017 19:34:55 -0700 (PDT) From: Jacob Chen To: linux-rockchip@lists.infradead.org Cc: linux-kernel@vger.kernel.org, roliveir@synopsys.com, linux-media@vger.kernel.org, mchehab@kernel.org, vladimir_zapolskiy@mentor.com, hans.verkuil@cisco.com, sakari.ailus@linux.intel.com, Jacob Chen Subject: [PATCH] media: i2c: OV5647: gate clock lane before stream on Date: Tue, 25 Jul 2017 10:34:01 +0800 Message-Id: <1500950041-5449-1-git-send-email-jacob-chen@iotwrt.com> X-Mailer: git-send-email 2.7.4 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP According to datasheet, BIT5 in reg-0x4800 are used to enable/disable clock lane gate. It's wrong to make clock lane free running before sensor stream on was called, while the mipi phy are not initialized. Signed-off-by: Jacob Chen --- drivers/media/i2c/ov5647.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/drivers/media/i2c/ov5647.c b/drivers/media/i2c/ov5647.c index 95ce90f..d3e6fd0 100644 --- a/drivers/media/i2c/ov5647.c +++ b/drivers/media/i2c/ov5647.c @@ -253,6 +253,10 @@ static int ov5647_stream_on(struct v4l2_subdev *sd) { int ret; + ret = ov5647_write(sd, 0x4800, 0x04); + if (ret < 0) + return ret; + ret = ov5647_write(sd, 0x4202, 0x00); if (ret < 0) return ret; @@ -264,6 +268,10 @@ static int ov5647_stream_off(struct v4l2_subdev *sd) { int ret; + ret = ov5647_write(sd, 0x4800, 0x25); + if (ret < 0) + return ret; + ret = ov5647_write(sd, 0x4202, 0x0f); if (ret < 0) return ret; @@ -320,7 +328,7 @@ static int __sensor_init(struct v4l2_subdev *sd) return ret; } - return ov5647_write(sd, 0x4800, 0x04); + return ov5647_stream_off(sd); } static int ov5647_sensor_power(struct v4l2_subdev *sd, int on)