Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp34825868rwd; Sun, 9 Jul 2023 21:30:58 -0700 (PDT) X-Google-Smtp-Source: APBJJlFHytpsMThgQSJl5OYvuvYClVrFRy9pkFJxMVdB0bOIiV1it89c0jX20dqjJURCwO2kv523 X-Received: by 2002:a05:6a20:9147:b0:12c:6a4a:7b4d with SMTP id x7-20020a056a20914700b0012c6a4a7b4dmr14756047pzc.51.1688963458169; Sun, 09 Jul 2023 21:30:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688963458; cv=none; d=google.com; s=arc-20160816; b=EaG83WloJPUsJDsnTigKrLy3Egkcfs1uQjESxRtGNr9u9x8xkzUjKuQwcrEtt6EZej fb3xNQxfy3SCVNBCtX146PVWeMUuPh3eWk6/o3VD+EG9ByMq97QPko+3Ms6sLc38aEtJ I6JY5lpPhRa1lVjnwivxeuf+a1WgJrLtsQs6l2YjbAkb4WDEqL0qmc6eG6ayl9+nVw/g ItRgiPKAILac/2QnrvXUVEqR4QnTsabD5SGJz+RpdKiN3Srmvv3++kjMrgfWF+V93hdE /yS3ACyCWJgze/GjildON8R+ZFTi0Tybx/0Vrl7KpNVRV0WRBVCU2GedVaffMX8tebod tmgA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :content-language:references:cc:to:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=zIC99KX0aU62FO2J7U8Nqo5+YB880or40glFeAx1Ya0=; fh=4iL+133R9zoqJVYUxYJXmacAwk4BeL1ANPDHTC2SqT0=; b=o4Zm4Z8mhIcjM9OGGZVf2GWF2OnvsfPNKFxr9RH0NAtc3dhaJJm94K+ZQuaRGSpN3T kHdVLG65xamJ2LpbB/C+UEX0p4Vs1ag27QTQejNRr9+FDaasAuli10Kr5ID2BtkoZ8Z/ N7GTUcBRBSy9qdRPZPs7WWMUDRrDqFvByFsnoNr92zl0o8Sdu6zNYXuHtuL6UP+HoOG6 RPy8djefbYl6FrXSgSfBCfKnaDOA3cUVos+kW86C94NVfjiiJn+cY8fPubXBz4s0OzVp MbpmSrtd5WuZHkANeBoKG+GUV/ZWd9+PjNvt3dpcQ9OQXyePwN7IH8Osk14Q+6JHe8hW IAAg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=L4vBaZDa; 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 j10-20020a634a4a000000b0053ff537164fsi8280134pgl.783.2023.07.09.21.30.46; Sun, 09 Jul 2023 21:30:58 -0700 (PDT) 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=L4vBaZDa; 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 S230225AbjGJEKh (ORCPT + 99 others); Mon, 10 Jul 2023 00:10:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41166 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229462AbjGJEKg (ORCPT ); Mon, 10 Jul 2023 00:10:36 -0400 Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 796A4E7; Sun, 9 Jul 2023 21:10:35 -0700 (PDT) Received: from pps.filterd (m0279863.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 36A2kfmX014794; Mon, 10 Jul 2023 04:10:23 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h=message-id : date : mime-version : subject : to : cc : references : from : in-reply-to : content-type : content-transfer-encoding; s=qcppdkim1; bh=zIC99KX0aU62FO2J7U8Nqo5+YB880or40glFeAx1Ya0=; b=L4vBaZDapPuj9wEYX8SQ+uZCI1d/wSfsJYquZMUL7kof/C6PBNLY+G3kw9EyaemQWi95 uPT++gz5BLXzvuRESlzCmNqALLzG0VYRQcwqs5SFlytUTL85ySa1A29knAPJkplkj/8i xOjzAaY7jIoJ+1KCKOoSjAbSVuTtR/WqIbrMsEYsvck10PPSEGZN2Nak8soxExQKFZLP kO2VIYQxCH3or+zohTBdEIyf/UKcLKW8+Y3n2i+6W3xmn/ZrFRHhKd67ptQeE5CPawAz +WJHGmSIC/q6haZa6S6ycaeV21UNRZE+F2omBSFRYGD7PnTRkci17M5xwtpMhuPM6k2Q Lg== Received: from nalasppmta03.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3rq01djepm-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 10 Jul 2023 04:10:23 +0000 Received: from nalasex01a.na.qualcomm.com (nalasex01a.na.qualcomm.com [10.47.209.196]) by NALASPPMTA03.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 36A4ALHc016346 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 10 Jul 2023 04:10:21 GMT Received: from [10.216.9.221] (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.1118.30; Sun, 9 Jul 2023 21:10:17 -0700 Message-ID: Date: Mon, 10 Jul 2023 09:40:14 +0530 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.12.0 Subject: Re: [PATCH 2/2] clk: qcom: gdsc: Add support for set_hwmode_dev To: Konrad Dybcio , Abel Vesa , "Rafael J . Wysocki" , "Kevin Hilman" , Ulf Hansson , "avel Machek" , Len Brown , Greg Kroah-Hartman , Bjorn Andersson , "Andy Gross" , Mike Turquette , "Stephen Boyd" , Taniya Das CC: , Linux Kernel Mailing List , References: <20230628105652.1670316-1-abel.vesa@linaro.org> <20230628105652.1670316-3-abel.vesa@linaro.org> <42b1167d-da60-f6c3-67b6-3f6857327396@linaro.org> Content-Language: en-US From: Taniya Das In-Reply-To: <42b1167d-da60-f6c3-67b6-3f6857327396@linaro.org> Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 7bit 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-ORIG-GUID: pZkrRaBr4lBulSbj6PttlyP8nkQ7G-x1 X-Proofpoint-GUID: pZkrRaBr4lBulSbj6PttlyP8nkQ7G-x1 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.591,FMLib:17.11.176.26 definitions=2023-07-10_03,2023-07-06_02,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 bulkscore=0 mlxscore=0 priorityscore=1501 clxscore=1011 adultscore=0 mlxlogscore=999 malwarescore=0 lowpriorityscore=0 spamscore=0 phishscore=0 suspectscore=0 impostorscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2305260000 definitions=main-2307100037 X-Spam-Status: No, score=-2.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_DNSWL_LOW, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE 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 Hi Abel, Thanks for the patch. On 6/28/2023 10:48 PM, Konrad Dybcio wrote: > On 28.06.2023 12:56, Abel Vesa wrote: >> Implement the GDSC specific genpd set_hwmode_dev callback in order to >> switch the HW control on or off. For any GDSC that supports HW control >> set this callback in order to allow its consumers to control it. >> >> Signed-off-by: Abel Vesa >> --- > This still does nothing to prevent the HW_CTRL state being changed in > init, enable and disable functions. > > Konrad >> drivers/clk/qcom/gdsc.c | 22 ++++++++++++++++++++++ >> 1 file changed, 22 insertions(+) >> >> diff --git a/drivers/clk/qcom/gdsc.c b/drivers/clk/qcom/gdsc.c >> index 5358e28122ab..9a04bf2e4379 100644 >> --- a/drivers/clk/qcom/gdsc.c >> +++ b/drivers/clk/qcom/gdsc.c >> @@ -314,6 +314,26 @@ static int gdsc_enable(struct generic_pm_domain *domain) >> return 0; >> } >> >> +static int gdsc_set_hwmode_dev(struct generic_pm_domain *domain, >> + struct device *dev, bool enable) >> +{ >> + int ret = gdsc_hwctrl(domain_to_gdsc(domain), enable); >> + >> + if (ret) >> + goto out; >> + >> + /* >> + * Wait for the GDSC to go through a power down and >> + * up cycle. In case there is a status polling going on >> + * before the power cycle is completed it might read an >> + * wrong status value. >> + */ >> + udelay(1); >> + >> +out: >> + return ret; >> +} >> + >> static int gdsc_disable(struct generic_pm_domain *domain) >> { >> struct gdsc *sc = domain_to_gdsc(domain); >> @@ -451,6 +471,8 @@ static int gdsc_init(struct gdsc *sc) >> sc->pd.power_off = gdsc_disable; >> if (!sc->pd.power_on) >> sc->pd.power_on = gdsc_enable; >> + if (sc->flags & HW_CTRL) >> + sc->pd.set_hwmode_dev = gdsc_set_hwmode_dev; >> We do not want to move to SW mode without consumers wanting to move to this mode. We want a new flag for the consumers wanting to move to this mode. The mode in which the GDSC would be enabled would be in SW mode only. + if (sc->flags & HW_CTRL_TRIGGER) { + sc->pd.set_hwmode_dev = gdsc_set_mode; + } + >> ret = pm_genpd_init(&sc->pd, NULL, !on); >> if (ret) -- Thanks & Regards, Taniya Das.