aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/arm/mach-pxa/include/mach/spitz.h22
-rw-r--r--arch/arm/mach-pxa/spitz.c66
-rw-r--r--arch/arm/mach-pxa/spitz_pm.c28
-rw-r--r--sound/soc/pxa/spitz.c33
4 files changed, 87 insertions, 62 deletions
diff --git a/arch/arm/mach-pxa/include/mach/spitz.h b/arch/arm/mach-pxa/include/mach/spitz.h
index d2fc22df0d7f..e9b3d33daed6 100644
--- a/arch/arm/mach-pxa/include/mach/spitz.h
+++ b/arch/arm/mach-pxa/include/mach/spitz.h
@@ -16,6 +16,7 @@
16#endif 16#endif
17 17
18#include <linux/fb.h> 18#include <linux/fb.h>
19#include <linux/gpio.h>
19 20
20/* Spitz/Akita GPIOs */ 21/* Spitz/Akita GPIOs */
21 22
@@ -107,6 +108,17 @@
107#define SPITZ_SCP_SUS_CLR (SPITZ_SCP_MUTE_L | SPITZ_SCP_MUTE_R | SPITZ_SCP_JK_A | SPITZ_SCP_ADC_TEMP_ON) 108#define SPITZ_SCP_SUS_CLR (SPITZ_SCP_MUTE_L | SPITZ_SCP_MUTE_R | SPITZ_SCP_JK_A | SPITZ_SCP_ADC_TEMP_ON)
108#define SPITZ_SCP_SUS_SET 0 109#define SPITZ_SCP_SUS_SET 0
109 110
111#define SPITZ_SCP_GPIO_BASE (NR_BUILTIN_GPIO)
112#define SPITZ_GPIO_LED_GREEN (SPITZ_SCP_GPIO_BASE + 0)
113#define SPITZ_GPIO_JK_B (SPITZ_SCP_GPIO_BASE + 1)
114#define SPITZ_GPIO_CHRG_ON (SPITZ_SCP_GPIO_BASE + 2)
115#define SPITZ_GPIO_MUTE_L (SPITZ_SCP_GPIO_BASE + 3)
116#define SPITZ_GPIO_MUTE_R (SPITZ_SCP_GPIO_BASE + 4)
117#define SPITZ_GPIO_CF_POWER (SPITZ_SCP_GPIO_BASE + 5)
118#define SPITZ_GPIO_LED_ORANGE (SPITZ_SCP_GPIO_BASE + 6)
119#define SPITZ_GPIO_JK_A (SPITZ_SCP_GPIO_BASE + 7)
120#define SPITZ_GPIO_ADC_TEMP_ON (SPITZ_SCP_GPIO_BASE + 8)
121
110/* Spitz Scoop Device (No. 2) GPIOs */ 122/* Spitz Scoop Device (No. 2) GPIOs */
111/* Suspend States in comments */ 123/* Suspend States in comments */
112#define SPITZ_SCP2_IR_ON SCOOP_GPCR_PA11 /* High */ 124#define SPITZ_SCP2_IR_ON SCOOP_GPCR_PA11 /* High */
@@ -128,6 +140,16 @@
128 SPITZ_SCP2_BACKLIGHT_CONT | SPITZ_SCP2_BACKLIGHT_ON | SPITZ_SCP2_MIC_BIAS) 140 SPITZ_SCP2_BACKLIGHT_CONT | SPITZ_SCP2_BACKLIGHT_ON | SPITZ_SCP2_MIC_BIAS)
129#define SPITZ_SCP2_SUS_SET (SPITZ_SCP2_IR_ON | SPITZ_SCP2_RESERVED_1) 141#define SPITZ_SCP2_SUS_SET (SPITZ_SCP2_IR_ON | SPITZ_SCP2_RESERVED_1)
130 142
143#define SPITZ_SCP2_GPIO_BASE (NR_BUILTIN_GPIO + 12)
144#define SPITZ_GPIO_IR_ON (SPITZ_SCP2_GPIO_BASE + 0)
145#define SPITZ_GPIO_AKIN_PULLUP (SPITZ_SCP2_GPIO_BASE + 1
146#define SPITZ_GPIO_RESERVED_1 (SPITZ_SCP2_GPIO_BASE + 2)
147#define SPITZ_GPIO_RESERVED_2 (SPITZ_SCP2_GPIO_BASE + 3)
148#define SPITZ_GPIO_RESERVED_3 (SPITZ_SCP2_GPIO_BASE + 4)
149#define SPITZ_GPIO_RESERVED_4 (SPITZ_SCP2_GPIO_BASE + 5)
150#define SPITZ_GPIO_BACKLIGHT_CONT (SPITZ_SCP2_GPIO_BASE + 6)
151#define SPITZ_GPIO_BACKLIGHT_ON (SPITZ_SCP2_GPIO_BASE + 7)
152#define SPITZ_GPIO_MIC_BIAS (SPITZ_SCP2_GPIO_BASE + 8)
131 153
132/* Spitz IRQ Definitions */ 154/* Spitz IRQ Definitions */
133 155
diff --git a/arch/arm/mach-pxa/spitz.c b/arch/arm/mach-pxa/spitz.c
index 8b06b7a749df..290008296e1b 100644
--- a/arch/arm/mach-pxa/spitz.c
+++ b/arch/arm/mach-pxa/spitz.c
@@ -134,10 +134,11 @@ static struct resource spitz_scoop_resources[] = {
134}; 134};
135 135
136static struct scoop_config spitz_scoop_setup = { 136static struct scoop_config spitz_scoop_setup = {
137 .io_dir = SPITZ_SCP_IO_DIR, 137 .io_dir = SPITZ_SCP_IO_DIR,
138 .io_out = SPITZ_SCP_IO_OUT, 138 .io_out = SPITZ_SCP_IO_OUT,
139 .suspend_clr = SPITZ_SCP_SUS_CLR, 139 .suspend_clr = SPITZ_SCP_SUS_CLR,
140 .suspend_set = SPITZ_SCP_SUS_SET, 140 .suspend_set = SPITZ_SCP_SUS_SET,
141 .gpio_base = SPITZ_SCP_GPIO_BASE,
141}; 142};
142 143
143struct platform_device spitzscoop_device = { 144struct platform_device spitzscoop_device = {
@@ -162,10 +163,11 @@ static struct resource spitz_scoop2_resources[] = {
162}; 163};
163 164
164static struct scoop_config spitz_scoop2_setup = { 165static struct scoop_config spitz_scoop2_setup = {
165 .io_dir = SPITZ_SCP2_IO_DIR, 166 .io_dir = SPITZ_SCP2_IO_DIR,
166 .io_out = SPITZ_SCP2_IO_OUT, 167 .io_out = SPITZ_SCP2_IO_OUT,
167 .suspend_clr = SPITZ_SCP2_SUS_CLR, 168 .suspend_clr = SPITZ_SCP2_SUS_CLR,
168 .suspend_set = SPITZ_SCP2_SUS_SET, 169 .suspend_set = SPITZ_SCP2_SUS_SET,
170 .gpio_base = SPITZ_SCP2_GPIO_BASE,
169}; 171};
170 172
171struct platform_device spitzscoop2_device = { 173struct platform_device spitzscoop2_device = {
@@ -187,7 +189,7 @@ static void spitz_card_pwr_ctrl(int device, unsigned short new_cpr)
187 unsigned short cpr = read_scoop_reg(&spitzscoop_device.dev, SCOOP_CPR); 189 unsigned short cpr = read_scoop_reg(&spitzscoop_device.dev, SCOOP_CPR);
188 190
189 if (new_cpr & 0x0007) { 191 if (new_cpr & 0x0007) {
190 set_scoop_gpio(&spitzscoop_device.dev, SPITZ_SCP_CF_POWER); 192 gpio_set_value(SPITZ_GPIO_CF_POWER, 1);
191 if (!(cpr & 0x0002) && !(cpr & 0x0004)) 193 if (!(cpr & 0x0002) && !(cpr & 0x0004))
192 mdelay(5); 194 mdelay(5);
193 if (device == SPITZ_PWR_CF) 195 if (device == SPITZ_PWR_CF)
@@ -203,7 +205,7 @@ static void spitz_card_pwr_ctrl(int device, unsigned short new_cpr)
203 if (!(cpr & 0x0002) && !(cpr & 0x0004)) { 205 if (!(cpr & 0x0002) && !(cpr & 0x0004)) {
204 write_scoop_reg(&spitzscoop_device.dev, SCOOP_CPR, 0x0000); 206 write_scoop_reg(&spitzscoop_device.dev, SCOOP_CPR, 0x0000);
205 mdelay(1); 207 mdelay(1);
206 reset_scoop_gpio(&spitzscoop_device.dev, SPITZ_SCP_CF_POWER); 208 gpio_set_value(SPITZ_GPIO_CF_POWER, 0);
207 } else { 209 } else {
208 write_scoop_reg(&spitzscoop_device.dev, SCOOP_CPR, cpr | new_cpr); 210 write_scoop_reg(&spitzscoop_device.dev, SCOOP_CPR, cpr | new_cpr);
209 } 211 }
@@ -283,16 +285,8 @@ static struct pxa2xx_spi_chip spitz_ads7846_chip = {
283static void spitz_notify_intensity(int intensity) 285static void spitz_notify_intensity(int intensity)
284{ 286{
285 if (machine_is_spitz() || machine_is_borzoi()) { 287 if (machine_is_spitz() || machine_is_borzoi()) {
286 /* Bit 5 is via SCOOP */ 288 gpio_set_value(SPITZ_GPIO_BACKLIGHT_CONT, !(intensity & 0x20));
287 if (intensity & 0x0020) 289 gpio_set_value(SPITZ_GPIO_BACKLIGHT_ON, intensity);
288 reset_scoop_gpio(&spitzscoop2_device.dev, SPITZ_SCP2_BACKLIGHT_CONT);
289 else
290 set_scoop_gpio(&spitzscoop2_device.dev, SPITZ_SCP2_BACKLIGHT_CONT);
291
292 if (intensity)
293 set_scoop_gpio(&spitzscoop2_device.dev, SPITZ_SCP2_BACKLIGHT_ON);
294 else
295 reset_scoop_gpio(&spitzscoop2_device.dev, SPITZ_SCP2_BACKLIGHT_ON);
296 return; 290 return;
297 } 291 }
298 292
@@ -515,12 +509,34 @@ static struct pxaohci_platform_data spitz_ohci_platform_data = {
515/* 509/*
516 * Irda 510 * Irda
517 */ 511 */
512static int spitz_irda_startup(struct device *dev)
513{
514 int rc;
515
516 rc = gpio_request(SPITZ_GPIO_IR_ON, "IrDA on");
517 if (rc)
518 goto err;
519
520 rc = gpio_direction_output(SPITZ_GPIO_IR_ON, 1);
521 if (rc)
522 goto err_dir;
523
524 return 0;
525
526err_dir:
527 gpio_free(SPITZ_GPIO_IR_ON);
528err:
529 return rc;
530}
531
532static void spitz_irda_shutdown(struct device *dev)
533{
534 gpio_free(SPITZ_GPIO_IR_ON);
535}
536
518static void spitz_irda_transceiver_mode(struct device *dev, int mode) 537static void spitz_irda_transceiver_mode(struct device *dev, int mode)
519{ 538{
520 if (mode & IR_OFF) 539 gpio_set_value(SPITZ_GPIO_IR_ON, mode & IR_OFF);
521 set_scoop_gpio(&spitzscoop2_device.dev, SPITZ_SCP2_IR_ON);
522 else
523 reset_scoop_gpio(&spitzscoop2_device.dev, SPITZ_SCP2_IR_ON);
524 pxa2xx_transceiver_mode(dev, mode); 540 pxa2xx_transceiver_mode(dev, mode);
525} 541}
526 542
@@ -536,8 +552,10 @@ static void akita_irda_transceiver_mode(struct device *dev, int mode)
536#endif 552#endif
537 553
538static struct pxaficp_platform_data spitz_ficp_platform_data = { 554static struct pxaficp_platform_data spitz_ficp_platform_data = {
539 .transceiver_cap = IR_SIRMODE | IR_OFF, 555 .transceiver_cap = IR_SIRMODE | IR_OFF,
540 .transceiver_mode = spitz_irda_transceiver_mode, 556 .transceiver_mode = spitz_irda_transceiver_mode,
557 .startup = spitz_irda_startup,
558 .shutdown = spitz_irda_shutdown,
541}; 559};
542 560
543 561
diff --git a/arch/arm/mach-pxa/spitz_pm.c b/arch/arm/mach-pxa/spitz_pm.c
index 8a40505dfd28..53018db106ac 100644
--- a/arch/arm/mach-pxa/spitz_pm.c
+++ b/arch/arm/mach-pxa/spitz_pm.c
@@ -21,7 +21,6 @@
21#include <asm/irq.h> 21#include <asm/irq.h>
22#include <asm/mach-types.h> 22#include <asm/mach-types.h>
23#include <mach/hardware.h> 23#include <mach/hardware.h>
24#include <asm/hardware/scoop.h>
25 24
26#include <mach/sharpsl.h> 25#include <mach/sharpsl.h>
27#include <mach/spitz.h> 26#include <mach/spitz.h>
@@ -48,44 +47,35 @@ static void spitz_charger_init(void)
48 47
49static void spitz_measure_temp(int on) 48static void spitz_measure_temp(int on)
50{ 49{
51 if (on) 50 gpio_set_value(SPITZ_GPIO_ADC_TEMP_ON, on);
52 set_scoop_gpio(&spitzscoop_device.dev, SPITZ_SCP_ADC_TEMP_ON);
53 else
54 reset_scoop_gpio(&spitzscoop_device.dev, SPITZ_SCP_ADC_TEMP_ON);
55} 51}
56 52
57static void spitz_charge(int on) 53static void spitz_charge(int on)
58{ 54{
59 if (on) { 55 if (on) {
60 if (sharpsl_pm.flags & SHARPSL_SUSPENDED) { 56 if (sharpsl_pm.flags & SHARPSL_SUSPENDED) {
61 set_scoop_gpio(&spitzscoop_device.dev, SPITZ_SCP_JK_B); 57 gpio_set_value(SPITZ_GPIO_JK_B, 1);
62 reset_scoop_gpio(&spitzscoop_device.dev, SPITZ_SCP_CHRG_ON); 58 gpio_set_value(SPITZ_GPIO_CHRG_ON, 0);
63 } else { 59 } else {
64 reset_scoop_gpio(&spitzscoop_device.dev, SPITZ_SCP_JK_B); 60 gpio_set_value(SPITZ_GPIO_JK_B, 0);
65 reset_scoop_gpio(&spitzscoop_device.dev, SPITZ_SCP_CHRG_ON); 61 gpio_set_value(SPITZ_GPIO_CHRG_ON, 0);
66 } 62 }
67 } else { 63 } else {
68 reset_scoop_gpio(&spitzscoop_device.dev, SPITZ_SCP_JK_B); 64 gpio_set_value(SPITZ_GPIO_JK_B, 0);
69 set_scoop_gpio(&spitzscoop_device.dev, SPITZ_SCP_CHRG_ON); 65 gpio_set_value(SPITZ_GPIO_CHRG_ON, 1);
70 } 66 }
71} 67}
72 68
73static void spitz_discharge(int on) 69static void spitz_discharge(int on)
74{ 70{
75 if (on) 71 gpio_set_value(SPITZ_GPIO_JK_A, on);
76 set_scoop_gpio(&spitzscoop_device.dev, SPITZ_SCP_JK_A);
77 else
78 reset_scoop_gpio(&spitzscoop_device.dev, SPITZ_SCP_JK_A);
79} 72}
80 73
81/* HACK - For unknown reasons, accurate voltage readings are only made with a load 74/* HACK - For unknown reasons, accurate voltage readings are only made with a load
82 on the power bus which the green led on spitz provides */ 75 on the power bus which the green led on spitz provides */
83static void spitz_discharge1(int on) 76static void spitz_discharge1(int on)
84{ 77{
85 if (on) 78 gpio_set_value(SPITZ_GPIO_LED_GREEN, on);
86 set_scoop_gpio(&spitzscoop_device.dev, SPITZ_SCP_LED_GREEN);
87 else
88 reset_scoop_gpio(&spitzscoop_device.dev, SPITZ_SCP_LED_GREEN);
89} 79}
90 80
91static void spitz_presuspend(void) 81static void spitz_presuspend(void)
diff --git a/sound/soc/pxa/spitz.c b/sound/soc/pxa/spitz.c
index 37cb768fc933..acfa712844e2 100644
--- a/sound/soc/pxa/spitz.c
+++ b/sound/soc/pxa/spitz.c
@@ -19,13 +19,13 @@
19#include <linux/timer.h> 19#include <linux/timer.h>
20#include <linux/interrupt.h> 20#include <linux/interrupt.h>
21#include <linux/platform_device.h> 21#include <linux/platform_device.h>
22#include <linux/gpio.h>
22#include <sound/core.h> 23#include <sound/core.h>
23#include <sound/pcm.h> 24#include <sound/pcm.h>
24#include <sound/soc.h> 25#include <sound/soc.h>
25#include <sound/soc-dapm.h> 26#include <sound/soc-dapm.h>
26 27
27#include <asm/mach-types.h> 28#include <asm/mach-types.h>
28#include <asm/hardware/scoop.h>
29#include <mach/pxa-regs.h> 29#include <mach/pxa-regs.h>
30#include <mach/hardware.h> 30#include <mach/hardware.h>
31#include <mach/akita.h> 31#include <mach/akita.h>
@@ -63,8 +63,8 @@ static void spitz_ext_control(struct snd_soc_codec *codec)
63 snd_soc_dapm_disable_pin(codec, "Mic Jack"); 63 snd_soc_dapm_disable_pin(codec, "Mic Jack");
64 snd_soc_dapm_disable_pin(codec, "Line Jack"); 64 snd_soc_dapm_disable_pin(codec, "Line Jack");
65 snd_soc_dapm_enable_pin(codec, "Headphone Jack"); 65 snd_soc_dapm_enable_pin(codec, "Headphone Jack");
66 set_scoop_gpio(&spitzscoop_device.dev, SPITZ_SCP_MUTE_L); 66 gpio_set_value(SPITZ_GPIO_MUTE_L, 1);
67 set_scoop_gpio(&spitzscoop_device.dev, SPITZ_SCP_MUTE_R); 67 gpio_set_value(SPITZ_GPIO_MUTE_R, 1);
68 break; 68 break;
69 case SPITZ_MIC: 69 case SPITZ_MIC:
70 /* enable mic jack and bias, mute hp */ 70 /* enable mic jack and bias, mute hp */
@@ -72,8 +72,8 @@ static void spitz_ext_control(struct snd_soc_codec *codec)
72 snd_soc_dapm_disable_pin(codec, "Headset Jack"); 72 snd_soc_dapm_disable_pin(codec, "Headset Jack");
73 snd_soc_dapm_disable_pin(codec, "Line Jack"); 73 snd_soc_dapm_disable_pin(codec, "Line Jack");
74 snd_soc_dapm_enable_pin(codec, "Mic Jack"); 74 snd_soc_dapm_enable_pin(codec, "Mic Jack");
75 reset_scoop_gpio(&spitzscoop_device.dev, SPITZ_SCP_MUTE_L); 75 gpio_set_value(SPITZ_GPIO_MUTE_L, 0);
76 reset_scoop_gpio(&spitzscoop_device.dev, SPITZ_SCP_MUTE_R); 76 gpio_set_value(SPITZ_GPIO_MUTE_R, 0);
77 break; 77 break;
78 case SPITZ_LINE: 78 case SPITZ_LINE:
79 /* enable line jack, disable mic bias and mute hp */ 79 /* enable line jack, disable mic bias and mute hp */
@@ -81,8 +81,8 @@ static void spitz_ext_control(struct snd_soc_codec *codec)
81 snd_soc_dapm_disable_pin(codec, "Headset Jack"); 81 snd_soc_dapm_disable_pin(codec, "Headset Jack");
82 snd_soc_dapm_disable_pin(codec, "Mic Jack"); 82 snd_soc_dapm_disable_pin(codec, "Mic Jack");
83 snd_soc_dapm_enable_pin(codec, "Line Jack"); 83 snd_soc_dapm_enable_pin(codec, "Line Jack");
84 reset_scoop_gpio(&spitzscoop_device.dev, SPITZ_SCP_MUTE_L); 84 gpio_set_value(SPITZ_GPIO_MUTE_L, 0);
85 reset_scoop_gpio(&spitzscoop_device.dev, SPITZ_SCP_MUTE_R); 85 gpio_set_value(SPITZ_GPIO_MUTE_R, 0);
86 break; 86 break;
87 case SPITZ_HEADSET: 87 case SPITZ_HEADSET:
88 /* enable and unmute headset jack enable mic bias, mute L hp */ 88 /* enable and unmute headset jack enable mic bias, mute L hp */
@@ -90,8 +90,8 @@ static void spitz_ext_control(struct snd_soc_codec *codec)
90 snd_soc_dapm_enable_pin(codec, "Mic Jack"); 90 snd_soc_dapm_enable_pin(codec, "Mic Jack");
91 snd_soc_dapm_disable_pin(codec, "Line Jack"); 91 snd_soc_dapm_disable_pin(codec, "Line Jack");
92 snd_soc_dapm_enable_pin(codec, "Headset Jack"); 92 snd_soc_dapm_enable_pin(codec, "Headset Jack");
93 reset_scoop_gpio(&spitzscoop_device.dev, SPITZ_SCP_MUTE_L); 93 gpio_set_value(SPITZ_GPIO_MUTE_L, 0);
94 set_scoop_gpio(&spitzscoop_device.dev, SPITZ_SCP_MUTE_R); 94 gpio_set_value(SPITZ_GPIO_MUTE_R, 1);
95 break; 95 break;
96 case SPITZ_HP_OFF: 96 case SPITZ_HP_OFF:
97 97
@@ -100,8 +100,8 @@ static void spitz_ext_control(struct snd_soc_codec *codec)
100 snd_soc_dapm_disable_pin(codec, "Headset Jack"); 100 snd_soc_dapm_disable_pin(codec, "Headset Jack");
101 snd_soc_dapm_disable_pin(codec, "Mic Jack"); 101 snd_soc_dapm_disable_pin(codec, "Mic Jack");
102 snd_soc_dapm_disable_pin(codec, "Line Jack"); 102 snd_soc_dapm_disable_pin(codec, "Line Jack");
103 reset_scoop_gpio(&spitzscoop_device.dev, SPITZ_SCP_MUTE_L); 103 gpio_set_value(SPITZ_GPIO_MUTE_L, 0);
104 reset_scoop_gpio(&spitzscoop_device.dev, SPITZ_SCP_MUTE_R); 104 gpio_set_value(SPITZ_GPIO_MUTE_R, 0);
105 break; 105 break;
106 } 106 }
107 snd_soc_dapm_sync(codec); 107 snd_soc_dapm_sync(codec);
@@ -215,14 +215,9 @@ static int spitz_set_spk(struct snd_kcontrol *kcontrol,
215static int spitz_mic_bias(struct snd_soc_dapm_widget *w, 215static int spitz_mic_bias(struct snd_soc_dapm_widget *w,
216 struct snd_kcontrol *k, int event) 216 struct snd_kcontrol *k, int event)
217{ 217{
218 if (machine_is_borzoi() || machine_is_spitz()) { 218 if (machine_is_borzoi() || machine_is_spitz())
219 if (SND_SOC_DAPM_EVENT_ON(event)) 219 gpio_set_value(SPITZ_GPIO_MIC_BIAS,
220 set_scoop_gpio(&spitzscoop2_device.dev, 220 SND_SOC_DAPM_EVENT_ON(event));
221 SPITZ_SCP2_MIC_BIAS);
222 else
223 reset_scoop_gpio(&spitzscoop2_device.dev,
224 SPITZ_SCP2_MIC_BIAS);
225 }
226 221
227 if (machine_is_akita()) { 222 if (machine_is_akita()) {
228 if (SND_SOC_DAPM_EVENT_ON(event)) 223 if (SND_SOC_DAPM_EVENT_ON(event))