drivers/media/platform/cadence/cdns-csi2tx.c
Source file repositories/reference/linux-study-clean/drivers/media/platform/cadence/cdns-csi2tx.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/media/platform/cadence/cdns-csi2tx.c- Extension
.c- Size
- 16293 bytes
- Lines
- 658
- 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.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- 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/clk.hlinux/delay.hlinux/io.hlinux/module.hlinux/mutex.hlinux/of.hlinux/of_graph.hlinux/platform_device.hlinux/slab.hmedia/mipi-csi2.hmedia/v4l2-ctrls.hmedia/v4l2-device.hmedia/v4l2-fwnode.hmedia/v4l2-subdev.h
Detected Declarations
struct csi2tx_fmtstruct csi2tx_privstruct csi2tx_vopsstruct csi2tx_privenum csi2tx_padsfunction csi2tx_enum_mbus_codefunction __csi2tx_get_pad_formatfunction csi2tx_get_pad_formatfunction csi2tx_set_pad_formatfunction csi2tx_dphy_set_wakeupfunction csi2tx_dphy_init_finishfunction csi2tx_dphy_setupfunction csi2tx_v2_dphy_setupfunction csi2tx_resetfunction csi2tx_startfunction media_pipeline_startfunction csi2tx_stopfunction csi2tx_s_streamfunction csi2tx_get_resourcesfunction csi2tx_check_lanesfunction csi2tx_probefunction csi2tx_remove
Annotated Snippet
struct csi2tx_fmt {
u32 mbus;
u32 dt;
u32 bpp;
};
struct csi2tx_priv;
/* CSI2TX Variant Operations */
struct csi2tx_vops {
void (*dphy_setup)(struct csi2tx_priv *csi2tx);
};
struct csi2tx_priv {
struct device *dev;
unsigned int count;
/*
* Used to prevent race conditions between multiple,
* concurrent calls to start and stop.
*/
struct mutex lock;
void __iomem *base;
struct csi2tx_vops *vops;
struct clk *esc_clk;
struct clk *p_clk;
struct clk *pixel_clk[CSI2TX_STREAMS_MAX];
struct v4l2_subdev subdev;
struct media_pad pads[CSI2TX_PAD_MAX];
struct v4l2_mbus_framefmt pad_fmts[CSI2TX_PAD_MAX];
bool has_internal_dphy;
u8 lanes[CSI2TX_LANES_MAX];
unsigned int num_lanes;
unsigned int max_lanes;
unsigned int max_streams;
};
static const struct csi2tx_fmt csi2tx_formats[] = {
{
.mbus = MEDIA_BUS_FMT_UYVY8_1X16,
.bpp = 2,
.dt = MIPI_CSI2_DT_YUV422_8B,
},
{
.mbus = MEDIA_BUS_FMT_RGB888_1X24,
.bpp = 3,
.dt = MIPI_CSI2_DT_RGB888,
},
};
static const struct v4l2_mbus_framefmt fmt_default = {
.width = 1280,
.height = 720,
.code = MEDIA_BUS_FMT_RGB888_1X24,
.field = V4L2_FIELD_NONE,
.colorspace = V4L2_COLORSPACE_DEFAULT,
};
static inline
struct csi2tx_priv *v4l2_subdev_to_csi2tx(struct v4l2_subdev *subdev)
{
return container_of(subdev, struct csi2tx_priv, subdev);
}
static const struct csi2tx_fmt *csi2tx_get_fmt_from_mbus(u32 mbus)
{
unsigned int i;
for (i = 0; i < ARRAY_SIZE(csi2tx_formats); i++)
if (csi2tx_formats[i].mbus == mbus)
return &csi2tx_formats[i];
return NULL;
}
static int csi2tx_enum_mbus_code(struct v4l2_subdev *subdev,
struct v4l2_subdev_state *sd_state,
struct v4l2_subdev_mbus_code_enum *code)
{
if (code->pad || code->index >= ARRAY_SIZE(csi2tx_formats))
return -EINVAL;
code->code = csi2tx_formats[code->index].mbus;
return 0;
Annotation
- Immediate include surface: `linux/clk.h`, `linux/delay.h`, `linux/io.h`, `linux/module.h`, `linux/mutex.h`, `linux/of.h`, `linux/of_graph.h`, `linux/platform_device.h`.
- Detected declarations: `struct csi2tx_fmt`, `struct csi2tx_priv`, `struct csi2tx_vops`, `struct csi2tx_priv`, `enum csi2tx_pads`, `function csi2tx_enum_mbus_code`, `function __csi2tx_get_pad_format`, `function csi2tx_get_pad_format`, `function csi2tx_set_pad_format`, `function csi2tx_dphy_set_wakeup`.
- Atlas domain: Driver Families / drivers/media.
- Implementation status: source implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
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.