]> rtime.felk.cvut.cz Git - sojka/nv-tegra/linux-3.10.git/commitdiff
misc: tegra-baseband: support pre boost gpio
authorMark Kuo <mkuo@nvidia.com>
Thu, 20 Nov 2014 03:17:40 +0000 (11:17 +0800)
committerSteve Lin <stlin@nvidia.com>
Thu, 4 Dec 2014 00:57:39 +0000 (16:57 -0800)
Support turning off pre boost regulator gpio before entering LP0, and
turning on pre boost regulator gpio after exiting LP0. This is to save
extra power in LP0 starting from Loki E03.

Also add devicetree documentation for modem power driver.

Bug 200052631

Change-Id: Ia29dd4e76253fa96383e015ac4524658bb7688b6
Signed-off-by: Mark Kuo <mkuo@nvidia.com>
Reviewed-on: http://git-master/r/603956
(cherry picked from commit f65a55245b865092ae067551d2d0da9dc357e5a1)
Reviewed-on: http://git-master/r/655298
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: BH Hsieh <bhsieh@nvidia.com>
Reviewed-by: Neil Patel <neilp@nvidia.com>
Reviewed-by: Rajkumar Jayaraman <rjayaraman@nvidia.com>
Reviewed-by: Steve Lin <stlin@nvidia.com>
Documentation/devicetree/bindings/misc/tegra_usb_modem_power.txt [new file with mode: 0644]
drivers/misc/tegra-baseband/tegra_usb_modem_power.c

diff --git a/Documentation/devicetree/bindings/misc/tegra_usb_modem_power.txt b/Documentation/devicetree/bindings/misc/tegra_usb_modem_power.txt
new file mode 100644 (file)
index 0000000..c3d0798
--- /dev/null
@@ -0,0 +1,77 @@
+Modem Power Management Driver
+-----------------------------------------------------------------------------
+This driver is nvidia's Icera modem power management driver. Current actively
+supported modem is Bruce. The driver controls modem power through GPIO and
+supports 3 different PHY interface since T210: EHCI HSIC, XHCI HSIC, and XHCI
+UTMI.
+
+This driver uses device tree to pass all necessary platform data now.
+
+Required properties:
+- compatible: should be "nvidia,icera-i500" for now
+- nvidia,boot-gpio: input GPIO for modem COLDBOOT signal
+- nvidia,mdm-en-gpio: output GPIO for enabling modem
+- nvidia,reset-gpio: output GPIO for hard resetting modem
+
+Optional properties:
+- nvidia,regulator: support for older platform which may need to enable
+                    regulator manually. It's there for backward compatibility
+- nvidia,wake-gpio: input GPIO. Define this GPIO if remote wakeup is through
+                    GPIO, or remote wakeup is supported natively
+- nvidia,mdm-power-report-gpio: input GPIO for modem power report
+- nvidia,mdm-sar0-gpio: output GPIO for modem SAR
+- nvidia,pre-boost-gpio: output GPIO for modem to control pre boost regulator
+- nvidia,num-temp-sensors: integer which specifies temperature sensor count for
+                    modem thermal reporting
+- nvidia,use-xhci-hsic: this property is only set by bootloader SHIM layer
+                    according to odmdata passed. If odmdata bit[26] is set,
+                    this property will be <1> to indicate XHCI HSIC is to
+                    be used as modem interface
+- nvidia,phy-type: integer 0, 1, or 2, which stand for EHCI HSIC, XHCI HSIC,
+                    or XHCI UTMI. This will be set automatically in driver
+                    according to nvidia,use-xhci-hsic property. This is used
+                    currently only for T210 loki E03 to indicate "XHCI UTMI"
+
+Example:
+
+With all properties defined:
+
+    modem {
+        compatible = "nvidia,icera-i500";
+
+        /* regulator */
+        nvidia,regulator = "vdd_wwan_mdm";
+
+        /* GPIO */
+        nvidia,wake-gpio = ...;
+        nvidia,boot-gpio = <&gpio TEGRA_GPIO(K, 6) GPIO_ACTIVE_LOW>;
+        nvidia,mdm-power-report-gpio = ...;
+        nvidia,mdm-sar0-gpio = ...;
+        nvidia,reset-gpio = ...;
+        nvidia,mdm-en-gpio = ...;
+        nvidia,pre-boost-gpio = ...;
+
+        /* temp sensors count */
+        nvidia,num-temp-sensors = <3>;
+
+        /* USB PHY interfaces */
+        nvidia,use-xhci-hsic = <1>;
+        nvidia,phy-type = <1>;
+
+        /* should be disabled by default. Bootloader will determine if this
+           node will be enabled according to TNSPEC. */
+        status = "disabled";
+    };
+
+
+Example node for a T210 ERS board:
+
+    modem {
+        compatible = "nvidia,icera-i500";
+        nvidia,boot-gpio = <&gpio TEGRA_GPIO(K, 6) GPIO_ACTIVE_LOW>;
+        nvidia,mdm-power-report-gpio = <&gpio TEGRA_GPIO(L, 1) GPIO_ACTIVE_LOW>;
+        nvidia,reset-gpio = <&gpio TEGRA_GPIO(L, 0) GPIO_ACTIVE_LOW>;
+        nvidia,mdm-en-gpio = <&gpio TEGRA_GPIO(K, 7) GPIO_ACTIVE_HIGH>;
+        nvidia,num-temp-sensors = <3>;
+        status = "disabled";
+    };
index edcf654a085fb702bf0130631991d2f2f3ed4900..42d19f053935029c0745099e7fffd4946dc7f510 100644 (file)
@@ -165,6 +165,7 @@ struct tegra_usb_modem {
        int sysedp_file_created;        /* sysedp state file created */
        enum { EHCI_HSIC = 0, XHCI_HSIC, XHCI_UTMI } phy_type;
        struct platform_device *modem_thermal_pdev;
+       int pre_boost_gpio;             /* control regulator output voltage */
 };
 
 
