diff --git a/arch/arm64/boot/dts/amlogic/mesong12_odroid_common.dtsi b/arch/arm64/boot/dts/amlogic/mesong12_odroid_common.dtsi index f3b1e9f00c49..b143908fb9e7 100644 --- a/arch/arm64/boot/dts/amlogic/mesong12_odroid_common.dtsi +++ b/arch/arm64/boot/dts/amlogic/mesong12_odroid_common.dtsi @@ -252,6 +252,49 @@ pwm-gpios = <&gpio_ao GPIOAO_10 GPIO_ACTIVE_HIGH>; status = "okay"; }; + + pwmfan:pwm-fan { + compatible = "pwm-fan"; + pwms = <&pwmgpio 0 40000 PWM_POLARITY_INVERTED>; + cooling-min-state = <0>; + cooling-max-state = <3>; + #cooling-cells = <2>; + cooling-levels = <0 120 170 220>; + }; +}; + +&soc_thermal { + trips { + fan_0: trip-point@4 { + temperature = <45000>; + hysteresis = <5000>; + type = "active"; + }; + fan_1: trip-point@5 { + temperature = <55000>; + hysteresis = <5000>; + type = "active"; + }; + fan_2: trip-point@6 { + temperature = <60000>; + hysteresis = <5000>; + type = "active"; + }; + }; + cooling-maps { + fan_cooling_map0 { + trip = <&fan_0>; + cooling-device = <&pwmfan 0 1>; + }; + fan_cooling_map1 { + trip = <&fan_1>; + cooling-device = <&pwmfan 1 2>; + }; + fan_cooling_map2 { + trip = <&fan_2>; + cooling-device = <&pwmfan 2 3>; + }; + }; }; ðmac { diff --git a/arch/arm64/configs/odroidn2_android_defconfig b/arch/arm64/configs/odroidn2_android_defconfig index 8c97b457ef7a..43520940ffbe 100644 --- a/arch/arm64/configs/odroidn2_android_defconfig +++ b/arch/arm64/configs/odroidn2_android_defconfig @@ -2704,7 +2704,7 @@ CONFIG_HWMON=y # CONFIG_SENSORS_NCT7904 is not set # CONFIG_SENSORS_PCF8591 is not set # CONFIG_PMBUS is not set -# CONFIG_SENSORS_PWM_FAN is not set +CONFIG_SENSORS_PWM_FAN=y # CONFIG_SENSORS_SHT15 is not set # CONFIG_SENSORS_SHT21 is not set # CONFIG_SENSORS_SHT3x is not set @@ -2752,9 +2752,9 @@ CONFIG_THERMAL_WRITABLE_TRIPS=y # CONFIG_THERMAL_DEFAULT_GOV_FAIR_SHARE is not set # CONFIG_THERMAL_DEFAULT_GOV_USER_SPACE is not set CONFIG_THERMAL_DEFAULT_GOV_POWER_ALLOCATOR=y -# CONFIG_THERMAL_GOV_FAIR_SHARE is not set -# CONFIG_THERMAL_GOV_STEP_WISE is not set -# CONFIG_THERMAL_GOV_BANG_BANG is not set +CONFIG_THERMAL_GOV_FAIR_SHARE=y +CONFIG_THERMAL_GOV_STEP_WISE=y +CONFIG_THERMAL_GOV_BANG_BANG=y CONFIG_THERMAL_GOV_USER_SPACE=y CONFIG_THERMAL_GOV_POWER_ALLOCATOR=y CONFIG_CPU_THERMAL=y diff --git a/arch/arm64/configs/odroidn2_defconfig b/arch/arm64/configs/odroidn2_defconfig index f1a8d20118a2..e692086a9a71 100644 --- a/arch/arm64/configs/odroidn2_defconfig +++ b/arch/arm64/configs/odroidn2_defconfig @@ -2714,7 +2714,7 @@ CONFIG_HWMON=y # CONFIG_SENSORS_NCT7904 is not set # CONFIG_SENSORS_PCF8591 is not set # CONFIG_PMBUS is not set -# CONFIG_SENSORS_PWM_FAN is not set +CONFIG_SENSORS_PWM_FAN=y # CONFIG_SENSORS_SHT15 is not set # CONFIG_SENSORS_SHT21 is not set # CONFIG_SENSORS_SHT3x is not set @@ -2762,9 +2762,9 @@ CONFIG_THERMAL_WRITABLE_TRIPS=y # CONFIG_THERMAL_DEFAULT_GOV_FAIR_SHARE is not set # CONFIG_THERMAL_DEFAULT_GOV_USER_SPACE is not set CONFIG_THERMAL_DEFAULT_GOV_POWER_ALLOCATOR=y -# CONFIG_THERMAL_GOV_FAIR_SHARE is not set -# CONFIG_THERMAL_GOV_STEP_WISE is not set -# CONFIG_THERMAL_GOV_BANG_BANG is not set +CONFIG_THERMAL_GOV_FAIR_SHARE=y +CONFIG_THERMAL_GOV_STEP_WISE=y +CONFIG_THERMAL_GOV_BANG_BANG=y CONFIG_THERMAL_GOV_USER_SPACE=y CONFIG_THERMAL_GOV_POWER_ALLOCATOR=y CONFIG_CPU_THERMAL=y diff --git a/drivers/amlogic/thermal/meson_tsensor.c b/drivers/amlogic/thermal/meson_tsensor.c index 2db98d0efc94..27769cb1898b 100644 --- a/drivers/amlogic/thermal/meson_tsensor.c +++ b/drivers/amlogic/thermal/meson_tsensor.c @@ -661,7 +661,11 @@ static int meson_map_dt_data(struct platform_device *pdev) data->tsensor_set_emulation = r1p1_tsensor_set_emulation; data->tsensor_clear_irqs = r1p1_tsensor_clear_irqs; data->tsensor_update_irqs = r1p1_tsensor_update_irqs; + #if defined(CONFIG_ARCH_MESON64_ODROID_COMMON) + data->ntrip = 7; + #else data->ntrip = 4; + #endif break; default: dev_err(&pdev->dev, "Platform not supported\n");