arch: tegra: Ventana: vdd_ldo4 regulator handling
Ramalingam C [Mon, 18 Mar 2013 06:43:00 +0000 (11:43 +0530)]
Cleaning up of the vdd_ldo4 regulator handling and also control
the multiple calls for regulator_get call for vdd_ldo4

Bug 1241274

Change-Id: I0f62d5059212302956bfe7e48d24eb7f45ff2dda
Signed-off-by: Ramalingam C <ramalingamc@nvidia.com>
Reviewed-on: http://git-master/r/207516
GVS: Gerrit_Virtual_Submit
Reviewed-by: Matthew Pedro <mapedro@nvidia.com>

arch/arm/mach-tegra/board-ventana-panel.c

index d2d8939..d507dea 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * arch/arm/mach-tegra/board-ventana-panel.c
  *
- * Copyright (c) 2010-2012 NVIDIA Corporation.
+ * Copyright (c) 2010-2013 NVIDIA Corporation.
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -48,6 +48,7 @@
 #define ventana_lvds_to_bl_ms  200
 
 static struct regulator *pnl_pwr;
+static struct regulator *vdd_ldo4;
 
 #ifdef CONFIG_TEGRA_DC
 static struct regulator *ventana_hdmi_reg = NULL;
@@ -104,11 +105,17 @@ static struct platform_device ventana_backlight_device = {
 #ifdef CONFIG_TEGRA_DC
 static int ventana_panel_enable(void)
 {
-       struct regulator *reg = regulator_get(NULL, "vdd_ldo4");
-
-       if (!reg) {
-               regulator_enable(reg);
-               regulator_put(reg);
+       if (vdd_ldo4 == NULL) {
+               vdd_ldo4 = regulator_get(NULL, "vdd_ldo4");
+
+               if (IS_ERR(vdd_ldo4)) {
+                       pr_err("%s: couldn't get regulator vdd_ldo4: %ld\n",
+                                       __func__, PTR_ERR(vdd_ldo4));
+               } else {
+                       regulator_enable(vdd_ldo4);
+                       regulator_disable(vdd_ldo4);
+                       regulator_put(vdd_ldo4);
+               }
        }
 
        if (pnl_pwr == NULL) {