sound/soc/tegra/tegra_wm8903.c
Source file repositories/reference/linux-study-clean/sound/soc/tegra/tegra_wm8903.c
File Facts
- System
- Linux kernel
- Corpus path
sound/soc/tegra/tegra_wm8903.c- Extension
.c- Size
- 5523 bytes
- Lines
- 190
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/gpio/consumer.hlinux/of.hlinux/module.hlinux/platform_device.hsound/core.hsound/jack.hsound/soc.h../codecs/wm8903.htegra_asoc_machine.h
Detected Declarations
function tegra_wm8903_mclk_ratefunction tegra_wm8903_initfunction tegra_wm8903_remove
Annotated Snippet
if (err) {
dev_err(rtd->dev, "Mic Jack creation failed: %d\n", err);
return err;
}
if (of_property_read_bool(card->dev->of_node, "nvidia,headset"))
shrt = SND_JACK_MICROPHONE;
wm8903_mic_detect(component, machine->mic_jack,
SND_JACK_MICROPHONE, shrt);
}
snd_soc_dapm_force_enable_pin(dapm, "MICBIAS");
return 0;
}
static int tegra_wm8903_remove(struct snd_soc_card *card)
{
struct snd_soc_dai_link *link = &card->dai_link[0];
struct snd_soc_pcm_runtime *rtd = snd_soc_get_pcm_runtime(card, link);
struct snd_soc_dai *codec_dai = snd_soc_rtd_to_codec(rtd, 0);
struct snd_soc_component *component = codec_dai->component;
wm8903_mic_detect(component, NULL, 0, 0);
return 0;
}
SND_SOC_DAILINK_DEFS(hifi,
DAILINK_COMP_ARRAY(COMP_EMPTY()),
DAILINK_COMP_ARRAY(COMP_CODEC(NULL, "wm8903-hifi")),
DAILINK_COMP_ARRAY(COMP_EMPTY()));
static struct snd_soc_dai_link tegra_wm8903_dai = {
.name = "WM8903",
.stream_name = "WM8903 PCM",
.init = tegra_wm8903_init,
.dai_fmt = SND_SOC_DAIFMT_I2S |
SND_SOC_DAIFMT_NB_NF |
SND_SOC_DAIFMT_CBC_CFC,
SND_SOC_DAILINK_REG(hifi),
};
static struct snd_soc_card snd_soc_tegra_wm8903 = {
.components = "codec:wm8903",
.owner = THIS_MODULE,
.dai_link = &tegra_wm8903_dai,
.num_links = 1,
.remove = tegra_wm8903_remove,
.fully_routed = true,
};
/* older device-trees used wrong polarity for the headphones-detection GPIO */
static const struct tegra_asoc_data tegra_wm8903_data_legacy = {
.mclk_rate = tegra_wm8903_mclk_rate,
.card = &snd_soc_tegra_wm8903,
.hp_jack_gpio_active_low = true,
.add_common_dapm_widgets = true,
.add_common_controls = true,
.add_common_snd_ops = true,
.add_mic_jack = true,
.add_hp_jack = true,
};
static const struct tegra_asoc_data tegra_wm8903_data = {
.mclk_rate = tegra_wm8903_mclk_rate,
.card = &snd_soc_tegra_wm8903,
.add_common_dapm_widgets = true,
.add_common_controls = true,
.add_common_snd_ops = true,
.add_mic_jack = true,
.add_hp_jack = true,
};
static const struct of_device_id tegra_wm8903_of_match[] = {
{ .compatible = "ad,tegra-audio-plutux", .data = &tegra_wm8903_data_legacy },
{ .compatible = "ad,tegra-audio-wm8903-medcom-wide", .data = &tegra_wm8903_data_legacy },
{ .compatible = "ad,tegra-audio-wm8903-tec", .data = &tegra_wm8903_data_legacy },
{ .compatible = "nvidia,tegra-audio-wm8903-cardhu", .data = &tegra_wm8903_data_legacy },
{ .compatible = "nvidia,tegra-audio-wm8903-harmony", .data = &tegra_wm8903_data_legacy },
{ .compatible = "nvidia,tegra-audio-wm8903-picasso", .data = &tegra_wm8903_data_legacy },
{ .compatible = "nvidia,tegra-audio-wm8903-seaboard", .data = &tegra_wm8903_data_legacy },
{ .compatible = "nvidia,tegra-audio-wm8903-ventana", .data = &tegra_wm8903_data_legacy },
{ .compatible = "nvidia,tegra-audio-wm8903", .data = &tegra_wm8903_data },
{},
};
MODULE_DEVICE_TABLE(of, tegra_wm8903_of_match);
static struct platform_driver tegra_wm8903_driver = {
Annotation
- Immediate include surface: `linux/gpio/consumer.h`, `linux/of.h`, `linux/module.h`, `linux/platform_device.h`, `sound/core.h`, `sound/jack.h`, `sound/soc.h`, `../codecs/wm8903.h`.
- Detected declarations: `function tegra_wm8903_mclk_rate`, `function tegra_wm8903_init`, `function tegra_wm8903_remove`.
- 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.