diff options
Diffstat (limited to 'arch')
-rw-r--r-- | arch/arm/mach-omap1/board-ams-delta.c | 42 | ||||
-rw-r--r-- | arch/arm/plat-omap/include/plat/board-ams-delta.h | 1 |
2 files changed, 7 insertions, 36 deletions
diff --git a/arch/arm/mach-omap1/board-ams-delta.c b/arch/arm/mach-omap1/board-ams-delta.c index 2fb2cbb1e105..cb6afe670468 100644 --- a/arch/arm/mach-omap1/board-ams-delta.c +++ b/arch/arm/mach-omap1/board-ams-delta.c | |||
@@ -18,7 +18,6 @@ | |||
18 | #include <linux/input.h> | 18 | #include <linux/input.h> |
19 | #include <linux/interrupt.h> | 19 | #include <linux/interrupt.h> |
20 | #include <linux/leds.h> | 20 | #include <linux/leds.h> |
21 | #include <linux/mutex.h> | ||
22 | #include <linux/platform_device.h> | 21 | #include <linux/platform_device.h> |
23 | #include <linux/regulator/consumer.h> | 22 | #include <linux/regulator/consumer.h> |
24 | #include <linux/regulator/fixed.h> | 23 | #include <linux/regulator/fixed.h> |
@@ -291,35 +290,8 @@ static struct platform_device modem_nreset_device = { | |||
291 | 290 | ||
292 | struct modem_private_data { | 291 | struct modem_private_data { |
293 | struct regulator *regulator; | 292 | struct regulator *regulator; |
294 | struct { | ||
295 | struct mutex lock; | ||
296 | bool enabled; | ||
297 | } consumer; | ||
298 | }; | 293 | }; |
299 | 294 | ||
300 | static int regulator_toggle(struct modem_private_data *priv, bool enable) | ||
301 | { | ||
302 | int err = 0; | ||
303 | |||
304 | mutex_lock(&priv->consumer.lock); | ||
305 | if (IS_ERR(priv->regulator)) { | ||
306 | err = PTR_ERR(priv->regulator); | ||
307 | } else if (enable) { | ||
308 | if (!priv->consumer.enabled) { | ||
309 | err = regulator_enable(priv->regulator); | ||
310 | priv->consumer.enabled = true; | ||
311 | } | ||
312 | } else { | ||
313 | if (priv->consumer.enabled) { | ||
314 | err = regulator_disable(priv->regulator); | ||
315 | priv->consumer.enabled = false; | ||
316 | } | ||
317 | } | ||
318 | mutex_unlock(&priv->consumer.lock); | ||
319 | |||
320 | return err; | ||
321 | } | ||
322 | |||
323 | static struct modem_private_data modem_priv; | 295 | static struct modem_private_data modem_priv; |
324 | 296 | ||
325 | void ams_delta_latch_write(int base, int ngpio, u16 mask, u16 value) | 297 | void ams_delta_latch_write(int base, int ngpio, u16 mask, u16 value) |
@@ -330,8 +302,6 @@ void ams_delta_latch_write(int base, int ngpio, u16 mask, u16 value) | |||
330 | for (; bit < ngpio; bit++, bitpos = bitpos << 1) { | 302 | for (; bit < ngpio; bit++, bitpos = bitpos << 1) { |
331 | if (!(mask & bitpos)) | 303 | if (!(mask & bitpos)) |
332 | continue; | 304 | continue; |
333 | else if (base + bit == AMS_DELTA_GPIO_PIN_MODEM_NRESET) | ||
334 | regulator_toggle(&modem_priv, (value & bitpos) != 0); | ||
335 | else | 305 | else |
336 | gpio_set_value(base + bit, (value & bitpos) != 0); | 306 | gpio_set_value(base + bit, (value & bitpos) != 0); |
337 | } | 307 | } |
@@ -530,10 +500,16 @@ static void modem_pm(struct uart_port *port, unsigned int state, unsigned old) | |||
530 | { | 500 | { |
531 | struct modem_private_data *priv = port->private_data; | 501 | struct modem_private_data *priv = port->private_data; |
532 | 502 | ||
503 | if (IS_ERR(priv->regulator)) | ||
504 | return; | ||
505 | |||
533 | if (state == old) | 506 | if (state == old) |
534 | return; | 507 | return; |
535 | 508 | ||
536 | regulator_toggle(priv, state == 0); | 509 | if (state == 0) |
510 | regulator_enable(priv->regulator); | ||
511 | else if (old == 0) | ||
512 | regulator_disable(priv->regulator); | ||
537 | } | 513 | } |
538 | 514 | ||
539 | static struct plat_serial8250_port ams_delta_modem_ports[] = { | 515 | static struct plat_serial8250_port ams_delta_modem_ports[] = { |
@@ -593,7 +569,6 @@ static int __init late_init(void) | |||
593 | gpio_direction_input(AMS_DELTA_GPIO_PIN_MODEM_IRQ); | 569 | gpio_direction_input(AMS_DELTA_GPIO_PIN_MODEM_IRQ); |
594 | 570 | ||
595 | /* Initialize the modem_nreset regulator consumer before use */ | 571 | /* Initialize the modem_nreset regulator consumer before use */ |
596 | mutex_init(&modem_priv.consumer.lock); | ||
597 | modem_priv.regulator = ERR_PTR(-ENODEV); | 572 | modem_priv.regulator = ERR_PTR(-ENODEV); |
598 | 573 | ||
599 | ams_delta_latch2_write(AMS_DELTA_LATCH2_MODEM_CODEC, | 574 | ams_delta_latch2_write(AMS_DELTA_LATCH2_MODEM_CODEC, |
@@ -606,9 +581,6 @@ static int __init late_init(void) | |||
606 | /* | 581 | /* |
607 | * Once the modem device is registered, the modem_nreset | 582 | * Once the modem device is registered, the modem_nreset |
608 | * regulator can be requested on behalf of that device. | 583 | * regulator can be requested on behalf of that device. |
609 | * In addition to the modem .pm callback, that regulator | ||
610 | * is still used via the ams_delta_latch_write() wrapper | ||
611 | * by the ASoC driver until updated. | ||
612 | */ | 584 | */ |
613 | modem_priv.regulator = regulator_get(&ams_delta_modem_device.dev, | 585 | modem_priv.regulator = regulator_get(&ams_delta_modem_device.dev, |
614 | "RESET#"); | 586 | "RESET#"); |
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 |