From patchwork Thu Mar 19 12:19:21 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lad Prabhakar X-Patchwork-Id: 11447103 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id A9DC31668 for ; Thu, 19 Mar 2020 12:22:08 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 940E820740 for ; Thu, 19 Mar 2020 12:22:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727089AbgCSMWF (ORCPT ); Thu, 19 Mar 2020 08:22:05 -0400 Received: from relmlor1.renesas.com ([210.160.252.171]:33740 "EHLO relmlie5.idc.renesas.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726785AbgCSMWF (ORCPT ); Thu, 19 Mar 2020 08:22:05 -0400 X-IronPort-AV: E=Sophos;i="5.70,571,1574089200"; d="scan'208";a="42339836" Received: from unknown (HELO relmlir6.idc.renesas.com) ([10.200.68.152]) by relmlie5.idc.renesas.com with ESMTP; 19 Mar 2020 21:22:04 +0900 Received: from localhost.localdomain (unknown [10.226.36.204]) by relmlir6.idc.renesas.com (Postfix) with ESMTP id 71BB242BCBDB; Thu, 19 Mar 2020 21:22:00 +0900 (JST) From: Lad Prabhakar To: Laurent Pinchart , Sakari Ailus , Mauro Carvalho Chehab , Rob Herring , Mark Rutland , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , NXP Linux Team , Kieran Bingham Cc: linux-media@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Lad Prabhakar , Lad Prabhakar Subject: [PATCH v4 3/5] media: i2c: ov5645: Increase tolerance of external clock frequency Date: Thu, 19 Mar 2020 12:19:21 +0000 Message-Id: <1584620363-2255-4-git-send-email-prabhakar.mahadev-lad.rj@bp.renesas.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1584620363-2255-1-git-send-email-prabhakar.mahadev-lad.rj@bp.renesas.com> References: <1584620363-2255-1-git-send-email-prabhakar.mahadev-lad.rj@bp.renesas.com> Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org While testing on Renesas RZ/G2E platform, noticed the clock frequency to be 24242424 as a result the probe failed. This patch increases the tolerance to 5% so that it avoids patching for new platforms and it warns the users if the frequency is not within the range and continue further in the probe instead of returning failure. Signed-off-by: Lad Prabhakar Reviewed-by: Laurent Pinchart --- drivers/media/i2c/ov5645.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/drivers/media/i2c/ov5645.c b/drivers/media/i2c/ov5645.c index e298acdadeef..52a185ed4368 100644 --- a/drivers/media/i2c/ov5645.c +++ b/drivers/media/i2c/ov5645.c @@ -1105,13 +1105,11 @@ static int ov5645_probe(struct i2c_client *client) } } - /* external clock must be 24MHz, allow 1% tolerance */ + /* ideally external clock must be 24MHz, allow 5% tolerance */ xclk_freq = clk_get_rate(ov5645->xclk); - if (xclk_freq < 23760000 || xclk_freq > 24240000) { - dev_err(dev, "external clock frequency %u is not supported\n", - xclk_freq); - return -EINVAL; - } + if (xclk_freq < 22800000 || xclk_freq > 25200000) + dev_warn(dev, "external clock frequency is set to %u, sensor might misbehave\n", + xclk_freq); for (i = 0; i < OV5645_NUM_SUPPLIES; i++) ov5645->supplies[i].supply = ov5645_supply_name[i];