aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorRafael J. Wysocki <rafael.j.wysocki@intel.com>2014-06-03 17:11:52 -0400
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2014-06-03 17:11:52 -0400
commit2770b8b1fdf03c4dad6fc8f7e38101a9c4082f7b (patch)
treefbd8bcc61d95930f42602a5598f75b64684e9f56 /drivers
parenta392f7d4afb850934851fde5a8e298912650a6b8 (diff)
parent8ce62f85a81f57e86bc120ab690facc612223188 (diff)
Merge branch 'acpi-platform'
* acpi-platform: ACPI / platform / LPSS: Enable async suspend/resume of LPSS devices ACPI / platform: add IDs for Broadcom Bluetooth and GPS chips
Diffstat (limited to 'drivers')
-rw-r--r--drivers/acpi/acpi_lpss.c17
-rw-r--r--drivers/acpi/acpi_platform.c29
-rw-r--r--drivers/acpi/internal.h3
3 files changed, 30 insertions, 19 deletions
diff --git a/drivers/acpi/acpi_lpss.c b/drivers/acpi/acpi_lpss.c
index 69e29f409d4c..0e9c0d38b85c 100644
--- a/drivers/acpi/acpi_lpss.c
+++ b/drivers/acpi/acpi_lpss.c
@@ -267,12 +267,14 @@ static int acpi_lpss_create_device(struct acpi_device *adev,
267 struct lpss_private_data *pdata; 267 struct lpss_private_data *pdata;
268 struct resource_list_entry *rentry; 268 struct resource_list_entry *rentry;
269 struct list_head resource_list; 269 struct list_head resource_list;
270 struct platform_device *pdev;
270 int ret; 271 int ret;
271 272
272 dev_desc = (struct lpss_device_desc *)id->driver_data; 273 dev_desc = (struct lpss_device_desc *)id->driver_data;
273 if (!dev_desc) 274 if (!dev_desc) {
274 return acpi_create_platform_device(adev, id); 275 pdev = acpi_create_platform_device(adev);
275 276 return IS_ERR_OR_NULL(pdev) ? PTR_ERR(pdev) : 1;
277 }
276 pdata = kzalloc(sizeof(*pdata), GFP_KERNEL); 278 pdata = kzalloc(sizeof(*pdata), GFP_KERNEL);
277 if (!pdata) 279 if (!pdata)
278 return -ENOMEM; 280 return -ENOMEM;
@@ -322,10 +324,13 @@ static int acpi_lpss_create_device(struct acpi_device *adev,
322 dev_desc->setup(pdata); 324 dev_desc->setup(pdata);
323 325
324 adev->driver_data = pdata; 326 adev->driver_data = pdata;
325 ret = acpi_create_platform_device(adev, id); 327 pdev = acpi_create_platform_device(adev);
326 if (ret > 0) 328 if (!IS_ERR_OR_NULL(pdev)) {
327 return ret; 329 device_enable_async_suspend(&pdev->dev);
330 return 1;
331 }
328 332
333 ret = PTR_ERR(pdev);
329 adev->driver_data = NULL; 334 adev->driver_data = NULL;
330 335
331 err_out: 336 err_out:
diff --git a/drivers/acpi/acpi_platform.c b/drivers/acpi/acpi_platform.c
index 1d4950388fa1..3bb89def2292 100644
--- a/drivers/acpi/acpi_platform.c
+++ b/drivers/acpi/acpi_platform.c
@@ -31,6 +31,10 @@ static const struct acpi_device_id acpi_platform_device_ids[] = {
31 { "PNP0D40" }, 31 { "PNP0D40" },
32 { "VPC2004" }, 32 { "VPC2004" },
33 { "BCM4752" }, 33 { "BCM4752" },
34 { "LNV4752" },
35 { "BCM2E1A" },
36 { "BCM2E39" },
37 { "BCM2E3D" },
34 38
35 /* Intel Smart Sound Technology */ 39 /* Intel Smart Sound Technology */
36 { "INT33C8" }, 40 { "INT33C8" },
@@ -42,7 +46,6 @@ static const struct acpi_device_id acpi_platform_device_ids[] = {
42/** 46/**
43 * acpi_create_platform_device - Create platform device for ACPI device node 47 * acpi_create_platform_device - Create platform device for ACPI device node
44 * @adev: ACPI device node to create a platform device for. 48 * @adev: ACPI device node to create a platform device for.
45 * @id: ACPI device ID used to match @adev.
46 * 49 *
47 * Check if the given @adev can be represented as a platform device and, if 50 * Check if the given @adev can be represented as a platform device and, if
48 * that's the case, create and register a platform device, populate its common 51 * that's the case, create and register a platform device, populate its common
@@ -50,8 +53,7 @@ static const struct acpi_device_id acpi_platform_device_ids[] = {
50 * 53 *
51 * Name of the platform device will be the same as @adev's. 54 * Name of the platform device will be the same as @adev's.
52 */ 55 */
53int acpi_create_platform_device(struct acpi_device *adev, 56struct platform_device *acpi_create_platform_device(struct acpi_device *adev)
54 const struct acpi_device_id *id)
55{ 57{
56 struct platform_device *pdev = NULL; 58 struct platform_device *pdev = NULL;
57 struct acpi_device *acpi_parent; 59 struct acpi_device *acpi_parent;
@@ -63,19 +65,19 @@ int acpi_create_platform_device(struct acpi_device *adev,
63 65
64 /* If the ACPI node already has a physical device attached, skip it. */ 66 /* If the ACPI node already has a physical device attached, skip it. */
65 if (adev->physical_node_count) 67 if (adev->physical_node_count)
66 return 0; 68 return NULL;
67 69
68 INIT_LIST_HEAD(&resource_list); 70 INIT_LIST_HEAD(&resource_list);
69 count = acpi_dev_get_resources(adev, &resource_list, NULL, NULL); 71 count = acpi_dev_get_resources(adev, &resource_list, NULL, NULL);
70 if (count < 0) { 72 if (count < 0) {
71 return 0; 73 return NULL;
72 } else if (count > 0) { 74 } else if (count > 0) {
73 resources = kmalloc(count * sizeof(struct resource), 75 resources = kmalloc(count * sizeof(struct resource),
74 GFP_KERNEL); 76 GFP_KERNEL);
75 if (!resources) { 77 if (!resources) {
76 dev_err(&adev->dev, "No memory for resources\n"); 78 dev_err(&adev->dev, "No memory for resources\n");
77 acpi_dev_free_resource_list(&resource_list); 79 acpi_dev_free_resource_list(&resource_list);
78 return -ENOMEM; 80 return ERR_PTR(-ENOMEM);
79 } 81 }
80 count = 0; 82 count = 0;
81 list_for_each_entry(rentry, &resource_list, node) 83 list_for_each_entry(rentry, &resource_list, node)
@@ -112,22 +114,27 @@ int acpi_create_platform_device(struct acpi_device *adev,
112 pdevinfo.num_res = count; 114 pdevinfo.num_res = count;
113 pdevinfo.acpi_node.companion = adev; 115 pdevinfo.acpi_node.companion = adev;
114 pdev = platform_device_register_full(&pdevinfo); 116 pdev = platform_device_register_full(&pdevinfo);
115 if (IS_ERR(pdev)) { 117 if (IS_ERR(pdev))
116 dev_err(&adev->dev, "platform device creation failed: %ld\n", 118 dev_err(&adev->dev, "platform device creation failed: %ld\n",
117 PTR_ERR(pdev)); 119 PTR_ERR(pdev));
118 pdev = NULL; 120 else
119 } else {
120 dev_dbg(&adev->dev, "created platform device %s\n", 121 dev_dbg(&adev->dev, "created platform device %s\n",
121 dev_name(&pdev->dev)); 122 dev_name(&pdev->dev));
122 }
123 123
124 kfree(resources); 124 kfree(resources);
125 return pdev;
126}
127
128static int acpi_platform_attach(struct acpi_device *adev,
129 const struct acpi_device_id *id)
130{
131 acpi_create_platform_device(adev);
125 return 1; 132 return 1;
126} 133}
127 134
128static struct acpi_scan_handler platform_handler = { 135static struct acpi_scan_handler platform_handler = {
129 .ids = acpi_platform_device_ids, 136 .ids = acpi_platform_device_ids,
130 .attach = acpi_create_platform_device, 137 .attach = acpi_platform_attach,
131}; 138};
132 139
133void __init acpi_platform_init(void) 140void __init acpi_platform_init(void)
diff --git a/drivers/acpi/internal.h b/drivers/acpi/internal.h
index 957391306cbf..bb7de413d06d 100644
--- a/drivers/acpi/internal.h
+++ b/drivers/acpi/internal.h
@@ -180,8 +180,7 @@ static inline void suspend_nvs_restore(void) {}
180 -------------------------------------------------------------------------- */ 180 -------------------------------------------------------------------------- */
181struct platform_device; 181struct platform_device;
182 182
183int acpi_create_platform_device(struct acpi_device *adev, 183struct platform_device *acpi_create_platform_device(struct acpi_device *adev);
184 const struct acpi_device_id *id);
185 184
186/*-------------------------------------------------------------------------- 185/*--------------------------------------------------------------------------
187 Video 186 Video