drivers/media/dvb-frontends/dibx000_common.c
Source file repositories/reference/linux-study-clean/drivers/media/dvb-frontends/dibx000_common.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/media/dvb-frontends/dibx000_common.c- Extension
.c- Size
- 13159 bytes
- Lines
- 509
- Domain
- Driver Families
- Bucket
- drivers/media
- Inferred role
- Driver Families: exported/initcall integration point
- Status
- integration 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.
- Exports symbols or registers init work; inspect boot/module ordering and who consumes the exported contract.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/i2c.hlinux/mutex.hlinux/module.hdibx000_common.h
Detected Declarations
function dibx000_write_wordfunction dibx000_read_wordfunction dibx000_is_i2c_donefunction dibx000_master_i2c_writefunction dibx000_master_i2c_readfunction dibx000_i2c_set_speedfunction dibx000_i2c_funcfunction dibx000_i2c_select_interfacefunction dibx000_i2c_master_xfer_gpio12function dibx000_i2c_master_xfer_gpio34function dibx000_i2c_gate_ctrlfunction dibx000_i2c_gated_gpio67_xferfunction dibx000_i2c_gated_tuner_xferfunction dibx000_reset_i2c_masterfunction i2c_adapter_initfunction dibx000_init_i2c_masterfunction dibx000_exit_i2c_masterexport dibx000_i2c_set_speedexport dibx000_get_i2c_adapterexport dibx000_reset_i2c_masterexport dibx000_init_i2c_masterexport dibx000_exit_i2c_master
Annotated Snippet
while (len) {
da = dibx000_read_word(mst, mst->base_reg);
*b++ = (da >> 8) & 0xff;
len--;
if (len >= 1) {
*b++ = da & 0xff;
len--;
}
}
}
return 0;
}
int dibx000_i2c_set_speed(struct i2c_adapter *i2c_adap, u16 speed)
{
struct dibx000_i2c_master *mst = i2c_get_adapdata(i2c_adap);
if (mst->device_rev < DIB7000MC && speed < 235)
speed = 235;
return dibx000_write_word(mst, mst->base_reg + 3, (u16)(60000 / speed));
}
EXPORT_SYMBOL(dibx000_i2c_set_speed);
static u32 dibx000_i2c_func(struct i2c_adapter *adapter)
{
return I2C_FUNC_I2C;
}
static int dibx000_i2c_select_interface(struct dibx000_i2c_master *mst,
enum dibx000_i2c_interface intf)
{
if (mst->device_rev > DIB3000MC && mst->selected_interface != intf) {
dprintk("selecting interface: %d\n", intf);
mst->selected_interface = intf;
return dibx000_write_word(mst, mst->base_reg + 4, intf);
}
return 0;
}
static int dibx000_i2c_master_xfer_gpio12(struct i2c_adapter *i2c_adap, struct i2c_msg msg[], int num)
{
struct dibx000_i2c_master *mst = i2c_get_adapdata(i2c_adap);
int msg_index;
int ret = 0;
dibx000_i2c_select_interface(mst, DIBX000_I2C_INTERFACE_GPIO_1_2);
for (msg_index = 0; msg_index < num; msg_index++) {
if (msg[msg_index].flags & I2C_M_RD) {
ret = dibx000_master_i2c_read(mst, &msg[msg_index]);
if (ret != 0)
return 0;
} else {
ret = dibx000_master_i2c_write(mst, &msg[msg_index], 1);
if (ret != 0)
return 0;
}
}
return num;
}
static int dibx000_i2c_master_xfer_gpio34(struct i2c_adapter *i2c_adap, struct i2c_msg msg[], int num)
{
struct dibx000_i2c_master *mst = i2c_get_adapdata(i2c_adap);
int msg_index;
int ret = 0;
dibx000_i2c_select_interface(mst, DIBX000_I2C_INTERFACE_GPIO_3_4);
for (msg_index = 0; msg_index < num; msg_index++) {
if (msg[msg_index].flags & I2C_M_RD) {
ret = dibx000_master_i2c_read(mst, &msg[msg_index]);
if (ret != 0)
return 0;
} else {
ret = dibx000_master_i2c_write(mst, &msg[msg_index], 1);
if (ret != 0)
return 0;
}
}
return num;
}
static const struct i2c_algorithm dibx000_i2c_master_gpio12_xfer_algo = {
.master_xfer = dibx000_i2c_master_xfer_gpio12,
.functionality = dibx000_i2c_func,
};
Annotation
- Immediate include surface: `linux/i2c.h`, `linux/mutex.h`, `linux/module.h`, `dibx000_common.h`.
- Detected declarations: `function dibx000_write_word`, `function dibx000_read_word`, `function dibx000_is_i2c_done`, `function dibx000_master_i2c_write`, `function dibx000_master_i2c_read`, `function dibx000_i2c_set_speed`, `function dibx000_i2c_func`, `function dibx000_i2c_select_interface`, `function dibx000_i2c_master_xfer_gpio12`, `function dibx000_i2c_master_xfer_gpio34`.
- Atlas domain: Driver Families / drivers/media.
- Implementation status: integration 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.