drivers/staging/vc04_services/bcm2835-audio/bcm2835.c
Source file repositories/reference/linux-study-clean/drivers/staging/vc04_services/bcm2835-audio/bcm2835.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/staging/vc04_services/bcm2835-audio/bcm2835.c- Extension
.c- Size
- 7838 bytes
- Lines
- 337
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/dma-mapping.hlinux/init.hlinux/slab.hlinux/module.hlinux/raspberrypi/vchiq_bus.hbcm2835.h
Detected Declarations
struct bcm2835_audio_driverstruct bcm2835_audio_driversfunction bcm2835_devm_free_vchi_ctxfunction bcm2835_devm_add_vchi_ctxfunction bcm2835_audio_dual_newpcmfunction bcm2835_audio_simple_newpcmfunction bcm2835_card_freefunction snd_add_child_devicefunction snd_add_child_devicesfunction snd_bcm2835_alsa_probefunction snd_bcm2835_alsa_suspendfunction snd_bcm2835_alsa_resume
Annotated Snippet
struct device_driver driver;
const char *shortname;
const char *longname;
int minchannels;
int (*newpcm)(struct bcm2835_chip *chip, const char *name,
enum snd_bcm2835_route route, u32 numchannels);
int (*newctl)(struct bcm2835_chip *chip);
enum snd_bcm2835_route route;
};
static int bcm2835_audio_dual_newpcm(struct bcm2835_chip *chip,
const char *name,
enum snd_bcm2835_route route,
u32 numchannels)
{
int err;
err = snd_bcm2835_new_pcm(chip, name, 0, route,
numchannels, false);
if (err)
return err;
err = snd_bcm2835_new_pcm(chip, "IEC958", 1, route, 1, true);
if (err)
return err;
return 0;
}
static int bcm2835_audio_simple_newpcm(struct bcm2835_chip *chip,
const char *name,
enum snd_bcm2835_route route,
u32 numchannels)
{
return snd_bcm2835_new_pcm(chip, name, 0, route, numchannels, false);
}
static struct bcm2835_audio_driver bcm2835_audio_hdmi = {
.driver = {
.name = "bcm2835_hdmi",
.owner = THIS_MODULE,
},
.shortname = "bcm2835 HDMI",
.longname = "bcm2835 HDMI",
.minchannels = 1,
.newpcm = bcm2835_audio_dual_newpcm,
.newctl = snd_bcm2835_new_hdmi_ctl,
.route = AUDIO_DEST_HDMI
};
static struct bcm2835_audio_driver bcm2835_audio_headphones = {
.driver = {
.name = "bcm2835_headphones",
.owner = THIS_MODULE,
},
.shortname = "bcm2835 Headphones",
.longname = "bcm2835 Headphones",
.minchannels = 1,
.newpcm = bcm2835_audio_simple_newpcm,
.newctl = snd_bcm2835_new_headphones_ctl,
.route = AUDIO_DEST_HEADPHONES
};
struct bcm2835_audio_drivers {
struct bcm2835_audio_driver *audio_driver;
const bool *is_enabled;
};
static struct bcm2835_audio_drivers children_devices[] = {
{
.audio_driver = &bcm2835_audio_hdmi,
.is_enabled = &enable_hdmi,
},
{
.audio_driver = &bcm2835_audio_headphones,
.is_enabled = &enable_headphones,
},
};
static void bcm2835_card_free(void *data)
{
snd_card_free(data);
}
static int snd_add_child_device(struct device *dev,
struct bcm2835_audio_driver *audio_driver,
u32 numchans)
{
struct bcm2835_chip *chip;
Annotation
- Immediate include surface: `linux/dma-mapping.h`, `linux/init.h`, `linux/slab.h`, `linux/module.h`, `linux/raspberrypi/vchiq_bus.h`, `bcm2835.h`.
- Detected declarations: `struct bcm2835_audio_driver`, `struct bcm2835_audio_drivers`, `function bcm2835_devm_free_vchi_ctx`, `function bcm2835_devm_add_vchi_ctx`, `function bcm2835_audio_dual_newpcm`, `function bcm2835_audio_simple_newpcm`, `function bcm2835_card_free`, `function snd_add_child_device`, `function snd_add_child_devices`, `function snd_bcm2835_alsa_probe`.
- Atlas domain: Driver Families / drivers/staging.
- Implementation status: pattern 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.