Skip to contentSkip to conversation

arm64: dts: meson: Enable active coling using gpio-fan on Odroid N2/N2+

PATCH In review Anand Moon 4 participants 10 messages Oct 22, 2022 – Oct 27, 2022

Subsystems (2)
lore
Share & tools
lore

Anand Moon

author
#0 lore raw

PATCH v3 1/1 arm64: dts: meson: Enable active coling using gpio-fan on Odroid N2/N2+

Odroid N2/N2+ support active cooling via gpio-fan controller. Add fan controls and tip point for cpu and ddr thermal sensor on this boards. Drop bias-disable from set pwm_ao_d_10 the pin as to allow transition from say pull-up to pull-down for on/off of the fan.

---
v2: changes tip name cpu-active --> ddr-active
v3: drop bias-disable for pwm_ao_d_10 pine.

---
 .../boot/dts/amlogic/meson-g12-common.dtsi    |  1 -
 .../dts/amlogic/meson-g12b-odroid-n2.dtsi     | 42 +++++++++++++++++++
 2 files changed, 42 insertions(+), 1 deletion(-)
arch/arm64/boot/dts/amlogic/meson-g12-common.dtsi +0 -1
index 45947c1031c4..10a09fe362fa 100644
@@ -1982,7 +1982,6 @@ pwm_ao_d_10_pins: pwm-ao-d-10 {
 						mux {
 							groups = "pwm_ao_d_10";
 							function = "pwm_ao_d";
-							bias-disable;
 						};
 					};
 
arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dtsi +42 -0

54 lines not on this page · raw message

base-commit: 4da34b7d175dc99b8befebd69e96546c960d526c

Signature · 7 lines
2.38.0


_______________________________________________
linux-amlogic mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-amlogic
#1 lore raw

Hi Anand,

Quoted 4 lines · Anand Moon

Odroid N2/N2+ support active cooling via gpio-fan controller. Add fan controls and tip point for cpu and ddr thermal sensor on this boards. Drop bias-disable from set pwm_ao_d_10 the pin

either use "on these boards" or "on this board"

[...]

