Andy Shevchenko | 3e57f26 | 2018-09-26 18:27:40 +0300 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0+ |
Matthew Garrett | 5c7f80f | 2013-07-03 00:50:13 -0400 | [diff] [blame] | 2 | /* |
| 3 | * Copyright 2013 Matthew Garrett <mjg59@srcf.ucam.org> |
Matthew Garrett | 5c7f80f | 2013-07-03 00:50:13 -0400 | [diff] [blame] | 4 | */ |
| 5 | |
Lv Zheng | 8b48463 | 2013-12-03 08:49:16 +0800 | [diff] [blame] | 6 | #include <linux/acpi.h> |
Andy Shevchenko | 8046f04 | 2018-09-26 18:27:14 +0300 | [diff] [blame] | 7 | #include <linux/module.h> |
Matthew Garrett | 5c7f80f | 2013-07-03 00:50:13 -0400 | [diff] [blame] | 8 | |
| 9 | MODULE_LICENSE("GPL"); |
| 10 | |
| 11 | static int smartconnect_acpi_init(struct acpi_device *acpi) |
| 12 | { |
Zhang Rui | 4a2d6f6 | 2013-09-03 08:32:14 +0800 | [diff] [blame] | 13 | unsigned long long value; |
Matthew Garrett | 5c7f80f | 2013-07-03 00:50:13 -0400 | [diff] [blame] | 14 | acpi_status status; |
| 15 | |
Zhang Rui | 4a2d6f6 | 2013-09-03 08:32:14 +0800 | [diff] [blame] | 16 | status = acpi_evaluate_integer(acpi->handle, "GAOS", NULL, &value); |
Axel Lin | 3526eca | 2016-09-19 09:33:51 +0800 | [diff] [blame] | 17 | if (ACPI_FAILURE(status)) |
Matthew Garrett | 5c7f80f | 2013-07-03 00:50:13 -0400 | [diff] [blame] | 18 | return -EINVAL; |
| 19 | |
Zhang Rui | 4a2d6f6 | 2013-09-03 08:32:14 +0800 | [diff] [blame] | 20 | if (value & 0x1) { |
Matthew Garrett | 5c7f80f | 2013-07-03 00:50:13 -0400 | [diff] [blame] | 21 | dev_info(&acpi->dev, "Disabling Intel Smart Connect\n"); |
Zhang Rui | 77c3985 | 2013-09-03 08:31:54 +0800 | [diff] [blame] | 22 | status = acpi_execute_simple_method(acpi->handle, "SAOS", 0); |
Matthew Garrett | 5c7f80f | 2013-07-03 00:50:13 -0400 | [diff] [blame] | 23 | } |
| 24 | |
Matthew Garrett | 5c7f80f | 2013-07-03 00:50:13 -0400 | [diff] [blame] | 25 | return 0; |
| 26 | } |
| 27 | |
| 28 | static const struct acpi_device_id smartconnect_ids[] = { |
| 29 | {"INT33A0", 0}, |
| 30 | {"", 0} |
| 31 | }; |
Andy Shevchenko | 8046f04 | 2018-09-26 18:27:14 +0300 | [diff] [blame] | 32 | MODULE_DEVICE_TABLE(acpi, smartconnect_ids); |
Matthew Garrett | 5c7f80f | 2013-07-03 00:50:13 -0400 | [diff] [blame] | 33 | |
| 34 | static struct acpi_driver smartconnect_driver = { |
| 35 | .owner = THIS_MODULE, |
| 36 | .name = "intel_smart_connect", |
| 37 | .class = "intel_smart_connect", |
| 38 | .ids = smartconnect_ids, |
| 39 | .ops = { |
| 40 | .add = smartconnect_acpi_init, |
| 41 | }, |
| 42 | }; |
| 43 | |
Wei Yongjun | 4d26353 | 2013-07-17 09:52:28 +0800 | [diff] [blame] | 44 | module_acpi_driver(smartconnect_driver); |