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 | |
Lukas Wunner | b717211 | 2016-02-10 14:17:41 +0100 | [diff] [blame] | 25 | #if IS_ENABLED(CONFIG_APPLE_GMUX) |
| 26 | |
Lukas Wunner | 2413306 | 2016-01-11 20:09:20 +0100 | [diff] [blame] | 27 | /** |
| 28 | * apple_gmux_present() - detect if gmux is built into the machine |
| 29 | * |
| 30 | * Drivers may use this to activate quirks specific to dual GPU MacBook Pros |
| 31 | * and Mac Pros, e.g. for deferred probing, runtime pm and backlight. |
| 32 | * |
| 33 | * Return: %true if gmux is present and the kernel was configured |
| 34 | * with CONFIG_APPLE_GMUX, %false otherwise. |
| 35 | */ |
| 36 | static inline bool apple_gmux_present(void) |
| 37 | { |
Lukas Wunner | c68ae33e | 2016-03-24 13:15:20 +0100 | [diff] [blame] | 38 | return acpi_dev_found(GMUX_ACPI_HID); |
Lukas Wunner | 2413306 | 2016-01-11 20:09:20 +0100 | [diff] [blame] | 39 | } |
| 40 | |
Lukas Wunner | b717211 | 2016-02-10 14:17:41 +0100 | [diff] [blame] | 41 | #else /* !CONFIG_APPLE_GMUX */ |
| 42 | |
| 43 | static inline bool apple_gmux_present(void) |
| 44 | { |
| 45 | return false; |
| 46 | } |
| 47 | |
| 48 | #endif /* !CONFIG_APPLE_GMUX */ |
| 49 | |
Lukas Wunner | 2413306 | 2016-01-11 20:09:20 +0100 | [diff] [blame] | 50 | #endif /* LINUX_APPLE_GMUX_H */ |