Introduce Synology Microp driver
Subsystems (6)
v5 cover Introduce Synology Microp driver
Synology uses a microcontroller in their NAS devices connected to a serial port to control certain LEDs, fan speeds, a beeper, to handle proper shutdown and restart, buttons and fan failures.
This patch series depends on the rust led abstraction [1] and the rust serdev abstraction [2].
This is only a initial version of the driver able to control LEDs. The following rust abstractions would be required, to implement the remaining features:
- hwmon (include/linux/hwmon.h)
- input (include/linux/input.h)
- sysoff handler + hardware protection shutdown (include/linux/reboot.h)
[1] https://lore.kernel.org/rust-for-linux/[email protected]/
[2] https://lore.kernel.org/rust-for-linux/[email protected]/
---
Changes in v5:
- add esata led support
- use different compatible for each model
- add visibility modifier to of_device_table macro
- fix match data missing when using PRP0001
- Link to v4: https://lore.kernel.org/r/[email protected]
Changes in v4:
- convert to monolithic driver and moved it into drivers/platform
- removed mfd rust abstraction
- moved dt-bindings to embedded-controller
- Link to v3: https://lore.kernel.org/r/[email protected]
Changes in v3:
- remove default n from Kconfig entry, as n is the default already.
- select RUST_SERIAL_DEV_BUS_ABSTRACTIONS in Kconfig
- add mfd rust abstraction
- split core and led parts into their own driver. It should now be considered a
MFD device.
- split led part of dt binding into its own file
- Link to v2: https://lore.kernel.org/r/[email protected]
Changes in v2:
- fix missing tabs in MAINTAINERS file
- remove word binding from patch subject
- add missing signed-off-by
- add missing help entry in Kconfig
- add missing spdx license headers
- remove no-check{,-cpu}-fan properties from the dt-bindings and replace
them with the check_fan module parameter
- use patternProperties for leds in dt-bindings
- license dt-binding as GPL-2.0-only OR BSD-2-Clause
- move driver from staging tree into mfd tree and mark it as work in
progress inside Kconfig
- only register alert and usb led if fwnode is present
- Link to v1: https://lore.kernel.org/r/[email protected]
---
Markus Probst (4):
dt-bindings: embedded-controller: Add synology microp devices
ACPI: of: match PRP0001 in of_match_device
rust: add visibility to of_device_table macro
platform: Add initial synology microp driver
.../synology,ds923p-microp.yaml | 65 +++++ MAINTAINERS | 6 + drivers/acpi/bus.c | 7 +- drivers/of/device.c | 9 +- drivers/platform/Kconfig | 2 + drivers/platform/Makefile | 1 + drivers/platform/synology_microp/Kconfig | 13 + drivers/platform/synology_microp/Makefile | 3 + drivers/platform/synology_microp/TODO | 7 + drivers/platform/synology_microp/command.rs | 55 ++++ drivers/platform/synology_microp/led.rs | 276 +++++++++++++++++++++ drivers/platform/synology_microp/model.rs | 171 +++++++++++++ .../platform/synology_microp/synology_microp.rs | 54 ++++ include/linux/acpi.h | 11 + rust/kernel/of.rs | 5 +- 15 files changed, 678 insertions(+), 7 deletions(-)
---
base-commit: d1d81e9d1a4dd846aee9ae77ff9ecc2800d72148
change-id: 20260306-synology_microp_initial-0f7dac7b7496
prerequisite-change-id: 20251217-rust_serdev-ee5481e9085c:v3
prerequisite-patch-id: 52b17274481cc770c257d8f95335293eca32a2c5
prerequisite-patch-id: eec47e5051640d08bcd34a9670b98804449cad52
prerequisite-patch-id: f24b68c71c3f69371e8ac0251efca0a023b31cc4
prerequisite-patch-id: 3dfc1f7e5ecd3e0dd65d676aeb16f55260847b25
prerequisite-change-id: 20251114-rust_leds-a959f7c2f7f9:v13
prerequisite-patch-id: 818700f22dcb9676157c985f82762d7c607b861e
prerequisite-patch-id: b15ffa7d95d9260151bfb116b259c4473f721c82
prerequisite-patch-id: 8c47e0d107530f577a1be0b79f8ee791f95d3cbe
PATCH v5 1/4 dt-bindings: embedded-controller: Add synology microp devices
Add the Synology Microp devicetree bindings. Those devices are microcontrollers found on Synology NAS devices. They are connected to a serial port on the host device.
Those devices are used to control certain LEDs, fan speeds, a beeper, to handle buttons, fan failures and to properly shutdown and reboot the device.
--- .../synology,ds923p-microp.yaml | 65 ++++++++++++++++++++++ 1 file changed, 65 insertions(+)
Documentation/devicetree/bindings/embedded-controller/synology,ds923p-microp.yaml new file +65 -0
@@ -0,0 +1,65 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/embedded-controller/synology,ds923p-microp.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Synology NAS on-board Microcontroller + +maintainers: + - Markus Probst <[email protected]> + +description: | + Synology Microp is a microcontroller found in Synology NAS devices. + It is connected to a serial port on the host device. + + It is necessary to properly shutdown and reboot the NAS device and + provides additional functionality such as led control, fan speed control, + a beeper and buttons on the NAS device. + +properties: + compatible: + enum: + - synology,ds923p-microp + - synology,ds918p-microp + - synology,ds214play-microp + - synology,ds225p-microp + - synology,ds425p-microp + - synology,ds710p-microp + - synology,ds1010p-microp + - synology,ds723p-microp + - synology,ds1522p-microp + - synology,rs422p-microp + - synology,ds725p-microp + - synology,ds118-microp + - synology,ds124-microp + - synology,ds223-microp + - synology,ds223j-microp + - synology,ds1823xsp-microp + - synology,rs822p-microp + - synology,rs1221p-microp + - synology,rs1221rpp-microp + - synology,ds925p-microp + - synology,ds1525p-microp + - synology,ds1825p-microp + + fan-failure-gpios: + description: GPIOs needed to determine which fans stopped working on a fan failure event. + minItems: 2 + maxItems: 3 + +required: + - compatible + +additionalProperties: false + +examples: + - | + #include <dt-bindings/leds/common.h> + #include <dt-bindings/gpio/gpio.h> + + embedded-controller { + compatible = "synology,ds923p-microp"; + + fan-failure-gpios = <&gpio 68 GPIO_ACTIVE_HIGH>, <&gpio 69 GPIO_ACTIVE_HIGH>; + };
Signature · 1 line
2.52.0
Re: [PATCH v5 1/4] dt-bindings: embedded-controller: Add synology microp devices
Quoted 15 lines · Markus Probst
Documentation/devicetree/bindings/embedded-controller/synology,ds923p-microp.yaml new file +15
-0+properties: + compatible: + enum: + - synology,ds923p-microp + - synology,ds918p-microp + - synology,ds214play-microp + - synology,ds225p-microp + - synology,ds425p-microp + - synology,ds710p-microp + - synology,ds1010p-microp + - synology,ds723p-microp + - synology,ds1522p-microp + - synology,rs422p-microp + - synology,ds725p-microp + - synology,ds118-microp
Documentation/devicetree/bindings/embedded-controller/synology,ds923p-microp.yaml line 44
Quoted 10 lines
Documentation/devicetree/bindings/embedded-controller/synology,ds923p-microp.yaml new file +10
-0+ - synology,ds124-microp + - synology,ds223-microp + - synology,ds223j-microp + - synology,ds1823xsp-microp + - synology,rs822p-microp + - synology,rs1221p-microp + - synology,rs1221rpp-microp + - synology,ds925p-microp + - synology,ds1525p-microp + - synology,ds1825p-microp
Last time you had one compatible and implied they are all compatible. Now none of them are compatible, which might be accurate, but nothing explains WHY they are not compatible in the commit msg.
Documentation/devicetree/bindings/embedded-controller/synology,ds923p-microp.yaml line 49
Quoted 5 lines
Documentation/devicetree/bindings/embedded-controller/synology,ds923p-microp.yaml new file +5
-0+ + fan-failure-gpios: + description: GPIOs needed to determine which fans stopped working on a fan failure event. + minItems: 2 + maxItems: 3
Constraints cannot be flexible. You need allOf:if:then: block to narrow them per variant.
Best regards,
Krzysztof
Re: [PATCH v5 1/4] dt-bindings: embedded-controller: Add synology microp devices
Quoted 27 lines · Krzysztof Kozlowski
Quoted 15 lines · Markus Probst
Documentation/devicetree/bindings/embedded-controller/synology,ds923p-microp.yaml new file +15
-0+properties: + compatible: + enum: + - synology,ds923p-microp + - synology,ds918p-microp + - synology,ds214play-microp + - synology,ds225p-microp + - synology,ds425p-microp + - synology,ds710p-microp + - synology,ds1010p-microp + - synology,ds723p-microp + - synology,ds1522p-microp + - synology,rs422p-microp + - synology,ds725p-microp + - synology,ds118-micropDocumentation/devicetree/bindings/embedded-controller/synology,ds923p-microp.yaml line 44
Quoted 10 lines
Documentation/devicetree/bindings/embedded-controller/synology,ds923p-microp.yaml new file +10
-0+ - synology,ds124-microp + - synology,ds223-microp + - synology,ds223j-microp + - synology,ds1823xsp-microp + - synology,rs822p-microp + - synology,rs1221p-microp + - synology,rs1221rpp-microp + - synology,ds925p-microp + - synology,ds1525p-microp + - synology,ds1825p-microp
Quoted 2 lines
Last time you had one compatible and implied they are all compatible. Now none of them are compatible, which might be accurate,
As you mentioned earlier:
Unless exactly same board is used
in different models (unlikely) then the compatible defines the LEDs and they are not needed in DT.
Quoted 3 lines
but nothing
explains WHY they are not compatible in the commit msg.
Shall all 22 compatible be in the commit msg?
Also, might be worth documenting this requirement [1].
Quoted 9 lines
Documentation/devicetree/bindings/embedded-controller/synology,ds923p-microp.yaml line 49
Quoted 6 lines
Documentation/devicetree/bindings/embedded-controller/synology,ds923p-microp.yaml new file +5
-0+ + fan-failure-gpios: + description: GPIOs needed to determine which fans stopped working on a fan failure event. + minItems: 2 + maxItems: 3Constraints cannot be flexible. You need allOf:if:then: block to narrow them per variant.
I can disable the property or force the property based on compatible with it.
But it seems it won't let me modify the minItems and maxItems constraint.
Thanks
- Markus Probst
[1] https://docs.kernel.org/devicetree/bindings/submitting-patches.html
Quoted 3 lines
Best regards,
Krzysztof
PATCH v5 2/4 ACPI: of: match PRP0001 in of_match_device
In reply to Markus ProbstExport acpi_of_match_device function and use it to match for PRP0001 in of_match_device, if the device does not have a device node.
This fixes the match data being NULL when using ACPI PRP0001, even though the device was matched against an of device table.
--- drivers/acpi/bus.c | 7 ++++--- drivers/of/device.c | 9 +++++++-- include/linux/acpi.h | 11 +++++++++++ 3 files changed, 22 insertions(+), 5 deletions(-)
drivers/acpi/bus.c +4 -3
@@ -831,9 +831,9 @@ const struct acpi_device *acpi_companion_match(const struct device *dev)* identifiers and a _DSD object with the "compatible" property, use that * property to match against the given list of identifiers. */ -static bool acpi_of_match_device (const struct acpi_device *adev, -const struct of_device_id *of_match_table, -const struct of_device_id **of_id) +bool acpi_of_match_device (const struct acpi_device *adev, +const struct of_device_id *of_match_table, +const struct of_device_id **of_id) {const union acpi_object *of_compatible, *obj;int i, nval;
@@ -866,6 +866,7 @@ static bool acpi_of_match_device(const struct acpi_device *adev,return false; } +EXPORT_SYMBOL_GPL (acpi_of_match_device);static bool acpi_of_modalias (struct acpi_device *adev,char *modalias,size_t len)
drivers/of/device.c +7 -2
@@ -11,6 +11,7 @@#include <linux/mod_devicetable.h> #include <linux/slab.h> #include <linux/platform_device.h> +#include <linux/acpi.h> #include <asm/errno.h> #include "of_private.h"
@@ -26,8 +27,12 @@const struct of_device_id *of_match_device (const struct of_device_id *matches,const struct device *dev) { -if (!matches || !dev->of_node || dev->of_node_reused) -return NULL ; +if (!matches || !dev->of_node || dev->of_node_reused) { +const struct of_device_id *id =NULL ; + +acpi_of_match_device (ACPI_COMPANION (dev), matches, &id); +return id; + }return of_match_node (matches, dev->of_node); }EXPORT_SYMBOL (of_match_device);
include/linux/acpi.h +11 -0
@@ -736,6 +736,10 @@ const struct acpi_device_id *acpi_match_acpi_device(const struct acpi_device_idconst struct acpi_device_id *acpi_match_device (const struct acpi_device_id *ids,const struct device *dev); +bool acpi_of_match_device (const struct acpi_device *adev, +const struct of_device_id *of_match_table, +const struct of_device_id **of_id); +const void *acpi_device_get_match_data (const struct device *dev);extern bool acpi_driver_match_device (struct device *dev,const struct device_driver *drv);
@@ -965,6 +969,13 @@ static inline const struct acpi_device_id *acpi_match_device(return NULL ; } +static inline bool acpi_of_match_device (const struct acpi_device *adev, +const struct of_device_id *of_match_table, +const struct of_device_id **of_id) +{ +return false; +} +static inline const void *acpi_device_get_match_data (const struct device *dev) {return NULL ;
Signature · 1 line
2.52.0
Re: [PATCH v5 2/4] ACPI: of: match PRP0001 in of_match_device
Quoted 5 lines · Markus Probst
Export
acpi_of_match_devicefunction and use it to match for PRP0001 inof_match_device, if the device does not have a device node.This fixes the match data being NULL when using ACPI PRP0001, even though the device was matched against an of device table.
Fixes tag?
I don't see how this is going to fix !ACPI case - the acpi_of_match_device() will just return false.
Quoted 46 lines
Signed-off-by Markus Probst <[email protected]>--- drivers/acpi/bus.c | 7 ++++--- drivers/of/device.c | 9 +++++++-- include/linux/acpi.h | 11 +++++++++++ 3 files changed, 22 insertions(+), 5 deletions(-)drivers/acpi/bus.c +4
-3@@ -831,9 +831,9 @@ const struct acpi_device *acpi_companion_match(const struct device *dev)* identifiers and a _DSD object with the "compatible" property, use that * property to match against the given list of identifiers. */ -static bool acpi_of_match_device (const struct acpi_device *adev, -const struct of_device_id *of_match_table, -const struct of_device_id **of_id) +bool acpi_of_match_device (const struct acpi_device *adev, +const struct of_device_id *of_match_table, +const struct of_device_id **of_id) {const union acpi_object *of_compatible, *obj;int i, nval;@@ -866,6 +866,7 @@ static bool acpi_of_match_device(const struct acpi_device *adev,return false; } +EXPORT_SYMBOL_GPL (acpi_of_match_device);static bool acpi_of_modalias (struct acpi_device *adev,char *modalias,size_t len)drivers/of/device.c +1
-0@@ -11,6 +11,7 @@#include <linux/mod_devicetable.h> #include <linux/slab.h> #include <linux/platform_device.h> +#include <linux/acpi.h> #include <asm/errno.h> #include "of_private.h"
drivers/of/device.c line 33
Quoted 9 lines
drivers/of/device.c +4
-2@@ -26,8 +27,12 @@const struct of_device_id *of_match_device (const struct of_device_id *matches,const struct device *dev) { -if (!matches || !dev->of_node || dev->of_node_reused) -return NULL ; +if (!matches || !dev->of_node || dev->of_node_reused) { +const struct of_device_id *id =NULL ; + +acpi_of_match_device (ACPI_COMPANION (dev), matches, &id);
I don't think this should be done from of_match_device. Yuo will have soon recursive calls, because acpi_of_match_device() will call other match, that will call of_match_device() and so on...
of_match_device() is supposed to match only against OF. Not ACPI. There should be no ACPI header or code in this unit file.
Best regards,
Krzysztof
Re: [PATCH v5 2/4] ACPI: of: match PRP0001 in of_match_device
Quoted 11 lines · Krzysztof Kozlowski
Quoted 5 lines · Markus Probst
Export
acpi_of_match_devicefunction and use it to match for PRP0001 inof_match_device, if the device does not have a device node.This fixes the match data being NULL when using ACPI PRP0001, even though the device was matched against an of device table.
Fixes tag?
I don't see how this is going to fix !ACPI case - the
acpi_of_match_device()will just return false.
While trying to argue I found out that there already is device_get_match_data, which takes PRP0001 into account.
I will now instead make a patch, which will make rust use this function instead of calling of_match_device and acpi_match_device individually, which ignores PRP0001.
There are still a lot of drivers only using of_match_device, which makes it impossible to use PRP0001 with them. But this is not relevant for this driver.
Thanks
- Markus Probst
Quoted 67 lines
Quoted 48 lines
Signed-off-by Markus Probst <[email protected]>--- drivers/acpi/bus.c | 7 ++++--- drivers/of/device.c | 9 +++++++-- include/linux/acpi.h | 11 +++++++++++ 3 files changed, 22 insertions(+), 5 deletions(-)drivers/acpi/bus.c +4
-3@@ -831,9 +831,9 @@ const struct acpi_device *acpi_companion_match(const struct device *dev)* identifiers and a _DSD object with the "compatible" property, use that * property to match against the given list of identifiers. */ -static bool acpi_of_match_device (const struct acpi_device *adev, -const struct of_device_id *of_match_table, -const struct of_device_id **of_id) +bool acpi_of_match_device (const struct acpi_device *adev, +const struct of_device_id *of_match_table, +const struct of_device_id **of_id) {const union acpi_object *of_compatible, *obj;int i, nval;@@ -866,6 +866,7 @@ static bool acpi_of_match_device(const struct acpi_device *adev,return false; } +EXPORT_SYMBOL_GPL (acpi_of_match_device);static bool acpi_of_modalias (struct acpi_device *adev,char *modalias,size_t len)drivers/of/device.c +1
-0@@ -11,6 +11,7 @@#include <linux/mod_devicetable.h> #include <linux/slab.h> #include <linux/platform_device.h> +#include <linux/acpi.h> #include <asm/errno.h> #include "of_private.h" drivers/of/device.c line 33
Quoted 9 lines
drivers/of/device.c +4
-2@@ -26,8 +27,12 @@const struct of_device_id *of_match_device (const struct of_device_id *matches,const struct device *dev) { -if (!matches || !dev->of_node || dev->of_node_reused) -return NULL ; +if (!matches || !dev->of_node || dev->of_node_reused) { +const struct of_device_id *id =NULL ; + +acpi_of_match_device (ACPI_COMPANION (dev), matches, &id);I don't think this should be done from
of_match_device. Yuo will have soon recursive calls, becauseacpi_of_match_device()will call other match, that will callof_match_device()and so on...
of_match_device()is supposed to match only against OF. Not ACPI. There should be no ACPI header or code in this unit file.Best regards,
Krzysztof
Rob Herring
maintainerRe: [PATCH v5 2/4] ACPI: of: match PRP0001 in of_match_device
Quoted 10 lines · Markus Probst
Quoted 9 lines · Krzysztof Kozlowski
Quoted 5 lines · Markus Probst
Export
acpi_of_match_devicefunction and use it to match for PRP0001 inof_match_device, if the device does not have a device node.This fixes the match data being NULL when using ACPI PRP0001, even though the device was matched against an of device table.
Fixes tag?
Quoted 8 lines
Quoted 2 lines
I don't see how this is going to fix !ACPI case - the
acpi_of_match_device()will just return false.While trying to argue I found out that there already is
device_get_match_data, which takes PRP0001 into account.I will now instead make a patch, which will make rust use this function instead of calling
of_match_deviceandacpi_match_deviceindividually, which ignores PRP0001.
IIRC, the rust binding already gives you the data pointer in probe.
Quoted 3 lines
There are still a lot of drivers only using
of_match_device, which makes it impossible to use PRP0001 with them. But this is not relevant for this driver.
Usually using of_match_device() in drivers is wrong. You generally just want the data pointer. There's a whole bunch of drivers still doing the old way.
Rob
Re: [PATCH v5 2/4] ACPI: of: match PRP0001 in of_match_device
Quoted 13 lines · Rob Herring
Quoted 12 lines · Markus Probst
Quoted 11 lines · Krzysztof Kozlowski
Quoted 5 lines · Markus Probst
Export
acpi_of_match_devicefunction and use it to match for PRP0001 inof_match_device, if the device does not have a device node.This fixes the match data being NULL when using ACPI PRP0001, even though the device was matched against an of device table.
Fixes tag?
I don't see how this is going to fix !ACPI case - the
acpi_of_match_device()will just return false.
Quoted 8 lines
Quoted 6 lines
While trying to argue I found out that there already is
device_get_match_data, which takes PRP0001 into account.I will now instead make a patch, which will make rust use this function instead of calling
of_match_deviceandacpi_match_deviceindividually, which ignores PRP0001.IIRC, the rust binding already gives you the data pointer in probe.
Yes, but that pointer is obtained by calling acpi_match_device and of_match_device [1].
Thanks
- Markus Probst
Quoted 10 lines
Quoted 4 lines
There are still a lot of drivers only using
of_match_device, which makes it impossible to use PRP0001 with them. But this is not relevant for this driver.Usually using
of_match_device()in drivers is wrong. You generally just want the data pointer. There's a whole bunch of drivers still doing the old way.Rob
PATCH v5 3/4 rust: add visibility to of_device_table macro
In reply to Markus ProbstAdd visibility argument to macro to allow defining an of device table in a different module than the driver, which can improve readability.
--- rust/kernel/of.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
rust/kernel/of.rs +3 -2
@@ -53,8 +53,9 @@ pub const fn new(compatible: &'static CStr) -> Self {/// Create an OF `IdTable` with an "alias" for modpost. #[macro_export] macro_rules! of_device_table { - ($table_name:ident, $module_table_name:ident, $id_info_type: ty, $table_data: expr) => { -const $table_name: $crate::device_id::IdArray < + ($table_vis:vis $table_name:ident, $module_table_name:ident, $id_info_type: ty, + $table_data: expr) => { + $table_visconst $table_name: $crate::device_id::IdArray < $crate::of::DeviceId , $id_info_type, { $table_data.len () },
Signature · 1 line
2.52.0
Re: [PATCH v5 3/4] rust: add visibility to of_device_table macro
Quoted 2 lines · Markus Probst
Add visibility argument to macro to allow defining an of device table in a different module than the driver, which can improve readability.
No. The of_device_id table must be always placed next to the foo_driver. You keep introducing completely inconsisting styles in this patchset, like completely broken usage of compatibles in the driver.
Best regards,
Krzysztof
PATCH v5 4/4 platform: Add initial synology microp driver
In reply to Markus ProbstAdd a initial synology microp driver, written in Rust.
The driver targets a microcontroller found in Synology NAS devices. It currently only supports controlling of the power led, status led, alert led and usb led. Other components such as fan control or handling on-device buttons will be added once the required rust abstractions are there.
This driver can be used both on arm and x86, thus it goes into the root directory of drivers/platform.
Tested successfully on a Synology DS923+.
--- MAINTAINERS | 6 + drivers/platform/Kconfig | 2 + drivers/platform/Makefile | 1 + drivers/platform/synology_microp/Kconfig | 13 + drivers/platform/synology_microp/Makefile | 3 + drivers/platform/synology_microp/TODO | 7 + drivers/platform/synology_microp/command.rs | 55 ++++ drivers/platform/synology_microp/led.rs | 276 +++++++++++++++++++++ drivers/platform/synology_microp/model.rs | 171 +++++++++++++ .../platform/synology_microp/synology_microp.rs | 54 ++++ 10 files changed, 588 insertions(+)
MAINTAINERS +6 -0
@@ -25544,6 +25544,12 @@ F: drivers/dma-buf/sync_* F: include/linux/sync_file.h F: include/uapi/linux/sync_file.h +SYNOLOGY MICROP DRIVER +M: Markus Probst <[email protected]> +S: Maintained +F: Documentation/devicetree/bindings/embedded-controller/synology,ds923p-microp.yaml +F: drivers/platform/synology_microp/ + SYNOPSYS ARC ARCHITECTURE M: Vineet Gupta <[email protected]> L: [email protected]
drivers/platform/Kconfig +2 -0
@@ -22,3 +22,5 @@ source "drivers/platform/arm64/Kconfig" source "drivers/platform/raspberrypi/Kconfig" source "drivers/platform/wmi/Kconfig" + +source "drivers/platform/synology_microp/Kconfig"
drivers/platform/Makefile +1 -0
@@ -15,3 +15,4 @@ obj-$(CONFIG_SURFACE_PLATFORMS) += surface/ obj-$(CONFIG_ARM64_PLATFORM_DEVICES) += arm64/ obj-$(CONFIG_BCM2835_VCHIQ) += raspberrypi/ obj-$(CONFIG_ACPI_WMI) += wmi/ +obj-$(CONFIG_SYNOLOGY_MICROP) += synology_microp/
drivers/platform/synology_microp/Kconfig new file +13 -0
@@ -0,0 +1,13 @@ +# SPDX-License-Identifier: GPL-2.0-only + +config SYNOLOGY_MICROP + tristate "Synology Microp driver" + depends on LEDS_CLASS && LEDS_CLASS_MULTICOLOR + depends on RUST_SERIAL_DEV_BUS_ABSTRACTIONS + help + Enable support for the MCU found in Synology NAS devices. + + This is needed to properly shutdown and reboot the device, as well as + additional functionality like fan and LED control. + + This driver is work in progress and may not be fully functional.
drivers/platform/synology_microp/Makefile new file +3 -0
@@ -0,0 +1,3 @@ +# SPDX-License-Identifier: GPL-2.0 + +obj-y += synology_microp.o
drivers/platform/synology_microp/TODO new file +7 -0
@@ -0,0 +1,7 @@ +TODO: +- add missing components: + - handle on-device buttons (Power, Factory reset, "USB Copy") + - handle fan failure + - beeper + - fan speed control + - correctly perform device power-off and restart on Synology devices
drivers/platform/synology_microp/command.rs new file +55 -0
55 lines not on this page · raw message
drivers/platform/synology_microp/led.rs new file +276 -0
276 lines not on this page · raw message
drivers/platform/synology_microp/model.rs new file +171 -0
171 lines not on this page · raw message
drivers/platform/synology_microp/synology_microp.rs new file +54 -0
54 lines not on this page · raw message
Signature · 1 line
2.52.0
Re: [PATCH v5 4/4] platform: Add initial synology microp driver
Quoted 37 lines · On 29/03/2026 20:02, Markus Probst via B4 Relay wrote:
drivers/platform/synology_microp/model.rs new file +37
-0+ +kernel::of_device_table!( + pub(crate) OF_TABLE, + MODULE_OF_TABLE, + Model, + models![ + apollolake @ [ + ds918p, + ], + evansport @ [ + ds214play, + ], + geminilakenk @ [ + ds225p.led_usb_copy(), + ds425p, + ], + pineview @ [ + ds710p.led_esata(), + ds1010p.led_alert(Color::Orange), + ], + r1000 @ [ + ds923p, + ds723p, + ds1522p, + rs422p.led_power(Color::Green), + ], + r1000nk @ [ + ds725p, + ], + rtd1296 @ [ + ds118, + ], + rtd1619b @ [ + ds124, + ds223.led_usb_copy(), + ds223j, + ],
drivers/platform/synology_microp/model.rs line 168
Quoted 10 lines
drivers/platform/synology_microp/model.rs new file +10
-0+ v1000 @ [ + ds1823xsp, + rs822p.led_power(Color::Green), + rs1221p.led_power(Color::Green), + rs1221rpp.led_power(Color::Green), + ], + v1000nk @ [ + ds925p, + ds1525p, + ds1825p,
I don't see any compatible strings here. Actually, nowhere in the driver. If that's how you write Rust drivers then NAK. Compatibles must be greppable. Not only for humans but also for ABI check.
Best regards,
Krzysztof
Re: [PATCH v5 4/4] platform: Add initial synology microp driver
Quoted 43 lines · Krzysztof Kozlowski
Quoted 42 lines · On 29/03/2026 20:02, Markus Probst via B4 Relay wrote:
drivers/platform/synology_microp/model.rs new file +42
-0+ +kernel::of_device_table!( + pub(crate) OF_TABLE, + MODULE_OF_TABLE, + Model, + models![ + apollolake @ [ + ds918p, + ], + evansport @ [ + ds214play, + ], + geminilakenk @ [ + ds225p.led_usb_copy(), + ds425p, + ], + pineview @ [ + ds710p.led_esata(), + ds1010p.led_alert(Color::Orange), + ], + r1000 @ [ + ds923p, + ds723p, + ds1522p, + rs422p.led_power(Color::Green), + ], + r1000nk @ [ + ds725p, + ], + rtd1296 @ [ + ds118, + ], + rtd1619b @ [ + ds124, + ds223.led_usb_copy(), + ds223j, + ], + v1000 @ [ + ds1823xsp, + rs822p.led_power(Color::Green), + rs1221p.led_power(Color::Green), + rs1221rpp.led_power(Color::Green),
Quoted 8 lines
drivers/platform/synology_microp/model.rs line 168
Quoted 5 lines
drivers/platform/synology_microp/model.rs new file +5
-0+ ], + v1000nk @ [ + ds925p, + ds1525p, + ds1825p,I don't see any compatible strings here. Actually, nowhere in the driver. If that's how you write Rust drivers then NAK. Compatibles must be greppable. Not only for humans but also for ABI check.
The code immediately prior creates a macro, which is called here to produce these. This macro is barely grokkable to begin with IMO, but you can see the DeviceID::new() call down there that creates the compatible using string concatenation.
Definitely on the same page as you about compatibles being greppable. It's not as if it is difficult to create the list using vim or whatever code generator llm you wanna use. Probably making the macro was more effort than writing them out!
+macro_rules! models {
+ [
+ $($arch:ident $(.$arch_func:ident( $($arch_arg:tt)* ))*
+ @ [
+ $($model:ident $(.$func:ident( $($arg:tt)* ))*, )*
+ ],
+ )*
+ ] => {
+ models![
+ $(
+ {
+ Architecture::new()
+ $(
+ .$arch_func($($arch_arg)*)
+ )*
+ } + @ + [
+ $(
+ $model $(.$func($($arg)*))*,
+ )*
+ ],
+ )*
+ ]
+ };
+ [
+ $($arch:block
+ @ [
+ $($model:ident $(.$func:ident( $($arg:tt)* ))*, )*
+ ],
+ )*
+ ] => {
+ [
+ $(
+ $((
+ DeviceId::new(::kernel::c_str!(
+ ::core::concat!(
+ "synology,", + ::core::stringify!($model), + "-microp", + ) + )), + Model::new($arch) + $(
+ .$func($($arg)*)
+ )*
+ ),)*
+ )*
+ ]
+ };
+}