devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v3 0/5] Add Khadas MCU and fan control support for Khadas Edge 2
@ 2025-10-21 15:22 muhammed.efecetin.67
  2025-10-21 15:22 ` [PATCH v3 1/5] dt-bindings: mfd: khadas-mcu: add new compatible " muhammed.efecetin.67
                   ` (4 more replies)
  0 siblings, 5 replies; 9+ messages in thread
From: muhammed.efecetin.67 @ 2025-10-21 15:22 UTC (permalink / raw)
  To: linux-rockchip
  Cc: devicetree, linux-arm-kernel, linux-kernel, robh+dt,
	krzysztof.kozlowski+dt, heiko, neil.armstrong, lee, rafael,
	efectn, daniel.lezcano

From: Muhammed Efe Cetin <efectn@protonmail.com>

This patch series adds support for the Khadas MCU and fan control for Khadas Edge 2 board.

The first patch updates the device tree bindings to add new "khadas,mcu-edge2" compatible for Khadas Edge 2.
The second mfd patch removes unused nvmem code.
The third patch adds the Khadas Edge 2 registers to the mfd driver.
The fourth patch adds support for Khadas Edge 2's new fan control registers to MCU thermal driver and the last one adds the Khadas Edge 2 device tree node for the MCU and fan control.
And the final patch adds the Khadas Edge 2 device tree node for the MCU and fan control.

Changes in v3:
- Renamed the compatible "khadas,mcu-v2" to "khadas,mcu-edge2" for Khadas Edge 2.
- Renamed KHADAS_MCU_V2 registers prefix to KHADAS_MCU_EDGE2.
- Used of_device_get_match_data instead of of_device_is_compatible to identify the MCU variant.

Changes in v2:
- Added a new compatible "khadas,mcu-v2" for Khadas Edge 2 instead of cooling-levels property in old variant.
- Added Khadas Edge 2 registers with KHADAS_MCU_EDGE2 prefix.

Muhammed Efe Cetin (5):
  dt-bindings: mfd: khadas-mcu: add new compatible for Khadas Edge 2
  mfd: khadas-mcu: drop unused nvmem code
  mfd: add Khadas Edge 2 registers to khadas-mcu.
  thermal: khadas_mcu_fan: add support for Khadas Edge 2
  arm64: dts: rockchip: add Khadas MCU and fan control nodes

 .../devicetree/bindings/mfd/khadas,mcu.yaml   |  5 +-
 .../dts/rockchip/rk3588s-khadas-edge2.dts     | 58 +++++++++++++++++++
 drivers/mfd/khadas-mcu.c                      | 58 ++++++++++++++-----
 drivers/thermal/khadas_mcu_fan.c              | 20 +++++--
 include/linux/mfd/khadas-mcu.h                | 32 ++++++++++
 5 files changed, 153 insertions(+), 20 deletions(-)

-- 
2.51.1.dirty


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH v3 1/5] dt-bindings: mfd: khadas-mcu: add new compatible for Khadas Edge 2
  2025-10-21 15:22 [PATCH v3 0/5] Add Khadas MCU and fan control support for Khadas Edge 2 muhammed.efecetin.67
@ 2025-10-21 15:22 ` muhammed.efecetin.67
  2025-10-22 17:37   ` Conor Dooley
  2025-10-21 15:22 ` [PATCH v3 2/5] mfd: khadas-mcu: drop unused nvmem code muhammed.efecetin.67
                   ` (3 subsequent siblings)
  4 siblings, 1 reply; 9+ messages in thread
From: muhammed.efecetin.67 @ 2025-10-21 15:22 UTC (permalink / raw)
  To: linux-rockchip
  Cc: devicetree, linux-arm-kernel, linux-kernel, robh+dt,
	krzysztof.kozlowski+dt, heiko, neil.armstrong, lee, rafael,
	efectn, daniel.lezcano

From: Muhammed Efe Cetin <efectn@protonmail.com>

Add new khadas,mcu-edge2 compatible which is going to be used with Khadas
Edge 2.

Signed-off-by: Muhammed Efe Cetin <efectn@protonmail.com>
---
 Documentation/devicetree/bindings/mfd/khadas,mcu.yaml | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/Documentation/devicetree/bindings/mfd/khadas,mcu.yaml b/Documentation/devicetree/bindings/mfd/khadas,mcu.yaml
index 084960fd5a1fd..c0f91eedfa8ab 100644
--- a/Documentation/devicetree/bindings/mfd/khadas,mcu.yaml
+++ b/Documentation/devicetree/bindings/mfd/khadas,mcu.yaml
@@ -11,13 +11,14 @@ maintainers:
 
 description: |
   Khadas embeds a microcontroller on their VIM and Edge boards adding some
