CP2112(4)

πŸ“¦ version 15.1, in freebsd 14.5, freebsd 15.1, nixpkgs unstable

πŸ’œ CP2112(4) β€” cp2112

okay so welcome to the Kernel Interfaces Manual, section 4, bestie β€” this is where we talk about cp2112, which is literally the driver for a USB GPIO and I2C peripheral device. sit down, grab a strawberry πŸ“, we're gonna get into it.


✨ NAME ✨

cp2112 β€” driver for a USB GPIO and I2C peripheral device πŸ‘‘


πŸŽ€ SYNOPSIS πŸŽ€

so if you wanna compile this driver into the kernel (yes, fully baked in, main character energy), you drop these lines into your kernel configuration file:

device cp2112
device usb
device gpio
device iicbus

or β€” and this is the lowkey easier path β€” you can load the driver as a module at boot time instead, by putting this one line in loader.conf(5):

cp2112_load="YES"

both options are valid, pick your fighter πŸ’…


🌸 DESCRIPTION 🌸

the cp2112 driver provides support for the Silicon Labs CP2112 device, and honestly? it's giving "small but mighty." this thing has 8 general purpose I/O pins plus an I2C controller that supports a subset of the I2C protocol. no cap, that's the whole vibe.

all pins support both input and output modes β€” versatile icon behavior πŸ¦‹. and when a pin is doing output, you can configure it for either open-drain or push-pull operation, so you've got options.

now, the special ones: pins 0, 1 and 7 support special functions β€” that's I2C transmit indication, I2C receive indication and clock output respectively. sounds amazing, right? well... at the moment the cp2112 driver does not provide a way to enable and configure those special functions. so they're just kinda sitting there being iconic and unusable πŸ˜­πŸ™ˆ.

the I2C controller itself is where the numbers get spicy πŸ”₯ β€” here's the tea:

  • it supports read transactions with up to 512 bytes of data
  • it supports write transactions with up to 61 bytes of data
  • it supports a write followed by the repeated start followed by a read transaction, where the write can be up to 16 bytes and the read can be up to 512 bytes
  • zero length transfers are not supported β€” nope, not a thing, don't even try πŸ’€

and finally, the driver creates a gpio(4) and iicbus(4) child buses to expose the respective functions. so like, it's not doing everything itself β€” it's delegating, as a queen should πŸ‘‘.


🌈 SEE ALSO 🌈

go read those next, iykyk πŸ“šβœ¨


⭐ HISTORY ⭐

the cp2112 driver and this manual page were written by Andriy Gapon <avg@FreeBSD.org> β€” we stan a writer who ships both the code and the docs 🫢 periodt.


and that's the whole page, bestie!! this one comes to you from the Debian flavor of things, dated August 12, 2020, living in CP2112(4) β€” mwah πŸ’–πŸŽ€πŸ§š

πŸ“¦ where this page comes from