summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnimesh Kishore <ankishore@nvidia.com>2011-06-15 16:03:30 +0530
committerNiket Sirsi <nsirsi@nvidia.com>2011-06-15 21:27:18 -0700
commite38ad73bcc26cd1352443bbadc18e39e613ecea6 (patch)
treeb29978072d721e58e92942daf75857eed698dc12
parent71d2145b74851d72fad498800be5723552a7ca6d (diff)
ARM: tegra: enterprise: panel power management
Implementation for dsi panel power management Bug 833709 Bug 793857 Change-Id: Ia13c9b0a4a8a4ec1d802ad56cdbcdc27e5f183d4 Reviewed-on: http://git-master/r/36139 Reviewed-by: Animesh Kishore <ankishore@nvidia.com> Tested-by: Animesh Kishore <ankishore@nvidia.com> Reviewed-by: Hanumanth Venkateswa Moganty <vmoganty@nvidia.com> Reviewed-by: Narendra Damahe <ndamahe@nvidia.com>
-rwxr-xr-x[-rw-r--r--]arch/arm/mach-tegra/board-enterprise-panel.c94
1 files changed, 84 insertions, 10 deletions
diff --git a/arch/arm/mach-tegra/board-enterprise-panel.c b/arch/arm/mach-tegra/board-enterprise-panel.c
index 5f4955051703..fa410f85fdb8 100644..100755
--- a/arch/arm/mach-tegra/board-enterprise-panel.c
+++ b/arch/arm/mach-tegra/board-enterprise-panel.c
@@ -47,6 +47,7 @@
#define enterprise_hdmi_hpd TEGRA_GPIO_PN7
#define enterprise_dsi_panel_reset TEGRA_GPIO_PW0
+#define enterprise_dsi_panel_bl TEGRA_GPIO_PW1
#define enterprise_lcd_2d_3d TEGRA_GPIO_PH1
#define ENTERPRISE_STEREO_3D 0
@@ -56,6 +57,8 @@
#define ENTERPRISE_STEREO_LANDSCAPE 0
#define ENTERPRISE_STEREO_PORTRAIT 1
+static struct regulator *enterprise_dsi_reg = NULL;
+
static struct regulator *enterprise_hdmi_reg;
static struct regulator *enterprise_hdmi_pll;
static struct regulator *enterprise_hdmi_vddio;
@@ -279,23 +282,64 @@ static struct tegra_dc_platform_data enterprise_disp2_pdata = {
static int enterprise_dsi_panel_enable(void)
{
- static struct regulator *reg = NULL;
-
- if (reg == NULL) {
- reg = regulator_get(NULL, "avdd_dsi_csi");
- if (IS_ERR_OR_NULL(reg)) {
- pr_err("dsi: Could not get regulator avdd_dsi_csi\n");
- reg = NULL;
- return PTR_ERR(reg);
+ int ret;
+
+ if (enterprise_dsi_reg == NULL) {
+ enterprise_dsi_reg = regulator_get(NULL, "avdd_dsi_csi");
+ if (IS_ERR_OR_NULL(enterprise_dsi_reg)) {
+ pr_err("dsi: Could not get regulator avdd_dsi_csi\n");
+ enterprise_dsi_reg = NULL;
+ return PTR_ERR(enterprise_dsi_reg);
}
}
- regulator_enable(reg);
+ ret = regulator_enable(enterprise_dsi_reg);
+ if (ret < 0) {
+ printk(KERN_ERR
+ "DSI regulator avdd_dsi_csi could not be enabled\n");
+ return ret;
+ }
- return 0;
+#if DSI_PANEL_RESET
+ ret = gpio_request(enterprise_dsi_panel_reset, "panel reset");
+ if (ret < 0)
+ return ret;
+
+ ret = gpio_direction_output(enterprise_dsi_panel_reset, 0);
+ if (ret < 0) {
+ gpio_free(enterprise_dsi_panel_reset);
+ return ret;
+ }
+ tegra_gpio_enable(enterprise_dsi_panel_reset);
+
+ gpio_set_value(enterprise_dsi_panel_reset, 0);
+ udelay(2000);
+ gpio_set_value(enterprise_dsi_panel_reset, 1);
+ mdelay(20);
+#endif
+
+ ret = gpio_request(enterprise_dsi_panel_bl, "DSIa backlight");
+ if (ret < 0)
+ return ret;
+
+ ret = gpio_direction_output(enterprise_dsi_panel_bl, 1);
+ if (ret < 0) {
+ gpio_free(enterprise_dsi_panel_bl);
+ return ret;
+ }
+ tegra_gpio_enable(enterprise_dsi_panel_bl);
+
+ return ret;
}
static int enterprise_dsi_panel_disable(void)
{
+ tegra_gpio_disable(enterprise_dsi_panel_bl);
+ gpio_free(enterprise_dsi_panel_bl);
+
+#if DSI_PANEL_RESET
+ tegra_gpio_disable(enterprise_dsi_panel_reset);
+ gpio_free(enterprise_dsi_panel_reset);
+#endif
return 0;
}
@@ -323,6 +367,22 @@ static void enterprise_stereo_set_orientation(int mode)
}
}
+static int enterprise_dsi_panel_postsuspend(void)
+{
+ int err = 0;
+
+ if (enterprise_dsi_reg) {
+ err = regulator_disable(enterprise_dsi_reg);
+ if (err < 0)
+ printk(KERN_ERR
+ "DSI regulator avdd_dsi_csi disable failed\n");
+ regulator_put(enterprise_dsi_reg);
+ enterprise_dsi_reg = NULL;
+ }
+
+ return err;
+}
+
static struct tegra_dsi_cmd dsi_init_cmd[]= {
DSI_CMD_SHORT(0x05, 0x11, 0x00),
DSI_DLY_MS(150),
@@ -330,6 +390,13 @@ static struct tegra_dsi_cmd dsi_init_cmd[]= {
DSI_DLY_MS(20),
};
+static struct tegra_dsi_cmd dsi_suspend_cmd[] = {
+ DSI_CMD_SHORT(0x05, 0x28, 0x00),
+ DSI_DLY_MS(20),
+ DSI_CMD_SHORT(0x05, 0x10, 0x00),
+ DSI_DLY_MS(5),
+};
+
struct tegra_dsi_out enterprise_dsi = {
.n_data_lanes = 2,
.pixel_format = TEGRA_DSI_PIXEL_FORMAT_24BIT_P,
@@ -338,10 +405,16 @@ struct tegra_dsi_out enterprise_dsi = {
.panel_has_frame_buffer = true,
.dsi_instance = 0,
+
+ .panel_reset = DSI_PANEL_RESET,
+
.n_init_cmd = ARRAY_SIZE(dsi_init_cmd),
.dsi_init_cmd = dsi_init_cmd,
+ .n_suspend_cmd = ARRAY_SIZE(dsi_suspend_cmd),
+ .dsi_suspend_cmd = dsi_suspend_cmd,
.video_data_type = TEGRA_DSI_VIDEO_TYPE_COMMAND_MODE,
+ .lp_cmd_mode_freq_khz = 430000,
};
static struct tegra_stereo_out enterprise_stereo = {
@@ -389,6 +462,7 @@ static struct tegra_dc_out enterprise_disp1_out = {
.enable = enterprise_dsi_panel_enable,
.disable = enterprise_dsi_panel_disable,
+ .postsuspend = enterprise_dsi_panel_postsuspend,
};
static struct tegra_dc_platform_data enterprise_disp1_pdata = {
.flags = TEGRA_DC_FLAG_ENABLED,