drivers/media/i2c/tc358746.c
Source file repositories/reference/linux-study-clean/drivers/media/i2c/tc358746.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/media/i2c/tc358746.c- Extension
.c- Size
- 43485 bytes
- Lines
- 1718
- 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/bitfield.hlinux/clk.hlinux/clk-provider.hlinux/delay.hlinux/i2c.hlinux/interrupt.hlinux/kernel.hlinux/module.hlinux/phy/phy-mipi-dphy.hlinux/property.hlinux/pm_runtime.hlinux/regmap.hlinux/units.hmedia/v4l2-ctrls.hmedia/v4l2-device.hmedia/v4l2-fwnode.hmedia/v4l2-mc.h
Detected Declarations
struct tc358746struct tc358746_formatfunction tc358746_get_format_by_idxfunction tc358746_get_format_by_codefunction tc358746_src_mbus_codefunction tc358746_valid_regfunction tc358746_writefunction tc358746_readfunction tc358746_update_bitsfunction tc358746_set_bitsfunction tc358746_clear_bitsfunction tc358746_sw_resetfunction tc358746_apply_pll_configfunction tc358746_calc_vb_sizefunction tc358746_apply_misc_configfunction tc358746_cfg_to_cntfunction tc358746_ps_to_cntfunction tc358746_us_to_cntfunction tc358746_apply_dphy_configfunction tc358746_enable_csi_lanesfunction tc358746_enable_csi_modulefunction tc358746_enable_parallel_portfunction tc358746_s_streamfunction tc358746_init_statefunction tc358746_enum_mbus_codefunction tc358746_set_fmtfunction tc358746_find_pll_settingsfunction tc358746_get_mbus_configfunction tc358746_g_registerfunction tc358746_s_registerfunction tc358746_mclk_enablefunction tc358746_mclk_disablefunction tc358746_find_mclk_settingsfunction tc358746_recalc_ratefunction tc358746_mclk_determine_ratefunction tc358746_mclk_set_ratefunction tc358746_setup_mclk_providerfunction tc358746_init_subdevfunction tc358746_init_output_portfunction tc358746_init_hwfunction tc358746_init_controlsfunction tc358746_notify_boundfunction tc358746_async_registerfunction tc358746_probefunction tc358746_removefunction tc358746_clk_enablefunction tc358746_suspendfunction tc358746_resume
Annotated Snippet
struct tc358746 {
struct v4l2_subdev sd;
struct media_pad pads[TC358746_NR_PADS];
struct v4l2_async_notifier notifier;
struct v4l2_fwnode_endpoint csi_vep;
struct v4l2_ctrl_handler ctrl_hdl;
struct regmap *regmap;
struct clk *refclk;
struct gpio_desc *reset_gpio;
struct regulator_bulk_data supplies[ARRAY_SIZE(tc358746_supplies)];
struct clk_hw mclk_hw;
unsigned long mclk_rate;
u8 mclk_prediv;
u16 mclk_postdiv;
unsigned long pll_rate;
u8 pll_post_div;
u16 pll_pre_div;
u16 pll_mul;
struct phy_configure_opts_mipi_dphy dphy_cfg;
};
static inline struct tc358746 *to_tc358746(struct v4l2_subdev *sd)
{
return container_of(sd, struct tc358746, sd);
}
static inline struct tc358746 *clk_hw_to_tc358746(struct clk_hw *hw)
{
return container_of(hw, struct tc358746, mclk_hw);
}
struct tc358746_format {
u32 code;
bool csi_format;
unsigned char bus_width;
unsigned char bpp;
/* Register values */
u8 pdformat; /* Peripheral Data Format */
u8 pdataf; /* Parallel Data Format Option */
};
enum {
PDFORMAT_RAW8 = 0,
PDFORMAT_RAW10,
PDFORMAT_RAW12,
PDFORMAT_RGB888,
PDFORMAT_RGB666,
PDFORMAT_RGB565,
PDFORMAT_YUV422_8BIT,
/* RESERVED = 7 */
PDFORMAT_RAW14 = 8,
PDFORMAT_YUV422_10BIT,
PDFORMAT_YUV444,
};
#define TC358746_FORMAT_RAW(_bpp, _code) \
{ \
.code = _code, \
.bus_width = _bpp, \
.bpp = _bpp, \
.pdformat = PDFORMAT_RAW##_bpp, \
.pdataf = PDATAF_MODE0, /* don't care */ \
}
/* Check tc358746_src_mbus_code() if you add new formats */
static const struct tc358746_format tc358746_formats[] = {
{
.code = MEDIA_BUS_FMT_UYVY8_2X8,
.bus_width = 8,
.bpp = 16,
.pdformat = PDFORMAT_YUV422_8BIT,
.pdataf = PDATAF_MODE0,
}, {
.code = MEDIA_BUS_FMT_UYVY8_1X16,
.csi_format = true,
.bus_width = 16,
.bpp = 16,
.pdformat = PDFORMAT_YUV422_8BIT,
.pdataf = PDATAF_MODE1,
}, {
.code = MEDIA_BUS_FMT_YUYV8_1X16,
.csi_format = true,
.bus_width = 16,
.bpp = 16,
.pdformat = PDFORMAT_YUV422_8BIT,
Annotation
- Immediate include surface: `linux/bitfield.h`, `linux/clk.h`, `linux/clk-provider.h`, `linux/delay.h`, `linux/i2c.h`, `linux/interrupt.h`, `linux/kernel.h`, `linux/module.h`.
- Detected declarations: `struct tc358746`, `struct tc358746_format`, `function tc358746_get_format_by_idx`, `function tc358746_get_format_by_code`, `function tc358746_src_mbus_code`, `function tc358746_valid_reg`, `function tc358746_write`, `function tc358746_read`, `function tc358746_update_bits`, `function tc358746_set_bits`.
- 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.