From: Ivaylo Dimitrov <ivo.g.dimitrov.75@gmail.com>
To: robh+dt@kernel.org, mark.rutland@arm.com,
ijc+devicetree@hellion.org.uk, galak@codeaurora.org,
thierry.reding@gmail.com, bcousson@baylibre.com,
tony@atomide.com, linux@arm.linux.org.uk,
mchehab@osg.samsung.com
Cc: devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-pwm@vger.kernel.org, linux-omap@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
linux-media@vger.kernel.org, sre@kernel.org,
pali.rohar@gmail.com, pavel@ucw.cz,
Ivaylo Dimitrov <ivo.g.dimitrov.75@gmail.com>
Subject: [RESEND PATCH v2 2/5] pwm: omap-dmtimer: Allow for setting dmtimer clock source
Date: Wed, 22 Jun 2016 22:22:18 +0300 [thread overview]
Message-ID: <1466623341-30130-3-git-send-email-ivo.g.dimitrov.75@gmail.com> (raw)
In-Reply-To: <1466623341-30130-1-git-send-email-ivo.g.dimitrov.75@gmail.com>
OMAP GP timers can have different input clocks that allow different PWM
frequencies. However, there is no other way of setting the clock source but
through clocks or clock-names properties of the timer itself. This limits
PWM functionality to only the frequencies allowed by the particular clock
source. Allowing setting the clock source by PWM rather than by timer
allows different PWMs to have different ranges by not hard-wiring the clock
source to the timer.
Signed-off-by: Ivaylo Dimitrov <ivo.g.dimitrov.75@gmail.com>
Acked-by: Rob Herring <robh@kernel.org>
---
Documentation/devicetree/bindings/pwm/pwm-omap-dmtimer.txt | 4 ++++
drivers/pwm/pwm-omap-dmtimer.c | 12 +++++++-----
2 files changed, 11 insertions(+), 5 deletions(-)
diff --git a/Documentation/devicetree/bindings/pwm/pwm-omap-dmtimer.txt b/Documentation/devicetree/bindings/pwm/pwm-omap-dmtimer.txt
index 5befb53..2e53324 100644
--- a/Documentation/devicetree/bindings/pwm/pwm-omap-dmtimer.txt
+++ b/Documentation/devicetree/bindings/pwm/pwm-omap-dmtimer.txt
@@ -9,6 +9,10 @@ Required properties:
Optional properties:
- ti,prescaler: Should be a value between 0 and 7, see the timers datasheet
+- ti,clock-source: Set dmtimer parent clock, values between 0 and 2:
+ - 0x00 - high-frequency system clock (timer_sys_ck)
+ - 0x01 - 32-kHz always-on clock (timer_32k_ck)
+ - 0x02 - external clock (timer_ext_ck, OMAP2 only)
Example:
pwm9: dmtimer-pwm@9 {
diff --git a/drivers/pwm/pwm-omap-dmtimer.c b/drivers/pwm/pwm-omap-dmtimer.c
index 3e95090..5ad42f3 100644
--- a/drivers/pwm/pwm-omap-dmtimer.c
+++ b/drivers/pwm/pwm-omap-dmtimer.c
@@ -245,7 +245,7 @@ static int pwm_omap_dmtimer_probe(struct platform_device *pdev)
struct pwm_omap_dmtimer_chip *omap;
struct pwm_omap_dmtimer_pdata *pdata;
pwm_omap_dmtimer *dm_timer;
- u32 prescaler;
+ u32 v;
int status;
pdata = dev_get_platdata(&pdev->dev);
@@ -306,10 +306,12 @@ static int pwm_omap_dmtimer_probe(struct platform_device *pdev)
if (pm_runtime_active(&omap->dm_timer_pdev->dev))
omap->pdata->stop(omap->dm_timer);
- /* setup dmtimer prescaler */
- if (!of_property_read_u32(pdev->dev.of_node, "ti,prescaler",
- &prescaler))
- omap->pdata->set_prescaler(omap->dm_timer, prescaler);
+ if (!of_property_read_u32(pdev->dev.of_node, "ti,prescaler", &v))
+ omap->pdata->set_prescaler(omap->dm_timer, v);
+
+ /* setup dmtimer clock source */
+ if (!of_property_read_u32(pdev->dev.of_node, "ti,clock-source", &v))
+ omap->pdata->set_source(omap->dm_timer, v);
omap->chip.dev = &pdev->dev;
omap->chip.ops = &pwm_omap_dmtimer_ops;
--
1.9.1
next prev parent reply other threads:[~2016-06-22 19:22 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-06-22 19:22 [RESEND PATCH v2 0/5] ir-rx51 driver fixes Ivaylo Dimitrov
2016-06-22 19:22 ` [RESEND PATCH v2 1/5] ir-rx51: Fix build after multiarch changes broke it Ivaylo Dimitrov
[not found] ` <1466623341-30130-2-git-send-email-ivo.g.dimitrov.75-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2016-06-23 17:48 ` Pali Rohár
2016-06-27 18:19 ` Ivaylo Dimitrov
[not found] ` <57716E27.2040702-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2016-06-30 4:49 ` Tony Lindgren
2016-06-22 19:22 ` Ivaylo Dimitrov [this message]
2016-06-23 8:24 ` [RESEND PATCH v2 2/5] pwm: omap-dmtimer: Allow for setting dmtimer clock source Thierry Reding
2016-06-22 19:22 ` [RESEND PATCH v2 3/5] ir-rx51: use PWM framework instead of OMAP dmtimer Ivaylo Dimitrov
2016-06-22 19:22 ` [RESEND PATCH v2 4/5] ir-rx51: add DT support to driver Ivaylo Dimitrov
2016-06-22 19:22 ` [RESEND PATCH v2 5/5] ir-rx51: use hrtimer instead of dmtimer Ivaylo Dimitrov
2016-06-23 4:44 ` [RESEND PATCH v2 0/5] ir-rx51 driver fixes Tony Lindgren
2016-07-04 7:07 ` Tony Lindgren
2016-06-23 17:51 ` Pali Rohár
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=1466623341-30130-3-git-send-email-ivo.g.dimitrov.75@gmail.com \
--to=ivo.g.dimitrov.75@gmail.com \
--cc=bcousson@baylibre.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-media@vger.kernel.org \
--cc=linux-omap@vger.kernel.org \
--cc=linux-pwm@vger.kernel.org \
--cc=linux@arm.linux.org.uk \
--cc=mark.rutland@arm.com \
--cc=mchehab@osg.samsung.com \
--cc=pali.rohar@gmail.com \
--cc=pavel@ucw.cz \
--cc=robh+dt@kernel.org \
--cc=sre@kernel.org \
--cc=thierry.reding@gmail.com \
--cc=tony@atomide.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).