mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Clifton Barnes <cabarnes@indesign-llc.com>
To: <thierry.reding@gmail.com>
Cc: <linux-pwm@vger.kernel.org>, <linux-kernel@vger.kernel.org>
Subject: [PATCH] pwm: tiehrpwm: fix disabled state of pwm when inverted
Date: Mon, 3 Oct 2016 07:37:02 -0400	[thread overview]
Message-ID: <1475494622-43846-1-git-send-email-cabarnes@indesign-llc.com> (raw)

The disable function forces the output to low regardless of whether
the PWM is inverted. Fix this by checking the inverted status of the
PWM and force the output to the proper state when disabled.

Signed-off-by: Clifton Barnes <cabarnes@indesign-llc.com>
---
 drivers/pwm/pwm-tiehrpwm.c |    7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/pwm/pwm-tiehrpwm.c b/drivers/pwm/pwm-tiehrpwm.c
index b5c6b06..e47e020 100644
--- a/drivers/pwm/pwm-tiehrpwm.c
+++ b/drivers/pwm/pwm-tiehrpwm.c
@@ -372,13 +372,14 @@ static void ehrpwm_pwm_disable(struct pwm_chip *chip, struct pwm_device *pwm)
 {
 	struct ehrpwm_pwm_chip *pc = to_ehrpwm_pwm_chip(chip);
 	unsigned short aqcsfrc_val, aqcsfrc_mask;
+	bool inv = pc->polarity[pwm->hwpwm] == PWM_POLARITY_INVERSED;
 
-	/* Action Qualifier puts PWM output low forcefully */
+	/* Action Qualifier puts PWM output high/low forcefully */
 	if (pwm->hwpwm) {
-		aqcsfrc_val = AQCSFRC_CSFB_FRCLOW;
+		aqcsfrc_val = inv ? AQCSFRC_CSFB_FRCHIGH : AQCSFRC_CSFB_FRCLOW;
 		aqcsfrc_mask = AQCSFRC_CSFB_MASK;
 	} else {
-		aqcsfrc_val = AQCSFRC_CSFA_FRCLOW;
+		aqcsfrc_val = inv ? AQCSFRC_CSFA_FRCHIGH : AQCSFRC_CSFA_FRCLOW;
 		aqcsfrc_mask = AQCSFRC_CSFA_MASK;
 	}
 
-- 
1.7.9.5

                 reply	other threads:[~2016-10-03 11:52 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=1475494622-43846-1-git-send-email-cabarnes@indesign-llc.com \
    --to=cabarnes@indesign-llc.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pwm@vger.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

all inboxes | Powered by JetHome®