From: Laxman Dewangan <ldewangan@nvidia.com>
To: <thierry.reding@gmail.com>, <swarren@wwwdotorg.org>
Cc: <gnurou@gmail.com>, <jonathanh@nvidia.com>,
<linux-tegra@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
Laxman Dewangan <ldewangan@nvidia.com>
Subject: [PATCH V2 4/4] soc/tegra: pmc: Make configuration of IO pads in atomic context
Date: Wed, 9 Nov 2016 18:39:22 +0530 [thread overview]
Message-ID: <1478696962-11831-5-git-send-email-ldewangan@nvidia.com> (raw)
In-Reply-To: <1478696962-11831-1-git-send-email-ldewangan@nvidia.com>
The IO pad voltage configuration can be done in the regulator
notifier callback which is atomic in nature.
Replace the mutex with spin lock for the locking mechanism.
Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
---
Changes from V1:
New in series based on pinctrl driver requirement.
---
drivers/soc/tegra/pmc.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/drivers/soc/tegra/pmc.c b/drivers/soc/tegra/pmc.c
index 916a94b..52cd218 100644
--- a/drivers/soc/tegra/pmc.c
+++ b/drivers/soc/tegra/pmc.c
@@ -172,6 +172,7 @@ struct tegra_pmc_soc {
* @lp0_vec_size: size of the LP0 warm boot code
* @powergates_available: Bitmap of available power gates
* @powergates_lock: mutex for power gate register access
+ * @io_pad_lock: Spinlock for IO pad voltage register access
* @plat_subdevs: Platform device for PMC child devices.
*/
struct tegra_pmc {
@@ -199,6 +200,7 @@ struct tegra_pmc {
DECLARE_BITMAP(powergates_available, TEGRA_POWERGATE_MAX);
struct mutex powergates_lock;
+ struct spinlock io_pad_lock;
struct platform_device **plat_subdevs;
};
@@ -1103,7 +1105,7 @@ int tegra_io_pad_set_voltage(enum tegra_io_pad id,
if (pad->voltage == UINT_MAX)
return -ENOTSUPP;
- mutex_lock(&pmc->powergates_lock);
+ spin_lock(&pmc->io_pad_lock);
/* write-enable PMC_PWR_DET_VALUE[pad->voltage] */
value = tegra_pmc_readl(PMC_PWR_DET);
@@ -1120,7 +1122,7 @@ int tegra_io_pad_set_voltage(enum tegra_io_pad id,
tegra_pmc_writel(value, PMC_PWR_DET_VALUE);
- mutex_unlock(&pmc->powergates_lock);
+ spin_unlock(&pmc->io_pad_lock);
usleep_range(100, 250);
@@ -1800,6 +1802,7 @@ static int __init tegra_pmc_early_init(void)
u32 value;
mutex_init(&pmc->powergates_lock);
+ spin_lock_init(&pmc->io_pad_lock);
np = of_find_matching_node_and_match(NULL, tegra_pmc_match, &match);
if (!np) {
--
2.1.4
next prev parent reply other threads:[~2016-11-09 13:28 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-11-09 13:09 [PATCH V2 0/4] soc/tegra: pmc: Add support for IO pad configuration and sub-driver Laxman Dewangan
2016-11-09 13:09 ` [PATCH V2 1/4] soc/tegra: pmc: Remove legacy Tegra I/O rail API Laxman Dewangan
2016-11-09 13:09 ` [PATCH V2 2/4] soc/tegra: pmc: Add interface to get IO pad power status Laxman Dewangan
2016-11-09 13:09 ` [PATCH V2 3/4] soc/tegra: pmc: Register PMC child devices as platform device Laxman Dewangan
2016-11-09 13:09 ` Laxman Dewangan [this message]
2016-11-22 11:32 ` [PATCH V2 0/4] soc/tegra: pmc: Add support for IO pad configuration and sub-driver Laxman Dewangan
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=1478696962-11831-5-git-send-email-ldewangan@nvidia.com \
--to=ldewangan@nvidia.com \
--cc=gnurou@gmail.com \
--cc=jonathanh@nvidia.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tegra@vger.kernel.org \
--cc=swarren@wwwdotorg.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®