of_gpio_spi_cs_get_count(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… of_gpio_spi_cs_get_count β€” Kernel API Manual ✨

okay so bestie, we're in the Kernel API Manual and this page is literally called of_gpio_spi_cs_get_count(9), which is the special GPIO counting situation for SPI. yes it's a mouthful, no we're not changing it, it's iconic πŸŽ€


🌸 NAME 🌸

of_gpio_spi_cs_get_count β€” special GPIO counting for SPI. that's the whole vibe. ✨


πŸ¦‹ SYNOPSIS πŸ¦‹

int of_gpio_spi_cs_get_count (const struct device_node *np , const char
*con_id );

πŸŽ€ ARGUMENTS πŸŽ€

  • np β€” the Consuming device node, aka the one doing the consuming, main character energy πŸ‘‘
  • con_id β€” the Function within the GPIO consumer. like, which function is this consumer even doing rn

πŸ’– DESCRIPTION πŸ’–

so here's the tea, bestie: some elder GPIO controllers have special quirks. not bad, just... built different. currently we handle the Freescale and PPC GPIO controller, whose bindings lowkey refuse to use the established "cs-gpios" for chip selects and instead rely on "gpios" for the chip select lines. the way that is so not the standard 😭

if we detect this situation, we redirect the counting of "cs-gpios" to count "gpios" instead β€” fully transparent to the driver. nobody even notices. slay 🫢


πŸ”₯ RETURN πŸ”₯

you get either the number of GPIOs defined in the property, or:

  • -EINVAL if the "gpios" property is incorrectly formed (malformed bestie, it's giving broken)
  • -ENOENT if the "gpios" property is just... missing. gone. not here. πŸ’€

🧚 SEE ALSO 🧚

Kernel file ./drivers/gpio/gpiolib-of.c plus the whole friend group: of_gpio_named_count(9), of_get_named_gpiod_flags(9), of_gpiochip_remove_hog(9), of_gpio_twocell_xlate(9), of_gpio_threecell_xlate(9). iykyk πŸ’œ


ngl, if you're messing with "gpios" properties on Freescale or PPC hardware, read this twice. the redirect is transparent, but the errors are not shy about showing up.

that's a wrap, bestie! 🌈 this little gem lives over in ./drivers/gpio, dated October 2026, and it's filed under the Kernel API Manual β€” go be obsessed with it responsibly β­πŸ’…

πŸ“¦ where this page comes from