From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.1 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id BC912C282C8 for ; Mon, 28 Jan 2019 07:32:11 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 7B57E2148E for ; Mon, 28 Jan 2019 07:32:11 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=amarulasolutions.com header.i=@amarulasolutions.com header.b="FP0capNk" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726761AbfA1HcH (ORCPT ); Mon, 28 Jan 2019 02:32:07 -0500 Received: from mail-it1-f195.google.com ([209.85.166.195]:39658 "EHLO mail-it1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726612AbfA1HcH (ORCPT ); Mon, 28 Jan 2019 02:32:07 -0500 Received: by mail-it1-f195.google.com with SMTP id a6so17921194itl.4 for ; Sun, 27 Jan 2019 23:32:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=mTGnqD6HTlX/N8E4wtdR/Qhebt0GeL6pNgp0cAE+85Y=; b=FP0capNk5QGL+WcawuamdA068tY8dz/YSgCBFM9wrmlAr+8Ovb62IcfGcrdkVDEnii AoOnCkSMR3Qlq3MnJeEHdWeUkD6bjikyO0+hiEltNEu6QgvTgCvsOYoEagNyFDbKfCcY uGLxUXJpoAiWiehBtbwO1yhM+5xr2JnVni4yk= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=mTGnqD6HTlX/N8E4wtdR/Qhebt0GeL6pNgp0cAE+85Y=; b=eKK6Mi1NcsWfMR3W1Cp3PhqFmXdBnAi/OQOcKe3evIYkOnC5ZeJbPzmwII2tuckkpb XYh8vU5QIUTRGnrT04i2pyJCbDFeKxrbsvxucA0NVKQYwd/PH4THFQ8yiuV1a36NS6LZ TIuxE8quDanlrnMg9bY+NkBTm+HvoOQmX0vC2uLntBxBWabz5vnm3btnKzsCvjTE0hvj d7IfU9JrT4yCB3BA3AtxhublgoD0M0UyEIqIft1BRkGaMINo5CH70DXq+3L9xAwNpY0J aYS1uq6fHCIuDkxkekntymswxdFxewGZwHY1Za/yL1+osUPSlkJ6xIL+1Gy93T+zR69s WpUQ== X-Gm-Message-State: AJcUukd+yh648JgkxkfSMOKHP9vf+LR+PJfLnK7WrmzjPAtQAvCYGkF4 73A36QKk+o4UGYizdXuZ34agRkkVKWzgMXeSS6+FDg== X-Google-Smtp-Source: ALg8bN6QzCMRMTALAsaeCJnY8PI/UAJdQmeNoWOiUVuzDFpjWtnFZx5kxTREQHLIXcvfFMd51PKAZLZHN+jH6dSj7cs= X-Received: by 2002:a24:385:: with SMTP id e127mr9061780ite.32.1548660725998; Sun, 27 Jan 2019 23:32:05 -0800 (PST) MIME-Version: 1.0 References: <20190124180736.28408-1-jagan@amarulasolutions.com> <20190124180736.28408-3-jagan@amarulasolutions.com> <20190125154245.5wx2mwhzsjeaahi3@flea> In-Reply-To: <20190125154245.5wx2mwhzsjeaahi3@flea> From: Jagan Teki Date: Mon, 28 Jan 2019 13:01:54 +0530 Message-ID: Subject: Re: [PATCH v7 2/5] media: sun6i: Add A64 CSI block support To: Maxime Ripard Cc: Yong Deng , Mauro Carvalho Chehab , Chen-Yu Tsai , Rob Herring , Mark Rutland , linux-media , linux-arm-kernel , linux-kernel , Michael Trimarchi , linux-amarula@amarulasolutions.com, devicetree , linux-sunxi Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Jan 25, 2019 at 9:12 PM Maxime Ripard wrote: > > On Thu, Jan 24, 2019 at 11:37:33PM +0530, Jagan Teki wrote: > > CSI block in Allwinner A64 has similar features as like in H3, > > but the default CSI_SCLK rate cannot work properly to drive the > > connected sensor interface. > > > > The tested mod cock rate is 300 MHz and BSP vfe media driver is also > > using the same rate. Unfortunately there is no valid information about > > clock rate in manual or any other sources except the BSP driver. so more > > faith on BSP code, because same has tested in mainline. > > > > So, add support for A64 CSI block by setting updated mod clock rate. > > > > Signed-off-by: Jagan Teki > > --- > > drivers/media/platform/sunxi/sun6i-csi/sun6i_csi.c | 13 ++++++++++++- > > 1 file changed, 12 insertions(+), 1 deletion(-) > > > > diff --git a/drivers/media/platform/sunxi/sun6i-csi/sun6i_csi.c b/drivers/media/platform/sunxi/sun6i-csi/sun6i_csi.c > > index ee882b66a5ea..cd2d33242c17 100644 > > --- a/drivers/media/platform/sunxi/sun6i-csi/sun6i_csi.c > > +++ b/drivers/media/platform/sunxi/sun6i-csi/sun6i_csi.c > > @@ -15,6 +15,7 @@ > > #include > > #include > > #include > > +#include > > #include > > #include > > #include > > @@ -154,6 +155,7 @@ bool sun6i_csi_is_format_supported(struct sun6i_csi *csi, > > int sun6i_csi_set_power(struct sun6i_csi *csi, bool enable) > > { > > struct sun6i_csi_dev *sdev = sun6i_csi_to_dev(csi); > > + struct device *dev = sdev->dev; > > struct regmap *regmap = sdev->regmap; > > int ret; > > > > @@ -161,15 +163,20 @@ int sun6i_csi_set_power(struct sun6i_csi *csi, bool enable) > > regmap_update_bits(regmap, CSI_EN_REG, CSI_EN_CSI_EN, 0); > > > > clk_disable_unprepare(sdev->clk_ram); > > + if (of_device_is_compatible(dev->of_node, "allwinner,sun50i-a64-csi")) > > + clk_rate_exclusive_put(sdev->clk_mod); > > clk_disable_unprepare(sdev->clk_mod); > > reset_control_assert(sdev->rstc_bus); > > return 0; > > } > > > > + if (of_device_is_compatible(dev->of_node, "allwinner,sun50i-a64-csi")) > > + clk_set_rate_exclusive(sdev->clk_mod, 300000000); > > + > > ret = clk_prepare_enable(sdev->clk_mod); > > if (ret) { > > dev_err(sdev->dev, "Enable csi clk err %d\n", ret); > > - return ret; > > + goto clk_mod_put; > > } > > > > ret = clk_prepare_enable(sdev->clk_ram); > > @@ -192,6 +199,9 @@ int sun6i_csi_set_power(struct sun6i_csi *csi, bool enable) > > clk_disable_unprepare(sdev->clk_ram); > > clk_mod_disable: > > clk_disable_unprepare(sdev->clk_mod); > > +clk_mod_put: > > + if (of_device_is_compatible(dev->of_node, "allwinner,sun50i-a64-csi")) > > + clk_rate_exclusive_put(sdev->clk_mod); > > return ret; > > The sequence in the error path and in the disable path aren't the same, why? True, it should be similar sequence, will fix and send next version. thanks!