Commit 92fd8686 authored by Lokesh Vutla's avatar Lokesh Vutla Committed by Daniel Lezcano

clocksource/drivers/timer-ti-dm: Add support to get pwm current status

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: default avatarLokesh Vutla <lokeshvutla@ti.com>
Acked-by: default avatarTony Lindgen <tony@atomide.com>
Signed-off-by: default avatarDaniel Lezcano <daniel.lezcano@linaro.org>
Link: https://lore.kernel.org/r/20200305082715.15861-6-lokeshvutla@ti.com
parent aff7665d
...@@ -627,6 +627,20 @@ static int omap_dm_timer_set_pwm(struct omap_dm_timer *timer, int def_on, ...@@ -627,6 +627,20 @@ static int omap_dm_timer_set_pwm(struct omap_dm_timer *timer, int def_on,
return 0; 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, static int omap_dm_timer_set_prescaler(struct omap_dm_timer *timer,
int prescaler) int prescaler)
{ {
...@@ -927,6 +941,7 @@ static const struct omap_dm_timer_ops dmtimer_ops = { ...@@ -927,6 +941,7 @@ static const struct omap_dm_timer_ops dmtimer_ops = {
.set_load = omap_dm_timer_set_load, .set_load = omap_dm_timer_set_load,
.set_match = omap_dm_timer_set_match, .set_match = omap_dm_timer_set_match,
.set_pwm = omap_dm_timer_set_pwm, .set_pwm = omap_dm_timer_set_pwm,
.get_pwm_status = omap_dm_timer_get_pwm_status,
.set_prescaler = omap_dm_timer_set_prescaler, .set_prescaler = omap_dm_timer_set_prescaler,
.read_counter = omap_dm_timer_read_counter, .read_counter = omap_dm_timer_read_counter,
.write_counter = omap_dm_timer_write_counter, .write_counter = omap_dm_timer_write_counter,
......
...@@ -36,6 +36,7 @@ struct omap_dm_timer_ops { ...@@ -36,6 +36,7 @@ struct omap_dm_timer_ops {
unsigned int match); unsigned int match);
int (*set_pwm)(struct omap_dm_timer *timer, int def_on, int (*set_pwm)(struct omap_dm_timer *timer, int def_on,
int toggle, int trigger); int toggle, int trigger);
int (*get_pwm_status)(struct omap_dm_timer *timer);
int (*set_prescaler)(struct omap_dm_timer *timer, int prescaler); int (*set_prescaler)(struct omap_dm_timer *timer, int prescaler);
unsigned int (*read_counter)(struct omap_dm_timer *timer); unsigned int (*read_counter)(struct omap_dm_timer *timer);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment