Skip to content

Commit 1fca7e0

Browse files
committed
Merge branches 'acpi-ec', 'acpi-soc', 'acpi-pmic' and 'acpi-button'
* acpi-ec: ACPI: EC: add support for hardware-reduced systems ACPI: EC: tweak naming in preparation for GpioInt support * acpi-soc: ACPI: LPSS: Add dmi quirk for skipping _DEP check for some device-links ACPI: LPSS: Add LNXVIDEO -> BYT I2C1 to lpss_device_links ACPI: LPSS: Add LNXVIDEO -> BYT I2C7 to lpss_device_links * acpi-pmic: ACPI / PMIC: Add Cherry Trail Crystal Cove PMIC OpRegion driver ACPI / PMIC: Add byt prefix to Crystal Cove PMIC OpRegion driver ACPI / PMIC: Do not register handlers for unhandled OpRegions * acpi-button: ACPI: button: Remove unused acpi_lid_notifier_[un]register() functions ACPI: button: Add DMI quirk for Asus T200TA ACPI: button: Add DMI quirk for Medion Akoya E2215T ACPI: button: Turn lid_blacklst DMI table into a generic quirk table ACPI: button: Allow disabling LID support with the lid_init_state module option ACPI: button: Refactor lid_init_state module parsing code
5 parents 713608a + 406857f + 6025e2f + cefe6aa + e346d0c commit 1fca7e0

File tree

11 files changed

+314
-149
lines changed

11 files changed

+314
-149
lines changed

drivers/acpi/Kconfig

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -513,11 +513,19 @@ menuconfig PMIC_OPREGION
513513
PMIC chip.
514514

515515
if PMIC_OPREGION
516-
config CRC_PMIC_OPREGION
517-
bool "ACPI operation region support for CrystalCove PMIC"
516+
config BYTCRC_PMIC_OPREGION
517+
bool "ACPI operation region support for Bay Trail Crystal Cove PMIC"
518518
depends on INTEL_SOC_PMIC
519519
help
520-
This config adds ACPI operation region support for CrystalCove PMIC.
520+
This config adds ACPI operation region support for the Bay Trail
521+
version of the Crystal Cove PMIC.
522+
523+
config CHTCRC_PMIC_OPREGION
524+
bool "ACPI operation region support for Cherry Trail Crystal Cove PMIC"
525+
depends on INTEL_SOC_PMIC
526+
help
527+
This config adds ACPI operation region support for the Cherry Trail
528+
version of the Crystal Cove PMIC.
521529

522530
config XPOWER_PMIC_OPREGION
523531
bool "ACPI operation region support for XPower AXP288 PMIC"

drivers/acpi/Makefile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,8 @@ obj-$(CONFIG_ACPI_APEI) += apei/
109109
obj-$(CONFIG_ACPI_EXTLOG) += acpi_extlog.o
110110

111111
obj-$(CONFIG_PMIC_OPREGION) += pmic/intel_pmic.o
112-
obj-$(CONFIG_CRC_PMIC_OPREGION) += pmic/intel_pmic_crc.o
112+
obj-$(CONFIG_BYTCRC_PMIC_OPREGION) += pmic/intel_pmic_bytcrc.o
113+
obj-$(CONFIG_CHTCRC_PMIC_OPREGION) += pmic/intel_pmic_chtcrc.o
113114
obj-$(CONFIG_XPOWER_PMIC_OPREGION) += pmic/intel_pmic_xpower.o
114115
obj-$(CONFIG_BXT_WC_PMIC_OPREGION) += pmic/intel_pmic_bxtwc.o
115116
obj-$(CONFIG_CHT_WC_PMIC_OPREGION) += pmic/intel_pmic_chtwc.o

drivers/acpi/acpi_lpss.c

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
#include <linux/acpi.h>
1111
#include <linux/clkdev.h>
1212
#include <linux/clk-provider.h>
13+
#include <linux/dmi.h>
1314
#include <linux/err.h>
1415
#include <linux/io.h>
1516
#include <linux/mutex.h>
@@ -463,6 +464,18 @@ struct lpss_device_links {
463464
const char *consumer_hid;
464465
const char *consumer_uid;
465466
u32 flags;
467+
const struct dmi_system_id *dep_missing_ids;
468+
};
469+
470+
/* Please keep this list sorted alphabetically by vendor and model */
471+
static const struct dmi_system_id i2c1_dep_missing_dmi_ids[] = {
472+
{
473+
.matches = {
474+
DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
475+
DMI_MATCH(DMI_PRODUCT_NAME, "T200TA"),
476+
},
477+
},
478+
{}
466479
};
467480