-  system feature as PWM Fan control (for VIM2 rev14 or VIM3), User memory
+  system feature as PWM Fan control (for VIM2 rev14, VIM3, Edge2), User memory
   storage, IR/Key resume control, system power LED control and more.
 
 properties:
   compatible:
     enum:
-      - khadas,mcu # MCU revision is discoverable
+      - khadas,mcu    # Used by VIM2 rev14, VIM3
+      - khadas,mcu-edge2 # Used by Edge2
 
   "#cooling-cells": # Only needed for boards having FAN control feature
     const: 2
-- 
2.51.1.dirty


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH v3 2/5] mfd: khadas-mcu: drop unused nvmem code
  2025-10-21 15:22 [PATCH v3 0/5] Add Khadas MCU and fan control support for Khadas Edge 2 muhammed.efecetin.67
  2025-10-21 15:22 ` [PATCH v3 1/5] dt-bindings: mfd: khadas-mcu: add new compatible " muhammed.efecetin.67
@ 2025-10-21 15:22 ` muhammed.efecetin.67
  2025-10-21 15:22 ` [PATCH v3 3/5] mfd: add Khadas Edge 2 registers to khadas-mcu muhammed.efecetin.67
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 9+ messages in thread
From: muhammed.efecetin.67 @ 2025-10-21 15:22 UTC (permalink / raw)
  To: linux-rockchip
  Cc: devicetree, linux-arm-kernel, linux-kernel, robh+dt,
	krzysztof.kozlowski+dt, heiko, neil.armstrong, lee, rafael,
	efectn, daniel.lezcano

From: Muhammed Efe Cetin <efectn@protonmail.com>

Drop "khadas-mcu-user-mem" code since it is not used anywhere.

Signed-off-by: Muhammed Efe Cetin <efectn@protonmail.com>
Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>
---
 drivers/mfd/khadas-mcu.c | 11 -----------
 1 file changed, 11 deletions(-)

diff --git a/drivers/mfd/khadas-mcu.c b/drivers/mfd/khadas-mcu.c
index ba981a7886921..ca4bd6cf56994 100644
--- a/drivers/mfd/khadas-mcu.c
+++ b/drivers/mfd/khadas-mcu.c
@@ -80,10 +80,6 @@ static struct mfd_cell khadas_mcu_fan_cells[] = {
 	{ .name = "khadas-mcu-fan-ctrl", },
 };
 
-static struct mfd_cell khadas_mcu_cells[] = {
-	{ .name = "khadas-mcu-user-mem", },
-};
-
 static int khadas_mcu_probe(struct i2c_client *client)
 {
 	struct device *dev = &client->dev;
@@ -105,13 +101,6 @@ static int khadas_mcu_probe(struct i2c_client *client)
 		return ret;
 	}
 
-	ret = devm_mfd_add_devices(dev, PLATFORM_DEVID_NONE,
-				   khadas_mcu_cells,
-				   ARRAY_SIZE(khadas_mcu_cells),
-				   NULL, 0, NULL);
-	if (ret)
-		return ret;
-
 	if (of_property_present(dev->of_node, "#cooling-cells"))
 		return devm_mfd_add_devices(dev, PLATFORM_DEVID_NONE,
 					    khadas_mcu_fan_cells,
-- 
2.51.1.dirty


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH v3 3/5] mfd: add Khadas Edge 2 registers to khadas-mcu.
  2025-10-21 15:22 [PATCH v3 0/5] Add Khadas MCU and fan control support for Khadas Edge 2 muhammed.efecetin.67
  2025-10-21 15:22 ` [PATCH v3 1/5] dt-bindings: mfd: khadas-mcu: add new compatible " muhammed.efecetin.67
  2025-10-21 15:22 ` [PATCH v3 2/5] mfd: khadas-mcu: drop unused nvmem code muhammed.efecetin.67
@ 2025-10-21 15:22 ` muhammed.efecetin.67
  2025-10-22  7:18   ` kernel test robot
  2025-10-23  2:03   ` kernel test robot
  2025-10-21 15:22 ` [PATCH v3 4/5] thermal: khadas_mcu_fan: add support for Khadas Edge 2 muhammed.efecetin.67
  2025-10-21 15:22 ` [PATCH v3 5/5] arm64: dts: rockchip: add Khadas MCU and fan control nodes muhammed.efecetin.67
  4 siblings, 2 replies; 9+ messages in thread
From: muhammed.efecetin.67 @ 2025-10-21 15:22 UTC (permalink / raw)
  To: linux-rockchip
  Cc: devicetree, linux-arm-kernel, linux-kernel, robh+dt,
	krzysztof.kozlowski+dt, heiko, neil.armstrong, lee, rafael,
	efectn, daniel.lezcano

From: Muhammed Efe Cetin <efectn@protonmail.com>

