diff mbox

[3/7] soc/tegra: pmc: Add interface to get IO rail power status

Message ID 1460473007-11535-4-git-send-email-ldewangan@nvidia.com
State Superseded, archived
Headers show

Commit Message

Laxman Dewangan April 12, 2016, 2:56 p.m. UTC
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@nvidia.com>
---
 drivers/soc/tegra/pmc.c | 16 ++++++++++++++++
 include/soc/tegra/pmc.h |  6 ++++++
 2 files changed, 22 insertions(+)

Comments

kernel test robot April 12, 2016, 6:06 p.m. UTC | #1
Hi Laxman,

[auto build test ERROR on tegra/for-next]
[also build test ERROR on next-20160412]
[cannot apply to v4.6-rc3]
[if your patch is applied to the wrong git tree, please drop us a note to help improving the system]

url:    https://github.com/0day-ci/linux/commits/Laxman-Dewangan/pinctrl-soc-tegra-Add-support-to-configure-IO-rail-voltage-and-pad-power-states/20160412-232024
base:   https://git.kernel.org/pub/scm/linux/kernel/git/tegra/linux for-next
config: i386-randconfig-s1-201615 (attached as .config)
reproduce:
        # save the attached .config to linux build tree
        make ARCH=i386 

All errors (new ones prefixed by >>):

   In file included from drivers/gpu/drm/nouveau/include/nvif/os.h:35:0,
                    from drivers/gpu/drm/nouveau/include/nvif/object.h:4,
                    from drivers/gpu/drm/nouveau/nvif/object.c:25:
   include/soc/tegra/pmc.h: In function 'tegra_io_rail_power_get_status':
>> include/soc/tegra/pmc.h:177:10: error: 'ENOTSUP' undeclared (first use in this function)
     return -ENOTSUP;
             ^
   include/soc/tegra/pmc.h:177:10: note: each undeclared identifier is reported only once for each function it appears in

vim +/ENOTSUP +177 include/soc/tegra/pmc.h

   171	{
   172		return -ENOSYS;
   173	}
   174	
   175	static inline int tegra_io_rail_power_get_status(unsigned int id)
   176	{
 > 177		return -ENOTSUP;
   178	}
   179	#endif /* CONFIG_ARCH_TEGRA */
   180	

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation
Jon Hunter April 12, 2016, 6:13 p.m. UTC | #2
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@nvidia.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
--
To unsubscribe from this list: send the line "unsubscribe linux-tegra" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

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;
+
+	if ((id > 63) || (id == 30) || (id == 31))
+		return -EINVAL;
+
+	status = (id < 32) ? IO_DPD_STATUS : IO_DPD2_STATUS;
+	mask = BIT(id % 32);
+	value = tegra_pmc_readl(status);
+
+	return !!(value & mask);
+}
+EXPORT_SYMBOL(tegra_io_rail_power_get_status);
+
 #ifdef CONFIG_PM_SLEEP
 enum tegra_suspend_mode tegra_pmc_get_suspend_mode(void)
 {
diff --git a/include/soc/tegra/pmc.h b/include/soc/tegra/pmc.h
index 58fadc5..4f3db41 100644
--- a/include/soc/tegra/pmc.h
+++ b/include/soc/tegra/pmc.h
@@ -133,6 +133,7 @@  int tegra_powergate_sequence_power_up(unsigned int id, struct clk *clk,
 
 int tegra_io_rail_power_on(unsigned int id);
 int tegra_io_rail_power_off(unsigned int id);
+int tegra_io_rail_power_get_status(unsigned int id);
 #else
 static inline int tegra_powergate_is_powered(unsigned int id)
 {
@@ -170,6 +171,11 @@  static inline int tegra_io_rail_power_off(unsigned int id)
 {
 	return -ENOSYS;
 }
+
+static inline int tegra_io_rail_power_get_status(unsigned int id)
+{
+	return -ENOTSUP;
+}
 #endif /* CONFIG_ARCH_TEGRA */
 
 #endif /* __SOC_TEGRA_PMC_H__ */