diff --git a/drivers/soc/qcom/rpmh-rsc.c b/drivers/soc/qcom/rpmh-rsc.c index 71a5a5452a6e..05775e056952 100644 --- a/drivers/soc/qcom/rpmh-rsc.c +++ b/drivers/soc/qcom/rpmh-rsc.c @@ -1218,6 +1218,13 @@ int rpmh_rsc_is_tcs_completed(struct rsc_drv *drv, int ch) sts &= CH1_WAKE_TCS_STATUS; retry--; + /* + * Wait till all the WAKE votes of the new channel are + * applied during channel switch. + * Maximum delay of 100 usec. + */ + if (!sts) + udelay(10); } while (!sts && retry); if (!retry) { diff --git a/drivers/soc/qcom/rpmh.c b/drivers/soc/qcom/rpmh.c index 9c5d87a27872..d1494d7033af 100644 --- a/drivers/soc/qcom/rpmh.c +++ b/drivers/soc/qcom/rpmh.c @@ -445,6 +445,7 @@ int _rpmh_flush(struct rpmh_ctrlr *ctrlr, int ch) */ int rpmh_flush(struct rpmh_ctrlr *ctrlr, int ch) { + unsigned long flags; int ret; if (rpmh_standalone) @@ -464,14 +465,9 @@ int rpmh_flush(struct rpmh_ctrlr *ctrlr, int ch) if (!(ctrlr->flags & SOLVER_PRESENT)) lockdep_assert_irqs_disabled(); - /* - * If the lock is busy it means another transaction is on going, - * in such case it's better to abort than spin. - */ - if (!spin_trylock(&ctrlr->cache_lock)) - return -EBUSY; + spin_lock_irqsave(&ctrlr->cache_lock, flags); ret = _rpmh_flush(ctrlr, ch); - spin_unlock(&ctrlr->cache_lock); + spin_unlock_irqrestore(&ctrlr->cache_lock, flags); return ret; }