From patchwork Mon Jan 2 10:48:28 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Akhil P Oommen X-Patchwork-Id: 38070 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp4106204wrt; Mon, 2 Jan 2023 02:51:14 -0800 (PST) X-Google-Smtp-Source: AMrXdXsWZNOSXufto5YxCSaokCXxSTzaUkOVlJQWy2anYZOUGsxHfgl3XuGMpFqIwSy9OB7XY/Th X-Received: by 2002:a17:906:9f0a:b0:7c0:e302:b523 with SMTP id fy10-20020a1709069f0a00b007c0e302b523mr42874333ejc.59.1672656674429; Mon, 02 Jan 2023 02:51:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672656674; cv=none; d=google.com; s=arc-20160816; b=nTxLXxw0srSgd2+aWCCSw6HWmxP49ZoGtRHcv2vSYm8sx4CIZHLNyr9NHbL8DuZqjk JN+fJ22QVHpQw0DIhxde6o8sgcB+jXtaNrbWJI3PB2DvHsVmR9AYUtF82X44JKkokuRR XXwimulXKfWpfofmh9Vrw6h/Xn+uA+gYBSp2BENPj8hs6GwLHNRRa8Hg3XyLa8HXdaPU vbY6e4QacXYKFBA1b9A35QmexrUC6UVQjMKXMMGWtdCcYe1mN96EIeo/JdrBUvc7ooAR on25VkJ256mMacrLQGmlhV0UgATCDX96RVUJS9F1B2rhpaYmX7pnSwWejVwnfi1kjii0 4Y8w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=gJFZaBKm1J2oTYrnsJYWMaEEuU4OU/XOBGD0euxe2zc=; b=muWL0LR1oP2bsHWPC3CTlrGOug8+ZywwqWlNJtrnWAhEFqC1zysWbJlNmu1qW/KVqq XgvETrgpRGnIW/Q7k4CyfellAo0S3hhmCO1BSb8n/0mAP1kL92zZzuPWhalObdFkmqW8 /ykbFdhIF1++pMoFOrjtbsSdqfJyeINWTe/U9BCThtGRmeeO21KVqqDrjpZo6AoYEuHg xtrg2Z0XOxJnjQDVrwu4WJhgfrM/7iFdeRs3rb5nSaYIGetCLi55zWpAYBGzyOV9O5wQ xZcak+mmLa8+0TqEVbJMdIETcOjF4ConUfuVDQJj3P7HTI1PiS5SYoyDWFeMAlfARjBG C0Iw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b="F7sUMv0/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id hw20-20020a170907a0d400b007c1275dd934si20369607ejc.792.2023.01.02.02.50.50; Mon, 02 Jan 2023 02:51:14 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b="F7sUMv0/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232371AbjABKtV (ORCPT + 99 others); Mon, 2 Jan 2023 05:49:21 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50660 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231633AbjABKtI (ORCPT ); Mon, 2 Jan 2023 05:49:08 -0500 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 98015B25; Mon, 2 Jan 2023 02:49:07 -0800 (PST) Received: from pps.filterd (m0279870.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 3029f4CQ032142; Mon, 2 Jan 2023 10:49:01 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-type; s=qcppdkim1; bh=gJFZaBKm1J2oTYrnsJYWMaEEuU4OU/XOBGD0euxe2zc=; b=F7sUMv0//AfzwdssG5weyD+4c9NDcuLhXHqhyW3JG7jgkV/f0yy/erxbBRtz+Pyj39CT jAaLpVHZnFAXC2FWzLIFGbpmgCfoIvcrfa6zxttkE15al7Ar8vHizPzRK4GKUEHANzgK 77XjtB9ET9IkWsKWkea32qCC5gpRG7ZjsNNCv5wXQf6p6ZQ8e+S5JGoYpc8WfQ/fyq3n 6S7dRcKsTgLgI5mg2WQVaUkWz34f8ViCtp4uYBxgygNncL7DYf77MV8VNws1ZUA9g1yk IQaJrhORHadd7tyQf+aqWJNT1U/fes2ofsBOEPfgLmio7jqe3ccbkHI2jFpthxTW3Urt 5Q== Received: from nalasppmta04.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3mtd61avtc-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 02 Jan 2023 10:49:01 +0000 Received: from nalasex01a.na.qualcomm.com (nalasex01a.na.qualcomm.com [10.47.209.196]) by NALASPPMTA04.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 302AmxF4007356 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 2 Jan 2023 10:49:00 GMT Received: from hyd-lnxbld559.qualcomm.com (10.80.80.8) by nalasex01a.na.qualcomm.com (10.47.209.196) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.36; Mon, 2 Jan 2023 02:48:55 -0800 From: Akhil P Oommen To: freedreno , , , Rob Clark , Ulf Hansson , Bjorn Andersson , Stephen Boyd , Philipp Zabel CC: Akhil P Oommen , Andy Gross , Konrad Dybcio , Michael Turquette , , Subject: [PATCH v5 2/5] clk: qcom: gdsc: Support 'synced_poweroff' genpd flag Date: Mon, 2 Jan 2023 16:18:28 +0530 Message-ID: <20230102161757.v5.2.Ic128c1df50b7fc9a6b919932a3b41a799b5ed5e8@changeid> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1672656511-1931-1-git-send-email-quic_akhilpo@quicinc.com> References: <1672656511-1931-1-git-send-email-quic_akhilpo@quicinc.com> MIME-Version: 1.0 X-Originating-IP: [10.80.80.8] X-ClientProxiedBy: nasanex01b.na.qualcomm.com (10.46.141.250) To nalasex01a.na.qualcomm.com (10.47.209.196) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-GUID: VICx3pDz2fGaX6a4ZJRdP0V79wLzPK5W X-Proofpoint-ORIG-GUID: VICx3pDz2fGaX6a4ZJRdP0V79wLzPK5W X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.923,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2023-01-02_06,2022-12-30_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 lowpriorityscore=0 malwarescore=0 priorityscore=1501 mlxlogscore=999 clxscore=1015 suspectscore=0 phishscore=0 spamscore=0 adultscore=0 mlxscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2212070000 definitions=main-2301020098 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1753907644963670712?= X-GMAIL-MSGID: =?utf-8?q?1753907644963670712?= Add support for the newly added 'synced_poweroff' genpd flag. This allows some clients (like adreno gpu driver) to request gdsc driver to ensure a votable gdsc (like gpucc cx gdsc) has collapsed at hardware. Signed-off-by: Akhil P Oommen Reviewed-by: Ulf Hansson --- (no changes since v3) Changes in v3: - Rename the var 'force_sync' to 'wait (Stephen) drivers/clk/qcom/gdsc.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/drivers/clk/qcom/gdsc.c b/drivers/clk/qcom/gdsc.c index 9e4d6ce891aa..5358e28122ab 100644 --- a/drivers/clk/qcom/gdsc.c +++ b/drivers/clk/qcom/gdsc.c @@ -136,7 +136,8 @@ static int gdsc_update_collapse_bit(struct gdsc *sc, bool val) return 0; } -static int gdsc_toggle_logic(struct gdsc *sc, enum gdsc_status status) +static int gdsc_toggle_logic(struct gdsc *sc, enum gdsc_status status, + bool wait) { int ret; @@ -149,7 +150,7 @@ static int gdsc_toggle_logic(struct gdsc *sc, enum gdsc_status status) ret = gdsc_update_collapse_bit(sc, status == GDSC_OFF); /* If disabling votable gdscs, don't poll on status */ - if ((sc->flags & VOTABLE) && status == GDSC_OFF) { + if ((sc->flags & VOTABLE) && status == GDSC_OFF && !wait) { /* * Add a short delay here to ensure that an enable * right after it was disabled does not put it in an @@ -275,7 +276,7 @@ static int gdsc_enable(struct generic_pm_domain *domain) gdsc_deassert_clamp_io(sc); } - ret = gdsc_toggle_logic(sc, GDSC_ON); + ret = gdsc_toggle_logic(sc, GDSC_ON, false); if (ret) return ret; @@ -352,7 +353,7 @@ static int gdsc_disable(struct generic_pm_domain *domain) if (sc->pwrsts == PWRSTS_RET_ON) return 0; - ret = gdsc_toggle_logic(sc, GDSC_OFF); + ret = gdsc_toggle_logic(sc, GDSC_OFF, domain->synced_poweroff); if (ret) return ret; @@ -392,7 +393,7 @@ static int gdsc_init(struct gdsc *sc) /* Force gdsc ON if only ON state is supported */ if (sc->pwrsts == PWRSTS_ON) { - ret = gdsc_toggle_logic(sc, GDSC_ON); + ret = gdsc_toggle_logic(sc, GDSC_ON, false); if (ret) return ret; }