Re: [PATCH v3 10/10] drivers: qcom: rpmh-rsc: allow active requests from wake TCS

From: Stephen Boyd
Date: Thu Mar 08 2018 - 15:47:16 EST


Quoting Lina Iyer (2018-03-02 08:43:17)
> diff --git a/drivers/soc/qcom/rpmh-rsc.c b/drivers/soc/qcom/rpmh-rsc.c
> index e9f5a1f387fd..d9cfa7aaf49c 100644
> --- a/drivers/soc/qcom/rpmh-rsc.c
> +++ b/drivers/soc/qcom/rpmh-rsc.c
> @@ -220,6 +220,7 @@ static struct tcs_group *get_tcs_for_msg(struct rsc_drv *drv,
> struct tcs_request *msg)
> {
> int type;
> + struct tcs_group *tcs;

const?

>
> switch (msg->state) {
> case RPMH_ACTIVE_ONLY_STATE:
> @@ -235,7 +236,22 @@ static struct tcs_group *get_tcs_for_msg(struct rsc_drv *drv,
> return ERR_PTR(-EINVAL);
> }
>
> - return get_tcs_of_type(drv, type);
> + /*
> + * If we are making an active request on a RSC that does not have a
> + * dedicated TCS for active state use, then re-purpose a wake TCS to
> + * send active votes.
> + * NOTE: The driver must be aware that this RSC does not have a
> + * dedicated AMC, and therefore would invalidate the sleep and wake
> + * TCSes before making an active state request.
> + */
> + tcs = get_tcs_of_type(drv, type);
> + if (msg->state == RPMH_ACTIVE_ONLY_STATE && IS_ERR(tcs)) {
> + tcs = get_tcs_of_type(drv, WAKE_TCS);
> + if (!IS_ERR(tcs))
> + rpmh_rsc_invalidate(drv);
> + }
> +
> + return tcs;