linux-pwm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Stefan Agner <stefan@agner.ch>
To: l.majewski@majess.pl, thierry.reding@gmail.com
Cc: s.hauer@pengutronix.de, linux-pwm@vger.kernel.org,
	bhuvanchandra.dv@toradex.com, linux-kernel@vger.kernel.org,
	fabio.estevam@nxp.com, boris.brezillon@free-electrons.com,
	LW@karo-electronics.de, kernel@pengutronix.de,
	shawnguo@kernel.org, Stefan Agner <stefan@agner.ch>
Subject: [PATCH] pwm: imx: keep peripheral clock enabled during register access
Date: Thu, 29 Dec 2016 15:10:41 +0100	[thread overview]
Message-ID: <20161229141041.16369-1-stefan@agner.ch> (raw)

On some platforms (i.MX 7) the peripheral clock is required during
register access. Make sure that the clock is kept enabled when
accessing registers.

Signed-off-by: Stefan Agner <stefan@agner.ch>
---
Hi Thierry, hi Lukasz,

This patch applies ontop of Lukasz "pwm: imx: Provide atomic operation
for IMX PWM driver" patchset. With that, my expressed concern to patch
2 is solved.

--
Stefan

 drivers/pwm/pwm-imx.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/pwm/pwm-imx.c b/drivers/pwm/pwm-imx.c
index a21463436aa4..fbd997514a87 100644
--- a/drivers/pwm/pwm-imx.c
+++ b/drivers/pwm/pwm-imx.c
@@ -192,7 +192,7 @@ static int imx_pwm_apply_v2(struct pwm_chip *chip, struct pwm_device *pwm,
 		period_cycles = 0;
 
 	/* Enable the clock if the PWM is being enabled. */
-	if (state->enabled && !cstate.enabled) {
+	if (!cstate.enabled) {
 		ret = clk_prepare_enable(imx->clk_per);
 		if (ret)
 			return ret;
@@ -223,7 +223,7 @@ static int imx_pwm_apply_v2(struct pwm_chip *chip, struct pwm_device *pwm,
 	writel(cr, imx->mmio_base + MX3_PWMCR);
 
 	/* Disable the clock if the PWM is being disabled. */
-	if (!state->enabled && cstate.enabled)
+	if (!state->enabled)
 		clk_disable_unprepare(imx->clk_per);
 
 	return 0;
-- 
2.11.0

                 reply	other threads:[~2016-12-29 14:10 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20161229141041.16369-1-stefan@agner.ch \
    --to=stefan@agner.ch \
    --cc=LW@karo-electronics.de \
    --cc=bhuvanchandra.dv@toradex.com \
    --cc=boris.brezillon@free-electrons.com \
    --cc=fabio.estevam@nxp.com \
    --cc=kernel@pengutronix.de \
    --cc=l.majewski@majess.pl \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pwm@vger.kernel.org \
    --cc=s.hauer@pengutronix.de \
    --cc=shawnguo@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).