Skip to content

Commit

Permalink
ARM: OMAP1: ams-delta: update the modem to use regulator API
Browse files Browse the repository at this point in the history
After the CX20442 codec driver already takes care of enabling the codec
power for itself (commit f75a8ff,
"ASoC: cx20442: add bias control over a platform provided regulator"),
but before dropping the old bias control method from the Amstrad Delta
ASoC sound card file, which in fact keeps the modem power always on,
even on the ASoC device close for now, extend the modem setup with a
power management callback which toggles the regulator up to the modem's
needs, reusing the previously set up regulator consumer for this. Also,
drop the MODEM_NRESET pin setup from the modem initialization procedure,
as this operation was already ineffective since patch 1/3, and not
needed because the regulator is set up as initially enabled.

Depends on patch 1/3 "ARM: OMAP1: ams-delta: set up regulator over modem
reset GPIO pin" to apply cleanly.

Signed-off-by: Janusz Krzysztofik <jkrzyszt@tis.icnet.pl>
Cc: Tony Lindgren <tony@atomide.com>
Signed-off-by: Tony Lindgren <tony@atomide.com>
  • Loading branch information
Janusz Krzysztofik authored and Tony Lindgren committed Mar 5, 2012
1 parent ac2885d commit aabf317
Showing 1 changed file with 17 additions and 5 deletions.
22 changes: 17 additions & 5 deletions arch/arm/mach-omap1/board-ams-delta.c
Original file line number Diff line number Diff line change
Expand Up @@ -526,6 +526,16 @@ static void __init ams_delta_init(void)
omap_writew(omap_readw(ARM_RSTCT1) | 0x0004, ARM_RSTCT1);
}

static void modem_pm(struct uart_port *port, unsigned int state, unsigned old)
{
struct modem_private_data *priv = port->private_data;

if (state == old)
return;

regulator_toggle(priv, state == 0);
}

static struct plat_serial8250_port ams_delta_modem_ports[] = {
{
.membase = IOMEM(MODEM_VIRT),
Expand All @@ -536,6 +546,8 @@ static struct plat_serial8250_port ams_delta_modem_ports[] = {
.iotype = UPIO_MEM,
.regshift = 1,
.uartclk = BASE_BAUD * 16,
.pm = modem_pm,
.private_data = &modem_priv,
},
{ },
};
Expand Down Expand Up @@ -584,9 +596,8 @@ static int __init late_init(void)
mutex_init(&modem_priv.consumer.lock);
modem_priv.regulator = ERR_PTR(-ENODEV);

ams_delta_latch2_write(
AMS_DELTA_LATCH2_MODEM_NRESET | AMS_DELTA_LATCH2_MODEM_CODEC,
AMS_DELTA_LATCH2_MODEM_NRESET | AMS_DELTA_LATCH2_MODEM_CODEC);
ams_delta_latch2_write(AMS_DELTA_LATCH2_MODEM_CODEC,
AMS_DELTA_LATCH2_MODEM_CODEC);

err = platform_device_register(&ams_delta_modem_device);
if (err)
Expand All @@ -595,8 +606,9 @@ static int __init late_init(void)
/*
* Once the modem device is registered, the modem_nreset
* regulator can be requested on behalf of that device.
* The regulator is used via ams_delta_latch_write()
* by the modem and ASoC drivers until updated.
* In addition to the modem .pm callback, that regulator
* is still used via the ams_delta_latch_write() wrapper
* by the ASoC driver until updated.
*/
modem_priv.regulator = regulator_get(&ams_delta_modem_device.dev,
"RESET#");
Expand Down

0 comments on commit aabf317

Please sign in to comment.