sound/soc/intel/boards/sof_pcm512x.c
Source file repositories/reference/linux-study-clean/sound/soc/intel/boards/sof_pcm512x.c
File Facts
- System
- Linux kernel
- Corpus path
sound/soc/intel/boards/sof_pcm512x.c- Extension
.c- Size
- 11738 bytes
- Lines
- 445
- Domain
- Driver Families
- Bucket
- sound/soc
- 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/clk.hlinux/dmi.hlinux/i2c.hlinux/input.hlinux/module.hlinux/platform_device.hlinux/types.hsound/core.hsound/jack.hsound/pcm.hsound/pcm_params.hsound/soc.hsound/soc-acpi.h../../codecs/pcm512x.h../common/soc-intel-quirks.hhda_dsp_common.h
Detected Declarations
struct sof_hdmi_pcmstruct sof_card_privatefunction sof_pcm512x_quirk_cbfunction sof_hdmi_initfunction sof_pcm512x_codec_initfunction aif1_startupfunction aif1_shutdownfunction sof_card_late_probefunction dmic_initfunction sof_audio_probefunction sof_pcm512x_removefunction for_each_card_components
Annotated Snippet
struct sof_hdmi_pcm {
struct list_head head;
struct snd_soc_dai *codec_dai;
int device;
};
struct sof_card_private {
struct list_head hdmi_pcm_list;
bool idisp_codec;
};
static int sof_pcm512x_quirk_cb(const struct dmi_system_id *id)
{
sof_pcm512x_quirk = (unsigned long)id->driver_data;
return 1;
}
static const struct dmi_system_id sof_pcm512x_quirk_table[] = {
{
.callback = sof_pcm512x_quirk_cb,
.matches = {
DMI_MATCH(DMI_SYS_VENDOR, "AAEON"),
DMI_MATCH(DMI_PRODUCT_NAME, "UP-CHT01"),
},
.driver_data = (void *)(SOF_PCM512X_SSP_CODEC(2)),
},
{}
};
static int sof_hdmi_init(struct snd_soc_pcm_runtime *rtd)
{
struct sof_card_private *ctx = snd_soc_card_get_drvdata(rtd->card);
struct snd_soc_dai *dai = snd_soc_rtd_to_codec(rtd, 0);
struct sof_hdmi_pcm *pcm;
pcm = devm_kzalloc(rtd->card->dev, sizeof(*pcm), GFP_KERNEL);
if (!pcm)
return -ENOMEM;
/* dai_link id is 1:1 mapped to the PCM device */
pcm->device = rtd->dai_link->id;
pcm->codec_dai = dai;
list_add_tail(&pcm->head, &ctx->hdmi_pcm_list);
return 0;
}
static int sof_pcm512x_codec_init(struct snd_soc_pcm_runtime *rtd)
{
struct snd_soc_component *codec = snd_soc_rtd_to_codec(rtd, 0)->component;
snd_soc_component_update_bits(codec, PCM512x_GPIO_EN, 0x08, 0x08);
snd_soc_component_update_bits(codec, PCM512x_GPIO_OUTPUT_4, 0x0f, 0x02);
snd_soc_component_update_bits(codec, PCM512x_GPIO_CONTROL_1,
0x08, 0x08);
return 0;
}
static int aif1_startup(struct snd_pcm_substream *substream)
{
struct snd_soc_pcm_runtime *rtd = snd_soc_substream_to_rtd(substream);
struct snd_soc_component *codec = snd_soc_rtd_to_codec(rtd, 0)->component;
snd_soc_component_update_bits(codec, PCM512x_GPIO_CONTROL_1,
0x08, 0x08);
return 0;
}
static void aif1_shutdown(struct snd_pcm_substream *substream)
{
struct snd_soc_pcm_runtime *rtd = snd_soc_substream_to_rtd(substream);
struct snd_soc_component *codec = snd_soc_rtd_to_codec(rtd, 0)->component;
snd_soc_component_update_bits(codec, PCM512x_GPIO_CONTROL_1,
0x08, 0x00);
}
static const struct snd_soc_ops sof_pcm512x_ops = {
.startup = aif1_startup,
.shutdown = aif1_shutdown,
};
static struct snd_soc_dai_link_component platform_component[] = {
{
/* name might be overridden during probe */
.name = "0000:00:1f.3"
}
Annotation
- Immediate include surface: `linux/clk.h`, `linux/dmi.h`, `linux/i2c.h`, `linux/input.h`, `linux/module.h`, `linux/platform_device.h`, `linux/types.h`, `sound/core.h`.
- Detected declarations: `struct sof_hdmi_pcm`, `struct sof_card_private`, `function sof_pcm512x_quirk_cb`, `function sof_hdmi_init`, `function sof_pcm512x_codec_init`, `function aif1_startup`, `function aif1_shutdown`, `function sof_card_late_probe`, `function dmic_init`, `function sof_audio_probe`.
- Atlas domain: Driver Families / sound/soc.
- 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.