drivers/media/i2c/s5k5baf.c
Source file repositories/reference/linux-study-clean/drivers/media/i2c/s5k5baf.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/media/i2c/s5k5baf.c- Extension
.c- Size
- 51141 bytes
- Lines
- 2036
- 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/firmware.hlinux/gpio/consumer.hlinux/i2c.hlinux/media.hlinux/module.hlinux/of_graph.hlinux/regulator/consumer.hlinux/slab.hmedia/media-entity.hmedia/v4l2-ctrls.hmedia/v4l2-device.hmedia/v4l2-subdev.hmedia/v4l2-mediabus.hmedia/v4l2-fwnode.h
Detected Declarations
struct s5k5baf_pixfmtstruct s5k5baf_ctrlsstruct s5k5baf_fwstruct s5k5bafenum s5k5baf_gpio_idenum selection_rectfunction s5k5baf_fw_parsefunction s5k5baf_is_cis_subdevfunction s5k5baf_i2c_readfunction s5k5baf_i2c_writefunction s5k5baf_readfunction s5k5baf_writefunction s5k5baf_write_arr_seqfunction s5k5baf_write_nseqfunction s5k5baf_synchronizefunction s5k5baf_hw_patchfunction s5k5baf_hw_set_clocksfunction s5k5baf_hw_set_ccmfunction s5k5baf_hw_set_cisfunction s5k5baf_hw_sync_cfgfunction s5k5baf_hw_set_mirrorfunction s5k5baf_hw_set_algfunction s5k5baf_hw_set_awbfunction s5k5baf_hw_set_user_exposurefunction s5k5baf_hw_set_user_gainfunction s5k5baf_hw_set_auto_exposurefunction s5k5baf_hw_set_anti_flickerfunction s5k5baf_hw_set_colorfxfunction s5k5baf_find_pixfmtfunction s5k5baf_clear_errorfunction s5k5baf_hw_set_video_busfunction s5k5baf_get_cfg_errorfunction s5k5baf_hw_set_fivfunction s5k5baf_hw_find_min_fivfunction s5k5baf_hw_validate_cfgfunction s5k5baf_rescalefunction s5k5baf_hw_set_crop_rectsfunction s5k5baf_hw_set_configfunction s5k5baf_hw_set_test_patternfunction s5k5baf_gpio_assertfunction s5k5baf_gpio_deassertfunction s5k5baf_power_onfunction s5k5baf_power_offfunction s5k5baf_hw_initfunction s5k5baf_initialize_datafunction s5k5baf_load_setfilefunction s5k5baf_set_powerfunction s5k5baf_hw_set_stream
Annotated Snippet
struct s5k5baf_pixfmt {
u32 code;
u32 colorspace;
/* REG_P_FMT(x) register value */
u16 reg_p_fmt;
};
struct s5k5baf_ctrls {
struct v4l2_ctrl_handler handler;
struct { /* Auto / manual white balance cluster */
struct v4l2_ctrl *awb;
struct v4l2_ctrl *gain_red;
struct v4l2_ctrl *gain_blue;
};
struct { /* Mirror cluster */
struct v4l2_ctrl *hflip;
struct v4l2_ctrl *vflip;
};
struct { /* Auto exposure / manual exposure and gain cluster */
struct v4l2_ctrl *auto_exp;
struct v4l2_ctrl *exposure;
struct v4l2_ctrl *gain;
};
};
enum {
S5K5BAF_FW_ID_PATCH,
S5K5BAF_FW_ID_CCM,
S5K5BAF_FW_ID_CIS,
};
struct s5k5baf_fw {
u16 count;
struct {
u16 id;
u16 offset;
} seq[];
};
struct s5k5baf {
struct gpio_desc *gpios[NUM_GPIOS];
enum v4l2_mbus_type bus_type;
u8 nlanes;
struct regulator_bulk_data supplies[S5K5BAF_NUM_SUPPLIES];
struct clk *clock;
struct s5k5baf_fw *fw;
struct v4l2_subdev cis_sd;
struct media_pad cis_pad;
struct v4l2_subdev sd;
struct media_pad pads[NUM_ISP_PADS];
/* protects the struct members below */
struct mutex lock;
int error;
struct v4l2_rect crop_sink;
struct v4l2_rect compose;
struct v4l2_rect crop_source;
/* index to s5k5baf_formats array */
int pixfmt;
/* actual frame interval in 100us */
u16 fiv;
/* requested frame interval in 100us */
u16 req_fiv;
/* cache for REG_DBG_AUTOALG_EN register */
u16 auto_alg;
struct s5k5baf_ctrls ctrls;
unsigned int streaming:1;
unsigned int apply_cfg:1;
unsigned int apply_crop:1;
unsigned int valid_auto_alg:1;
unsigned int power;
};
static const struct s5k5baf_pixfmt s5k5baf_formats[] = {
{ MEDIA_BUS_FMT_VYUY8_2X8, V4L2_COLORSPACE_JPEG, 5 },
/* range 16-240 */
{ MEDIA_BUS_FMT_VYUY8_2X8, V4L2_COLORSPACE_REC709, 6 },
{ MEDIA_BUS_FMT_RGB565_2X8_BE, V4L2_COLORSPACE_JPEG, 0 },
};
static struct v4l2_rect s5k5baf_cis_rect = {
0, 0, S5K5BAF_CIS_WIDTH, S5K5BAF_CIS_HEIGHT
Annotation
- Immediate include surface: `linux/clk.h`, `linux/delay.h`, `linux/firmware.h`, `linux/gpio/consumer.h`, `linux/i2c.h`, `linux/media.h`, `linux/module.h`, `linux/of_graph.h`.
- Detected declarations: `struct s5k5baf_pixfmt`, `struct s5k5baf_ctrls`, `struct s5k5baf_fw`, `struct s5k5baf`, `enum s5k5baf_gpio_id`, `enum selection_rect`, `function s5k5baf_fw_parse`, `function s5k5baf_is_cis_subdev`, `function s5k5baf_i2c_read`, `function s5k5baf_i2c_write`.
- 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.