diff options
| author | Ryan Mallon <ryan@bluewatersys.com> | 2010-06-08 06:01:12 -0400 |
|---|---|---|
| committer | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2010-06-09 06:16:18 -0400 |
| commit | 315f7da6314e01322cae8bce9a90850060c041ea (patch) | |
| tree | a9b28b4eb8d4b61e949078cfd46201491a1d88fc | |
| parent | 6e03a61544c368c2c3ff946c1ce7807e5c36a527 (diff) | |
ASoC: EP93xx: Add Snapper CL15 i2s audio support
Add support for i2s audio on Bluewater Systems Snapper CL15 module
Signed-off-by: Ryan Mallon <ryan@bluewatersys.com>
Acked-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Acked-by: Liam Girdwood <lrg@slimlogic.co.uk>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
| -rw-r--r-- | arch/arm/mach-ep93xx/snappercl15.c | 1 | ||||
| -rw-r--r-- | sound/soc/ep93xx/Kconfig | 9 | ||||
| -rw-r--r-- | sound/soc/ep93xx/Makefile | 3 | ||||
| -rw-r--r-- | sound/soc/ep93xx/snappercl15.c | 150 |
4 files changed, 163 insertions, 0 deletions
diff --git a/arch/arm/mach-ep93xx/snappercl15.c b/arch/arm/mach-ep93xx/snappercl15.c index 38deaee40397..a12c89301297 100644 --- a/arch/arm/mach-ep93xx/snappercl15.c +++ b/arch/arm/mach-ep93xx/snappercl15.c | |||
| @@ -157,6 +157,7 @@ static void __init snappercl15_init_machine(void) | |||
| 157 | ep93xx_register_i2c(&snappercl15_i2c_gpio_data, snappercl15_i2c_data, | 157 | ep93xx_register_i2c(&snappercl15_i2c_gpio_data, snappercl15_i2c_data, |
| 158 | ARRAY_SIZE(snappercl15_i2c_data)); | 158 | ARRAY_SIZE(snappercl15_i2c_data)); |
| 159 | ep93xx_register_fb(&snappercl15_fb_info); | 159 | ep93xx_register_fb(&snappercl15_fb_info); |
| 160 | ep93xx_register_i2s(); | ||
| 160 | platform_device_register(&snappercl15_nand_device); | 161 | platform_device_register(&snappercl15_nand_device); |
| 161 | } | 162 | } |
| 162 | 163 | ||
diff --git a/sound/soc/ep93xx/Kconfig b/sound/soc/ep93xx/Kconfig index ba66ac8e1419..f617f560f46b 100644 --- a/sound/soc/ep93xx/Kconfig +++ b/sound/soc/ep93xx/Kconfig | |||
| @@ -7,3 +7,12 @@ config SND_EP93XX_SOC | |||
| 7 | 7 | ||
| 8 | config SND_EP93XX_SOC_I2S | 8 | config SND_EP93XX_SOC_I2S |
| 9 | tristate | 9 | tristate |
| 10 | |||
| 11 | config SND_EP93XX_SOC_SNAPPERCL15 | ||
| 12 | tristate "SoC Audio support for Bluewater Systems Snapper CL15 module" | ||
| 13 | depends on SND_EP93XX_SOC && MACH_SNAPPER_CL15 | ||
| 14 | select SND_EP93XX_SOC_I2S | ||
| 15 | select SND_SOC_TLV320AIC23 | ||
| 16 | help | ||
| 17 | Say Y or M here if you want to add support for I2S audio on the | ||
| 18 | Bluewater Systems Snapper CL15 module. | ||
diff --git a/sound/soc/ep93xx/Makefile b/sound/soc/ep93xx/Makefile index 0239da36cea3..272e60f57b9a 100644 --- a/sound/soc/ep93xx/Makefile +++ b/sound/soc/ep93xx/Makefile | |||
| @@ -6,3 +6,6 @@ obj-$(CONFIG_SND_EP93XX_SOC) += snd-soc-ep93xx.o | |||
| 6 | obj-$(CONFIG_SND_EP93XX_SOC_I2S) += snd-soc-ep93xx-i2s.o | 6 | obj-$(CONFIG_SND_EP93XX_SOC_I2S) += snd-soc-ep93xx-i2s.o |
| 7 | 7 | ||
| 8 | # EP93XX Machine Support | 8 | # EP93XX Machine Support |
| 9 | snd-soc-snappercl15-objs := snappercl15.o | ||
| 10 | |||
| 11 | obj-$(CONFIG_SND_EP93XX_SOC_SNAPPERCL15) += snd-soc-snappercl15.o | ||
diff --git a/sound/soc/ep93xx/snappercl15.c b/sound/soc/ep93xx/snappercl15.c new file mode 100644 index 000000000000..64955340ff75 --- /dev/null +++ b/sound/soc/ep93xx/snappercl15.c | |||
| @@ -0,0 +1,150 @@ | |||
| 1 | /* | ||
| 2 | * snappercl15.c -- SoC audio for Bluewater Systems Snapper CL15 module | ||
| 3 | * | ||
| 4 | * Copyright (C) 2008 Bluewater Systems Ltd | ||
| 5 | * Author: Ryan Mallon <ryan@bluewatersys.com> | ||
| 6 | * | ||
| 7 | * This program is free software; you can redistribute it and/or modify it | ||
| 8 | * under the terms of the GNU General Public License as published by the | ||
| 9 | * Free Software Foundation; either version 2 of the License, or (at your | ||
| 10 | * option) any later version. | ||
| 11 | * | ||
| 12 | */ | ||
| 13 | |||
| 14 | #include <linux/platform_device.h> | ||
| 15 | #include <sound/core.h> | ||
| 16 | #include <sound/pcm.h> | ||
| 17 | #include <sound/soc.h> | ||
| 18 | #include <sound/soc-dapm.h> | ||
| 19 | |||
| 20 | #include <asm/mach-types.h> | ||
| 21 | #include <mach/hardware.h> | ||
| 22 | |||
| 23 | #include "../codecs/tlv320aic23.h" | ||
| 24 | #include "ep93xx-pcm.h" | ||
| 25 | #include "ep93xx-i2s.h" | ||
| 26 | |||
| 27 | #define CODEC_CLOCK 5644800 | ||
| 28 | |||
| 29 | static int snappercl15_hw_params(struct snd_pcm_substream *substream, | ||
| 30 | struct snd_pcm_hw_params *params) | ||
| 31 | { | ||
| 32 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | ||
| 33 | struct snd_soc_dai *codec_dai = rtd->dai->codec_dai; | ||
| 34 | struct snd_soc_dai *cpu_dai = rtd->dai->cpu_dai; | ||
| 35 | int err; | ||
| 36 | |||
| 37 | err = snd_soc_dai_set_fmt(codec_dai, SND_SOC_DAIFMT_I2S | | ||
| 38 | SND_SOC_DAIFMT_NB_IF | | ||
| 39 | SND_SOC_DAIFMT_CBS_CFS); | ||
| 40 | |||
| 41 | err = snd_soc_dai_set_fmt(cpu_dai, SND_SOC_DAIFMT_I2S | | ||
| 42 | SND_SOC_DAIFMT_NB_IF | | ||
| 43 | SND_SOC_DAIFMT_CBS_CFS); | ||
| 44 | if (err) | ||
| 45 | return err; | ||
| 46 | |||
| 47 | err = snd_soc_dai_set_sysclk(codec_dai, 0, CODEC_CLOCK, | ||
| 48 | SND_SOC_CLOCK_IN); | ||
| 49 | if (err) | ||
| 50 | return err; | ||
| 51 | |||
| 52 | err = snd_soc_dai_set_sysclk(cpu_dai, 0, CODEC_CLOCK, | ||
| 53 | SND_SOC_CLOCK_OUT); | ||
| 54 | if (err) | ||
| 55 | return err; | ||
| 56 | |||
| 57 | return 0; | ||
| 58 | } | ||
| 59 | |||
| 60 | static struct snd_soc_ops snappercl15_ops = { | ||
| 61 | .hw_params = snappercl15_hw_params, | ||
| 62 | }; | ||
| 63 | |||
| 64 | static const struct snd_soc_dapm_widget tlv320aic23_dapm_widgets[] = { | ||
| 65 | SND_SOC_DAPM_HP("Headphone Jack", NULL), | ||
| 66 | SND_SOC_DAPM_LINE("Line In", NULL), | ||
| 67 | SND_SOC_DAPM_MIC("Mic Jack", NULL), | ||
| 68 | }; | ||
| 69 | |||
| 70 | static const struct snd_soc_dapm_route audio_map[] = { | ||
| 71 | {"Headphone Jack", NULL, "LHPOUT"}, | ||
| 72 | {"Headphone Jack", NULL, "RHPOUT"}, | ||
| 73 | |||
| 74 | {"LLINEIN", NULL, "Line In"}, | ||
| 75 | {"RLINEIN", NULL, "Line In"}, | ||
| 76 | |||
| 77 | {"MICIN", NULL, "Mic Jack"}, | ||
| 78 | }; | ||
| 79 | |||
| 80 | static int snappercl15_tlv320aic23_init(struct snd_soc_codec *codec) | ||
| 81 | { | ||
| 82 | snd_soc_dapm_new_controls(codec, tlv320aic23_dapm_widgets, | ||
| 83 | ARRAY_SIZE(tlv320aic23_dapm_widgets)); | ||
| 84 | |||
| 85 | snd_soc_dapm_add_routes(codec, audio_map, ARRAY_SIZE(audio_map)); | ||
| 86 | return 0; | ||
| 87 | } | ||
| 88 | |||
| 89 | static struct snd_soc_dai_link snappercl15_dai = { | ||
| 90 | .name = "tlv320aic23", | ||
| 91 | .stream_name = "AIC23", | ||
| 92 | .cpu_dai = &ep93xx_i2s_dai, | ||
| 93 | .codec_dai = &tlv320aic23_dai, | ||
| 94 | .init = snappercl15_tlv320aic23_init, | ||
| 95 | .ops = &snappercl15_ops, | ||
| 96 | }; | ||
| 97 | |||
| 98 | static struct snd_soc_card snd_soc_snappercl15 = { | ||
| 99 | .name = "Snapper CL15", | ||
| 100 | .platform = &ep93xx_soc_platform, | ||
| 101 | .dai_link = &snappercl15_dai, | ||
| 102 | .num_links = 1, | ||
| 103 | }; | ||
| 104 | |||
| 105 | static struct snd_soc_device snappercl15_snd_devdata = { | ||
| 106 | .card = &snd_soc_snappercl15, | ||
| 107 | .codec_dev = &soc_codec_dev_tlv320aic23, | ||
| 108 | }; | ||
| 109 | |||
| 110 | static struct platform_device *snappercl15_snd_device; | ||
| 111 | |||
| 112 | static int __init snappercl15_init(void) | ||
| 113 | { | ||
| 114 | int ret; | ||
| 115 | |||
| 116 | if (!machine_is_snapper_cl15()) | ||
| 117 | return -ENODEV; | ||
| 118 | |||
| 119 | ret = ep93xx_i2s_acquire(EP93XX_SYSCON_DEVCFG_I2SONAC97, | ||
| 120 | EP93XX_SYSCON_I2SCLKDIV_ORIDE | | ||
| 121 | EP93XX_SYSCON_I2SCLKDIV_SPOL); | ||
| 122 | if (ret) | ||
| 123 | return ret; | ||
| 124 | |||
| 125 | snappercl15_snd_device = platform_device_alloc("soc-audio", -1); | ||
| 126 | if (!snappercl15_snd_device) | ||
| 127 | return -ENOMEM; | ||
| 128 | |||
| 129 | platform_set_drvdata(snappercl15_snd_device, &snappercl15_snd_devdata); | ||
| 130 | snappercl15_snd_devdata.dev = &snappercl15_snd_device->dev; | ||
| 131 | ret = platform_device_add(snappercl15_snd_device); | ||
| 132 | if (ret) | ||
| 133 | platform_device_put(snappercl15_snd_device); | ||
| 134 | |||
| 135 | return ret; | ||
| 136 | } | ||
| 137 | |||
| 138 | static void __exit snappercl15_exit(void) | ||
| 139 | { | ||
| 140 | platform_device_unregister(snappercl15_snd_device); | ||
| 141 | ep93xx_i2s_release(); | ||
| 142 | } | ||
| 143 | |||
| 144 | module_init(snappercl15_init); | ||
| 145 | module_exit(snappercl15_exit); | ||
| 146 | |||
| 147 | MODULE_AUTHOR("Ryan Mallon <ryan@bluewatersys.com>"); | ||
| 148 | MODULE_DESCRIPTION("ALSA SoC Snapper CL15"); | ||
| 149 | MODULE_LICENSE("GPL"); | ||
| 150 | |||
