Re: [PWM v6 1/3] PWM: Implement a generic PWM framework

From: Bill Gatliff
Date: Wed Mar 09 2011 - 11:15:59 EST


Lars-Peter:

On Mon, Mar 7, 2011 at 1:26 PM, Lars-Peter Clausen <lars@xxxxxxxxxx> 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. :)


b.g.
--
Bill Gatliff
bgat@xxxxxxxxxxxxxxx
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/