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

Anand Moon linux.amoon at gmail.com
Thu Oct 27 12:18:23 PDT 2022


Hi Neil,

On Thu, 27 Oct 2022 at 19:02, Neil Armstrong
<narmstrong.kernel at gmail.com> wrote:
>
> On 27/10/2022 14:49, neil.armstrong at linaro.org wrote:
> > Hi,
> >
> > On 26/10/2022 18:02, Anand Moon wrote:
> >> Hi Neil,
> >
> > <snip>
> >
> >>
> >> 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
> >
> > 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.
>
> >
> >>
> >> Below are my changes with  pwm_AO_ab
> >> ---------------------------------------------------------------------------------------------
> >> alarm at odroid-n2:~/linux-amlogic-5.y-devel$ git diff
> >> arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dtsi
> >> diff --git a/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dtsi
> >> b/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dtsi
> >> index fd3fa82e4c33..d038ba1e2453 100644
> >> --- a/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dtsi
> >> +++ b/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-n2.dtsi
> >> @@ -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

> >
> >> +               fan-supply = <&vcc_5v>;
> >> +               #cooling-cells = <2>;
> >> +               cooling-levels = <0 100 170 230>;
> >> +       };
> >> +
> >>          leds {
> >
> > <snip>
> >
> >>
> >> +&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.
> >
ok.
> >> +       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



More information about the linux-amlogic mailing list