x86/speculation/mds: Fix documentation typo
[linux/fpc-iii.git] / sound / soc / blackfin / bfin-eval-adav80x.c
blob99e5ecabdcda3c23d8beef43bdca4ccd56b0e160
1 /*
2 * Machine driver for EVAL-ADAV801 and EVAL-ADAV803 on Analog Devices bfin
3 * evaluation boards.
5 * Copyright 2011 Analog Devices Inc.
6 * Author: Lars-Peter Clausen <lars@metafoo.de>
8 * Licensed under the GPL-2 or later.
9 */
11 #include <linux/init.h>
12 #include <linux/platform_device.h>
13 #include <linux/module.h>
14 #include <sound/core.h>
15 #include <sound/pcm.h>
16 #include <sound/soc.h>
18 #include "../codecs/adav80x.h"
20 static const struct snd_soc_dapm_widget bfin_eval_adav80x_dapm_widgets[] = {
21 SND_SOC_DAPM_LINE("Line Out", NULL),
22 SND_SOC_DAPM_LINE("Line In", NULL),
25 static const struct snd_soc_dapm_route bfin_eval_adav80x_dapm_routes[] = {
26 { "Line Out", NULL, "VOUTL" },
27 { "Line Out", NULL, "VOUTR" },
29 { "VINL", NULL, "Line In" },
30 { "VINR", NULL, "Line In" },
33 static int bfin_eval_adav80x_hw_params(struct snd_pcm_substream *substream,
34 struct snd_pcm_hw_params *params)
36 struct snd_soc_pcm_runtime *rtd = substream->private_data;
37 struct snd_soc_dai *codec_dai = rtd->codec_dai;
38 int ret;
40 ret = snd_soc_dai_set_pll(codec_dai, ADAV80X_PLL1, ADAV80X_PLL_SRC_XTAL,
41 27000000, params_rate(params) * 256);
42 if (ret)
43 return ret;
45 ret = snd_soc_dai_set_sysclk(codec_dai, ADAV80X_CLK_PLL1,
46 params_rate(params) * 256, SND_SOC_CLOCK_IN);
48 return ret;
51 static int bfin_eval_adav80x_codec_init(struct snd_soc_pcm_runtime *rtd)
53 struct snd_soc_dai *codec_dai = rtd->codec_dai;
55 snd_soc_dai_set_sysclk(codec_dai, ADAV80X_CLK_SYSCLK1, 0,
56 SND_SOC_CLOCK_OUT);
57 snd_soc_dai_set_sysclk(codec_dai, ADAV80X_CLK_SYSCLK2, 0,
58 SND_SOC_CLOCK_OUT);
59 snd_soc_dai_set_sysclk(codec_dai, ADAV80X_CLK_SYSCLK3, 0,
60 SND_SOC_CLOCK_OUT);
62 snd_soc_dai_set_sysclk(codec_dai, ADAV80X_CLK_XTAL, 2700000, 0);
64 return 0;
67 static const struct snd_soc_ops bfin_eval_adav80x_ops = {
68 .hw_params = bfin_eval_adav80x_hw_params,
71 static struct snd_soc_dai_link bfin_eval_adav80x_dais[] = {
73 .name = "adav80x",
74 .stream_name = "ADAV80x HiFi",
75 .cpu_dai_name = "bfin-i2s.0",
76 .codec_dai_name = "adav80x-hifi",
77 .platform_name = "bfin-i2s-pcm-audio",
78 .init = bfin_eval_adav80x_codec_init,
79 .ops = &bfin_eval_adav80x_ops,
80 .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF |
81 SND_SOC_DAIFMT_CBM_CFM,
85 static struct snd_soc_card bfin_eval_adav80x = {
86 .name = "bfin-eval-adav80x",
87 .owner = THIS_MODULE,
88 .dai_link = bfin_eval_adav80x_dais,
89 .num_links = ARRAY_SIZE(bfin_eval_adav80x_dais),
91 .dapm_widgets = bfin_eval_adav80x_dapm_widgets,
92 .num_dapm_widgets = ARRAY_SIZE(bfin_eval_adav80x_dapm_widgets),
93 .dapm_routes = bfin_eval_adav80x_dapm_routes,
94 .num_dapm_routes = ARRAY_SIZE(bfin_eval_adav80x_dapm_routes),
97 enum bfin_eval_adav80x_type {
98 BFIN_EVAL_ADAV801,
99 BFIN_EVAL_ADAV803,
102 static int bfin_eval_adav80x_probe(struct platform_device *pdev)
104 struct snd_soc_card *card = &bfin_eval_adav80x;
105 const char *codec_name;
107 switch (platform_get_device_id(pdev)->driver_data) {
108 case BFIN_EVAL_ADAV801:
109 codec_name = "spi0.1";
110 break;
111 case BFIN_EVAL_ADAV803:
112 codec_name = "adav803.0-0034";
113 break;
114 default:
115 return -EINVAL;
118 bfin_eval_adav80x_dais[0].codec_name = codec_name;
120 card->dev = &pdev->dev;
122 return devm_snd_soc_register_card(&pdev->dev, &bfin_eval_adav80x);
125 static const struct platform_device_id bfin_eval_adav80x_ids[] = {
126 { "bfin-eval-adav801", BFIN_EVAL_ADAV801 },
127 { "bfin-eval-adav803", BFIN_EVAL_ADAV803 },
128 { },
130 MODULE_DEVICE_TABLE(platform, bfin_eval_adav80x_ids);
132 static struct platform_driver bfin_eval_adav80x_driver = {
133 .driver = {
134 .name = "bfin-eval-adav80x",
135 .pm = &snd_soc_pm_ops,
137 .probe = bfin_eval_adav80x_probe,
138 .id_table = bfin_eval_adav80x_ids,
141 module_platform_driver(bfin_eval_adav80x_driver);
143 MODULE_AUTHOR("Lars-Peter Clausen <lars@metafoo.de>");
144 MODULE_DESCRIPTION("ALSA SoC bfin adav80x driver");
145 MODULE_LICENSE("GPL");