From nobody Tue Apr 7 14:06:31 2026 Received: from courrier.aliel.fr (courrier.aliel.fr [65.21.61.41]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2E6823CB2C1; Fri, 3 Apr 2026 16:09:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=65.21.61.41 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775232566; cv=none; b=klj1iYbbPZXoMUxf/5eiHq1LMmt54c1Ceg6RD8yMeD2VaMDyxWSSLoDnDs4jRVoJ6vG30FvoN57yOhhjuy1WAu1ujCMaoYIBHbOYJHh6dHCEZHigPlGZ6VhKznb8KWKApEOwcNnKuQLJJCaaDY5clztcVqouj3oHAOi2arw3E/E= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775232566; c=relaxed/simple; bh=OW1b2Q/DJTEMxPikE6mdf/p+H5KyL7TPJwoR6k9njCc=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=XASUNmuklp0ZNBL2aGVml1la/zL6JdRy5os7E3RY2VCn9K9mlY7g7oKHbzg7620S9PqeTMxvsKn/zD6HaBanWAkYceQphsYkNdSPolBYo+mSF0EJnkKk6WXWYwhAatLdEpw8D70zxSS84Uv49ZrvVZkdPmPTehgUA200rNPLjEA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=aliel.fr; spf=pass smtp.mailfrom=aliel.fr; dkim=pass (1024-bit key) header.d=aliel.fr header.i=@aliel.fr header.b=PfXZMFwX; arc=none smtp.client-ip=65.21.61.41 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=aliel.fr Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=aliel.fr Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=aliel.fr header.i=@aliel.fr header.b="PfXZMFwX" From: Ronald Claveau DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=aliel.fr; s=courrier-s1; t=1775232558; bh=OW1b2Q/DJTEMxPikE6mdf/p+H5KyL7TPJwoR6k9njCc=; h=From:Date:Subject:References:In-Reply-To:To:Cc; b=PfXZMFwXIsrCSGosZonVrGVmWJ+K0tfoIGVOLJTEZHqMjOd1C8y7YNQGoV8BBdDKM Aqz3mhfR4tgb4+gUt9kiMeDc1oE/jey/DwxU6JhX9Iv9IjvpJ4p1M04P75gqUs36Wk Tqf+o8kbtjCbPThDXxmj8zY2tolXEyosnTrrINWc= Date: Fri, 03 Apr 2026 18:08:36 +0200 Subject: [PATCH v2 3/8] mfd: khadas-mcu: Add per-variant configuration infrastructure and VIM4 support Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260403-add-mcu-fan-khadas-vim4-v2-3-70536b22439a@aliel.fr> References: <20260403-add-mcu-fan-khadas-vim4-v2-0-70536b22439a@aliel.fr> In-Reply-To: <20260403-add-mcu-fan-khadas-vim4-v2-0-70536b22439a@aliel.fr> To: Neil Armstrong , Lee Jones , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Andi Shyti , Kevin Hilman , Jerome Brunet , Martin Blumenstingl , Beniamino Galvani , "Rafael J. Wysocki" , Daniel Lezcano , Zhang Rui , Lukasz Luba , Liam Girdwood , Mark Brown Cc: linux-amlogic@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-i2c@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-pm@vger.kernel.org, Ronald Claveau X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=openssh-sha256; t=1775232552; l=2417; i=linux-kernel-dev@aliel.fr; s=id_ed25519; h=from:subject:message-id; bh=OW1b2Q/DJTEMxPikE6mdf/p+H5KyL7TPJwoR6k9njCc=; b=U1NIU0lHAAAAAQAAADMAAAALc3NoLWVkMjU1MTkAAAAgMGec55oxeeisqykQiUedekMYyOnR9 BG9E/7rDWyqdNoAAAAGcGF0YXR0AAAAAAAAAAZzaGE1MTIAAABTAAAAC3NzaC1lZDI1NTE5AAAA QBYAqg8sMjvR+NKLPDE6Tj+YQsbEym15keBIbm65muteVJUAKrgLJTN7ouhVTiko2nYSYH9FP00 fFT0k7WtOXQc= X-Developer-Key: i=linux-kernel-dev@aliel.fr; a=openssh; fpr=SHA256:kch4osYZ6A1BrPps5AUs6KnfdE2wm4ocMtyTc8TmZMs Introduce a per-variant configuration structure (khadas_mcu_data) holding the regmap config and MFD cells, selected at probe time via the of_device_id match data. This makes adding other variants straightforward. Also introduce khadas_mcu_fan_pdata to pass fan register address and maximum level to the fan sub-driver, removing the hardcoded constants. Signed-off-by: Ronald Claveau --- include/linux/mfd/khadas-mcu.h | 39 +++++++++++++++++++++++++++++++++++++-- 1 file changed, 37 insertions(+), 2 deletions(-) diff --git a/include/linux/mfd/khadas-mcu.h b/include/linux/mfd/khadas-mcu.h index a99ba2ed0e4e0..75e275d3fa8d9 100644 --- a/include/linux/mfd/khadas-mcu.h +++ b/include/linux/mfd/khadas-mcu.h @@ -70,6 +70,13 @@ #define KHADAS_MCU_WOL_INIT_START_REG 0x87 /* WO */ #define KHADAS_MCU_CMD_FAN_STATUS_CTRL_REG 0x88 /* WO */ =20 +/* VIM4 specific registers */ +#define KHADAS_MCU_VIM4_REST_CONF_REG 0x2c /* WO - reset EEPROM */ +#define KHADAS_MCU_VIM4_LED_ON_RAM_REG 0x89 /* WO - LED volatile */ +#define KHADAS_MCU_VIM4_FAN_CTRL_REG 0x8a /* WO */ +#define KHADAS_MCU_VIM4_WDT_EN_REG 0x8b /* WO */ +#define KHADAS_MCU_VIM4_SYS_RST_REG 0x91 /* WO */ + enum { KHADAS_BOARD_VIM1 =3D 0x1, KHADAS_BOARD_VIM2, @@ -82,10 +89,38 @@ enum { * struct khadas_mcu - Khadas MCU structure * @device: device reference used for logs * @regmap: register map + * @data: pointer to variant-specific config */ struct khadas_mcu { - struct device *dev; - struct regmap *regmap; + struct device *dev; + struct regmap *regmap; + const struct khadas_mcu_data *data; +}; + +/** + * struct khadas_mcu_data - per-variant configuration + * @regmap_config: regmap configuration + * @cells: MFD sub-devices + * @ncells: number of sub-devices + * @fan_cells: MFD fan sub-devices + * @nfan_cells: number of fan sub-devices + */ +struct khadas_mcu_data { + const struct regmap_config *regmap_config; + const struct mfd_cell *cells; + int ncells; + const struct mfd_cell *fan_cells; + int nfan_cells; +}; + +/** + * struct khadas_mcu_fan_pdata - fan sub-driver configuration + * @fan_reg: register address to write the fan level + * @max_level: maximum fan level + */ +struct khadas_mcu_fan_pdata { + unsigned int fan_reg; + unsigned int max_level; }; =20 #endif /* MFD_KHADAS_MCU_H */ --=20 2.49.0