Matthew Garrett | 5c7f80f | 2013-07-03 00:50:13 -0400 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2013 Matthew Garrett <mjg59@srcf.ucam.org> |
| 3 | * |
| 4 | * This program is free software; you can redistribute it and/or modify |
| 5 | * it under the terms of the GNU General Public License as published by |
| 6 | * the Free Software Foundation; either version 2 of the License, or |
| 7 | * (at your option) any later version. |
| 8 | * |
| 9 | * This program is distributed in the hope that it will be useful, |
| 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 | * GNU General Public License for more details. |
| 13 | * |
| 14 | * You should have received a copy of the GNU General Public License along |
| 15 | * with this program; if not, write to the Free Software Foundation, Inc., |
| 16 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
| 17 | */ |
| 18 | |
| 19 | |
| 20 | #include <linux/init.h> |
| 21 | #include <linux/module.h> |
Lv Zheng | 8b48463 | 2013-12-03 08:49:16 +0800 | [diff] [blame] | 22 | #include <linux/acpi.h> |
Matthew Garrett | 5c7f80f | 2013-07-03 00:50:13 -0400 | [diff] [blame] | 23 | |
| 24 | MODULE_LICENSE("GPL"); |
| 25 | |
| 26 | static int smartconnect_acpi_init(struct acpi_device *acpi) |
| 27 | { |
Zhang Rui | 4a2d6f6 | 2013-09-03 08:32:14 +0800 | [diff] [blame] | 28 | unsigned long long value; |
Matthew Garrett | 5c7f80f | 2013-07-03 00:50:13 -0400 | [diff] [blame] | 29 | acpi_status status; |
| 30 | |
Zhang Rui | 4a2d6f6 | 2013-09-03 08:32:14 +0800 | [diff] [blame] | 31 | status = acpi_evaluate_integer(acpi->handle, "GAOS", NULL, &value); |
Axel Lin | 3526eca | 2016-09-19 09:33:51 +0800 | [diff] [blame^] | 32 | if (ACPI_FAILURE(status)) |
Matthew Garrett | 5c7f80f | 2013-07-03 00:50:13 -0400 | [diff] [blame] | 33 | return -EINVAL; |
| 34 | |
Zhang Rui | 4a2d6f6 | 2013-09-03 08:32:14 +0800 | [diff] [blame] | 35 | if (value & 0x1) { |
Matthew Garrett | 5c7f80f | 2013-07-03 00:50:13 -0400 | [diff] [blame] | 36 | dev_info(&acpi->dev, "Disabling Intel Smart Connect\n"); |
Zhang Rui | 77c3985 | 2013-09-03 08:31:54 +0800 | [diff] [blame] | 37 | status = acpi_execute_simple_method(acpi->handle, "SAOS", 0); |
Matthew Garrett | 5c7f80f | 2013-07-03 00:50:13 -0400 | [diff] [blame] | 38 | } |
| 39 | |
Matthew Garrett | 5c7f80f | 2013-07-03 00:50:13 -0400 | [diff] [blame] | 40 | return 0; |
| 41 | } |
| 42 | |
| 43 | static const struct acpi_device_id smartconnect_ids[] = { |
| 44 | {"INT33A0", 0}, |
| 45 | {"", 0} |
| 46 | }; |
| 47 | |
| 48 | static struct acpi_driver smartconnect_driver = { |
| 49 | .owner = THIS_MODULE, |
| 50 | .name = "intel_smart_connect", |
| 51 | .class = "intel_smart_connect", |
| 52 | .ids = smartconnect_ids, |
| 53 | .ops = { |
| 54 | .add = smartconnect_acpi_init, |
| 55 | }, |
| 56 | }; |
| 57 | |
Wei Yongjun | 4d26353 | 2013-07-17 09:52:28 +0800 | [diff] [blame] | 58 | module_acpi_driver(smartconnect_driver); |
Matthew Garrett | 5c7f80f | 2013-07-03 00:50:13 -0400 | [diff] [blame] | 59 | |
| 60 | MODULE_DEVICE_TABLE(acpi, smartconnect_ids); |