blob: 714186de8c3629c5ebcc44da6660f77eb7c31523 [file] [log] [blame]
Lukas Wunner24133062016-01-11 20:09:20 +01001/*
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 Wunnerb7172112016-02-10 14:17:41 +010025#if IS_ENABLED(CONFIG_APPLE_GMUX)
26
Lukas Wunner24133062016-01-11 20:09:20 +010027/**
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 */
36static inline bool apple_gmux_present(void)
37{
Lukas Wunnerc68ae33e2016-03-24 13:15:20 +010038 return acpi_dev_found(GMUX_ACPI_HID);
Lukas Wunner24133062016-01-11 20:09:20 +010039}
40
Lukas Wunnerb7172112016-02-10 14:17:41 +010041#else /* !CONFIG_APPLE_GMUX */
42
43static inline bool apple_gmux_present(void)
44{
45 return false;
46}
47
48#endif /* !CONFIG_APPLE_GMUX */
49
Lukas Wunner24133062016-01-11 20:09:20 +010050#endif /* LINUX_APPLE_GMUX_H */