arch/arm64/boot/dts/amlogic/meson-g12-common.dtsi pwm_ao_d_10_pins: pwm-ao-d-10 { · line 1985

Quoted 5 lines
arch/arm64/boot/dts/amlogic/meson-g12-common.dtsi +0 -1
@@ -1982,7 +1982,6 @@ pwm_ao_d_10_pins: pwm-ao-d-10 {
                                                mux {
                                                        groups = "pwm_ao_d_10";
                                                        function = "pwm_ao_d";
-                                                       bias-disable;

&pwm_ao_d_10_pins is not referenced anywhere so it seems that this change has no impact on controlling the fan on Odroid-N2(+). How did you test this change?

Best regards,
Martin

_______________________________________________
linux-amlogic mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-amlogic

author
#2 lore raw

Hi Martin,

Thanks for your review comments..

Quoted 11 lines · Martin Blumenstingl

Hi Anand,

Quoted 4 lines · Anand Moon

Odroid N2/N2+ support active cooling via gpio-fan controller. Add fan controls and tip point for cpu and ddr thermal sensor on this boards. Drop bias-disable from set pwm_ao_d_10 the pin

either use "on these boards" or "on this board"

[...]

Quoted 9 lines

arch/arm64/boot/dts/amlogic/meson-g12-common.dtsi pwm_ao_d_10_pins: pwm-ao-d-10 { · line 1985

Quoted 5 lines
arch/arm64/boot/dts/amlogic/meson-g12-common.dtsi +0 -1
@@ -1982,7 +1982,6 @@ pwm_ao_d_10_pins: pwm-ao-d-10 {
                                                mux {
                                                        groups = "pwm_ao_d_10";
                                                        function = "pwm_ao_d";
-                                                       bias-disable;

&pwm_ao_d_10_pins is not referenced anywhere so it seems that this change has no impact on controlling the fan on Odroid-N2(+). How did you test this change?

Ok I felt these changes affect the behavior of the pinctrl

* @PIN_CONFIG_BIAS_DISABLE: disable any pin bias on the pin, a
* transition from say pull-up to pull-down implies that you disable
* pull-up in the process, this setting disables all biasing.

I mapped this is linked in pinctrl driver, pwm_ao_d_10_pins GPIOAO_10 see below

[0] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/pinctrl/meson/pinctrl-meson-g12a.c?h=v6.1-rc1#n825

For testing, I tried to libgpio command to verify shown below, with this patch applied.

$ gpioinfo
....
gpiochip1 - 15 lines:
        line   0:      unnamed       unused   input  active-high
        line   1:      unnamed       unused   input  active-high
        line   2:      unnamed     "enable"  output  active-high [used]
        line   3:      unnamed       unused   input  active-high
        line   4:      unnamed       unused  output  active-high
        line   5:      unnamed       unused   input  active-high
        line   6:      unnamed       unused   input  active-high
        line   7:      unnamed       unused   input  active-high
        line   8:      unnamed "regulator-tflash_vdd" output active-high [used]
        line   9:      unnamed      "TF_IO"  output  active-high [used]
        line  10:      unnamed   "gpio-fan"  output  active-high [used]
        line  11:      unnamed    "n2:blue"  output  active-high [used]
        line  12:      unnamed       unused   input  active-high
        line  13:      unnamed       unused   input  active-high
        line  14:      unnamed       unused   input  active-high
$ cat /sys/kernel/debug/pinctrl/ff800000.sys-ctrl\:pinctrl@14-pinctrl-meson/pinmux-pins
Pinmux settings per pin
Format: pin (name): mux_owner gpio_owner hog?
pin 0 (GPIOAO_0): ff803000.serial (GPIO UNCLAIMED) function uart_ao_a
group uart_ao_a_tx
pin 1 (GPIOAO_1): ff803000.serial (GPIO UNCLAIMED) function uart_ao_a
group uart_ao_a_rx
pin 2 (GPIOAO_2): (MUX UNCLAIMED) aobus-banks:1950
pin 3 (GPIOAO_3): (MUX UNCLAIMED) (GPIO UNCLAIMED)
pin 4 (GPIOAO_4): (MUX UNCLAIMED) (GPIO UNCLAIMED)
pin 5 (GPIOAO_5): ff808000.ir (GPIO UNCLAIMED) function
remote_ao_input group remote_ao_input
pin 6 (GPIOAO_6): (MUX UNCLAIMED) (GPIO UNCLAIMED)
pin 7 (GPIOAO_7): (MUX UNCLAIMED) (GPIO UNCLAIMED)
pin 8 (GPIOAO_8): (MUX UNCLAIMED) aobus-banks:1956
pin 9 (GPIOAO_9): (MUX UNCLAIMED) aobus-banks:1957
pin 10 (GPIOAO_10): (MUX UNCLAIMED) aobus-banks:1958
pin 11 (GPIOAO_11): (MUX UNCLAIMED) aobus-banks:1959
pin 12 (GPIOE_0): (MUX UNCLAIMED) (GPIO UNCLAIMED)
pin 13 (GPIOE_1): ff802000.pwm (GPIO UNCLAIMED) function pwm_ao_d
group pwm_ao_d_e
pin 14 (GPIOE_2): ffd1b000.pwm (GPIO UNCLAIMED) function pwm_a_e group pwm_a_e
$ sudo gpiomon  gpiochip1 10
gpiomon: error waiting for events: Device or resource busy
$ sudo gpioget  gpiochip1 10
gpioget: error reading GPIO values: Device or resource busy

If I am wrong I have previously sent it with a typo correction below.

[1] https://lore.kernel.org/all/[email protected]/

Thanks
-Anand

Quoted 3 lines

Best regards,
Martin

_______________________________________________
linux-amlogic mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-amlogic

#3 lore raw

Hi Anand,

On Sat, Oct 22, 2022 at 1:27 PM Anand Moon <[email protected]> wrote:
[...]

Quoted 9 lines
Quoted 9 lines

arch/arm64/boot/dts/amlogic/meson-g12-common.dtsi pwm_ao_d_10_pins: pwm-ao-d-10 { · line 1985

Quoted 5 lines
arch/arm64/boot/dts/amlogic/meson-g12-common.dtsi +0 -1
@@ -1982,7 +1982,6 @@ pwm_ao_d_10_pins: pwm-ao-d-10 {
                                                mux {
                                                        groups = "pwm_ao_d_10";
                                                        function = "pwm_ao_d";
-                                                       bias-disable;

&pwm_ao_d_10_pins is not referenced anywhere so it seems that this change has no impact on controlling the fan on Odroid-N2(+). How did you test this change?

Quoted 7 lines

Ok I felt these changes affect the behavior of the pinctrl

* @PIN_CONFIG_BIAS_DISABLE: disable any pin bias on the pin, a
* transition from say pull-up to pull-down implies that you disable
* pull-up in the process, this setting disables all biasing.

I mapped this is linked in pinctrl driver, pwm_ao_d_10_pins GPIOAO_10 see below

Yes, I understand this part.
My concern is: &pwm_ao_d_10_pins settings only become active when this node is actively referenced. You can even see it in your output below...

[...]

Quoted 1 line

pin 10 (GPIOAO_10): (MUX UNCLAIMED) aobus-banks:1958

This shows that it's used as a GPIO. If the &pwm_ao_d_10_pins setting was used then it would show "function pwm_ao_d group pwm_ao_d_10" (similar to what GPIOE_1 shows in your output)

If you want to know if a pull-up/down is enabled you can look at the output of:

$ cat /sys/kernel/debug/pinctrl/ff800000.sys-ctrl\:pinctrl@14-pinctrl-meson/pinconf-pins
(I'm sure this can also be retrieved from some userspace tools, but I
don't know how)

Best regards,
Martin

author
#4 lore raw

Hi Martin,

Quoted 28 lines · Martin Blumenstingl

Hi Anand,

On Sat, Oct 22, 2022 at 1:27 PM Anand Moon <[email protected]> wrote:
[...]

Quoted 9 lines
Quoted 9 lines

arch/arm64/boot/dts/amlogic/meson-g12-common.dtsi pwm_ao_d_10_pins: pwm-ao-d-10 { · line 1985

Quoted 5 lines
arch/arm64/boot/dts/amlogic/meson-g12-common.dtsi +0 -1
@@ -1982,7 +1982,6 @@ pwm_ao_d_10_pins: pwm-ao-d-10 {
                                                mux {
                                                        groups = "pwm_ao_d_10";
                                                        function = "pwm_ao_d";
-                                                       bias-disable;

&pwm_ao_d_10_pins is not referenced anywhere so it seems that this change has no impact on controlling the fan on Odroid-N2(+). How did you test this change?

Quoted 7 lines

Ok I felt these changes affect the behavior of the pinctrl

* @PIN_CONFIG_BIAS_DISABLE: disable any pin bias on the pin, a
* transition from say pull-up to pull-down implies that you disable
* pull-up in the process, this setting disables all biasing.

I mapped this is linked in pinctrl driver, pwm_ao_d_10_pins GPIOAO_10 see below

Yes, I understand this part.
My concern is: &pwm_ao_d_10_pins settings only become active when this node is actively referenced. You can even see it in your output below...

[...]

Quoted 1 line

pin 10 (GPIOAO_10): (MUX UNCLAIMED) aobus-banks:1958

Quoted 9 lines

This shows that it's used as a GPIO. If the &pwm_ao_d_10_pins setting was used then it would show "function pwm_ao_d group pwm_ao_d_10" (similar to what GPIOE_1 shows in your output)

If you want to know if a pull-up/down is enabled you can look at the output of:

$ cat /sys/kernel/debug/pinctrl/ff800000.sys-ctrl\:pinctrl@14-pinctrl-meson/pinconf-pins
(I'm sure this can also be retrieved from some userspace tools, but I
don't know how)

I now switch using pwm-fan with the local changes I am able to link pwm_ao_d_10_pins
but now the issue is fan keeps on spinning on boot-up and stays on.

I can manually turn on off by using

$ sudo gpioset gpiochip1 10=1   // fan on
$ sudo gpioset gpiochip1 10=0   // fan off

It is not controlled by the thermal tip as expected. I feel some configuration is missing in pwm-meson driver. Any input for me?

$ sudo cat /sys/kernel/debug/pinctrl/ff800000.sys-ctrl\:pinctrl@14-pinctrl-meson/pinmux-pins
[sudo] password for alarm:
Pinmux settings per pin
Format: pin (name): mux_owner gpio_owner hog?
pin 0 (GPIOAO_0): ff803000.serial (GPIO UNCLAIMED) function uart_ao_a
group uart_ao_a_tx
pin 1 (GPIOAO_1): ff803000.serial (GPIO UNCLAIMED) function uart_ao_a
group uart_ao_a_rx
pin 2 (GPIOAO_2): (MUX UNCLAIMED) aobus-banks:1950
pin 3 (GPIOAO_3): (MUX UNCLAIMED) (GPIO UNCLAIMED)
pin 4 (GPIOAO_4): (MUX UNCLAIMED) (GPIO UNCLAIMED)
pin 5 (GPIOAO_5): ff808000.ir (GPIO UNCLAIMED) function
remote_ao_input group remote_ao_input
pin 6 (GPIOAO_6): (MUX UNCLAIMED) (GPIO UNCLAIMED)
pin 7 (GPIOAO_7): (MUX UNCLAIMED) (GPIO UNCLAIMED)
pin 8 (GPIOAO_8): (MUX UNCLAIMED) aobus-banks:1956
pin 9 (GPIOAO_9): (MUX UNCLAIMED) aobus-banks:1957
pin 10 (GPIOAO_10): ff807000.pwm (GPIO UNCLAIMED) function pwm_ao_d
group pwm_ao_d_10
pin 11 (GPIOAO_11): (MUX UNCLAIMED) aobus-banks:1959
pin 12 (GPIOE_0): (MUX UNCLAIMED) (GPIO UNCLAIMED)
pin 13 (GPIOE_1): ff802000.pwm (GPIO UNCLAIMED) function pwm_ao_d
group pwm_ao_d_e
pin 14 (GPIOE_2): ffd1b000.pwm (GPIO UNCLAIMED) function pwm_a_e group pwm_a_e
$ sudo cat /sys/kernel/debug/pwm
platform/ffd1b000.pwm, 2 PWM devices
 pwm-0   (regulator-vddcpu-a  ): requested enabled period: 1250 ns
duty: 838 ns polarity: normal
 pwm-1   ((null)              ): period: 0 ns duty: 0 ns polarity: normal

platform/ff807000.pwm, 2 PWM devices
pwm-0 (pwm-fan ): requested period: 1250 ns duty: 0 ns
polarity: normal
pwm-1 ((null) ): period: 0 ns duty: 0 ns polarity: normal

platform/ff802000.pwm, 2 PWM devices

 pwm-0   ((null)              ): period: 0 ns duty: 0 ns polarity: normal
 pwm-1   (regulator-vddcpu-b  ): requested enabled period: 1250 ns

duty: 1213 ns polarity: normal

I could observe a change in duty when we have stress testing the CPU.

Thanks

-Anand

maintainer
#5 lore raw

Hi,

Quoted 42 lines · Anand Moon

Hi Martin,

Quoted 28 lines · Martin Blumenstingl

Hi Anand,

On Sat, Oct 22, 2022 at 1:27 PM Anand Moon <[email protected]> wrote:
[...]

Quoted 9 lines
Quoted 9 lines

arch/arm64/boot/dts/amlogic/meson-g12-common.dtsi pwm_ao_d_10_pins: pwm-ao-d-10 { · line 1985

Quoted 5 lines
arch/arm64/boot/dts/amlogic/meson-g12-common.dtsi +0 -1
@@ -1982,7 +1982,6 @@ pwm_ao_d_10_pins: pwm-ao-d-10 {
                                                 mux {
                                                         groups = "pwm_ao_d_10";
                                                         function = "pwm_ao_d";
-                                                       bias-disable;

&pwm_ao_d_10_pins is not referenced anywhere so it seems that this change has no impact on controlling the fan on Odroid-N2(+). How did you test this change?

Quoted 7 lines

Ok I felt these changes affect the behavior of the pinctrl

* @PIN_CONFIG_BIAS_DISABLE: disable any pin bias on the pin, a
* transition from say pull-up to pull-down implies that you disable
* pull-up in the process, this setting disables all biasing.

I mapped this is linked in pinctrl driver, pwm_ao_d_10_pins GPIOAO_10 see below

Yes, I understand this part.
My concern is: &pwm_ao_d_10_pins settings only become active when this node is actively referenced. You can even see it in your output below...

[...]

Quoted 1 line

pin 10 (GPIOAO_10): (MUX UNCLAIMED) aobus-banks:1958

Quoted 9 lines

This shows that it's used as a GPIO. If the &pwm_ao_d_10_pins setting was used then it would show "function pwm_ao_d group pwm_ao_d_10" (similar to what GPIOE_1 shows in your output)

If you want to know if a pull-up/down is enabled you can look at the output of:

$ cat /sys/kernel/debug/pinctrl/ff800000.sys-ctrl\:pinctrl@14-pinctrl-meson/pinconf-pins
(I'm sure this can also be retrieved from some userspace tools, but I
don't know how)
Quoted 7 lines

I now switch using pwm-fan with the local changes I am able to link pwm_ao_d_10_pins
but now the issue is fan keeps on spinning on boot-up and stays on.

I can manually turn on off by using

$ sudo gpioset gpiochip1 10=1   // fan on
$ sudo gpioset gpiochip1 10=0   // fan off

By doing that actually override the PWM function of the pin and set it as a GPIO.

Quoted 36 lines

It is not controlled by the thermal tip as expected. I feel some configuration is missing in pwm-meson driver. Any input for me?

$ sudo cat /sys/kernel/debug/pinctrl/ff800000.sys-ctrl\:pinctrl@14-pinctrl-meson/pinmux-pins
[sudo] password for alarm:
Pinmux settings per pin
Format: pin (name): mux_owner gpio_owner hog?
pin 0 (GPIOAO_0): ff803000.serial (GPIO UNCLAIMED) function uart_ao_a
group uart_ao_a_tx
pin 1 (GPIOAO_1): ff803000.serial (GPIO UNCLAIMED) function uart_ao_a
group uart_ao_a_rx
pin 2 (GPIOAO_2): (MUX UNCLAIMED) aobus-banks:1950
pin 3 (GPIOAO_3): (MUX UNCLAIMED) (GPIO UNCLAIMED)
pin 4 (GPIOAO_4): (MUX UNCLAIMED) (GPIO UNCLAIMED)
pin 5 (GPIOAO_5): ff808000.ir (GPIO UNCLAIMED) function
remote_ao_input group remote_ao_input
pin 6 (GPIOAO_6): (MUX UNCLAIMED) (GPIO UNCLAIMED)
pin 7 (GPIOAO_7): (MUX UNCLAIMED) (GPIO UNCLAIMED)
pin 8 (GPIOAO_8): (MUX UNCLAIMED) aobus-banks:1956
pin 9 (GPIOAO_9): (MUX UNCLAIMED) aobus-banks:1957
pin 10 (GPIOAO_10): ff807000.pwm (GPIO UNCLAIMED) function pwm_ao_d
group pwm_ao_d_10
pin 11 (GPIOAO_11): (MUX UNCLAIMED) aobus-banks:1959
pin 12 (GPIOE_0): (MUX UNCLAIMED) (GPIO UNCLAIMED)
pin 13 (GPIOE_1): ff802000.pwm (GPIO UNCLAIMED) function pwm_ao_d
group pwm_ao_d_e
pin 14 (GPIOE_2): ffd1b000.pwm (GPIO UNCLAIMED) function pwm_a_e group pwm_a_e
$ sudo cat /sys/kernel/debug/pwm
platform/ffd1b000.pwm, 2 PWM devices
  pwm-0   (regulator-vddcpu-a  ): requested enabled period: 1250 ns
duty: 838 ns polarity: normal
  pwm-1   ((null)              ): period: 0 ns duty: 0 ns polarity: normal
Quoted 4 lines

platform/ff807000.pwm, 2 PWM devices
pwm-0 (pwm-fan ): requested period: 1250 ns duty: 0 ns
polarity: normal
pwm-1 ((null) ): period: 0 ns duty: 0 ns polarity: normal

This should be on the pwm-1, hence the "pwm_AO_cd" name, "c" and "d" and the names of the outputs.

So you need to use 1 as first PWM phandle argument instead of 0.

Quoted 7 lines

platform/ff802000.pwm, 2 PWM devices

  pwm-0   ((null)              ): period: 0 ns duty: 0 ns polarity: normal
  pwm-1   (regulator-vddcpu-b  ): requested enabled period: 1250 ns

duty: 1213 ns polarity: normal

I could observe a change in duty when we have stress testing the CPU.

Can you share the complete change you did here ?

Quoted 4 lines

Thanks

-Anand

Neil

author
#6 lore raw

Hi Neil,

Quoted 50 lines · Neil Armstrong

Hi,

Quoted 46 lines · Anand Moon

Hi Martin,

Quoted 28 lines · Martin Blumenstingl

Hi Anand,

On Sat, Oct 22, 2022 at 1:27 PM Anand Moon <[email protected]> wrote:
[...]

Quoted 9 lines
Quoted 9 lines

Review pwm_ao_d_10_pins: pwm-ao-d-10 { · line 1985

Quoted 5 lines
(quoted diff) +0 -1
@@ -1982,7 +1982,6 @@ pwm_ao_d_10_pins: pwm-ao-d-10 {
                                                 mux {
                                                         groups = "pwm_ao_d_10";
                                                         function = "pwm_ao_d";
-                                                       bias-disable;

&pwm_ao_d_10_pins is not referenced anywhere so it seems that this change has no impact on controlling the fan on Odroid-N2(+). How did you test this change?

Quoted 7 lines

Ok I felt these changes affect the behavior of the pinctrl

* @PIN_CONFIG_BIAS_DISABLE: disable any pin bias on the pin, a
* transition from say pull-up to pull-down implies that you disable
* pull-up in the process, this setting disables all biasing.

I mapped this is linked in pinctrl driver, pwm_ao_d_10_pins GPIOAO_10 see below

Yes, I understand this part.
My concern is: &pwm_ao_d_10_pins settings only become active when this node is actively referenced. You can even see it in your output below...

[...]

Quoted 1 line

pin 10 (GPIOAO_10): (MUX UNCLAIMED) aobus-banks:1958

Quoted 9 lines

This shows that it's used as a GPIO. If the &pwm_ao_d_10_pins setting was used then it would show "function pwm_ao_d group pwm_ao_d_10" (similar to what GPIOE_1 shows in your output)

If you want to know if a pull-up/down is enabled you can look at the output of:

$ cat /sys/kernel/debug/pinctrl/ff800000.sys-ctrl\:pinctrl@14-pinctrl-meson/pinconf-pins
(I'm sure this can also be retrieved from some userspace tools, but I
don't know how)

I now switch using pwm-fan with the local changes I am able to link pwm_ao_d_10_pins
but now the issue is fan keeps on spinning on boot-up and stays on.

Quoted 5 lines
Quoted 3 lines

I can manually turn on off by using

$ sudo gpioset gpiochip1 10=1   // fan on
$ sudo gpioset gpiochip1 10=0   // fan off

By doing that actually override the PWM function of the pin and set it as a GPIO.

Yes, I just want to test if this pin is working.

Quoted 48 lines
Quoted 37 lines

It is not controlled by the thermal tip as expected. I feel some configuration is missing in pwm-meson driver. Any input for me?

$ sudo cat /sys/kernel/debug/pinctrl/ff800000.sys-ctrl\:pinctrl@14-pinctrl-meson/pinmux-pins
[sudo] password for alarm:
Pinmux settings per pin
Format: pin (name): mux_owner gpio_owner hog?
pin 0 (GPIOAO_0): ff803000.serial (GPIO UNCLAIMED) function uart_ao_a
group uart_ao_a_tx
pin 1 (GPIOAO_1): ff803000.serial (GPIO UNCLAIMED) function uart_ao_a
group uart_ao_a_rx
pin 2 (GPIOAO_2): (MUX UNCLAIMED) aobus-banks:1950
pin 3 (GPIOAO_3): (MUX UNCLAIMED) (GPIO UNCLAIMED)
pin 4 (GPIOAO_4): (MUX UNCLAIMED) (GPIO UNCLAIMED)
pin 5 (GPIOAO_5): ff808000.ir (GPIO UNCLAIMED) function
remote_ao_input group remote_ao_input
pin 6 (GPIOAO_6): (MUX UNCLAIMED) (GPIO UNCLAIMED)
pin 7 (GPIOAO_7): (MUX UNCLAIMED) (GPIO UNCLAIMED)
pin 8 (GPIOAO_8): (MUX UNCLAIMED) aobus-banks:1956
pin 9 (GPIOAO_9): (MUX UNCLAIMED) aobus-banks:1957
pin 10 (GPIOAO_10): ff807000.pwm (GPIO UNCLAIMED) function pwm_ao_d
group pwm_ao_d_10
pin 11 (GPIOAO_11): (MUX UNCLAIMED) aobus-banks:1959
pin 12 (GPIOE_0): (MUX UNCLAIMED) (GPIO UNCLAIMED)
pin 13 (GPIOE_1): ff802000.pwm (GPIO UNCLAIMED) function pwm_ao_d
group pwm_ao_d_e
pin 14 (GPIOE_2): ffd1b000.pwm (GPIO UNCLAIMED) function pwm_a_e group pwm_a_e
$ sudo cat /sys/kernel/debug/pwm
platform/ffd1b000.pwm, 2 PWM devices
  pwm-0   (regulator-vddcpu-a  ): requested enabled period: 1250 ns
duty: 838 ns polarity: normal
  pwm-1   ((null)              ): period: 0 ns duty: 0 ns polarity: normal
Quoted 4 lines

platform/ff807000.pwm, 2 PWM devices
pwm-0 (pwm-fan ): requested period: 1250 ns duty: 0 ns
polarity: normal
pwm-1 ((null) ): period: 0 ns duty: 0 ns polarity: normal

This should be on the pwm-1, hence the "pwm_AO_cd" name, "c" and "d" and the names of the outputs.

So you need to use 1 as first PWM phandle argument instead of 0.

Quoted 1 line
Quoted 9 lines
Quoted 6 lines

platform/ff802000.pwm, 2 PWM devices

  pwm-0   ((null)              ): period: 0 ns duty: 0 ns polarity: normal
  pwm-1   (regulator-vddcpu-b  ): requested enabled period: 1250 ns

duty: 1213 ns polarity: normal

I could observe a change in duty when we have stress testing the CPU.

Can you share the complete change you did here ?

When I try to use pwm_AO_cd,,
Either one of the PWM binds will fail to get the following error.

&pwm_AO_cd {
- pinctrl-0 = <&pwm_ao_d_e_pins>;

+       pinctrl-0 = <&pwm_ao_d_e_pins>, <&pwm_ao_d_10_pins>;
        pinctrl-names = "default";
        clocks = <&xtal>;
        clock-names = "clkin1";
[    3.941700] pwm-regulator regulator-vddcpu-b: error -EBUSY: Failed to get PWM
[    3.943198] pwm-regulator: probe of regulator-vddcpu-b failed with error -16
[    3.956356] pwm-fan pwm-fan: error -EBUSY: Could not get PWM
[    3.956396] pwm-fan: probe of pwm-fan failed with error -16

Below are my changes with pwm_AO_ab
---------------------------------------------------------------------------------------------

alarm@odroid-n2:~/linux-amlogic-5.y-devel$ git diff
arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dtsi
(quoted diff) +0 -0

b/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dtsi index fd3fa82e4c33..d038ba1e2453 100644

arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dtsi +21 -0
@@ -39,6 +39,14 @@ emmc_pwrseq: emmc-pwrseq {
                reset-gpios = <&gpio BOOT_12 GPIO_ACTIVE_LOW>;
        };
 
+       fan: pwm-fan {
+               compatible = "pwm-fan";
+               pwms = <&pwm_AO_ab 1 1250 0>;
+               fan-supply = <&vcc_5v>;
+               #cooling-cells = <2>;
+               cooling-levels = <0 100 170 230>;
+       };
+
        leds {
                compatible = "gpio-leds";
 
@@ -410,6 +418,40 @@ &cpu103 {
        clock-latency = <50000>;
 };
 
+&cpu_thermal {
+       trips {
+               cpu_active: cpu-active {
+                       temperature = <55000>; /* millicelsius */
+                       hysteresis = <2000>; /* millicelsius */
+                       type = "active";
+               };
+       };
+
+       cooling-maps {
+               map {
+                       trip = <&cpu_active>;
+                       cooling-device = <&fan THERMAL_NO_LIMIT

THERMAL_NO_LIMIT>;
+ };
+ };
+};
+
+&ddr_thermal {
+ trips {
+ ddr_active: ddr-active {

+                       temperature = <55000>; /* millicelsius */
+                       hysteresis = <2000>; /* millicelsius */
+                       type = "active";

+ };
+ };
+
+ cooling-maps {
+ map {
+ trip = <&ddr_active>;
+ cooling-device = <&fan THERMAL_NO_LIMIT
THERMAL_NO_LIMIT>;
+ };
+ };
+};
+

 &ext_mdio {
        external_phy: ethernet-phy@0 {
                /* Realtek RTL8211F (0x001cc916) */
@@ -547,6 +589,14 @@ &pwm_ab {
        status = "okay";

};

+&pwm_AO_ab {

+       pinctrl-0 = <&pwm_ao_d_10_pins>;
+       pinctrl-names = "default";
+       clocks = <&xtal>;
+       clock-names = "clkin1";
+       status = "okay";
+};
+
 &pwm_AO_cd {
        pinctrl-0 = <&pwm_ao_d_e_pins>;
        pinctrl-names = "default";

-------------------------------------------------------------------------------------------

Quoted 6 lines
Quoted 4 lines

Thanks

-Anand

Neil

#7 lore raw

Hi,

Quoted 1 line · Anand Moon

Hi Neil,

<snip>

Quoted 11 lines

When I try to use pwm_AO_cd,,
Either one of the PWM binds will fail to get the following error.

  &pwm_AO_cd {
(quoted diff) +1 -1
-       pinctrl-0 = <&pwm_ao_d_e_pins>;
+       pinctrl-0 = <&pwm_ao_d_e_pins>, <&pwm_ao_d_10_pins>;
         pinctrl-names = "default";
         clocks = <&xtal>;
         clock-names = "clkin1";
Quoted 5 lines
[    3.941700] pwm-regulator regulator-vddcpu-b: error -EBUSY: Failed to get PWM
[    3.943198] pwm-regulator: probe of regulator-vddcpu-b failed with error -16
[    3.956356] pwm-fan pwm-fan: error -EBUSY: Could not get PWM
[    3.956396] pwm-fan: probe of pwm-fan failed with error -16

Yeah because PWM "D" is already used by the "pwm_AO_ab" controller, so you can't use it for the FAN.

Quoted 11 lines

Below are my changes with pwm_AO_ab
---------------------------------------------------------------------------------------------

alarm@odroid-n2:~/linux-amlogic-5.y-devel$ git diff
arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dtsi
arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dtsi +0 -0
index fd3fa82e4c33..d038ba1e2453 100644

arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dtsi emmc_pwrseq: emmc-pwrseq { · line 44

Quoted 6 lines
arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dtsi +3 -0
@@ -39,6 +39,14 @@ emmc_pwrseq: emmc-pwrseq {
                 reset-gpios = <&gpio BOOT_12 GPIO_ACTIVE_LOW>;
         };
 
+       fan: pwm-fan {
+               compatible = "pwm-fan";
+               pwms = <&pwm_AO_ab 1 1250 0>;

Here you use the "B" PWM signal, not the D.

Quoted 6 lines
arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dtsi +5 -0
+               fan-supply = <&vcc_5v>;
+               #cooling-cells = <2>;
+               cooling-levels = <0 100 170 230>;
+       };
+
         leds {

<snip>

Quoted 3 lines

+&pwm_AO_ab {
+ pinctrl-0 = <&pwm_ao_d_10_pins>;

The "pwm_AO_ab" controller only controls the PWM "A" & "B signals, not the "D" !

This basically enables the PWM "D" pin function to GPIOAO_10, it doesn't assign it to the "pwm_AO_ab" controller.

So by enabling this pinctrl, it will duplicate the pwm_ao_d_e_pins signal to pwm_ao_d_10_pins, this is why the FAN spins non-stop.

Quoted 11 lines
arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dtsi +6 -1
+       pinctrl-names = "default";
+       clocks = <&xtal>;
+       clock-names = "clkin1";
+       status = "okay";
+};
+
  &pwm_AO_cd {
         pinctrl-0 = <&pwm_ao_d_e_pins>;
         pinctrl-names = "default";
-------------------------------------------------------------------------------------------
Quoted 1 line
Quoted 1 line
Quoted 5 lines
Quoted 5 lines
Quoted 3 lines

Thanks

-Anand

Neil

Neil

#8 lore raw
Quoted 18 lines · On 27/10/2022 14:49, [email protected] wrote:

Hi,

Quoted 1 line · Anand Moon

Hi Neil,

<snip>

Quoted 11 lines

When I try to use pwm_AO_cd,,
Either one of the PWM binds will fail to get the following error.

  &pwm_AO_cd {
-       pinctrl-0 = <&pwm_ao_d_e_pins>;
+       pinctrl-0 = <&pwm_ao_d_e_pins>, <&pwm_ao_d_10_pins>; pinctrl-names = "default";
         clocks = <&xtal>;
         clock-names = "clkin1";

Quoted 7 lines
Quoted 5 lines

[    3.941700] pwm-regulator regulator-vddcpu-b: error -EBUSY: Failed to get PWM [    3.943198] pwm-regulator: probe of regulator-vddcpu-b failed with error -16

[    3.956356] pwm-fan pwm-fan: error -EBUSY: Could not get PWM [    3.956396] pwm-fan: probe of pwm-fan failed with error -16

Yeah because PWM "D" is already used by the "pwm_AO_ab" controller, so you can't use it for the FAN.

I was meaning regulator-vddcpu-b.

Quoted 55 lines
Quoted 12 lines

Below are my changes with  pwm_AO_ab
---------------------------------------------------------------------------------------------

alarm@odroid-n2:~/linux-amlogic-5.y-devel$ git diff
arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dtsi
arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dtsi +0 -0
index fd3fa82e4c33..d038ba1e2453 100644

arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dtsi emmc_pwrseq: emmc-pwrseq { · line 44

Quoted 6 lines
arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dtsi +3 -0
@@ -39,6 +39,14 @@ emmc_pwrseq: emmc-pwrseq {
                  reset-gpios = <&gpio BOOT_12 GPIO_ACTIVE_LOW>;
          };
 
+       fan: pwm-fan {
+               compatible = "pwm-fan";
+               pwms = <&pwm_AO_ab 1 1250 0>;

Here you use the "B" PWM signal, not the D.

Quoted 6 lines
arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dtsi +5 -0
+               fan-supply = <&vcc_5v>;
+               #cooling-cells = <2>;
+               cooling-levels = <0 100 170 230>;
+       };
+
          leds {

<snip>

Quoted 3 lines

+&pwm_AO_ab {
+       pinctrl-0 = <&pwm_ao_d_10_pins>;

The "pwm_AO_ab" controller only controls the PWM "A" & "B signals, not the "D" !

This basically enables the PWM "D" pin function to GPIOAO_10, it doesn't assign it to the "pwm_AO_ab" controller.

So by enabling this pinctrl, it will duplicate the pwm_ao_d_e_pins signal to pwm_ao_d_10_pins, this is why the FAN spins non-stop.

Quoted 15 lines

+       pinctrl-names = "default";
+       clocks = <&xtal>;
+       clock-names = "clkin1";
+       status = "okay";

arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dtsi +2 -0
+};
+

  &pwm_AO_cd {
         pinctrl-0 = <&pwm_ao_d_e_pins>;
         pinctrl-names = "default";
-------------------------------------------------------------------------------------------

Quoted 5 lines
Quoted 4 lines

Thanks

-Anand

Quoted 8 lines
Quoted 1 line
Quoted 1 line

Neil

Neil

_______________________________________________
linux-amlogic mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-amlogic

_______________________________________________
linux-amlogic mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-amlogic

author
#9 lore raw

Hi Neil,

Quoted 23 lines · Neil Armstrong
Quoted 21 lines · On 27/10/2022 14:49, [email protected] wrote:

Hi,

Quoted 1 line · Anand Moon

Hi Neil,

<snip>

Quoted 14 lines

When I try to use pwm_AO_cd,,
Either one of the PWM binds will fail to get the following error.

  &pwm_AO_cd {
(quoted diff) +1 -1
-       pinctrl-0 = <&pwm_ao_d_e_pins>;
+       pinctrl-0 = <&pwm_ao_d_e_pins>, <&pwm_ao_d_10_pins>;
         pinctrl-names = "default";
         clocks = <&xtal>;
         clock-names = "clkin1";
[    3.941700] pwm-regulator regulator-vddcpu-b: error -EBUSY: Failed to get PWM
[    3.943198] pwm-regulator: probe of regulator-vddcpu-b failed with error -16
Quoted 27 lines
Quoted 4 lines
Quoted 2 lines
[    3.956356] pwm-fan pwm-fan: error -EBUSY: Could not get PWM
[    3.956396] pwm-fan: probe of pwm-fan failed with error -16

Yeah because PWM "D" is already used by the "pwm_AO_ab" controller, so you can't use it for the FAN.

I was meaning regulator-vddcpu-b.

Quoted 20 lines
Quoted 12 lines

Below are my changes with pwm_AO_ab
---------------------------------------------------------------------------------------------

alarm@odroid-n2:~/linux-amlogic-5.y-devel$ git diff
arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dtsi
arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dtsi +0 -0
index fd3fa82e4c33..d038ba1e2453 100644

arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dtsi emmc_pwrseq: emmc-pwrseq { · line 44

Quoted 6 lines
arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dtsi +3 -0
@@ -39,6 +39,14 @@ emmc_pwrseq: emmc-pwrseq {
                 reset-gpios = <&gpio BOOT_12 GPIO_ACTIVE_LOW>;
         };
 
+       fan: pwm-fan {
+               compatible = "pwm-fan";
+               pwms = <&pwm_AO_ab 1 1250 0>;

Here you use the "B" PWM signal, not the D.

Thanks for your review comments, ok now I get better understand of PWM mux configuration
so now I switch to use &pwm_cd, But still, the issue of the fan keeps spinning on start. persist.

$ sudo cat /sys/kernel/debug/pwm
platform/ffd1b000.pwm, 2 PWM devices
 pwm-0   (regulator-vddcpu-a  ): requested enabled period: 1250 ns
duty: 963 ns polarity: normal
 pwm-1   ((null)              ): period: 0 ns duty: 0 ns polarity: normal

platform/ffd1a000.pwm, 2 PWM devices

 pwm-0   ((null)              ): period: 0 ns duty: 0 ns polarity: normal
 pwm-1   (pwm-fan             ): requested period: 1250 ns duty: 0 ns

polarity: normal

platform/ff802000.pwm, 2 PWM devices

 pwm-0   ((null)              ): period: 0 ns duty: 0 ns polarity: normal
 pwm-1   (regulator-vddcpu-b  ): requested enabled period: 1250 ns

duty: 88 ns polarity: normal

Quoted 14 lines
Quoted 14 lines
Quoted 7 lines
arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dtsi +5 -0
+               fan-supply = <&vcc_5v>;
+               #cooling-cells = <2>;
+               cooling-levels = <0 100 170 230>;
+       };
+
         leds {

<snip>

Quoted 3 lines

+&pwm_AO_ab {
+ pinctrl-0 = <&pwm_ao_d_10_pins>;

Quoted 6 lines
Quoted 6 lines

The "pwm_AO_ab" controller only controls the PWM "A" & "B signals, not the "D" !

This basically enables the PWM "D" pin function to GPIOAO_10, it doesn't assign it to the "pwm_AO_ab" controller.

So by enabling this pinctrl, it will duplicate the pwm_ao_d_e_pins signal to pwm_ao_d_10_pins, this is why the FAN spins non-stop.

ok.

Quoted 10 lines
Quoted 10 lines

arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dtsi

Quoted 10 lines
arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dtsi +6 -1
+       pinctrl-names = "default";
+       clocks = <&xtal>;
+       clock-names = "clkin1";
+       status = "okay";
+};
+
  &pwm_AO_cd {
         pinctrl-0 = <&pwm_ao_d_e_pins>;
         pinctrl-names = "default";
-------------------------------------------------------------------------------------------

Thanks
-Anand

_______________________________________________
linux-amlogic mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-amlogic