[PATCH v2 02/10] pwm: Allow chips to support multiple PWMs.

Thierry Reding thierry.reding at avionic-design.de
Wed Feb 8 22:12:32 EST 2012


* Russell King - ARM Linux wrote:
> On Tue, Feb 07, 2012 at 08:04:00AM +0100, Thierry Reding wrote:
> > One of the major problems when converting to a non-global namespace is how to
> > represent the relationship in code. For device tree this should be easy to do
> > because it has all the infrastructure in place. For non-device-tree devices I
> > have no idea yet how this could be done. Perhaps by using something like the
> > clock API and using names for lookup?
> 
> Well, the first step is to make sure that the pwm 'chip' drivers don't
> know anything about the global numberspace.
> 
> That limits the extent of the global numberspace to the pwm core and
> pwm users.  You then don't have to worry about the pwm chip drivers
> while you work out how to solve the other half of the problem.

I see. That would mean that pwm_request() gets a global PWM index, looks up
the corresponding PWM chip and device then pass the chip-relative index to
the driver's ops.

I think that can be simplified even further. For instance if the pwm_device
structure contains a pointer to its parent struct pwm_chip, then that can be
used directly to call into the driver's ops. And the ops could be modified to
take a pwm_device instead of the global PWM index. That would be similar to
how struct irq_data is used.

Thierry
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://lists.ozlabs.org/pipermail/devicetree-discuss/attachments/20120208/57c89e5a/attachment.pgp>


More information about the devicetree-discuss mailing list