]> Git Repo - linux.git/commitdiff
clocksource/drivers/timer-ti-dm: Add support to get pwm current status
authorLokesh Vutla <[email protected]>
Thu, 5 Mar 2020 08:27:14 +0000 (13:57 +0530)
committerDaniel Lezcano <[email protected]>
Mon, 16 Mar 2020 11:40:42 +0000 (12:40 +0100)
omap_dm_timer_ops provide support to configure the pwm but there is no
support to get the current status. For configuring pwm it is advised to
check the current hw status instead of relying on pwm framework. So
implement a new timer ops to get the current status of pwm.

Signed-off-by: Lokesh Vutla <[email protected]>
Acked-by: Tony Lindgen <[email protected]>
Signed-off-by: Daniel Lezcano <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
drivers/clocksource/timer-ti-dm.c
include/linux/platform_data/dmtimer-omap.h

index b565b8456e5cd970d573e3130c6140a7380f96d6..73ac73efdef83b7bfbf47892506ca78cd6326fb8 100644 (file)
@@ -627,6 +627,20 @@ static int omap_dm_timer_set_pwm(struct omap_dm_timer *timer, int def_on,
        return 0;
 }
 
+static int omap_dm_timer_get_pwm_status(struct omap_dm_timer *timer)
+{
+       u32 l;
+
+       if (unlikely(!timer))
+               return -EINVAL;
+
+       omap_dm_timer_enable(timer);
+       l = omap_dm_timer_read_reg(timer, OMAP_TIMER_CTRL_REG);
+       omap_dm_timer_disable(timer);
+
+       return l;
+}
+
 static int omap_dm_timer_set_prescaler(struct omap_dm_timer *timer,
                                        int prescaler)
 {
@@ -927,6 +941,7 @@ static const struct omap_dm_timer_ops dmtimer_ops = {
        .set_load = omap_dm_timer_set_load,
        .set_match = omap_dm_timer_set_match,
        .set_pwm = omap_dm_timer_set_pwm,
+       .get_pwm_status = omap_dm_timer_get_pwm_status,
        .set_prescaler = omap_dm_timer_set_prescaler,
        .read_counter = omap_dm_timer_read_counter,
        .write_counter = omap_dm_timer_write_counter,
index bdaaf537604af9376db266d3ea667382f9853710..3173b7b6ff6f30dd85d3e6c0e586d35144711e60 100644 (file)
@@ -36,6 +36,7 @@ struct omap_dm_timer_ops {
                             unsigned int match);
        int     (*set_pwm)(struct omap_dm_timer *timer, int def_on,
                           int toggle, int trigger);
+       int     (*get_pwm_status)(struct omap_dm_timer *timer);
        int     (*set_prescaler)(struct omap_dm_timer *timer, int prescaler);
 
        unsigned int (*read_counter)(struct omap_dm_timer *timer);
This page took 0.079261 seconds and 4 git commands to generate.