apple-gmux.h 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. /*
  2. * apple-gmux.h - microcontroller built into dual GPU MacBook Pro & Mac Pro
  3. * Copyright (C) 2015 Lukas Wunner <lukas@wunner.de>
  4. *
  5. * This program is free software; you can redistribute it and/or modify
  6. * it under the terms of the GNU General Public License (version 2) as
  7. * published by the Free Software Foundation.
  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
  15. * along with this program; if not, see <http://www.gnu.org/licenses/>.
  16. */
  17. #ifndef LINUX_APPLE_GMUX_H
  18. #define LINUX_APPLE_GMUX_H
  19. #include <linux/acpi.h>
  20. #define GMUX_ACPI_HID "APP000B"
  21. #if IS_ENABLED(CONFIG_APPLE_GMUX)
  22. /**
  23. * apple_gmux_present() - detect if gmux is built into the machine
  24. *
  25. * Drivers may use this to activate quirks specific to dual GPU MacBook Pros
  26. * and Mac Pros, e.g. for deferred probing, runtime pm and backlight.
  27. *
  28. * Return: %true if gmux is present and the kernel was configured
  29. * with CONFIG_APPLE_GMUX, %false otherwise.
  30. */
  31. static inline bool apple_gmux_present(void)
  32. {
  33. return acpi_dev_found(GMUX_ACPI_HID);
  34. }
  35. #else /* !CONFIG_APPLE_GMUX */
  36. static inline bool apple_gmux_present(void)
  37. {
  38. return false;
  39. }
  40. #endif /* !CONFIG_APPLE_GMUX */
  41. #endif /* LINUX_APPLE_GMUX_H */