Skip to contentSkip to conversation

*mfd: Add support for Khadas Microcontroller

PATCH Applied Neil Armstrong 3 participants 6 messages Jun 24, 2020 – Jul 2, 2020

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

v5 cover *mfd: Add support for Khadas Microcontroller

The new Khadas VIM2, VIM3 and Edge boards embeds an on-board microcontroller connected via I2C.

This Microcontroller is present on the Khadas VIM1, VIM2, VIM3 and Edge boards.

It has multiple boot control features like password check, power-on options, power-off control and system FAN control on recent boards.

Thie serie adds :
- the Thermal Cooling cell driver
- add support into the Khadas VIM3/VIM3L DT

Changes since v4 at [5]:
- Removed ctx checks in thermal driver
- Removed the useless khadas_mcu_fan_disable() helper in thermal driver
- Fixed a small indentation issue in thermal driver

Changes since v3 at [4]:
- Removed Applied patches 1, 2 & 4
- Added reviewed-by tags for patch 3 & 5

Changes since v2 at [3]:
- Removed NVMEM driver for separate submission
- fixed MFD driver, header and Kconfig
- fixed Thermal Kconfig
- fixed MAINTAINERS files and path

Changes since RFC v1 at [2]:
- moved hwmon driver to thermal-only
- moved the SM1 thermal nodes in a separate serie
- added the bindings review tag from rob

[1] http://lore.kernel.org/r/[email protected]
[2] http://lore.kernel.org/r/[email protected]
[3] http://lore.kernel.org/r/[email protected]
[4] http://lore.kernel.org/r/[email protected]
[5] http://lore.kernel.org/r/[email protected]

Neil Armstrong (2):
thermal: add support for the MCU controlled FAN on Khadas boards
arm64: dts: meson-khadas-vim3: add Khadas MCU nodes

 .../boot/dts/amlogic/meson-khadas-vim3.dtsi   |  23 +++
 drivers/thermal/Kconfig                       |  11 ++
 drivers/thermal/Makefile                      |   1 +
 drivers/thermal/khadas_mcu_fan.c              | 162 ++++++++++++++++++
 4 files changed, 197 insertions(+)
 create mode 100644 drivers/thermal/khadas_mcu_fan.c
Signature · 7 lines
2.22.0


_______________________________________________
linux-amlogic mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-amlogic
#1 lore raw

PATCH v5 1/2 thermal: add support for the MCU controlled FAN on Khadas boards

The new Khadas VIM2 and VIM3 boards controls the cooling fan via the on-board microcontroller.

This implements the FAN control as thermal devices and as cell of the Khadas MCU MFD driver.

---
Hi Daniel,

Is it ok Lee applies this patch via the MFD tree since it depends on the linux/mfd/khadas-mcu.h header ?

Thanks,
Neil

 drivers/thermal/Kconfig          |  11 +++
 drivers/thermal/Makefile         |   1 +
 drivers/thermal/khadas_mcu_fan.c | 162 +++++++++++++++++++++++++++++++
 3 files changed, 174 insertions(+)
 create mode 100644 drivers/thermal/khadas_mcu_fan.c
drivers/thermal/Kconfig +11 -0
index 3eb2348e5242..0125561488c9 100644
@@ -500,4 +500,15 @@ config SPRD_THERMAL
 	help
 	  Support for the Spreadtrum thermal sensor driver in the Linux thermal
 	  framework.
+
+config KHADAS_MCU_FAN_THERMAL
+	tristate "Khadas MCU controller FAN cooling support"
+	depends on OF || COMPILE_TEST
+	depends on MFD_KHADAS_MCU
+	select MFD_CORE
+	select REGMAP
+	help
+	  If you say yes here you get support for the FAN controlled
+	  by the Microcontroller found on the Khadas VIM boards.
+
 endif
drivers/thermal/Makefile +1 -0
index 0c8b84a09b9a..4b6aabaa7e31 100644
@@ -61,3 +61,4 @@ obj-$(CONFIG_ZX2967_THERMAL)	+= zx2967_thermal.o
 obj-$(CONFIG_UNIPHIER_THERMAL)	+= uniphier_thermal.o
 obj-$(CONFIG_AMLOGIC_THERMAL)     += amlogic_thermal.o
 obj-$(CONFIG_SPRD_THERMAL)	+= sprd_thermal.o
+obj-$(CONFIG_KHADAS_MCU_FAN_THERMAL)	+= khadas_mcu_fan.o
drivers/thermal/khadas_mcu_fan.c new file +162 -0

162 lines not on this page · raw message

Signature · 7 lines
2.22.0


_______________________________________________
linux-amlogic mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-amlogic
Acked-by on v5 1/2
#2 lore raw

Re: [PATCH v5 1/2] thermal: add support for the MCU controlled FAN on Khadas boards

Quoted 6 lines · Neil Armstrong

The new Khadas VIM2 and VIM3 boards controls the cooling fan via the on-board microcontroller.

This implements the FAN control as thermal devices and as cell of the Khadas MCU MFD driver.

Quoted 7 lines

---
Hi Daniel,

Is it ok Lee applies this patch via the MFD tree since it depends on the linux/mfd/khadas-mcu.h header ?

