target: Modify API for detecting volume up key in timer callback
Modify function for detecting volume up key in timer callback.
Change-Id: Id5165b7453145b913096c7d623a1a1eeca8b76c7
diff --git a/target/msm8226/init.c b/target/msm8226/init.c
index 1995c27..c27e07a 100644
--- a/target/msm8226/init.c
+++ b/target/msm8226/init.c
@@ -141,11 +141,16 @@
/* Return 1 if vol_up pressed */
static int target_volume_up()
{
+ static uint8_t first_time = 0;
uint8_t status = 0;
- gpio_tlmm_config(TLMM_VOL_UP_BTN_GPIO, 0, GPIO_INPUT, GPIO_PULL_UP, GPIO_2MA, GPIO_ENABLE);
+ if (!first_time) {
+ gpio_tlmm_config(TLMM_VOL_UP_BTN_GPIO, 0, GPIO_INPUT, GPIO_PULL_UP, GPIO_2MA, GPIO_ENABLE);
- thread_sleep(10);
+ /* Wait for the gpio config to take effect - debounce time */
+ udelay(10000);
+ first_time = 1;
+ }
/* Get status of GPIO */
status = gpio_status(TLMM_VOL_UP_BTN_GPIO);