Re: [PATCH v2 0/2] pinctrl: Intel Cherryview/Braswell support

Rafael J. Wysocki
2014-11-04T22:52:23Z

On Tuesday, November 04, 2014 04:39:12 PM Timur Tabi wrote:
> On 11/04/2014 04:32 PM, Timur Tabi wrote:
> >
> > There are lots of situations where you don't know the size of the
> > property in advance (e.g. strings), and drivers use of_find_property()
> > or of_get_property() to pre-allocate a buffer or to verify that the
> > property is correctly formed in the device tree.
>
> To follow-up, I have this problem right now with pinctrl_dt_to_map().
> The pinctrl-%d property in the device tree is an array of phandles. The
> array can be any size, and pinctrl_dt_to_map() queries the size of the
> property to determine how many phandles there are. It iterates over all
> of them. How do I support that with device_property_read_u32_array()?
> That function expects to be told how many phandles there are, and it
> doesn't even tell me if there are more or fewer than the number I've given.

Well, first of all, you won't use phandles with ACPI. :-)

That seems to be the case in which some ACPI-specific code would need to be
written. In ACPI, instead of the list of phandles you'll have a list of
references to device objects that you can walk in an analogous way. I'm
not sure how much of that code can be shared between DT and ACPI ATM, but
it looks like at least some of it can be shared.

And it looks like we'll need a device_property_read_string_index(). :-)

BTW, where's the pinctrl binding documented?

Rafael