aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/arm/mach-omap1/Kconfig2
-rw-r--r--arch/arm/mach-omap1/board-ams-delta.c116
-rw-r--r--arch/arm/plat-omap/include/plat/board-ams-delta.h1
-rw-r--r--drivers/input/serio/ams_delta_serio.c2
-rw-r--r--drivers/mtd/nand/ams-delta.c2
-rw-r--r--drivers/video/omap/lcd_ams_delta.c2
-rw-r--r--sound/soc/omap/ams-delta.c32
7 files changed, 101 insertions, 56 deletions
diff --git a/arch/arm/mach-omap1/Kconfig b/arch/arm/mach-omap1/Kconfig
index 5b1edbae6893..4b6a774606cb 100644
--- a/arch/arm/mach-omap1/Kconfig
+++ b/arch/arm/mach-omap1/Kconfig
@@ -157,6 +157,8 @@ config MACH_AMS_DELTA
157 select FIQ 157 select FIQ
158 select GPIO_GENERIC_PLATFORM 158 select GPIO_GENERIC_PLATFORM
159 select LEDS_GPIO_REGISTER 159 select LEDS_GPIO_REGISTER
160 select REGULATOR
161 select REGULATOR_FIXED_VOLTAGE
160 help 162 help
161 Support for the Amstrad E3 (codename Delta) videophone. Say Y here 163 Support for the Amstrad E3 (codename Delta) videophone. Say Y here
162 if you have such a device. 164 if you have such a device.
diff --git a/arch/arm/mach-omap1/board-ams-delta.c b/arch/arm/mach-omap1/board-ams-delta.c
index 87b13039f936..cb6afe670468 100644
--- a/arch/arm/mach-omap1/board-ams-delta.c
+++ b/arch/arm/mach-omap1/board-ams-delta.c
@@ -19,6 +19,9 @@
19#include <linux/interrupt.h> 19#include <linux/interrupt.h>
20#include <linux/leds.h> 20#include <linux/leds.h>
21#include <linux/platform_device.h> 21#include <linux/platform_device.h>
22#include <linux/regulator/consumer.h>
23#include <linux/regulator/fixed.h>
24#include <linux/regulator/machine.h>
22#include <linux/serial_8250.h> 25#include <linux/serial_8250.h>
23#include <linux/export.h> 26#include <linux/export.h>
24 27
@@ -150,11 +153,11 @@ static struct map_desc ams_delta_io_desc[] __initdata = {
150 } 153 }
151}; 154};
152 155
153static struct omap_lcd_config ams_delta_lcd_config = { 156static struct omap_lcd_config ams_delta_lcd_config __initdata = {
154 .ctrl_name = "internal", 157 .ctrl_name = "internal",
155}; 158};
156 159
157static struct omap_usb_config ams_delta_usb_config __initdata = { 160static struct omap_usb_config ams_delta_usb_config = {
158 .register_host = 1, 161 .register_host = 1,
159 .hmc_mode = 16, 162 .hmc_mode = 16,
160 .pins[0] = 2, 163 .pins[0] = 2,
@@ -167,7 +170,7 @@ static struct omap_board_config_kernel ams_delta_config[] __initdata = {
167#define LATCH1_GPIO_BASE 232 170#define LATCH1_GPIO_BASE 232
168#define LATCH1_NGPIO 8 171#define LATCH1_NGPIO 8
169 172
170static struct resource latch1_resources[] __initconst = { 173static struct resource latch1_resources[] = {
171 [0] = { 174 [0] = {
172 .name = "dat", 175 .name = "dat",
173 .start = LATCH1_PHYS, 176 .start = LATCH1_PHYS,
@@ -176,7 +179,7 @@ static struct resource latch1_resources[] __initconst = {
176 }, 179 },
177}; 180};
178 181
179static struct bgpio_pdata latch1_pdata __initconst = { 182static struct bgpio_pdata latch1_pdata = {
180 .base = LATCH1_GPIO_BASE, 183 .base = LATCH1_GPIO_BASE,
181 .ngpio = LATCH1_NGPIO, 184 .ngpio = LATCH1_NGPIO,
182}; 185};
@@ -191,7 +194,7 @@ static struct platform_device latch1_gpio_device = {
191 }, 194 },
192}; 195};
193 196
194static struct resource latch2_resources[] __initconst = { 197static struct resource latch2_resources[] = {
195 [0] = { 198 [0] = {
196 .name = "dat", 199 .name = "dat",
197 .start = LATCH2_PHYS, 200 .start = LATCH2_PHYS,
@@ -200,7 +203,7 @@ static struct resource latch2_resources[] __initconst = {
200 }, 203 },
201}; 204};
202 205
203static struct bgpio_pdata latch2_pdata __initconst = { 206static struct bgpio_pdata latch2_pdata = {
204 .base = AMS_DELTA_LATCH2_GPIO_BASE, 207 .base = AMS_DELTA_LATCH2_GPIO_BASE,
205 .ngpio = AMS_DELTA_LATCH2_NGPIO, 208 .ngpio = AMS_DELTA_LATCH2_NGPIO,
206}; 209};
@@ -215,7 +218,7 @@ static struct platform_device latch2_gpio_device = {
215 }, 218 },
216}; 219};
217 220
218static struct gpio latch_gpios[] __initconst = { 221static const struct gpio latch_gpios[] __initconst = {
219 { 222 {
220 .gpio = LATCH1_GPIO_BASE + 6, 223 .gpio = LATCH1_GPIO_BASE + 6,
221 .flags = GPIOF_OUT_INIT_LOW, 224 .flags = GPIOF_OUT_INIT_LOW,
@@ -237,11 +240,6 @@ static struct gpio latch_gpios[] __initconst = {
237 .label = "scard_cmdvcc", 240 .label = "scard_cmdvcc",
238 }, 241 },
239 { 242 {
240 .gpio = AMS_DELTA_GPIO_PIN_MODEM_NRESET,
241 .flags = GPIOF_OUT_INIT_LOW,
242 .label = "modem_nreset",
243 },
244 {
245 .gpio = AMS_DELTA_GPIO_PIN_MODEM_CODEC, 243 .gpio = AMS_DELTA_GPIO_PIN_MODEM_CODEC,
246 .flags = GPIOF_OUT_INIT_LOW, 244 .flags = GPIOF_OUT_INIT_LOW,
247 .label = "modem_codec", 245 .label = "modem_codec",
@@ -258,6 +256,44 @@ static struct gpio latch_gpios[] __initconst = {
258 }, 256 },
259}; 257};
260 258
259static struct regulator_consumer_supply modem_nreset_consumers[] = {
260 REGULATOR_SUPPLY("RESET#", "serial8250.1"),
261 REGULATOR_SUPPLY("POR", "cx20442-codec"),
262};
263
264static struct regulator_init_data modem_nreset_data = {
265 .constraints = {
266 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
267 .boot_on = 1,
268 },
269 .num_consumer_supplies = ARRAY_SIZE(modem_nreset_consumers),
270 .consumer_supplies = modem_nreset_consumers,
271};
272
273static struct fixed_voltage_config modem_nreset_config = {
274 .supply_name = "modem_nreset",
275 .microvolts = 3300000,
276 .gpio = AMS_DELTA_GPIO_PIN_MODEM_NRESET,
277 .startup_delay = 25000,
278 .enable_high = 1,
279 .enabled_at_boot = 1,
280 .init_data = &modem_nreset_data,
281};
282
283static struct platform_device modem_nreset_device = {
284 .name = "reg-fixed-voltage",
285 .id = -1,
286 .dev = {
287 .platform_data = &modem_nreset_config,
288 },
289};
290
291struct modem_private_data {
292 struct regulator *regulator;
293};
294
295static struct modem_private_data modem_priv;
296
261void ams_delta_latch_write(int base, int ngpio, u16 mask, u16 value) 297void ams_delta_latch_write(int base, int ngpio, u16 mask, u16 value)
262{ 298{
263 int bit = 0; 299 int bit = 0;
@@ -266,7 +302,8 @@ void ams_delta_latch_write(int base, int ngpio, u16 mask, u16 value)
266 for (; bit < ngpio; bit++, bitpos = bitpos << 1) { 302 for (; bit < ngpio; bit++, bitpos = bitpos << 1) {
267 if (!(mask & bitpos)) 303 if (!(mask & bitpos))
268 continue; 304 continue;
269 gpio_set_value(base + bit, (value & bitpos) != 0); 305 else
306 gpio_set_value(base + bit, (value & bitpos) != 0);
270 } 307 }
271} 308}
272EXPORT_SYMBOL(ams_delta_latch_write); 309EXPORT_SYMBOL(ams_delta_latch_write);
@@ -300,7 +337,7 @@ static const struct matrix_keymap_data ams_delta_keymap_data = {
300 .keymap_size = ARRAY_SIZE(ams_delta_keymap), 337 .keymap_size = ARRAY_SIZE(ams_delta_keymap),
301}; 338};
302 339
303static struct omap_kp_platform_data ams_delta_kp_data __initdata = { 340static struct omap_kp_platform_data ams_delta_kp_data = {
304 .rows = 8, 341 .rows = 8,
305 .cols = 8, 342 .cols = 8,
306 .keymap_data = &ams_delta_keymap_data, 343 .keymap_data = &ams_delta_keymap_data,
@@ -322,7 +359,7 @@ static struct platform_device ams_delta_lcd_device = {
322 .id = -1, 359 .id = -1,
323}; 360};
324 361
325static struct gpio_led gpio_leds[] __initconst = { 362static const struct gpio_led gpio_leds[] __initconst = {
326 { 363 {
327 .name = "camera", 364 .name = "camera",
328 .gpio = LATCH1_GPIO_BASE + 0, 365 .gpio = LATCH1_GPIO_BASE + 0,
@@ -358,7 +395,7 @@ static struct gpio_led gpio_leds[] __initconst = {
358 }, 395 },
359}; 396};
360 397
361static struct gpio_led_platform_data leds_pdata __initconst = { 398static const struct gpio_led_platform_data leds_pdata __initconst = {
362 .leds = gpio_leds, 399 .leds = gpio_leds,
363 .num_leds = ARRAY_SIZE(gpio_leds), 400 .num_leds = ARRAY_SIZE(gpio_leds),
364}; 401};
@@ -415,7 +452,7 @@ static struct platform_device *ams_delta_devices[] __initdata = {
415 &ams_delta_camera_device, 452 &ams_delta_camera_device,
416}; 453};
417 454
418static struct platform_device *late_devices[] __initconst = { 455static struct platform_device *late_devices[] __initdata = {
419 &ams_delta_nand_device, 456 &ams_delta_nand_device,
420 &ams_delta_lcd_device, 457 &ams_delta_lcd_device,
421}; 458};
@@ -459,6 +496,22 @@ static void __init ams_delta_init(void)
459 omap_writew(omap_readw(ARM_RSTCT1) | 0x0004, ARM_RSTCT1); 496 omap_writew(omap_readw(ARM_RSTCT1) | 0x0004, ARM_RSTCT1);
460} 497}
461 498
499static void modem_pm(struct uart_port *port, unsigned int state, unsigned old)
500{
501 struct modem_private_data *priv = port->private_data;
502
503 if (IS_ERR(priv->regulator))
504 return;
505
506 if (state == old)
507 return;
508
509 if (state == 0)
510 regulator_enable(priv->regulator);
511 else if (old == 0)
512 regulator_disable(priv->regulator);
513}
514
462static struct plat_serial8250_port ams_delta_modem_ports[] = { 515static struct plat_serial8250_port ams_delta_modem_ports[] = {
463 { 516 {
464 .membase = IOMEM(MODEM_VIRT), 517 .membase = IOMEM(MODEM_VIRT),
@@ -469,6 +522,8 @@ static struct plat_serial8250_port ams_delta_modem_ports[] = {
469 .iotype = UPIO_MEM, 522 .iotype = UPIO_MEM,
470 .regshift = 1, 523 .regshift = 1,
471 .uartclk = BASE_BAUD * 16, 524 .uartclk = BASE_BAUD * 16,
525 .pm = modem_pm,
526 .private_data = &modem_priv,
472 }, 527 },
473 { }, 528 { },
474}; 529};
@@ -496,6 +551,12 @@ static int __init late_init(void)
496 551
497 platform_add_devices(late_devices, ARRAY_SIZE(late_devices)); 552 platform_add_devices(late_devices, ARRAY_SIZE(late_devices));
498 553
554 err = platform_device_register(&modem_nreset_device);
555 if (err) {
556 pr_err("Couldn't register the modem regulator device\n");
557 return err;
558 }
559
499 omap_cfg_reg(M14_1510_GPIO2); 560 omap_cfg_reg(M14_1510_GPIO2);
500 ams_delta_modem_ports[0].irq = 561 ams_delta_modem_ports[0].irq =
501 gpio_to_irq(AMS_DELTA_GPIO_PIN_MODEM_IRQ); 562 gpio_to_irq(AMS_DELTA_GPIO_PIN_MODEM_IRQ);
@@ -507,15 +568,30 @@ static int __init late_init(void)
507 } 568 }
508 gpio_direction_input(AMS_DELTA_GPIO_PIN_MODEM_IRQ); 569 gpio_direction_input(AMS_DELTA_GPIO_PIN_MODEM_IRQ);
509 570
510 ams_delta_latch2_write( 571 /* Initialize the modem_nreset regulator consumer before use */
511 AMS_DELTA_LATCH2_MODEM_NRESET | AMS_DELTA_LATCH2_MODEM_CODEC, 572 modem_priv.regulator = ERR_PTR(-ENODEV);
512 AMS_DELTA_LATCH2_MODEM_NRESET | AMS_DELTA_LATCH2_MODEM_CODEC); 573
574 ams_delta_latch2_write(AMS_DELTA_LATCH2_MODEM_CODEC,
575 AMS_DELTA_LATCH2_MODEM_CODEC);
513 576
514 err = platform_device_register(&ams_delta_modem_device); 577 err = platform_device_register(&ams_delta_modem_device);
515 if (err) 578 if (err)
516 goto gpio_free; 579 goto gpio_free;
580
581 /*
582 * Once the modem device is registered, the modem_nreset
583 * regulator can be requested on behalf of that device.
584 */
585 modem_priv.regulator = regulator_get(&ams_delta_modem_device.dev,
586 "RESET#");
587 if (IS_ERR(modem_priv.regulator)) {
588 err = PTR_ERR(modem_priv.regulator);
589 goto unregister;
590 }
517 return 0; 591 return 0;
518 592
593unregister:
594 platform_device_unregister(&ams_delta_modem_device);
519gpio_free: 595gpio_free:
520 gpio_free(AMS_DELTA_GPIO_PIN_MODEM_IRQ); 596 gpio_free(AMS_DELTA_GPIO_PIN_MODEM_IRQ);
521 return err; 597 return err;
diff --git a/arch/arm/plat-omap/include/plat/board-ams-delta.h b/arch/arm/plat-omap/include/plat/board-ams-delta.h
index 027e79eead5e..ad6f865d1f16 100644
--- a/arch/arm/plat-omap/include/plat/board-ams-delta.h
+++ b/arch/arm/plat-omap/include/plat/board-ams-delta.h
@@ -30,7 +30,6 @@
30 30
31#define AMD_DELTA_LATCH2_SCARD_RSTIN 0x0400 31#define AMD_DELTA_LATCH2_SCARD_RSTIN 0x0400
32#define AMD_DELTA_LATCH2_SCARD_CMDVCC 0x0800 32#define AMD_DELTA_LATCH2_SCARD_CMDVCC 0x0800
33#define AMS_DELTA_LATCH2_MODEM_NRESET 0x1000
34#define AMS_DELTA_LATCH2_MODEM_CODEC 0x2000 33#define AMS_DELTA_LATCH2_MODEM_CODEC 0x2000
35 34
36#define AMS_DELTA_GPIO_PIN_KEYBRD_DATA 0 35#define AMS_DELTA_GPIO_PIN_KEYBRD_DATA 0
diff --git a/drivers/input/serio/ams_delta_serio.c b/drivers/input/serio/ams_delta_serio.c
index 0571e2ec358b..bd5b10eeeb40 100644
--- a/drivers/input/serio/ams_delta_serio.c
+++ b/drivers/input/serio/ams_delta_serio.c
@@ -103,7 +103,7 @@ static void ams_delta_serio_close(struct serio *serio)
103 gpio_set_value(AMS_DELTA_GPIO_PIN_KEYBRD_PWR, 0); 103 gpio_set_value(AMS_DELTA_GPIO_PIN_KEYBRD_PWR, 0);
104} 104}
105 105
106static struct gpio ams_delta_gpios[] __initconst_or_module = { 106static const struct gpio ams_delta_gpios[] __initconst_or_module = {
107 { 107 {
108 .gpio = AMS_DELTA_GPIO_PIN_KEYBRD_DATA, 108 .gpio = AMS_DELTA_GPIO_PIN_KEYBRD_DATA,
109 .flags = GPIOF_DIR_IN, 109 .flags = GPIOF_DIR_IN,
diff --git a/drivers/mtd/nand/ams-delta.c b/drivers/mtd/nand/ams-delta.c
index 85934dc8546f..73416951f4c1 100644
--- a/drivers/mtd/nand/ams-delta.c
+++ b/drivers/mtd/nand/ams-delta.c
@@ -145,7 +145,7 @@ static int ams_delta_nand_ready(struct mtd_info *mtd)
145 return gpio_get_value(AMS_DELTA_GPIO_PIN_NAND_RB); 145 return gpio_get_value(AMS_DELTA_GPIO_PIN_NAND_RB);
146} 146}
147 147
148static struct gpio _mandatory_gpio[] __initconst_or_module = { 148static const struct gpio _mandatory_gpio[] = {
149 { 149 {
150 .gpio = AMS_DELTA_GPIO_PIN_NAND_NCE, 150 .gpio = AMS_DELTA_GPIO_PIN_NAND_NCE,
151 .flags = GPIOF_OUT_INIT_HIGH, 151 .flags = GPIOF_OUT_INIT_HIGH,
diff --git a/drivers/video/omap/lcd_ams_delta.c b/drivers/video/omap/lcd_ams_delta.c
index 0e71e2898b18..d3a311327227 100644
--- a/drivers/video/omap/lcd_ams_delta.c
+++ b/drivers/video/omap/lcd_ams_delta.c
@@ -99,7 +99,7 @@ static struct lcd_ops ams_delta_lcd_ops = {
99 99
100/* omapfb panel section */ 100/* omapfb panel section */
101 101
102static struct gpio _gpios[] __initconst_or_module = { 102static const struct gpio _gpios[] = {
103 { 103 {
104 .gpio = AMS_DELTA_GPIO_PIN_LCD_VBLEN, 104 .gpio = AMS_DELTA_GPIO_PIN_LCD_VBLEN,
105 .flags = GPIOF_OUT_INIT_LOW, 105 .flags = GPIOF_OUT_INIT_LOW,
diff --git a/sound/soc/omap/ams-delta.c b/sound/soc/omap/ams-delta.c
index da6e005c1c41..f610260065ba 100644
--- a/sound/soc/omap/ams-delta.c
+++ b/sound/soc/omap/ams-delta.c
@@ -426,29 +426,6 @@ static struct snd_soc_ops ams_delta_ops = {
426}; 426};
427 427
428 428
429/* Board specific codec bias level control */
430static int ams_delta_set_bias_level(struct snd_soc_card *card,
431 struct snd_soc_dapm_context *dapm,
432 enum snd_soc_bias_level level)
433{
434 switch (level) {
435 case SND_SOC_BIAS_ON:
436 case SND_SOC_BIAS_PREPARE:
437 case SND_SOC_BIAS_STANDBY:
438 if (card->dapm.bias_level == SND_SOC_BIAS_OFF)
439 ams_delta_latch2_write(AMS_DELTA_LATCH2_MODEM_NRESET,
440 AMS_DELTA_LATCH2_MODEM_NRESET);
441 break;
442 case SND_SOC_BIAS_OFF:
443 if (card->dapm.bias_level != SND_SOC_BIAS_OFF)
444 ams_delta_latch2_write(AMS_DELTA_LATCH2_MODEM_NRESET,
445 0);
446 }
447 card->dapm.bias_level = level;
448
449 return 0;
450}
451
452/* Digital mute implemented using modem/CPU multiplexer. 429/* Digital mute implemented using modem/CPU multiplexer.
453 * Shares hardware with codec config pulse generation */ 430 * Shares hardware with codec config pulse generation */
454static bool ams_delta_muted = 1; 431static bool ams_delta_muted = 1;
@@ -512,9 +489,6 @@ static int ams_delta_cx20442_init(struct snd_soc_pcm_runtime *rtd)
512 ams_delta_ops.shutdown = ams_delta_shutdown; 489 ams_delta_ops.shutdown = ams_delta_shutdown;
513 } 490 }
514 491
515 /* Set codec bias level */
516 ams_delta_set_bias_level(card, dapm, SND_SOC_BIAS_STANDBY);
517
518 /* Add hook switch - can be used to control the codec from userspace 492 /* Add hook switch - can be used to control the codec from userspace
519 * even if line discipline fails */ 493 * even if line discipline fails */
520 ret = snd_soc_jack_new(rtd->codec, "hook_switch", 494 ret = snd_soc_jack_new(rtd->codec, "hook_switch",
@@ -598,7 +572,6 @@ static struct snd_soc_card ams_delta_audio_card = {
598 .owner = THIS_MODULE, 572 .owner = THIS_MODULE,
599 .dai_link = &ams_delta_dai_link, 573 .dai_link = &ams_delta_dai_link,
600 .num_links = 1, 574 .num_links = 1,
601 .set_bias_level = ams_delta_set_bias_level,
602}; 575};
603 576
604/* Module init/exit */ 577/* Module init/exit */
@@ -647,11 +620,6 @@ static void __exit ams_delta_module_exit(void)
647 ARRAY_SIZE(ams_delta_hook_switch_gpios), 620 ARRAY_SIZE(ams_delta_hook_switch_gpios),
648 ams_delta_hook_switch_gpios); 621 ams_delta_hook_switch_gpios);
649 622
650 /* Keep modem power on */
651 ams_delta_set_bias_level(&ams_delta_audio_card,
652 &ams_delta_audio_card.rtd[0].codec->dapm,
653 SND_SOC_BIAS_STANDBY);
654
655 platform_device_unregister(cx20442_platform_device); 623 platform_device_unregister(cx20442_platform_device);
656 platform_device_unregister(ams_delta_audio_platform_device); 624 platform_device_unregister(ams_delta_audio_platform_device);
657} 625}