Commit af8fefd7 authored by Rafael J. Wysocki's avatar Rafael J. Wysocki

Merge branches 'acpi-x86', 'acpi-pmic' and 'acpi-dptf'

Merge x86-specific ACPI updates, PMIC driver ACPI updates and a DPTF
driver update for 5.17-rc1:

 - Rework the handling of device enumeration quirks in the x86-specific
   code and add new quirks for known-broken platforms (Hans de Goede).

 - Fix the handling of defective LPAT in the ACPI xpower PMIC driver
   and clean up some definitions of PMIC data structures (Hans de
   Goede).

 - Fix outdated comment in the ACPI DPTF driver (Sumeet Pawnikar).

* acpi-x86:
  ACPI / x86: Skip AC and battery devices on x86 Android tablets with broken DSDTs
  ACPI / x86: Introduce an acpi_quirk_skip_acpi_ac_and_battery() helper
  mmc: sdhci-acpi: Use the new soc_intel_is_byt() helper
  mmc: sdhci-acpi: Remove special handling for GPD win/pocket devices
  ACPI / x86: Add PWM2 on the Xiaomi Mi Pad 2 to the always_present list
  ACPI / x86: Add not-present quirk for the PCI0.SDHB.BRC1 device on the GPD win
  ACPI / x86: Allow specifying acpi_device_override_status() quirks by path
  ACPI: Change acpi_device_always_present() into acpi_device_override_status()
  ACPI / x86: Drop PWM2 device on Lenovo Yoga Book from always present table

* acpi-pmic:
  ACPI: PMIC: xpower: Fix _TMP ACPI errors
  ACPI: PMIC: allow drivers to provide a custom lpat_raw_to_temp() function
  ACPI: PMIC: constify all struct intel_pmic_opregion_data declarations

* acpi-dptf:
  ACPI: DPTF: Update device ID in a comment
