[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <570D3AC4.2020105@nvidia.com>
Date: Tue, 12 Apr 2016 19:13:24 +0100
From: Jon Hunter <jonathanh@...dia.com>
To: Laxman Dewangan <ldewangan@...dia.com>, <swarren@...dotorg.org>,
<thierry.reding@...il.com>, <linus.walleij@...aro.org>,
<gnurou@...il.com>, <robh+dt@...nel.org>, <mark.rutland@....com>
CC: <linux-tegra@...r.kernel.org>, <devicetree@...r.kernel.org>,
<linux-kernel@...r.kernel.org>, <linux-gpio@...r.kernel.org>
Subject: Re: [PATCH 3/7] soc/tegra: pmc: Add interface to get IO rail power
status
On 12/04/16 15:56, Laxman Dewangan wrote:
> Add API to get the IO rail power status of the Tegra IO pads.
> This will help client driver to get the current power status
> of IO pads for handling IO pad power.
>
> Signed-off-by: Laxman Dewangan <ldewangan@...dia.com>
> ---
> drivers/soc/tegra/pmc.c | 16 ++++++++++++++++
> include/soc/tegra/pmc.h | 6 ++++++
> 2 files changed, 22 insertions(+)
>
> diff --git a/drivers/soc/tegra/pmc.c b/drivers/soc/tegra/pmc.c
> index 762f4fa..0bc8219 100644
> --- a/drivers/soc/tegra/pmc.c
> +++ b/drivers/soc/tegra/pmc.c
> @@ -613,6 +613,22 @@ error:
> }
> EXPORT_SYMBOL(tegra_io_rail_power_off);
>
> +int tegra_io_rail_power_get_status(unsigned int id)
> +{
> + unsigned long status, value;
> + unsigned int mask;
These should all be u32 as tegra_pmc_readl() returns a u32.
Hmmm ... I see some of the other tegra_io_rail_xxx() APIs use a unsigned
long here too. We should fix those as well.
> +
> + if ((id > 63) || (id == 30) || (id == 31))
> + return -EINVAL;
Seems that this could vary per SoC and so I am wondering if we need a
bitmap for this?
> +
> + status = (id < 32) ? IO_DPD_STATUS : IO_DPD2_STATUS;
> + mask = BIT(id % 32);
> + value = tegra_pmc_readl(status);
> +
> + return !!(value & mask);
Nit-pick ... do you need this mask variable?
Cheers
Jon
Powered by blists - more mailing lists