From a8ca7f90130a95852bd7612a4253738a084d039c Mon Sep 17 00:00:00 2001 From: Boojin Kim Date: Thu, 6 Dec 2018 13:17:56 +0900 Subject: [PATCH] [ERD][APR-103] [COMMON]chub: change name of kernel log flag to wake flag Change-Id: I6f5e1e936e8ea451695a7750c522d925669019b3 Signed-off-by: Sukwon Ryoo --- drivers/staging/nanohub/chub.c | 31 +++++++++++++++++++++++++----- drivers/staging/nanohub/chub_ipc.c | 8 ++++---- drivers/staging/nanohub/chub_ipc.h | 12 +++++------- 3 files changed, 35 insertions(+), 16 deletions(-) diff --git a/drivers/staging/nanohub/chub.c b/drivers/staging/nanohub/chub.c index d77fa8fb9c6b..7ceac250e682 100644 --- a/drivers/staging/nanohub/chub.c +++ b/drivers/staging/nanohub/chub.c @@ -559,7 +559,6 @@ static int contexthub_hw_reset(struct contexthub_ipc_info *ipc, ipc_hw_write_shared_reg(AP, ipc->os_load, SR_BOOT_MODE); ipc_set_chub_clk((u32)ipc->clkrate); ipc_set_chub_bootmode(BOOTMODE_COLD); - ipc_set_chub_kernel_log(KERNEL_LOG_ON); switch (event) { case MAILBOX_EVT_POWER_ON: @@ -750,6 +749,7 @@ int contexthub_ipc_write_event(struct contexthub_ipc_info *ipc, atomic_set(&ipc->chub_status, CHUB_ST_SHUTDOWN); break; case MAILBOX_EVT_CHUB_ALIVE: + ipc_hw_write_shared_reg(AP, AP_WAKE, SR_3); val = contexthub_lowlevel_alive(ipc); if (val) { atomic_set(&ipc->chub_status, CHUB_ST_RUN); @@ -1057,6 +1057,9 @@ static irqreturn_t contexthub_irq_handler(int irq, void *data) enum chub_err_type err = 0; enum irq_chub evt = 0; int irq_num = IRQ_EVT_CHUB_ALIVE + start_index; +#ifndef CHECK_HW_TRIGGER + int i; +#endif /* chub alive interrupt handle */ if (status & (1 << irq_num)) { @@ -1072,6 +1075,23 @@ static irqreturn_t contexthub_irq_handler(int irq, void *data) wake_up(&ipc->chub_alive_lock.event); } +#ifndef CHECK_HW_TRIGGER + if (status) { + for (i = start_index; i < irq_num; i++) { + if (status & (1 << i)) { + cur_evt = ipc_get_evt(IPC_EVT_C2A); + if (cur_evt) { + evt = cur_evt->evt; + handle_irq(ipc, (u32)evt); + ipc_hw_clear_int_pend_reg(AP, i); + } else { + err = CHUB_ERR_EVTQ_EMTPY; + break; + } + } + } + } +#else /* chub ipc interrupt handle */ while (status) { cur_evt = ipc_get_evt(IPC_EVT_C2A); @@ -1094,6 +1114,7 @@ static irqreturn_t contexthub_irq_handler(int irq, void *data) ipc_hw_clear_int_pend_reg(AP, irq_num); status &= ~(1 << irq_num); } +#endif if (err) { pr_err("inval irq err(%d):start_irqnum:%d,evt(%p):%d,irq_hw:%d,status_reg:0x%x(0x%x,0x%x)\n", @@ -1499,8 +1520,8 @@ static int contexthub_suspend(struct device *dev) if (atomic_read(&ipc->chub_status) != CHUB_ST_RUN) return 0; - dev_dbg(dev, "nanohub log to kernel off\n"); - ipc_hw_write_shared_reg(AP, MAILBOX_REQUEST_KLOG_OFF, SR_3); + dev_info(dev, "nanohub log to kernel off\n"); + ipc_hw_write_shared_reg(AP, AP_SLEEP, SR_3); ipc_hw_gen_interrupt(AP, IRQ_EVT_CHUB_ALIVE); #ifdef CONFIG_CHRE_SENSORHUB_HAL @@ -1520,8 +1541,8 @@ static int contexthub_resume(struct device *dev) if (atomic_read(&ipc->chub_status) != CHUB_ST_RUN) return 0; - dev_dbg(dev, "nanohub log to kernel on\n"); - ipc_hw_write_shared_reg(AP, MAILBOX_REQUEST_KLOG_ON, SR_3); + dev_info(dev, "nanohub log to kernel on\n"); + ipc_hw_write_shared_reg(AP, AP_WAKE, SR_3); ipc_hw_gen_interrupt(AP, IRQ_EVT_CHUB_ALIVE); #ifdef CONFIG_CHRE_SENSORHUB_HAL diff --git a/drivers/staging/nanohub/chub_ipc.c b/drivers/staging/nanohub/chub_ipc.c index bcc67196dc00..a314edc68726 100644 --- a/drivers/staging/nanohub/chub_ipc.c +++ b/drivers/staging/nanohub/chub_ipc.c @@ -178,18 +178,18 @@ u16 ipc_get_chub_bootmode(void) return map->bootmode; } -void ipc_set_chub_kernel_log(u16 kernel_log) +void ipc_set_ap_wake(u16 wake) { struct chub_bootargs *map = ipc_get_base(IPC_REG_BL_MAP); - map->kernel_log = kernel_log; + map->wake = wake; } -u16 ipc_get_chub_kernel_log(void) +u16 ipc_get_ap_wake(void) { struct chub_bootargs *map = ipc_get_base(IPC_REG_BL_MAP); - return map->kernel_log; + return map->wake; } #if defined(LOCAL_POWERGATE) diff --git a/drivers/staging/nanohub/chub_ipc.h b/drivers/staging/nanohub/chub_ipc.h index 5c11b3ec1a0d..3b90f67692b7 100644 --- a/drivers/staging/nanohub/chub_ipc.h +++ b/drivers/staging/nanohub/chub_ipc.h @@ -75,15 +75,13 @@ #define BOOTMODE_COLD (0x7733) #define BOOTMODE_PWRGATING (0x1188) -#define KERNEL_LOG_ON (0x1) -#define KERNEL_LOG_OFF (0x0) +#define AP_WAKE (0x1) +#define AP_SLEEP (0x2) #define AP_WAKE (0x1) #define AP_SLEEP (0x2) #define READY_TO_GO 99 -#define MAILBOX_REQUEST_KLOG_ON (0x1) -#define MAILBOX_REQUEST_KLOG_OFF (0x2) struct chub_bootargs { char magic[16]; @@ -102,7 +100,7 @@ struct chub_bootargs { u32 dump_end; u32 chubclk; u16 bootmode; - u16 kernel_log; + u16 wake; #if defined(LOCAL_POWERGATE) u32 psp; u32 msp; @@ -534,8 +532,8 @@ void ipc_set_chub_clk(u32 clk); u32 ipc_get_chub_clk(void); void ipc_set_chub_bootmode(u16 bootmode); u16 ipc_get_chub_bootmode(void); -void ipc_set_chub_kernel_log(u16 kernel_log); -u16 ipc_get_chub_kernel_log(void); +void ipc_set_ap_wake(u16 wake); +u16 ipc_get_ap_wake(void); void ipc_dump(void); #if defined(LOCAL_POWERGATE) u32 *ipc_get_chub_psp(void); -- 2.20.1