Skip to content

Commit af8fefd

Browse files
committed
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
4 parents 5847d2d + 1b15b69 + 5f96ba5 + 75f32fa commit af8fefd

File tree

15 files changed

+234
-214
lines changed

15 files changed

+234
-214
lines changed

drivers/acpi/ac.c

Lines changed: 3 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -48,19 +48,12 @@ static const struct acpi_device_id ac_device_ids[] = {
4848
};
4949
MODULE_DEVICE_TABLE(acpi, ac_device_ids);
5050

51-
/* Lists of PMIC ACPI HIDs with an (often better) native charger driver */
52-
static const struct acpi_ac_bl acpi_ac_blacklist[] = {
53-
{ "INT33F4", -1 }, /* X-Powers AXP288 PMIC */
54-
{ "INT34D3", 3 }, /* Intel Cherrytrail Whiskey Cove PMIC */
55-
};
56-
5751
#ifdef CONFIG_PM_SLEEP
5852
static int acpi_ac_resume(struct device *dev);
5953
#endif
6054
static SIMPLE_DEV_PM_OPS(acpi_ac_pm, NULL, acpi_ac_resume);
6155

6256
static int ac_sleep_before_get_state_ms;
63-
static int ac_check_pmic = 1;
6457
static int ac_only;
6558

6659
static struct acpi_driver acpi_ac_driver = {
@@ -200,12 +193,6 @@ static int __init thinkpad_e530_quirk(const struct dmi_system_id *d)
200193
return 0;
201194
}
202195

