ACPI: Adding new acpi_driver type drivers ?
Subsystems (3)
cover ACPI: Adding new acpi_driver type drivers ?
Hi Rafael,
I recently learned that some Dell AIOs (1) use a backlight controller board connected to an UART. Canonical even submitted a driver for this in 2017:
https://lkml.org/lkml/2017/10/26/78
This UART has a DELL0501 HID with CID set to PNP0501 so that the UART is still handled by 8250_pnp.c. Unfortunately there is no separate ACPI device with an UartSerialBusV2() resource to model the backlight-controller.
The RFC patch 2/2 in this series uses acpi_quirk_skip_serdev_enumeration() to still create a serdev for this for a backlight driver to bind to instead of creating a /dev/ttyS0.
Like other cases where the UartSerialBusV2() resource is missing or broken this will only create the serdev-controller device and the serdev-device itself will need to be instantiated by the consumer (the backlight driver).
Unlike existing other cases which use DMI modaliases to load on a specific board to work around brokeness of that board's specific ACPI tables, the intend here is to have a single driver for all Dell AIOs using the DELL0501 HID for their UART, without needing to maintain a list of DMI matches.
This means that the dell-uart-backlight driver will need something to bind to. The original driver from 2017 used an acpi_driver for this matching on and binding to the DELL0501 acpi_device.
AFAIK you are trying to get rid of having drivers bind directly to acpi_device-s so I assume that you don't want me to introduce a new one. So to get a device to bind to without introducing a new acpi_driver patch 2/2 if this series creates a platform_device for this.
The creation of this platform_device is why this is marked as RFC, if you are ok with this solution I guess you can merge this series already as is. With the caveat that the matching dell-uart-backlight driver is still under development (its progressing nicely and the serdev-device instantation + binding a serdev driver to it already works).
If you have a different idea how to handle this I'm certainly open to suggestions.
Regards,
Hans
1) All In One a monitor with a PC builtin
p.s.
I also tried this approach, but that did not work:
This was an attempt to create both a pdev from acpi_default_enumeration() by making the PNP scan handler attach() method return 0 rather then 1; and get a pnp_device created for the UART driver as well by making acpi_is_pnp_device() return true.
This approach does not work due to the following code in pnpacpi_add_device():
/* Skip devices that are already bound */ if (device->physical_node_count) return 0;
drivers/acpi/acpi_pnp.c +12 -2
@@ -353,10 +353,17 @@ static bool acpi_pnp_match(const char *idstr, const struct acpi_device_id **matc* given ACPI device object, the PNP scan handler will not attach to that * object, because there is a proper non-PNP driver in the kernel for the * device represented by it. +* +* The DELL0501 ACPI HID represents an UART (CID is set to PNP0501) with +* a backlight-controller attached. There is no separate ACPI device with +* an UartSerialBusV2() resource to model the backlight-controller. +* This setup requires instantiating both a pnp_device for the UART as well +* as a platform_device for the backlight-controller driver to bind too. */ static const struct acpi_device_id acpi_nonpnp_device_ids[] = { {"INTC1080" }, {"INTC1081" }, + {"DELL0501" }, {"" }, };
@@ -376,13 +383,16 @@ static struct acpi_scan_handler acpi_pnp_handler = {* For CMOS RTC devices, the PNP ACPI scan handler does not work, because * there is a CMOS RTC ACPI scan handler installed already, so we need to * check those devices and enumerate them to the PNP bus directly. +* For DELL0501 devices the PNP ACPI scan handler is skipped to create +* a platform_device, see the acpi_nonpnp_device_ids[] comment. */ -static int is_cmos_rtc_device (struct acpi_device *adev) +static int is_special_pnp_device (struct acpi_device *adev) {static const struct acpi_device_id ids[] = { {"PNP0B00" }, {"PNP0B01" }, {"PNP0B02" }, + {"DELL0501" }, {"" }, };return !acpi_match_device_ids (adev, ids);
@@ -390,7 +400,7 @@ static int is_cmos_rtc_device(struct acpi_device *adev)bool acpi_is_pnp_device (struct acpi_device *adev) { -return adev->handler == &acpi_pnp_handler ||is_cmos_rtc_device (adev); +return adev->handler == &acpi_pnp_handler ||is_special_pnp_device (adev); }EXPORT_SYMBOL_GPL (acpi_is_pnp_device);
Hans de Goede (2):
ACPI: x86: Move acpi_quirk_skip_serdev_enumeration() out of
CONFIG_X86_ANDROID_TABLETS
ACPI: x86: Add DELL0501 handling to
acpi_quirk_skip_serdev_enumeration()
drivers/acpi/x86/utils.c | 38 ++++++++++++++++++++++++++++++++++---- include/acpi/acpi_bus.h | 22 +++++++++++----------- 2 files changed, 45 insertions(+), 15 deletions(-)
Signature · 1 line
2.43.0
RFC 1/2 ACPI: x86: Move acpi_quirk_skip_serdev_enumeration() out of CONFIG_X86_ANDROID_TABLETS
Some recent(ish) Dell AIO devices have a backlight controller board connected to an UART.
This UART has a DELL0501 HID with CID set to PNP0501 so that the UART is still handled by 8250_pnp.c. Unfortunately there is no separate ACPI device with an UartSerialBusV2() resource to model the backlight-controller.
The next patch in this series will use acpi_quirk_skip_serdev_enumeration() to still create a serdev for this for a backlight driver to bind to instead of creating a /dev/ttyS0.
This new acpi_quirk_skip_serdev_enumeration() use is not limited to Android X86 tablets, so move it out of the ifdef CONFIG_X86_ANDROID_TABLETS block.
--- drivers/acpi/x86/utils.c | 18 ++++++++++++++---- include/acpi/acpi_bus.h | 22 +++++++++++----------- 2 files changed, 25 insertions(+), 15 deletions(-)
drivers/acpi/x86/utils.c +14 -4
@@ -437,7 +437,7 @@ bool acpi_quirk_skip_i2c_client_enumeration(struct acpi_device *adev) }EXPORT_SYMBOL_GPL (acpi_quirk_skip_i2c_client_enumeration); -int acpi_quirk_skip_serdev_enumeration (struct device *controller_parent,bool *skip) +static int acpi_dmi_skip_serdev_enumeration (struct device *controller_parent,bool *skip) {struct acpi_device *adev =ACPI_COMPANION (controller_parent);const struct dmi_system_id *dmi_id;
@@ -445,8 +445,6 @@ int acpi_quirk_skip_serdev_enumeration(struct device *controller_parent, bool *su64 uid;int ret; - *skip = false; - ret =acpi_dev_uid_to_integer (adev, &uid);if (ret)return 0 ;
@@ -472,7 +470,6 @@ int acpi_quirk_skip_serdev_enumeration(struct device *controller_parent, bool *sreturn 0 ; } -EXPORT_SYMBOL_GPL (acpi_quirk_skip_serdev_enumeration);bool acpi_quirk_skip_gpio_event_handlers (void ) {
@@ -487,8 +484,21 @@ bool acpi_quirk_skip_gpio_event_handlers(void)return (quirks &ACPI_QUIRK_SKIP_GPIO_EVENT_HANDLERS ); }EXPORT_SYMBOL_GPL (acpi_quirk_skip_gpio_event_handlers); +#else +static int acpi_dmi_skip_serdev_enumeration (struct device *controller_parent,bool *skip) +{ +return 0 ; +}#endif +int acpi_quirk_skip_serdev_enumeration (struct device *controller_parent,bool *skip) +{ + *skip = false; + +return acpi_dmi_skip_serdev_enumeration (controller_parent, skip); +} +EXPORT_SYMBOL_GPL (acpi_quirk_skip_serdev_enumeration); +/* Lists of PMIC ACPI HIDs with an (often better) native charger driver */ static const struct { const char *hid;
include/acpi/acpi_bus.h +11 -11
@@ -749,6 +749,7 @@ bool acpi_device_override_status(struct acpi_device *adev, unsigned long long *sbool acpi_quirk_skip_acpi_ac_and_battery (void );int acpi_install_cmos_rtc_space_handler (acpi_handle handle);void acpi_remove_cmos_rtc_space_handler (acpi_handle handle); +int acpi_quirk_skip_serdev_enumeration (struct device *controller_parent,bool *skip);#else static inline bool acpi_device_override_status (struct acpi_device *adev,unsigned long long *status)
@@ -766,23 +767,22 @@ static inline int acpi_install_cmos_rtc_space_handler(acpi_handle handle)static inline void acpi_remove_cmos_rtc_space_handler (acpi_handle handle) { } -#endif - -#if IS_ENABLED (CONFIG_X86_ANDROID_TABLETS ) -bool acpi_quirk_skip_i2c_client_enumeration (struct acpi_device *adev); -int acpi_quirk_skip_serdev_enumeration (struct device *controller_parent,bool *skip); -bool acpi_quirk_skip_gpio_event_handlers (void ); -#else -static inline bool acpi_quirk_skip_i2c_client_enumeration (struct acpi_device *adev) -{ -return false; -}static inline int acpi_quirk_skip_serdev_enumeration (struct device *controller_parent,bool *skip) { *skip = false;return 0 ; } +#endif + +#if IS_ENABLED (CONFIG_X86_ANDROID_TABLETS ) +bool acpi_quirk_skip_i2c_client_enumeration (struct acpi_device *adev); +bool acpi_quirk_skip_gpio_event_handlers (void ); +#else +static inline bool acpi_quirk_skip_i2c_client_enumeration (struct acpi_device *adev) +{ +return false; +}static inline bool acpi_quirk_skip_gpio_event_handlers (void ) {return false;
Signature · 1 line
2.43.0
Re: [RFC 1/2] ACPI: x86: Move acpi_quirk_skip_serdev_enumeration() out of CONFIG_X86_ANDROID_TABLETS
Quoted 14 lines · Hans de Goede
Some recent(ish) Dell AIO devices have a backlight controller board connected to an UART.
This UART has a DELL0501 HID with CID set to PNP0501 so that the UART is still handled by
8250_pnp.c. Unfortunately there is no separate ACPI device with anUartSerialBusV2()resource to model the backlight-controller.The next patch in this series will use
acpi_quirk_skip_serdev_enumeration()to still create a serdev for this for a backlight driver to bind to instead of creating a/dev/ttyS0.This new
acpi_quirk_skip_serdev_enumeration()use is not limited to Android X86 tablets, so move it out of the ifdefCONFIG_X86_ANDROID_TABLETSblock.
...
Quoted 6 lines
drivers/acpi/x86/utils.c +5
-0+#else +static int acpi_dmi_skip_serdev_enumeration (struct device *controller_parent,bool *skip) +{ +return 0 ; +}#endif
...
Quoted 7 lines
static inline int
acpi_quirk_skip_serdev_enumeration(struct device *controller_parent, bool *skip){ *skip = false; return 0;}
+#endif
Now you have basically two identical blocks in two files. I believe you may reorganize the code to have only one of these.
Signature · 2 lines
With Best Regards, Andy Shevchenko
Re: [RFC 1/2] ACPI: x86: Move acpi_quirk_skip_serdev_enumeration() out of CONFIG_X86_ANDROID_TABLETS
Hi,
Quoted 35 lines · Andy Shevchenko
Quoted 14 lines · Hans de Goede
Some recent(ish) Dell AIO devices have a backlight controller board connected to an UART.
This UART has a DELL0501 HID with CID set to PNP0501 so that the UART is still handled by
8250_pnp.c. Unfortunately there is no separate ACPI device with anUartSerialBusV2()resource to model the backlight-controller.The next patch in this series will use
acpi_quirk_skip_serdev_enumeration()to still create a serdev for this for a backlight driver to bind to instead of creating a/dev/ttyS0.This new
acpi_quirk_skip_serdev_enumeration()use is not limited to Android X86 tablets, so move it out of the ifdefCONFIG_X86_ANDROID_TABLETSblock....
Quoted 6 lines
drivers/acpi/x86/utils.c +5
-0+#else +static int acpi_dmi_skip_serdev_enumeration (struct device *controller_parent,bool *skip) +{ +return 0 ; +}#endif ...
Quoted 7 lines
static inline int
acpi_quirk_skip_serdev_enumeration(struct device *controller_parent, bool *skip){ *skip = false; return 0;}
+#endif
Quoted 2 lines
Now you have basically two identical blocks in two files. I believe you may reorganize the code to have only one of these.
One is #if IS_ENABLED(CONFIG_X86_ANDROID_TABLETS) the other is #ifdef CONFIG_X86
Also one is for a private helper, the other is for a public function.
The whole idea of this patch is actually to have both, with the upcoming DELL0501 handling we want acpi_quirk_skip_serdev_enumeration() to be defined (and not just an inline stub in the .h) independent of IS_ENABLED(CONFIG_X86_ANDROID_TABLETS), the first #if block provides a dummy for the x86-android specific bits for
the now always defined acpi_quirk_skip_serdev_enumeration() to call when CONFIG_X86_ANDROID_TABLETS is not set.
The second #if is because acpi_quirk_skip_serdev_enumeration() still is only defined on X86 platforms and on non x86 platforms we need a stub for it in the public .h file.
Regards,
Hans
RFC 2/2 ACPI: x86: Add DELL0501 handling to acpi_quirk_skip_serdev_enumeration()
In reply to Hans de GoedeSome recent(ish) Dell AIO devices have a backlight controller board connected to an UART.
This UART has a DELL0501 HID with CID set to PNP0501 so that the UART is still handled by 8250_pnp.c. Unfortunately there is no separate ACPI device with an UartSerialBusV2() resource to model the backlight-controller. This causes the kernel to create a /dev/ttyS0 char-device for the UART instead of creating an in kernel serdev-controller + serdev-device pair for a kernel backlight driver.
Use the existing acpi_quirk_skip_serdev_enumeration() mechanism to work around this by returning skip=true for tty-ctrl parents with a HID of DELL0501.
Like other cases where the UartSerialBusV2() resource is missing or broken this will only create the serdev-controller device and the serdev-device itself will need to be instantiated by platform code.
Unfortunately in this case there is no device for the platform-code instantiating the serdev-device to bind to. So also create a platform_device for this.
--- drivers/acpi/x86/utils.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+)
drivers/acpi/x86/utils.c +20 -0
@@ -493,8 +493,28 @@ static int acpi_dmi_skip_serdev_enumeration(struct device *controller_parent, boint acpi_quirk_skip_serdev_enumeration (struct device *controller_parent,bool *skip) { +struct acpi_device *adev =ACPI_COMPANION (controller_parent); + *skip = false; +/* +* The DELL0501 ACPI HID represents an UART (CID is set to PNP0501) with +* a backlight-controller attached. There is no separate ACPI device with +* an UartSerialBusV2() resource to model the backlight-controller. +* Set skip to true so that the tty core creates a serdev ctrl device. +* The backlight driver will manually create the serdev client device. +*/ +if (acpi_dev_hid_match (adev,"DELL0501" )) { + *skip = true; +/* +* Create a platform dev for dell-uart-backlight to bind to. +* This is a static device, so no need to store the result. +*/ +platform_device_register_simple ("dell-uart-backlight" ,PLATFORM_DEVID_NONE , +NULL ,0 ); +return 0 ; + } +return acpi_dmi_skip_serdev_enumeration (controller_parent, skip); }EXPORT_SYMBOL_GPL (acpi_quirk_skip_serdev_enumeration);
Signature · 1 line
2.43.0
Rafael J. Wysocki
maintainerHi Hans,
Quoted 28 lines · Hans de Goede
Hi Rafael,
I recently learned that some Dell AIOs (1) use a backlight controller board connected to an UART. Canonical even submitted a driver for this in 2017:
https://lkml.org/lkml/2017/10/26/78This UART has a DELL0501 HID with CID set to PNP0501 so that the UART is still handled by
8250_pnp.c. Unfortunately there is no separate ACPI device with anUartSerialBusV2()resource to model the backlight-controller.The RFC patch 2/2 in this series uses
acpi_quirk_skip_serdev_enumeration()to still create a serdev for this for a backlight driver to bind to instead of creating a/dev/ttyS0.Like other cases where the
UartSerialBusV2()resource is missing or broken this will only create the serdev-controller device and the serdev-device itself will need to be instantiated by the consumer (the backlight driver).Unlike existing other cases which use DMI modaliases to load on a specific board to work around brokeness of that board's specific ACPI tables, the intend here is to have a single driver for all Dell AIOs using the DELL0501 HID for their UART, without needing to maintain a list of DMI matches.
This means that the dell-uart-backlight driver will need something to bind to. The original driver from 2017 used an
acpi_driverfor this matching on and binding to the DELL0501acpi_device.
Quoted 8 lines
AFAIK you are trying to get rid of having drivers bind directly to acpi_device-s so I assume that you don't want me to introduce a new one. So to get a device to bind to without introducing a new
acpi_driverpatch 2/2 if this series creates aplatform_devicefor this.The creation of this
platform_deviceis why this is marked as RFC, if you are ok with this solution I guess you can merge this series already as is.
OK
Quoted 7 lines
With the caveat that the matching dell-uart-backlight driver is still under development (its progressing nicely and the serdev-device instantation + binding a serdev driver to it already works).
If you have a different idea how to handle this I'm certainly open to suggestions.
I agree with the approach, thanks!
Hi Hans,
Quoted 33 lines · Hans de Goede
Hi Rafael,
I recently learned that some Dell AIOs (1) use a backlight controller board connected to an UART. Canonical even submitted a driver for this in 2017:
https://lkml.org/lkml/2017/10/26/78This UART has a DELL0501 HID with CID set to PNP0501 so that the UART is still handled by
8250_pnp.c. Unfortunately there is no separate ACPI device with anUartSerialBusV2()resource to model the backlight-controller.The RFC patch 2/2 in this series uses
acpi_quirk_skip_serdev_enumeration()to still create a serdev for this for a backlight driver to bind to instead of creating a/dev/ttyS0.Like other cases where the
UartSerialBusV2()resource is missing or broken this will only create the serdev-controller device and the serdev-device itself will need to be instantiated by the consumer (the backlight driver).Unlike existing other cases which use DMI modaliases to load on a specific board to work around brokeness of that board's specific ACPI tables, the intend here is to have a single driver for all Dell AIOs using the DELL0501 HID for their UART, without needing to maintain a list of DMI matches.
This means that the dell-uart-backlight driver will need something to bind to. The original driver from 2017 used an
acpi_driverfor this matching on and binding to the DELL0501acpi_device.AFAIK you are trying to get rid of having drivers bind directly to acpi_device-s so I assume that you don't want me to introduce a new one. So to get a device to bind to without introducing a new
acpi_driverpatch 2/2 if this series creates aplatform_devicefor this.
Quoted 6 lines
The creation of this
platform_deviceis why this is marked as RFC, if you are ok with this solution I guess you can merge this series already as is. With the caveat that the matching dell-uart-backlight driver is still under development (its progressing nicely and the serdev-device instantation + binding a serdev driver to it already works).
I was about to work on this and found you're already working on it.
Please add me to Cc list when the driver is ready to be tested, thanks!
Kai-Heng
Quoted 89 lines
If you have a different idea how to handle this I'm certainly open to suggestions.
Regards,
Hans
1) All In One a monitor with a PC builtin
p.s.
I also tried this approach, but that did not work:
This was an attempt to create both a pdev from
acpi_default_enumeration()by making the PNP scan handlerattach()method return 0 rather then 1; and get apnp_devicecreated for the UART driver as well by makingacpi_is_pnp_device()return true.This approach does not work due to the following code in
pnpacpi_add_device():/* Skip devices that are already bound */ if (device->physical_node_count) return 0;drivers/acpi/acpi_pnp.c +12
-2@@ -353,10 +353,17 @@ static bool acpi_pnp_match(const char *idstr, const struct acpi_device_id **matc* given ACPI device object, the PNP scan handler will not attach to that * object, because there is a proper non-PNP driver in the kernel for the * device represented by it. +* +* The DELL0501 ACPI HID represents an UART (CID is set to PNP0501) with +* a backlight-controller attached. There is no separate ACPI device with +* an UartSerialBusV2() resource to model the backlight-controller. +* This setup requires instantiating both a pnp_device for the UART as well +* as a platform_device for the backlight-controller driver to bind too. */ static const struct acpi_device_id acpi_nonpnp_device_ids[] = { {"INTC1080" }, {"INTC1081" }, + {"DELL0501" }, {"" }, };@@ -376,13 +383,16 @@ static struct acpi_scan_handler acpi_pnp_handler = {* For CMOS RTC devices, the PNP ACPI scan handler does not work, because * there is a CMOS RTC ACPI scan handler installed already, so we need to * check those devices and enumerate them to the PNP bus directly. +* For DELL0501 devices the PNP ACPI scan handler is skipped to create +* a platform_device, see the acpi_nonpnp_device_ids[] comment. */ -static int is_cmos_rtc_device (struct acpi_device *adev) +static int is_special_pnp_device (struct acpi_device *adev) {static const struct acpi_device_id ids[] = { {"PNP0B00" }, {"PNP0B01" }, {"PNP0B02" }, + {"DELL0501" }, {"" }, };return !acpi_match_device_ids (adev, ids);@@ -390,7 +400,7 @@ static int is_cmos_rtc_device(struct acpi_device *adev)bool acpi_is_pnp_device (struct acpi_device *adev) { -return adev->handler == &acpi_pnp_handler ||is_cmos_rtc_device (adev); +return adev->handler == &acpi_pnp_handler ||is_special_pnp_device (adev); }EXPORT_SYMBOL_GPL (acpi_is_pnp_device);Hans de Goede (2):
ACPI: x86: Moveacpi_quirk_skip_serdev_enumeration()out of
CONFIG_X86_ANDROID_TABLETS
ACPI: x86: Add DELL0501 handling to
acpi_quirk_skip_serdev_enumeration()drivers/acpi/x86/utils.c | 38 ++++++++++++++++++++++++++++++++++---- include/acpi/acpi_bus.h | 22 +++++++++++----------- 2 files changed, 45 insertions(+), 15 deletions(-)--
2.43.0
Hi Kai-Heng Feng,
Quoted 43 lines · Kai-Heng Feng
Hi Hans,
Quoted 33 lines · Hans de Goede
Hi Rafael,
I recently learned that some Dell AIOs (1) use a backlight controller board connected to an UART. Canonical even submitted a driver for this in 2017:
https://lkml.org/lkml/2017/10/26/78This UART has a DELL0501 HID with CID set to PNP0501 so that the UART is still handled by
8250_pnp.c. Unfortunately there is no separate ACPI device with anUartSerialBusV2()resource to model the backlight-controller.The RFC patch 2/2 in this series uses
acpi_quirk_skip_serdev_enumeration()to still create a serdev for this for a backlight driver to bind to instead of creating a/dev/ttyS0.Like other cases where the
UartSerialBusV2()resource is missing or broken this will only create the serdev-controller device and the serdev-device itself will need to be instantiated by the consumer (the backlight driver).Unlike existing other cases which use DMI modaliases to load on a specific board to work around brokeness of that board's specific ACPI tables, the intend here is to have a single driver for all Dell AIOs using the DELL0501 HID for their UART, without needing to maintain a list of DMI matches.
This means that the dell-uart-backlight driver will need something to bind to. The original driver from 2017 used an
acpi_driverfor this matching on and binding to the DELL0501acpi_device.AFAIK you are trying to get rid of having drivers bind directly to acpi_device-s so I assume that you don't want me to introduce a new one. So to get a device to bind to without introducing a new
acpi_driverpatch 2/2 if this series creates aplatform_devicefor this.Quoted 6 lines
The creation of this
platform_deviceis why this is marked as RFC, if you are ok with this solution I guess you can merge this series already as is. With the caveat that the matching dell-uart-backlight driver is still under development (its progressing nicely and the serdev-device instantation + binding a serdev driver to it already works).
Quoted 3 lines
I was about to work on this and found you're already working on it.
Please add me to Cc list when the driver is ready to be tested, thanks!
I hope you have access to actual hw with such a backlight device ?
The driver actually has been ready for testing for quite a while now, but the person who reported this backlight controller not being supported to me has been testing this on a AIO of a friend of theirs and this has been going pretty slow.
So if you can test the driver (attached) then that would be great :)
I even wrote an emulator to test it locally and that works, so assuming I got the protocol right from the original posting of the driver for this years ago then things should work.
Note this depends on the kernel also having the patches from this RFC (which Rafael has already merged) applied.
Regards,
Hans
Quoted 81 lines
Quoted 81 lines
If you have a different idea how to handle this I'm certainly open to suggestions.
Regards,
Hans
1) All In One a monitor with a PC builtin
p.s.
I also tried this approach, but that did not work:
This was an attempt to create both a pdev from
acpi_default_enumeration()by making the PNP scan handlerattach()method return 0 rather then 1; and get apnp_devicecreated for the UART driver as well by makingacpi_is_pnp_device()return true.This approach does not work due to the following code in
pnpacpi_add_device():/* Skip devices that are already bound */ if (device->physical_node_count) return 0;drivers/acpi/acpi_pnp.c +12
-2@@ -353,10 +353,17 @@ static bool acpi_pnp_match(const char *idstr, const struct acpi_device_id **matc* given ACPI device object, the PNP scan handler will not attach to that * object, because there is a proper non-PNP driver in the kernel for the * device represented by it. +* +* The DELL0501 ACPI HID represents an UART (CID is set to PNP0501) with +* a backlight-controller attached. There is no separate ACPI device with +* an UartSerialBusV2() resource to model the backlight-controller. +* This setup requires instantiating both a pnp_device for the UART as well +* as a platform_device for the backlight-controller driver to bind too. */ static const struct acpi_device_id acpi_nonpnp_device_ids[] = { {"INTC1080" }, {"INTC1081" }, + {"DELL0501" }, {"" }, };@@ -376,13 +383,16 @@ static struct acpi_scan_handler acpi_pnp_handler = {* For CMOS RTC devices, the PNP ACPI scan handler does not work, because * there is a CMOS RTC ACPI scan handler installed already, so we need to * check those devices and enumerate them to the PNP bus directly. +* For DELL0501 devices the PNP ACPI scan handler is skipped to create +* a platform_device, see the acpi_nonpnp_device_ids[] comment. */ -static int is_cmos_rtc_device (struct acpi_device *adev) +static int is_special_pnp_device (struct acpi_device *adev) {static const struct acpi_device_id ids[] = { {"PNP0B00" }, {"PNP0B01" }, {"PNP0B02" }, + {"DELL0501" }, {"" }, };return !acpi_match_device_ids (adev, ids);@@ -390,7 +400,7 @@ static int is_cmos_rtc_device(struct acpi_device *adev)bool acpi_is_pnp_device (struct acpi_device *adev) { -return adev->handler == &acpi_pnp_handler ||is_cmos_rtc_device (adev); +return adev->handler == &acpi_pnp_handler ||is_special_pnp_device (adev); }EXPORT_SYMBOL_GPL (acpi_is_pnp_device);Hans de Goede (2):
ACPI: x86: Moveacpi_quirk_skip_serdev_enumeration()out of
CONFIG_X86_ANDROID_TABLETS
ACPI: x86: Add DELL0501 handling to
acpi_quirk_skip_serdev_enumeration()
Quoted 8 lines
Quoted 7 lines
drivers/acpi/x86/utils.c | 38 ++++++++++++++++++++++++++++++++++---- include/acpi/acpi_bus.h | 22 +++++++++++----------- 2 files changed, 45 insertions(+), 15 deletions(-)--
2.43.0
From 5717af4e556f34d2a96bc33596b1c6866e3b09bc Mon Sep 17 00:00:00 2001
From: Hans de Goede <[email protected]>
Date: Sun, 18 Feb 2024 16:16:14 +0100
Subject: [PATCH 1/3] platform/x86: Add new Dell UART backlight driver
Dell All In One (AIO) models released after 2017 use a backlight controller board connected to an UART.
In DSDT this uart port will be defined as:
Name (_HID, "DELL0501")
Name (_CID, EisaId ("PNP0501")
Instead of having a separate ACPI device with an UartSerialBusV2() resource to model the backlight-controller, which would be the standard way to do this.
The acpi_quirk_skip_serdev_enumeration() has special handling for this and it will make the serial port code create a serdev controller device for the UART instead of a /dev/ttyS0 char-dev. It will also create a dell-uart-backlight driver platform device for this driver to bind too.
This new kernel module contains 2 drivers for this:
1. A simple platform driver which creates the actual serdev device (with the serdev controller device as parent)
2. A serdev driver for the created serdev device which exports the backlight functionality uses a standard backlight class device.
--- drivers/platform/x86/dell/Kconfig | 15 + drivers/platform/x86/dell/Makefile | 1 + .../platform/x86/dell/dell-uart-backlight.c | 409 ++++++++++++++++++ 3 files changed, 425 insertions(+) create mode 100644 drivers/platform/x86/dell/dell-uart-backlight.c
drivers/platform/x86/dell/Kconfig +15 -0
@@ -145,6 +145,21 @@ config DELL_SMO8800 To compile this driver as a module, choose M here: the module will be called dell-smo8800. +config DELL_UART_BACKLIGHT + tristate "Dell AIO UART Backlight driver" + depends on ACPI + depends on BACKLIGHT_CLASS_DEVICE + depends on SERIAL_DEV_BUS + help + Say Y here if you want to support Dell AIO UART backlight interface. + The Dell AIO machines released after 2017 come with a UART interface + to communicate with the backlight scalar board. This driver creates + a standard backlight interface and talks to the scalar board through + UART to adjust the AIO screen brightness. + + To compile this driver as a module, choose M here: the module will + be called dell_uart_backlight. + config DELL_WMI tristate "Dell WMI notifications" default m
drivers/platform/x86/dell/Makefile +1 -0
@@ -14,6 +14,7 @@ dell-smbios-objs := dell-smbios-base.o dell-smbios-$(CONFIG_DELL_SMBIOS_WMI) += dell-smbios-wmi.o dell-smbios-$(CONFIG_DELL_SMBIOS_SMM) += dell-smbios-smm.o obj-$(CONFIG_DELL_SMO8800) += dell-smo8800.o +obj-$(CONFIG_DELL_UART_BACKLIGHT) += dell-uart-backlight.o obj-$(CONFIG_DELL_WMI) += dell-wmi.o dell-wmi-objs := dell-wmi-base.o dell-wmi-$(CONFIG_DELL_WMI_PRIVACY) += dell-wmi-privacy.o
drivers/platform/x86/dell/dell-uart-backlight.c new file +409 -0
409 lines not on this page · raw message
Signature · 1 line
2.44.0
From e91eb2c85ce633957b3406c2c07dfe048dbd4dd1 Mon Sep 17 00:00:00 2001
From: Hans de Goede <[email protected]>
Date: Tue, 20 Feb 2024 22:09:42 +0100
Subject: [PATCH 2/3] platform/x86: dell-uart-backlight: Add ifdefs to make it
build with kernel 6.7/6.8
Local modification, do not upstream. Make the serdev helpers and dell-uart-backlight work with kernel 6.7/6.8 for testing purposes.
--- drivers/platform/x86/dell/dell-uart-backlight.c | 4 ++++ drivers/platform/x86/serdev_helpers.h | 6 ++++++ 2 files changed, 10 insertions(+)
drivers/platform/x86/dell/dell-uart-backlight.c +4 -0
@@ -198,7 +198,11 @@ static const struct backlight_ops dell_uart_backlight_ops = { .get_brightness = dell_uart_get_brightness_op, }; +#if LINUX_VERSION_CODE >=KERNEL_VERSION (6 ,9 ,0 ) static size_t dell_uart_bl_receive(struct serdev_device *serdev, const u8 *data, size_t len) +#else +static ssize_t dell_uart_bl_receive(struct serdev_device *serdev, const u8 *data, size_t len) +#endif {struct dell_uart_backlight *dell_bl =serdev_device_get_drvdata (serdev);size_t i;
drivers/platform/x86/serdev_helpers.h +6 -0
@@ -20,6 +20,7 @@#include <linux/printk.h> #include <linux/sprintf.h> #include <linux/string.h> +#include <linux/version.h> static inline struct device * get_serdev_controller(const char *serial_ctrl_hid,
@@ -49,7 +50,12 @@ get_serdev_controller(const char *serial_ctrl_hid, }/* Walk host -> uart-ctrl -> port -> serdev-ctrl */ +#if LINUX_VERSION_CODE >=KERNEL_VERSION (6 ,8 ,0 )for (i =0 ; i <3 ; i++) { +#else +/* Kernels < 6.8 have host -> serdev-ctrl */ +for (i =2 ; i <3 ; i++) { +#endif switch (i) {case 0 :snprintf (name,sizeof (name),"%s:0" ,dev_name (ctrl_dev));
Signature · 1 line
2.44.0
From 9677480af27d6f1d3c981e62b86a2ec56f9afe11 Mon Sep 17 00:00:00 2001
From: Hans de Goede <[email protected]>
Date: Mon, 19 Feb 2024 17:41:57 +0100
Subject: [PATCH 3/3] tools arch x86: Add dell-uart-backlight-emulator
Dell All In One (AIO) models released after 2017 use a backlight controller board connected to an UART.
Add a small emulator to allow development and testing of the drivers/platform/x86/dell/dell-uart-backlight.c driver for this board, without requiring access to an actual Dell All In One.
--- .../dell-uart-backlight-emulator/.gitignore | 1 + .../x86/dell-uart-backlight-emulator/Makefile | 19 ++ .../x86/dell-uart-backlight-emulator/README | 46 +++++ .../dell-uart-backlight-emulator.c | 166 ++++++++++++++++++ 4 files changed, 232 insertions(+) create mode 100644 tools/arch/x86/dell-uart-backlight-emulator/.gitignore create mode 100644 tools/arch/x86/dell-uart-backlight-emulator/Makefile create mode 100644 tools/arch/x86/dell-uart-backlight-emulator/README create mode 100644 tools/arch/x86/dell-uart-backlight-emulator/dell-uart-backlight-emulator.c
tools/arch/x86/dell-uart-backlight-emulator/.gitignore new file +1 -0
@@ -0,0 +1 @@ +dell-uart-backlight-emulator
tools/arch/x86/dell-uart-backlight-emulator/Makefile new file +19 -0
@@ -0,0 +1,19 @@ +# SPDX-License-Identifier: GPL-2.0 +# Makefile for Intel Software Defined Silicon provisioning tool + +dell-uart-backlight-emulator: dell-uart-backlight-emulator.c + +BINDIR ?= /usr/bin + +override CFLAGS += -O2 -Wall + +%: %.c + $(CC) $(CFLAGS) -o $@ $< $(LDFLAGS) + +.PHONY : clean +clean : + @rm -f dell-uart-backlight-emulator + +install : dell-uart-backlight-emulator + install -d $(DESTDIR)$(BINDIR) + install -m 755 -p dell-uart-backlight-emulator $(DESTDIR)$(BINDIR)/dell-uart-backlight-emulator
tools/arch/x86/dell-uart-backlight-emulator/README new file +46 -0
46 lines not on this page · raw message
tools/arch/x86/dell-uart-backlight-emulator/dell-uart-backlight-emulator.c new file +166 -0
166 lines not on this page · raw message
Signature · 1 line
2.44.0
Kai-Heng Feng
Tested-by[+Cc AceLan]
Hi Hans,
Quoted 58 lines · Hans de Goede
Hi Kai-Heng Feng,
Quoted 43 lines · Kai-Heng Feng
Hi Hans,
Quoted 33 lines · Hans de Goede
Hi Rafael,
I recently learned that some Dell AIOs (1) use a backlight controller board connected to an UART. Canonical even submitted a driver for this in 2017:
https://lkml.org/lkml/2017/10/26/78This UART has a DELL0501 HID with CID set to PNP0501 so that the UART is still handled by
8250_pnp.c. Unfortunately there is no separate ACPI device with anUartSerialBusV2()resource to model the backlight-controller.The RFC patch 2/2 in this series uses
acpi_quirk_skip_serdev_enumeration()to still create a serdev for this for a backlight driver to bind to instead of creating a/dev/ttyS0.Like other cases where the
UartSerialBusV2()resource is missing or broken this will only create the serdev-controller device and the serdev-device itself will need to be instantiated by the consumer (the backlight driver).Unlike existing other cases which use DMI modaliases to load on a specific board to work around brokeness of that board's specific ACPI tables, the intend here is to have a single driver for all Dell AIOs using the DELL0501 HID for their UART, without needing to maintain a list of DMI matches.
This means that the dell-uart-backlight driver will need something to bind to. The original driver from 2017 used an
acpi_driverfor this matching on and binding to the DELL0501acpi_device.AFAIK you are trying to get rid of having drivers bind directly to acpi_device-s so I assume that you don't want me to introduce a new one. So to get a device to bind to without introducing a new
acpi_driverpatch 2/2 if this series creates aplatform_devicefor this.Quoted 6 lines
The creation of this
platform_deviceis why this is marked as RFC, if you are ok with this solution I guess you can merge this series already as is. With the caveat that the matching dell-uart-backlight driver is still under development (its progressing nicely and the serdev-device instantation + binding a serdev driver to it already works).Quoted 3 lines
I was about to work on this and found you're already working on it.
Please add me to Cc list when the driver is ready to be tested, thanks!
I hope you have access to actual hw with such a backlight device ?
The driver actually has been ready for testing for quite a while now, but the person who reported this backlight controller not being supported to me has been testing this on a AIO of a friend of theirs and this has been going pretty slow.
Quoted 8 lines
So if you can test the driver (attached) then that would be great :)
I even wrote an emulator to test it locally and that works, so assuming I got the protocol right from the original posting of the driver for this years ago then things should work.
Note this depends on the kernel also having the patches from this RFC (which Rafael has already merged) applied.
There are newer AIO have UID other than 0, like "SIOBUAR2".
Once change the "0" to NULL in 'get_serdev_controller("DELL0501", "0", 0, "serial0");', everything works perfectly.
With that change,
Kai-Heng
Quoted 99 lines
Regards,
Hans
Quoted 89 lines
Quoted 88 lines
If you have a different idea how to handle this I'm certainly open to suggestions.
Regards,
Hans
1) All In One a monitor with a PC builtin
p.s.
I also tried this approach, but that did not work:
This was an attempt to create both a pdev from
acpi_default_enumeration()by making the PNP scan handlerattach()method return 0 rather then 1; and get apnp_devicecreated for the UART driver as well by makingacpi_is_pnp_device()return true.This approach does not work due to the following code in
pnpacpi_add_device():/* Skip devices that are already bound */ if (device->physical_node_count) return 0;drivers/acpi/acpi_pnp.c +12
-2@@ -353,10 +353,17 @@ static bool acpi_pnp_match(const char *idstr, const struct acpi_device_id **matc* given ACPI device object, the PNP scan handler will not attach to that * object, because there is a proper non-PNP driver in the kernel for the * device represented by it. +* +* The DELL0501 ACPI HID represents an UART (CID is set to PNP0501) with +* a backlight-controller attached. There is no separate ACPI device with +* an UartSerialBusV2() resource to model the backlight-controller. +* This setup requires instantiating both a pnp_device for the UART as well +* as a platform_device for the backlight-controller driver to bind too. */ static const struct acpi_device_id acpi_nonpnp_device_ids[] = { {"INTC1080" }, {"INTC1081" }, + {"DELL0501" }, {"" }, };@@ -376,13 +383,16 @@ static struct acpi_scan_handler acpi_pnp_handler = {* For CMOS RTC devices, the PNP ACPI scan handler does not work, because * there is a CMOS RTC ACPI scan handler installed already, so we need to * check those devices and enumerate them to the PNP bus directly. +* For DELL0501 devices the PNP ACPI scan handler is skipped to create +* a platform_device, see the acpi_nonpnp_device_ids[] comment. */ -static int is_cmos_rtc_device (struct acpi_device *adev) +static int is_special_pnp_device (struct acpi_device *adev) {static const struct acpi_device_id ids[] = { {"PNP0B00" }, {"PNP0B01" }, {"PNP0B02" }, + {"DELL0501" }, {"" }, };return !acpi_match_device_ids (adev, ids);@@ -390,7 +400,7 @@ static int is_cmos_rtc_device(struct acpi_device *adev)bool acpi_is_pnp_device (struct acpi_device *adev) { -return adev->handler == &acpi_pnp_handler ||is_cmos_rtc_device (adev); +return adev->handler == &acpi_pnp_handler ||is_special_pnp_device (adev); }EXPORT_SYMBOL_GPL (acpi_is_pnp_device);Hans de Goede (2):
ACPI: x86: Moveacpi_quirk_skip_serdev_enumeration()out of
CONFIG_X86_ANDROID_TABLETS
ACPI: x86: Add DELL0501 handling to
acpi_quirk_skip_serdev_enumeration()drivers/acpi/x86/utils.c | 38 ++++++++++++++++++++++++++++++++++---- include/acpi/acpi_bus.h | 22 +++++++++++----------- 2 files changed, 45 insertions(+), 15 deletions(-)--
2.43.0
Quoted 64 lines · Kai-Heng Feng
[+Cc AceLan]
Quoted 53 lines · Hans de Goede
Quoted 41 lines · Kai-Heng Feng
Quoted 33 lines · Hans de Goede
Hi Rafael,
I recently learned that some Dell AIOs (1) use a backlight controller board connected to an UART. Canonical even submitted a driver for this in 2017:
https://lkml.org/lkml/2017/10/26/78This UART has a DELL0501 HID with CID set to PNP0501 so that the UART is still handled by
8250_pnp.c. Unfortunately there is no separate ACPI device with anUartSerialBusV2()resource to model the backlight-controller.The RFC patch 2/2 in this series uses
acpi_quirk_skip_serdev_enumeration()to still create a serdev for this for a backlight driver to bind to instead of creating a/dev/ttyS0.Like other cases where the
UartSerialBusV2()resource is missing or broken this will only create the serdev-controller device and the serdev-device itself will need to be instantiated by the consumer (the backlight driver).Unlike existing other cases which use DMI modaliases to load on a specific board to work around brokeness of that board's specific ACPI tables, the intend here is to have a single driver for all Dell AIOs using the DELL0501 HID for their UART, without needing to maintain a list of DMI matches.
This means that the dell-uart-backlight driver will need something to bind to. The original driver from 2017 used an
acpi_driverfor this matching on and binding to the DELL0501acpi_device.AFAIK you are trying to get rid of having drivers bind directly to acpi_device-s so I assume that you don't want me to introduce a new one. So to get a device to bind to without introducing a new
acpi_driverpatch 2/2 if this series creates aplatform_devicefor this.Quoted 6 lines
The creation of this
platform_deviceis why this is marked as RFC, if you are ok with this solution I guess you can merge this series already as is. With the caveat that the matching dell-uart-backlight driver is still under development (its progressing nicely and the serdev-device instantation + binding a serdev driver to it already works).Quoted 3 lines
I was about to work on this and found you're already working on it.
Please add me to Cc list when the driver is ready to be tested, thanks!
I hope you have access to actual hw with such a backlight device ?
The driver actually has been ready for testing for quite a while now, but the person who reported this backlight controller not being supported to me has been testing this on a AIO of a friend of theirs and this has been going pretty slow.
Quoted 8 lines
So if you can test the driver (attached) then that would be great :)
I even wrote an emulator to test it locally and that works, so assuming I got the protocol right from the original posting of the driver for this years ago then things should work.
Note this depends on the kernel also having the patches from this RFC (which Rafael has already merged) applied.
Quoted 7 lines
There are newer AIO have UID other than 0, like "SIOBUAR2".
Once change the "0" to NULL in '
get_serdev_controller("DELL0501", "0", 0, "serial0");', everything works perfectly.With that change,
Tested-by Kai-Heng Feng <[email protected]>
Do we have tables with _UID set to 0?
If so, we would need more complex approach.
Signature · 2 lines
With Best Regards, Andy Shevchenko
Quoted 68 lines · Andy Shevchenko
Quoted 66 lines · Kai-Heng Feng
[+Cc AceLan]
Quoted 53 lines · Hans de Goede
Quoted 41 lines · Kai-Heng Feng
Quoted 33 lines · Hans de Goede
Hi Rafael,
I recently learned that some Dell AIOs (1) use a backlight controller board connected to an UART. Canonical even submitted a driver for this in 2017:
https://lkml.org/lkml/2017/10/26/78This UART has a DELL0501 HID with CID set to PNP0501 so that the UART is still handled by
8250_pnp.c. Unfortunately there is no separate ACPI device with anUartSerialBusV2()resource to model the backlight-controller.The RFC patch 2/2 in this series uses
acpi_quirk_skip_serdev_enumeration()to still create a serdev for this for a backlight driver to bind to instead of creating a/dev/ttyS0.Like other cases where the
UartSerialBusV2()resource is missing or broken this will only create the serdev-controller device and the serdev-device itself will need to be instantiated by the consumer (the backlight driver).Unlike existing other cases which use DMI modaliases to load on a specific board to work around brokeness of that board's specific ACPI tables, the intend here is to have a single driver for all Dell AIOs using the DELL0501 HID for their UART, without needing to maintain a list of DMI matches.
This means that the dell-uart-backlight driver will need something to bind to. The original driver from 2017 used an
acpi_driverfor this matching on and binding to the DELL0501acpi_device.AFAIK you are trying to get rid of having drivers bind directly to acpi_device-s so I assume that you don't want me to introduce a new one. So to get a device to bind to without introducing a new
acpi_driverpatch 2/2 if this series creates aplatform_devicefor this.Quoted 6 lines
The creation of this
platform_deviceis why this is marked as RFC, if you are ok with this solution I guess you can merge this series already as is. With the caveat that the matching dell-uart-backlight driver is still under development (its progressing nicely and the serdev-device instantation + binding a serdev driver to it already works).Quoted 3 lines
I was about to work on this and found you're already working on it.
Please add me to Cc list when the driver is ready to be tested, thanks!
I hope you have access to actual hw with such a backlight device ?
The driver actually has been ready for testing for quite a while now, but the person who reported this backlight controller not being supported to me has been testing this on a AIO of a friend of theirs and this has been going pretty slow.
Quoted 8 lines
So if you can test the driver (attached) then that would be great :)
I even wrote an emulator to test it locally and that works, so assuming I got the protocol right from the original posting of the driver for this years ago then things should work.
Note this depends on the kernel also having the patches from this RFC (which Rafael has already merged) applied.
There are newer AIO have UID other than 0, like "SIOBUAR2".
Quoted 8 lines
Quoted 5 lines
Once change the "0" to NULL in '
get_serdev_controller("DELL0501", "0", 0, "serial0");', everything works perfectly.With that change,
Tested-by Kai-Heng Feng <[email protected]>Do we have tables with
_UIDset to 0?
If so, we would need more complex approach.
Yes, some tables have _UID set to 0 and some have other _UID values.
Kai-Heng
Quoted 6 lines
--
With Best Regards,
Andy Shevchenko
Hi Andy,
Quoted 67 lines · Andy Shevchenko
Quoted 66 lines · Kai-Heng Feng
[+Cc AceLan]
Quoted 53 lines · Hans de Goede
Quoted 41 lines · Kai-Heng Feng
Quoted 33 lines · Hans de Goede
Hi Rafael,
I recently learned that some Dell AIOs (1) use a backlight controller board connected to an UART. Canonical even submitted a driver for this in 2017:
https://lkml.org/lkml/2017/10/26/78This UART has a DELL0501 HID with CID set to PNP0501 so that the UART is still handled by
8250_pnp.c. Unfortunately there is no separate ACPI device with anUartSerialBusV2()resource to model the backlight-controller.The RFC patch 2/2 in this series uses
acpi_quirk_skip_serdev_enumeration()to still create a serdev for this for a backlight driver to bind to instead of creating a/dev/ttyS0.Like other cases where the
UartSerialBusV2()resource is missing or broken this will only create the serdev-controller device and the serdev-device itself will need to be instantiated by the consumer (the backlight driver).Unlike existing other cases which use DMI modaliases to load on a specific board to work around brokeness of that board's specific ACPI tables, the intend here is to have a single driver for all Dell AIOs using the DELL0501 HID for their UART, without needing to maintain a list of DMI matches.
This means that the dell-uart-backlight driver will need something to bind to. The original driver from 2017 used an
acpi_driverfor this matching on and binding to the DELL0501acpi_device.AFAIK you are trying to get rid of having drivers bind directly to acpi_device-s so I assume that you don't want me to introduce a new one. So to get a device to bind to without introducing a new
acpi_driverpatch 2/2 if this series creates aplatform_devicefor this.Quoted 6 lines
The creation of this
platform_deviceis why this is marked as RFC, if you are ok with this solution I guess you can merge this series already as is. With the caveat that the matching dell-uart-backlight driver is still under development (its progressing nicely and the serdev-device instantation + binding a serdev driver to it already works).Quoted 3 lines
I was about to work on this and found you're already working on it.
Please add me to Cc list when the driver is ready to be tested, thanks!
I hope you have access to actual hw with such a backlight device ?
The driver actually has been ready for testing for quite a while now, but the person who reported this backlight controller not being supported to me has been testing this on a AIO of a friend of theirs and this has been going pretty slow.
Quoted 8 lines
So if you can test the driver (attached) then that would be great :)
I even wrote an emulator to test it locally and that works, so assuming I got the protocol right from the original posting of the driver for this years ago then things should work.
Note this depends on the kernel also having the patches from this RFC (which Rafael has already merged) applied.
There are newer AIO have UID other than 0, like "SIOBUAR2".
Quoted 8 lines
Quoted 5 lines
Once change the "0" to NULL in '
get_serdev_controller("DELL0501", "0", 0, "serial0");', everything works perfectly.With that change,
Tested-by Kai-Heng Feng <[email protected]>Do we have tables with
_UIDset to 0?
If so, we would need more complex approach.
passing NULL as uid argument to get_serdev_controller() makes it skip the UID check altogether and there is no reaosn to expect the special "DELL0501" HID to be attached to more then 1 uart, so this should be fine.
Regards,
Hans
Hi Kai-Heng Feng,
Quoted 72 lines · Kai-Heng Feng
[+Cc AceLan]
Hi Hans,
Quoted 58 lines · Hans de Goede
Hi Kai-Heng Feng,
Quoted 43 lines · Kai-Heng Feng
Hi Hans,
Quoted 33 lines · Hans de Goede
Hi Rafael,
I recently learned that some Dell AIOs (1) use a backlight controller board connected to an UART. Canonical even submitted a driver for this in 2017:
https://lkml.org/lkml/2017/10/26/78This UART has a DELL0501 HID with CID set to PNP0501 so that the UART is still handled by
8250_pnp.c. Unfortunately there is no separate ACPI device with anUartSerialBusV2()resource to model the backlight-controller.The RFC patch 2/2 in this series uses
acpi_quirk_skip_serdev_enumeration()to still create a serdev for this for a backlight driver to bind to instead of creating a/dev/ttyS0.Like other cases where the
UartSerialBusV2()resource is missing or broken this will only create the serdev-controller device and the serdev-device itself will need to be instantiated by the consumer (the backlight driver).Unlike existing other cases which use DMI modaliases to load on a specific board to work around brokeness of that board's specific ACPI tables, the intend here is to have a single driver for all Dell AIOs using the DELL0501 HID for their UART, without needing to maintain a list of DMI matches.
This means that the dell-uart-backlight driver will need something to bind to. The original driver from 2017 used an
acpi_driverfor this matching on and binding to the DELL0501acpi_device.AFAIK you are trying to get rid of having drivers bind directly to acpi_device-s so I assume that you don't want me to introduce a new one. So to get a device to bind to without introducing a new
acpi_driverpatch 2/2 if this series creates aplatform_devicefor this.Quoted 6 lines
The creation of this
platform_deviceis why this is marked as RFC, if you are ok with this solution I guess you can merge this series already as is. With the caveat that the matching dell-uart-backlight driver is still under development (its progressing nicely and the serdev-device instantation + binding a serdev driver to it already works).Quoted 3 lines
I was about to work on this and found you're already working on it.
Please add me to Cc list when the driver is ready to be tested, thanks!
I hope you have access to actual hw with such a backlight device ?
The driver actually has been ready for testing for quite a while now, but the person who reported this backlight controller not being supported to me has been testing this on a AIO of a friend of theirs and this has been going pretty slow.
Quoted 8 lines
So if you can test the driver (attached) then that would be great :)
I even wrote an emulator to test it locally and that works, so assuming I got the protocol right from the original posting of the driver for this years ago then things should work.
Note this depends on the kernel also having the patches from this RFC (which Rafael has already merged) applied.
Quoted 7 lines
There are newer AIO have UID other than 0, like "SIOBUAR2".
Once change the "0" to NULL in '
get_serdev_controller("DELL0501", "0", 0, "serial0");', everything works perfectly.With that change,
Tested-by Kai-Heng Feng <[email protected]>
Great thank you for testing. Luck has it that the user for who's Dell AOI I started working on this also just reported back that the driver works for them :)
So I'm going to send out the patch series for this now with the following diff squashed in vs what I send you:
drivers/platform/x86/dell/dell-uart-backlight.c +1 -1
@@ -352,7 +352,7 @@ static int dell_uart_bl_pdev_probe(struct platform_device *pdev)struct device *ctrl_dev;int ret; - ctrl_dev =get_serdev_controller ("DELL0501" ,"0" ,0 ,"serial0" ); + ctrl_dev =get_serdev_controller ("DELL0501" ,NULL ,0 ,"serial0" );if (IS_ERR (ctrl_dev))return PTR_ERR (ctrl_dev);
Regards,
Hans