Merge "pm8921: Add support to disable rtc alarm"
diff --git a/dev/panel/msm/mipi_nt35510.c b/dev/panel/msm/mipi_nt35510.c
index f690c24..d32af1e 100644
--- a/dev/panel/msm/mipi_nt35510.c
+++ b/dev/panel/msm/mipi_nt35510.c
@@ -37,6 +37,12 @@
 #include <target/display.h>
 #include <dev/gpio.h>
 
+static char cmd_rotate[4]= {0x36, 0xc0, 0x15, 0x80};
+
+static struct mipi_dsi_cmd nt35510_panel_rotate_cmds[] = {
+	{sizeof(cmd_rotate), cmd_rotate},
+};
+
 
 int mipi_nt35510_panel_dsi_config(int on)
 {
@@ -58,8 +64,18 @@
 		gpio_set(85, 0x1);
 		mdelay(20);
 	} else {
+		gpio_set(96, 0x0);
 		gpio_set(35, 0x0);
 		gpio_set(40, 0x0);
 	}
 	return 0;
 }
+
+int mipi_nt35510_panel_wvga_rotate()
+{
+        int ret = NO_ERROR;
+
+        ret = mipi_dsi_cmds_tx(nt35510_panel_rotate_cmds, ARRAY_SIZE(nt35510_panel_rotate_cmds));
+
+        return ret;
+}
diff --git a/dev/panel/msm/mipi_nt35510_cmd_wvga.c b/dev/panel/msm/mipi_nt35510_cmd_wvga.c
index 54c324e..8c0b3cf 100644
--- a/dev/panel/msm/mipi_nt35510_cmd_wvga.c
+++ b/dev/panel/msm/mipi_nt35510_cmd_wvga.c
@@ -36,6 +36,7 @@
 #include <debug.h>
 #include <target/display.h>
 
+extern int mipi_nt35510_panel_wvga_rotate();
 
 /* MIPI NT35510 panel commands */
 static char exit_sleep[4] = {0x11, 0x00, 0x05, 0x80};
@@ -323,6 +324,7 @@
 	pinfo->on = mipi_nt35510_cmd_wvga_on;
 	pinfo->off = mipi_nt35510_cmd_wvga_off;
 	pinfo->config = mipi_nt35510_cmd_wvga_config;
+	pinfo->rotate = mipi_nt35510_panel_wvga_rotate;
 
 	return;
 }
diff --git a/dev/panel/msm/mipi_nt35510_video_wvga.c b/dev/panel/msm/mipi_nt35510_video_wvga.c
index e073b71..5529b41 100644
--- a/dev/panel/msm/mipi_nt35510_video_wvga.c
+++ b/dev/panel/msm/mipi_nt35510_video_wvga.c
@@ -39,6 +39,7 @@
 #include <dev/gpio.h>
 
 
+extern int mipi_nt35510_panel_wvga_rotate();
 /* MIPI NT35510 panel commands */
 static char exit_sleep[4] = {0x11, 0x00, 0x09, 0x80};
 static char display_on[4] = {0x29, 0x00, 0x05, 0x80};
@@ -349,6 +350,7 @@
 	pinfo->on = mipi_nt35510_video_wvga_on;
 	pinfo->off = mipi_nt35510_video_wvga_off;
 	pinfo->config = mipi_nt35510_video_wvga_config;
+	pinfo->rotate = mipi_nt35510_panel_wvga_rotate;
 
 	return;
 }
diff --git a/platform/msm_shared/include/msm_panel.h b/platform/msm_shared/include/msm_panel.h
index 2e4796a..a3bec93 100644
--- a/platform/msm_shared/include/msm_panel.h
+++ b/platform/msm_shared/include/msm_panel.h
@@ -168,12 +168,14 @@
 	int (*on) (void);
 	int (*off) (void);
 	int (*config) (void *pdata);
+	int (*rotate) (void);
 };
 
 struct msm_fb_panel_data {
 	struct msm_panel_info panel_info;
 	struct fbcon_config fb;
 	int mdp_rev;
+	int rotate;
 
 	/* function entry chain */
 	int (*power_func) (int enable);
diff --git a/platform/msm_shared/mipi_dsi.c b/platform/msm_shared/mipi_dsi.c
index 5c54bf4..0e02d80 100644
--- a/platform/msm_shared/mipi_dsi.c
+++ b/platform/msm_shared/mipi_dsi.c
@@ -633,6 +633,9 @@
 
 	ret += mipi_dsi_panel_initialize(&mipi_pinfo);
 
+	if (pinfo->rotate && panel->rotate)
+		pinfo->rotate();
+
 	return ret;
 }
 
diff --git a/target/mdm9615/init.c b/target/mdm9615/init.c
index accae91..fd2f4f7 100755
--- a/target/mdm9615/init.c
+++ b/target/mdm9615/init.c
@@ -2,7 +2,7 @@
  * Copyright (c) 2009, Google Inc.
  * All rights reserved.
  *
