xref: /freebsd/sys/contrib/device-tree/src/arm64/renesas/r8a779g3-sparrow-hawk-fan-pwm.dtso (revision ae5de77ed78ae54d86cead5604869212e8008e6b)
1*ae5de77eSEmmanuel Vadot// SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
2*ae5de77eSEmmanuel Vadot/*
3*ae5de77eSEmmanuel Vadot * Device Tree Overlay for the PWM controlled blower fan in connector J3:FAN
4*ae5de77eSEmmanuel Vadot * on R-Car V4H ES3.0 Sparrow Hawk board
5*ae5de77eSEmmanuel Vadot *
6*ae5de77eSEmmanuel Vadot * Copyright (C) 2025 Marek Vasut <marek.vasut+renesas@mailbox.org>
7*ae5de77eSEmmanuel Vadot *
8*ae5de77eSEmmanuel Vadot * Example usage:
9*ae5de77eSEmmanuel Vadot *
10*ae5de77eSEmmanuel Vadot * # Localize hwmon sysfs directory that matches the PWM fan,
11*ae5de77eSEmmanuel Vadot * # enable the PWM fan, and configure the fan speed manually.
12*ae5de77eSEmmanuel Vadot * r8a779g3-sparrow-hawk$ grep -H . /sys/class/hwmon/hwmon?/name
13*ae5de77eSEmmanuel Vadot * /sys/class/hwmon/hwmon0/name:sensor1_thermal
14*ae5de77eSEmmanuel Vadot * /sys/class/hwmon/hwmon1/name:sensor2_thermal
15*ae5de77eSEmmanuel Vadot * /sys/class/hwmon/hwmon2/name:sensor3_thermal
16*ae5de77eSEmmanuel Vadot * /sys/class/hwmon/hwmon3/name:sensor4_thermal
17*ae5de77eSEmmanuel Vadot * /sys/class/hwmon/hwmon4/name:pwmfan
18*ae5de77eSEmmanuel Vadot *                       ^      ^^^^^^
19*ae5de77eSEmmanuel Vadot *
20*ae5de77eSEmmanuel Vadot * # Select mode 2 , enable fan PWM and regulator and keep them enabled.
21*ae5de77eSEmmanuel Vadot * # For details, see Linux Documentation/hwmon/pwm-fan.rst
22*ae5de77eSEmmanuel Vadot * r8a779g3-sparrow-hawk$ echo 2 > /sys/class/hwmon/hwmon4/pwm1_enable
23*ae5de77eSEmmanuel Vadot *
24*ae5de77eSEmmanuel Vadot * # Configure PWM fan speed in range 0..255 , 0 is stopped , 255 is full speed .
25*ae5de77eSEmmanuel Vadot * # Fan speed 101 is about 2/5 of the PWM fan speed:
26*ae5de77eSEmmanuel Vadot * r8a779g3-sparrow-hawk$ echo 101 > /sys/class/hwmon/hwmon4/pwm1
27*ae5de77eSEmmanuel Vadot */
28*ae5de77eSEmmanuel Vadot
29*ae5de77eSEmmanuel Vadot/dts-v1/;
30*ae5de77eSEmmanuel Vadot/plugin/;
31*ae5de77eSEmmanuel Vadot
32*ae5de77eSEmmanuel Vadot/*
33*ae5de77eSEmmanuel Vadot * Override default PWM fan settings. For a list of available properties,
34*ae5de77eSEmmanuel Vadot * see schema Documentation/devicetree/bindings/hwmon/pwm-fan.yaml .
35*ae5de77eSEmmanuel Vadot */
36*ae5de77eSEmmanuel Vadot&fan {
37*ae5de77eSEmmanuel Vadot	/* Available cooling levels */
38*ae5de77eSEmmanuel Vadot	cooling-levels = <0 50 100 150 200 255>;
39*ae5de77eSEmmanuel Vadot	/* Four pulses of tacho signal per one revolution */
40*ae5de77eSEmmanuel Vadot	pulses-per-revolution = <4>;
41*ae5de77eSEmmanuel Vadot	/* PWM period: 100us ~= 10 kHz */
42*ae5de77eSEmmanuel Vadot	pwms = <&pwm0 0 100000>;
43*ae5de77eSEmmanuel Vadot};
44