468481
/*
@@ -473,9 +486,17 @@ struct lpss_device_links {
473486
* the supplier is not enumerated until after the consumer is probed.
474487
*/
475488
static const struct lpss_device_links lpss_device_links[] = {
489+
/* CHT External sdcard slot controller depends on PMIC I2C ctrl */
476490
{"808622C1", "7", "80860F14", "3", DL_FLAG_PM_RUNTIME},
491+
/* CHT iGPU depends on PMIC I2C controller */
477492
{"808622C1", "7", "LNXVIDEO", NULL, DL_FLAG_PM_RUNTIME},
493+
/* BYT iGPU depends on the Embedded Controller I2C controller (UID 1) */
494+
{"80860F41", "1", "LNXVIDEO", NULL, DL_FLAG_PM_RUNTIME,
495+
i2c1_dep_missing_dmi_ids},
496+
/* BYT CR iGPU depends on PMIC I2C controller (UID 5 on CR) */
478497
{"80860F41", "5", "LNXVIDEO", NULL, DL_FLAG_PM_RUNTIME},
498+
/* BYT iGPU depends on PMIC I2C controller (UID 7 on non CR) */
499+
{"80860F41", "7", "LNXVIDEO", NULL, DL_FLAG_PM_RUNTIME},
479500
};
480501

