aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc
diff options
context:
space:
mode:
authorNeil Jones <neiljay@gmail.com>2009-11-02 10:14:17 -0500
committerMark Brown <broonie@opensource.wolfsonmicro.com>2009-11-02 10:24:19 -0500
commit89933dee5b17c09f2673c2bfd853625a848f91f5 (patch)
treeb0905b16cec48df48e905a0d6f27ba82a60c16c6 /sound/soc
parent0f83d639d84c99a775c60696dbde77372c2cf4ac (diff)
ASoC: Add support for the WM8727 DAC.
Add support for the Wolfson Microelectronics WM8727 DAC, this is a simple non-configurable DAC. Signed-off-by: Neil Jones <neil.jones@imgtec.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'sound/soc')
-rw-r--r--sound/soc/codecs/Kconfig4
-rw-r--r--sound/soc/codecs/Makefile2
-rw-r--r--sound/soc/codecs/wm8727.c143
-rw-r--r--sound/soc/codecs/wm8727.h21
4 files changed, 170 insertions, 0 deletions
diff --git a/sound/soc/codecs/Kconfig b/sound/soc/codecs/Kconfig
index 3df3497335bf..4a3e8dcf24d9 100644
--- a/sound/soc/codecs/Kconfig
+++ b/sound/soc/codecs/Kconfig
@@ -40,6 +40,7 @@ config SND_SOC_ALL_CODECS
40 select SND_SOC_WM8523 if I2C 40 select SND_SOC_WM8523 if I2C
41 select SND_SOC_WM8580 if I2C 41 select SND_SOC_WM8580 if I2C
42 select SND_SOC_WM8711 if SND_SOC_I2C_AND_SPI 42 select SND_SOC_WM8711 if SND_SOC_I2C_AND_SPI
43 select SND_SOC_WM8727
43 select SND_SOC_WM8728 if SND_SOC_I2C_AND_SPI 44 select SND_SOC_WM8728 if SND_SOC_I2C_AND_SPI
44 select SND_SOC_WM8731 if SND_SOC_I2C_AND_SPI 45 select SND_SOC_WM8731 if SND_SOC_I2C_AND_SPI
45 select SND_SOC_WM8750 if SND_SOC_I2C_AND_SPI 46 select SND_SOC_WM8750 if SND_SOC_I2C_AND_SPI
@@ -174,6 +175,9 @@ config SND_SOC_WM8580
174config SND_SOC_WM8711 175config SND_SOC_WM8711
175 tristate 176 tristate
176 177
178config SND_SOC_WM8727
179 tristate
180
177config SND_SOC_WM8728 181config SND_SOC_WM8728
178 tristate 182 tristate
179 183
diff --git a/sound/soc/codecs/Makefile b/sound/soc/codecs/Makefile
index 8f519ee9600d..cacfc7692d7f 100644
--- a/sound/soc/codecs/Makefile
+++ b/sound/soc/codecs/Makefile
@@ -27,6 +27,7 @@ snd-soc-wm8510-objs := wm8510.o
27snd-soc-wm8523-objs := wm8523.o 27snd-soc-wm8523-objs := wm8523.o
28snd-soc-wm8580-objs := wm8580.o 28snd-soc-wm8580-objs := wm8580.o
29snd-soc-wm8711-objs := wm8711.o 29snd-soc-wm8711-objs := wm8711.o
30snd-soc-wm8727-objs := wm8727.o
30snd-soc-wm8728-objs := wm8728.o 31snd-soc-wm8728-objs := wm8728.o
31snd-soc-wm8731-objs := wm8731.o 32snd-soc-wm8731-objs := wm8731.o
32snd-soc-wm8750-objs := wm8750.o 33snd-soc-wm8750-objs := wm8750.o
@@ -81,6 +82,7 @@ obj-$(CONFIG_SND_SOC_WM8510) += snd-soc-wm8510.o
81obj-$(CONFIG_SND_SOC_WM8523) += snd-soc-wm8523.o 82obj-$(CONFIG_SND_SOC_WM8523) += snd-soc-wm8523.o
82obj-$(CONFIG_SND_SOC_WM8580) += snd-soc-wm8580.o 83obj-$(CONFIG_SND_SOC_WM8580) += snd-soc-wm8580.o
83obj-$(CONFIG_SND_SOC_WM8711) += snd-soc-wm8711.o 84obj-$(CONFIG_SND_SOC_WM8711) += snd-soc-wm8711.o
85obj-$(CONFIG_SND_SOC_WM8727) += snd-soc-wm8727.o
84obj-$(CONFIG_SND_SOC_WM8728) += snd-soc-wm8728.o 86obj-$(CONFIG_SND_SOC_WM8728) += snd-soc-wm8728.o
85obj-$(CONFIG_SND_SOC_WM8731) += snd-soc-wm8731.o 87obj-$(CONFIG_SND_SOC_WM8731) += snd-soc-wm8731.o
86obj-$(CONFIG_SND_SOC_WM8750) += snd-soc-wm8750.o 88obj-$(CONFIG_SND_SOC_WM8750) += snd-soc-wm8750.o
diff --git a/sound/soc/codecs/wm8727.c b/sound/soc/codecs/wm8727.c
new file mode 100644
index 000000000000..b3b60dd7bc14
--- /dev/null
+++ b/sound/soc/codecs/wm8727.c
@@ -0,0 +1,143 @@
1/*
2 * wm8727.c
3 *
4 * Created on: 15-Oct-2009
5 * Author: neil.jones@imgtec.com
6 *
7 * Copyright (C) 2009 Imagination Technologies Ltd.
8 *
9 * This program is free software; you can redistribute it and/or modify it
10 * under the terms of the GNU General Public License as published by the
11 * Free Software Foundation; either version 2 of the License, or (at your
12 * option) any later version.
13 */
14
15#include <linux/init.h>
16#include <linux/module.h>
17#include <linux/kernel.h>
18#include <linux/device.h>
19#include <sound/core.h>
20#include <sound/pcm.h>
21#include <sound/ac97_codec.h>
22#include <sound/initval.h>
23#include <sound/soc.h>
24
25#include "wm8727.h"
26/*
27 * Note this is a simple chip with no configuration interface, sample rate is
28 * determined automatically by examining the Master clock and Bit clock ratios
29 */
30#define WM8727_RATES (SNDRV_PCM_RATE_32000 | SNDRV_PCM_RATE_44100 |\
31 SNDRV_PCM_RATE_48000 | SNDRV_PCM_RATE_96000 |\
32 SNDRV_PCM_RATE_192000)
33
34
35struct snd_soc_dai wm8727_dai = {
36 .name = "WM8727",
37 .playback = {
38 .stream_name = "Playback",
39 .channels_min = 2,
40 .channels_max = 2,
41 .rates = WM8727_RATES,
42 .formats = SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S24_LE,
43 },
44};
45EXPORT_SYMBOL_GPL(wm8727_dai);
46
47static int wm8727_soc_probe(struct platform_device *pdev)
48{
49 struct snd_soc_device *socdev = platform_get_drvdata(pdev);
50 struct snd_soc_codec *codec;
51 int ret = 0;
52
53 codec = kzalloc(sizeof(struct snd_soc_codec), GFP_KERNEL);
54 if (codec == NULL)
55 return -ENOMEM;
56 mutex_init(&codec->mutex);
57 codec->name = "WM8727";
58 codec->owner = THIS_MODULE;
59 codec->dai = &wm8727_dai;
60 codec->num_dai = 1;
61 socdev->card->codec = codec;
62 INIT_LIST_HEAD(&codec->dapm_widgets);
63 INIT_LIST_HEAD(&codec->dapm_paths);
64
65 /* register pcms */
66 ret = snd_soc_new_pcms(socdev, SNDRV_DEFAULT_IDX1, SNDRV_DEFAULT_STR1);
67 if (ret < 0) {
68 printk(KERN_ERR "wm8727: failed to create pcms\n");
69 goto pcm_err;
70 }
71 /* register card */
72 ret = snd_soc_init_card(socdev);
73 if (ret < 0) {
74 printk(KERN_ERR "wm8727: failed to register card\n");
75 goto register_err;
76 }
77
78 return ret;
79
80register_err:
81 snd_soc_free_pcms(socdev);
82pcm_err:
83 kfree(socdev->card->codec);
84 socdev->card->codec = NULL;
85 return ret;
86}
87
88static int wm8727_soc_remove(struct platform_device *pdev)
89{
90 struct snd_soc_device *socdev = platform_get_drvdata(pdev);
91 struct snd_soc_codec *codec = socdev->card->codec;
92
93 if (codec == NULL)
94 return 0;
95 snd_soc_free_pcms(socdev);
96 kfree(codec);
97 return 0;
98}
99
100struct snd_soc_codec_device soc_codec_dev_wm8727 = {
101 .probe = wm8727_soc_probe,
102 .remove = wm8727_soc_remove,
103};
104EXPORT_SYMBOL_GPL(soc_codec_dev_wm8727);
105
106
107static __devinit int wm8727_platform_probe(struct platform_device *pdev)
108{
109 wm8727_dai.dev = &pdev->dev;
110 return snd_soc_register_dai(&wm8727_dai);
111}
112
113static int __devexit wm8727_platform_remove(struct platform_device *pdev)
114{
115 snd_soc_unregister_dai(&wm8727_dai);
116 return 0;
117}
118
119struct platform_driver wm8727_codec_driver = {
120 .driver = {
121 .name = "wm8727-codec",
122 .owner = THIS_MODULE,
123 },
124
125 .probe = wm8727_platform_probe,
126 .remove = __devexit_p(wm8727_platform_remove),
127};
128
129static int __init wm8727_init(void)
130{
131 return platform_driver_register(&wm8727_codec_driver);
132}
133module_init(wm8727_init);
134
135static void __exit wm8727_exit(void)
136{
137 platform_driver_unregister(&wm8727_codec_driver);
138}
139module_exit(wm8727_exit);
140
141MODULE_DESCRIPTION("ASoC wm8727 driver");
142MODULE_AUTHOR("Neil Jones");
143MODULE_LICENSE("GPL");
diff --git a/sound/soc/codecs/wm8727.h b/sound/soc/codecs/wm8727.h
new file mode 100644
index 000000000000..ee19aa71bcdc
--- /dev/null
+++ b/sound/soc/codecs/wm8727.h
@@ -0,0 +1,21 @@
1/*
2 * wm8727.h
3 *
4 * Created on: 15-Oct-2009
5 * Author: neil.jones@imgtec.com
6 *
7 * Copyright (C) 2009 Imagination Technologies Ltd.
8 *
9 * This program is free software; you can redistribute it and/or modify it
10 * under the terms of the GNU General Public License as published by the
11 * Free Software Foundation; either version 2 of the License, or (at your
12 * option) any later version.
13 */
14
15#ifndef WM8727_H_
16#define WM8727_H_
17
18extern struct snd_soc_dai wm8727_dai;
19extern struct snd_soc_codec_device soc_codec_dev_wm8727;
20
21#endif /* WM8727_H_ */