aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi
diff options
context:
space:
mode:
authorZhang Rui <rui.zhang@intel.com>2014-05-30 08:35:34 -0400
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2014-05-30 10:04:37 -0400
commit48459340b92b00ae1a75179f168ef20d3e61f264 (patch)
tree46ee03d1984eba3272131619977ac3f2751c1ab0 /drivers/acpi
parentd6ddaaac8f5c37ad84db3e6e019981f392389cf0 (diff)
ACPI / scan: use platform bus type by default for _HID enumeration
Because of the growing demand for enumerating ACPI devices to platform bus, change the code to enumerate ACPI device objects to platform bus by default. Namely, create platform devices for the ACPI device objects that 1. Have pnp.type.platform_id set (device objects with _HID currently). 2. Do not have a scan handler attached. 3. Are not SPI/I2C slave devices (that should be enumerated to the appropriate buses bus by their parent). Signed-off-by: Zhang Rui <rui.zhang@intel.com> [rjw: Subject and changelog, rebase and code cleanup] Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Reviewed-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Diffstat (limited to 'drivers/acpi')
-rw-r--r--drivers/acpi/acpi_platform.c44
-rw-r--r--drivers/acpi/scan.c42
2 files changed, 49 insertions, 37 deletions
diff --git a/drivers/acpi/acpi_platform.c b/drivers/acpi/acpi_platform.c
index 3bb89def2292..2bf9082f7523 100644
--- a/drivers/acpi/acpi_platform.c
+++ b/drivers/acpi/acpi_platform.c
@@ -22,25 +22,11 @@
22 22
23ACPI_MODULE_NAME("platform"); 23ACPI_MODULE_NAME("platform");
24 24
25/* 25static const struct acpi_device_id forbidden_id_list[] = {
26 * The following ACPI IDs are known to be suitable for representing as 26 {"PNP0000", 0}, /* PIC */
27 * platform devices. 27 {"PNP0100", 0}, /* Timer */
28 */ 28 {"PNP0200", 0}, /* AT DMA Controller */
29static const struct acpi_device_id acpi_platform_device_ids[] = { 29 {"", 0},
30
31 { "PNP0D40" },
32 { "VPC2004" },
33 { "BCM4752" },
34 { "LNV4752" },
35 { "BCM2E1A" },
36 { "BCM2E39" },
37 { "BCM2E3D" },
38
39 /* Intel Smart Sound Technology */
40 { "INT33C8" },
41 { "80860F28" },
42
43 { }
44}; 30};
45 31
46/** 32/**
@@ -67,6 +53,9 @@ struct platform_device *acpi_create_platform_device(struct acpi_device *adev)
67 if (adev->physical_node_count) 53 if (adev->physical_node_count)
68 return NULL; 54 return NULL;
69 55
56 if (!acpi_match_device_ids(adev, forbidden_id_list))
57 return ERR_PTR(-EINVAL);
58
70 INIT_LIST_HEAD(&resource_list); 59 INIT_LIST_HEAD(&resource_list);
71 count = acpi_dev_get_resources(adev, &resource_list, NULL, NULL); 60 count = acpi_dev_get_resources(adev, &resource_list, NULL, NULL);
72 if (count < 0) { 61 if (count < 0) {
@@ -124,20 +113,3 @@ struct platform_device *acpi_create_platform_device(struct acpi_device *adev)
124 kfree(resources); 113 kfree(resources);
125 return pdev; 114 return pdev;
126} 115}
127
128static int acpi_platform_attach(struct acpi_device *adev,
129 const struct acpi_device_id *id)
130{
131 acpi_create_platform_device(adev);
132 return 1;
133}
134
135static struct acpi_scan_handler platform_handler = {
136 .ids = acpi_platform_device_ids,
137 .attach = acpi_platform_attach,
138};
139
140void __init acpi_platform_init(void)
141{
142 acpi_scan_add_handler(&platform_handler);
143}
diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c
index 611bb5db7e57..df49fc8276b9 100644
--- a/drivers/acpi/scan.c
+++ b/drivers/acpi/scan.c
@@ -2070,6 +2070,44 @@ static acpi_status acpi_bus_check_add(acpi_handle handle, u32 lvl_not_used,
2070 return AE_OK; 2070 return AE_OK;
2071} 2071}
2072 2072
2073static int acpi_check_spi_i2c_slave(struct acpi_resource *ares, void *data)
2074{
2075 bool *is_spi_i2c_slave_p = data;
2076
2077 if (ares->type != ACPI_RESOURCE_TYPE_SERIAL_BUS)
2078 return 1;
2079
2080 /*
2081 * devices that are connected to UART still need to be enumerated to
2082 * platform bus
2083 */
2084 if (ares->data.common_serial_bus.type != ACPI_RESOURCE_SERIAL_TYPE_UART)
2085 *is_spi_i2c_slave_p = true;
2086
2087 /* no need to do more checking */
2088 return -1;
2089}
2090
2091static void acpi_default_enumeration(struct acpi_device *device)
2092{
2093 struct list_head resource_list;
2094 bool is_spi_i2c_slave = false;
2095
2096 if (!device->pnp.type.platform_id || device->handler)
2097 return;
2098
2099 /*
2100 * Do not enemerate SPI/I2C slaves as they will be enuerated by their
2101 * respective parents.
2102 */
2103 INIT_LIST_HEAD(&resource_list);
2104 acpi_dev_get_resources(device, &resource_list, acpi_check_spi_i2c_slave,
2105 &is_spi_i2c_slave);
2106 acpi_dev_free_resource_list(&resource_list);
2107 if (!is_spi_i2c_slave)
2108 acpi_create_platform_device(device);
2109}
2110
2073static int acpi_scan_attach_handler(struct acpi_device *device) 2111static int acpi_scan_attach_handler(struct acpi_device *device)
2074{ 2112{
2075 struct acpi_hardware_id *hwid; 2113 struct acpi_hardware_id *hwid;
@@ -2095,6 +2133,9 @@ static int acpi_scan_attach_handler(struct acpi_device *device)
2095 break; 2133 break;
2096 } 2134 }
2097 } 2135 }
2136 if (!ret)
2137 acpi_default_enumeration(device);
2138
2098 return ret; 2139 return ret;
2099} 2140}
2100 2141
@@ -2254,7 +2295,6 @@ int __init acpi_scan_init(void)
2254 acpi_pci_root_init(); 2295 acpi_pci_root_init();
2255 acpi_pci_link_init(); 2296 acpi_pci_link_init();
2256 acpi_processor_init(); 2297 acpi_processor_init();
2257 acpi_platform_init();
2258 acpi_lpss_init(); 2298 acpi_lpss_init();
2259 acpi_cmos_rtc_init(); 2299 acpi_cmos_rtc_init();
2260 acpi_container_init(); 2300 acpi_container_init();