From ed5be35c5d1797218e33466a78994cc672a726fa Mon Sep 17 00:00:00 2001 From: Steve Lin Date: Wed, 3 Aug 2011 15:05:55 -0700 Subject: arm: tegra: baseband: add callback functions for null phy power off Adding pre_phy_off and post_phy_off callback functions in null_phy_power_off function. So that the modem handshaking GPIO is set to reflect the real phy status. Bug 856096 Bug 854339 Change-Id: Ia39a84d3958b9dd078f93ab5be20387fb1ed9103 Reviewed-on: http://git-master/r/44840 Tested-by: Szming Lin Reviewed-by: Bharat Nihalani --- arch/arm/mach-tegra/board-enterprise-baseband.c | 51 +++++++++++++------------ 1 file changed, 27 insertions(+), 24 deletions(-) (limited to 'arch') diff --git a/arch/arm/mach-tegra/board-enterprise-baseband.c b/arch/arm/mach-tegra/board-enterprise-baseband.c index 38f7d46bf578..f1f8baf77991 100644 --- a/arch/arm/mach-tegra/board-enterprise-baseband.c +++ b/arch/arm/mach-tegra/board-enterprise-baseband.c @@ -72,16 +72,16 @@ static struct usb_device_id modem_list[] = { {}, }; -static int ph450_reset(void); -static int ph450_handshake(void); +static int ph450_phy_on(void); +static int ph450_phy_off(void); static struct ph450_priv ph450_priv; static struct tegra_ulpi_trimmer e1219_trimmer = { 10, 1, 1, 1 }; static struct tegra_ulpi_config ehci2_null_ulpi_phy_config = { .trimmer = &e1219_trimmer, - .preinit = NULL, - .postinit = ph450_handshake, + .post_phy_on = ph450_phy_on, + .pre_phy_off = ph450_phy_off, }; static struct tegra_ehci_platform_data ehci2_null_ulpi_platform_data = { @@ -172,12 +172,10 @@ static irqreturn_t mdm_start_thread(int irq, void *data) if (gpio_get_value(priv->restart_gpio)) { pr_info("BB_RST_OUT high\n"); - gpio_set_value(AP2MDM_ACK2, 1); /* hold wait lock to complete the enumeration */ wake_lock_timeout(&priv->wake_lock, HZ * 2); } else { pr_info("BB_RST_OUT low\n"); - gpio_set_value(AP2MDM_ACK2, 0); } return IRQ_HANDLED; @@ -187,20 +185,16 @@ static irqreturn_t mdm_wake_thread(int irq, void *data) { struct ph450_priv *priv = (struct ph450_priv *)data; - if (gpio_get_value(priv->wake_gpio) == 0) { - pr_info("MDM2AP_ACK2 low\n"); - - wake_lock_timeout(&priv->wake_lock, HZ); - mutex_lock(&priv->lock); - if (priv->udev) { - usb_lock_device(priv->udev); - pr_info("mdm wake (%u)\n", ++(priv->wake_cnt)); - if (usb_autopm_get_interface(priv->intf) == 0) - usb_autopm_put_interface_async(priv->intf); - usb_unlock_device(priv->udev); - } - mutex_unlock(&priv->lock); + wake_lock_timeout(&priv->wake_lock, HZ); + mutex_lock(&priv->lock); + if (priv->udev) { + usb_lock_device(priv->udev); + pr_info("mdm wake (%u)\n", ++(priv->wake_cnt)); + if (usb_autopm_get_interface(priv->intf) == 0) + usb_autopm_put_interface_async(priv->intf); + usb_unlock_device(priv->udev); } + mutex_unlock(&priv->lock); return IRQ_HANDLED; } @@ -220,11 +214,19 @@ static int ph450_reset(void) return 0; } -static int ph450_handshake(void) +static int ph450_phy_on(void) { /* set AP2MDM_ACK2 low */ gpio_set_value(AP2MDM_ACK2, 0); + pr_info("%s\n", __func__); + return 0; +} +static int ph450_phy_off(void) +{ + /* set AP2MDM_ACK2 high */ + gpio_set_value(AP2MDM_ACK2, 1); + pr_info("%s\n", __func__); return 0; } @@ -295,8 +297,8 @@ static int __init ph450_init(void) gpio_direction_input(MDM2AP_ACK2); gpio_direction_input(BB_RST_OUT); - /* reset modem */ - ph450_reset(); + /* phy init */ + tegra_null_ulpi_init(); ph450_priv.wake_gpio = TEGRA_GPIO_PV0; ph450_priv.restart_gpio = TEGRA_GPIO_PV1; @@ -347,6 +349,9 @@ static int __init ph450_init(void) return ret; } + /* reset modem */ + ph450_reset(); + return 0; } @@ -360,7 +365,5 @@ int __init enterprise_modem_init(void) return ret; } - tegra_null_ulpi_init(); - return 0; } -- cgit v1.2.3