diff --git a/arch/arm64/boot/dts/amlogic/mesong12_odroid_common.dtsi b/arch/arm64/boot/dts/amlogic/mesong12_odroid_common.dtsi index 954e59a2b41c..90f9abf05d35 100644 --- a/arch/arm64/boot/dts/amlogic/mesong12_odroid_common.dtsi +++ b/arch/arm64/boot/dts/amlogic/mesong12_odroid_common.dtsi @@ -215,6 +215,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_defconfig b/arch/arm64/configs/odroidn2_defconfig index ced2b61a8412..8504378e7c4b 100644 --- a/arch/arm64/configs/odroidn2_defconfig +++ b/arch/arm64/configs/odroidn2_defconfig @@ -1,6 +1,6 @@ # # Automatically generated file; DO NOT EDIT. -# Linux/arm64 4.9.160 Kernel Configuration +# Linux/arm64 4.9.162 Kernel Configuration # CONFIG_ARM64=y CONFIG_64BIT=y @@ -3113,7 +3113,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 @@ -3161,9 +3161,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 18699834ccd0..b9eb25acce26 100644 --- a/drivers/amlogic/thermal/meson_tsensor.c +++ b/drivers/amlogic/thermal/meson_tsensor.c @@ -652,7 +652,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");