Received: by 2002:ac0:a591:0:0:0:0:0 with SMTP id m17-v6csp1735680imm; Fri, 6 Jul 2018 05:42:15 -0700 (PDT) X-Google-Smtp-Source: AAOMgpcjj+XooXq9LLugxD3c49/FFRwlcjAsTwDThMnfDDhDzQorLyyq6rsppQOcnqV6aq0UdNcr X-Received: by 2002:a62:6147:: with SMTP id v68-v6mr10522174pfb.115.1530880935120; Fri, 06 Jul 2018 05:42:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530880935; cv=none; d=google.com; s=arc-20160816; b=oey3Z859Uqpf/uvML4DF1PaLvlaFPPSrOBKA67P+XGwfb5OnXgdxZUu/XYNjPIlKVB BbU4jzCnExLB+DwKxAoeEeS5vY4WGCV/c8pWAycvOJ7N5QpEOhgk6QzW6f1soZPynXqM qz0oq/+2yv/gWlU7EfXAE7BIt3UMuIbV/etcpYtybTth8kE31e29wpL9VXP9YPS5O3Dc 61r4OMRhOXm7feUQePCX5j1NZB1cjkiDCDBBbeW5dYLXeCbp5/ZnD1sTl9hfKEkAFo4f kDbnvm7gf6B73D2vCfjajVo6YHNvV4Cn0tyKZ8J2FGRllsn/1X3SaCEJLsqoUdD7p508 2X8w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=i9bYIAgY+HuGeH8Vvzym9gau82dfETKiVZz5VqFC8JQ=; b=jIB3hHBah+XRxMu6dR8WFfy6+lUnA83e7yuNgKASj2BfF1yGRjn+F562iEC3N11IsD jepqtV/zjv3czKADqyY55/zBf4bDYkM95OftKFJmiJJqOnJhvqpBOxD7ytGLQIAv7lcp KJHIypi1LeYlEDmqJYGgTPf4eRbjVUH89KGrYiNYfdRITStMR/Ow7ajjuB5bKNGMp1cr WWLowOIOR/+ZZcsSKdJ1CvotnFCyy5mRyPiObHFYcBXpC2HRgaYlB0qOETpvsdFlyRR7 0qYrChZV7QwBEY43RmtTkoDeB0fECQRihgzdMTeqFIb+7cPIRm3PvGUq0akvEQTLIDtz aVRQ== ARC-Authentication-Results: i=1; mx.google.com; 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 l8-v6si7773022pgf.567.2018.07.06.05.42.00; Fri, 06 Jul 2018 05:42:15 -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; 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 S933362AbeGFMkv (ORCPT + 99 others); Fri, 6 Jul 2018 08:40:51 -0400 Received: from alexa-out-blr-02.qualcomm.com ([103.229.18.198]:32534 "EHLO alexa-out-blr.qualcomm.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S933060AbeGFMil (ORCPT ); Fri, 6 Jul 2018 08:38:41 -0400 X-IronPort-AV: E=Sophos;i="5.51,316,1526322600"; d="scan'208";a="98704" Received: from ironmsg03-blr.qualcomm.com ([10.86.208.132]) by alexa-out-blr.qualcomm.com with ESMTP/TLS/AES256-SHA; 06 Jul 2018 18:00:54 +0530 X-IronPort-AV: E=McAfee;i="5900,7806,8945"; a="470260" Received: from asutoshd-linux.qualcomm.com ([10.206.24.163]) by ironmsg03-blr.qualcomm.com with ESMTP; 06 Jul 2018 18:00:54 +0530 Received: by asutoshd-linux.qualcomm.com (Postfix, from userid 92687) id 75EDB2FAD; Fri, 6 Jul 2018 18:00:53 +0530 (IST) From: Asutosh Das To: subhashj@codeaurora.org, 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 Cc: linux-arm-msm@vger.kernel.org, Venkat Gopalakrishnan , Asutosh Das , linux-kernel@vger.kernel.org (open list) Subject: [PATCH v1 7/9] scsi: ufs: add UFS power collapse support during hibern8 Date: Fri, 6 Jul 2018 18:00:34 +0530 Message-Id: <13f4fbc290b5e3cfea95f49d65ddb2bf99a15cdb.1530880007.git.asutoshd@codeaurora.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: References: In-Reply-To: References: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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); } 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*/ -- Qualcomm India Private Limited, on behalf of Qualcomm Innovation Center, Inc. Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project.