ODROID-COMMON: arm64/dts: overlay: Add the PWM examples.
authorLuke go <sangch.go@gmail.com>
Tue, 18 Aug 2020 05:56:46 +0000 (14:56 +0900)
committerLuke go <sangch.go@gmail.com>
Tue, 20 Oct 2020 08:20:56 +0000 (17:20 +0900)
- pwmfan, pwm-backlight.

Change-Id: Id1cdbbebc80962f0ed51be05d95b771c1af6be30

arch/arm64/boot/dts/amlogic/overlays/odroidc4/Makefile
arch/arm64/boot/dts/amlogic/overlays/odroidc4/pwm_a-pwmfan.dts [new file with mode: 0644]
arch/arm64/boot/dts/amlogic/overlays/odroidc4/pwm_b-backlight.dts [new file with mode: 0644]
arch/arm64/boot/dts/amlogic/overlays/odroidn2/Makefile
arch/arm64/boot/dts/amlogic/overlays/odroidn2/pwm_c-pwmfan.dts [new file with mode: 0644]
arch/arm64/boot/dts/amlogic/overlays/odroidn2/pwm_d-backlight.dts [new file with mode: 0644]
arch/arm64/configs/odroidg12_defconfig

index 3465149d799c3bd8bf960ae09b81fe769baa3d26..97ebe25a3e1dfa7006956b91432528391a5d3dad 100644 (file)
@@ -21,7 +21,9 @@ dtbo-$(CONFIG_ARCH_MESON64_ODROIDC4) += spi0.dtbo             \
                                        fanspeed-full.dtbo      \
                                        pwm_ab.dtbo             \
                                        pwm_cd.dtbo             \
-                                       pwm_ef.dtbo
+                                       pwm_ef.dtbo             \
+                                       pwm_a-pwmfan.dtbo       \
+                                       pwm_b-backlight.dtbo
 
 targets        += $(dtbo-y)
 always := $(dtbo-y)
