Re: [v3,1/1] adv_mix955x is a scheme that multiplexes PCA9554/PCA9555 into LED and GPIO
From: Hans de Goede
Date: Thu May 06 2021 - 04:47:21 EST
Hi,
On 5/5/21 3:23 PM, Hans de Goede wrote:
> Hi,
>
> On 5/3/21 3:16 PM, yuechao.zhao(赵越超) wrote:
>> Hi Andy
>> Sorry for the late reply
>>
>> The reason for writing this driver is that our customers hope that the LED and GPIO can be used out of the box
>> When they using our X86-Platform
>>
>> About the document and ACPI expert, I will provide them after I improve them. Please wait for a few days.
>
> So my initial assessment of this code matches Andy's I don't like the idea
> of duplicating the GPIO chip functionality from drivers/gpio/gpio-pca953x.c here.
>
> I understand that you want to have things working out of the box and I believe
> that we all agree that that is what we want.
>
> But you can get there without duplicating the code.
>
> We already have cases where there is an I2C device with an existing driver
> where we need some "glue" code to translate the ACPI provided info to
> what the i2c drivers expect, some examples of these are:
>
> drivers/platform/x86/i2c-multi-instantiate.c
> drivers/platform/x86/intel_cht_int33fe_typec.c
>
> So what you need to do is basically start writing a completely new driver
> which:
>
> 1. Instantiates an i2c-client for the drivers/gpio/gpio-pca953x.c driver
> to bind to.
>
> 2. Creates and attaches software-fwnodes which provide info for the
> drivers/leds/leds-gpio.c code to parse and have that code instantiate
> LED class devices which drive the leds through the GPIO interface
> offered by the drivers/gpio/gpio-pca953x.c driver.
I just saw the "Advantech AHC1EC0 embedded controller" patch series
posted by your colleague Campion Kang (added to the Cc) it seems that
that series is using devicetree config bits embedded inside the ACPI
tables. If you can still change / update the ACPI tables then perhaps
using that would be an option here too ? And then just include the
whole GPIO LED descriptions inside the embedded devicetree bits.
Regards,
Hans
>> 在 2021/5/2 下午6:50,“Andy Shevchenko”<andy.shevchenko@xxxxxxxxx> 写入:
>>
>> On Fri, Apr 30, 2021 at 8:27 AM yuechao.zhao(赵越超)
>> <yuechao.zhao@xxxxxxxxxxxxxxxx> wrote:
>> >
>> > From: Yuechao Zhao <yuechao.zhao@xxxxxxxxxxxxxxxx>
>> >
>> > With this driver, we can multiplex PCA9554/PCA9555 into LED and GPIO
>> > based on the ACPI data of BIOS.
>>
>> NAK as per v2.
>>
>> Please, add a proper documentation and show ACPI excerpt, and last but
>> not least is missing justification.
>>
>>
>> --
>> With Best Regards,
>> Andy Shevchenko
>>