Received: by 10.223.185.111 with SMTP id b44csp862449wrg; Fri, 9 Mar 2018 15:27:35 -0800 (PST) X-Google-Smtp-Source: AG47ELsf7rO22kFBA1AD0XWJcX+CLip38CpW9j95WKH9oGHGEguhxiacipbAObbSz/KZqLjn32EE X-Received: by 2002:a17:902:2cc1:: with SMTP id n59-v6mr173536plb.215.1520638054968; Fri, 09 Mar 2018 15:27:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520638054; cv=none; d=google.com; s=arc-20160816; b=x9uaExP8gzcOMT9bI+pcMHRcHKyLBorOlVW6O/CXPlNS2uK/KxAcu3p5V0N5O1O6e3 r6FtXCrnGysIosXK5kUnGUKdAxxp4E3Wvq9J4Jf9nflFBTB+L6R06pRQx2g3QS5NS3nR XrR8m3Vqi87Kga4C74CEXnKDsPXInLjdSTbUDV02LazuBJnMBoLTnaqJ4dZuipHV8oaQ jSCbOs7N4KWpkYE3US/EaUK6KAWgvDjHJ7G5FcYbxbSt3UtN0EodHHaZq8B6dp/StQ0g eSeaX3Cp5h02kTNEl0cqBfBhywvAuZRyFoVcvTHSQEpw/Wdjd6PFUXU/Dkiy3ifz1LuC EJlQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dmarc-filter:dkim-signature:dkim-signature :arc-authentication-results; bh=P8/RBV7kmaSNiZrvpBsTfevZ/rJY5v75Vqexq/8qHu8=; b=F2BTorQh36mhEUFrkXaZkdSfbaY4swEYfn4ExC/4b6nuco8B6Nx0XZQT3JbTud7dtH gxPQrSpVgkAuUHjepe/L96SwNIexjDlxrkK+6VkHnFhGLPKEzyJhx9zgpXjDqwy21EJk cweQBUsKj33AHlBo0AQ5qY9HgwOdlLnhDLuiZfxVtgI1RR5edbXJWN56oLWdJMrwmA2o z/j1VPGc0yJga9Re7/CoYKgVMVik8K032TKyfiOcPkE0XU6vBJT2tvNpaLUcpThCVA/j F6T0MRTqLgXBieHdWreasnT6/z1naAJPCeas0bcFkFa4Upm5GPcTiwnILlhrpq+jVCjZ w+3A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b=N9Gpw0W3; dkim=pass header.i=@codeaurora.org header.s=default header.b=bXDBOEuW; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d15-v6si1744077pln.186.2018.03.09.15.27.20; Fri, 09 Mar 2018 15:27:34 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b=N9Gpw0W3; dkim=pass header.i=@codeaurora.org header.s=default header.b=bXDBOEuW; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932892AbeCIX0F (ORCPT + 99 others); Fri, 9 Mar 2018 18:26:05 -0500 Received: from smtp.codeaurora.org ([198.145.29.96]:54022 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932873AbeCIX0C (ORCPT ); Fri, 9 Mar 2018 18:26:02 -0500 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 091FD6095F; Fri, 9 Mar 2018 23:26:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1520637962; bh=bo73knlsa38rpDMzodcMv1X2/+inTVdUF9X4y86tqMk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=N9Gpw0W3xnQvYMK2BED+D7xNas5oE/tPTRekYsn9aYbwLm8LcSDErI6g+E2MVr7gi rEZ8G+tN1qqe5VLsUb+EHoAw/Z2om6Orzt+0VWkk6/fAt+fjahpm5j9F/iH2WIFeaE bOmtdYeUBb+2ccpJSwyi6sZqX1oNdVoQm3gJSuRw= X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on pdx-caf-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.8 required=2.0 tests=ALL_TRUSTED,BAYES_00, DKIM_SIGNED,T_DKIM_INVALID autolearn=no autolearn_force=no version=3.4.0 Received: from codeaurora.org (i-global254.qualcomm.com [199.106.103.254]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: ilina@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id EE9D860817; Fri, 9 Mar 2018 23:25:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1520637959; bh=bo73knlsa38rpDMzodcMv1X2/+inTVdUF9X4y86tqMk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bXDBOEuWM4g4G1eCcbUSIK3xMZj8t/jNfkORpdOoPiU8SHBSgJ5cu+0ooTrwcYgHv 3XRKL8Tv98uUNfpGePh+FYGmEfLgDecZDc6AAtlVi+XM5laXhQSXdEK7vSgn2ZGwzw fBlpQSBu7KEO7535g6oNfXkLhW5r3wJKjJ8KES+o= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org EE9D860817 Authentication-Results: pdx-caf-mail.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: pdx-caf-mail.web.codeaurora.org; spf=none smtp.mailfrom=ilina@codeaurora.org From: Lina Iyer To: andy.gross@linaro.org, david.brown@linaro.org, linux-arm-msm@vger.kernel.org Cc: linux-soc@vger.kernel.org, rnayak@codeaurora.org, bjorn.andersson@linaro.org, linux-kernel@vger.kernel.org, sboyd@kernel.org, Lina Iyer Subject: [PATCH v4 10/10] drivers: qcom: rpmh-rsc: allow active requests from wake TCS Date: Fri, 9 Mar 2018 16:25:43 -0700 Message-Id: <20180309232543.24636-11-ilina@codeaurora.org> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180309232543.24636-1-ilina@codeaurora.org> References: <20180309232543.24636-1-ilina@codeaurora.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Some RSCs may only have sleep and wake TCS, i.e, there is no dedicated TCS for active mode request, but drivers may still want to make active requests from these RSCs. In such cases re-purpose the wake TCS to send active state requests. The requirement for this is that the driver is aware that the wake TCS is being repurposed to send active request, hence the sleep and wake TCSes be invalidated before the active request is sent. Signed-off-by: Lina Iyer --- drivers/soc/qcom/rpmh-rsc.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/drivers/soc/qcom/rpmh-rsc.c b/drivers/soc/qcom/rpmh-rsc.c index 1dbccc4d0605..c1a460a8d955 100644 --- a/drivers/soc/qcom/rpmh-rsc.c +++ b/drivers/soc/qcom/rpmh-rsc.c @@ -214,6 +214,7 @@ static struct tcs_group *get_tcs_for_msg(struct rsc_drv *drv, const struct tcs_request *msg) { int type; + struct tcs_group *tcs; switch (msg->state) { case RPMH_ACTIVE_ONLY_STATE: @@ -229,7 +230,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; } static void send_tcs_response(struct tcs_response *resp) -- The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project