mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Ahmad Fatoum <a.fatoum@pengutronix.de>
To: barebox@lists.infradead.org
Cc: Ahmad Fatoum <a.fatoum@pengutronix.de>
Subject: [PATCH 5/7] PWM: core: add definition for PWM_POLARITY_INVERSED
Date: Mon, 15 Apr 2024 07:35:58 +0200	[thread overview]
Message-ID: <20240415053600.370622-6-a.fatoum@pengutronix.de> (raw)
In-Reply-To: <20240415053600.370622-1-a.fatoum@pengutronix.de>

PWM_POLARITY_INVERTED is the macro used in the DT binding, while
PWM_POLARITY_INVERSED is the Linux driver macro that it is translated
to.

They are the same value, but Linux PWM chip drivers will use the latter,
so define it as well.

Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
 drivers/pwm/core.c |  2 +-
 include/pwm.h      | 14 +++++++++++++-
 2 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/drivers/pwm/core.c b/drivers/pwm/core.c
index 7e090cc144af..69724e1a5c26 100644
--- a/drivers/pwm/core.c
+++ b/drivers/pwm/core.c
@@ -244,7 +244,7 @@ struct pwm_device *of_pwm_request(struct device_node *np, const char *con_id)
 	pwm->args.polarity = PWM_POLARITY_NORMAL;
 
 	if (args.args_count > 2 && args.args[2] & PWM_POLARITY_INVERTED)
-		pwm->args.polarity = PWM_POLARITY_INVERTED;
+		pwm->args.polarity = PWM_POLARITY_INVERSED;
 
 	ret = __pwm_request(pwm);
 	if (ret)
diff --git a/include/pwm.h b/include/pwm.h
index e8b0f2c96263..b90ac1de4220 100644
--- a/include/pwm.h
+++ b/include/pwm.h
@@ -8,7 +8,19 @@
 struct pwm_device;
 struct device;
 
-#define	PWM_POLARITY_NORMAL	0
+/**
+ * enum pwm_polarity - polarity of a PWM signal
+ * @PWM_POLARITY_NORMAL: a high signal for the duration of the duty-
+ * cycle, followed by a low signal for the remainder of the pulse
+ * period
+ * @PWM_POLARITY_INVERSED: a low signal for the duration of the duty-
+ * cycle, followed by a high signal for the remainder of the pulse
+ * period
+ */
+enum pwm_polarity {
+	PWM_POLARITY_NORMAL,
+	PWM_POLARITY_INVERSED,
+};
 
 /*
  * struct pwm_state - state of a PWM channel
-- 
2.39.2




  parent reply	other threads:[~2024-04-15  5:36 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-15  5:35 [PATCH 0/7] PWM: rockchip: add driver support Ahmad Fatoum
2024-04-15  5:35 ` [PATCH 1/7] PWM: core: check that struct pwm_chip::devname is set Ahmad Fatoum
2024-04-15  5:35 ` [PATCH 2/7] PWM: core: add struct pwm_chip::dev Ahmad Fatoum
2024-04-15  5:35 ` [PATCH 3/7] PWM: core: adopt Linux prototype for struct pwm_ops::apply Ahmad Fatoum
2024-04-15  5:35 ` [PATCH 4/7] PWM: align struct pwm_state member names with Linux Ahmad Fatoum
2024-04-15  5:35 ` Ahmad Fatoum [this message]
2024-04-15  5:35 ` [PATCH 6/7] PWM: rockchip: add driver support Ahmad Fatoum
2024-04-15  5:36 ` [PATCH 7/7] ARM: dts: rk356x: add aliases for PWM controllers Ahmad Fatoum
2024-04-16 10:11 ` [PATCH 0/7] PWM: rockchip: add driver support Sascha Hauer

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=20240415053600.370622-6-a.fatoum@pengutronix.de \
    --to=a.fatoum@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    /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