intel-smartconnect.c 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  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. #include <linux/init.h>
  19. #include <linux/module.h>
  20. #include <linux/acpi.h>
  21. MODULE_LICENSE("GPL");
  22. static int smartconnect_acpi_init(struct acpi_device *acpi)
  23. {
  24. unsigned long long value;
  25. acpi_status status;
  26. status = acpi_evaluate_integer(acpi->handle, "GAOS", NULL, &value);
  27. if (!ACPI_SUCCESS(status))
  28. return -EINVAL;
  29. if (value & 0x1) {
  30. dev_info(&acpi->dev, "Disabling Intel Smart Connect\n");
  31. status = acpi_execute_simple_method(acpi->handle, "SAOS", 0);
  32. }
  33. return 0;
  34. }
  35. static const struct acpi_device_id smartconnect_ids[] = {
  36. {"INT33A0", 0},
  37. {"", 0}
  38. };
  39. static struct acpi_driver smartconnect_driver = {
  40. .owner = THIS_MODULE,
  41. .name = "intel_smart_connect",
  42. .class = "intel_smart_connect",
  43. .ids = smartconnect_ids,
  44. .ops = {
  45. .add = smartconnect_acpi_init,
  46. },
  47. };
  48. module_acpi_driver(smartconnect_driver);
  49. MODULE_DEVICE_TABLE(acpi, smartconnect_ids);