Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drivers: qcom: rpmh-rsc: allow invalidation of sleep/wake TCS

Allow sleep and wake commands to be cleared from the respective TCSes,
so that they can be re-populated.

Signed-off-by: Lina Iyer <ilina@codeaurora.org>
Signed-off-by: Raju P.L.S.S.S.N <rplsssn@codeaurora.org>
Signed-off-by: Andy Gross <andy.gross@linaro.org>

authored by

Lina Iyer and committed by
Andy Gross
9a3afcfb fa460e45

+44
+44
drivers/soc/qcom/rpmh-rsc.c
··· 101 101 return &drv->tcs[type]; 102 102 } 103 103 104 + static int tcs_invalidate(struct rsc_drv *drv, int type) 105 + { 106 + int m; 107 + struct tcs_group *tcs; 108 + 109 + tcs = get_tcs_of_type(drv, type); 110 + if (IS_ERR(tcs)) 111 + return PTR_ERR(tcs); 112 + 113 + spin_lock(&tcs->lock); 114 + if (bitmap_empty(tcs->slots, MAX_TCS_SLOTS)) { 115 + spin_unlock(&tcs->lock); 116 + return 0; 117 + } 118 + 119 + for (m = tcs->offset; m < tcs->offset + tcs->num_tcs; m++) { 120 + if (!tcs_is_free(drv, m)) { 121 + spin_unlock(&tcs->lock); 122 + return -EAGAIN; 123 + } 124 + write_tcs_reg_sync(drv, RSC_DRV_CMD_ENABLE, m, 0); 125 + } 126 + bitmap_zero(tcs->slots, MAX_TCS_SLOTS); 127 + spin_unlock(&tcs->lock); 128 + 129 + return 0; 130 + } 131 + 132 + /** 133 + * rpmh_rsc_invalidate - Invalidate sleep and wake TCSes 134 + * 135 + * @drv: the RSC controller 136 + */ 137 + int rpmh_rsc_invalidate(struct rsc_drv *drv) 138 + { 139 + int ret; 140 + 141 + ret = tcs_invalidate(drv, SLEEP_TCS); 142 + if (!ret) 143 + ret = tcs_invalidate(drv, WAKE_TCS); 144 + 145 + return ret; 146 + } 147 + 104 148 static struct tcs_group *get_tcs_for_msg(struct rsc_drv *drv, 105 149 const struct tcs_request *msg) 106 150 {