blob: 64c2dc93472f474869b98e418ac1a67bb74d5559 [file] [log] [blame]
Andy Shevchenko3e57f262018-09-26 18:27:40 +03001// SPDX-License-Identifier: GPL-2.0+
Matthew Garrett5c7f80f2013-07-03 00:50:13 -04002/*
3 * Copyright 2013 Matthew Garrett <mjg59@srcf.ucam.org>
Matthew Garrett5c7f80f2013-07-03 00:50:13 -04004 */
5
Lv Zheng8b484632013-12-03 08:49:16 +08006#include <linux/acpi.h>
Andy Shevchenko8046f042018-09-26 18:27:14 +03007#include <linux/module.h>
Matthew Garrett5c7f80f2013-07-03 00:50:13 -04008
9MODULE_LICENSE("GPL");
10
11static int smartconnect_acpi_init(struct acpi_device *acpi)
12{
Zhang Rui4a2d6f62013-09-03 08:32:14 +080013 unsigned long long value;
Matthew Garrett5c7f80f2013-07-03 00:50:13 -040014 acpi_status status;
15
Zhang Rui4a2d6f62013-09-03 08:32:14 +080016 status = acpi_evaluate_integer(acpi->handle, "GAOS", NULL, &value);
Axel Lin3526eca2016-09-19 09:33:51 +080017 if (ACPI_FAILURE(status))
Matthew Garrett5c7f80f2013-07-03 00:50:13 -040018 return -EINVAL;
19
Zhang Rui4a2d6f62013-09-03 08:32:14 +080020 if (value & 0x1) {
Matthew Garrett5c7f80f2013-07-03 00:50:13 -040021 dev_info(&acpi->dev, "Disabling Intel Smart Connect\n");
Zhang Rui77c39852013-09-03 08:31:54 +080022 status = acpi_execute_simple_method(acpi->handle, "SAOS", 0);
Matthew Garrett5c7f80f2013-07-03 00:50:13 -040023 }
24
Matthew Garrett5c7f80f2013-07-03 00:50:13 -040025 return 0;
26}
27
28static const struct acpi_device_id smartconnect_ids[] = {
29 {"INT33A0", 0},
30 {"", 0}
31};
Andy Shevchenko8046f042018-09-26 18:27:14 +030032MODULE_DEVICE_TABLE(acpi, smartconnect_ids);
Matthew Garrett5c7f80f2013-07-03 00:50:13 -040033
34static 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 Yongjun4d263532013-07-17 09:52:28 +080044module_acpi_driver(smartconnect_driver);