History

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

Pull ACPI updates from Rafael Wysocki: "These revert two ACPICA commits that are not needed any more, rework the property graphs support in ACPI to be more aligned with the analogous DT code, add some new quirks and remove one that isn't needed any more, add a special platform driver to enumerate multiple I2C devices hooked up to the same device object in the ACPI tables and update the battery and button drivers. Specifics: - Revert two ACPICA commits that are not needed any more (Erik Schmauss). - Rework property graph support in the ACPI device properties framework to make it behave more like the analogous DT code and update the documentation of it (Sakari Ailus). - Change the default ACPI device status after initialization to ACPI_STA_DEFAULT instead of 0 (Hans de Goede). - Add a special platform driver for enumerating multiple I2C devices hooked up to the same object in the ACPI tables (Hans de Goede). - Fix the ACPI battery driver to avoid reporting full capacity on systems without support for that and clean it up (Hans de Goede, Dmitry Rozhkov, Lucas Rangit Magasweran). - Add two system wakeup quirks to the ACPI EC driver (Aaron Ma, Mika Westerberg). - Add the touchscreen on Dell Venue Pro 7139 to the list of "always present" devices to make it work (Tristian Celestin). - Revert a special tables handling quirk for Dell XPS 9570 and Precision M5530 which is not needed any more (Kai Heng Feng). - Add support for a new OEM _OSI string to allow system vendors to work around issues with NVidia HDMI audio (Alex Hung). - Prevent the ACPI button driver from reporting excessive system wakeup events and clean it up (Ravi Chandra Sadineni, Randy Dunlap). - Clean up two minor code style issues in the ACPI core and GHES handling on ARM64 (Dongjiu Geng, John Garry, Tom Todd)" * tag 'acpi-4.19-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm: (34 commits) platform/x86: Add ACPI i2c-multi-instantiate pseudo driver ACPI / x86: utils: Remove status workaround from acpi_device_always_present() ACPI / scan: Create platform device for fwnodes with multiple i2c devices ACPI / scan: Initialize status to ACPI_STA_DEFAULT ACPI / EC: Add another entry for Thinkpad X1 Carbon 6th ACPI: bus: Fix a pointer coding style issue arm64 / ACPI: clean the additional checks before calling ghes_notify_sea() ACPI / scan: Add static attribute to indirect_io_hosts[] ACPI / battery: Do not export energy_full[_design] on devices without full_charge_capacity ACPI / EC: Use ec_no_wakeup on ThinkPad X1 Yoga 3rd ACPI / battery: get rid of negations in conditions ACPI / battery: use specialized print macros ACPI / battery: reorder headers alphabetically ACPI / battery: drop inclusion of init.h ACPI: battery: remove redundant old_present check on insertion ACPI: property: graph: Update graph documentation to use generic references ACPI: property: graph: Improve graph documentation for port/ep numbering ACPI: property: graph: Fix graph documentation ACPI: property: Update documentation for hierarchical data extension 1.1 ACPI: property: Document key numbering for hierarchical data extension refs ...

Linus Torvalds committed 8 years ago

Commit 2c204432 parents b018fc9 76f7d6c28 files · +528 −277Browse files

Unified · Split

28 files
  1. Documentation/acpi/dsd/data-node-references.txt +89 −0
  2. Documentation/acpi/dsd/graph.txt +42 −30
  3. MAINTAINERS +6 −0
  4. arch/arm64/mm/fault.c +1 −6
  5. drivers/acpi/acpica/aclocal.h +0 −1
  6. drivers/acpi/acpica/nsaccess.c +0 −7
  7. drivers/acpi/acpica/nssearch.c +0 −1
  8. drivers/acpi/battery.c +44 −25
  9. drivers/acpi/bus.c +8 −32
  10. drivers/acpi/button.c +10 −7
  11. drivers/acpi/ec.c +14 −0
  12. drivers/acpi/osi.c +8 −0
  13. drivers/acpi/property.c +97 −112
  14. drivers/acpi/scan.c +20 −3
  15. drivers/acpi/x86/utils.c +9 −13
  16. drivers/gpio/gpiolib-acpi.c +7 −4
  17. drivers/infiniband/hw/hns/hns_roce_hw_v1.c +4 −6
  18. drivers/media/v4l2-core/v4l2-fwnode.c +1 −1
  19. drivers/net/ethernet/apm/xgene/xgene_enet_hw.c +3 −3
  20. drivers/net/ethernet/hisilicon/hns/hns_dsaf_mac.c +4 −2
  21. drivers/net/ethernet/hisilicon/hns/hns_enet.c +6 −2
  22. drivers/platform/x86/Kconfig +11 −0
  23. drivers/platform/x86/Makefile +1 −0
  24. drivers/platform/x86/i2c-multi-instantiate.c +132 −0
  25. include/acpi/acpixf.h +1 −1
  26. include/acpi/ghes.h +4 −0
  27. include/linux/acpi.h +5 −20
  28. include/linux/fwnode.h +1 −1
