ACPI fixes for 5.0-rc2

- Fix build failures with both CONFIG_NLS and CONFIG_PCI unset that
    can occur since ACPI can be built without PCI now (Sinan Kaya).
 
  - Clean up the handling of duplicate entries in power resource lists
    returned by _PRx evaluation to avoid triggering WARN_ON() on
    attempts to add duplicate symlinks in sysfs (Hans de Goede).
 
  - Fix issues with the TS current-source switching on systems using
    the xpower PMIC by avoiding to update unrelated bits in the TS
    pin-ctrl register and avoiding to unconditionally enable TS
    current-source on systems where it is not used (Hans de Goede).
 
  - Fix addresses in NUMA-related messages on 32-bit with PAE which
    can be truncated due to integer type conversions (Chao Fan).
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2
 
 iQIcBAABCAAGBQJcOGwhAAoJEILEb/54YlRx2f8QAJZlOPuSlzXO5pl2ki8L/XXW
 S0vj6zOjR0mUeWuvq4ipKE/FzF7GZi+WjbMbJCF3C/txoHaYZqoGLjM0XZmiACi5
 4FrFEDyVfLZRoXfM0z9XcoptG9jWdBuGT8DckwnkeOdgxusop9kpIaDv8QDOLCXz
 +nZjPeG8wkGH+shNSyHb0q+Jok1Q2rNLHdkjzFkjjso803ORhVah7LcQkAViYPab
 L3r39MzuEpemRuPvLNzntWrNlKZyDZna8ydDD2PR1aqK8X2vIwT+Noo/WmismMWk
 wW4/GRL3DR5gnsmf/qpyQHnSKMvZLi6/JTe6etXTURKuZ6KtCxFsdjH7Ygaa65J9
 CL5C7Y3x0C8gJk4c9UP9jnVUY3IFm+R3xyynQWAnRLg7+kobN7h4lYyL12nwhWBS
 +vfVfaheHETNTx8K6agLbYzgcY6iNbZw0DeZM4oIAL+jRXyvhIjHjjGMnUPG1sTf
 K1EL2BtBL5virZJWgLv//87SKGxN39pBkR/zyx7rFKRY7mFztmLaQoEvpFP4HEv1
 ge1PhFU+8hPSzj3rElfOwZi5W7DRETpKnaNtRBNDRQnFSeWuCiKjAfLHVFND0EjH
 0sHk4Rjx5H6iDyMCoWyc3H4Dcdz89fwvH+ByAWlW+L1locJFrNEKoQgSeP9CAk7f
 srtuj+V+QtsVIaxBWhP6
 =83Yo
 -----END PGP SIGNATURE-----

Merge tag 'acpi-5.0-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm

Pull ACPI fixes from Rafael Wysocki:
 "Fix a build failure introduced recently, fix the xpower PMIC ACPI
  driver, clean up the handling of duplicate entries in _PRx power
  resource lists and fix addresses in NUMA-related messages on 32-bit
  with PAE.

  Specifics:

   - Fix build failures with both CONFIG_NLS and CONFIG_PCI unset that
     can occur since ACPI can be built without PCI now (Sinan Kaya).

   - Clean up the handling of duplicate entries in power resource lists
     returned by _PRx evaluation to avoid triggering WARN_ON() on
     attempts to add duplicate symlinks in sysfs (Hans de Goede).

   - Fix issues with the TS current-source switching on systems using
     the xpower PMIC by avoiding to update unrelated bits in the TS
     pin-ctrl register and avoiding to unconditionally enable TS
     current-source on systems where it is not used (Hans de Goede).

   - Fix addresses in NUMA-related messages on 32-bit with PAE which can
     be truncated due to integer type conversions (Chao Fan)"

* tag 'acpi-5.0-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm:
  ACPI / PMIC: xpower: Fix TS-pin current-source handling
  ACPI: NUMA: Use correct type for printing addresses on i386-PAE
  ACPI: power: Skip duplicate power resource references in _PRx
  ACPI: Fix build failure when CONFIG_NLS is set to 'n'
This commit is contained in:
Linus Torvalds 2019-01-11 09:04:36 -08:00
commit 8e1b295b69
4 changed files with 59 additions and 11 deletions

View File

@ -10,6 +10,7 @@ menuconfig ACPI
bool "ACPI (Advanced Configuration and Power Interface) Support"
depends on ARCH_SUPPORTS_ACPI
select PNP
select NLS
default y if X86
help
Advanced Configuration and Power Interface (ACPI) support for

