Introduce Synology Microp driver
Subsystems (3)
v2 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 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 (2):
dt-bindings: mfd: Add synology,microp device
mfd: Add initial synology microp driver
.../devicetree/bindings/mfd/synology,microp.yaml | 49 ++++ MAINTAINERS | 6 + drivers/mfd/Kconfig | 2 + drivers/mfd/Makefile | 2 + drivers/mfd/synology_microp/Kconfig | 14 ++ drivers/mfd/synology_microp/Makefile | 2 + drivers/mfd/synology_microp/TODO | 7 + drivers/mfd/synology_microp/command.rs | 50 ++++ drivers/mfd/synology_microp/led.rs | 275 +++++++++++++++++++++ drivers/mfd/synology_microp/synology_microp.rs | 82 ++++++ rust/uapi/uapi_helper.h | 2 + 11 files changed, 491 insertions(+)
---
base-commit: 9fad1d148df6f36105159c2503d0ecb1397bc89a
change-id: 20260306-synology_microp_initial-0f7dac7b7496
prerequisite-change-id: 20251217-rust_serdev-ee5481e9085c:v2
prerequisite-patch-id: 52b17274481cc770c257d8f95335293eca32a2c5
prerequisite-patch-id: 680c0509490833f416b17eb3b918bb829ce7b90f
prerequisite-patch-id: 37016d6c07f0da898be02bf30110e8c0a30025d2
prerequisite-patch-id: 3dfc1f7e5ecd3e0dd65d676aeb16f55260847b25
prerequisite-change-id: 20251114-rust_leds-a959f7c2f7f9:v12
prerequisite-patch-id: 42c445ef6981e3a3740dbaaf307f4b810042e46f
prerequisite-patch-id: 90c7b200cca722a592353885e21af069101c4e09
prerequisite-patch-id: c664a52faa3d47000d252eb7603c9c08382e868a
PATCH v2 1/2 dt-bindings: mfd: Add synology,microp device
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.
--- .../devicetree/bindings/mfd/synology,microp.yaml | 49 ++++++++++++++++++++++ 1 file changed, 49 insertions(+)
Documentation/devicetree/bindings/mfd/synology,microp.yaml new file +49 -0
@@ -0,0 +1,49 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/mfd/synology,microp.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Synology NAS on-board Microcontroller + +maintainers: + - Markus Probst <[email protected]> + +description: + Synology devices contain a microcontroller on their device to control + certain leds, fan speeds, a beeper, to properly handle system shutdown + and reboot, buttons and fan failures. + +properties: + compatible: + const: synology,microp + +patternProperties: + "^(power|status|alert|usb)-led$": + $ref: /schemas/leds/common.yaml + unevaluatedProperties: false + +required: + - compatible + - power-led + - status-led + +additionalProperties: false + +examples: + - | + #include <dt-bindings/leds/common.h> + + mcu { + compatible = "synology,microp"; + + power-led { + color = <LED_COLOR_ID_BLUE>; + function = LED_FUNCTION_POWER; + }; + + status-led { + color = <LED_COLOR_ID_MULTI>; + function = LED_FUNCTION_STATUS; + }; + };
Signature · 1 line
2.52.0
Re: [PATCH v2 1/2] dt-bindings: mfd: Add synology,microp device
Quoted 11 lines · Markus Probst
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.
Signed-off-by Markus Probst <[email protected]>--- .../devicetree/bindings/mfd/synology,microp.yaml | 49 ++++++++++++++++++++++
This is not an "MFD" device.
...
Documentation/devicetree/bindings/mfd/synology,microp.yaml line 37
Quoted 7 lines
Documentation/devicetree/bindings/mfd/synology,microp.yaml new file +7
-0+additionalProperties: false + +examples: + - | + #include <dt-bindings/leds/common.h> + + mcu {
Please read previous comments.
Best regards,
Krzysztof
PATCH v2 2/2 mfd: 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.
--- MAINTAINERS | 6 + drivers/mfd/Kconfig | 2 + drivers/mfd/Makefile | 2 + drivers/mfd/synology_microp/Kconfig | 14 ++ drivers/mfd/synology_microp/Makefile | 2 + drivers/mfd/synology_microp/TODO | 7 + drivers/mfd/synology_microp/command.rs | 50 +++++ drivers/mfd/synology_microp/led.rs | 275 +++++++++++++++++++++++++ drivers/mfd/synology_microp/synology_microp.rs | 82 ++++++++ rust/uapi/uapi_helper.h | 2 + 10 files changed, 442 insertions(+)
MAINTAINERS +6 -0
@@ -25550,6 +25550,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/mfd/synology,microp.yaml +F: drivers/mfd/synology_microp/ + SYNOPSYS ARC ARCHITECTURE M: Vineet Gupta <[email protected]> L: [email protected]
drivers/mfd/Kconfig +2 -0
@@ -2580,5 +2580,7 @@ config MFD_MAX7360 additional drivers must be enabled in order to use the functionality of the device. +source "drivers/mfd/synology_microp/Kconfig" + endmenu endif
drivers/mfd/Makefile +2 -0
@@ -304,3 +304,5 @@ obj-$(CONFIG_MFD_RSMU_SPI) += rsmu_spi.o rsmu_core.o obj-$(CONFIG_MFD_UPBOARD_FPGA) += upboard-fpga.o obj-$(CONFIG_MFD_LOONGSON_SE) += loongson-se.o + +obj-$(CONFIG_MFD_SYNOLOGY_MICROP) += synology_microp/
drivers/mfd/synology_microp/Kconfig new file +14 -0
@@ -0,0 +1,14 @@ + +config MFD_SYNOLOGY_MICROP + tristate "Synology Microp driver" + depends on RUST + depends on SERIAL_DEV_BUS + depends on LEDS_CLASS && LEDS_CLASS_MULTICOLOR + default n + 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/mfd/synology_microp/Makefile new file +2 -0
@@ -0,0 +1,2 @@ + +obj-y += synology_microp.o
drivers/mfd/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/mfd/synology_microp/command.rs new file +50 -0
50 lines not on this page · raw message
drivers/mfd/synology_microp/led.rs new file +275 -0
275 lines not on this page · raw message
drivers/mfd/synology_microp/synology_microp.rs new file +82 -0
82 lines not on this page · raw message
rust/uapi/uapi_helper.h +2 -0
@@ -14,3 +14,5 @@#include <uapi/linux/mdio.h> #include <uapi/linux/mii.h> #include <uapi/linux/ethtool.h> +#include <uapi/linux/serial_reg.h> +
Signature · 1 line
2.52.0
Re: [PATCH v2 2/2] mfd: Add initial synology microp driver
Quoted 6 lines · Markus Probst
Add 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.
Why is this a mfd device? Shouldn't it be an aux device?
But this is just a serial port connection, so why is a kernel driver needed at all?
Quoted 59 lines
Signed-off-by Markus Probst <[email protected]>--- MAINTAINERS | 6 + drivers/mfd/Kconfig | 2 + drivers/mfd/Makefile | 2 + drivers/mfd/synology_microp/Kconfig | 14 ++ drivers/mfd/synology_microp/Makefile | 2 + drivers/mfd/synology_microp/TODO | 7 + drivers/mfd/synology_microp/command.rs | 50 +++++ drivers/mfd/synology_microp/led.rs | 275 +++++++++++++++++++++++++ drivers/mfd/synology_microp/synology_microp.rs | 82 ++++++++ rust/uapi/uapi_helper.h | 2 + 10 files changed, 442 insertions(+)MAINTAINERS +6
-0@@ -25550,6 +25550,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/mfd/synology,microp.yaml +F: drivers/mfd/synology_microp/ + SYNOPSYS ARC ARCHITECTURE M: Vineet Gupta <[email protected]> L: [email protected]drivers/mfd/Kconfig +2
-0@@ -2580,5 +2580,7 @@ config MFD_MAX7360 additional drivers must be enabled in order to use the functionality of the device. +source "drivers/mfd/synology_microp/Kconfig" + endmenu endifdrivers/mfd/Makefile +2
-0@@ -304,3 +304,5 @@ obj-$(CONFIG_MFD_RSMU_SPI) += rsmu_spi.o rsmu_core.o obj-$(CONFIG_MFD_UPBOARD_FPGA) += upboard-fpga.o obj-$(CONFIG_MFD_LOONGSON_SE) += loongson-se.o + +obj-$(CONFIG_MFD_SYNOLOGY_MICROP) += synology_microp/drivers/mfd/synology_microp/Kconfig new file +0
-0
drivers/mfd/synology_microp/Kconfig line 5
Quoted 5 lines
drivers/mfd/synology_microp/Kconfig new file +5
-0@@ -0,0 +1,14 @@ + +config MFD_SYNOLOGY_MICROP + tristate "Synology Microp driver" + depends on RUST + depends on SERIAL_DEV_BUS
We don't have rust serdev bindings yet, but if we do, shouldn't you just depend on them instead of two different things here?
drivers/mfd/synology_microp/Kconfig line 7
Quoted 2 lines
drivers/mfd/synology_microp/Kconfig new file +2
-0+ depends on LEDS_CLASS && LEDS_CLASS_MULTICOLOR + default n
n is always the default, no need to say it again :)
thanks,
greg k-h
Re: [PATCH v2 2/2] mfd: Add initial synology microp driver
Quoted 8 lines · Greg Kroah-Hartman
Quoted 6 lines · Markus Probst
Add 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.
Quoted 4 lines
Why is this a mfd device? Shouldn't it be an aux device?
But this is just a serial port connection, so why is a kernel driver needed at all?
I am not sure what you mean.
It has multiple functions (leds, hwmon, power/reset, input etc.) and does is a multifunction device (mfd).
It does not however use mfd-core or anything from the auxiliary device and instead implements its functionality directly in this driver.
Quoted 60 lines
Quoted 60 lines
Signed-off-by Markus Probst <[email protected]>--- MAINTAINERS | 6 + drivers/mfd/Kconfig | 2 + drivers/mfd/Makefile | 2 + drivers/mfd/synology_microp/Kconfig | 14 ++ drivers/mfd/synology_microp/Makefile | 2 + drivers/mfd/synology_microp/TODO | 7 + drivers/mfd/synology_microp/command.rs | 50 +++++ drivers/mfd/synology_microp/led.rs | 275 +++++++++++++++++++++++++ drivers/mfd/synology_microp/synology_microp.rs | 82 ++++++++ rust/uapi/uapi_helper.h | 2 + 10 files changed, 442 insertions(+)MAINTAINERS +6
-0@@ -25550,6 +25550,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/mfd/synology,microp.yaml +F: drivers/mfd/synology_microp/ + SYNOPSYS ARC ARCHITECTURE M: Vineet Gupta <[email protected]> L: [email protected]drivers/mfd/Kconfig +2
-0@@ -2580,5 +2580,7 @@ config MFD_MAX7360 additional drivers must be enabled in order to use the functionality of the device. +source "drivers/mfd/synology_microp/Kconfig" + endmenu endifdrivers/mfd/Makefile +2
-0@@ -304,3 +304,5 @@ obj-$(CONFIG_MFD_RSMU_SPI) += rsmu_spi.o rsmu_core.o obj-$(CONFIG_MFD_UPBOARD_FPGA) += upboard-fpga.o obj-$(CONFIG_MFD_LOONGSON_SE) += loongson-se.o + +obj-$(CONFIG_MFD_SYNOLOGY_MICROP) += synology_microp/drivers/mfd/synology_microp/Kconfig new file +0
-0@@ -0,0 +1,14 @@
Quoted 8 lines
drivers/mfd/synology_microp/Kconfig line 5
Quoted 5 lines
drivers/mfd/synology_microp/Kconfig new file +5
-0+ +config MFD_SYNOLOGY_MICROP + tristate "Synology Microp driver" + depends on RUST + depends on SERIAL_DEV_BUSWe don't have rust serdev bindings yet, but if we do, shouldn't you just depend on them instead of two different things here?
I will add a RUST_SERDEV_ABSTRACTIONS Kconfig entry in the next serdev rust abstraction patch revision then.
Quoted 6 lines
drivers/mfd/synology_microp/Kconfig line 7
Quoted 4 lines
drivers/mfd/synology_microp/Kconfig new file +2
-0+ depends on LEDS_CLASS && LEDS_CLASS_MULTICOLOR + default nn is always the default, no need to say it again :)
I took some inspiration from the NOVA_CORE Kconfig entry, since that driver is work in progress too.
Quoted 4 lines
thanks,
greg k-h
Thanks
- Markus Probst
Re: [PATCH v2 2/2] mfd: Add initial synology microp driver
Quoted 9 lines · Markus Probst
Quoted 8 lines · Greg Kroah-Hartman
Quoted 6 lines · Markus Probst
Add 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.
Quoted 5 lines
Quoted 4 lines
Why is this a mfd device? Shouldn't it be an aux device?
But this is just a serial port connection, so why is a kernel driver needed at all?
I am not sure what you mean.
Can't this just be controlled from userspace over the tty device to the uart this device uses? Why is a kernel driver needed at all?
Quoted 5 lines
It has multiple functions (leds, hwmon, power/reset, input etc.) and does is a multifunction device (mfd).
It does not however use mfd-core or anything from the auxiliary device and instead implements its functionality directly in this driver.
If it does not use mfd-core, then it should not be in drivers/mfd/ right? Instead, use the aux bus code to split this up into different devices and attach them that way, as that's what the aux bus code was created for.
thanks,
greg k-h
Lee Jones
maintainerRe: [PATCH v2 2/2] mfd: Add initial synology microp driver
Quoted 22 lines · Greg Kroah-Hartman
Quoted 9 lines · Markus Probst
Quoted 8 lines · Greg Kroah-Hartman
Quoted 6 lines · Markus Probst
Add 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.Quoted 5 lines
Quoted 4 lines
Why is this a mfd device? Shouldn't it be an aux device?
But this is just a serial port connection, so why is a kernel driver needed at all?
I am not sure what you mean.
Can't this just be controlled from userspace over the tty device to the uart this device uses? Why is a kernel driver needed at all?
Quoted 3 lines
It has multiple functions (leds, hwmon, power/reset, input etc.) and does is a multifunction device (mfd).
Quoted 7 lines
Quoted 2 lines
It does not however use mfd-core or anything from the auxiliary device and instead implements its functionality directly in this driver.
If it does not use mfd-core, then it should not be in
drivers/mfd/right? Instead, use the aux bus code to split this up into different devices and attach them that way, as that's what the aux bus code was created for.
Correct.
If the MFD APIs are not used, your device is not a Linux MFD.
MFD is not a dumping ground for devices with more than one function.
Please place all of the relevant pieces into their respective subsystems.
Signature · 1 line
Lee Jones [李琼斯]
Re: [PATCH v2 2/2] mfd: Add initial synology microp driver
In reply to Greg Kroah-HartmanQuoted 10 lines · Greg Kroah-Hartman
Quoted 9 lines · Markus Probst
Quoted 8 lines · Greg Kroah-Hartman
Quoted 6 lines · Markus Probst
Add 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.
Quoted 8 lines
Quoted 5 lines
Quoted 4 lines
Why is this a mfd device? Shouldn't it be an aux device?
But this is just a serial port connection, so why is a kernel driver needed at all?
I am not sure what you mean.
Can't this just be controlled from userspace over the tty device to the uart this device uses? Why is a kernel driver needed at all?
Like with any other bus device, it can be controlled by userspace.
But the kernel already provides the necessary userspace interfaces for leds, hwmon, input etc. for any userspace application to access.
Furthermore it is required for proper shutdown and reboot, which is a kernel task.
On arm devices, it completely takes care of the poweroff and reboot. There is already a driver here drivers/power/reset/qnap-poweroff.c, which seems to be primarily developed for QNAP, but works for Synology too.
On x86 devices, is uses ACPI Sleep, but must still announce the poweroff / reboot prior to the firmware call to the device for proper shutdown / reboot. There is no existing driver that takes care of this yet.
Quoted 11 lines
Quoted 6 lines
It has multiple functions (leds, hwmon, power/reset, input etc.) and does is a multifunction device (mfd).
It does not however use mfd-core or anything from the auxiliary device and instead implements its functionality directly in this driver.
If it does not use mfd-core, then it should not be in
drivers/mfd/right? Instead, use the aux bus code to split this up into different devices and attach them that way, as that's what the aux bus code was created for.
Yes. I will split it into multiple drivers using the aux bus in the next revision.
Quoted 4 lines
thanks,
greg k-h
Thanks
- Markus Probst
Re: [PATCH v2 2/2] mfd: Add initial synology microp driver
Quoted 13 lines · Markus Probst
Quoted 12 lines · Greg Kroah-Hartman
Quoted 11 lines · Markus Probst
Quoted 10 lines · Greg Kroah-Hartman
Quoted 6 lines · Markus Probst
Add 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.Why is this a mfd device? Shouldn't it be an aux device?
Quoted 7 lines
Quoted 6 lines
Quoted 3 lines
Quoted 2 lines
But this is just a serial port connection, so why is a kernel driver needed at all?
I am not sure what you mean.
Can't this just be controlled from userspace over the tty device to the uart this device uses? Why is a kernel driver needed at all?
Like with any other bus device, it can be controlled by userspace.
Great, then usually that means it should not be a kernel driver :)
Quoted 2 lines
But the kernel already provides the necessary userspace interfaces for leds, hwmon, input etc. for any userspace application to access.
True, but:
Quoted 2 lines
Furthermore it is required for proper shutdown and reboot, which is a kernel task.
What do you mean by this? What does it do for shutdown and reboot?
Is there an out-of-tree C kernel driver for this somewhere? Or does it all just work through userspace today on these devices?
Quoted 4 lines
On arm devices, it completely takes care of the poweroff and reboot. There is already a driver here
drivers/power/reset/qnap-poweroff.c, which seems to be primarily developed for QNAP, but works for Synology too.
But that's not this device, that's a different device and driver.
Quoted 4 lines
On x86 devices, is uses ACPI Sleep, but must still announce the poweroff / reboot prior to the firmware call to the device for proper shutdown / reboot. There is no existing driver that takes care of this yet.
Then that should be a kernel driver, no need for the led blinks to be a kernel driver if they don't have to, right? We try to only put stuff in the kernel that _has_ to be in the kernel, within reason.
thanks,
greg k-h
Re: [PATCH v2 2/2] mfd: Add initial synology microp driver
Quoted 16 lines · Greg Kroah-Hartman
Quoted 15 lines · Markus Probst
Quoted 14 lines · Greg Kroah-Hartman
Quoted 13 lines · Markus Probst
Quoted 12 lines · Greg Kroah-Hartman
Quoted 6 lines · Markus Probst
Add 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.Why is this a mfd device? Shouldn't it be an aux device?
But this is just a serial port connection, so why is a kernel driver needed at all?
Quoted 7 lines
Quoted 5 lines
Quoted 4 lines
Quoted 1 line
I am not sure what you mean.
Can't this just be controlled from userspace over the tty device to the uart this device uses? Why is a kernel driver needed at all?
Like with any other bus device, it can be controlled by userspace.
Great, then usually that means it should not be a kernel driver :)
Not sure if this is an argument. The same would apply to the majority of kernel drivers.
Quoted 6 lines
Quoted 3 lines
But the kernel already provides the necessary userspace interfaces for leds, hwmon, input etc. for any userspace application to access.
True, but:
Quoted 7 lines
Quoted 2 lines
Furthermore it is required for proper shutdown and reboot, which is a kernel task.
What do you mean by this? What does it do for shutdown and reboot?
Is there an out-of-tree C kernel driver for this somewhere? Or does it all just work through userspace today on these devices?
On the proprietary os of those devices,
the shutdown and reboot part is done in their modified version of the 4.4.x linux kernel.
Most of the interactions with this device however is in a proprietary kernel module called "synobios" (source code not available), which exposes this via their own proprietary ioctls.
Quoted 7 lines
Quoted 5 lines
On arm devices, it completely takes care of the poweroff and reboot. There is already a driver here
drivers/power/reset/qnap-poweroff.c, which seems to be primarily developed for QNAP, but works for Synology too.But that's not this device, that's a different device and driver.
Different driver, but supports the same device. See the "Can also be used on Synology devices." comment on top and the "synology,power-off" entry in the of_match_table.
Quoted 9 lines
Quoted 5 lines
On x86 devices, is uses ACPI Sleep, but must still announce the poweroff / reboot prior to the firmware call to the device for proper shutdown / reboot. There is no existing driver that takes care of this yet.
Then that should be a kernel driver, no need for the led blinks to be a kernel driver if they don't have to, right? We try to only put stuff in the kernel that _has_ to be in the kernel, within reason.
Are you trying to refer to the led part of this driver, or to a prior patch series by me regarding a more feature-rich disk trigger for led blinking ("leds: extend disk trigger") ?
In case of the later, I have started working on a non-device-specific userspace daemon as replacement.
Quoted 4 lines
thanks,
greg k-h
Thanks
- Markus Probst
Danilo Krummrich
reviewerRe: [PATCH v2 2/2] mfd: Add initial synology microp driver
In reply to Markus ProbstQuoted 2 lines · Markus Probst
Yes. I will split it into multiple drivers using the aux bus in the next revision.
Independent of the other discussion whether this belongs into the kernel in the first place, reading over the cover letter and commit message I understood the following.
"Synology uses a microcontroller in their NAS devices connected to a serial port [...]" controlling LEDs, fan speeds, a beeper, etc.
I.e. it muliplexes several physical functions that belong to different subsystems, such as hwmon, input, etc. over a single serial port.
This sounds like a textbook candidate for MFD to me.
I.e. there is a very loose coupling of the different functions that make up for entirely independent drivers, except that they share the same serial port connection.
Whereas the auxiliary bus is more for very complicated devices to be broken down into more managable (sometimes optional) sub-domains, where the corresponding drivers usually have driver specific APIs to interact with each other.
- Danilo
Re: [PATCH v2 2/2] mfd: Add initial synology microp driver
Quoted 20 lines · Danilo Krummrich
Quoted 2 lines · Markus Probst
Yes. I will split it into multiple drivers using the aux bus in the next revision.
Independent of the other discussion whether this belongs into the kernel in the first place, reading over the cover letter and commit message I understood the following.
"Synology uses a microcontroller in their NAS devices connected to a serial port [...]" controlling LEDs, fan speeds, a beeper, etc.
I.e. it muliplexes several physical functions that belong to different subsystems, such as hwmon, input, etc. over a single serial port.
This sounds like a textbook candidate for MFD to me.
I.e. there is a very loose coupling of the different functions that make up for entirely independent drivers, except that they share the same serial port connection.
Quoted 5 lines
Whereas the auxiliary bus is more for very complicated devices to be broken down into more managable (sometimes optional) sub-domains, where the corresponding drivers usually have driver specific APIs to interact with each other.
- Danilo
QNAP and Synology do things very similarly.
There is already a driver for QNAP devices:
drivers/mfd/qnap-mcu.cdrivers/leds/leds-qnap-mcu.cdrivers/input/misc/qnap-mcu-input.cdrivers/hwmon/qnap-mcu-hwmon.cdrivers/nvmem/qnap-mcu-eeprom.c
drivers/power/reset/qnap-poweroff.c (this one is not part of the mfd)
and I try to implement the equivalent for Synology devices. Given its a MFD I would assume the same applies to this driver?
Thanks
- Markus Probst
Lee Jones
maintainerRe: [PATCH v2 2/2] mfd: Add initial synology microp driver
Quoted 9 lines · Markus Probst
Quoted 8 lines · Danilo Krummrich
Quoted 2 lines · Markus Probst
Yes. I will split it into multiple drivers using the aux bus in the next revision.
Independent of the other discussion whether this belongs into the kernel in the first place, reading over the cover letter and commit message I understood the following.
Quoted 7 lines
Quoted 7 lines
"Synology uses a microcontroller in their NAS devices connected to a serial port [...]" controlling LEDs, fan speeds, a beeper, etc.
I.e. it muliplexes several physical functions that belong to different subsystems, such as hwmon, input, etc. over a single serial port.
This sounds like a textbook candidate for MFD to me.
Then you do not know what a textbook candidate for MFD is. :)
What part of the MFD API does this device utilise?
Quoted 19 lines
Quoted 9 lines
I.e. there is a very loose coupling of the different functions that make up for entirely independent drivers, except that they share the same serial port connection.
Whereas the auxiliary bus is more for very complicated devices to be broken down into more managable (sometimes optional) sub-domains, where the corresponding drivers usually have driver specific APIs to interact with each other.
- Danilo
QNAP and Synology do things very similarly.
There is already a driver for QNAP devices:
drivers/mfd/qnap-mcu.cdrivers/leds/leds-qnap-mcu.cdrivers/input/misc/qnap-mcu-input.cdrivers/hwmon/qnap-mcu-hwmon.cdrivers/nvmem/qnap-mcu-eeprom.c
Quoted 4 lines
drivers/power/reset/qnap-poweroff.c(this one is not part of the mfd)and I try to implement the equivalent for Synology devices. Given its a MFD I would assume the same applies to this driver?
Of course not.
The QNAP driver above calls devm_mfd_add_devices().
This one uses none of the MFD functionality provided.
Linux supports 10's if not 100's of devices which do more than one thing. Only a fraction of them are Linux MFDs. MFD in Linux is an API, not a type of device.
Don't get me wrong, you could probably code up this device as a Linux MFD, but you have chosen not to, so therefore it cannot reside here.
Signature · 1 line
Lee Jones [李琼斯]
Re: [PATCH v2 2/2] mfd: Add initial synology microp driver
Quoted 51 lines · Lee Jones
Quoted 9 lines · Markus Probst
Quoted 8 lines · Danilo Krummrich
Quoted 2 lines · Markus Probst
Yes. I will split it into multiple drivers using the aux bus in the next revision.
Independent of the other discussion whether this belongs into the kernel in the first place, reading over the cover letter and commit message I understood the following.
Quoted 7 lines
Quoted 7 lines
"Synology uses a microcontroller in their NAS devices connected to a serial port [...]" controlling LEDs, fan speeds, a beeper, etc.
I.e. it muliplexes several physical functions that belong to different subsystems, such as hwmon, input, etc. over a single serial port.
This sounds like a textbook candidate for MFD to me.
Then you do not know what a textbook candidate for MFD is. :)
What part of the MFD API does this device utilise?
Quoted 19 lines
Quoted 9 lines
I.e. there is a very loose coupling of the different functions that make up for entirely independent drivers, except that they share the same serial port connection.
Whereas the auxiliary bus is more for very complicated devices to be broken down into more managable (sometimes optional) sub-domains, where the corresponding drivers usually have driver specific APIs to interact with each other.
- Danilo
QNAP and Synology do things very similarly.
There is already a driver for QNAP devices:
drivers/mfd/qnap-mcu.cdrivers/leds/leds-qnap-mcu.cdrivers/input/misc/qnap-mcu-input.cdrivers/hwmon/qnap-mcu-hwmon.cdrivers/nvmem/qnap-mcu-eeprom.cQuoted 4 lines
drivers/power/reset/qnap-poweroff.c(this one is not part of the mfd)and I try to implement the equivalent for Synology devices. Given its a MFD I would assume the same applies to this driver?
Of course not.
The QNAP driver above calls
devm_mfd_add_devices().
Quoted 8 lines
This one uses none of the MFD functionality provided.
Linux supports 10's if not 100's of devices which do more than one thing. Only a fraction of them are Linux MFDs. MFD in Linux is an API, not a type of device.
Don't get me wrong, you could probably code up this device as a Linux MFD, but you have chosen not to, so therefore it cannot reside here.
From what I have read so far, the way its written it probably can't live anywhere inside the kernel right now. So it will be restructured to either use mfd or auxiliary, which both involve splitting the driver up into multiple pieces. From what Danilo is writing, it will likely be mfd.
Thanks
- Markus Probst
Lee Jones
maintainerRe: [PATCH v2 2/2] mfd: Add initial synology microp driver
Quoted 54 lines · Markus Probst
Quoted 53 lines · Lee Jones
Quoted 9 lines · Markus Probst
Quoted 8 lines · Danilo Krummrich
Quoted 2 lines · Markus Probst
Yes. I will split it into multiple drivers using the aux bus in the next revision.
Independent of the other discussion whether this belongs into the kernel in the first place, reading over the cover letter and commit message I understood the following.
Quoted 7 lines
Quoted 7 lines
"Synology uses a microcontroller in their NAS devices connected to a serial port [...]" controlling LEDs, fan speeds, a beeper, etc.
I.e. it muliplexes several physical functions that belong to different subsystems, such as hwmon, input, etc. over a single serial port.
This sounds like a textbook candidate for MFD to me.
Then you do not know what a textbook candidate for MFD is. :)
What part of the MFD API does this device utilise?
Quoted 19 lines
Quoted 9 lines
I.e. there is a very loose coupling of the different functions that make up for entirely independent drivers, except that they share the same serial port connection.
Whereas the auxiliary bus is more for very complicated devices to be broken down into more managable (sometimes optional) sub-domains, where the corresponding drivers usually have driver specific APIs to interact with each other.
- Danilo
QNAP and Synology do things very similarly.
There is already a driver for QNAP devices:
drivers/mfd/qnap-mcu.cdrivers/leds/leds-qnap-mcu.cdrivers/input/misc/qnap-mcu-input.cdrivers/hwmon/qnap-mcu-hwmon.cdrivers/nvmem/qnap-mcu-eeprom.cQuoted 4 lines
drivers/power/reset/qnap-poweroff.c(this one is not part of the mfd)and I try to implement the equivalent for Synology devices. Given its a MFD I would assume the same applies to this driver?
Of course not.
The QNAP driver above calls
devm_mfd_add_devices().This one uses none of the MFD functionality provided.
Quoted 8 lines
Quoted 6 lines
Linux supports 10's if not 100's of devices which do more than one thing. Only a fraction of them are Linux MFDs. MFD in Linux is an API, not a type of device.
Don't get me wrong, you could probably code up this device as a Linux MFD, but you have chosen not to, so therefore it cannot reside here.
From what I have read so far, the way its written it probably can't live anywhere inside the kernel right now.
There is a place for everything in the kernel.
Quoted 3 lines
So it will be restructured
to either use mfd or auxiliary, which both involve splitting the driver up into multiple pieces.
The driver should absolutely be split up into multiple pieces with each part being redistributed into its associated subsystem.
Quoted 2 lines
From what Danilo is writing, it will likely be
mfd.
If you use the MFD API, then it can live in drivers/mfd. If you go with the Auxiliary route, then you'll have to find somewhere else to put it.
Signature · 1 line
Lee Jones [李琼斯]
Danilo Krummrich
reviewerRe: [PATCH v2 2/2] mfd: Add initial synology microp driver
In reply to Lee JonesQuoted 14 lines · Lee Jones
Quoted 12 lines · Markus Probst
Quoted 11 lines · Danilo Krummrich
Quoted 2 lines · Markus Probst
Yes. I will split it into multiple drivers using the aux bus in the next revision.
Independent of the other discussion whether this belongs into the kernel in the first place, reading over the cover letter and commit message I understood the following.
"Synology uses a microcontroller in their NAS devices connected to a serial port [...]" controlling LEDs, fan speeds, a beeper, etc.
Quoted 8 lines
Quoted 4 lines
Quoted 4 lines
I.e. it muliplexes several physical functions that belong to different subsystems, such as hwmon, input, etc. over a single serial port.
This sounds like a textbook candidate for MFD to me.
Then you do not know what a textbook candidate for MFD is. :)
What part of the MFD API does this device utilise?
I did *not* say this driver - as in the code that was posted - is a textbook example for MFD.
I said that the hardware that is supposed to be fully supported eventually is a textbook candidate for an MFD driver, i.e. it should use things like devm_mfd_add_devices().
I think this was obvious from what I wrote above.
Lee Jones
maintainerRe: [PATCH v2 2/2] mfd: Add initial synology microp driver
Quoted 24 lines · Danilo Krummrich
Quoted 14 lines · Lee Jones
Quoted 12 lines · Markus Probst
Quoted 11 lines · Danilo Krummrich
Quoted 2 lines · Markus Probst
Yes. I will split it into multiple drivers using the aux bus in the next revision.
Independent of the other discussion whether this belongs into the kernel in the first place, reading over the cover letter and commit message I understood the following.
"Synology uses a microcontroller in their NAS devices connected to a serial port [...]" controlling LEDs, fan speeds, a beeper, etc.
Quoted 8 lines
Quoted 4 lines
Quoted 4 lines
I.e. it muliplexes several physical functions that belong to different subsystems, such as hwmon, input, etc. over a single serial port.
This sounds like a textbook candidate for MFD to me.
Then you do not know what a textbook candidate for MFD is. :)
What part of the MFD API does this device utilise?
Quoted 8 lines
I did *not* say this driver - as in the code that was posted - is a textbook example for MFD.
I said that the hardware that is supposed to be fully supported eventually is a textbook candidate for an MFD driver, i.e. it should use things like
devm_mfd_add_devices().I think this was obvious from what I wrote above.
No, not at all. Or there would be no confusion. :)
But yes, I agree, if re-authored this could fit into MFD.
Signature · 1 line
Lee Jones [李琼斯]
Re: [PATCH v2 2/2] mfd: Add initial synology microp driver
In reply to Markus Probstdrivers/mfd/synology_microp/synology_microp.rs line 35
Quoted 12 lines · Markus Probst
drivers/mfd/synology_microp/synology_microp.rs new file +12
-0+kernel::module_serdev_device_driver! { +type :SynologyMicropDriver , + name:"synology_microp" , + authors: ["Markus Probst <[email protected]>" ], + description:"Synology Microp driver" , + license:"GPL v2" , +params : { + check_fan:i32 { +default :1 , + description:"Check for cpu fan failures" , + }, + },
This is not the 1990's, please do not add new module parameters for no good reason. This should be dynamic (why would you NOT want to check for cpu fan failures?) and per-device, not per-module.
thanks,
greg k-h
Re: [PATCH v2 2/2] mfd: Add initial synology microp driver
Quoted 14 lines · Greg Kroah-Hartman
drivers/mfd/synology_microp/synology_microp.rs line 35
Quoted 12 lines · Markus Probst
drivers/mfd/synology_microp/synology_microp.rs new file +12
-0+kernel::module_serdev_device_driver! { +type :SynologyMicropDriver , + name:"synology_microp" , + authors: ["Markus Probst <[email protected]>" ], + description:"Synology Microp driver" , + license:"GPL v2" , +params : { + check_fan:i32 { +default :1 , + description:"Check for cpu fan failures" , + }, + },
Quoted 2 lines
This is not the 1990's, please do not add new module parameters for no good reason. This should be dynamic and per-device, not per-module.
agreed.
Quoted 1 line
why would you NOT want to check for cpu fan failures?
Because it is also triggered at low fan speeds, even if they are intentionally set by the driver. While the parameter is 1, the driver would enable those checks for fan failures and would prevent low fan speeds. The parameter would allow it to disable this check and allow for low fan speeds.
Quoted 4 lines
thanks,
greg k-h
Thanks
- Markus Probst
Re: [PATCH v2 2/2] mfd: Add initial synology microp driver
Quoted 19 lines · Markus Probst
Quoted 14 lines · Greg Kroah-Hartman
drivers/mfd/synology_microp/synology_microp.rs line 35
Quoted 12 lines · Markus Probst
drivers/mfd/synology_microp/synology_microp.rs new file +12
-0+kernel::module_serdev_device_driver! { +type :SynologyMicropDriver , + name:"synology_microp" , + authors: ["Markus Probst <[email protected]>" ], + description:"Synology Microp driver" , + license:"GPL v2" , +params : { + check_fan:i32 { +default :1 , + description:"Check for cpu fan failures" , + }, + },Quoted 2 lines
This is not the 1990's, please do not add new module parameters for no good reason. This should be dynamic and per-device, not per-module.
agreed.
Quoted 7 lines
Quoted 1 line
why would you NOT want to check for cpu fan failures?
Because it is also triggered at low fan speeds, even if they are intentionally set by the driver. While the parameter is 1, the driver would enable those checks for fan failures and would prevent low fan speeds. The parameter would allow it to disable this check and allow for low fan speeds.
That sounds like something that the driver itself can do on its own, don't force a user to make a choice that they really shouldn't be making.
thanks,
greg k-h