From: Luke go Date: Tue, 18 Aug 2020 05:56:46 +0000 (+0900) Subject: ODROID-COMMON: arm64/dts: overlay: Add the PWM examples. X-Git-Tag: hardkernel-4.9.236-104~8 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=d615a4cadcba0fc44b082ce0d3f9e8d8c73af53a;p=platform%2Fkernel%2Flinux-amlogic.git ODROID-COMMON: arm64/dts: overlay: Add the PWM examples. - pwmfan, pwm-backlight. Change-Id: Id1cdbbebc80962f0ed51be05d95b771c1af6be30 --- diff --git a/arch/arm64/boot/dts/amlogic/overlays/odroidc4/Makefile b/arch/arm64/boot/dts/amlogic/overlays/odroidc4/Makefile index 3465149d799c..97ebe25a3e1d 100644 --- a/arch/arm64/boot/dts/amlogic/overlays/odroidc4/Makefile +++ b/arch/arm64/boot/dts/amlogic/overlays/odroidc4/Makefile @@ -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 index 000000000000..e9acda3e2379 --- /dev/null +++ b/arch/arm64/boot/dts/amlogic/overlays/odroidc4/pwm_a-pwmfan.dts @@ -0,0 +1,75 @@ +/dts-v1/; +/plugin/; + +#include +#include +#include + +/{ + 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 index 000000000000..ee1c1f9239df --- /dev/null +++ b/arch/arm64/boot/dts/amlogic/overlays/odroidc4/pwm_b-backlight.dts @@ -0,0 +1,42 @@ +/dts-v1/; +/plugin/; + +#include +#include + +/{ + 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"; + }; + }; + }; +}; diff --git a/arch/arm64/boot/dts/amlogic/overlays/odroidn2/Makefile b/arch/arm64/boot/dts/amlogic/overlays/odroidn2/Makefile index ee196f5ce317..81843a843dae 100644 --- a/arch/arm64/boot/dts/amlogic/overlays/odroidn2/Makefile +++ b/arch/arm64/boot/dts/amlogic/overlays/odroidn2/Makefile @@ -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 index 000000000000..14c0b4564c00 --- /dev/null +++ b/arch/arm64/boot/dts/amlogic/overlays/odroidn2/pwm_c-pwmfan.dts @@ -0,0 +1,75 @@ +/dts-v1/; +/plugin/; + +#include +#include +#include + +/{ + 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 index 000000000000..81c5ec15956b --- /dev/null +++ b/arch/arm64/boot/dts/amlogic/overlays/odroidn2/pwm_d-backlight.dts @@ -0,0 +1,42 @@ +/dts-v1/; +/plugin/; + +#include +#include + +/{ + 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"; + }; + }; + }; +}; diff --git a/arch/arm64/configs/odroidg12_defconfig b/arch/arm64/configs/odroidg12_defconfig index 0621f912d490..23d28271a16d 100644 --- a/arch/arm64/configs/odroidg12_defconfig +++ b/arch/arm64/configs/odroidg12_defconfig @@ -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