@@ -969,6 +970,21 @@ static int tegra_usb_modem_parse_dt(struct tegra_usb_modem *modem,
        dev_info(&pdev->dev, "set mdm power report gpio:%d\n",
                pdata->mdm_power_report_gpio);
 
+       gpio = of_get_named_gpio(node, "nvidia,pre-boost-gpio", 0);
+       if (gpio_is_valid(gpio)) {
+               dev_info(&pdev->dev, "set pre boost gpio (%d) to 1\n", gpio);
+               ret = gpio_request(gpio, "MODEM PREBOOST");
+               if (ret) {
+                       dev_err(&pdev->dev, "request gpio %d failed\n", gpio);
+                       return ret;
+               }
+               gpio_direction_output(gpio, 1);
+               modem->pre_boost_gpio = gpio;
+       } else
+               modem->pre_boost_gpio = -1;
+
+
+
        /* set GPIO IRQ flags */
        pdata->wake_irq_flags = pdata->boot_irq_flags =
                pdata->mdm_power_irq_flags =
@@ -1121,6 +1137,9 @@ static int tegra_usb_modem_suspend(struct platform_device *pdev,
                        pr_info("%s, wake irq=%d, error=%d\n",
                                __func__, modem->boot_irq, ret);
        }
+
+       if (gpio_is_valid(modem->pre_boost_gpio))
+               gpio_set_value(modem->pre_boost_gpio, 0);
 fail:
        return ret;
 }
@@ -1130,6 +1149,9 @@ static int tegra_usb_modem_resume(struct platform_device *pdev)
        struct tegra_usb_modem *modem = platform_get_drvdata(pdev);
        int ret = 0;
 
+       if (gpio_is_valid(modem->pre_boost_gpio))
+               gpio_set_value(modem->pre_boost_gpio, 1);
+
        if (modem->boot_irq) {
                ret = disable_irq_wake(modem->boot_irq);
                if (ret)