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 @@
1Copyright (C) 2018 Intel Corporation
2Author: Sakari Ailus <sakari.ailus@linux.intel.com>
3
4
5Referencing hierarchical data nodes
6-----------------------------------
7
8ACPI in general allows referring to device objects in the tree only.
9Hierarchical data extension nodes may not be referred to directly, hence this
10document defines a scheme to implement such references.
11
12A reference consist of the device object name followed by one or more
13hierarchical data extension [1] keys. Specifically, the hierarchical data
14extension node which is referred to by the key shall lie directly under the
15parent object i.e. either the device object or another hierarchical data
16extension node.
17
18The 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-
20or postfixes). The same ACPI object shall include the _DSD property extension
21with a property "reg" that shall have the same numerical value as the number of
22the node.
23
24In 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
27extension key.
28
29
30Example
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
78Please also see a graph example in graph.txt .
79
80References
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
36[3]. A port represents an interface in a device, and an endpoint36[3]. A port represents an interface in a device, and an endpoint
37represents a connection to that interface.37represents a connection to that interface.
38 38
39All port nodes are located under the device's "_DSD" node in the39All port nodes are located under the device's "_DSD" node in the hierarchical
40hierarchical data extension tree. The property extension related to40data extension tree. The data extension related to each port node must begin
41each port node must contain the key "port" and an integer value which41with "port" and must be followed by the "@" character and the number of the port
42is the number of the port. The object it refers to should be called "PRTX",42as its key. The target object it refers to should be called "PRTX", where "X" is
43where "X" is the number of the port.43the number of the port. An example of such a package would be:
44 44
45Further on, endpoints are located under the individual port nodes. The45 Package() { "port@4", PRT4 }
46first hierarchical data extension package list entry of the endpoint46
47nodes must begin with "endpoint" and must be followed by the number47Further on, endpoints are located under the port nodes. The hierarchical
48of the endpoint. The object it refers to should be called "EPXY", where48data extension key of the endpoint nodes must begin with
49"X" is the number of the port and "Y" is the number of the endpoint.49"endpoint" and must be followed by the "@" character and the number of the
50 50endpoint. The object it refers to should be called "EPXY", where "X" is the
51Each port node contains a property extension key "port", the value of51number of the port and "Y" is the number of the endpoint. An example of such a
52which is the number of the port node. The each endpoint is similarly numbered52package would be:
53with a property extension key "endpoint". Port numbers must be unique within a53
54device and endpoint numbers must be unique within a port.54 Package() { "endpoint@0", EP40 }
55
56Each port node contains a property extension key "port", the value of which is
57the number of the port. Each endpoint is similarly numbered with a property
58extension key "reg", the value of which is the number of the endpoint. Port
59numbers must be unique within a device and endpoint numbers must be unique
60within a port. If a device object may only has a single port, then the number
61of that port shall be zero. Similarly, if a port may only have a single
62endpoint, the number of that endpoint shall be zero.
55 63
56The endpoint reference uses property extension with "remote-endpoint" property64The endpoint reference uses property extension with "remote-endpoint" property
57name followed by a reference in the same package. Such references consist of the65name followed by a reference in the same package. Such references consist of the
58the remote device reference, number of the port in the device and finally the66the remote device reference, the first package entry of the port data extension
59number of the endpoint in that port. Individual references thus appear as:67reference under the device and finally the first package entry of the endpoint
68data extension reference under the port. Individual references thus appear as:
60 69
61 Package() { device, port_number, endpoint_number }70 Package() { device, "port@X", "endpoint@Y" }
71
72In the above example, "X" is the number of the port and "Y" is the number of the
73endpoint.
62 74
63The references to endpoints must be always done both ways, to the75The references to endpoints must be always done both ways, to the
64remote endpoint and back from the referred remote endpoint node.76remote endpoint and back from the referred remote endpoint node.
@@ -76,24 +88,24 @@ A simple example of this is show below: · 11 unmodified lines
76 },88 },
77 ToUUID("dbb8e3e6-5886-4ba6-8795-1319f52a966b"),89 ToUUID("dbb8e3e6-5886-4ba6-8795-1319f52a966b"),
78 Package () {90 Package () {
79 Package () { "port0", "PRT0" },91 Package () { "port@0", PRT0 },
80 }92 }
81 })93 })
82 Name (PRT0, Package() {94 Name (PRT0, Package() {
83 ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"),95 ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"),
84 Package () {96 Package () {
85 Package () { "port", 0 },97 Package () { "reg", 0 },
86 },98 },
87 ToUUID("dbb8e3e6-5886-4ba6-8795-1319f52a966b"),99 ToUUID("dbb8e3e6-5886-4ba6-8795-1319f52a966b"),
88 Package () {100 Package () {
89 Package () { "endpoint0", "EP00" },101 Package () { "endpoint@0", EP00 },
90 }102 }
91 })103 })
92 Name (EP00, Package() {104 Name (EP00, Package() {
93 ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"),105 ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"),
94 Package () {106 Package () {
95 Package () { "endpoint", 0 },107 Package () { "reg", 0 },
96 Package () { "remote-endpoint", Package() { \_SB.PCI0.ISP, 4, 0 } },108 Package () { "remote-endpoint", Package() { \_SB.PCI0.ISP, "port@4", "endpoint@0" } },
97 }109 }
98 })110 })
99 }111 }
@@ -106,26 +118,26 @@ A simple example of this is show below: · 6 unmodified lines
106 Name (_DSD, Package () {118 Name (_DSD, Package () {
107 ToUUID("dbb8e3e6-5886-4ba6-8795-1319f52a966b"),119 ToUUID("dbb8e3e6-5886-4ba6-8795-1319f52a966b"),
108 Package () {120 Package () {
109 Package () { "port4", "PRT4" },121 Package () { "port@4", PRT4 },
110 }122 }
111 })123 })
112 124
113 Name (PRT4, Package() {125 Name (PRT4, Package() {
114 ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"),126 ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"),
115 Package () {127 Package () {
116 Package () { "port", 4 }, /* CSI-2 port number */128 Package () { "reg", 4 }, /* CSI-2 port number */
117 },129 },
118 ToUUID("dbb8e3e6-5886-4ba6-8795-1319f52a966b"),130 ToUUID("dbb8e3e6-5886-4ba6-8795-1319f52a966b"),
119 Package () {131 Package () {
120 Package () { "endpoint0", "EP40" },132 Package () { "endpoint@0", EP40 },
121 }133 }
122 })134 })
123 135
124 Name (EP40, Package() {136 Name (EP40, Package() {
125 ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"),137 ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"),
126 Package () {138 Package () {
127 Package () { "endpoint", 0 },139 Package () { "reg", 0 },
128 Package () { "remote-endpoint", Package () { \_SB.PCI0.I2C2.CAM0, 0, 0 } },140 Package () { "remote-endpoint", Package () { \_SB.PCI0.I2C2.CAM0, "port@0", "endpoint@0" } },
129 }141 }
130 })142 })
131 }143 }
@@ -151,7 +163,7 @@ References · 19 unmodified lines
151 referenced 2016-10-04.163 referenced 2016-10-04.
152 164
153[5] Hierarchical Data Extension UUID For _DSD.165[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>,
155 referenced 2016-10-04.167 referenced 2016-10-04.
156 168
157[6] Advanced Configuration and Power Interface Specification.169[6] Advanced Configuration and Power Interface Specification.
MAINTAINERS+6−0
@@ -367,6 +367,12 @@ L: linux-acpi@vger.kernel.org · 366 unmodified lines
367S: Maintained367S: Maintained
368F: drivers/acpi/arm64368F: drivers/acpi/arm64
369 369
370ACPI I2C MULTI INSTANTIATE DRIVER
371M: Hans de Goede <hdegoede@redhat.com>
372L: platform-driver-x86@vger.kernel.org
373S: Maintained
374F: drivers/platform/x86/i2c-multi-instantiate.c
375
370ACPI PMIC DRIVERS376ACPI PMIC DRIVERS
371M: "Rafael J. Wysocki" <rjw@rjwysocki.net>377M: "Rafael J. Wysocki" <rjw@rjwysocki.net>
372M: Len Brown <lenb@kernel.org>378M: 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
727 727
728int handle_guest_sea(phys_addr_t addr, unsigned int esr)728int handle_guest_sea(phys_addr_t addr, unsigned int esr)
729{729{
730 int ret = -ENOENT;730 return ghes_notify_sea();
731
732 if (IS_ENABLED(CONFIG_ACPI_APEI_SEA))
733 ret = ghes_notify_sea();
734
735 return ret;
736}731}
737 732
738asmlinkage void __exception do_mem_abort(unsigned long addr, unsigned int esr,733asmlinkage 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
165#define ANOBJ_EVALUATED 0x20 /* Set on first evaluation of node */165#define ANOBJ_EVALUATED 0x20 /* Set on first evaluation of node */
166#define ANOBJ_ALLOCATED_BUFFER 0x40 /* Method AML buffer is dynamic (install_method) */166#define ANOBJ_ALLOCATED_BUFFER 0x40 /* Method AML buffer is dynamic (install_method) */
167 167
168#define IMPLICIT_EXTERNAL 0x02 /* iASL only: This object created implicitly via External */
169#define ANOBJ_IS_EXTERNAL 0x08 /* iASL only: This object created via External() */168#define ANOBJ_IS_EXTERNAL 0x08 /* iASL only: This object created via External() */
170#define ANOBJ_METHOD_NO_RETVAL 0x10 /* iASL only: Method has no return value */169#define ANOBJ_METHOD_NO_RETVAL 0x10 /* iASL only: Method has no return value */
171#define ANOBJ_METHOD_SOME_NO_RETVAL 0x20 /* iASL only: Method has at least one return value */170#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
613 /* Special handling for the last segment (num_segments == 0) */613 /* Special handling for the last segment (num_segments == 0) */
614 614
615 else {615 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
623 /*616 /*
624 * Sanity typecheck of the target object:617 * Sanity typecheck of the target object:
625 *618 *
drivers/acpi/acpica/nssearch.c+0−1
@@ -381,7 +381,6 @@ acpi_ns_search_and_enter(u32 target_name, · 380 unmodified lines
381 if (flags & ACPI_NS_EXTERNAL ||381 if (flags & ACPI_NS_EXTERNAL ||
382 (walk_state && walk_state->opcode == AML_SCOPE_OP)) {382 (walk_state && walk_state->opcode == AML_SCOPE_OP)) {
383 new_node->flags |= ANOBJ_IS_EXTERNAL;383 new_node->flags |= ANOBJ_IS_EXTERNAL;
384 new_node->flags |= IMPLICIT_EXTERNAL;
385 }384 }
386#endif385#endif
387 386
drivers/acpi/battery.c+44−25
@@ -23,18 +23,18 @@ · 22 unmodified lines
23 23
24#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt24#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
25 25
26#include <linux/async.h>
27#include <linux/delay.h>
28#include <linux/dmi.h>
29#include <linux/jiffies.h>
26#include <linux/kernel.h>30#include <linux/kernel.h>
27#include <linux/list.h>31#include <linux/list.h>
28#include <linux/module.h>32#include <linux/module.h>
29#include <linux/mutex.h>33#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>
36#include <linux/slab.h>34#include <linux/slab.h>
37#include <linux/suspend.h>35#include <linux/suspend.h>
36#include <linux/types.h>
37
38#include <asm/unaligned.h>38#include <asm/unaligned.h>
39 39
40#ifdef CONFIG_ACPI_PROCFS_POWER40#ifdef CONFIG_ACPI_PROCFS_POWER
@@ -364,6 +364,20 @@ static enum power_supply_property energy_battery_props[] = { · 323 unmodified lines
364 POWER_SUPPLY_PROP_SERIAL_NUMBER,364 POWER_SUPPLY_PROP_SERIAL_NUMBER,
365};365};
366 366
367static 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
367/* --------------------------------------------------------------------------381/* --------------------------------------------------------------------------
368 Battery Management382 Battery Management
369 -------------------------------------------------------------------------- */383 -------------------------------------------------------------------------- */
@@ -577,8 +591,7 @@ static int acpi_battery_get_state(struct acpi_battery *battery) · 207 unmodified lines
577 battery->rate_now != ACPI_BATTERY_VALUE_UNKNOWN &&591 battery->rate_now != ACPI_BATTERY_VALUE_UNKNOWN &&
578 (s16)(battery->rate_now) < 0) {592 (s16)(battery->rate_now) < 0) {
579 battery->rate_now = abs((s16)battery->rate_now);593 battery->rate_now = abs((s16)battery->rate_now);
580 printk_once(KERN_WARNING FW_BUG594 pr_warn_once(FW_BUG "battery: (dis)charge rate invalid.\n");
581 "battery: (dis)charge rate invalid.\n");
582 }595 }
583 596
584 if (test_bit(ACPI_BATTERY_QUIRK_PERCENTAGE_CAPACITY, &battery->flags)597 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
799 battery->bat_desc.properties = charge_battery_props;812 battery->bat_desc.properties = charge_battery_props;
800 battery->bat_desc.num_properties =813 battery->bat_desc.num_properties =
801 ARRAY_SIZE(charge_battery_props);814 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);
802 } else {820 } else {
803 battery->bat_desc.properties = energy_battery_props;821 battery->bat_desc.properties = energy_battery_props;
804 battery->bat_desc.num_properties =822 battery->bat_desc.num_properties =
@@ -918,10 +936,11 @@ static void acpi_battery_quirks(struct acpi_battery *battery) · 113 unmodified lines
918 936
919static int acpi_battery_update(struct acpi_battery *battery, bool resume)937static int acpi_battery_update(struct acpi_battery *battery, bool resume)
920{938{
921 int result, old_present = acpi_battery_present(battery);939 int result = acpi_battery_get_status(battery);
922 result = acpi_battery_get_status(battery);940
923 if (result)941 if (result)
924 return result;942 return result;
943
925 if (!acpi_battery_present(battery)) {944 if (!acpi_battery_present(battery)) {
926 sysfs_remove_battery(battery);945 sysfs_remove_battery(battery);
927 battery->update_time = 0;946 battery->update_time = 0;
@@ -931,8 +950,7 @@ static int acpi_battery_update(struct acpi_battery *battery, bool resume) · 3 unmodified lines
931 if (resume)950 if (resume)
932 return 0;951 return 0;
933 952
934 if (!battery->update_time ||953 if (!battery->update_time) {
935 old_present != acpi_battery_present(battery)) {
936 result = acpi_battery_get_info(battery);954 result = acpi_battery_get_info(battery);
937 if (result)955 if (result)
938 return result;956 return result;
@@ -1021,7 +1039,7 @@ static int acpi_battery_info_proc_show(struct seq_file *seq, void *offset) · 82 unmodified lines
1021 acpi_battery_units(battery));1039 acpi_battery_units(battery));
1022 1040
1023 seq_printf(seq, "battery technology: %srechargeable\n",1041 seq_printf(seq, "battery technology: %srechargeable\n",
1024 (!battery->technology)?"non-":"");1042 battery->technology ? "" : "non-");
1025 1043
1026 if (battery->design_voltage == ACPI_BATTERY_VALUE_UNKNOWN)1044 if (battery->design_voltage == ACPI_BATTERY_VALUE_UNKNOWN)
1027 seq_printf(seq, "design voltage: unknown\n");1045 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
1112 goto end;1130 goto end;
1113 }1131 }
1114 seq_printf(seq, "alarm: ");1132 seq_printf(seq, "alarm: ");
1115 if (!battery->alarm)1133 if (battery->alarm) {
1116 seq_printf(seq, "unsupported\n");
1117 else
1118 seq_printf(seq, "%u %sh\n", battery->alarm,1134 seq_printf(seq, "%u %sh\n", battery->alarm,
1119 acpi_battery_units(battery));1135 acpi_battery_units(battery));
1136 } else {
1137 seq_printf(seq, "unsupported\n");
1138 }
1120 end:1139 end:
1121 if (result)1140 if (result)
1122 seq_printf(seq, "ERROR: Unable to read battery alarm\n");1141 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
1149 }1168 }
1150 result = acpi_battery_set_alarm(battery);1169 result = acpi_battery_set_alarm(battery);
1151 end:1170 end:
1152 if (!result)1171 if (result)
1153 return count;1172 return result;
1154 return result;1173 return count;
1155}1174}
1156 1175
1157static int acpi_battery_alarm_proc_open(struct inode *inode, struct file *file)1176static 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
1170 1189
1171static int acpi_battery_add_fs(struct acpi_device *device)1190static int acpi_battery_add_fs(struct acpi_device *device)
1172{1191{
1173 printk(KERN_WARNING PREFIX "Deprecated procfs I/F for battery is loaded,"1192 pr_warning(PREFIX "Deprecated procfs I/F for battery is loaded, please retry with CONFIG_ACPI_PROCFS_POWER cleared\n");
1174 " please retry with CONFIG_ACPI_PROCFS_POWER cleared\n");
1175 if (!acpi_device_dir(device)) {1193 if (!acpi_device_dir(device)) {
1176 acpi_device_dir(device) = proc_mkdir(acpi_device_bid(device),1194 acpi_device_dir(device) = proc_mkdir(acpi_device_bid(device),
1177 acpi_battery_dir);1195 acpi_battery_dir);
@@ -1247,7 +1265,9 @@ static int battery_notify(struct notifier_block *nb, · 69 unmodified lines
1247 if (!acpi_battery_present(battery))1265 if (!acpi_battery_present(battery))
1248 return 0;1266 return 0;
1249 1267
1250 if (!battery->bat) {1268 if (battery->bat) {
1269 acpi_battery_refresh(battery);
1270 } else {
1251 result = acpi_battery_get_info(battery);1271 result = acpi_battery_get_info(battery);
1252 if (result)1272 if (result)
1253 return result;1273 return result;
@@ -1255,8 +1275,7 @@ static int battery_notify(struct notifier_block *nb, · 1 unmodified line
1255 result = sysfs_add_battery(battery);1275 result = sysfs_add_battery(battery);
1256 if (result)1276 if (result)
1257 return result;1277 return result;
1258 } else1278 }
1259 acpi_battery_refresh(battery);
1260 1279
1261 acpi_battery_init_alarm(battery);1280 acpi_battery_init_alarm(battery);
1262 acpi_battery_get_state(battery);1281 acpi_battery_get_state(battery);
@@ -1398,7 +1417,7 @@ static int acpi_battery_add(struct acpi_device *device) · 135 unmodified lines
1398 }1417 }
1399#endif1418#endif
1400 1419
1401 printk(KERN_INFO PREFIX "%s Slot [%s] (battery %s)\n",1420 pr_info(PREFIX "%s Slot [%s] (battery %s)\n",
1402 ACPI_BATTERY_DEVICE_NAME, acpi_device_bid(device),1421 ACPI_BATTERY_DEVICE_NAME, acpi_device_bid(device),
1403 device->status.battery_present ? "present" : "absent");1422 device->status.battery_present ? "present" : "absent");
1404 1423
drivers/acpi/bus.c+8−32
@@ -66,37 +66,10 @@ static int set_copy_dsdt(const struct dmi_system_id *id) · 65 unmodified lines
66 return 0;66 return 0;
67}67}
68#endif68#endif
69static int set_gbl_term_list(const struct dmi_system_id *id)
70{
71 acpi_gbl_execute_tables_as_methods = 1;
72 return 0;
73}
74 69
75static const struct dmi_system_id acpi_quirks_dmi_table[] __initconst = {70static const struct dmi_system_id dsdt_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 },
97 /*71 /*
98 * Invoke DSDT corruption work-around on all Toshiba Satellite.72 * Invoke DSDT corruption work-around on all Toshiba Satellite.
99 * DSDT will be copied to memory.
100 * https://bugzilla.kernel.org/show_bug.cgi?id=1467973 * https://bugzilla.kernel.org/show_bug.cgi?id=14679
101 */74 */
102 {75 {
@@ -110,7 +83,7 @@ static const struct dmi_system_id acpi_quirks_dmi_table[] __initconst = { · 7 unmodified lines
110 {}83 {}
111};84};
112#else85#else
113static const struct dmi_system_id acpi_quirks_dmi_table[] __initconst = {86static const struct dmi_system_id dsdt_dmi_table[] __initconst = {
114 {}87 {}
115};88};
116#endif89#endif
@@ -962,7 +935,7 @@ static int acpi_device_probe(struct device *dev) · 845 unmodified lines
962 return 0;935 return 0;
963}936}
964 937
965static int acpi_device_remove(struct device * dev)938static int acpi_device_remove(struct device *dev)
966{939{
967 struct acpi_device *acpi_dev = to_acpi_device(dev);940 struct acpi_device *acpi_dev = to_acpi_device(dev);
968 struct acpi_driver *acpi_drv = acpi_dev->driver;941 struct acpi_driver *acpi_drv = acpi_dev->driver;
@@ -1060,8 +1033,11 @@ void __init acpi_early_init(void) · 91 unmodified lines
1060 1033
1061 acpi_permanent_mmap = true;1034 acpi_permanent_mmap = true;
1062 1035
1063 /* Check machine-specific quirks */1036 /*
1064 dmi_check_system(acpi_quirks_dmi_table);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);
1065 1041
1066 status = acpi_reallocate_root_table();1042 status = acpi_reallocate_root_table();
1067 if (ACPI_FAILURE(status)) {1043 if (ACPI_FAILURE(status)) {
drivers/acpi/button.c+10−7
@@ -21,6 +21,7 @@ · 20 unmodified lines
21 21
22#define pr_fmt(fmt) "ACPI: button: " fmt22#define pr_fmt(fmt) "ACPI: button: " fmt
23 23
24#include <linux/compiler.h>
24#include <linux/kernel.h>25#include <linux/kernel.h>
25#include <linux/module.h>26#include <linux/module.h>
26#include <linux/init.h>27#include <linux/init.h>
@@ -235,9 +236,6 @@ static int acpi_lid_notify_state(struct acpi_device *device, int state) · 208 unmodified lines
235 button->last_time = ktime_get();236 button->last_time = ktime_get();
236 }237 }
237 238
238 if (state)
239 acpi_pm_wakeup_event(&device->dev);
240
241 ret = blocking_notifier_call_chain(&acpi_lid_notifier, state, device);239 ret = blocking_notifier_call_chain(&acpi_lid_notifier, state, device);
242 if (ret == NOTIFY_DONE)240 if (ret == NOTIFY_DONE)
243 ret = blocking_notifier_call_chain(&acpi_lid_notifier, state,241 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
252 return ret;250 return ret;
253}251}
254 252
255static int acpi_button_state_seq_show(struct seq_file *seq, void *offset)253static int __maybe_unused acpi_button_state_seq_show(struct seq_file *seq,
254 void *offset)
256{255{
257 struct acpi_device *device = seq->private;256 struct acpi_device *device = seq->private;
258 int state;257 int state;
@@ -366,7 +365,8 @@ int acpi_lid_open(void) · 107 unmodified lines
366}365}
367EXPORT_SYMBOL(acpi_lid_open);366EXPORT_SYMBOL(acpi_lid_open);
368 367
369static int acpi_lid_update_state(struct acpi_device *device)368static int acpi_lid_update_state(struct acpi_device *device,
369 bool signal_wakeup)
370{370{
371 int state;371 int state;
372 372
@@ -374,6 +374,9 @@ static int acpi_lid_update_state(struct acpi_device *device) · 1 unmodified line
374 if (state < 0)374 if (state < 0)
375 return state;375 return state;
376 376
377 if (state && signal_wakeup)
378 acpi_pm_wakeup_event(&device->dev);
379
377 return acpi_lid_notify_state(device, state);380 return acpi_lid_notify_state(device, state);
378}381}
379 382
@@ -384,7 +387,7 @@ static void acpi_lid_initialize_state(struct acpi_device *device) · 4 unmodified lines
384 (void)acpi_lid_notify_state(device, 1);387 (void)acpi_lid_notify_state(device, 1);
385 break;388 break;
386 case ACPI_BUTTON_LID_INIT_METHOD:389 case ACPI_BUTTON_LID_INIT_METHOD:
387 (void)acpi_lid_update_state(device);390 (void)acpi_lid_update_state(device, false);
388 break;391 break;
389 case ACPI_BUTTON_LID_INIT_IGNORE:392 case ACPI_BUTTON_LID_INIT_IGNORE:
390 default:393 default:
@@ -409,7 +412,7 @@ static void acpi_button_notify(struct acpi_device *device, u32 event) · 18 unmodified lines
409 users = button->input->users;412 users = button->input->users;
410 mutex_unlock(&button->input->mutex);413 mutex_unlock(&button->input->mutex);
411 if (users)414 if (users)
412 acpi_lid_update_state(device);415 acpi_lid_update_state(device, true);
413 } else {416 } else {
414 int keycode;417 int keycode;
415 418
drivers/acpi/ec.c+14−0
@@ -2045,6 +2045,20 @@ static const struct dmi_system_id acpi_ec_no_wakeup[] = { · 2044 unmodified lines
2045 DMI_MATCH(DMI_PRODUCT_FAMILY, "Thinkpad X1 Carbon 6th"),2045 DMI_MATCH(DMI_PRODUCT_FAMILY, "Thinkpad X1 Carbon 6th"),
2046 },2046 },
2047 },2047 },
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 },
2048 { },2062 { },
2049};2063};
2050 2064
drivers/acpi/osi.c+8−0
@@ -66,6 +66,14 @@ osi_setup_entries[OSI_STRING_ENTRIES_MAX] __initdata = { · 65 unmodified lines
66 * be removed if both new and old graphics cards are supported.66 * be removed if both new and old graphics cards are supported.
67 */67 */
68 {"Linux-Dell-Video", true},68 {"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},
69};77};
70 78
71static u32 acpi_osi_handler(acpi_string interface, u32 supported)79static 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
542 return 0;542 return 0;
543}543}
544 544
545static struct fwnode_handle *
546acpi_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
545/**562/**
546 * __acpi_node_get_property_reference - returns handle to the referenced object563 * __acpi_node_get_property_reference - returns handle to the referenced object
547 * @fwnode: Firmware node to get the property from564 * @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
579 */596 */
580int __acpi_node_get_property_reference(const struct fwnode_handle *fwnode,597int __acpi_node_get_property_reference(const struct fwnode_handle *fwnode,
581 const char *propname, size_t index, size_t num_args,598 const char *propname, size_t index, size_t num_args,
582 struct acpi_reference_args *args)599 struct fwnode_reference_args *args)
583{600{
584 const union acpi_object *element, *end;601 const union acpi_object *element, *end;
585 const union acpi_object *obj;602 const union acpi_object *obj;
@@ -607,7 +624,7 @@ int __acpi_node_get_property_reference(const struct fwnode_handle *fwnode, · 21 unmodified lines
607 if (ret)624 if (ret)
608 return ret == -ENODEV ? -EINVAL : ret;625 return ret == -ENODEV ? -EINVAL : ret;
609 626
610 args->adev = device;627 args->fwnode = acpi_fwnode_handle(device);
611 args->nargs = 0;628 args->nargs = 0;
612 return 0;629 return 0;
613 }630 }
@@ -633,6 +650,8 @@ int __acpi_node_get_property_reference(const struct fwnode_handle *fwnode, · 19 unmodified lines
633 u32 nargs, i;650 u32 nargs, i;
634 651
635 if (element->type == ACPI_TYPE_LOCAL_REFERENCE) {652 if (element->type == ACPI_TYPE_LOCAL_REFERENCE) {
653 struct fwnode_handle *ref_fwnode;
654
636 ret = acpi_bus_get_device(element->reference.handle,655 ret = acpi_bus_get_device(element->reference.handle,
637 &device);656 &device);
638 if (ret)657 if (ret)
@@ -641,6 +660,19 @@ int __acpi_node_get_property_reference(const struct fwnode_handle *fwnode, · 2 unmodified lines
641 nargs = 0;660 nargs = 0;
642 element++;661 element++;
643 662
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
644 /* assume following integer elements are all args */676 /* assume following integer elements are all args */
645 for (i = 0; element + i < end && i < num_args; i++) {677 for (i = 0; element + i < end && i < num_args; i++) {
646 int type = element[i].type;678 int type = element[i].type;
@@ -653,11 +685,11 @@ int __acpi_node_get_property_reference(const struct fwnode_handle *fwnode, · 6 unmodified lines
653 return -EINVAL;685 return -EINVAL;
654 }686 }
655 687
656 if (nargs > MAX_ACPI_REFERENCE_ARGS)688 if (nargs > NR_FWNODE_REFERENCE_ARGS)
657 return -EINVAL;689 return -EINVAL;
658 690
659 if (idx == index) {691 if (idx == index) {
660 args->adev = device;692 args->fwnode = ref_fwnode;
661 args->nargs = nargs;693 args->nargs = nargs;
662 for (i = 0; i < nargs; i++)694 for (i = 0; i < nargs; i++)
663 args->args[i] = element[i].integer.value;695 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
995 return NULL;1027 return NULL;
996}1028}
997 1029
1030/*
1031 * Return true if the node is an ACPI graph node. Called on either ports
1032 * or endpoints.
1033 */
1034static 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
998/**1050/**
999 * acpi_graph_get_next_endpoint - Get next endpoint ACPI firmware node1051 * acpi_graph_get_next_endpoint - Get next endpoint ACPI firmware node
1000 * @fwnode: Pointer to the parent firmware node1052 * @fwnode: Pointer to the parent firmware node
1001 * @prev: Previous endpoint node or %NULL to get the first1053 * @prev: Previous endpoint node or %NULL to get the first
1002 *1054 *
1003 * Looks up next endpoint ACPI firmware node below a given @fwnode. Returns1055 * 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 case1056 * %NULL if there is no next endpoint or in case of error. In case of success
1005 * of success the next endpoint is returned.1057 * the next endpoint is returned.
1006 */1058 */
1007struct fwnode_handle *acpi_graph_get_next_endpoint(1059static struct fwnode_handle *acpi_graph_get_next_endpoint(
1008 const struct fwnode_handle *fwnode, struct fwnode_handle *prev)1060 const struct fwnode_handle *fwnode, struct fwnode_handle *prev)
1009{1061{
1010 struct fwnode_handle *port = NULL;1062 struct fwnode_handle *port = NULL;
@@ -1013,8 +1065,14 @@ struct fwnode_handle *acpi_graph_get_next_endpoint( · 2 unmodified lines
1013 if (!prev) {1065 if (!prev) {
1014 do {1066 do {
1015 port = fwnode_get_next_child_node(fwnode, port);1067 port = fwnode_get_next_child_node(fwnode, port);
1016 /* Ports must have port property */1068 /*
1017 if (fwnode_property_present(port, "port"))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"))
1018 break;1076 break;
1019 } while (port);1077 } while (port);
1020 } else {1078 } else {
@@ -1029,15 +1087,19 @@ struct fwnode_handle *acpi_graph_get_next_endpoint( · 8 unmodified lines
1029 port = fwnode_get_next_child_node(fwnode, port);1087 port = fwnode_get_next_child_node(fwnode, port);
1030 if (!port)1088 if (!port)
1031 break;1089 break;
1032 if (fwnode_property_present(port, "port"))1090 if (is_acpi_graph_node(port, "port"))
1033 endpoint = fwnode_get_next_child_node(port, NULL);1091 endpoint = fwnode_get_next_child_node(port, NULL);
1034 }1092 }
1035 1093
1036 if (endpoint) {1094 /*
1037 /* Endpoints must have "endpoint" property */1095 * The names of the endpoint nodes begin with "endpoint@" followed by
1038 if (!fwnode_property_present(endpoint, "endpoint"))1096 * the number of the endpoint node and they also have a "reg" property
1039 return ERR_PTR(-EPROTO);1097 * that also has the number of the endpoint node. For compatibility
1040 }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;
1041 1103
1042 return endpoint;1104 return endpoint;
1043}1105}
@@ -1074,65 +1136,42 @@ static struct fwnode_handle *acpi_graph_get_child_prop_value( · 30 unmodified lines
1074/**1136/**
1075 * acpi_graph_get_remote_enpoint - Parses and returns remote end of an endpoint1137 * acpi_graph_get_remote_enpoint - Parses and returns remote end of an endpoint
1076 * @fwnode: Endpoint firmware node pointing to a remote device1138 * @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
1079 * @endpoint: Firmware node of remote endpoint is filled here if not %NULL1139 * @endpoint: Firmware node of remote endpoint is filled here if not %NULL
1080 *1140 *
1081 * Function parses remote end of ACPI firmware remote endpoint and fills in1141 * Returns the remote endpoint corresponding to @__fwnode. NULL on error.
1082 * fields requested by the caller. Returns %0 in case of success and
1083 * negative errno otherwise.
1084 */1142 */
1085int acpi_graph_get_remote_endpoint(const struct fwnode_handle *__fwnode,1143static struct fwnode_handle *
1086 struct fwnode_handle **parent,1144acpi_graph_get_remote_endpoint(const struct fwnode_handle *__fwnode)
1087 struct fwnode_handle **port,
1088 struct fwnode_handle **endpoint)
1089{1145{
1090 struct fwnode_handle *fwnode;1146 struct fwnode_handle *fwnode;
1091 unsigned int port_nr, endpoint_nr;1147 unsigned int port_nr, endpoint_nr;
1092 struct acpi_reference_args args;1148 struct fwnode_reference_args args;
1093 int ret;1149 int ret;
1094 1150
1095 memset(&args, 0, sizeof(args));1151 memset(&args, 0, sizeof(args));
1096 ret = acpi_node_get_property_reference(__fwnode, "remote-endpoint", 0,1152 ret = acpi_node_get_property_reference(__fwnode, "remote-endpoint", 0,
1097 &args);1153 &args);
1098 if (ret)1154 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;
1100 1160
1101 /*1161 /*
1102 * Always require two arguments with the reference: port and1162 * Always require two arguments with the reference: port and
1103 * endpoint indices.1163 * endpoint indices.
1104 */1164 */
1105 if (args.nargs != 2)1165 if (args.nargs != 2)
1106 return -EPROTO;1166 return NULL;
1107 1167
1108 fwnode = acpi_fwnode_handle(args.adev);1168 fwnode = args.fwnode;
1109 port_nr = args.args[0];1169 port_nr = args.args[0];
1110 endpoint_nr = args.args[1];1170 endpoint_nr = args.args[1];
1111 1171
1112 if (parent)
1113 *parent = fwnode;
1114
1115 if (!port && !endpoint)
1116 return 0;
1117
1118 fwnode = acpi_graph_get_child_prop_value(fwnode, "port", port_nr);1172 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;
1127 1173
1128 fwnode = acpi_graph_get_child_prop_value(fwnode, "endpoint",1174 return acpi_graph_get_child_prop_value(fwnode, "endpoint", endpoint_nr);
1129 endpoint_nr);
1130 if (!fwnode)
1131 return -EPROTO;
1132
1133 *endpoint = fwnode;
1134
1135 return 0;
1136}1175}
1137 1176
1138static bool acpi_fwnode_device_is_available(const struct fwnode_handle *fwnode)1177static 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
1186 val, nval);1225 val, nval);
1187}1226}
1188 1227
1189static struct fwnode_handle *
1190acpi_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
1206static int1228static int
1207acpi_fwnode_get_reference_args(const struct fwnode_handle *fwnode,1229acpi_fwnode_get_reference_args(const struct fwnode_handle *fwnode,
1208 const char *prop, const char *nargs_prop,1230 const char *prop, const char *nargs_prop,
1209 unsigned int args_count, unsigned int index,1231 unsigned int args_count, unsigned int index,
1210 struct fwnode_reference_args *args)1232 struct fwnode_reference_args *args)
1211{1233{
1212 struct acpi_reference_args acpi_args;1234 return __acpi_node_get_property_reference(fwnode, prop, index,
1213 unsigned int i;1235 args_count, args);
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
1232static struct fwnode_handle *
1233acpi_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
1245static struct fwnode_handle *
1246acpi_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;
1253}1236}
1254 1237
1255static struct fwnode_handle *1238static struct fwnode_handle *
@@ -1265,8 +1248,10 @@ static int acpi_fwnode_graph_parse_endpoint(const struct fwnode_handle *fwnode, · 9 unmodified lines
1265 1248
1266 endpoint->local_fwnode = fwnode;1249 endpoint->local_fwnode = fwnode;
1267 1250
1268 fwnode_property_read_u32(port_fwnode, "port", &endpoint->port);1251 if (fwnode_property_read_u32(port_fwnode, "reg", &endpoint->port))
1269 fwnode_property_read_u32(fwnode, "endpoint", &endpoint->id);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);
1270 1255
1271 return 0;1256 return 0;
1272}1257}
@@ -1292,9 +1277,9 @@ acpi_fwnode_device_get_match_data(const struct fwnode_handle *fwnode, · 19 unmodified lines
1292 .get_named_child_node = acpi_fwnode_get_named_child_node, \1277 .get_named_child_node = acpi_fwnode_get_named_child_node, \
1293 .get_reference_args = acpi_fwnode_get_reference_args, \1278 .get_reference_args = acpi_fwnode_get_reference_args, \
1294 .graph_get_next_endpoint = \1279 .graph_get_next_endpoint = \
1295 acpi_fwnode_graph_get_next_endpoint, \1280 acpi_graph_get_next_endpoint, \
1296 .graph_get_remote_endpoint = \1281 .graph_get_remote_endpoint = \
1297 acpi_fwnode_graph_get_remote_endpoint, \1282 acpi_graph_get_remote_endpoint, \
1298 .graph_get_port_parent = acpi_fwnode_get_parent, \1283 .graph_get_port_parent = acpi_fwnode_get_parent, \
1299 .graph_parse_endpoint = acpi_fwnode_graph_parse_endpoint, \1284 .graph_parse_endpoint = acpi_fwnode_graph_parse_endpoint, \
1300 }; \1285 }; \
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
1528static bool acpi_is_indirect_io_slave(struct acpi_device *device)1528static bool acpi_is_indirect_io_slave(struct acpi_device *device)
1529{1529{
1530 struct acpi_device *parent = device->parent;1530 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[] = {
1532 {"HISI0191", 0},1532 {"HISI0191", 0},
1533 {}1533 {}
1534 };1534 };
@@ -1540,6 +1540,18 @@ static bool acpi_device_enumeration_by_parent(struct acpi_device *device) · 5 unmodified lines
1540{1540{
1541 struct list_head resource_list;1541 struct list_head resource_list;
1542 bool is_serial_bus_slave = false;1542 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 };
1543 1555
1544 if (acpi_is_indirect_io_slave(device))1556 if (acpi_is_indirect_io_slave(device))
1545 return true;1557 return true;
@@ -1551,6 +1563,10 @@ static bool acpi_device_enumeration_by_parent(struct acpi_device *device) · 5 unmodified lines
1551 fwnode_property_present(&device->fwnode, "baud")))1563 fwnode_property_present(&device->fwnode, "baud")))
1552 return true;1564 return true;
1553 1565
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
1554 INIT_LIST_HEAD(&resource_list);1570 INIT_LIST_HEAD(&resource_list);
1555 acpi_dev_get_resources(device, &resource_list,1571 acpi_dev_get_resources(device, &resource_list,
1556 acpi_check_serial_bus_slave,1572 acpi_check_serial_bus_slave,
@@ -1612,7 +1628,8 @@ static int acpi_add_single_object(struct acpi_device **child, · 55 unmodified lines
1612 * Note this must be done before the get power-/wakeup_dev-flags calls.1628 * Note this must be done before the get power-/wakeup_dev-flags calls.
1613 */1629 */
1614 if (type == ACPI_BUS_TYPE_DEVICE)1630 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);
1616 1633
1617 acpi_bus_get_power_flags(device);1634 acpi_bus_get_power_flags(device);
1618 acpi_bus_get_wakeup_device_flags(device);1635 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
1690 * acpi_add_single_object updates this once we've an acpi_device1707 * acpi_add_single_object updates this once we've an acpi_device
1691 * so that acpi_bus_get_status' quirk handling can be used.1708 * so that acpi_bus_get_status' quirk handling can be used.
1692 */1709 */
1693 *sta = 0;1710 *sta = ACPI_STA_DEFAULT;
1694 break;1711 break;
1695 case ACPI_TYPE_PROCESSOR:1712 case ACPI_TYPE_PROCESSOR:
1696 *type = ACPI_BUS_TYPE_PROCESSOR;1713 *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
62 */62 */
63 ENTRY("INT0002", "1", ICPU(INTEL_FAM6_ATOM_AIRMONT), {}),63 ENTRY("INT0002", "1", ICPU(INTEL_FAM6_ATOM_AIRMONT), {}),
64 /*64 /*
65 * On the Dell Venue 11 Pro 7130 the DSDT hides the touchscreen ACPI65 * On the Dell Venue 11 Pro 7130 and 7139, the DSDT hides
66 * device until a certain time after _SB.PCI0.GFX0.LCD.LCD1._ON gets66 * the touchscreen ACPI device until a certain time
67 * called has passed *and* _STA has been called at least 3 times since.67 * after _SB.PCI0.GFX0.LCD.LCD1._ON gets called has passed
68 * *and* _STA has been called at least 3 times since.
68 */69 */
69 ENTRY("SYNA7500", "1", ICPU(INTEL_FAM6_HASWELL_ULT), {70 ENTRY("SYNA7500", "1", ICPU(INTEL_FAM6_HASWELL_ULT), {
70 DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),71 DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
71 DMI_MATCH(DMI_PRODUCT_NAME, "Venue 11 Pro 7130"),72 DMI_MATCH(DMI_PRODUCT_NAME, "Venue 11 Pro 7130"),
72 }),73 }),
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
73 /*79 /*
74 * The GPD win BIOS dated 20170221 has disabled the accelerometer, the80 * The GPD win BIOS dated 20170221 has disabled the accelerometer, the
75 * drivers sometimes cause crashes under Windows and this is how the81 * 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
103 109
104bool acpi_device_always_present(struct acpi_device *adev)110bool acpi_device_always_present(struct acpi_device *adev)
105{111{
106 u32 *status = (u32 *)&adev->status;
107 u32 old_status = *status;
108 bool ret = false;112 bool ret = false;
109 unsigned int i;113 unsigned int i;
110 114
111 /* acpi_match_device_ids checks status, so set it to default */
112 *status = ACPI_STA_DEFAULT;
113 for (i = 0; i < ARRAY_SIZE(always_present_ids); i++) {115 for (i = 0; i < ARRAY_SIZE(always_present_ids); i++) {
114 if (acpi_match_device_ids(adev, always_present_ids[i].hid))116 if (acpi_match_device_ids(adev, always_present_ids[i].hid))
115 continue;117 continue;
@@ -125,15 +127,9 @@ bool acpi_device_always_present(struct acpi_device *adev) · 9 unmodified lines
125 !dmi_check_system(always_present_ids[i].dmi_ids))127 !dmi_check_system(always_present_ids[i].dmi_ids))
126 continue;128 continue;
127 129
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
133 ret = true;130 ret = true;
134 break;131 break;
135 }132 }
136 *status = old_status;
137 133
138 return ret;134 return ret;
139}135}
drivers/gpio/gpiolib-acpi.c+7−4
@@ -389,7 +389,7 @@ EXPORT_SYMBOL_GPL(devm_acpi_dev_remove_driver_gpios); · 388 unmodified lines
389 389
390static bool acpi_get_driver_gpio_data(struct acpi_device *adev,390static bool acpi_get_driver_gpio_data(struct acpi_device *adev,
391 const char *name, int index,391 const char *name, int index,
392 struct acpi_reference_args *args,392 struct fwnode_reference_args *args,
393 unsigned int *quirks)393 unsigned int *quirks)
394{394{
395 const struct acpi_gpio_mapping *gm;395 const struct acpi_gpio_mapping *gm;
@@ -401,7 +401,7 @@ static bool acpi_get_driver_gpio_data(struct acpi_device *adev, · 5 unmodified lines
401 if (!strcmp(name, gm->name) && gm->data && index < gm->size) {401 if (!strcmp(name, gm->name) && gm->data && index < gm->size) {
402 const struct acpi_gpio_params *par = gm->data + index;402 const struct acpi_gpio_params *par = gm->data + index;
403 403
404 args->adev = adev;404 args->fwnode = acpi_fwnode_handle(adev);
405 args->args[0] = par->crs_entry_index;405 args->args[0] = par->crs_entry_index;
406 args->args[1] = par->line_index;406 args->args[1] = par->line_index;
407 args->args[2] = par->active_low;407 args->args[2] = par->active_low;
@@ -564,7 +564,7 @@ static int acpi_gpio_property_lookup(struct fwnode_handle *fwnode, · 156 unmodified lines
564 const char *propname, int index,564 const char *propname, int index,
565 struct acpi_gpio_lookup *lookup)565 struct acpi_gpio_lookup *lookup)
566{566{
567 struct acpi_reference_args args;567 struct fwnode_reference_args args;
568 unsigned int quirks = 0;568 unsigned int quirks = 0;
569 int ret;569 int ret;
570 570
@@ -585,6 +585,8 @@ static int acpi_gpio_property_lookup(struct fwnode_handle *fwnode, · 14 unmodified lines
585 * The property was found and resolved, so need to lookup the GPIO based585 * The property was found and resolved, so need to lookup the GPIO based
586 * on returned args.586 * on returned args.
587 */587 */
588 if (!to_acpi_device_node(args.fwnode))
589 return -EINVAL;
588 if (args.nargs != 3)590 if (args.nargs != 3)
589 return -EPROTO;591 return -EPROTO;
590 592
@@ -592,8 +594,9 @@ static int acpi_gpio_property_lookup(struct fwnode_handle *fwnode, · 1 unmodified line
592 lookup->pin_index = args.args[1];594 lookup->pin_index = args.args[1];
593 lookup->active_low = !!args.args[2];595 lookup->active_low = !!args.args[2];
594 596
595 lookup->info.adev = args.adev;597 lookup->info.adev = to_acpi_device_node(args.fwnode);
596 lookup->info.quirks = quirks;598 lookup->info.quirks = quirks;
599
597 return 0;600 return 0;
598}601}
599 602
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
1435 }1435 }
1436 fwnode = &dsaf_node->fwnode;1436 fwnode = &dsaf_node->fwnode;
1437 } else if (is_acpi_device_node(dev->fwnode)) {1437 } else if (is_acpi_device_node(dev->fwnode)) {
1438 struct acpi_reference_args args;1438 struct fwnode_reference_args args;
1439 1439
1440 ret = acpi_node_get_property_reference(dev->fwnode,1440 ret = acpi_node_get_property_reference(dev->fwnode,
1441 "dsaf-handle", 0, &args);1441 "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
1443 dev_err(dev, "could not find dsaf-handle\n");1443 dev_err(dev, "could not find dsaf-handle\n");
1444 return ret;1444 return ret;
1445 }1445 }
1446 fwnode = acpi_fwnode_handle(args.adev);1446 fwnode = args.fwnode;
1447 } else {1447 } else {
1448 dev_err(dev, "cannot read data from DT or ACPI\n");1448 dev_err(dev, "cannot read data from DT or ACPI\n");
1449 return -ENXIO;1449 return -ENXIO;
@@ -4835,16 +4835,14 @@ static int hns_roce_get_cfg(struct hns_roce_dev *hr_dev) · 3385 unmodified lines
4835 continue;4835 continue;
4836 pdev = of_find_device_by_node(net_node);4836 pdev = of_find_device_by_node(net_node);
4837 } else if (is_acpi_device_node(dev->fwnode)) {4837 } else if (is_acpi_device_node(dev->fwnode)) {
4838 struct acpi_reference_args args;4838 struct fwnode_reference_args args;
4839 struct fwnode_handle *fwnode;
4840 4839
4841 ret = acpi_node_get_property_reference(dev->fwnode,4840 ret = acpi_node_get_property_reference(dev->fwnode,
4842 "eth-handle",4841 "eth-handle",
4843 i, &args);4842 i, &args);
4844 if (ret)4843 if (ret)
4845 continue;4844 continue;
4846 fwnode = acpi_fwnode_handle(args.adev);4845 pdev = hns_roce_find_pdev(args.fwnode);
4847 pdev = hns_roce_find_pdev(fwnode);
4848 } else {4846 } else {
4849 dev_err(dev, "cannot read data from DT or ACPI\n");4847 dev_err(dev, "cannot read data from DT or ACPI\n");
4850 return -ENXIO;4848 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
739 const char * const *props, unsigned int nprops)739 const char * const *props, unsigned int nprops)
740{740{
741 struct fwnode_reference_args fwnode_args;741 struct fwnode_reference_args fwnode_args;
742 unsigned int *args = fwnode_args.args;742 u64 *args = fwnode_args.args;
743 struct fwnode_handle *child;743 struct fwnode_handle *child;
744 int ret;744 int ret;
745 745
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
836#ifdef CONFIG_ACPI836#ifdef CONFIG_ACPI
837static struct acpi_device *acpi_phy_find_device(struct device *dev)837static struct acpi_device *acpi_phy_find_device(struct device *dev)
838{838{
839 struct acpi_reference_args args;839 struct fwnode_reference_args args;
840 struct fwnode_handle *fw_node;840 struct fwnode_handle *fw_node;
841 int status;841 int status;
842 842
843 fw_node = acpi_fwnode_handle(ACPI_COMPANION(dev));843 fw_node = acpi_fwnode_handle(ACPI_COMPANION(dev));
844 status = acpi_node_get_property_reference(fw_node, "phy-handle", 0,844 status = acpi_node_get_property_reference(fw_node, "phy-handle", 0,
845 &args);845 &args);
846 if (ACPI_FAILURE(status)) {846 if (ACPI_FAILURE(status) || !is_acpi_device_node(args.fwnode)) {
847 dev_dbg(dev, "No matching phy in ACPI table\n");847 dev_dbg(dev, "No matching phy in ACPI table\n");
848 return NULL;848 return NULL;
849 }849 }
850 850
851 return args.adev;851 return to_acpi_device_node(args.fwnode);
852}852}
853#endif853#endif
854 854
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
708 708
709static int hns_mac_register_phy(struct hns_mac_cb *mac_cb)709static int hns_mac_register_phy(struct hns_mac_cb *mac_cb)
710{710{
711 struct acpi_reference_args args;711 struct fwnode_reference_args args;
712 struct platform_device *pdev;712 struct platform_device *pdev;
713 struct mii_bus *mii_bus;713 struct mii_bus *mii_bus;
714 int rc;714 int rc;
@@ -722,13 +722,15 @@ static int hns_mac_register_phy(struct hns_mac_cb *mac_cb) · 7 unmodified lines
722 mac_cb->fw_port, "mdio-node", 0, &args);722 mac_cb->fw_port, "mdio-node", 0, &args);
723 if (rc)723 if (rc)
724 return rc;724 return rc;
725 if (!is_acpi_device_node(args.fwnode))
726 return -EINVAL;
725 727
726 addr = hns_mac_phy_parse_addr(mac_cb->dev, mac_cb->fw_port);728 addr = hns_mac_phy_parse_addr(mac_cb->dev, mac_cb->fw_port);
727 if (addr < 0)729 if (addr < 0)
728 return addr;730 return addr;
729 731
730 /* dev address in adev */732 /* 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);
732 if (!pdev) {734 if (!pdev) {
733 dev_err(mac_cb->dev, "mac%d mdio pdev is NULL\n",735 dev_err(mac_cb->dev, "mac%d mdio pdev is NULL\n",
734 mac_cb->mac_id);736 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
2377 }2377 }
2378 priv->fwnode = &ae_node->fwnode;2378 priv->fwnode = &ae_node->fwnode;
2379 } else if (is_acpi_node(dev->fwnode)) {2379 } else if (is_acpi_node(dev->fwnode)) {
2380 struct acpi_reference_args args;2380 struct fwnode_reference_args args;
2381 2381
2382 if (acpi_dev_found(hns_enet_acpi_match[0].id))2382 if (acpi_dev_found(hns_enet_acpi_match[0].id))
2383 priv->enet_ver = AE_VERSION_1;2383 priv->enet_ver = AE_VERSION_1;
@@ -2393,7 +2393,11 @@ static int hns_nic_dev_probe(struct platform_device *pdev) · 9 unmodified lines
2393 dev_err(dev, "not find ae-handle\n");2393 dev_err(dev, "not find ae-handle\n");
2394 goto out_read_prop_fail;2394 goto out_read_prop_fail;
2395 }2395 }
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;
2397 } else {2401 } else {
2398 dev_err(dev, "cannot read cfg data from OF or acpi\n");2402 dev_err(dev, "cannot read cfg data from OF or acpi\n");
2399 return -ENXIO;2403 return -ENXIO;
drivers/platform/x86/Kconfig+11−0
@@ -1218,6 +1218,17 @@ config INTEL_CHTDC_TI_PWRBTN · 1217 unmodified lines
1218 To compile this driver as a module, choose M here: the module1218 To compile this driver as a module, choose M here: the module
1219 will be called intel_chtdc_ti_pwrbtn.1219 will be called intel_chtdc_ti_pwrbtn.
1220 1220
1221config 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
1221endif # X86_PLATFORM_DEVICES1232endif # X86_PLATFORM_DEVICES
1222 1233
1223config PMC_ATOM1234config PMC_ATOM
drivers/platform/x86/Makefile+1−0
@@ -91,3 +91,4 @@ obj-$(CONFIG_PMC_ATOM) += pmc_atom.o · 90 unmodified lines
91obj-$(CONFIG_MLX_PLATFORM) += mlx-platform.o91obj-$(CONFIG_MLX_PLATFORM) += mlx-platform.o
92obj-$(CONFIG_INTEL_TURBO_MAX_3) += intel_turbo_max_3.o92obj-$(CONFIG_INTEL_TURBO_MAX_3) += intel_turbo_max_3.o
93obj-$(CONFIG_INTEL_CHTDC_TI_PWRBTN) += intel_chtdc_ti_pwrbtn.o93obj-$(CONFIG_INTEL_CHTDC_TI_PWRBTN) += intel_chtdc_ti_pwrbtn.o
94obj-$(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
16struct i2c_inst_data {
17 const char *type;
18 int gpio_irq_idx;
19};
20
21struct i2c_multi_inst_data {
22 int num_clients;
23 struct i2c_client *clients[0];
24};
25
26static 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
85error:
86 while (--i >= 0)
87 i2c_unregister_device(multi->clients[i]);
88
89 return ret;
90}
91
92static 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
103static 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 */
114static const struct acpi_device_id i2c_multi_inst_acpi_ids[] = {
115 { "BSG1160", (unsigned long)bsg1160_data },
116 { }
117};
118MODULE_DEVICE_TABLE(acpi, i2c_multi_inst_acpi_ids);
119
120static 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};
128module_platform_driver(i2c_multi_inst_driver);
129
130MODULE_DESCRIPTION("I2C multi instantiate pseudo device driver");
131MODULE_AUTHOR("Hans de Goede <hdegoede@redhat.com>");
132MODULE_LICENSE("GPL");
include/acpi/acpixf.h+1−1
@@ -12,7 +12,7 @@ · 11 unmodified lines
12 12
13/* Current ACPICA subsystem version in YYYYMMDD format */13/* Current ACPICA subsystem version in YYYYMMDD format */
14 14
15#define ACPI_CA_VERSION 0x2018053115#define ACPI_CA_VERSION 0x20180629
16 16
17#include <acpi/acconfig.h>17#include <acpi/acconfig.h>
18#include <acpi/actypes.h>18#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
118 (void *)section - (void *)(estatus + 1) < estatus->data_length; \118 (void *)section - (void *)(estatus + 1) < estatus->data_length; \
119 section = acpi_hest_get_next(section))119 section = acpi_hest_get_next(section))
120 120
121#ifdef CONFIG_ACPI_APEI_SEA
121int ghes_notify_sea(void);122int ghes_notify_sea(void);
123#else
124static inline int ghes_notify_sea(void) { return -ENOENT; }
125#endif
122 126
123#endif /* GHES_H */127#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
1058 1058
1059/* Device properties */1059/* Device properties */
1060 1060
1061#define MAX_ACPI_REFERENCE_ARGS 8
1062struct acpi_reference_args {
1063 struct acpi_device *adev;
1064 size_t nargs;
1065 u64 args[MAX_ACPI_REFERENCE_ARGS];
1066};
1067
1068#ifdef CONFIG_ACPI1061#ifdef CONFIG_ACPI
1069int acpi_dev_get_property(const struct acpi_device *adev, const char *name,1062int acpi_dev_get_property(const struct acpi_device *adev, const char *name,
1070 acpi_object_type type, const union acpi_object **obj);1063 acpi_object_type type, const union acpi_object **obj);
1071int __acpi_node_get_property_reference(const struct fwnode_handle *fwnode,1064int __acpi_node_get_property_reference(const struct fwnode_handle *fwnode,
1072 const char *name, size_t index, size_t num_args,1065 const char *name, size_t index, size_t num_args,
1073 struct acpi_reference_args *args);1066 struct fwnode_reference_args *args);
1074 1067
1075static inline int acpi_node_get_property_reference(1068static inline int acpi_node_get_property_reference(
1076 const struct fwnode_handle *fwnode,1069 const struct fwnode_handle *fwnode,
1077 const char *name, size_t index,1070 const char *name, size_t index,
1078 struct acpi_reference_args *args)1071 struct fwnode_reference_args *args)
1079{1072{
1080 return __acpi_node_get_property_reference(fwnode, name, index,1073 return __acpi_node_get_property_reference(fwnode, name, index,
1081 MAX_ACPI_REFERENCE_ARGS, args);1074 NR_FWNODE_REFERENCE_ARGS, args);
1082}1075}
1083 1076
1084int acpi_node_prop_get(const struct fwnode_handle *fwnode, const char *propname,1077int 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
1096 struct fwnode_handle *child);1089 struct fwnode_handle *child);
1097struct fwnode_handle *acpi_node_get_parent(const struct fwnode_handle *fwnode);1090struct fwnode_handle *acpi_node_get_parent(const struct fwnode_handle *fwnode);
1098 1091
1099struct fwnode_handle *
1100acpi_graph_get_next_endpoint(const struct fwnode_handle *fwnode,
1101 struct fwnode_handle *prev);
1102int 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
1107struct acpi_probe_entry;1092struct acpi_probe_entry;
1108typedef bool (*acpi_probe_entry_validate_subtbl)(struct acpi_subtable_header *,1093typedef bool (*acpi_probe_entry_validate_subtbl)(struct acpi_subtable_header *,
1109 struct acpi_probe_entry *);1094 struct acpi_probe_entry *);
@@ -1169,7 +1154,7 @@ static inline int acpi_dev_get_property(struct acpi_device *adev, · 59 unmodified lines
1169static inline int1154static inline int
1170__acpi_node_get_property_reference(const struct fwnode_handle *fwnode,1155__acpi_node_get_property_reference(const struct fwnode_handle *fwnode,
1171 const char *name, size_t index, size_t num_args,1156 const char *name, size_t index, size_t num_args,
1172 struct acpi_reference_args *args)1157 struct fwnode_reference_args *args)
1173{1158{
1174 return -ENXIO;1159 return -ENXIO;
1175}1160}
@@ -1177,7 +1162,7 @@ __acpi_node_get_property_reference(const struct fwnode_handle *fwnode, · 1 unmodified line
1177static inline int1162static inline int
1178acpi_node_get_property_reference(const struct fwnode_handle *fwnode,1163acpi_node_get_property_reference(const struct fwnode_handle *fwnode,
1179 const char *name, size_t index,1164 const char *name, size_t index,
1180 struct acpi_reference_args *args)1165 struct fwnode_reference_args *args)
1181{1166{
1182 return -ENXIO;1167 return -ENXIO;
1183}1168}
include/linux/fwnode.h+1−1
@@ -45,7 +45,7 @@ struct fwnode_endpoint { · 44 unmodified lines
45struct fwnode_reference_args {45struct fwnode_reference_args {
46 struct fwnode_handle *fwnode;46 struct fwnode_handle *fwnode;
47 unsigned int nargs;47 unsigned int nargs;
48 unsigned int args[NR_FWNODE_REFERENCE_ARGS];48 u64 args[NR_FWNODE_REFERENCE_ARGS];
49};49};
50 50
51/**51/**

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