From: Boyoung Date: Mon, 10 Dec 2018 23:07:20 +0000 (+0900) Subject: [ERD][APR-103] [COMMON]chub: add slient reset for chub error X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=a1ddcc371ee00c6442f81f7e358a4b4fa06c2f63;p=GitHub%2FLineageOS%2Fandroid_kernel_motorola_exynos9610.git [ERD][APR-103] [COMMON]chub: add slient reset for chub error Change-Id: I18bdbc2ee03bde8cd7992e50c367db4652971fa1 Signed-off-by: Boyoung --- diff --git a/drivers/staging/nanohub/chub.c b/drivers/staging/nanohub/chub.c index 7ceac250e682..fa9da88f1f53 100644 --- a/drivers/staging/nanohub/chub.c +++ b/drivers/staging/nanohub/chub.c @@ -342,6 +342,24 @@ static void contexthub_handle_debug(struct contexthub_ipc_info *ipc, dev_info(ipc->dev, "%s: err:%d(cnt:%d), enable_wq:%d\n", __func__, err, ipc->err_cnt[err], enable_wq); + /* set status in CHUB_ST_ERR */ + if ((err == CHUB_ERR_ITMON) || (err == CHUB_ERR_FW_WDT) || (err == CHUB_ERR_FW_FAULT) || (err == CHUB_ERR_CHUB_NO_RESPONSE)) { + atomic_set(&ipc->chub_status, CHUB_ST_ERR); + goto error_handler; + } + + if (err < CHUB_ERR_NEED_RESET) { + if (ipc->err_cnt[err] > CHUB_RESET_THOLD) { + atomic_set(&ipc->chub_status, CHUB_ST_ERR); + ipc->err_cnt[err] = 0; + dev_info(ipc->dev, "%s: err:%d(cnt:%d), enter error status\n", + __func__, err, ipc->err_cnt[err]); + } else { + ipc->err_cnt[err]++; + return; + } + } + /* get chub-fw err */ if (err == CHUB_ERR_NANOHUB) { enum ipc_debug_event fw_evt; @@ -362,10 +380,7 @@ static void contexthub_handle_debug(struct contexthub_ipc_info *ipc, contexthub_put_token(ipc); } - /* set status in CHUB_ST_ERR */ - if ((err == CHUB_ERR_ITMON) || (err == CHUB_ERR_FW_WDT) || (err == CHUB_ERR_FW_FAULT)) - atomic_set(&ipc->chub_status, CHUB_ST_ERR); - +error_handler: /* handle err */ if (enable_wq) { ipc->cur_err |= (1 << err); @@ -778,11 +793,16 @@ int contexthub_ipc_write_event(struct contexthub_ipc_info *ipc, } if (need_ipc) { - if (contexthub_get_token(ipc) || (atomic_read(&ipc->chub_status) != CHUB_ST_RUN)) { + if (atomic_read(&ipc->chub_status) != CHUB_ST_RUN) { dev_warn(ipc->dev, "%s event:%d/%d fails chub isn't active, status:%d, inreset:%d\n", __func__, event, MAILBOX_EVT_MAX, atomic_read(&ipc->chub_status), atomic_read(&ipc->in_reset)); return -EINVAL; } + if (contexthub_get_token(ipc)) { + dev_warn(ipc->dev, "%s event:%d/%d fails to get token, status:%d, inreset:%d\n", + __func__, event, MAILBOX_EVT_MAX, atomic_read(&ipc->chub_status), atomic_read(&ipc->in_reset)); + return -EINVAL; + } /* handle ipc */ switch (event) {