cvs_read_i2c(9)
π cvs_read_i2c β bestie's guide to the Kernel API Manual β¨
okay so picture this: you're deep in cvs_read_i2c(9) land, the kernel API manual is open, and you just want the device to talk back to you. say less, i got you π«Ά
πΈ NAME πΈ
cvs_read_i2c β the girlie that issues a read-type command and fetches the device response. two jobs, one function, main character energy fr fr π
β¨ SYNOPSIS β¨
int cvs_read_i2c (struct icvs *ctx , __be16 cmd_id , void *resp , size_t
size );
that's the whole vibe check. four params, one int back, no drama π
π ARGUMENTS π
ctxβ the CVS device context. it's giving "your ticket into the device", don't lose it πcmd_idβ the command identifier, and yes bestie it's big endian (__be16). byte order matters, ngl π₯respβ destination buffer for the response payload. this is where the answer lands πsizeβ size of the payload to read intoresp, and note the fine print: without prefix. so don't be counting the prefix bytes in here, ok? β
π¦ DESCRIPTION π¦
so here's what actually happens: it sends cmd_id and reads back the response in a single I2C transaction. one trip, both things done, we love an efficient icon π
and the lowkey genius part: when the device prepends a 4-byte protocol prefix, the combined prefix+payload gets read into a temporary buffer, and then only the payload is copied to resp. meaning? no dependency at all on the layout of the caller's buffer. your buffer can be shaped however, it literally does not care π§
π RETURN π
0 on success, or a negative errno. so like β zero is the slay, anything negative is the situation π
π SEE ALSO π
kernel file ./drivers/media/i2c/cvs/core.c plus the whole friend group:
cvs_set_quirks(9), cvs_write_i2c(9), cvs_checksum(9), cvs_schedule_and_wait(9), cvs_wait_wake_or_sleep(9), cvs_config_mipi(9), cvs_get_device_state(9), cvs_get_device_caps(9), cvs_hw_init(9), cvs_irq_handler(9), cvs_reset(9), cvs_recv(9), cvs_send(9), cvs_set_link_owner(9), cvs_configure_dev_caps(9), cvs_core_probe(9), cvs_probe(9), cvs_core_remove(9), cvs_remove(9), cvs_suspend(9), cvs_resume(9), cvs_runtime_resume(9), cvs_runtime_suspend(9), cvs_init(9), cvs_exit(9)
ok that's the whole page, no notes π go read your I2C responses responsibly bestie
this lil gem lives in ./drivers/media/i2c/cvs, stamped October 2026 β see you in the next manpage, 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