From 0358875560c6a93898708e341461ae62b687d80a Mon Sep 17 00:00:00 2001 From: Ramalingam C Date: Mon, 18 Mar 2013 12:13:00 +0530 Subject: arch: tegra: Ventana: vdd_ldo4 regulator handling 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 Reviewed-on: http://git-master/r/207516 GVS: Gerrit_Virtual_Submit Reviewed-by: Matthew Pedro --- arch/arm/mach-tegra/board-ventana-panel.c | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/arch/arm/mach-tegra/board-ventana-panel.c b/arch/arm/mach-tegra/board-ventana-panel.c index d2d89392e1c5..d507dea88813 100644 --- a/arch/arm/mach-tegra/board-ventana-panel.c +++ b/arch/arm/mach-tegra/board-ventana-panel.c @@ -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) { -- cgit v1.2.3