ODROID-COMMON: arm64/dts: overlay: Add pwm examples.

- N2
  - pwm_c(33) - pwm fan.
  - pwm_d(35) - pwm backlight.

- C4
  - pwm_a(33) - pwm fan.
  - pwm_b(35) - pwm backlight.

Change-Id: If5382b0f5fa515d74d547b1cb20107be5ad813bd
This commit is contained in:
Luke go
2020-08-18 12:24:15 +09:00
committed by Chris
parent 65efb21457
commit 202902f042
9 changed files with 249 additions and 5 deletions

View File

@@ -12,7 +12,12 @@ dtbo-$(CONFIG_ARCH_MESON64_ODROIDC4) += spi0.dtbo \
sx865x-i2c1.dtbo \
pcf8563.dtbo \
onewire.dtbo \
can0.dtbo
can0.dtbo \
pwm_ab.dtbo \
pwm_cd.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

@@ -12,9 +12,14 @@ dtbo-$(CONFIG_ARCH_MESON64_ODROIDN2) += spi0.dtbo \
saradc.dtbo \
irblaster.dtbo \
odroidn2-opp.dtbo \
odroidn2_plus-opp.dtbo \
onewire.dtbo \
can0.dtbo \
fanspeed-full.dtbo
fanspeed-full.dtbo \
pwm_cd.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

@@ -3290,7 +3290,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

View File

@@ -3290,7 +3290,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

View File

@@ -3244,7 +3244,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