arm: tegra: pluto: power: hdmi support for 4K
Gaurav Batra [Tue, 26 Feb 2013 18:47:21 +0000 (10:47 -0800)]
Changed the supply from ldo1 to ldo4 for hdmi_pll.
Also added the enable / disable functions for hdmi.

Bug 1242520

Change-Id: I599f24a58a12bd7d1c39912622cf60f89f124403
Signed-off-by: Gaurav Batra <gbatra@nvidia.com>
Reviewed-on: http://git-master/r/206846
Reviewed-by: Harshada Kale <hkale@nvidia.com>
Tested-by: Harshada Kale <hkale@nvidia.com>

arch/arm/mach-tegra/board-pluto-panel.c
arch/arm/mach-tegra/board-pluto-power.c

index af40a67..9016501 100644 (file)
@@ -1,12 +1,11 @@
 /*
  * arch/arm/mach-tegra/board-pluto-panel.c
  *
- * Copyright (c) 2011-2012, NVIDIA Corporation.
+ * Copyright (C) 2012-2013 NVIDIA Corporation. All rights reserved.
  *
  * 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
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
  *
  * This program is distributed in the hope that it will be useful, but WITHOUT
  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
@@ -62,6 +61,8 @@ struct platform_device * __init pluto_host1x_init(void)
 
 /* hdmi related regulators */
 static struct regulator *pluto_hdmi_vddio;
