Introduce Synology NAS x86 platform driver
PATCH v2 1/1 Introduce Synology NAS x86 platform driver
Add platform driver for Synology x86-based NAS devices to support HDD LEDs controller by ICH9 GPIO pins.
Only DS411+II is supported for now (DS411+ should be the same except CPU).
Unfortunately, the DMI data in BIOS is not very helpful to identify the device as almost all strings are "To be filled by O.E.M.". Match also the BIOS date and then check presence of the onboard SiI3531 SATA controller and i82574L ethernet controller to avoid activation on other systems.
Buttons and other LEDs are not supported by this driver because they're controlled by a PIC MCU (connected through serial port).
---
Changes in v2:
- fixed includes (order, added missing, removed kernel.h)
- added missing DMI and PCI dependencies to Kconfig
- added PCI device presence check details to changelog
- used %pe for error message
--- drivers/platform/x86/Kconfig | 16 ++++ drivers/platform/x86/Makefile | 3 + drivers/platform/x86/synology-x86.c | 128 ++++++++++++++++++++++++++++ 3 files changed, 147 insertions(+) create mode 100644 drivers/platform/x86/synology-x86.c
drivers/platform/x86/Kconfig +16 -0
@@ -1059,6 +1059,22 @@ config OXP_EC source "drivers/platform/x86/tuxedo/Kconfig" +config SYNOLOGY_X86 + tristate "Synology x86 NAS Platform Driver" + depends on DMI + depends on GPIOLIB + depends on LPC_ICH + depends on GPIO_ICH + depends on LEDS_CLASS + depends on PCI + select LEDS_GPIO + help + This driver provides support for the HDD LEDs on Synology x86 NAS + devices. + + To compile this driver as a module, choose M here: the module + will be called synology-x86. + endif # X86_PLATFORM_DEVICES config P2SB
drivers/platform/x86/Makefile +3 -0
@@ -166,3 +166,6 @@ obj-$(CONFIG_SEL3350_PLATFORM) += sel3350-platform.o # OneXPlayer obj-$(CONFIG_OXP_EC) += oxpec.o + +# Synology +obj-$(CONFIG_SYNOLOGY_X86) += synology-x86.o
drivers/platform/x86/synology-x86.c new file +128 -0
128 lines not on this page · raw message
Signature · 1 line
Ondrej Zary
Ilpo Järvinen
maintainerQuoted 9 lines · Ondrej Zary
Add platform driver for Synology x86-based NAS devices to support HDD LEDs controller by ICH9 GPIO pins.
Only DS411+II is supported for now (DS411+ should be the same except CPU).
Unfortunately, the DMI data in BIOS is not very helpful to identify the device as almost all strings are "To be filled by O.E.M.". Match also the BIOS date and then check presence of the onboard SiI3531 SATA controller and i82574L ethernet controller to avoid activation on other systems.
Hans, Andy,
Do you have an opinion on the selected approach?
Quoted 158 lines
Buttons and other LEDs are not supported by this driver because they're controlled by a PIC MCU (connected through serial port).
Signed-off-by Ondrej Zary <[email protected]>---
Changes in v2:
- fixed includes (order, added missing, removedkernel.h)
- added missing DMI and PCI dependencies toKconfig
- added PCI device presence check details to changelog
- used %pe for error message--- drivers/platform/x86/Kconfig | 16 ++++ drivers/platform/x86/Makefile | 3 + drivers/platform/x86/synology-x86.c | 128 ++++++++++++++++++++++++++++ 3 files changed, 147 insertions(+) create mode 100644 drivers/platform/x86/synology-x86.cdrivers/platform/x86/Kconfig +16
-0@@ -1059,6 +1059,22 @@ config OXP_EC source "drivers/platform/x86/tuxedo/Kconfig" +config SYNOLOGY_X86 + tristate "Synology x86 NAS Platform Driver" + depends on DMI + depends on GPIOLIB + depends on LPC_ICH + depends on GPIO_ICH + depends on LEDS_CLASS + depends on PCI + select LEDS_GPIO + help + This driver provides support for the HDD LEDs on Synology x86 NAS + devices. + + To compile this driver as a module, choose M here: the module + will be called synology-x86. + endif # X86_PLATFORM_DEVICES config P2SBdrivers/platform/x86/Makefile +3
-0@@ -166,3 +166,6 @@ obj-$(CONFIG_SEL3350_PLATFORM) += sel3350-platform.o # OneXPlayer obj-$(CONFIG_OXP_EC) += oxpec.o + +# Synology +obj-$(CONFIG_SYNOLOGY_X86) += synology-x86.odrivers/platform/x86/synology-x86.c new file +96
-0@@ -0,0 +1,128 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* +* Synology x86 NAS platform driver +* +* Inspired by platform/x86/meraki-mx100.c +* +* Copyright (C) 2026 Ondrej Zary <[email protected]> +*/ + +#include <linux/array_size.h> +#include <linux/dmi.h> +#include <linux/err.h> +#include <linux/gpio/machine.h> +#include <linux/leds.h> +#include <linux/module.h> +#include <linux/pci.h> +#include <linux/pci_ids.h> +#include <linux/platform_device.h> +#include <linux/printk.h> +#include <linux/string.h> + +static const struct gpio_led synology_leds[] = { + { .name ="synology:green:hdd1" }, + { .name ="synology:amber:hdd1" }, + { .name ="synology:green:hdd2" }, + { .name ="synology:amber:hdd2" }, + { .name ="synology:green:hdd3" }, + { .name ="synology:amber:hdd3" }, + { .name ="synology:green:hdd4" }, + { .name ="synology:amber:hdd4" }, +}; + +static const struct gpio_led_platform_data synology_leds_pdata = { + .num_leds =ARRAY_SIZE (synology_leds), + .leds = synology_leds, +}; + +#define GPIO_ICH_DRIVER_NAME "gpio_ich" + +static struct gpiod_lookup_table synology_leds_table = { + .dev_id ="leds-gpio" , + .table = { +GPIO_LOOKUP_IDX (GPIO_ICH_DRIVER_NAME ,16 ,NULL ,0 ,GPIO_ACTIVE_HIGH ), +GPIO_LOOKUP_IDX (GPIO_ICH_DRIVER_NAME ,18 ,NULL ,1 ,GPIO_ACTIVE_HIGH ), +GPIO_LOOKUP_IDX (GPIO_ICH_DRIVER_NAME ,20 ,NULL ,2 ,GPIO_ACTIVE_HIGH ), +GPIO_LOOKUP_IDX (GPIO_ICH_DRIVER_NAME ,32 ,NULL ,3 ,GPIO_ACTIVE_HIGH ), +GPIO_LOOKUP_IDX (GPIO_ICH_DRIVER_NAME ,33 ,NULL ,4 ,GPIO_ACTIVE_HIGH ), +GPIO_LOOKUP_IDX (GPIO_ICH_DRIVER_NAME ,34 ,NULL ,5 ,GPIO_ACTIVE_HIGH ), +GPIO_LOOKUP_IDX (GPIO_ICH_DRIVER_NAME ,49 ,NULL ,6 ,GPIO_ACTIVE_HIGH ), +GPIO_LOOKUP_IDX (GPIO_ICH_DRIVER_NAME ,55 ,NULL ,7 ,GPIO_ACTIVE_HIGH ), + {} + } +}; + +static const struct dmi_system_id synology_systems[]__initconst = { + { + .ident ="DS411+" ,/* DS411+II is the same with faster CPU */ + .matches = { +/* Synology did not put anything in DMI strings */ +DMI_EXACT_MATCH (DMI_SYS_VENDOR ,"To Be Filled By O.E.M." ), +DMI_EXACT_MATCH (DMI_PRODUCT_NAME ,"To Be Filled By O.E.M." ), +DMI_EXACT_MATCH (DMI_BOARD_NAME ,"To be filled by O.E.M." ), +DMI_EXACT_MATCH (DMI_BIOS_DATE ,"05/21/2012" ), + }, + }, + {} +}; +MODULE_DEVICE_TABLE (dmi, synology_systems); + +static struct platform_device *synology_leds_pdev; + +static int __init synology_init (void ) +{ +int ret; + +static const struct pci_device_id pci_sii3531[] = { + {PCI_DEVICE_SUB (PCI_VENDOR_ID_CMD ,0x3531 ,PCI_VENDOR_ID_CMD ,0x3531 ) }, + { } + }; + +static const struct pci_device_id pci_i82574l[] = { + {PCI_DEVICE_SUB (PCI_VENDOR_ID_INTEL ,0x10d3 ,PCI_VENDOR_ID_INTEL ,0x0000 ) }, + { } + }; + +const struct dmi_system_id *dmi =dmi_first_match (synology_systems); + +if (!dmi) +return -ENODEV ; + +/* DS411+ DMI match is too generic, confirm by onboard PCI devices */ +if (!strcmp (dmi->ident,"DS411+" )) { +if (!pci_dev_present (pci_sii3531) || + !pci_dev_present (pci_i82574l)) +return -ENODEV ; + }
drivers/platform/x86/synology-x86.c line 106
Quoted 10 lines
drivers/platform/x86/synology-x86.c new file +10
-0+ +pr_info ("Detected Synology NAS %s\n" , dmi->ident); + +gpiod_add_lookup_table (&synology_leds_table); + + synology_leds_pdev =platform_device_register_data (NULL , +"leds-gpio" ,PLATFORM_DEVID_NONE , &synology_leds_pdata, +sizeof (synology_leds_pdata)); +if (IS_ERR (synology_leds_pdev)) { +pr_err ("error registering platform device: %pe\n" , synology_leds_pdev);
Won't these be prefixless and you should add the usual pr_fmt line?
Quoted 23 lines
drivers/platform/x86/synology-x86.c new file +22
-0+ ret =PTR_ERR (synology_leds_pdev); + goto err; + } + +return 0 ; + +err: +gpiod_remove_lookup_table (&synology_leds_table); +return ret; +} +module_init (synology_init); + +static void __exit synology_exit(void) +{ +platform_device_unregister (synology_leds_pdev); +gpiod_remove_lookup_table (&synology_leds_table); +} +module_exit (synology_exit); + +MODULE_AUTHOR ("Ondrej Zary <[email protected]>" ); +MODULE_DESCRIPTION ("Synology x86 NAS Platform Driver" ); +MODULE_LICENSE ("GPL" );
Signature · 1 line
i.
Quoted 7 lines · Ilpo Järvinen
Quoted 5 lines · Ondrej Zary
Add platform driver for Synology x86-based NAS devices to support HDD LEDs controller by ICH9 GPIO pins.
Only DS411+II is supported for now (DS411+ should be the same except CPU).
Quoted 8 lines
Quoted 4 lines
Unfortunately, the DMI data in BIOS is not very helpful to identify the device as almost all strings are "To be filled by O.E.M.". Match also the BIOS date and then check presence of the onboard SiI3531 SATA controller and i82574L ethernet controller to avoid activation on other systems.
Hans, Andy,
Do you have an opinion on the selected approach?
Thinking more about that, maybe we should check the PCI host bridge (CPU) and ISA bridge (ICH9R) too. And if we also check the bus and device number of the onboard devices (02:00 and 03:00), the chance of false detection is almost zero.
Unfortunately, the subsystem IDs are not set either. Only the ethernet interface has subsystem device ID 0x0000 (how common is that?)
# lspci -vnn | egrep '^0|Subsystem'
00:00.0 Host bridge [0600]: Intel Corporation Atom Processor D4xx/D5xx/N4xx/N5xx DMI Bridge [8086:a000] (rev 02)
Subsystem: Intel Corporation Atom Processor D4xx/D5xx/N4xx/N5xx DMI Bridge [8086:a000]
00:02.0 VGA compatible controller [0300]: Intel Corporation Atom Processor D4xx/D5xx/N4xx/N5xx Integrated Graphics Controller [8086:a001] (rev 02) (prog-if 00 [VGA controller])
Subsystem: Intel Corporation Atom Processor D4xx/D5xx/N4xx/N5xx Integrated Graphics Controller [8086:a001]
00:02.1 Display controller [0380]: Intel Corporation Atom Processor D4xx/D5xx/N4xx/N5xx Integrated Graphics Controller [8086:a002] (rev 02)
Subsystem: Intel Corporation Device [8086:a001]
00:1a.0 USB controller [0c03]: Intel Corporation 82801I (ICH9 Family) USB UHCI Controller #4 [8086:2937] (rev 02) (prog-if 00 [UHCI])
Subsystem: Intel Corporation Optiplex 755 [8086:2937]
00:1a.1 USB controller [0c03]: Intel Corporation 82801I (ICH9 Family) USB UHCI Controller #5 [8086:2938] (rev 02) (prog-if 00 [UHCI])
Subsystem: Intel Corporation Optiplex 755 [8086:2938]
00:1a.2 USB controller [0c03]: Intel Corporation 82801I (ICH9 Family) USB UHCI Controller #6 [8086:2939] (rev 02) (prog-if 00 [UHCI])
Subsystem: Intel Corporation 82801I (ICH9 Family) USB UHCI Controller #6 [8086:2939]
00:1a.7 USB controller [0c03]: Intel Corporation 82801I (ICH9 Family) USB2 EHCI Controller #2 [8086:293c] (rev 02) (prog-if 20 [EHCI])
Subsystem: Intel Corporation Optiplex 755 [8086:293c]
00:1c.0 PCI bridge [0604]: Intel Corporation 82801I (ICH9 Family) PCI Express Port 1 [8086:2940] (rev 02) (prog-if 00 [Normal decode])
Subsystem: Intel Corporation Optiplex 755 [8086:2940]
Capabilities: [90] Subsystem: Intel Corporation Optiplex 755 [8086:2940]
00:1c.1 PCI bridge [0604]: Intel Corporation 82801I (ICH9 Family) PCI Express Port 2 [8086:2942] (rev 02) (prog-if 00 [Normal decode])
Subsystem: Intel Corporation 82801I (ICH9 Family) PCI Express Port 2 [8086:2942]
Capabilities: [90] Subsystem: Intel Corporation 82801I (ICH9 Family) PCI Express Port 2 [8086:2942]
00:1c.4 PCI bridge [0604]: Intel Corporation 82801I (ICH9 Family) PCI Express Port 5 [8086:2948] (rev 02) (prog-if 00 [Normal decode])
Subsystem: Intel Corporation 82801I (ICH9 Family) PCI Express Port 5 [8086:2948]
Capabilities: [90] Subsystem: Intel Corporation 82801I (ICH9 Family) PCI Express Port 5 [8086:2948]
00:1d.0 USB controller [0c03]: Intel Corporation 82801I (ICH9 Family) USB UHCI Controller #1 [8086:2934] (rev 02) (prog-if 00 [UHCI])
Subsystem: Intel Corporation 82801I (ICH9 Family) USB UHCI Controller #1 [8086:2934]
00:1d.1 USB controller [0c03]: Intel Corporation 82801I (ICH9 Family) USB UHCI Controller #2 [8086:2935] (rev 02) (prog-if 00 [UHCI])
Subsystem: Intel Corporation 82801I (ICH9 Family) USB UHCI Controller #2 [8086:2935]
00:1d.2 USB controller [0c03]: Intel Corporation 82801I (ICH9 Family) USB UHCI Controller #3 [8086:2936] (rev 02) (prog-if 00 [UHCI])
Subsystem: Intel Corporation 82801I (ICH9 Family) USB UHCI Controller #3 [8086:2936]
00:1d.7 USB controller [0c03]: Intel Corporation 82801I (ICH9 Family) USB2 EHCI Controller #1 [8086:293a] (rev 02) (prog-if 20 [EHCI])
Subsystem: Intel Corporation 82801I (ICH9 Family) USB2 EHCI Controller #1 [8086:293a]
00:1e.0 PCI bridge [0604]: Intel Corporation 82801 PCI Bridge [8086:244e] (rev 92) (prog-if 01 [Subtractive decode])
Subsystem: Intel Corporation 82801 PCI Bridge [8086:244e]
Capabilities: [50] Subsystem: Intel Corporation 82801 PCI Bridge [8086:244e]
00:1f.0 ISA bridge [0601]: Intel Corporation 82801IR (ICH9R) LPC Interface Controller [8086:2916] (rev 02)
Subsystem: Intel Corporation 82801IR (ICH9R) LPC Interface Controller [8086:2916]
00:1f.2 SATA controller [0106]: Intel Corporation 82801IR/IO/IH (ICH9R/DO/DH) 6 port SATA Controller [AHCI mode] [8086:2922] (rev 02) (prog-if 01 [AHCI 1.0])
Subsystem: Intel Corporation 82801IR/IO/IH (ICH9R/DO/DH) 6 port SATA Controller [AHCI mode] [8086:2922]
00:1f.3 SMBus [0c05]: Intel Corporation 82801I (ICH9 Family) SMBus Controller [8086:2930] (rev 02)
Subsystem: Intel Corporation 82801I (ICH9 Family) SMBus Controller [8086:2930]
02:00.0 Mass storage controller [0180]: Silicon Image, Inc. SiI 3531 [SATALink/SATARaid] Serial ATA Controller [1095:3531] (rev 01)
Subsystem: Silicon Image, Inc. SiI 3531 [SATALink/SATARaid] Serial ATA Controller [1095:3531]
03:00.0 Ethernet controller [0200]: Intel Corporation 82574L Gigabit Network Connection [8086:10d3]
Subsystem: Intel Corporation Device [8086:0000]Quoted 195 lines
Quoted 158 lines
Buttons and other LEDs are not supported by this driver because they're controlled by a PIC MCU (connected through serial port).
Signed-off-by Ondrej Zary <[email protected]>---
Changes in v2:
- fixed includes (order, added missing, removedkernel.h)
- added missing DMI and PCI dependencies toKconfig
- added PCI device presence check details to changelog
- used %pe for error message--- drivers/platform/x86/Kconfig | 16 ++++ drivers/platform/x86/Makefile | 3 + drivers/platform/x86/synology-x86.c | 128 ++++++++++++++++++++++++++++ 3 files changed, 147 insertions(+) create mode 100644 drivers/platform/x86/synology-x86.cdrivers/platform/x86/Kconfig +16
-0@@ -1059,6 +1059,22 @@ config OXP_EC source "drivers/platform/x86/tuxedo/Kconfig" +config SYNOLOGY_X86 + tristate "Synology x86 NAS Platform Driver" + depends on DMI + depends on GPIOLIB + depends on LPC_ICH + depends on GPIO_ICH + depends on LEDS_CLASS + depends on PCI + select LEDS_GPIO + help + This driver provides support for the HDD LEDs on Synology x86 NAS + devices. + + To compile this driver as a module, choose M here: the module + will be called synology-x86. + endif # X86_PLATFORM_DEVICES config P2SBdrivers/platform/x86/Makefile +3
-0@@ -166,3 +166,6 @@ obj-$(CONFIG_SEL3350_PLATFORM) += sel3350-platform.o # OneXPlayer obj-$(CONFIG_OXP_EC) += oxpec.o + +# Synology +obj-$(CONFIG_SYNOLOGY_X86) += synology-x86.odrivers/platform/x86/synology-x86.c new file +96
-0@@ -0,0 +1,128 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* +* Synology x86 NAS platform driver +* +* Inspired by platform/x86/meraki-mx100.c +* +* Copyright (C) 2026 Ondrej Zary <[email protected]> +*/ + +#include <linux/array_size.h> +#include <linux/dmi.h> +#include <linux/err.h> +#include <linux/gpio/machine.h> +#include <linux/leds.h> +#include <linux/module.h> +#include <linux/pci.h> +#include <linux/pci_ids.h> +#include <linux/platform_device.h> +#include <linux/printk.h> +#include <linux/string.h> + +static const struct gpio_led synology_leds[] = { + { .name ="synology:green:hdd1" }, + { .name ="synology:amber:hdd1" }, + { .name ="synology:green:hdd2" }, + { .name ="synology:amber:hdd2" }, + { .name ="synology:green:hdd3" }, + { .name ="synology:amber:hdd3" }, + { .name ="synology:green:hdd4" }, + { .name ="synology:amber:hdd4" }, +}; + +static const struct gpio_led_platform_data synology_leds_pdata = { + .num_leds =ARRAY_SIZE (synology_leds), + .leds = synology_leds, +}; + +#define GPIO_ICH_DRIVER_NAME "gpio_ich" + +static struct gpiod_lookup_table synology_leds_table = { + .dev_id ="leds-gpio" , + .table = { +GPIO_LOOKUP_IDX (GPIO_ICH_DRIVER_NAME ,16 ,NULL ,0 ,GPIO_ACTIVE_HIGH ), +GPIO_LOOKUP_IDX (GPIO_ICH_DRIVER_NAME ,18 ,NULL ,1 ,GPIO_ACTIVE_HIGH ), +GPIO_LOOKUP_IDX (GPIO_ICH_DRIVER_NAME ,20 ,NULL ,2 ,GPIO_ACTIVE_HIGH ), +GPIO_LOOKUP_IDX (GPIO_ICH_DRIVER_NAME ,32 ,NULL ,3 ,GPIO_ACTIVE_HIGH ), +GPIO_LOOKUP_IDX (GPIO_ICH_DRIVER_NAME ,33 ,NULL ,4 ,GPIO_ACTIVE_HIGH ), +GPIO_LOOKUP_IDX (GPIO_ICH_DRIVER_NAME ,34 ,NULL ,5 ,GPIO_ACTIVE_HIGH ), +GPIO_LOOKUP_IDX (GPIO_ICH_DRIVER_NAME ,49 ,NULL ,6 ,GPIO_ACTIVE_HIGH ), +GPIO_LOOKUP_IDX (GPIO_ICH_DRIVER_NAME ,55 ,NULL ,7 ,GPIO_ACTIVE_HIGH ), + {} + } +}; + +static const struct dmi_system_id synology_systems[]__initconst = { + { + .ident ="DS411+" ,/* DS411+II is the same with faster CPU */ + .matches = { +/* Synology did not put anything in DMI strings */ +DMI_EXACT_MATCH (DMI_SYS_VENDOR ,"To Be Filled By O.E.M." ), +DMI_EXACT_MATCH (DMI_PRODUCT_NAME ,"To Be Filled By O.E.M." ), +DMI_EXACT_MATCH (DMI_BOARD_NAME ,"To be filled by O.E.M." ), +DMI_EXACT_MATCH (DMI_BIOS_DATE ,"05/21/2012" ), + }, + }, + {} +}; +MODULE_DEVICE_TABLE (dmi, synology_systems); + +static struct platform_device *synology_leds_pdev; + +static int __init synology_init (void ) +{ +int ret; + +static const struct pci_device_id pci_sii3531[] = { + {PCI_DEVICE_SUB (PCI_VENDOR_ID_CMD ,0x3531 ,PCI_VENDOR_ID_CMD ,0x3531 ) }, + { } + }; + +static const struct pci_device_id pci_i82574l[] = { + {PCI_DEVICE_SUB (PCI_VENDOR_ID_INTEL ,0x10d3 ,PCI_VENDOR_ID_INTEL ,0x0000 ) }, + { } + }; + +const struct dmi_system_id *dmi =dmi_first_match (synology_systems); + +if (!dmi) +return -ENODEV ; + +/* DS411+ DMI match is too generic, confirm by onboard PCI devices */ +if (!strcmp (dmi->ident,"DS411+" )) { +if (!pci_dev_present (pci_sii3531) || + !pci_dev_present (pci_i82574l)) +return -ENODEV ; + }drivers/platform/x86/synology-x86.c line 106
Quoted 10 lines
drivers/platform/x86/synology-x86.c new file +10
-0+ +pr_info ("Detected Synology NAS %s\n" , dmi->ident); + +gpiod_add_lookup_table (&synology_leds_table); + + synology_leds_pdev =platform_device_register_data (NULL , +"leds-gpio" ,PLATFORM_DEVID_NONE , &synology_leds_pdata, +sizeof (synology_leds_pdata)); +if (IS_ERR (synology_leds_pdev)) { +pr_err ("error registering platform device: %pe\n" , synology_leds_pdev);Won't these be prefixless and you should add the usual
pr_fmtline?Quoted 23 lines
drivers/platform/x86/synology-x86.c new file +22
-0+ ret =PTR_ERR (synology_leds_pdev); + goto err; + } + +return 0 ; + +err: +gpiod_remove_lookup_table (&synology_leds_table); +return ret; +} +module_init (synology_init); + +static void __exit synology_exit(void) +{ +platform_device_unregister (synology_leds_pdev); +gpiod_remove_lookup_table (&synology_leds_table); +} +module_exit (synology_exit); + +MODULE_AUTHOR ("Ondrej Zary <[email protected]>" ); +MODULE_DESCRIPTION ("Synology x86 NAS Platform Driver" ); +MODULE_LICENSE ("GPL" );
Signature · 1 line
Ondrej Zary
Quoted 5 lines · Ondrej Zary
Quoted 4 lines · Ilpo Järvinen
Quoted 2 lines · Ondrej Zary
Add platform driver for Synology x86-based NAS devices to support HDD LEDs controller by ICH9 GPIO pins.
We usually host more than that in PDx86, you need to rephrase to point that this code only supports HDD LEDs on the platform in question. Same for the Kconfig help text.
Quoted 10 lines
Quoted 10 lines
Quoted 6 lines
Only DS411+II is supported for now (DS411+ should be the same except CPU).
Unfortunately, the DMI data in BIOS is not very helpful to identify the device as almost all strings are "To be filled by O.E.M.". Match also the BIOS date and then check presence of the onboard SiI3531 SATA controller and i82574L ethernet controller to avoid activation on other systems.
Hans, Andy,
Do you have an opinion on the selected approach?
Let me briefly look into this...
Quoted 7 lines
Thinking more about that, maybe we should check the PCI host bridge (CPU) and ISA bridge (ICH9R) too. And if we also check the bus and device number of the onboard devices (02:00 and 03:00), the chance of false detection is almost zero.
Unfortunately, the subsystem IDs are not set either. Only the ethernet interface has subsystem device ID
0x0000(how common is that?)
Usually Ethernet cards need a specific ROM part (where MAC address is written and possible other configuration pieces) that usually IFWI has and the proper ID of the Ethernet is updated with that information (yes, there are some stub PCI IDs are used for Intel Ethernet cards). But I haven't checked if 10d3 is a stub ID. And assuming device is recognized and working, I can simply guess that this is a miss in the BIOS (non-critical BIOS bug when they forgot to file that data into PCI configuration space).
Quoted 45 lines
# lspci -vnn | egrep '^0|Subsystem'
00:00.0 Host bridge [0600]: Intel Corporation Atom Processor D4xx/D5xx/N4xx/N5xx DMI Bridge [8086:a000] (rev 02)
Subsystem: Intel Corporation Atom Processor D4xx/D5xx/N4xx/N5xx DMI Bridge [8086:a000]
00:02.0 VGA compatible controller [0300]: Intel Corporation Atom Processor D4xx/D5xx/N4xx/N5xx Integrated Graphics Controller [8086:a001] (rev 02) (prog-if 00 [VGA controller])
Subsystem: Intel Corporation Atom Processor D4xx/D5xx/N4xx/N5xx Integrated Graphics Controller [8086:a001]
00:02.1 Display controller [0380]: Intel Corporation Atom Processor D4xx/D5xx/N4xx/N5xx Integrated Graphics Controller [8086:a002] (rev 02)
Subsystem: Intel Corporation Device [8086:a001]
00:1a.0 USB controller [0c03]: Intel Corporation 82801I (ICH9 Family) USB UHCI Controller #4 [8086:2937] (rev 02) (prog-if 00 [UHCI])
Subsystem: Intel Corporation Optiplex 755 [8086:2937]
00:1a.1 USB controller [0c03]: Intel Corporation 82801I (ICH9 Family) USB UHCI Controller #5 [8086:2938] (rev 02) (prog-if 00 [UHCI])
Subsystem: Intel Corporation Optiplex 755 [8086:2938]
00:1a.2 USB controller [0c03]: Intel Corporation 82801I (ICH9 Family) USB UHCI Controller #6 [8086:2939] (rev 02) (prog-if 00 [UHCI])
Subsystem: Intel Corporation 82801I (ICH9 Family) USB UHCI Controller #6 [8086:2939]
00:1a.7 USB controller [0c03]: Intel Corporation 82801I (ICH9 Family) USB2 EHCI Controller #2 [8086:293c] (rev 02) (prog-if 20 [EHCI])
Subsystem: Intel Corporation Optiplex 755 [8086:293c]
00:1c.0 PCI bridge [0604]: Intel Corporation 82801I (ICH9 Family) PCI Express Port 1 [8086:2940] (rev 02) (prog-if 00 [Normal decode])
Subsystem: Intel Corporation Optiplex 755 [8086:2940]
Capabilities: [90] Subsystem: Intel Corporation Optiplex 755 [8086:2940]
00:1c.1 PCI bridge [0604]: Intel Corporation 82801I (ICH9 Family) PCI Express Port 2 [8086:2942] (rev 02) (prog-if 00 [Normal decode])
Subsystem: Intel Corporation 82801I (ICH9 Family) PCI Express Port 2 [8086:2942]
Capabilities: [90] Subsystem: Intel Corporation 82801I (ICH9 Family) PCI Express Port 2 [8086:2942]
00:1c.4 PCI bridge [0604]: Intel Corporation 82801I (ICH9 Family) PCI Express Port 5 [8086:2948] (rev 02) (prog-if 00 [Normal decode])
Subsystem: Intel Corporation 82801I (ICH9 Family) PCI Express Port 5 [8086:2948]
Capabilities: [90] Subsystem: Intel Corporation 82801I (ICH9 Family) PCI Express Port 5 [8086:2948]
00:1d.0 USB controller [0c03]: Intel Corporation 82801I (ICH9 Family) USB UHCI Controller #1 [8086:2934] (rev 02) (prog-if 00 [UHCI])
Subsystem: Intel Corporation 82801I (ICH9 Family) USB UHCI Controller #1 [8086:2934]
00:1d.1 USB controller [0c03]: Intel Corporation 82801I (ICH9 Family) USB UHCI Controller #2 [8086:2935] (rev 02) (prog-if 00 [UHCI])
Subsystem: Intel Corporation 82801I (ICH9 Family) USB UHCI Controller #2 [8086:2935]
00:1d.2 USB controller [0c03]: Intel Corporation 82801I (ICH9 Family) USB UHCI Controller #3 [8086:2936] (rev 02) (prog-if 00 [UHCI])
Subsystem: Intel Corporation 82801I (ICH9 Family) USB UHCI Controller #3 [8086:2936]
00:1d.7 USB controller [0c03]: Intel Corporation 82801I (ICH9 Family) USB2 EHCI Controller #1 [8086:293a] (rev 02) (prog-if 20 [EHCI])
Subsystem: Intel Corporation 82801I (ICH9 Family) USB2 EHCI Controller #1 [8086:293a]
00:1e.0 PCI bridge [0604]: Intel Corporation 82801 PCI Bridge [8086:244e] (rev 92) (prog-if 01 [Subtractive decode])
Subsystem: Intel Corporation 82801 PCI Bridge [8086:244e]
Capabilities: [50] Subsystem: Intel Corporation 82801 PCI Bridge [8086:244e]
00:1f.0 ISA bridge [0601]: Intel Corporation 82801IR (ICH9R) LPC Interface Controller [8086:2916] (rev 02)
Subsystem: Intel Corporation 82801IR (ICH9R) LPC Interface Controller [8086:2916]
00:1f.2 SATA controller [0106]: Intel Corporation 82801IR/IO/IH (ICH9R/DO/DH) 6 port SATA Controller [AHCI mode] [8086:2922] (rev 02) (prog-if 01 [AHCI 1.0])
Subsystem: Intel Corporation 82801IR/IO/IH (ICH9R/DO/DH) 6 port SATA Controller [AHCI mode] [8086:2922]
00:1f.3 SMBus [0c05]: Intel Corporation 82801I (ICH9 Family) SMBus Controller [8086:2930] (rev 02)
Subsystem: Intel Corporation 82801I (ICH9 Family) SMBus Controller [8086:2930]
02:00.0 Mass storage controller [0180]: Silicon Image, Inc. SiI 3531 [SATALink/SATARaid] Serial ATA Controller [1095:3531] (rev 01)
Subsystem: Silicon Image, Inc. SiI 3531 [SATALink/SATARaid] Serial ATA Controller [1095:3531]
03:00.0 Ethernet controller [0200]: Intel Corporation 82574L Gigabit Network Connection [8086:10d3]
Subsystem: Intel Corporation Device [8086:0000]...
Quoted 1 line
Quoted 1 line
Quoted 1 line
+ * Synology x86 NAS platform driver
Make this line same as tristate in Kconfig.
...
Quoted 9 lines
Quoted 9 lines
drivers/platform/x86/synology-x86.c line 17
Quoted 9 lines
drivers/platform/x86/synology-x86.c new file +8
-0+#include <linux/array_size.h> +#include <linux/dmi.h> +#include <linux/err.h> +#include <linux/gpio/machine.h> +#include <linux/leds.h> +#include <linux/module.h> +#include <linux/pci.h> +#include <linux/pci_ids.h>
It's assumed by pci.h.
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
drivers/platform/x86/synology-x86.c new file +3
-0+#include <linux/platform_device.h> +#include <linux/printk.h> +#include <linux/string.h>
...
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
drivers/platform/x86/synology-x86.c new file +6
-0+static struct gpiod_lookup_table synology_leds_table = { + .dev_id ="leds-gpio" , + .table = { +GPIO_LOOKUP_IDX (GPIO_ICH_DRIVER_NAME ,16 ,NULL ,0 ,GPIO_ACTIVE_HIGH ), +GPIO_LOOKUP_IDX (GPIO_ICH_DRIVER_NAME ,18 ,NULL ,1 ,GPIO_ACTIVE_HIGH ), +GPIO_LOOKUP_IDX (GPIO_ICH_DRIVER_NAME ,20 ,NULL ,2 ,GPIO_ACTIVE_HIGH ),
Quoted 8 lines
Quoted 8 lines
drivers/platform/x86/synology-x86.c line 53
Quoted 8 lines
drivers/platform/x86/synology-x86.c new file +8
-0+ GPIO_LOOKUP_IDX(GPIO_ICH_DRIVER_NAME, 32, NULL, 3, GPIO_ACTIVE_HIGH), + GPIO_LOOKUP_IDX(GPIO_ICH_DRIVER_NAME, 33, NULL, 4, GPIO_ACTIVE_HIGH), + GPIO_LOOKUP_IDX(GPIO_ICH_DRIVER_NAME, 34, NULL, 5, GPIO_ACTIVE_HIGH), + GPIO_LOOKUP_IDX(GPIO_ICH_DRIVER_NAME, 49, NULL, 6, GPIO_ACTIVE_HIGH), + GPIO_LOOKUP_IDX(GPIO_ICH_DRIVER_NAME, 55, NULL, 7, GPIO_ACTIVE_HIGH), + {} + } +};
Please, switch to use GPIO swnodes.
...
Quoted 10 lines
Quoted 10 lines
drivers/platform/x86/synology-x86.c line 64
Quoted 10 lines
drivers/platform/x86/synology-x86.c new file +10
-0+static const struct dmi_system_id synology_systems[]__initconst = { + { + .ident ="DS411+" ,/* DS411+II is the same with faster CPU */ + .matches = { +/* Synology did not put anything in DMI strings */ +DMI_EXACT_MATCH (DMI_SYS_VENDOR ,"To Be Filled By O.E.M." ), +DMI_EXACT_MATCH (DMI_PRODUCT_NAME ,"To Be Filled By O.E.M." ), +DMI_EXACT_MATCH (DMI_BOARD_NAME ,"To be filled by O.E.M." ), +DMI_EXACT_MATCH (DMI_BIOS_DATE ,"05/21/2012" ), + },
This needs a better comment assuring that this is unique enough. See what Hans did elsewhere for the similar DMI case.
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
drivers/platform/x86/synology-x86.c new file +3
-0+ }, + {} +};
...
Quoted 16 lines
Quoted 15 lines
Quoted 15 lines
drivers/platform/x86/synology-x86.c new file +15
-0+static int __init synology_init (void ) +{ +int ret; + +static const struct pci_device_id pci_sii3531[] = { + {PCI_DEVICE_SUB (PCI_VENDOR_ID_CMD ,0x3531 ,PCI_VENDOR_ID_CMD ,0x3531 ) }, + { } + }; + +static const struct pci_device_id pci_i82574l[] = { + {PCI_DEVICE_SUB (PCI_VENDOR_ID_INTEL ,0x10d3 ,PCI_VENDOR_ID_INTEL ,0x0000 ) }, + { } + }; + +const struct dmi_system_id *dmi =dmi_first_match (synology_systems);
Quoted 1 line
Quoted 1 line
Quoted 1 line
+
Unneeded blank line.
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
drivers/platform/x86/synology-x86.c new file +9
-0+if (!dmi) +return -ENODEV ; + +/* DS411+ DMI match is too generic, confirm by onboard PCI devices */ +if (!strcmp (dmi->ident,"DS411+" )) { +if (!pci_dev_present (pci_sii3531) || + !pci_dev_present (pci_i82574l)) +return -ENODEV ; + }
Quoted 8 lines
Quoted 8 lines
drivers/platform/x86/synology-x86.c line 104
Quoted 8 lines
drivers/platform/x86/synology-x86.c new file +8
-0+ +pr_info ("Detected Synology NAS %s\n" , dmi->ident); + +gpiod_add_lookup_table (&synology_leds_table); + + synology_leds_pdev =platform_device_register_data (NULL , +"leds-gpio" ,PLATFORM_DEVID_NONE , &synology_leds_pdata, +sizeof (synology_leds_pdata));
ret = PTR_ERR_OR_ZERO(...);
Quoted 15 lines
Quoted 15 lines
drivers/platform/x86/synology-x86.c line 106
Quoted 2 lines
drivers/platform/x86/synology-x86.c new file +2
-0+if (IS_ERR (synology_leds_pdev)) { +pr_err ("error registering platform device: %pe\n" , synology_leds_pdev);Won't these be prefixless and you should add the usual
pr_fmtline?Quoted 10 lines
drivers/platform/x86/synology-x86.c new file +10
-0+ ret =PTR_ERR (synology_leds_pdev); + goto err; + } + +return 0 ; + +err: +gpiod_remove_lookup_table (&synology_leds_table); +return ret; +}
Signature · 2 lines
With Best Regards, Andy Shevchenko
Quoted 3 lines · Andy Shevchenko
Quoted 2 lines · Ondrej Zary
Quoted 1 line · Ilpo Järvinen
On Fri, 20 Nov 2026, Ondrej Zary wrote:
...
Quoted 3 lines
Quoted 1 line
Quoted 1 line
Do you have an opinion on the selected approach?
Let me briefly look into this...
In general there is nothing wrong with this approach. Only the enumeration part is somewhat worrying. I haven't checked how other similar drivers do in such cases, I know Hans has a lot of expertise in x86 quirks.
Signature · 2 lines
With Best Regards, Andy Shevchenko