Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp2785244ybl; Sun, 2 Feb 2020 06:39:05 -0800 (PST) X-Google-Smtp-Source: APXvYqwmEq8Aa7OOrFEUqbjLTOCYXQO1DihpRVJu8Edewr5xX21ADMzia0VUQo514o5j8POUa250 X-Received: by 2002:a05:6830:612:: with SMTP id w18mr14810342oti.160.1580654345170; Sun, 02 Feb 2020 06:39:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1580654345; cv=none; d=google.com; s=arc-20160816; b=iXT9yk9uMEHGFOMjL7xDrWAYfC8iuoTTRYtWrVrQALeuxInoQ9iq9PoJY9YLitsUCQ 6nNBRcFh1pO5K5e2fCafM666deEZIU4R/9ztinU/CqjeyTLUeLnJAWNL9N0xCfHg+fu0 5EDDB4CQGxMGr4rWH01uZT9pF227WXm25+L+jssfogcG7dbSpIAswXtP5blLuKqNHqay mur7r8xqj4z//JACNK0ZApXzhfNSwbWJqTRQX9D9Wf2eE3b7YFndsbeUqmOLDpRGmzY9 8qU2r0IXOOQuVuYn2MLvpCMsrfp3I9L2+MxgNnF9pak0bnyUZ/SjZrnSnaiYYHzJbLjI 1HjQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=+7SXwisOz3MJdWhABlsmYfw2UinRaMfqXmyYRTMi5bI=; b=iPx84d95XEEN6QrIv4yLpoTIFwOmqSy0Bfh2BFS6Z2Iw46MO1M9z+LHeI20wjbRKFb fGQ/3E3AYhE13MwHjJgF2N5o/iFHUmN6JQKqT91Jv9VJPID0ZT2w+pY1XDhOFa8C+aqM I2vKyWNnWas+h8ylN+ddRFBQ7flsbR6M2rYVEPjXCBc3xO3vV2IrHsPSsDm808GJ8LC6 1x5o/H6yYgRgNKel1kT88c4H/BdXtyI/eEK+01PBvsG+Ab0kB/+d/d0mR3UT1PgpqzN9 nrHM4R0wL19xVrfaSh+Mg7Pk7mqEI/dxAYhQCRTKYp8gwa3I7xi4q6k7uM7XqYvmZSxh 9RvQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=nkGIcVJU; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i10si7710859otk.195.2020.02.02.06.38.53; Sun, 02 Feb 2020 06:39:05 -0800 (PST) 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=@gmail.com header.s=20161025 header.b=nkGIcVJU; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726969AbgBBOgJ (ORCPT + 99 others); Sun, 2 Feb 2020 09:36:09 -0500 Received: from mail-vk1-f196.google.com ([209.85.221.196]:40237 "EHLO mail-vk1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726679AbgBBOgI (ORCPT ); Sun, 2 Feb 2020 09:36:08 -0500 Received: by mail-vk1-f196.google.com with SMTP id c129so3414685vkh.7; Sun, 02 Feb 2020 06:36:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=+7SXwisOz3MJdWhABlsmYfw2UinRaMfqXmyYRTMi5bI=; b=nkGIcVJUjrMDSCgg9dnvxyApE+KcfK1JRDvG9M7U69uj4lu4YeheYaqQ2B2zYSHejF HtyDT9986T1/59nJv7gUpX4p3b04B4cUUJ38raYyX5kaGSuNmDDQX2tuz7BF4FG5J4ri /o0xrbv1G0wkzFupwOvxgiHxTfde5/sY89NBglGhIQ9zKDqPrbcmikAM/SO9aD9VMLJ7 DENW0BEgzEZ8NGFO7Dbz6loV1SAF3rKSJvkB029la8q0b0d9qxwf/hzaM5N6Z84EQVRT HyaLMek17KZSxzfbyj84G5GprKqrNJeuXLNuFuM2RlKt4ERX0B6YGiY+K7wXz1SHYocf 5ukg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=+7SXwisOz3MJdWhABlsmYfw2UinRaMfqXmyYRTMi5bI=; b=PbKHXtIS7ZaPTnR3tzTnf19efAYlIF6hsoRZP2B9CbnL/MPBcJPI1hOBm+8ZV4uewA wzSU0/WB41XBNGDBZOFCj2DVnIM0itmUuKxObUXpbE00mdrpjIaheL0Dr8wHuCne8gPP fj1kHKY214Y8xVg3Z1ImFJ2gOC1Sw3kFA86H4Mm9/PSy7Mo88k/Vts3D+0LVMlvTTefp ptWr0sJWncnEr4ljRNQSB5boHlGFJ5Rf2E6owJtZPr54pI3O3/P0FsVyx0u8Qb/toTEa E22bEkhnSlyWmY8FoFFzkuFrxPWkdM5mlWrMQSfChmuKWnLCgGLkkR+tiR4riNOH83q9 /ytg== X-Gm-Message-State: APjAAAVtFFY8IULbBATFtBeKoKoIMOnIc+ma5AQC1FHrlFLQ7Hx0pfLO 07rDeWE/wrF7UDfOaaqP62ysu09/ObPtTpzr500= X-Received: by 2002:a1f:4541:: with SMTP id s62mr11624924vka.59.1580654167536; Sun, 02 Feb 2020 06:36:07 -0800 (PST) MIME-Version: 1.0 References: <20200129073902.5786-1-stanley.chu@mediatek.com> <20200129073902.5786-3-stanley.chu@mediatek.com> In-Reply-To: <20200129073902.5786-3-stanley.chu@mediatek.com> From: Alim Akhtar Date: Sun, 2 Feb 2020 20:05:31 +0530 Message-ID: Subject: Re: [PATCH v3 2/4] scsi: ufs-mediatek: support linkoff state during suspend To: Stanley Chu Cc: linux-scsi@vger.kernel.org, "Martin K. Petersen" , Avri Altman , Alim Akhtar , "James E.J. Bottomley" , "Bean Huo (beanhuo)" , asutoshd@codeaurora.org, Can Guo , Matthias Brugger , Bart Van Assche , linux-mediatek@lists.infradead.org, linux-arm-kernel@lists.infradead.org, open list , Kuohong Wang , peter.wang@mediatek.com, chun-hung.wu@mediatek.com, andy.teng@mediatek.com Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Stanley On Wed, Jan 29, 2020 at 1:11 PM Stanley Chu wrote: > > If system suspend or runtime suspend mode is configured as > linkoff state, phy can be powered off and reference clock > can be gated in MediaTek Chipsets. > > In the same time, remove redundant reference clock control > in suspend and resume callbacks because such control can be > well-handled in setup_clocks callback.. > > Signed-off-by: Stanley Chu Reviewed-by: Alim Akhtar > --- > drivers/scsi/ufs/ufs-mediatek.c | 12 +++++++----- > 1 file changed, 7 insertions(+), 5 deletions(-) > > diff --git a/drivers/scsi/ufs/ufs-mediatek.c b/drivers/scsi/ufs/ufs-mediatek.c > index 7ac838cc15d1..d78897a14905 100644 > --- a/drivers/scsi/ufs/ufs-mediatek.c > +++ b/drivers/scsi/ufs/ufs-mediatek.c > @@ -167,7 +167,7 @@ static int ufs_mtk_setup_clocks(struct ufs_hba *hba, bool on, > > switch (status) { > case PRE_CHANGE: > - if (!on) { > + if (!on && !ufshcd_is_link_active(hba)) { > ufs_mtk_setup_ref_clk(hba, on); > ret = phy_power_off(host->mphy); > } > @@ -437,10 +437,11 @@ static int ufs_mtk_suspend(struct ufs_hba *hba, enum ufs_pm_op pm_op) > err = ufs_mtk_link_set_lpm(hba); > if (err) > return -EAGAIN; > - phy_power_off(host->mphy); > - ufs_mtk_setup_ref_clk(hba, false); > } > > + if (!ufshcd_is_link_active(hba)) > + phy_power_off(host->mphy); > + > return 0; > } > > @@ -449,9 +450,10 @@ static int ufs_mtk_resume(struct ufs_hba *hba, enum ufs_pm_op pm_op) > struct ufs_mtk_host *host = ufshcd_get_variant(hba); > int err; > > - if (ufshcd_is_link_hibern8(hba)) { > - ufs_mtk_setup_ref_clk(hba, true); > + if (!ufshcd_is_link_active(hba)) > phy_power_on(host->mphy); > + > + if (ufshcd_is_link_hibern8(hba)) { > err = ufs_mtk_link_set_hpm(hba); > if (err) > return err; > -- > 2.18.0 -- Regards, Alim