...@@ -48,19 +48,12 @@ static const struct acpi_device_id ac_device_ids[] = { ...@@ -48,19 +48,12 @@ static const struct acpi_device_id ac_device_ids[] = {
}; };
MODULE_DEVICE_TABLE(acpi, ac_device_ids); MODULE_DEVICE_TABLE(acpi, ac_device_ids);
/* Lists of PMIC ACPI HIDs with an (often better) native charger driver */
static const struct acpi_ac_bl acpi_ac_blacklist[] = {
{ "INT33F4", -1 }, /* X-Powers AXP288 PMIC */
{ "INT34D3", 3 }, /* Intel Cherrytrail Whiskey Cove PMIC */
};
#ifdef CONFIG_PM_SLEEP #ifdef CONFIG_PM_SLEEP
static int acpi_ac_resume(struct device *dev); static int acpi_ac_resume(struct device *dev);
#endif #endif
static SIMPLE_DEV_PM_OPS(acpi_ac_pm, NULL, acpi_ac_resume); static SIMPLE_DEV_PM_OPS(acpi_ac_pm, NULL, acpi_ac_resume);
static int ac_sleep_before_get_state_ms; static int ac_sleep_before_get_state_ms;
static int ac_check_pmic = 1;
static int ac_only; static int ac_only;
static struct acpi_driver acpi_ac_driver = { static struct acpi_driver acpi_ac_driver = {
...@@ -200,12 +193,6 @@ static int __init thinkpad_e530_quirk(const struct dmi_system_id *d) ...@@ -200,12 +193,6 @@ static int __init thinkpad_e530_quirk(const struct dmi_system_id *d)
return 0; return 0;
} }
static int __init ac_do_not_check_pmic_quirk(const struct dmi_system_id *d)
{
ac_check_pmic = 0;
return 0;
}
static int __init ac_only_quirk(const struct dmi_system_id *d) static int __init ac_only_quirk(const struct dmi_system_id *d)
{ {
ac_only = 1; ac_only = 1;
...@@ -214,13 +201,6 @@ static int __init ac_only_quirk(const struct dmi_system_id *d) ...@@ -214,13 +201,6 @@ static int __init ac_only_quirk(const struct dmi_system_id *d)
/* Please keep this list alphabetically sorted */ /* Please keep this list alphabetically sorted */
static const struct dmi_system_id ac_dmi_table[] __initconst = { static const struct dmi_system_id ac_dmi_table[] __initconst = {
{
/* ECS EF20EA, AXP288 PMIC but uses separate fuel-gauge */
.callback = ac_do_not_check_pmic_quirk,
.matches = {
DMI_MATCH(DMI_PRODUCT_NAME, "EF20EA"),
},
},
{ {
/* Kodlix GK45 returning incorrect state */ /* Kodlix GK45 returning incorrect state */
.callback = ac_only_quirk, .callback = ac_only_quirk,
...@@ -228,15 +208,6 @@ static const struct dmi_system_id ac_dmi_table[] __initconst = { ...@@ -228,15 +208,6 @@ static const struct dmi_system_id ac_dmi_table[] __initconst = {
DMI_MATCH(DMI_PRODUCT_NAME, "GK45"), DMI_MATCH(DMI_PRODUCT_NAME, "GK45"),
}, },
}, },
{
/* Lenovo Ideapad Miix 320, AXP288 PMIC, separate fuel-gauge */
.callback = ac_do_not_check_pmic_quirk,
.matches = {
DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
DMI_MATCH(DMI_PRODUCT_NAME, "80XF"),
DMI_MATCH(DMI_PRODUCT_VERSION, "Lenovo MIIX 320-10ICR"),
},
},
{ {
/* Lenovo Thinkpad e530, see comment in acpi_ac_notify() */ /* Lenovo Thinkpad e530, see comment in acpi_ac_notify() */
.callback = thinkpad_e530_quirk, .callback = thinkpad_e530_quirk,
...@@ -341,23 +312,15 @@ static int acpi_ac_remove(struct acpi_device *device) ...@@ -341,23 +312,15 @@ static int acpi_ac_remove(struct acpi_device *device)
static int __init acpi_ac_init(void) static int __init acpi_ac_init(void)
{ {
unsigned int i;
int result; int result;
if (acpi_disabled) if (acpi_disabled)
return -ENODEV; return -ENODEV;
dmi_check_system(ac_dmi_table); if (acpi_quirk_skip_acpi_ac_and_battery())
if (ac_check_pmic) {
for (i = 0; i < ARRAY_SIZE(acpi_ac_blacklist); i++)
if (acpi_dev_present(acpi_ac_blacklist[i].hid, "1",
acpi_ac_blacklist[i].hrv)) {
pr_info("found native %s PMIC, not loading\n",
acpi_ac_blacklist[i].hid);
return -ENODEV; return -ENODEV;
}
} dmi_check_system(ac_dmi_table);
result = acpi_bus_register_driver(&acpi_ac_driver); result = acpi_bus_register_driver(&acpi_ac_driver);
if (result < 0) if (result < 0)
......
...@@ -52,7 +52,6 @@ static bool battery_driver_registered; ...@@ -52,7 +52,6 @@ static bool battery_driver_registered;
static int battery_bix_broken_package; static int battery_bix_broken_package;
static int battery_notification_delay_ms; static int battery_notification_delay_ms;
static int battery_ac_is_broken; static int battery_ac_is_broken;
static int battery_check_pmic = 1;
static unsigned int cache_time = 1000; static unsigned int cache_time = 1000;
module_param(cache_time, uint, 0644); module_param(cache_time, uint, 0644);
MODULE_PARM_DESC(cache_time, "cache time in milliseconds"); MODULE_PARM_DESC(cache_time, "cache time in milliseconds");
...@@ -64,11 +63,6 @@ static const struct acpi_device_id battery_device_ids[] = { ...@@ -64,11 +63,6 @@ static const struct acpi_device_id battery_device_ids[] = {
MODULE_DEVICE_TABLE(acpi, battery_device_ids); MODULE_DEVICE_TABLE(acpi, battery_device_ids);
/* Lists of PMIC ACPI HIDs with an (often better) native battery driver */
static const char * const acpi_battery_blacklist[] = {
"INT33F4", /* X-Powers AXP288 PMIC */
};
enum { enum {
ACPI_BATTERY_ALARM_PRESENT, ACPI_BATTERY_ALARM_PRESENT,
ACPI_BATTERY_XINFO_PRESENT, ACPI_BATTERY_XINFO_PRESENT,
...@@ -1104,13 +1098,6 @@ battery_ac_is_broken_quirk(const struct dmi_system_id *d) ...@@ -1104,13 +1098,6 @@ battery_ac_is_broken_quirk(const struct dmi_system_id *d)
return 0; return 0;
} }
static int __init
battery_do_not_check_pmic_quirk(const struct dmi_system_id *d)
{
battery_check_pmic = 0;
return 0;
}
static const struct dmi_system_id bat_dmi_table[] __initconst = { static const struct dmi_system_id bat_dmi_table[] __initconst = {
{ {
/* NEC LZ750/LS */ /* NEC LZ750/LS */
...@@ -1139,22 +1126,6 @@ static const struct dmi_system_id bat_dmi_table[] __initconst = { ...@@ -1139,22 +1126,6 @@ static const struct dmi_system_id bat_dmi_table[] __initconst = {
DMI_MATCH(DMI_BIOS_DATE, "08/22/2014"), DMI_MATCH(DMI_BIOS_DATE, "08/22/2014"),
}, },
}, },
{
/* ECS EF20EA, AXP288 PMIC but uses separate fuel-gauge */
.callback = battery_do_not_check_pmic_quirk,
.matches = {
DMI_MATCH(DMI_PRODUCT_NAME, "EF20EA"),
},
},
{
/* Lenovo Ideapad Miix 320, AXP288 PMIC, separate fuel-gauge */
.callback = battery_do_not_check_pmic_quirk,
.matches = {
DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
DMI_MATCH(DMI_PRODUCT_NAME, "80XF"),
DMI_MATCH(DMI_PRODUCT_VERSION, "Lenovo MIIX 320-10ICR"),
},
},
{}, {},
}; };
...@@ -1279,19 +1250,12 @@ static struct acpi_driver acpi_battery_driver = { ...@@ -1279,19 +1250,12 @@ static struct acpi_driver acpi_battery_driver = {
static void __init acpi_battery_init_async(void *unused, async_cookie_t cookie) static void __init acpi_battery_init_async(void *unused, async_cookie_t cookie)
{ {
unsigned int i;
int result; int result;
dmi_check_system(bat_dmi_table); if (acpi_quirk_skip_acpi_ac_and_battery())
if (battery_check_pmic) {
for (i = 0; i < ARRAY_SIZE(acpi_battery_blacklist); i++)
if (acpi_dev_present(acpi_battery_blacklist[i], "1", -1)) {
pr_info("found native %s PMIC, not loading\n",
acpi_battery_blacklist[i]);
return; return;
}
} dmi_check_system(bat_dmi_table);
result = acpi_bus_register_driver(&acpi_battery_driver); result = acpi_bus_register_driver(&acpi_battery_driver);
battery_driver_registered = (result == 0); battery_driver_registered = (result == 0);
......
...@@ -98,8 +98,8 @@ int acpi_bus_get_status(struct acpi_device *device) ...@@ -98,8 +98,8 @@ int acpi_bus_get_status(struct acpi_device *device)
acpi_status status; acpi_status status;
unsigned long long sta; unsigned long long sta;
if (acpi_device_always_present(device)) { if (acpi_device_override_status(device, &sta)) {
acpi_set_device_status(device, ACPI_STA_DEFAULT); acpi_set_device_status(device, sta);
return 0; return 0;
} }
......
...@@ -46,7 +46,7 @@ static int pch_fivr_read(acpi_handle handle, char *method, struct pch_fivr_resp ...@@ -46,7 +46,7 @@ static int pch_fivr_read(acpi_handle handle, char *method, struct pch_fivr_resp
} }
/* /*
* Presentation of attributes which are defined for INT1045 * Presentation of attributes which are defined for INTC10xx
* They are: * They are:
* freq_mhz_low_clock : Set PCH FIVR switching freq for * freq_mhz_low_clock : Set PCH FIVR switching freq for
* FIVR clock 19.2MHz and 24MHz * FIVR clock 19.2MHz and 24MHz
......
...@@ -25,7 +25,7 @@ struct intel_pmic_opregion { ...@@ -25,7 +25,7 @@ struct intel_pmic_opregion {
struct mutex lock; struct mutex lock;
struct acpi_lpat_conversion_table *lpat_table; struct acpi_lpat_conversion_table *lpat_table;
struct regmap *regmap; struct regmap *regmap;
struct intel_pmic_opregion_data *data; const struct intel_pmic_opregion_data *data;
struct intel_pmic_regs_handler_ctx ctx; struct intel_pmic_regs_handler_ctx ctx;
}; };
...@@ -53,7 +53,7 @@ static acpi_status intel_pmic_power_handler(u32 function, ...@@ -53,7 +53,7 @@ static acpi_status intel_pmic_power_handler(u32 function,
{ {
struct intel_pmic_opregion *opregion = region_context; struct intel_pmic_opregion *opregion = region_context;
struct regmap *regmap = opregion->regmap; struct regmap *regmap = opregion->regmap;
struct intel_pmic_opregion_data *d = opregion->data; const struct intel_pmic_opregion_data *d = opregion->data;
int reg, bit, result; int reg, bit, result;
if (bits != 32 || !value64) if (bits != 32 || !value64)
...@@ -95,7 +95,7 @@ static int pmic_read_temp(struct intel_pmic_opregion *opregion, ...@@ -95,7 +95,7 @@ static int pmic_read_temp(struct intel_pmic_opregion *opregion,
return 0; return 0;
} }
temp = acpi_lpat_raw_to_temp(opregion->lpat_table, raw_temp); temp = opregion->data->lpat_raw_to_temp(opregion->lpat_table, raw_temp);
if (temp < 0) if (temp < 0)
return temp; return temp;
...@@ -135,7 +135,7 @@ static int pmic_thermal_aux(struct intel_pmic_opregion *opregion, int reg, ...@@ -135,7 +135,7 @@ static int pmic_thermal_aux(struct intel_pmic_opregion *opregion, int reg,
static int pmic_thermal_pen(struct intel_pmic_opregion *opregion, int reg, static int pmic_thermal_pen(struct intel_pmic_opregion *opregion, int reg,
int bit, u32 function, u64 *value) int bit, u32 function, u64 *value)
{ {
struct intel_pmic_opregion_data *d = opregion->data; const struct intel_pmic_opregion_data *d = opregion->data;
struct regmap *regmap = opregion->regmap; struct regmap *regmap = opregion->regmap;
if (!d->get_policy || !d->update_policy) if (!d->get_policy || !d->update_policy)
...@@ -171,7 +171,7 @@ static acpi_status intel_pmic_thermal_handler(u32 function, ...@@ -171,7 +171,7 @@ static acpi_status intel_pmic_thermal_handler(u32 function,
void *handler_context, void *region_context) void *handler_context, void *region_context)
{ {
struct intel_pmic_opregion *opregion = region_context; struct intel_pmic_opregion *opregion = region_context;
struct intel_pmic_opregion_data *d = opregion->data; const struct intel_pmic_opregion_data *d = opregion->data;
int reg, bit, result; int reg, bit, result;
if (bits != 32 || !value64) if (bits != 32 || !value64)
...@@ -255,7 +255,7 @@ static acpi_status intel_pmic_regs_handler(u32 function, ...@@ -255,7 +255,7 @@ static acpi_status intel_pmic_regs_handler(u32 function,
int intel_pmic_install_opregion_handler(struct device *dev, acpi_handle handle, int intel_pmic_install_opregion_handler(struct device *dev, acpi_handle handle,
struct regmap *regmap, struct regmap *regmap,
struct intel_pmic_opregion_data *d) const struct intel_pmic_opregion_data *d)
{ {
acpi_status status = AE_OK; acpi_status status = AE_OK;
struct intel_pmic_opregion *opregion; struct intel_pmic_opregion *opregion;
...@@ -344,7 +344,7 @@ EXPORT_SYMBOL_GPL(intel_pmic_install_opregion_handler); ...@@ -344,7 +344,7 @@ EXPORT_SYMBOL_GPL(intel_pmic_install_opregion_handler);
int intel_soc_pmic_exec_mipi_pmic_seq_element(u16 i2c_address, u32 reg_address, int intel_soc_pmic_exec_mipi_pmic_seq_element(u16 i2c_address, u32 reg_address,
u32 value, u32 mask) u32 value, u32 mask)
{ {
struct intel_pmic_opregion_data *d; const struct intel_pmic_opregion_data *d;
int ret; int ret;
if (!intel_pmic_opregion) { if (!intel_pmic_opregion) {
......
...@@ -2,6 +2,8 @@ ...@@ -2,6 +2,8 @@
#ifndef __INTEL_PMIC_H #ifndef __INTEL_PMIC_H
#define __INTEL_PMIC_H #define __INTEL_PMIC_H
#include <acpi/acpi_lpat.h>
struct pmic_table { struct pmic_table {
int address; /* operation region address */ int address; /* operation region address */
int reg; /* corresponding thermal register */ int reg; /* corresponding thermal register */
...@@ -17,6 +19,8 @@ struct intel_pmic_opregion_data { ...@@ -17,6 +19,8 @@ struct intel_pmic_opregion_data {
int (*update_policy)(struct regmap *r, int reg, int bit, int enable); int (*update_policy)(struct regmap *r, int reg, int bit, int enable);
int (*exec_mipi_pmic_seq_element)(struct regmap *r, u16 i2c_address, int (*exec_mipi_pmic_seq_element)(struct regmap *r, u16 i2c_address,
u32 reg_address, u32 value, u32 mask); u32 reg_address, u32 value, u32 mask);
int (*lpat_raw_to_temp)(struct acpi_lpat_conversion_table *lpat_table,
int raw);
struct pmic_table *power_table; struct pmic_table *power_table;
int power_table_count; int power_table_count;
struct pmic_table *thermal_table; struct pmic_table *thermal_table;
...@@ -25,6 +29,8 @@ struct intel_pmic_opregion_data { ...@@ -25,6 +29,8 @@ struct intel_pmic_opregion_data {
int pmic_i2c_address; int pmic_i2c_address;
}; };
int intel_pmic_install_opregion_handler(struct device *dev, acpi_handle handle, struct regmap *regmap, struct intel_pmic_opregion_data *d); int intel_pmic_install_opregion_handler(struct device *dev, acpi_handle handle,
struct regmap *regmap,
const struct intel_pmic_opregion_data *d);
#endif #endif
...@@ -369,13 +369,14 @@ intel_bxtwc_pmic_update_policy(struct regmap *regmap, ...@@ -369,13 +369,14 @@ intel_bxtwc_pmic_update_policy(struct regmap *regmap,
return regmap_update_bits(regmap, reg, mask, val); return regmap_update_bits(regmap, reg, mask, val);
} }
static struct intel_pmic_opregion_data intel_bxtwc_pmic_opregion_data = { static const struct intel_pmic_opregion_data intel_bxtwc_pmic_opregion_data = {
.get_power = intel_bxtwc_pmic_get_power, .get_power = intel_bxtwc_pmic_get_power,
.update_power = intel_bxtwc_pmic_update_power, .update_power = intel_bxtwc_pmic_update_power,
.get_raw_temp = intel_bxtwc_pmic_get_raw_temp, .get_raw_temp = intel_bxtwc_pmic_get_raw_temp,
.update_aux = intel_bxtwc_pmic_update_aux, .update_aux = intel_bxtwc_pmic_update_aux,
.get_policy = intel_bxtwc_pmic_get_policy, .get_policy = intel_bxtwc_pmic_get_policy,
.update_policy = intel_bxtwc_pmic_update_policy, .update_policy = intel_bxtwc_pmic_update_policy,
.lpat_raw_to_temp = acpi_lpat_raw_to_temp,
.power_table = power_table, .power_table = power_table,
.power_table_count = ARRAY_SIZE(power_table), .power_table_count = ARRAY_SIZE(power_table),
.thermal_table = thermal_table, .thermal_table = thermal_table,
......
...@@ -271,13 +271,14 @@ static int intel_crc_pmic_update_policy(struct regmap *regmap, ...@@ -271,13 +271,14 @@ static int intel_crc_pmic_update_policy(struct regmap *regmap,
return 0; return 0;
} }
static struct intel_pmic_opregion_data intel_crc_pmic_opregion_data = { static const struct intel_pmic_opregion_data intel_crc_pmic_opregion_data = {
.get_power = intel_crc_pmic_get_power, .get_power = intel_crc_pmic_get_power,
.update_power = intel_crc_pmic_update_power, .update_power = intel_crc_pmic_update_power,
.get_raw_temp = intel_crc_pmic_get_raw_temp, .get_raw_temp = intel_crc_pmic_get_raw_temp,
.update_aux = intel_crc_pmic_update_aux, .update_aux = intel_crc_pmic_update_aux,
.get_policy = intel_crc_pmic_get_policy, .get_policy = intel_crc_pmic_get_policy,
.update_policy = intel_crc_pmic_update_policy, .update_policy = intel_crc_pmic_update_policy,
.lpat_raw_to_temp = acpi_lpat_raw_to_temp,
.power_table = power_table, .power_table = power_table,
.power_table_count= ARRAY_SIZE(power_table), .power_table_count= ARRAY_SIZE(power_table),
.thermal_table = thermal_table, .thermal_table = thermal_table,
......
...@@ -23,7 +23,8 @@ ...@@ -23,7 +23,8 @@
* intel_soc_pmic_exec_mipi_pmic_seq_element work on devices with a * intel_soc_pmic_exec_mipi_pmic_seq_element work on devices with a
* CHT Crystal Cove PMIC. * CHT Crystal Cove PMIC.
*/ */
static struct intel_pmic_opregion_data intel_chtcrc_pmic_opregion_data = { static const struct intel_pmic_opregion_data intel_chtcrc_pmic_opregion_data = {
.lpat_raw_to_temp = acpi_lpat_raw_to_temp,
.pmic_i2c_address = 0x6e, .pmic_i2c_address = 0x6e,
}; };
......
...@@ -94,10 +94,11 @@ static int chtdc_ti_pmic_get_raw_temp(struct regmap *regmap, int reg) ...@@ -94,10 +94,11 @@ static int chtdc_ti_pmic_get_raw_temp(struct regmap *regmap, int reg)
return ((buf[0] & 0x03) << 8) | buf[1]; return ((buf[0] & 0x03) << 8) | buf[1];
} }
static struct intel_pmic_opregion_data chtdc_ti_pmic_opregion_data = { static const struct intel_pmic_opregion_data chtdc_ti_pmic_opregion_data = {
.get_power = chtdc_ti_pmic_get_power, .get_power = chtdc_ti_pmic_get_power,
.update_power = chtdc_ti_pmic_update_power, .update_power = chtdc_ti_pmic_update_power,
.get_raw_temp = chtdc_ti_pmic_get_raw_temp, .get_raw_temp = chtdc_ti_pmic_get_raw_temp,
.lpat_raw_to_temp = acpi_lpat_raw_to_temp,
.power_table = chtdc_ti_power_table, .power_table = chtdc_ti_power_table,
.power_table_count = ARRAY_SIZE(chtdc_ti_power_table), .power_table_count = ARRAY_SIZE(chtdc_ti_power_table),
.thermal_table = chtdc_ti_thermal_table, .thermal_table = chtdc_ti_thermal_table,
......
...@@ -253,10 +253,11 @@ static int intel_cht_wc_exec_mipi_pmic_seq_element(struct regmap *regmap, ...@@ -253,10 +253,11 @@ static int intel_cht_wc_exec_mipi_pmic_seq_element(struct regmap *regmap,
* The thermal table and ops are empty, we do not support the Thermal opregion * The thermal table and ops are empty, we do not support the Thermal opregion
* (DPTF) due to lacking documentation. * (DPTF) due to lacking documentation.
*/ */
static struct intel_pmic_opregion_data intel_cht_wc_pmic_opregion_data = { static const struct intel_pmic_opregion_data intel_cht_wc_pmic_opregion_data = {
.get_power = intel_cht_wc_pmic_get_power, .get_power = intel_cht_wc_pmic_get_power,
.update_power = intel_cht_wc_pmic_update_power, .update_power = intel_cht_wc_pmic_update_power,
.exec_mipi_pmic_seq_element = intel_cht_wc_exec_mipi_pmic_seq_element, .exec_mipi_pmic_seq_element = intel_cht_wc_exec_mipi_pmic_seq_element,
.lpat_raw_to_temp = acpi_lpat_raw_to_temp,
.power_table = power_table, .power_table = power_table,
.power_table_count = ARRAY_SIZE(power_table), .power_table_count = ARRAY_SIZE(power_table),
}; };
......
...@@ -293,11 +293,33 @@ static int intel_xpower_exec_mipi_pmic_seq_element(struct regmap *regmap, ...@@ -293,11 +293,33 @@ static int intel_xpower_exec_mipi_pmic_seq_element(struct regmap *regmap,
return ret; return ret;
} }
static struct intel_pmic_opregion_data intel_xpower_pmic_opregion_data = { static int intel_xpower_lpat_raw_to_temp(struct acpi_lpat_conversion_table *lpat_table,
int raw)
{
struct acpi_lpat first = lpat_table->lpat[0];
struct acpi_lpat last = lpat_table->lpat[lpat_table->lpat_count - 1];
/*
* Some LPAT tables in the ACPI Device for the AXP288 PMIC for some
* reason only describe a small temperature range, e.g. 27° - 37°
* Celcius. Resulting in errors when the tablet is idle in a cool room.
*
* To avoid these errors clamp the raw value to be inside the LPAT.
*/
if (first.raw < last.raw)
raw = clamp(raw, first.raw, last.raw);
else
raw = clamp(raw, last.raw, first.raw);
return acpi_lpat_raw_to_temp(lpat_table, raw);
}
static const struct intel_pmic_opregion_data intel_xpower_pmic_opregion_data = {
.get_power = intel_xpower_pmic_get_power, .get_power = intel_xpower_pmic_get_power,
.update_power = intel_xpower_pmic_update_power, .update_power = intel_xpower_pmic_update_power,
.get_raw_temp = intel_xpower_pmic_get_raw_temp, .get_raw_temp = intel_xpower_pmic_get_raw_temp,
.exec_mipi_pmic_seq_element = intel_xpower_exec_mipi_pmic_seq_element, .exec_mipi_pmic_seq_element = intel_xpower_exec_mipi_pmic_seq_element,
.lpat_raw_to_temp = intel_xpower_lpat_raw_to_temp,
.power_table = power_table, .power_table = power_table,
.power_table_count = ARRAY_SIZE(power_table), .power_table_count = ARRAY_SIZE(power_table),
.thermal_table = thermal_table, .thermal_table = thermal_table,
......
This diff is collapsed.
...@@ -31,10 +31,8 @@ ...@@ -31,10 +31,8 @@
#include <linux/mmc/slot-gpio.h> #include <linux/mmc/slot-gpio.h>
#ifdef CONFIG_X86 #ifdef CONFIG_X86
#include <asm/cpu_device_id.h> #include <linux/platform_data/x86/soc.h>
#include <asm/intel-family.h>
#include <asm/iosf_mbi.h> #include <asm/iosf_mbi.h>
#include <linux/pci.h>
#endif #endif
#include "sdhci.h" #include "sdhci.h"
...@@ -240,26 +238,6 @@ static const struct sdhci_acpi_chip sdhci_acpi_chip_int = { ...@@ -240,26 +238,6 @@ static const struct sdhci_acpi_chip sdhci_acpi_chip_int = {
#ifdef CONFIG_X86 #ifdef CONFIG_X86
static bool sdhci_acpi_byt(void)
{
static const struct x86_cpu_id byt[] = {
X86_MATCH_INTEL_FAM6_MODEL(ATOM_SILVERMONT, NULL),
{}
};
return x86_match_cpu(byt);
}
static bool sdhci_acpi_cht(void)
{
static const struct x86_cpu_id cht[] = {
X86_MATCH_INTEL_FAM6_MODEL(ATOM_AIRMONT, NULL),
{}
};
return x86_match_cpu(cht);
}
#define BYT_IOSF_SCCEP 0x63 #define BYT_IOSF_SCCEP 0x63
#define BYT_IOSF_OCP_NETCTRL0 0x1078 #define BYT_IOSF_OCP_NETCTRL0 0x1078
#define BYT_IOSF_OCP_TIMEOUT_BASE GENMASK(10, 8) #define BYT_IOSF_OCP_TIMEOUT_BASE GENMASK(10, 8)
...@@ -268,7 +246,7 @@ static void sdhci_acpi_byt_setting(struct device *dev) ...@@ -268,7 +246,7 @@ static void sdhci_acpi_byt_setting(struct device *dev)
{ {
u32 val = 0; u32 val = 0;
if (!sdhci_acpi_byt()) if (!soc_intel_is_byt())
return; return;
if (iosf_mbi_read(BYT_IOSF_SCCEP, MBI_CR_READ, BYT_IOSF_OCP_NETCTRL0, if (iosf_mbi_read(BYT_IOSF_SCCEP, MBI_CR_READ, BYT_IOSF_OCP_NETCTRL0,
...@@ -293,7 +271,7 @@ static void sdhci_acpi_byt_setting(struct device *dev) ...@@ -293,7 +271,7 @@ static void sdhci_acpi_byt_setting(struct device *dev)
static bool sdhci_acpi_byt_defer(struct device *dev) static bool sdhci_acpi_byt_defer(struct device *dev)
{ {
if (!sdhci_acpi_byt()) if (!soc_intel_is_byt())
return false; return false;
if (!iosf_mbi_available()) if (!iosf_mbi_available())
...@@ -304,43 +282,6 @@ static bool sdhci_acpi_byt_defer(struct device *dev) ...@@ -304,43 +282,6 @@ static bool sdhci_acpi_byt_defer(struct device *dev)
return false; return false;
} }
static bool sdhci_acpi_cht_pci_wifi(unsigned int vendor, unsigned int device,
unsigned int slot, unsigned int parent_slot)
{
struct pci_dev *dev, *parent, *from = NULL;
while (1) {
dev = pci_get_device(vendor, device, from);
pci_dev_put(from);
if (!dev)
break;
parent = pci_upstream_bridge(dev);
if (ACPI_COMPANION(&dev->dev) && PCI_SLOT(dev->devfn) == slot &&
parent && PCI_SLOT(parent->devfn) == parent_slot &&
!pci_upstream_bridge(parent)) {
pci_dev_put(dev);
return true;
}
from = dev;
}
return false;
}
/*
* GPDwin uses PCI wifi which conflicts with SDIO's use of
* acpi_device_fix_up_power() on child device nodes. Identifying GPDwin is
* problematic, but since SDIO is only used for wifi, the presence of the PCI
* wifi card in the expected slot with an ACPI companion node, is used to
* indicate that acpi_device_fix_up_power() should be avoided.
*/
static inline bool sdhci_acpi_no_fixup_child_power(struct acpi_device *adev)
{
return sdhci_acpi_cht() &&
acpi_dev_hid_uid_match(adev, "80860F14", "2") &&
sdhci_acpi_cht_pci_wifi(0x14e4, 0x43ec, 0, 28);
}
#else #else
static inline void sdhci_acpi_byt_setting(struct device *dev) static inline void sdhci_acpi_byt_setting(struct device *dev)
...@@ -352,11 +293,6 @@ static inline bool sdhci_acpi_byt_defer(struct device *dev) ...@@ -352,11 +293,6 @@ static inline bool sdhci_acpi_byt_defer(struct device *dev)
return false; return false;
} }
static inline bool sdhci_acpi_no_fixup_child_power(struct acpi_device *adev)
{
return false;
}
#endif #endif
static int bxt_get_cd(struct mmc_host *mmc) static int bxt_get_cd(struct mmc_host *mmc)
...@@ -861,11 +797,9 @@ static int sdhci_acpi_probe(struct platform_device *pdev) ...@@ -861,11 +797,9 @@ static int sdhci_acpi_probe(struct platform_device *pdev)
/* Power on the SDHCI controller and its children */ /* Power on the SDHCI controller and its children */
acpi_device_fix_up_power(device); acpi_device_fix_up_power(device);
if (!sdhci_acpi_no_fixup_child_power(device)) {
list_for_each_entry(child, &device->children, node) list_for_each_entry(child, &device->children, node)
if (child->status.present && child->status.enabled) if (child->status.present && child->status.enabled)
acpi_device_fix_up_power(child); acpi_device_fix_up_power(child);
}
if (sdhci_acpi_byt_defer(dev)) if (sdhci_acpi_byt_defer(dev))
return -EPROBE_DEFER; return -EPROBE_DEFER;
......
...@@ -614,9 +614,15 @@ int acpi_enable_wakeup_device_power(struct acpi_device *dev, int state); ...@@ -614,9 +614,15 @@ int acpi_enable_wakeup_device_power(struct acpi_device *dev, int state);
int acpi_disable_wakeup_device_power(struct acpi_device *dev); int acpi_disable_wakeup_device_power(struct acpi_device *dev);
#ifdef CONFIG_X86 #ifdef CONFIG_X86
bool acpi_device_always_present(struct acpi_device *adev); bool acpi_device_override_status(struct acpi_device *adev, unsigned long long *status);
bool acpi_quirk_skip_acpi_ac_and_battery(void);
#else #else
static inline bool acpi_device_always_present(struct acpi_device *adev) static inline bool acpi_device_override_status(struct acpi_device *adev,
unsigned long long *status)
{
return false;
}
static inline bool acpi_quirk_skip_acpi_ac_and_battery(void)
{ {
return false; return false;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment