drivers/media/pci/cx23885/altera-ci.c
Source file repositories/reference/linux-study-clean/drivers/media/pci/cx23885/altera-ci.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/media/pci/cx23885/altera-ci.c- Extension
.c- Size
- 20377 bytes
- Lines
- 839
- 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
media/dvb_demux.hmedia/dvb_frontend.haltera-ci.hmedia/dvb_ca_en50221.h
Detected Declarations
struct altera_ci_statestruct netup_hw_pid_filterstruct fpga_internalstruct altera_ci_statestruct netup_hw_pid_filterstruct fpga_inodefunction remove_inodefunction netup_fpga_op_rwfunction altera_ci_op_camfunction altera_ci_read_attribute_memfunction altera_ci_write_attribute_memfunction altera_ci_read_cam_ctlfunction altera_ci_write_cam_ctlfunction altera_ci_slot_resetfunction altera_ci_slot_shutdownfunction altera_ci_slot_ts_ctlfunction netup_read_ci_statusfunction altera_ci_irqfunction altera_poll_ci_slot_statusfunction altera_hw_filt_releasefunction altera_ci_releasefunction altera_pid_controlfunction altera_toggle_fullts_streamingfunction altera_pid_feed_controlfunction altera_ci_start_feedfunction altera_ci_stop_feedfunction altera_ci_start_feed_1function altera_ci_stop_feed_1function altera_ci_start_feed_2function altera_ci_stop_feed_2function altera_hw_filt_initfunction altera_ci_initfunction altera_ci_tuner_resetexport altera_ci_irqexport altera_ci_releaseexport altera_ci_initexport altera_ci_tuner_reset
Annotated Snippet
struct fpga_internal {
void *dev;
struct mutex fpga_mutex;/* two CI's on the same fpga */
struct netup_hw_pid_filter *pid_filt[2];
struct altera_ci_state *state[2];
struct work_struct work;
int (*fpga_rw) (void *dev, int flag, int data, int rw);
int cis_used;
int filts_used;
int strt_wrk;
};
/* stores all private variables for communication with CI */
struct altera_ci_state {
struct fpga_internal *internal;
struct dvb_ca_en50221 ca;
int status;
int nr;
};
/* stores all private variables for hardware pid filtering */
struct netup_hw_pid_filter {
struct fpga_internal *internal;
struct dvb_demux *demux;
/* save old functions */
int (*start_feed)(struct dvb_demux_feed *feed);
int (*stop_feed)(struct dvb_demux_feed *feed);
int status;
int nr;
};
/* internal params node */
struct fpga_inode {
/* pointer for internal params, one for each pair of CI's */
struct fpga_internal *internal;
struct fpga_inode *next_inode;
};
/* first internal params */
static struct fpga_inode *fpga_first_inode;
/* find chip by dev */
static struct fpga_inode *find_inode(void *dev)
{
struct fpga_inode *temp_chip = fpga_first_inode;
if (temp_chip == NULL)
return temp_chip;
/*
Search for the last fpga CI chip or
find it by dev */
while ((temp_chip != NULL) &&
(temp_chip->internal->dev != dev))
temp_chip = temp_chip->next_inode;
return temp_chip;
}
/* check demux */
static struct fpga_internal *check_filter(struct fpga_internal *temp_int,
void *demux_dev, int filt_nr)
{
if (temp_int == NULL)
return NULL;
if ((temp_int->pid_filt[filt_nr]) == NULL)
return NULL;
if (temp_int->pid_filt[filt_nr]->demux == demux_dev)
return temp_int;
return NULL;
}
/* find chip by demux */
static struct fpga_inode *find_dinode(void *demux_dev)
{
struct fpga_inode *temp_chip = fpga_first_inode;
struct fpga_internal *temp_int;
/*
* Search of the last fpga CI chip or
* find it by demux
*/
while (temp_chip != NULL) {
if (temp_chip->internal != NULL) {
temp_int = temp_chip->internal;
if (check_filter(temp_int, demux_dev, 0))
break;
Annotation
- Immediate include surface: `media/dvb_demux.h`, `media/dvb_frontend.h`, `altera-ci.h`, `media/dvb_ca_en50221.h`.
- Detected declarations: `struct altera_ci_state`, `struct netup_hw_pid_filter`, `struct fpga_internal`, `struct altera_ci_state`, `struct netup_hw_pid_filter`, `struct fpga_inode`, `function remove_inode`, `function netup_fpga_op_rw`, `function altera_ci_op_cam`, `function altera_ci_read_attribute_mem`.
- 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.