summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--drivers/hwmon/imx_ahci_hwmon.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/drivers/hwmon/imx_ahci_hwmon.c b/drivers/hwmon/imx_ahci_hwmon.c
index 62048f764e0d..7688d92a2c92 100644
--- a/drivers/hwmon/imx_ahci_hwmon.c
+++ b/drivers/hwmon/imx_ahci_hwmon.c
@@ -90,6 +90,11 @@ static ssize_t imx_ahci_hwmon_temp_show(struct device *dev,
return -1;
}
+ /* Disable PDDQ mode when this mode is enabled */
+ read_sum = readl(mmio + PORT_PHY_CTL);
+ if (read_sum & PORT_PHY_CTL_PDDQ_LOC)
+ writel(read_sum & ~PORT_PHY_CTL_PDDQ_LOC, mmio + PORT_PHY_CTL);
+
/* check rd-wr to reg */
read_sum = 0;
sata_phy_cr_addr(SATA_PHY_CR_CLOCK_CRCMP_LT_LIMIT, mmio);
@@ -230,6 +235,10 @@ static ssize_t imx_ahci_hwmon_temp_show(struct device *dev,
a = (m2 - m1) / (m2 / 1000);
temp = ((((-559) * a) / 1000) * a) / 1000 + (1379) * a / 1000 + (-458);
+ /* Enable PDDQ mode to save power */
+ read_sum = readl(mmio + PORT_PHY_CTL);
+ writel(read_sum | PORT_PHY_CTL_PDDQ_LOC, mmio + PORT_PHY_CTL);
+
iounmap(mmio);
/* Release the clocks */
@@ -237,6 +246,7 @@ static ssize_t imx_ahci_hwmon_temp_show(struct device *dev,
clk_put(sata_ref_clk);
clk_disable(sata_clk);
clk_put(sata_clk);
+
mutex_unlock(&hwmon->lock);
return sprintf(buf, "%d\n", temp * 1000);