Re: [PATCH] gpio: New driver for GPO emulation using PWM generators

From: Grant Likely
Date: Fri Nov 23 2012 - 02:55:36 EST


On Thu, 22 Nov 2012 14:42:03 +0100, Peter Ujfalusi <peter.ujfalusi@xxxxxx> wrote:
> There seams to be board designs using PWM generators as enable/disable signals.
> For these boards we used to have custom code as hacks to deal with such a
> situations.
> With the gpio-pwm driver we can emulate the GPIO functionality using PWM
> generators via standard interfaces. The PWM will be configured to be off
> when the GPIO is off and to full duty cycle when the GPIO is requested to be
> on.
>
> Signed-off-by: Peter Ujfalusi <peter.ujfalusi@xxxxxx>
> ---
> Hi Linus,
>
> So this is the driver I came up regarding to the issue that some boards
> (BeagleBoard for example) are using the PWM generators as enable/disable signal.
>
> On BeagleBoard the situation is like this:
> TWL4030 PWMA -> TWL4030 LEDA -> nUSBHOST_PWR_EN -> external power switch -> USB
> host hub power.
>
> So I have tested this driver on BeagleBoard:
> - Custom code to toggle the GPIO just to see if it switches correctly
>
> - Real life usecase:
> fixed voltage regulator with GPIO control (the gpio is the gpio-pwm provided).
> ehci-omap has been modified to allow deferred probe.
> the regulator is used by ehci-omap.
>
> All works fine.

Ugh. and this is why I wanted the PWM and GPIO subsystems to use the
same namespace and binding. <grumble, mutter> But that's not your fault.

It's pretty horrible to have a separate translator node to convert a PWM
into a GPIO (with output only of course). The gpio properties should
appear directly in the PWM node itself and the translation code should
be in either the pwm or the gpio core. I don't think it should look like
a separate device.

g.

--
Grant Likely, B.Sc, P.Eng.
Secret Lab Technologies, Ltd.
--
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/