Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp5345554imm; Sun, 22 Jul 2018 20:09:02 -0700 (PDT) X-Google-Smtp-Source: AAOMgpc9EYKhv+gANn9/KYDd5v14Y1Xff7ImDKywTYMQvMabBfcZj0LVHh8W1jhK0TIY0Wv8EPBj X-Received: by 2002:a63:9f0a:: with SMTP id g10-v6mr10696102pge.324.1532315342742; Sun, 22 Jul 2018 20:09:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532315342; cv=none; d=google.com; s=arc-20160816; b=ajczbrNxN/mNPDhWcv05z+JQfLBgrXrxHwfvPmXIv8t6DYclF77j9zAz2x28L2HnWJ oUyaX9mSSaK5UOHwBQTC2pIQbLrrx5vsgRgBKoEjjyZfnto/pQd16Ci3hpH3soUSf80a sr08o8QhA91i2cpgDK+SETj2BPfdHap4xRyio7web34hbDCtkxprkJsnGyLxwMCJyoQK VMRFbQqdqYDyaHxz246Vs68Ur8TuF12srzToTqE/XIgtTGMiE6UuOOXUnyJcbM7H2hOW G5WL9fRFCGNs0/ddWuOSWJXrRWSHKt85onrMm0lovkR8CMrRIwq30kpszWpqIS8+vCdH FzhQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dmarc-filter :dkim-signature:dkim-signature:arc-authentication-results; bh=a+6icLAX+hDzvYoLSXoNY/AADa0nnMebkvyOEG7dAX8=; b=NSI2wrG/2vf4Rd6PS1zx88PM8C/OhdzuqhnYgs80ss3ORa+jJd8/SjsImpaPm1oFvs ECvRTcH2OUDs8KyCXnAMir7GJBfelnxAkt/9V8XPebGiB16iGnxc7GO4pzl7lyaW084B 1s46zPbg0SOXaJRuWKoJpYBsrPTLIbqYtkV9SDlcvce92N9ul9WxmMLGBTWDtvQgfdsH ezvAGV3NpFX+PGg2oI4Tp3rfa9RR4Q8mZm7UgRGU5j2buvSSz1TR8vb10fz39uH8sfSG I9GKjfUZervHS2Tcc5PqOkmsaORtvcTvh2FPPGXE4TgzwgnTFX1frHEdRKBxKJJRoa+7 VEjw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b=PJhaCcRV; dkim=pass header.i=@codeaurora.org header.s=default header.b=Mgw5m8l9; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k14-v6si7496313pga.149.2018.07.22.20.08.48; Sun, 22 Jul 2018 20:09:02 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b=PJhaCcRV; dkim=pass header.i=@codeaurora.org header.s=default header.b=Mgw5m8l9; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387808AbeGWEGN (ORCPT + 99 others); Mon, 23 Jul 2018 00:06:13 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:51008 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725903AbeGWEGN (ORCPT ); Mon, 23 Jul 2018 00:06:13 -0400 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 1FBE660BE1; Mon, 23 Jul 2018 03:07:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1532315233; bh=fKRHmpveHnxqMdrFhKP9RdAadoPKpmpvBtNU4U6d2rI=; h=Subject:To:Cc:References:From:Date:In-Reply-To:From; b=PJhaCcRVs/ql3lASCcGYXqW4GdW39yurGfsXAReQDci2DEvGvuN1EfXGsc2hpPULj SecHVLVms+CPo9leqg12nHALP0+tWaz4OfsrcYdXJCMg+UN32v/K5MC/eiOs3bSGhd cAduHrkryNvZ/d88i6O1LOFhdR8j63DzxMKNCis0= X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on pdx-caf-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.8 required=2.0 tests=ALL_TRUSTED,BAYES_00, DKIM_SIGNED,T_DKIM_INVALID autolearn=no autolearn_force=no version=3.4.0 Received: from [10.206.24.39] (blr-c-bdr-fw-01_globalnat_allzones-outside.qualcomm.com [103.229.19.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: asutoshd@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id 65EF660285; Mon, 23 Jul 2018 03:07:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1532315230; bh=fKRHmpveHnxqMdrFhKP9RdAadoPKpmpvBtNU4U6d2rI=; h=Subject:To:Cc:References:From:Date:In-Reply-To:From; b=Mgw5m8l9FRn29N9uly5Os29hsyt1dD5Q7U95jd7ivyPio9NkboyDakgD3t+ZzOhtF HlwoilboxBVISrDJKJm6en5norOYvbj59Whm1sV07r7NJj6lqSGWJw1rz1nuW2K1sU Fj+MvT7KhTybwbu94YarYtvBnlZ4Zm4KLygRmV+M= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 65EF660285 Authentication-Results: pdx-caf-mail.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: pdx-caf-mail.web.codeaurora.org; spf=none smtp.mailfrom=asutoshd@codeaurora.org Subject: Re: [PATCH v1 7/9] scsi: ufs: add UFS power collapse support during hibern8 To: Subhash Jadavani Cc: cang@codeaurora.org, vivek.gautam@codeaurora.org, rnayak@codeaurora.org, vinholikatti@gmail.com, jejb@linux.vnet.ibm.com, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, linux-arm-msm@vger.kernel.org, Venkat Gopalakrishnan , linux-kernel@vger.kernel.org References: <13f4fbc290b5e3cfea95f49d65ddb2bf99a15cdb.1530880007.git.asutoshd@codeaurora.org> From: "Asutosh Das (asd)" Message-ID: <8607cabf-e6ae-0a53-2139-d2279d458a9c@codeaurora.org> Date: Mon, 23 Jul 2018 08:37:04 +0530 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 7/21/2018 5:28 AM, Subhash Jadavani wrote: > On 2018-07-06 05:30, Asutosh Das wrote: >> From: Subhash Jadavani >> >> UFS host controller hardware may allow the host controller >> to be power collapsed when UFS link is hibern8 state, this >> change allows the UFS host controller to be power collapsed >> during hibern8. >> >> Signed-off-by: Subhash Jadavani >> Signed-off-by: Venkat Gopalakrishnan >> Signed-off-by: Can Guo >> Signed-off-by: Asutosh Das >> --- >>  drivers/scsi/ufs/ufshcd.c |  8 ++++++-- >>  drivers/scsi/ufs/ufshcd.h | 13 ++++++++++++- >>  2 files changed, 18 insertions(+), 3 deletions(-) >> >> diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c >> index 40d9c35..50588cf 100644 >> --- a/drivers/scsi/ufs/ufshcd.c >> +++ b/drivers/scsi/ufs/ufshcd.c >> @@ -7673,13 +7673,17 @@ static int ufshcd_vreg_set_hpm(struct ufs_hba >> *hba) >> >>  static void ufshcd_hba_vreg_set_lpm(struct ufs_hba *hba) >>  { >> -    if (ufshcd_is_link_off(hba)) >> +    if (ufshcd_is_link_off(hba) || >> +        (ufshcd_is_link_hibern8(hba) >> +         && ufshcd_is_power_collapse_during_hibern8_allowed(hba))) >>          ufshcd_setup_hba_vreg(hba, false); > > I guess we have to handle the UFS host controller power collapse via > "power-domains" which would requires us to specify the "power-domains" > attribute under UFS controller's DT node and then linux core power > framework should automatically collapse the UFS controller post runtime > suspend. This also means we can't power collapse UFS controller > aggressively (as part of clock gating) but it should still be fine from > power point of view. > >>  } >> >>  static void ufshcd_hba_vreg_set_hpm(struct ufs_hba *hba) >>  { >> -    if (ufshcd_is_link_off(hba)) >> +    if (ufshcd_is_link_off(hba) || >> +        (ufshcd_is_link_hibern8(hba) >> +         && ufshcd_is_power_collapse_during_hibern8_allowed(hba))) >>          ufshcd_setup_hba_vreg(hba, true); >>  } >> >> diff --git a/drivers/scsi/ufs/ufshcd.h b/drivers/scsi/ufs/ufshcd.h >> index f79a639..8c5f987 100644 >> --- a/drivers/scsi/ufs/ufshcd.h >> +++ b/drivers/scsi/ufs/ufshcd.h >> @@ -728,7 +728,12 @@ struct ufs_hba { >>       * to do background operation when it's active but it might degrade >>       * the performance of ongoing read/write operations. >>       */ >> -#define UFSHCD_CAP_KEEP_AUTO_BKOPS_ENABLED_EXCEPT_SUSPEND (1 << 5) >> +#define UFSHCD_CAP_KEEP_AUTO_BKOPS_ENABLED_EXCEPT_SUSPEND (1 << 6) >> +    /* >> +     * If host controller hardware can be power collapsed when UFS >> link is >> +     * in hibern8 then enable this cap. >> +     */ >> +#define UFSHCD_CAP_POWER_COLLAPSE_DURING_HIBERN8 (1 << 7) >> >>      struct devfreq *devfreq; >>      struct ufs_clk_scaling clk_scaling; >> @@ -764,6 +769,12 @@ static inline bool >> ufshcd_is_hibern8_on_idle_allowed(struct ufs_hba *hba) >>      return hba->caps & UFSHCD_CAP_HIBERN8_ENTER_ON_IDLE; >>  } >> >> +static inline bool ufshcd_is_power_collapse_during_hibern8_allowed( >> +                        struct ufs_hba *hba) >> +{ >> +    return !!(hba->caps & UFSHCD_CAP_POWER_COLLAPSE_DURING_HIBERN8); >> +} >> + >>  static inline bool ufshcd_is_intr_aggr_allowed(struct ufs_hba *hba) >>  { >>  /* DWC UFS Core has the Interrupt aggregation feature but is not >> detectable*/ > Thanks. I'll check the 'power-domains' part and get back with the changes. -- Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project