Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp508562yba; Wed, 15 May 2019 05:21:49 -0700 (PDT) X-Google-Smtp-Source: APXvYqycglgfkq7rZwruQaXYmcWDIWmgtscHAQGmLbyOisnlLVzRuZ4aabcwSrzy+/dg+ZkPuWYT X-Received: by 2002:a17:902:8698:: with SMTP id g24mr45225603plo.151.1557922909058; Wed, 15 May 2019 05:21:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1557922909; cv=none; d=google.com; s=arc-20160816; b=geiUco2fLieELH4q7I/luhUdpXKpvYry0gwWnhsJayAw38I/+Do08hSbh8zSWTzbpG ne9nY645EjrqWXj5OA7Y/qg/6H79WnkqZB6QotIJtLK7eBkTl2+l15iCz4FXF2BWA2Bz kOe1Uh3JLNwyxFRohdKfISSKUHF4MsIB3cWxRxYIv1se30VYKHcK4VEEuMVljknRwF1A KW95j2NsVd4ikbAEDHtRAuPVOHpBW+FAcrmgMJKSCUT6otXIAvSdDvbvQ4zkPxjXsEbd 9C9dEGmNFbc3fdKetXG8q3S3yfzBUkxtYwLGt0iw1M/7Hpd3YnqguLxM86YkdH9hCV7L KqzQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=svckBcuxsQ22w74rPwzUZO8f/53WsZJuqHDZSIO90w4=; b=QkEGxfJIAttAq0sdj0z9IY0/X2QQ4i40C+TSWH2vgvKlGlxQR9KrqeeqfvEhODvHDR yYwea9/HI0jl2HHRQbak5TDUIwvpE1QWjwRkx1f2Yii35lIZDR6NIMU3N3nFpYlQuAwK lw9D29jA6paUiVXv0BB66IpEyo/w0TiUg7sIoWteTXtagBKH6LSoLx3/uAEje1egHMXv Ugywi+MXxsTD7j4LWsYpb7q8Roiqpr/Siuab2ImVoi625R+7XoobzPwzFB+l10vIapsG xIpioM2Rv4aB2A1Gmju79lSPmdEPe/0aRa0aaRGBExVL9rvktXIFf1c1xSm+sA6Iwex0 gfSQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="j/TJrxDH"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j14si1794510pfh.232.2019.05.15.05.21.34; Wed, 15 May 2019 05:21:49 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="j/TJrxDH"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727278AbfEOK7x (ORCPT + 99 others); Wed, 15 May 2019 06:59:53 -0400 Received: from mail.kernel.org ([198.145.29.99]:56502 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726715AbfEOK7w (ORCPT ); Wed, 15 May 2019 06:59:52 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id C10262084E; Wed, 15 May 2019 10:59:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1557917991; bh=y1m3BZBT5j0xD2ZtXIItUoqNCZhpJTQQhzHyJ1ZirYk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=j/TJrxDHdU9BgRhRShY8IKvX/OEkOzW7kJic/HMlwxZYzLHLeS1RbVjRqXmIR3yUf YU/JZ9CqvjAzTzsPQbaXmisPviPoDTpwGf04puyythW/YVmPHlcT/OO9TWdgSx3/qB FNjrpg4m5iDz2v5iX1ppCF5N+V+dRQOUW3v+Ai5U= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jacopo Mondi , Sakari Ailus , Mauro Carvalho Chehab Subject: [PATCH 3.18 51/86] media: v4l2: i2c: ov7670: Fix PLL bypass register values Date: Wed, 15 May 2019 12:55:28 +0200 Message-Id: <20190515090652.463756699@linuxfoundation.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190515090642.339346723@linuxfoundation.org> References: <20190515090642.339346723@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Jacopo Mondi commit 61da76beef1e4f0b6ba7be4f8d0cf0dac7ce1f55 upstream. The following commits: commit f6dd927f34d6 ("[media] media: ov7670: calculate framerate properly for ov7675") commit 04ee6d92047e ("[media] media: ov7670: add possibility to bypass pll for ov7675") introduced the ability to bypass PLL multiplier and use input clock (xvclk) as pixel clock output frequency for ov7675 sensor. PLL is bypassed using register DBLV[7:6], according to ov7670 and ov7675 sensor manuals. Macros used to set DBLV register seem wrong in the driver, as their values do not match what reported in the datasheet. Fix by changing DBLV_* macros to use bits [7:6] and set bits [3:0] to default 0x0a reserved value (according to datasheets). While at there, remove a write to DBLV register in "ov7675_set_framerate()" that over-writes the previous one to the same register that takes "info->pll_bypass" flag into account instead of setting PLL multiplier to 4x unconditionally. And, while at there, since "info->pll_bypass" is only used in set/get_framerate() functions used by ov7675 only, it is not necessary to check for the device id at probe time to make sure that when using ov7670 "info->pll_bypass" is set to false. Fixes: f6dd927f34d6 ("[media] media: ov7670: calculate framerate properly for ov7675") Signed-off-by: Jacopo Mondi Signed-off-by: Sakari Ailus Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Greg Kroah-Hartman --- drivers/media/i2c/ov7670.c | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) --- a/drivers/media/i2c/ov7670.c +++ b/drivers/media/i2c/ov7670.c @@ -155,10 +155,10 @@ MODULE_PARM_DESC(debug, "Debug level (0- #define REG_GFIX 0x69 /* Fix gain control */ #define REG_DBLV 0x6b /* PLL control an debugging */ -#define DBLV_BYPASS 0x00 /* Bypass PLL */ -#define DBLV_X4 0x01 /* clock x4 */ -#define DBLV_X6 0x10 /* clock x6 */ -#define DBLV_X8 0x11 /* clock x8 */ +#define DBLV_BYPASS 0x0a /* Bypass PLL */ +#define DBLV_X4 0x4a /* clock x4 */ +#define DBLV_X6 0x8a /* clock x6 */ +#define DBLV_X8 0xca /* clock x8 */ #define REG_REG76 0x76 /* OV's name */ #define R76_BLKPCOR 0x80 /* Black pixel correction enable */ @@ -833,7 +833,7 @@ static int ov7675_set_framerate(struct v if (ret < 0) return ret; - return ov7670_write(sd, REG_DBLV, DBLV_X4); + return 0; } static void ov7670_get_framerate_legacy(struct v4l2_subdev *sd, @@ -1540,11 +1540,7 @@ static int ov7670_probe(struct i2c_clien if (config->clock_speed) info->clock_speed = config->clock_speed; - /* - * It should be allowed for ov7670 too when it is migrated to - * the new frame rate formula. - */ - if (config->pll_bypass && id->driver_data != MODEL_OV7670) + if (config->pll_bypass) info->pll_bypass = true; if (config->pclk_hb_disable)