Message ID | 20230620200022.295674-2-macroalpha82@gmail.com |
---|---|
State | New |
Headers | show |
Series | [1/3] arm: dts: sun8i: V3s: Add pinctrl for pwm | expand |
在 2023-06-21星期三的 00:50 +0100,Andre Przywara写道: > On Tue, 20 Jun 2023 15:00:20 -0500 > Chris Morgan <macroalpha82@gmail.com> wrote: > > Hi Chris, > > thanks for taking care of upstreaming, cute little device. > > > From: Chris Morgan <macromorgan@hotmail.com> > > > > Add a default pinctrl for the pwm function. > > > > Signed-off-by: Chris Morgan <macromorgan@hotmail.com> > > > > --- > > arch/arm/boot/dts/sun8i-v3s.dtsi | 7 +++++++ > > 1 file changed, 7 insertions(+) > > > > diff --git a/arch/arm/boot/dts/sun8i-v3s.dtsi > > b/arch/arm/boot/dts/sun8i-v3s.dtsi > > index b001251644f7..e5977524abe2 100644 > > --- a/arch/arm/boot/dts/sun8i-v3s.dtsi > > +++ b/arch/arm/boot/dts/sun8i-v3s.dtsi > > @@ -414,6 +414,11 @@ mmc1_pins: mmc1-pins { > > bias-pull-up; > > }; > > > > + pwm_pins: pwm-pins { > > + pins = "PB4"; > > + function = "pwm0"; > > + }; > > + > > spi0_pins: spi0-pins { > > pins = "PC0", "PC1", "PC2", "PC3"; > > function = "spi0"; > > @@ -441,6 +446,8 @@ pwm: pwm@1c21400 { > > "allwinner,sun7i-a20-pwm"; > > reg = <0x01c21400 0xc>; > > clocks = <&osc24M>; > > + pinctrl-0 = <&pwm_pins>; > > + pinctrl-names = "default"; > > How is this supposed to work with multiple channels? There is PWM1 on > PB5. If one wants to potentially use that, we would need to add a > reference to those pins here as well, and they would all be muxed to > PWM upon the PWM controller probing? > > So while I see that it's the only output pin for PWM0, this might > still > need to go into the board .dts, alongside the status = "okay"; line. > So > each board would specify exactly the pins it needs (PWM0 only, PWM1 > only, both or none). Maybe we should have two PWM pinctrl nodes, pwm0_pins and pwm1_pins, and then enable the controller (with the pinctrl property) in individual board DTs. > > Otherwise I compared this against the manual and Linux pinctrl > driver, > it all matches up. > > Cheers, > Andre > > > #pwm-cells = <3>; > > status = "disabled"; > > }; >
On Sat, 24 Jun 2023 12:57:49 +0800 Icenowy Zheng <uwu@icenowy.me> wrote: > 在 2023-06-21星期三的 00:50 +0100,Andre Przywara写道: > > On Tue, 20 Jun 2023 15:00:20 -0500 > > Chris Morgan <macroalpha82@gmail.com> wrote: > > > > Hi Chris, > > > > thanks for taking care of upstreaming, cute little device. > > > > > From: Chris Morgan <macromorgan@hotmail.com> > > > > > > Add a default pinctrl for the pwm function. > > > > > > Signed-off-by: Chris Morgan <macromorgan@hotmail.com> > > > > > > > --- > > > arch/arm/boot/dts/sun8i-v3s.dtsi | 7 +++++++ > > > 1 file changed, 7 insertions(+) > > > > > > diff --git a/arch/arm/boot/dts/sun8i-v3s.dtsi > > > b/arch/arm/boot/dts/sun8i-v3s.dtsi > > > index b001251644f7..e5977524abe2 100644 > > > --- a/arch/arm/boot/dts/sun8i-v3s.dtsi > > > +++ b/arch/arm/boot/dts/sun8i-v3s.dtsi > > > @@ -414,6 +414,11 @@ mmc1_pins: mmc1-pins { > > > bias-pull-up; > > > }; > > > > > > + pwm_pins: pwm-pins { > > > + pins = "PB4"; > > > + function = "pwm0"; > > > + }; > > > + > > > spi0_pins: spi0-pins { > > > pins = "PC0", "PC1", "PC2", "PC3"; > > > function = "spi0"; > > > @@ -441,6 +446,8 @@ pwm: pwm@1c21400 { > > > "allwinner,sun7i-a20-pwm"; > > > reg = <0x01c21400 0xc>; > > > clocks = <&osc24M>; > > > + pinctrl-0 = <&pwm_pins>; > > > + pinctrl-names = "default"; > > > > How is this supposed to work with multiple channels? There is PWM1 on > > PB5. If one wants to potentially use that, we would need to add a > > reference to those pins here as well, and they would all be muxed to > > PWM upon the PWM controller probing? > > > > So while I see that it's the only output pin for PWM0, this might > > still > > need to go into the board .dts, alongside the status = "okay"; line. > > So > > each board would specify exactly the pins it needs (PWM0 only, PWM1 > > only, both or none). > > Maybe we should have two PWM pinctrl nodes, pwm0_pins and pwm1_pins, > and then enable the controller (with the pinctrl property) in > individual board DTs. Yes, that's what I meant: keep the pinctrl node in the .dtsi here, but move the pinctrl *properties* to each board's .dts. Cheers, Andre > > Otherwise I compared this against the manual and Linux pinctrl > > driver, > > it all matches up. > > > > Cheers, > > Andre > > > > > #pwm-cells = <3>; > > > status = "disabled"; > > > }; > > >
diff --git a/arch/arm/boot/dts/sun8i-v3s.dtsi b/arch/arm/boot/dts/sun8i-v3s.dtsi index b001251644f7..e5977524abe2 100644 --- a/arch/arm/boot/dts/sun8i-v3s.dtsi +++ b/arch/arm/boot/dts/sun8i-v3s.dtsi @@ -414,6 +414,11 @@ mmc1_pins: mmc1-pins { bias-pull-up; }; + pwm_pins: pwm-pins { + pins = "PB4"; + function = "pwm0"; + }; + spi0_pins: spi0-pins { pins = "PC0", "PC1", "PC2", "PC3"; function = "spi0"; @@ -441,6 +446,8 @@ pwm: pwm@1c21400 { "allwinner,sun7i-a20-pwm"; reg = <0x01c21400 0xc>; clocks = <&osc24M>; + pinctrl-0 = <&pwm_pins>; + pinctrl-names = "default"; #pwm-cells = <3>; status = "disabled"; };