drivers/staging/media/av7110/av7110_av.c
Source file repositories/reference/linux-study-clean/drivers/staging/media/av7110/av7110_av.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/staging/media/av7110/av7110_av.c- Extension
.c- Size
- 41770 bytes
- Lines
- 1723
- Domain
- Driver Families
- Bucket
- drivers/staging
- Inferred role
- Driver Families: operation-table or driver-model contract
- Status
- pattern 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.
- Defines an operation table; this is where Linux turns generic core objects into subsystem-specific behavior.
- Touches user memory; correctness depends on fault-safe copying and privilege boundary handling.
- 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/ethtool.hlinux/types.hlinux/kernel.hlinux/string.hlinux/delay.hlinux/fs.hav7110.hav7110_hw.hav7110_av.hav7110_ipack.h
Detected Declarations
struct compat_video_still_picturestruct compat_video_eventfunction av7110_record_cbfunction dvb_filter_pes2ts_cbfunction av7110_av_start_recordfunction av7110_av_start_playfunction av7110_av_stopfunction av7110_pes_playfunction av7110_set_volumefunction av7110_set_vidmodefunction get_video_formatfunction aux_ring_buffer_writefunction play_video_cbfunction play_audio_cbfunction ts_playfunction dvb_ringbuffer_freefunction dvb_play_kernelfunction dvb_aplayfunction av7110_p2t_initfunction clear_p2tfunction find_pes_headerfunction av7110_p2t_writefunction write_ts_header2function p_to_tfunction write_ts_to_decoderfunction av7110_write_to_decoderfunction dvb_video_add_eventfunction dvb_video_get_eventfunction dvb_video_pollfunction dvb_video_writefunction dvb_audio_pollfunction dvb_audio_writefunction play_iframefunction dvb_compat_video_get_eventfunction dvb_video_ioctlfunction dvb_audio_ioctlfunction dvb_video_openfunction dvb_video_releasefunction dvb_audio_openfunction dvb_audio_releasefunction av7110_av_registerfunction av7110_av_unregisterfunction av7110_av_initfunction av7110_av_exit
Annotated Snippet
static const struct file_operations dvb_video_fops = {
.owner = THIS_MODULE,
.write = dvb_video_write,
.unlocked_ioctl = dvb_generic_ioctl,
.compat_ioctl = dvb_generic_ioctl,
.open = dvb_video_open,
.release = dvb_video_release,
.poll = dvb_video_poll,
.llseek = noop_llseek,
};
static struct dvb_device dvbdev_video = {
.priv = NULL,
.users = 6,
.readers = 5, /* arbitrary */
.writers = 1,
.fops = &dvb_video_fops,
.kernel_ioctl = dvb_video_ioctl,
};
static const struct file_operations dvb_audio_fops = {
.owner = THIS_MODULE,
.write = dvb_audio_write,
.unlocked_ioctl = dvb_generic_ioctl,
.compat_ioctl = dvb_generic_ioctl,
.open = dvb_audio_open,
.release = dvb_audio_release,
.poll = dvb_audio_poll,
.llseek = noop_llseek,
};
static struct dvb_device dvbdev_audio = {
.priv = NULL,
.users = 1,
.writers = 1,
.fops = &dvb_audio_fops,
.kernel_ioctl = dvb_audio_ioctl,
};
int av7110_av_register(struct av7110 *av7110)
{
av7110->audiostate.AV_sync_state = 0;
av7110->audiostate.mute_state = 0;
av7110->audiostate.play_state = AUDIO_STOPPED;
av7110->audiostate.stream_source = AUDIO_SOURCE_DEMUX;
av7110->audiostate.channel_select = AUDIO_STEREO;
av7110->audiostate.bypass_mode = 0;
av7110->videostate.video_blank = 0;
av7110->videostate.play_state = VIDEO_STOPPED;
av7110->videostate.stream_source = VIDEO_SOURCE_DEMUX;
av7110->videostate.video_format = VIDEO_FORMAT_4_3;
av7110->videostate.display_format = VIDEO_LETTER_BOX;
av7110->display_ar = VIDEO_FORMAT_4_3;
av7110->display_panscan = VID_VC_AND_PS_PREF;
init_waitqueue_head(&av7110->video_events.wait_queue);
spin_lock_init(&av7110->video_events.lock);
av7110->video_events.eventw = 0;
av7110->video_events.eventr = 0;
av7110->video_events.overflow = 0;
memset(&av7110->video_size, 0, sizeof(video_size_t));
dvb_register_device(&av7110->dvb_adapter, &av7110->video_dev,
&dvbdev_video, av7110, DVB_DEVICE_VIDEO, 0);
dvb_register_device(&av7110->dvb_adapter, &av7110->audio_dev,
&dvbdev_audio, av7110, DVB_DEVICE_AUDIO, 0);
return 0;
}
void av7110_av_unregister(struct av7110 *av7110)
{
dvb_unregister_device(av7110->audio_dev);
dvb_unregister_device(av7110->video_dev);
}
int av7110_av_init(struct av7110 *av7110)
{
void (*play[])(u8 *, int, void *) = { play_audio_cb, play_video_cb };
int i, ret;
for (i = 0; i < 2; i++) {
struct ipack *ipack = av7110->ipack + i;
ret = av7110_ipack_init(ipack, IPACKS, play[i]);
if (ret < 0) {
if (i)
av7110_ipack_free(--ipack);
Annotation
- Immediate include surface: `linux/ethtool.h`, `linux/types.h`, `linux/kernel.h`, `linux/string.h`, `linux/delay.h`, `linux/fs.h`, `av7110.h`, `av7110_hw.h`.
- Detected declarations: `struct compat_video_still_picture`, `struct compat_video_event`, `function av7110_record_cb`, `function dvb_filter_pes2ts_cb`, `function av7110_av_start_record`, `function av7110_av_start_play`, `function av7110_av_stop`, `function av7110_pes_play`, `function av7110_set_volume`, `function av7110_set_vidmode`.
- Atlas domain: Driver Families / drivers/staging.
- Implementation status: pattern implementation candidate.
- This snippet crosses the user/kernel memory boundary; validate fault handling and access checks before translating the pattern.
- 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.