- * Copyright (c) 2009-2011, Code Aurora Forum. All rights reserved.
+ * Copyright (c) 2009-2012, Code Aurora Forum. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -49,28 +49,35 @@
 
 #define RECOVERY_MODE	0x77665502
 #define FOTA_COOKIE	0x64645343
-#define FOTA_PARTITION  5
+#define FOTA_PARTITION    5
+#define DSP3_PARTITION    5
 
 static struct ptable flash_ptable;
 unsigned hw_platform = 0;
 unsigned target_msm_id = 0;
 
 /* Partition names for fastboot flash */
-char *apps_ptn_names[] = { "aboot", "boot", "cache", "misc", "recovery", "fota",
+static char *apps_ptn_names[] = { "aboot", "boot", "cache", "misc", "recovery", "fota",
 	"recoveryfs", "system", "userdata" };
 
 /* Partitions should be in this order */
-char *ptable_ptn_names[] = { "APPSBL", "APPS", "CACHE", "MISC", "RECOVERY",
+static char *ptable_ptn_names[] = { "APPSBL", "APPS", "CACHE", "MISC", "RECOVERY",
 	"FOTA", "RECOVERYFS", "SYSTEM", "USERDATA" };
 
-unsigned ptn_name_count = 9;
+static unsigned ptn_name_count = 9;
 
 /* Apps partition flags to detect the presence of FOTA partitions.
  * Initially, assume that the FOTA partitions are absent.
  */
-unsigned int apps_ptn_flag[] = {1, 1, 0, 0, 0, 0, 0, 1, 1};
+static unsigned int apps_ptn_flag[] = {1, 1, 0, 0, 0, 0, 0, 1, 1};
+/* Modem partition flags to detect the presence of DSP3 partitions.
+ * Initially, assume that the DSP3 partition is absent.
+ * The order of modem partiotions -
+ * "mibib", "sbl2", "rpm", "efs2", "dsp1", "dsp3", "dsp2"
+ */
+static unsigned int modem_ptn_flag[] = {1, 1, 1, 1, 1, 0, 1};
 
-unsigned modem_ptn_count = 6;
+static unsigned modem_ptn_count = 7;
 
 static const uint8_t uart_gsbi_id = GSBI_ID_4;
 
@@ -255,12 +262,25 @@
 	uint32_t ptn_index, i = 0;
 	uint32_t name_size;
 	struct ptentry *ptentry_ptr = flash_ptable.parts;
+	struct ptentry *dsp3_ptn;
 
-	for (ptn_index = 0; ptn_index < modem_ptn_count; ptn_index++) {
+	dsp3_ptn = ptable_find(&flash_ptable, "DSP3");
+
+	/* Check for DSP3 partition and its size */
+	if (dsp3_ptn != NULL)
+		if (dsp3_ptn->length > 0)
+			modem_ptn_flag[DSP3_PARTITION] = 1;
+
+	for (ptn_index = 0; ptn_index < modem_ptn_count; ptn_index++)
+	{
+		if (!modem_ptn_flag[ptn_index])
+			continue;
+
 		name_size = strlen(ptentry_ptr[ptn_index].name);
-		for (i = 0; i < name_size; i++) {
+		for (i = 0; i < name_size; i++)
+		{
 			ptentry_ptr[ptn_index].name[i] =
-			    tolower(ptentry_ptr[ptn_index].name[i]);
+		    tolower(ptentry_ptr[ptn_index].name[i]);
 		}
 	}
 }
diff --git a/target/msm7627a/target_display.c b/target/msm7627a/target_display.c
index 157b91b..4561a37 100644
--- a/target/msm7627a/target_display.c
+++ b/target/msm7627a/target_display.c
@@ -97,13 +97,15 @@
 		panel.fb.bpp =  panel.panel_info.bpp;
 		panel.fb.format = FB_FORMAT_RGB888;
 		panel.mdp_rev = MDP_REV_303;
+		if (mach_type == MSM8X25_EVT)
+			panel.rotate = 1;
 		break;
 	default:
 		return;
 	};
 
 	if (msm_display_init(&panel)) {
-		printf(CRITICAL, "Display init failed!\n");
+		dprintf(CRITICAL, "Display init failed!\n");
 		return;
 	}
 	display_enabled = 1;
diff --git a/target/msm8960/target_display.c b/target/msm8960/target_display.c
index 1afef54..f7fb2db 100644
--- a/target/msm8960/target_display.c
+++ b/target/msm8960/target_display.c
@@ -216,7 +216,7 @@
 	};
 
 	if (msm_display_init(&panel)) {
-		printf(CRITICAL, "Display init failed!\n");
+		dprintf(CRITICAL, "Display init failed!\n");
 		return;
 	}