ASoC: Intel: Move apci find machine routines
[deliverable/linux.git] / sound / soc / blackfin / bfin-eval-adau1701.c
CommitLineData
53a93d58
LPC
1/*
2 * Machine driver for EVAL-ADAU1701MINIZ on Analog Devices bfin
3 * evaluation boards.
4 *
5 * Copyright 2011 Analog Devices Inc.
6 * Author: Lars-Peter Clausen <lars@metafoo.de>
7 *
8 * Licensed under the GPL-2 or later.
9 */
10
11#include <linux/module.h>
12#include <linux/device.h>
13#include <sound/core.h>
14#include <sound/pcm.h>
15#include <sound/soc.h>
16#include <sound/pcm_params.h>
17
18#include "../codecs/adau1701.h"
19
20static const struct snd_soc_dapm_widget bfin_eval_adau1701_dapm_widgets[] = {
21 SND_SOC_DAPM_SPK("Speaker", NULL),
22 SND_SOC_DAPM_LINE("Line Out", NULL),
23 SND_SOC_DAPM_LINE("Line In", NULL),
24};
25
26static const struct snd_soc_dapm_route bfin_eval_adau1701_dapm_routes[] = {
27 { "Speaker", NULL, "OUT0" },
28 { "Speaker", NULL, "OUT1" },
29 { "Line Out", NULL, "OUT2" },
30 { "Line Out", NULL, "OUT3" },
31
32 { "IN0", NULL, "Line In" },
33 { "IN1", NULL, "Line In" },
34};
35
36static int bfin_eval_adau1701_hw_params(struct snd_pcm_substream *substream,
37 struct snd_pcm_hw_params *params)
38{
39 struct snd_soc_pcm_runtime *rtd = substream->private_data;
53a93d58
LPC
40 struct snd_soc_dai *codec_dai = rtd->codec_dai;
41 int ret;
42
53a93d58
LPC
43 ret = snd_soc_dai_set_sysclk(codec_dai, ADAU1701_CLK_SRC_OSC, 12288000,
44 SND_SOC_CLOCK_IN);
45
46 return ret;
47}
48
49static struct snd_soc_ops bfin_eval_adau1701_ops = {
50 .hw_params = bfin_eval_adau1701_hw_params,
51};
52
980b0bc6
LPC
53#define BFIN_EVAL_ADAU1701_DAI_FMT (SND_SOC_DAIFMT_I2S | \
54 SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBM_CFM)
55
53a93d58
LPC
56static struct snd_soc_dai_link bfin_eval_adau1701_dai[] = {
57 {
58 .name = "adau1701",
59 .stream_name = "adau1701",
60 .cpu_dai_name = "bfin-i2s.0",
61 .codec_dai_name = "adau1701",
62 .platform_name = "bfin-i2s-pcm-audio",
63 .codec_name = "adau1701.0-0034",
64 .ops = &bfin_eval_adau1701_ops,
980b0bc6 65 .dai_fmt = BFIN_EVAL_ADAU1701_DAI_FMT,
53a93d58
LPC
66 },
67 {
68 .name = "adau1701",
69 .stream_name = "adau1701",
70 .cpu_dai_name = "bfin-i2s.1",
71 .codec_dai_name = "adau1701",
72 .platform_name = "bfin-i2s-pcm-audio",
73 .codec_name = "adau1701.0-0034",
74 .ops = &bfin_eval_adau1701_ops,
980b0bc6 75 .dai_fmt = BFIN_EVAL_ADAU1701_DAI_FMT,
53a93d58
LPC
76 },
77};
78
79static struct snd_soc_card bfin_eval_adau1701 = {
80 .name = "bfin-eval-adau1701",
30e49530 81 .owner = THIS_MODULE,
53a93d58
LPC
82 .dai_link = &bfin_eval_adau1701_dai[CONFIG_SND_BF5XX_SPORT_NUM],
83 .num_links = 1,
84
85 .dapm_widgets = bfin_eval_adau1701_dapm_widgets,
86 .num_dapm_widgets = ARRAY_SIZE(bfin_eval_adau1701_dapm_widgets),
87 .dapm_routes = bfin_eval_adau1701_dapm_routes,
88 .num_dapm_routes = ARRAY_SIZE(bfin_eval_adau1701_dapm_routes),
89};
90
91static int bfin_eval_adau1701_probe(struct platform_device *pdev)
92{
93 struct snd_soc_card *card = &bfin_eval_adau1701;
94
95 card->dev = &pdev->dev;
96
76b0d1f5 97 return devm_snd_soc_register_card(&pdev->dev, &bfin_eval_adau1701);
53a93d58
LPC
98}
99
100static struct platform_driver bfin_eval_adau1701_driver = {
101 .driver = {
102 .name = "bfin-eval-adau1701",
53a93d58
LPC
103 .pm = &snd_soc_pm_ops,
104 },
105 .probe = bfin_eval_adau1701_probe,
53a93d58
LPC
106};
107
fb80297e 108module_platform_driver(bfin_eval_adau1701_driver);
53a93d58
LPC
109
110MODULE_AUTHOR("Lars-Peter Clausen <lars@metafoo.de>");
111MODULE_DESCRIPTION("ALSA SoC bfin ADAU1701 driver");
112MODULE_LICENSE("GPL");
113MODULE_ALIAS("platform:bfin-eval-adau1701");
This page took 0.221199 seconds and 5 git commands to generate.