From: Greg Kroah-Hartman Date: Mon, 26 Jun 2017 12:25:18 +0000 (+0200) Subject: 4.11-stable patches X-Git-Tag: v3.18.59~18 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=371603f2dd1944caf88b0fbcde89f8deb3dc2ab2;p=thirdparty%2Fkernel%2Fstable-queue.git 4.11-stable patches added patches: acpi-scan-apply-default-enumeration-to-devices-with-acpi-drivers.patch acpi-scan-fix-enumeration-for-special-spi-and-i2c-devices.patch --- diff --git a/queue-4.11/acpi-scan-apply-default-enumeration-to-devices-with-acpi-drivers.patch b/queue-4.11/acpi-scan-apply-default-enumeration-to-devices-with-acpi-drivers.patch new file mode 100644 index 00000000000..c979107a29c --- /dev/null +++ b/queue-4.11/acpi-scan-apply-default-enumeration-to-devices-with-acpi-drivers.patch @@ -0,0 +1,48 @@ +From f5beabfe61794d9a9d9549d387cda2bffd81e504 Mon Sep 17 00:00:00 2001 +From: "Rafael J. Wysocki" +Date: Mon, 17 Apr 2017 01:19:50 +0200 +Subject: ACPI / scan: Apply default enumeration to devices with ACPI drivers + +From: Rafael J. Wysocki + +commit f5beabfe61794d9a9d9549d387cda2bffd81e504 upstream. + +The current code in acpi_bus_attach() is inconsistent with respect +to device objects with ACPI drivers bound to them, as it allows +ACPI drivers to bind to device objects with existing "physical" +device companions, but it doesn't allow "physical" device objects +to be created for ACPI device objects with ACPI drivers bound to +them. Thus, in some cases, the outcome depends on the ordering +of events which is confusing at best. + +For this reason, modify acpi_bus_attach() to call +acpi_default_enumeration() for device objects with the +pnp.type.platform_id flag set regardless of whether or not +any ACPI drivers are bound to them. + +Signed-off-by: Rafael J. Wysocki +Reviewed-by: Mika Westerberg +Reviewed-by: Joey Lee +Cc: Jarkko Nikula +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/acpi/scan.c | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +--- a/drivers/acpi/scan.c ++++ b/drivers/acpi/scan.c +@@ -1866,10 +1866,10 @@ static void acpi_bus_attach(struct acpi_ + if (ret < 0) + return; + +- if (ret > 0 || !device->pnp.type.platform_id) +- acpi_device_set_enumerated(device); +- else ++ if (device->pnp.type.platform_id) + acpi_default_enumeration(device); ++ else ++ acpi_device_set_enumerated(device); + + ok: + list_for_each_entry(child, &device->children, node) diff --git a/queue-4.11/acpi-scan-fix-enumeration-for-special-spi-and-i2c-devices.patch b/queue-4.11/acpi-scan-fix-enumeration-for-special-spi-and-i2c-devices.patch new file mode 100644 index 00000000000..dec53232bd1 --- /dev/null +++ b/queue-4.11/acpi-scan-fix-enumeration-for-special-spi-and-i2c-devices.patch @@ -0,0 +1,163 @@ +From e4330d8bf669139a983255d1801733b64c2ae841 Mon Sep 17 00:00:00 2001 +From: Jarkko Nikula +Date: Mon, 19 Jun 2017 15:53:01 +0300 +Subject: ACPI / scan: Fix enumeration for special SPI and I2C devices + +From: Jarkko Nikula + +commit e4330d8bf669139a983255d1801733b64c2ae841 upstream. + +Commit f406270bf73d ("ACPI / scan: Set the visited flag for all +enumerated devices") caused that two group of special SPI or I2C +devices do not enumerate. SPI and I2C devices are expected to be +enumerated by the SPI and I2C subsystems but change caused that +acpi_bus_attach() marks those devices with acpi_device_set_enumerated(). + +First group of devices are matched using Device Tree compatible property +with special _HID "PRP0001". Those devices have matched scan handler, +acpi_scan_attach_handler() retuns 1 and acpi_bus_attach() marks them +with acpi_device_set_enumerated(). + +Second group of devices without valid _HID such as "LNXVIDEO" have +device->pnp.type.platform_id set to zero and change again marks them +with acpi_device_set_enumerated(). + +Fix this by flagging the SPI and I2C devices during struct acpi_device +object initialization time and let the code in acpi_bus_attach() to go +through the device_attach() and acpi_default_enumeration() path for all +SPI and I2C devices. + +Fixes: f406270bf73d (ACPI / scan: Set the visited flag for all enumerated devices) +Signed-off-by: Jarkko Nikula +Acked-by: Mika Westerberg +Signed-off-by: Rafael J. Wysocki +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/acpi/scan.c | 67 ++++++++++++++++++++++++++---------------------- + include/acpi/acpi_bus.h | 3 +- + 2 files changed, 39 insertions(+), 31 deletions(-) + +--- a/drivers/acpi/scan.c ++++ b/drivers/acpi/scan.c +@@ -1433,6 +1433,37 @@ static void acpi_init_coherency(struct a + adev->flags.coherent_dma = cca; + } + ++static int acpi_check_spi_i2c_slave(struct acpi_resource *ares, void *data) ++{ ++ bool *is_spi_i2c_slave_p = data; ++ ++ if (ares->type != ACPI_RESOURCE_TYPE_SERIAL_BUS) ++ return 1; ++ ++ /* ++ * devices that are connected to UART still need to be enumerated to ++ * platform bus ++ */ ++ if (ares->data.common_serial_bus.type != ACPI_RESOURCE_SERIAL_TYPE_UART) ++ *is_spi_i2c_slave_p = true; ++ ++ /* no need to do more checking */ ++ return -1; ++} ++ ++static bool acpi_is_spi_i2c_slave(struct acpi_device *device) ++{ ++ struct list_head resource_list; ++ bool is_spi_i2c_slave = false; ++ ++ INIT_LIST_HEAD(&resource_list); ++ acpi_dev_get_resources(device, &resource_list, acpi_check_spi_i2c_slave, ++ &is_spi_i2c_slave); ++ acpi_dev_free_resource_list(&resource_list); ++ ++ return is_spi_i2c_slave; ++} ++ + void acpi_init_device_object(struct acpi_device *device, acpi_handle handle, + int type, unsigned long long sta) + { +@@ -1448,6 +1479,7 @@ void acpi_init_device_object(struct acpi + acpi_bus_get_flags(device); + device->flags.match_driver = false; + device->flags.initialized = true; ++ device->flags.spi_i2c_slave = acpi_is_spi_i2c_slave(device); + acpi_device_clear_enumerated(device); + device_initialize(&device->dev); + dev_set_uevent_suppress(&device->dev, true); +@@ -1732,38 +1764,13 @@ static acpi_status acpi_bus_check_add(ac + return AE_OK; + } + +-static int acpi_check_spi_i2c_slave(struct acpi_resource *ares, void *data) +-{ +- bool *is_spi_i2c_slave_p = data; +- +- if (ares->type != ACPI_RESOURCE_TYPE_SERIAL_BUS) +- return 1; +- +- /* +- * devices that are connected to UART still need to be enumerated to +- * platform bus +- */ +- if (ares->data.common_serial_bus.type != ACPI_RESOURCE_SERIAL_TYPE_UART) +- *is_spi_i2c_slave_p = true; +- +- /* no need to do more checking */ +- return -1; +-} +- + static void acpi_default_enumeration(struct acpi_device *device) + { +- struct list_head resource_list; +- bool is_spi_i2c_slave = false; +- + /* + * Do not enumerate SPI/I2C slaves as they will be enumerated by their + * respective parents. + */ +- INIT_LIST_HEAD(&resource_list); +- acpi_dev_get_resources(device, &resource_list, acpi_check_spi_i2c_slave, +- &is_spi_i2c_slave); +- acpi_dev_free_resource_list(&resource_list); +- if (!is_spi_i2c_slave) { ++ if (!device->flags.spi_i2c_slave) { + acpi_create_platform_device(device, NULL); + acpi_device_set_enumerated(device); + } else { +@@ -1857,7 +1864,7 @@ static void acpi_bus_attach(struct acpi_ + return; + + device->flags.match_driver = true; +- if (ret > 0) { ++ if (ret > 0 && !device->flags.spi_i2c_slave) { + acpi_device_set_enumerated(device); + goto ok; + } +@@ -1866,10 +1873,10 @@ static void acpi_bus_attach(struct acpi_ + if (ret < 0) + return; + +- if (device->pnp.type.platform_id) +- acpi_default_enumeration(device); +- else ++ if (!device->pnp.type.platform_id && !device->flags.spi_i2c_slave) + acpi_device_set_enumerated(device); ++ else ++ acpi_default_enumeration(device); + + ok: + list_for_each_entry(child, &device->children, node) +--- a/include/acpi/acpi_bus.h ++++ b/include/acpi/acpi_bus.h +@@ -209,7 +209,8 @@ struct acpi_device_flags { + u32 of_compatible_ok:1; + u32 coherent_dma:1; + u32 cca_seen:1; +- u32 reserved:20; ++ u32 spi_i2c_slave:1; ++ u32 reserved:19; + }; + + /* File System */ diff --git a/queue-4.11/series b/queue-4.11/series index 31752fc71ee..cfd3129ed0d 100644 --- a/queue-4.11/series +++ b/queue-4.11/series @@ -46,3 +46,5 @@ drm-radeon-add-a-quirk-for-toshiba-satellite-l20-183.patch drm-amdgpu-atom-fix-ps-allocation-size-for-enabledisppowergating.patch drm-amdgpu-adjust-default-display-clock.patch drm-amdgpu-add-polaris12-did.patch +acpi-scan-apply-default-enumeration-to-devices-with-acpi-drivers.patch +acpi-scan-fix-enumeration-for-special-spi-and-i2c-devices.patch