[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20190125154245.5wx2mwhzsjeaahi3@flea>
Date: Fri, 25 Jan 2019 16:42:45 +0100
From: Maxime Ripard <maxime.ripard@...tlin.com>
To: Jagan Teki <jagan@...rulasolutions.com>
Cc: Yong Deng <yong.deng@...ewell.com>,
Mauro Carvalho Chehab <mchehab@...nel.org>,
Chen-Yu Tsai <wens@...e.org>, Rob Herring <robh+dt@...nel.org>,
Mark Rutland <mark.rutland@....com>,
linux-media@...r.kernel.org, linux-arm-kernel@...ts.infradead.org,
linux-kernel@...r.kernel.org,
Michael Trimarchi <michael@...rulasolutions.com>,
linux-amarula@...rulasolutions.com, devicetree@...r.kernel.org,
linux-sunxi@...glegroups.com
Subject: Re: [PATCH v7 2/5] media: sun6i: Add A64 CSI block support
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 <jagan@...rulasolutions.com>
> ---
> 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 <linux/ioctl.h>
> #include <linux/module.h>
> #include <linux/of.h>
> +#include <linux/of_device.h>
> #include <linux/platform_device.h>
> #include <linux/pm_runtime.h>
> #include <linux/regmap.h>
> @@ -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?
Maxime
--
Maxime Ripard, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
Download attachment "signature.asc" of type "application/pgp-signature" (229 bytes)
Powered by blists - more mailing lists