diff options
author | Kuninori Morimoto <morimoto.kuninori@renesas.com> | 2009-08-20 20:42:59 -0400 |
---|---|---|
committer | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2009-08-21 06:02:03 -0400 |
commit | b8e583f6012d618fb93bb38a302b63c3c6d2bfbc (patch) | |
tree | b766926ab822d02441d1ed77033896945e02d35b /sound/soc/sh | |
parent | a3a83d9a7cb0ce3b1d100060d5ad777e7480b4f2 (diff) |
ASoC: Add FSI-AK4642 sound support for SuperH
This patch is tested by ms7724se
Signed-off-by: Kuninori Morimoto <morimoto.kuninori@renesas.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'sound/soc/sh')
-rw-r--r-- | sound/soc/sh/Kconfig | 8 | ||||
-rw-r--r-- | sound/soc/sh/Makefile | 2 | ||||
-rw-r--r-- | sound/soc/sh/fsi-ak4642.c | 107 |
3 files changed, 117 insertions, 0 deletions
diff --git a/sound/soc/sh/Kconfig b/sound/soc/sh/Kconfig index 01943a188cff..9154b4363db3 100644 --- a/sound/soc/sh/Kconfig +++ b/sound/soc/sh/Kconfig | |||
@@ -40,4 +40,12 @@ config SND_SH7760_AC97 | |||
40 | This option enables generic sound support for the first | 40 | This option enables generic sound support for the first |
41 | AC97 unit of the SH7760. | 41 | AC97 unit of the SH7760. |
42 | 42 | ||
43 | config SND_FSI_AK4642 | ||
44 | bool "FSI-AK4642 sound support" | ||
45 | depends on SND_SOC_SH4_FSI | ||
46 | select SND_SOC_AK4642 | ||
47 | help | ||
48 | This option enables generic sound support for the | ||
49 | FSI - AK4642 unit | ||
50 | |||
43 | endmenu | 51 | endmenu |
diff --git a/sound/soc/sh/Makefile b/sound/soc/sh/Makefile index 9fbcc4ac9420..a6997872f24e 100644 --- a/sound/soc/sh/Makefile +++ b/sound/soc/sh/Makefile | |||
@@ -12,5 +12,7 @@ obj-$(CONFIG_SND_SOC_SH4_FSI) += snd-soc-fsi.o | |||
12 | 12 | ||
13 | ## boards | 13 | ## boards |
14 | snd-soc-sh7760-ac97-objs := sh7760-ac97.o | 14 | snd-soc-sh7760-ac97-objs := sh7760-ac97.o |
15 | snd-soc-fsi-ak4642-objs := fsi-ak4642.o | ||
15 | 16 | ||
16 | obj-$(CONFIG_SND_SH7760_AC97) += snd-soc-sh7760-ac97.o | 17 | obj-$(CONFIG_SND_SH7760_AC97) += snd-soc-sh7760-ac97.o |
18 | obj-$(CONFIG_SND_FSI_AK4642) += snd-soc-fsi-ak4642.o | ||
diff --git a/sound/soc/sh/fsi-ak4642.c b/sound/soc/sh/fsi-ak4642.c new file mode 100644 index 000000000000..c7af09729c6e --- /dev/null +++ b/sound/soc/sh/fsi-ak4642.c | |||
@@ -0,0 +1,107 @@ | |||
1 | /* | ||
2 | * FSI-AK464x sound support for ms7724se | ||
3 | * | ||
4 | * Copyright (C) 2009 Renesas Solutions Corp. | ||
5 | * Kuninori Morimoto <morimoto.kuninori@renesas.com> | ||
6 | * | ||
7 | * This file is subject to the terms and conditions of the GNU General Public | ||
8 | * License. See the file "COPYING" in the main directory of this archive | ||
9 | * for more details. | ||
10 | */ | ||
11 | |||
12 | #include <linux/module.h> | ||
13 | #include <linux/moduleparam.h> | ||
14 | #include <linux/platform_device.h> | ||
15 | #include <linux/i2c.h> | ||
16 | #include <linux/io.h> | ||
17 | #include <sound/core.h> | ||
18 | #include <sound/pcm.h> | ||
19 | #include <sound/soc.h> | ||
20 | #include <sound/soc-dapm.h> | ||
21 | |||
22 | #include <sound/sh_fsi.h> | ||
23 | #include <../sound/soc/codecs/ak4642.h> | ||
24 | |||
25 | static struct snd_soc_dai_link fsi_dai_link = { | ||
26 | .name = "AK4642", | ||
27 | .stream_name = "AK4642", | ||
28 | .cpu_dai = &fsi_soc_dai[0], /* fsi */ | ||
29 | .codec_dai = &ak4642_dai, | ||
30 | .ops = NULL, | ||
31 | }; | ||
32 | |||
33 | static struct snd_soc_card fsi_soc_card = { | ||
34 | .name = "FSI", | ||
35 | .platform = &fsi_soc_platform, | ||
36 | .dai_link = &fsi_dai_link, | ||
37 | .num_links = 1, | ||
38 | }; | ||
39 | |||
40 | static struct snd_soc_device fsi_snd_devdata = { | ||
41 | .card = &fsi_soc_card, | ||
42 | .codec_dev = &soc_codec_dev_ak4642, | ||
43 | }; | ||
44 | |||
45 | #define AK4642_BUS 0 | ||
46 | #define AK4642_ADR 0x12 | ||
47 | static int ak4642_add_i2c_device(void) | ||
48 | { | ||
49 | struct i2c_board_info info; | ||
50 | struct i2c_adapter *adapter; | ||
51 | struct i2c_client *client; | ||
52 | |||
53 | memset(&info, 0, sizeof(struct i2c_board_info)); | ||
54 | info.addr = AK4642_ADR; | ||
55 | strlcpy(info.type, "ak4642", I2C_NAME_SIZE); | ||
56 | |||
57 | adapter = i2c_get_adapter(AK4642_BUS); | ||
58 | if (!adapter) { | ||
59 | printk(KERN_DEBUG "can't get i2c adapter\n"); | ||
60 | return -ENODEV; | ||
61 | } | ||
62 | |||
63 | client = i2c_new_device(adapter, &info); | ||
64 | i2c_put_adapter(adapter); | ||
65 | if (!client) { | ||
66 | printk(KERN_DEBUG "can't add i2c device\n"); | ||
67 | return -ENODEV; | ||
68 | } | ||
69 | |||
70 | return 0; | ||
71 | } | ||
72 | |||
73 | static struct platform_device *fsi_snd_device; | ||
74 | |||
75 | static int __init fsi_ak4642_init(void) | ||
76 | { | ||
77 | int ret = -ENOMEM; | ||
78 | |||
79 | ak4642_add_i2c_device(); | ||
80 | |||
81 | fsi_snd_device = platform_device_alloc("soc-audio", -1); | ||
82 | if (!fsi_snd_device) | ||
83 | goto out; | ||
84 | |||
85 | platform_set_drvdata(fsi_snd_device, | ||
86 | &fsi_snd_devdata); | ||
87 | fsi_snd_devdata.dev = &fsi_snd_device->dev; | ||
88 | ret = platform_device_add(fsi_snd_device); | ||
89 | |||
90 | if (ret) | ||
91 | platform_device_put(fsi_snd_device); | ||
92 | |||
93 | out: | ||
94 | return ret; | ||
95 | } | ||
96 | |||
97 | static void __exit fsi_ak4642_exit(void) | ||
98 | { | ||
99 | platform_device_unregister(fsi_snd_device); | ||
100 | } | ||
101 | |||
102 | module_init(fsi_ak4642_init); | ||
103 | module_exit(fsi_ak4642_exit); | ||
104 | |||
105 | MODULE_LICENSE("GPL"); | ||
106 | MODULE_DESCRIPTION("Generic SH4 FSI-AK4642 sound card"); | ||
107 | MODULE_AUTHOR("Kuninori Morimoto <morimoto.kuninori@renesas.com>"); | ||