|
|
88f3771 |
From cc2b0e2c164d02ab42efa736f91f53baf8d8bc36 Mon Sep 17 00:00:00 2001
|
|
|
88f3771 |
From: Hans de Goede <hdegoede@redhat.com>
|
|
|
88f3771 |
Date: Thu, 20 Apr 2017 22:41:20 +0200
|
|
|
88f3771 |
Subject: [PATCH 05/16] ACPI / PMIC: xpower: Add support for the GPI1 regulator
|
|
|
88f3771 |
to the OpRegion handler
|
|
|
88f3771 |
|
|
|
88f3771 |
Some Bay Trail devices use a GPI1 regulator field (address 0x4c) in
|
|
|
88f3771 |
their 0x8d power OpRegion, add support for this.
|
|
|
88f3771 |
|
|
|
88f3771 |
This fixes AE_BAD_PARAMETER errors getting thrown on these devices and
|
|
|
88f3771 |
fixes these errors causing these devices to not suspend.
|
|
|
88f3771 |
|
|
|
88f3771 |
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
|
|
|
88f3771 |
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
|
|
|
88f3771 |
---
|
|
|
88f3771 |
Changes in v2:
|
|
|
88f3771 |
-Simplify reg == 0x92 handling (suggested by Andy Shevchenko)
|
|
|
88f3771 |
-Add special handling for reg == 0x92 to intel_xpower_pmic_get_power() too
|
|
|
88f3771 |
Changes in v3:
|
|
|
88f3771 |
-Use defines for GPI1 reg and bits, rather then hardcoded hex values
|
|
|
88f3771 |
---
|
|
|
88f3771 |
drivers/acpi/pmic/intel_pmic_xpower.c | 21 ++++++++++++++++++++-
|
|
|
88f3771 |
1 file changed, 20 insertions(+), 1 deletion(-)
|
|
|
88f3771 |
|
|
|
88f3771 |
diff --git a/drivers/acpi/pmic/intel_pmic_xpower.c b/drivers/acpi/pmic/intel_pmic_xpower.c
|
|
|
88f3771 |
index 1a76c784cd4c..3b7d5be5b7ed 100644
|
|
|
88f3771 |
--- a/drivers/acpi/pmic/intel_pmic_xpower.c
|
|
|
88f3771 |
+++ b/drivers/acpi/pmic/intel_pmic_xpower.c
|
|
|
88f3771 |
@@ -21,6 +21,11 @@
|
|
|
88f3771 |
#include "intel_pmic.h"
|
|
|
88f3771 |
|
|
|
88f3771 |
#define XPOWER_GPADC_LOW 0x5b
|
|
|
88f3771 |
+#define XPOWER_GPI1_CTRL 0x92
|
|
|
88f3771 |
+
|
|
|
88f3771 |
+#define GPI1_LDO_MASK GENMASK(2, 0)
|
|
|
88f3771 |
+#define GPI1_LDO_ON (3 << 0)
|
|
|
88f3771 |
+#define GPI1_LDO_OFF (4 << 0)
|
|
|
88f3771 |
|
|
|
88f3771 |
static struct pmic_table power_table[] = {
|
|
|
88f3771 |
{
|
|
|
88f3771 |
@@ -118,6 +123,10 @@ static struct pmic_table power_table[] = {
|
|
|
88f3771 |
.reg = 0x10,
|
|
|
88f3771 |
.bit = 0x00
|
|
|
88f3771 |
}, /* BUC6 */
|
|
|
88f3771 |
+ {
|
|
|
88f3771 |
+ .address = 0x4c,
|
|
|
88f3771 |
+ .reg = 0x92,
|
|
|
88f3771 |
+ }, /* GPI1 */
|
|
|
88f3771 |
};
|
|
|
88f3771 |
|
|
|
88f3771 |
/* TMP0 - TMP5 are the same, all from GPADC */
|
|
|
88f3771 |
@@ -156,7 +165,12 @@ static int intel_xpower_pmic_get_power(struct regmap *regmap, int reg,
|
|
|
88f3771 |
if (regmap_read(regmap, reg, &data))
|
|
|
88f3771 |
return -EIO;
|
|
|
88f3771 |
|
|
|
88f3771 |
- *value = (data & BIT(bit)) ? 1 : 0;
|
|
|
88f3771 |
+ /* GPIO1 LDO regulator needs special handling */
|
|
|
88f3771 |
+ if (reg == XPOWER_GPI1_CTRL)
|
|
|
88f3771 |
+ *value = ((data & GPI1_LDO_MASK) == GPI1_LDO_ON);
|
|
|
88f3771 |
+ else
|
|
|
88f3771 |
+ *value = (data & BIT(bit)) ? 1 : 0;
|
|
|
88f3771 |
+
|
|
|
88f3771 |
return 0;
|
|
|
88f3771 |
}
|
|
|
88f3771 |
|
|
|
88f3771 |
@@ -165,6 +179,11 @@ static int intel_xpower_pmic_update_power(struct regmap *regmap, int reg,
|
|
|
88f3771 |
{
|
|
|
88f3771 |
int data;
|
|
|
88f3771 |
|
|
|
88f3771 |
+ /* GPIO1 LDO regulator needs special handling */
|
|
|
88f3771 |
+ if (reg == XPOWER_GPI1_CTRL)
|
|
|
88f3771 |
+ return regmap_update_bits(regmap, reg, GPI1_LDO_MASK,
|
|
|
88f3771 |
+ on ? GPI1_LDO_ON : GPI1_LDO_OFF);
|
|
|
88f3771 |
+
|
|
|
88f3771 |
if (regmap_read(regmap, reg, &data))
|
|
|
88f3771 |
return -EIO;
|
|
|
88f3771 |
|
|
|
88f3771 |
--
|
|
|
88f3771 |
2.13.0
|
|
|
88f3771 |
|