MCPGPIO(4)

πŸ“¦ version 11.0, in nixpkgs unstable

πŸ’… MCPGPIO πŸ’…

okay so this is the mcpgpio man page, straight out of the Kernel Interfaces Manual (that's section 4, driver town πŸš—βœ¨). it's the driver for Microchip I/O Expanders on I2C and SPI bus, and bestie, it's lowkey iconic.


✨ NAME ✨

mcpgpio β€” the Driver for Microchip I/O Expanders on I2C and SPI bus πŸ¦‹


🌸 SYNOPSIS 🌸

πŸŽ€ I2C

mcpgpio* at iic? addr ?
gpio* at gpiobus?

πŸŽ€ SPI

mcpgpio0 at spi? slave 0 flags 0
mcpgpio1 at spi? slave 0 flags 1
mcpgpio2 at spi? slave 0 flags 2
mcpgpio3 at spi? slave 0 flags 3
gpio* at gpiobus?

πŸ’– DESCRIPTION πŸ’–

the mcpgpio driver is the main character for these Microchip I/O Expanders, no cap:

  • MCP23008 β€” 8-bit I/O expander, I2C interface
  • MCP23S08 β€” 8-bit I/O expander, SPI interface
  • MCP23017 β€” 16-bit I/O expander, I2C interface
  • MCP23S17 β€” 16-bit I/O expander, SPI interface
  • MCP23018 β€” 16-bit I/O expander, open-drain outputs, I2C interface
  • MCP23S18 β€” 16-bit I/O expander, open-drain outputs, SPI interface

access to the pins? oh that's all handled by the gpio(4) interface. it's giving delegation, we love to see it 🫢

the SPI version of these devices fr fr supports multiple chips per chip select signal. on the MCP23S08 and MCP23S17, you pull that off by tying the address select pins to VDD or GND to select an address β€” that's 0-3 on MCP23S08 or 0-7 on MCP23S17. the MCP23S18 has a similar capability but it's extra about it: it uses an analog voltage input on a single address select pin, plus an internal voltage divider ladder and a series of comparators, to generate the 3 address bits πŸ§šβ€β™€οΈ (see the data sheet for details, iykyk).

the flags argument in the configuration directive for SPI attachments selects the hardware address of the chip instance for that driver instance. periodt. πŸ‘‘


πŸ’€ SEE ALSO πŸ’€

gpio(4), iic(4), intro(4), spi(4)


🌈 HISTORY 🌈

the mcpgpio driver first appeared in NetBSD 7.0. then it got a whole glow-up in NetBSD 10.0 to support additional chip types and to add the I2C attachment. ate and left no crumbs πŸ’…πŸ”₯


πŸ‘‘ AUTHORS πŸ‘‘

the mcpgpio driver was written by Frank Kardel <kardel@NetBSD.org> and Jason R. Thorpe <thorpej@NetBSD.org>. kings, literally 🫢


πŸ™ˆ BUGS πŸ™ˆ

⚠️ bestie, listen: SPI instances of the mcpgpio driver do not utilize the Device Tree bindings for this device. 😭
⚠️ also, the mcpgpio driver does not currently act as a GPIO provider for the platform device tree. ngl, mildly tragic.

πŸ“ and that's the whole page!! this one's from Debian, dated January 10, 2022, and it's MCPGPIO(4) β€” go forth and expand your I/O, bestie πŸ’œβœ¨πŸŽ€

πŸ“¦ where this page comes from