View File

@ -146,9 +146,9 @@ acpi_table_print_srat_entry(struct acpi_subtable_header *header)
{
struct acpi_srat_mem_affinity *p =
(struct acpi_srat_mem_affinity *)header;
pr_debug("SRAT Memory (0x%lx length 0x%lx) in proximity domain %d %s%s%s\n",
(unsigned long)p->base_address,
(unsigned long)p->length,
pr_debug("SRAT Memory (0x%llx length 0x%llx) in proximity domain %d %s%s%s\n",
(unsigned long long)p->base_address,
(unsigned long long)p->length,
p->proximity_domain,
(p->flags & ACPI_SRAT_MEM_ENABLED) ?
"enabled" : "disabled",

View File

@ -20,8 +20,11 @@
#define GPI1_LDO_ON (3 << 0)
#define GPI1_LDO_OFF (4 << 0)
#define AXP288_ADC_TS_PIN_GPADC 0xf2
#define AXP288_ADC_TS_PIN_ON 0xf3
#define AXP288_ADC_TS_CURRENT_ON_OFF_MASK GENMASK(1, 0)
#define AXP288_ADC_TS_CURRENT_OFF (0 << 0)
#define AXP288_ADC_TS_CURRENT_ON_WHEN_CHARGING (1 << 0)
#define AXP288_ADC_TS_CURRENT_ON_ONDEMAND (2 << 0)
#define AXP288_ADC_TS_CURRENT_ON (3 << 0)
static struct pmic_table power_table[] = {
{
@ -212,22 +215,44 @@ out:
*/
static int intel_xpower_pmic_get_raw_temp(struct regmap *regmap, int reg)
{
int ret, adc_ts_pin_ctrl;
u8 buf[2];
int ret;
ret = regmap_write(regmap, AXP288_ADC_TS_PIN_CTRL,
AXP288_ADC_TS_PIN_GPADC);
/*
* The current-source used for the battery temp-sensor (TS) is shared
* with the GPADC. For proper fuel-gauge and charger operation the TS
* current-source needs to be permanently on. But to read the GPADC we
* need to temporary switch the TS current-source to ondemand, so that
* the GPADC can use it, otherwise we will always read an all 0 value.
*
* Note that the switching from on to on-ondemand is not necessary
* when the TS current-source is off (this happens on devices which
* do not use the TS-pin).
*/
ret = regmap_read(regmap, AXP288_ADC_TS_PIN_CTRL, &adc_ts_pin_ctrl);
if (ret)
return ret;
/* After switching to the GPADC pin give things some time to settle */
usleep_range(6000, 10000);
if (adc_ts_pin_ctrl & AXP288_ADC_TS_CURRENT_ON_OFF_MASK) {
ret = regmap_update_bits(regmap, AXP288_ADC_TS_PIN_CTRL,
AXP288_ADC_TS_CURRENT_ON_OFF_MASK,
AXP288_ADC_TS_CURRENT_ON_ONDEMAND);
if (ret)
return ret;
/* Wait a bit after switching the current-source */
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);
if (adc_ts_pin_ctrl & AXP288_ADC_TS_CURRENT_ON_OFF_MASK) {
regmap_update_bits(regmap, AXP288_ADC_TS_PIN_CTRL,
AXP288_ADC_TS_CURRENT_ON_OFF_MASK,
AXP288_ADC_TS_CURRENT_ON);
}
return ret;
}

View File

@ -131,6 +131,23 @@ void acpi_power_resources_list_free(struct list_head *list)
}
}
static bool acpi_power_resource_is_dup(union acpi_object *package,
unsigned int start, unsigned int i)
{
acpi_handle rhandle, dup;
unsigned int j;
/* The caller is expected to check the package element types */
rhandle = package->package.elements[i].reference.handle;
for (j = start; j < i; j++) {
dup = package->package.elements[j].reference.handle;
if (dup == rhandle)
return true;
}
return false;
}
int acpi_extract_power_resources(union acpi_object *package, unsigned int start,
struct list_head *list)
{
@ -150,6 +167,11 @@ int acpi_extract_power_resources(union acpi_object *package, unsigned int start,
err = -ENODEV;
break;
}
/* Some ACPI tables contain duplicate power resource references */
if (acpi_power_resource_is_dup(package, start, i))
continue;
err = acpi_add_power_resource(rhandle);
if (err)
break;