[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20220616053725.5681-12-stanley.chu@mediatek.com>
Date: Thu, 16 Jun 2022 13:37:25 +0800
From: Stanley Chu <stanley.chu@...iatek.com>
To: <linux-scsi@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
<martin.petersen@...cle.com>, <avri.altman@....com>,
<alim.akhtar@...sung.com>, <jejb@...ux.ibm.com>,
<bvanassche@....org>
CC: <peter.wang@...iatek.com>, <chun-hung.wu@...iatek.com>,
<alice.chao@...iatek.com>, <powen.kao@...iatek.com>,
<mason.zhang@...iatek.com>, <qilin.tan@...iatek.com>,
<lin.gui@...iatek.com>, <eddie.huang@...iatek.com>,
<tun-yu.yu@...iatek.com>, <cc.chou@...iatek.com>,
<chaotian.jing@...iatek.com>, <jiajie.hao@...iatek.com>,
<stanley.chu@...iatek.com>
Subject: [PATCH v5 11/11] scsi: ufs-mediatek: Disable unused VCCQx power rails
Some MediaTek UFS platforms support different VCCQx power rails,
for example, both 1.2v and 1.8v VCCQx, in a single kernel image.
To optimize the system power consumption, provide a way to disable
and release the unused power rail during the device probing.
Signed-off-by: Stanley Chu <stanley.chu@...iatek.com>
---
drivers/ufs/host/ufs-mediatek.c | 24 ++++++++++++++++++++++++
1 file changed, 24 insertions(+)
diff --git a/drivers/ufs/host/ufs-mediatek.c b/drivers/ufs/host/ufs-mediatek.c
index 34e51c094366..bfe04a4d1dce 100755
--- a/drivers/ufs/host/ufs-mediatek.c
+++ b/drivers/ufs/host/ufs-mediatek.c
@@ -712,6 +712,29 @@ static int ufs_mtk_vreg_fix_vcc(struct ufs_hba *hba)
return err;
}
+static void ufs_mtk_vreg_fix_vccqx(struct ufs_hba *hba)
+{
+ struct ufs_vreg_info *info = &hba->vreg_info;
+ struct ufs_vreg **vreg_on, **vreg_off;
+
+ if (hba->dev_info.wspecversion >= 0x0300) {
+ vreg_on = &info->vccq;
+ vreg_off = &info->vccq2;
+ } else {
+ vreg_on = &info->vccq2;
+ vreg_off = &info->vccq;
+ }
+
+ if (*vreg_on)
+ (*vreg_on)->always_on = true;
+
+ if (*vreg_off) {
+ regulator_disable((*vreg_off)->reg);
+ devm_kfree(hba->dev, (*vreg_off)->name);
+ devm_kfree(hba->dev, *vreg_off);
+ }
+}
+
/**
* ufs_mtk_init - find other essential mmio bases
* @hba: host controller instance
@@ -1241,6 +1264,7 @@ static void ufs_mtk_fixup_dev_quirks(struct ufs_hba *hba)
}
ufs_mtk_vreg_fix_vcc(hba);
+ ufs_mtk_vreg_fix_vccqx(hba);
}
static void ufs_mtk_event_notify(struct ufs_hba *hba,
--
2.18.0
Powered by blists - more mailing lists