Add Khadas Edge 2 MCU registers to khadas-mcu.h with KHADAS_MCU_EDGE2 register.
New "khadas,mcu-edge2" compatible added as it is quite different compared to older MCU variants
and there are no way to distinguish them using any register.

Signed-off-by: Muhammed Efe Cetin <efectn@protonmail.com>
---
 drivers/mfd/khadas-mcu.c       | 47 +++++++++++++++++++++++++++++++---
 include/linux/mfd/khadas-mcu.h | 32 +++++++++++++++++++++++
 2 files changed, 76 insertions(+), 3 deletions(-)

diff --git a/drivers/mfd/khadas-mcu.c b/drivers/mfd/khadas-mcu.c
index ca4bd6cf56994..8898f5ab6915a 100644
--- a/drivers/mfd/khadas-mcu.c
+++ b/drivers/mfd/khadas-mcu.c
@@ -32,6 +32,20 @@ static bool khadas_mcu_reg_volatile(struct device *dev, unsigned int reg)
 	}
 }
 
+static bool khadas_mcu_reg_volatile_edge2(struct device *dev, unsigned int reg)
+{
+	switch (reg) {
+	case KHADAS_MCU_EDGE2_SLEEP_EN_REG:
+	case KHADAS_MCU_EDGE2_LED_ON_RAM_REG:
+	case KHADAS_MCU_EDGE2_FAN_CTRL_REG:
+	case KHADAS_MCU_EDGE2_WDT_EN_REG:
+	case KHADAS_MCU_EDGE2_SYS_RST_REG:
+		return true;
+	default:
+		return false;
+	}
+}
+
 static bool khadas_mcu_reg_writeable(struct device *dev, unsigned int reg)
 {
 	switch (reg) {
@@ -65,6 +79,17 @@ static bool khadas_mcu_reg_writeable(struct device *dev, unsigned int reg)
 	}
 }
 
