Lukas Wunner | 2413306 | 2016-01-11 20:09:20 +0100 | [diff] [blame] | 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 | |
| 18 | #ifndef LINUX_APPLE_GMUX_H |
| 19 | #define LINUX_APPLE_GMUX_H |
| 20 | |
| 21 | #include <linux/acpi.h> |
| 22 | |
| 23 | #define GMUX_ACPI_HID "APP000B" |
| 24 | |
| 25 | /** |
| 26 | * apple_gmux_present() - detect if gmux is built into the machine |
| 27 | * |
| 28 | * Drivers may use this to activate quirks specific to dual GPU MacBook Pros |
| 29 | * and Mac Pros, e.g. for deferred probing, runtime pm and backlight. |
| 30 | * |
| 31 | * Return: %true if gmux is present and the kernel was configured |
| 32 | * with CONFIG_APPLE_GMUX, %false otherwise. |
| 33 | */ |
| 34 | static inline bool apple_gmux_present(void) |
| 35 | { |
| 36 | return IS_ENABLED(CONFIG_APPLE_GMUX) && acpi_dev_present(GMUX_ACPI_HID); |
| 37 | } |
| 38 | |
| 39 | #endif /* LINUX_APPLE_GMUX_H */ |