203-
static int __init ac_do_not_check_pmic_quirk(const struct dmi_system_id *d)
204-
{
205-
ac_check_pmic = 0;
206-
return 0;
207-
}
208-
209196
static int __init ac_only_quirk(const struct dmi_system_id *d)
210197
{
211198
ac_only = 1;
@@ -214,29 +201,13 @@ static int __init ac_only_quirk(const struct dmi_system_id *d)
214201

215202
/* Please keep this list alphabetically sorted */
216203
static const struct dmi_system_id ac_dmi_table[] __initconst = {
217-
{
218-
/* ECS EF20EA, AXP288 PMIC but uses separate fuel-gauge */
219-
.callback = ac_do_not_check_pmic_quirk,
220-
.matches = {
221-
DMI_MATCH(DMI_PRODUCT_NAME, "EF20EA"),
222-
},
223-
},
224204
{
225205
/* Kodlix GK45 returning incorrect state */
226206
.callback = ac_only_quirk,
227207
.matches = {
228208
DMI_MATCH(DMI_PRODUCT_NAME, "GK45"),
229209
},
230210
},
231-
{
232-
/* Lenovo Ideapad Miix 320, AXP288 PMIC, separate fuel-gauge */
233-
.callback = ac_do_not_check_pmic_quirk,
234-
.matches = {
235-
DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
236-
DMI_MATCH(DMI_PRODUCT_NAME, "80XF"),
237-
DMI_MATCH(DMI_PRODUCT_VERSION, "Lenovo MIIX 320-10ICR"),
238-
},
239-
},
240211
{
241212
/* Lenovo Thinkpad e530, see comment in acpi_ac_notify() */
242213
.callback = thinkpad_e530_quirk,
@@ -341,23 +312,15 @@ static int acpi_ac_remove(struct acpi_device *device)
341312

342313
static int __init acpi_ac_init(void)
343314
{
344-
unsigned int i;
345315
int result;
346316

347317
if (acpi_disabled)
348318
return -ENODEV;
349319

350-
dmi_check_system(ac_dmi_table);
320+
if (acpi_quirk_skip_acpi_ac_and_battery())
321+
return -ENODEV;
351322

352-
if (ac_check_pmic) {
353-
for (i = 0; i < ARRAY_SIZE(acpi_ac_blacklist); i++)
354-
if (acpi_dev_present(acpi_ac_blacklist[i].hid, "1",
355-
acpi_ac_blacklist[i].hrv)) {
356-
pr_info("found native %s PMIC, not loading\n",
357-
acpi_ac_blacklist[i].hid);
358-
return -ENODEV;
359-
}
360-
}
323+
dmi_check_system(ac_dmi_table);
361324

362325
result = acpi_bus_register_driver(&acpi_ac_driver);
363326
if (result < 0)

drivers/acpi/battery.c

Lines changed: 3 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@ static bool battery_driver_registered;
5252
static int battery_bix_broken_package;
5353
static int battery_notification_delay_ms;
5454
static int battery_ac_is_broken;
55-
static int battery_check_pmic = 1;
5655
static unsigned int cache_time = 1000;
5756
module_param(cache_time, uint, 0644);
5857
MODULE_PARM_DESC(cache_time, "cache time in milliseconds");
@@ -64,11 +63,6 @@ static const struct acpi_device_id battery_device_ids[] = {
6463

6564
MODULE_DEVICE_TABLE(acpi, battery_device_ids);
6665

67-
/* Lists of PMIC ACPI HIDs with an (often better) native battery driver */
68-
static const char * const acpi_battery_blacklist[] = {
69-
"INT33F4", /* X-Powers AXP288 PMIC */
70-
};
71-
7266
enum {
7367
ACPI_BATTERY_ALARM_PRESENT,
7468
ACPI_BATTERY_XINFO_PRESENT,
@@ -1104,13 +1098,6 @@ battery_ac_is_broken_quirk(const struct dmi_system_id *d)
11041098
return 0;
11051099
}
11061100

1107-
static int __init
1108-
battery_do_not_check_pmic_quirk(const struct dmi_system_id *d)
1109-
{
1110-
battery_check_pmic = 0;
1111-
return 0;
1112-
}
1113-
11141101
static const struct dmi_system_id bat_dmi_table[] __initconst = {
11151102
{
11161103
/* NEC LZ750/LS */
@@ -1139,22 +1126,6 @@ static const struct dmi_system_id bat_dmi_table[] __initconst = {
11391126
DMI_MATCH(DMI_BIOS_DATE, "08/22/2014"),
11401127
},
11411128
},
1142-
{
1143-
/* ECS EF20EA, AXP288 PMIC but uses separate fuel-gauge */
1144-
.callback = battery_do_not_check_pmic_quirk,
1145-
.matches = {
1146-
DMI_MATCH(DMI_PRODUCT_NAME, "EF20EA"),
1147-
},
1148-
},
1149-
{
1150-
/* Lenovo Ideapad Miix 320, AXP288 PMIC, separate fuel-gauge */
1151-
.callback = battery_do_not_check_pmic_quirk,
1152-
.matches = {
1153-
DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
1154-
DMI_MATCH(DMI_PRODUCT_NAME, "80XF"),
1155-
DMI_MATCH(DMI_PRODUCT_VERSION, "Lenovo MIIX 320-10ICR"),
1156-
},
1157-
},
11581129
{},
11591130
};
11601131

@@ -1279,19 +1250,12 @@ static struct acpi_driver acpi_battery_driver = {
12791250

12801251
static void __init acpi_battery_init_async(void *unused, async_cookie_t cookie)
12811252
{
1282-
unsigned int i;
12831253
int result;
12841254

1285-
dmi_check_system(bat_dmi_table);
1255+
if (acpi_quirk_skip_acpi_ac_and_battery())
1256+
return;
12861257

1287-
if (battery_check_pmic) {
1288-
for (i = 0; i < ARRAY_SIZE(acpi_battery_blacklist); i++)
1289-
if (acpi_dev_present(acpi_battery_blacklist[i], "1", -1)) {
1290-
pr_info("found native %s PMIC, not loading\n",
1291-
acpi_battery_blacklist[i]);
1292-
return;
1293-
}
1294-
}
1258+
dmi_check_system(bat_dmi_table);
12951259

12961260
result = acpi_bus_register_driver(&acpi_battery_driver);
12971261
battery_driver_registered = (result == 0);

drivers/acpi/bus.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,8 +98,8 @@ int acpi_bus_get_status(struct acpi_device *device)
9898
acpi_status status;
9999
unsigned long long sta;
100100

101-
if (acpi_device_always_present(device)) {
102-
acpi_set_device_status(device, ACPI_STA_DEFAULT);
101+
if (acpi_device_override_status(device, &sta)) {
102+
acpi_set_device_status(device, sta);
103103
return 0;
104104
}
105105

drivers/acpi/dptf/dptf_pch_fivr.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ static int pch_fivr_read(acpi_handle handle, char *method, struct pch_fivr_resp
4646
}
4747

4848
/*
49-
* Presentation of attributes which are defined for INT1045
49+
* Presentation of attributes which are defined for INTC10xx
5050
* They are:
5151
* freq_mhz_low_clock : Set PCH FIVR switching freq for
5252
* FIVR clock 19.2MHz and 24MHz

drivers/acpi/pmic/intel_pmic.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ struct intel_pmic_opregion {
2525
struct mutex lock;
2626
struct acpi_lpat_conversion_table *lpat_table;
2727
struct regmap *regmap;
28-
struct intel_pmic_opregion_data *data;
28+
const struct intel_pmic_opregion_data *data;
2929
struct intel_pmic_regs_handler_ctx ctx;
3030
};
3131

@@ -53,7 +53,7 @@ static acpi_status intel_pmic_power_handler(u32 function,
5353
{
5454
struct intel_pmic_opregion *opregion = region_context;
5555
struct regmap *regmap = opregion->regmap;
56-
struct intel_pmic_opregion_data *d = opregion->data;
56+
const struct intel_pmic_opregion_data *d = opregion->data;
5757
int reg, bit, result;
5858

5959
if (bits != 32 || !value64)
@@ -95,7 +95,7 @@ static int pmic_read_temp(struct intel_pmic_opregion *opregion,
9595
return 0;
9696
}
9797

98-
temp = acpi_lpat_raw_to_temp(opregion->lpat_table, raw_temp);
98+
temp = opregion->data->lpat_raw_to_temp(opregion->lpat_table, raw_temp);
9999
if (temp < 0)
100100
return temp;
101101

@@ -135,7 +135,7 @@ static int pmic_thermal_aux(struct intel_pmic_opregion *opregion, int reg,
135135
static int pmic_thermal_pen(struct intel_pmic_opregion *opregion, int reg,
136136
int bit, u32 function, u64 *value)
137137
{
138-
struct intel_pmic_opregion_data *d = opregion->data;
138+
const struct intel_pmic_opregion_data *d = opregion->data;
139139
struct regmap *regmap = opregion->regmap;
140140

141141
if (!d->get_policy || !d->update_policy)
@@ -171,7 +171,7 @@ static acpi_status intel_pmic_thermal_handler(u32 function,
171171
void *handler_context, void *region_context)
172172
{
173173
struct intel_pmic_opregion *opregion = region_context;
174-
struct intel_pmic_opregion_data *d = opregion->data;
174+
const struct intel_pmic_opregion_data *d = opregion->data;
175175
int reg, bit, result;
176176

177177
if (bits != 32 || !value64)
@@ -255,7 +255,7 @@ static acpi_status intel_pmic_regs_handler(u32 function,
255255

256256
int intel_pmic_install_opregion_handler(struct device *dev, acpi_handle handle,
257257
struct regmap *regmap,
258-
struct intel_pmic_opregion_data *d)
258+
const struct intel_pmic_opregion_data *d)
259259
{
260260
acpi_status status = AE_OK;
261261
struct intel_pmic_opregion *opregion;
@@ -344,7 +344,7 @@ EXPORT_SYMBOL_GPL(intel_pmic_install_opregion_handler);
344344
int intel_soc_pmic_exec_mipi_pmic_seq_element(u16 i2c_address, u32 reg_address,
345345
u32 value, u32 mask)
346346
{
347-
struct intel_pmic_opregion_data *d;
347+
const struct intel_pmic_opregion_data *d;
348348
int ret;
349349

350350
if (!intel_pmic_opregion) {

drivers/acpi/pmic/intel_pmic.h

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
#ifndef __INTEL_PMIC_H
33
#define __INTEL_PMIC_H
44

5+
#include <acpi/acpi_lpat.h>
6+
57
struct pmic_table {
68
int address; /* operation region address */
79
int reg; /* corresponding thermal register */
@@ -17,6 +19,8 @@ struct intel_pmic_opregion_data {
1719
int (*update_policy)(struct regmap *r, int reg, int bit, int enable);
1820
int (*exec_mipi_pmic_seq_element)(struct regmap *r, u16 i2c_address,
1921
u32 reg_address, u32 value, u32 mask);
22+
int (*lpat_raw_to_temp)(struct acpi_lpat_conversion_table *lpat_table,
23+
int raw);
2024
struct pmic_table *power_table;
2125
int power_table_count;
2226
struct pmic_table *thermal_table;
@@ -25,6 +29,8 @@ struct intel_pmic_opregion_data {
2529
int pmic_i2c_address;
2630
};
2731

28-
int intel_pmic_install_opregion_handler(struct device *dev, acpi_handle handle, struct regmap *regmap, struct intel_pmic_opregion_data *d);
32+
int intel_pmic_install_opregion_handler(struct device *dev, acpi_handle handle,
33+
struct regmap *regmap,
34+
const struct intel_pmic_opregion_data *d);
2935

3036
#endif

drivers/acpi/pmic/intel_pmic_bxtwc.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -369,13 +369,14 @@ intel_bxtwc_pmic_update_policy(struct regmap *regmap,
369369
return regmap_update_bits(regmap, reg, mask, val);
370370
}
371371

372-
static struct intel_pmic_opregion_data intel_bxtwc_pmic_opregion_data = {
372+
static const struct intel_pmic_opregion_data intel_bxtwc_pmic_opregion_data = {
373373
.get_power = intel_bxtwc_pmic_get_power,
374374
.update_power = intel_bxtwc_pmic_update_power,
375375
.get_raw_temp = intel_bxtwc_pmic_get_raw_temp,
376376
.update_aux = intel_bxtwc_pmic_update_aux,
377377
.get_policy = intel_bxtwc_pmic_get_policy,
378378
.update_policy = intel_bxtwc_pmic_update_policy,
379+
.lpat_raw_to_temp = acpi_lpat_raw_to_temp,
379380
.power_table = power_table,
380381
.power_table_count = ARRAY_SIZE(power_table),
381382
.thermal_table = thermal_table,

drivers/acpi/pmic/intel_pmic_bytcrc.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -271,13 +271,14 @@ static int intel_crc_pmic_update_policy(struct regmap *regmap,
271271
return 0;
272272
}
273273

274-
static struct intel_pmic_opregion_data intel_crc_pmic_opregion_data = {
274+
static const struct intel_pmic_opregion_data intel_crc_pmic_opregion_data = {
275275
.get_power = intel_crc_pmic_get_power,
276276
.update_power = intel_crc_pmic_update_power,
277277
.get_raw_temp = intel_crc_pmic_get_raw_temp,
278278
.update_aux = intel_crc_pmic_update_aux,
279279
.get_policy = intel_crc_pmic_get_policy,
280280
.update_policy = intel_crc_pmic_update_policy,
281+
.lpat_raw_to_temp = acpi_lpat_raw_to_temp,
281282
.power_table = power_table,
282283
.power_table_count= ARRAY_SIZE(power_table),
283284
.thermal_table = thermal_table,

drivers/acpi/pmic/intel_pmic_chtcrc.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@
2323
* intel_soc_pmic_exec_mipi_pmic_seq_element work on devices with a
2424
* CHT Crystal Cove PMIC.
2525
*/
26-
static struct intel_pmic_opregion_data intel_chtcrc_pmic_opregion_data = {
26+
static const struct intel_pmic_opregion_data intel_chtcrc_pmic_opregion_data = {
27+
.lpat_raw_to_temp = acpi_lpat_raw_to_temp,
2728
.pmic_i2c_address = 0x6e,
2829
};
2930

drivers/acpi/pmic/intel_pmic_chtdc_ti.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,10 +94,11 @@ static int chtdc_ti_pmic_get_raw_temp(struct regmap *regmap, int reg)
9494
return ((buf[0] & 0x03) << 8) | buf[1];
9595
}
9696

97-
static struct intel_pmic_opregion_data chtdc_ti_pmic_opregion_data = {
97+
static const struct intel_pmic_opregion_data chtdc_ti_pmic_opregion_data = {
9898
.get_power = chtdc_ti_pmic_get_power,
9999
.update_power = chtdc_ti_pmic_update_power,
100100
.get_raw_temp = chtdc_ti_pmic_get_raw_temp,
101+
.lpat_raw_to_temp = acpi_lpat_raw_to_temp,
101102
.power_table = chtdc_ti_power_table,
102103
.power_table_count = ARRAY_SIZE(chtdc_ti_power_table),
103104
.thermal_table = chtdc_ti_thermal_table,

0 commit comments

Comments
 (0)