smartconnect.c 953 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. // SPDX-License-Identifier: GPL-2.0+
  2. /*
  3. * Copyright 2013 Matthew Garrett <[email protected]>
  4. */
  5. #include <linux/acpi.h>
  6. #include <linux/module.h>
  7. MODULE_LICENSE("GPL");
  8. static int smartconnect_acpi_init(struct acpi_device *acpi)
  9. {
  10. unsigned long long value;
  11. acpi_status status;
  12. status = acpi_evaluate_integer(acpi->handle, "GAOS", NULL, &value);
  13. if (ACPI_FAILURE(status))
  14. return -EINVAL;
  15. if (value & 0x1) {
  16. dev_info(&acpi->dev, "Disabling Intel Smart Connect\n");
  17. status = acpi_execute_simple_method(acpi->handle, "SAOS", 0);
  18. }
  19. return 0;
  20. }
  21. static const struct acpi_device_id smartconnect_ids[] = {
  22. {"INT33A0", 0},
  23. {"", 0}
  24. };
  25. MODULE_DEVICE_TABLE(acpi, smartconnect_ids);
  26. static struct acpi_driver smartconnect_driver = {
  27. .owner = THIS_MODULE,
  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);