drivers/media/i2c/tvp5150.c
Source file repositories/reference/linux-study-clean/drivers/media/i2c/tvp5150.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/media/i2c/tvp5150.c- Extension
.c- Size
- 62194 bytes
- Lines
- 2293
- 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.
- Touches IRQ or DMA behavior; this matters for the representative real-device path.
- 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
dt-bindings/media/tvp5150.hlinux/i2c.hlinux/slab.hlinux/videodev2.hlinux/delay.hlinux/gpio/consumer.hlinux/interrupt.hlinux/module.hlinux/of_graph.hlinux/pm_runtime.hlinux/regmap.hmedia/v4l2-async.hmedia/v4l2-device.hmedia/v4l2-event.hmedia/v4l2-ctrls.hmedia/v4l2-fwnode.hmedia/v4l2-mc.hmedia/v4l2-rect.htvp5150_reg.h
Detected Declarations
struct tvp5150_connectorstruct tvp5150struct i2c_reg_valuestruct tvp5150_vbi_typestruct i2c_vbi_ram_valueenum tvp5150_padsfunction tvp5150_readfunction dump_reg_rangefunction tvp5150_log_statusfunction tvp5150_selmuxfunction tvp5150_write_inittabfunction tvp5150_vdp_initfunction tvp5150_g_sliced_vbi_capfunction flagsfunction tvp5150_get_vbifunction tvp5150_set_stdfunction tvp5150_g_stdfunction tvp5150_s_stdfunction tvp5150_read_stdfunction query_lockfunction tvp5150_querystdfunction tvp5150_isrfunction tvp5150_resetfunction tvp5150_enablefunction tvp5150_s_ctrlfunction tvp5150_set_defaultfunction tvp5150_get_pad_cropfunction tvp5150_fill_fmtfunction tvp5150_get_hmaxfunction tvp5150_set_hw_selectionfunction tvp5150_set_selectionfunction tvp5150_get_selectionfunction tvp5150_get_mbus_configfunction tvp5150_init_statefunction subdev_openfunction tvp5150_enum_mbus_codefunction tvp5150_enum_frame_sizefunction tvp5150_set_linkfunction tvp5150_disable_all_input_linksfunction tvp5150_link_setupfunction tvp5150_runtime_suspendfunction tvp5150_runtime_resumefunction tvp5150_s_streamfunction tvp5150_s_routingfunction tvp5150_s_raw_fmtfunction tvp5150_s_sliced_fmtfunction tvp5150_g_sliced_fmtfunction tvp5150_g_register
Annotated Snippet
struct tvp5150_connector {
struct v4l2_fwnode_connector base;
struct media_entity ent;
struct media_pad pad;
};
struct tvp5150 {
struct v4l2_subdev sd;
struct media_pad pads[TVP5150_NUM_PADS];
struct tvp5150_connector connectors[TVP5150_MAX_CONNECTORS];
struct tvp5150_connector *cur_connector;
unsigned int connectors_num;
struct v4l2_ctrl_handler hdl;
struct v4l2_rect rect;
struct regmap *regmap;
int irq;
v4l2_std_id norm; /* Current set standard */
v4l2_std_id detected_norm;
u32 input;
u32 output;
u32 oe;
int enable;
bool lock;
u16 dev_id;
u16 rom_ver;
enum v4l2_mbus_type mbus_type;
};
static inline struct tvp5150 *to_tvp5150(struct v4l2_subdev *sd)
{
return container_of(sd, struct tvp5150, sd);
}
static inline struct v4l2_subdev *to_sd(struct v4l2_ctrl *ctrl)
{
return &container_of(ctrl->handler, struct tvp5150, hdl)->sd;
}
static int tvp5150_read(struct v4l2_subdev *sd, unsigned char addr)
{
struct tvp5150 *decoder = to_tvp5150(sd);
int ret, val;
ret = regmap_read(decoder->regmap, addr, &val);
if (ret < 0)
return ret;
return val;
}
static void dump_reg_range(struct v4l2_subdev *sd, char *s, u8 init,
const u8 end, int max_line)
{
u8 buf[16];
int i = 0, j, len;
if (max_line > 16) {
dprintk0(sd->dev, "too much data to dump\n");
return;
}
for (i = init; i < end; i += max_line) {
len = (end - i > max_line) ? max_line : end - i;
for (j = 0; j < len; j++)
buf[j] = tvp5150_read(sd, i + j);
dprintk0(sd->dev, "%s reg %02x = %*ph\n", s, i, len, buf);
}
}
static int tvp5150_log_status(struct v4l2_subdev *sd)
{
dprintk0(sd->dev, "tvp5150: Video input source selection #1 = 0x%02x\n",
tvp5150_read(sd, TVP5150_VD_IN_SRC_SEL_1));
dprintk0(sd->dev, "tvp5150: Analog channel controls = 0x%02x\n",
tvp5150_read(sd, TVP5150_ANAL_CHL_CTL));
dprintk0(sd->dev, "tvp5150: Operation mode controls = 0x%02x\n",
tvp5150_read(sd, TVP5150_OP_MODE_CTL));
dprintk0(sd->dev, "tvp5150: Miscellaneous controls = 0x%02x\n",
tvp5150_read(sd, TVP5150_MISC_CTL));
dprintk0(sd->dev, "tvp5150: Autoswitch mask= 0x%02x\n",
tvp5150_read(sd, TVP5150_AUTOSW_MSK));
dprintk0(sd->dev, "tvp5150: Color killer threshold control = 0x%02x\n",
tvp5150_read(sd, TVP5150_COLOR_KIL_THSH_CTL));
Annotation
- Immediate include surface: `dt-bindings/media/tvp5150.h`, `linux/i2c.h`, `linux/slab.h`, `linux/videodev2.h`, `linux/delay.h`, `linux/gpio/consumer.h`, `linux/interrupt.h`, `linux/module.h`.
- Detected declarations: `struct tvp5150_connector`, `struct tvp5150`, `struct i2c_reg_value`, `struct tvp5150_vbi_type`, `struct i2c_vbi_ram_value`, `enum tvp5150_pads`, `function tvp5150_read`, `function dump_reg_range`, `function tvp5150_log_status`, `function tvp5150_selmux`.
- Atlas domain: Driver Families / drivers/media.
- Implementation status: source implementation candidate.
- IRQ or DMA behavior appears here, which is relevant to the selected PCIe/NVMe device path.
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.