Introduce Synology Microp driver
Subsystems (4)
v19 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]. The latter already being in driver-core.
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 (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 v19:
- rebase onto v7.4-rc5
- adapt to rust_leds v29
- Link to v18: https://patch.msgid.link/[email protected]
Changes in v18:
- fix issues reported by Sashiko:
- fix hardware blink delays not reported if every subled has
intensity = 0
- fix blink aborting if every subled has intensity = 0
- Link to v17: https://patch.msgid.link/[email protected]
Changes in v17:
- adapted to rust serdev abstraction v16
- Link to v16: https://patch.msgid.link/[email protected]
Changes in v16:
- fix issues reported by Sashiko:
- fix typo in dt compatible
- fix not compilable as loadable module
- Link to v15: https://patch.msgid.link/[email protected]
Changes in v15:
- adapted to rust led abstractiopn v21
- Link to v14: https://patch.msgid.link/[email protected]
Changes in v14:
- adapt to led abstraction v18 and serdev abstraction v11
- Link to v13: https://patch.msgid.link/[email protected]
Changes in v13:
- adapted to driver-lifetime v5 patch series.
- set blink = false as initial power led state, as set_blink hasn't been
called yet (even though the led is blinking at startup)
- Link to v12: https://patch.msgid.link/[email protected]
Changes in v12:
- adapted to driver-lifetime patch series. The driver can't take
advantage of it, until class devices like led also make use of it.
- Link to v11: https://patch.msgid.link/[email protected]
Changes in v11:
- rebased on top of 7.1-rc1
- add "synology" as devicename to led, like it is done in existing dts
files in the kernel
- fix color for led being orange instead of amber. I personally can't
clearly tell them apart, but apparently its amber.
- replaced MCU with EC in Kconfig help
- Link to v10: https://patch.msgid.link/[email protected]
Changes in v10:
- resolved issues reported by Sashiko Bot:
- removed unneeded include from device tree
- fix typo in of device table
- fix blink not set to false, if delay_off or delay_on is 0
- Link to v9: https://patch.msgid.link/[email protected]
Changes in v9:
- separate fallback and front compatibles in dt schema
- remove front compatibles from of id table, if all functionality is
by covered by the fallback
- remove TODO file
- add [email protected] to Maintainers file entry
- use Delta type in BLINK_DELAY const
- Link to v8: https://patch.msgid.link/[email protected]
Changes in v8:
- removed unnecessary Copy and Clone derive
- added BLINK_DELAY constant
- added compatible id fallbacks
- moved dt schema patch before the driver
- added ds411p
- Link to v7: https://lore.kernel.org/r/[email protected]
Changes in v7:
- remove list of compatible ids from commit msg
- explain what makes the different models not compatible in the commit msg
- remove unnecessary examples
- Link to v6: https://lore.kernel.org/r/[email protected]
Changes in v6:
- moved devicetree bindings patch at the end of the set
- remove several patches
- move of id table from model.rs to synology_microp.rs
- remove the model! macro
- use if blocks in devicetree schema to narrow down the
fan-failure-gpios property
- add multiple devicetree examples to test if blocks
- Link to v5: https://lore.kernel.org/r/[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 (2):
dt-bindings: embedded-controller: Add synology microp devices
platform: Add initial synology microp driver
.../synology,ds918p-microp.yaml | 100 +++++++ MAINTAINERS | 7 + drivers/platform/Kconfig | 2 + drivers/platform/Makefile | 1 + drivers/platform/synology_microp/Kconfig | 13 + drivers/platform/synology_microp/Makefile | 5 + drivers/platform/synology_microp/command.rs | 54 ++++ drivers/platform/synology_microp/led.rs | 300 +++++++++++++++++++++ drivers/platform/synology_microp/model.rs | 49 ++++ .../platform/synology_microp/synology_microp.rs | 90 +++++++ 10 files changed, 621 insertions(+)
---
base-commit: c8cbaa094f4f7cc4e4d5a1e3ea7be5dfb362dcbb
change-id: 20260306-synology_microp_initial-0f7dac7b7496
prerequisite-change-id: 20251114-rust_leds-a959f7c2f7f9:v29
prerequisite-patch-id: 89aa72aea271e8b3d6dbaffe46d93c1bff4014a9
prerequisite-patch-id: 9d6a38e90660f59652540ad258808c8bfa6c0d8c
prerequisite-patch-id: 8c8dcfb3cca3fd63b704edc30737268d525d0b54
prerequisite-patch-id: 9976190872fe26c2a980c66a4ebc050fd2bcaf71
PATCH v19 1/2 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.
The device has a different feature set depending on the Synology NAS model, like having different number of fans, buttons and leds. Depending on the architecture of the model, they also need a different system shutdown behaviour.
--- .../synology,ds918p-microp.yaml | 100 +++++++++++++++++++++ 1 file changed, 100 insertions(+)
Documentation/devicetree/bindings/embedded-controller/synology,ds918p-microp.yaml new file +100 -0
@@ -0,0 +1,100 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/embedded-controller/synology,ds918p-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: + oneOf: + - items: + - enum: + - synology,rs1221rpp-microp + - synology,rs822p-microp + - synology,rs422p-microp + - const: synology,rs1221p-microp + + - items: + - const: synology,ds1825p-microp + - const: synology,ds1823xsp-microp + + - items: + - enum: + - synology,ds725p-microp + - synology,ds225p-microp + - synology,ds723p-microp + - synology,ds710p-microp + - const: synology,ds214play-microp + + - items: + - enum: + - synology,ds425p-microp + - synology,ds1525p-microp + - synology,ds925p-microp + - synology,ds923p-microp + - synology,ds1522p-microp + - synology,ds1010p-microp + - synology,ds411p-microp + - const: synology,ds918p-microp + + - items: + - enum: + - synology,ds124-microp + - synology,ds223j-microp + - synology,ds223-microp + - const: synology,ds118-microp + + - enum: + - synology,ds118-microp + - synology,ds1823xsp-microp + - synology,rs1221p-microp + - synology,ds918p-microp + - synology,ds214play-microp + + fan-failure-gpios: + description: GPIOs needed to determine which fans stopped working on a fan failure event. + minItems: 2 + maxItems: 3 + +required: + - compatible + +allOf: + - if: + properties: + compatible: + contains: + enum: + - synology,ds918p-microp + - synology,rs422p-microp + then: + required: + - fan-failure-gpios + else: + properties: + fan-failure-gpios: false + +additionalProperties: false + +examples: + - | + #include <dt-bindings/gpio/gpio.h> + + embedded-controller { + compatible = "synology,ds923p-microp", "synology,ds918p-microp"; + + fan-failure-gpios = <&gpio 68 GPIO_ACTIVE_HIGH>, <&gpio 69 GPIO_ACTIVE_HIGH>; + };
Signature · 1 line
2.56.1
[email protected]
AI reviewRe: [PATCH v19 1/2] dt-bindings: embedded-controller: Add synology microp devices
Thank you for your contribution! Sashiko AI review found 2 potential issues to consider: - [Low] dt-bindings: embedded-controller: missing parent serial node in example - [Low] dt-bindings…
Thank you for your contribution! Sashiko AI review found 2 potential issues to consider:
- [Low] dt-bindings: embedded-controller: missing parent serial node in example
- [Low] dt-bindings: embedded-controller: 2-space indent in DTS example --
commit 8fe6bccc5e36d162abef34bba8a8edb8b0eef808
Author: Markus Probst <[email protected]>
dt-bindings: embedded-controller: Add synology microp devices
This commit adds the devicetree binding schema for Synology Microp serial-attached embedded controllers found on Synology NAS devices.
Quoted 6 lines
Documentation/devicetree/bindings/embedded-controller/synology,ds918p-microp.yaml new file +0
-0@@ -0,0 +1,100 @@
[ ... ]
Documentation/devicetree/bindings/embedded-controller/synology,ds918p-microp.yaml line 96
Quoted 5 lines
Documentation/devicetree/bindings/embedded-controller/synology,ds918p-microp.yaml new file +5
-0+examples: + - | + #include <dt-bindings/gpio/gpio.h> + + embedded-controller {
[Severity: Low]
Should this embedded-controller node be nested inside a parent serial { } node?
Documentation/devicetree/bindings/serial/serial.yaml requires serial-attached embedded-controller nodes to be children of the host UART node. A top-level node will not probe via serdev and bypasses serial child-node validation in dt_binding_check.
Documentation/devicetree/bindings/embedded-controller/synology,ds918p-microp.yaml line 100
Quoted 4 lines
Documentation/devicetree/bindings/embedded-controller/synology,ds918p-microp.yaml new file +4
-0+ compatible = "synology,ds923p-microp", "synology,ds918p-microp"; + + fan-failure-gpios = <&gpio 68 GPIO_ACTIVE_HIGH>, <&gpio 69 GPIO_ACTIVE_HIGH>; + };
[Severity: Low]
Does this DTS example need 4-space indentation instead of 2 spaces? scripts/dtc/dt-check-style in strict mode rejects 2-space indentation in YAML examples. Once re-indented (or nested under a serial node), fan-failure-gpios will also exceed 80 columns and need wrapping.
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
PATCH v19 2/2 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 | 7 + drivers/platform/Kconfig | 2 + drivers/platform/Makefile | 1 + drivers/platform/synology_microp/Kconfig | 13 + drivers/platform/synology_microp/Makefile | 5 + drivers/platform/synology_microp/command.rs | 54 ++++ drivers/platform/synology_microp/led.rs | 300 +++++++++++++++++++++ drivers/platform/synology_microp/model.rs | 49 ++++ .../platform/synology_microp/synology_microp.rs | 90 +++++++ 9 files changed, 521 insertions(+)
MAINTAINERS +7 -0
@@ -27144,6 +27144,13 @@ 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]> +L: [email protected] +S: Maintained +F: Documentation/devicetree/bindings/embedded-controller/synology,ds918p-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 + +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 EC 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 +5 -0
@@ -0,0 +1,5 @@ +# SPDX-License-Identifier: GPL-2.0 + +obj-$(CONFIG_SYNOLOGY_MICROP) += synology-microp.o +synology-microp-y += synology_microp.o +
drivers/platform/synology_microp/command.rs new file +54 -0
54 lines not on this page · raw message
drivers/platform/synology_microp/led.rs new file +300 -0
300 lines not on this page · raw message
drivers/platform/synology_microp/model.rs new file +49 -0
49 lines not on this page · raw message
drivers/platform/synology_microp/synology_microp.rs new file +90 -0
90 lines not on this page · raw message
Signature · 1 line
2.56.1
[email protected]
AI reviewRe: [PATCH v19 2/2] platform: Add initial synology microp driver
Thank you for your contribution! Sashiko AI review found 8 potential issues to consider: - [High] platform: synology_microp: unbounded serdev wait in Command::write() - [Medium]…
Thank you for your contribution! Sashiko AI review found 8 potential issues to consider:
- [High] platform: synology_microp: unbounded serdev wait in Command::write()
- [Medium] platform/synology_microp: Kconfig allows modular LEDS_CLASS breaking Rust build
- [Medium] platform/synology_microp: Command::write() ignores short writes from write_all()
- [Medium] platform/synology_microp: blink state and delays mutated before write succeeds
- [Medium] platform/synology_microp: multi_intensity turns off blinking status LED
- [Medium] rust: led: aliasing &mut usize in blink_set_callback() from ledtrig-timer
- [Low] platform/synology_microp: deprecated vendor prefix and non-standard LED name
- [Low] platform/synology_microp: commit message omits supported eSATA LED
--
commit 5e1e8cacbaf185da4acf3731fa20dd161b67fc7a
Author: Markus Probst <[email protected]>
platform: Add initial synology microp driver
This commit adds an initial Rust serdev driver for the Synology NAS microcontroller, exposing its power, status, alert, USB, and eSATA LEDs through the kernel LED class abstractions.
Quoted 2 lines
It currently only supports controlling of the power led, status led, alert led and usb led.
[Severity: Low]
This isn't a bug, but the commit message omits the eSATA LED, which this patch also implements for synology,ds710p-microp.
[ ... ]
drivers/platform/synology_microp/Kconfig line 5
Quoted 11 lines
drivers/platform/synology_microp/Kconfig new file +5
-0@@ -0,0 +1,13 @@ +# SPDX-License-Identifier: GPL-2.0 + +config SYNOLOGY_MICROP + tristate "Synology Microp driver" + depends on LEDS_CLASS && LEDS_CLASS_MULTICOLOR
[Severity: Medium]
Can this break the build when CONFIG_LEDS_CLASS=m or CONFIG_LEDS_CLASS_MULTICOLOR=m with CONFIG_SYNOLOGY_MICROP=m?
Both LEDS_CLASS and LEDS_CLASS_MULTICOLOR are tristate, but rust/kernel/lib.rs gates pub mod led on CONFIG_LEDS_CLASS="y" and rust/kernel/led.rs gates mod multicolor on CONFIG_LEDS_CLASS_MULTICOLOR="y". In modular configs such as allmodconfig, the driver fails to compile with unresolved kernel::led imports.
Changing the dependency to LEDS_CLASS=y && LEDS_CLASS_MULTICOLOR=y prevents the broken configuration.
[ ... ]
Quoted 6 lines
drivers/platform/synology_microp/command.rs new file +0
-0@@ -0,0 +1,54 @@
[ ... ]
Quoted 4 lines
drivers/platform/synology_microp/command.rs new file +4
-0+impl Command { +pub (crate )fn write (self, dev: &serdev::Device <Bound >) ->Result { + dev.write_all( + match self {
[ ... ]
Quoted 4 lines
drivers/platform/synology_microp/command.rs new file +4
-0+ Self::AlertLed(led::State::On) => &[0x4C, 0x41, 0x31], + Self::AlertLed(led::State::Blink) => &[0x4C, 0x41, 0x32], + Self::AlertLed(led::State::Off) => &[0x4C, 0x41, 0x33], +
drivers/platform/synology_microp/command.rs line 50
Quoted 10 lines
drivers/platform/synology_microp/command.rs new file +10
-0+ Self::UsbLed(led::State::On) => &[0x40], + Self::UsbLed(led::State::Blink) => &[0x41], + Self::UsbLed(led::State::Off) => &[0x42], + + Self::EsataLed(led::State::On) => &[0x4C, 0x45, 0x31], + Self::EsataLed(led::State::Blink) => &[0x4C, 0x45, 0x32], + Self::EsataLed(led::State::Off) => &[0x4C, 0x45, 0x33], + }, + 0, + )?;
[Severity: Medium]
Can Command::write() silently treat a short write of a 3-byte AlertLed or EsataLed command as success?
serdev::Device::write_all() wraps serdev_device_write(), which returns the positive partial byte count as Ok(written) if a signal interrupts the wait after at least one byte is accepted. Discarding that count leaves a truncated prefix on the serial line and releases serdev->write_lock, allowing subsequent LED commands to interleave and desynchronize the microcontroller parser.
Checking that the returned count equals the slice length (and retrying or returning an error otherwise) avoids silent truncation.
Quoted 1 line
+
dev.wait_until_sent(0);
[Severity: High]
Can passing timeout 0 to dev.write_all() and dev.wait_until_sent() deadlock the global leds_wq workqueue when the parent UART is unbound or removed?
Timeout 0 is translated to MAX_SCHEDULE_TIMEOUT in both serdev_device_write() and tty_wait_until_sent(). During UART removal, serial_core_unregister_port() marks the port UPF_DEAD before unregistering the serdev child, and PrivateData::drop() drops SynologyMicropDriver before calling serdev_device_close():
UART removal thread leds_wq kworker
------------------- ---------------serial_core_unregister_port()
port->flags |= UPF_DEAD
serial_core_remove_one_port()
... -> led_classdev_unregister()
led_set_brightness(LED_OFF)
flush_work(set_brightness_work)
set_brightness_delayed()
Command::write()
uart_write() -> kfifo_in()
__uart_start() (skips, UPF_DEAD)
tty_wait_until_sent(tty, 0)
<-- sleeps foreverBecause __uart_start() returns early on UPF_DEAD, the queued byte never drains and tty_wait_until_sent() sleeps indefinitely while the removal thread waits in flush_work(), wedging leds_wq and holding serial_core's port_mutex. The same unbounded wait applies to dev.write_all(..., 0) if the FIFO fills, or if an LED trigger fires while the parent UART is suspended.
Passing finite timeouts to both dev.write_all() and dev.wait_until_sent() prevents the permanent hang.
Quoted 6 lines
drivers/platform/synology_microp/led.rs new file +0
-0@@ -0,0 +1,300 @@
[ ... ]
Quoted 3 lines
drivers/platform/synology_microp/led.rs new file +3
-0+ status <- led::DeviceBuilder ::new () + .color (led::Color ::Multi ) + .name (c"synology:multicolor:status" )
[ ... ]
Quoted 1 line
+ .name(c"synology:green:esata")
[Severity: Low]
Should these LED names drop the synology: vendor prefix and use a standard LED_FUNCTION_* name instead of esata?
Documentation/leds/leds-class.rst deprecates vendor prefixes in LED device names and expects the function part to come from include/dt-bindings/leds/common.h, which does not define esata. All five LEDs registered in Data::register() currently use the synology:
prefix.
[ ... ]
drivers/platform/synology_microp/led.rs line 194
Quoted 5 lines
drivers/platform/synology_microp/led.rs new file +5
-0+fn blink_set <'bound>( + self: &led::Device <'bound,Self >, + delay_on: &mut usize , + delay_off: &mut usize , + ) ->Result <()> {
[Severity: Medium]
Does implementing LedOps::blink_set() here expose aliasing &mut usize undefined behavior in rust/kernel/led/?
This driver adds the first in-tree implementations of LedOps::blink_set() (in LedHandler and StatusLedHandler), instantiating Adapter::blink_set_callback() in rust/kernel/led/normal.rs and rust/kernel/led/multicolor.rs. Both callbacks form
unsafe { &mut *delay_on } and unsafe { &mut *delay_off } assuming exclusive access, but led_delay_on_store() and led_delay_off_store() in drivers/leds/trigger/ledtrig-timer.c pass &led_cdev->blink_delay_off and &led_cdev->blink_delay_on to led_blink_set() without locking.
Two concurrent writes to delay_on (or a write racing with a sysfs read) create aliasing &mut usize references and data races on those fields before self.blink.lock() is acquired.
Quoted 9 lines
drivers/platform/synology_microp/led.rs new file +9
-0+let mut blink = self.blink.lock (); + + (self.command)(if *delay_on ==0 && *delay_off !=0 { + *blink =false ; + +State ::Off + }else if *delay_on !=0 && *delay_off ==0 { + *blink =false ; +
drivers/platform/synology_microp/led.rs line 213
Quoted 10 lines
drivers/platform/synology_microp/led.rs new file +10
-0+State ::On + }else { + *blink =true ; + *delay_on =BLINK_DELAY .as_millis ()as usize ; + *delay_off =BLINK_DELAY .as_millis ()as usize ; + +State ::Blink + }) + .write (self.dev) + }
[Severity: Medium]
Does mutating *blink, *delay_on, and *delay_off before .write(self.dev) succeeds corrupt software-blink fallback on write errors?
If Command::write() fails (for example with -ERESTARTSYS), led_blink_setup() in drivers/leds/led-core.c falls back to led_set_software_blink() using the already-overwritten 167 ms delays instead of the requested or default delays. Because *blink was already set to true, each software-blink ON tick then calls brightness_set(1) and sends State::Blink instead of State::On.
StatusLedHandler::blink_set() has the same issue, and both LedHandler::brightness_set() and StatusLedHandler::brightness_set() clear *blink before .write(self.dev) succeeds. Updating *blink and the delay out-parameters only after .write(self.dev)? returns Ok(()) keeps driver state in sync with the hardware.
[ ... ]
Quoted 10 lines
drivers/platform/synology_microp/led.rs new file +10
-0+fn brightness_set <'bound>( + self: &led::MultiColorDevice <'bound,Self >, + brightness:u32 , + ) ->Result <()> { +let mut blink = self.blink.lock (); +if brightness ==0 { + *blink =false ; + } + +let amber_brightness = self.subleds ()[1 ].brightness ();
[ ... ]
Quoted 4 lines
drivers/platform/synology_microp/led.rs new file +4
-0+fn blink_set <'bound>( + self: &led::MultiColorDevice <'bound,Self >, + delay_on: &mut usize , + delay_off: &mut usize,
drivers/platform/synology_microp/led.rs line 272
Quoted 10 lines
drivers/platform/synology_microp/led.rs new file +10
-0+ ) -> Result<()> { +let mut blink = self.blink.lock (); + +let amber_intensity = self.subleds ()[1 ].intensity (); + +let (color, subled_intensity) =if amber_intensity ==0 { + (StatusLedColor ::Green , self.subleds ()[0 ].intensity ()) + }else { + (StatusLedColor ::Amber , amber_intensity) + };
[Severity: Medium]
Does writing multi_intensity turn off the status LED when hardware blinking was started from brightness 0?
Data::register() leaves the status LED's initial brightness at 0 with Green intensity 1. When the timer trigger starts hardware blinking, StatusLedHandler::blink_set() uses the subled intensities to start blinking while led_cdev->brightness stays 0. If userspace then writes multi_intensity to switch the blinking color to amber, multi_intensity_store() calls led_set_brightness(led_cdev, 0), which runs brightness_set(0), clears *blink, and sends State::Off.
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=2