linux-pwm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sylvain Lemieux <slemieux.tyco@gmail.com>
To: vz@mleia.com, thierry.reding@gmail.com
Cc: linux-arm-kernel@lists.infradead.org, linux-pwm@vger.kernel.org
Subject: [PATCH v2 2/3] pwm: lpc32xx: Add support for PWM_PIN_LEVEL bit configuration
Date: Mon, 27 Jun 2016 09:09:56 -0400	[thread overview]
Message-ID: <1467032997-5340-3-git-send-email-slemieux.tyco@gmail.com> (raw)
In-Reply-To: <1467032997-5340-1-git-send-email-slemieux.tyco@gmail.com>

From: Sylvain Lemieux <slemieux@tycoint.com>

Provide support to configure the pin output
(i.e. PWM_PIN_LEVEL bit) when the PWM is disabled.

Note:
When the LPC32xx PWM is disabled, both options of pin
output high and low level values are valid; however this
particular controller does not have polarity control.

Refer to the LPC32x0 User Manual [1], for details.

[1] http://www.nxp.com/documents/user_manual/UM10326.pdf

Signed-off-by: Sylvain Lemieux <slemieux@tycoint.com>
---
Changes from v1 to v2:
* New patch in version 2.

 drivers/pwm/pwm-lpc32xx.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/pwm/pwm-lpc32xx.c b/drivers/pwm/pwm-lpc32xx.c
index a9b3cff..d1bd901 100644
--- a/drivers/pwm/pwm-lpc32xx.c
+++ b/drivers/pwm/pwm-lpc32xx.c
@@ -130,9 +130,13 @@ static int lpc32xx_pwm_probe(struct platform_device *pdev)
 		return ret;
 	}
 
-	/* When PWM is disable, configure the output to the default value */
+	/* When PWM is disable, configure the output correctly */
 	val = readl(lpc32xx->base + (lpc32xx->chip.pwms[0].hwpwm << 2));
-	val &= ~PWM_PIN_LEVEL;
+	if (device_property_read_bool(&pdev->dev,
+				      "nxp,pwm-disabled-level-high"))
+		val |= PWM_PIN_LEVEL;
+	else
+		val &= ~PWM_PIN_LEVEL;
 	writel(val, lpc32xx->base + (lpc32xx->chip.pwms[0].hwpwm << 2));
 
 	platform_set_drvdata(pdev, lpc32xx);
-- 
1.8.3.1

  parent reply	other threads:[~2016-06-27 13:10 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-27 13:09 [PATCH v2 0/3] pwm: lpc32xx: Add support to control PWM_PIN_LEVEL bit Sylvain Lemieux
2016-06-27 13:09 ` [PATCH v2 1/3] pwm: lpc32xx: Set PWM_PIN_LEVEL bit to default value Sylvain Lemieux
2016-07-11  8:55   ` Thierry Reding
2016-06-27 13:09 ` Sylvain Lemieux [this message]
2016-06-27 13:09 ` [PATCH v2 3/3] dt-bindings: pwm: lpc32xx: Add nxp,pwm-disabled-level-high property Sylvain Lemieux
2016-06-30  8:43 ` [PATCH v2 0/3] pwm: lpc32xx: Add support to control PWM_PIN_LEVEL bit Vladimir Zapolskiy
2016-06-30 13:25   ` Sylvain Lemieux
2016-07-01  8:13     ` Vladimir Zapolskiy
2016-07-04 14:08       ` Sylvain Lemieux

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=1467032997-5340-3-git-send-email-slemieux.tyco@gmail.com \
    --to=slemieux.tyco@gmail.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-pwm@vger.kernel.org \
    --cc=thierry.reding@gmail.com \
    --cc=vz@mleia.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).