drivers/media/i2c/thp7312.c
Source file repositories/reference/linux-study-clean/drivers/media/i2c/thp7312.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/media/i2c/thp7312.c- Extension
.c- Size
- 60164 bytes
- Lines
- 2250
- 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/unaligned.hlinux/clk.hlinux/delay.hlinux/device.hlinux/firmware.hlinux/gpio/consumer.hlinux/i2c.hlinux/init.hlinux/iopoll.hlinux/kernel.hlinux/module.hlinux/mtd/spi-nor.hlinux/pm_runtime.hlinux/property.hlinux/regulator/consumer.hlinux/slab.hlinux/types.hmedia/v4l2-async.hmedia/v4l2-cci.hmedia/v4l2-ctrls.hmedia/v4l2-device.hmedia/v4l2-fwnode.hmedia/v4l2-subdev.huapi/linux/thp7312.h
Detected Declarations
struct thp7312_frame_ratestruct thp7312_mode_infostruct thp7312_devicestruct thp7312_sensor_infostruct thp7312_sensorstruct thp7312_deviceenum thp7312_focus_methodenum thp7312_focus_stateenum thp7312_boot_modefunction thp7312_find_modefunction thp7312_find_ratefunction thp7312_map_data_lanesfunction thp7312_set_mipi_lanesfunction thp7312_change_modefunction thp7312_set_framefmtfunction thp7312_init_modefunction thp7312_stream_enablefunction thp7312_check_status_stream_modefunction thp7312_resetfunction __thp7312_power_offfunction thp7312_power_offfunction __thp7312_power_onfunction thp7312_power_onfunction thp7312_pm_runtime_suspendfunction thp7312_pm_runtime_resumefunction thp7312_find_bus_codefunction thp7312_enum_mbus_codefunction thp7312_enum_frame_sizefunction thp7312_enum_frame_intervalfunction thp7312_set_fmtfunction thp7312_set_frame_intervalfunction thp7312_s_streamfunction thp7312_init_statefunction thp7312_set_focusfunction thp7312_s_ctrlfunction thp7312_init_controlsfunction thp7312_read_firmware_versionfunction thp7312_write_buffunction __thp7312_flash_reg_writefunction __thp7312_flash_reg_readfunction thp7312_fw_prepare_configfunction thp7312_fw_prepare_checkfunction thp7312_fw_prepare_resetfunction thp7312_flash_erasefunction thp7312_write_download_data_by_unitfunction thp7312_fw_load_to_ramfunction thp7312_fw_write_to_flashfunction thp7312_fw_check_crc
Annotated Snippet
struct thp7312_frame_rate {
u32 fps;
u32 link_freq;
u8 reg_frame_rate_mode;
};
struct thp7312_mode_info {
u32 width;
u32 height;
u8 reg_image_size;
const struct thp7312_frame_rate *rates;
};
static const u32 thp7312_colour_fmts[] = {
MEDIA_BUS_FMT_YUYV8_1X16,
};
/* regulator supplies */
static const char * const thp7312_supply_name[] = {
"vddcore",
"vhtermrx",
"vddtx",
"vddhost",
"vddcmos",
"vddgpio-0",
"vddgpio-1",
};
static const struct thp7312_mode_info thp7312_mode_info_data[] = {
{
.width = 1920,
.height = 1080,
.reg_image_size = THP7312_VIDEO_IMAGE_SIZE_1920x1080,
.rates = (const struct thp7312_frame_rate[]) {
{ 30, 300000000, 0x81 },
{ 60, 387500000, 0x82 },
{ 0 }
},
}, {
.width = 2048,
.height = 1536,
.reg_image_size = THP7312_VIDEO_IMAGE_SIZE_2048x1536,
.rates = (const struct thp7312_frame_rate[]) {
{ 30, 300000000, 0x81 },
{ 0 }
}
}, {
.width = 3840,
.height = 2160,
.reg_image_size = THP7312_VIDEO_IMAGE_SIZE_3840x2160,
.rates = (const struct thp7312_frame_rate[]) {
{ 30, 600000000, 0x81 },
{ 0 }
},
}, {
.width = 4160,
.height = 3120,
.reg_image_size = THP7312_VIDEO_IMAGE_SIZE_4160x3120,
.rates = (const struct thp7312_frame_rate[]) {
{ 20, 600000000, 0x81 },
{ 0 }
},
},
};
struct thp7312_device;
struct thp7312_sensor_info {
const char *model;
};
struct thp7312_sensor {
const struct thp7312_sensor_info *info;
u8 lane_remap;
};
struct thp7312_device {
struct device *dev;
struct regmap *regmap;
struct v4l2_subdev sd;
struct media_pad pad;
struct gpio_desc *reset_gpio;
struct regulator_bulk_data supplies[ARRAY_SIZE(thp7312_supply_name)];
struct clk *iclk;
u8 lane_remap;
struct thp7312_sensor sensors[1];
Annotation
- Immediate include surface: `linux/unaligned.h`, `linux/clk.h`, `linux/delay.h`, `linux/device.h`, `linux/firmware.h`, `linux/gpio/consumer.h`, `linux/i2c.h`, `linux/init.h`.
- Detected declarations: `struct thp7312_frame_rate`, `struct thp7312_mode_info`, `struct thp7312_device`, `struct thp7312_sensor_info`, `struct thp7312_sensor`, `struct thp7312_device`, `enum thp7312_focus_method`, `enum thp7312_focus_state`, `enum thp7312_boot_mode`, `function thp7312_find_mode`.
- 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.