+static struct regulator *pluto_hdmi_reg;
+static struct regulator *pluto_hdmi_pll;
 
 static struct resource pluto_disp1_resources[] = {
        {
@@ -132,13 +133,52 @@ static struct tegra_dc_out pluto_disp1_out = {
 
 static int pluto_hdmi_enable(struct device *dev)
 {
-       /* TODO */
+       int ret;
+       if (!pluto_hdmi_reg) {
+               pluto_hdmi_reg = regulator_get(dev, "avdd_hdmi");
+               if (IS_ERR_OR_NULL(pluto_hdmi_reg)) {
+                       pr_err("hdmi: couldn't get regulator avdd_hdmi\n");
+                       pluto_hdmi_reg = NULL;
+                       return PTR_ERR(pluto_hdmi_reg);
+               }
+       }
+       ret = regulator_enable(pluto_hdmi_reg);
+       if (ret < 0) {
+               pr_err("hdmi: couldn't enable regulator avdd_hdmi\n");
+               return ret;
+       }
+       if (!pluto_hdmi_pll) {
+               pluto_hdmi_pll = regulator_get(dev, "avdd_hdmi_pll");
+               if (IS_ERR_OR_NULL(pluto_hdmi_pll)) {
+                       pr_err("hdmi: couldn't get regulator avdd_hdmi_pll\n");
+                       pluto_hdmi_pll = NULL;
+                       regulator_put(pluto_hdmi_reg);
+                       pluto_hdmi_reg = NULL;
+                       return PTR_ERR(pluto_hdmi_pll);
+               }
+       }
+       ret = regulator_enable(pluto_hdmi_pll);
+       if (ret < 0) {
+               pr_err("hdmi: couldn't enable regulator avdd_hdmi_pll\n");
+               return ret;
+       }
        return 0;
 }
 
 static int pluto_hdmi_disable(void)
 {
-       /* TODO */
+       if (pluto_hdmi_reg) {
+               regulator_disable(pluto_hdmi_reg);
+               regulator_put(pluto_hdmi_reg);
+               pluto_hdmi_reg = NULL;
+       }
+
+       if (pluto_hdmi_pll) {
+               regulator_disable(pluto_hdmi_pll);
+               regulator_put(pluto_hdmi_pll);
+               pluto_hdmi_pll = NULL;
+       }
+
        return 0;
 }
 
index cfa4c5f..fe09ec5 100644 (file)
@@ -50,6 +50,7 @@
 
 #define PMC_CTRL               0x0
 #define PMC_CTRL_INTR_LOW      (1 << 17)
+#define PLUTO_4K_REWORKED      0x2
 
 /************************ Pluto based regulator ****************/
 static struct regulator_consumer_supply palmas_smps123_supply[] = {
@@ -148,6 +149,18 @@ static struct regulator_consumer_supply palmas_ldo1_supply[] = {
        REGULATOR_SUPPLY("avdd_plle", NULL),
 };
 
+static struct regulator_consumer_supply palmas_ldo1_4K_supply[] = {
+       REGULATOR_SUPPLY("avdd_csi_dsi_pll", "tegradc.0"),
+       REGULATOR_SUPPLY("avdd_csi_dsi_pll", "tegradc.1"),
+       REGULATOR_SUPPLY("avdd_csi_dsi_pll", "vi"),
+       REGULATOR_SUPPLY("avdd_pllm", NULL),
+       REGULATOR_SUPPLY("avdd_pllu", NULL),
+       REGULATOR_SUPPLY("avdd_plla_p_c", NULL),
+       REGULATOR_SUPPLY("avdd_pllx", NULL),
+       REGULATOR_SUPPLY("vdd_ddr_hs", NULL),
+       REGULATOR_SUPPLY("avdd_plle", NULL),
+};
+
 static struct regulator_consumer_supply palmas_ldo2_supply[] = {
        REGULATOR_SUPPLY("avdd_lcd", NULL),
 };
@@ -168,6 +181,11 @@ static struct regulator_consumer_supply palmas_ldo4_supply[] = {
        REGULATOR_SUPPLY("vdd_spare", NULL),
 };
 
+static struct regulator_consumer_supply palmas_ldo4_4K_supply[] = {
+       REGULATOR_SUPPLY("avdd_hdmi_pll", "tegradc.1"),
+       REGULATOR_SUPPLY("vdd_spare", NULL),
+};
+
 static struct regulator_consumer_supply palmas_ldo5_supply[] = {
        REGULATOR_SUPPLY("avdd_cam1", NULL),
        REGULATOR_SUPPLY("vana", "2-0010"),
@@ -238,7 +256,7 @@ PALMAS_PDATA_INIT(smps10, 5000,  5000, NULL, 0, 0, 0, 0);
 PALMAS_PDATA_INIT(ldo1, 1050,  1050, palmas_rails(smps7), 0, 0, 1, 0);
 PALMAS_PDATA_INIT(ldo2, 2800,  3000, NULL, 0, 0, 0, 0);
 PALMAS_PDATA_INIT(ldo3, 1200,  1200, palmas_rails(smps8), 0, 1, 1, 0);
-PALMAS_PDATA_INIT(ldo4, 900,  3300, NULL, 0, 0, 0, 0);
+PALMAS_PDATA_INIT(ldo4, 1200,  1200, NULL, 0, 0, 1, 0);
 PALMAS_PDATA_INIT(ldo5, 2700,  2700, NULL, 0, 0, 1, 0);
 PALMAS_PDATA_INIT(ldo6, 3000,  3000, NULL, 1, 1, 1, 0);
 PALMAS_PDATA_INIT(ldo7, 2800,  2800, NULL, 0, 0, 1, 0);
@@ -668,6 +686,16 @@ int __init pluto_regulator_init(void)
        pmc_ctrl = readl(pmc + PMC_CTRL);
        writel(pmc_ctrl & ~PMC_CTRL_INTR_LOW, pmc + PMC_CTRL);
 
+       if (get_power_config() & PLUTO_4K_REWORKED) {
+               /* Account for the change of avdd_hdmi_pll from ldo1 to ldo4 */
+               reg_idata_ldo1.consumer_supplies = palmas_ldo1_4K_supply;
+               reg_idata_ldo1.num_consumer_supplies =
+                       ARRAY_SIZE(palmas_ldo1_4K_supply);
+               reg_idata_ldo4.consumer_supplies = palmas_ldo4_4K_supply;
+               reg_idata_ldo4.num_consumer_supplies =
+                       ARRAY_SIZE(palmas_ldo4_4K_supply);
+       }
+
        for (i = 0; i < PALMAS_NUM_REGS ; i++) {
                pmic_platform.reg_data[i] = pluto_reg_data[i];
                pmic_platform.reg_init[i] = pluto_reg_init[i];