aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-omap1
diff options
context:
space:
mode:
authorJanusz Krzysztofik <jkrzyszt@tis.icnet.pl>2012-03-05 11:05:12 -0500
committerTony Lindgren <tony@atomide.com>2012-03-05 14:25:34 -0500
commit0379c1f55b734d9d112f535e12f4508b90a1bab1 (patch)
tree91fa87d36cb93868bc05b7e05e4f6af86c1d0fec /arch/arm/mach-omap1
parentaabf31737a6a5eb0c4d73857409cd5bcc914d5f5 (diff)
ASoC: OMAP: ams-delta: drop .set_bias_level callback
This functionality has already been implemented in the cx20442 codec driver (commit f75a8ff67d161b5166a2c2360bb2ffaefd5eb853, "ASoC: cx20442: add bias control over a platform provided regulator"), no need to keep it here duplicated. Once done, remove the no longer used AMS_DELTA_LATCH2_MODEM_NRESET symbol from the board header file and a call to the regulator_toggle() helper function from the old API wrapper found in the board file. While being at it, simplify the way the modem .pm callback handles the regulator and drop that helper function and its related consumer setup completely. Depends on patches 1/3 and 2/3 for clean apply and keep things working. Signed-off-by: Janusz Krzysztofik <jkrzyszt@tis.icnet.pl> Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Cc: Tony Lindgren <tony@atomide.com> Signed-off-by: Tony Lindgren <tony@atomide.com>
Diffstat (limited to 'arch/arm/mach-omap1')
-rw-r--r--arch/arm/mach-omap1/board-ams-delta.c42
1 files changed, 7 insertions, 35 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
292struct modem_private_data { 291struct 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
300static 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
323static struct modem_private_data modem_priv; 295static struct modem_private_data modem_priv;
324 296
325void 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)
@@ -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
539static struct plat_serial8250_port ams_delta_modem_ports[] = { 515static 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#");