drivers/media/i2c/ds90ub953.c
Source file repositories/reference/linux-study-clean/drivers/media/i2c/ds90ub953.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/media/i2c/ds90ub953.c- Extension
.c- Size
- 32406 bytes
- Lines
- 1379
- 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-provider.hlinux/clk.hlinux/delay.hlinux/gpio/driver.hlinux/i2c-atr.hlinux/i2c.hlinux/kernel.hlinux/math64.hlinux/module.hlinux/property.hlinux/rational.hlinux/regmap.hmedia/i2c/ds90ub9xx.hmedia/v4l2-ctrls.hmedia/v4l2-fwnode.hmedia/v4l2-mediabus.hmedia/v4l2-subdev.hds90ub953.h
Detected Declarations
struct ub953_hw_datastruct ub953_clkout_datastruct ub953_dataenum ub953_modefunction ub953_readfunction ub953_writefunction ub953_select_ind_reg_blockfunction ub953_read_indfunction ub953_write_indfunction ub953_gpio_get_directionfunction ub953_gpio_direction_infunction ub953_gpio_direction_outfunction ub953_gpio_getfunction ub953_gpio_setfunction ub953_gpio_of_xlatefunction ub953_gpiochip_probefunction ub953_gpiochip_removefunction _ub953_set_routingfunction ub953_set_routingfunction ub953_set_fmtfunction ub953_init_statefunction ub953_log_statusfunction ub953_enable_streamsfunction ub953_disable_streamsfunction ub953_notify_boundfunction ub953_v4l2_notifier_registerfunction ub953_v4l2_notifier_unregisterfunction ub953_i2c_master_initfunction ub953_get_fc_ratefunction ub953_calc_clkout_ub953function ub953_calc_clkout_ub971function ub953_calc_clkout_paramsfunction ub953_write_clkout_regsfunction ub953_clkout_recalc_ratefunction ub953_clkout_determine_ratefunction ub953_clkout_set_ratefunction ub953_register_clkoutfunction ub953_add_i2c_adapterfunction ub953_parse_dtfunction ub953_hw_initfunction ub953_subdev_initfunction ub953_subdev_uninitfunction ub953_probefunction ub953_remove
Annotated Snippet
struct ub953_hw_data {
const char *model;
bool is_ub971;
};
struct ub953_clkout_data {
u32 hs_div;
u32 m;
u32 n;
unsigned long rate;
};
struct ub953_data {
const struct ub953_hw_data *hw_data;
struct i2c_client *client;
struct regmap *regmap;
struct clk *clkin;
u32 num_data_lanes;
bool non_continous_clk;
struct gpio_chip gpio_chip;
struct v4l2_subdev sd;
struct media_pad pads[2];
struct v4l2_async_notifier notifier;
struct v4l2_subdev *source_sd;
u16 source_sd_pad;
u64 enabled_source_streams;
/* lock for register access */
struct mutex reg_lock;
u8 current_indirect_target;
struct clk_hw clkout_clk_hw;
enum ub953_mode mode;
const struct ds90ub9xx_platform_data *plat_data;
};
static inline struct ub953_data *sd_to_ub953(struct v4l2_subdev *sd)
{
return container_of(sd, struct ub953_data, sd);
}
/*
* HW Access
*/
static int ub953_read(struct ub953_data *priv, u8 reg, u8 *val, int *err)
{
unsigned int v;
int ret;
if (err && *err)
return *err;
mutex_lock(&priv->reg_lock);
ret = regmap_read(priv->regmap, reg, &v);
if (ret) {
dev_err(&priv->client->dev, "Cannot read register 0x%02x: %d\n",
reg, ret);
goto out_unlock;
}
*val = v;
out_unlock:
mutex_unlock(&priv->reg_lock);
if (ret && err)
*err = ret;
return ret;
}
static int ub953_write(struct ub953_data *priv, u8 reg, u8 val, int *err)
{
int ret;
if (err && *err)
return *err;
Annotation
- Immediate include surface: `linux/clk-provider.h`, `linux/clk.h`, `linux/delay.h`, `linux/gpio/driver.h`, `linux/i2c-atr.h`, `linux/i2c.h`, `linux/kernel.h`, `linux/math64.h`.
- Detected declarations: `struct ub953_hw_data`, `struct ub953_clkout_data`, `struct ub953_data`, `enum ub953_mode`, `function ub953_read`, `function ub953_write`, `function ub953_select_ind_reg_block`, `function ub953_read_ind`, `function ub953_write_ind`, `function ub953_gpio_get_direction`.
- 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.