drivers/media/pci/bt8xx/bttv-audio-hook.c
Source file repositories/reference/linux-study-clean/drivers/media/pci/bt8xx/bttv-audio-hook.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/media/pci/bt8xx/bttv-audio-hook.c- Extension
.c- Size
- 10013 bytes
- Lines
- 482
- Domain
- Driver Families
- Bucket
- drivers/media
- Inferred role
- Driver Families: implementation source
- Status
- source 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 or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
bttv-audio-hook.hlinux/delay.h
Detected Declarations
function Copyrightfunction gvbctv3pci_audiofunction gvbctv5pci_audiofunction avermedia_tvphone_audiofunction avermedia_tv_stereo_audiofunction lt9415_audiofunction terratv_audiofunction winfast2000_audiofunction pvbt878p9b_audiofunction pvbt878p9b_audiofunction windvr_audiofunction adtvk503_audio
Annotated Snippet
switch (t->audmode) {
case V4L2_TUNER_MODE_LANG2:
con = 0x300;
break;
case V4L2_TUNER_MODE_LANG1_LANG2:
con = 0x100;
break;
default:
con = 0x000;
break;
}
if (con != (val & 0x300)) {
gpio_bits(0x300, con);
if (bttv_gpio)
bttv_gpio_tracking(btv, "gvbctv5pci");
}
} else {
switch (val & 0x70) {
case 0x10:
t->rxsubchans = V4L2_TUNER_SUB_LANG1 | V4L2_TUNER_SUB_LANG2;
t->audmode = V4L2_TUNER_MODE_LANG1_LANG2;
break;
case 0x30:
t->rxsubchans = V4L2_TUNER_SUB_LANG2;
t->audmode = V4L2_TUNER_MODE_LANG1_LANG2;
break;
case 0x50:
t->rxsubchans = V4L2_TUNER_SUB_LANG1;
t->audmode = V4L2_TUNER_MODE_LANG1_LANG2;
break;
case 0x60:
t->rxsubchans = V4L2_TUNER_SUB_STEREO;
t->audmode = V4L2_TUNER_MODE_STEREO;
break;
case 0x70:
t->rxsubchans = V4L2_TUNER_SUB_MONO;
t->audmode = V4L2_TUNER_MODE_MONO;
break;
default:
t->rxsubchans = V4L2_TUNER_SUB_MONO |
V4L2_TUNER_SUB_STEREO |
V4L2_TUNER_SUB_LANG1 |
V4L2_TUNER_SUB_LANG2;
t->audmode = V4L2_TUNER_MODE_LANG1;
}
}
}
/*
* Mario Medina Nussbaum <medisoft@alohabbs.org.mx>
* I discover that on BT848_GPIO_DATA address a byte 0xcce enable stereo,
* 0xdde enables mono and 0xccd enables sap
*
* Petr Vandrovec <VANDROVE@vc.cvut.cz>
* P.S.: At least mask in line above is wrong - GPIO pins 3,2 select
* input/output sound connection, so both must be set for output mode.
*
* Looks like it's needed only for the "tvphone", the "tvphone 98"
* handles this with a tda9840
*
*/
void avermedia_tvphone_audio(struct bttv *btv, struct v4l2_tuner *t, int set)
{
int val;
if (!set) {
/* Not much to do here */
t->audmode = V4L2_TUNER_MODE_LANG1;
t->rxsubchans = V4L2_TUNER_SUB_MONO |
V4L2_TUNER_SUB_STEREO |
V4L2_TUNER_SUB_LANG1 |
V4L2_TUNER_SUB_LANG2;
return;
}
switch (t->audmode) {
case V4L2_TUNER_MODE_LANG2: /* SAP */
val = 0x02;
break;
case V4L2_TUNER_MODE_STEREO:
val = 0x01;
break;
default:
return;
}
gpio_bits(0x03, val);
if (bttv_gpio)
bttv_gpio_tracking(btv, "avermedia");
Annotation
- Immediate include surface: `bttv-audio-hook.h`, `linux/delay.h`.
- Detected declarations: `function Copyright`, `function gvbctv3pci_audio`, `function gvbctv5pci_audio`, `function avermedia_tvphone_audio`, `function avermedia_tv_stereo_audio`, `function lt9415_audio`, `function terratv_audio`, `function winfast2000_audio`, `function pvbt878p9b_audio`, `function pvbt878p9b_audio`.
- Atlas domain: Driver Families / drivers/media.
- Implementation status: source 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.