arm: tegra: baseband: add shutdown for safe down.
Shawn Joo [Wed, 2 Jan 2013 05:52:00 +0000 (14:52 +0900)]
when reboot or power off, baseband should be off safely by calling right shutdown process.
add shutdown callback.

Bug 1210566

Change-Id: I26cf97e73f5234df875407aeb8db8c67b317d778
Signed-off-by: Shawn Joo <sjoo@nvidia.com>
Reviewed-on: http://git-master/r/188509
(cherry picked from commit 0febbb5fb8ca7a2e0cc44088b3a1f582437d9e78)
Reviewed-on: http://git-master/r/199082
Reviewed-by: Automatic_Commit_Validation_User
GVS: Gerrit_Virtual_Submit
Reviewed-by: Seshendra Gadagottu <sgadagottu@nvidia.com>
Reviewed-by: Steve Lin <stlin@nvidia.com>

arch/arm/mach-tegra/board-enterprise-baseband.c
arch/arm/mach-tegra/tegra_usb_modem_power.c

index c4bd87b..f2a0bca 100644 (file)
@@ -112,6 +112,14 @@ static void baseband_reset(void)
        gpio_set_value(MODEM_PWR_ON, 1);
 }
 
+static void baseband_stop(void)
+{
+       /* Baseband power off */
+       pr_info("%s\n", __func__);
+       gpio_set_value(MODEM_PWR_ON, 0);
+       mdelay(1);
+}
+
 static int baseband_init(void)
 {
        int ret;
@@ -138,6 +146,7 @@ static const struct tegra_modem_operations baseband_operations = {
        .init = baseband_init,
        .start = baseband_start,
        .reset = baseband_reset,
+       .stop = baseband_stop,
 };
 
 static struct tegra_usb_modem_power_platform_data baseband_pdata = {
index 6da9a67..5a7dcfd 100644 (file)
@@ -879,6 +879,14 @@ static int __exit tegra_usb_modem_remove(struct platform_device *pdev)
        return 0;
 }
 
+static void tegra_usb_modem_shutdown(struct platform_device *pdev)
+{
+       struct tegra_usb_modem *modem = platform_get_drvdata(pdev);
+
+       if (modem->ops && modem->ops->stop)
+               modem->ops->stop();
+}
+
 #ifdef CONFIG_PM
 static int tegra_usb_modem_suspend(struct platform_device *pdev,
                                   pm_message_t state)
@@ -909,6 +917,7 @@ static struct platform_driver tegra_usb_modem_power_driver = {
                   },
        .probe = tegra_usb_modem_probe,
        .remove = __exit_p(tegra_usb_modem_remove),
+       .shutdown = tegra_usb_modem_shutdown,
 #ifdef CONFIG_PM
        .suspend = tegra_usb_modem_suspend,
        .resume = tegra_usb_modem_resume,