[ ... ]

Signature · 5 lines
<http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs

Follow Linaro:  <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog
Applied
#3 lore raw

Re: [PATCH v5 1/2] thermal: add support for the MCU controlled FAN on Khadas boards

In reply to Neil Armstrong
Quoted 14 lines · Neil Armstrong

The new Khadas VIM2 and VIM3 boards controls the cooling fan via the on-board microcontroller.

This implements the FAN control as thermal devices and as cell of the Khadas MCU MFD driver.

---
Hi Daniel,

Is it ok Lee applies this patch via the MFD tree since it depends on the linux/mfd/khadas-mcu.h header ?

Quoted 8 lines

Thanks,
Neil

 drivers/thermal/Kconfig          |  11 +++
 drivers/thermal/Makefile         |   1 +
 drivers/thermal/khadas_mcu_fan.c | 162 +++++++++++++++++++++++++++++++
 3 files changed, 174 insertions(+)
 create mode 100644 drivers/thermal/khadas_mcu_fan.c

Applied, thanks.

Signature · 4 lines
Lee Jones [李琼斯]
Senior Technical Lead - Developer Services
Linaro.org │ Open source software for Arm SoCs
Follow Linaro: Facebook | Twitter | Blog
#4 lore raw

PATCH v5 2/2 arm64: dts: meson-khadas-vim3: add Khadas MCU nodes

In reply to Neil Armstrong

Add the Khadas MCU node with active FAN thermal nodes for all the Khadas VIM3 variants.

---
Hi Kevin,

The bindings has been reviewed and merged by Lee,
could you apply this one via the amlogic tree ?

Thanks,
Neil

 .../boot/dts/amlogic/meson-khadas-vim3.dtsi   | 23 +++++++++++++++++++
 1 file changed, 23 insertions(+)
arch/arm64/boot/dts/amlogic/meson-khadas-vim3.dtsi +23 -0
index 1ef1e3672b96..27408c10a811 100644
@@ -183,6 +183,23 @@
 	hdmi-phandle = <&hdmi_tx>;
 };
 
+&cpu_thermal {
+	trips {
+		cpu_active: cpu-active {
+			temperature = <80000>; /* millicelsius */
+			hysteresis = <2000>; /* millicelsius */
+			type = "active";
+		};
+	};
+
+	cooling-maps {
+		map {
+			trip = <&cpu_active>;
+			cooling-device = <&khadas_mcu THERMAL_NO_LIMIT THERMAL_NO_LIMIT>;
+		};
+	};
+};
+
 &ext_mdio {
 	external_phy: ethernet-phy@0 {
 		/* Realtek RTL8211F (0x001cc916) */
@@ -222,6 +239,12 @@
 	pinctrl-0 = <&i2c_ao_sck_pins>, <&i2c_ao_sda_pins>;
 	pinctrl-names = "default";
 
+	khadas_mcu: system-controller@18 {
+		compatible = "khadas,mcu";
+		reg = <0x18>;
+		#cooling-cells = <2>;
+	};
+
 	gpio_expander: gpio-controller@20 {
 		compatible = "ti,tca6408";
 		reg = <0x20>;
Signature · 1 line
2.22.0
#5 lore raw

Re: [PATCH v5 2/2] arm64: dts: meson-khadas-vim3: add Khadas MCU nodes

Hi Kevin,

Can you apply this patch ? the rest of the serie has been pulled into Lee's tree.

Thanks,
Neil

Quoted 59 lines · Neil Armstrong

Add the Khadas MCU node with active FAN thermal nodes for all the Khadas VIM3 variants.

---
Hi Kevin,

The bindings has been reviewed and merged by Lee,
could you apply this one via the amlogic tree ?

Thanks,
Neil

 .../boot/dts/amlogic/meson-khadas-vim3.dtsi   | 23 +++++++++++++++++++
 1 file changed, 23 insertions(+)
arch/arm64/boot/dts/amlogic/meson-khadas-vim3.dtsi +23 -0
index 1ef1e3672b96..27408c10a811 100644
@@ -183,6 +183,23 @@
 	hdmi-phandle = <&hdmi_tx>;
 };
 
+&cpu_thermal {
+	trips {
+		cpu_active: cpu-active {
+			temperature = <80000>; /* millicelsius */
+			hysteresis = <2000>; /* millicelsius */
+			type = "active";
+		};
+	};
+
+	cooling-maps {
+		map {
+			trip = <&cpu_active>;
+			cooling-device = <&khadas_mcu THERMAL_NO_LIMIT THERMAL_NO_LIMIT>;
+		};
+	};
+};
+
 &ext_mdio {
 	external_phy: ethernet-phy@0 {
 		/* Realtek RTL8211F (0x001cc916) */
@@ -222,6 +239,12 @@
 	pinctrl-0 = <&i2c_ao_sck_pins>, <&i2c_ao_sda_pins>;
 	pinctrl-names = "default";
 
+	khadas_mcu: system-controller@18 {
+		compatible = "khadas,mcu";
+		reg = <0x18>;
+		#cooling-cells = <2>;
+	};
+
 	gpio_expander: gpio-controller@20 {
 		compatible = "ti,tca6408";
 		reg = <0x20>;