drivers/media/i2c/os05b10.c
Source file repositories/reference/linux-study-clean/drivers/media/i2c/os05b10.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/media/i2c/os05b10.c- Extension
.c- Size
- 30008 bytes
- Lines
- 1131
- 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/array_size.hlinux/bitops.hlinux/clk.hlinux/container_of.hlinux/delay.hlinux/device/devres.hlinux/err.hlinux/gpio/consumer.hlinux/i2c.hlinux/module.hlinux/pm_runtime.hlinux/regulator/consumer.hlinux/types.hlinux/time.hlinux/units.hmedia/v4l2-cci.hmedia/v4l2-ctrls.hmedia/v4l2-device.hmedia/v4l2-fwnode.hmedia/v4l2-mediabus.h
Detected Declarations
struct os05b10struct os05b10_modefunction os05b10_set_ctrlfunction os05b10_enum_mbus_codefunction os05b10_set_framing_limitsfunction os05b10_set_pad_formatfunction os05b10_get_selectionfunction os05b10_enum_frame_sizefunction os05b10_enable_streamsfunction os05b10_disable_streamsfunction os05b10_init_statefunction os05b10_identify_modulefunction os05b10_power_onfunction os05b10_power_offfunction os05b10_parse_endpointfunction os05b10_pixel_ratefunction os05b10_init_controlsfunction os05b10_probefunction os05b10_remove
Annotated Snippet
struct os05b10 {
struct device *dev;
struct regmap *cci;
struct v4l2_subdev sd;
struct media_pad pad;
struct clk *xclk;
struct i2c_client *client;
struct gpio_desc *reset_gpio;
struct regulator_bulk_data supplies[ARRAY_SIZE(os05b10_supply_name)];
/* V4L2 Controls */
struct v4l2_ctrl_handler handler;
struct v4l2_ctrl *link_freq;
struct v4l2_ctrl *hblank;
struct v4l2_ctrl *vblank;
struct v4l2_ctrl *gain;
struct v4l2_ctrl *exposure;
u32 link_freq_index;
u32 data_lanes;
};
struct os05b10_mode {
u32 width;
u32 height;
u32 vts;
u32 hts;
u32 exp;
u8 bpp;
};
static const struct os05b10_mode supported_modes_10bit[] = {
{
.width = 2592,
.height = 1944,
.vts = 2006,
.hts = 1744,
.exp = 1944,
.bpp = 10,
},
};
static const s64 link_frequencies[] = {
OS05B10_LINK_FREQ_600MHZ,
};
static const u32 os05b10_mbus_codes[] = {
MEDIA_BUS_FMT_SBGGR10_1X10,
};
static inline struct os05b10 *to_os05b10(struct v4l2_subdev *sd)
{
return container_of_const(sd, struct os05b10, sd);
};
static int os05b10_set_ctrl(struct v4l2_ctrl *ctrl)
{
struct os05b10 *os05b10 = container_of_const(ctrl->handler,
struct os05b10, handler);
struct v4l2_subdev_state *state;
struct v4l2_mbus_framefmt *fmt;
int vmax, ret;
state = v4l2_subdev_get_locked_active_state(&os05b10->sd);
fmt = v4l2_subdev_state_get_format(state, 0);
if (ctrl->id == V4L2_CID_VBLANK) {
/* Honour the VBLANK limits when setting exposure. */
s64 max = fmt->height + ctrl->val - OS05B10_EXPOSURE_MARGIN;
ret = __v4l2_ctrl_modify_range(os05b10->exposure,
os05b10->exposure->minimum, max,
os05b10->exposure->step,
os05b10->exposure->default_value);
if (ret)
return ret;
}
if (pm_runtime_get_if_in_use(os05b10->dev) == 0)
return 0;
switch (ctrl->id) {
case V4L2_CID_VBLANK:
vmax = fmt->height + ctrl->val;
ret = cci_write(os05b10->cci, OS05B10_REG_VTS, vmax, NULL);
break;
case V4L2_CID_ANALOGUE_GAIN:
ret = cci_write(os05b10->cci, OS05B10_REG_ANALOG_GAIN,
ctrl->val, NULL);
break;
Annotation
- Immediate include surface: `linux/array_size.h`, `linux/bitops.h`, `linux/clk.h`, `linux/container_of.h`, `linux/delay.h`, `linux/device/devres.h`, `linux/err.h`, `linux/gpio/consumer.h`.
- Detected declarations: `struct os05b10`, `struct os05b10_mode`, `function os05b10_set_ctrl`, `function os05b10_enum_mbus_code`, `function os05b10_set_framing_limits`, `function os05b10_set_pad_format`, `function os05b10_get_selection`, `function os05b10_enum_frame_size`, `function os05b10_enable_streams`, `function os05b10_disable_streams`.
- 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.