Skip to content

Commit

Permalink
g12b: remote_key: modify wake up key [1/1]
Browse files Browse the repository at this point in the history
PD#169590

Problem:
wake up key set wrong

Solution:
modify adc_key to gpioao key

Verify:
g12b

Change-Id: I8b96f39198abfa20f811879535682b80987d6899
Signed-off-by: liangzhuo.xie <[email protected]>
  • Loading branch information
liangzhuo.xie authored and Xiaobo Gu committed Jul 5, 2018
1 parent 94c8e8f commit 2546db5
Showing 1 changed file with 17 additions and 12 deletions.
29 changes: 17 additions & 12 deletions board/amlogic/g12b_w400_v1/firmware/scp_task/pwr_ctrl.c
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ static void power_on_at_24M(unsigned int suspend_from)
void get_wakeup_source(void *response, unsigned int suspend_from)
{
struct wakeup_info *p = (struct wakeup_info *)response;
struct wakeup_gpio_info *gpio;
unsigned val;
unsigned i = 0;

Expand All @@ -88,7 +89,17 @@ void get_wakeup_source(void *response, unsigned int suspend_from)
ETH_PHY_WAKEUP_SRC | BT_WAKEUP_SRC);

p->sources = val;
p->gpio_info_count = i;

/* Power Key: AO_GPIO[3]*/
gpio = &(p->gpio_info[i]);
gpio->wakeup_id = POWER_KEY_WAKEUP_SRC;
gpio->gpio_in_idx = GPIOAO_3;
gpio->gpio_in_ao = 1;
gpio->gpio_out_idx = -1;
gpio->gpio_out_ao = -1;
gpio->irq = IRQ_AO_GPIO0_NUM;
gpio->trig_type = GPIO_IRQ_FALLING_EDGE;
p->gpio_info_count = ++i;

}
extern void __switch_idle_task(void);
Expand All @@ -97,7 +108,6 @@ static unsigned int detect_key(unsigned int suspend_from)
{
int exit_reason = 0;
unsigned *irq = (unsigned *)WAKEUP_SRC_IRQ_ADDR_BASE;
unsigned char adc_key_cnt = 0;
init_remote();
saradc_enable();
#ifdef CONFIG_CEC_WAKEUP
Expand Down Expand Up @@ -126,16 +136,11 @@ static unsigned int detect_key(unsigned int suspend_from)
exit_reason = RTC_WAKEUP;
}

if (irq[IRQ_AO_TIMERA] == IRQ_AO_TIMERA_NUM) {
irq[IRQ_AO_TIMERA] = 0xFFFFFFFF;
if (check_adc_key_resume()) {
adc_key_cnt++;
/*using variable 'adc_key_cnt' to eliminate the dithering of the key*/
if (2 == adc_key_cnt)
exit_reason = POWER_KEY_WAKEUP;
} else {
adc_key_cnt = 0;
}

if (irq[IRQ_AO_GPIO0] == IRQ_AO_GPIO0_NUM) {
irq[IRQ_AO_GPIO0] = 0xFFFFFFFF;
if ((readl(AO_GPIO_I) & (1<<3)) == 0)
exit_reason = POWER_KEY_WAKEUP;
}

if (exit_reason)
Expand Down

0 comments on commit 2546db5

Please sign in to comment.