2 * ADAU7002 Stereo PDM-to-I2S/TDM converter driver
4 * Copyright 2014-2016 Analog Devices
5 * Author: Lars-Peter Clausen <lars@metafoo.de>
7 * Licensed under the GPL-2.
10 #include <linux/acpi.h>
11 #include <linux/init.h>
12 #include <linux/module.h>
14 #include <linux/platform_device.h>
16 #include <sound/soc.h>
18 static const struct snd_soc_dapm_widget adau7002_widgets[] = {
19 SND_SOC_DAPM_INPUT("PDM_DAT"),
20 SND_SOC_DAPM_REGULATOR_SUPPLY("IOVDD", 0, 0),
23 static const struct snd_soc_dapm_route adau7002_routes[] = {
24 { "Capture", NULL, "PDM_DAT" },
25 { "Capture", NULL, "IOVDD" },
28 static struct snd_soc_dai_driver adau7002_dai = {
29 .name = "adau7002-hifi",
31 .stream_name = "Capture",
34 .rates = SNDRV_PCM_RATE_8000_96000,
35 .formats = SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S18_3LE |
36 SNDRV_PCM_FMTBIT_S20_3LE | SNDRV_PCM_FMTBIT_S24_LE |
37 SNDRV_PCM_FMTBIT_S24_3LE | SNDRV_PCM_FMTBIT_S32_LE,
42 static const struct snd_soc_component_driver adau7002_component_driver = {
43 .dapm_widgets = adau7002_widgets,
44 .num_dapm_widgets = ARRAY_SIZE(adau7002_widgets),
45 .dapm_routes = adau7002_routes,
46 .num_dapm_routes = ARRAY_SIZE(adau7002_routes),
50 .non_legacy_dai_naming = 1,
53 static int adau7002_probe(struct platform_device *pdev)
55 return devm_snd_soc_register_component(&pdev->dev,
56 &adau7002_component_driver,
60 static int adau7002_remove(struct platform_device *pdev)
66 static const struct of_device_id adau7002_dt_ids[] = {
67 { .compatible = "adi,adau7002", },
70 MODULE_DEVICE_TABLE(of, adau7002_dt_ids);
74 static const struct acpi_device_id adau7002_acpi_match[] = {
78 MODULE_DEVICE_TABLE(acpi, adau7002_acpi_match);
81 static struct platform_driver adau7002_driver = {
84 .of_match_table = of_match_ptr(adau7002_dt_ids),
85 .acpi_match_table = ACPI_PTR(adau7002_acpi_match),
87 .probe = adau7002_probe,
88 .remove = adau7002_remove,
90 module_platform_driver(adau7002_driver);
92 MODULE_AUTHOR("Lars-Peter Clausen <lars@metafoo.de>");
93 MODULE_DESCRIPTION("ADAU7002 Stereo PDM-to-I2S/TDM Converter driver");
94 MODULE_LICENSE("GPL v2");