+static bool khadas_mcu_reg_writeable_edge2(struct device *dev, unsigned int reg)
+{
+	switch (reg) {
+	case KHADAS_MCU_EDGE2_VERSION1_REG:
+	case KHADAS_MCU_EDGE2_VERSION2_REG:
+		return false;
+	default:
+		return true;
+	}
+}
+
 static const struct regmap_config khadas_mcu_regmap_config = {
 	.reg_bits	= 8,
 	.reg_stride	= 1,
@@ -75,8 +100,18 @@ static const struct regmap_config khadas_mcu_regmap_config = {
 	.cache_type	= REGCACHE_MAPLE,
 };
 
+static const struct regmap_config khadas_mcu_regmap_config_edge2 = {
+	.reg_bits	= 8,
+	.reg_stride	= 1,
+	.val_bits	= 8,
+	.max_register	= KHADAS_MCU_EDGE2_SYS_RST_REG,
+	.volatile_reg	= khadas_mcu_reg_volatile_edge2,
+	.writeable_reg	= khadas_mcu_reg_writeable_edge2,
+	.cache_type	= REGCACHE_MAPLE,
+};
+
 static struct mfd_cell khadas_mcu_fan_cells[] = {
-	/* VIM1/2 Rev13+ and VIM3 only */
+	/* VIM1/2 Rev13+, VIM3 and Edge2 only */
 	{ .name = "khadas-mcu-fan-ctrl", },
 };
 
@@ -84,6 +119,7 @@ static int khadas_mcu_probe(struct i2c_client *client)
 {
 	struct device *dev = &client->dev;
 	struct khadas_mcu *ddata;
+	const struct regmap_config *regmap_config;
 	int ret;
 
 	ddata = devm_kzalloc(dev, sizeof(*ddata), GFP_KERNEL);
@@ -94,7 +130,11 @@ static int khadas_mcu_probe(struct i2c_client *client)
 
 	ddata->dev = dev;
 
-	ddata->regmap = devm_regmap_init_i2c(client, &khadas_mcu_regmap_config);
+	regmap_config = of_device_get_match_data(dev);
+	if (!regmap_config)
+		return -EINVAL;
+
+	ddata->regmap = devm_regmap_init_i2c(client, regmap_config);
 	if (IS_ERR(ddata->regmap)) {
 		ret = PTR_ERR(ddata->regmap);
 		dev_err(dev, "Failed to allocate register map: %d\n", ret);
@@ -112,7 +152,8 @@ static int khadas_mcu_probe(struct i2c_client *client)
 
 #ifdef CONFIG_OF
 static const struct of_device_id khadas_mcu_of_match[] = {
-	{ .compatible = "khadas,mcu", },
+	{ .compatible = "khadas,mcu", .data = &khadas_mcu_regmap_config },
+	{ .compatible = "khadas,mcu-edge2", .data = &khadas_mcu_regmap_config_edge2 },
 	{},
 };
 MODULE_DEVICE_TABLE(of, khadas_mcu_of_match);
diff --git a/include/linux/mfd/khadas-mcu.h b/include/linux/mfd/khadas-mcu.h
index a99ba2ed0e4e0..e278326451df6 100644
--- a/include/linux/mfd/khadas-mcu.h
+++ b/include/linux/mfd/khadas-mcu.h
@@ -10,6 +10,7 @@
 #ifndef MFD_KHADAS_MCU_H
 #define MFD_KHADAS_MCU_H
 
+/* Registers used by Khadas VIM2 rev14 and VIM3 */
 #define KHADAS_MCU_PASSWD_VEN_0_REG		0x00 /* RO */
 #define KHADAS_MCU_PASSWD_VEN_1_REG		0x01 /* RO */
 #define KHADAS_MCU_PASSWD_VEN_2_REG		0x02 /* RO */
@@ -70,12 +71,43 @@
 #define KHADAS_MCU_WOL_INIT_START_REG		0x87 /* WO */
 #define KHADAS_MCU_CMD_FAN_STATUS_CTRL_REG	0x88 /* WO */
 
+/* Registers used by Khadas Edge 2 */
+#define KHADAS_MCU_EDGE2_VERSION1_REG             0x12  /* RO */
+#define KHADAS_MCU_EDGE2_VERSION2_REG             0x13  /* RO */
+#define KHADAS_MCU_EDGE2_BOOT_MODE_REG            0x20  /* RW */
+#define KHADAS_MCU_EDGE2_BOOT_EN_DCIN_REG         0x21  /* RW */
+#define KHADAS_MCU_EDGE2_BOOT_EN_RTC_REG          0x22  /* RW */
+#define KHADAS_MCU_EDGE2_LED_MODE_ON_REG          0x23  /* RW */
+#define KHADAS_MCU_EDGE2_LED_MODE_OFF_REG         0x24  /* RW */
+#define KHADAS_MCU_EDGE2_RGB_ON_R_REG             0x25  /* RW */
+#define KHADAS_MCU_EDGE2_RGB_ON_G_REG             0x26  /* RW */
+#define KHADAS_MCU_EDGE2_RGB_ON_B_REG             0x27  /* RW */
+#define KHADAS_MCU_EDGE2_RGB_OFF_R_REG            0x28  /* RW */
+#define KHADAS_MCU_EDGE2_RGB_OFF_G_REG            0x29  /* RW */
+#define KHADAS_MCU_EDGE2_RGB_OFF_B_REG            0x2A  /* RW */
+#define KHADAS_MCU_EDGE2_REST_CONF_REG            0x2C  /* WO */
+#define KHADAS_MCU_EDGE2_SLEEP_EN_REG             0x2E  /* RW */
+#define KHADAS_MCU_EDGE2_BOOT_EN_IR_REG           0x2F  /* RW */
+#define KHADAS_MCU_EDGE2_IR1_CUST1_REG            0x30  /* RW */
+#define KHADAS_MCU_EDGE2_IR1_CUST2_REG            0x31  /* RW */
+#define KHADAS_MCU_EDGE2_IR1_ORDER1_REG           0x32  /* RW */
+#define KHADAS_MCU_EDGE2_IR1_ORDER2_REG           0x33  /* RW */
+#define KHADAS_MCU_EDGE2_IR2_CUST1_REG            0x34  /* RW */
+#define KHADAS_MCU_EDGE2_IR2_CUST2_REG            0x35  /* RW */
+#define KHADAS_MCU_EDGE2_IR2_ORDER1_REG           0x36  /* RW */
+#define KHADAS_MCU_EDGE2_IR2_ORDER2_REG           0x37  /* RW */
+#define KHADAS_MCU_EDGE2_LED_ON_RAM_REG           0x89  /* WO */
+#define KHADAS_MCU_EDGE2_FAN_CTRL_REG             0x8A  /* WO */
+#define KHADAS_MCU_EDGE2_WDT_EN_REG               0x8B  /* WO */
+#define KHADAS_MCU_EDGE2_SYS_RST_REG              0x91  /* WO */
+
 enum {
 	KHADAS_BOARD_VIM1 = 0x1,
 	KHADAS_BOARD_VIM2,
 	KHADAS_BOARD_VIM3,
 	KHADAS_BOARD_EDGE = 0x11,
 	KHADAS_BOARD_EDGE_V,
+	KHADAS_BOARD_EDGE2,
 };
 
 /**
-- 
2.51.1.dirty


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH v3 4/5] thermal: khadas_mcu_fan: add support for Khadas Edge 2
  2025-10-21 15:22 [PATCH v3 0/5] Add Khadas MCU and fan control support for Khadas Edge 2 muhammed.efecetin.67
                   ` (2 preceding siblings ...)
  2025-10-21 15:22 ` [PATCH v3 3/5] mfd: add Khadas Edge 2 registers to khadas-mcu muhammed.efecetin.67
@ 2025-10-21 15:22 ` muhammed.efecetin.67
  2025-10-21 15:22 ` [PATCH v3 5/5] arm64: dts: rockchip: add Khadas MCU and fan control nodes muhammed.efecetin.67
  4 siblings, 0 replies; 9+ messages in thread
From: muhammed.efecetin.67 @ 2025-10-21 15:22 UTC (permalink / raw)
  To: linux-rockchip
  Cc: devicetree, linux-arm-kernel, linux-kernel, robh+dt,
	krzysztof.kozlowski+dt, heiko, neil.armstrong, lee, rafael,
	efectn, daniel.lezcano

From: Muhammed Efe Cetin <efectn@protonmail.com>

Fan control on the Khadas Edge 2 is controlled with the 0x8A register,
using percentage values from 0 to 100, whereas there are only 3 constant
steps in previous Khadas boards. Therefore, i adjusted max_level and
fan_ctrl_reg when the mcu node is defined with khadas,mcu-edge2 compatible.

Signed-off-by: Muhammed Efe Cetin <efectn@protonmail.com>
---
 drivers/thermal/khadas_mcu_fan.c | 20 ++++++++++++++++----
 1 file changed, 16 insertions(+), 4 deletions(-)

diff --git a/drivers/thermal/khadas_mcu_fan.c b/drivers/thermal/khadas_mcu_fan.c
index d35e5313bea41..e3ac4fb6d1f82 100644
--- a/drivers/thermal/khadas_mcu_fan.c
+++ b/drivers/thermal/khadas_mcu_fan.c
@@ -15,10 +15,13 @@
 #include <linux/thermal.h>
 
 #define MAX_LEVEL 3
+#define MAX_LEVEL_EDGE2 100
 
 struct khadas_mcu_fan_ctx {
 	struct khadas_mcu *mcu;
 	unsigned int level;
+	unsigned int max_level;
+	unsigned int fan_ctrl_reg;
 	struct thermal_cooling_device *cdev;
 };
 
@@ -26,8 +29,7 @@ static int khadas_mcu_fan_set_level(struct khadas_mcu_fan_ctx *ctx,
 				    unsigned int level)
 {
 	int ret;
-
-	ret = regmap_write(ctx->mcu->regmap, KHADAS_MCU_CMD_FAN_STATUS_CTRL_REG,
+	ret = regmap_write(ctx->mcu->regmap, ctx->fan_ctrl_reg,
 			   level);
 	if (ret)
 		return ret;
@@ -40,7 +42,9 @@ static int khadas_mcu_fan_set_level(struct khadas_mcu_fan_ctx *ctx,
 static int khadas_mcu_fan_get_max_state(struct thermal_cooling_device *cdev,
 					unsigned long *state)
 {
-	*state = MAX_LEVEL;
+	struct khadas_mcu_fan_ctx *ctx = cdev->devdata;
+
+	*state = ctx->max_level;
 
 	return 0;
 }
@@ -61,7 +65,7 @@ khadas_mcu_fan_set_cur_state(struct thermal_cooling_device *cdev,
 {
 	struct khadas_mcu_fan_ctx *ctx = cdev->devdata;
 
-	if (state > MAX_LEVEL)
+	if (state > ctx->max_level)
 		return -EINVAL;
 
 	if (state == ctx->level)
@@ -88,6 +92,14 @@ static int khadas_mcu_fan_probe(struct platform_device *pdev)
 	if (!ctx)
 		return -ENOMEM;
 	ctx->mcu = mcu;
+	ctx->max_level = MAX_LEVEL;
+	ctx->fan_ctrl_reg = KHADAS_MCU_CMD_FAN_STATUS_CTRL_REG;
+
+	if (of_device_is_compatible(mcu->dev->of_node, "khadas,mcu-edge2")) {
+		ctx->fan_ctrl_reg = KHADAS_MCU_EDGE2_FAN_CTRL_REG;
+		ctx->max_level = MAX_LEVEL_EDGE2;
+	}
+
 	platform_set_drvdata(pdev, ctx);
 
 	cdev = devm_thermal_of_cooling_device_register(dev->parent,
-- 
2.51.1.dirty


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH v3 5/5] arm64: dts: rockchip: add Khadas MCU and fan control nodes
  2025-10-21 15:22 [PATCH v3 0/5] Add Khadas MCU and fan control support for Khadas Edge 2 muhammed.efecetin.67
                   ` (3 preceding siblings ...)
  2025-10-21 15:22 ` [PATCH v3 4/5] thermal: khadas_mcu_fan: add support for Khadas Edge 2 muhammed.efecetin.67
@ 2025-10-21 15:22 ` muhammed.efecetin.67
  4 siblings, 0 replies; 9+ messages in thread
From: muhammed.efecetin.67 @ 2025-10-21 15:22 UTC (permalink / raw)
  To: linux-rockchip
  Cc: devicetree, linux-arm-kernel, linux-kernel, robh+dt,
	krzysztof.kozlowski+dt, heiko, neil.armstrong, lee, rafael,
	efectn, daniel.lezcano

From: Muhammed Efe Cetin <efectn@protonmail.com>

Add Khadas MCU fan control to Khadas Edge 2 with 4 fan control levels.

Signed-off-by: Muhammed Efe Cetin <efectn@protonmail.com>
---
 .../dts/rockchip/rk3588s-khadas-edge2.dts     | 58 +++++++++++++++++++
 1 file changed, 58 insertions(+)

diff --git a/arch/arm64/boot/dts/rockchip/rk3588s-khadas-edge2.dts b/arch/arm64/boot/dts/rockchip/rk3588s-khadas-edge2.dts
index 2c22abaf40a82..ed5168d50e182 100644
--- a/arch/arm64/boot/dts/rockchip/rk3588s-khadas-edge2.dts
+++ b/arch/arm64/boot/dts/rockchip/rk3588s-khadas-edge2.dts
@@ -271,12 +271,70 @@ hym8563: rtc@51 {
 		clock-output-names = "hym8563";
 		wakeup-source;
 	};
+
+	khadas_mcu: system-controller@18 {
+		compatible = "khadas,mcu-edge2";
+		reg = <0x18>;
+		#cooling-cells = <2>;
+	};
 };
 
 &i2s5_8ch {
 	status = "okay";
 };
 
+&package_thermal {
+	polling-delay = <2000>;
+
+	trips {
+		package_fan0: package-fan0 {
+			temperature = <50000>;
+			hysteresis = <5000>;
+			type = "active";
+		};
+
+		package_fan1: package-fan1 {
+			temperature = <60000>;
+			hysteresis = <5000>;
+			type = "active";
+		};
+
+		package_fan2: package-fan2 {
+			temperature = <65000>;
+			hysteresis = <5000>;
+			type = "active";
+		};
+
+		package_fan3: package-fan3 {
+			temperature = <75000>;
+			hysteresis = <5000>;
+			type = "active";
+		};
+	};
+
+	cooling-maps {
+		map0 {
+			trip = <&package_fan0>;
+			cooling-device = <&khadas_mcu THERMAL_NO_LIMIT 50>;
+		};
+
+		map1 {
+			trip = <&package_fan1>;
+			cooling-device = <&khadas_mcu 50 72>;
+		};
+
+		map2 {
+			trip = <&package_fan2>;
+			cooling-device = <&khadas_mcu 72 100>;
+		};
+
+		map3 {
+			trip = <&package_fan3>;
+			cooling-device = <&khadas_mcu 100 THERMAL_NO_LIMIT>;
+		};
+	};
+};
+
 &pd_gpu {
 	domain-supply = <&vdd_gpu_s0>;
 };
-- 
2.51.1.dirty


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [PATCH v3 3/5] mfd: add Khadas Edge 2 registers to khadas-mcu.
  2025-10-21 15:22 ` [PATCH v3 3/5] mfd: add Khadas Edge 2 registers to khadas-mcu muhammed.efecetin.67
@ 2025-10-22  7:18   ` kernel test robot
  2025-10-23  2:03   ` kernel test robot
  1 sibling, 0 replies; 9+ messages in thread
From: kernel test robot @ 2025-10-22  7:18 UTC (permalink / raw)
  To: muhammed.efecetin.67, linux-rockchip
  Cc: llvm, oe-kbuild-all, devicetree, linux-arm-kernel, linux-kernel,
	robh+dt, krzysztof.kozlowski+dt, heiko, neil.armstrong, lee,
	rafael, efectn, daniel.lezcano

Hi,

kernel test robot noticed the following build warnings:

[auto build test WARNING on lee-mfd/for-mfd-next]
[also build test WARNING on lee-mfd/for-mfd-fixes rockchip/for-next rafael-pm/thermal linus/master v6.18-rc2 next-20251022]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/muhammed-efecetin-67-gmail-com/dt-bindings-mfd-khadas-mcu-add-new-compatible-for-Khadas-Edge-2/20251021-232554
base:   https://git.kernel.org/pub/scm/linux/kernel/git/lee/mfd.git for-mfd-next
patch link:    https://lore.kernel.org/r/adbd6dd5e9ed938bab7927597b7f21eca3274b78.1761059314.git.efectn%40protonmail.com
patch subject: [PATCH v3 3/5] mfd: add Khadas Edge 2 registers to khadas-mcu.
config: i386-buildonly-randconfig-002-20251022 (https://download.01.org/0day-ci/archive/20251022/202510221512.9Ji8w2KZ-lkp@intel.com/config)
compiler: clang version 20.1.8 (https://github.com/llvm/llvm-project 87f0227cb60147a26a1eeb4fb06e3b505e9c7261)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20251022/202510221512.9Ji8w2KZ-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202510221512.9Ji8w2KZ-lkp@intel.com/

All warnings (new ones prefixed by >>):

>> drivers/mfd/khadas-mcu.c:93:35: warning: unused variable 'khadas_mcu_regmap_config' [-Wunused-const-variable]
      93 | static const struct regmap_config khadas_mcu_regmap_config = {
         |                                   ^~~~~~~~~~~~~~~~~~~~~~~~
>> drivers/mfd/khadas-mcu.c:103:35: warning: unused variable 'khadas_mcu_regmap_config_edge2' [-Wunused-const-variable]
     103 | static const struct regmap_config khadas_mcu_regmap_config_edge2 = {
         |                                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   2 warnings generated.


vim +/khadas_mcu_regmap_config +93 drivers/mfd/khadas-mcu.c

54c97b83897fb1 Muhammed Efe Cetin 2025-10-21   92  
6c27219e349116 Neil Armstrong     2020-06-08  @93  static const struct regmap_config khadas_mcu_regmap_config = {
6c27219e349116 Neil Armstrong     2020-06-08   94  	.reg_bits	= 8,
6c27219e349116 Neil Armstrong     2020-06-08   95  	.reg_stride	= 1,
6c27219e349116 Neil Armstrong     2020-06-08   96  	.val_bits	= 8,
6c27219e349116 Neil Armstrong     2020-06-08   97  	.max_register	= KHADAS_MCU_CMD_FAN_STATUS_CTRL_REG,
6c27219e349116 Neil Armstrong     2020-06-08   98  	.volatile_reg	= khadas_mcu_reg_volatile,
6c27219e349116 Neil Armstrong     2020-06-08   99  	.writeable_reg	= khadas_mcu_reg_writeable,
14100f8e58564d Bo Liu             2024-02-06  100  	.cache_type	= REGCACHE_MAPLE,
6c27219e349116 Neil Armstrong     2020-06-08  101  };
6c27219e349116 Neil Armstrong     2020-06-08  102  
54c97b83897fb1 Muhammed Efe Cetin 2025-10-21 @103  static const struct regmap_config khadas_mcu_regmap_config_edge2 = {
54c97b83897fb1 Muhammed Efe Cetin 2025-10-21  104  	.reg_bits	= 8,
54c97b83897fb1 Muhammed Efe Cetin 2025-10-21  105  	.reg_stride	= 1,
54c97b83897fb1 Muhammed Efe Cetin 2025-10-21  106  	.val_bits	= 8,
54c97b83897fb1 Muhammed Efe Cetin 2025-10-21  107  	.max_register	= KHADAS_MCU_EDGE2_SYS_RST_REG,
54c97b83897fb1 Muhammed Efe Cetin 2025-10-21  108  	.volatile_reg	= khadas_mcu_reg_volatile_edge2,
54c97b83897fb1 Muhammed Efe Cetin 2025-10-21  109  	.writeable_reg	= khadas_mcu_reg_writeable_edge2,
54c97b83897fb1 Muhammed Efe Cetin 2025-10-21  110  	.cache_type	= REGCACHE_MAPLE,
54c97b83897fb1 Muhammed Efe Cetin 2025-10-21  111  };
54c97b83897fb1 Muhammed Efe Cetin 2025-10-21  112  

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH v3 1/5] dt-bindings: mfd: khadas-mcu: add new compatible for Khadas Edge 2
  2025-10-21 15:22 ` [PATCH v3 1/5] dt-bindings: mfd: khadas-mcu: add new compatible " muhammed.efecetin.67
@ 2025-10-22 17:37   ` Conor Dooley
  0 siblings, 0 replies; 9+ messages in thread
From: Conor Dooley @ 2025-10-22 17:37 UTC (permalink / raw)
  To: muhammed.efecetin.67
  Cc: linux-rockchip, devicetree, linux-arm-kernel, linux-kernel,
	robh+dt, krzysztof.kozlowski+dt, heiko, neil.armstrong, lee,
	rafael, efectn, daniel.lezcano

[-- Attachment #1: Type: text/plain, Size: 369 bytes --]

On Tue, Oct 21, 2025 at 05:22:41PM +0200, muhammed.efecetin.67@gmail.com wrote:
> From: Muhammed Efe Cetin <efectn@protonmail.com>
> 
> Add new khadas,mcu-edge2 compatible which is going to be used with Khadas
> Edge 2.
> 
> Signed-off-by: Muhammed Efe Cetin <efectn@protonmail.com>

Acked-by: Conor Dooley <conor.dooley@microchip.com>
pw-bot: not-applicable

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH v3 3/5] mfd: add Khadas Edge 2 registers to khadas-mcu.
  2025-10-21 15:22 ` [PATCH v3 3/5] mfd: add Khadas Edge 2 registers to khadas-mcu muhammed.efecetin.67
  2025-10-22  7:18   ` kernel test robot
@ 2025-10-23  2:03   ` kernel test robot
  1 sibling, 0 replies; 9+ messages in thread
From: kernel test robot @ 2025-10-23  2:03 UTC (permalink / raw)
  To: muhammed.efecetin.67, linux-rockchip
  Cc: oe-kbuild-all, devicetree, linux-arm-kernel, linux-kernel,
	robh+dt, krzysztof.kozlowski+dt, heiko, neil.armstrong, lee,
	rafael, efectn, daniel.lezcano

Hi,

kernel test robot noticed the following build warnings:

[auto build test WARNING on lee-mfd/for-mfd-next]
[also build test WARNING on lee-mfd/for-mfd-fixes rockchip/for-next rafael-pm/thermal linus/master v6.18-rc2 next-20251022]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/muhammed-efecetin-67-gmail-com/dt-bindings-mfd-khadas-mcu-add-new-compatible-for-Khadas-Edge-2/20251021-232554
base:   https://git.kernel.org/pub/scm/linux/kernel/git/lee/mfd.git for-mfd-next
patch link:    https://lore.kernel.org/r/adbd6dd5e9ed938bab7927597b7f21eca3274b78.1761059314.git.efectn%40protonmail.com
patch subject: [PATCH v3 3/5] mfd: add Khadas Edge 2 registers to khadas-mcu.
config: x86_64-buildonly-randconfig-002-20251023 (https://download.01.org/0day-ci/archive/20251023/202510230921.N0ezsPtO-lkp@intel.com/config)
compiler: gcc-13 (Debian 13.3.0-16) 13.3.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20251023/202510230921.N0ezsPtO-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202510230921.N0ezsPtO-lkp@intel.com/

All warnings (new ones prefixed by >>):

>> drivers/mfd/khadas-mcu.c:103:35: warning: 'khadas_mcu_regmap_config_edge2' defined but not used [-Wunused-const-variable=]
     103 | static const struct regmap_config khadas_mcu_regmap_config_edge2 = {
         |                                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> drivers/mfd/khadas-mcu.c:93:35: warning: 'khadas_mcu_regmap_config' defined but not used [-Wunused-const-variable=]
      93 | static const struct regmap_config khadas_mcu_regmap_config = {
         |                                   ^~~~~~~~~~~~~~~~~~~~~~~~


vim +/khadas_mcu_regmap_config_edge2 +103 drivers/mfd/khadas-mcu.c

    92	
  > 93	static const struct regmap_config khadas_mcu_regmap_config = {
    94		.reg_bits	= 8,
    95		.reg_stride	= 1,
    96		.val_bits	= 8,
    97		.max_register	= KHADAS_MCU_CMD_FAN_STATUS_CTRL_REG,
    98		.volatile_reg	= khadas_mcu_reg_volatile,
    99		.writeable_reg	= khadas_mcu_reg_writeable,
   100		.cache_type	= REGCACHE_MAPLE,
   101	};
   102	
 > 103	static const struct regmap_config khadas_mcu_regmap_config_edge2 = {
   104		.reg_bits	= 8,
   105		.reg_stride	= 1,
   106		.val_bits	= 8,
   107		.max_register	= KHADAS_MCU_EDGE2_SYS_RST_REG,
   108		.volatile_reg	= khadas_mcu_reg_volatile_edge2,
   109		.writeable_reg	= khadas_mcu_reg_writeable_edge2,
   110		.cache_type	= REGCACHE_MAPLE,
   111	};
   112	

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2025-10-23  2:03 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-10-21 15:22 [PATCH v3 0/5] Add Khadas MCU and fan control support for Khadas Edge 2 muhammed.efecetin.67
2025-10-21 15:22 ` [PATCH v3 1/5] dt-bindings: mfd: khadas-mcu: add new compatible " muhammed.efecetin.67
2025-10-22 17:37   ` Conor Dooley
2025-10-21 15:22 ` [PATCH v3 2/5] mfd: khadas-mcu: drop unused nvmem code muhammed.efecetin.67
2025-10-21 15:22 ` [PATCH v3 3/5] mfd: add Khadas Edge 2 registers to khadas-mcu muhammed.efecetin.67
2025-10-22  7:18   ` kernel test robot
2025-10-23  2:03   ` kernel test robot
2025-10-21 15:22 ` [PATCH v3 4/5] thermal: khadas_mcu_fan: add support for Khadas Edge 2 muhammed.efecetin.67
2025-10-21 15:22 ` [PATCH v3 5/5] arm64: dts: rockchip: add Khadas MCU and fan control nodes muhammed.efecetin.67

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).