Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp617261imm; Fri, 27 Jul 2018 03:07:15 -0700 (PDT) X-Google-Smtp-Source: AAOMgpesrUMBjxagGt0ZWsJEdd4Yss+mNZRowIvaayIZHtO2i88rzFPE0gmPofEz0UT2vSjCIevV X-Received: by 2002:a62:3a5b:: with SMTP id h88-v6mr5981087pfa.61.1532686035497; Fri, 27 Jul 2018 03:07:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532686035; cv=none; d=google.com; s=arc-20160816; b=rF6VV881Yd1xzdu43ysnyakqLJUsMJOy24YS1uJ7976gx4VkwvlP/onvPv/C4nBVSN rAIMGaCRghoqPrKoL9jYt0sFnkiIkKz9dGTYpFZYA0Tv0YoOaI33AuZSv7iBdlI1ts5x wrPr+WL4kpL57ZiuRRY/NzhxCCgYRuwjAZU1q8bTK0JLR4PieGlX8U2BJuVC388n31g2 WpscahMRBBW/Qjq7K9tOj2VzbZ02bmiSRGODDRqs5dBXrHeFRSdjWnTVLatTX2znjvi3 NIi1DK1s5NHLG8/Ze1vCQsj92V0+zzE8gpWwUBIGFdmMaSinOshbv2LdABEofP9CoTMA eCxg== 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=C2twvJOzpVG+pu9gO/PXQ8CtOZ0VxJrs7kYuYk//PMU=; b=DRjy05iFR/wvbIYsFcaqxZnB6UfI/3v5J4ULvYf+sjl4Rh9dHUQGfikXJzUD9iItkk 7sxcDx/nANpIE/DemDGrHUkx6x8s+2DdkpbF+/N+SWumUyBaK/obLUemKNGzu4XGwUzj Y5HaQb/1pluyIY2HgwvuVk1qWvlU7nVKWFGnzxjEhislIpkj4h+q4Vhe863jRrH4ujHv 6TbaNYB+P4qKUNmCAkMmfP2x5m3zj1yZJXq73tJ9UTM59FgTbcNk80+UnSGksxOCThzG tSlVs224tdVJjI+M4O0j6nkNaXsQGvXjeKh1Q6wi0Z+/7m3pv4/SzEQdszhjt3EXOI21 5noA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b=oVnXj9Dl; dkim=pass header.i=@codeaurora.org header.s=default header.b=RlHZfpgT; 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 m18-v6si3476456pgi.688.2018.07.27.03.07.00; Fri, 27 Jul 2018 03:07:15 -0700 (PDT) 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=oVnXj9Dl; dkim=pass header.i=@codeaurora.org header.s=default header.b=RlHZfpgT; 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 S2389231AbeG0L0O (ORCPT + 99 others); Fri, 27 Jul 2018 07:26:14 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:45230 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388964AbeG0L0N (ORCPT ); Fri, 27 Jul 2018 07:26:13 -0400 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 785B660B74; Fri, 27 Jul 2018 10:05:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1532685902; bh=LXSvzrGk8u8GMe066kKwp4GfgpPSPfky36YVntV17nA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=oVnXj9DlimNKonMI9wA2QXIuDzUwhoVOLu/vy4j23uc7r1MGOMmrqwwPb+6CTfrnv usQwIT6Bkc/B1loOMQF1dNBNHAqXsZNPTVG3EXOjT3BKrAm7tzqUVDoho7yLNzl3G9 Sinm5odsKbaQlsLuRltchCfqrQp9DVzn7n9mlO7g= 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.3 required=2.0 tests=ALL_TRUSTED,BAYES_00, DKIM_SIGNED,FROM_LOCAL_NOVOWEL,T_DKIM_INVALID autolearn=no autolearn_force=no version=3.4.0 Received: from rplsssn-linux.qualcomm.com (blr-c-bdr-fw-01_globalnat_allzones-outside.qualcomm.com [103.229.19.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: rplsssn@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id 419B760B19; Fri, 27 Jul 2018 10:04:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1532685901; bh=LXSvzrGk8u8GMe066kKwp4GfgpPSPfky36YVntV17nA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RlHZfpgTINCdkeYLEQpFbbsFvrtACKhGGy/3dNTy54SaAYv4KZG/Rn5ToJLkTSMWK E5b4vUnWSLLFBDOTlD5v7WrNtp3KVaInL1bGWQUuLLVRDst6TBpb/EYF50mDtVlX0L k2SH4q1OiPlckO6L9/mYYuMeRboIhQa5An5e5fno= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 419B760B19 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=rplsssn@codeaurora.org From: Raju P L S S S N To: andy.gross@linaro.org, david.brown@linaro.org, linux-arm-msm@vger.kernel.org, linux-soc@vger.kernel.org Cc: rnayak@codeaurora.org, bjorn.andersson@linaro.org, linux-kernel@vger.kernel.org, sboyd@kernel.org, evgreen@chromium.org, dianders@chromium.org, mka@chromium.org, ilina@codeaurora.org, "Raju P.L.S.S.S.N" Subject: [PATCH v2 1/6] drivers: qcom: rpmh-rsc: return if the controller is idle Date: Fri, 27 Jul 2018 15:34:44 +0530 Message-Id: <1532685889-31345-2-git-send-email-rplsssn@codeaurora.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1532685889-31345-1-git-send-email-rplsssn@codeaurora.org> References: <1532685889-31345-1-git-send-email-rplsssn@codeaurora.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Lina Iyer Allow the controller status be queried. The controller is busy if it is actively processing request. Signed-off-by: Lina Iyer Signed-off-by: Raju P.L.S.S.S.N --- Changes in v2: - Remove unnecessary EXPORT_SYMBOL --- drivers/soc/qcom/rpmh-internal.h | 1 + drivers/soc/qcom/rpmh-rsc.c | 20 ++++++++++++++++++++ 2 files changed, 21 insertions(+) diff --git a/drivers/soc/qcom/rpmh-internal.h b/drivers/soc/qcom/rpmh-internal.h index a7bbbb6..4ff43bf 100644 --- a/drivers/soc/qcom/rpmh-internal.h +++ b/drivers/soc/qcom/rpmh-internal.h @@ -108,6 +108,7 @@ struct rsc_drv { int rpmh_rsc_write_ctrl_data(struct rsc_drv *drv, const struct tcs_request *msg); int rpmh_rsc_invalidate(struct rsc_drv *drv); +bool rpmh_rsc_ctrlr_is_idle(struct rsc_drv *drv); void rpmh_tx_done(const struct tcs_request *msg, int r); diff --git a/drivers/soc/qcom/rpmh-rsc.c b/drivers/soc/qcom/rpmh-rsc.c index 33fe9f9..42d0041 100644 --- a/drivers/soc/qcom/rpmh-rsc.c +++ b/drivers/soc/qcom/rpmh-rsc.c @@ -496,6 +496,26 @@ static int tcs_ctrl_write(struct rsc_drv *drv, const struct tcs_request *msg) } /** + * rpmh_rsc_ctrlr_is_idle: Check if any of the AMCs are busy. + * + * @drv: The controller + * + * Returns true if the TCSes are engaged in handling requests. + */ +bool rpmh_rsc_ctrlr_is_idle(struct rsc_drv *drv) +{ + int m; + struct tcs_group *tcs = get_tcs_of_type(drv, ACTIVE_TCS); + + for (m = tcs->offset; m < tcs->offset + tcs->num_tcs; m++) { + if (!tcs_is_free(drv, m)) + return false; + } + + return true; +} + +/** * rpmh_rsc_write_ctrl_data: Write request to the controller * * @drv: the controller -- The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,\na Linux Foundation Collaborative Project