cvs_wait_wake_or_sleep(9)
π cvs_wait_wake_or_sleep(9) β the kernel API manual, bestie edition
Okay so this is a page straight out of the Kernel API Manual, section 9, and it's all about cvs_wait_wake_or_sleep(9) β the little function that decides whether you're gonna wait for a wake event or just take a nap. Slay. Let's get into it β¨
πΈ NAME πΈ
cvs_wait_wake_or_sleep β literally just: wait for the wake IRQ, or fall back to sleeping. That's the whole vibe π
π SYNOPSIS π
int cvs_wait_wake_or_sleep (struct icvs *ctx , unsigned long
timeout_jiffies , unsigned int sleep_ms );
π¦ ARGUMENTS π¦
ctxβ the CVS device context. Your main character struct, iykyk π«Άtimeout_jiffiesβ how long (in jiffies, bestie, jiffies) to wait for a wake event on full-cap devices. This is the "how long am I willing to stand here" number β³sleep_msβ how many milliseconds to actually sleep on light-cap devices. Nap duration, basically π΄
β¨ DESCRIPTION β¨
So here's the tea, and it's honestly giving dual-personality in the best way π₯
For full capability devices (that's ICVS_FULLCAP, no cap), it waits interruptibly on ctx->hostwake_event until ctx->hostwake_event_arg becomes true β or until timeout_jiffies elapses, whichever comes first. And then β important detail β the flag is cleared after the wait. Cleanup queen π
For light capability devices, it just does a blocking msleep(sleep_ms). No drama, no polling, just a solid nap. Periodt π
Oh and the return codes? They're deliberately normalized so the caller can just switch on them π§ That's the whole point:
<0β error / interrupted π-ETIMEDOUTβ timeout (wake event not observed) π0β success (wake observed OR light-cap sleep elapsed) π
π RETURN π
- a negative
errno -ETIMEDOUTon timeout0on success
That's it, that's the whole return menu π
β SEE ALSO β
Kernel file ./drivers/media/i2c/cvs/core.c β plus the whole friend group, because this function does not operate alone:
cvs_set_quirks(9), cvs_read_i2c(9), cvs_write_i2c(9), cvs_checksum(9), cvs_schedule_and_wait(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)
π And that's the page! Sourced from ./drivers/media/i2c/cvs, dated October 2026 β go forth and wait (or sleep) responsibly, bestie π«Άβ¨
π¦ 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