From e27cbba0fcc7c13ee924d285bb19704d100f62b4 Mon Sep 17 00:00:00 2001 From: kevinh Date: Mon, 21 Mar 2011 13:12:21 -0700 Subject: ARM: tegra: cardhu: Fix panel disable/enable functions. Original-Change-Id: I2638de53505e237cdf2b3e05c5d3d36c19798773 Reviewed-on: http://git-master/r/23104 Reviewed-by: Narendra Damahe Reviewed-by: Kevin Huang Reviewed-by: Yu-Huan Hsu Tested-by: Kevin Huang Change-Id: Ib31bad9902ef29ce5bb39fff0efbabb1cf3cafd1 --- arch/arm/mach-tegra/board-cardhu-panel.c | 47 ++++++++++++++++++++++++++------ 1 file changed, 39 insertions(+), 8 deletions(-) (limited to 'arch/arm/mach-tegra/board-cardhu-panel.c') diff --git a/arch/arm/mach-tegra/board-cardhu-panel.c b/arch/arm/mach-tegra/board-cardhu-panel.c index af92376320ca..367bd92fdda0 100644 --- a/arch/arm/mach-tegra/board-cardhu-panel.c +++ b/arch/arm/mach-tegra/board-cardhu-panel.c @@ -63,6 +63,10 @@ static struct regulator *cardhu_hdmi_vddio = NULL; static atomic_t sd_brightness = ATOMIC_INIT(255); +static struct regulator *cardhu_lvds_reg = NULL; +static struct regulator *cardhu_lvds_vdd_bl = NULL; +static struct regulator *cardhu_lvds_vdd_panel = NULL; + static int cardhu_backlight_init(struct device *dev) { int ret; @@ -111,7 +115,7 @@ static int cardhu_backlight_init(struct device *dev) { static void cardhu_backlight_exit(struct device *dev) { #ifndef CONFIG_TEGRA_CARDHU_DSI int ret; - ret = gpio_request(cardhu_bl_enb, "backlight_enb"); + /*ret = gpio_request(cardhu_bl_enb, "backlight_enb");*/ gpio_set_value(cardhu_bl_enb, 0); gpio_free(cardhu_bl_enb); tegra_gpio_disable(cardhu_bl_enb); @@ -181,23 +185,50 @@ static struct platform_device cardhu_backlight_device = { static int cardhu_panel_enable(void) { - static struct regulator *reg = NULL; + if (cardhu_lvds_reg == NULL) { + cardhu_lvds_reg = regulator_get(NULL, "vdd_lvds"); + if (WARN_ON(IS_ERR(cardhu_lvds_reg))) + pr_err("%s: couldn't get regulator vdd_lvds: %ld\n", + __func__, PTR_ERR(cardhu_lvds_reg)); + else + regulator_enable(cardhu_lvds_reg); + } - if (reg == NULL) { - reg = regulator_get(NULL, "avdd_lvds"); - if (WARN_ON(IS_ERR(reg))) - pr_err("%s: couldn't get regulator avdd_lvds: %ld\n", - __func__, PTR_ERR(reg)); + if (cardhu_lvds_vdd_bl == NULL) { + cardhu_lvds_vdd_bl = regulator_get(NULL, "vdd_backlight"); + if (WARN_ON(IS_ERR(cardhu_lvds_vdd_bl))) + pr_err("%s: couldn't get regulator vdd_backlight: %ld\n", + __func__, PTR_ERR(cardhu_lvds_vdd_bl)); else - regulator_enable(reg); + regulator_enable(cardhu_lvds_vdd_bl); } + if (cardhu_lvds_vdd_panel == NULL) { + cardhu_lvds_vdd_panel = regulator_get(NULL, "vdd_lcd_panel"); + if (WARN_ON(IS_ERR(cardhu_lvds_vdd_panel))) + pr_err("%s: couldn't get regulator vdd_lcd_panel: %ld\n", + __func__, PTR_ERR(cardhu_lvds_vdd_panel)); + else + regulator_enable(cardhu_lvds_vdd_panel); + } gpio_set_value(cardhu_lvds_shutdown, 1); return 0; } static int cardhu_panel_disable(void) { + regulator_disable(cardhu_lvds_reg); + regulator_put(cardhu_lvds_reg); + cardhu_lvds_reg = NULL; + + regulator_disable(cardhu_lvds_vdd_bl); + regulator_put(cardhu_lvds_vdd_bl); + cardhu_lvds_vdd_bl = NULL; + + regulator_disable(cardhu_lvds_vdd_panel); + regulator_put(cardhu_lvds_vdd_panel); + cardhu_lvds_vdd_panel= NULL; + gpio_set_value(cardhu_lvds_shutdown, 0); return 0; } -- cgit v1.2.3