drivers/media/tuners/xc2028.c
Source file repositories/reference/linux-study-clean/drivers/media/tuners/xc2028.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/media/tuners/xc2028.c- Extension
.c- Size
- 35749 bytes
- Lines
- 1523
- 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.
- 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/i2c.hasm/div64.hlinux/firmware.hlinux/videodev2.hlinux/delay.hmedia/tuner.hlinux/mutex.hlinux/slab.hlinux/unaligned.htuner-i2c.hxc2028.hxc2028-types.hlinux/dvb/frontend.hmedia/dvb_frontend.h
Detected Declarations
struct firmware_descriptionstruct firmware_propertiesstruct xc2028_dataenum xc2028_statefunction xc2028_get_regfunction dump_firm_type_and_int_freqfunction parse_audio_std_optionfunction check_device_statusfunction free_firmwarefunction load_all_firmwaresfunction seek_firmwarefunction do_tuner_callbackfunction load_firmwarefunction load_scodefunction check_firmwarefunction xc2028_get_regfunction xc2028_signalfunction xc2028_get_afcfunction generic_set_freqfunction XC3028Lfunction xc2028_set_analog_freqfunction xc2028_set_paramsfunction xc2028_sleepfunction xc2028_dvb_releasefunction xc2028_get_frequencyfunction load_firmware_cbfunction xc2028_set_configexport xc2028_attach
Annotated Snippet
struct firmware_description {
unsigned int type;
v4l2_std_id id;
__u16 int_freq;
unsigned char *ptr;
unsigned int size;
};
struct firmware_properties {
unsigned int type;
v4l2_std_id id;
v4l2_std_id std_req;
__u16 int_freq;
unsigned int scode_table;
int scode_nr;
};
enum xc2028_state {
XC2028_NO_FIRMWARE = 0,
XC2028_WAITING_FIRMWARE,
XC2028_ACTIVE,
XC2028_SLEEP,
XC2028_NODEV,
};
struct xc2028_data {
struct list_head hybrid_tuner_instance_list;
struct tuner_i2c_props i2c_props;
__u32 frequency;
enum xc2028_state state;
const char *fname;
struct firmware_description *firm;
int firm_size;
__u16 firm_version;
__u16 hwmodel;
__u16 hwvers;
struct xc2028_ctrl ctrl;
struct firmware_properties cur_fw;
struct mutex lock;
};
#define i2c_send(priv, buf, size) ({ \
int _rc; \
_rc = tuner_i2c_xfer_send(&priv->i2c_props, buf, size); \
if (size != _rc) \
tuner_info("i2c output error: rc = %d (should be %d)\n",\
_rc, (int)size); \
if (priv->ctrl.msleep) \
msleep(priv->ctrl.msleep); \
_rc; \
})
#define i2c_send_recv(priv, obuf, osize, ibuf, isize) ({ \
int _rc; \
_rc = tuner_i2c_xfer_send_recv(&priv->i2c_props, obuf, osize, \
ibuf, isize); \
if (isize != _rc) \
tuner_err("i2c input error: rc = %d (should be %d)\n", \
_rc, (int)isize); \
if (priv->ctrl.msleep) \
msleep(priv->ctrl.msleep); \
_rc; \
})
#define send_seq(priv, data...) ({ \
static u8 _val[] = data; \
int _rc; \
if (sizeof(_val) != \
(_rc = tuner_i2c_xfer_send(&priv->i2c_props, \
_val, sizeof(_val)))) { \
tuner_err("Error on line %d: %d\n", __LINE__, _rc); \
} else if (priv->ctrl.msleep) \
msleep(priv->ctrl.msleep); \
_rc; \
})
static int xc2028_get_reg(struct xc2028_data *priv, u16 reg, u16 *val)
{
unsigned char buf[2];
unsigned char ibuf[2];
tuner_dbg("%s %04x called\n", __func__, reg);
buf[0] = reg >> 8;
Annotation
- Immediate include surface: `linux/i2c.h`, `asm/div64.h`, `linux/firmware.h`, `linux/videodev2.h`, `linux/delay.h`, `media/tuner.h`, `linux/mutex.h`, `linux/slab.h`.
- Detected declarations: `struct firmware_description`, `struct firmware_properties`, `struct xc2028_data`, `enum xc2028_state`, `function xc2028_get_reg`, `function dump_firm_type_and_int_freq`, `function parse_audio_std_option`, `function check_device_status`, `function free_firmware`, `function load_all_firmwares`.
- 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.