All of lore.kernel.org
 help / color / mirror / Atom feed
From: Aapo Vienamo <avienamo@nvidia.com>
To: Rob Herring <robh+dt@kernel.org>,
	Mark Rutland <mark.rutland@arm.com>,
	Thierry Reding <thierry.reding@gmail.com>,
	Jonathan Hunter <jonathanh@nvidia.com>,
	Mikko Perttunen <mperttunen@nvidia.com>
Cc: Aapo Vienamo <avienamo@nvidia.com>,
	devicetree@vger.kernel.org, linux-tegra@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: [PATCH v2 3/7] soc/tegra: pmc: Implement tegra_io_pad_is_powered()
Date: Wed, 11 Jul 2018 17:01:29 +0300	[thread overview]
Message-ID: <1531317693-3520-4-git-send-email-avienamo@nvidia.com> (raw)
In-Reply-To: <1531317693-3520-1-git-send-email-avienamo@nvidia.com>

Implement a function to query whether a pad is in deep power down mode.

Signed-off-by: Aapo Vienamo <avienamo@nvidia.com>
Acked-by: Jon Hunter <jonathanh@nvidia.com>
---
 drivers/soc/tegra/pmc.c | 17 +++++++++++++++++
 include/soc/tegra/pmc.h |  1 +
 2 files changed, 18 insertions(+)

diff --git a/drivers/soc/tegra/pmc.c b/drivers/soc/tegra/pmc.c
index 393ca72..fa47e7a 100644
--- a/drivers/soc/tegra/pmc.c
+++ b/drivers/soc/tegra/pmc.c
@@ -1075,6 +1075,23 @@ int tegra_io_pad_power_disable(enum tegra_io_pad id)
 }
 EXPORT_SYMBOL(tegra_io_pad_power_disable);
 