Documentation/acpi/dsd/data-node-references.txt+89−0
@@ -0,0 +1,89 @@
1+Copyright (C) 2018 Intel Corporation
2+Author: Sakari Ailus <sakari.ailus@linux.intel.com>
3+
4+
5+Referencing hierarchical data nodes
6+-----------------------------------
7+
8+ACPI in general allows referring to device objects in the tree only.
9+Hierarchical data extension nodes may not be referred to directly, hence this
10+document defines a scheme to implement such references.
11+
12+A reference consist of the device object name followed by one or more
13+hierarchical data extension [1] keys. Specifically, the hierarchical data
14+extension node which is referred to by the key shall lie directly under the
15+parent object i.e. either the device object or another hierarchical data
16+extension node.
17+
18+The keys in the hierarchical data nodes shall consist of the name of the node,
19+"@" character and the number of the node in hexadecimal notation (without pre-
20+or postfixes). The same ACPI object shall include the _DSD property extension
21+with a property "reg" that shall have the same numerical value as the number of
22+the node.
23+
24+In case a hierarchical data extensions node has no numerical value, then the
25+"reg" property shall be omitted from the ACPI object's _DSD properties and the
26+"@" character and the number shall be omitted from the hierarchical data
27+extension key.
28+
29+
30+Example
31+-------
32+
33+ In the ASL snippet below, the "reference" _DSD property [2] contains a
34+ device object reference to DEV0 and under that device object, a
35+ hierarchical data extension key "node@1" referring to the NOD1 object
36+ and lastly, a hierarchical data extension key "anothernode" referring to
37+ the ANOD object which is also the final target node of the reference.
38+
39+ Device (DEV0)
40+ {
41+ Name (_DSD, Package () {
42+ ToUUID("dbb8e3e6-5886-4ba6-8795-1319f52a966b"),
43+ Package () {
44+ Package () { "node@0", NOD0 },
45+ Package () { "node@1", NOD1 },
46+ }
47+ })
48+ Name (NOD0, Package() {
49+ ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"),
50+ Package () {
51+ Package () { "random-property", 3 },
52+ }
53+ })
54+ Name (NOD1, Package() {
55+ ToUUID("dbb8e3e6-5886-4ba6-8795-1319f52a966b"),
56+ Package () {
57+ Package () { "anothernode", ANOD },
58+ }
59+ })
60+ Name (ANOD, Package() {
61+ ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"),
62+ Package () {
63+ Package () { "random-property", 0 },
64+ }
65+ })
66+ }
67+
68+ Device (DEV1)
69+ {
70+ Name (_DSD, Package () {
71+ ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"),
72+ Package () {
73+ Package () { "reference", ^DEV0, "node@1", "anothernode" },
74+ }
75+ })
76+ }
77+
78+Please also see a graph example in graph.txt .
79+
80+References
81+----------
82+
83+[1] Hierarchical Data Extension UUID For _DSD.
84+ <URL:http://www.uefi.org/sites/default/files/resources/_DSD-hierarchical-data-extension-UUID-v1.1.pdf>,
85+ referenced 2018-07-17.
86+
87+[2] Device Properties UUID For _DSD.
88+ <URL:http://www.uefi.org/sites/default/files/resources/_DSD-device-properties-UUID.pdf>,
89+ referenced 2016-10-04.
Documentation/acpi/dsd/graph.txt+42−30
@@ -36,29 +36,41 @@ The port and endpoint concepts are very similar to those in Devicetree · 35 unmodified lines
3636 [3]. A port represents an interface in a device, and an endpoint
3737 represents a connection to that interface.
3838
39−All port nodes are located under the device's "_DSD" node in the
40−hierarchical data extension tree. The property extension related to
41−each port node must contain the key "port" and an integer value which
42−is the number of the port. The object it refers to should be called "PRTX",
43−where "X" is the number of the port.
44−
45−Further on, endpoints are located under the individual port nodes. The
46−first hierarchical data extension package list entry of the endpoint
47−nodes must begin with "endpoint" and must be followed by the number
48−of the endpoint. The object it refers to should be called "EPXY", where
49−"X" is the number of the port and "Y" is the number of the endpoint.
50−
51−Each port node contains a property extension key "port", the value of
52−which is the number of the port node. The each endpoint is similarly numbered
53−with a property extension key "endpoint". Port numbers must be unique within a
54−device and endpoint numbers must be unique within a port.
39+All port nodes are located under the device's "_DSD" node in the hierarchical
40+data extension tree. The data extension related to each port node must begin
41+with "port" and must be followed by the "@" character and the number of the port
42+as its key. The target object it refers to should be called "PRTX", where "X" is
43+the number of the port. An example of such a package would be:
44+
45+ Package() { "port@4", PRT4 }
46+
47+Further on, endpoints are located under the port nodes. The hierarchical
48+data extension key of the endpoint nodes must begin with
49+"endpoint" and must be followed by the "@" character and the number of the
50+endpoint. The object it refers to should be called "EPXY", where "X" is the
51+number of the port and "Y" is the number of the endpoint. An example of such a
52+package would be:
53+
54+ Package() { "endpoint@0", EP40 }
55+
56+Each port node contains a property extension key "port", the value of which is
57+the number of the port. Each endpoint is similarly numbered with a property
58+extension key "reg", the value of which is the number of the endpoint. Port
59+numbers must be unique within a device and endpoint numbers must be unique
60+within a port. If a device object may only has a single port, then the number
61+of that port shall be zero. Similarly, if a port may only have a single
62+endpoint, the number of that endpoint shall be zero.
5563
5664 The endpoint reference uses property extension with "remote-endpoint" property
5765 name followed by a reference in the same package. Such references consist of the
58−the remote device reference, number of the port in the device and finally the
59−number of the endpoint in that port. Individual references thus appear as:
66+the remote device reference, the first package entry of the port data extension
67+reference under the device and finally the first package entry of the endpoint
68+data extension reference under the port. Individual references thus appear as:
6069
61− Package() { device, port_number, endpoint_number }
70+ Package() { device, "port@X", "endpoint@Y" }
71+
72+In the above example, "X" is the number of the port and "Y" is the number of the
73+endpoint.
6274
6375 The references to endpoints must be always done both ways, to the
6476 remote endpoint and back from the referred remote endpoint node.
@@ -76,24 +88,24 @@ A simple example of this is show below: · 11 unmodified lines
7688 },
7789 ToUUID("dbb8e3e6-5886-4ba6-8795-1319f52a966b"),
7890 Package () {
79− Package () { "port0", "PRT0" },
91+ Package () { "port@0", PRT0 },
8092 }
8193 })
8294 Name (PRT0, Package() {
8395 ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"),
8496 Package () {
85− Package () { "port", 0 },
97+ Package () { "reg", 0 },
8698 },
8799 ToUUID("dbb8e3e6-5886-4ba6-8795-1319f52a966b"),
88100 Package () {
89− Package () { "endpoint0", "EP00" },
101+ Package () { "endpoint@0", EP00 },
90102 }
91103 })
92104 Name (EP00, Package() {
93105 ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"),
94106 Package () {
95− Package () { "endpoint", 0 },
96− Package () { "remote-endpoint", Package() { \_SB.PCI0.ISP, 4, 0 } },
107+ Package () { "reg", 0 },
108+ Package () { "remote-endpoint", Package() { \_SB.PCI0.ISP, "port@4", "endpoint@0" } },
97109 }
98110 })
99111 }
@@ -106,26 +118,26 @@ A simple example of this is show below: · 6 unmodified lines
106118 Name (_DSD, Package () {
107119 ToUUID("dbb8e3e6-5886-4ba6-8795-1319f52a966b"),
108120 Package () {
109− Package () { "port4", "PRT4" },
121+ Package () { "port@4", PRT4 },
110122 }
111123 })
112124
113125 Name (PRT4, Package() {
114126 ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"),
115127 Package () {
116− Package () { "port", 4 }, /* CSI-2 port number */
128+ Package () { "reg", 4 }, /* CSI-2 port number */
117129 },
118130 ToUUID("dbb8e3e6-5886-4ba6-8795-1319f52a966b"),
119131 Package () {
120− Package () { "endpoint0", "EP40" },
132+ Package () { "endpoint@0", EP40 },
121133 }
122134 })
123135
124136 Name (EP40, Package() {
125137 ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"),
126138 Package () {
127− Package () { "endpoint", 0 },
128− Package () { "remote-endpoint", Package () { \_SB.PCI0.I2C2.CAM0, 0, 0 } },
139+ Package () { "reg", 0 },
140+ Package () { "remote-endpoint", Package () { \_SB.PCI0.I2C2.CAM0, "port@0", "endpoint@0" } },
129141 }
130142 })
131143 }
@@ -151,7 +163,7 @@ References · 19 unmodified lines
151163 referenced 2016-10-04.
152164
153165 [5] Hierarchical Data Extension UUID For _DSD.
154− <URL:http://www.uefi.org/sites/default/files/resources/_DSD-hierarchical-data-extension-UUID-v1.pdf>,
166+ <URL:http://www.uefi.org/sites/default/files/resources/_DSD-hierarchical-data-extension-UUID-v1.1.pdf>,
155167 referenced 2016-10-04.
156168
157169 [6] Advanced Configuration and Power Interface Specification.
MAINTAINERS+6−0
@@ -367,6 +367,12 @@ L: linux-acpi@vger.kernel.org · 366 unmodified lines
367367 S: Maintained
368368 F: drivers/acpi/arm64
369369
370+ACPI I2C MULTI INSTANTIATE DRIVER
371+M: Hans de Goede <hdegoede@redhat.com>
372+L: platform-driver-x86@vger.kernel.org
373+S: Maintained
374+F: drivers/platform/x86/i2c-multi-instantiate.c
375+
370376 ACPI PMIC DRIVERS
371377 M: "Rafael J. Wysocki" <rjw@rjwysocki.net>
372378 M: Len Brown <lenb@kernel.org>
arch/arm64/mm/fault.c+1−6
@@ -727,12 +727,7 @@ static const struct fault_info fault_info[] = { · 726 unmodified lines
727727
728728 int handle_guest_sea(phys_addr_t addr, unsigned int esr)
729729 {
730− int ret = -ENOENT;
731−
732− if (IS_ENABLED(CONFIG_ACPI_APEI_SEA))
733− ret = ghes_notify_sea();
734−
735− return ret;
730+ return ghes_notify_sea();
736731 }
737732
738733 asmlinkage void __exception do_mem_abort(unsigned long addr, unsigned int esr,
drivers/acpi/acpica/aclocal.h+0−1
@@ -165,7 +165,6 @@ struct acpi_namespace_node { · 164 unmodified lines
165165 #define ANOBJ_EVALUATED 0x20 /* Set on first evaluation of node */
166166 #define ANOBJ_ALLOCATED_BUFFER 0x40 /* Method AML buffer is dynamic (install_method) */
167167
168−#define IMPLICIT_EXTERNAL 0x02 /* iASL only: This object created implicitly via External */
169168 #define ANOBJ_IS_EXTERNAL 0x08 /* iASL only: This object created via External() */
170169 #define ANOBJ_METHOD_NO_RETVAL 0x10 /* iASL only: Method has no return value */
171170 #define ANOBJ_METHOD_SOME_NO_RETVAL 0x20 /* iASL only: Method has at least one return value */
drivers/acpi/acpica/nsaccess.c+0−7
@@ -613,13 +613,6 @@ acpi_ns_lookup(union acpi_generic_state *scope_info, · 612 unmodified lines
613613 /* Special handling for the last segment (num_segments == 0) */
614614
615615 else {
616−#ifdef ACPI_ASL_COMPILER
617− if (!acpi_gbl_disasm_flag
618− && (this_node->flags & ANOBJ_IS_EXTERNAL)) {
619− this_node->flags &= ~IMPLICIT_EXTERNAL;
620− }
621−#endif
622−
623616 /*
624617 * Sanity typecheck of the target object:
625618 *
drivers/acpi/acpica/nssearch.c+0−1
@@ -381,7 +381,6 @@ acpi_ns_search_and_enter(u32 target_name, · 380 unmodified lines
381381 if (flags & ACPI_NS_EXTERNAL ||
382382 (walk_state && walk_state->opcode == AML_SCOPE_OP)) {
383383 new_node->flags |= ANOBJ_IS_EXTERNAL;
384− new_node->flags |= IMPLICIT_EXTERNAL;
385384 }
386385 #endif
387386
drivers/acpi/battery.c+44−25
@@ -23,18 +23,18 @@ · 22 unmodified lines
2323
2424 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
2525
26+#include <linux/async.h>
27+#include <linux/delay.h>
28+#include <linux/dmi.h>
29+#include <linux/jiffies.h>
2630 #include <linux/kernel.h>
2731 #include <linux/list.h>
2832 #include <linux/module.h>
2933 #include <linux/mutex.h>
30−#include <linux/init.h>
31−#include <linux/types.h>
32−#include <linux/jiffies.h>
33−#include <linux/async.h>
34−#include <linux/dmi.h>
35−#include <linux/delay.h>
3634 #include <linux/slab.h>
3735 #include <linux/suspend.h>
36+#include <linux/types.h>
37+
3838 #include <asm/unaligned.h>
3939
4040 #ifdef CONFIG_ACPI_PROCFS_POWER
@@ -364,6 +364,20 @@ static enum power_supply_property energy_battery_props[] = { · 323 unmodified lines
364364 POWER_SUPPLY_PROP_SERIAL_NUMBER,
365365 };
366366
367+static enum power_supply_property energy_battery_full_cap_broken_props[] = {
368+ POWER_SUPPLY_PROP_STATUS,
369+ POWER_SUPPLY_PROP_PRESENT,
370+ POWER_SUPPLY_PROP_TECHNOLOGY,
371+ POWER_SUPPLY_PROP_CYCLE_COUNT,
372+ POWER_SUPPLY_PROP_VOLTAGE_MIN_DESIGN,
373+ POWER_SUPPLY_PROP_VOLTAGE_NOW,
374+ POWER_SUPPLY_PROP_POWER_NOW,
375+ POWER_SUPPLY_PROP_ENERGY_NOW,
376+ POWER_SUPPLY_PROP_MODEL_NAME,
377+ POWER_SUPPLY_PROP_MANUFACTURER,
378+ POWER_SUPPLY_PROP_SERIAL_NUMBER,
379+};
380+
367381 /* --------------------------------------------------------------------------
368382 Battery Management
369383 -------------------------------------------------------------------------- */
@@ -577,8 +591,7 @@ static int acpi_battery_get_state(struct acpi_battery *battery) · 207 unmodified lines
577591 battery->rate_now != ACPI_BATTERY_VALUE_UNKNOWN &&
578592 (s16)(battery->rate_now) < 0) {
579593 battery->rate_now = abs((s16)battery->rate_now);
580− printk_once(KERN_WARNING FW_BUG
581− "battery: (dis)charge rate invalid.\n");
594+ pr_warn_once(FW_BUG "battery: (dis)charge rate invalid.\n");
582595 }
583596
584597 if (test_bit(ACPI_BATTERY_QUIRK_PERCENTAGE_CAPACITY, &battery->flags)
@@ -799,6 +812,11 @@ static int sysfs_add_battery(struct acpi_battery *battery) · 214 unmodified lines
799812 battery->bat_desc.properties = charge_battery_props;
800813 battery->bat_desc.num_properties =
801814 ARRAY_SIZE(charge_battery_props);
815+ } else if (battery->full_charge_capacity == 0) {
816+ battery->bat_desc.properties =
817+ energy_battery_full_cap_broken_props;
818+ battery->bat_desc.num_properties =
819+ ARRAY_SIZE(energy_battery_full_cap_broken_props);
802820 } else {
803821 battery->bat_desc.properties = energy_battery_props;
804822 battery->bat_desc.num_properties =
@@ -918,10 +936,11 @@ static void acpi_battery_quirks(struct acpi_battery *battery) · 113 unmodified lines
918936
919937 static int acpi_battery_update(struct acpi_battery *battery, bool resume)
920938 {
921− int result, old_present = acpi_battery_present(battery);
922− result = acpi_battery_get_status(battery);
939+ int result = acpi_battery_get_status(battery);
940+
923941 if (result)
924942 return result;
943+
925944 if (!acpi_battery_present(battery)) {
926945 sysfs_remove_battery(battery);
927946 battery->update_time = 0;
@@ -931,8 +950,7 @@ static int acpi_battery_update(struct acpi_battery *battery, bool resume) · 3 unmodified lines
931950 if (resume)
932951 return 0;
933952
934− if (!battery->update_time ||
935− old_present != acpi_battery_present(battery)) {
953+ if (!battery->update_time) {
936954 result = acpi_battery_get_info(battery);
937955 if (result)
938956 return result;
@@ -1021,7 +1039,7 @@ static int acpi_battery_info_proc_show(struct seq_file *seq, void *offset) · 82 unmodified lines
10211039 acpi_battery_units(battery));
10221040
10231041 seq_printf(seq, "battery technology: %srechargeable\n",
1024− (!battery->technology)?"non-":"");
1042+ battery->technology ? "" : "non-");
10251043
10261044 if (battery->design_voltage == ACPI_BATTERY_VALUE_UNKNOWN)
10271045 seq_printf(seq, "design voltage: unknown\n");
@@ -1112,11 +1130,12 @@ static int acpi_battery_alarm_proc_show(struct seq_file *seq, void *offset) · 84 unmodified lines
11121130 goto end;
11131131 }
11141132 seq_printf(seq, "alarm: ");
1115− if (!battery->alarm)
1116− seq_printf(seq, "unsupported\n");
1117− else
1133+ if (battery->alarm) {
11181134 seq_printf(seq, "%u %sh\n", battery->alarm,
11191135 acpi_battery_units(battery));
1136+ } else {
1137+ seq_printf(seq, "unsupported\n");
1138+ }
11201139 end:
11211140 if (result)
11221141 seq_printf(seq, "ERROR: Unable to read battery alarm\n");
@@ -1149,9 +1168,9 @@ static ssize_t acpi_battery_write_alarm(struct file *file, · 26 unmodified lines
11491168 }
11501169 result = acpi_battery_set_alarm(battery);
11511170 end:
1152− if (!result)
1153− return count;
1154− return result;
1171+ if (result)
1172+ return result;
1173+ return count;
11551174 }
11561175
11571176 static int acpi_battery_alarm_proc_open(struct inode *inode, struct file *file)
@@ -1170,8 +1189,7 @@ static const struct file_operations acpi_battery_alarm_fops = { · 12 unmodified lines
11701189
11711190 static int acpi_battery_add_fs(struct acpi_device *device)
11721191 {
1173− printk(KERN_WARNING PREFIX "Deprecated procfs I/F for battery is loaded,"
1174− " please retry with CONFIG_ACPI_PROCFS_POWER cleared\n");
1192+ pr_warning(PREFIX "Deprecated procfs I/F for battery is loaded, please retry with CONFIG_ACPI_PROCFS_POWER cleared\n");
11751193 if (!acpi_device_dir(device)) {
11761194 acpi_device_dir(device) = proc_mkdir(acpi_device_bid(device),
11771195 acpi_battery_dir);
@@ -1247,7 +1265,9 @@ static int battery_notify(struct notifier_block *nb, · 69 unmodified lines
12471265 if (!acpi_battery_present(battery))
12481266 return 0;
12491267
1250− if (!battery->bat) {
1268+ if (battery->bat) {
1269+ acpi_battery_refresh(battery);
1270+ } else {
12511271 result = acpi_battery_get_info(battery);
12521272 if (result)
12531273 return result;
@@ -1255,8 +1275,7 @@ static int battery_notify(struct notifier_block *nb, · 1 unmodified line
12551275 result = sysfs_add_battery(battery);
12561276 if (result)
12571277 return result;
1258− } else
1259− acpi_battery_refresh(battery);
1278+ }
12601279
12611280 acpi_battery_init_alarm(battery);
12621281 acpi_battery_get_state(battery);
@@ -1398,7 +1417,7 @@ static int acpi_battery_add(struct acpi_device *device) · 135 unmodified lines
13981417 }
13991418 #endif
14001419
1401− printk(KERN_INFO PREFIX "%s Slot [%s] (battery %s)\n",
1420+ pr_info(PREFIX "%s Slot [%s] (battery %s)\n",
14021421 ACPI_BATTERY_DEVICE_NAME, acpi_device_bid(device),
14031422 device->status.battery_present ? "present" : "absent");
14041423
drivers/acpi/bus.c+8−32
@@ -66,37 +66,10 @@ static int set_copy_dsdt(const struct dmi_system_id *id) · 65 unmodified lines
6666 return 0;
6767 }
6868 #endif
69−static int set_gbl_term_list(const struct dmi_system_id *id)
70−{
71− acpi_gbl_execute_tables_as_methods = 1;
72− return 0;
73−}
7469
75−static const struct dmi_system_id acpi_quirks_dmi_table[] __initconst = {
76− /*
77− * Touchpad on Dell XPS 9570/Precision M5530 doesn't work under I2C
78− * mode.
79− * https://bugzilla.kernel.org/show_bug.cgi?id=198515
80− */
81− {
82− .callback = set_gbl_term_list,
83− .ident = "Dell Precision M5530",
84− .matches = {
85− DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
86− DMI_MATCH(DMI_PRODUCT_NAME, "Precision M5530"),
87− },
88− },
89− {
90− .callback = set_gbl_term_list,
91− .ident = "Dell XPS 15 9570",
92− .matches = {
93− DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
94− DMI_MATCH(DMI_PRODUCT_NAME, "XPS 15 9570"),
95− },
96− },
70+static const struct dmi_system_id dsdt_dmi_table[] __initconst = {
9771 /*
9872 * Invoke DSDT corruption work-around on all Toshiba Satellite.
99− * DSDT will be copied to memory.
10073 * https://bugzilla.kernel.org/show_bug.cgi?id=14679
10174 */
10275 {
@@ -110,7 +83,7 @@ static const struct dmi_system_id acpi_quirks_dmi_table[] __initconst = { · 7 unmodified lines
11083 {}
11184 };
11285 #else
113−static const struct dmi_system_id acpi_quirks_dmi_table[] __initconst = {
86+static const struct dmi_system_id dsdt_dmi_table[] __initconst = {
11487 {}
11588 };
11689 #endif
@@ -962,7 +935,7 @@ static int acpi_device_probe(struct device *dev) · 845 unmodified lines
962935 return 0;
963936 }
964937
965−static int acpi_device_remove(struct device * dev)
938+static int acpi_device_remove(struct device *dev)
966939 {
967940 struct acpi_device *acpi_dev = to_acpi_device(dev);
968941 struct acpi_driver *acpi_drv = acpi_dev->driver;
@@ -1060,8 +1033,11 @@ void __init acpi_early_init(void) · 91 unmodified lines
10601033
10611034 acpi_permanent_mmap = true;
10621035
1063− /* Check machine-specific quirks */
1064− dmi_check_system(acpi_quirks_dmi_table);
1036+ /*
1037+ * If the machine falls into the DMI check table,
1038+ * DSDT will be copied to memory
1039+ */
1040+ dmi_check_system(dsdt_dmi_table);
10651041
10661042 status = acpi_reallocate_root_table();
10671043 if (ACPI_FAILURE(status)) {
drivers/acpi/button.c+10−7
@@ -21,6 +21,7 @@ · 20 unmodified lines
2121
2222 #define pr_fmt(fmt) "ACPI: button: " fmt
2323
24+#include <linux/compiler.h>
2425 #include <linux/kernel.h>
2526 #include <linux/module.h>
2627 #include <linux/init.h>
@@ -235,9 +236,6 @@ static int acpi_lid_notify_state(struct acpi_device *device, int state) · 208 unmodified lines
235236 button->last_time = ktime_get();
236237 }
237238
238− if (state)
239− acpi_pm_wakeup_event(&device->dev);
240−
241239 ret = blocking_notifier_call_chain(&acpi_lid_notifier, state, device);
242240 if (ret == NOTIFY_DONE)
243241 ret = blocking_notifier_call_chain(&acpi_lid_notifier, state,
@@ -252,7 +250,8 @@ static int acpi_lid_notify_state(struct acpi_device *device, int state) · 8 unmodified lines
252250 return ret;
253251 }
254252
255−static int acpi_button_state_seq_show(struct seq_file *seq, void *offset)
253+static int __maybe_unused acpi_button_state_seq_show(struct seq_file *seq,
254+ void *offset)
256255 {
257256 struct acpi_device *device = seq->private;
258257 int state;
@@ -366,7 +365,8 @@ int acpi_lid_open(void) · 107 unmodified lines
366365 }
367366 EXPORT_SYMBOL(acpi_lid_open);
368367
369−static int acpi_lid_update_state(struct acpi_device *device)
368+static int acpi_lid_update_state(struct acpi_device *device,
369+ bool signal_wakeup)
370370 {
371371 int state;
372372
@@ -374,6 +374,9 @@ static int acpi_lid_update_state(struct acpi_device *device) · 1 unmodified line
374374 if (state < 0)
375375 return state;
376376
377+ if (state && signal_wakeup)
378+ acpi_pm_wakeup_event(&device->dev);
379+
377380 return acpi_lid_notify_state(device, state);
378381 }
379382
@@ -384,7 +387,7 @@ static void acpi_lid_initialize_state(struct acpi_device *device) · 4 unmodified lines
384387 (void)acpi_lid_notify_state(device, 1);
385388 break;
386389 case ACPI_BUTTON_LID_INIT_METHOD:
387− (void)acpi_lid_update_state(device);
390+ (void)acpi_lid_update_state(device, false);
388391 break;
389392 case ACPI_BUTTON_LID_INIT_IGNORE:
390393 default:
@@ -409,7 +412,7 @@ static void acpi_button_notify(struct acpi_device *device, u32 event) · 18 unmodified lines
409412 users = button->input->users;
410413 mutex_unlock(&button->input->mutex);
411414 if (users)
412− acpi_lid_update_state(device);
415+ acpi_lid_update_state(device, true);
413416 } else {
414417 int keycode;
415418
drivers/acpi/ec.c+14−0
@@ -2045,6 +2045,20 @@ static const struct dmi_system_id acpi_ec_no_wakeup[] = { · 2044 unmodified lines
20452045 DMI_MATCH(DMI_PRODUCT_FAMILY, "Thinkpad X1 Carbon 6th"),
20462046 },
20472047 },
2048+ {
2049+ .ident = "ThinkPad X1 Carbon 6th",
2050+ .matches = {
2051+ DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
2052+ DMI_MATCH(DMI_PRODUCT_FAMILY, "ThinkPad X1 Carbon 6th"),
2053+ },
2054+ },
2055+ {
2056+ .ident = "ThinkPad X1 Yoga 3rd",
2057+ .matches = {
2058+ DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
2059+ DMI_MATCH(DMI_PRODUCT_FAMILY, "ThinkPad X1 Yoga 3rd"),
2060+ },
2061+ },
20482062 { },
20492063 };
20502064
drivers/acpi/osi.c+8−0
@@ -66,6 +66,14 @@ osi_setup_entries[OSI_STRING_ENTRIES_MAX] __initdata = { · 65 unmodified lines
6666 * be removed if both new and old graphics cards are supported.
6767 */
6868 {"Linux-Dell-Video", true},
69+ /*
70+ * Linux-Lenovo-NV-HDMI-Audio is used by BIOS to power on NVidia's HDMI
71+ * audio device which is turned off for power-saving in Windows OS.
72+ * This power management feature observed on some Lenovo Thinkpad
73+ * systems which will not be able to output audio via HDMI without
74+ * a BIOS workaround.
75+ */
76+ {"Linux-Lenovo-NV-HDMI-Audio", true},
6977 };
7078
7179 static u32 acpi_osi_handler(acpi_string interface, u32 supported)
drivers/acpi/property.c+97−112
@@ -542,6 +542,23 @@ static int acpi_data_get_property_array(const struct acpi_device_data *data, · 541 unmodified lines
542542 return 0;
543543 }
544544
545+static struct fwnode_handle *
546+acpi_fwnode_get_named_child_node(const struct fwnode_handle *fwnode,
547+ const char *childname)
548+{
549+ struct fwnode_handle *child;
550+
551+ /*
552+ * Find first matching named child node of this fwnode.
553+ * For ACPI this will be a data only sub-node.
554+ */
555+ fwnode_for_each_child_node(fwnode, child)
556+ if (acpi_data_node_match(child, childname))
557+ return child;
558+
559+ return NULL;
560+}
561+
545562 /**
546563 * __acpi_node_get_property_reference - returns handle to the referenced object
547564 * @fwnode: Firmware node to get the property from
@@ -579,7 +596,7 @@ static int acpi_data_get_property_array(const struct acpi_device_data *data, · 31 unmodified lines
579596 */
580597 int __acpi_node_get_property_reference(const struct fwnode_handle *fwnode,
581598 const char *propname, size_t index, size_t num_args,
582− struct acpi_reference_args *args)
599+ struct fwnode_reference_args *args)
583600 {
584601 const union acpi_object *element, *end;
585602 const union acpi_object *obj;
@@ -607,7 +624,7 @@ int __acpi_node_get_property_reference(const struct fwnode_handle *fwnode, · 21 unmodified lines
607624 if (ret)
608625 return ret == -ENODEV ? -EINVAL : ret;
609626
610− args->adev = device;
627+ args->fwnode = acpi_fwnode_handle(device);
611628 args->nargs = 0;
612629 return 0;
613630 }
@@ -633,6 +650,8 @@ int __acpi_node_get_property_reference(const struct fwnode_handle *fwnode, · 19 unmodified lines
633650 u32 nargs, i;
634651
635652 if (element->type == ACPI_TYPE_LOCAL_REFERENCE) {
653+ struct fwnode_handle *ref_fwnode;
654+
636655 ret = acpi_bus_get_device(element->reference.handle,
637656 &device);
638657 if (ret)
@@ -641,6 +660,19 @@ int __acpi_node_get_property_reference(const struct fwnode_handle *fwnode, · 2 unmodified lines
641660 nargs = 0;
642661 element++;
643662
663+ /*
664+ * Find the referred data extension node under the
665+ * referred device node.
666+ */
667+ for (ref_fwnode = acpi_fwnode_handle(device);
668+ element < end && element->type == ACPI_TYPE_STRING;
669+ element++) {
670+ ref_fwnode = acpi_fwnode_get_named_child_node(
671+ ref_fwnode, element->string.pointer);
672+ if (!ref_fwnode)
673+ return -EINVAL;
674+ }
675+
644676 /* assume following integer elements are all args */
645677 for (i = 0; element + i < end && i < num_args; i++) {
646678 int type = element[i].type;
@@ -653,11 +685,11 @@ int __acpi_node_get_property_reference(const struct fwnode_handle *fwnode, · 6 unmodified lines
653685 return -EINVAL;
654686 }
655687
656− if (nargs > MAX_ACPI_REFERENCE_ARGS)
688+ if (nargs > NR_FWNODE_REFERENCE_ARGS)
657689 return -EINVAL;
658690
659691 if (idx == index) {
660− args->adev = device;
692+ args->fwnode = ref_fwnode;
661693 args->nargs = nargs;
662694 for (i = 0; i < nargs; i++)
663695 args->args[i] = element[i].integer.value;
@@ -995,16 +1027,36 @@ struct fwnode_handle *acpi_node_get_parent(const struct fwnode_handle *fwnode) · 331 unmodified lines
9951027 return NULL;
9961028 }
9971029
1030+/*
1031+ * Return true if the node is an ACPI graph node. Called on either ports
1032+ * or endpoints.
1033+ */
1034+static bool is_acpi_graph_node(struct fwnode_handle *fwnode,
1035+ const char *str)
1036+{
1037+ unsigned int len = strlen(str);
1038+ const char *name;
1039+
1040+ if (!len || !is_acpi_data_node(fwnode))
1041+ return false;
1042+
1043+ name = to_acpi_data_node(fwnode)->name;
1044+
1045+ return (fwnode_property_present(fwnode, "reg") &&
1046+ !strncmp(name, str, len) && name[len] == '@') ||
1047+ fwnode_property_present(fwnode, str);
1048+}
1049+
9981050 /**
9991051 * acpi_graph_get_next_endpoint - Get next endpoint ACPI firmware node
10001052 * @fwnode: Pointer to the parent firmware node
10011053 * @prev: Previous endpoint node or %NULL to get the first
10021054 *
10031055 * Looks up next endpoint ACPI firmware node below a given @fwnode. Returns
1004− * %NULL if there is no next endpoint, ERR_PTR() in case of error. In case
1005− * of success the next endpoint is returned.
1056+ * %NULL if there is no next endpoint or in case of error. In case of success
1057+ * the next endpoint is returned.
10061058 */
1007−struct fwnode_handle *acpi_graph_get_next_endpoint(
1059+static struct fwnode_handle *acpi_graph_get_next_endpoint(
10081060 const struct fwnode_handle *fwnode, struct fwnode_handle *prev)
10091061 {
10101062 struct fwnode_handle *port = NULL;
@@ -1013,8 +1065,14 @@ struct fwnode_handle *acpi_graph_get_next_endpoint( · 2 unmodified lines
10131065 if (!prev) {
10141066 do {
10151067 port = fwnode_get_next_child_node(fwnode, port);
1016− /* Ports must have port property */
1017− if (fwnode_property_present(port, "port"))
1068+ /*
1069+ * The names of the port nodes begin with "port@"
1070+ * followed by the number of the port node and they also
1071+ * have a "reg" property that also has the number of the
1072+ * port node. For compatibility reasons a node is also
1073+ * recognised as a port node from the "port" property.
1074+ */
1075+ if (is_acpi_graph_node(port, "port"))
10181076 break;
10191077 } while (port);
10201078 } else {
@@ -1029,15 +1087,19 @@ struct fwnode_handle *acpi_graph_get_next_endpoint( · 8 unmodified lines
10291087 port = fwnode_get_next_child_node(fwnode, port);
10301088 if (!port)
10311089 break;
1032− if (fwnode_property_present(port, "port"))
1090+ if (is_acpi_graph_node(port, "port"))
10331091 endpoint = fwnode_get_next_child_node(port, NULL);
10341092 }
10351093
1036− if (endpoint) {
1037− /* Endpoints must have "endpoint" property */
1038− if (!fwnode_property_present(endpoint, "endpoint"))
1039− return ERR_PTR(-EPROTO);
1040− }
1094+ /*
1095+ * The names of the endpoint nodes begin with "endpoint@" followed by
1096+ * the number of the endpoint node and they also have a "reg" property
1097+ * that also has the number of the endpoint node. For compatibility
1098+ * reasons a node is also recognised as an endpoint node from the
1099+ * "endpoint" property.
1100+ */
1101+ if (!is_acpi_graph_node(endpoint, "endpoint"))
1102+ return NULL;
10411103
10421104 return endpoint;
10431105 }
@@ -1074,65 +1136,42 @@ static struct fwnode_handle *acpi_graph_get_child_prop_value( · 30 unmodified lines
10741136 /**
10751137 * acpi_graph_get_remote_enpoint - Parses and returns remote end of an endpoint
10761138 * @fwnode: Endpoint firmware node pointing to a remote device
1077− * @parent: Firmware node of remote port parent is filled here if not %NULL
1078− * @port: Firmware node of remote port is filled here if not %NULL
10791139 * @endpoint: Firmware node of remote endpoint is filled here if not %NULL
10801140 *
1081− * Function parses remote end of ACPI firmware remote endpoint and fills in
1082− * fields requested by the caller. Returns %0 in case of success and
1083− * negative errno otherwise.
1141+ * Returns the remote endpoint corresponding to @__fwnode. NULL on error.
10841142 */
1085−int acpi_graph_get_remote_endpoint(const struct fwnode_handle *__fwnode,
1086− struct fwnode_handle **parent,
1087− struct fwnode_handle **port,
1088− struct fwnode_handle **endpoint)
1143+static struct fwnode_handle *
1144+acpi_graph_get_remote_endpoint(const struct fwnode_handle *__fwnode)
10891145 {
10901146 struct fwnode_handle *fwnode;
10911147 unsigned int port_nr, endpoint_nr;
1092− struct acpi_reference_args args;
1148+ struct fwnode_reference_args args;
10931149 int ret;
10941150
10951151 memset(&args, 0, sizeof(args));
10961152 ret = acpi_node_get_property_reference(__fwnode, "remote-endpoint", 0,
10971153 &args);
10981154 if (ret)
1099− return ret;
1155+ return NULL;
1156+
1157+ /* Direct endpoint reference? */
1158+ if (!is_acpi_device_node(args.fwnode))
1159+ return args.nargs ? NULL : args.fwnode;
11001160
11011161 /*
11021162 * Always require two arguments with the reference: port and
11031163 * endpoint indices.
11041164 */
11051165 if (args.nargs != 2)
1106− return -EPROTO;
1166+ return NULL;
11071167
1108− fwnode = acpi_fwnode_handle(args.adev);
1168+ fwnode = args.fwnode;
11091169 port_nr = args.args[0];
11101170 endpoint_nr = args.args[1];
11111171
1112− if (parent)
1113− *parent = fwnode;
1114−
1115− if (!port && !endpoint)
1116− return 0;
1117−
11181172 fwnode = acpi_graph_get_child_prop_value(fwnode, "port", port_nr);
1119− if (!fwnode)
1120− return -EPROTO;
1121−
1122− if (port)
1123− *port = fwnode;
1124−
1125− if (!endpoint)
1126− return 0;
11271173
1128− fwnode = acpi_graph_get_child_prop_value(fwnode, "endpoint",
1129− endpoint_nr);
1130− if (!fwnode)
1131− return -EPROTO;
1132−
1133− *endpoint = fwnode;
1134−
1135− return 0;
1174+ return acpi_graph_get_child_prop_value(fwnode, "endpoint", endpoint_nr);
11361175 }
11371176
11381177 static bool acpi_fwnode_device_is_available(const struct fwnode_handle *fwnode)
@@ -1186,70 +1225,14 @@ acpi_fwnode_property_read_string_array(const struct fwnode_handle *fwnode, · 47 unmodified lines
11861225 val, nval);
11871226 }
11881227
1189−static struct fwnode_handle *
1190−acpi_fwnode_get_named_child_node(const struct fwnode_handle *fwnode,
1191− const char *childname)
1192−{
1193− struct fwnode_handle *child;
1194−
1195− /*
1196− * Find first matching named child node of this fwnode.
1197− * For ACPI this will be a data only sub-node.
1198− */
1199− fwnode_for_each_child_node(fwnode, child)
1200− if (acpi_data_node_match(child, childname))
1201− return child;
1202−
1203− return NULL;
1204−}
1205−
12061228 static int
12071229 acpi_fwnode_get_reference_args(const struct fwnode_handle *fwnode,
12081230 const char *prop, const char *nargs_prop,
12091231 unsigned int args_count, unsigned int index,
12101232 struct fwnode_reference_args *args)
12111233 {
1212− struct acpi_reference_args acpi_args;
1213− unsigned int i;
1214− int ret;
1215−
1216− ret = __acpi_node_get_property_reference(fwnode, prop, index,
1217− args_count, &acpi_args);
1218− if (ret < 0)
1219− return ret;
1220− if (!args)
1221− return 0;
1222−
1223− args->nargs = acpi_args.nargs;
1224− args->fwnode = acpi_fwnode_handle(acpi_args.adev);
1225−
1226− for (i = 0; i < NR_FWNODE_REFERENCE_ARGS; i++)
1227− args->args[i] = i < acpi_args.nargs ? acpi_args.args[i] : 0;
1228−
1229− return 0;
1230−}
1231−
1232−static struct fwnode_handle *
1233−acpi_fwnode_graph_get_next_endpoint(const struct fwnode_handle *fwnode,
1234− struct fwnode_handle *prev)
1235−{
1236− struct fwnode_handle *endpoint;
1237−
1238− endpoint = acpi_graph_get_next_endpoint(fwnode, prev);
1239− if (IS_ERR(endpoint))
1240− return NULL;
1241−
1242− return endpoint;
1243−}
1244−
1245−static struct fwnode_handle *
1246−acpi_fwnode_graph_get_remote_endpoint(const struct fwnode_handle *fwnode)
1247−{
1248− struct fwnode_handle *endpoint = NULL;
1249−
1250− acpi_graph_get_remote_endpoint(fwnode, NULL, NULL, &endpoint);
1251−
1252− return endpoint;
1234+ return __acpi_node_get_property_reference(fwnode, prop, index,
1235+ args_count, args);
12531236 }
12541237
12551238 static struct fwnode_handle *
@@ -1265,8 +1248,10 @@ static int acpi_fwnode_graph_parse_endpoint(const struct fwnode_handle *fwnode, · 9 unmodified lines
12651248
12661249 endpoint->local_fwnode = fwnode;
12671250
1268− fwnode_property_read_u32(port_fwnode, "port", &endpoint->port);
1269− fwnode_property_read_u32(fwnode, "endpoint", &endpoint->id);
1251+ if (fwnode_property_read_u32(port_fwnode, "reg", &endpoint->port))
1252+ fwnode_property_read_u32(port_fwnode, "port", &endpoint->port);
1253+ if (fwnode_property_read_u32(fwnode, "reg", &endpoint->id))
1254+ fwnode_property_read_u32(fwnode, "endpoint", &endpoint->id);
12701255
12711256 return 0;
12721257 }
@@ -1292,9 +1277,9 @@ acpi_fwnode_device_get_match_data(const struct fwnode_handle *fwnode, · 19 unmodified lines
12921277 .get_named_child_node = acpi_fwnode_get_named_child_node, \
12931278 .get_reference_args = acpi_fwnode_get_reference_args, \
12941279 .graph_get_next_endpoint = \
1295− acpi_fwnode_graph_get_next_endpoint, \
1280+ acpi_graph_get_next_endpoint, \
12961281 .graph_get_remote_endpoint = \
1297− acpi_fwnode_graph_get_remote_endpoint, \
1282+ acpi_graph_get_remote_endpoint, \
12981283 .graph_get_port_parent = acpi_fwnode_get_parent, \
12991284 .graph_parse_endpoint = acpi_fwnode_graph_parse_endpoint, \
13001285 }; \
drivers/acpi/scan.c+20−3
@@ -1528,7 +1528,7 @@ static int acpi_check_serial_bus_slave(struct acpi_resource *ares, void *data) · 1527 unmodified lines
15281528 static bool acpi_is_indirect_io_slave(struct acpi_device *device)
15291529 {
15301530 struct acpi_device *parent = device->parent;
1531− const struct acpi_device_id indirect_io_hosts[] = {
1531+ static const struct acpi_device_id indirect_io_hosts[] = {
15321532 {"HISI0191", 0},
15331533 {}
15341534 };
@@ -1540,6 +1540,18 @@ static bool acpi_device_enumeration_by_parent(struct acpi_device *device) · 5 unmodified lines
15401540 {
15411541 struct list_head resource_list;
15421542 bool is_serial_bus_slave = false;
1543+ /*
1544+ * These devices have multiple I2cSerialBus resources and an i2c-client
1545+ * must be instantiated for each, each with its own i2c_device_id.
1546+ * Normally we only instantiate an i2c-client for the first resource,
1547+ * using the ACPI HID as id. These special cases are handled by the
1548+ * drivers/platform/x86/i2c-multi-instantiate.c driver, which knows
1549+ * which i2c_device_id to use for each resource.
1550+ */
1551+ static const struct acpi_device_id i2c_multi_instantiate_ids[] = {
1552+ {"BSG1160", },
1553+ {}
1554+ };
15431555
15441556 if (acpi_is_indirect_io_slave(device))
15451557 return true;
@@ -1551,6 +1563,10 @@ static bool acpi_device_enumeration_by_parent(struct acpi_device *device) · 5 unmodified lines
15511563 fwnode_property_present(&device->fwnode, "baud")))
15521564 return true;
15531565
1566+ /* Instantiate a pdev for the i2c-multi-instantiate drv to bind to */
1567+ if (!acpi_match_device_ids(device, i2c_multi_instantiate_ids))
1568+ return false;
1569+
15541570 INIT_LIST_HEAD(&resource_list);
15551571 acpi_dev_get_resources(device, &resource_list,
15561572 acpi_check_serial_bus_slave,
@@ -1612,7 +1628,8 @@ static int acpi_add_single_object(struct acpi_device **child, · 55 unmodified lines
16121628 * Note this must be done before the get power-/wakeup_dev-flags calls.
16131629 */
16141630 if (type == ACPI_BUS_TYPE_DEVICE)
1615− acpi_bus_get_status(device);
1631+ if (acpi_bus_get_status(device) < 0)
1632+ acpi_set_device_status(device, 0);
16161633
16171634 acpi_bus_get_power_flags(device);
16181635 acpi_bus_get_wakeup_device_flags(device);
@@ -1690,7 +1707,7 @@ static int acpi_bus_type_and_status(acpi_handle handle, int *type, · 71 unmodified lines
16901707 * acpi_add_single_object updates this once we've an acpi_device
16911708 * so that acpi_bus_get_status' quirk handling can be used.
16921709 */
1693− *sta = 0;
1710+ *sta = ACPI_STA_DEFAULT;
16941711 break;
16951712 case ACPI_TYPE_PROCESSOR:
16961713 *type = ACPI_BUS_TYPE_PROCESSOR;
drivers/acpi/x86/utils.c+9−13
@@ -62,14 +62,20 @@ static const struct always_present_id always_present_ids[] = { · 61 unmodified lines
6262 */
6363 ENTRY("INT0002", "1", ICPU(INTEL_FAM6_ATOM_AIRMONT), {}),
6464 /*
65− * On the Dell Venue 11 Pro 7130 the DSDT hides the touchscreen ACPI
66− * device until a certain time after _SB.PCI0.GFX0.LCD.LCD1._ON gets
67− * called has passed *and* _STA has been called at least 3 times since.
65+ * On the Dell Venue 11 Pro 7130 and 7139, the DSDT hides
66+ * the touchscreen ACPI device until a certain time
67+ * after _SB.PCI0.GFX0.LCD.LCD1._ON gets called has passed
68+ * *and* _STA has been called at least 3 times since.
6869 */
6970 ENTRY("SYNA7500", "1", ICPU(INTEL_FAM6_HASWELL_ULT), {
7071 DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
7172 DMI_MATCH(DMI_PRODUCT_NAME, "Venue 11 Pro 7130"),
7273 }),
74+ ENTRY("SYNA7500", "1", ICPU(INTEL_FAM6_HASWELL_ULT), {
75+ DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
76+ DMI_MATCH(DMI_PRODUCT_NAME, "Venue 11 Pro 7139"),
77+ }),
78+
7379 /*
7480 * The GPD win BIOS dated 20170221 has disabled the accelerometer, the
7581 * drivers sometimes cause crashes under Windows and this is how the
@@ -103,13 +109,9 @@ static const struct always_present_id always_present_ids[] = { · 27 unmodified lines
103109
104110 bool acpi_device_always_present(struct acpi_device *adev)
105111 {
106− u32 *status = (u32 *)&adev->status;
107− u32 old_status = *status;
108112 bool ret = false;
109113 unsigned int i;
110114
111− /* acpi_match_device_ids checks status, so set it to default */
112− *status = ACPI_STA_DEFAULT;
113115 for (i = 0; i < ARRAY_SIZE(always_present_ids); i++) {
114116 if (acpi_match_device_ids(adev, always_present_ids[i].hid))
115117 continue;
@@ -125,15 +127,9 @@ bool acpi_device_always_present(struct acpi_device *adev) · 9 unmodified lines
125127 !dmi_check_system(always_present_ids[i].dmi_ids))
126128 continue;
127129
128− if (old_status != ACPI_STA_DEFAULT) /* Log only once */
129− dev_info(&adev->dev,
130− "Device [%s] is in always present list\n",
131− adev->pnp.bus_id);
132−
133130 ret = true;
134131 break;
135132 }
136− *status = old_status;
137133
138134 return ret;
139135 }
drivers/gpio/gpiolib-acpi.c+7−4
@@ -389,7 +389,7 @@ EXPORT_SYMBOL_GPL(devm_acpi_dev_remove_driver_gpios); · 388 unmodified lines
389389
390390 static bool acpi_get_driver_gpio_data(struct acpi_device *adev,
391391 const char *name, int index,
392− struct acpi_reference_args *args,
392+ struct fwnode_reference_args *args,
393393 unsigned int *quirks)
394394 {
395395 const struct acpi_gpio_mapping *gm;
@@ -401,7 +401,7 @@ static bool acpi_get_driver_gpio_data(struct acpi_device *adev, · 5 unmodified lines
401401 if (!strcmp(name, gm->name) && gm->data && index < gm->size) {
402402 const struct acpi_gpio_params *par = gm->data + index;
403403
404− args->adev = adev;
404+ args->fwnode = acpi_fwnode_handle(adev);
405405 args->args[0] = par->crs_entry_index;
406406 args->args[1] = par->line_index;
407407 args->args[2] = par->active_low;
@@ -564,7 +564,7 @@ static int acpi_gpio_property_lookup(struct fwnode_handle *fwnode, · 156 unmodified lines
564564 const char *propname, int index,
565565 struct acpi_gpio_lookup *lookup)
566566 {
567− struct acpi_reference_args args;
567+ struct fwnode_reference_args args;
568568 unsigned int quirks = 0;
569569 int ret;
570570
@@ -585,6 +585,8 @@ static int acpi_gpio_property_lookup(struct fwnode_handle *fwnode, · 14 unmodified lines
585585 * The property was found and resolved, so need to lookup the GPIO based
586586 * on returned args.
587587 */
588+ if (!to_acpi_device_node(args.fwnode))
589+ return -EINVAL;
588590 if (args.nargs != 3)
589591 return -EPROTO;
590592
@@ -592,8 +594,9 @@ static int acpi_gpio_property_lookup(struct fwnode_handle *fwnode, · 1 unmodified line
592594 lookup->pin_index = args.args[1];
593595 lookup->active_low = !!args.args[2];
594596
595− lookup->info.adev = args.adev;
597+ lookup->info.adev = to_acpi_device_node(args.fwnode);
596598 lookup->info.quirks = quirks;
599+
597600 return 0;
598601 }
599602
drivers/infiniband/hw/hns/hns_roce_hw_v1.c+4−6
@@ -1435,7 +1435,7 @@ static int hns_roce_v1_reset(struct hns_roce_dev *hr_dev, bool dereset) · 1434 unmodified lines
14351435 }
14361436 fwnode = &dsaf_node->fwnode;
14371437 } else if (is_acpi_device_node(dev->fwnode)) {
1438− struct acpi_reference_args args;
1438+ struct fwnode_reference_args args;
14391439
14401440 ret = acpi_node_get_property_reference(dev->fwnode,
14411441 "dsaf-handle", 0, &args);
@@ -1443,7 +1443,7 @@ static int hns_roce_v1_reset(struct hns_roce_dev *hr_dev, bool dereset) · 1 unmodified line
14431443 dev_err(dev, "could not find dsaf-handle\n");
14441444 return ret;
14451445 }
1446− fwnode = acpi_fwnode_handle(args.adev);
1446+ fwnode = args.fwnode;
14471447 } else {
14481448 dev_err(dev, "cannot read data from DT or ACPI\n");
14491449 return -ENXIO;
@@ -4835,16 +4835,14 @@ static int hns_roce_get_cfg(struct hns_roce_dev *hr_dev) · 3385 unmodified lines
48354835 continue;
48364836 pdev = of_find_device_by_node(net_node);
48374837 } else if (is_acpi_device_node(dev->fwnode)) {
4838− struct acpi_reference_args args;
4839− struct fwnode_handle *fwnode;
4838+ struct fwnode_reference_args args;
48404839
48414840 ret = acpi_node_get_property_reference(dev->fwnode,
48424841 "eth-handle",
48434842 i, &args);
48444843 if (ret)
48454844 continue;
4846− fwnode = acpi_fwnode_handle(args.adev);
4847− pdev = hns_roce_find_pdev(fwnode);
4845+ pdev = hns_roce_find_pdev(args.fwnode);
48484846 } else {
48494847 dev_err(dev, "cannot read data from DT or ACPI\n");
48504848 return -ENXIO;
drivers/media/v4l2-core/v4l2-fwnode.c+1−1
@@ -739,7 +739,7 @@ static struct fwnode_handle *v4l2_fwnode_reference_get_int_prop( · 738 unmodified lines
739739 const char * const *props, unsigned int nprops)
740740 {
741741 struct fwnode_reference_args fwnode_args;
742− unsigned int *args = fwnode_args.args;
742+ u64 *args = fwnode_args.args;
743743 struct fwnode_handle *child;
744744 int ret;
745745
drivers/net/ethernet/apm/xgene/xgene_enet_hw.c+3−3
@@ -836,19 +836,19 @@ static void xgene_enet_adjust_link(struct net_device *ndev) · 835 unmodified lines
836836 #ifdef CONFIG_ACPI
837837 static struct acpi_device *acpi_phy_find_device(struct device *dev)
838838 {
839− struct acpi_reference_args args;
839+ struct fwnode_reference_args args;
840840 struct fwnode_handle *fw_node;
841841 int status;
842842
843843 fw_node = acpi_fwnode_handle(ACPI_COMPANION(dev));
844844 status = acpi_node_get_property_reference(fw_node, "phy-handle", 0,
845845 &args);
846− if (ACPI_FAILURE(status)) {
846+ if (ACPI_FAILURE(status) || !is_acpi_device_node(args.fwnode)) {
847847 dev_dbg(dev, "No matching phy in ACPI table\n");
848848 return NULL;
849849 }
850850
851− return args.adev;
851+ return to_acpi_device_node(args.fwnode);
852852 }
853853 #endif
854854
drivers/net/ethernet/hisilicon/hns/hns_dsaf_mac.c+4−2
@@ -708,7 +708,7 @@ hns_mac_register_phydev(struct mii_bus *mdio, struct hns_mac_cb *mac_cb, · 707 unmodified lines
708708
709709 static int hns_mac_register_phy(struct hns_mac_cb *mac_cb)
710710 {
711− struct acpi_reference_args args;
711+ struct fwnode_reference_args args;
712712 struct platform_device *pdev;
713713 struct mii_bus *mii_bus;
714714 int rc;
@@ -722,13 +722,15 @@ static int hns_mac_register_phy(struct hns_mac_cb *mac_cb) · 7 unmodified lines
722722 mac_cb->fw_port, "mdio-node", 0, &args);
723723 if (rc)
724724 return rc;
725+ if (!is_acpi_device_node(args.fwnode))
726+ return -EINVAL;
725727
726728 addr = hns_mac_phy_parse_addr(mac_cb->dev, mac_cb->fw_port);
727729 if (addr < 0)
728730 return addr;
729731
730732 /* dev address in adev */
731− pdev = hns_dsaf_find_platform_device(acpi_fwnode_handle(args.adev));
733+ pdev = hns_dsaf_find_platform_device(args.fwnode);
732734 if (!pdev) {
733735 dev_err(mac_cb->dev, "mac%d mdio pdev is NULL\n",
734736 mac_cb->mac_id);
drivers/net/ethernet/hisilicon/hns/hns_enet.c+6−2
@@ -2377,7 +2377,7 @@ static int hns_nic_dev_probe(struct platform_device *pdev) · 2376 unmodified lines
23772377 }
23782378 priv->fwnode = &ae_node->fwnode;
23792379 } else if (is_acpi_node(dev->fwnode)) {
2380− struct acpi_reference_args args;
2380+ struct fwnode_reference_args args;
23812381
23822382 if (acpi_dev_found(hns_enet_acpi_match[0].id))
23832383 priv->enet_ver = AE_VERSION_1;
@@ -2393,7 +2393,11 @@ static int hns_nic_dev_probe(struct platform_device *pdev) · 9 unmodified lines
23932393 dev_err(dev, "not find ae-handle\n");
23942394 goto out_read_prop_fail;
23952395 }
2396− priv->fwnode = acpi_fwnode_handle(args.adev);
2396+ if (!is_acpi_device_node(args.fwnode)) {
2397+ ret = -EINVAL;
2398+ goto out_read_prop_fail;
2399+ }
2400+ priv->fwnode = args.fwnode;
23972401 } else {
23982402 dev_err(dev, "cannot read cfg data from OF or acpi\n");
23992403 return -ENXIO;
drivers/platform/x86/Kconfig+11−0
@@ -1218,6 +1218,17 @@ config INTEL_CHTDC_TI_PWRBTN · 1217 unmodified lines
12181218 To compile this driver as a module, choose M here: the module
12191219 will be called intel_chtdc_ti_pwrbtn.
12201220
1221+config I2C_MULTI_INSTANTIATE
1222+ tristate "I2C multi instantiate pseudo device driver"
1223+ depends on I2C && ACPI
1224+ help
1225+ Some ACPI-based systems list multiple i2c-devices in a single ACPI
1226+ firmware-node. This driver will instantiate separate i2c-clients
1227+ for each device in the firmware-node.
1228+
1229+ To compile this driver as a module, choose M here: the module
1230+ will be called i2c-multi-instantiate.
1231+
12211232 endif # X86_PLATFORM_DEVICES
12221233
12231234 config PMC_ATOM
drivers/platform/x86/Makefile+1−0
@@ -91,3 +91,4 @@ obj-$(CONFIG_PMC_ATOM) += pmc_atom.o · 90 unmodified lines
9191 obj-$(CONFIG_MLX_PLATFORM) += mlx-platform.o
9292 obj-$(CONFIG_INTEL_TURBO_MAX_3) += intel_turbo_max_3.o
9393 obj-$(CONFIG_INTEL_CHTDC_TI_PWRBTN) += intel_chtdc_ti_pwrbtn.o
94+obj-$(CONFIG_I2C_MULTI_INSTANTIATE) += i2c-multi-instantiate.o
drivers/platform/x86/i2c-multi-instantiate.c+132−0
@@ -0,0 +1,132 @@
1+// SPDX-License-Identifier: GPL-2.0+
2+/*
3+ * I2C multi-instantiate driver, pseudo driver to instantiate multiple
4+ * i2c-clients from a single fwnode.
5+ *
6+ * Copyright 2018 Hans de Goede <hdegoede@redhat.com>
7+ */
8+
9+#include <linux/acpi.h>
10+#include <linux/i2c.h>
11+#include <linux/interrupt.h>
12+#include <linux/kernel.h>
13+#include <linux/module.h>
14+#include <linux/platform_device.h>
15+
16+struct i2c_inst_data {
17+ const char *type;
18+ int gpio_irq_idx;
19+};
20+
21+struct i2c_multi_inst_data {
22+ int num_clients;
23+ struct i2c_client *clients[0];
24+};
25+
26+static int i2c_multi_inst_probe(struct platform_device *pdev)
27+{
28+ struct i2c_multi_inst_data *multi;
29+ const struct acpi_device_id *match;
30+ const struct i2c_inst_data *inst_data;
31+ struct i2c_board_info board_info = {};
32+ struct device *dev = &pdev->dev;
33+ struct acpi_device *adev;
34+ char name[32];
35+ int i, ret;
36+
37+ match = acpi_match_device(dev->driver->acpi_match_table, dev);
38+ if (!match) {
39+ dev_err(dev, "Error ACPI match data is missing\n");
40+ return -ENODEV;
41+ }
42+ inst_data = (const struct i2c_inst_data *)match->driver_data;
43+
44+ adev = ACPI_COMPANION(dev);
45+
46+ /* Count number of clients to instantiate */
47+ for (i = 0; inst_data[i].type; i++) {}
48+
49+ multi = devm_kmalloc(dev,
50+ offsetof(struct i2c_multi_inst_data, clients[i]),
51+ GFP_KERNEL);
52+ if (!multi)
53+ return -ENOMEM;
54+
55+ multi->num_clients = i;
56+
57+ for (i = 0; i < multi->num_clients; i++) {
58+ memset(&board_info, 0, sizeof(board_info));
59+ strlcpy(board_info.type, inst_data[i].type, I2C_NAME_SIZE);
60+ snprintf(name, sizeof(name), "%s-%s", match->id,
61+ inst_data[i].type);
62+ board_info.dev_name = name;
63+ board_info.irq = 0;
64+ if (inst_data[i].gpio_irq_idx != -1) {
65+ ret = acpi_dev_gpio_irq_get(adev,
66+ inst_data[i].gpio_irq_idx);
67+ if (ret < 0) {
68+ dev_err(dev, "Error requesting irq at index %d: %d\n",
69+ inst_data[i].gpio_irq_idx, ret);
70+ goto error;
71+ }
72+ board_info.irq = ret;
73+ }
74+ multi->clients[i] = i2c_acpi_new_device(dev, i, &board_info);
75+ if (!multi->clients[i]) {
76+ dev_err(dev, "Error creating i2c-client, idx %d\n", i);
77+ ret = -ENODEV;
78+ goto error;
79+ }
80+ }
81+
82+ platform_set_drvdata(pdev, multi);
83+ return 0;
84+
85+error:
86+ while (--i >= 0)
87+ i2c_unregister_device(multi->clients[i]);
88+
89+ return ret;
90+}
91+
92+static int i2c_multi_inst_remove(struct platform_device *pdev)
93+{
94+ struct i2c_multi_inst_data *multi = platform_get_drvdata(pdev);
95+ int i;
96+
97+ for (i = 0; i < multi->num_clients; i++)
98+ i2c_unregister_device(multi->clients[i]);
99+
100+ return 0;
101+}
102+
103+static const struct i2c_inst_data bsg1160_data[] = {
104+ { "bmc150_accel", 0 },
105+ { "bmc150_magn", -1 },
106+ { "bmg160", -1 },
107+ {}
108+};
109+
110+/*
111+ * Note new device-ids must also be added to i2c_multi_instantiate_ids in
112+ * drivers/acpi/scan.c: acpi_device_enumeration_by_parent().
113+ */
114+static const struct acpi_device_id i2c_multi_inst_acpi_ids[] = {
115+ { "BSG1160", (unsigned long)bsg1160_data },
116+ { }
117+};
118+MODULE_DEVICE_TABLE(acpi, i2c_multi_inst_acpi_ids);
119+
120+static struct platform_driver i2c_multi_inst_driver = {
121+ .driver = {
122+ .name = "I2C multi instantiate pseudo device driver",
123+ .acpi_match_table = ACPI_PTR(i2c_multi_inst_acpi_ids),
124+ },
125+ .probe = i2c_multi_inst_probe,
126+ .remove = i2c_multi_inst_remove,
127+};
128+module_platform_driver(i2c_multi_inst_driver);
129+
130+MODULE_DESCRIPTION("I2C multi instantiate pseudo device driver");
131+MODULE_AUTHOR("Hans de Goede <hdegoede@redhat.com>");
132+MODULE_LICENSE("GPL");
include/acpi/acpixf.h+1−1
@@ -12,7 +12,7 @@ · 11 unmodified lines
1212
1313 /* Current ACPICA subsystem version in YYYYMMDD format */
1414
15−#define ACPI_CA_VERSION 0x20180531
15+#define ACPI_CA_VERSION 0x20180629
1616
1717 #include <acpi/acconfig.h>
1818 #include <acpi/actypes.h>
include/acpi/ghes.h+4−0
@@ -118,6 +118,10 @@ static inline void *acpi_hest_get_next(struct acpi_hest_generic_data *gdata) · 117 unmodified lines
118118 (void *)section - (void *)(estatus + 1) < estatus->data_length; \
119119 section = acpi_hest_get_next(section))
120120
121+#ifdef CONFIG_ACPI_APEI_SEA
121122 int ghes_notify_sea(void);
123+#else
124+static inline int ghes_notify_sea(void) { return -ENOENT; }
125+#endif
122126
123127 #endif /* GHES_H */
include/linux/acpi.h+5−20
@@ -1058,27 +1058,20 @@ static inline int acpi_dev_gpio_irq_get(struct acpi_device *adev, int index) · 1057 unmodified lines
10581058
10591059 /* Device properties */
10601060
1061−#define MAX_ACPI_REFERENCE_ARGS 8
1062−struct acpi_reference_args {
1063− struct acpi_device *adev;
1064− size_t nargs;
1065− u64 args[MAX_ACPI_REFERENCE_ARGS];
1066−};
1067−
10681061 #ifdef CONFIG_ACPI
10691062 int acpi_dev_get_property(const struct acpi_device *adev, const char *name,
10701063 acpi_object_type type, const union acpi_object **obj);
10711064 int __acpi_node_get_property_reference(const struct fwnode_handle *fwnode,
10721065 const char *name, size_t index, size_t num_args,
1073− struct acpi_reference_args *args);
1066+ struct fwnode_reference_args *args);
10741067
10751068 static inline int acpi_node_get_property_reference(
10761069 const struct fwnode_handle *fwnode,
10771070 const char *name, size_t index,
1078− struct acpi_reference_args *args)
1071+ struct fwnode_reference_args *args)
10791072 {
10801073 return __acpi_node_get_property_reference(fwnode, name, index,
1081− MAX_ACPI_REFERENCE_ARGS, args);
1074+ NR_FWNODE_REFERENCE_ARGS, args);
10821075 }
10831076
10841077 int acpi_node_prop_get(const struct fwnode_handle *fwnode, const char *propname,
@@ -1096,14 +1089,6 @@ struct fwnode_handle *acpi_get_next_subnode(const struct fwnode_handle *fwnode, · 11 unmodified lines
10961089 struct fwnode_handle *child);
10971090 struct fwnode_handle *acpi_node_get_parent(const struct fwnode_handle *fwnode);
10981091
1099−struct fwnode_handle *
1100−acpi_graph_get_next_endpoint(const struct fwnode_handle *fwnode,
1101− struct fwnode_handle *prev);
1102−int acpi_graph_get_remote_endpoint(const struct fwnode_handle *fwnode,
1103− struct fwnode_handle **remote,
1104− struct fwnode_handle **port,
1105− struct fwnode_handle **endpoint);
1106−
11071092 struct acpi_probe_entry;
11081093 typedef bool (*acpi_probe_entry_validate_subtbl)(struct acpi_subtable_header *,
11091094 struct acpi_probe_entry *);
@@ -1169,7 +1154,7 @@ static inline int acpi_dev_get_property(struct acpi_device *adev, · 59 unmodified lines
11691154 static inline int
11701155 __acpi_node_get_property_reference(const struct fwnode_handle *fwnode,
11711156 const char *name, size_t index, size_t num_args,
1172− struct acpi_reference_args *args)
1157+ struct fwnode_reference_args *args)
11731158 {
11741159 return -ENXIO;
11751160 }
@@ -1177,7 +1162,7 @@ __acpi_node_get_property_reference(const struct fwnode_handle *fwnode, · 1 unmodified line
11771162 static inline int
11781163 acpi_node_get_property_reference(const struct fwnode_handle *fwnode,
11791164 const char *name, size_t index,
1180− struct acpi_reference_args *args)
1165+ struct fwnode_reference_args *args)
11811166 {
11821167 return -ENXIO;
11831168 }
include/linux/fwnode.h+1−1
@@ -45,7 +45,7 @@ struct fwnode_endpoint { · 44 unmodified lines
4545 struct fwnode_reference_args {
4646 struct fwnode_handle *fwnode;
4747 unsigned int nargs;
48− unsigned int args[NR_FWNODE_REFERENCE_ARGS];
48+ u64 args[NR_FWNODE_REFERENCE_ARGS];
4949 };
5050
5151 /**

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t