of_gpio_spi_cs_get_count(9)
π 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:
-EINVALif the"gpios"property is incorrectly formed (malformed bestie, it's giving broken)-ENOENTif 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
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms