From: Claudiu Beznea <claudiu.beznea@microchip.com>
To: thierry.reding@gmail.com, robh+dt@kernel.org, pawel.moll@arm.com,
mark.rutland@arm.com, ijc+devicetree@hellion.org.uk,
galak@codeaurora.org, boris.brezillon@free-electrons.com,
alexandre.belloni@free-electrons.com
Cc: linux-pwm@vger.kernel.org,
Claudiu Beznea <claudiu.beznea@microchip.com>,
linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org
Subject: [PATCH 1/2] drivers: pwm: pwm-atmel: add support for pwm on sama5d2
Date: Thu, 23 Feb 2017 10:38:39 +0200 [thread overview]
Message-ID: <1487839120-13650-2-git-send-email-claudiu.beznea@microchip.com> (raw)
In-Reply-To: <1487839120-13650-1-git-send-email-claudiu.beznea@microchip.com>
Enable PWM on sama5d2 by adding atmel_pwm_config_v3().
This, simply, sets the period and duty factor registers.
Signed-off-by: Claudiu Beznea <claudiu.beznea@microchip.com>
---
Documentation/devicetree/bindings/pwm/atmel-pwm.txt | 1 +
drivers/pwm/pwm-atmel.c | 16 ++++++++++++++++
2 files changed, 17 insertions(+)
diff --git a/Documentation/devicetree/bindings/pwm/atmel-pwm.txt b/Documentation/devicetree/bindings/pwm/atmel-pwm.txt
index 02331b9..c8c831d 100644
--- a/Documentation/devicetree/bindings/pwm/atmel-pwm.txt
+++ b/Documentation/devicetree/bindings/pwm/atmel-pwm.txt
@@ -4,6 +4,7 @@ Required properties:
- compatible: should be one of:
- "atmel,at91sam9rl-pwm"
- "atmel,sama5d3-pwm"
+ - "atmel,sama5d2-pwm"
- reg: physical base address and length of the controller's registers
- #pwm-cells: Should be 3. See pwm.txt in this directory for a
description of the cells format.
diff --git a/drivers/pwm/pwm-atmel.c b/drivers/pwm/pwm-atmel.c
index 0e4bd4e..4406639 100644
--- a/drivers/pwm/pwm-atmel.c
+++ b/drivers/pwm/pwm-atmel.c
@@ -207,6 +207,15 @@ static void atmel_pwm_config_v2(struct pwm_chip *chip, struct pwm_device *pwm,
}
}
+static void atmel_pwm_config_v3(struct pwm_chip *chip, struct pwm_device *pwm,
+ unsigned long dty, unsigned long prd)
+{
+ struct atmel_pwm_chip *atmel_pwm = to_atmel_pwm_chip(chip);
+
+ atmel_pwm_ch_writel(atmel_pwm, pwm->hwpwm, PWMV2_CDTY, dty);
+ atmel_pwm_ch_writel(atmel_pwm, pwm->hwpwm, PWMV2_CPRD, prd);
+}
+
static int atmel_pwm_set_polarity(struct pwm_chip *chip, struct pwm_device *pwm,
enum pwm_polarity polarity)
{
@@ -295,6 +304,10 @@ static const struct atmel_pwm_data atmel_pwm_data_v2 = {
.config = atmel_pwm_config_v2,
};
+static const struct atmel_pwm_data atmel_pwm_data_v3 = {
+ .config = atmel_pwm_config_v3,
+};
+
static const struct platform_device_id atmel_pwm_devtypes[] = {
{
.name = "at91sam9rl-pwm",
@@ -316,6 +329,9 @@ static const struct of_device_id atmel_pwm_dt_ids[] = {
.compatible = "atmel,sama5d3-pwm",
.data = &atmel_pwm_data_v2,
}, {
+ .compatible = "atmel,sama5d2-pwm",
+ .data = &atmel_pwm_data_v3,
+ }, {
/* sentinel */
},
};
--
2.7.4
next prev parent reply other threads:[~2017-02-23 8:38 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-02-23 8:38 [PATCH 0/2] drivers: pwm: add pwm support for sama5d2 Claudiu Beznea
2017-02-23 8:38 ` Claudiu Beznea [this message]
2017-02-23 9:16 ` [PATCH 1/2] drivers: pwm: pwm-atmel: add support for pwm on sama5d2 Alexandre Belloni
2017-02-27 15:23 ` m18063
2017-02-23 8:38 ` [PATCH 2/2] drivers: pwm: pwm-atmel: add support to allow run time changing of pwm parameters Claudiu Beznea
[not found] ` <1487839120-13650-3-git-send-email-claudiu.beznea-UWL1GkI3JZL3oGB3hsPCZA@public.gmane.org>
2017-02-23 9:21 ` Alexandre Belloni
2017-02-23 10:25 ` m18063
2017-02-23 10:32 ` Boris Brezillon
2017-02-23 10:32 ` Alexandre Belloni
[not found] ` <20170223103239.tv6nodddlar5l5fl-m++hUPXGwpdeoWH0uzbU5w@public.gmane.org>
2017-02-23 15:22 ` m18063
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=1487839120-13650-2-git-send-email-claudiu.beznea@microchip.com \
--to=claudiu.beznea@microchip.com \
--cc=alexandre.belloni@free-electrons.com \
--cc=boris.brezillon@free-electrons.com \
--cc=devicetree@vger.kernel.org \
--cc=galak@codeaurora.org \
--cc=ijc+devicetree@hellion.org.uk \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pwm@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=pawel.moll@arm.com \
--cc=robh+dt@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).