* [PATCH v2 0/5] Add Khadas MCU and fan control support for Khadas Edge 2
@ 2025-07-22 12:38 muhammed.efecetin.67
2025-07-22 12:38 ` [PATCH v2 1/5] dt-bindings: mfd: khadas-mcu: add new compatible " muhammed.efecetin.67
` (4 more replies)
0 siblings, 5 replies; 8+ messages in thread
From: muhammed.efecetin.67 @ 2025-07-22 12:38 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-v2" 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 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_V2 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 | 56 +++++++++++++-----
drivers/thermal/khadas_mcu_fan.c | 20 +++++--
include/linux/mfd/khadas-mcu.h | 32 ++++++++++
5 files changed, 152 insertions(+), 19 deletions(-)
--
2.50.1
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH v2 1/5] dt-bindings: mfd: khadas-mcu: add new compatible for Khadas Edge 2
2025-07-22 12:38 [PATCH v2 0/5] Add Khadas MCU and fan control support for Khadas Edge 2 muhammed.efecetin.67
@ 2025-07-22 12:38 ` muhammed.efecetin.67
2025-07-23 7:46 ` Krzysztof Kozlowski
2025-07-22 12:38 ` [PATCH v2 2/5] mfd: khadas-mcu: drop unused nvmem code muhammed.efecetin.67
` (3 subsequent siblings)
4 siblings, 1 reply; 8+ messages in thread
From: muhammed.efecetin.67 @ 2025-07-22 12:38 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-v2 compatible which is going to be used with Khadas
Edge 2 and potantially new Khadas boards like Vim4, using the same fan
control register.
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 084960fd5..fd57ed92c 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-v2 # Used by Edge2
"#cooling-cells": # Only needed for boards having FAN control feature
const: 2
--
2.50.1
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH v2 2/5] mfd: khadas-mcu: drop unused nvmem code
2025-07-22 12:38 [PATCH v2 0/5] Add Khadas MCU and fan control support for Khadas Edge 2 muhammed.efecetin.67
2025-07-22 12:38 ` [PATCH v2 1/5] dt-bindings: mfd: khadas-mcu: add new compatible " muhammed.efecetin.67
@ 2025-07-22 12:38 ` muhammed.efecetin.67
2025-07-22 12:38 ` [PATCH v2 3/5] mfd: add Khadas Edge 2 registers to khadas-mcu muhammed.efecetin.67
` (2 subsequent siblings)
4 siblings, 0 replies; 8+ messages in thread
From: muhammed.efecetin.67 @ 2025-07-22 12:38 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 ba981a788..ca4bd6cf5 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.50.1
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH v2 3/5] mfd: add Khadas Edge 2 registers to khadas-mcu.
2025-07-22 12:38 [PATCH v2 0/5] Add Khadas MCU and fan control support for Khadas Edge 2 muhammed.efecetin.67
2025-07-22 12:38 ` [PATCH v2 1/5] dt-bindings: mfd: khadas-mcu: add new compatible " muhammed.efecetin.67
2025-07-22 12:38 ` [PATCH v2 2/5] mfd: khadas-mcu: drop unused nvmem code muhammed.efecetin.67
@ 2025-07-22 12:38 ` muhammed.efecetin.67
2025-07-23 7:47 ` Krzysztof Kozlowski
2025-07-22 12:38 ` [PATCH v2 4/5] thermal: khadas_mcu_fan: add support for Khadas Edge 2 muhammed.efecetin.67
2025-07-22 12:38 ` [PATCH v2 5/5] arm64: dts: rockchip: add Khadas MCU and fan control nodes muhammed.efecetin.67
4 siblings, 1 reply; 8+ messages in thread
From: muhammed.efecetin.67 @ 2025-07-22 12:38 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_V2 register.
New "khadas,mcu-v2" 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 | 45 ++++++++++++++++++++++++++++++++--
include/linux/mfd/khadas-mcu.h | 32 ++++++++++++++++++++++++
2 files changed, 75 insertions(+), 2 deletions(-)
diff --git a/drivers/mfd/khadas-mcu.c b/drivers/mfd/khadas-mcu.c
index ca4bd6cf5..bc94de51d 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_v2(struct device *dev, unsigned int reg)
+{
+ switch (reg) {
+ case KHADAS_MCU_V2_SLEEP_EN_REG:
+ case KHADAS_MCU_V2_LED_ON_RAM_REG:
+ case KHADAS_MCU_V2_FAN_CTRL_REG:
+ case KHADAS_MCU_V2_WDT_EN_REG:
+ case KHADAS_MCU_V2_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_v2(struct device *dev, unsigned int reg)
+{
+ switch (reg) {
+ case KHADAS_MCU_V2_VERSION1_REG:
+ case KHADAS_MCU_V2_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_v2 = {
+ .reg_bits = 8,
+ .reg_stride = 1,
+ .val_bits = 8,
+ .max_register = KHADAS_MCU_V2_SYS_RST_REG,
+ .volatile_reg = khadas_mcu_reg_volatile_v2,
+ .writeable_reg = khadas_mcu_reg_writeable_v2,
+ .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);
+ if (of_device_is_compatible(dev->of_node, "khadas,mcu-v2"))
+ regmap_config = &khadas_mcu_regmap_config_v2;
+ else
+ regmap_config = &khadas_mcu_regmap_config;
+ 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);
@@ -113,6 +153,7 @@ 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-v2", },
{},
};
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 a99ba2ed0..077f18b52 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_V2_VERSION1_REG 0x12 /* RO */
+#define KHADAS_MCU_V2_VERSION2_REG 0x13 /* RO */
+#define KHADAS_MCU_V2_BOOT_MODE_REG 0x20 /* RW */
+#define KHADAS_MCU_V2_BOOT_EN_DCIN_REG 0x21 /* RW */
+#define KHADAS_MCU_V2_BOOT_EN_RTC_REG 0x22 /* RW */
+#define KHADAS_MCU_V2_LED_MODE_ON_REG 0x23 /* RW */
+#define KHADAS_MCU_V2_LED_MODE_OFF_REG 0x24 /* RW */
+#define KHADAS_MCU_V2_RGB_ON_R_REG 0x25 /* RW */
+#define KHADAS_MCU_V2_RGB_ON_G_REG 0x26 /* RW */
+#define KHADAS_MCU_V2_RGB_ON_B_REG 0x27 /* RW */
+#define KHADAS_MCU_V2_RGB_OFF_R_REG 0x28 /* RW */
+#define KHADAS_MCU_V2_RGB_OFF_G_REG 0x29 /* RW */
+#define KHADAS_MCU_V2_RGB_OFF_B_REG 0x2A /* RW */
+#define KHADAS_MCU_V2_REST_CONF_REG 0x2C /* WO */
+#define KHADAS_MCU_V2_SLEEP_EN_REG 0x2E /* RW */
+#define KHADAS_MCU_V2_BOOT_EN_IR_REG 0x2F /* RW */
+#define KHADAS_MCU_V2_IR1_CUST1_REG 0x30 /* RW */
+#define KHADAS_MCU_V2_IR1_CUST2_REG 0x31 /* RW */
+#define KHADAS_MCU_V2_IR1_ORDER1_REG 0x32 /* RW */
+#define KHADAS_MCU_V2_IR1_ORDER2_REG 0x33 /* RW */
+#define KHADAS_MCU_V2_IR2_CUST1_REG 0x34 /* RW */
+#define KHADAS_MCU_V2_IR2_CUST2_REG 0x35 /* RW */
+#define KHADAS_MCU_V2_IR2_ORDER1_REG 0x36 /* RW */
+#define KHADAS_MCU_V2_IR2_ORDER2_REG 0x37 /* RW */
+#define KHADAS_MCU_V2_LED_ON_RAM_REG 0x89 /* WO */
+#define KHADAS_MCU_V2_FAN_CTRL_REG 0x8A /* WO */
+#define KHADAS_MCU_V2_WDT_EN_REG 0x8B /* WO */
+#define KHADAS_MCU_V2_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.50.1
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH v2 4/5] thermal: khadas_mcu_fan: add support for Khadas Edge 2
2025-07-22 12:38 [PATCH v2 0/5] Add Khadas MCU and fan control support for Khadas Edge 2 muhammed.efecetin.67
` (2 preceding siblings ...)
2025-07-22 12:38 ` [PATCH v2 3/5] mfd: add Khadas Edge 2 registers to khadas-mcu muhammed.efecetin.67
@ 2025-07-22 12:38 ` muhammed.efecetin.67
2025-07-22 12:38 ` [PATCH v2 5/5] arm64: dts: rockchip: add Khadas MCU and fan control nodes muhammed.efecetin.67
4 siblings, 0 replies; 8+ messages in thread
From: muhammed.efecetin.67 @ 2025-07-22 12:38 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-v2 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 d35e5313b..f5c58be4f 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_V2 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-v2")) {
+ ctx->fan_ctrl_reg = KHADAS_MCU_V2_FAN_CTRL_REG;
+ ctx->max_level = MAX_LEVEL_V2;
+ }
+
platform_set_drvdata(pdev, ctx);
cdev = devm_thermal_of_cooling_device_register(dev->parent,
--
2.50.1
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH v2 5/5] arm64: dts: rockchip: add Khadas MCU and fan control nodes
2025-07-22 12:38 [PATCH v2 0/5] Add Khadas MCU and fan control support for Khadas Edge 2 muhammed.efecetin.67
` (3 preceding siblings ...)
2025-07-22 12:38 ` [PATCH v2 4/5] thermal: khadas_mcu_fan: add support for Khadas Edge 2 muhammed.efecetin.67
@ 2025-07-22 12:38 ` muhammed.efecetin.67
4 siblings, 0 replies; 8+ messages in thread
From: muhammed.efecetin.67 @ 2025-07-22 12:38 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 2c22abaf4..b51b64732 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-v2";
+ 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.50.1
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH v2 1/5] dt-bindings: mfd: khadas-mcu: add new compatible for Khadas Edge 2
2025-07-22 12:38 ` [PATCH v2 1/5] dt-bindings: mfd: khadas-mcu: add new compatible " muhammed.efecetin.67
@ 2025-07-23 7:46 ` Krzysztof Kozlowski
0 siblings, 0 replies; 8+ messages in thread
From: Krzysztof Kozlowski @ 2025-07-23 7:46 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
On Tue, Jul 22, 2025 at 03:38:11PM +0300, muhammed.efecetin.67@gmail.com wrote:
> From: Muhammed Efe Cetin <efectn@protonmail.com>
>
> Add new khadas,mcu-v2 compatible which is going to be used with Khadas
> Edge 2 and potantially new Khadas boards like Vim4, using the same fan
> control register.
>
> 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 084960fd5..fd57ed92c 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-v2 # Used by Edge2
You need documented versioning (provide a link/datasheet). Otherwise you
should use compatibles specific to the hardware, e.g. edge2
Best regards,
Krzysztof
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH v2 3/5] mfd: add Khadas Edge 2 registers to khadas-mcu.
2025-07-22 12:38 ` [PATCH v2 3/5] mfd: add Khadas Edge 2 registers to khadas-mcu muhammed.efecetin.67
@ 2025-07-23 7:47 ` Krzysztof Kozlowski
0 siblings, 0 replies; 8+ messages in thread
From: Krzysztof Kozlowski @ 2025-07-23 7:47 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
On Tue, Jul 22, 2025 at 03:38:13PM +0300, muhammed.efecetin.67@gmail.com wrote:
> 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);
> + if (of_device_is_compatible(dev->of_node, "khadas,mcu-v2"))
This does not scale. Use device match data for exactly this purpose.
> + regmap_config = &khadas_mcu_regmap_config_v2;
> + else
> + regmap_config = &khadas_mcu_regmap_config;
> + 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);
> @@ -113,6 +153,7 @@ 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-v2", },
So devices are 100% compatible? Empty match data suggests that...
Best regards,
Krzysztof
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2025-07-23 7:47 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-07-22 12:38 [PATCH v2 0/5] Add Khadas MCU and fan control support for Khadas Edge 2 muhammed.efecetin.67
2025-07-22 12:38 ` [PATCH v2 1/5] dt-bindings: mfd: khadas-mcu: add new compatible " muhammed.efecetin.67
2025-07-23 7:46 ` Krzysztof Kozlowski
2025-07-22 12:38 ` [PATCH v2 2/5] mfd: khadas-mcu: drop unused nvmem code muhammed.efecetin.67
2025-07-22 12:38 ` [PATCH v2 3/5] mfd: add Khadas Edge 2 registers to khadas-mcu muhammed.efecetin.67
2025-07-23 7:47 ` Krzysztof Kozlowski
2025-07-22 12:38 ` [PATCH v2 4/5] thermal: khadas_mcu_fan: add support for Khadas Edge 2 muhammed.efecetin.67
2025-07-22 12:38 ` [PATCH v2 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).