drivers/media/i2c/et8ek8/et8ek8_driver.c
Source file repositories/reference/linux-study-clean/drivers/media/i2c/et8ek8/et8ek8_driver.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/media/i2c/et8ek8/et8ek8_driver.c- Extension
.c- Size
- 35886 bytes
- Lines
- 1513
- 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/gpio/consumer.hlinux/i2c.hlinux/kernel.hlinux/module.hlinux/mutex.hlinux/regulator/consumer.hlinux/slab.hlinux/sort.hlinux/v4l2-mediabus.hmedia/media-entity.hmedia/v4l2-ctrls.hmedia/v4l2-device.hmedia/v4l2-subdev.het8ek8_reg.h
Detected Declarations
struct et8ek8_sensorenum et8ek8_versionsfunction et8ek8_i2c_read_regfunction et8ek8_i2c_create_msgfunction et8ek8_i2c_buffered_write_regsfunction et8ek8_i2c_write_regsfunction et8ek8_i2c_write_regfunction et8ek8_i2c_reglist_find_writefunction et8ek8_reglist_to_mbusfunction et8ek8_reglist_cmpfunction et8ek8_reglist_importfunction et8ek8_set_gainfunction et8ek8_set_test_patternfunction et8ek8_set_ctrlfunction et8ek8_init_controlsfunction et8ek8_update_controlsfunction et8ek8_configurefunction et8ek8_stream_onfunction et8ek8_stream_offfunction et8ek8_s_streamfunction et8ek8_power_offfunction et8ek8_power_onfunction et8ek8_enum_mbus_codefunction et8ek8_enum_frame_sizefunction et8ek8_enum_frame_ivalfunction __et8ek8_get_pad_formatfunction et8ek8_get_pad_formatfunction et8ek8_set_pad_formatfunction et8ek8_get_frame_intervalfunction et8ek8_set_frame_intervalfunction et8ek8_g_priv_memfunction et8ek8_dev_initfunction priv_mem_showfunction et8ek8_registeredfunction __et8ek8_set_powerfunction et8ek8_set_powerfunction et8ek8_openfunction et8ek8_closefunction et8ek8_suspendfunction et8ek8_resumefunction et8ek8_probefunction et8ek8_remove
Annotated Snippet
struct et8ek8_sensor {
struct v4l2_subdev subdev;
struct media_pad pad;
struct v4l2_mbus_framefmt format;
struct gpio_desc *reset;
struct regulator *vana;
struct clk *ext_clk;
u32 xclk_freq;
u16 version;
struct v4l2_ctrl_handler ctrl_handler;
struct v4l2_ctrl *exposure;
struct v4l2_ctrl *pixel_rate;
struct et8ek8_reglist *current_reglist;
u8 priv_mem[ET8EK8_PRIV_MEM_SIZE];
struct mutex power_lock;
int power_count;
};
#define to_et8ek8_sensor(sd) container_of(sd, struct et8ek8_sensor, subdev)
enum et8ek8_versions {
ET8EK8_REV_1 = 0x0001,
ET8EK8_REV_2,
};
/*
* This table describes what should be written to the sensor register
* for each gain value. The gain(index in the table) is in terms of
* 0.1EV, i.e. 10 indexes in the table give 2 time more gain [0] in
* the *analog gain, [1] in the digital gain
*
* Analog gain [dB] = 20*log10(regvalue/32); 0x20..0x100
*/
static struct et8ek8_gain {
u16 analog;
u16 digital;
} const et8ek8_gain_table[] = {
{ 32, 0}, /* x1 */
{ 34, 0},
{ 37, 0},
{ 39, 0},
{ 42, 0},
{ 45, 0},
{ 49, 0},
{ 52, 0},
{ 56, 0},
{ 60, 0},
{ 64, 0}, /* x2 */
{ 69, 0},
{ 74, 0},
{ 79, 0},
{ 84, 0},
{ 91, 0},
{ 97, 0},
{104, 0},
{111, 0},
{119, 0},
{128, 0}, /* x4 */
{137, 0},
{147, 0},
{158, 0},
{169, 0},
{181, 0},
{194, 0},
{208, 0},
{223, 0},
{239, 0},
{256, 0}, /* x8 */
{256, 73},
{256, 152},
{256, 236},
{256, 327},
{256, 424},
{256, 528},
{256, 639},
{256, 758},
{256, 886},
{256, 1023}, /* x16 */
};
/* Register definitions */
#define REG_REVISION_NUMBER_L 0x1200
#define REG_REVISION_NUMBER_H 0x1201
#define PRIV_MEM_START_REG 0x0008
#define PRIV_MEM_WIN_SIZE 8
Annotation
- Immediate include surface: `linux/clk.h`, `linux/delay.h`, `linux/gpio/consumer.h`, `linux/i2c.h`, `linux/kernel.h`, `linux/module.h`, `linux/mutex.h`, `linux/regulator/consumer.h`.
- Detected declarations: `struct et8ek8_sensor`, `enum et8ek8_versions`, `function et8ek8_i2c_read_reg`, `function et8ek8_i2c_create_msg`, `function et8ek8_i2c_buffered_write_regs`, `function et8ek8_i2c_write_regs`, `function et8ek8_i2c_write_reg`, `function et8ek8_i2c_reglist_find_write`, `function et8ek8_reglist_to_mbus`, `function et8ek8_reglist_cmp`.
- 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.