diff --git a/arch/arm64/boot/dts/amlogic/overlays/odroidc4/pwm_a-pwmfan.dts b/arch/arm64/boot/dts/amlogic/overlays/odroidc4/pwm_a-pwmfan.dts
new file mode 100644 (file)
index 0000000..e9acda3
--- /dev/null
@@ -0,0 +1,75 @@
+/dts-v1/;
+/plugin/;
+
+#include <include/dt-bindings/thermal/thermal.h>
+#include <dt-bindings/pwm/meson.h>
+#include <dt-bindings/pwm/pwm.h>
+
+/{
+       fragment@0 {
+               // pwm_ab
+               // This activates pwm_ab.
+               target = <&pwm_ab>;
+
+               __overlay__ {
+                       status = "okay";
+                       pinctrl-names = "pwm_pins";
+                       pinctrl-0 = <&pwm_a_pins &pwm_b_pins2>;
+               };
+       };
+
+       fragment@1 {
+               target-path = "/";
+
+               __overlay__ {
+                       pwmcfan: pwm_c-fan {
+                               compatible = "pwm-fan";
+                               status = "okay";
+                               #cooling-cells = <2>;
+                               cooling-levels = <0 128 180 240>;
+                               pwms = <&pwm_ab MESON_PWM_0 40000 0>;
+                       };
+               };
+       };
+
+       fragment@2 {
+               target = <&soc_thermal>;
+
+               __overlay__ {
+                       trips {
+                               pwmc_fan_low: trip-point@7 {
+                                       temperature = <65000>;
+                                       hysteresis = <5000>;
+                                       type = "active";
+                               };
+                               pwmc_fan_mid: trip-point@8 {
+                                       temperature = <75000>;
+                                       hysteresis = <5000>;
+                                       type = "active";
+                               };
+                               pwmc_fan_high: trip-point@9 {
+                                       temperature = <90000>;
+                                       hysteresis = <5000>;
+                                       type = "active";
+                               };
+                       };
+                       cooling-maps {
+                               pwmc_fan_cooling_map0 {
+                                       trip = <&pwmc_fan_low>;
+                                       cooling-device = <&pwmcfan THERMAL_NO_LIMIT 1>;
+                                       contribution = <1024>;
+                               };
+                               pwmc_fan_cooling_map1 {
+                                       trip = <&pwmc_fan_mid>;
+                                       cooling-device = <&pwmcfan THERMAL_NO_LIMIT 2>;
+                                       contribution = <1024>;
+                               };
+                               pwmc_fan_cooling_map2 {
+                                       trip = <&pwmc_fan_high>;
+                                       cooling-device = <&pwmcfan 3 THERMAL_NO_LIMIT>;
+                                       contribution = <1024>;
+                               };
+                       };
+               };
+       };
+};
diff --git a/arch/arm64/boot/dts/amlogic/overlays/odroidc4/pwm_b-backlight.dts b/arch/arm64/boot/dts/amlogic/overlays/odroidc4/pwm_b-backlight.dts
new file mode 100644 (file)
index 0000000..ee1c1f9
--- /dev/null
@@ -0,0 +1,42 @@
+/dts-v1/;
+/plugin/;
+
+#include <dt-bindings/pwm/meson.h>
+#include <dt-bindings/pwm/pwm.h>
+
+/{
+       fragment@0 {
+               // pwm_ab
+               // This activates pwm_ab.
+               target = <&pwm_ab>;
+
+               __overlay__ {
+                       status = "okay";
+                       pinctrl-names = "pwm_pins";
+                       pinctrl-0 = <&pwm_a_pins &pwm_b_pins2>;
+               };
+       };
+
+       fragment@1 {
+               target-path = "/";
+
+               __overlay__ {
+                       backlight: backlight {
+                               compatible = "pwm-backlight";
+                               brightness-levels = <0
+                                       8 16 24 32
+                                       40 48 56 64
+                                       72 80 88 96
+                                       104 112 120 128
+                                       136 144 152 160
+                                       168 176 184 192
+                                       200 208 216 224
+                                       232 240 248 255
+                               >;
+                               default-brightness-level = <16>;
+                               pwms = <&pwm_ab MESON_PWM_1 1000000 0>;
+                               status = "okay";
+                       };
+               };
+       };
+};
index ee196f5ce31741c94d607350d80411f34fb7f447..81843a843dae4f51239f02a3f6cf28db9f0433f6 100644 (file)
@@ -16,7 +16,9 @@ dtbo-$(CONFIG_ARCH_MESON64_ODROIDN2) += spi0.dtbo             \
                                        fanspeed-full.dtbo      \
                                        gpio_spdif.dtbo \
                                        pwm_cd.dtbo             \
-                                       pwm_ef.dtbo
+                                       pwm_ef.dtbo             \
+                                       pwm_c-pwmfan.dtbo       \
+                                       pwm_d-backlight.dtbo
 
 targets        += $(dtbo-y)
 always := $(dtbo-y)
