[RFC 2/7] pwm: Allow chips to support multiple PWMs.
Thierry Reding
thierry.reding at avionic-design.de
Thu Dec 22 17:57:11 EST 2011
* Stephen Warren wrote:
> Thierry Reding wrote at Wednesday, December 21, 2011 7:10 AM:
> > * Thierry Reding wrote:
> > > * Stephen Warren wrote:
> > > > In other words, can you do away with NR_PWM, and make it completely
> > > > dynamic?
> > >
> > > IRQ can be configured to use a radix tree if CONFIG_SPARSE_IRQ=y. I guess it
> > > doesn't hurt to always use a radix tree for PWM, so I'll read up on it and
> > > will try to address that in the next version.
> >
> > I guess something like idr/ida can be used to dynamically assign a PWM ID,
> > which would allow us to get rid of the bitmap. Then again, ida itself is not
> > much more than a bitmap either. It would complicate things a little in that
> > the ID assignment could no longer be assumed to be sequential for one given
> > PWM chip, so the lookup (or rather mapping the ID to a chip-relative number)
> > will be trickier to do.
>
> You can support both dynamic assignment of IDs, and assigning each PWM
> chip's IDs in a contiguous block. Just search for n contiguous free IDs
> instead of looping n times looking for 1 free ID.
Yes, but that doesn't buy us anything over using a bitmap like we're doing
now, since ida is really only a bitmap with a different API on top (it is
also limited to 1024 entries). For our purposes, using a bitmap should work
just as well.
> > Interestingly though it uses per-device numbering as well, which would be
> > fine for PWM as well if we had only device tree based probing. In order to
> > support other devices, we'll still need a global namespace.
>
> Yes, that's probably true. I guess a global namespace is reasonable for
> now. If you do plan to rework the API though, the sooner the better since
> the tree will grow fewer users before it's done:-)
Right =) If you think it better to do it all in one go, perhaps we should
rather get the API rework done now. I was hoping it could be avoided, but
perhaps it would be just as well to bite the bullet now. Perhaps Sascha or
Arnd (Cc'ed) can comment on this. One of the reasons why Sascha's solution
was preferred over Bill Gatliff's proposal was that it doesn't change the
existing API.
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/20111222/37681c56/attachment.pgp>
More information about the devicetree-discuss
mailing list