drivers/media/pci/bt8xx/bttv-cards.c
Source file repositories/reference/linux-study-clean/drivers/media/pci/bt8xx/bttv-cards.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/media/pci/bt8xx/bttv-cards.c- Extension
.c- Size
- 150913 bytes
- Lines
- 4934
- 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.
- 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/delay.hlinux/module.hlinux/kmod.hlinux/init.hlinux/pci.hlinux/vmalloc.hlinux/firmware.hnet/checksum.hlinux/unaligned.hasm/io.hbttvp.hmedia/v4l2-common.hmedia/i2c/tvaudio.hbttv-audio-hook.h
Detected Declarations
function bttv_idcardfunction identify_by_eepromfunction flyvideo_gpiofunction miro_pinnacle_gpiofunction init_ids_eaglefunction eagle_muxselfunction gvc1100_muxselfunction init_lmlbt4xfunction sigmaSQ_muxselfunction sigmaSLC_muxselfunction geovision_muxselfunction Enablefunction td3116_muxselfunction bttv_reset_audiofunction bttv_init_card1function bttv_init_card2function elsefunction bttv_init_tunerfunction modtec_eepromfunction hauppauge_eepromfunction bttv_tea575x_set_pinsfunction bttv_tea575x_get_pinsfunction bttv_tea575x_set_directionfunction tea575x_initfunction terratec_active_radio_upgradefunction pvr_altera_loadfunction pvr_bootfunction osprey_eepromfunction avermedia_eepromfunction bttv_tda9880_setnormfunction boot_msp34xxfunction init_PXC200function buffunction CN4function insteadfunction CS16function tibetCS16_initfunction numberfunction kodicom4400r_initfunction xguard_muxselfunction picolo_tetra_initfunction picolo_tetra_muxselfunction ivc120_muxselfunction Rubinifunction phytec_muxselfunction valuefunction cardsfunction gv800s_init
Annotated Snippet
if (type != -1) {
/* found it */
pr_info("%d: detected: %s [card=%d], PCI subsystem ID is %04x:%04x\n",
btv->c.nr, cards[type].name, cards[type].cardnr,
btv->cardid & 0xffff,
(btv->cardid >> 16) & 0xffff);
btv->c.type = cards[type].cardnr;
} else {
/* 404 */
pr_info("%d: subsystem: %04x:%04x (UNKNOWN)\n",
btv->c.nr, btv->cardid & 0xffff,
(btv->cardid >> 16) & 0xffff);
pr_debug("please mail id, board name and the correct card= insmod option to linux-media@vger.kernel.org\n");
}
}
/* let the user override the autodetected type */
if (card[btv->c.nr] < bttv_num_tvcards)
btv->c.type=card[btv->c.nr];
/* print which card config we are using */
pr_info("%d: using: %s [card=%d,%s]\n",
btv->c.nr, bttv_tvcards[btv->c.type].name, btv->c.type,
card[btv->c.nr] < bttv_num_tvcards
? "insmod option" : "autodetected");
/* overwrite gpio stuff ?? */
if (UNSET == audioall && UNSET == audiomux[0])
return;
if (UNSET != audiomux[0]) {
gpiobits = 0;
for (i = 0; i < ARRAY_SIZE(bttv_tvcards->gpiomux); i++) {
bttv_tvcards[btv->c.type].gpiomux[i] = audiomux[i];
gpiobits |= audiomux[i];
}
} else {
gpiobits = audioall;
for (i = 0; i < ARRAY_SIZE(bttv_tvcards->gpiomux); i++) {
bttv_tvcards[btv->c.type].gpiomux[i] = audioall;
}
}
bttv_tvcards[btv->c.type].gpiomask = (UNSET != gpiomask) ? gpiomask : gpiobits;
pr_info("%d: gpio config override: mask=0x%x, mux=",
btv->c.nr, bttv_tvcards[btv->c.type].gpiomask);
for (i = 0; i < ARRAY_SIZE(bttv_tvcards->gpiomux); i++) {
pr_cont("%s0x%x",
i ? "," : "", bttv_tvcards[btv->c.type].gpiomux[i]);
}
pr_cont("\n");
}
/*
* (most) board specific initialisations goes here
*/
/* Some Modular Technology cards have an eeprom, but no subsystem ID */
static void identify_by_eeprom(struct bttv *btv, unsigned char eeprom_data[256])
{
int type = -1;
if (0 == strncmp(eeprom_data,"GET MM20xPCTV",13))
type = BTTV_BOARD_MODTEC_205;
else if (0 == strncmp(eeprom_data+20,"Picolo",7))
type = BTTV_BOARD_EURESYS_PICOLO;
else if (eeprom_data[0] == 0x84 && eeprom_data[2]== 0)
type = BTTV_BOARD_HAUPPAUGE; /* old bt848 */
if (-1 != type) {
btv->c.type = type;
pr_info("%d: detected by eeprom: %s [card=%d]\n",
btv->c.nr, bttv_tvcards[btv->c.type].name, btv->c.type);
}
}
static void flyvideo_gpio(struct bttv *btv)
{
int gpio, has_remote, has_radio, is_capture_only;
int is_lr90, has_tda9820_tda9821;
int tuner_type = UNSET, ttype;
gpio_inout(0xffffff, 0);
udelay(8); /* without this we would see the 0x1800 mask */
gpio = gpio_read();
/* FIXME: must restore OUR_EN ??? */
/* all cards provide GPIO info, some have an additional eeprom
* LR50: GPIO coding can be found lower right CP1 .. CP9
* CP9=GPIO23 .. CP1=GPIO15; when OPEN, the corresponding GPIO reads 1.
* GPIO14-12: n.c.
Annotation
- Immediate include surface: `linux/delay.h`, `linux/module.h`, `linux/kmod.h`, `linux/init.h`, `linux/pci.h`, `linux/vmalloc.h`, `linux/firmware.h`, `net/checksum.h`.
- Detected declarations: `function bttv_idcard`, `function identify_by_eeprom`, `function flyvideo_gpio`, `function miro_pinnacle_gpio`, `function init_ids_eagle`, `function eagle_muxsel`, `function gvc1100_muxsel`, `function init_lmlbt4x`, `function sigmaSQ_muxsel`, `function sigmaSLC_muxsel`.
- 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.