0001
0002
0003
0004
0005
0006
0007
0008
0009 #include <linux/init.h>
0010 #include <linux/slab.h>
0011 #include <linux/module.h>
0012 #include <linux/kernel.h>
0013 #include <linux/device.h>
0014 #include <sound/core.h>
0015 #include <sound/pcm.h>
0016 #include <sound/ac97_codec.h>
0017 #include <sound/initval.h>
0018 #include <sound/soc.h>
0019
0020 #include "ad73311.h"
0021
0022 static const struct snd_soc_dapm_widget ad73311_dapm_widgets[] = {
0023 SND_SOC_DAPM_INPUT("VINP"),
0024 SND_SOC_DAPM_INPUT("VINN"),
0025 SND_SOC_DAPM_OUTPUT("VOUTN"),
0026 SND_SOC_DAPM_OUTPUT("VOUTP"),
0027 };
0028
0029 static const struct snd_soc_dapm_route ad73311_dapm_routes[] = {
0030 { "Capture", NULL, "VINP" },
0031 { "Capture", NULL, "VINN" },
0032
0033 { "VOUTN", NULL, "Playback" },
0034 { "VOUTP", NULL, "Playback" },
0035 };
0036
0037 static struct snd_soc_dai_driver ad73311_dai = {
0038 .name = "ad73311-hifi",
0039 .playback = {
0040 .stream_name = "Playback",
0041 .channels_min = 1,
0042 .channels_max = 1,
0043 .rates = SNDRV_PCM_RATE_8000,
0044 .formats = SNDRV_PCM_FMTBIT_S16_LE, },
0045 .capture = {
0046 .stream_name = "Capture",
0047 .channels_min = 1,
0048 .channels_max = 1,
0049 .rates = SNDRV_PCM_RATE_8000,
0050 .formats = SNDRV_PCM_FMTBIT_S16_LE, },
0051 };
0052
0053 static const struct snd_soc_component_driver soc_component_dev_ad73311 = {
0054 .dapm_widgets = ad73311_dapm_widgets,
0055 .num_dapm_widgets = ARRAY_SIZE(ad73311_dapm_widgets),
0056 .dapm_routes = ad73311_dapm_routes,
0057 .num_dapm_routes = ARRAY_SIZE(ad73311_dapm_routes),
0058 .idle_bias_on = 1,
0059 .use_pmdown_time = 1,
0060 .endianness = 1,
0061 };
0062
0063 static int ad73311_probe(struct platform_device *pdev)
0064 {
0065 return devm_snd_soc_register_component(&pdev->dev,
0066 &soc_component_dev_ad73311, &ad73311_dai, 1);
0067 }
0068
0069 static struct platform_driver ad73311_codec_driver = {
0070 .driver = {
0071 .name = "ad73311",
0072 },
0073
0074 .probe = ad73311_probe,
0075 };
0076
0077 module_platform_driver(ad73311_codec_driver);
0078
0079 MODULE_DESCRIPTION("ASoC ad73311 driver");
0080 MODULE_AUTHOR("Cliff Cai ");
0081 MODULE_LICENSE("GPL");