Merge "app: aboot: Blocked fastboot boot when MDTP is activated"
diff --git a/dev/fbcon/fbcon.c b/dev/fbcon/fbcon.c
index 266e220..4010f1b 100644
--- a/dev/fbcon/fbcon.c
+++ b/dev/fbcon/fbcon.c
@@ -55,39 +55,78 @@
#define FONT_WIDTH 5
#define FONT_HEIGHT 12
-static uint16_t BGCOLOR;
-static uint16_t FGCOLOR;
+#define SCALE_FACTOR 2
+
+static uint32_t BGCOLOR;
+static uint32_t FGCOLOR;
static struct pos cur_pos;
static struct pos max_pos;
-static void fbcon_drawglyph(uint16_t *pixels, uint16_t paint, unsigned stride,
- unsigned *glyph)
+static void fbcon_drawglyph(char *pixels, uint32_t paint, unsigned stride,
+ unsigned bpp, unsigned *glyph)
{
- unsigned x, y, data;
- stride -= FONT_WIDTH;
+ unsigned x, y, i, j, k;
+ unsigned data, temp;
+ uint32_t fg_color = paint;
+ stride -= FONT_WIDTH * SCALE_FACTOR;
data = glyph[0];
- for (y = 0; y < (FONT_HEIGHT / 2); ++y) {
- for (x = 0; x < FONT_WIDTH; ++x) {
- if (data & 1)
- *pixels = paint;
- data >>= 1;
- pixels++;
+ for (y = 0; y < FONT_HEIGHT / 2; ++y) {
+ temp = data;
+ for (i = 0; i < SCALE_FACTOR; i++) {
+ data = temp;
+ for (x = 0; x < FONT_WIDTH; ++x) {
+ if (data & 1) {
+ for (j = 0; j < SCALE_FACTOR; j++) {
+ fg_color = paint;
+ for (k = 0; k < bpp; k++) {
+ *pixels = (unsigned char) fg_color;
+ fg_color = fg_color >> 8;
+ pixels++;
+ }
+ }
+ }
+ else
+ {
+ for (j = 0; j < SCALE_FACTOR; j++) {
+ pixels = pixels + bpp;
+ }
+ }
+ data >>= 1;
+ }
+ pixels += (stride * bpp);
}
- pixels += stride;
}
data = glyph[1];
- for (y = 0; y < (FONT_HEIGHT / 2); y++) {
- for (x = 0; x < FONT_WIDTH; x++) {
- if (data & 1)
- *pixels = paint;
- data >>= 1;
- pixels++;
+ for (y = 0; y < FONT_HEIGHT / 2; ++y) {
+ temp = data;
+ for (i = 0; i < SCALE_FACTOR; i++) {
+ data = temp;
+ for (x = 0; x < FONT_WIDTH; ++x) {
+ if (data & 1) {
+ for (j = 0; j < SCALE_FACTOR; j++) {
+ fg_color = paint;
+ for (k = 0; k < bpp; k++) {
+ *pixels = (unsigned char) fg_color;
+ fg_color = fg_color >> 8;
+ pixels++;
+ }
+ }
+ }
+ else
+ {
+ for (j = 0; j < SCALE_FACTOR; j++) {
+ pixels = pixels + bpp;
+ }
+ }
+ data >>= 1;
+ }
+ pixels += (stride * bpp);
}
- pixels += stride;
}
+
}
static void fbcon_flush(void)
@@ -128,8 +167,18 @@
/* TODO: take stride into account */
void fbcon_clear(void)
{
+ unsigned long i = 0, j = 0;
+ unsigned char *pixels = config->base;
unsigned count = config->width * config->height;
- memset(config->base, BGCOLOR, count * ((config->bpp) / 8));
+ uint32_t bg_color;
+ for (i = 0; i < count; i++) {
+ bg_color = BGCOLOR;
+ for (j = 0; j < (config->bpp / 8); j++) {
+ *pixels = (unsigned char) bg_color;
+ bg_color = bg_color >> 8;
+ pixels++;
+ }
+ }
}
@@ -141,7 +190,7 @@
void fbcon_putc(char c)
{
- uint16_t *pixels;
+ char *pixels;
/* ignore anything that happens before fbcon is initialized */
if (!config)
@@ -149,18 +198,22 @@
if((unsigned char)c > 127)
return;
+
if((unsigned char)c < 32) {
if(c == '\n')
goto newline;
- else if (c == '\r')
+ else if (c == '\r') {
cur_pos.x = 0;
- return;
+ return;
+ }
+ else
+ return;
}
pixels = config->base;
- pixels += cur_pos.y * FONT_HEIGHT * config->width;
- pixels += cur_pos.x * (FONT_WIDTH + 1);
- fbcon_drawglyph(pixels, FGCOLOR, config->stride,
+ pixels += cur_pos.y * SCALE_FACTOR * ((config->bpp / 8) * FONT_HEIGHT * config->width);
+ pixels += cur_pos.x * SCALE_FACTOR * ((config->bpp / 8) * (FONT_WIDTH + 1));
+ fbcon_drawglyph(pixels, FGCOLOR, config->stride, (config->bpp / 8),
font5x12 + (c - 32) * 2);
cur_pos.x++;
@@ -179,8 +232,8 @@
void fbcon_setup(struct fbcon_config *_config)
{
- uint32_t bg;
- uint32_t fg;
+ uint32_t bg = 0;
+ uint32_t fg = 0;
ASSERT(_config);
@@ -205,7 +258,7 @@
cur_pos.x = 0;
cur_pos.y = 0;
- max_pos.x = config->width / (FONT_WIDTH+1);
+ max_pos.x = config->width / ((FONT_WIDTH + 1) * SCALE_FACTOR);
max_pos.y = (config->height - 1) / FONT_HEIGHT;
#if !DISPLAY_SPLASH_SCREEN
fbcon_clear();
diff --git a/dev/pmic/pm8x41/include/pm8x41.h b/dev/pmic/pm8x41/include/pm8x41.h
index 6e89f57..9278470 100644
--- a/dev/pmic/pm8x41/include/pm8x41.h
+++ b/dev/pmic/pm8x41/include/pm8x41.h
@@ -9,7 +9,7 @@
* copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials provided
* with the distribution.
- * * Neither the name of The Linux Foundation, Inc. nor the names of its
+ * * Neither the name of The Linux Foundation, nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
@@ -225,6 +225,7 @@
int pm8x41_ldo_control(struct pm8x41_ldo *ldo, uint8_t enable);
uint8_t pm8x41_get_pmic_rev();
uint8_t pm8x41_get_pon_reason();
+uint8_t pm8950_get_pon_reason();
uint8_t pm8x41_get_pon_poff_reason1();
uint8_t pm8x41_get_pon_poff_reason2();
uint32_t pm8x41_get_pwrkey_is_pressed();
diff --git a/dev/pmic/pm8x41/include/pm8x41_hw.h b/dev/pmic/pm8x41/include/pm8x41_hw.h
index 44e9599..0a8e2e8 100644
--- a/dev/pmic/pm8x41/include/pm8x41_hw.h
+++ b/dev/pmic/pm8x41/include/pm8x41_hw.h
@@ -1,4 +1,4 @@
-/* Copyright (c) 2012-2014, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2012-2015, The Linux Foundation. All rights reserved.
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
@@ -9,7 +9,7 @@
* copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials provided
* with the distribution.
- * * Neither the name of The Linux Foundation, Inc. nor the names of its
+ * * Neither the name of The Linux Foundation, nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
@@ -91,6 +91,13 @@
#define S2_RESET_TYPE_WARM 0x1
#define PON_RESIN_N_RESET_S2_TIMER_MAX_VALUE 0x7
+/* USB Peripheral registers */
+#define SMBCHGL_USB_ICL_STS_2 0x1309
+
+/* USB Peripheral register bits */
+#define USBIN_ACTIVE_PWR_SRC BIT(0)
+#define DCIN_ACTIVE_PWR_SRC BIT(1)
+
/* MPP registers */
#define MPP_DIG_VIN_CTL 0x41
#define MPP_MODE_CTL 0x40
diff --git a/dev/pmic/pm8x41/pm8x41.c b/dev/pmic/pm8x41/pm8x41.c
index e753f6c..583145a 100644
--- a/dev/pmic/pm8x41/pm8x41.c
+++ b/dev/pmic/pm8x41/pm8x41.c
@@ -9,7 +9,7 @@
* copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials provided
* with the distribution.
- * * Neither the name of The Linux Foundation, Inc. nor the names of its
+ * * Neither the name of The Linux Foundation, nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
@@ -539,6 +539,18 @@
return REG_READ(PON_PON_REASON1);
}
+uint8_t pm8950_get_pon_reason()
+{
+ uint8_t pon_reason = 0;
+
+ pon_reason = REG_READ(SMBCHGL_USB_ICL_STS_2);
+ /* check usbin/dcin status on pmi and set the corresponding bits for pon */
+ pon_reason = (pon_reason & (USBIN_ACTIVE_PWR_SRC|DCIN_ACTIVE_PWR_SRC)) << 3 ;
+ pon_reason |= REG_READ(PON_PON_REASON1);
+
+ return pon_reason;
+}
+
uint8_t pm8x41_get_pon_poff_reason1()
{
return REG_READ(PON_POFF_REASON1);
diff --git a/dev/qpnp_wled/qpnp_wled.c b/dev/qpnp_wled/qpnp_wled.c
index 2f4b196..a0e101d 100644
--- a/dev/qpnp_wled/qpnp_wled.c
+++ b/dev/qpnp_wled/qpnp_wled.c
@@ -154,12 +154,18 @@
static int qpnp_wled_set_display_type(struct qpnp_wled *wled, uint16_t base_addr)
{
uint8_t reg = 0;
+ int rc;
/* display type */
reg = pm8x41_wled_reg_read(QPNP_WLED_DISP_SEL_REG(base_addr));
reg &= QPNP_WLED_DISP_SEL_MASK;
reg |= (wled->disp_type_amoled << QPNP_WLED_DISP_SEL_SHIFT);
+
+ rc = qpnp_wled_sec_access(wled, base_addr);
+ if (rc)
+ return rc;
+
pm8x41_wled_reg_write(QPNP_WLED_DISP_SEL_REG(base_addr), reg);
return 0;
diff --git a/platform/msm8996/acpuclock.c b/platform/msm8996/acpuclock.c
index 9b1a23b..db4113e 100644
--- a/platform/msm8996/acpuclock.c
+++ b/platform/msm8996/acpuclock.c
@@ -249,6 +249,10 @@
struct clk *phy_reset_clk = NULL;
struct clk *pipe_reset_clk = NULL;
+ struct clk *master_clk = NULL;
+
+ master_clk = clk_get("usb30_master_clk");
+ ASSERT(master_clk);
/* Look if phy com clock is present */
phy_reset_clk = clk_get("usb30_phy_reset");
@@ -258,12 +262,18 @@
ASSERT(pipe_reset_clk);
/* ASSERT */
+ ret = clk_reset(master_clk, CLK_RESET_ASSERT);
+ if (ret)
+ {
+ dprintf(CRITICAL, "Failed to assert usb30_master_reset clk\n");
+ return;
+ }
ret = clk_reset(phy_reset_clk, CLK_RESET_ASSERT);
if (ret)
{
dprintf(CRITICAL, "Failed to assert usb30_phy_reset clk\n");
- return;
+ goto deassert_master_clk;
}
ret = clk_reset(pipe_reset_clk, CLK_RESET_ASSERT);
@@ -291,6 +301,15 @@
dprintf(CRITICAL, "Failed to deassert usb30_phy_com_reset clk\n");
return;
}
+deassert_master_clk:
+
+ ret = clk_reset(master_clk, CLK_RESET_DEASSERT);
+ if (ret)
+ {
+ dprintf(CRITICAL, "Failed to deassert usb30_master clk\n");
+ return;
+ }
+
}
void mmss_gdsc_enable()
diff --git a/platform/msm_shared/crypto5_eng.c b/platform/msm_shared/crypto5_eng.c
index 8caad79..6f0cc8f 100644
--- a/platform/msm_shared/crypto5_eng.c
+++ b/platform/msm_shared/crypto5_eng.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 2012-2014, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2012-2015, The Linux Foundation. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
@@ -530,9 +530,16 @@
CRYPTO_SEND_DATA_ERR:
+ crypto5_unlock_pipes(dev);
+
return ret_status;
}
+void crypto5_unlock_pipes(struct crypto_dev *dev)
+{
+ CLEAR_STATUS(dev);
+}
+
void crypto5_cleanup(struct crypto_dev *dev)
{
CLEAR_STATUS(dev);
diff --git a/platform/msm_shared/crypto5_wrapper.c b/platform/msm_shared/crypto5_wrapper.c
index db12320..0be227a 100644
--- a/platform/msm_shared/crypto5_wrapper.c
+++ b/platform/msm_shared/crypto5_wrapper.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 2012, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2012,2015, The Linux Foundation. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
@@ -45,6 +45,11 @@
crypto5_cleanup(&dev);
}
+void crypto_unlock(void)
+{
+ crypto5_unlock_pipes(&dev);
+}
+
void ce_clock_init(void)
{
/* Clock init is done during crypto_init. */
@@ -109,4 +114,4 @@
uint32_t crypto_get_max_auth_blk_size()
{
return crypto5_get_max_auth_blk_size(&dev);
-}
\ No newline at end of file
+}
diff --git a/platform/msm_shared/hsusb.c b/platform/msm_shared/hsusb.c
index 766c197..abb3b1d 100644
--- a/platform/msm_shared/hsusb.c
+++ b/platform/msm_shared/hsusb.c
@@ -882,7 +882,11 @@
}
/* create our device descriptor */
- desc = udc_descriptor_alloc(TYPE_DEVICE, 0, 18);
+ if(!(desc = udc_descriptor_alloc(TYPE_DEVICE, 0, 18)))
+ {
+ dprintf(CRITICAL, "Failed to allocate device descriptor\n");
+ ASSERT(0);
+ }
data = desc->data;
data[2] = 0x00; /* usb spec minor rev */
data[3] = 0x02; /* usb spec major rev */
diff --git a/platform/msm_shared/include/crypto5_eng.h b/platform/msm_shared/include/crypto5_eng.h
index 872f46e..7f81488 100644
--- a/platform/msm_shared/include/crypto5_eng.h
+++ b/platform/msm_shared/include/crypto5_eng.h
@@ -1,4 +1,4 @@
-/* Copyright (c) 2012, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2012,2015, The Linux Foundation. All rights reserved.
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
@@ -177,5 +177,6 @@
crypto_auth_alg_type auth_alg);
void crypto5_get_ctx(struct crypto_dev *dev, void *ctx_ptr);
uint32_t crypto5_get_max_auth_blk_size(struct crypto_dev *dev);
+void crypto5_unlock_pipes(struct crypto_dev *dev);
#endif
diff --git a/platform/msm_shared/include/crypto5_wrapper.h b/platform/msm_shared/include/crypto5_wrapper.h
index 0ae4ff0..e205b76 100644
--- a/platform/msm_shared/include/crypto5_wrapper.h
+++ b/platform/msm_shared/include/crypto5_wrapper.h
@@ -1,4 +1,4 @@
-/* Copyright (c) 2012,2014 The Linux Foundation. All rights reserved.
+/* Copyright (c) 2012,2014-2015, The Linux Foundation. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
@@ -34,5 +34,6 @@
void crypto_init_params(struct crypto_init_params * params);
uint32_t crypto_get_max_auth_blk_size();
void crypto_eng_cleanup(void);
+void crypto_unlock(void);
#endif
diff --git a/platform/msm_shared/smd.c b/platform/msm_shared/smd.c
index e78b2d4..6ead08e 100644
--- a/platform/msm_shared/smd.c
+++ b/platform/msm_shared/smd.c
@@ -416,6 +416,15 @@
smd_state_update(ch, flag);
}
+static void flush_smd_channel_entries()
+{
+ int i = 0;
+ for(i = 0; i< SMEM_NUM_SMD_STREAM_CHANNELS; i++)
+ {
+ arch_invalidate_cache_range((addr_t)&smd_channel_alloc_entry[i],
+ sizeof(smd_channel_alloc_entry_t));
+ }
+}
enum handler_return smd_irq_handler(void* data)
{
@@ -423,6 +432,7 @@
if(ch->current_state == SMD_SS_CLOSED)
{
+ flush_smd_channel_entries();
free(smd_channel_alloc_entry);
event_signal(&smd_closed, false);
return INT_NO_RESCHEDULE;
diff --git a/platform/msm_shared/usb30_dwc.c b/platform/msm_shared/usb30_dwc.c
index 5ae8801..9e4a59a 100644
--- a/platform/msm_shared/usb30_dwc.c
+++ b/platform/msm_shared/usb30_dwc.c
@@ -1209,6 +1209,9 @@
uint32_t *event)
{
dwc_event_ep_event_id_t event_id = DWC_EVENT_EP_EVENT_ID(*event);
+#ifdef DEBUG_USB
+ uint8_t ep_phy_num = DWC_EVENT_EP_EVENT_EP_NUM(*event);
+#endif
switch (event_id)
{