ACPI / PMIC: xpower: Do pinswitch magic when reading GPADC
Testing has shown that the TS-pin's bias-current needs to be disabled when reading the GPIO0 pin in GPADC mode. It seems that there is only 1 bias current source and to be able to use it for the GPIO0 pin in GPADC mode it must be temporarily turned off for the TS pin, but the datasheet does not mention this. This commit adds the necessary writes to turn the TS pin BIAS current off before and back on after reading the GPADC. This fixes the GPADC always returning a reading of 0. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
This commit is contained in:
parent
520eccdfe1
commit
58eefe2f3f
@ -27,6 +27,9 @@
|
|||||||
#define GPI1_LDO_ON (3 << 0)
|
#define GPI1_LDO_ON (3 << 0)
|
||||||
#define GPI1_LDO_OFF (4 << 0)
|
#define GPI1_LDO_OFF (4 << 0)
|
||||||
|
|
||||||
|
#define AXP288_ADC_TS_PIN_GPADC 0xf2
|
||||||
|
#define AXP288_ADC_TS_PIN_ON 0xf3
|
||||||
|
|
||||||
static struct pmic_table power_table[] = {
|
static struct pmic_table power_table[] = {
|
||||||
{
|
{
|
||||||
.address = 0x00,
|
.address = 0x00,
|
||||||
@ -209,11 +212,23 @@ static int intel_xpower_pmic_update_power(struct regmap *regmap, int reg,
|
|||||||
static int intel_xpower_pmic_get_raw_temp(struct regmap *regmap, int reg)
|
static int intel_xpower_pmic_get_raw_temp(struct regmap *regmap, int reg)
|
||||||
{
|
{
|
||||||
u8 buf[2];
|
u8 buf[2];
|
||||||
|
int ret;
|
||||||
|
|
||||||
if (regmap_bulk_read(regmap, AXP288_GP_ADC_H, buf, 2))
|
ret = regmap_write(regmap, AXP288_ADC_TS_PIN_CTRL,
|
||||||
return -EIO;
|
AXP288_ADC_TS_PIN_GPADC);
|
||||||
|
if (ret)
|
||||||
|
return ret;
|
||||||
|
|
||||||
return (buf[0] << 4) + ((buf[1] >> 4) & 0x0F);
|
/* After switching to the GPADC pin give things some time to settle */
|
||||||
|
usleep_range(6000, 10000);
|
||||||
|
|
||||||
|
ret = regmap_bulk_read(regmap, AXP288_GP_ADC_H, buf, 2);
|
||||||
|
if (ret == 0)
|
||||||
|
ret = (buf[0] << 4) + ((buf[1] >> 4) & 0x0f);
|
||||||
|
|
||||||
|
regmap_write(regmap, AXP288_ADC_TS_PIN_CTRL, AXP288_ADC_TS_PIN_ON);
|
||||||
|
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct intel_pmic_opregion_data intel_xpower_pmic_opregion_data = {
|
static struct intel_pmic_opregion_data intel_xpower_pmic_opregion_data = {
|
||||||
|
Loading…
Reference in New Issue
Block a user