pwm: omap-dmtimer: Allow for setting dmtimer clock source
authorIvaylo Dimitrov <ivo.g.dimitrov.75@gmail.com>
Wed, 22 Jun 2016 19:22:18 +0000 (22:22 +0300)
committerTony Lindgren <tony@atomide.com>
Thu, 30 Jun 2016 04:54:00 +0000 (21:54 -0700)
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>
Acked-by: Thierry Reding <treding@nvidia.com>
Acked-by: Pali Rohár <pali.rohar@gmail.com>
Signed-off-by: Tony Lindgren <tony@atomide.com>
Documentation/devicetree/bindings/pwm/pwm-omap-dmtimer.txt
drivers/pwm/pwm-omap-dmtimer.c

index 5befb538db950b8cbc444decce15415847275cd1..2e53324fb720db9b29db0baaf6bf878ce9b9fd0e 100644 (file)
@@ -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 {
index 3e95090cd7cf5c21c758225b547cb5c5c57ed7e0..5ad42f33e70c11d8efd0ef4a545f01bf948e3c76 100644 (file)
@@ -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;
This page took 0.027301 seconds and 5 git commands to generate.