Skip to contentSkip to conversation

ARM: pxa: spitz: Fix GPIO dev_name for SPI devices

PATCH In review Laurence de Bruxelles 3 participants 3 messages Jul 21, 2022 – Jul 22, 2022

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ARM: pxa: spitz: Fix GPIO dev_name for SPI devices

Kernel >5.18 on Zaurus has a bug where the power management code can't talk to devices, emitting the following errors:

sharpsl-pm sharpsl-pm: Error: AC check failed: voltage -22. sharpsl-pm sharpsl-pm: Charging Error!
sharpsl-pm sharpsl-pm: Warning: Cannot read main battery!

Looking at the recent changes, I found that commit 31455bbda208 ("spi:
pxa2xx_spi: Convert to use GPIO descriptors") replaced the deprecated SPI chip select platform device code with a gpiod lookup table. However, this didn't seem to work until I changed the dev_id member from the device name to the bus id. I'm not entirely sure why this is necessary, but I suspect it is related to the fact that in sysfs SPI devices are attached under /sys/devices/.../dev_name/spi_master/spiB/spiB.C, rather than directly to the device.

One thing I'm not clear on is whether the same change needs to be made to other PXA devices. The previous commit affected 10 devices, this commit only fixes one, but I only have hardware for that one, so possibly other hardware is different.

Fixes 31455bbda208 ("spi: pxa2xx_spi: Convert to use GPIO descriptors")
---
 arch/arm/mach-pxa/spitz.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/mach-pxa/spitz.c +1 -1
index edc2d63ee20d..b1b9385149fc 100644
@@ -578,7 +578,7 @@ static struct pxa2xx_spi_controller spitz_spi_info = {
 };
 
 static struct gpiod_lookup_table spitz_spi_gpio_table = {
-	.dev_id = "pxa2xx-spi.2",
+	.dev_id = "spi2",
 	.table = {
 		GPIO_LOOKUP_IDX("gpio-pxa", SPITZ_GPIO_ADS7846_CS, "cs", 0, GPIO_ACTIVE_LOW),
 		GPIO_LOOKUP_IDX("gpio-pxa", SPITZ_GPIO_LCDCON_CS, "cs", 1, GPIO_ACTIVE_LOW),
Signature · 7 lines
2.37.0


_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
#1 lore raw
Quoted 17 lines · Laurence de Bruxelles

Kernel >5.18 on Zaurus has a bug where the power management code can't talk to devices, emitting the following errors:

sharpsl-pm sharpsl-pm: Error: AC check failed: voltage -22. sharpsl-pm sharpsl-pm: Charging Error!
sharpsl-pm sharpsl-pm: Warning: Cannot read main battery!

Looking at the recent changes, I found that commit 31455bbda208 ("spi:
pxa2xx_spi: Convert to use GPIO descriptors") replaced the deprecated SPI chip select platform device code with a gpiod lookup table. However, this didn't seem to work until I changed the dev_id member from the device name to the bus id. I'm not entirely sure why this is necessary, but I suspect it is related to the fact that in sysfs SPI devices are attached under /sys/devices/.../dev_name/spi_master/spiB/spiB.C, rather than directly to the device.

Quoted 6 lines

One thing I'm not clear on is whether the same change needs to be made to other PXA devices. The previous commit affected 10 devices, this commit only fixes one, but I only have hardware for that one, so possibly other hardware is different.

Fixes 31455bbda208 ("spi: pxa2xx_spi: Convert to use GPIO descriptors")

I think all the previous conversions were done blindly, so it's most likely that everything needs the same change.

Linus, can you have a look at this? I don't understand where the name is supposed to come from, and importantly what the best fix is. I assume we can address this either by changing all the board files to use the correct dev_id, or by changing the gpio drivers to change the ID of the gpio controller to be what we expected it to be.

Arnd

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

#2 lore raw
Quoted 10 lines · Arnd Bergmann
Quoted 6 lines · Laurence de Bruxelles

One thing I'm not clear on is whether the same change needs to be made to other PXA devices. The previous commit affected 10 devices, this commit only fixes one, but I only have hardware for that one, so possibly other hardware is different.

Fixes 31455bbda208 ("spi: pxa2xx_spi: Convert to use GPIO descriptors")
Quoted 8 lines

I think all the previous conversions were done blindly, so it's most likely that everything needs the same change.

Linus, can you have a look at this? I don't understand where the name is supposed to come from, and importantly what the best fix is. I assume we can address this either by changing all the board files to use the correct dev_id, or by changing the gpio drivers to change the ID of the gpio controller to be what we expected it to be.

I'm surprised the change was so small to make things actually work, one of the best side effects is that we now know that Laurence is using the Zaurus!

I have sent a patch fixing up all the sites with Laurence as reporter.

Laurence: please consider signing up as maintainer of the Zaurus/spitz in MAINTAINERS, also possibly start looking at a DT conversion :)

Yours,
Linus Walleij

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