drivers/media/common/b2c2/flexcop-hw-filter.c
Source file repositories/reference/linux-study-clean/drivers/media/common/b2c2/flexcop-hw-filter.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/media/common/b2c2/flexcop-hw-filter.c- Extension
.c- Size
- 6957 bytes
- Lines
- 246
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
flexcop.h
Detected Declarations
function FlexcopIIfunction flexcop_smc_ctrlfunction flexcop_null_filter_ctrlfunction flexcop_set_mac_filterfunction flexcop_mac_filter_ctrlfunction flexcop_pid_group_filterfunction flexcop_pid_group_filter_ctrlfunction flexcop_pid_Stream1_PID_ctrlfunction flexcop_pid_Stream2_PID_ctrlfunction flexcop_pid_PCR_PID_ctrlfunction flexcop_pid_PMT_PID_ctrlfunction flexcop_pid_EMM_PID_ctrlfunction flexcop_pid_ECM_PID_ctrlfunction flexcop_pid_controlfunction flexcop_toggle_fullts_streamingfunction flexcop_pid_feed_controlfunction flexcop_hw_filter_initexport flexcop_pid_feed_control
Annotated Snippet
if (fc->has_32_hw_pid_filter && index < 38) {
flexcop_ibi_value vpid, vid;
/* set the index */
vid = fc->read_ibi_reg(fc, index_reg_310);
vid.index_reg_310.index_reg = index - 6;
fc->write_ibi_reg(fc, index_reg_310, vid);
vpid = fc->read_ibi_reg(fc, pid_n_reg_314);
vpid.pid_n_reg_314.PID = onoff ? pid : 0x1fff;
vpid.pid_n_reg_314.PID_enable_bit = onoff;
fc->write_ibi_reg(fc, pid_n_reg_314, vpid);
}
break;
}
}
static int flexcop_toggle_fullts_streaming(struct flexcop_device *fc, int onoff)
{
if (fc->fullts_streaming_state != onoff) {
deb_ts("%s full TS transfer\n",onoff ? "enabling" : "disabling");
flexcop_pid_group_filter(fc, 0, 0x1fe0 * (!onoff));
flexcop_pid_group_filter_ctrl(fc, onoff);
fc->fullts_streaming_state = onoff;
}
return 0;
}
int flexcop_pid_feed_control(struct flexcop_device *fc,
struct dvb_demux_feed *dvbdmxfeed, int onoff)
{
int max_pid_filter = 6;
max_pid_filter -= 6 * fc->skip_6_hw_pid_filter;
max_pid_filter += 32 * fc->has_32_hw_pid_filter;
fc->feedcount += onoff ? 1 : -1; /* the number of PIDs/Feed currently requested */
if (dvbdmxfeed->index >= max_pid_filter)
fc->extra_feedcount += onoff ? 1 : -1;
/* toggle complete-TS-streaming when:
* - pid_filtering is not enabled and it is the first or last feed requested
* - pid_filtering is enabled,
* - but the number of requested feeds is exceeded
* - or the requested pid is 0x2000 */
if (!fc->pid_filtering && fc->feedcount == onoff)
flexcop_toggle_fullts_streaming(fc, onoff);
if (fc->pid_filtering) {
flexcop_pid_control \
(fc, dvbdmxfeed->index, dvbdmxfeed->pid, onoff);
if (fc->extra_feedcount > 0)
flexcop_toggle_fullts_streaming(fc, 1);
else if (dvbdmxfeed->pid == 0x2000)
flexcop_toggle_fullts_streaming(fc, onoff);
else
flexcop_toggle_fullts_streaming(fc, 0);
}
/* if it was the first or last feed request change the stream-status */
if (fc->feedcount == onoff) {
flexcop_rcv_data_ctrl(fc, onoff);
if (fc->stream_control) /* device specific stream control */
fc->stream_control(fc, onoff);
/* feeding stopped -> reset the flexcop filter*/
if (onoff == 0) {
flexcop_reset_block_300(fc);
flexcop_hw_filter_init(fc);
}
}
return 0;
}
EXPORT_SYMBOL(flexcop_pid_feed_control);
void flexcop_hw_filter_init(struct flexcop_device *fc)
{
int i;
flexcop_ibi_value v;
int max_pid_filter = 6;
max_pid_filter -= 6 * fc->skip_6_hw_pid_filter;
max_pid_filter += 32 * fc->has_32_hw_pid_filter;
for (i = 0; i < max_pid_filter; i++)
flexcop_pid_control(fc, i, 0x1fff, 0);
flexcop_pid_group_filter(fc, 0, 0x1fe0);
Annotation
- Immediate include surface: `flexcop.h`.
- Detected declarations: `function FlexcopII`, `function flexcop_smc_ctrl`, `function flexcop_null_filter_ctrl`, `function flexcop_set_mac_filter`, `function flexcop_mac_filter_ctrl`, `function flexcop_pid_group_filter`, `function flexcop_pid_group_filter_ctrl`, `function flexcop_pid_Stream1_PID_ctrl`, `function flexcop_pid_Stream2_PID_ctrl`, `function flexcop_pid_PCR_PID_ctrl`.
- Atlas domain: Driver Families / drivers/media.
- Implementation status: integration implementation candidate.
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.