Received: by 2002:a05:6358:f14:b0:e5:3b68:ec04 with SMTP id b20csp6022559rwj; Wed, 21 Dec 2022 09:45:40 -0800 (PST) X-Google-Smtp-Source: AMrXdXu3wwECOdenivIVJVdxtSike93R6MfFCW4gp4iVUHYfPISyU1RUOT0VI5Vp2UgOuaDYomOH X-Received: by 2002:a05:6a20:ce07:b0:af:ee05:fd0b with SMTP id ic7-20020a056a20ce0700b000afee05fd0bmr2991702pzb.3.1671644739747; Wed, 21 Dec 2022 09:45:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1671644739; cv=none; d=google.com; s=arc-20160816; b=a+1Q5mHs05ax1t7BEsDRm5jcipLG6VXZjXZ7C95qT5DYwxkbjMGhgYQJDpBq6hBxUU H6CwvdRVYIvPwR1dZYyQt5TH40O+EggKwm7VuToPQ9rKrG1cITpqv6WwCyMaZcodjI7E fu1V0yMRfSUCEk+ZcV0m1fr8ZAoWd69Hin3LawNeDzAGfQq9svIsAsgoihWbm1FIJi00 t8GltIyl0XW6FCABssqC3uM+QK3Hfa4LUljP8Z2j1oVXENwiBefl5pLVFZd0S9/x6qlz Jid02vKQ1jaJP7/CiNlQhUYoRPFxIA8926ieQ/f/ysIBZRZ8uOpA/RyzBv/5TjJCBNqU S1rg== 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=SFm4sYMp/c3P2qEYhneJ47yxJuztQysWAUYzINhpWsw=; b=nSlot7ZFRiD5APpipaKQvO8iS1SE23L0VsCRlWgNPOiPkC8hF1neO4zq9NK2IL1GP9 3a+4VPmvuZ1WLGEetRwPxT+/ceXqGPy1J6kcW52DhWnmmzl4/zH/u5x5czwvKj+rc69m Y6dYhhHWQY/k4cN/oqdPnpHpiJ2gRfIDA+LkWzccR37lZeKU2axnCCV8fawr88Dibt0Y x6r/83z2ko4f5knGv0zRjMKhQ0kWB0Ih/X6mLE2oddy0oZhXi9HbCZTZRntNNVCWZ28v mPn0G/OoCERKNqPMHprqERz6NsOJxEpZBCYRNz3pkLW7ijvqE2prT/CK1KIpwZanTzY0 YWwg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=nbThkgGf; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k69-20020a638448000000b00490a1c37b20si4279241pgd.615.2022.12.21.09.45.30; Wed, 21 Dec 2022 09:45:39 -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=nbThkgGf; 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 S234815AbiLURPs (ORCPT + 67 others); Wed, 21 Dec 2022 12:15:48 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53986 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230103AbiLURPT (ORCPT ); Wed, 21 Dec 2022 12:15:19 -0500 Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1EEF8B4B; Wed, 21 Dec 2022 09:14:42 -0800 (PST) Received: from pps.filterd (m0279865.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 2BLGnphm011216; Wed, 21 Dec 2022 17:14:35 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=SFm4sYMp/c3P2qEYhneJ47yxJuztQysWAUYzINhpWsw=; b=nbThkgGfnr/hDxuQZA6CLIEsqT80aXNWs0kBDnIAbQRZV0AUhb/LLkBI8DPg77Fby7f+ aPhC7OlWly/h7f6yKRux29fJmKqeijuqiYajlmMBFhGUp7wcEdFwD0W2HZezHyj4dqQ2 GD8ZvUz2eXX3zDh2s0NBvgSnCFnDnF3aALrfF0kXREOiTP4tM/tQTcRDSmqFl9nwFasV IrQlL7fEHeA0CKVCM2OzvqCSm3Xyu+/8s+xg18SDfm8nFOwEIOfERPUxtUQclppyGdt4 TenQjFkiUgPZpTYdSbXPl/jjEscsbT7uJTWktV2vQDFUAi0yUwerVDMTqVKY+B/7qa1d tg== Received: from nalasppmta05.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3mm4xkr6ma-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 21 Dec 2022 17:14:35 +0000 Received: from nalasex01a.na.qualcomm.com (nalasex01a.na.qualcomm.com [10.47.209.196]) by NALASPPMTA05.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 2BLHEYH1022866 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 21 Dec 2022 17:14:34 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; Wed, 21 Dec 2022 09:14:30 -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 v4 2/5] clk: qcom: gdsc: Support 'synced_poweroff' genpd flag Date: Wed, 21 Dec 2022 22:44:00 +0530 Message-ID: <20221221224338.v4.2.Ic128c1df50b7fc9a6b919932a3b41a799b5ed5e8@changeid> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1671642843-5244-1-git-send-email-quic_akhilpo@quicinc.com> References: <1671642843-5244-1-git-send-email-quic_akhilpo@quicinc.com> MIME-Version: 1.0 Content-Type: text/plain 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: a6rJ0FJEmWy7j7LoqvQEdWLJ-f2Uw8Np X-Proofpoint-ORIG-GUID: a6rJ0FJEmWy7j7LoqvQEdWLJ-f2Uw8Np 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=2022-12-21_10,2022-12-21_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 malwarescore=0 impostorscore=0 spamscore=0 lowpriorityscore=0 bulkscore=0 priorityscore=1501 adultscore=0 clxscore=1015 mlxscore=0 mlxlogscore=999 phishscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2212070000 definitions=main-2212210144 X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW,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 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 --- (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; } -- 2.7.4