arm: dts: sunxi: h3/h5: add gpio-ranges for pio and r_pio
Subsystems (2)
PATCH 1/1 arm: dts: sunxi: h3/h5: add gpio-ranges for pio and r_pio
Without this property the next node can't be hogged:
&r_pio {
test_hog {
gpio-hog;
gpios = <0 6 GPIO_ACTIVE_HIGH>;
output-high;
};
};And the appropriate error message:
"requesting hog GPIO test_hog (chip 1f02c00.pinctrl, offset 6) failed, -517"
This problem occurs because the "pinctrl-sunxi" calls "gpiochip_add_data" that parses "gpio-ranges"
(using "of_gpiochip_add_pin_range") and registers hogs (using "of_gpiochip_scan_gpios").
So when the gpiolib tries to register hogs it can't find any ranges and fails.
--- arch/arm/boot/dts/sunxi-h3-h5.dtsi | 4 ++++ 1 file changed, 4 insertions(+)
arch/arm/boot/dts/sunxi-h3-h5.dtsi +4 -0
@@ -404,6 +404,9 @@ pio: pinctrl@1c20800 { #gpio-cells = <3>; interrupt-controller; #interrupt-cells = <3>; + gpio-ranges = <&pio 0 0 22>, <&pio 64 64 17>, + <&pio 96 96 18>, <&pio 128 128 16>, + <&pio 160 160 7>, <&pio 192 192 14>; csi_pins: csi-pins { pins = "PE0", "PE2", "PE3", "PE4", "PE5",
@@ -937,6 +940,7 @@ r_pio: pinctrl@1f02c00 { #gpio-cells = <3>; interrupt-controller; #interrupt-cells = <3>; + gpio-ranges = <&r_pio 0 352 12>; r_ir_rx_pin: r-ir-rx-pin { pins = "PL11";
Signature · 1 line
2.25.1
Quoted 28 lines · On Sun, 22 May 2022 20:20:19 +0300 Andrei Lalaev <[email protected]>…
Without this property the next node can't be hogged:
&r_pio { test_hog { gpio-hog; gpios = <0 6 GPIO_ACTIVE_HIGH>; output-high; }; };And the appropriate error message:
"requesting hog GPIOtest_hog(chip 1f02c00.pinctrl, offset 6) failed, -517"This problem occurs because the "pinctrl-sunxi" calls "
gpiochip_add_data" that parses "gpio-ranges"
(using "of_gpiochip_add_pin_range") and registers hogs (using "of_gpiochip_scan_gpios").
So when the gpiolib tries to register hogs it can't find any ranges and fails.Signed-off-by Andrei Lalaev <[email protected]>--- arch/arm/boot/dts/sunxi-h3-h5.dtsi | 4 ++++ 1 file changed, 4 insertions(+)arch/arm/boot/dts/sunxi-h3-h5.dtsi +0
-0
arch/arm/boot/dts/sunxi-h3-h5.dtsi pio: pinctrl@1c20800 { · line 409
Quoted 6 lines
arch/arm/boot/dts/sunxi-h3-h5.dtsi +3
-0@@ -404,6 +404,9 @@ pio: pinctrl@1c20800 { #gpio-cells = <3>; interrupt-controller; #interrupt-cells = <3>; + gpio-ranges = <&pio 0 0 22>, <&pio 64 64 17>, + <&pio 96 96 18>, <&pio 128 128 16>, + <&pio 160 160 7>, <&pio 192 192 14>;
But this is somewhat redundant information, because the pinctrl driver knows about those values, as they are derived from the big struct sunxi_desc_pin definition.
So wouldn't it be smarter to put a call to gpiochip_add_pingroup_range() somewhere into the sunxi pinctrl driver, so that it would automatically work for all SoCs?
Cheers,
Andre
Quoted 11 lines
arch/arm/boot/dts/sunxi-h3-h5.dtsi +1
-0csi_pins: csi-pins { pins = "PE0", "PE2", "PE3", "PE4", "PE5",@@ -937,6 +940,7 @@ r_pio: pinctrl@1f02c00 { #gpio-cells = <3>; interrupt-controller; #interrupt-cells = <3>; + gpio-ranges = <&r_pio 0 352 12>; r_ir_rx_pin: r-ir-rx-pin { pins = "PL11";
Quoted 6 lines · On Sun, 22 May 2022 22:26:30 +0100 Andre Przywara <[email protected]>…
But this is somewhat redundant information, because the pinctrl driver knows about those values, as they are derived from the big struct
sunxi_desc_pindefinition.
So wouldn't it be smarter to put a call togpiochip_add_pingroup_range()somewhere into the sunxi pinctrl driver, so that it would automatically work for all SoCs?
Sorry, I forgot about the other SoCs. I completely agree with you now. I will try to fix it in another way.
Thank you, Andre!
Best regards,
Andrei Lalaev
Andre, I checked the gpiolib API and didn't find any function I can use to register gpio-hogs specified in DTS.
But I found the similar patch to the qcom driver. Could you please check it?
https://patchwork.kernel.org/project/linux-arm-kernel/patch/[email protected]/
What do you think about it? Is it a good idea to impelement the same changes in "sunxi-pinctrl" driver?
Best regards,
Andrei Lalaev
Samuel Holland
maintainerHi Andrei,
Quoted 7 lines · Andrei Lalaev
Andre, I checked the gpiolib API and didn't find any function I can use to register gpio-hogs specified in DTS.
But I found the similar patch to the qcom driver. Could you please check it?
https://patchwork.kernel.org/project/linux-arm-kernel/patch/[email protected]/What do you think about it? Is it a good idea to impelement the same changes in "sunxi-pinctrl" driver?
Yes, those are exactly the kind of changes we need.
Regards,
Samuel