Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp2537569yba; Mon, 6 May 2019 07:40:49 -0700 (PDT) X-Google-Smtp-Source: APXvYqyWmlh+lISUQbMuwgF+KCCQ7Fw3gQXt9IhwM89GxIznxgKy6QhU3cKwMpj7MtpbqI7Gcl0B X-Received: by 2002:a63:171c:: with SMTP id x28mr32088841pgl.12.1557153649627; Mon, 06 May 2019 07:40:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1557153649; cv=none; d=google.com; s=arc-20160816; b=lYeQtHRIDIheqIbB+TMfonwc8d5eOujdctRwL23P2edds42M1KsZ7Dg88rZjHlfowZ Kk148IgyTwv8LytM6zQxntG1HkpFEQdd33T8+qZmq9M6o+UAjYcqCbtoeRYsz00RwDJm qERCKxKFgdHc41fM9NUszcIZBNqrz0rr0TmWvKcDVQDHdAduRMVBZU4dPn9fTMY0VkW7 iQ173UL6xjfRbLm7kJ0qQpHkkWKTqmZwuWZ2XIBYC4VZ4iFCvgaMFLEVj6J0Rhu45kk/ DAGjXhl4riehvOrLstx+2899CnWuhJ6FBWoGtCLcv41jnlVM45J4FKoEO9g/oIQPFKQl +m+w== 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=KhwKlnyKDNFtA6NAuS7US2DTCDbxMmmjd1/uIUhcxyc=; b=L4xiW06zvgQPpQtptvlfUTesX3q3g3G+omJFfdTYEa+8vGEpmNbyfLDn17DLeFouIQ 73l25AqhlPM6OtiELysVI/9fjGLX2lfb/hPLnUtp+1PnDxP4yc/fFsMSa23IDM+TsZ1I LrT6XKJGC3+664nzkkVhQ7mxGWVOkWs5BbrMTY9MJG5ZcWQflVXI1XgdvI2sYTRHgTAo EmPPNGv+weF9lP6j50hN/9PzBwnoBxz/JayOaNyxkkthHt4+78F7gtqDGUDjCMgVB7rS DqdLOal0VTFMZJnCRBLtaW+4IbIf9J6C/C4of7ZdSlk8jTZx2Cem3L3e8xXl/zvv2KfO XXXQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Tp2THbaI; 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 1si14454681pgx.176.2019.05.06.07.40.33; Mon, 06 May 2019 07:40: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=Tp2THbaI; 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 S1727683AbfEFOit (ORCPT + 99 others); Mon, 6 May 2019 10:38:49 -0400 Received: from mail.kernel.org ([198.145.29.99]:60094 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726679AbfEFOir (ORCPT ); Mon, 6 May 2019 10:38:47 -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 C787421479; Mon, 6 May 2019 14:38:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1557153527; bh=uu0EMjhOToFcA+5jmlzRFDtcC1h61DsUoHuGmibseAg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Tp2THbaIpJ25MmAB23bkb5Pw68P4/cqFLSqA1uMvJCRn3DUnE11F8Y3UsS2rxTmRA Z+nyOT88PMqkGLh16CfPpDtDbw9YWeT3+2nPZunF2NiXYyGnB4TXu7OyCaUYMp1bio g83MRQkszaV5IeRNP/FUR4LliwUh58APw7DvQzb4= 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 5.0 122/122] media: v4l2: i2c: ov7670: Fix PLL bypass register values Date: Mon, 6 May 2019 16:33:00 +0200 Message-Id: <20190506143105.263885603@linuxfoundation.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190506143054.670334917@linuxfoundation.org> References: <20190506143054.670334917@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 @@ -160,10 +160,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_SCALING_XSC 0x70 /* Test pattern and horizontal scale factor */ #define TEST_PATTTERN_0 0x80 @@ -863,7 +863,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, @@ -1801,11 +1801,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)