Loading drivers/soc/qcom/bg_rsb.c +16 −1 Original line number Diff line number Diff line Loading @@ -128,6 +128,9 @@ struct bgrsb_priv { uint32_t calbrtion_cpi; uint8_t bttn_configs; bool calibration_needed; bool is_calibrd; }; static void *bgrsb_drv; Loading Loading @@ -406,7 +409,13 @@ static void bgrsb_bgdown_work(struct work_struct *work) else pr_err("Failed to unvote LDO-11 on BG down\n"); } pr_debug("RSB current state is : %d\n", dev->bgrsb_current_state); pr_info("RSB current state is : %d\n", dev->bgrsb_current_state); if (dev->bgrsb_current_state == BGRSB_STATE_INIT) { if (dev->is_calibrd) dev->calibration_needed = true; } } static void bgrsb_glink_bgdown_work(struct work_struct *work) Loading Loading @@ -635,6 +644,11 @@ static void bgrsb_enable_rsb(struct work_struct *work) } dev->bgrsb_current_state = BGRSB_STATE_RSB_ENABLED; pr_debug("RSB Enabled\n"); if (dev->calibration_needed) { dev->calibration_needed = false; queue_work(dev->bgrsb_wq, &dev->rsb_calibration_work); } } static void bgrsb_disable_rsb(struct work_struct *work) Loading Loading @@ -688,6 +702,7 @@ static void bgrsb_calibration(struct work_struct *work) pr_err("Failed to send interval value to BG\n"); return; } dev->is_calibrd = true; pr_debug("RSB Calibbered\n"); } Loading drivers/soc/qcom/bgcom.h +2 −2 Original line number Diff line number Diff line Loading @@ -197,14 +197,14 @@ int bgcom_ahb_write(void *handle, uint32_t ahb_start_addr, * @handle: BGCOM handle associated with the channel * Return 0 on success or -Ve on error */ int bgcom_suspend(void **handle); int bgcom_suspend(void *handle); /** * bgcom_resume() - Resumes the channel. * @handle: BGCOM handle associated with the channel * Return 0 on success or -Ve on error */ int bgcom_resume(void **handle); int bgcom_resume(void *handle); int bgcom_set_spi_state(enum bgcom_spi_state state); Loading drivers/soc/qcom/bgcom_spi.c +12 −12 Original line number Diff line number Diff line Loading @@ -464,7 +464,7 @@ int bgcom_ahb_read(void *handle, uint32_t ahb_start_addr, return -EBUSY; } if (bgcom_resume(&handle)) { if (bgcom_resume(handle)) { pr_err("Failed to resume\n"); return -EBUSY; } Loading Loading @@ -525,7 +525,7 @@ int bgcom_ahb_write(void *handle, uint32_t ahb_start_addr, return -EBUSY; } if (bgcom_resume(&handle)) { if (bgcom_resume(handle)) { pr_err("Failed to resume\n"); return -EBUSY; } Loading Loading @@ -574,7 +574,7 @@ int bgcom_fifo_write(void *handle, uint32_t num_words, return -EBUSY; } if (bgcom_resume(&handle)) { if (bgcom_resume(handle)) { pr_err("Failed to resume\n"); return -EBUSY; } Loading Loading @@ -757,23 +757,23 @@ static int is_bg_resume(void *handle) return cmnd_reg & BIT(31); } int bgcom_resume(void **handle) int bgcom_resume(void *handle) { struct bg_spi_priv *bg_spi; struct bg_context *cntx; int retry = 0; if (*handle == NULL) if (handle == NULL) return -EINVAL; cntx = *handle; cntx = (struct bg_context *)handle; bg_spi = cntx->bg_spi; mutex_lock(&bg_resume_mutex); if (bg_spi->bg_state == BGCOM_STATE_ACTIVE) goto unlock; do { if (is_bg_resume(*handle)) { if (is_bg_resume(handle)) { bg_spi->bg_state = BGCOM_STATE_ACTIVE; break; } Loading @@ -783,29 +783,29 @@ int bgcom_resume(void **handle) unlock: mutex_unlock(&bg_resume_mutex); pr_info("BG Resumed in %d retries\n", retry); pr_info("BG retries for wake up : %d\n", retry); return (retry == MAX_RETRY ? -ETIMEDOUT : 0); } EXPORT_SYMBOL(bgcom_resume); int bgcom_suspend(void **handle) int bgcom_suspend(void *handle) { struct bg_spi_priv *bg_spi; struct bg_context *cntx; uint32_t cmnd_reg = 0; int ret = 0; if (*handle == NULL) if (handle == NULL) return -EINVAL; cntx = *handle; cntx = (struct bg_context *)handle; bg_spi = cntx->bg_spi; mutex_lock(&bg_resume_mutex); if (bg_spi->bg_state == BGCOM_STATE_SUSPEND) goto unlock; cmnd_reg |= BIT(31); ret = bgcom_reg_write(*handle, BG_CMND_REG, 1, &cmnd_reg); ret = bgcom_reg_write(handle, BG_CMND_REG, 1, &cmnd_reg); if (ret == 0) bg_spi->bg_state = BGCOM_STATE_SUSPEND; Loading Loading
drivers/soc/qcom/bg_rsb.c +16 −1 Original line number Diff line number Diff line Loading @@ -128,6 +128,9 @@ struct bgrsb_priv { uint32_t calbrtion_cpi; uint8_t bttn_configs; bool calibration_needed; bool is_calibrd; }; static void *bgrsb_drv; Loading Loading @@ -406,7 +409,13 @@ static void bgrsb_bgdown_work(struct work_struct *work) else pr_err("Failed to unvote LDO-11 on BG down\n"); } pr_debug("RSB current state is : %d\n", dev->bgrsb_current_state); pr_info("RSB current state is : %d\n", dev->bgrsb_current_state); if (dev->bgrsb_current_state == BGRSB_STATE_INIT) { if (dev->is_calibrd) dev->calibration_needed = true; } } static void bgrsb_glink_bgdown_work(struct work_struct *work) Loading Loading @@ -635,6 +644,11 @@ static void bgrsb_enable_rsb(struct work_struct *work) } dev->bgrsb_current_state = BGRSB_STATE_RSB_ENABLED; pr_debug("RSB Enabled\n"); if (dev->calibration_needed) { dev->calibration_needed = false; queue_work(dev->bgrsb_wq, &dev->rsb_calibration_work); } } static void bgrsb_disable_rsb(struct work_struct *work) Loading Loading @@ -688,6 +702,7 @@ static void bgrsb_calibration(struct work_struct *work) pr_err("Failed to send interval value to BG\n"); return; } dev->is_calibrd = true; pr_debug("RSB Calibbered\n"); } Loading
drivers/soc/qcom/bgcom.h +2 −2 Original line number Diff line number Diff line Loading @@ -197,14 +197,14 @@ int bgcom_ahb_write(void *handle, uint32_t ahb_start_addr, * @handle: BGCOM handle associated with the channel * Return 0 on success or -Ve on error */ int bgcom_suspend(void **handle); int bgcom_suspend(void *handle); /** * bgcom_resume() - Resumes the channel. * @handle: BGCOM handle associated with the channel * Return 0 on success or -Ve on error */ int bgcom_resume(void **handle); int bgcom_resume(void *handle); int bgcom_set_spi_state(enum bgcom_spi_state state); Loading
drivers/soc/qcom/bgcom_spi.c +12 −12 Original line number Diff line number Diff line Loading @@ -464,7 +464,7 @@ int bgcom_ahb_read(void *handle, uint32_t ahb_start_addr, return -EBUSY; } if (bgcom_resume(&handle)) { if (bgcom_resume(handle)) { pr_err("Failed to resume\n"); return -EBUSY; } Loading Loading @@ -525,7 +525,7 @@ int bgcom_ahb_write(void *handle, uint32_t ahb_start_addr, return -EBUSY; } if (bgcom_resume(&handle)) { if (bgcom_resume(handle)) { pr_err("Failed to resume\n"); return -EBUSY; } Loading Loading @@ -574,7 +574,7 @@ int bgcom_fifo_write(void *handle, uint32_t num_words, return -EBUSY; } if (bgcom_resume(&handle)) { if (bgcom_resume(handle)) { pr_err("Failed to resume\n"); return -EBUSY; } Loading Loading @@ -757,23 +757,23 @@ static int is_bg_resume(void *handle) return cmnd_reg & BIT(31); } int bgcom_resume(void **handle) int bgcom_resume(void *handle) { struct bg_spi_priv *bg_spi; struct bg_context *cntx; int retry = 0; if (*handle == NULL) if (handle == NULL) return -EINVAL; cntx = *handle; cntx = (struct bg_context *)handle; bg_spi = cntx->bg_spi; mutex_lock(&bg_resume_mutex); if (bg_spi->bg_state == BGCOM_STATE_ACTIVE) goto unlock; do { if (is_bg_resume(*handle)) { if (is_bg_resume(handle)) { bg_spi->bg_state = BGCOM_STATE_ACTIVE; break; } Loading @@ -783,29 +783,29 @@ int bgcom_resume(void **handle) unlock: mutex_unlock(&bg_resume_mutex); pr_info("BG Resumed in %d retries\n", retry); pr_info("BG retries for wake up : %d\n", retry); return (retry == MAX_RETRY ? -ETIMEDOUT : 0); } EXPORT_SYMBOL(bgcom_resume); int bgcom_suspend(void **handle) int bgcom_suspend(void *handle) { struct bg_spi_priv *bg_spi; struct bg_context *cntx; uint32_t cmnd_reg = 0; int ret = 0; if (*handle == NULL) if (handle == NULL) return -EINVAL; cntx = *handle; cntx = (struct bg_context *)handle; bg_spi = cntx->bg_spi; mutex_lock(&bg_resume_mutex); if (bg_spi->bg_state == BGCOM_STATE_SUSPEND) goto unlock; cmnd_reg |= BIT(31); ret = bgcom_reg_write(*handle, BG_CMND_REG, 1, &cmnd_reg); ret = bgcom_reg_write(handle, BG_CMND_REG, 1, &cmnd_reg); if (ret == 0) bg_spi->bg_state = BGCOM_STATE_SUSPEND; Loading