smartconnect.c 990 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. // SPDX-License-Identifier: GPL-2.0+
  2. /*
  3. * Copyright 2013 Matthew Garrett <mjg59@srcf.ucam.org>
  4. */
  5. #include <linux/acpi.h>
  6. #include <linux/module.h>
  7. MODULE_DESCRIPTION("Intel Smart Connect disabling driver");
  8. MODULE_LICENSE("GPL");
  9. static int smartconnect_acpi_init(struct acpi_device *acpi)
  10. {
  11. unsigned long long value;
  12. acpi_status status;
  13. status = acpi_evaluate_integer(acpi->handle, "GAOS", NULL, &value);
  14. if (ACPI_FAILURE(status))
  15. return -EINVAL;
  16. if (value & 0x1) {
  17. dev_info(&acpi->dev, "Disabling Intel Smart Connect\n");
  18. status = acpi_execute_simple_method(acpi->handle, "SAOS", 0);
  19. }
  20. return 0;
  21. }
  22. static const struct acpi_device_id smartconnect_ids[] = {
  23. {"INT33A0", 0},
  24. {"", 0}
  25. };
  26. MODULE_DEVICE_TABLE(acpi, smartconnect_ids);
  27. static struct acpi_driver smartconnect_driver = {
  28. .name = "intel_smart_connect",
  29. .class = "intel_smart_connect",
  30. .ids = smartconnect_ids,
  31. .ops = {
  32. .add = smartconnect_acpi_init,
  33. },
  34. };
  35. module_acpi_driver(smartconnect_driver);