Skip to contentSkip to conversation

adv_mix955x is a scheme that multiplexes PCA9554/PCA9555 into LED and GPIO

PATCH yuechao.zhao(赵越超) 3 participants 5 messages Apr 30, 2021 – May 6, 2021 1 message not in the archive x86 platform drivers

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw

From: Yuechao Zhao <[email protected]>

With this driver, we can multiplex PCA9554/PCA9555 into LED and GPIO based on the ACPI data of BIOS.

v3:
- Cc LED drivers to the LED maintainers
- delete useless comments
v2:
- alphabetical order title ("ADVANTECH MIX995X DRIVER")

---
 MAINTAINERS                        |   6 +
 drivers/platform/x86/Kconfig       |  14 +
 drivers/platform/x86/Makefile      |   3 +
 drivers/platform/x86/adv_mix955x.c | 699 +++++++++++++++++++++++++++++
 4 files changed, 722 insertions(+)
 create mode 100644 drivers/platform/x86/adv_mix955x.c
MAINTAINERS +6 -0
index d92f85ca831d..90033699334c 100644
@@ -573,6 +573,12 @@ S:	Maintained
 F:	Documentation/scsi/advansys.rst
 F:	drivers/scsi/advansys.c
 
+ADVANTECH MIX995X DRIVER
+M:	Yuechao Zhao <[email protected]>
+M:	Sui Jia <[email protected]>
+S:	Maintained
+F:	drivers/platform/x86/adv_mix955x.c
+
 ADXL34X THREE-AXIS DIGITAL ACCELEROMETER DRIVER (ADXL345/ADXL346)
 M:	Michael Hennerich <[email protected]>
 S:	Supported
drivers/platform/x86/Kconfig +14 -0
index ad4e630e73e2..ccead75c764b 100644
@@ -1284,6 +1284,20 @@ config INTEL_TELEMETRY
 	  directly via debugfs files. Various tools may use
 	  this interface for SoC state monitoring.
 
+config ADV_MIX955X
+    tristate "Advantech LEDs and GPIOs Driver"
+    depends on X86_64
+    depends on ACPI && GPIOLIB
+    select LEDS_CLASS
+    select LEDS_TRIGGERS
+    help
+      This driver is based on the kernel driver leds-pca955x
+      and gpio-pca953x but rewrite for PCA9554/PCA9555.
+      This driver requires LED data which is defined inside
+      ACPI DSDT or devicetree.
+      In addition, the pin that is not defined as LED will
+      be declared as GPIO.
+
 endif # X86_PLATFORM_DEVICES
 
 config PMC_ATOM
drivers/platform/x86/Makefile +3 -0
index 60d554073749..5ecad0ae925e 100644
@@ -138,3 +138,6 @@ obj-$(CONFIG_INTEL_TELEMETRY)		+= intel_telemetry_core.o \
 					   intel_telemetry_pltdrv.o \
 					   intel_telemetry_debugfs.o
 obj-$(CONFIG_PMC_ATOM)			+= pmc_atom.o
+
+# Advantech
+obj-$(CONFIG_ADV_MIX955X)		+= adv_mix955x.o
drivers/platform/x86/adv_mix955x.c new file +699 -0

699 lines not on this page · raw message

Signature · 1 line
2.27.0
#2 lore raw
Quoted 5 lines · yuechao.zhao(赵越超)

From: Yuechao Zhao <[email protected]>

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.

Signature · 2 lines
With Best Regards,
Andy Shevchenko
#3 lore raw

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.

Thank you very much

Yuechao Zhao

在 2021/5/2 下午6:50,“Andy Shevchenko”<[email protected]> 写入:

On Fri, Apr 30, 2021 at 8:27 AM yuechao.zhao(赵越超) <[email protected]> wrote:
>
> From: Yuechao Zhao <[email protected]>
>
> 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

#4 lore raw

Hi,

Quoted 7 lines · yuechao.zhao(赵越超)

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.

Regards,

Hans

Quoted 20 lines

在 2021/5/2 下午6:50,“Andy Shevchenko”<[email protected]> 写入:

On Fri, Apr 30, 2021 at 8:27 AM yuechao.zhao(赵越超) <[email protected]> wrote:
>
> From: Yuechao Zhao <[email protected]>
>
> 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

#5 lore raw

Hi,

Quoted 29 lines · Hans de Goede

Hi,

Quoted 7 lines · yuechao.zhao(赵越超)

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:

Quoted 7 lines

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

Quoted 20 lines
Quoted 20 lines

在 2021/5/2 下午6:50,“Andy Shevchenko”<[email protected]> 写入:

On Fri, Apr 30, 2021 at 8:27 AM yuechao.zhao(赵越超) <[email protected]> wrote:
>
> From: Yuechao Zhao <[email protected]>
>
> 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