@@ -46,7 +46,7 @@ struct pwm_omap_dmtimer_chip {
const struct omap_dm_timer_ops *pdata;
struct platform_device *dm_timer_pdev;
unsigned long freq;
- unsigned int ev_cnt, overflow, width;
+ unsigned int ev_cnt, overflow, width, counter_irq, counter_captured;
};
static inline struct pwm_omap_dmtimer_chip *
@@ -280,6 +280,8 @@ static int pwm_omap_dmtimer_capture(struct pwm_chip *chip,
omap->ev_cnt = omap->width = 0;
spin_unlock_irqrestore(&omap->lock, flags);
+ printk("diff: %d\n", pwm_omap_dmtimer_ticks_to_ns(omap, omap->counter_irq - omap->counter_captured));
+
res = wait_event_interruptible_timeout(omap->wait,
omap->width > 0,
timeout);
@@ -317,6 +319,8 @@ static irqreturn_t pwm_omap_dmtimer_irq(int irq, void *dev_id)
if (l & OMAP_TIMER_INT_CAPTURE) {
if (!omap->width && omap->ev_cnt == 1) {
omap->pdata->read_capture(omap->dm_timer, &c1, &c2);
+ omap->counter_irq = omap->pdata->read_counter(omap->dm_timer);
+ omap->counter_captured = c2;
omap->width = pwm_omap_dmtimer_get_width(omap, c1, c2);
wake_up(&omap->wait);
}