sound/soc/tegra/tegra_wm8962.c

Source file repositories/reference/linux-study-clean/sound/soc/tegra/tegra_wm8962.c

File Facts

System
Linux kernel
Corpus path
sound/soc/tegra/tegra_wm8962.c
Extension
.c
Size
4153 bytes
Lines
166
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.

Dependency Surface

Detected Declarations

Annotated Snippet

if (err) {
			dev_err(rtd->dev, "Mic Jack creation failed: %d\n", err);
			return err;
		}

		wm8962_mic_detect(component, machine->mic_jack);
	}

	snd_soc_dapm_force_enable_pin(dapm, "MICBIAS");

	return 0;
}

static int tegra_wm8962_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;

	wm8962_mic_detect(component, NULL);

	return 0;
}

SND_SOC_DAILINK_DEFS(wm8962_hifi,
	DAILINK_COMP_ARRAY(COMP_EMPTY()),
	DAILINK_COMP_ARRAY(COMP_CODEC(NULL, "wm8962")),
	DAILINK_COMP_ARRAY(COMP_EMPTY()));

static struct snd_soc_dai_link tegra_wm8962_dai = {
	.name = "WM8962",
	.stream_name = "WM8962 PCM",
	.init = tegra_wm8962_init,
	.dai_fmt = SND_SOC_DAIFMT_I2S |
		   SND_SOC_DAIFMT_NB_NF |
		   SND_SOC_DAIFMT_CBC_CFC,
	SND_SOC_DAILINK_REG(wm8962_hifi),
};

static struct snd_soc_card snd_soc_tegra_wm8962 = {
	.components = "codec:wm8962",
	.owner = THIS_MODULE,
	.dai_link = &tegra_wm8962_dai,
	.num_links = 1,
	.remove = tegra_wm8962_remove,
	.fully_routed = true,
};

static const struct tegra_asoc_data tegra_wm8962_data = {
	.mclk_rate = tegra_wm8962_mclk_rate,
	.card = &snd_soc_tegra_wm8962,
	.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_wm8962_of_match[] = {
	{ .compatible = "nvidia,tegra-audio-wm8962", .data = &tegra_wm8962_data },
	{},
};
MODULE_DEVICE_TABLE(of, tegra_wm8962_of_match);

static struct platform_driver tegra_wm8962_driver = {
	.driver = {
		.name = "tegra-wm8962",
		.of_match_table = tegra_wm8962_of_match,
		.pm = &snd_soc_pm_ops,
	},
	.probe = tegra_asoc_machine_probe,
};
module_platform_driver(tegra_wm8962_driver);

MODULE_AUTHOR("Jonas Schwöbel <jonasschwoebel@yahoo.de>");
MODULE_AUTHOR("Svyatoslav Ryhel <clamor95@gmail.com>");
MODULE_DESCRIPTION("Tegra+WM8962 machine ASoC driver");
MODULE_LICENSE("GPL");

Annotation

Implementation Notes