Received: by 2002:a89:48b:0:b0:1f5:f2ab:c469 with SMTP id a11csp319552lqd; Wed, 24 Apr 2024 03:28:15 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVBvWcUlL3lLM8USUpRUEPXhE+dxeUYrIrTysCxG7FiyDxOQ8eDvIprMrFJWj5ofvD7sADdD9tsT5acCj2GqeUMZxm+PCBDakPmQjb/ow== X-Google-Smtp-Source: AGHT+IElpnTZPvnLm8G5A8PbTeSlAQE0vTLFrxjhGJaqKvkbOsyCwcX6M2am7YNUfU1/PIcn1ywO X-Received: by 2002:a0c:c78e:0:b0:69b:6746:1990 with SMTP id k14-20020a0cc78e000000b0069b67461990mr1935777qvj.2.1713954494907; Wed, 24 Apr 2024 03:28:14 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713954494; cv=pass; d=google.com; s=arc-20160816; b=vo1mal+/MwVYlJG2SHtg2alN8b2ComjXOIGXQcAqsltdvqAWtD+A6d5UBAxzyRxE70 J3r3t4cOCssEbNCcH5SUfVp/lJXKu/9UM8HCarPBtnDCa8jfT+pO+ZYC3uui5viLVKpd y84V6OcZQ7cc7FNE/wq6JZ24A/D04PU4+g9HiiAazOcZTgyXzojfPTCiiFNoYRw29RKr Xii15tSSGZ+2mszVds++8ZxnUdrVb3oyzE3ABbYb0OFN/dla5/QGeb/kbSjNHRCUafAP qWxl6g/DZG4AMU3/5VgkxFVeXL/ixuq0ky3ffig/bQjWog/CUBm1iDiCV1ACqgOgbkLS 7rMA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id:dkim-signature; bh=RQNt5PZZm3frh00wj8WKWSZPe7aKlTUmfVkfoQWkc4g=; fh=4ICIux8e70tKKEFg6bjcTczgLJLzrvubEpVTdQ8U2Ik=; b=T6OUoJd7t75krP4aEW7pIvHzgtmb0ECczdhhcI5/R4snTv6V8OEDUEQKCcVf2T6C29 Xn6kA72wB8RgGSiqYPYvLut+0+1fZzKE2p9jk91/nBoFlgOjjIk8dvBlEeRhzynjq5YH zm+2C9nIemdlSVxQc+6IGzFElHx1rZg8BQn9xLep4kO0XVveC1GG9ASQ0lfWiHuQ+KcX fjTmUhlVYE3okBHj6meOsW6QVrDvub4dyHtlO1MFrBcmwhiRwoB9+anWCrZnrs4ubOpB oskij5gG5Zo86hQ/zTLy8HVUX8bcFOJ62cZngpEYOu2zBI7SBAvQumzqbMW9nDk0yCkW qVTw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=J+sbYCbO; arc=pass (i=1 spf=pass spfdomain=quicinc.com dkim=pass dkdomain=quicinc.com dmarc=pass fromdomain=quicinc.com); spf=pass (google.com: domain of linux-kernel+bounces-156724-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-156724-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id pm23-20020ad446d7000000b006a07f208bc7si6798252qvb.61.2024.04.24.03.28.14 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Apr 2024 03:28:14 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-156724-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=J+sbYCbO; arc=pass (i=1 spf=pass spfdomain=quicinc.com dkim=pass dkdomain=quicinc.com dmarc=pass fromdomain=quicinc.com); spf=pass (google.com: domain of linux-kernel+bounces-156724-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-156724-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 931621C211E0 for ; Wed, 24 Apr 2024 10:28:14 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 1BBD4159597; Wed, 24 Apr 2024 10:28:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b="J+sbYCbO" Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B22ED152DE1; Wed, 24 Apr 2024 10:28:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.180.131 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713954483; cv=none; b=JHz2JtQeFrfSVwRqytvi7tgjC/P2rc3MmBnyBMAaicqfo9YWbTYf9YOR7TDJ3Hlt4mqMJPb3YCUc1vcyvxNJyWR0uzV8WKVVu4Db6wX+T8JToEza+mqv8K75k7pUzi30rko2TyG2MGKkfA6EOpDKC7eAia9hn5JMOe14roG/HZY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713954483; c=relaxed/simple; bh=KMVHm+SIAgutMAbC6mgTihoI+YnjySmbBuGhkkDnQtM=; h=Message-ID:Date:MIME-Version:Subject:To:CC:References:From: In-Reply-To:Content-Type; b=TZj5UKXGvgbqZdw7jp9xv+FwHVpytd0b2ALw2pAlIE9LwKDhsQNGp7Wi5rmhCq2kYYjVjb01w9itDVKvS+gnLIuia3fz+GITVbPypoiRTFfmRwcsknc34yQPKtrArFHl0HVvztH4OPYBp2AWDfbXeXoH20jxn9PuR377CXvMDFs= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com; spf=pass smtp.mailfrom=quicinc.com; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b=J+sbYCbO; arc=none smtp.client-ip=205.220.180.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=quicinc.com Received: from pps.filterd (m0279873.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 43O6Xc50016794; Wed, 24 Apr 2024 10:27:52 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=RQNt5PZZm3frh00wj8WKWSZPe7aKlTUmfVkfoQWkc4g=; b=J+ sbYCbOCxdLNqKvWyyG2apikUXBGiWrqSBsioJEOPuPWldzZZLss82Cw5wpyesS1t xfq5MylLo5D6k4Oet2g8Zs1GOXK02jbfOvBUoJsBPp8CpVRveVZlFmPV8HPUWMUM d7dQM2enkLhfNBahD0VEV9tDjIzrkHGJvPtvulnxA3Q/ZlVJoIZz0lHDuFuOrWUV Pp8fhMYIlMd/5YO1ozlwZkifc+tSxiYT3HvVtvBWlZBbehuTT88cxwXjUKun2Gs1 EcUIXB7FCGUwaD8l5yjrkWccctFy3dteg2omVj+K8IfzXm7teDn/tjr8T5Jv8Lc3 ArUmhB/KVUptpc/5QTCg== Received: from nalasppmta01.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3xpv9fgj42-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 24 Apr 2024 10:27:52 +0000 (GMT) Received: from nalasex01a.na.qualcomm.com (nalasex01a.na.qualcomm.com [10.47.209.196]) by NALASPPMTA01.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 43OARoPf012223 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 24 Apr 2024 10:27:50 GMT Received: from [10.218.5.19] (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.1544.9; Wed, 24 Apr 2024 03:27:42 -0700 Message-ID: <2e8f5e93-1f24-4451-ab9f-ad1e7d98bc65@quicinc.com> Date: Wed, 24 Apr 2024 15:57:39 +0530 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH V5 RESEND 3/5] clk: qcom: gdsc: Add set and get hwmode callbacks to switch GDSC mode To: Bryan O'Donoghue , Bjorn Andersson , Michael Turquette , "Stephen Boyd" , Stanimir Varbanov , Vikash Garodia , Mauro Carvalho Chehab , Ulf Hansson , "Rafael J . Wysocki" , Kevin Hilman , Pavel Machek , Len Brown , Greg Kroah-Hartman , Konrad Dybcio , "Andy Gross" , Dmitry Baryshkov , Abel Vesa CC: , , , , , Taniya Das , "Satya Priya Kakitapalli" , Imran Shaik , Ajit Pandey References: <20240413152013.22307-1-quic_jkona@quicinc.com> <20240413152013.22307-4-quic_jkona@quicinc.com> <0ed739d8-7ef6-4b0d-bd61-62966c9a9362@linaro.org> Content-Language: en-US From: Jagadeesh Kona In-Reply-To: <0ed739d8-7ef6-4b0d-bd61-62966c9a9362@linaro.org> Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 8bit X-ClientProxiedBy: nasanex01a.na.qualcomm.com (10.52.223.231) 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: UdaJqMHmAelHEwYEvmrTYsnUWBXurROV X-Proofpoint-GUID: UdaJqMHmAelHEwYEvmrTYsnUWBXurROV X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1011,Hydra:6.0.650,FMLib:17.11.176.26 definitions=2024-04-24_08,2024-04-23_02,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 malwarescore=0 bulkscore=0 impostorscore=0 clxscore=1015 priorityscore=1501 adultscore=0 phishscore=0 mlxlogscore=999 lowpriorityscore=0 suspectscore=0 mlxscore=0 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2404010003 definitions=main-2404240043 On 4/24/2024 3:25 PM, Bryan O'Donoghue wrote: > On 24/04/2024 10:47, Jagadeesh Kona wrote: >> >> >> On 4/24/2024 5:18 AM, Bryan O'Donoghue wrote: >>> On 13/04/2024 16:20, Jagadeesh Kona wrote: >>>> Some GDSC client drivers require the GDSC mode to be switched >>>> dynamically >>>> to HW mode at runtime to gain the power benefits. Typically such client >>>> drivers require the GDSC to be brought up in SW mode initially to >>>> enable >>>> the required dependent clocks and configure the hardware to proper >>>> state. >>>> Once initial hardware set up is done, they switch the GDSC to HW >>>> mode to >>>> save power. At the end of usecase, they switch the GDSC back to SW mode >>>> and disable the GDSC. >>>> >>>> Introduce HW_CTRL_TRIGGER flag to register the set_hwmode_dev and >>>> get_hwmode_dev callbacks for GDSC's whose respective client drivers >>>> require the GDSC mode to be switched dynamically at runtime using >>>> dev_pm_genpd_set_hwmode() API. >>>> >>>> Signed-off-by: Jagadeesh Kona >>>> Signed-off-by: Abel Vesa >>>> --- >>>>   drivers/clk/qcom/gdsc.c | 37 +++++++++++++++++++++++++++++++++++++ >>>>   drivers/clk/qcom/gdsc.h |  1 + >>>>   2 files changed, 38 insertions(+) >>>> >>>> diff --git a/drivers/clk/qcom/gdsc.c b/drivers/clk/qcom/gdsc.c >>>> index df9618ab7eea..c5f6be8181d8 100644 >>>> --- a/drivers/clk/qcom/gdsc.c >>>> +++ b/drivers/clk/qcom/gdsc.c >>>> @@ -363,6 +363,39 @@ static int gdsc_disable(struct >>>> generic_pm_domain *domain) >>>>       return 0; >>>>   } >>>> +static int gdsc_set_hwmode(struct generic_pm_domain *domain, struct >>>> device *dev, bool mode) >>>> +{ >>>> +    struct gdsc *sc = domain_to_gdsc(domain); >>>> +    int ret; >>>> + >>>> +    ret = gdsc_hwctrl(sc, mode); >>>> +    if (ret) >>>> +        return ret; >>>> + >>>> +    /* Wait for 1usec for mode transition to properly complete */ >>>> +    udelay(1); >>> >>> A delay I suspect you don't need - if the HW spec says "takes 1 usec >>> for this to take effect" that's 1 usec from io write completion from >>> APSS to another system agent. >>> >>> You poll for the state transition down below anyway. >>> >>> I'd be pretty certain that's a redundant delay. >>> >> >> Thanks Bryan for your review! >> >> This 1usec delay is needed every time GDSC is moved in and out of HW >> control mode and the reason for same is explained in one of the older >> gdsc driver change at below link >> >> https://lore.kernel.org/all/1484027679-18397-1-git-send-email-rnayak@codeaurora.org/ >> > > Right. > > If that is your precedent then you seem to be missing the mb(); between > > gdsc_hwctrl(); > > /* mb(); here */ > > and this > > udelay(1); > Sorry, earlier I shared the link to base patch series which has mb() used, but in the mainlined series of the same patch mb() is removed as per the review comments. Please find the mainlined series link:- https://lore.kernel.org/all/1485145581-517-1-git-send-email-rnayak@codeaurora.org/ Thanks, Jagadeesh > --- > bod