Skip to content

Commit 9a3afcf

Browse files
Lina IyerAndy Gross
authored andcommitted
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>
1 parent fa460e4 commit 9a3afcf

File tree

1 file changed

+44
-0
lines changed

1 file changed

+44
-0
lines changed

drivers/soc/qcom/rpmh-rsc.c

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,50 @@ static struct tcs_group *get_tcs_of_type(struct rsc_drv *drv, int type)
101101
return &drv->tcs[type];
102102
}
103103

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+
104148
static struct tcs_group *get_tcs_for_msg(struct rsc_drv *drv,
105149
const struct tcs_request *msg)
106150
{

0 commit comments

Comments
 (0)