Commit c3fb4660 authored by Rafael J. Wysocki's avatar Rafael J. Wysocki

Merge branches 'acpi-glue', 'acpi-pnp', 'acpi-processor' and 'acpi-soc'

Merge updates of the code associating ACPI device objects with
devices and PNP code, processor driver, and Intel LPSS driver updates
for 5.16-rc1:

 - Make the association of ACPI device objects with PCI devices more
   straightforward and simplify the code doing that for all devices
   in general (Rafael Wysocki).

 - Use acpi_device_adr() in acpi_find_child_device() instead of
   evaluating _ADR (Rafael Wysocki).

 - Drop duplicate device IDs from PNP device IDs list (Krzysztof
   Kozlowski).

 - Allow acpi_idle_play_dead() to use C3 on AMD processors (Richard
   Gong).

 - Use ACPI_COMPANION() to simplify code in the ACPI driver for Intel
   SoCs (Rafael Wysocki).

* acpi-glue:
  ACPI: glue: Use acpi_device_adr() in acpi_find_child_device()
  ACPI: glue: Look for ACPI bus type only if ACPI companion is not known
  ACPI: glue: Drop cleanup callback from struct acpi_bus_type
  PCI: ACPI: Drop acpi_pci_bus

* acpi-pnp:
  ACPI: PNP: remove duplicated BRI0A49 and BDP3336 entries

* acpi-processor:
  ACPI: processor idle: Allow playing dead in C3 state

* acpi-soc:
  ACPI: LPSS: Use ACPI_COMPANION() directly
