drivers/media/i2c/cx25840/cx25840-core.c
Source file repositories/reference/linux-study-clean/drivers/media/i2c/cx25840/cx25840-core.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/media/i2c/cx25840/cx25840-core.c- Extension
.c- Size
- 119157 bytes
- Lines
- 4007
- Domain
- Driver Families
- Bucket
- drivers/media
- Inferred role
- Driver Families: implementation source
- Status
- source implementation candidate
Why This File Exists
Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/kernel.hlinux/module.hlinux/slab.hlinux/videodev2.hlinux/i2c.hlinux/delay.hlinux/math64.hmedia/v4l2-common.hmedia/drv-intf/cx25840.hcx25840-core.h
Detected Declarations
function cx25840_writefunction cx25840_write4function cx25840_readfunction cx25840_read4function cx25840_and_orfunction cx25840_and_or4function cx23885_s_io_pin_configfunction cx25840_function_to_padfunction cx25840_set_invertfunction cx25840_s_io_pin_configfunction common_s_io_pin_configfunction init_dll1function init_dll2function cx25836_initializefunction cx25840_work_handlerfunction cx25840_vconfig_applyfunction cx25840_initializefunction cx23885_initializefunction cx231xx_initializefunction cx25840_std_setupfunction input_changefunction set_inputfunction regfunction set_v4lstdfunction cx25840_s_ctrlfunction cx25840_set_fmtfunction log_video_statusfunction log_audio_statusfunction cx25840_vconfig_addfunction cx25840_initfunction cx25840_resetfunction invocationfunction cx25840_g_registerfunction cx25840_s_registerfunction cx25840_s_audio_streamfunction cx25840_s_streamfunction cx25840_querystdfunction cx25840_g_input_statusfunction cx25840_g_stdfunction cx25840_s_stdfunction cx25840_s_radiofunction cx25840_s_video_routingfunction cx25840_s_audio_routingfunction cx25840_s_frequencyfunction cx25840_g_tunerfunction cx25840_s_tunerfunction cx25840_log_statusfunction cx23885_irq_handler
Annotated Snippet
switch (p[i].pin) {
case CX23885_PIN_IRQ_N_GPIO16:
if (p[i].function != CX23885_PAD_IRQ_N) {
/* GPIO16 */
pin_ctrl &= ~(0x1 << 25);
} else {
/* IRQ_N */
if (p[i].flags &
(BIT(V4L2_SUBDEV_IO_PIN_DISABLE) |
BIT(V4L2_SUBDEV_IO_PIN_INPUT))) {
pin_ctrl &= ~(0x1 << 25);
} else {
pin_ctrl |= (0x1 << 25);
}
if (p[i].flags &
BIT(V4L2_SUBDEV_IO_PIN_ACTIVE_LOW)) {
pin_ctrl &= ~(0x1 << 24);
} else {
pin_ctrl |= (0x1 << 24);
}
}
break;
case CX23885_PIN_IR_RX_GPIO19:
if (p[i].function != CX23885_PAD_GPIO19) {
/* IR_RX */
gpio_oe |= (0x1 << 0);
pin_ctrl &= ~(0x3 << 18);
pin_ctrl |= (strength << 18);
} else {
/* GPIO19 */
gpio_oe &= ~(0x1 << 0);
if (p[i].flags & BIT(V4L2_SUBDEV_IO_PIN_SET_VALUE)) {
gpio_data &= ~(0x1 << 0);
gpio_data |= ((p[i].value & 0x1) << 0);
}
pin_ctrl &= ~(0x3 << 12);
pin_ctrl |= (strength << 12);
}
break;
case CX23885_PIN_IR_TX_GPIO20:
if (p[i].function != CX23885_PAD_GPIO20) {
/* IR_TX */
gpio_oe |= (0x1 << 1);
if (p[i].flags & BIT(V4L2_SUBDEV_IO_PIN_DISABLE))
pin_ctrl &= ~(0x1 << 10);
else
pin_ctrl |= (0x1 << 10);
pin_ctrl &= ~(0x3 << 18);
pin_ctrl |= (strength << 18);
} else {
/* GPIO20 */
gpio_oe &= ~(0x1 << 1);
if (p[i].flags & BIT(V4L2_SUBDEV_IO_PIN_SET_VALUE)) {
gpio_data &= ~(0x1 << 1);
gpio_data |= ((p[i].value & 0x1) << 1);
}
pin_ctrl &= ~(0x3 << 12);
pin_ctrl |= (strength << 12);
}
break;
case CX23885_PIN_I2S_SDAT_GPIO21:
if (p[i].function != CX23885_PAD_GPIO21) {
/* I2S_SDAT */
/* TODO: Input or Output config */
gpio_oe |= (0x1 << 2);
pin_ctrl &= ~(0x3 << 22);
pin_ctrl |= (strength << 22);
} else {
/* GPIO21 */
gpio_oe &= ~(0x1 << 2);
if (p[i].flags & BIT(V4L2_SUBDEV_IO_PIN_SET_VALUE)) {
gpio_data &= ~(0x1 << 2);
gpio_data |= ((p[i].value & 0x1) << 2);
}
pin_ctrl &= ~(0x3 << 12);
pin_ctrl |= (strength << 12);
}
break;
case CX23885_PIN_I2S_WCLK_GPIO22:
if (p[i].function != CX23885_PAD_GPIO22) {
/* I2S_WCLK */
/* TODO: Input or Output config */
gpio_oe |= (0x1 << 3);
pin_ctrl &= ~(0x3 << 22);
pin_ctrl |= (strength << 22);
} else {
/* GPIO22 */
gpio_oe &= ~(0x1 << 3);
if (p[i].flags & BIT(V4L2_SUBDEV_IO_PIN_SET_VALUE)) {
gpio_data &= ~(0x1 << 3);
Annotation
- Immediate include surface: `linux/kernel.h`, `linux/module.h`, `linux/slab.h`, `linux/videodev2.h`, `linux/i2c.h`, `linux/delay.h`, `linux/math64.h`, `media/v4l2-common.h`.
- Detected declarations: `function cx25840_write`, `function cx25840_write4`, `function cx25840_read`, `function cx25840_read4`, `function cx25840_and_or`, `function cx25840_and_or4`, `function cx23885_s_io_pin_config`, `function cx25840_function_to_pad`, `function cx25840_set_invert`, `function cx25840_s_io_pin_config`.
- Atlas domain: Driver Families / drivers/media.
- Implementation status: source implementation candidate.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.