* [PATCH v3 0/7] Introduce Synology Microp driver
@ 2026-03-13 18:48 Markus Probst
2026-03-13 18:48 ` [PATCH v3 1/7] rust: Add `parent_unchecked` function to `Device` Markus Probst
` (2 more replies)
0 siblings, 3 replies; 12+ messages in thread
From: Markus Probst @ 2026-03-13 18:48 UTC (permalink / raw)
To: Lee Jones, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
Greg Kroah-Hartman, Miguel Ojeda, Boqun Feng, Gary Guo,
Björn Roy Baron, Benno Lossin, Andreas Hindborg, Alice Ryhl,
Trevor Gross, Danilo Krummrich, Rafael J. Wysocki, Igor Korotin,
Daniel Almeida, Bjorn Helgaas, Krzysztof Wilczyński,
Pavel Machek, Len Brown, Robert Moore
Cc: devicetree, linux-kernel, rust-for-linux, driver-core, linux-pci,
linux-leds, linux-acpi, acpica-devel, Markus Probst
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 only adds the core driver and led driver.
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/20260207-rust_leds-v12-0-fdb518417b75@posteo.de/
[2] https://lore.kernel.org/rust-for-linux/20260313-rust_serdev-v3-0-c9a3af214f7f@posteo.de/
Signed-off-by: Markus Probst <markus.probst@posteo.de>
---
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/20260308-synology_microp_initial-v2-0-9389963f31c5@posteo.de
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/20260306-synology_microp_initial-v1-0-fcffede6448c@posteo.de
---
Markus Probst (7):
rust: Add `parent_unchecked` function to `Device`
rust: add basic mfd abstractions
acpi: add acpi_of_match_device_ids
mfd: match acpi devices against PRP0001
dt-bindings: mfd: Add synology,microp device
mfd: Add synology microp core driver
leds: add synology microp led driver
.../devicetree/bindings/leds/synology,microp.yaml | 40 +++
.../devicetree/bindings/mfd/synology,microp.yaml | 51 ++++
MAINTAINERS | 14 +
drivers/acpi/bus.c | 7 +
drivers/leds/Kconfig | 11 +
drivers/leds/Makefile | 1 +
drivers/leds/leds_synology_microp.rs | 303 +++++++++++++++++++++
drivers/mfd/Kconfig | 11 +
drivers/mfd/Makefile | 2 +
drivers/mfd/mfd-core.c | 27 ++
drivers/mfd/synology_microp.rs | 46 ++++
include/acpi/acpi_bus.h | 2 +
rust/bindings/bindings_helper.h | 1 +
rust/kernel/device.rs | 25 +-
rust/kernel/i2c.rs | 7 +
rust/kernel/lib.rs | 1 +
rust/kernel/mfd.rs | 114 ++++++++
rust/kernel/pci.rs | 7 +
rust/kernel/platform.rs | 7 +
rust/kernel/serdev.rs | 6 +
rust/kernel/usb.rs | 7 +
21 files changed, 688 insertions(+), 2 deletions(-)
---
base-commit: 3daa4f5dc6cc1ac1ab2f95b5b4c16bc5fb87f48f
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:v12
prerequisite-patch-id: 42c445ef6981e3a3740dbaaf307f4b810042e46f
prerequisite-patch-id: 90c7b200cca722a592353885e21af069101c4e09
prerequisite-patch-id: c664a52faa3d47000d252eb7603c9c08382e868a
^ permalink raw reply [flat|nested] 12+ messages in thread* [PATCH v3 1/7] rust: Add `parent_unchecked` function to `Device` 2026-03-13 18:48 [PATCH v3 0/7] Introduce Synology Microp driver Markus Probst @ 2026-03-13 18:48 ` Markus Probst 2026-03-13 18:48 ` [PATCH v3 2/7] rust: add basic mfd abstractions Markus Probst 2026-03-13 18:48 ` [PATCH v3 3/7] acpi: add acpi_of_match_device_ids Markus Probst 2 siblings, 0 replies; 12+ messages in thread From: Markus Probst @ 2026-03-13 18:48 UTC (permalink / raw) To: Lee Jones, Rob Herring, Krzysztof Kozlowski, Conor Dooley, Greg Kroah-Hartman, Miguel Ojeda, Boqun Feng, Gary Guo, Björn Roy Baron, Benno Lossin, Andreas Hindborg, Alice Ryhl, Trevor Gross, Danilo Krummrich, Rafael J. Wysocki, Igor Korotin, Daniel Almeida, Bjorn Helgaas, Krzysztof Wilczyński, Pavel Machek, Len Brown, Robert Moore Cc: devicetree, linux-kernel, rust-for-linux, driver-core, linux-pci, linux-leds, linux-acpi, acpica-devel, Markus Probst This allows mfd sub-devices to access the bus device of their parent. The existing safe `parent` function has been made public for consistency. Signed-off-by: Markus Probst <markus.probst@posteo.de> --- rust/kernel/device.rs | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/rust/kernel/device.rs b/rust/kernel/device.rs index 94e0548e7687..a53fb8a388e8 100644 --- a/rust/kernel/device.rs +++ b/rust/kernel/device.rs @@ -340,8 +340,7 @@ pub(crate) fn as_raw(&self) -> *mut bindings::device { } /// Returns a reference to the parent device, if any. - #[cfg_attr(not(CONFIG_AUXILIARY_BUS), expect(dead_code))] - pub(crate) fn parent(&self) -> Option<&Device> { + pub fn parent(&self) -> Option<&Device> { // SAFETY: // - By the type invariant `self.as_raw()` is always valid. // - The parent device is only ever set at device creation. @@ -358,6 +357,28 @@ pub(crate) fn parent(&self) -> Option<&Device> { } } + /// Returns a reference to the parent device as bus device. + /// + /// # Safety + /// + /// Callers must ensure that the device has a parent, that is contained in `T`. + pub unsafe fn parent_unchecked<T: AsBusDevice<Ctx>>(&self) -> &T { + // SAFETY: + // - By the type invariant `self.as_raw()` is always valid. + // - The parent device is only ever set at device creation. + let parent_raw = unsafe { (*self.as_raw()).parent }; + + // SAFETY: + // - The safety requirements guarantee that the device has a parent, thus `parent_raw` + // must be a pointer to a valid `struct device`. + // - `parent_raw` is valid for the lifetime of `self`, since a `struct device` holds a + // reference count of its parent. + let parent = unsafe { Device::from_raw(parent_raw) }; + + // SAFETY: The safety requirements guarantee that the parent device is contained in `T`. + unsafe { T::from_device(parent) } + } + /// Convert a raw C `struct device` pointer to a `&'a Device`. /// /// # Safety -- 2.52.0 ^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH v3 2/7] rust: add basic mfd abstractions 2026-03-13 18:48 [PATCH v3 0/7] Introduce Synology Microp driver Markus Probst 2026-03-13 18:48 ` [PATCH v3 1/7] rust: Add `parent_unchecked` function to `Device` Markus Probst @ 2026-03-13 18:48 ` Markus Probst 2026-03-13 18:48 ` [PATCH v3 3/7] acpi: add acpi_of_match_device_ids Markus Probst 2 siblings, 0 replies; 12+ messages in thread From: Markus Probst @ 2026-03-13 18:48 UTC (permalink / raw) To: Lee Jones, Rob Herring, Krzysztof Kozlowski, Conor Dooley, Greg Kroah-Hartman, Miguel Ojeda, Boqun Feng, Gary Guo, Björn Roy Baron, Benno Lossin, Andreas Hindborg, Alice Ryhl, Trevor Gross, Danilo Krummrich, Rafael J. Wysocki, Igor Korotin, Daniel Almeida, Bjorn Helgaas, Krzysztof Wilczyński, Pavel Machek, Len Brown, Robert Moore Cc: devicetree, linux-kernel, rust-for-linux, driver-core, linux-pci, linux-leds, linux-acpi, acpica-devel, Markus Probst Implement the basic mfd rust abstractions required to register mfd sub-devices, including: - `mfd::Cell` - a safe wrapper for `struct mfd_cell` - `mfd::CellAcpiMatch` - a safe wrapper for `struct mfd_cell_acpi_match` - `const MFD_CELLS: Option<&'static [mfd::Cell]>` in each bus device, except auxiliary The mfd sub-device registration will be done after a successful call to probe in each bus device, except auxiliary. This guarantees that `mfd_add_devices` will only be run at most once per device. It also ensures that the sub-devices will be probed after the drvdata of the device has been set. In order to register mfd sub-devices for a device, the driver needs to set `const MFD_CELLS` in their Driver trait implementation to Some. A build_assert guarantees that this can only be set to Some, if CONFIG_MFD_CORE is enabled. Signed-off-by: Markus Probst <markus.probst@posteo.de> --- MAINTAINERS | 6 +++ rust/bindings/bindings_helper.h | 1 + rust/kernel/i2c.rs | 7 +++ rust/kernel/lib.rs | 1 + rust/kernel/mfd.rs | 114 ++++++++++++++++++++++++++++++++++++++++ rust/kernel/pci.rs | 7 +++ rust/kernel/platform.rs | 7 +++ rust/kernel/serdev.rs | 6 +++ rust/kernel/usb.rs | 7 +++ 9 files changed, 156 insertions(+) diff --git a/MAINTAINERS b/MAINTAINERS index 749d63ca18fa..fa49e40836ab 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -18082,6 +18082,12 @@ F: drivers/mfd/ F: include/dt-bindings/mfd/ F: include/linux/mfd/ +MULTIFUNCTION DEVICES (MFD) [RUST] +M: Markus Probst <markus.probst@posteo.de> +S: Maintained +T: git git://git.kernel.org/pub/scm/linux/kernel/git/lee/mfd.git +F: rust/kernel/mfd.rs + MULTIMEDIA CARD (MMC) ETC. OVER SPI S: Orphan F: drivers/mmc/host/mmc_spi.c diff --git a/rust/bindings/bindings_helper.h b/rust/bindings/bindings_helper.h index f597fe3352f5..b7c17d1d9ece 100644 --- a/rust/bindings/bindings_helper.h +++ b/rust/bindings/bindings_helper.h @@ -65,6 +65,7 @@ #include <linux/jump_label.h> #include <linux/led-class-multicolor.h> #include <linux/mdio.h> +#include <linux/mfd/core.h> #include <linux/mm.h> #include <linux/miscdevice.h> #include <linux/of_device.h> diff --git a/rust/kernel/i2c.rs b/rust/kernel/i2c.rs index bb5b830f48c3..e733b651d878 100644 --- a/rust/kernel/i2c.rs +++ b/rust/kernel/i2c.rs @@ -14,6 +14,7 @@ devres::Devres, driver, error::*, + mfd, of, prelude::*, types::{ @@ -167,6 +168,9 @@ extern "C" fn probe_callback(idev: *mut bindings::i2c_client) -> kernel::ffi::c_ let data = T::probe(idev, info); idev.as_ref().set_drvdata(data)?; + + idev.as_ref().mfd_add_devices(T::MFD_CELLS)?; + Ok(0) }) } @@ -328,6 +332,9 @@ pub trait Driver: Send { /// The table of ACPI device ids supported by the driver. const ACPI_ID_TABLE: Option<acpi::IdTable<Self::IdInfo>> = None; + /// The mfd cells for mfd devices. + const MFD_CELLS: Option<&'static [mfd::Cell]> = None; + /// I2C driver probe. /// /// Called when a new i2c client is added or discovered. diff --git a/rust/kernel/lib.rs b/rust/kernel/lib.rs index 311fdf984b87..bacc54ca6aea 100644 --- a/rust/kernel/lib.rs +++ b/rust/kernel/lib.rs @@ -114,6 +114,7 @@ pub mod led; pub mod list; pub mod maple_tree; +pub mod mfd; pub mod miscdevice; pub mod mm; pub mod module_param; diff --git a/rust/kernel/mfd.rs b/rust/kernel/mfd.rs new file mode 100644 index 000000000000..6c47d9211bf2 --- /dev/null +++ b/rust/kernel/mfd.rs @@ -0,0 +1,114 @@ +// SPDX-License-Identifier: GPL-2.0 + +//! Abstractions for the mfd subsystem. +//! +//! C header: [`include/linux/mfd/core.h`](srctree/include/linux/mfd/core.h) + +use core::{mem::MaybeUninit, ptr}; + +use crate::{ + device::{ + CoreInternal, + Device, // + }, + error::to_result, + prelude::*, // +}; + +/// A mfd cell. +/// +/// # Invariants +/// +/// A [`Cell`] instance represents a valid `struct mfd_cell`. +#[repr(transparent)] +pub struct Cell(bindings::mfd_cell); + +impl Cell { + /// Creates a new mfd cell. + pub const fn new(name: &'static CStr) -> Self { + Self(bindings::mfd_cell { + name: name.as_ptr().cast::<u8>(), + + // SAFETY: Always safe to call. + // This is the const equivalent to `bindings::mfd_cell::default()`. + ..unsafe { MaybeUninit::zeroed().assume_init() } + }) + } + + /// Sets `of_compatible` and optionally `of_reg` and `use_of_reg` on the mfd cell. + pub const fn of(self, compatible: &'static CStr, reg: Option<u64>) -> Self { + Self(bindings::mfd_cell { + of_compatible: compatible.as_ptr().cast::<u8>(), + // TODO: Use `unwrap_or` once stabilized in const fn. + of_reg: if let Some(reg) = reg { reg } else { 0 }, + use_of_reg: reg.is_some(), + + ..self.0 + }) + } + + /// Sets `acpi_match` on the mfd cell. + pub const fn acpi(self, acpi_match: &'static CellAcpiMatch) -> Self { + Self(bindings::mfd_cell { + acpi_match: &raw const acpi_match.0, + + ..self.0 + }) + } +} + +/// A mfd cell acpi match entry. +/// +/// # Invariants +/// +/// A [`CellAcpiMatch`] instance represents a valid `struct mfd_cell_acpi_match`. +#[repr(transparent)] +pub struct CellAcpiMatch(bindings::mfd_cell_acpi_match); + +impl CellAcpiMatch { + /// Creates a new mfd cell acpi match entry, using a ACPI PNP ID. + pub const fn pnpid(pnpid: &'static CStr) -> Self { + Self(bindings::mfd_cell_acpi_match { + pnpid: pnpid.as_ptr().cast::<u8>(), + adr: 0, + }) + } + + /// Creates a new mfd cell acpi match entry, using a ACPI ADR. + pub const fn adr(adr: u64) -> Self { + Self(bindings::mfd_cell_acpi_match { + pnpid: ptr::null(), + adr, + }) + } +} + +impl Device<CoreInternal> { + /// Registers child mfd devices. + // Always inline to optimize out error path of `build_assert`. + #[inline(always)] + pub(crate) fn mfd_add_devices(&self, cells: Option<&'static [Cell]>) -> Result { + if let Some(cells) = cells { + build_assert!(cfg!(CONFIG_MFD_CORE)); + + // SAFETY: + // - `self.as_raw()` is guaranteed to be a pointer to a valid `device`. + // - `cells.as_ptr()` is a guaranteed to be a pointer to a valid `mfd_cell` array + // with the length of `cells.len()`. + to_result(unsafe { + bindings::devm_mfd_add_devices( + self.as_raw(), + bindings::PLATFORM_DEVID_AUTO, + // CAST: `Cell` is a transparent wrapper of `mfd_cell`. + cells.as_ptr().cast::<bindings::mfd_cell>(), + i32::try_from(cells.len())?, + ptr::null_mut(), + 0, + ptr::null_mut(), + ) + })?; + } + + Ok(()) + } +} diff --git a/rust/kernel/pci.rs b/rust/kernel/pci.rs index af74ddff6114..6c4cf6cf970b 100644 --- a/rust/kernel/pci.rs +++ b/rust/kernel/pci.rs @@ -17,6 +17,7 @@ from_result, to_result, // }, + mfd, prelude::*, str::CStr, types::Opaque, @@ -116,6 +117,9 @@ extern "C" fn probe_callback( let data = T::probe(pdev, info); pdev.as_ref().set_drvdata(data)?; + + pdev.as_ref().mfd_add_devices(T::MFD_CELLS)?; + Ok(0) }) } @@ -303,6 +307,9 @@ pub trait Driver: Send { /// The table of device ids supported by the driver. const ID_TABLE: IdTable<Self::IdInfo>; + /// The mfd cells for mfd devices. + const MFD_CELLS: Option<&'static [mfd::Cell]> = None; + /// PCI driver probe. /// /// Called when a new pci device is added or discovered. Implementers should diff --git a/rust/kernel/platform.rs b/rust/kernel/platform.rs index 8917d4ee499f..e2bcf8ef093c 100644 --- a/rust/kernel/platform.rs +++ b/rust/kernel/platform.rs @@ -25,6 +25,7 @@ self, IrqRequest, // }, + mfd, of, prelude::*, types::Opaque, @@ -104,6 +105,9 @@ extern "C" fn probe_callback(pdev: *mut bindings::platform_device) -> kernel::ff let data = T::probe(pdev, info); pdev.as_ref().set_drvdata(data)?; + + pdev.as_ref().mfd_add_devices(T::MFD_CELLS)?; + Ok(0) }) } @@ -218,6 +222,9 @@ pub trait Driver: Send { /// The table of ACPI device ids supported by the driver. const ACPI_ID_TABLE: Option<acpi::IdTable<Self::IdInfo>> = None; + /// The mfd cells for mfd devices. + const MFD_CELLS: Option<&'static [mfd::Cell]> = None; + /// Platform driver probe. /// /// Called when a new platform device is added or discovered. diff --git a/rust/kernel/serdev.rs b/rust/kernel/serdev.rs index d9fea4bd4439..6e702c734ded 100644 --- a/rust/kernel/serdev.rs +++ b/rust/kernel/serdev.rs @@ -14,6 +14,7 @@ to_result, VTABLE_DEFAULT_ERROR, // }, + mfd, of, prelude::*, sync::Completion, @@ -180,6 +181,8 @@ extern "C" fn probe_callback(sdev: *mut bindings::serdev_device) -> kernel::ffi: private_data.probe_complete.complete_all(); + sdev.as_ref().mfd_add_devices(T::MFD_CELLS)?; + result.map(|()| 0) }) } @@ -339,6 +342,9 @@ pub trait Driver: Send { /// The table of ACPI device ids supported by the driver. const ACPI_ID_TABLE: Option<acpi::IdTable<Self::IdInfo>> = None; + /// The mfd cells for mfd devices. + const MFD_CELLS: Option<&'static [mfd::Cell]> = None; + /// Serial device bus device driver probe. /// /// Called when a new serial device bus device is added or discovered. diff --git a/rust/kernel/usb.rs b/rust/kernel/usb.rs index 0e1b9a88f4f1..a64ed6a530f1 100644 --- a/rust/kernel/usb.rs +++ b/rust/kernel/usb.rs @@ -17,6 +17,7 @@ from_result, to_result, // }, + mfd, prelude::*, types::{ AlwaysRefCounted, @@ -96,6 +97,9 @@ extern "C" fn probe_callback( let dev: &device::Device<device::CoreInternal> = intf.as_ref(); dev.set_drvdata(data)?; + + dev.mfd_add_devices(T::MFD_CELLS)?; + Ok(0) }) } @@ -309,6 +313,9 @@ pub trait Driver { /// The table of device ids supported by the driver. const ID_TABLE: IdTable<Self::IdInfo>; + /// The mfd cells for mfd devices. + const MFD_CELLS: Option<&'static [mfd::Cell]> = None; + /// USB driver probe. /// /// Called when a new USB interface is bound to this driver. -- 2.52.0 ^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH v3 3/7] acpi: add acpi_of_match_device_ids 2026-03-13 18:48 [PATCH v3 0/7] Introduce Synology Microp driver Markus Probst 2026-03-13 18:48 ` [PATCH v3 1/7] rust: Add `parent_unchecked` function to `Device` Markus Probst 2026-03-13 18:48 ` [PATCH v3 2/7] rust: add basic mfd abstractions Markus Probst @ 2026-03-13 18:48 ` Markus Probst 2026-03-13 18:57 ` Rafael J. Wysocki 2 siblings, 1 reply; 12+ messages in thread From: Markus Probst @ 2026-03-13 18:48 UTC (permalink / raw) To: Lee Jones, Rob Herring, Krzysztof Kozlowski, Conor Dooley, Greg Kroah-Hartman, Miguel Ojeda, Boqun Feng, Gary Guo, Björn Roy Baron, Benno Lossin, Andreas Hindborg, Alice Ryhl, Trevor Gross, Danilo Krummrich, Rafael J. Wysocki, Igor Korotin, Daniel Almeida, Bjorn Helgaas, Krzysztof Wilczyński, Pavel Machek, Len Brown, Robert Moore Cc: devicetree, linux-kernel, rust-for-linux, driver-core, linux-pci, linux-leds, linux-acpi, acpica-devel, Markus Probst Add a function to match acpi devices against of_device_ids. This will be used in the following commit ("mfd: match acpi devices against PRP0001") to match mfd sub-devices against a of compatible string. Signed-off-by: Markus Probst <markus.probst@posteo.de> --- drivers/acpi/bus.c | 7 +++++++ include/acpi/acpi_bus.h | 2 ++ 2 files changed, 9 insertions(+) diff --git a/drivers/acpi/bus.c b/drivers/acpi/bus.c index f6707325f582..5ddcc56edc87 100644 --- a/drivers/acpi/bus.c +++ b/drivers/acpi/bus.c @@ -1044,6 +1044,13 @@ int acpi_match_device_ids(struct acpi_device *device, } EXPORT_SYMBOL(acpi_match_device_ids); +int acpi_of_match_device_ids(struct acpi_device *device, + const struct of_device_id *ids) +{ + return __acpi_match_device(device, NULL, ids, NULL, NULL) ? 0 : -ENOENT; +} +EXPORT_SYMBOL(acpi_of_match_device_ids); + bool acpi_driver_match_device(struct device *dev, const struct device_driver *drv) { diff --git a/include/acpi/acpi_bus.h b/include/acpi/acpi_bus.h index aad1a95e6863..0081b9e4aaee 100644 --- a/include/acpi/acpi_bus.h +++ b/include/acpi/acpi_bus.h @@ -677,6 +677,8 @@ void acpi_bus_trim(struct acpi_device *start); acpi_status acpi_bus_get_ejd(acpi_handle handle, acpi_handle * ejd); int acpi_match_device_ids(struct acpi_device *device, const struct acpi_device_id *ids); +int acpi_of_match_device_ids(struct acpi_device *device, + const struct of_device_id *ids); void acpi_set_modalias(struct acpi_device *adev, const char *default_id, char *modalias, size_t len); -- 2.52.0 ^ permalink raw reply related [flat|nested] 12+ messages in thread
* Re: [PATCH v3 3/7] acpi: add acpi_of_match_device_ids 2026-03-13 18:48 ` [PATCH v3 3/7] acpi: add acpi_of_match_device_ids Markus Probst @ 2026-03-13 18:57 ` Rafael J. Wysocki 2026-03-13 20:32 ` Markus Probst 0 siblings, 1 reply; 12+ messages in thread From: Rafael J. Wysocki @ 2026-03-13 18:57 UTC (permalink / raw) To: Markus Probst Cc: Lee Jones, Rob Herring, Krzysztof Kozlowski, Conor Dooley, Greg Kroah-Hartman, Miguel Ojeda, Boqun Feng, Gary Guo, Björn Roy Baron, Benno Lossin, Andreas Hindborg, Alice Ryhl, Trevor Gross, Danilo Krummrich, Rafael J. Wysocki, Igor Korotin, Daniel Almeida, Bjorn Helgaas, Krzysztof Wilczyński, Pavel Machek, Len Brown, Robert Moore, devicetree, linux-kernel, rust-for-linux, driver-core, linux-pci, linux-leds, linux-acpi, acpica-devel On Fri, Mar 13, 2026 at 7:48 PM Markus Probst <markus.probst@posteo.de> wrote: > > Add a function to match acpi devices against of_device_ids. This will be > used in the following commit ("mfd: match acpi devices against PRP0001") > to match mfd sub-devices against a of compatible string. Not until I can see how this is going to be used. Maybe never. > Signed-off-by: Markus Probst <markus.probst@posteo.de> > --- > drivers/acpi/bus.c | 7 +++++++ > include/acpi/acpi_bus.h | 2 ++ > 2 files changed, 9 insertions(+) > > diff --git a/drivers/acpi/bus.c b/drivers/acpi/bus.c > index f6707325f582..5ddcc56edc87 100644 > --- a/drivers/acpi/bus.c > +++ b/drivers/acpi/bus.c > @@ -1044,6 +1044,13 @@ int acpi_match_device_ids(struct acpi_device *device, > } > EXPORT_SYMBOL(acpi_match_device_ids); > > +int acpi_of_match_device_ids(struct acpi_device *device, > + const struct of_device_id *ids) > +{ > + return __acpi_match_device(device, NULL, ids, NULL, NULL) ? 0 : -ENOENT; > +} > +EXPORT_SYMBOL(acpi_of_match_device_ids); > + > bool acpi_driver_match_device(struct device *dev, > const struct device_driver *drv) > { > diff --git a/include/acpi/acpi_bus.h b/include/acpi/acpi_bus.h > index aad1a95e6863..0081b9e4aaee 100644 > --- a/include/acpi/acpi_bus.h > +++ b/include/acpi/acpi_bus.h > @@ -677,6 +677,8 @@ void acpi_bus_trim(struct acpi_device *start); > acpi_status acpi_bus_get_ejd(acpi_handle handle, acpi_handle * ejd); > int acpi_match_device_ids(struct acpi_device *device, > const struct acpi_device_id *ids); > +int acpi_of_match_device_ids(struct acpi_device *device, > + const struct of_device_id *ids); > void acpi_set_modalias(struct acpi_device *adev, const char *default_id, > char *modalias, size_t len); > > > -- > 2.52.0 > > ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH v3 3/7] acpi: add acpi_of_match_device_ids 2026-03-13 18:57 ` Rafael J. Wysocki @ 2026-03-13 20:32 ` Markus Probst 0 siblings, 0 replies; 12+ messages in thread From: Markus Probst @ 2026-03-13 20:32 UTC (permalink / raw) To: Rafael J. Wysocki Cc: Lee Jones, Rob Herring, Krzysztof Kozlowski, Conor Dooley, Greg Kroah-Hartman, Miguel Ojeda, Boqun Feng, Gary Guo, Björn Roy Baron, Benno Lossin, Andreas Hindborg, Alice Ryhl, Trevor Gross, Danilo Krummrich, Igor Korotin, Daniel Almeida, Bjorn Helgaas, Krzysztof Wilczyński, Pavel Machek, Len Brown, Robert Moore, devicetree, linux-kernel, rust-for-linux, driver-core, linux-pci, linux-leds, linux-acpi, acpica-devel [-- Attachment #1: Type: text/plain, Size: 887 bytes --] On Fri, 2026-03-13 at 19:57 +0100, Rafael J. Wysocki wrote: > On Fri, Mar 13, 2026 at 7:48 PM Markus Probst <markus.probst@posteo.de> wrote: > > > > Add a function to match acpi devices against of_device_ids. This will be > > used in the following commit ("mfd: match acpi devices against PRP0001") > > to match mfd sub-devices against a of compatible string. > > Not until I can see how this is going to be used. This is used directly in the following patch. Only half of the patch series has been sent by b4, because of a limit of my email provider (which I didn't know existed until now). I am sorry for the inconvenience. The patch series has been resent via the b4 relay. You can take a look at [1] to see how it is used. [1] https://lore.kernel.org/rust-for-linux/20260313-synology_microp_initial-v3-4-ad6ac463a201@posteo.de/T/#u Thanks - Markus Probst [-- Attachment #2: This is a digitally signed message part --] [-- Type: application/pgp-signature, Size: 870 bytes --] ^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH v3 0/7] Introduce Synology Microp driver
@ 2026-03-13 19:03 Markus Probst via B4 Relay
2026-03-13 19:03 ` [PATCH v3 3/7] acpi: add acpi_of_match_device_ids Markus Probst via B4 Relay
0 siblings, 1 reply; 12+ messages in thread
From: Markus Probst via B4 Relay @ 2026-03-13 19:03 UTC (permalink / raw)
To: Lee Jones, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
Greg Kroah-Hartman, Miguel Ojeda, Boqun Feng, Gary Guo,
Björn Roy Baron, Benno Lossin, Andreas Hindborg, Alice Ryhl,
Trevor Gross, Danilo Krummrich, Rafael J. Wysocki, Igor Korotin,
Daniel Almeida, Bjorn Helgaas, Krzysztof Wilczyński,
Pavel Machek, Len Brown, Robert Moore
Cc: devicetree, linux-kernel, rust-for-linux, driver-core, linux-pci,
linux-leds, linux-acpi, acpica-devel, Markus Probst
Apparently my email provider refused to send the whole patch series,
because of a 100 receiver per hour limit to protect against spam
(according to the error message). Please ignore the previous submission.
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 only adds the core driver and led driver.
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/20260207-rust_leds-v12-0-fdb518417b75@posteo.de/
[2] https://lore.kernel.org/rust-for-linux/20260313-rust_serdev-v3-0-c9a3af214f7f@posteo.de/
Signed-off-by: Markus Probst <markus.probst@posteo.de>
---
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/20260308-synology_microp_initial-v2-0-9389963f31c5@posteo.de
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/20260306-synology_microp_initial-v1-0-fcffede6448c@posteo.de
---
Markus Probst (7):
rust: Add `parent_unchecked` function to `Device`
rust: add basic mfd abstractions
acpi: add acpi_of_match_device_ids
mfd: match acpi devices against PRP0001
dt-bindings: mfd: Add synology,microp device
mfd: Add synology microp core driver
leds: add synology microp led driver
.../devicetree/bindings/leds/synology,microp.yaml | 40 +++
.../devicetree/bindings/mfd/synology,microp.yaml | 51 ++++
MAINTAINERS | 14 +
drivers/acpi/bus.c | 7 +
drivers/leds/Kconfig | 11 +
drivers/leds/Makefile | 1 +
drivers/leds/leds_synology_microp.rs | 303 +++++++++++++++++++++
drivers/mfd/Kconfig | 11 +
drivers/mfd/Makefile | 2 +
drivers/mfd/mfd-core.c | 27 ++
drivers/mfd/synology_microp.rs | 46 ++++
include/acpi/acpi_bus.h | 2 +
rust/bindings/bindings_helper.h | 1 +
rust/kernel/device.rs | 25 +-
rust/kernel/i2c.rs | 7 +
rust/kernel/lib.rs | 1 +
rust/kernel/mfd.rs | 114 ++++++++
rust/kernel/pci.rs | 7 +
rust/kernel/platform.rs | 7 +
rust/kernel/serdev.rs | 6 +
rust/kernel/usb.rs | 7 +
21 files changed, 688 insertions(+), 2 deletions(-)
---
base-commit: 3daa4f5dc6cc1ac1ab2f95b5b4c16bc5fb87f48f
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:v12
prerequisite-patch-id: 42c445ef6981e3a3740dbaaf307f4b810042e46f
prerequisite-patch-id: 90c7b200cca722a592353885e21af069101c4e09
prerequisite-patch-id: c664a52faa3d47000d252eb7603c9c08382e868a
^ permalink raw reply [flat|nested] 12+ messages in thread* [PATCH v3 3/7] acpi: add acpi_of_match_device_ids 2026-03-13 19:03 [PATCH v3 0/7] Introduce Synology Microp driver Markus Probst via B4 Relay @ 2026-03-13 19:03 ` Markus Probst via B4 Relay 2026-03-23 19:57 ` Rafael J. Wysocki 0 siblings, 1 reply; 12+ messages in thread From: Markus Probst via B4 Relay @ 2026-03-13 19:03 UTC (permalink / raw) To: Lee Jones, Rob Herring, Krzysztof Kozlowski, Conor Dooley, Greg Kroah-Hartman, Miguel Ojeda, Boqun Feng, Gary Guo, Björn Roy Baron, Benno Lossin, Andreas Hindborg, Alice Ryhl, Trevor Gross, Danilo Krummrich, Rafael J. Wysocki, Igor Korotin, Daniel Almeida, Bjorn Helgaas, Krzysztof Wilczyński, Pavel Machek, Len Brown, Robert Moore Cc: devicetree, linux-kernel, rust-for-linux, driver-core, linux-pci, linux-leds, linux-acpi, acpica-devel, Markus Probst From: Markus Probst <markus.probst@posteo.de> Add a function to match acpi devices against of_device_ids. This will be used in the following commit ("mfd: match acpi devices against PRP0001") to match mfd sub-devices against a of compatible string. Signed-off-by: Markus Probst <markus.probst@posteo.de> --- drivers/acpi/bus.c | 7 +++++++ include/acpi/acpi_bus.h | 2 ++ 2 files changed, 9 insertions(+) diff --git a/drivers/acpi/bus.c b/drivers/acpi/bus.c index f6707325f582..5ddcc56edc87 100644 --- a/drivers/acpi/bus.c +++ b/drivers/acpi/bus.c @@ -1044,6 +1044,13 @@ int acpi_match_device_ids(struct acpi_device *device, } EXPORT_SYMBOL(acpi_match_device_ids); +int acpi_of_match_device_ids(struct acpi_device *device, + const struct of_device_id *ids) +{ + return __acpi_match_device(device, NULL, ids, NULL, NULL) ? 0 : -ENOENT; +} +EXPORT_SYMBOL(acpi_of_match_device_ids); + bool acpi_driver_match_device(struct device *dev, const struct device_driver *drv) { diff --git a/include/acpi/acpi_bus.h b/include/acpi/acpi_bus.h index aad1a95e6863..0081b9e4aaee 100644 --- a/include/acpi/acpi_bus.h +++ b/include/acpi/acpi_bus.h @@ -677,6 +677,8 @@ void acpi_bus_trim(struct acpi_device *start); acpi_status acpi_bus_get_ejd(acpi_handle handle, acpi_handle * ejd); int acpi_match_device_ids(struct acpi_device *device, const struct acpi_device_id *ids); +int acpi_of_match_device_ids(struct acpi_device *device, + const struct of_device_id *ids); void acpi_set_modalias(struct acpi_device *adev, const char *default_id, char *modalias, size_t len); -- 2.52.0 ^ permalink raw reply related [flat|nested] 12+ messages in thread
* Re: [PATCH v3 3/7] acpi: add acpi_of_match_device_ids 2026-03-13 19:03 ` [PATCH v3 3/7] acpi: add acpi_of_match_device_ids Markus Probst via B4 Relay @ 2026-03-23 19:57 ` Rafael J. Wysocki 2026-03-24 15:30 ` Markus Probst 0 siblings, 1 reply; 12+ messages in thread From: Rafael J. Wysocki @ 2026-03-23 19:57 UTC (permalink / raw) To: markus.probst Cc: Lee Jones, Rob Herring, Krzysztof Kozlowski, Conor Dooley, Greg Kroah-Hartman, Miguel Ojeda, Boqun Feng, Gary Guo, Björn Roy Baron, Benno Lossin, Andreas Hindborg, Alice Ryhl, Trevor Gross, Danilo Krummrich, Rafael J. Wysocki, Igor Korotin, Daniel Almeida, Bjorn Helgaas, Krzysztof Wilczyński, Pavel Machek, Len Brown, Robert Moore, devicetree, linux-kernel, rust-for-linux, driver-core, linux-pci, linux-leds, linux-acpi, acpica-devel On Fri, Mar 13, 2026 at 8:03 PM Markus Probst via B4 Relay <devnull+markus.probst.posteo.de@kernel.org> wrote: > > From: Markus Probst <markus.probst@posteo.de> > > Add a function to match acpi devices against of_device_ids. This will be > used in the following commit ("mfd: match acpi devices against PRP0001") > to match mfd sub-devices against a of compatible string. Please always spell ACPI in capitals in patch subjects, comments, changelogs, etc. It is not a regular word. > Signed-off-by: Markus Probst <markus.probst@posteo.de> > --- > drivers/acpi/bus.c | 7 +++++++ > include/acpi/acpi_bus.h | 2 ++ > 2 files changed, 9 insertions(+) > > diff --git a/drivers/acpi/bus.c b/drivers/acpi/bus.c > index f6707325f582..5ddcc56edc87 100644 > --- a/drivers/acpi/bus.c > +++ b/drivers/acpi/bus.c > @@ -1044,6 +1044,13 @@ int acpi_match_device_ids(struct acpi_device *device, > } > EXPORT_SYMBOL(acpi_match_device_ids); > Missing kerneldoc. > +int acpi_of_match_device_ids(struct acpi_device *device, > + const struct of_device_id *ids) > +{ > + return __acpi_match_device(device, NULL, ids, NULL, NULL) ? 0 : -ENOENT; > +} > +EXPORT_SYMBOL(acpi_of_match_device_ids); Are you aware of the consensus that using PRP0001 in production platform firmware will be regarded as invalid? Because of that, it is not an option for a driver to avoid providing ACPI match data on a platform that uses ACPI. > + > bool acpi_driver_match_device(struct device *dev, > const struct device_driver *drv) > { > diff --git a/include/acpi/acpi_bus.h b/include/acpi/acpi_bus.h > index aad1a95e6863..0081b9e4aaee 100644 > --- a/include/acpi/acpi_bus.h > +++ b/include/acpi/acpi_bus.h > @@ -677,6 +677,8 @@ void acpi_bus_trim(struct acpi_device *start); > acpi_status acpi_bus_get_ejd(acpi_handle handle, acpi_handle * ejd); > int acpi_match_device_ids(struct acpi_device *device, > const struct acpi_device_id *ids); > +int acpi_of_match_device_ids(struct acpi_device *device, > + const struct of_device_id *ids); > void acpi_set_modalias(struct acpi_device *adev, const char *default_id, > char *modalias, size_t len); > > > -- > 2.52.0 > > ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH v3 3/7] acpi: add acpi_of_match_device_ids 2026-03-23 19:57 ` Rafael J. Wysocki @ 2026-03-24 15:30 ` Markus Probst 2026-03-24 16:01 ` Rafael J. Wysocki 0 siblings, 1 reply; 12+ messages in thread From: Markus Probst @ 2026-03-24 15:30 UTC (permalink / raw) To: Rafael J. Wysocki Cc: Lee Jones, Rob Herring, Krzysztof Kozlowski, Conor Dooley, Greg Kroah-Hartman, Miguel Ojeda, Boqun Feng, Gary Guo, Björn Roy Baron, Benno Lossin, Andreas Hindborg, Alice Ryhl, Trevor Gross, Danilo Krummrich, Igor Korotin, Daniel Almeida, Bjorn Helgaas, Krzysztof Wilczyński, Pavel Machek, Len Brown, Robert Moore, devicetree, linux-kernel, rust-for-linux, driver-core, linux-pci, linux-leds, linux-acpi, acpica-devel [-- Attachment #1: Type: text/plain, Size: 3436 bytes --] On Mon, 2026-03-23 at 20:57 +0100, Rafael J. Wysocki wrote: > On Fri, Mar 13, 2026 at 8:03 PM Markus Probst via B4 Relay > <devnull+markus.probst.posteo.de@kernel.org> wrote: > > > > From: Markus Probst <markus.probst@posteo.de> > > > > Add a function to match acpi devices against of_device_ids. This will be > > used in the following commit ("mfd: match acpi devices against PRP0001") > > to match mfd sub-devices against a of compatible string. > > Please always spell ACPI in capitals in patch subjects, comments, > changelogs, etc. It is not a regular word. Ok. > > > Signed-off-by: Markus Probst <markus.probst@posteo.de> > > --- > > drivers/acpi/bus.c | 7 +++++++ > > include/acpi/acpi_bus.h | 2 ++ > > 2 files changed, 9 insertions(+) > > > > diff --git a/drivers/acpi/bus.c b/drivers/acpi/bus.c > > index f6707325f582..5ddcc56edc87 100644 > > --- a/drivers/acpi/bus.c > > +++ b/drivers/acpi/bus.c > > @@ -1044,6 +1044,13 @@ int acpi_match_device_ids(struct acpi_device *device, > > } > > EXPORT_SYMBOL(acpi_match_device_ids); > > > > Missing kerneldoc. The same amount of kerneldoc as `acpi_match_device_ids`, if I am not mistaken. > > > +int acpi_of_match_device_ids(struct acpi_device *device, > > + const struct of_device_id *ids) > > +{ > > + return __acpi_match_device(device, NULL, ids, NULL, NULL) ? 0 : -ENOENT; > > +} > > +EXPORT_SYMBOL(acpi_of_match_device_ids); > > Are you aware of the consensus that using PRP0001 in production > platform firmware will be regarded as invalid? > > Because of that, it is not an option for a driver to avoid providing > ACPI match data on a platform that uses ACPI. First of all, the driver that would have made use of it has been restructed to not use mfd subdevices. It would not be affected anymore through this patch set. Not sure if I should still send it as its own patch series though. The device of the driver has no ACPI ID allocated by the manufacturer, as it is only used on a proprietary Linux OS (with their own modified kernel). The driver would have only been useful via device tree or an ACPI Overlay. Obviously, I don't have a PNP or ACPI Vendor ID, so I can't assign one. The parent/main driver does only have a of compatible id. As it needs to use PRP0001 anyway on ACPI, I thought it makes more sense to also use PRP0001 there instead of matching it with a _ADR which is "a grey area in the ACPI specification". Thanks - Markus Probst > > > + > > bool acpi_driver_match_device(struct device *dev, > > const struct device_driver *drv) > > { > > diff --git a/include/acpi/acpi_bus.h b/include/acpi/acpi_bus.h > > index aad1a95e6863..0081b9e4aaee 100644 > > --- a/include/acpi/acpi_bus.h > > +++ b/include/acpi/acpi_bus.h > > @@ -677,6 +677,8 @@ void acpi_bus_trim(struct acpi_device *start); > > acpi_status acpi_bus_get_ejd(acpi_handle handle, acpi_handle * ejd); > > int acpi_match_device_ids(struct acpi_device *device, > > const struct acpi_device_id *ids); > > +int acpi_of_match_device_ids(struct acpi_device *device, > > + const struct of_device_id *ids); > > void acpi_set_modalias(struct acpi_device *adev, const char *default_id, > > char *modalias, size_t len); > > > > > > -- > > 2.52.0 > > > > [-- Attachment #2: This is a digitally signed message part --] [-- Type: application/pgp-signature, Size: 870 bytes --] ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH v3 3/7] acpi: add acpi_of_match_device_ids 2026-03-24 15:30 ` Markus Probst @ 2026-03-24 16:01 ` Rafael J. Wysocki 2026-03-24 16:26 ` Markus Probst 0 siblings, 1 reply; 12+ messages in thread From: Rafael J. Wysocki @ 2026-03-24 16:01 UTC (permalink / raw) To: Markus Probst Cc: Rafael J. Wysocki, Lee Jones, Rob Herring, Krzysztof Kozlowski, Conor Dooley, Greg Kroah-Hartman, Miguel Ojeda, Boqun Feng, Gary Guo, Björn Roy Baron, Benno Lossin, Andreas Hindborg, Alice Ryhl, Trevor Gross, Danilo Krummrich, Igor Korotin, Daniel Almeida, Bjorn Helgaas, Krzysztof Wilczyński, Pavel Machek, Len Brown, Robert Moore, devicetree, linux-kernel, rust-for-linux, driver-core, linux-pci, linux-leds, linux-acpi, acpica-devel On Tue, Mar 24, 2026 at 4:30 PM Markus Probst <markus.probst@posteo.de> wrote: > > On Mon, 2026-03-23 at 20:57 +0100, Rafael J. Wysocki wrote: > > On Fri, Mar 13, 2026 at 8:03 PM Markus Probst via B4 Relay > > <devnull+markus.probst.posteo.de@kernel.org> wrote: > > > > > > From: Markus Probst <markus.probst@posteo.de> > > > > > > Add a function to match acpi devices against of_device_ids. This will be > > > used in the following commit ("mfd: match acpi devices against PRP0001") > > > to match mfd sub-devices against a of compatible string. > > > > Please always spell ACPI in capitals in patch subjects, comments, > > changelogs, etc. It is not a regular word. > Ok. > > > > > Signed-off-by: Markus Probst <markus.probst@posteo.de> > > > --- > > > drivers/acpi/bus.c | 7 +++++++ > > > include/acpi/acpi_bus.h | 2 ++ > > > 2 files changed, 9 insertions(+) > > > > > > diff --git a/drivers/acpi/bus.c b/drivers/acpi/bus.c > > > index f6707325f582..5ddcc56edc87 100644 > > > --- a/drivers/acpi/bus.c > > > +++ b/drivers/acpi/bus.c > > > @@ -1044,6 +1044,13 @@ int acpi_match_device_ids(struct acpi_device *device, > > > } > > > EXPORT_SYMBOL(acpi_match_device_ids); > > > > > > > Missing kerneldoc. > The same amount of kerneldoc as `acpi_match_device_ids`, if I am not > mistaken. > > > > > +int acpi_of_match_device_ids(struct acpi_device *device, > > > + const struct of_device_id *ids) > > > +{ > > > + return __acpi_match_device(device, NULL, ids, NULL, NULL) ? 0 : -ENOENT; > > > +} > > > +EXPORT_SYMBOL(acpi_of_match_device_ids); > > > > Are you aware of the consensus that using PRP0001 in production > > platform firmware will be regarded as invalid? > > > > Because of that, it is not an option for a driver to avoid providing > > ACPI match data on a platform that uses ACPI. > First of all, the driver that would have made use of it has been > restructed to not use mfd subdevices. It would not be affected anymore > through this patch set. So what exactly would be affected by it? > Not sure if I should still send it as its own patch series though. > > The device of the driver has no ACPI ID allocated by the manufacturer, > as it is only used on a proprietary Linux OS (with their own modified > kernel). Do I understand correctly that there is an ACPI platform firmware on the board, but it doesn't enumerate the given device properly (that is, as an ACPI device object with a specific device ID)? In which case there probably is a driver that can find that device somehow (it has hardcoded resources or similar). > The driver would have only been useful via device tree or an ACPI > Overlay. Do you mean a custom SSDT loaded via configfs or something else? > Obviously, I don't have a PNP or ACPI Vendor ID, so I can't > assign one. The parent/main driver does only have a of compatible id. > As it needs to use PRP0001 anyway on ACPI, I thought it makes more > sense to also use PRP0001 there instead of matching it with a _ADR > which is "a grey area in the ACPI specification". You can't match a device with _ADR. By itself, _ADR doesn't provide you with any information on the device in question, it only helps to connect it to some information that can be collected by other means. The role of it, at least in principle, is to allow some device objects in the ACPI hierarchy to be associated with devices enumerated by other means (like on a PCI bus). The enumeration with the help of PRP0001 only works if there is a device object in the ACPI hierarchy and its _HID is PRP0001 or its _CID list contains PRP0001, there is a _DSD under it and a "compatible" property is returned by that _DSD. Who's going to provide all of that for the given device? Moreover, if the device has some resources that the kernel needs to know about, there should be a _CRS under the device object in question and the resources should be listed there. Or how are the resources going to be found otherwise? ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH v3 3/7] acpi: add acpi_of_match_device_ids 2026-03-24 16:01 ` Rafael J. Wysocki @ 2026-03-24 16:26 ` Markus Probst 2026-03-24 17:39 ` Rafael J. Wysocki 0 siblings, 1 reply; 12+ messages in thread From: Markus Probst @ 2026-03-24 16:26 UTC (permalink / raw) To: Rafael J. Wysocki Cc: Lee Jones, Rob Herring, Krzysztof Kozlowski, Conor Dooley, Greg Kroah-Hartman, Miguel Ojeda, Boqun Feng, Gary Guo, Björn Roy Baron, Benno Lossin, Andreas Hindborg, Alice Ryhl, Trevor Gross, Danilo Krummrich, Igor Korotin, Daniel Almeida, Bjorn Helgaas, Krzysztof Wilczyński, Pavel Machek, Len Brown, Robert Moore, devicetree, linux-kernel, rust-for-linux, driver-core, linux-pci, linux-leds, linux-acpi, acpica-devel [-- Attachment #1: Type: text/plain, Size: 5419 bytes --] On Tue, 2026-03-24 at 17:01 +0100, Rafael J. Wysocki wrote: > On Tue, Mar 24, 2026 at 4:30 PM Markus Probst <markus.probst@posteo.de> wrote: > > > > On Mon, 2026-03-23 at 20:57 +0100, Rafael J. Wysocki wrote: > > > On Fri, Mar 13, 2026 at 8:03 PM Markus Probst via B4 Relay > > > <devnull+markus.probst.posteo.de@kernel.org> wrote: > > > > > > > > From: Markus Probst <markus.probst@posteo.de> > > > > > > > > Add a function to match acpi devices against of_device_ids. This will be > > > > used in the following commit ("mfd: match acpi devices against PRP0001") > > > > to match mfd sub-devices against a of compatible string. > > > > > > Please always spell ACPI in capitals in patch subjects, comments, > > > changelogs, etc. It is not a regular word. > > Ok. > > > > > > > Signed-off-by: Markus Probst <markus.probst@posteo.de> > > > > --- > > > > drivers/acpi/bus.c | 7 +++++++ > > > > include/acpi/acpi_bus.h | 2 ++ > > > > 2 files changed, 9 insertions(+) > > > > > > > > diff --git a/drivers/acpi/bus.c b/drivers/acpi/bus.c > > > > index f6707325f582..5ddcc56edc87 100644 > > > > --- a/drivers/acpi/bus.c > > > > +++ b/drivers/acpi/bus.c > > > > @@ -1044,6 +1044,13 @@ int acpi_match_device_ids(struct acpi_device *device, > > > > } > > > > EXPORT_SYMBOL(acpi_match_device_ids); > > > > > > > > > > Missing kerneldoc. > > The same amount of kerneldoc as `acpi_match_device_ids`, if I am not > > mistaken. > > > > > > > +int acpi_of_match_device_ids(struct acpi_device *device, > > > > + const struct of_device_id *ids) > > > > +{ > > > > + return __acpi_match_device(device, NULL, ids, NULL, NULL) ? 0 : -ENOENT; > > > > +} > > > > +EXPORT_SYMBOL(acpi_of_match_device_ids); > > > > > > Are you aware of the consensus that using PRP0001 in production > > > platform firmware will be regarded as invalid? > > > > > > Because of that, it is not an option for a driver to avoid providing > > > ACPI match data on a platform that uses ACPI. > > First of all, the driver that would have made use of it has been > > restructed to not use mfd subdevices. It would not be affected anymore > > through this patch set. > > So what exactly would be affected by it? I won't have a use for myself anymore, but I still think the patch is useful. Anyway, MFD Devices without an assigned ACPI ID, if they are present on devices with ACPI platform firmware. > > > Not sure if I should still send it as its own patch series though. That is why I asked this question (see 1. sentence in the paragraph above). > > > > The device of the driver has no ACPI ID allocated by the manufacturer, > > as it is only used on a proprietary Linux OS (with their own modified > > kernel). > > Do I understand correctly that there is an ACPI platform firmware on > the board, but it doesn't enumerate the given device properly (that > is, as an ACPI device object with a specific device ID)? There is only a serial device in the ACPI platform firmware. The device connected to the bus isn't specified. > > In which case there probably is a driver that can find that device > somehow (it has hardcoded resources or similar). Yes, that driver has `filp_open("/dev/ttyS1")` hardcoded. > > > The driver would have only been useful via device tree or an ACPI > > Overlay. > > Do you mean a custom SSDT loaded via configfs or something else? Yes, in my case via initrd. > > > Obviously, I don't have a PNP or ACPI Vendor ID, so I can't > > assign one. The parent/main driver does only have a of compatible id. > > As it needs to use PRP0001 anyway on ACPI, I thought it makes more > > sense to also use PRP0001 there instead of matching it with a _ADR > > which is "a grey area in the ACPI specification". > > You can't match a device with _ADR. By itself, _ADR doesn't provide > you with any information on the device in question, it only helps to > connect it to some information that can be collected by other means. > The role of it, at least in principle, is to allow some device objects > in the ACPI hierarchy to be associated with devices enumerated by > other means (like on a PCI bus). This patch affects mfd devices. A bus device can via mfd register child devices and those child devices will be matched to a fwnode if available. According to commit 98a3be44ffa67b812de7aa7aed9f2331edcfb1a5, there is a board on the market with a sub-device that will be matched using _ADR [1]. [1] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=98a3be44ffa67b812de7aa7aed9f2331edcfb1a5 > > The enumeration with the help of PRP0001 only works if there is a > device object in the ACPI hierarchy and its _HID is PRP0001 or its > _CID list contains PRP0001, there is a _DSD under it and a > "compatible" property is returned by that _DSD. Who's going to > provide all of that for the given device? A ACPI Overlay would do that. > > Moreover, if the device has some resources that the kernel needs to > know about, there should be a _CRS under the device object in question > and the resources should be listed there. Or how are the resources > going to be found otherwise? Resources in mfd are usually handled by the parent device, not the mfd child device. But yes, it would be using _CRS if any. Thanks - Markus Probst [-- Attachment #2: This is a digitally signed message part --] [-- Type: application/pgp-signature, Size: 870 bytes --] ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH v3 3/7] acpi: add acpi_of_match_device_ids 2026-03-24 16:26 ` Markus Probst @ 2026-03-24 17:39 ` Rafael J. Wysocki 0 siblings, 0 replies; 12+ messages in thread From: Rafael J. Wysocki @ 2026-03-24 17:39 UTC (permalink / raw) To: Markus Probst Cc: Rafael J. Wysocki, Lee Jones, Rob Herring, Krzysztof Kozlowski, Conor Dooley, Greg Kroah-Hartman, Miguel Ojeda, Boqun Feng, Gary Guo, Björn Roy Baron, Benno Lossin, Andreas Hindborg, Alice Ryhl, Trevor Gross, Danilo Krummrich, Igor Korotin, Daniel Almeida, Bjorn Helgaas, Krzysztof Wilczyński, Pavel Machek, Len Brown, Robert Moore, devicetree, linux-kernel, rust-for-linux, driver-core, linux-pci, linux-leds, linux-acpi, acpica-devel On Tue, Mar 24, 2026 at 5:26 PM Markus Probst <markus.probst@posteo.de> wrote: > > On Tue, 2026-03-24 at 17:01 +0100, Rafael J. Wysocki wrote: > > On Tue, Mar 24, 2026 at 4:30 PM Markus Probst <markus.probst@posteo.de> wrote: > > > > > > On Mon, 2026-03-23 at 20:57 +0100, Rafael J. Wysocki wrote: > > > > On Fri, Mar 13, 2026 at 8:03 PM Markus Probst via B4 Relay > > > > <devnull+markus.probst.posteo.de@kernel.org> wrote: > > > > > > > > > > From: Markus Probst <markus.probst@posteo.de> > > > > > > > > > > Add a function to match acpi devices against of_device_ids. This will be > > > > > used in the following commit ("mfd: match acpi devices against PRP0001") > > > > > to match mfd sub-devices against a of compatible string. > > > > > > > > Please always spell ACPI in capitals in patch subjects, comments, > > > > changelogs, etc. It is not a regular word. > > > Ok. > > > > > > > > > Signed-off-by: Markus Probst <markus.probst@posteo.de> > > > > > --- > > > > > drivers/acpi/bus.c | 7 +++++++ > > > > > include/acpi/acpi_bus.h | 2 ++ > > > > > 2 files changed, 9 insertions(+) > > > > > > > > > > diff --git a/drivers/acpi/bus.c b/drivers/acpi/bus.c > > > > > index f6707325f582..5ddcc56edc87 100644 > > > > > --- a/drivers/acpi/bus.c > > > > > +++ b/drivers/acpi/bus.c > > > > > @@ -1044,6 +1044,13 @@ int acpi_match_device_ids(struct acpi_device *device, > > > > > } > > > > > EXPORT_SYMBOL(acpi_match_device_ids); > > > > > > > > > > > > > Missing kerneldoc. > > > The same amount of kerneldoc as `acpi_match_device_ids`, if I am not > > > mistaken. > > > > > > > > > +int acpi_of_match_device_ids(struct acpi_device *device, > > > > > + const struct of_device_id *ids) > > > > > +{ > > > > > + return __acpi_match_device(device, NULL, ids, NULL, NULL) ? 0 : -ENOENT; > > > > > +} > > > > > +EXPORT_SYMBOL(acpi_of_match_device_ids); > > > > > > > > Are you aware of the consensus that using PRP0001 in production > > > > platform firmware will be regarded as invalid? > > > > > > > > Because of that, it is not an option for a driver to avoid providing > > > > ACPI match data on a platform that uses ACPI. > > > First of all, the driver that would have made use of it has been > > > restructed to not use mfd subdevices. It would not be affected anymore > > > through this patch set. > > > > So what exactly would be affected by it? > I won't have a use for myself anymore, but I still think the patch is > useful. Anyway, > > MFD Devices without an assigned ACPI ID, if they are present on devices > with ACPI platform firmware. > > > > > > Not sure if I should still send it as its own patch series though. > That is why I asked this question (see 1. sentence in the paragraph > above). > > > > > > > The device of the driver has no ACPI ID allocated by the manufacturer, > > > as it is only used on a proprietary Linux OS (with their own modified > > > kernel). > > > > Do I understand correctly that there is an ACPI platform firmware on > > the board, but it doesn't enumerate the given device properly (that > > is, as an ACPI device object with a specific device ID)? > There is only a serial device in the ACPI platform firmware. > The device connected to the bus isn't specified. > > > > In which case there probably is a driver that can find that device > > somehow (it has hardcoded resources or similar). > Yes, that driver has `filp_open("/dev/ttyS1")` hardcoded. > > > > > The driver would have only been useful via device tree or an ACPI > > > Overlay. > > > > Do you mean a custom SSDT loaded via configfs or something else? > Yes, in my case via initrd. > > > > > > Obviously, I don't have a PNP or ACPI Vendor ID, so I can't > > > assign one. The parent/main driver does only have a of compatible id. > > > As it needs to use PRP0001 anyway on ACPI, I thought it makes more > > > sense to also use PRP0001 there instead of matching it with a _ADR > > > which is "a grey area in the ACPI specification". > > > > You can't match a device with _ADR. By itself, _ADR doesn't provide > > you with any information on the device in question, it only helps to > > connect it to some information that can be collected by other means. > > The role of it, at least in principle, is to allow some device objects > > in the ACPI hierarchy to be associated with devices enumerated by > > other means (like on a PCI bus). > > This patch affects mfd devices. A bus device can via mfd register child > devices and those child devices will be matched to a fwnode if > available. That only works because the parent can be recognized and properly enumerated, so it is parent-relative. > According to commit 98a3be44ffa67b812de7aa7aed9f2331edcfb1a5, there is > a board on the market with a sub-device that will be matched using _ADR > [1]. With the help of a quirk though. > [1] > https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=98a3be44ffa67b812de7aa7aed9f2331edcfb1a5 > > > > > The enumeration with the help of PRP0001 only works if there is a > > device object in the ACPI hierarchy and its _HID is PRP0001 or its > > _CID list contains PRP0001, there is a _DSD under it and a > > "compatible" property is returned by that _DSD. Who's going to > > provide all of that for the given device? > A ACPI Overlay would do that. > > > > > Moreover, if the device has some resources that the kernel needs to > > know about, there should be a _CRS under the device object in question > > and the resources should be listed there. Or how are the resources > > going to be found otherwise? > Resources in mfd are usually handled by the parent device, not the mfd > child device. But yes, it would be using _CRS if any. So this is kind of a valid use case, but since you don't need it any more, I'd rather not put it in without a clear need. Also, it's not a huge deal for a vendor to allocate a proper ACPI device ID for a piece of hardware. It just involves some due diligence. ^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2026-03-24 17:40 UTC | newest] Thread overview: 12+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2026-03-13 18:48 [PATCH v3 0/7] Introduce Synology Microp driver Markus Probst 2026-03-13 18:48 ` [PATCH v3 1/7] rust: Add `parent_unchecked` function to `Device` Markus Probst 2026-03-13 18:48 ` [PATCH v3 2/7] rust: add basic mfd abstractions Markus Probst 2026-03-13 18:48 ` [PATCH v3 3/7] acpi: add acpi_of_match_device_ids Markus Probst 2026-03-13 18:57 ` Rafael J. Wysocki 2026-03-13 20:32 ` Markus Probst -- strict thread matches above, loose matches on Subject: below -- 2026-03-13 19:03 [PATCH v3 0/7] Introduce Synology Microp driver Markus Probst via B4 Relay 2026-03-13 19:03 ` [PATCH v3 3/7] acpi: add acpi_of_match_device_ids Markus Probst via B4 Relay 2026-03-23 19:57 ` Rafael J. Wysocki 2026-03-24 15:30 ` Markus Probst 2026-03-24 16:01 ` Rafael J. Wysocki 2026-03-24 16:26 ` Markus Probst 2026-03-24 17:39 ` Rafael J. Wysocki
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox