STRUCT CCS_QUIRK(9)
π struct ccs_quirk(9) β like, the whole vibe
okay so bestie, welcome to the Kernel API Manual section 9, where we talk about struct ccs_quirk β¨ β literally the designated coping mechanism for sensors that refuse to follow the SMIA++ standard. no cap, these are quirks for sensors that deviate from that standard, and honestly? relatable. we all deviate sometimes π
πΈ SYNOPSIS πΈ
here's the whole struct, character for character, because we do not paraphrase code in this house:
struct ccs_quirk {
int (*limits)(struct ccs_sensor *sensor);
int (*post_poweron)(struct ccs_sensor *sensor);
int (*pre_streamon)(struct ccs_sensor *sensor);
int (*post_streamoff)(struct ccs_sensor *sensor);
unsigned long (*pll_flags)(struct ccs_sensor *sensor);
int (*init)(struct ccs_sensor *sensor);
int (*reg_access)(struct ccs_sensor *sensor, bool write, u32 *reg, u32 *val);
unsigned long flags;
};
yes ma'am, that's eight members and one very important flags field at the end. we love a struct that knows what it is π«Ά
π Members π
like a little roster of function pointers, each one doing its own iconic thing:
limitsβ swaps outsensor->limitswith values that genuinely can't be read from the sensor registers. it gets called the first time the sensor is powered up. so like, once. only once. main character energy, one appearance only πpost_poweronβ called always after the sensor has been fully powered on. no conditions, no ifs, just vibes β¨pre_streamonβ called just before streaming is enabled. a little pre-game ritual πpost_streamoffβ called right after stopping streaming. the cool-down stretch πpll_flagsβ returns flags for the PLL calculator. that's it, that's the whole job π§initβ quirk initialisation, and it's called last in probe. also the appropriate spot for adding sensor specific controls, for instance. so like, if you're gonna do it, do it here bestie πreg_accessβ the register access quirk. plot twist: the quirk may divert the access to another register, or to no register at all π. giving "i'll take it from here" energyflagsβ quirk flags. short, sweet, iconic π
β¨ Description β¨
okay this part is specifically about reg_access, and the original writes it as a lovely run-on, so let's break it down but keep every single bit of it:
-write: is this a read (false) or a write (true) access?-reg: pointer to the register to access-val: register value β set by the caller on write, or by the quirk on read-return:0on success,-ENOIOCTLCMDif no register access may be done by the caller (default read value is zero), else negative error code on error
ngl, that -ENOIOCTLCMD return is the one to remember fr fr β if the caller isn't allowed to do the register access, that's the code you get back, and the default read value comes back as zero. not optional knowledge, bestie π
π¦ SEE ALSO π¦
- Kernel file
./drivers/media/i2c/ccs/ccs-quirk.hβ go read it, iykyk π
and that's the whole page, bestie! πΈ this little gem lives in ./drivers/media/i2c/ccs and it's dated October 2026 β so mark your calendar, mwah ππ
π¦ 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