Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp3691671rwb; Tue, 20 Sep 2022 03:23:31 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4V16vI5gavGKiF/RG4iAAuHPrCPskfguSj7sKYAo65FcKJM51CkvMs1KnBAFsX1oEXPfKJ X-Received: by 2002:a17:903:41c2:b0:178:5ddd:c75b with SMTP id u2-20020a17090341c200b001785dddc75bmr4194780ple.22.1663669411361; Tue, 20 Sep 2022 03:23:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1663669411; cv=none; d=google.com; s=arc-20160816; b=Ya54XaY+w5ankYg5WoQInuhNPCJUjQtIA68I/PhnMx1OgQOs1ZMKYi/U9sNTPGKd3Z Ap6mNh2gFgowNdoOekNHgh9i1KoGTFXCFb/BHs6asaB4Bh9erBldnJpLYvdxkqfdZ8a5 zbOlw96Br8PToL+3kVsIrcYRoty3boQF0xHzzNEOLYWs7l6FS7Tc1c9kCOsRP5dazw/c 3u16LMiNtzpVL5v96V1Ib8/wFSLtKlvdVZAKjNcouegus4iy621YUpwQj12OfD0wULmg r7bxLlnmS5dO3tFJWKzacFwvltt/4rAjAPSV7Jxhy8mNSk7n5eXX/Y4Zjwdjx/7zgVKu ueow== 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 :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=e+Mjuh5gg+qCqPNY3CWaWhGM9M/UVXbWGlTVwOxGB3k=; b=EgjD6l5+hijDhWckQaE1xWce/7HraxMRlJX8GKpVAElilekWBuvqspq6wIdqZbMra5 6Kh3NWdotmnxdo4MAJrzQPPxZscahz+sYthT5HBVgG5Xm1TuQxigjSN1Ku9F+WNU6G4a mLArH9vTkC1N7Ghcvc3H4CLNz31SkPmTiZWuK0K7uwdLh8LfyCnRNwLyAl9KRAZlErKx tE0MvEKe/FxkVKgsXpvgEZK9xB49rRBlKRD/CnlfjG6dOMdqL3XmlMYhPcdiJmtdyReW XpW5hNfLXCipAO1jH8bKjXkpatYoQg8TDqeDbenFnz9YUXQaN+4tZ1Paex8R1rCCl7ru /onQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=NQUQMa4c; 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 w197-20020a6282ce000000b0051bbbc5f0aasi1122780pfd.261.2022.09.20.03.23.20; Tue, 20 Sep 2022 03:23:31 -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=NQUQMa4c; 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 S230253AbiITKAN (ORCPT + 99 others); Tue, 20 Sep 2022 06:00:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53404 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230225AbiITKAL (ORCPT ); Tue, 20 Sep 2022 06:00:11 -0400 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EAE6ADF13; Tue, 20 Sep 2022 03:00:09 -0700 (PDT) Received: from pps.filterd (m0279872.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 28K7xi2Q013764; Tue, 20 Sep 2022 10:00:00 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=e+Mjuh5gg+qCqPNY3CWaWhGM9M/UVXbWGlTVwOxGB3k=; b=NQUQMa4corel2l/91rbA435gqIz45nQD2IhHv1UkZbZXemmP5KPyxf3w1J3oif2nIYxp 2s5O6bbwi0zE7qmHVRpBKt0Akl8QNlXV5vRELrrQFK+s8ZfNoLGomihkQcK19ljzuq3n zNycduep2EbDAYwGmXpgNm/D+iAUjpKj0c24UFUeeK3auJwKqb40K6DibMMeLxw/UmsG t01QZ7btD4XRYybsBvOtaSZYg5khO6JBzmySvWyyqifx9RAM4J2j6ScqBwE2li8wgKda enPmkOTVoEIbG2qppKrBrnW2XG0cIA01SDNARR2fRqbh724nsEOvVb8oI08FfYgvMge+ Jw== Received: from nalasppmta05.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3jq4r09byk-7 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 20 Sep 2022 10:00:00 +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 28K9fCno028326 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 20 Sep 2022 09:41:12 GMT Received: from [10.216.24.214] (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.29; Tue, 20 Sep 2022 02:41:07 -0700 Message-ID: <48c560ef-67fd-8903-a7c0-2fd7a9bd6b19@quicinc.com> Date: Tue, 20 Sep 2022 15:11:04 +0530 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.9.1 Subject: Re: [PATCH v6 3/5] phy: core: Add support for phy power down & power up Content-Language: en-US To: Dmitry Baryshkov CC: , , , , , , , , , , , , Kishon Vijay Abraham I , Vinod Koul , "open list:GENERIC PHY FRAMEWORK" References: <1662713084-8106-1-git-send-email-quic_krichai@quicinc.com> <1662713084-8106-4-git-send-email-quic_krichai@quicinc.com> <87138bc9-2fc0-39fb-89c1-d3826e28594e@quicinc.com> From: Krishna Chaitanya Chundru In-Reply-To: Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 8bit X-Originating-IP: [10.80.80.8] 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: 9dhGy6_L9UqGlSWt1h6AUQAw-scBXFcn X-Proofpoint-GUID: 9dhGy6_L9UqGlSWt1h6AUQAw-scBXFcn X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.895,Hydra:6.0.528,FMLib:17.11.122.1 definitions=2022-09-20_02,2022-09-16_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 phishscore=0 mlxlogscore=899 malwarescore=0 suspectscore=0 spamscore=0 lowpriorityscore=0 clxscore=1015 impostorscore=0 mlxscore=0 bulkscore=0 priorityscore=1501 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2209130000 definitions=main-2209200060 X-Spam-Status: No, score=-5.0 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 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 On 9/19/2022 10:59 PM, Dmitry Baryshkov wrote: > On 14/09/2022 17:50, Krishna Chaitanya Chundru wrote: >> >> On 9/9/2022 2:34 PM, Dmitry Baryshkov wrote: >>> On Fri, 9 Sept 2022 at 11:45, Krishna chaitanya chundru >>> wrote: >>>> Introducing phy power down/up callbacks for allowing to park the >>>> link-state in L1ss without holding any PCIe resources during >>>> system suspend. >>>> >>>> Signed-off-by: Krishna chaitanya chundru >>>> --- >>>>   drivers/phy/phy-core.c  | 30 ++++++++++++++++++++++++++++++ >>>>   include/linux/phy/phy.h | 20 ++++++++++++++++++++ >>>>   2 files changed, 50 insertions(+) >>>> >>>> diff --git a/drivers/phy/phy-core.c b/drivers/phy/phy-core.c >>>> index d93ddf1..1b0b757 100644 >>>> --- a/drivers/phy/phy-core.c >>>> +++ b/drivers/phy/phy-core.c >>>> @@ -441,6 +441,36 @@ int phy_set_speed(struct phy *phy, int speed) >>>>   } >>>>   EXPORT_SYMBOL_GPL(phy_set_speed); >>>> >>>> +int phy_power_down(struct phy *phy) >>>> +{ >>>> +       int ret; >>>> + >>>> +       if (!phy || !phy->ops->power_down) >>>> +               return 0; >>>> + >>>> +       mutex_lock(&phy->mutex); >>>> +       ret = phy->ops->power_down(phy); >>>> +       mutex_unlock(&phy->mutex); >>>> + >>>> +       return ret; >>>> +} >>>> +EXPORT_SYMBOL_GPL(phy_power_down); >>>> + >>>> +int phy_power_up(struct phy *phy) >>>> +{ >>>> +       int ret; >>>> + >>>> +       if (!phy || !phy->ops->power_up) >>>> +               return 0; >>>> + >>>> +       mutex_lock(&phy->mutex); >>>> +       ret = phy->ops->power_up(phy); >>>> +       mutex_unlock(&phy->mutex); >>>> + >>>> +       return ret; >>>> +} >>> As it can be seen from the phy_power_off(), the PHY can be a shared >>> resource, with the power_count counting the number of users that >>> requested the PHY to be powered up. By introducing suc calls you break >>> directly into this by allowing a single user to power down the PHY, no >>> matter how many other users have requested the PHY to stay alive. >> >> can we use same power_count in this function also here and restrict >> the single user to >> >> power down the PHY same like phy_power_off?. > > What is the difference between power_off() and power_down()? In power_off  we are turning off PCIe PHY-specific clocks, and also resetting the PHY due to this PCIe link also will go down. To retain, the PCIe link state in l1ss with PHY clocks turned off, we need park PCIe PHY in the power-down state and skip the resets of the PHY so that it can maintain the link state in l1ss with the help of the always-on power domain aka MX). To support this PHY Power-down state PHY driver has been updated with new interface APIs. Initially we added phy_suspend & phy_resume to phy but as this API's are already used by drivers/net/phy/phy_device.c we are getting compilation errors. So we used these power_down & power up. As power_off & power_down is confusing we will change new api's power_down & power_up to phy_pm_suspend & phy_pm_resume in the next patch series. > >