[lkml]   [2011]   [Mar]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: [PWM v6 1/3] PWM: Implement a generic PWM framework

On Mon, Mar 7, 2011 at 1:26 PM, Lars-Peter Clausen <> wrote:
> I was thinking about an interface similar to gpio_to_irq. So you could map a
> PWM device to a IRQ number and use the existing the existing genirq framework
> to manage the callback handler.

I really like this idea, though at the moment I don't see clearly how
to implement it. I'm just a little rusty on those data structures,
that's all.

I'm going to pull all of the callback functionality out of the API,
and will take it as a task to make something like this possible in a
future update:

struct pwm_device *p;
request_irq(pwm_to_irq(p), my_pwm_callback, ...);

> Maybe I'm on the wrong track here though. Could you explain what your expected
> use case is for this part of the API? For example what would a driver using a
> PWM device normally be doing in the handler it passed to the PWM device?

Honestly, I'm not really sure how useful the callback functionality
is. In fact, it's probably a bad idea to offer it because it allows
someone to do pulse counting for things like stepper motors, and I'm
already thinking about an API for that. Abusing a PWM to do pulse
counting is pretty CPU-intensive.

The only time end-of-period interrupts come up is when someone wants
to do a coordinated stop i.e. doesn't want a short pulse. But that's
really a concern for the driver, not users.

So in the above where I said that I might put the callback-like
functionality back into the API, actually I might not. :)

Bill Gatliff

 \ /
  Last update: 2011-03-09 17:19    [W:0.048 / U:8.104 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site