drivers/media/i2c/ds90ub960.c
Source file repositories/reference/linux-study-clean/drivers/media/i2c/ds90ub960.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/media/i2c/ds90ub960.c- Extension
.c- Size
- 132572 bytes
- Lines
- 5300
- 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.
- Touches IRQ or DMA behavior; this matters for the representative real-device path.
- 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/bitops.hlinux/cleanup.hlinux/clk.hlinux/delay.hlinux/fwnode.hlinux/gpio/consumer.hlinux/i2c-atr.hlinux/i2c.hlinux/init.hlinux/interrupt.hlinux/kernel.hlinux/kthread.hlinux/module.hlinux/mutex.hlinux/property.hlinux/regmap.hlinux/regulator/consumer.hlinux/slab.hlinux/units.hlinux/workqueue.hmedia/i2c/ds90ub9xx.hmedia/mipi-csi2.hmedia/v4l2-ctrls.hmedia/v4l2-fwnode.hmedia/v4l2-subdev.hds90ub953.h
Detected Declarations
struct ub960_hw_datastruct ub960_rxportstruct ub960_asdstruct ub960_txportstruct ub960_datastruct ub960_format_infostruct ub960_rxport_iterenum chip_typeenum chip_familyenum ub960_rxport_modeenum ub960_rxport_cdrenum ub960_iter_flagsfunction ub960_pad_is_sinkfunction ub960_pad_is_sourcefunction ub960_pad_to_portfunction ub960_iter_rxportfunction ub960_iter_rxportfunction ub960_iter_rxportfunction ub960_iter_rxportfunction ub960_readfunction ub960_writefunction ub960_update_bitsfunction ub960_read16function ub960_rxport_selectfunction ub960_rxport_readfunction ub960_rxport_writefunction ub960_rxport_update_bitsfunction ub960_rxport_read16function ub960_txport_selectfunction ub960_txport_readfunction ub960_txport_writefunction ub960_txport_update_bitsfunction ub960_select_ind_reg_blockfunction ub960_read_indfunction ub960_write_indfunction ub960_ind_update_bitsfunction ub960_resetfunction ub960_atr_attach_addrfunction ub960_atr_detach_addrfunction ub960_init_atrfunction ub960_uninit_atrfunction ub960_parse_dt_txportfunction ub960_csi_handle_eventsfunction ub960_rxport_enable_vpocsfunction for_each_active_rxportfunction ub960_rxport_disable_vpocsfunction ub960_rxport_clear_errorsfunction ub960_clear_rx_errors
Annotated Snippet
struct ub960_hw_data {
const char *model;
enum chip_type chip_type;
enum chip_family chip_family;
u8 num_rxports;
u8 num_txports;
};
enum ub960_rxport_mode {
RXPORT_MODE_RAW10 = 0,
RXPORT_MODE_RAW12_HF = 1,
RXPORT_MODE_RAW12_LF = 2,
RXPORT_MODE_CSI2_SYNC = 3,
RXPORT_MODE_CSI2_NONSYNC = 4,
RXPORT_MODE_LAST = RXPORT_MODE_CSI2_NONSYNC,
};
enum ub960_rxport_cdr {
RXPORT_CDR_FPD3 = 0,
RXPORT_CDR_FPD4 = 1,
RXPORT_CDR_LAST = RXPORT_CDR_FPD4,
};
struct ub960_rxport {
struct ub960_data *priv;
u8 nport; /* RX port number, and index in priv->rxport[] */
struct {
struct v4l2_subdev *sd;
u16 pad;
struct fwnode_handle *ep_fwnode;
} source;
/* Serializer */
struct {
struct fwnode_handle *fwnode;
struct i2c_client *client;
unsigned short alias; /* I2C alias (lower 7 bits) */
short addr; /* Local I2C address (lower 7 bits) */
struct ds90ub9xx_platform_data pdata;
struct regmap *regmap;
} ser;
enum ub960_rxport_mode rx_mode;
enum ub960_rxport_cdr cdr_mode;
u8 lv_fv_pol; /* LV and FV polarities */
struct regulator *vpoc;
/* EQ settings */
struct {
bool manual_eq;
s8 strobe_pos;
union {
struct {
u8 eq_level_min;
u8 eq_level_max;
} aeq;
struct {
u8 eq_level;
} manual;
};
} eq;
/* lock for aliased_addrs and associated registers */
struct mutex aliased_addrs_lock;
u16 aliased_addrs[UB960_MAX_PORT_ALIASES];
};
struct ub960_asd {
struct v4l2_async_connection base;
struct ub960_rxport *rxport;
};
static inline struct ub960_asd *to_ub960_asd(struct v4l2_async_connection *asd)
{
return container_of(asd, struct ub960_asd, base);
}
struct ub960_txport {
struct ub960_data *priv;
u8 nport; /* TX port number, and index in priv->txport[] */
u32 num_data_lanes;
bool non_continous_clk;
};
Annotation
- Immediate include surface: `linux/bitops.h`, `linux/cleanup.h`, `linux/clk.h`, `linux/delay.h`, `linux/fwnode.h`, `linux/gpio/consumer.h`, `linux/i2c-atr.h`, `linux/i2c.h`.
- Detected declarations: `struct ub960_hw_data`, `struct ub960_rxport`, `struct ub960_asd`, `struct ub960_txport`, `struct ub960_data`, `struct ub960_format_info`, `struct ub960_rxport_iter`, `enum chip_type`, `enum chip_family`, `enum ub960_rxport_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.
- IRQ or DMA behavior appears here, which is relevant to the selected PCIe/NVMe device path.
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.