...@@ -712,14 +712,13 @@ static void __lpss_reg_write(u32 val, struct lpss_private_data *pdata, ...@@ -712,14 +712,13 @@ static void __lpss_reg_write(u32 val, struct lpss_private_data *pdata,
static int lpss_reg_read(struct device *dev, unsigned int reg, u32 *val) static int lpss_reg_read(struct device *dev, unsigned int reg, u32 *val)
{ {
struct acpi_device *adev; struct acpi_device *adev = ACPI_COMPANION(dev);
struct lpss_private_data *pdata; struct lpss_private_data *pdata;
unsigned long flags; unsigned long flags;
int ret; int ret;
ret = acpi_bus_get_device(ACPI_HANDLE(dev), &adev); if (WARN_ON(!adev))
if (WARN_ON(ret)) return -ENODEV;
return ret;
spin_lock_irqsave(&dev->power.lock, flags); spin_lock_irqsave(&dev->power.lock, flags);
if (pm_runtime_suspended(dev)) { if (pm_runtime_suspended(dev)) {
...@@ -732,6 +731,7 @@ static int lpss_reg_read(struct device *dev, unsigned int reg, u32 *val) ...@@ -732,6 +731,7 @@ static int lpss_reg_read(struct device *dev, unsigned int reg, u32 *val)
goto out; goto out;
} }
*val = __lpss_reg_read(pdata, reg); *val = __lpss_reg_read(pdata, reg);
ret = 0;
out: out:
spin_unlock_irqrestore(&dev->power.lock, flags); spin_unlock_irqrestore(&dev->power.lock, flags);
...@@ -1266,7 +1266,8 @@ static int acpi_lpss_platform_notify(struct notifier_block *nb, ...@@ -1266,7 +1266,8 @@ static int acpi_lpss_platform_notify(struct notifier_block *nb,
if (!id || !id->driver_data) if (!id || !id->driver_data)
return 0; return 0;
if (acpi_bus_get_device(ACPI_HANDLE(&pdev->dev), &adev)) adev = ACPI_COMPANION(&pdev->dev);
if (!adev)
return 0; return 0;
pdata = acpi_driver_data(adev); pdata = acpi_driver_data(adev);
......
...@@ -156,8 +156,6 @@ static const struct acpi_device_id acpi_pnp_device_ids[] = { ...@@ -156,8 +156,6 @@ static const struct acpi_device_id acpi_pnp_device_ids[] = {
{"BRI0A49"}, /* Boca Complete Ofc Communicator 14.4 Data-FAX */ {"BRI0A49"}, /* Boca Complete Ofc Communicator 14.4 Data-FAX */
{"BRI1400"}, /* Boca Research 33,600 ACF Modem */ {"BRI1400"}, /* Boca Research 33,600 ACF Modem */
{"BRI3400"}, /* Boca 33.6 Kbps Internal FD34FSVD */ {"BRI3400"}, /* Boca 33.6 Kbps Internal FD34FSVD */
{"BRI0A49"}, /* Boca 33.6 Kbps Internal FD34FSVD */
{"BDP3336"}, /* Best Data Products Inc. Smart One 336F PnP Modem */
{"CPI4050"}, /* Computer Peripherals Inc. EuroViVa CommCenter-33.6 SP PnP */ {"CPI4050"}, /* Computer Peripherals Inc. EuroViVa CommCenter-33.6 SP PnP */
{"CTL3001"}, /* Creative Labs Phone Blaster 28.8 DSVD PnP Voice */ {"CTL3001"}, /* Creative Labs Phone Blaster 28.8 DSVD PnP Voice */
{"CTL3011"}, /* Creative Labs Modem Blaster 28.8 DSVD PnP Voice */ {"CTL3011"}, /* Creative Labs Modem Blaster 28.8 DSVD PnP Voice */
......
...@@ -17,6 +17,8 @@ ...@@ -17,6 +17,8 @@
#include <linux/rwsem.h> #include <linux/rwsem.h>
#include <linux/acpi.h> #include <linux/acpi.h>
#include <linux/dma-mapping.h> #include <linux/dma-mapping.h>
#include <linux/pci.h>
#include <linux/pci-acpi.h>
#include <linux/platform_device.h> #include <linux/platform_device.h>
#include "internal.h" #include "internal.h"
...@@ -111,13 +113,10 @@ struct acpi_device *acpi_find_child_device(struct acpi_device *parent, ...@@ -111,13 +113,10 @@ struct acpi_device *acpi_find_child_device(struct acpi_device *parent,
return NULL; return NULL;
list_for_each_entry(adev, &parent->children, node) { list_for_each_entry(adev, &parent->children, node) {
unsigned long long addr; acpi_bus_address addr = acpi_device_adr(adev);
acpi_status status;
int score; int score;
status = acpi_evaluate_integer(adev->handle, METHOD_NAME__ADR, if (!adev->pnp.type.bus_address || addr != address)
NULL, &addr);
if (ACPI_FAILURE(status) || addr != address)
continue; continue;
if (!ret) { if (!ret) {
...@@ -287,12 +286,13 @@ EXPORT_SYMBOL_GPL(acpi_unbind_one); ...@@ -287,12 +286,13 @@ EXPORT_SYMBOL_GPL(acpi_unbind_one);
void acpi_device_notify(struct device *dev) void acpi_device_notify(struct device *dev)
{ {
struct acpi_bus_type *type = acpi_get_bus_type(dev);
struct acpi_device *adev; struct acpi_device *adev;
int ret; int ret;
ret = acpi_bind_one(dev, NULL); ret = acpi_bind_one(dev, NULL);
if (ret) { if (ret) {
struct acpi_bus_type *type = acpi_get_bus_type(dev);
if (!type) if (!type)
goto err; goto err;
...@@ -304,17 +304,26 @@ void acpi_device_notify(struct device *dev) ...@@ -304,17 +304,26 @@ void acpi_device_notify(struct device *dev)
ret = acpi_bind_one(dev, adev); ret = acpi_bind_one(dev, adev);
if (ret) if (ret)
goto err; goto err;
}
adev = ACPI_COMPANION(dev);
if (dev_is_platform(dev)) if (type->setup) {
acpi_configure_pmsi_domain(dev); type->setup(dev);
goto done;
}
} else {
adev = ACPI_COMPANION(dev);
if (dev_is_pci(dev)) {
pci_acpi_setup(dev, adev);
goto done;
} else if (dev_is_platform(dev)) {
acpi_configure_pmsi_domain(dev);
}
}
if (type && type->setup) if (adev->handler && adev->handler->bind)
type->setup(dev);
else if (adev->handler && adev->handler->bind)
adev->handler->bind(dev); adev->handler->bind(dev);
done:
acpi_handle_debug(ACPI_HANDLE(dev), "Bound to device %s\n", acpi_handle_debug(ACPI_HANDLE(dev), "Bound to device %s\n",
dev_name(dev)); dev_name(dev));
...@@ -327,14 +336,12 @@ void acpi_device_notify(struct device *dev) ...@@ -327,14 +336,12 @@ void acpi_device_notify(struct device *dev)
void acpi_device_notify_remove(struct device *dev) void acpi_device_notify_remove(struct device *dev)
{ {
struct acpi_device *adev = ACPI_COMPANION(dev); struct acpi_device *adev = ACPI_COMPANION(dev);
struct acpi_bus_type *type;
if (!adev) if (!adev)
return; return;
type = acpi_get_bus_type(dev); if (dev_is_pci(dev))
if (type && type->cleanup) pci_acpi_cleanup(dev, adev);
type->cleanup(dev);
else if (adev->handler && adev->handler->unbind) else if (adev->handler && adev->handler->unbind)
adev->handler->unbind(dev); adev->handler->unbind(dev);
......
...@@ -789,7 +789,8 @@ static int acpi_processor_setup_cstates(struct acpi_processor *pr) ...@@ -789,7 +789,8 @@ static int acpi_processor_setup_cstates(struct acpi_processor *pr)
state->enter = acpi_idle_enter; state->enter = acpi_idle_enter;
state->flags = 0; state->flags = 0;
if (cx->type == ACPI_STATE_C1 || cx->type == ACPI_STATE_C2) { if (cx->type == ACPI_STATE_C1 || cx->type == ACPI_STATE_C2 ||
cx->type == ACPI_STATE_C3) {
state->enter_dead = acpi_idle_play_dead; state->enter_dead = acpi_idle_play_dead;
drv->safe_state_index = count; drv->safe_state_index = count;
} }
......
...@@ -1356,13 +1356,9 @@ static void pci_acpi_set_external_facing(struct pci_dev *dev) ...@@ -1356,13 +1356,9 @@ static void pci_acpi_set_external_facing(struct pci_dev *dev)
dev->external_facing = 1; dev->external_facing = 1;
} }
static void pci_acpi_setup(struct device *dev) void pci_acpi_setup(struct device *dev, struct acpi_device *adev)
{ {
struct pci_dev *pci_dev = to_pci_dev(dev); struct pci_dev *pci_dev = to_pci_dev(dev);
struct acpi_device *adev = ACPI_COMPANION(dev);
if (!adev)
return;
pci_acpi_optimize_delay(pci_dev, adev->handle); pci_acpi_optimize_delay(pci_dev, adev->handle);
pci_acpi_set_external_facing(pci_dev); pci_acpi_set_external_facing(pci_dev);
...@@ -1386,14 +1382,10 @@ static void pci_acpi_setup(struct device *dev) ...@@ -1386,14 +1382,10 @@ static void pci_acpi_setup(struct device *dev)
acpi_device_power_add_dependent(adev, dev); acpi_device_power_add_dependent(adev, dev);
} }
static void pci_acpi_cleanup(struct device *dev) void pci_acpi_cleanup(struct device *dev, struct acpi_device *adev)
{ {
struct acpi_device *adev = ACPI_COMPANION(dev);
struct pci_dev *pci_dev = to_pci_dev(dev); struct pci_dev *pci_dev = to_pci_dev(dev);
if (!adev)
return;
pci_acpi_remove_edr_notifier(pci_dev); pci_acpi_remove_edr_notifier(pci_dev);
pci_acpi_remove_pm_notifier(adev); pci_acpi_remove_pm_notifier(adev);
if (adev->wakeup.flags.valid) { if (adev->wakeup.flags.valid) {
...@@ -1405,20 +1397,6 @@ static void pci_acpi_cleanup(struct device *dev) ...@@ -1405,20 +1397,6 @@ static void pci_acpi_cleanup(struct device *dev)
} }
} }
static bool pci_acpi_bus_match(struct device *dev)
{
return dev_is_pci(dev);
}
static struct acpi_bus_type acpi_pci_bus = {
.name = "PCI",
.match = pci_acpi_bus_match,
.find_companion = acpi_pci_find_companion,
.setup = pci_acpi_setup,
.cleanup = pci_acpi_cleanup,
};
static struct fwnode_handle *(*pci_msi_get_fwnode_cb)(struct device *dev); static struct fwnode_handle *(*pci_msi_get_fwnode_cb)(struct device *dev);
/** /**
...@@ -1460,8 +1438,6 @@ struct irq_domain *pci_host_bridge_acpi_msi_domain(struct pci_bus *bus) ...@@ -1460,8 +1438,6 @@ struct irq_domain *pci_host_bridge_acpi_msi_domain(struct pci_bus *bus)
static int __init acpi_pci_init(void) static int __init acpi_pci_init(void)
{ {
int ret;
if (acpi_gbl_FADT.boot_flags & ACPI_FADT_NO_MSI) { if (acpi_gbl_FADT.boot_flags & ACPI_FADT_NO_MSI) {
pr_info("ACPI FADT declares the system doesn't support MSI, so disable it\n"); pr_info("ACPI FADT declares the system doesn't support MSI, so disable it\n");
pci_no_msi(); pci_no_msi();
...@@ -1472,8 +1448,7 @@ static int __init acpi_pci_init(void) ...@@ -1472,8 +1448,7 @@ static int __init acpi_pci_init(void)
pcie_no_aspm(); pcie_no_aspm();
} }
ret = register_acpi_bus_type(&acpi_pci_bus); if (acpi_pci_disabled)
if (ret)
return 0; return 0;
pci_set_platform_pm(&acpi_pci_platform_pm); pci_set_platform_pm(&acpi_pci_platform_pm);
......
...@@ -570,7 +570,6 @@ struct acpi_bus_type { ...@@ -570,7 +570,6 @@ struct acpi_bus_type {
bool (*match)(struct device *dev); bool (*match)(struct device *dev);
struct acpi_device * (*find_companion)(struct device *); struct acpi_device * (*find_companion)(struct device *);
void (*setup)(struct device *); void (*setup)(struct device *);
void (*cleanup)(struct device *);
}; };
int register_acpi_bus_type(struct acpi_bus_type *); int register_acpi_bus_type(struct acpi_bus_type *);
int unregister_acpi_bus_type(struct acpi_bus_type *); int unregister_acpi_bus_type(struct acpi_bus_type *);
......
...@@ -84,6 +84,14 @@ extern struct pci_bus *acpi_pci_root_create(struct acpi_pci_root *root, ...@@ -84,6 +84,14 @@ extern struct pci_bus *acpi_pci_root_create(struct acpi_pci_root *root,
void acpi_pci_add_bus(struct pci_bus *bus); void acpi_pci_add_bus(struct pci_bus *bus);
void acpi_pci_remove_bus(struct pci_bus *bus); void acpi_pci_remove_bus(struct pci_bus *bus);
#ifdef CONFIG_PCI
void pci_acpi_setup(struct device *dev, struct acpi_device *adev);
void pci_acpi_cleanup(struct device *dev, struct acpi_device *adev);
#else
static inline void pci_acpi_setup(struct device *dev, struct acpi_device *adev) {}
static inline void pci_acpi_cleanup(struct device *dev, struct acpi_device *adev) {}
#endif
#ifdef CONFIG_ACPI_PCI_SLOT #ifdef CONFIG_ACPI_PCI_SLOT
void acpi_pci_slot_init(void); void acpi_pci_slot_init(void);
void acpi_pci_slot_enumerate(struct pci_bus *bus); void acpi_pci_slot_enumerate(struct pci_bus *bus);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment