STRUCT MCP320X(9)
π struct mcp320x π
okay so real talk β this is a page from the Kernel API Manual, and today's main character is struct mcp320x, aka the Microchip SPI ADC instance. yes bestie, we're doing kernel structs now, and honestly? it's giving iconic. π
β¨ NAME β¨
struct mcp320x β the Microchip SPI ADC instance herself. that's it, that's the vibe. π
πΈ SYNOPSIS πΈ
like, here's literally the whole struct, copied exactly, no cap:
struct mcp320x {
struct spi_device *spi;
struct spi_message msg;
struct spi_transfer transfer[2];
struct spi_message start_conv_msg;
struct spi_transfer start_conv_transfer;
struct regulator *reg;
struct mutex lock;
const struct mcp320x_chip_info *chip_info;
u8 tx_buf;
u8 rx_buf[4];
};
look at her. ten fields. absolutely ate. π₯
π¦ Members π¦
time for the roll call, bestie β every single field, no skips, no "skip the boring ones" energy:
spiβ the SPI slave, which is also the parent of the IIO device. proud parent energy fr fr. πmsgβ the SPI message that selects a channel and receives a value from the ADC. she does two jobs and does them both flawlessly. πtransferβ the SPI transfers thatmsguses. the supporting cast, but honestly? essential. β¨start_conv_msgβ the SPI message that starts a conversion by briefly asserting CS. brief but powerful, like a story post. βstart_conv_transferβ the SPI transfer thatstart_conv_msguses. they're a duo, iykyk. π«Άregβ the regulator generating Vref. keeping the voltage cute and stable. πlockβ this one protects read sequences. a whole mutex just for that. security queen behavior, we love to see it. π (well,lock, but you get me)chip_infoβ the ADC properties. her little info card. πtx_bufβ the buffer fortransfer[0], and lowkey important detail: it's not used on single-channel converters. so if you're on single-channel, she's just chilling there unused. πrx_bufβ the buffer fortransfer[1]. currently four whole bytes ofu8coming home to roost. π
π SEE ALSO π
- the kernel file
./drivers/iio/adc/mcp320x.cβ go read the source bestie, it's right there π
okay that's the whole page, and that's on periodt. this cutie lives in ./drivers/iio/adc, and the manual itself is dated October 2026 β screenshot it, frame it, put it on the fridge. π§π
π¦ 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