+int tegra_io_pad_is_powered(enum tegra_io_pad id)
+{
+	unsigned long request, status;
+	u32 mask;
+	u32 value;
+	int err;
+
+	err = tegra_io_pad_get_dpd_register_bit(id, &request, &status, &mask);
+	if (err)
+		return err;
+
+	value = tegra_pmc_readl(status);
+
+	return !(value & mask);
+}
+EXPORT_SYMBOL(tegra_io_pad_is_powered);
+
 int tegra_io_pad_set_voltage(enum tegra_io_pad id,
 			     enum tegra_io_pad_voltage voltage)
 {
diff --git a/include/soc/tegra/pmc.h b/include/soc/tegra/pmc.h
index 445aa66..14206e8 100644
--- a/include/soc/tegra/pmc.h
+++ b/include/soc/tegra/pmc.h
@@ -163,6 +163,7 @@ int tegra_powergate_sequence_power_up(unsigned int id, struct clk *clk,
 
 int tegra_io_pad_power_enable(enum tegra_io_pad id);
 int tegra_io_pad_power_disable(enum tegra_io_pad id);
+int tegra_io_pad_is_powered(enum tegra_io_pad id);
 int tegra_io_pad_set_voltage(enum tegra_io_pad id,
 			     enum tegra_io_pad_voltage voltage);
 int tegra_io_pad_get_voltage(enum tegra_io_pad id);
-- 
2.7.4

WARNING: multiple messages have this Message-ID (diff)
From: Aapo Vienamo <avienamo@nvidia.com>
To: Rob Herring <robh+dt@kernel.org>,
	Mark Rutland <mark.rutland@arm.com>,
	Thierry Reding <thierry.reding@gmail.com>,
	Jonathan Hunter <jonathanh@nvidia.com>,
	Mikko Perttunen <mperttunen@nvidia.com>
Cc: Aapo Vienamo <avienamo@nvidia.com>, <devicetree@vger.kernel.org>,
	<linux-tegra@vger.kernel.org>, <linux-kernel@vger.kernel.org>
Subject: [PATCH v2 3/7] soc/tegra: pmc: Implement tegra_io_pad_is_powered()
Date: Wed, 11 Jul 2018 17:01:29 +0300	[thread overview]
Message-ID: <1531317693-3520-4-git-send-email-avienamo@nvidia.com> (raw)
In-Reply-To: <1531317693-3520-1-git-send-email-avienamo@nvidia.com>

Implement a function to query whether a pad is in deep power down mode.

Signed-off-by: Aapo Vienamo <avienamo@nvidia.com>
Acked-by: Jon Hunter <jonathanh@nvidia.com>
---
 drivers/soc/tegra/pmc.c | 17 +++++++++++++++++
 include/soc/tegra/pmc.h |  1 +
 2 files changed, 18 insertions(+)

diff --git a/drivers/soc/tegra/pmc.c b/drivers/soc/tegra/pmc.c
index 393ca72..fa47e7a 100644
--- a/drivers/soc/tegra/pmc.c
+++ b/drivers/soc/tegra/pmc.c
@@ -1075,6 +1075,23 @@ int tegra_io_pad_power_disable(enum tegra_io_pad id)
 }
 EXPORT_SYMBOL(tegra_io_pad_power_disable);
 
+int tegra_io_pad_is_powered(enum tegra_io_pad id)
+{
+	unsigned long request, status;
+	u32 mask;
+	u32 value;
+	int err;
+
+	err = tegra_io_pad_get_dpd_register_bit(id, &request, &status, &mask);
+	if (err)
+		return err;
+
+	value = tegra_pmc_readl(status);
+
+	return !(value & mask);
+}
+EXPORT_SYMBOL(tegra_io_pad_is_powered);
+
 int tegra_io_pad_set_voltage(enum tegra_io_pad id,
 			     enum tegra_io_pad_voltage voltage)
 {
diff --git a/include/soc/tegra/pmc.h b/include/soc/tegra/pmc.h
index 445aa66..14206e8 100644
--- a/include/soc/tegra/pmc.h
+++ b/include/soc/tegra/pmc.h
@@ -163,6 +163,7 @@ int tegra_powergate_sequence_power_up(unsigned int id, struct clk *clk,
 
 int tegra_io_pad_power_enable(enum tegra_io_pad id);
 int tegra_io_pad_power_disable(enum tegra_io_pad id);
+int tegra_io_pad_is_powered(enum tegra_io_pad id);
 int tegra_io_pad_set_voltage(enum tegra_io_pad id,
 			     enum tegra_io_pad_voltage voltage);
 int tegra_io_pad_get_voltage(enum tegra_io_pad id);
-- 
2.7.4


  parent reply	other threads:[~2018-07-11 14:01 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-11 14:01 [PATCH v2 0/7] Tegra PMC pinctrl pad configuration Aapo Vienamo
2018-07-11 14:01 ` Aapo Vienamo
2018-07-11 14:01 ` [PATCH v2 1/7] soc/tegra: pmc: Fix pad voltage configuration for Tegra186 Aapo Vienamo
2018-07-11 14:01   ` Aapo Vienamo
2018-07-11 15:27   ` Jon Hunter
2018-07-11 15:27     ` Jon Hunter
2018-07-11 14:01 ` [PATCH v2 2/7] soc/tegra: pmc: Factor out DPD register bit calculation Aapo Vienamo
2018-07-11 14:01   ` Aapo Vienamo
2018-07-11 14:01 ` Aapo Vienamo [this message]
2018-07-11 14:01   ` [PATCH v2 3/7] soc/tegra: pmc: Implement tegra_io_pad_is_powered() Aapo Vienamo
2018-07-11 15:23   ` Jon Hunter
2018-07-11 15:23     ` Jon Hunter
2018-07-11 15:26     ` Jon Hunter
2018-07-11 15:26       ` Jon Hunter
2018-07-12  7:52       ` Aapo Vienamo
2018-07-12  7:52         ` Aapo Vienamo
2018-07-12 10:10         ` Jon Hunter
2018-07-12 10:10           ` Jon Hunter
2018-07-11 14:01 ` [PATCH v2 4/7] soc/tegra: pmc: Use X macro to generate IO pad tables Aapo Vienamo
2018-07-11 14:01   ` Aapo Vienamo
2018-07-11 14:05 ` [PATCH v2 5/7] dt-bindings: Add Tegra PMC pad configuration bindings Aapo Vienamo
2018-07-11 14:05   ` Aapo Vienamo
2018-07-11 14:05 ` [PATCH v2 6/7] soc/tegra: pmc: Remove public pad voltage APIs Aapo Vienamo
2018-07-11 14:05   ` Aapo Vienamo
2018-07-11 15:30   ` Jon Hunter
2018-07-11 15:30     ` Jon Hunter
2018-07-12  0:05   ` kbuild test robot
2018-07-12  0:05     ` kbuild test robot
2018-07-12  0:58   ` kbuild test robot
2018-07-11 14:06 ` [PATCH v2 7/7] soc/tegra: pmc: Implement pad configuration via pinctrl Aapo Vienamo
2018-07-11 14:06   ` Aapo Vienamo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1531317693-3520-4-git-send-email-avienamo@nvidia.com \
    --to=avienamo@nvidia.com \
    --cc=devicetree@vger.kernel.org \
    --cc=jonathanh@nvidia.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tegra@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=mperttunen@nvidia.com \
    --cc=robh+dt@kernel.org \
    --cc=thierry.reding@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.