On Sun, Dec 13, 2020 at 10:48:39PM +0000, Daniel Scally wrote: > On 01/12/2020 18:49, Andy Shevchenko wrote: > >>>> + table_entry = (struct gpiod_lookup)GPIO_LOOKUP_IDX(acpi_dev_name(adev), > >>>> + ares->data.gpio.pin_table[0], > >>>> + func, 0, GPIO_ACTIVE_HIGH); > >>> > >>> You won't need this if you have regular INT3472 platform driver. > >>> Simple call there _DSM to map resources to the type and use devm_gpiod_get on > >>> consumer behalf. Thus, previous patch is not needed. > >> > >> How does the consumer (the camera sensor) retrieve the GPIO though ? The > >> _DSM is in the PMIC device object, while the real consumer is the camera > >> sensor. > > > > 1. A GPIO proxy > > 2. A custom GPIO lookup tables > > 3. An fwnode passing to the sensor (via swnodes graph) > > > > First may issue deferred probe, while second needs some ordering tricks I guess. > > Third one should also provide an ACPI GPIO mapping table or so to make the > > consumer rely on names rather than custom numbers. > > > > Perhaps someone may propose other solutions. > > Hi Andy > > Sorry; some more clarification here if you have time please: No problem, thanks for discussing this. > 1. Do you mean here, register a new gpio_chip providing GPIOs to the > sensors, and just have the .set() callback for that function set the > corresponding line against the INT3472 device? Yes. On one hand it should be a consumer (*gpiod_get*() family of APIs), on the other it should be provider of known (artificial) GPIO chip. > 2. I thought custom GPIO lookup tables was what I was doing, are you > referring to something else? I think so, i.e. nothing else from high point of view. > 3. I guess you mean something like of_find_gpio() and acpi_find_gpio() > here? As far as I can see there isn't currently a swnodes > equivalent...we could just pass it via reference of course but it would > mean the sensor drivers would all need to account for that. Theoretically we may provide GPIOs as swnodes. In that case the consumer will get them as usual But I think it may be too complicated / over engineered. -- With Best Regards, Andy Shevchenko