xref: /linux/drivers/platform/x86/intel/smartconnect.c (revision 513480da5e9c8f55b4f8f5e89f386e26188fbb3f)
1 // SPDX-License-Identifier: GPL-2.0+
2 /*
3  *  Copyright 2013 Matthew Garrett <mjg59@srcf.ucam.org>
4  */
5 
6 #include <linux/acpi.h>
7 #include <linux/module.h>
8 #include <linux/platform_device.h>
9 
10 MODULE_DESCRIPTION("Intel Smart Connect disabling driver");
11 MODULE_LICENSE("GPL");
12 
13 static int smartconnect_acpi_probe(struct platform_device *pdev)
14 {
15 	unsigned long long value;
16 	acpi_handle handle;
17 	acpi_status status;
18 
19 	handle = ACPI_HANDLE(&pdev->dev);
20 	if (!handle)
21 		return -ENODEV;
22 
23 	status = acpi_evaluate_integer(handle, "GAOS", NULL, &value);
24 	if (ACPI_FAILURE(status))
25 		return -EINVAL;
26 
27 	if (value & 0x1) {
28 		dev_info(&pdev->dev, "Disabling Intel Smart Connect\n");
29 		status = acpi_execute_simple_method(handle, "SAOS", 0);
30 	}
31 
32 	return 0;
33 }
34 
35 static const struct acpi_device_id smartconnect_ids[] = {
36 	{"INT33A0", 0},
37 	{"", 0}
38 };
39 MODULE_DEVICE_TABLE(acpi, smartconnect_ids);
40 
41 static struct platform_driver smartconnect_driver = {
42 	.probe = smartconnect_acpi_probe,
43 	.driver = {
44 		.name = "intel_smart_connect",
45 		.acpi_match_table = smartconnect_ids,
46 	},
47 };
48 
49 module_platform_driver(smartconnect_driver);
50