diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2011-03-18 13:46:37 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2011-03-18 13:46:37 -0400 |
commit | d3e458d78167102cc961237cfceef6fffc80c0b3 (patch) | |
tree | e9195c1294daf053614e63ac52b0b44a28479017 /sound/soc/samsung | |
parent | f2e1fbb5f2177227f71c4fc0491e531dd7acd385 (diff) | |
parent | d351cf4603edb2a5bfa9a48d06c425511c63f2a3 (diff) |
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound-2.6
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound-2.6: (308 commits)
ALSA: sound/pci/asihpi: check adapter index in hpi_ioctl
ALSA: aloop - Fix possible IRQ lock inversion
ALSA: sound/core: merge list_del()/list_add_tail() to list_move_tail()
ALSA: ctxfi - use list_move() instead of list_del()/list_add() combination
ALSA: firewire - msleep needs delay.h
ALSA: firewire-lib, firewire-speakers: handle packet queueing errors
ALSA: firewire-lib: allocate DMA buffer separately
ALSA: firewire-lib: use no-info SYT for packets without SYT sample
ALSA: add LaCie FireWire Speakers/Griffin FireWave Surround driver
ALSA: hda - Remove an unused variable in patch_realtek.c
ALSA: hda - pin-adc-mux-dmic auto-configuration of 92HD8X codecs
ALSA: hda - fix digital mic selection in mixer on 92HD8X codecs
ALSA: hda - Move default input-src selection to init part
ALSA: hda - Initialize special cases for input src in init phase
ALSA: ctxfi - Clear input settings before initialization
ALSA: ctxfi - Fix SPDIF status retrieval
ALSA: ctxfi - Fix incorrect SPDIF status bit mask
ALSA: ctxfi - Fix microphone boost codes/comments
ALSA: atiixp - Fix wrong time-out checks during ac-link reset
ALSA: intel8x0m: append 'm' to "r_intel8x0"
...
Diffstat (limited to 'sound/soc/samsung')
30 files changed, 365 insertions, 1253 deletions
diff --git a/sound/soc/samsung/Kconfig b/sound/soc/samsung/Kconfig index d6713d5a90e7..a3fdfb631469 100644 --- a/sound/soc/samsung/Kconfig +++ b/sound/soc/samsung/Kconfig | |||
@@ -35,23 +35,16 @@ config SND_SAMSUNG_I2S | |||
35 | tristate | 35 | tristate |
36 | 36 | ||
37 | config SND_SOC_SAMSUNG_NEO1973_WM8753 | 37 | config SND_SOC_SAMSUNG_NEO1973_WM8753 |
38 | tristate "SoC I2S Audio support for NEO1973 - WM8753" | 38 | tristate "Audio support for Openmoko Neo1973 Smartphones (GTA01/GTA02)" |
39 | depends on SND_SOC_SAMSUNG && MACH_NEO1973_GTA01 | 39 | depends on SND_SOC_SAMSUNG && (MACH_NEO1973_GTA01 || MACH_NEO1973_GTA02) |
40 | select SND_S3C24XX_I2S | 40 | select SND_S3C24XX_I2S |
41 | select SND_SOC_WM8753 | 41 | select SND_SOC_WM8753 |
42 | select SND_SOC_LM4857 if MACH_NEO1973_GTA01 | ||
43 | select SND_SOC_DFBMCS320 | ||
42 | help | 44 | help |
43 | Say Y if you want to add support for SoC audio on smdk2440 | 45 | Say Y here to enable audio support for the Openmoko Neo1973 |
44 | with the WM8753. | 46 | Smartphones. |
45 | 47 | ||
46 | config SND_SOC_SAMSUNG_NEO1973_GTA02_WM8753 | ||
47 | tristate "Audio support for the Openmoko Neo FreeRunner (GTA02)" | ||
48 | depends on SND_SOC_SAMSUNG && MACH_NEO1973_GTA02 | ||
49 | select SND_S3C24XX_I2S | ||
50 | select SND_SOC_WM8753 | ||
51 | help | ||
52 | This driver provides audio support for the Openmoko Neo FreeRunner | ||
53 | smartphone. | ||
54 | |||
55 | config SND_SOC_SAMSUNG_JIVE_WM8750 | 48 | config SND_SOC_SAMSUNG_JIVE_WM8750 |
56 | tristate "SoC I2S Audio support for Jive" | 49 | tristate "SoC I2S Audio support for Jive" |
57 | depends on SND_SOC_SAMSUNG && MACH_JIVE | 50 | depends on SND_SOC_SAMSUNG && MACH_JIVE |
diff --git a/sound/soc/samsung/Makefile b/sound/soc/samsung/Makefile index 705d4e8a6724..294dec05c26d 100644 --- a/sound/soc/samsung/Makefile +++ b/sound/soc/samsung/Makefile | |||
@@ -20,7 +20,6 @@ obj-$(CONFIG_SND_SAMSUNG_I2S) += snd-soc-i2s.o | |||
20 | # S3C24XX Machine Support | 20 | # S3C24XX Machine Support |
21 | snd-soc-jive-wm8750-objs := jive_wm8750.o | 21 | snd-soc-jive-wm8750-objs := jive_wm8750.o |
22 | snd-soc-neo1973-wm8753-objs := neo1973_wm8753.o | 22 | snd-soc-neo1973-wm8753-objs := neo1973_wm8753.o |
23 | snd-soc-neo1973-gta02-wm8753-objs := neo1973_gta02_wm8753.o | ||
24 | snd-soc-smdk2443-wm9710-objs := smdk2443_wm9710.o | 23 | snd-soc-smdk2443-wm9710-objs := smdk2443_wm9710.o |
25 | snd-soc-ln2440sbc-alc650-objs := ln2440sbc_alc650.o | 24 | snd-soc-ln2440sbc-alc650-objs := ln2440sbc_alc650.o |
26 | snd-soc-s3c24xx-uda134x-objs := s3c24xx_uda134x.o | 25 | snd-soc-s3c24xx-uda134x-objs := s3c24xx_uda134x.o |
@@ -38,7 +37,6 @@ snd-soc-smdk-spdif-objs := smdk_spdif.o | |||
38 | 37 | ||
39 | obj-$(CONFIG_SND_SOC_SAMSUNG_JIVE_WM8750) += snd-soc-jive-wm8750.o | 38 | obj-$(CONFIG_SND_SOC_SAMSUNG_JIVE_WM8750) += snd-soc-jive-wm8750.o |
40 | obj-$(CONFIG_SND_SOC_SAMSUNG_NEO1973_WM8753) += snd-soc-neo1973-wm8753.o | 39 | obj-$(CONFIG_SND_SOC_SAMSUNG_NEO1973_WM8753) += snd-soc-neo1973-wm8753.o |
41 | obj-$(CONFIG_SND_SOC_SAMSUNG_NEO1973_GTA02_WM8753) += snd-soc-neo1973-gta02-wm8753.o | ||
42 | obj-$(CONFIG_SND_SOC_SAMSUNG_SMDK2443_WM9710) += snd-soc-smdk2443-wm9710.o | 40 | obj-$(CONFIG_SND_SOC_SAMSUNG_SMDK2443_WM9710) += snd-soc-smdk2443-wm9710.o |
43 | obj-$(CONFIG_SND_SOC_SAMSUNG_LN2440SBC_ALC650) += snd-soc-ln2440sbc-alc650.o | 41 | obj-$(CONFIG_SND_SOC_SAMSUNG_LN2440SBC_ALC650) += snd-soc-ln2440sbc-alc650.o |
44 | obj-$(CONFIG_SND_SOC_SAMSUNG_S3C24XX_UDA134X) += snd-soc-s3c24xx-uda134x.o | 42 | obj-$(CONFIG_SND_SOC_SAMSUNG_S3C24XX_UDA134X) += snd-soc-s3c24xx-uda134x.o |
diff --git a/sound/soc/samsung/ac97.c b/sound/soc/samsung/ac97.c index 4770a9550341..f97110e72e85 100644 --- a/sound/soc/samsung/ac97.c +++ b/sound/soc/samsung/ac97.c | |||
@@ -12,24 +12,24 @@ | |||
12 | * published by the Free Software Foundation. | 12 | * published by the Free Software Foundation. |
13 | */ | 13 | */ |
14 | 14 | ||
15 | #include <linux/init.h> | ||
16 | #include <linux/module.h> | ||
17 | #include <linux/io.h> | 15 | #include <linux/io.h> |
18 | #include <linux/delay.h> | 16 | #include <linux/delay.h> |
19 | #include <linux/clk.h> | 17 | #include <linux/clk.h> |
20 | 18 | ||
21 | #include <sound/soc.h> | 19 | #include <sound/soc.h> |
22 | 20 | ||
23 | #include <plat/regs-ac97.h> | ||
24 | #include <mach/dma.h> | 21 | #include <mach/dma.h> |
22 | #include <plat/regs-ac97.h> | ||
25 | #include <plat/audio.h> | 23 | #include <plat/audio.h> |
26 | 24 | ||
27 | #include "dma.h" | 25 | #include "dma.h" |
28 | #include "ac97.h" | ||
29 | 26 | ||
30 | #define AC_CMD_ADDR(x) (x << 16) | 27 | #define AC_CMD_ADDR(x) (x << 16) |
31 | #define AC_CMD_DATA(x) (x & 0xffff) | 28 | #define AC_CMD_DATA(x) (x & 0xffff) |
32 | 29 | ||
30 | #define S3C_AC97_DAI_PCM 0 | ||
31 | #define S3C_AC97_DAI_MIC 1 | ||
32 | |||
33 | struct s3c_ac97_info { | 33 | struct s3c_ac97_info { |
34 | struct clk *ac97_clk; | 34 | struct clk *ac97_clk; |
35 | void __iomem *regs; | 35 | void __iomem *regs; |
diff --git a/sound/soc/samsung/ac97.h b/sound/soc/samsung/ac97.h deleted file mode 100644 index 0d0e1b511457..000000000000 --- a/sound/soc/samsung/ac97.h +++ /dev/null | |||
@@ -1,21 +0,0 @@ | |||
1 | /* sound/soc/samsung/ac97.h | ||
2 | * | ||
3 | * ALSA SoC Audio Layer - S3C AC97 Controller driver | ||
4 | * Evolved from s3c2443-ac97.h | ||
5 | * | ||
6 | * Copyright (c) 2010 Samsung Electronics Co. Ltd | ||
7 | * Author: Jaswinder Singh <jassi.brar@samsung.com> | ||
8 | * Credits: Graeme Gregory, Sean Choi | ||
9 | * | ||
10 | * This program is free software; you can redistribute it and/or modify | ||
11 | * it under the terms of the GNU General Public License version 2 as | ||
12 | * published by the Free Software Foundation. | ||
13 | */ | ||
14 | |||
15 | #ifndef __S3C_AC97_H_ | ||
16 | #define __S3C_AC97_H_ | ||
17 | |||
18 | #define S3C_AC97_DAI_PCM 0 | ||
19 | #define S3C_AC97_DAI_MIC 1 | ||
20 | |||
21 | #endif /* __S3C_AC97_H_ */ | ||
diff --git a/sound/soc/samsung/dma.c b/sound/soc/samsung/dma.c index 21240198c5d6..5cb3b880f0d5 100644 --- a/sound/soc/samsung/dma.c +++ b/sound/soc/samsung/dma.c | |||
@@ -14,17 +14,11 @@ | |||
14 | * option) any later version. | 14 | * option) any later version. |
15 | */ | 15 | */ |
16 | 16 | ||
17 | #include <linux/module.h> | ||
18 | #include <linux/init.h> | ||
19 | #include <linux/io.h> | ||
20 | #include <linux/platform_device.h> | ||
21 | #include <linux/slab.h> | 17 | #include <linux/slab.h> |
22 | #include <linux/dma-mapping.h> | 18 | #include <linux/dma-mapping.h> |
23 | 19 | ||
24 | #include <sound/core.h> | ||
25 | #include <sound/pcm.h> | ||
26 | #include <sound/pcm_params.h> | ||
27 | #include <sound/soc.h> | 20 | #include <sound/soc.h> |
21 | #include <sound/pcm_params.h> | ||
28 | 22 | ||
29 | #include <asm/dma.h> | 23 | #include <asm/dma.h> |
30 | #include <mach/hardware.h> | 24 | #include <mach/hardware.h> |
@@ -32,6 +26,9 @@ | |||
32 | 26 | ||
33 | #include "dma.h" | 27 | #include "dma.h" |
34 | 28 | ||
29 | #define ST_RUNNING (1<<0) | ||
30 | #define ST_OPENED (1<<1) | ||
31 | |||
35 | static const struct snd_pcm_hardware dma_hardware = { | 32 | static const struct snd_pcm_hardware dma_hardware = { |
36 | .info = SNDRV_PCM_INFO_INTERLEAVED | | 33 | .info = SNDRV_PCM_INFO_INTERLEAVED | |
37 | SNDRV_PCM_INFO_BLOCK_TRANSFER | | 34 | SNDRV_PCM_INFO_BLOCK_TRANSFER | |
@@ -313,7 +310,7 @@ dma_pointer(struct snd_pcm_substream *substream) | |||
313 | /* we seem to be getting the odd error from the pcm library due | 310 | /* we seem to be getting the odd error from the pcm library due |
314 | * to out-of-bounds pointers. this is maybe due to the dma engine | 311 | * to out-of-bounds pointers. this is maybe due to the dma engine |
315 | * not having loaded the new values for the channel before being | 312 | * not having loaded the new values for the channel before being |
316 | * callled... (todo - fix ) | 313 | * called... (todo - fix ) |
317 | */ | 314 | */ |
318 | 315 | ||
319 | if (res >= snd_pcm_lib_buffer_bytes(substream)) { | 316 | if (res >= snd_pcm_lib_buffer_bytes(substream)) { |
diff --git a/sound/soc/samsung/dma.h b/sound/soc/samsung/dma.h index f8cd2b4223af..c50659269a40 100644 --- a/sound/soc/samsung/dma.h +++ b/sound/soc/samsung/dma.h | |||
@@ -12,9 +12,6 @@ | |||
12 | #ifndef _S3C_AUDIO_H | 12 | #ifndef _S3C_AUDIO_H |
13 | #define _S3C_AUDIO_H | 13 | #define _S3C_AUDIO_H |
14 | 14 | ||
15 | #define ST_RUNNING (1<<0) | ||
16 | #define ST_OPENED (1<<1) | ||
17 | |||
18 | struct s3c_dma_params { | 15 | struct s3c_dma_params { |
19 | struct s3c2410_dma_client *client; /* stream identifier */ | 16 | struct s3c2410_dma_client *client; /* stream identifier */ |
20 | int channel; /* Channel ID */ | 17 | int channel; /* Channel ID */ |
@@ -22,9 +19,4 @@ struct s3c_dma_params { | |||
22 | int dma_size; /* Size of the DMA transfer */ | 19 | int dma_size; /* Size of the DMA transfer */ |
23 | }; | 20 | }; |
24 | 21 | ||
25 | #define S3C24XX_DAI_I2S 0 | ||
26 | |||
27 | /* platform data */ | ||
28 | extern struct snd_ac97_bus_ops s3c24xx_ac97_ops; | ||
29 | |||
30 | #endif | 22 | #endif |
diff --git a/sound/soc/samsung/goni_wm8994.c b/sound/soc/samsung/goni_wm8994.c index 34dd9ef1b9c0..f6b3a3ce5919 100644 --- a/sound/soc/samsung/goni_wm8994.c +++ b/sound/soc/samsung/goni_wm8994.c | |||
@@ -11,21 +11,13 @@ | |||
11 | * | 11 | * |
12 | */ | 12 | */ |
13 | 13 | ||
14 | #include <linux/module.h> | ||
15 | #include <linux/moduleparam.h> | ||
16 | #include <linux/io.h> | ||
17 | #include <linux/platform_device.h> | ||
18 | #include <sound/soc.h> | 14 | #include <sound/soc.h> |
19 | #include <sound/jack.h> | 15 | #include <sound/jack.h> |
16 | |||
20 | #include <asm/mach-types.h> | 17 | #include <asm/mach-types.h> |
21 | #include <mach/gpio.h> | 18 | #include <mach/gpio.h> |
22 | #include <mach/regs-clock.h> | ||
23 | 19 | ||
24 | #include <linux/mfd/wm8994/core.h> | ||
25 | #include <linux/mfd/wm8994/registers.h> | ||
26 | #include "../codecs/wm8994.h" | 20 | #include "../codecs/wm8994.h" |
27 | #include "dma.h" | ||
28 | #include "i2s.h" | ||
29 | 21 | ||
30 | #define MACHINE_NAME 0 | 22 | #define MACHINE_NAME 0 |
31 | #define CPU_VOICE_DAI 1 | 23 | #define CPU_VOICE_DAI 1 |
diff --git a/sound/soc/samsung/h1940_uda1380.c b/sound/soc/samsung/h1940_uda1380.c index c45f7ce14d61..241f55d00660 100644 --- a/sound/soc/samsung/h1940_uda1380.c +++ b/sound/soc/samsung/h1940_uda1380.c | |||
@@ -13,25 +13,16 @@ | |||
13 | * | 13 | * |
14 | */ | 14 | */ |
15 | 15 | ||
16 | #include <linux/module.h> | ||
17 | #include <linux/moduleparam.h> | ||
18 | #include <linux/platform_device.h> | ||
19 | #include <linux/i2c.h> | ||
20 | #include <linux/gpio.h> | 16 | #include <linux/gpio.h> |
21 | 17 | ||
22 | #include <sound/soc.h> | 18 | #include <sound/soc.h> |
23 | #include <sound/uda1380.h> | ||
24 | #include <sound/jack.h> | 19 | #include <sound/jack.h> |
25 | 20 | ||
26 | #include <plat/regs-iis.h> | 21 | #include <plat/regs-iis.h> |
27 | |||
28 | #include <mach/h1940-latch.h> | 22 | #include <mach/h1940-latch.h> |
29 | |||
30 | #include <asm/mach-types.h> | 23 | #include <asm/mach-types.h> |
31 | 24 | ||
32 | #include "dma.h" | ||
33 | #include "s3c24xx-i2s.h" | 25 | #include "s3c24xx-i2s.h" |
34 | #include "../codecs/uda1380.h" | ||
35 | 26 | ||
36 | static unsigned int rates[] = { | 27 | static unsigned int rates[] = { |
37 | 11025, | 28 | 11025, |
diff --git a/sound/soc/samsung/i2s.c b/sound/soc/samsung/i2s.c index d00ac3a7102c..ffa09b3b2caa 100644 --- a/sound/soc/samsung/i2s.c +++ b/sound/soc/samsung/i2s.c | |||
@@ -15,9 +15,8 @@ | |||
15 | #include <linux/clk.h> | 15 | #include <linux/clk.h> |
16 | #include <linux/io.h> | 16 | #include <linux/io.h> |
17 | 17 | ||
18 | #include <sound/pcm.h> | ||
19 | #include <sound/pcm_params.h> | ||
20 | #include <sound/soc.h> | 18 | #include <sound/soc.h> |
19 | #include <sound/pcm_params.h> | ||
21 | 20 | ||
22 | #include <plat/audio.h> | 21 | #include <plat/audio.h> |
23 | 22 | ||
diff --git a/sound/soc/samsung/jive_wm8750.c b/sound/soc/samsung/jive_wm8750.c index 08802520e014..3b53ad54bc33 100644 --- a/sound/soc/samsung/jive_wm8750.c +++ b/sound/soc/samsung/jive_wm8750.c | |||
@@ -11,22 +11,11 @@ | |||
11 | * published by the Free Software Foundation. | 11 | * published by the Free Software Foundation. |
12 | */ | 12 | */ |
13 | 13 | ||
14 | #include <linux/module.h> | ||
15 | #include <linux/moduleparam.h> | ||
16 | #include <linux/timer.h> | ||
17 | #include <linux/interrupt.h> | ||
18 | #include <linux/platform_device.h> | ||
19 | #include <linux/clk.h> | ||
20 | |||
21 | #include <sound/core.h> | ||
22 | #include <sound/pcm.h> | ||
23 | #include <sound/soc.h> | 14 | #include <sound/soc.h> |
24 | 15 | ||
25 | #include <asm/mach-types.h> | 16 | #include <asm/mach-types.h> |
26 | 17 | ||
27 | #include "dma.h" | ||
28 | #include "s3c2412-i2s.h" | 18 | #include "s3c2412-i2s.h" |
29 | |||
30 | #include "../codecs/wm8750.h" | 19 | #include "../codecs/wm8750.h" |
31 | 20 | ||
32 | static const struct snd_soc_dapm_route audio_map[] = { | 21 | static const struct snd_soc_dapm_route audio_map[] = { |
diff --git a/sound/soc/samsung/lm4857.h b/sound/soc/samsung/lm4857.h deleted file mode 100644 index 0cf5b7011d6f..000000000000 --- a/sound/soc/samsung/lm4857.h +++ /dev/null | |||
@@ -1,32 +0,0 @@ | |||
1 | /* | ||
2 | * lm4857.h -- ALSA Soc Audio Layer | ||
3 | * | ||
4 | * Copyright 2007 Wolfson Microelectronics PLC. | ||
5 | * Author: Graeme Gregory | ||
6 | * graeme.gregory@wolfsonmicro.com or linux@wolfsonmicro.com | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or modify it | ||
9 | * under the terms of the GNU General Public License as published by the | ||
10 | * Free Software Foundation; either version 2 of the License, or (at your | ||
11 | * option) any later version. | ||
12 | * | ||
13 | * Revision history | ||
14 | * 18th Jun 2007 Initial version. | ||
15 | */ | ||
16 | |||
17 | #ifndef LM4857_H_ | ||
18 | #define LM4857_H_ | ||
19 | |||
20 | /* The register offsets in the cache array */ | ||
21 | #define LM4857_MVOL 0 | ||
22 | #define LM4857_LVOL 1 | ||
23 | #define LM4857_RVOL 2 | ||
24 | #define LM4857_CTRL 3 | ||
25 | |||
26 | /* the shifts required to set these bits */ | ||
27 | #define LM4857_3D 5 | ||
28 | #define LM4857_WAKEUP 5 | ||
29 | #define LM4857_EPGAIN 4 | ||
30 | |||
31 | #endif /*LM4857_H_*/ | ||
32 | |||
diff --git a/sound/soc/samsung/ln2440sbc_alc650.c b/sound/soc/samsung/ln2440sbc_alc650.c index a2bb34def740..bd91c19a6c08 100644 --- a/sound/soc/samsung/ln2440sbc_alc650.c +++ b/sound/soc/samsung/ln2440sbc_alc650.c | |||
@@ -16,15 +16,8 @@ | |||
16 | * | 16 | * |
17 | */ | 17 | */ |
18 | 18 | ||
19 | #include <linux/module.h> | ||
20 | #include <linux/device.h> | ||
21 | #include <sound/core.h> | ||
22 | #include <sound/pcm.h> | ||
23 | #include <sound/soc.h> | 19 | #include <sound/soc.h> |
24 | 20 | ||
25 | #include "dma.h" | ||
26 | #include "ac97.h" | ||
27 | |||
28 | static struct snd_soc_card ln2440sbc; | 21 | static struct snd_soc_card ln2440sbc; |
29 | 22 | ||
30 | static struct snd_soc_dai_link ln2440sbc_dai[] = { | 23 | static struct snd_soc_dai_link ln2440sbc_dai[] = { |
diff --git a/sound/soc/samsung/neo1973_gta02_wm8753.c b/sound/soc/samsung/neo1973_gta02_wm8753.c deleted file mode 100644 index 0d0ae2b9eef6..000000000000 --- a/sound/soc/samsung/neo1973_gta02_wm8753.c +++ /dev/null | |||
@@ -1,504 +0,0 @@ | |||
1 | /* | ||
2 | * neo1973_gta02_wm8753.c -- SoC audio for Openmoko Freerunner(GTA02) | ||
3 | * | ||
4 | * Copyright 2007 Openmoko Inc | ||
5 | * Author: Graeme Gregory <graeme@openmoko.org> | ||
6 | * Copyright 2007 Wolfson Microelectronics PLC. | ||
7 | * Author: Graeme Gregory <linux@wolfsonmicro.com> | ||
8 | * Copyright 2009 Wolfson Microelectronics | ||
9 | * | ||
10 | * This program is free software; you can redistribute it and/or modify it | ||
11 | * under the terms of the GNU General Public License as published by the | ||
12 | * Free Software Foundation; either version 2 of the License, or (at your | ||
13 | * option) any later version. | ||
14 | */ | ||
15 | |||
16 | #include <linux/module.h> | ||
17 | #include <linux/moduleparam.h> | ||
18 | #include <linux/timer.h> | ||
19 | #include <linux/interrupt.h> | ||
20 | #include <linux/platform_device.h> | ||
21 | #include <linux/gpio.h> | ||
22 | #include <sound/core.h> | ||
23 | #include <sound/pcm.h> | ||
24 | #include <sound/soc.h> | ||
25 | |||
26 | #include <asm/mach-types.h> | ||
27 | |||
28 | #include <plat/regs-iis.h> | ||
29 | |||
30 | #include <mach/regs-clock.h> | ||
31 | #include <asm/io.h> | ||
32 | #include <mach/gta02.h> | ||
33 | #include "../codecs/wm8753.h" | ||
34 | #include "dma.h" | ||
35 | #include "s3c24xx-i2s.h" | ||
36 | |||
37 | static struct snd_soc_card neo1973_gta02; | ||
38 | |||
39 | static int neo1973_gta02_hifi_hw_params(struct snd_pcm_substream *substream, | ||
40 | struct snd_pcm_hw_params *params) | ||
41 | { | ||
42 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | ||
43 | struct snd_soc_dai *codec_dai = rtd->codec_dai; | ||
44 | struct snd_soc_dai *cpu_dai = rtd->cpu_dai; | ||
45 | unsigned int pll_out = 0, bclk = 0; | ||
46 | int ret = 0; | ||
47 | unsigned long iis_clkrate; | ||
48 | |||
49 | iis_clkrate = s3c24xx_i2s_get_clockrate(); | ||
50 | |||
51 | switch (params_rate(params)) { | ||
52 | case 8000: | ||
53 | case 16000: | ||
54 | pll_out = 12288000; | ||
55 | break; | ||
56 | case 48000: | ||
57 | bclk = WM8753_BCLK_DIV_4; | ||
58 | pll_out = 12288000; | ||
59 | break; | ||
60 | case 96000: | ||
61 | bclk = WM8753_BCLK_DIV_2; | ||
62 | pll_out = 12288000; | ||
63 | break; | ||
64 | case 11025: | ||
65 | bclk = WM8753_BCLK_DIV_16; | ||
66 | pll_out = 11289600; | ||
67 | break; | ||
68 | case 22050: | ||
69 | bclk = WM8753_BCLK_DIV_8; | ||
70 | pll_out = 11289600; | ||
71 | break; | ||
72 | case 44100: | ||
73 | bclk = WM8753_BCLK_DIV_4; | ||
74 | pll_out = 11289600; | ||
75 | break; | ||
76 | case 88200: | ||
77 | bclk = WM8753_BCLK_DIV_2; | ||
78 | pll_out = 11289600; | ||
79 | break; | ||
80 | } | ||
81 | |||
82 | /* set codec DAI configuration */ | ||
83 | ret = snd_soc_dai_set_fmt(codec_dai, | ||
84 | SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF | | ||
85 | SND_SOC_DAIFMT_CBM_CFM); | ||
86 | if (ret < 0) | ||
87 | return ret; | ||
88 | |||
89 | /* set cpu DAI configuration */ | ||
90 | ret = snd_soc_dai_set_fmt(cpu_dai, | ||
91 | SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF | | ||
92 | SND_SOC_DAIFMT_CBM_CFM); | ||
93 | if (ret < 0) | ||
94 | return ret; | ||
95 | |||
96 | /* set the codec system clock for DAC and ADC */ | ||
97 | ret = snd_soc_dai_set_sysclk(codec_dai, WM8753_MCLK, pll_out, | ||
98 | SND_SOC_CLOCK_IN); | ||
99 | if (ret < 0) | ||
100 | return ret; | ||
101 | |||
102 | /* set MCLK division for sample rate */ | ||
103 | ret = snd_soc_dai_set_clkdiv(cpu_dai, S3C24XX_DIV_MCLK, | ||
104 | S3C2410_IISMOD_32FS); | ||
105 | if (ret < 0) | ||
106 | return ret; | ||
107 | |||
108 | /* set codec BCLK division for sample rate */ | ||
109 | ret = snd_soc_dai_set_clkdiv(codec_dai, | ||
110 | WM8753_BCLKDIV, bclk); | ||
111 | if (ret < 0) | ||
112 | return ret; | ||
113 | |||
114 | /* set prescaler division for sample rate */ | ||
115 | ret = snd_soc_dai_set_clkdiv(cpu_dai, S3C24XX_DIV_PRESCALER, | ||
116 | S3C24XX_PRESCALE(4, 4)); | ||
117 | if (ret < 0) | ||
118 | return ret; | ||
119 | |||
120 | /* codec PLL input is PCLK/4 */ | ||
121 | ret = snd_soc_dai_set_pll(codec_dai, WM8753_PLL1, 0, | ||
122 | iis_clkrate / 4, pll_out); | ||
123 | if (ret < 0) | ||
124 | return ret; | ||
125 | |||
126 | return 0; | ||
127 | } | ||
128 | |||
129 | static int neo1973_gta02_hifi_hw_free(struct snd_pcm_substream *substream) | ||
130 | { | ||
131 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | ||
132 | struct snd_soc_dai *codec_dai = rtd->codec_dai; | ||
133 | |||
134 | /* disable the PLL */ | ||
135 | return snd_soc_dai_set_pll(codec_dai, WM8753_PLL1, 0, 0, 0); | ||
136 | } | ||
137 | |||
138 | /* | ||
139 | * Neo1973 WM8753 HiFi DAI opserations. | ||
140 | */ | ||
141 | static struct snd_soc_ops neo1973_gta02_hifi_ops = { | ||
142 | .hw_params = neo1973_gta02_hifi_hw_params, | ||
143 | .hw_free = neo1973_gta02_hifi_hw_free, | ||
144 | }; | ||
145 | |||
146 | static int neo1973_gta02_voice_hw_params( | ||
147 | struct snd_pcm_substream *substream, | ||
148 | struct snd_pcm_hw_params *params) | ||
149 | { | ||
150 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | ||
151 | struct snd_soc_dai *codec_dai = rtd->codec_dai; | ||
152 | unsigned int pcmdiv = 0; | ||
153 | int ret = 0; | ||
154 | unsigned long iis_clkrate; | ||
155 | |||
156 | iis_clkrate = s3c24xx_i2s_get_clockrate(); | ||
157 | |||
158 | if (params_rate(params) != 8000) | ||
159 | return -EINVAL; | ||
160 | if (params_channels(params) != 1) | ||
161 | return -EINVAL; | ||
162 | |||
163 | pcmdiv = WM8753_PCM_DIV_6; /* 2.048 MHz */ | ||
164 | |||
165 | /* todo: gg check mode (DSP_B) against CSR datasheet */ | ||
166 | /* set codec DAI configuration */ | ||
167 | ret = snd_soc_dai_set_fmt(codec_dai, SND_SOC_DAIFMT_DSP_B | | ||
168 | SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBS_CFS); | ||
169 | if (ret < 0) | ||
170 | return ret; | ||
171 | |||
172 | /* set the codec system clock for DAC and ADC */ | ||
173 | ret = snd_soc_dai_set_sysclk(codec_dai, WM8753_PCMCLK, | ||
174 | 12288000, SND_SOC_CLOCK_IN); | ||
175 | if (ret < 0) | ||
176 | return ret; | ||
177 | |||
178 | /* set codec PCM division for sample rate */ | ||
179 | ret = snd_soc_dai_set_clkdiv(codec_dai, WM8753_PCMDIV, | ||
180 | pcmdiv); | ||
181 | if (ret < 0) | ||
182 | return ret; | ||
183 | |||
184 | /* configure and enable PLL for 12.288MHz output */ | ||
185 | ret = snd_soc_dai_set_pll(codec_dai, WM8753_PLL2, 0, | ||
186 | iis_clkrate / 4, 12288000); | ||
187 | if (ret < 0) | ||
188 | return ret; | ||
189 | |||
190 | return 0; | ||
191 | } | ||
192 | |||
193 | static int neo1973_gta02_voice_hw_free(struct snd_pcm_substream *substream) | ||
194 | { | ||
195 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | ||
196 | struct snd_soc_dai *codec_dai = rtd->codec_dai; | ||
197 | |||
198 | /* disable the PLL */ | ||
199 | return snd_soc_dai_set_pll(codec_dai, WM8753_PLL2, 0, 0, 0); | ||
200 | } | ||
201 | |||
202 | static struct snd_soc_ops neo1973_gta02_voice_ops = { | ||
203 | .hw_params = neo1973_gta02_voice_hw_params, | ||
204 | .hw_free = neo1973_gta02_voice_hw_free, | ||
205 | }; | ||
206 | |||
207 | #define LM4853_AMP 1 | ||
208 | #define LM4853_SPK 2 | ||
209 | |||
210 | static u8 lm4853_state; | ||
211 | |||
212 | /* This has no effect, it exists only to maintain compatibility with | ||
213 | * existing ALSA state files. | ||
214 | */ | ||
215 | static int lm4853_set_state(struct snd_kcontrol *kcontrol, | ||
216 | struct snd_ctl_elem_value *ucontrol) | ||
217 | { | ||
218 | int val = ucontrol->value.integer.value[0]; | ||
219 | |||
220 | if (val) | ||
221 | lm4853_state |= LM4853_AMP; | ||
222 | else | ||
223 | lm4853_state &= ~LM4853_AMP; | ||
224 | |||
225 | return 0; | ||
226 | } | ||
227 | |||
228 | static int lm4853_get_state(struct snd_kcontrol *kcontrol, | ||
229 | struct snd_ctl_elem_value *ucontrol) | ||
230 | { | ||
231 | ucontrol->value.integer.value[0] = lm4853_state & LM4853_AMP; | ||
232 | |||
233 | return 0; | ||
234 | } | ||
235 | |||
236 | static int lm4853_set_spk(struct snd_kcontrol *kcontrol, | ||
237 | struct snd_ctl_elem_value *ucontrol) | ||
238 | { | ||
239 | int val = ucontrol->value.integer.value[0]; | ||
240 | |||
241 | if (val) { | ||
242 | lm4853_state |= LM4853_SPK; | ||
243 | gpio_set_value(GTA02_GPIO_HP_IN, 0); | ||
244 | } else { | ||
245 | lm4853_state &= ~LM4853_SPK; | ||
246 | gpio_set_value(GTA02_GPIO_HP_IN, 1); | ||
247 | } | ||
248 | |||
249 | return 0; | ||
250 | } | ||
251 | |||
252 | static int lm4853_get_spk(struct snd_kcontrol *kcontrol, | ||
253 | struct snd_ctl_elem_value *ucontrol) | ||
254 | { | ||
255 | ucontrol->value.integer.value[0] = (lm4853_state & LM4853_SPK) >> 1; | ||
256 | |||
257 | return 0; | ||
258 | } | ||
259 | |||
260 | static int lm4853_event(struct snd_soc_dapm_widget *w, | ||
261 | struct snd_kcontrol *k, | ||
262 | int event) | ||
263 | { | ||
264 | gpio_set_value(GTA02_GPIO_AMP_SHUT, SND_SOC_DAPM_EVENT_OFF(event)); | ||
265 | |||
266 | return 0; | ||
267 | } | ||
268 | |||
269 | static const struct snd_soc_dapm_widget wm8753_dapm_widgets[] = { | ||
270 | SND_SOC_DAPM_SPK("Stereo Out", lm4853_event), | ||
271 | SND_SOC_DAPM_LINE("GSM Line Out", NULL), | ||
272 | SND_SOC_DAPM_LINE("GSM Line In", NULL), | ||
273 | SND_SOC_DAPM_MIC("Headset Mic", NULL), | ||
274 | SND_SOC_DAPM_MIC("Handset Mic", NULL), | ||
275 | SND_SOC_DAPM_SPK("Handset Spk", NULL), | ||
276 | }; | ||
277 | |||
278 | |||
279 | /* example machine audio_mapnections */ | ||
280 | static const struct snd_soc_dapm_route audio_map[] = { | ||
281 | |||
282 | /* Connections to the lm4853 amp */ | ||
283 | {"Stereo Out", NULL, "LOUT1"}, | ||
284 | {"Stereo Out", NULL, "ROUT1"}, | ||
285 | |||
286 | /* Connections to the GSM Module */ | ||
287 | {"GSM Line Out", NULL, "MONO1"}, | ||
288 | {"GSM Line Out", NULL, "MONO2"}, | ||
289 | {"RXP", NULL, "GSM Line In"}, | ||
290 | {"RXN", NULL, "GSM Line In"}, | ||
291 | |||
292 | /* Connections to Headset */ | ||
293 | {"MIC1", NULL, "Mic Bias"}, | ||
294 | {"Mic Bias", NULL, "Headset Mic"}, | ||
295 | |||
296 | /* Call Mic */ | ||
297 | {"MIC2", NULL, "Mic Bias"}, | ||
298 | {"MIC2N", NULL, "Mic Bias"}, | ||
299 | {"Mic Bias", NULL, "Handset Mic"}, | ||
300 | |||
301 | /* Call Speaker */ | ||
302 | {"Handset Spk", NULL, "LOUT2"}, | ||
303 | {"Handset Spk", NULL, "ROUT2"}, | ||
304 | |||
305 | /* Connect the ALC pins */ | ||
306 | {"ACIN", NULL, "ACOP"}, | ||
307 | }; | ||
308 | |||
309 | static const struct snd_kcontrol_new wm8753_neo1973_gta02_controls[] = { | ||
310 | SOC_DAPM_PIN_SWITCH("Stereo Out"), | ||
311 | SOC_DAPM_PIN_SWITCH("GSM Line Out"), | ||
312 | SOC_DAPM_PIN_SWITCH("GSM Line In"), | ||
313 | SOC_DAPM_PIN_SWITCH("Headset Mic"), | ||
314 | SOC_DAPM_PIN_SWITCH("Handset Mic"), | ||
315 | SOC_DAPM_PIN_SWITCH("Handset Spk"), | ||
316 | |||
317 | /* This has no effect, it exists only to maintain compatibility with | ||
318 | * existing ALSA state files. | ||
319 | */ | ||
320 | SOC_SINGLE_EXT("Amp State Switch", 6, 0, 1, 0, | ||
321 | lm4853_get_state, | ||
322 | lm4853_set_state), | ||
323 | SOC_SINGLE_EXT("Amp Spk Switch", 7, 0, 1, 0, | ||
324 | lm4853_get_spk, | ||
325 | lm4853_set_spk), | ||
326 | }; | ||
327 | |||
328 | /* | ||
329 | * This is an example machine initialisation for a wm8753 connected to a | ||
330 | * neo1973 GTA02. | ||
331 | */ | ||
332 | static int neo1973_gta02_wm8753_init(struct snd_soc_pcm_runtime *rtd) | ||
333 | { | ||
334 | struct snd_soc_codec *codec = rtd->codec; | ||
335 | struct snd_soc_dapm_context *dapm = &codec->dapm; | ||
336 | int err; | ||
337 | |||
338 | /* set up NC codec pins */ | ||
339 | snd_soc_dapm_nc_pin(dapm, "OUT3"); | ||
340 | snd_soc_dapm_nc_pin(dapm, "OUT4"); | ||
341 | snd_soc_dapm_nc_pin(dapm, "LINE1"); | ||
342 | snd_soc_dapm_nc_pin(dapm, "LINE2"); | ||
343 | |||
344 | /* Add neo1973 gta02 specific widgets */ | ||
345 | snd_soc_dapm_new_controls(dapm, wm8753_dapm_widgets, | ||
346 | ARRAY_SIZE(wm8753_dapm_widgets)); | ||
347 | |||
348 | /* add neo1973 gta02 specific controls */ | ||
349 | err = snd_soc_add_controls(codec, wm8753_neo1973_gta02_controls, | ||
350 | ARRAY_SIZE(wm8753_neo1973_gta02_controls)); | ||
351 | |||
352 | if (err < 0) | ||
353 | return err; | ||
354 | |||
355 | /* set up neo1973 gta02 specific audio path audio_map */ | ||
356 | snd_soc_dapm_add_routes(dapm, audio_map, ARRAY_SIZE(audio_map)); | ||
357 | |||
358 | /* set endpoints to default off mode */ | ||
359 | snd_soc_dapm_disable_pin(dapm, "Stereo Out"); | ||
360 | snd_soc_dapm_disable_pin(dapm, "GSM Line Out"); | ||
361 | snd_soc_dapm_disable_pin(dapm, "GSM Line In"); | ||
362 | snd_soc_dapm_disable_pin(dapm, "Headset Mic"); | ||
363 | snd_soc_dapm_disable_pin(dapm, "Handset Mic"); | ||
364 | snd_soc_dapm_disable_pin(dapm, "Handset Spk"); | ||
365 | |||
366 | /* allow audio paths from the GSM modem to run during suspend */ | ||
367 | snd_soc_dapm_ignore_suspend(dapm, "Stereo Out"); | ||
368 | snd_soc_dapm_ignore_suspend(dapm, "GSM Line Out"); | ||
369 | snd_soc_dapm_ignore_suspend(dapm, "GSM Line In"); | ||
370 | snd_soc_dapm_ignore_suspend(dapm, "Headset Mic"); | ||
371 | snd_soc_dapm_ignore_suspend(dapm, "Handset Mic"); | ||
372 | snd_soc_dapm_ignore_suspend(dapm, "Handset Spk"); | ||
373 | |||
374 | snd_soc_dapm_sync(dapm); | ||
375 | |||
376 | return 0; | ||
377 | } | ||
378 | |||
379 | /* | ||
380 | * BT Codec DAI | ||
381 | */ | ||
382 | static struct snd_soc_dai_driver bt_dai = { | ||
383 | .name = "bluetooth-dai", | ||
384 | .playback = { | ||
385 | .channels_min = 1, | ||
386 | .channels_max = 1, | ||
387 | .rates = SNDRV_PCM_RATE_8000, | ||
388 | .formats = SNDRV_PCM_FMTBIT_S16_LE,}, | ||
389 | .capture = { | ||
390 | .channels_min = 1, | ||
391 | .channels_max = 1, | ||
392 | .rates = SNDRV_PCM_RATE_8000, | ||
393 | .formats = SNDRV_PCM_FMTBIT_S16_LE,}, | ||
394 | }; | ||
395 | |||
396 | static struct snd_soc_dai_link neo1973_gta02_dai[] = { | ||
397 | { /* Hifi Playback - for similatious use with voice below */ | ||
398 | .name = "WM8753", | ||
399 | .stream_name = "WM8753 HiFi", | ||
400 | .cpu_dai_name = "s3c24xx-iis", | ||
401 | .codec_dai_name = "wm8753-hifi", | ||
402 | .init = neo1973_gta02_wm8753_init, | ||
403 | .platform_name = "samsung-audio", | ||
404 | .codec_name = "wm8753-codec.0-001a", | ||
405 | .ops = &neo1973_gta02_hifi_ops, | ||
406 | }, | ||
407 | { /* Voice via BT */ | ||
408 | .name = "Bluetooth", | ||
409 | .stream_name = "Voice", | ||
410 | .cpu_dai_name = "bluetooth-dai", | ||
411 | .codec_dai_name = "wm8753-voice", | ||
412 | .ops = &neo1973_gta02_voice_ops, | ||
413 | .codec_name = "wm8753-codec.0-001a", | ||
414 | .platform_name = "samsung-audio", | ||
415 | }, | ||
416 | }; | ||
417 | |||
418 | static struct snd_soc_card neo1973_gta02 = { | ||
419 | .name = "neo1973-gta02", | ||
420 | .dai_link = neo1973_gta02_dai, | ||
421 | .num_links = ARRAY_SIZE(neo1973_gta02_dai), | ||
422 | }; | ||
423 | |||
424 | static struct platform_device *neo1973_gta02_snd_device; | ||
425 | |||
426 | static int __init neo1973_gta02_init(void) | ||
427 | { | ||
428 | int ret; | ||
429 | |||
430 | if (!machine_is_neo1973_gta02()) { | ||
431 | printk(KERN_INFO | ||
432 | "Only GTA02 is supported by this ASoC driver\n"); | ||
433 | return -ENODEV; | ||
434 | } | ||
435 | |||
436 | neo1973_gta02_snd_device = platform_device_alloc("soc-audio", -1); | ||
437 | if (!neo1973_gta02_snd_device) | ||
438 | return -ENOMEM; | ||
439 | |||
440 | /* register bluetooth DAI here */ | ||
441 | ret = snd_soc_register_dai(&neo1973_gta02_snd_device->dev, &bt_dai); | ||
442 | if (ret) | ||
443 | goto err_put_device; | ||
444 | |||
445 | platform_set_drvdata(neo1973_gta02_snd_device, &neo1973_gta02); | ||
446 | ret = platform_device_add(neo1973_gta02_snd_device); | ||
447 | |||
448 | if (ret) | ||
449 | goto err_unregister_dai; | ||
450 | |||
451 | /* Initialise GPIOs used by amp */ | ||
452 | ret = gpio_request(GTA02_GPIO_HP_IN, "GTA02_HP_IN"); | ||
453 | if (ret) { | ||
454 | pr_err("gta02_wm8753: Failed to register GPIO %d\n", GTA02_GPIO_HP_IN); | ||
455 | goto err_del_device; | ||
456 | } | ||
457 | |||
458 | ret = gpio_direction_output(GTA02_GPIO_HP_IN, 1); | ||
459 | if (ret) { | ||
460 | pr_err("gta02_wm8753: Failed to configure GPIO %d\n", GTA02_GPIO_HP_IN); | ||
461 | goto err_free_gpio_hp_in; | ||
462 | } | ||
463 | |||
464 | ret = gpio_request(GTA02_GPIO_AMP_SHUT, "GTA02_AMP_SHUT"); | ||
465 | if (ret) { | ||
466 | pr_err("gta02_wm8753: Failed to register GPIO %d\n", GTA02_GPIO_AMP_SHUT); | ||
467 | goto err_free_gpio_hp_in; | ||
468 | } | ||
469 | |||
470 | ret = gpio_direction_output(GTA02_GPIO_AMP_SHUT, 1); | ||
471 | if (ret) { | ||
472 | pr_err("gta02_wm8753: Failed to configure GPIO %d\n", GTA02_GPIO_AMP_SHUT); | ||
473 | goto err_free_gpio_amp_shut; | ||
474 | } | ||
475 | |||
476 | return 0; | ||
477 | |||
478 | err_free_gpio_amp_shut: | ||
479 | gpio_free(GTA02_GPIO_AMP_SHUT); | ||
480 | err_free_gpio_hp_in: | ||
481 | gpio_free(GTA02_GPIO_HP_IN); | ||
482 | err_del_device: | ||
483 | platform_device_del(neo1973_gta02_snd_device); | ||
484 | err_unregister_dai: | ||
485 | snd_soc_unregister_dai(&neo1973_gta02_snd_device->dev); | ||
486 | err_put_device: | ||
487 | platform_device_put(neo1973_gta02_snd_device); | ||
488 | return ret; | ||
489 | } | ||
490 | module_init(neo1973_gta02_init); | ||
491 | |||
492 | static void __exit neo1973_gta02_exit(void) | ||
493 | { | ||
494 | snd_soc_unregister_dai(&neo1973_gta02_snd_device->dev); | ||
495 | platform_device_unregister(neo1973_gta02_snd_device); | ||
496 | gpio_free(GTA02_GPIO_HP_IN); | ||
497 | gpio_free(GTA02_GPIO_AMP_SHUT); | ||
498 | } | ||
499 | module_exit(neo1973_gta02_exit); | ||
500 | |||
501 | /* Module information */ | ||
502 | MODULE_AUTHOR("Graeme Gregory, graeme@openmoko.org"); | ||
503 | MODULE_DESCRIPTION("ALSA SoC WM8753 Neo1973 GTA02"); | ||
504 | MODULE_LICENSE("GPL"); | ||
diff --git a/sound/soc/samsung/neo1973_wm8753.c b/sound/soc/samsung/neo1973_wm8753.c index d20815d5ab2e..78bfdb3f5d7e 100644 --- a/sound/soc/samsung/neo1973_wm8753.c +++ b/sound/soc/samsung/neo1973_wm8753.c | |||
@@ -1,57 +1,32 @@ | |||
1 | /* | 1 | /* |
2 | * neo1973_wm8753.c -- SoC audio for Neo1973 | 2 | * neo1973_wm8753.c -- SoC audio for Openmoko Neo1973 and Freerunner devices |
3 | * | 3 | * |
4 | * Copyright 2007 Openmoko Inc | ||
5 | * Author: Graeme Gregory <graeme@openmoko.org> | ||
4 | * Copyright 2007 Wolfson Microelectronics PLC. | 6 | * Copyright 2007 Wolfson Microelectronics PLC. |
5 | * Author: Graeme Gregory | 7 | * Author: Graeme Gregory |
6 | * graeme.gregory@wolfsonmicro.com or linux@wolfsonmicro.com | 8 | * graeme.gregory@wolfsonmicro.com or linux@wolfsonmicro.com |
9 | * Copyright 2009 Wolfson Microelectronics | ||
7 | * | 10 | * |
8 | * This program is free software; you can redistribute it and/or modify it | 11 | * This program is free software; you can redistribute it and/or modify it |
9 | * under the terms of the GNU General Public License as published by the | 12 | * under the terms of the GNU General Public License as published by the |
10 | * Free Software Foundation; either version 2 of the License, or (at your | 13 | * Free Software Foundation; either version 2 of the License, or (at your |
11 | * option) any later version. | 14 | * option) any later version. |
12 | * | ||
13 | */ | 15 | */ |
14 | 16 | ||
15 | #include <linux/module.h> | 17 | #include <linux/module.h> |
16 | #include <linux/moduleparam.h> | ||
17 | #include <linux/timer.h> | ||
18 | #include <linux/interrupt.h> | ||
19 | #include <linux/platform_device.h> | 18 | #include <linux/platform_device.h> |
20 | #include <linux/i2c.h> | 19 | #include <linux/gpio.h> |
21 | #include <sound/core.h> | 20 | |
22 | #include <sound/pcm.h> | ||
23 | #include <sound/soc.h> | 21 | #include <sound/soc.h> |
24 | #include <sound/tlv.h> | ||
25 | 22 | ||
26 | #include <asm/mach-types.h> | 23 | #include <asm/mach-types.h> |
27 | #include <asm/hardware/scoop.h> | ||
28 | #include <mach/regs-clock.h> | ||
29 | #include <mach/regs-gpio.h> | ||
30 | #include <mach/hardware.h> | ||
31 | #include <linux/io.h> | ||
32 | #include <mach/spi-gpio.h> | ||
33 | |||
34 | #include <plat/regs-iis.h> | 24 | #include <plat/regs-iis.h> |
25 | #include <mach/gta02.h> | ||
35 | 26 | ||
36 | #include "../codecs/wm8753.h" | 27 | #include "../codecs/wm8753.h" |
37 | #include "lm4857.h" | ||
38 | #include "dma.h" | ||
39 | #include "s3c24xx-i2s.h" | 28 | #include "s3c24xx-i2s.h" |
40 | 29 | ||
41 | /* define the scenarios */ | ||
42 | #define NEO_AUDIO_OFF 0 | ||
43 | #define NEO_GSM_CALL_AUDIO_HANDSET 1 | ||
44 | #define NEO_GSM_CALL_AUDIO_HEADSET 2 | ||
45 | #define NEO_GSM_CALL_AUDIO_BLUETOOTH 3 | ||
46 | #define NEO_STEREO_TO_SPEAKERS 4 | ||
47 | #define NEO_STEREO_TO_HEADPHONES 5 | ||
48 | #define NEO_CAPTURE_HANDSET 6 | ||
49 | #define NEO_CAPTURE_HEADSET 7 | ||
50 | #define NEO_CAPTURE_BLUETOOTH 8 | ||
51 | |||
52 | static struct snd_soc_card neo1973; | ||
53 | static struct i2c_client *i2c; | ||
54 | |||
55 | static int neo1973_hifi_hw_params(struct snd_pcm_substream *substream, | 30 | static int neo1973_hifi_hw_params(struct snd_pcm_substream *substream, |
56 | struct snd_pcm_hw_params *params) | 31 | struct snd_pcm_hw_params *params) |
57 | { | 32 | { |
@@ -62,8 +37,6 @@ static int neo1973_hifi_hw_params(struct snd_pcm_substream *substream, | |||
62 | int ret = 0; | 37 | int ret = 0; |
63 | unsigned long iis_clkrate; | 38 | unsigned long iis_clkrate; |
64 | 39 | ||
65 | pr_debug("Entered %s\n", __func__); | ||
66 | |||
67 | iis_clkrate = s3c24xx_i2s_get_clockrate(); | 40 | iis_clkrate = s3c24xx_i2s_get_clockrate(); |
68 | 41 | ||
69 | switch (params_rate(params)) { | 42 | switch (params_rate(params)) { |
@@ -148,8 +121,6 @@ static int neo1973_hifi_hw_free(struct snd_pcm_substream *substream) | |||
148 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | 121 | struct snd_soc_pcm_runtime *rtd = substream->private_data; |
149 | struct snd_soc_dai *codec_dai = rtd->codec_dai; | 122 | struct snd_soc_dai *codec_dai = rtd->codec_dai; |
150 | 123 | ||
151 | pr_debug("Entered %s\n", __func__); | ||
152 | |||
153 | /* disable the PLL */ | 124 | /* disable the PLL */ |
154 | return snd_soc_dai_set_pll(codec_dai, WM8753_PLL1, 0, 0, 0); | 125 | return snd_soc_dai_set_pll(codec_dai, WM8753_PLL1, 0, 0, 0); |
155 | } | 126 | } |
@@ -171,8 +142,6 @@ static int neo1973_voice_hw_params(struct snd_pcm_substream *substream, | |||
171 | int ret = 0; | 142 | int ret = 0; |
172 | unsigned long iis_clkrate; | 143 | unsigned long iis_clkrate; |
173 | 144 | ||
174 | pr_debug("Entered %s\n", __func__); | ||
175 | |||
176 | iis_clkrate = s3c24xx_i2s_get_clockrate(); | 145 | iis_clkrate = s3c24xx_i2s_get_clockrate(); |
177 | 146 | ||
178 | if (params_rate(params) != 8000) | 147 | if (params_rate(params) != 8000) |
@@ -214,8 +183,6 @@ static int neo1973_voice_hw_free(struct snd_pcm_substream *substream) | |||
214 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | 183 | struct snd_soc_pcm_runtime *rtd = substream->private_data; |
215 | struct snd_soc_dai *codec_dai = rtd->codec_dai; | 184 | struct snd_soc_dai *codec_dai = rtd->codec_dai; |
216 | 185 | ||
217 | pr_debug("Entered %s\n", __func__); | ||
218 | |||
219 | /* disable the PLL */ | 186 | /* disable the PLL */ |
220 | return snd_soc_dai_set_pll(codec_dai, WM8753_PLL2, 0, 0, 0); | 187 | return snd_soc_dai_set_pll(codec_dai, WM8753_PLL2, 0, 0, 0); |
221 | } | 188 | } |
@@ -225,335 +192,232 @@ static struct snd_soc_ops neo1973_voice_ops = { | |||
225 | .hw_free = neo1973_voice_hw_free, | 192 | .hw_free = neo1973_voice_hw_free, |
226 | }; | 193 | }; |
227 | 194 | ||
228 | static int neo1973_scenario; | 195 | /* Shared routes and controls */ |
229 | |||
230 | static int neo1973_get_scenario(struct snd_kcontrol *kcontrol, | ||
231 | struct snd_ctl_elem_value *ucontrol) | ||
232 | { | ||
233 | ucontrol->value.integer.value[0] = neo1973_scenario; | ||
234 | return 0; | ||
235 | } | ||
236 | |||
237 | static int set_scenario_endpoints(struct snd_soc_codec *codec, int scenario) | ||
238 | { | ||
239 | struct snd_soc_dapm_context *dapm = &codec->dapm; | ||
240 | |||
241 | pr_debug("Entered %s\n", __func__); | ||
242 | |||
243 | switch (neo1973_scenario) { | ||
244 | case NEO_AUDIO_OFF: | ||
245 | snd_soc_dapm_disable_pin(dapm, "Audio Out"); | ||
246 | snd_soc_dapm_disable_pin(dapm, "GSM Line Out"); | ||
247 | snd_soc_dapm_disable_pin(dapm, "GSM Line In"); | ||
248 | snd_soc_dapm_disable_pin(dapm, "Headset Mic"); | ||
249 | snd_soc_dapm_disable_pin(dapm, "Call Mic"); | ||
250 | break; | ||
251 | case NEO_GSM_CALL_AUDIO_HANDSET: | ||
252 | snd_soc_dapm_enable_pin(dapm, "Audio Out"); | ||
253 | snd_soc_dapm_enable_pin(dapm, "GSM Line Out"); | ||
254 | snd_soc_dapm_enable_pin(dapm, "GSM Line In"); | ||
255 | snd_soc_dapm_disable_pin(dapm, "Headset Mic"); | ||
256 | snd_soc_dapm_enable_pin(dapm, "Call Mic"); | ||
257 | break; | ||
258 | case NEO_GSM_CALL_AUDIO_HEADSET: | ||
259 | snd_soc_dapm_enable_pin(dapm, "Audio Out"); | ||
260 | snd_soc_dapm_enable_pin(dapm, "GSM Line Out"); | ||
261 | snd_soc_dapm_enable_pin(dapm, "GSM Line In"); | ||
262 | snd_soc_dapm_enable_pin(dapm, "Headset Mic"); | ||
263 | snd_soc_dapm_disable_pin(dapm, "Call Mic"); | ||
264 | break; | ||
265 | case NEO_GSM_CALL_AUDIO_BLUETOOTH: | ||
266 | snd_soc_dapm_disable_pin(dapm, "Audio Out"); | ||
267 | snd_soc_dapm_enable_pin(dapm, "GSM Line Out"); | ||
268 | snd_soc_dapm_enable_pin(dapm, "GSM Line In"); | ||
269 | snd_soc_dapm_disable_pin(dapm, "Headset Mic"); | ||
270 | snd_soc_dapm_disable_pin(dapm, "Call Mic"); | ||
271 | break; | ||
272 | case NEO_STEREO_TO_SPEAKERS: | ||
273 | snd_soc_dapm_enable_pin(dapm, "Audio Out"); | ||
274 | snd_soc_dapm_disable_pin(dapm, "GSM Line Out"); | ||
275 | snd_soc_dapm_disable_pin(dapm, "GSM Line In"); | ||
276 | snd_soc_dapm_disable_pin(dapm, "Headset Mic"); | ||
277 | snd_soc_dapm_disable_pin(dapm, "Call Mic"); | ||
278 | break; | ||
279 | case NEO_STEREO_TO_HEADPHONES: | ||
280 | snd_soc_dapm_enable_pin(dapm, "Audio Out"); | ||
281 | snd_soc_dapm_disable_pin(dapm, "GSM Line Out"); | ||
282 | snd_soc_dapm_disable_pin(dapm, "GSM Line In"); | ||
283 | snd_soc_dapm_disable_pin(dapm, "Headset Mic"); | ||
284 | snd_soc_dapm_disable_pin(dapm, "Call Mic"); | ||
285 | break; | ||
286 | case NEO_CAPTURE_HANDSET: | ||
287 | snd_soc_dapm_disable_pin(dapm, "Audio Out"); | ||
288 | snd_soc_dapm_disable_pin(dapm, "GSM Line Out"); | ||
289 | snd_soc_dapm_disable_pin(dapm, "GSM Line In"); | ||
290 | snd_soc_dapm_disable_pin(dapm, "Headset Mic"); | ||
291 | snd_soc_dapm_enable_pin(dapm, "Call Mic"); | ||
292 | break; | ||
293 | case NEO_CAPTURE_HEADSET: | ||
294 | snd_soc_dapm_disable_pin(dapm, "Audio Out"); | ||
295 | snd_soc_dapm_disable_pin(dapm, "GSM Line Out"); | ||
296 | snd_soc_dapm_disable_pin(dapm, "GSM Line In"); | ||
297 | snd_soc_dapm_enable_pin(dapm, "Headset Mic"); | ||
298 | snd_soc_dapm_disable_pin(dapm, "Call Mic"); | ||
299 | break; | ||
300 | case NEO_CAPTURE_BLUETOOTH: | ||
301 | snd_soc_dapm_disable_pin(dapm, "Audio Out"); | ||
302 | snd_soc_dapm_disable_pin(dapm, "GSM Line Out"); | ||
303 | snd_soc_dapm_disable_pin(dapm, "GSM Line In"); | ||
304 | snd_soc_dapm_disable_pin(dapm, "Headset Mic"); | ||
305 | snd_soc_dapm_disable_pin(dapm, "Call Mic"); | ||
306 | break; | ||
307 | default: | ||
308 | snd_soc_dapm_disable_pin(dapm, "Audio Out"); | ||
309 | snd_soc_dapm_disable_pin(dapm, "GSM Line Out"); | ||
310 | snd_soc_dapm_disable_pin(dapm, "GSM Line In"); | ||
311 | snd_soc_dapm_disable_pin(dapm, "Headset Mic"); | ||
312 | snd_soc_dapm_disable_pin(dapm, "Call Mic"); | ||
313 | } | ||
314 | 196 | ||
315 | snd_soc_dapm_sync(dapm); | 197 | static const struct snd_soc_dapm_widget neo1973_wm8753_dapm_widgets[] = { |
198 | SND_SOC_DAPM_LINE("GSM Line Out", NULL), | ||
199 | SND_SOC_DAPM_LINE("GSM Line In", NULL), | ||
200 | SND_SOC_DAPM_MIC("Headset Mic", NULL), | ||
201 | SND_SOC_DAPM_MIC("Handset Mic", NULL), | ||
202 | }; | ||
316 | 203 | ||
317 | return 0; | 204 | static const struct snd_soc_dapm_route neo1973_wm8753_routes[] = { |
318 | } | 205 | /* Connections to the GSM Module */ |
206 | {"GSM Line Out", NULL, "MONO1"}, | ||
207 | {"GSM Line Out", NULL, "MONO2"}, | ||
208 | {"RXP", NULL, "GSM Line In"}, | ||
209 | {"RXN", NULL, "GSM Line In"}, | ||
319 | 210 | ||
320 | static int neo1973_set_scenario(struct snd_kcontrol *kcontrol, | 211 | /* Connections to Headset */ |
321 | struct snd_ctl_elem_value *ucontrol) | 212 | {"MIC1", NULL, "Mic Bias"}, |
322 | { | 213 | {"Mic Bias", NULL, "Headset Mic"}, |
323 | struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); | ||
324 | 214 | ||
325 | pr_debug("Entered %s\n", __func__); | 215 | /* Call Mic */ |
216 | {"MIC2", NULL, "Mic Bias"}, | ||
217 | {"MIC2N", NULL, "Mic Bias"}, | ||
218 | {"Mic Bias", NULL, "Handset Mic"}, | ||
326 | 219 | ||
327 | if (neo1973_scenario == ucontrol->value.integer.value[0]) | 220 | /* Connect the ALC pins */ |
328 | return 0; | 221 | {"ACIN", NULL, "ACOP"}, |
222 | }; | ||
329 | 223 | ||
330 | neo1973_scenario = ucontrol->value.integer.value[0]; | 224 | static const struct snd_kcontrol_new neo1973_wm8753_controls[] = { |
331 | set_scenario_endpoints(codec, neo1973_scenario); | 225 | SOC_DAPM_PIN_SWITCH("GSM Line Out"), |
332 | return 1; | 226 | SOC_DAPM_PIN_SWITCH("GSM Line In"), |
333 | } | 227 | SOC_DAPM_PIN_SWITCH("Headset Mic"), |
228 | SOC_DAPM_PIN_SWITCH("Handset Mic"), | ||
229 | }; | ||
334 | 230 | ||
335 | static u8 lm4857_regs[4] = {0x00, 0x40, 0x80, 0xC0}; | 231 | /* GTA02 specific routes and controlls */ |
336 | 232 | ||
337 | static void lm4857_write_regs(void) | 233 | #ifdef CONFIG_MACH_NEO1973_GTA02 |
338 | { | ||
339 | pr_debug("Entered %s\n", __func__); | ||
340 | 234 | ||
341 | if (i2c_master_send(i2c, lm4857_regs, 4) != 4) | 235 | static int gta02_speaker_enabled; |
342 | printk(KERN_ERR "lm4857: i2c write failed\n"); | ||
343 | } | ||
344 | 236 | ||
345 | static int lm4857_get_reg(struct snd_kcontrol *kcontrol, | 237 | static int lm4853_set_spk(struct snd_kcontrol *kcontrol, |
346 | struct snd_ctl_elem_value *ucontrol) | 238 | struct snd_ctl_elem_value *ucontrol) |
347 | { | 239 | { |
348 | struct soc_mixer_control *mc = | 240 | gta02_speaker_enabled = ucontrol->value.integer.value[0]; |
349 | (struct soc_mixer_control *)kcontrol->private_value; | ||
350 | int reg = mc->reg; | ||
351 | int shift = mc->shift; | ||
352 | int mask = mc->max; | ||
353 | 241 | ||
354 | pr_debug("Entered %s\n", __func__); | 242 | gpio_set_value(GTA02_GPIO_HP_IN, !gta02_speaker_enabled); |
355 | 243 | ||
356 | ucontrol->value.integer.value[0] = (lm4857_regs[reg] >> shift) & mask; | ||
357 | return 0; | 244 | return 0; |
358 | } | 245 | } |
359 | 246 | ||
360 | static int lm4857_set_reg(struct snd_kcontrol *kcontrol, | 247 | static int lm4853_get_spk(struct snd_kcontrol *kcontrol, |
361 | struct snd_ctl_elem_value *ucontrol) | 248 | struct snd_ctl_elem_value *ucontrol) |
362 | { | 249 | { |
363 | struct soc_mixer_control *mc = | 250 | ucontrol->value.integer.value[0] = gta02_speaker_enabled; |
364 | (struct soc_mixer_control *)kcontrol->private_value; | 251 | return 0; |
365 | int reg = mc->reg; | ||
366 | int shift = mc->shift; | ||
367 | int mask = mc->max; | ||
368 | |||
369 | if (((lm4857_regs[reg] >> shift) & mask) == | ||
370 | ucontrol->value.integer.value[0]) | ||
371 | return 0; | ||
372 | |||
373 | lm4857_regs[reg] &= ~(mask << shift); | ||
374 | lm4857_regs[reg] |= ucontrol->value.integer.value[0] << shift; | ||
375 | lm4857_write_regs(); | ||
376 | return 1; | ||
377 | } | 252 | } |
378 | 253 | ||
379 | static int lm4857_get_mode(struct snd_kcontrol *kcontrol, | 254 | static int lm4853_event(struct snd_soc_dapm_widget *w, |
380 | struct snd_ctl_elem_value *ucontrol) | 255 | struct snd_kcontrol *k, int event) |
381 | { | 256 | { |
382 | u8 value = lm4857_regs[LM4857_CTRL] & 0x0F; | 257 | gpio_set_value(GTA02_GPIO_AMP_SHUT, SND_SOC_DAPM_EVENT_OFF(event)); |
383 | |||
384 | pr_debug("Entered %s\n", __func__); | ||
385 | |||
386 | if (value) | ||
387 | value -= 5; | ||
388 | 258 | ||
389 | ucontrol->value.integer.value[0] = value; | ||
390 | return 0; | 259 | return 0; |
391 | } | 260 | } |
392 | 261 | ||
393 | static int lm4857_set_mode(struct snd_kcontrol *kcontrol, | 262 | static const struct snd_soc_dapm_route neo1973_gta02_routes[] = { |
394 | struct snd_ctl_elem_value *ucontrol) | 263 | /* Connections to the amp */ |
395 | { | 264 | {"Stereo Out", NULL, "LOUT1"}, |
396 | u8 value = ucontrol->value.integer.value[0]; | 265 | {"Stereo Out", NULL, "ROUT1"}, |
397 | |||
398 | pr_debug("Entered %s\n", __func__); | ||
399 | |||
400 | if (value) | ||
401 | value += 5; | ||
402 | |||
403 | if ((lm4857_regs[LM4857_CTRL] & 0x0F) == value) | ||
404 | return 0; | ||
405 | |||
406 | lm4857_regs[LM4857_CTRL] &= 0xF0; | ||
407 | lm4857_regs[LM4857_CTRL] |= value; | ||
408 | lm4857_write_regs(); | ||
409 | return 1; | ||
410 | } | ||
411 | 266 | ||
412 | static const struct snd_soc_dapm_widget wm8753_dapm_widgets[] = { | 267 | /* Call Speaker */ |
413 | SND_SOC_DAPM_LINE("Audio Out", NULL), | 268 | {"Handset Spk", NULL, "LOUT2"}, |
414 | SND_SOC_DAPM_LINE("GSM Line Out", NULL), | 269 | {"Handset Spk", NULL, "ROUT2"}, |
415 | SND_SOC_DAPM_LINE("GSM Line In", NULL), | ||
416 | SND_SOC_DAPM_MIC("Headset Mic", NULL), | ||
417 | SND_SOC_DAPM_MIC("Call Mic", NULL), | ||
418 | }; | 270 | }; |
419 | 271 | ||
272 | static const struct snd_kcontrol_new neo1973_gta02_wm8753_controls[] = { | ||
273 | SOC_DAPM_PIN_SWITCH("Handset Spk"), | ||
274 | SOC_DAPM_PIN_SWITCH("Stereo Out"), | ||
420 | 275 | ||
421 | static const struct snd_soc_dapm_route dapm_routes[] = { | 276 | SOC_SINGLE_BOOL_EXT("Amp Spk Switch", 0, |
422 | 277 | lm4853_get_spk, | |
423 | /* Connections to the lm4857 amp */ | 278 | lm4853_set_spk), |
424 | {"Audio Out", NULL, "LOUT1"}, | 279 | }; |
425 | {"Audio Out", NULL, "ROUT1"}, | ||
426 | |||
427 | /* Connections to the GSM Module */ | ||
428 | {"GSM Line Out", NULL, "MONO1"}, | ||
429 | {"GSM Line Out", NULL, "MONO2"}, | ||
430 | {"RXP", NULL, "GSM Line In"}, | ||
431 | {"RXN", NULL, "GSM Line In"}, | ||
432 | 280 | ||
433 | /* Connections to Headset */ | 281 | static const struct snd_soc_dapm_widget neo1973_gta02_wm8753_dapm_widgets[] = { |
434 | {"MIC1", NULL, "Mic Bias"}, | 282 | SND_SOC_DAPM_SPK("Handset Spk", NULL), |
435 | {"Mic Bias", NULL, "Headset Mic"}, | 283 | SND_SOC_DAPM_SPK("Stereo Out", lm4853_event), |
284 | }; | ||
436 | 285 | ||
437 | /* Call Mic */ | 286 | static int neo1973_gta02_wm8753_init(struct snd_soc_codec *codec) |
438 | {"MIC2", NULL, "Mic Bias"}, | 287 | { |
439 | {"MIC2N", NULL, "Mic Bias"}, | 288 | struct snd_soc_dapm_context *dapm = &codec->dapm; |
440 | {"Mic Bias", NULL, "Call Mic"}, | 289 | int ret; |
441 | 290 | ||
442 | /* Connect the ALC pins */ | 291 | ret = snd_soc_dapm_new_controls(dapm, neo1973_gta02_wm8753_dapm_widgets, |
443 | {"ACIN", NULL, "ACOP"}, | 292 | ARRAY_SIZE(neo1973_gta02_wm8753_dapm_widgets)); |
444 | }; | 293 | if (ret) |
294 | return ret; | ||
445 | 295 | ||
446 | static const char *lm4857_mode[] = { | 296 | ret = snd_soc_dapm_add_routes(dapm, neo1973_gta02_routes, |
447 | "Off", | 297 | ARRAY_SIZE(neo1973_gta02_routes)); |
448 | "Call Speaker", | 298 | if (ret) |
449 | "Stereo Speakers", | 299 | return ret; |
450 | "Stereo Speakers + Headphones", | ||
451 | "Headphones" | ||
452 | }; | ||
453 | 300 | ||
454 | static const struct soc_enum lm4857_mode_enum[] = { | 301 | ret = snd_soc_add_controls(codec, neo1973_gta02_wm8753_controls, |
455 | SOC_ENUM_SINGLE_EXT(ARRAY_SIZE(lm4857_mode), lm4857_mode), | 302 | ARRAY_SIZE(neo1973_gta02_wm8753_controls)); |
456 | }; | 303 | if (ret) |
304 | return ret; | ||
457 | 305 | ||
458 | static const char *neo_scenarios[] = { | 306 | snd_soc_dapm_disable_pin(dapm, "Stereo Out"); |
459 | "Off", | 307 | snd_soc_dapm_disable_pin(dapm, "Handset Spk"); |
460 | "GSM Handset", | 308 | snd_soc_dapm_ignore_suspend(dapm, "Stereo Out"); |
461 | "GSM Headset", | 309 | snd_soc_dapm_ignore_suspend(dapm, "Handset Spk"); |
462 | "GSM Bluetooth", | ||
463 | "Speakers", | ||
464 | "Headphones", | ||
465 | "Capture Handset", | ||
466 | "Capture Headset", | ||
467 | "Capture Bluetooth" | ||
468 | }; | ||
469 | 310 | ||
470 | static const struct soc_enum neo_scenario_enum[] = { | 311 | return 0; |
471 | SOC_ENUM_SINGLE_EXT(ARRAY_SIZE(neo_scenarios), neo_scenarios), | 312 | } |
472 | }; | ||
473 | 313 | ||
474 | static const DECLARE_TLV_DB_SCALE(stereo_tlv, -4050, 150, 0); | 314 | #else |
475 | static const DECLARE_TLV_DB_SCALE(mono_tlv, -3450, 150, 0); | 315 | static int neo1973_gta02_wm8753_init(struct snd_soc_code *codec) { return 0; } |
476 | 316 | #endif | |
477 | static const struct snd_kcontrol_new wm8753_neo1973_controls[] = { | ||
478 | SOC_SINGLE_EXT_TLV("Amp Left Playback Volume", LM4857_LVOL, 0, 31, 0, | ||
479 | lm4857_get_reg, lm4857_set_reg, stereo_tlv), | ||
480 | SOC_SINGLE_EXT_TLV("Amp Right Playback Volume", LM4857_RVOL, 0, 31, 0, | ||
481 | lm4857_get_reg, lm4857_set_reg, stereo_tlv), | ||
482 | SOC_SINGLE_EXT_TLV("Amp Mono Playback Volume", LM4857_MVOL, 0, 31, 0, | ||
483 | lm4857_get_reg, lm4857_set_reg, mono_tlv), | ||
484 | SOC_ENUM_EXT("Amp Mode", lm4857_mode_enum[0], | ||
485 | lm4857_get_mode, lm4857_set_mode), | ||
486 | SOC_ENUM_EXT("Neo Mode", neo_scenario_enum[0], | ||
487 | neo1973_get_scenario, neo1973_set_scenario), | ||
488 | SOC_SINGLE_EXT("Amp Spk 3D Playback Switch", LM4857_LVOL, 5, 1, 0, | ||
489 | lm4857_get_reg, lm4857_set_reg), | ||
490 | SOC_SINGLE_EXT("Amp HP 3d Playback Switch", LM4857_RVOL, 5, 1, 0, | ||
491 | lm4857_get_reg, lm4857_set_reg), | ||
492 | SOC_SINGLE_EXT("Amp Fast Wakeup Playback Switch", LM4857_CTRL, 5, 1, 0, | ||
493 | lm4857_get_reg, lm4857_set_reg), | ||
494 | SOC_SINGLE_EXT("Amp Earpiece 6dB Playback Switch", LM4857_CTRL, 4, 1, 0, | ||
495 | lm4857_get_reg, lm4857_set_reg), | ||
496 | }; | ||
497 | 317 | ||
498 | /* | ||
499 | * This is an example machine initialisation for a wm8753 connected to a | ||
500 | * neo1973 II. It is missing logic to detect hp/mic insertions and logic | ||
501 | * to re-route the audio in such an event. | ||
502 | */ | ||
503 | static int neo1973_wm8753_init(struct snd_soc_pcm_runtime *rtd) | 318 | static int neo1973_wm8753_init(struct snd_soc_pcm_runtime *rtd) |
504 | { | 319 | { |
505 | struct snd_soc_codec *codec = rtd->codec; | 320 | struct snd_soc_codec *codec = rtd->codec; |
506 | struct snd_soc_dapm_context *dapm = &codec->dapm; | 321 | struct snd_soc_dapm_context *dapm = &codec->dapm; |
507 | int err; | 322 | int ret; |
508 | |||
509 | pr_debug("Entered %s\n", __func__); | ||
510 | 323 | ||
511 | /* set up NC codec pins */ | 324 | /* set up NC codec pins */ |
512 | snd_soc_dapm_nc_pin(dapm, "LOUT2"); | 325 | if (machine_is_neo1973_gta01()) { |
513 | snd_soc_dapm_nc_pin(dapm, "ROUT2"); | 326 | snd_soc_dapm_nc_pin(dapm, "LOUT2"); |
327 | snd_soc_dapm_nc_pin(dapm, "ROUT2"); | ||
328 | } | ||
514 | snd_soc_dapm_nc_pin(dapm, "OUT3"); | 329 | snd_soc_dapm_nc_pin(dapm, "OUT3"); |
515 | snd_soc_dapm_nc_pin(dapm, "OUT4"); | 330 | snd_soc_dapm_nc_pin(dapm, "OUT4"); |
516 | snd_soc_dapm_nc_pin(dapm, "LINE1"); | 331 | snd_soc_dapm_nc_pin(dapm, "LINE1"); |
517 | snd_soc_dapm_nc_pin(dapm, "LINE2"); | 332 | snd_soc_dapm_nc_pin(dapm, "LINE2"); |
518 | 333 | ||
519 | /* Add neo1973 specific widgets */ | 334 | /* Add neo1973 specific widgets */ |
520 | snd_soc_dapm_new_controls(dapm, wm8753_dapm_widgets, | 335 | ret = snd_soc_dapm_new_controls(dapm, neo1973_wm8753_dapm_widgets, |
521 | ARRAY_SIZE(wm8753_dapm_widgets)); | 336 | ARRAY_SIZE(neo1973_wm8753_dapm_widgets)); |
522 | 337 | if (ret) | |
523 | /* set endpoints to default mode */ | 338 | return ret; |
524 | set_scenario_endpoints(codec, NEO_AUDIO_OFF); | ||
525 | 339 | ||
526 | /* add neo1973 specific controls */ | 340 | /* add neo1973 specific controls */ |
527 | err = snd_soc_add_controls(codec, wm8753_neo1973_controls, | 341 | ret = snd_soc_add_controls(codec, neo1973_wm8753_controls, |
528 | ARRAY_SIZE(8753_neo1973_controls)); | 342 | ARRAY_SIZE(neo1973_wm8753_controls)); |
529 | if (err < 0) | 343 | if (ret) |
530 | return err; | 344 | return ret; |
531 | 345 | ||
532 | /* set up neo1973 specific audio routes */ | 346 | /* set up neo1973 specific audio routes */ |
533 | err = snd_soc_dapm_add_routes(dapm, dapm_routes, | 347 | ret = snd_soc_dapm_add_routes(dapm, neo1973_wm8753_routes, |
534 | ARRAY_SIZE(dapm_routes)); | 348 | ARRAY_SIZE(neo1973_wm8753_routes)); |
349 | if (ret) | ||
350 | return ret; | ||
351 | |||
352 | /* set endpoints to default off mode */ | ||
353 | snd_soc_dapm_disable_pin(dapm, "GSM Line Out"); | ||
354 | snd_soc_dapm_disable_pin(dapm, "GSM Line In"); | ||
355 | snd_soc_dapm_disable_pin(dapm, "Headset Mic"); | ||
356 | snd_soc_dapm_disable_pin(dapm, "Handset Mic"); | ||
357 | |||
358 | /* allow audio paths from the GSM modem to run during suspend */ | ||
359 | snd_soc_dapm_ignore_suspend(dapm, "GSM Line Out"); | ||
360 | snd_soc_dapm_ignore_suspend(dapm, "GSM Line In"); | ||
361 | snd_soc_dapm_ignore_suspend(dapm, "Headset Mic"); | ||
362 | snd_soc_dapm_ignore_suspend(dapm, "Handset Mic"); | ||
363 | |||
364 | if (machine_is_neo1973_gta02()) { | ||
365 | ret = neo1973_gta02_wm8753_init(codec); | ||
366 | if (ret) | ||
367 | return ret; | ||
368 | } | ||
535 | 369 | ||
536 | snd_soc_dapm_sync(dapm); | 370 | snd_soc_dapm_sync(dapm); |
371 | |||
537 | return 0; | 372 | return 0; |
538 | } | 373 | } |
539 | 374 | ||
540 | /* | 375 | /* GTA01 specific controlls */ |
541 | * BT Codec DAI | 376 | |
542 | */ | 377 | #ifdef CONFIG_MACH_NEO1973_GTA01 |
543 | static struct snd_soc_dai bt_dai = { | 378 | |
544 | .name = "bluetooth-dai", | 379 | static const struct snd_soc_dapm_route neo1973_lm4857_routes[] = { |
545 | .playback = { | 380 | {"Amp IN", NULL, "ROUT1"}, |
546 | .channels_min = 1, | 381 | {"Amp IN", NULL, "LOUT1"}, |
547 | .channels_max = 1, | 382 | |
548 | .rates = SNDRV_PCM_RATE_8000, | 383 | {"Handset Spk", NULL, "Amp EP"}, |
549 | .formats = SNDRV_PCM_FMTBIT_S16_LE,}, | 384 | {"Stereo Out", NULL, "Amp LS"}, |
550 | .capture = { | 385 | {"Headphone", NULL, "Amp HP"}, |
551 | .channels_min = 1, | 386 | }; |
552 | .channels_max = 1, | 387 | |
553 | .rates = SNDRV_PCM_RATE_8000, | 388 | static const struct snd_soc_dapm_widget neo1973_lm4857_dapm_widgets[] = { |
554 | .formats = SNDRV_PCM_FMTBIT_S16_LE,}, | 389 | SND_SOC_DAPM_SPK("Handset Spk", NULL), |
390 | SND_SOC_DAPM_SPK("Stereo Out", NULL), | ||
391 | SND_SOC_DAPM_HP("Headphone", NULL), | ||
555 | }; | 392 | }; |
556 | 393 | ||
394 | static int neo1973_lm4857_init(struct snd_soc_dapm_context *dapm) | ||
395 | { | ||
396 | int ret; | ||
397 | |||
398 | ret = snd_soc_dapm_new_controls(dapm, neo1973_lm4857_dapm_widgets, | ||
399 | ARRAY_SIZE(neo1973_lm4857_dapm_widgets)); | ||
400 | if (ret) | ||
401 | return ret; | ||
402 | |||
403 | ret = snd_soc_dapm_add_routes(dapm, neo1973_lm4857_routes, | ||
404 | ARRAY_SIZE(neo1973_lm4857_routes)); | ||
405 | if (ret) | ||
406 | return ret; | ||
407 | |||
408 | snd_soc_dapm_ignore_suspend(dapm, "Stereo Out"); | ||
409 | snd_soc_dapm_ignore_suspend(dapm, "Handset Spk"); | ||
410 | snd_soc_dapm_ignore_suspend(dapm, "Headphone"); | ||
411 | |||
412 | snd_soc_dapm_sync(dapm); | ||
413 | |||
414 | return 0; | ||
415 | } | ||
416 | |||
417 | #else | ||
418 | static int neo1973_lm4857_init(struct snd_soc_dapm_context *dapm) { return 0; }; | ||
419 | #endif | ||
420 | |||
557 | static struct snd_soc_dai_link neo1973_dai[] = { | 421 | static struct snd_soc_dai_link neo1973_dai[] = { |
558 | { /* Hifi Playback - for similatious use with voice below */ | 422 | { /* Hifi Playback - for similatious use with voice below */ |
559 | .name = "WM8753", | 423 | .name = "WM8753", |
@@ -569,90 +433,49 @@ static struct snd_soc_dai_link neo1973_dai[] = { | |||
569 | .name = "Bluetooth", | 433 | .name = "Bluetooth", |
570 | .stream_name = "Voice", | 434 | .stream_name = "Voice", |
571 | .platform_name = "samsung-audio", | 435 | .platform_name = "samsung-audio", |
572 | .cpu_dai_name = "bluetooth-dai", | 436 | .cpu_dai_name = "dfbmcs320-pcm", |
573 | .codec_dai_name = "wm8753-voice", | 437 | .codec_dai_name = "wm8753-voice", |
574 | .codec_name = "wm8753-codec.0-001a", | 438 | .codec_name = "wm8753-codec.0-001a", |
575 | .ops = &neo1973_voice_ops, | 439 | .ops = &neo1973_voice_ops, |
576 | }, | 440 | }, |
577 | }; | 441 | }; |
578 | 442 | ||
579 | static struct snd_soc_card neo1973 = { | 443 | static struct snd_soc_aux_dev neo1973_aux_devs[] = { |
580 | .name = "neo1973", | 444 | { |
581 | .dai_link = neo1973_dai, | 445 | .name = "dfbmcs320", |
582 | .num_links = ARRAY_SIZE(neo1973_dai), | 446 | .codec_name = "dfbmcs320.0", |
447 | }, | ||
448 | { | ||
449 | .name = "lm4857", | ||
450 | .codec_name = "lm4857.0-007c", | ||
451 | .init = neo1973_lm4857_init, | ||
452 | }, | ||
583 | }; | 453 | }; |
584 | 454 | ||
585 | static int lm4857_i2c_probe(struct i2c_client *client, | 455 | static struct snd_soc_codec_conf neo1973_codec_conf[] = { |
586 | const struct i2c_device_id *id) | 456 | { |
587 | { | 457 | .dev_name = "lm4857.0-007c", |
588 | pr_debug("Entered %s\n", __func__); | 458 | .name_prefix = "Amp", |
589 | 459 | }, | |
590 | i2c = client; | 460 | }; |
591 | |||
592 | lm4857_write_regs(); | ||
593 | return 0; | ||
594 | } | ||
595 | |||
596 | static int lm4857_i2c_remove(struct i2c_client *client) | ||
597 | { | ||
598 | pr_debug("Entered %s\n", __func__); | ||
599 | |||
600 | i2c = NULL; | ||
601 | |||
602 | return 0; | ||
603 | } | ||
604 | |||
605 | static u8 lm4857_state; | ||
606 | |||
607 | static int lm4857_suspend(struct i2c_client *dev, pm_message_t state) | ||
608 | { | ||
609 | pr_debug("Entered %s\n", __func__); | ||
610 | |||
611 | dev_dbg(&dev->dev, "lm4857_suspend\n"); | ||
612 | lm4857_state = lm4857_regs[LM4857_CTRL] & 0xf; | ||
613 | if (lm4857_state) { | ||
614 | lm4857_regs[LM4857_CTRL] &= 0xf0; | ||
615 | lm4857_write_regs(); | ||
616 | } | ||
617 | return 0; | ||
618 | } | ||
619 | |||
620 | static int lm4857_resume(struct i2c_client *dev) | ||
621 | { | ||
622 | pr_debug("Entered %s\n", __func__); | ||
623 | |||
624 | if (lm4857_state) { | ||
625 | lm4857_regs[LM4857_CTRL] |= (lm4857_state & 0x0f); | ||
626 | lm4857_write_regs(); | ||
627 | } | ||
628 | return 0; | ||
629 | } | ||
630 | |||
631 | static void lm4857_shutdown(struct i2c_client *dev) | ||
632 | { | ||
633 | pr_debug("Entered %s\n", __func__); | ||
634 | |||
635 | dev_dbg(&dev->dev, "lm4857_shutdown\n"); | ||
636 | lm4857_regs[LM4857_CTRL] &= 0xf0; | ||
637 | lm4857_write_regs(); | ||
638 | } | ||
639 | 461 | ||
640 | static const struct i2c_device_id lm4857_i2c_id[] = { | 462 | #ifdef CONFIG_MACH_NEO1973_GTA02 |
641 | { "neo1973_lm4857", 0 }, | 463 | static const struct gpio neo1973_gta02_gpios[] = { |
642 | { } | 464 | { GTA02_GPIO_HP_IN, GPIOF_OUT_INIT_HIGH, "GTA02_HP_IN" }, |
465 | { GTA02_GPIO_AMP_SHUT, GPIOF_OUT_INIT_HIGH, "GTA02_AMP_SHUT" }, | ||
643 | }; | 466 | }; |
467 | #else | ||
468 | static const struct gpio neo1973_gta02_gpios[] = {}; | ||
469 | #endif | ||
644 | 470 | ||
645 | static struct i2c_driver lm4857_i2c_driver = { | 471 | static struct snd_soc_card neo1973 = { |
646 | .driver = { | 472 | .name = "neo1973", |
647 | .name = "LM4857 I2C Amp", | 473 | .dai_link = neo1973_dai, |
648 | .owner = THIS_MODULE, | 474 | .num_links = ARRAY_SIZE(neo1973_dai), |
649 | }, | 475 | .aux_dev = neo1973_aux_devs, |
650 | .suspend = lm4857_suspend, | 476 | .num_aux_devs = ARRAY_SIZE(neo1973_aux_devs), |
651 | .resume = lm4857_resume, | 477 | .codec_conf = neo1973_codec_conf, |
652 | .shutdown = lm4857_shutdown, | 478 | .num_configs = ARRAY_SIZE(neo1973_codec_conf), |
653 | .probe = lm4857_i2c_probe, | ||
654 | .remove = lm4857_i2c_remove, | ||
655 | .id_table = lm4857_i2c_id, | ||
656 | }; | 479 | }; |
657 | 480 | ||
658 | static struct platform_device *neo1973_snd_device; | 481 | static struct platform_device *neo1973_snd_device; |
@@ -661,46 +484,56 @@ static int __init neo1973_init(void) | |||
661 | { | 484 | { |
662 | int ret; | 485 | int ret; |
663 | 486 | ||
664 | pr_debug("Entered %s\n", __func__); | 487 | if (!machine_is_neo1973_gta01() && !machine_is_neo1973_gta02()) |
665 | |||
666 | if (!machine_is_neo1973_gta01()) { | ||
667 | printk(KERN_INFO | ||
668 | "Only GTA01 hardware supported by ASoC driver\n"); | ||
669 | return -ENODEV; | 488 | return -ENODEV; |
489 | |||
490 | if (machine_is_neo1973_gta02()) { | ||
491 | neo1973.name = "neo1973gta02"; | ||
492 | neo1973.num_aux_devs = 1; | ||
493 | |||
494 | ret = gpio_request_array(neo1973_gta02_gpios, | ||
495 | ARRAY_SIZE(neo1973_gta02_gpios)); | ||
496 | if (ret) | ||
497 | return ret; | ||
670 | } | 498 | } |
671 | 499 | ||
672 | neo1973_snd_device = platform_device_alloc("soc-audio", -1); | 500 | neo1973_snd_device = platform_device_alloc("soc-audio", -1); |
673 | if (!neo1973_snd_device) | 501 | if (!neo1973_snd_device) { |
674 | return -ENOMEM; | 502 | ret = -ENOMEM; |
503 | goto err_gpio_free; | ||
504 | } | ||
675 | 505 | ||
676 | platform_set_drvdata(neo1973_snd_device, &neo1973); | 506 | platform_set_drvdata(neo1973_snd_device, &neo1973); |
677 | ret = platform_device_add(neo1973_snd_device); | 507 | ret = platform_device_add(neo1973_snd_device); |
678 | 508 | ||
679 | if (ret) { | 509 | if (ret) |
680 | platform_device_put(neo1973_snd_device); | 510 | goto err_put_device; |
681 | return ret; | ||
682 | } | ||
683 | |||
684 | ret = i2c_add_driver(&lm4857_i2c_driver); | ||
685 | 511 | ||
686 | if (ret != 0) | 512 | return 0; |
687 | platform_device_unregister(neo1973_snd_device); | ||
688 | 513 | ||
514 | err_put_device: | ||
515 | platform_device_put(neo1973_snd_device); | ||
516 | err_gpio_free: | ||
517 | if (machine_is_neo1973_gta02()) { | ||
518 | gpio_free_array(neo1973_gta02_gpios, | ||
519 | ARRAY_SIZE(neo1973_gta02_gpios)); | ||
520 | } | ||
689 | return ret; | 521 | return ret; |
690 | } | 522 | } |
523 | module_init(neo1973_init); | ||
691 | 524 | ||
692 | static void __exit neo1973_exit(void) | 525 | static void __exit neo1973_exit(void) |
693 | { | 526 | { |
694 | pr_debug("Entered %s\n", __func__); | ||
695 | |||
696 | i2c_del_driver(&lm4857_i2c_driver); | ||
697 | platform_device_unregister(neo1973_snd_device); | 527 | platform_device_unregister(neo1973_snd_device); |
698 | } | ||
699 | 528 | ||
700 | module_init(neo1973_init); | 529 | if (machine_is_neo1973_gta02()) { |
530 | gpio_free_array(neo1973_gta02_gpios, | ||
531 | ARRAY_SIZE(neo1973_gta02_gpios)); | ||
532 | } | ||
533 | } | ||
701 | module_exit(neo1973_exit); | 534 | module_exit(neo1973_exit); |
702 | 535 | ||
703 | /* Module information */ | 536 | /* Module information */ |
704 | MODULE_AUTHOR("Graeme Gregory, graeme@openmoko.org, www.openmoko.org"); | 537 | MODULE_AUTHOR("Graeme Gregory, graeme@openmoko.org, www.openmoko.org"); |
705 | MODULE_DESCRIPTION("ALSA SoC WM8753 Neo1973"); | 538 | MODULE_DESCRIPTION("ALSA SoC WM8753 Neo1973 and Frerunner"); |
706 | MODULE_LICENSE("GPL"); | 539 | MODULE_LICENSE("GPL"); |
diff --git a/sound/soc/samsung/pcm.c b/sound/soc/samsung/pcm.c index 48d0b750406b..38aac7d57a59 100644 --- a/sound/soc/samsung/pcm.c +++ b/sound/soc/samsung/pcm.c | |||
@@ -11,20 +11,11 @@ | |||
11 | * published by the Free Software Foundation. | 11 | * published by the Free Software Foundation. |
12 | */ | 12 | */ |
13 | 13 | ||
14 | #include <linux/init.h> | ||
15 | #include <linux/module.h> | ||
16 | #include <linux/device.h> | ||
17 | #include <linux/delay.h> | ||
18 | #include <linux/clk.h> | 14 | #include <linux/clk.h> |
19 | #include <linux/kernel.h> | ||
20 | #include <linux/gpio.h> | ||
21 | #include <linux/io.h> | 15 | #include <linux/io.h> |
22 | 16 | ||
23 | #include <sound/core.h> | ||
24 | #include <sound/pcm.h> | ||
25 | #include <sound/pcm_params.h> | ||
26 | #include <sound/initval.h> | ||
27 | #include <sound/soc.h> | 17 | #include <sound/soc.h> |
18 | #include <sound/pcm_params.h> | ||
28 | 19 | ||
29 | #include <plat/audio.h> | 20 | #include <plat/audio.h> |
30 | #include <plat/dma.h> | 21 | #include <plat/dma.h> |
@@ -32,6 +23,113 @@ | |||
32 | #include "dma.h" | 23 | #include "dma.h" |
33 | #include "pcm.h" | 24 | #include "pcm.h" |
34 | 25 | ||
26 | /*Register Offsets */ | ||
27 | #define S3C_PCM_CTL 0x00 | ||
28 | #define S3C_PCM_CLKCTL 0x04 | ||
29 | #define S3C_PCM_TXFIFO 0x08 | ||
30 | #define S3C_PCM_RXFIFO 0x0C | ||
31 | #define S3C_PCM_IRQCTL 0x10 | ||
32 | #define S3C_PCM_IRQSTAT 0x14 | ||
33 | #define S3C_PCM_FIFOSTAT 0x18 | ||
34 | #define S3C_PCM_CLRINT 0x20 | ||
35 | |||
36 | /* PCM_CTL Bit-Fields */ | ||
37 | #define S3C_PCM_CTL_TXDIPSTICK_MASK 0x3f | ||
38 | #define S3C_PCM_CTL_TXDIPSTICK_SHIFT 13 | ||
39 | #define S3C_PCM_CTL_RXDIPSTICK_MASK 0x3f | ||
40 | #define S3C_PCM_CTL_RXDIPSTICK_SHIFT 7 | ||
41 | #define S3C_PCM_CTL_TXDMA_EN (0x1 << 6) | ||
42 | #define S3C_PCM_CTL_RXDMA_EN (0x1 << 5) | ||
43 | #define S3C_PCM_CTL_TXMSB_AFTER_FSYNC (0x1 << 4) | ||
44 | #define S3C_PCM_CTL_RXMSB_AFTER_FSYNC (0x1 << 3) | ||
45 | #define S3C_PCM_CTL_TXFIFO_EN (0x1 << 2) | ||
46 | #define S3C_PCM_CTL_RXFIFO_EN (0x1 << 1) | ||
47 | #define S3C_PCM_CTL_ENABLE (0x1 << 0) | ||
48 | |||
49 | /* PCM_CLKCTL Bit-Fields */ | ||
50 | #define S3C_PCM_CLKCTL_SERCLK_EN (0x1 << 19) | ||
51 | #define S3C_PCM_CLKCTL_SERCLKSEL_PCLK (0x1 << 18) | ||
52 | #define S3C_PCM_CLKCTL_SCLKDIV_MASK 0x1ff | ||
53 | #define S3C_PCM_CLKCTL_SYNCDIV_MASK 0x1ff | ||
54 | #define S3C_PCM_CLKCTL_SCLKDIV_SHIFT 9 | ||
55 | #define S3C_PCM_CLKCTL_SYNCDIV_SHIFT 0 | ||
56 | |||
57 | /* PCM_TXFIFO Bit-Fields */ | ||
58 | #define S3C_PCM_TXFIFO_DVALID (0x1 << 16) | ||
59 | #define S3C_PCM_TXFIFO_DATA_MSK (0xffff << 0) | ||
60 | |||
61 | /* PCM_RXFIFO Bit-Fields */ | ||
62 | #define S3C_PCM_RXFIFO_DVALID (0x1 << 16) | ||
63 | #define S3C_PCM_RXFIFO_DATA_MSK (0xffff << 0) | ||
64 | |||
65 | /* PCM_IRQCTL Bit-Fields */ | ||
66 | #define S3C_PCM_IRQCTL_IRQEN (0x1 << 14) | ||
67 | #define S3C_PCM_IRQCTL_WRDEN (0x1 << 12) | ||
68 | #define S3C_PCM_IRQCTL_TXEMPTYEN (0x1 << 11) | ||
69 | #define S3C_PCM_IRQCTL_TXALMSTEMPTYEN (0x1 << 10) | ||
70 | #define S3C_PCM_IRQCTL_TXFULLEN (0x1 << 9) | ||
71 | #define S3C_PCM_IRQCTL_TXALMSTFULLEN (0x1 << 8) | ||
72 | #define S3C_PCM_IRQCTL_TXSTARVEN (0x1 << 7) | ||
73 | #define S3C_PCM_IRQCTL_TXERROVRFLEN (0x1 << 6) | ||
74 | #define S3C_PCM_IRQCTL_RXEMPTEN (0x1 << 5) | ||
75 | #define S3C_PCM_IRQCTL_RXALMSTEMPTEN (0x1 << 4) | ||
76 | #define S3C_PCM_IRQCTL_RXFULLEN (0x1 << 3) | ||
77 | #define S3C_PCM_IRQCTL_RXALMSTFULLEN (0x1 << 2) | ||
78 | #define S3C_PCM_IRQCTL_RXSTARVEN (0x1 << 1) | ||
79 | #define S3C_PCM_IRQCTL_RXERROVRFLEN (0x1 << 0) | ||
80 | |||
81 | /* PCM_IRQSTAT Bit-Fields */ | ||
82 | #define S3C_PCM_IRQSTAT_IRQPND (0x1 << 13) | ||
83 | #define S3C_PCM_IRQSTAT_WRD_XFER (0x1 << 12) | ||
84 | #define S3C_PCM_IRQSTAT_TXEMPTY (0x1 << 11) | ||
85 | #define S3C_PCM_IRQSTAT_TXALMSTEMPTY (0x1 << 10) | ||
86 | #define S3C_PCM_IRQSTAT_TXFULL (0x1 << 9) | ||
87 | #define S3C_PCM_IRQSTAT_TXALMSTFULL (0x1 << 8) | ||
88 | #define S3C_PCM_IRQSTAT_TXSTARV (0x1 << 7) | ||
89 | #define S3C_PCM_IRQSTAT_TXERROVRFL (0x1 << 6) | ||
90 | #define S3C_PCM_IRQSTAT_RXEMPT (0x1 << 5) | ||
91 | #define S3C_PCM_IRQSTAT_RXALMSTEMPT (0x1 << 4) | ||
92 | #define S3C_PCM_IRQSTAT_RXFULL (0x1 << 3) | ||
93 | #define S3C_PCM_IRQSTAT_RXALMSTFULL (0x1 << 2) | ||
94 | #define S3C_PCM_IRQSTAT_RXSTARV (0x1 << 1) | ||
95 | #define S3C_PCM_IRQSTAT_RXERROVRFL (0x1 << 0) | ||
96 | |||
97 | /* PCM_FIFOSTAT Bit-Fields */ | ||
98 | #define S3C_PCM_FIFOSTAT_TXCNT_MSK (0x3f << 14) | ||
99 | #define S3C_PCM_FIFOSTAT_TXFIFOEMPTY (0x1 << 13) | ||
100 | #define S3C_PCM_FIFOSTAT_TXFIFOALMSTEMPTY (0x1 << 12) | ||
101 | #define S3C_PCM_FIFOSTAT_TXFIFOFULL (0x1 << 11) | ||
102 | #define S3C_PCM_FIFOSTAT_TXFIFOALMSTFULL (0x1 << 10) | ||
103 | #define S3C_PCM_FIFOSTAT_RXCNT_MSK (0x3f << 4) | ||
104 | #define S3C_PCM_FIFOSTAT_RXFIFOEMPTY (0x1 << 3) | ||
105 | #define S3C_PCM_FIFOSTAT_RXFIFOALMSTEMPTY (0x1 << 2) | ||
106 | #define S3C_PCM_FIFOSTAT_RXFIFOFULL (0x1 << 1) | ||
107 | #define S3C_PCM_FIFOSTAT_RXFIFOALMSTFULL (0x1 << 0) | ||
108 | |||
109 | /** | ||
110 | * struct s3c_pcm_info - S3C PCM Controller information | ||
111 | * @dev: The parent device passed to use from the probe. | ||
112 | * @regs: The pointer to the device register block. | ||
113 | * @dma_playback: DMA information for playback channel. | ||
114 | * @dma_capture: DMA information for capture channel. | ||
115 | */ | ||
116 | struct s3c_pcm_info { | ||
117 | spinlock_t lock; | ||
118 | struct device *dev; | ||
119 | void __iomem *regs; | ||
120 | |||
121 | unsigned int sclk_per_fs; | ||
122 | |||
123 | /* Whether to keep PCMSCLK enabled even when idle(no active xfer) */ | ||
124 | unsigned int idleclk; | ||
125 | |||
126 | struct clk *pclk; | ||
127 | struct clk *cclk; | ||
128 | |||
129 | struct s3c_dma_params *dma_playback; | ||
130 | struct s3c_dma_params *dma_capture; | ||
131 | }; | ||
132 | |||
35 | static struct s3c2410_dma_client s3c_pcm_dma_client_out = { | 133 | static struct s3c2410_dma_client s3c_pcm_dma_client_out = { |
36 | .name = "PCM Stereo out" | 134 | .name = "PCM Stereo out" |
37 | }; | 135 | }; |
diff --git a/sound/soc/samsung/pcm.h b/sound/soc/samsung/pcm.h index 03393dcf852d..726baf814613 100644 --- a/sound/soc/samsung/pcm.h +++ b/sound/soc/samsung/pcm.h | |||
@@ -9,116 +9,9 @@ | |||
9 | #ifndef __S3C_PCM_H | 9 | #ifndef __S3C_PCM_H |
10 | #define __S3C_PCM_H __FILE__ | 10 | #define __S3C_PCM_H __FILE__ |
11 | 11 | ||
12 | /*Register Offsets */ | ||
13 | #define S3C_PCM_CTL (0x00) | ||
14 | #define S3C_PCM_CLKCTL (0x04) | ||
15 | #define S3C_PCM_TXFIFO (0x08) | ||
16 | #define S3C_PCM_RXFIFO (0x0C) | ||
17 | #define S3C_PCM_IRQCTL (0x10) | ||
18 | #define S3C_PCM_IRQSTAT (0x14) | ||
19 | #define S3C_PCM_FIFOSTAT (0x18) | ||
20 | #define S3C_PCM_CLRINT (0x20) | ||
21 | |||
22 | /* PCM_CTL Bit-Fields */ | ||
23 | #define S3C_PCM_CTL_TXDIPSTICK_MASK (0x3f) | ||
24 | #define S3C_PCM_CTL_TXDIPSTICK_SHIFT (13) | ||
25 | #define S3C_PCM_CTL_RXDIPSTICK_MASK (0x3f) | ||
26 | #define S3C_PCM_CTL_RXDIPSTICK_SHIFT (7) | ||
27 | #define S3C_PCM_CTL_TXDMA_EN (0x1<<6) | ||
28 | #define S3C_PCM_CTL_RXDMA_EN (0x1<<5) | ||
29 | #define S3C_PCM_CTL_TXMSB_AFTER_FSYNC (0x1<<4) | ||
30 | #define S3C_PCM_CTL_RXMSB_AFTER_FSYNC (0x1<<3) | ||
31 | #define S3C_PCM_CTL_TXFIFO_EN (0x1<<2) | ||
32 | #define S3C_PCM_CTL_RXFIFO_EN (0x1<<1) | ||
33 | #define S3C_PCM_CTL_ENABLE (0x1<<0) | ||
34 | |||
35 | /* PCM_CLKCTL Bit-Fields */ | ||
36 | #define S3C_PCM_CLKCTL_SERCLK_EN (0x1<<19) | ||
37 | #define S3C_PCM_CLKCTL_SERCLKSEL_PCLK (0x1<<18) | ||
38 | #define S3C_PCM_CLKCTL_SCLKDIV_MASK (0x1ff) | ||
39 | #define S3C_PCM_CLKCTL_SYNCDIV_MASK (0x1ff) | ||
40 | #define S3C_PCM_CLKCTL_SCLKDIV_SHIFT (9) | ||
41 | #define S3C_PCM_CLKCTL_SYNCDIV_SHIFT (0) | ||
42 | |||
43 | /* PCM_TXFIFO Bit-Fields */ | ||
44 | #define S3C_PCM_TXFIFO_DVALID (0x1<<16) | ||
45 | #define S3C_PCM_TXFIFO_DATA_MSK (0xffff<<0) | ||
46 | |||
47 | /* PCM_RXFIFO Bit-Fields */ | ||
48 | #define S3C_PCM_RXFIFO_DVALID (0x1<<16) | ||
49 | #define S3C_PCM_RXFIFO_DATA_MSK (0xffff<<0) | ||
50 | |||
51 | /* PCM_IRQCTL Bit-Fields */ | ||
52 | #define S3C_PCM_IRQCTL_IRQEN (0x1<<14) | ||
53 | #define S3C_PCM_IRQCTL_WRDEN (0x1<<12) | ||
54 | #define S3C_PCM_IRQCTL_TXEMPTYEN (0x1<<11) | ||
55 | #define S3C_PCM_IRQCTL_TXALMSTEMPTYEN (0x1<<10) | ||
56 | #define S3C_PCM_IRQCTL_TXFULLEN (0x1<<9) | ||
57 | #define S3C_PCM_IRQCTL_TXALMSTFULLEN (0x1<<8) | ||
58 | #define S3C_PCM_IRQCTL_TXSTARVEN (0x1<<7) | ||
59 | #define S3C_PCM_IRQCTL_TXERROVRFLEN (0x1<<6) | ||
60 | #define S3C_PCM_IRQCTL_RXEMPTEN (0x1<<5) | ||
61 | #define S3C_PCM_IRQCTL_RXALMSTEMPTEN (0x1<<4) | ||
62 | #define S3C_PCM_IRQCTL_RXFULLEN (0x1<<3) | ||
63 | #define S3C_PCM_IRQCTL_RXALMSTFULLEN (0x1<<2) | ||
64 | #define S3C_PCM_IRQCTL_RXSTARVEN (0x1<<1) | ||
65 | #define S3C_PCM_IRQCTL_RXERROVRFLEN (0x1<<0) | ||
66 | |||
67 | /* PCM_IRQSTAT Bit-Fields */ | ||
68 | #define S3C_PCM_IRQSTAT_IRQPND (0x1<<13) | ||
69 | #define S3C_PCM_IRQSTAT_WRD_XFER (0x1<<12) | ||
70 | #define S3C_PCM_IRQSTAT_TXEMPTY (0x1<<11) | ||
71 | #define S3C_PCM_IRQSTAT_TXALMSTEMPTY (0x1<<10) | ||
72 | #define S3C_PCM_IRQSTAT_TXFULL (0x1<<9) | ||
73 | #define S3C_PCM_IRQSTAT_TXALMSTFULL (0x1<<8) | ||
74 | #define S3C_PCM_IRQSTAT_TXSTARV (0x1<<7) | ||
75 | #define S3C_PCM_IRQSTAT_TXERROVRFL (0x1<<6) | ||
76 | #define S3C_PCM_IRQSTAT_RXEMPT (0x1<<5) | ||
77 | #define S3C_PCM_IRQSTAT_RXALMSTEMPT (0x1<<4) | ||
78 | #define S3C_PCM_IRQSTAT_RXFULL (0x1<<3) | ||
79 | #define S3C_PCM_IRQSTAT_RXALMSTFULL (0x1<<2) | ||
80 | #define S3C_PCM_IRQSTAT_RXSTARV (0x1<<1) | ||
81 | #define S3C_PCM_IRQSTAT_RXERROVRFL (0x1<<0) | ||
82 | |||
83 | /* PCM_FIFOSTAT Bit-Fields */ | ||
84 | #define S3C_PCM_FIFOSTAT_TXCNT_MSK (0x3f<<14) | ||
85 | #define S3C_PCM_FIFOSTAT_TXFIFOEMPTY (0x1<<13) | ||
86 | #define S3C_PCM_FIFOSTAT_TXFIFOALMSTEMPTY (0x1<<12) | ||
87 | #define S3C_PCM_FIFOSTAT_TXFIFOFULL (0x1<<11) | ||
88 | #define S3C_PCM_FIFOSTAT_TXFIFOALMSTFULL (0x1<<10) | ||
89 | #define S3C_PCM_FIFOSTAT_RXCNT_MSK (0x3f<<4) | ||
90 | #define S3C_PCM_FIFOSTAT_RXFIFOEMPTY (0x1<<3) | ||
91 | #define S3C_PCM_FIFOSTAT_RXFIFOALMSTEMPTY (0x1<<2) | ||
92 | #define S3C_PCM_FIFOSTAT_RXFIFOFULL (0x1<<1) | ||
93 | #define S3C_PCM_FIFOSTAT_RXFIFOALMSTFULL (0x1<<0) | ||
94 | |||
95 | #define S3C_PCM_CLKSRC_PCLK 0 | 12 | #define S3C_PCM_CLKSRC_PCLK 0 |
96 | #define S3C_PCM_CLKSRC_MUX 1 | 13 | #define S3C_PCM_CLKSRC_MUX 1 |
97 | 14 | ||
98 | #define S3C_PCM_SCLK_PER_FS 0 | 15 | #define S3C_PCM_SCLK_PER_FS 0 |
99 | 16 | ||
100 | /** | ||
101 | * struct s3c_pcm_info - S3C PCM Controller information | ||
102 | * @dev: The parent device passed to use from the probe. | ||
103 | * @regs: The pointer to the device register block. | ||
104 | * @dma_playback: DMA information for playback channel. | ||
105 | * @dma_capture: DMA information for capture channel. | ||
106 | */ | ||
107 | struct s3c_pcm_info { | ||
108 | spinlock_t lock; | ||
109 | struct device *dev; | ||
110 | void __iomem *regs; | ||
111 | |||
112 | unsigned int sclk_per_fs; | ||
113 | |||
114 | /* Whether to keep PCMSCLK enabled even when idle(no active xfer) */ | ||
115 | unsigned int idleclk; | ||
116 | |||
117 | struct clk *pclk; | ||
118 | struct clk *cclk; | ||
119 | |||
120 | struct s3c_dma_params *dma_playback; | ||
121 | struct s3c_dma_params *dma_capture; | ||
122 | }; | ||
123 | |||
124 | #endif /* __S3C_PCM_H */ | 17 | #endif /* __S3C_PCM_H */ |
diff --git a/sound/soc/samsung/rx1950_uda1380.c b/sound/soc/samsung/rx1950_uda1380.c index f40027445dda..1e574a5d440d 100644 --- a/sound/soc/samsung/rx1950_uda1380.c +++ b/sound/soc/samsung/rx1950_uda1380.c | |||
@@ -17,26 +17,15 @@ | |||
17 | * | 17 | * |
18 | */ | 18 | */ |
19 | 19 | ||
20 | #include <linux/module.h> | ||
21 | #include <linux/moduleparam.h> | ||
22 | #include <linux/platform_device.h> | ||
23 | #include <linux/i2c.h> | ||
24 | #include <linux/gpio.h> | 20 | #include <linux/gpio.h> |
25 | #include <linux/clk.h> | ||
26 | 21 | ||
27 | #include <sound/soc.h> | 22 | #include <sound/soc.h> |
28 | #include <sound/uda1380.h> | ||
29 | #include <sound/jack.h> | 23 | #include <sound/jack.h> |
30 | 24 | ||
31 | #include <plat/regs-iis.h> | 25 | #include <plat/regs-iis.h> |
32 | |||
33 | #include <mach/regs-clock.h> | ||
34 | |||
35 | #include <asm/mach-types.h> | 26 | #include <asm/mach-types.h> |
36 | 27 | ||
37 | #include "dma.h" | ||
38 | #include "s3c24xx-i2s.h" | 28 | #include "s3c24xx-i2s.h" |
39 | #include "../codecs/uda1380.h" | ||
40 | 29 | ||
41 | static int rx1950_uda1380_init(struct snd_soc_pcm_runtime *rtd); | 30 | static int rx1950_uda1380_init(struct snd_soc_pcm_runtime *rtd); |
42 | static int rx1950_startup(struct snd_pcm_substream *substream); | 31 | static int rx1950_startup(struct snd_pcm_substream *substream); |
diff --git a/sound/soc/samsung/s3c-i2s-v2.c b/sound/soc/samsung/s3c-i2s-v2.c index 094f36e41e83..52074a2b0696 100644 --- a/sound/soc/samsung/s3c-i2s-v2.c +++ b/sound/soc/samsung/s3c-i2s-v2.c | |||
@@ -20,9 +20,8 @@ | |||
20 | #include <linux/clk.h> | 20 | #include <linux/clk.h> |
21 | #include <linux/io.h> | 21 | #include <linux/io.h> |
22 | 22 | ||
23 | #include <sound/pcm.h> | ||
24 | #include <sound/pcm_params.h> | ||
25 | #include <sound/soc.h> | 23 | #include <sound/soc.h> |
24 | #include <sound/pcm_params.h> | ||
26 | 25 | ||
27 | #include <mach/dma.h> | 26 | #include <mach/dma.h> |
28 | 27 | ||
diff --git a/sound/soc/samsung/s3c2412-i2s.c b/sound/soc/samsung/s3c2412-i2s.c index 7ea837867124..841ab14c1100 100644 --- a/sound/soc/samsung/s3c2412-i2s.c +++ b/sound/soc/samsung/s3c2412-i2s.c | |||
@@ -16,21 +16,13 @@ | |||
16 | * option) any later version. | 16 | * option) any later version. |
17 | */ | 17 | */ |
18 | 18 | ||
19 | #include <linux/init.h> | ||
20 | #include <linux/module.h> | ||
21 | #include <linux/device.h> | ||
22 | #include <linux/delay.h> | 19 | #include <linux/delay.h> |
23 | #include <linux/gpio.h> | 20 | #include <linux/gpio.h> |
24 | #include <linux/clk.h> | 21 | #include <linux/clk.h> |
25 | #include <linux/kernel.h> | ||
26 | #include <linux/io.h> | 22 | #include <linux/io.h> |
27 | 23 | ||
28 | #include <sound/core.h> | ||
29 | #include <sound/pcm.h> | ||
30 | #include <sound/pcm_params.h> | ||
31 | #include <sound/initval.h> | ||
32 | #include <sound/soc.h> | 24 | #include <sound/soc.h> |
33 | #include <mach/hardware.h> | 25 | #include <sound/pcm_params.h> |
34 | 26 | ||
35 | #include <mach/regs-gpio.h> | 27 | #include <mach/regs-gpio.h> |
36 | #include <mach/dma.h> | 28 | #include <mach/dma.h> |
@@ -39,8 +31,6 @@ | |||
39 | #include "regs-i2s-v2.h" | 31 | #include "regs-i2s-v2.h" |
40 | #include "s3c2412-i2s.h" | 32 | #include "s3c2412-i2s.h" |
41 | 33 | ||
42 | #define S3C2412_I2S_DEBUG 0 | ||
43 | |||
44 | static struct s3c2410_dma_client s3c2412_dma_client_out = { | 34 | static struct s3c2410_dma_client s3c2412_dma_client_out = { |
45 | .name = "I2S PCM Stereo out" | 35 | .name = "I2S PCM Stereo out" |
46 | }; | 36 | }; |
diff --git a/sound/soc/samsung/s3c24xx-i2s.c b/sound/soc/samsung/s3c24xx-i2s.c index 13e41ed8e22b..63d8849d80bd 100644 --- a/sound/soc/samsung/s3c24xx-i2s.c +++ b/sound/soc/samsung/s3c24xx-i2s.c | |||
@@ -14,28 +14,16 @@ | |||
14 | * option) any later version. | 14 | * option) any later version. |
15 | */ | 15 | */ |
16 | 16 | ||
17 | #include <linux/init.h> | ||
18 | #include <linux/module.h> | ||
19 | #include <linux/device.h> | ||
20 | #include <linux/delay.h> | 17 | #include <linux/delay.h> |
21 | #include <linux/clk.h> | 18 | #include <linux/clk.h> |
22 | #include <linux/jiffies.h> | ||
23 | #include <linux/io.h> | 19 | #include <linux/io.h> |
24 | #include <linux/gpio.h> | 20 | #include <linux/gpio.h> |
25 | 21 | ||
26 | #include <sound/core.h> | ||
27 | #include <sound/pcm.h> | ||
28 | #include <sound/pcm_params.h> | ||
29 | #include <sound/initval.h> | ||
30 | #include <sound/soc.h> | 22 | #include <sound/soc.h> |
23 | #include <sound/pcm_params.h> | ||
31 | 24 | ||
32 | #include <mach/hardware.h> | ||
33 | #include <mach/regs-gpio.h> | 25 | #include <mach/regs-gpio.h> |
34 | #include <mach/regs-clock.h> | ||
35 | |||
36 | #include <asm/dma.h> | ||
37 | #include <mach/dma.h> | 26 | #include <mach/dma.h> |
38 | |||
39 | #include <plat/regs-iis.h> | 27 | #include <plat/regs-iis.h> |
40 | 28 | ||
41 | #include "dma.h" | 29 | #include "dma.h" |
diff --git a/sound/soc/samsung/s3c24xx_simtec.c b/sound/soc/samsung/s3c24xx_simtec.c index a434032d1832..349566f0686b 100644 --- a/sound/soc/samsung/s3c24xx_simtec.c +++ b/sound/soc/samsung/s3c24xx_simtec.c | |||
@@ -7,20 +7,13 @@ | |||
7 | * published by the Free Software Foundation. | 7 | * published by the Free Software Foundation. |
8 | */ | 8 | */ |
9 | 9 | ||
10 | #include <linux/module.h> | ||
11 | #include <linux/moduleparam.h> | ||
12 | #include <linux/platform_device.h> | ||
13 | #include <linux/gpio.h> | 10 | #include <linux/gpio.h> |
14 | #include <linux/clk.h> | 11 | #include <linux/clk.h> |
15 | #include <linux/i2c.h> | ||
16 | 12 | ||
17 | #include <sound/core.h> | ||
18 | #include <sound/pcm.h> | ||
19 | #include <sound/soc.h> | 13 | #include <sound/soc.h> |
20 | 14 | ||
21 | #include <plat/audio-simtec.h> | 15 | #include <plat/audio-simtec.h> |
22 | 16 | ||
23 | #include "dma.h" | ||
24 | #include "s3c24xx-i2s.h" | 17 | #include "s3c24xx-i2s.h" |
25 | #include "s3c24xx_simtec.h" | 18 | #include "s3c24xx_simtec.h" |
26 | 19 | ||
diff --git a/sound/soc/samsung/s3c24xx_simtec_hermes.c b/sound/soc/samsung/s3c24xx_simtec_hermes.c index 08fcaaa66907..ce6aef604179 100644 --- a/sound/soc/samsung/s3c24xx_simtec_hermes.c +++ b/sound/soc/samsung/s3c24xx_simtec_hermes.c | |||
@@ -7,18 +7,8 @@ | |||
7 | * published by the Free Software Foundation. | 7 | * published by the Free Software Foundation. |
8 | */ | 8 | */ |
9 | 9 | ||
10 | #include <linux/module.h> | ||
11 | #include <linux/clk.h> | ||
12 | #include <linux/platform_device.h> | ||
13 | |||
14 | #include <sound/core.h> | ||
15 | #include <sound/pcm.h> | ||
16 | #include <sound/soc.h> | 10 | #include <sound/soc.h> |
17 | 11 | ||
18 | #include <plat/audio-simtec.h> | ||
19 | |||
20 | #include "dma.h" | ||
21 | #include "s3c24xx-i2s.h" | ||
22 | #include "s3c24xx_simtec.h" | 12 | #include "s3c24xx_simtec.h" |
23 | 13 | ||
24 | static const struct snd_soc_dapm_widget dapm_widgets[] = { | 14 | static const struct snd_soc_dapm_widget dapm_widgets[] = { |
diff --git a/sound/soc/samsung/s3c24xx_simtec_tlv320aic23.c b/sound/soc/samsung/s3c24xx_simtec_tlv320aic23.c index 116e3e670167..a7ef7db54687 100644 --- a/sound/soc/samsung/s3c24xx_simtec_tlv320aic23.c +++ b/sound/soc/samsung/s3c24xx_simtec_tlv320aic23.c | |||
@@ -7,22 +7,10 @@ | |||
7 | * published by the Free Software Foundation. | 7 | * published by the Free Software Foundation. |
8 | */ | 8 | */ |
9 | 9 | ||
10 | #include <linux/module.h> | ||
11 | #include <linux/clk.h> | ||
12 | #include <linux/platform_device.h> | ||
13 | |||
14 | #include <sound/core.h> | ||
15 | #include <sound/pcm.h> | ||
16 | #include <sound/soc.h> | 10 | #include <sound/soc.h> |
17 | 11 | ||
18 | #include <plat/audio-simtec.h> | ||
19 | |||
20 | #include "dma.h" | ||
21 | #include "s3c24xx-i2s.h" | ||
22 | #include "s3c24xx_simtec.h" | 12 | #include "s3c24xx_simtec.h" |
23 | 13 | ||
24 | #include "../codecs/tlv320aic23.h" | ||
25 | |||
26 | /* supported machines: | 14 | /* supported machines: |
27 | * | 15 | * |
28 | * Machine Connections AMP | 16 | * Machine Connections AMP |
diff --git a/sound/soc/samsung/s3c24xx_uda134x.c b/sound/soc/samsung/s3c24xx_uda134x.c index 2c09e93dd566..3cb700751078 100644 --- a/sound/soc/samsung/s3c24xx_uda134x.c +++ b/sound/soc/samsung/s3c24xx_uda134x.c | |||
@@ -11,22 +11,15 @@ | |||
11 | * published by the Free Software Foundation. | 11 | * published by the Free Software Foundation. |
12 | */ | 12 | */ |
13 | 13 | ||
14 | #include <linux/module.h> | ||
15 | #include <linux/clk.h> | 14 | #include <linux/clk.h> |
16 | #include <linux/mutex.h> | ||
17 | #include <linux/gpio.h> | 15 | #include <linux/gpio.h> |
18 | #include <sound/pcm.h> | 16 | |
19 | #include <sound/pcm_params.h> | ||
20 | #include <sound/soc.h> | 17 | #include <sound/soc.h> |
21 | #include <sound/s3c24xx_uda134x.h> | 18 | #include <sound/s3c24xx_uda134x.h> |
22 | #include <sound/uda134x.h> | ||
23 | 19 | ||
24 | #include <plat/regs-iis.h> | 20 | #include <plat/regs-iis.h> |
25 | 21 | ||
26 | #include "dma.h" | ||
27 | #include "s3c24xx-i2s.h" | 22 | #include "s3c24xx-i2s.h" |
28 | #include "../codecs/uda134x.h" | ||
29 | |||
30 | 23 | ||
31 | /* #define ENFORCE_RATES 1 */ | 24 | /* #define ENFORCE_RATES 1 */ |
32 | /* | 25 | /* |
diff --git a/sound/soc/samsung/smartq_wm8987.c b/sound/soc/samsung/smartq_wm8987.c index 61e2b5219d42..0a2c4f223038 100644 --- a/sound/soc/samsung/smartq_wm8987.c +++ b/sound/soc/samsung/smartq_wm8987.c | |||
@@ -13,20 +13,14 @@ | |||
13 | * | 13 | * |
14 | */ | 14 | */ |
15 | 15 | ||
16 | #include <linux/module.h> | ||
17 | #include <linux/platform_device.h> | ||
18 | #include <linux/gpio.h> | 16 | #include <linux/gpio.h> |
19 | 17 | ||
20 | #include <sound/pcm.h> | ||
21 | #include <sound/pcm_params.h> | ||
22 | #include <sound/soc.h> | 18 | #include <sound/soc.h> |
23 | #include <sound/jack.h> | 19 | #include <sound/jack.h> |
24 | 20 | ||
25 | #include <asm/mach-types.h> | 21 | #include <asm/mach-types.h> |
26 | 22 | ||
27 | #include "dma.h" | ||
28 | #include "i2s.h" | 23 | #include "i2s.h" |
29 | |||
30 | #include "../codecs/wm8750.h" | 24 | #include "../codecs/wm8750.h" |
31 | 25 | ||
32 | /* | 26 | /* |
diff --git a/sound/soc/samsung/smdk2443_wm9710.c b/sound/soc/samsung/smdk2443_wm9710.c index 3be7e7e92d6e..3a0dbfc793f0 100644 --- a/sound/soc/samsung/smdk2443_wm9710.c +++ b/sound/soc/samsung/smdk2443_wm9710.c | |||
@@ -12,15 +12,8 @@ | |||
12 | * | 12 | * |
13 | */ | 13 | */ |
14 | 14 | ||
15 | #include <linux/module.h> | ||
16 | #include <linux/device.h> | ||
17 | #include <sound/core.h> | ||
18 | #include <sound/pcm.h> | ||
19 | #include <sound/soc.h> | 15 | #include <sound/soc.h> |
20 | 16 | ||
21 | #include "dma.h" | ||
22 | #include "ac97.h" | ||
23 | |||
24 | static struct snd_soc_card smdk2443; | 17 | static struct snd_soc_card smdk2443; |
25 | 18 | ||
26 | static struct snd_soc_dai_link smdk2443_dai[] = { | 19 | static struct snd_soc_dai_link smdk2443_dai[] = { |
diff --git a/sound/soc/samsung/smdk_spdif.c b/sound/soc/samsung/smdk_spdif.c index b5c3fad01bb8..e8ac961c6ba1 100644 --- a/sound/soc/samsung/smdk_spdif.c +++ b/sound/soc/samsung/smdk_spdif.c | |||
@@ -10,15 +10,10 @@ | |||
10 | * | 10 | * |
11 | */ | 11 | */ |
12 | 12 | ||
13 | #include <linux/module.h> | ||
14 | #include <linux/device.h> | ||
15 | #include <linux/clk.h> | 13 | #include <linux/clk.h> |
16 | 14 | ||
17 | #include <plat/devs.h> | ||
18 | |||
19 | #include <sound/soc.h> | 15 | #include <sound/soc.h> |
20 | 16 | ||
21 | #include "dma.h" | ||
22 | #include "spdif.h" | 17 | #include "spdif.h" |
23 | 18 | ||
24 | /* Audio clock settings are belonged to board specific part. Every | 19 | /* Audio clock settings are belonged to board specific part. Every |
diff --git a/sound/soc/samsung/smdk_wm8580.c b/sound/soc/samsung/smdk_wm8580.c index b2cff1a44aed..8aacf23d6f3a 100644 --- a/sound/soc/samsung/smdk_wm8580.c +++ b/sound/soc/samsung/smdk_wm8580.c | |||
@@ -10,17 +10,12 @@ | |||
10 | * option) any later version. | 10 | * option) any later version. |
11 | */ | 11 | */ |
12 | 12 | ||
13 | #include <linux/platform_device.h> | ||
14 | #include <linux/clk.h> | ||
15 | #include <sound/core.h> | ||
16 | #include <sound/pcm.h> | ||
17 | #include <sound/pcm_params.h> | ||
18 | #include <sound/soc.h> | 13 | #include <sound/soc.h> |
14 | #include <sound/pcm_params.h> | ||
19 | 15 | ||
20 | #include <asm/mach-types.h> | 16 | #include <asm/mach-types.h> |
21 | 17 | ||
22 | #include "../codecs/wm8580.h" | 18 | #include "../codecs/wm8580.h" |
23 | #include "dma.h" | ||
24 | #include "i2s.h" | 19 | #include "i2s.h" |
25 | 20 | ||
26 | /* | 21 | /* |
diff --git a/sound/soc/samsung/smdk_wm9713.c b/sound/soc/samsung/smdk_wm9713.c index ae5fed6f772f..fffe3c1dd1bd 100644 --- a/sound/soc/samsung/smdk_wm9713.c +++ b/sound/soc/samsung/smdk_wm9713.c | |||
@@ -11,13 +11,8 @@ | |||
11 | * | 11 | * |
12 | */ | 12 | */ |
13 | 13 | ||
14 | #include <linux/module.h> | ||
15 | #include <linux/device.h> | ||
16 | #include <sound/soc.h> | 14 | #include <sound/soc.h> |
17 | 15 | ||
18 | #include "dma.h" | ||
19 | #include "ac97.h" | ||
20 | |||
21 | static struct snd_soc_card smdk; | 16 | static struct snd_soc_card smdk; |
22 | 17 | ||
23 | /* | 18 | /* |
diff --git a/sound/soc/samsung/spdif.c b/sound/soc/samsung/spdif.c index f0816404ea3e..28c491dacf7a 100644 --- a/sound/soc/samsung/spdif.c +++ b/sound/soc/samsung/spdif.c | |||
@@ -13,9 +13,8 @@ | |||
13 | #include <linux/clk.h> | 13 | #include <linux/clk.h> |
14 | #include <linux/io.h> | 14 | #include <linux/io.h> |
15 | 15 | ||
16 | #include <sound/pcm.h> | ||
17 | #include <sound/pcm_params.h> | ||
18 | #include <sound/soc.h> | 16 | #include <sound/soc.h> |
17 | #include <sound/pcm_params.h> | ||
19 | 18 | ||
20 | #include <plat/audio.h> | 19 | #include <plat/audio.h> |
21 | #include <mach/dma.h> | 20 | #include <mach/dma.h> |