ODROID-COMMON: arm64/dts: overlay: Add the PWM examples.

- pwmfan, pwm-backlight.

Change-Id: Id1cdbbebc80962f0ed51be05d95b771c1af6be30
This commit is contained in:
Luke go
2020-08-18 14:56:46 +09:00
parent 154309864d
commit d615a4cadc
7 changed files with 241 additions and 3 deletions

View 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)

View File

@@ -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>;
};
};
};
};
};

View File

@@ -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";
};
};
};
};

View 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)

View File

@@ -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>;
};
};
};
};
};

View File

@@ -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";
};
};
};
};

View 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