[PATCH v10 1/6] mfd: khadas-mcu: Add per-variant configuration infrastructure and VIM4 support
sashiko-bot at kernel.org
sashiko-bot at kernel.org
Tue Sep 1 08:36:14 PDT 2026
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Low] Introducing a bespoke platform data structure (`struct khadas_mcu_fan_pdata`) for parent-initialized private resources violates MFD decoupling guidelines.
--
commit 8a8b8fef22780db703282e4a267b644d5339157a
Author: Ronald Claveau <linux-kernel-dev at aliel.fr>
mfd: khadas-mcu: Add per-variant configuration infrastructure and VIM4 support
This commit adds structures and registers to support per-variant configuration
for the Khadas MCU, specifically adding VIM4 support. It introduces an enum
for device matching and a custom platform data structure to pass fan
configuration from the parent to the sub-driver.
> diff --git a/include/linux/mfd/khadas-mcu.h b/include/linux/mfd/khadas-mcu.h
> index a99ba2ed0e4e0..7a9980ea63e7e 100644
> --- a/include/linux/mfd/khadas-mcu.h
> +++ b/include/linux/mfd/khadas-mcu.h
[ ... ]
> @@ -88,4 +95,21 @@ struct khadas_mcu {
> struct regmap *regmap;
> };
>
> +/**
> + * struct khadas_mcu_fan_pdata - fan sub-driver configuration
> + * @fan_reg: register address to write the fan level
> + * @levels: table mapping logical cooling-device states to raw fan levels
> + * @nlevels: number of entries in @levels
> + */
> +struct khadas_mcu_fan_pdata {
> + unsigned int fan_reg;
> + const unsigned int *levels;
> + unsigned int nlevels;
> +};
[Severity: Low]
Does introducing this bespoke platform data structure for parent-initialized
private resources violate MFD decoupling guidelines?
The parent MFD driver is forced to handle fan-specific configuration (like
register addresses and levels) rather than being limited to genuinely shared
core resources. This creates tight coupling with the child driver and
violates the requirement that private resources be initialized directly in
the child.
> +
> +enum khadas_mcu_type {
> + KHADAS_MCU_GENERIC = 1, /* VIM1/2/3, Edge, Edge-V */
> + KHADAS_MCU_VIM4,
> +};
> +
> #endif /* MFD_KHADAS_MCU_H */
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260901-add-mcu-fan-khadas-vim4-v10-0-aecdb9955a30@aliel.fr?part=1
More information about the linux-amlogic
mailing list