diff --git a/arch/arm64/boot/dts/amlogic/overlays/odroidn2/pwm_c-pwmfan.dts b/arch/arm64/boot/dts/amlogic/overlays/odroidn2/pwm_c-pwmfan.dts
new file mode 100644 (file)
index 0000000..14c0b45
--- /dev/null
@@ -0,0 +1,75 @@
+/dts-v1/;
+/plugin/;
+
+#include <include/dt-bindings/thermal/thermal.h>
+#include <dt-bindings/pwm/meson.h>
+#include <dt-bindings/pwm/pwm.h>
+
+/{
+       fragment@0 {
+               // pwm_cd
+               // This activates pwm_cd.
+               target = <&pwm_cd>;
+
+               __overlay__ {
+                       status = "okay";
+                       pinctrl-names = "pwm_pins";
+                       pinctrl-0 = <&pwm_c_pins2 &pwm_d_pins2>;
+               };
+       };
+
+       fragment@1 {
+               target-path = "/";
+
+               __overlay__ {
+                       pwmcfan: pwm_c-fan {
+                               compatible = "pwm-fan";
+                               status = "okay";
+                               #cooling-cells = <2>;
+                               cooling-levels = <0 128 180 240>;
+                               pwms = <&pwm_cd MESON_PWM_0 40000 0>;
+                       };
+               };
+       };
+
+       fragment@2 {
+               target = <&soc_thermal>;
+
+               __overlay__ {
+                       trips {
+                               pwmc_fan_low: trip-point@7 {
+                                       temperature = <65000>;
+                                       hysteresis = <5000>;
+                                       type = "active";
+                               };
+                               pwmc_fan_mid: trip-point@8 {
+                                       temperature = <75000>;
+                                       hysteresis = <5000>;
+                                       type = "active";
+                               };
+                               pwmc_fan_high: trip-point@9 {
+                                       temperature = <90000>;
+                                       hysteresis = <5000>;
+                                       type = "active";
+                               };
+                       };
+                       cooling-maps {
+                               pwmc_fan_cooling_map0 {
+                                       trip = <&pwmc_fan_low>;
+                                       cooling-device = <&pwmcfan THERMAL_NO_LIMIT 1>;
+                                       contribution = <1024>;
+                               };
+                               pwmc_fan_cooling_map1 {
+                                       trip = <&pwmc_fan_mid>;
+                                       cooling-device = <&pwmcfan THERMAL_NO_LIMIT 2>;
+                                       contribution = <1024>;
+                               };
+                               pwmc_fan_cooling_map2 {
+                                       trip = <&pwmc_fan_high>;
+                                       cooling-device = <&pwmcfan 3 THERMAL_NO_LIMIT>;
+                                       contribution = <1024>;
+                               };
+                       };
+               };
+       };
+};
diff --git a/arch/arm64/boot/dts/amlogic/overlays/odroidn2/pwm_d-backlight.dts b/arch/arm64/boot/dts/amlogic/overlays/odroidn2/pwm_d-backlight.dts
new file mode 100644 (file)
index 0000000..81c5ec1
--- /dev/null
@@ -0,0 +1,42 @@
+/dts-v1/;
+/plugin/;
+
+#include <dt-bindings/pwm/meson.h>
+#include <dt-bindings/pwm/pwm.h>
+
+/{
+       fragment@0 {
+               // pwm_cd
+               // This activates pwm_cd.
+               target = <&pwm_cd>;
+
+               __overlay__ {
+                       status = "okay";
+                       pinctrl-names = "pwm_pins";
+                       pinctrl-0 = <&pwm_c_pins2 &pwm_d_pins2>;
+               };
+       };
+
+       fragment@1 {
+               target-path = "/";
+
+               __overlay__ {
+                       backlight: backlight {
+                               compatible = "pwm-backlight";
+                               brightness-levels = <0
+                                       8 16 24 32
+                                       40 48 56 64
+                                       72 80 88 96
+                                       104 112 120 128
+                                       136 144 152 160
+                                       168 176 184 192
+                                       200 208 216 224
+                                       232 240 248 255
+                               >;
+                               default-brightness-level = <16>;
+                               pwms = <&pwm_cd MESON_PWM_1 1000000 0>;
+                               status = "okay";
+                       };
+               };
+       };
+};
index 0621f912d490db2fee9c1b50069af8ceb4b157a8..23d28271a16ddee4c0219058ed064453303c705b 100644 (file)
@@ -4413,7 +4413,7 @@ CONFIG_LCD_CLASS_DEVICE=m
 # CONFIG_LCD_HX8357 is not set
 CONFIG_BACKLIGHT_CLASS_DEVICE=y
 CONFIG_BACKLIGHT_GENERIC=y
-# CONFIG_BACKLIGHT_PWM is not set
+CONFIG_BACKLIGHT_PWM=y
 # CONFIG_BACKLIGHT_PM8941_WLED is not set
 # CONFIG_BACKLIGHT_ADP8860 is not set
 # CONFIG_BACKLIGHT_ADP8870 is not set