drivers/media/i2c/cx25840/cx25840-vbi.c
Source file repositories/reference/linux-study-clean/drivers/media/i2c/cx25840/cx25840-vbi.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/media/i2c/cx25840/cx25840-vbi.c- Extension
.c- Size
- 7105 bytes
- Lines
- 263
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/videodev2.hlinux/i2c.hmedia/v4l2-common.hmedia/drv-intf/cx25840.hcx25840-core.h
Detected Declarations
function odd_parityfunction decode_vpsfunction cx25840_g_sliced_fmtfunction cx25840_s_raw_fmtfunction cx25840_s_sliced_fmtfunction cx25840_decode_vbi_line
Annotated Snippet
switch (svbi->service_lines[1-x][i]) {
case V4L2_SLICED_TELETEXT_B:
lcr[i] |= 1 << (4 * x);
break;
case V4L2_SLICED_WSS_625:
lcr[i] |= 4 << (4 * x);
break;
case V4L2_SLICED_CAPTION_525:
lcr[i] |= 6 << (4 * x);
break;
case V4L2_SLICED_VPS:
lcr[i] |= 9 << (4 * x);
break;
}
}
}
if (is_pal) {
for (x = 1, i = state->vbi_regs_offset + 0x424;
i <= state->vbi_regs_offset + 0x434; i++, x++)
cx25840_write(client, i, lcr[6 + x]);
} else {
for (x = 1, i = state->vbi_regs_offset + 0x424;
i <= state->vbi_regs_offset + 0x430; i++, x++)
cx25840_write(client, i, lcr[9 + x]);
for (i = state->vbi_regs_offset + 0x431;
i <= state->vbi_regs_offset + 0x434; i++)
cx25840_write(client, i, 0);
}
cx25840_write(client, state->vbi_regs_offset + 0x43c, 0x16);
/* TODO: this will have to be changed for generic_mode VBI */
if (is_cx23888(state))
cx25840_write(client, 0x428, is_pal ? 0x2a : 0x22);
else
cx25840_write(client, 0x474, is_pal ? 0x2a : 0x22);
return 0;
}
int cx25840_decode_vbi_line(struct v4l2_subdev *sd, struct v4l2_decode_vbi_line *vbi)
{
struct cx25840_state *state = to_state(sd);
u8 *p = vbi->p;
int id1, id2, l, err = 0;
if (p[0] || p[1] != 0xff || p[2] != 0xff ||
(p[3] != 0x55 && p[3] != 0x91)) {
vbi->line = vbi->type = 0;
return 0;
}
p += 4;
id1 = p[-1];
id2 = p[0] & 0xf;
l = p[2] & 0x3f;
l += state->vbi_line_offset;
p += 4;
switch (id2) {
case 1:
id2 = V4L2_SLICED_TELETEXT_B;
break;
case 4:
id2 = V4L2_SLICED_WSS_625;
break;
case 6:
id2 = V4L2_SLICED_CAPTION_525;
err = !odd_parity(p[0]) || !odd_parity(p[1]);
break;
case 9:
id2 = V4L2_SLICED_VPS;
if (decode_vps(p, p) != 0)
err = 1;
break;
default:
id2 = 0;
err = 1;
break;
}
vbi->type = err ? 0 : id2;
vbi->line = err ? 0 : l;
vbi->is_second_field = err ? 0 : (id1 == 0x55);
vbi->p = p;
return 0;
}
Annotation
- Immediate include surface: `linux/videodev2.h`, `linux/i2c.h`, `media/v4l2-common.h`, `media/drv-intf/cx25840.h`, `cx25840-core.h`.
- Detected declarations: `function odd_parity`, `function decode_vps`, `function cx25840_g_sliced_fmt`, `function cx25840_s_raw_fmt`, `function cx25840_s_sliced_fmt`, `function cx25840_decode_vbi_line`.
- 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.