481502
static bool hid_uid_match(struct acpi_device *adev,
@@ -570,7 +591,8 @@ static void acpi_lpss_link_consumer(struct device *dev1,
570591
if (!dev2)
571592
return;
572593

573-
if (acpi_lpss_dep(ACPI_COMPANION(dev2), ACPI_HANDLE(dev1)))
594+
if ((link->dep_missing_ids && dmi_check_system(link->dep_missing_ids))
595+
|| acpi_lpss_dep(ACPI_COMPANION(dev2), ACPI_HANDLE(dev1)))
574596
device_link_add(dev2, dev1, link->flags);
575597

576598
put_device(dev2);
@@ -585,7 +607,8 @@ static void acpi_lpss_link_supplier(struct device *dev1,
585607
if (!dev2)
586608
return;
587609

588-
if (acpi_lpss_dep(ACPI_COMPANION(dev1), ACPI_HANDLE(dev2)))
610+
if ((link->dep_missing_ids && dmi_check_system(link->dep_missing_ids))
611+
|| acpi_lpss_dep(ACPI_COMPANION(dev1), ACPI_HANDLE(dev2)))
589612
device_link_add(dev1, dev2, link->flags);
590613

591614
put_device(dev2);

drivers/acpi/button.c

Lines changed: 75 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,19 @@
4444
#define ACPI_BUTTON_DEVICE_NAME_LID "Lid Switch"
4545
#define ACPI_BUTTON_TYPE_LID 0x05
4646

47-
#define ACPI_BUTTON_LID_INIT_IGNORE 0x00
48-
#define ACPI_BUTTON_LID_INIT_OPEN 0x01
49-
#define ACPI_BUTTON_LID_INIT_METHOD 0x02
47+
enum {
48+
ACPI_BUTTON_LID_INIT_IGNORE,
49+
ACPI_BUTTON_LID_INIT_OPEN,
50+
ACPI_BUTTON_LID_INIT_METHOD,
51+
ACPI_BUTTON_LID_INIT_DISABLED,
52+
};
53+
54+
static const char * const lid_init_state_str[] = {
55+
[ACPI_BUTTON_LID_INIT_IGNORE] = "ignore",
56+
[ACPI_BUTTON_LID_INIT_OPEN] = "open",
57+
[ACPI_BUTTON_LID_INIT_METHOD] = "method",
58+
[ACPI_BUTTON_LID_INIT_DISABLED] = "disabled",
59+
};
5060

5161
#define _COMPONENT ACPI_BUTTON_COMPONENT
5262
ACPI_MODULE_NAME("button");
@@ -65,18 +75,39 @@ static const struct acpi_device_id button_device_ids[] = {
6575
};
6676
MODULE_DEVICE_TABLE(acpi, button_device_ids);
6777

68-
/*
69-
* Some devices which don't even have a lid in anyway have a broken _LID
70-
* method (e.g. pointing to a floating gpio pin) causing spurious LID events.
71-
*/
72-
static const struct dmi_system_id lid_blacklst[] = {
78+
/* Please keep this list sorted alphabetically by vendor and model */
79+
static const struct dmi_system_id dmi_lid_quirks[] = {
80+
{
81+
/*
82+
* Asus T200TA, _LID keeps reporting closed after every second
83+
* openening of the lid. Causing immediate re-suspend after
84+
* opening every other open. Using LID_INIT_OPEN fixes this.
85+
*/
86+
.matches = {
87+
DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
88+
DMI_MATCH(DMI_PRODUCT_NAME, "T200TA"),
89+
},
90+
.driver_data = (void *)(long)ACPI_BUTTON_LID_INIT_OPEN,
91+
},
7392
{
74-
/* GP-electronic T701 */
93+
/* GP-electronic T701, _LID method points to a floating GPIO */
7594
.matches = {
7695
DMI_MATCH(DMI_SYS_VENDOR, "Insyde"),
7796
DMI_MATCH(DMI_PRODUCT_NAME, "T701"),
7897
DMI_MATCH(DMI_BIOS_VERSION, "BYT70A.YNCHENG.WIN.007"),
7998
},
99+
.driver_data = (void *)(long)ACPI_BUTTON_LID_INIT_DISABLED,
100+
},
101+
{
102+
/*
103+
* Medion Akoya E2215T, notification of the LID device only
104+
* happens on close, not on open and _LID always returns closed.
105+
*/
106+
.matches = {
107+
DMI_MATCH(DMI_SYS_VENDOR, "MEDION"),
108+
DMI_MATCH(DMI_PRODUCT_NAME, "E2215T MD60198"),
109+
},
110+
.driver_data = (void *)(long)ACPI_BUTTON_LID_INIT_OPEN,
80111
},
81112
{}
82113
};
@@ -116,9 +147,8 @@ struct acpi_button {
116147
bool suspended;
117148
};
118149

119-
static BLOCKING_NOTIFIER_HEAD(acpi_lid_notifier);
120150
static struct acpi_device *lid_device;
121-
static u8 lid_init_state = ACPI_BUTTON_LID_INIT_METHOD;
151+
static long lid_init_state = -1;
122152

123153
static unsigned long lid_report_interval __read_mostly = 500;
124154
module_param(lid_report_interval, ulong, 0644);
@@ -146,7 +176,6 @@ static int acpi_lid_evaluate_state(struct acpi_device *device)
146176
static int acpi_lid_notify_state(struct acpi_device *device, int state)
147177
{
148178
struct acpi_button *button = acpi_driver_data(device);
149-
int ret;
150179
ktime_t next_report;
151180
bool do_update;
152181

@@ -223,18 +252,7 @@ static int acpi_lid_notify_state(struct acpi_device *device, int state)
223252
button->last_time = ktime_get();
224253
}
225254

226-
ret = blocking_notifier_call_chain(&acpi_lid_notifier, state, device);
227-
if (ret == NOTIFY_DONE)
228-
ret = blocking_notifier_call_chain(&acpi_lid_notifier, state,
229-
device);
230-
if (ret == NOTIFY_DONE || ret == NOTIFY_OK) {
231-
/*
232-
* It is also regarded as success if the notifier_chain
233-
* returns NOTIFY_OK or NOTIFY_DONE.
234-
*/
235-
ret = 0;
236-
}
237-
return ret;
255+
return 0;
238256
}
239257

240258
static int __maybe_unused acpi_button_state_seq_show(struct seq_file *seq,
@@ -331,18 +349,6 @@ static int acpi_button_remove_fs(struct acpi_device *device)
331349
/* --------------------------------------------------------------------------
332350
Driver Interface
333351
-------------------------------------------------------------------------- */
334-
int acpi_lid_notifier_register(struct notifier_block *nb)
335-
{
336-
return blocking_notifier_chain_register(&acpi_lid_notifier, nb);
337-
}
338-
EXPORT_SYMBOL(acpi_lid_notifier_register);
339-
340-
int acpi_lid_notifier_unregister(struct notifier_block *nb)
341-
{
342-
return blocking_notifier_chain_unregister(&acpi_lid_notifier, nb);
343-
}
344-
EXPORT_SYMBOL(acpi_lid_notifier_unregister);
345-
346352
int acpi_lid_open(void)
347353
{
348354
if (!lid_device)
@@ -472,7 +478,8 @@ static int acpi_button_add(struct acpi_device *device)
472478
char *name, *class;
473479
int error;
474480

475-
if (!strcmp(hid, ACPI_BUTTON_HID_LID) && dmi_check_system(lid_blacklst))
481+
if (!strcmp(hid, ACPI_BUTTON_HID_LID) &&
482+
lid_init_state == ACPI_BUTTON_LID_INIT_DISABLED)
476483
return -ENODEV;
477484

478485
button = kzalloc(sizeof(struct acpi_button), GFP_KERNEL);
@@ -578,36 +585,30 @@ static int acpi_button_remove(struct acpi_device *device)
578585
static int param_set_lid_init_state(const char *val,
579586
const struct kernel_param *kp)
580587
{
581-
int result = 0;
582-
583-
if (!strncmp(val, "open", sizeof("open") - 1)) {
584-
lid_init_state = ACPI_BUTTON_LID_INIT_OPEN;
585-
pr_info("Notify initial lid state as open\n");
586-
} else if (!strncmp(val, "method", sizeof("method") - 1)) {
587-
lid_init_state = ACPI_BUTTON_LID_INIT_METHOD;
588-
pr_info("Notify initial lid state with _LID return value\n");
589-
} else if (!strncmp(val, "ignore", sizeof("ignore") - 1)) {
590-
lid_init_state = ACPI_BUTTON_LID_INIT_IGNORE;
591-
pr_info("Do not notify initial lid state\n");
592-
} else
593-
result = -EINVAL;
594-
return result;
588+
int i;
589+
590+
i = sysfs_match_string(lid_init_state_str, val);
591+
if (i < 0)
592+
return i;
593+
594+
lid_init_state = i;
595+
pr_info("Initial lid state set to '%s'\n", lid_init_state_str[i]);
596+
return 0;
595597
}
596598

597-
static int param_get_lid_init_state(char *buffer,
598-
const struct kernel_param *kp)
599+
static int param_get_lid_init_state(char *buf, const struct kernel_param *kp)
599600
{
600-
switch (lid_init_state) {
601-
case ACPI_BUTTON_LID_INIT_OPEN:
602-
return sprintf(buffer, "open");
603-
case ACPI_BUTTON_LID_INIT_METHOD:
604-
return sprintf(buffer, "method");
605-
case ACPI_BUTTON_LID_INIT_IGNORE:
606-
return sprintf(buffer, "ignore");
607-
default:
608-
return sprintf(buffer, "invalid");
609-
}
610-
return 0;
601+
int i, c = 0;
602+
603+
for (i = 0; i < ARRAY_SIZE(lid_init_state_str); i++)
604+
if (i == lid_init_state)
605+
c += sprintf(buf + c, "[%s] ", lid_init_state_str[i]);
606+
else
607+
c += sprintf(buf + c, "%s ", lid_init_state_str[i]);
608+
609+
buf[c - 1] = '\n'; /* Replace the final space with a newline */
610+
611+
return c;
611612
}
612613

613614
module_param_call(lid_init_state,
@@ -617,6 +618,16 @@ MODULE_PARM_DESC(lid_init_state, "Behavior for reporting LID initial state");
617618

618619
static int acpi_button_register_driver(struct acpi_driver *driver)
619620
{
621+
const struct dmi_system_id *dmi_id;
622+
623+
if (lid_init_state == -1) {
624+
dmi_id = dmi_first_match(dmi_lid_quirks);
625+
if (dmi_id)
626+
lid_init_state = (long)dmi_id->driver_data;
627+
else
628+
lid_init_state = ACPI_BUTTON_LID_INIT_METHOD;
629+
}
630+
620631
/*
621632
* Modules such as nouveau.ko and i915.ko have a link time dependency
622633
* on acpi_lid_open(), and would therefore not be loadable on ACPI

0 commit comments

Comments
 (0)