summaryrefslogtreecommitdiffstats
path: root/meta
diff options
context:
space:
mode:
Diffstat (limited to 'meta')
-rw-r--r--meta/packages/linux/linux-openmoko/defconfig-2.6.22.516
-rw-r--r--meta/packages/linux/linux-openmoko/gta-vibro-pwm-suspend.patch27
-rw-r--r--meta/packages/linux/linux-openmoko/gta02-sound.patch754
-rw-r--r--meta/packages/linux/linux-openmoko/iis-suspend.patch63
-rw-r--r--meta/packages/linux/linux-openmoko/s3c24xx-pcm-suspend.patch73
-rw-r--r--meta/packages/linux/linux-openmoko/soc-core-suspend.patch47
-rw-r--r--meta/packages/linux/linux-openmoko/tweak_power_button.patch32
-rw-r--r--meta/packages/linux/linux-openmoko_2.6.22.5.bb15
8 files changed, 1018 insertions, 9 deletions
diff --git a/meta/packages/linux/linux-openmoko/defconfig-2.6.22.5 b/meta/packages/linux/linux-openmoko/defconfig-2.6.22.5
index 7aa23df77c..333cd662ff 100644
--- a/meta/packages/linux/linux-openmoko/defconfig-2.6.22.5
+++ b/meta/packages/linux/linux-openmoko/defconfig-2.6.22.5
@@ -1,7 +1,7 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.22.5 3# Linux kernel version: 2.6.22.5
4# Wed Oct 3 13:55:25 2007 4# Wed Feb 20 11:10:51 2008
5# 5#
6CONFIG_ARM=y 6CONFIG_ARM=y
7CONFIG_SYS_SUPPORTS_APM_EMULATION=y 7CONFIG_SYS_SUPPORTS_APM_EMULATION=y
@@ -166,6 +166,7 @@ CONFIG_CPU_S3C2410_DMA=y
166CONFIG_S3C2410_PM=y 166CONFIG_S3C2410_PM=y
167CONFIG_S3C2410_GPIO=y 167CONFIG_S3C2410_GPIO=y
168CONFIG_S3C2410_CLOCK=y 168CONFIG_S3C2410_CLOCK=y
169CONFIG_S3C2410_PWM=y
169 170
170# 171#
171# S3C2410 Machines 172# S3C2410 Machines
@@ -252,7 +253,8 @@ CONFIG_ARM_THUMB=y
252CONFIG_PREEMPT=y 253CONFIG_PREEMPT=y
253CONFIG_NO_IDLE_HZ=y 254CONFIG_NO_IDLE_HZ=y
254CONFIG_HZ=200 255CONFIG_HZ=200
255# CONFIG_AEABI is not set 256CONFIG_AEABI=y
257# CONFIG_OABI_COMPAT is not set
256# CONFIG_ARCH_DISCONTIGMEM_ENABLE is not set 258# CONFIG_ARCH_DISCONTIGMEM_ENABLE is not set
257CONFIG_SELECT_MEMORY_MODEL=y 259CONFIG_SELECT_MEMORY_MODEL=y
258CONFIG_FLATMEM_MANUAL=y 260CONFIG_FLATMEM_MANUAL=y
@@ -271,7 +273,7 @@ CONFIG_ALIGNMENT_TRAP=y
271# 273#
272CONFIG_ZBOOT_ROM_TEXT=0x0 274CONFIG_ZBOOT_ROM_TEXT=0x0
273CONFIG_ZBOOT_ROM_BSS=0x0 275CONFIG_ZBOOT_ROM_BSS=0x0
274CONFIG_CMDLINE="ip=192.168.1.2:192.168.1.10:192.168.1.10:255.255.255.0:ezx:usb0:off" 276CONFIG_CMDLINE="unused -- bootloader passes ATAG list"
275# CONFIG_XIP_KERNEL is not set 277# CONFIG_XIP_KERNEL is not set
276CONFIG_KEXEC=y 278CONFIG_KEXEC=y
277 279
@@ -282,9 +284,6 @@ CONFIG_KEXEC=y
282# 284#
283# At least one emulation must be selected 285# At least one emulation must be selected
284# 286#
285CONFIG_FPE_NWFPE=y
286# CONFIG_FPE_NWFPE_XP is not set
287# CONFIG_FPE_FASTFPE is not set
288 287
289# 288#
290# Userspace binary formats 289# Userspace binary formats
@@ -292,7 +291,6 @@ CONFIG_FPE_NWFPE=y
292CONFIG_BINFMT_ELF=y 291CONFIG_BINFMT_ELF=y
293# CONFIG_BINFMT_AOUT is not set 292# CONFIG_BINFMT_AOUT is not set
294# CONFIG_BINFMT_MISC is not set 293# CONFIG_BINFMT_MISC is not set
295# CONFIG_ARTHUR is not set
296 294
297# 295#
298# Power management options 296# Power management options
@@ -893,6 +891,7 @@ CONFIG_INPUT_MOUSEDEV_SCREEN_Y=640
893# CONFIG_INPUT_TSDEV is not set 891# CONFIG_INPUT_TSDEV is not set
894CONFIG_INPUT_EVDEV=y 892CONFIG_INPUT_EVDEV=y
895CONFIG_INPUT_EVBUG=m 893CONFIG_INPUT_EVBUG=m
894CONFIG_INPUT_POWER=y
896 895
897# 896#
898# Input Device Drivers 897# Input Device Drivers
@@ -1049,6 +1048,7 @@ CONFIG_SPI_S3C24XX_GPIO=y
1049# CONFIG_SPI_AT25 is not set 1048# CONFIG_SPI_AT25 is not set
1050# CONFIG_SPI_SPIDEV is not set 1049# CONFIG_SPI_SPIDEV is not set
1051CONFIG_SPI_SLAVE_JBT6K74=y 1050CONFIG_SPI_SLAVE_JBT6K74=y
1051# CONFIG_SPI_SLAVE_LIS302DL is not set
1052 1052
1053# 1053#
1054# Dallas's 1-wire bus 1054# Dallas's 1-wire bus
@@ -1121,6 +1121,7 @@ CONFIG_LEDS_CLASS=y
1121# 1121#
1122CONFIG_LEDS_S3C24XX=m 1122CONFIG_LEDS_S3C24XX=m
1123CONFIG_LEDS_GTA01=y 1123CONFIG_LEDS_GTA01=y
1124# CONFIG_LEDS_GTA02 is not set
1124 1125
1125# 1126#
1126# LED Triggers 1127# LED Triggers
@@ -1248,6 +1249,7 @@ CONFIG_SND_SOC=y
1248CONFIG_SND_S3C24XX_SOC=m 1249CONFIG_SND_S3C24XX_SOC=m
1249CONFIG_SND_S3C24XX_SOC_I2S=m 1250CONFIG_SND_S3C24XX_SOC_I2S=m
1250CONFIG_SND_S3C24XX_SOC_NEO1973_WM8753=m 1251CONFIG_SND_S3C24XX_SOC_NEO1973_WM8753=m
1252# CONFIG_SND_S3C24XX_SOC_NEO1973_GTA02_WM8753 is not set
1251 1253
1252# 1254#
1253# SoC Audio support for SuperH 1255# SoC Audio support for SuperH
diff --git a/meta/packages/linux/linux-openmoko/gta-vibro-pwm-suspend.patch b/meta/packages/linux/linux-openmoko/gta-vibro-pwm-suspend.patch
new file mode 100644
index 0000000000..a98f5c8ca5
--- /dev/null
+++ b/meta/packages/linux/linux-openmoko/gta-vibro-pwm-suspend.patch
@@ -0,0 +1,27 @@
1Index: linux-2.6.22/drivers/leds/leds-gta01.c
2===================================================================
3--- linux-2.6.22.orig/drivers/leds/leds-gta01.c 2007-11-09 16:27:03.000000000 +0000
4+++ linux-2.6.22/drivers/leds/leds-gta01.c 2007-11-09 16:27:13.000000000 +0000
5@@ -33,6 +33,8 @@
6 struct s3c2410_pwm pwm;
7 };
8
9+static int gta01vib_init_hw(struct gta01_vib_priv *vp);
10+
11 static inline struct gta01_vib_priv *pdev_to_vpriv(struct platform_device *dev)
12 {
13 return platform_get_drvdata(dev);
14@@ -80,7 +82,13 @@
15
16 static int gta01vib_resume(struct platform_device *dev)
17 {
18+ struct gta01_vib_priv *vp = pdev_to_vpriv(dev);
19+
20 led_classdev_resume(&gta01_vib_led);
21+
22+ if (vp->has_pwm)
23+ gta01vib_init_hw(vp);
24+
25 return 0;
26 }
27 #endif
diff --git a/meta/packages/linux/linux-openmoko/gta02-sound.patch b/meta/packages/linux/linux-openmoko/gta02-sound.patch
new file mode 100644
index 0000000000..f742c77303
--- /dev/null
+++ b/meta/packages/linux/linux-openmoko/gta02-sound.patch
@@ -0,0 +1,754 @@
1Index: linux-2.6.22/sound/soc/s3c24xx/neo1973_gta02_wm8753.c
2===================================================================
3--- /dev/null 1970-01-01 00:00:00.000000000 +0000
4+++ linux-2.6.22/sound/soc/s3c24xx/neo1973_gta02_wm8753.c 2007-11-09 16:21:35.000000000 +0000
5@@ -0,0 +1,667 @@
6+/*
7+ * neo1973_gta02_wm8753.c -- SoC audio for Neo1973
8+ *
9+ * Copyright 2007 OpenMoko Inc
10+ * Author: Graeme Gregory <graeme@openmoko.org>
11+ * Copyright 2007 Wolfson Microelectronics PLC.
12+ * Author: Graeme Gregory <linux@wolfsonmicro.com>
13+ *
14+ * This program is free software; you can redistribute it and/or modify it
15+ * under the terms of the GNU General Public License as published by the
16+ * Free Software Foundation; either version 2 of the License, or (at your
17+ * option) any later version.
18+ *
19+ * Revision history
20+ * 06th Nov 2007 Changed from GTA01 to GTA02
21+ * 20th Jan 2007 Initial version.
22+ * 05th Feb 2007 Rename all to Neo1973
23+ *
24+ */
25+
26+#include <linux/module.h>
27+#include <linux/moduleparam.h>
28+#include <linux/timer.h>
29+#include <linux/interrupt.h>
30+#include <linux/platform_device.h>
31+#include <linux/i2c.h>
32+#include <sound/driver.h>
33+#include <sound/core.h>
34+#include <sound/pcm.h>
35+#include <sound/soc.h>
36+#include <sound/soc-dapm.h>
37+
38+#include <asm/mach-types.h>
39+#include <asm/hardware/scoop.h>
40+#include <asm/arch/regs-iis.h>
41+#include <asm/arch/regs-clock.h>
42+#include <asm/arch/regs-gpio.h>
43+#include <asm/hardware.h>
44+#include <asm/arch/audio.h>
45+#include <asm/io.h>
46+#include <asm/arch/spi-gpio.h>
47+#include <asm/arch/regs-gpioj.h>
48+#include <asm/arch/gta02.h>
49+#include "../codecs/wm8753.h"
50+#include "s3c24xx-pcm.h"
51+#include "s3c24xx-i2s.h"
52+
53+/* define the scenarios */
54+#define NEO_AUDIO_OFF 0
55+#define NEO_GSM_CALL_AUDIO_HANDSET 1
56+#define NEO_GSM_CALL_AUDIO_HEADSET 2
57+#define NEO_GSM_CALL_AUDIO_BLUETOOTH 3
58+#define NEO_STEREO_TO_SPEAKERS 4
59+#define NEO_STEREO_TO_HEADPHONES 5
60+#define NEO_CAPTURE_HANDSET 6
61+#define NEO_CAPTURE_HEADSET 7
62+#define NEO_CAPTURE_BLUETOOTH 8
63+#define NEO_STEREO_TO_HANDSET_SPK 9
64+
65+static struct snd_soc_machine neo1973_gta02;
66+
67+static int neo1973_gta02_hifi_hw_params(struct snd_pcm_substream *substream,
68+ struct snd_pcm_hw_params *params)
69+{
70+ struct snd_soc_pcm_runtime *rtd = substream->private_data;
71+ struct snd_soc_codec_dai *codec_dai = rtd->dai->codec_dai;
72+ struct snd_soc_cpu_dai *cpu_dai = rtd->dai->cpu_dai;
73+ unsigned int pll_out = 0, bclk = 0;
74+ int ret = 0;
75+ unsigned long iis_clkrate;
76+
77+ iis_clkrate = s3c24xx_i2s_get_clockrate();
78+
79+ switch (params_rate(params)) {
80+ case 8000:
81+ case 16000:
82+ pll_out = 12288000;
83+ break;
84+ case 48000:
85+ bclk = WM8753_BCLK_DIV_4;
86+ pll_out = 12288000;
87+ break;
88+ case 96000:
89+ bclk = WM8753_BCLK_DIV_2;
90+ pll_out = 12288000;
91+ break;
92+ case 11025:
93+ bclk = WM8753_BCLK_DIV_16;
94+ pll_out = 11289600;
95+ break;
96+ case 22050:
97+ bclk = WM8753_BCLK_DIV_8;
98+ pll_out = 11289600;
99+ break;
100+ case 44100:
101+ bclk = WM8753_BCLK_DIV_4;
102+ pll_out = 11289600;
103+ break;
104+ case 88200:
105+ bclk = WM8753_BCLK_DIV_2;
106+ pll_out = 11289600;
107+ break;
108+ }
109+
110+ /* set codec DAI configuration */
111+ ret = codec_dai->dai_ops.set_fmt(codec_dai,
112+ SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF |
113+ SND_SOC_DAIFMT_CBM_CFM);
114+ if (ret < 0)
115+ return ret;
116+
117+ /* set cpu DAI configuration */
118+ ret = cpu_dai->dai_ops.set_fmt(cpu_dai,
119+ SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF |
120+ SND_SOC_DAIFMT_CBM_CFM);
121+ if (ret < 0)
122+ return ret;
123+
124+ /* set the codec system clock for DAC and ADC */
125+ ret = codec_dai->dai_ops.set_sysclk(codec_dai, WM8753_MCLK, pll_out,
126+ SND_SOC_CLOCK_IN);
127+ if (ret < 0)
128+ return ret;
129+
130+ /* set MCLK division for sample rate */
131+ ret = cpu_dai->dai_ops.set_clkdiv(cpu_dai, S3C24XX_DIV_MCLK,
132+ S3C2410_IISMOD_32FS );
133+ if (ret < 0)
134+ return ret;
135+
136+ /* set codec BCLK division for sample rate */
137+ ret = codec_dai->dai_ops.set_clkdiv(codec_dai,
138+ WM8753_BCLKDIV, bclk);
139+ if (ret < 0)
140+ return ret;
141+
142+ /* set prescaler division for sample rate */
143+ ret = cpu_dai->dai_ops.set_clkdiv(cpu_dai, S3C24XX_DIV_PRESCALER,
144+ S3C24XX_PRESCALE(4,4));
145+ if (ret < 0)
146+ return ret;
147+
148+ /* codec PLL input is PCLK/4 */
149+ ret = codec_dai->dai_ops.set_pll(codec_dai, WM8753_PLL1,
150+ iis_clkrate / 4, pll_out);
151+ if (ret < 0)
152+ return ret;
153+
154+ return 0;
155+}
156+
157+static int neo1973_gta02_hifi_hw_free(struct snd_pcm_substream *substream)
158+{
159+ struct snd_soc_pcm_runtime *rtd = substream->private_data;
160+ struct snd_soc_codec_dai *codec_dai = rtd->dai->codec_dai;
161+
162+ /* disable the PLL */
163+ return codec_dai->dai_ops.set_pll(codec_dai, WM8753_PLL1, 0, 0);
164+}
165+
166+/*
167+ * Neo1973 WM8753 HiFi DAI opserations.
168+ */
169+static struct snd_soc_ops neo1973_gta02_hifi_ops = {
170+ .hw_params = neo1973_gta02_hifi_hw_params,
171+ .hw_free = neo1973_gta02_hifi_hw_free,
172+};
173+
174+static int neo1973_gta02_voice_hw_params(
175+ struct snd_pcm_substream *substream,
176+ struct snd_pcm_hw_params *params)
177+{
178+ struct snd_soc_pcm_runtime *rtd = substream->private_data;
179+ struct snd_soc_codec_dai *codec_dai = rtd->dai->codec_dai;
180+ unsigned int pcmdiv = 0;
181+ int ret = 0;
182+ unsigned long iis_clkrate;
183+
184+ iis_clkrate = s3c24xx_i2s_get_clockrate();
185+
186+ if (params_rate(params) != 8000)
187+ return -EINVAL;
188+ if (params_channels(params) != 1)
189+ return -EINVAL;
190+
191+ pcmdiv = WM8753_PCM_DIV_6; /* 2.048 MHz */
192+
193+ /* todo: gg check mode (DSP_B) against CSR datasheet */
194+ /* set codec DAI configuration */
195+ ret = codec_dai->dai_ops.set_fmt(codec_dai, SND_SOC_DAIFMT_DSP_B |
196+ SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBS_CFS);
197+ if (ret < 0)
198+ return ret;
199+
200+ /* set the codec system clock for DAC and ADC */
201+ ret = codec_dai->dai_ops.set_sysclk(codec_dai, WM8753_PCMCLK,
202+ 12288000, SND_SOC_CLOCK_IN);
203+ if (ret < 0)
204+ return ret;
205+
206+ /* set codec PCM division for sample rate */
207+ ret = codec_dai->dai_ops.set_clkdiv(codec_dai, WM8753_PCMDIV,
208+ pcmdiv);
209+ if (ret < 0)
210+ return ret;
211+
212+ /* configue and enable PLL for 12.288MHz output */
213+ ret = codec_dai->dai_ops.set_pll(codec_dai, WM8753_PLL2,
214+ iis_clkrate / 4, 12288000);
215+ if (ret < 0)
216+ return ret;
217+
218+ return 0;
219+}
220+
221+static int neo1973_gta02_voice_hw_free(struct snd_pcm_substream *substream)
222+{
223+ struct snd_soc_pcm_runtime *rtd = substream->private_data;
224+ struct snd_soc_codec_dai *codec_dai = rtd->dai->codec_dai;
225+
226+ /* disable the PLL */
227+ return codec_dai->dai_ops.set_pll(codec_dai, WM8753_PLL2, 0, 0);
228+}
229+
230+static struct snd_soc_ops neo1973_gta02_voice_ops = {
231+ .hw_params = neo1973_gta02_voice_hw_params,
232+ .hw_free = neo1973_gta02_voice_hw_free,
233+};
234+
235+#define LM4853_AMP 1
236+#define LM4853_SPK 2
237+
238+static u8 lm4853_state=0;
239+
240+static int lm4853_set_state(struct snd_kcontrol *kcontrol,
241+ struct snd_ctl_elem_value *ucontrol)
242+{
243+ int val = ucontrol->value.integer.value[0];
244+
245+ if(val) {
246+ lm4853_state |= LM4853_AMP;
247+ s3c2410_gpio_setpin(GTA02_GPIO_AMP_SHUT,0);
248+ } else {
249+ lm4853_state &= ~LM4853_AMP;
250+ s3c2410_gpio_setpin(GTA02_GPIO_AMP_SHUT,1);
251+ }
252+
253+ return 0;
254+}
255+
256+static int lm4853_get_state(struct snd_kcontrol *kcontrol,
257+ struct snd_ctl_elem_value *ucontrol)
258+{
259+ ucontrol->value.integer.value[0] = lm4853_state & LM4853_AMP;
260+
261+ return 0;
262+}
263+
264+static int lm4853_set_spk(struct snd_kcontrol *kcontrol,
265+ struct snd_ctl_elem_value *ucontrol)
266+{
267+ int val = ucontrol->value.integer.value[0];
268+
269+ if(val) {
270+ lm4853_state |= LM4853_SPK;
271+ s3c2410_gpio_setpin(GTA02_GPIO_HP_IN,0);
272+ } else {
273+ lm4853_state &= ~LM4853_SPK;
274+ s3c2410_gpio_setpin(GTA02_GPIO_HP_IN,1);
275+ }
276+
277+ return 0;
278+}
279+
280+static int lm4853_get_spk(struct snd_kcontrol *kcontrol,
281+ struct snd_ctl_elem_value *ucontrol)
282+{
283+ ucontrol->value.integer.value[0] = (lm4853_state & LM4853_SPK) >> 1;
284+
285+ return 0;
286+}
287+
288+static int neo1973_gta02_set_stereo_out(struct snd_kcontrol *kcontrol,
289+ struct snd_ctl_elem_value *ucontrol)
290+{
291+ struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
292+ int val = ucontrol->value.integer.value[0];
293+
294+ snd_soc_dapm_set_endpoint(codec, "Stereo Out", val);
295+
296+ snd_soc_dapm_sync_endpoints(codec);
297+
298+ return 0;
299+}
300+
301+static int neo1973_gta02_get_stereo_out(struct snd_kcontrol *kcontrol,
302+ struct snd_ctl_elem_value *ucontrol)
303+{
304+ struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
305+
306+ ucontrol->value.integer.value[0] =
307+ snd_soc_dapm_get_endpoint(codec, "Stereo Out");
308+
309+ return 0;
310+}
311+
312+
313+static int neo1973_gta02_set_gsm_out(struct snd_kcontrol *kcontrol,
314+ struct snd_ctl_elem_value *ucontrol)
315+{
316+ struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
317+ int val = ucontrol->value.integer.value[0];
318+
319+ snd_soc_dapm_set_endpoint(codec, "GSM Line Out", val);
320+
321+ snd_soc_dapm_sync_endpoints(codec);
322+
323+ return 0;
324+}
325+
326+static int neo1973_gta02_get_gsm_out(struct snd_kcontrol *kcontrol,
327+ struct snd_ctl_elem_value *ucontrol)
328+{
329+ struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
330+
331+ ucontrol->value.integer.value[0] =
332+ snd_soc_dapm_get_endpoint(codec, "GSM Line Out");
333+
334+ return 0;
335+}
336+
337+static int neo1973_gta02_set_gsm_in(struct snd_kcontrol *kcontrol,
338+ struct snd_ctl_elem_value *ucontrol)
339+{
340+ struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
341+ int val = ucontrol->value.integer.value[0];
342+
343+ snd_soc_dapm_set_endpoint(codec, "GSM Line In", val);
344+
345+ snd_soc_dapm_sync_endpoints(codec);
346+
347+ return 0;
348+}
349+
350+static int neo1973_gta02_get_gsm_in(struct snd_kcontrol *kcontrol,
351+ struct snd_ctl_elem_value *ucontrol)
352+{
353+ struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
354+
355+ ucontrol->value.integer.value[0] =
356+ snd_soc_dapm_get_endpoint(codec, "GSM Line In");
357+
358+ return 0;
359+}
360+
361+static int neo1973_gta02_set_headset_mic(struct snd_kcontrol *kcontrol,
362+ struct snd_ctl_elem_value *ucontrol)
363+{
364+ struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
365+ int val = ucontrol->value.integer.value[0];
366+
367+ snd_soc_dapm_set_endpoint(codec, "Headset Mic", val);
368+
369+ snd_soc_dapm_sync_endpoints(codec);
370+
371+ return 0;
372+}
373+
374+static int neo1973_gta02_get_headset_mic(struct snd_kcontrol *kcontrol,
375+ struct snd_ctl_elem_value *ucontrol)
376+{
377+ struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
378+
379+ ucontrol->value.integer.value[0] =
380+ snd_soc_dapm_get_endpoint(codec, "Headset Mic");
381+
382+ return 0;
383+}
384+
385+static int neo1973_gta02_set_handset_mic(struct snd_kcontrol *kcontrol,
386+ struct snd_ctl_elem_value *ucontrol)
387+{
388+ struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
389+ int val = ucontrol->value.integer.value[0];
390+
391+ snd_soc_dapm_set_endpoint(codec, "Handset Mic", val);
392+
393+ snd_soc_dapm_sync_endpoints(codec);
394+
395+ return 0;
396+}
397+
398+static int neo1973_gta02_get_handset_mic(struct snd_kcontrol *kcontrol,
399+ struct snd_ctl_elem_value *ucontrol)
400+{
401+ struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
402+
403+ ucontrol->value.integer.value[0] =
404+ snd_soc_dapm_get_endpoint(codec, "Handset Mic");
405+
406+ return 0;
407+}
408+
409+static int neo1973_gta02_set_handset_spk(struct snd_kcontrol *kcontrol,
410+ struct snd_ctl_elem_value *ucontrol)
411+{
412+ struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
413+ int val = ucontrol->value.integer.value[0];
414+
415+ snd_soc_dapm_set_endpoint(codec, "Handset Spk", val);
416+
417+ snd_soc_dapm_sync_endpoints(codec);
418+
419+ return 0;
420+}
421+
422+static int neo1973_gta02_get_handset_spk(struct snd_kcontrol *kcontrol,
423+ struct snd_ctl_elem_value *ucontrol)
424+{
425+ struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
426+
427+ ucontrol->value.integer.value[0] =
428+ snd_soc_dapm_get_endpoint(codec, "Handset Spk");
429+
430+ return 0;
431+}
432+
433+static const struct snd_soc_dapm_widget wm8753_dapm_widgets[] = {
434+ SND_SOC_DAPM_LINE("Stereo Out", NULL),
435+ SND_SOC_DAPM_LINE("GSM Line Out", NULL),
436+ SND_SOC_DAPM_LINE("GSM Line In", NULL),
437+ SND_SOC_DAPM_MIC("Headset Mic", NULL),
438+ SND_SOC_DAPM_MIC("Handset Mic", NULL),
439+ SND_SOC_DAPM_SPK("Handset Spk", NULL),
440+};
441+
442+
443+/* example machine audio_mapnections */
444+static const char* audio_map[][3] = {
445+
446+ /* Connections to the lm4853 amp */
447+ {"Stereo Out", NULL, "LOUT1"},
448+ {"Stereo Out", NULL, "ROUT1"},
449+
450+ /* Connections to the GSM Module */
451+ {"GSM Line Out", NULL, "MONO1"},
452+ {"GSM Line Out", NULL, "MONO2"},
453+ {"RXP", NULL, "GSM Line In"},
454+ {"RXN", NULL, "GSM Line In"},
455+
456+ /* Connections to Headset */
457+ {"MIC1", NULL, "Mic Bias"},
458+ {"Mic Bias", NULL, "Headset Mic"},
459+
460+ /* Call Mic */
461+ {"MIC2", NULL, "Mic Bias"},
462+ {"MIC2N", NULL, "Mic Bias"},
463+ {"Mic Bias", NULL, "Handset Mic"},
464+
465+ /* Call Speaker */
466+ {"Handset Spk", NULL, "LOUT2"},
467+ {"Handset Spk", NULL, "ROUT2"},
468+
469+ /* Connect the ALC pins */
470+ {"ACIN", NULL, "ACOP"},
471+
472+ {NULL, NULL, NULL},
473+};
474+
475+static const struct snd_kcontrol_new wm8753_neo1973_gta02_controls[] = {
476+ SOC_SINGLE_EXT("DAPM Stereo Out Switch", 0, 0, 1, 0,
477+ neo1973_gta02_get_stereo_out,
478+ neo1973_gta02_set_stereo_out),
479+ SOC_SINGLE_EXT("DAPM GSM Line Out Switch", 1, 0, 1, 0,
480+ neo1973_gta02_get_gsm_out,
481+ neo1973_gta02_set_gsm_out),
482+ SOC_SINGLE_EXT("DAPM GSM Line In Switch", 2, 0, 1, 0,
483+ neo1973_gta02_get_gsm_in,
484+ neo1973_gta02_set_gsm_in),
485+ SOC_SINGLE_EXT("DAPM Headset Mic Switch", 3, 0, 1, 0,
486+ neo1973_gta02_get_headset_mic,
487+ neo1973_gta02_set_headset_mic),
488+ SOC_SINGLE_EXT("DAPM Handset Mic Switch", 4, 0, 1, 0,
489+ neo1973_gta02_get_handset_mic,
490+ neo1973_gta02_set_handset_mic),
491+ SOC_SINGLE_EXT("DAPM Handset Spk Switch", 5, 0, 1, 0,
492+ neo1973_gta02_get_handset_spk,
493+ neo1973_gta02_set_handset_spk),
494+ SOC_SINGLE_EXT("Amp State Switch", 6, 0, 1, 0,
495+ lm4853_get_state,
496+ lm4853_set_state),
497+ SOC_SINGLE_EXT("Amp Spk Switch", 7, 0, 1, 0,
498+ lm4853_get_spk,
499+ lm4853_set_spk),
500+};
501+
502+/*
503+ * This is an example machine initialisation for a wm8753 connected to a
504+ * neo1973 GTA02.
505+ */
506+static int neo1973_gta02_wm8753_init(struct snd_soc_codec *codec)
507+{
508+ int i, err;
509+
510+ /* set up NC codec pins */
511+ snd_soc_dapm_set_endpoint(codec, "OUT3", 0);
512+ snd_soc_dapm_set_endpoint(codec, "OUT4", 0);
513+ snd_soc_dapm_set_endpoint(codec, "LINE1", 0);
514+ snd_soc_dapm_set_endpoint(codec, "LINE2", 0);
515+
516+ /* Add neo1973 gta02 specific widgets */
517+ for (i = 0; i < ARRAY_SIZE(wm8753_dapm_widgets); i++)
518+ snd_soc_dapm_new_control(codec, &wm8753_dapm_widgets[i]);
519+
520+ /* add neo1973 gta02 specific controls */
521+ for (i = 0; i < ARRAY_SIZE(wm8753_neo1973_gta02_controls); i++) {
522+ err = snd_ctl_add(codec->card,
523+ snd_soc_cnew(&wm8753_neo1973_gta02_controls[i],
524+ codec, NULL));
525+ if (err < 0)
526+ return err;
527+ }
528+
529+ /* set up neo1973 gta02 specific audio path audio_mapnects */
530+ for (i = 0; audio_map[i][0] != NULL; i++) {
531+ snd_soc_dapm_connect_input(codec, audio_map[i][0],
532+ audio_map[i][1], audio_map[i][2]);
533+ }
534+
535+ /* set endpoints to default off mode */
536+ snd_soc_dapm_set_endpoint(codec, "Stereo Out", 0);
537+ snd_soc_dapm_set_endpoint(codec, "GSM Line Out",0);
538+ snd_soc_dapm_set_endpoint(codec, "GSM Line In", 0);
539+ snd_soc_dapm_set_endpoint(codec, "Headset Mic", 0);
540+ snd_soc_dapm_set_endpoint(codec, "Handset Mic", 0);
541+ snd_soc_dapm_set_endpoint(codec, "Handset Spk", 0);
542+
543+ snd_soc_dapm_sync_endpoints(codec);
544+ return 0;
545+}
546+
547+/*
548+ * BT Codec DAI
549+ */
550+static struct snd_soc_cpu_dai bt_dai =
551+{ .name = "Bluetooth",
552+ .id = 0,
553+ .type = SND_SOC_DAI_PCM,
554+ .playback = {
555+ .channels_min = 1,
556+ .channels_max = 1,
557+ .rates = SNDRV_PCM_RATE_8000,
558+ .formats = SNDRV_PCM_FMTBIT_S16_LE,},
559+ .capture = {
560+ .channels_min = 1,
561+ .channels_max = 1,
562+ .rates = SNDRV_PCM_RATE_8000,
563+ .formats = SNDRV_PCM_FMTBIT_S16_LE,},
564+};
565+
566+static struct snd_soc_dai_link neo1973_gta02_dai[] = {
567+{ /* Hifi Playback - for similatious use with voice below */
568+ .name = "WM8753",
569+ .stream_name = "WM8753 HiFi",
570+ .cpu_dai = &s3c24xx_i2s_dai,
571+ .codec_dai = &wm8753_dai[WM8753_DAI_HIFI],
572+ .init = neo1973_gta02_wm8753_init,
573+ .ops = &neo1973_gta02_hifi_ops,
574+},
575+{ /* Voice via BT */
576+ .name = "Bluetooth",
577+ .stream_name = "Voice",
578+ .cpu_dai = &bt_dai,
579+ .codec_dai = &wm8753_dai[WM8753_DAI_VOICE],
580+ .ops = &neo1973_gta02_voice_ops,
581+},
582+};
583+
584+#ifdef CONFIG_PM
585+int neo1973_gta02_suspend(struct platform_device *pdev, pm_message_t state)
586+{
587+ s3c2410_gpio_setpin(GTA02_GPIO_AMP_SHUT, 1);
588+
589+ return 0;
590+}
591+
592+int neo1973_gta02_resume(struct platform_device *pdev)
593+{
594+ if(lm4853_state & LM4853_AMP)
595+ s3c2410_gpio_setpin(GTA02_GPIO_AMP_SHUT, 0);
596+
597+ return 0;
598+}
599+#else
600+#define neo1973_gta02_suspend NULL
601+#define neo1973_gta02_resume NULL
602+#endif
603+
604+static struct snd_soc_machine neo1973_gta02 = {
605+ .name = "neo1973-gta02",
606+ .suspend_pre = neo1973_gta02_suspend,
607+ .resume_post = neo1973_gta02_resume,
608+ .dai_link = neo1973_gta02_dai,
609+ .num_links = ARRAY_SIZE(neo1973_gta02_dai),
610+};
611+
612+static struct wm8753_setup_data neo1973_gta02_wm8753_setup = {
613+ .i2c_address = 0x1a,
614+};
615+
616+static struct snd_soc_device neo1973_gta02_snd_devdata = {
617+ .machine = &neo1973_gta02,
618+ .platform = &s3c24xx_soc_platform,
619+ .codec_dev = &soc_codec_dev_wm8753,
620+ .codec_data = &neo1973_gta02_wm8753_setup,
621+};
622+
623+static struct platform_device *neo1973_gta02_snd_device;
624+
625+static int __init neo1973_gta02_init(void)
626+{
627+ int ret;
628+
629+ if (!machine_is_neo1973_gta02()) {
630+ printk(KERN_INFO
631+ "Only GTA02 hardware supported by ASoc driver\n");
632+ return -ENODEV;
633+ }
634+
635+ neo1973_gta02_snd_device = platform_device_alloc("soc-audio", -1);
636+ if (!neo1973_gta02_snd_device)
637+ return -ENOMEM;
638+
639+ platform_set_drvdata(neo1973_gta02_snd_device,
640+ &neo1973_gta02_snd_devdata);
641+ neo1973_gta02_snd_devdata.dev = &neo1973_gta02_snd_device->dev;
642+ ret = platform_device_add(neo1973_gta02_snd_device);
643+
644+ if (ret)
645+ platform_device_put(neo1973_gta02_snd_device);
646+
647+ /* Initialise GPIOs used by amp */
648+ s3c2410_gpio_cfgpin(GTA02_GPIO_HP_IN, S3C2410_GPIO_OUTPUT);
649+ s3c2410_gpio_cfgpin(GTA02_GPIO_AMP_SHUT, S3C2410_GPIO_OUTPUT);
650+
651+ /* Amp off by default */
652+ s3c2410_gpio_setpin(GTA02_GPIO_AMP_SHUT, 1);
653+
654+ /* Speaker off by default */
655+ s3c2410_gpio_setpin(GTA02_GPIO_HP_IN, 1);
656+
657+ return ret;
658+}
659+
660+static void __exit neo1973_gta02_exit(void)
661+{
662+ platform_device_unregister(neo1973_gta02_snd_device);
663+}
664+
665+module_init(neo1973_gta02_init);
666+module_exit(neo1973_gta02_exit);
667+
668+/* Module information */
669+MODULE_AUTHOR("Graeme Gregory, graeme@openmoko.org");
670+MODULE_DESCRIPTION("ALSA SoC WM8753 Neo1973 GTA02");
671+MODULE_LICENSE("GPL");
672+
673Index: linux-2.6.22/sound/soc/s3c24xx/Kconfig
674===================================================================
675--- linux-2.6.22.orig/sound/soc/s3c24xx/Kconfig 2007-11-09 16:13:04.000000000 +0000
676+++ linux-2.6.22/sound/soc/s3c24xx/Kconfig 2007-11-09 16:13:08.000000000 +0000
677@@ -25,6 +25,15 @@
678 Say Y if you want to add support for SoC audio on smdk2440
679 with the WM8753.
680
681+config SND_S3C24XX_SOC_NEO1973_GTA02_WM8753
682+ tristate "SoC I2S Audio support for NEO1973 GTA02 - WM8753"
683+ depends on SND_S3C24XX_SOC && MACH_NEO1973_GTA02
684+ select SND_S3C24XX_SOC_I2S
685+ select SND_SOC_WM8753
686+ help
687+ Say Y if you want to add support for SoC audio on neo1973 gta02
688+ with the WM8753 codec
689+
690 config SND_S3C24XX_SOC_SMDK2443_WM9710
691 tristate "SoC AC97 Audio support for SMDK2443 - WM9710"
692 depends on SND_S3C24XX_SOC && MACH_SMDK2443
693Index: linux-2.6.22/sound/soc/s3c24xx/Makefile
694===================================================================
695--- linux-2.6.22.orig/sound/soc/s3c24xx/Makefile 2007-11-09 16:13:04.000000000 +0000
696+++ linux-2.6.22/sound/soc/s3c24xx/Makefile 2007-11-09 16:13:08.000000000 +0000
697@@ -10,6 +10,9 @@
698 # S3C24XX Machine Support
699 snd-soc-neo1973-wm8753-objs := neo1973_wm8753.o
700 snd-soc-smdk2443-wm9710-objs := smdk2443_wm9710.o
701+snd-soc-neo1973-gta02-wm8753-objs := neo1973_gta02_wm8753.o
702
703 obj-$(CONFIG_SND_S3C24XX_SOC_NEO1973_WM8753) += snd-soc-neo1973-wm8753.o
704 obj-$(CONFIG_SND_S3C24XX_SOC_SMDK2443_WM9710) += snd-soc-smdk2443-wm9710.o
705+obj-$(CONFIG_SND_S3C24XX_SOC_NEO1973_GTA02_WM8753) += snd-soc-neo1973-gta02-wm8753.o
706+
707Index: linux-2.6.22/include/sound/soc-dapm.h
708===================================================================
709--- linux-2.6.22.orig/include/sound/soc-dapm.h 2007-07-09 00:32:17.000000000 +0100
710+++ linux-2.6.22/include/sound/soc-dapm.h 2007-11-09 16:13:08.000000000 +0000
711@@ -206,6 +206,8 @@
712 /* dapm audio endpoint control */
713 int snd_soc_dapm_set_endpoint(struct snd_soc_codec *codec,
714 char *pin, int status);
715+int snd_soc_dapm_get_endpoint(struct snd_soc_codec *codec,
716+ char *pin);
717 int snd_soc_dapm_sync_endpoints(struct snd_soc_codec *codec);
718
719 /* dapm widget types */
720Index: linux-2.6.22/sound/soc/soc-dapm.c
721===================================================================
722--- linux-2.6.22.orig/sound/soc/soc-dapm.c 2007-07-09 00:32:17.000000000 +0100
723+++ linux-2.6.22/sound/soc/soc-dapm.c 2007-11-09 16:13:08.000000000 +0000
724@@ -1305,6 +1305,30 @@
725 EXPORT_SYMBOL_GPL(snd_soc_dapm_set_endpoint);
726
727 /**
728+ * snd_soc_dapm_get_endpoint - get audio endpoint status
729+ * @codec: audio codec
730+ * @endpoint: audio signal endpoint (or start point)
731+ *
732+ * Get audio endpoint status - connected or disconnected.
733+ *
734+ * Returns status
735+ */
736+int snd_soc_dapm_get_endpoint(struct snd_soc_codec *codec,
737+ char *endpoint)
738+{
739+ struct snd_soc_dapm_widget *w;
740+
741+ list_for_each_entry(w, &codec->dapm_widgets, list) {
742+ if (!strcmp(w->name, endpoint)) {
743+ return w->connected;
744+ }
745+ }
746+
747+ return 0;
748+}
749+EXPORT_SYMBOL_GPL(snd_soc_dapm_get_endpoint);
750+
751+/**
752 * snd_soc_dapm_free - free dapm resources
753 * @socdev: SoC device
754 *
diff --git a/meta/packages/linux/linux-openmoko/iis-suspend.patch b/meta/packages/linux/linux-openmoko/iis-suspend.patch
new file mode 100644
index 0000000000..ab38672463
--- /dev/null
+++ b/meta/packages/linux/linux-openmoko/iis-suspend.patch
@@ -0,0 +1,63 @@
1Index: linux-2.6.22/sound/soc/s3c24xx/s3c24xx-i2s.c
2===================================================================
3--- linux-2.6.22.orig/sound/soc/s3c24xx/s3c24xx-i2s.c 2007-11-09 16:13:04.000000000 +0000
4+++ linux-2.6.22/sound/soc/s3c24xx/s3c24xx-i2s.c 2007-11-09 16:17:47.000000000 +0000
5@@ -75,6 +75,10 @@
6 struct s3c24xx_i2s_info {
7 void __iomem *regs;
8 struct clk *iis_clk;
9+ u32 iiscon;
10+ u32 iismod;
11+ u32 iisfcon;
12+ u32 iispsr;
13 };
14 static struct s3c24xx_i2s_info s3c24xx_i2s;
15
16@@ -404,6 +408,38 @@
17 return 0;
18 }
19
20+#ifdef CONFIG_PM
21+int s3c24xx_i2s_suspend(struct platform_device *pdev,
22+ struct snd_soc_cpu_dai *cpu_dai)
23+{
24+ s3c24xx_i2s.iiscon=readl(s3c24xx_i2s.regs + S3C2410_IISCON);
25+ s3c24xx_i2s.iismod=readl(s3c24xx_i2s.regs + S3C2410_IISMOD);
26+ s3c24xx_i2s.iisfcon=readl(s3c24xx_i2s.regs + S3C2410_IISFCON);
27+ s3c24xx_i2s.iispsr=readl(s3c24xx_i2s.regs + S3C2410_IISPSR);
28+
29+ clk_disable(s3c24xx_i2s.iis_clk);
30+
31+ return 0;
32+}
33+
34+int s3c24xx_i2s_resume(struct platform_device *pdev,
35+ struct snd_soc_cpu_dai *cpu_dai)
36+{
37+ clk_enable(s3c24xx_i2s.iis_clk);
38+
39+ writel(s3c24xx_i2s.iiscon, s3c24xx_i2s.regs + S3C2410_IISCON);
40+ writel(s3c24xx_i2s.iismod, s3c24xx_i2s.regs + S3C2410_IISMOD);
41+ writel(s3c24xx_i2s.iisfcon, s3c24xx_i2s.regs + S3C2410_IISFCON);
42+ writel(s3c24xx_i2s.iispsr, s3c24xx_i2s.regs + S3C2410_IISPSR);
43+
44+ return 0;
45+}
46+#else
47+#define s3c24xx_i2s_suspend NULL
48+#define s3c24xx_i2s_resume NULL
49+#endif
50+
51+
52 #define S3C24XX_I2S_RATES \
53 (SNDRV_PCM_RATE_8000 | SNDRV_PCM_RATE_11025 | SNDRV_PCM_RATE_16000 | \
54 SNDRV_PCM_RATE_22050 | SNDRV_PCM_RATE_32000 | SNDRV_PCM_RATE_44100 | \
55@@ -414,6 +450,8 @@
56 .id = 0,
57 .type = SND_SOC_DAI_I2S,
58 .probe = s3c24xx_i2s_probe,
59+ .suspend = s3c24xx_i2s_suspend,
60+ .resume = s3c24xx_i2s_resume,
61 .playback = {
62 .channels_min = 2,
63 .channels_max = 2,
diff --git a/meta/packages/linux/linux-openmoko/s3c24xx-pcm-suspend.patch b/meta/packages/linux/linux-openmoko/s3c24xx-pcm-suspend.patch
new file mode 100644
index 0000000000..fffc685a4e
--- /dev/null
+++ b/meta/packages/linux/linux-openmoko/s3c24xx-pcm-suspend.patch
@@ -0,0 +1,73 @@
1Index: linux-2.6.22/sound/soc/s3c24xx/s3c24xx-pcm.c
2===================================================================
3--- linux-2.6.22.orig/sound/soc/s3c24xx/s3c24xx-pcm.c 2007-11-09 16:28:43.000000000 +0000
4+++ linux-2.6.22/sound/soc/s3c24xx/s3c24xx-pcm.c 2007-11-09 16:33:05.000000000 +0000
5@@ -49,7 +49,9 @@
6 .info = SNDRV_PCM_INFO_INTERLEAVED |
7 SNDRV_PCM_INFO_BLOCK_TRANSFER |
8 SNDRV_PCM_INFO_MMAP |
9- SNDRV_PCM_INFO_MMAP_VALID,
10+ SNDRV_PCM_INFO_MMAP_VALID |
11+ SNDRV_PCM_INFO_PAUSE |
12+ SNDRV_PCM_INFO_RESUME,
13 .formats = SNDRV_PCM_FMTBIT_S16_LE |
14 SNDRV_PCM_FMTBIT_U16_LE |
15 SNDRV_PCM_FMTBIT_U8 |
16@@ -176,28 +178,6 @@
17 }
18 }
19
20- /* channel needs configuring for mem=>device, increment memory addr,
21- * sync to pclk, half-word transfers to the IIS-FIFO. */
22- if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
23- s3c2410_dma_devconfig(prtd->params->channel,
24- S3C2410_DMASRC_MEM, S3C2410_DISRCC_INC |
25- S3C2410_DISRCC_APB, prtd->params->dma_addr);
26-
27- s3c2410_dma_config(prtd->params->channel,
28- prtd->params->dma_size,
29- S3C2410_DCON_SYNC_PCLK |
30- S3C2410_DCON_HANDSHAKE);
31- } else {
32- s3c2410_dma_config(prtd->params->channel,
33- prtd->params->dma_size,
34- S3C2410_DCON_HANDSHAKE |
35- S3C2410_DCON_SYNC_PCLK);
36-
37- s3c2410_dma_devconfig(prtd->params->channel,
38- S3C2410_DMASRC_HW, 0x3,
39- prtd->params->dma_addr);
40- }
41-
42 s3c2410_dma_set_buffdone_fn(prtd->params->channel,
43 s3c24xx_audio_buffdone);
44
45@@ -246,6 +226,28 @@
46 if (!prtd->params)
47 return 0;
48
49+ /* channel needs configuring for mem=>device, increment memory addr,
50+ * sync to pclk, half-word transfers to the IIS-FIFO. */
51+ if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
52+ s3c2410_dma_devconfig(prtd->params->channel,
53+ S3C2410_DMASRC_MEM, S3C2410_DISRCC_INC |
54+ S3C2410_DISRCC_APB, prtd->params->dma_addr);
55+
56+ s3c2410_dma_config(prtd->params->channel,
57+ prtd->params->dma_size,
58+ S3C2410_DCON_SYNC_PCLK |
59+ S3C2410_DCON_HANDSHAKE);
60+ } else {
61+ s3c2410_dma_config(prtd->params->channel,
62+ prtd->params->dma_size,
63+ S3C2410_DCON_HANDSHAKE |
64+ S3C2410_DCON_SYNC_PCLK);
65+
66+ s3c2410_dma_devconfig(prtd->params->channel,
67+ S3C2410_DMASRC_HW, 0x3,
68+ prtd->params->dma_addr);
69+ }
70+
71 /* flush the DMA channel */
72 s3c2410_dma_ctrl(prtd->params->channel, S3C2410_DMAOP_FLUSH);
73 prtd->dma_loaded = 0;
diff --git a/meta/packages/linux/linux-openmoko/soc-core-suspend.patch b/meta/packages/linux/linux-openmoko/soc-core-suspend.patch
new file mode 100644
index 0000000000..7fb6cc7f7a
--- /dev/null
+++ b/meta/packages/linux/linux-openmoko/soc-core-suspend.patch
@@ -0,0 +1,47 @@
1From 6c868238a5e083dca4d74439a7fd467b5c7726b0 Mon Sep 17 00:00:00 2001
2From: Liam Girdwood <liam@localhost.localdomain>
3Date: Fri, 1 Jun 2007 12:56:55 +0100
4Subject: [PATCH] This fixes a bug whereby PCM's were not being suspended when the rest of the audio subsystem was suspended.
5
6---
7 include/sound/soc.h | 3 +++
8 sound/soc/soc-core.c | 8 ++++++++
9 2 files changed, 11 insertions(+), 0 deletions(-)
10
11Index: linux-2.6.22/include/sound/soc.h
12===================================================================
13--- linux-2.6.22.orig/include/sound/soc.h 2007-07-09 00:32:17.000000000 +0100
14+++ linux-2.6.22/include/sound/soc.h 2007-11-09 16:13:08.000000000 +0000
15@@ -411,6 +411,9 @@
16
17 /* codec/machine specific init - e.g. add machine controls */
18 int (*init)(struct snd_soc_codec *codec);
19+
20+ /* DAI pcm */
21+ struct snd_pcm *pcm;
22 };
23
24 /* SoC machine */
25Index: linux-2.6.22/sound/soc/soc-core.c
26===================================================================
27--- linux-2.6.22.orig/sound/soc/soc-core.c 2007-07-09 00:32:17.000000000 +0100
28+++ linux-2.6.22/sound/soc/soc-core.c 2007-11-09 16:18:45.000000000 +0000
29@@ -639,6 +639,10 @@
30 dai->dai_ops.digital_mute(dai, 1);
31 }
32
33+ /* suspend all pcm's */
34+ for(i = 0; i < machine->num_links; i++)
35+ snd_pcm_suspend_all(machine->dai_link[i].pcm);
36+
37 if (machine->suspend_pre)
38 machine->suspend_pre(pdev, state);
39
40@@ -873,6 +877,7 @@
41 return ret;
42 }
43
44+ dai_link->pcm = pcm;
45 pcm->private_data = rtd;
46 soc_pcm_ops.mmap = socdev->platform->pcm_ops->mmap;
47 soc_pcm_ops.pointer = socdev->platform->pcm_ops->pointer;
diff --git a/meta/packages/linux/linux-openmoko/tweak_power_button.patch b/meta/packages/linux/linux-openmoko/tweak_power_button.patch
new file mode 100644
index 0000000000..1929365756
--- /dev/null
+++ b/meta/packages/linux/linux-openmoko/tweak_power_button.patch
@@ -0,0 +1,32 @@
1Index: linux-2.6.22/drivers/i2c/chips/pcf50606.c
2===================================================================
3--- linux-2.6.22.orig/drivers/i2c/chips/pcf50606.c 2008-02-20 12:05:27.000000000 +0000
4+++ linux-2.6.22/drivers/i2c/chips/pcf50606.c 2008-02-20 12:15:24.000000000 +0000
5@@ -564,7 +564,8 @@
6 /* ONKEY falling edge (start of button press) */
7 DEBUGPC("ONKEYF ");
8 pcf->flags |= PCF50606_F_PWR_PRESSED;
9- input_report_key(pcf->input_dev, KEY_POWER, 1);
10+ input_report_key(pcf->input_dev, KEY_SUSPEND, 1);
11+ input_event(pcf->input_dev, EV_PWR, KEY_SUSPEND, 1);
12 }
13 if (int1 & PCF50606_INT1_ONKEY1S) {
14 /* ONKEY pressed for more than 1 second */
15@@ -582,7 +583,7 @@
16 DEBUGPC("ONKEYR ");
17 pcf->flags &= ~PCF50606_F_PWR_PRESSED;
18 pcf->onkey_seconds = -1;
19- input_report_key(pcf->input_dev, KEY_POWER, 0);
20+ input_report_key(pcf->input_dev, KEY_SUSPEND, 0);
21 /* disable SECOND interrupt in case RTC didn't
22 * request it */
23 if (!(pcf->flags & PCF50606_F_RTC_SECOND))
24@@ -1622,7 +1623,7 @@
25 data->input_dev->cdev.dev = &new_client->dev;
26
27 data->input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_PWR);
28- set_bit(KEY_POWER, data->input_dev->keybit);
29+ set_bit(KEY_SUSPEND, data->input_dev->keybit);
30 set_bit(KEY_POWER2, data->input_dev->keybit);
31 set_bit(KEY_BATTERY, data->input_dev->keybit);
32
diff --git a/meta/packages/linux/linux-openmoko_2.6.22.5.bb b/meta/packages/linux/linux-openmoko_2.6.22.5.bb
index a7f78fc977..65e8d459c1 100644
--- a/meta/packages/linux/linux-openmoko_2.6.22.5.bb
+++ b/meta/packages/linux/linux-openmoko_2.6.22.5.bb
@@ -9,7 +9,7 @@ KERNEL_RELEASE = "2.6.22.5"
9#PV = "${VANILLA_VERSION}+${KERNEL_RELEASE}-moko11+svnr${SRCREV}" 9#PV = "${VANILLA_VERSION}+${KERNEL_RELEASE}-moko11+svnr${SRCREV}"
10 10
11PV = "${KERNEL_RELEASE}-moko11+svnr${SRCREV}" 11PV = "${KERNEL_RELEASE}-moko11+svnr${SRCREV}"
12PR = "r7" 12PR = "r14"
13 13
14KERNEL_IMAGETYPE = "uImage" 14KERNEL_IMAGETYPE = "uImage"
15UBOOT_ENTRYPOINT = "30008000" 15UBOOT_ENTRYPOINT = "30008000"
@@ -24,14 +24,21 @@ SRC_URI = "${KERNELORG_MIRROR}/pub/linux/kernel/v2.6/linux-${VANILLA_VERSION}.ta
24 svn://svn.openmoko.org/trunk/src/target/kernel;module=patches;proto=http \ 24 svn://svn.openmoko.org/trunk/src/target/kernel;module=patches;proto=http \
25 file://fix-EVIOCGRAB-semantics-2.6.22.5.patch;patch=1 \ 25 file://fix-EVIOCGRAB-semantics-2.6.22.5.patch;patch=1 \
26 file://fix-gta01-flowcontrol2-2.6.22.5.patch;patch=1 \ 26 file://fix-gta01-flowcontrol2-2.6.22.5.patch;patch=1 \
27 file://gta-vibro-pwm-suspend.patch;patch=1 \
28 file://tweak_power_button.patch;patch=1 \
29 http://www.rpsys.net/openzaurus/patches/archive/input_power-r9.patch;patch=1 \
27 file://defconfig-${KERNEL_RELEASE}" 30 file://defconfig-${KERNEL_RELEASE}"
28 31
32# file://gta02-sound.patch;patch=1 \
33# file://soc-core-suspend.patch;patch=1 \
34# file://iis-suspend.patch;patch=1 \
35# file://s3c24xx-pcm-suspend.patch;patch=1 \
36
29S = "${WORKDIR}/linux-${VANILLA_VERSION}" 37S = "${WORKDIR}/linux-${VANILLA_VERSION}"
30 38
31############################################################## 39##############################################################
32# kernel image resides on a seperate flash partition (for now) 40# kernel image resides on a seperate flash partition (for now)
33# 41#
34FILES_kernel-image = ""
35ALLOW_EMPTY = "1" 42ALLOW_EMPTY = "1"
36 43
37COMPATIBLE_HOST = "arm.*-linux" 44COMPATIBLE_HOST = "arm.*-linux"
@@ -49,6 +56,10 @@ module_autoload_hci_usb = "hci_usb"
49module_autoload_g_ether = "g_ether" 56module_autoload_g_ether = "g_ether"
50# audio 57# audio
51module_autoload_snd-soc-neo1973-wm8753 = "snd-soc-neo1973-wm8753" 58module_autoload_snd-soc-neo1973-wm8753 = "snd-soc-neo1973-wm8753"
59module_autoload_snd-soc-neo1973-gta02-wm8753 = "snd-soc-neo1973-gta02-wm8753"
60module_autoload_snd-pcm-oss = "snd-pcm-oss"
61module_autoload_snd-mixer-oss = "snd-mixer-oss"
62
52# sd/mmc 63# sd/mmc
53module_autoload_s3cmci = "s3cmci" 64module_autoload_s3cmci = "s3cmci"
54 65