target: Modify API for detecting volume up key in timer callback
Modify function for detecting volume up key in timer callback
Change-Id: I54eccca8c9429fe66745592cc01089e3e7c05bd7
diff --git a/target/msm8952/init.c b/target/msm8952/init.c
index 41ff356..2f1ea36 100644
--- a/target/msm8952/init.c
+++ b/target/msm8952/init.c
@@ -174,6 +174,7 @@
/* Return 1 if vol_up pressed */
int target_volume_up()
{
+ static uint8_t first_time = 0;
uint8_t status = 0;
uint32_t vol_up_gpio;
@@ -183,10 +184,14 @@
else
vol_up_gpio = TLMM_VOL_UP_BTN_GPIO;
- gpio_tlmm_config(vol_up_gpio, 0, GPIO_INPUT, GPIO_PULL_UP, GPIO_2MA, GPIO_ENABLE);
+ if (!first_time) {
+ gpio_tlmm_config(vol_up_gpio, 0, GPIO_INPUT, GPIO_PULL_UP, GPIO_2MA, GPIO_ENABLE);
- /* Wait for the gpio config to take effect - debounce time */
- 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(vol_up_gpio);