2019-06-03 05:44:50 +00:00
|
|
|
/* SPDX-License-Identifier: GPL-2.0-only */
|
2016-01-11 19:09:20 +00:00
|
|
|
/*
|
|
|
|
* apple-gmux.h - microcontroller built into dual GPU MacBook Pro & Mac Pro
|
|
|
|
* Copyright (C) 2015 Lukas Wunner <lukas@wunner.de>
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef LINUX_APPLE_GMUX_H
|
|
|
|
#define LINUX_APPLE_GMUX_H
|
|
|
|
|
|
|
|
#include <linux/acpi.h>
|
|
|
|
|
|
|
|
#define GMUX_ACPI_HID "APP000B"
|
|
|
|
|
2023-01-24 10:57:52 +00:00
|
|
|
/*
|
|
|
|
* gmux port offsets. Many of these are not yet used, but may be in the
|
|
|
|
* future, and it's useful to have them documented here anyhow.
|
|
|
|
*/
|
|
|
|
#define GMUX_PORT_VERSION_MAJOR 0x04
|
|
|
|
#define GMUX_PORT_VERSION_MINOR 0x05
|
|
|
|
#define GMUX_PORT_VERSION_RELEASE 0x06
|
|
|
|
#define GMUX_PORT_SWITCH_DISPLAY 0x10
|
|
|
|
#define GMUX_PORT_SWITCH_GET_DISPLAY 0x11
|
|
|
|
#define GMUX_PORT_INTERRUPT_ENABLE 0x14
|
|
|
|
#define GMUX_PORT_INTERRUPT_STATUS 0x16
|
|
|
|
#define GMUX_PORT_SWITCH_DDC 0x28
|
|
|
|
#define GMUX_PORT_SWITCH_EXTERNAL 0x40
|
|
|
|
#define GMUX_PORT_SWITCH_GET_EXTERNAL 0x41
|
|
|
|
#define GMUX_PORT_DISCRETE_POWER 0x50
|
|
|
|
#define GMUX_PORT_MAX_BRIGHTNESS 0x70
|
|
|
|
#define GMUX_PORT_BRIGHTNESS 0x74
|
|
|
|
#define GMUX_PORT_VALUE 0xc2
|
|
|
|
#define GMUX_PORT_READ 0xd0
|
|
|
|
#define GMUX_PORT_WRITE 0xd4
|
|
|
|
|
|
|
|
#define GMUX_MIN_IO_LEN (GMUX_PORT_BRIGHTNESS + 4)
|
|
|
|
|
2016-02-10 13:17:41 +00:00
|
|
|
#if IS_ENABLED(CONFIG_APPLE_GMUX)
|
|
|
|
|
2016-01-11 19:09:20 +00:00
|
|
|
/**
|
|
|
|
* apple_gmux_present() - detect if gmux is built into the machine
|
|
|
|
*
|
|
|
|
* Drivers may use this to activate quirks specific to dual GPU MacBook Pros
|
|
|
|
* and Mac Pros, e.g. for deferred probing, runtime pm and backlight.
|
|
|
|
*
|
|
|
|
* Return: %true if gmux is present and the kernel was configured
|
|
|
|
* with CONFIG_APPLE_GMUX, %false otherwise.
|
|
|
|
*/
|
|
|
|
static inline bool apple_gmux_present(void)
|
|
|
|
{
|
2016-03-24 12:15:20 +00:00
|
|
|
return acpi_dev_found(GMUX_ACPI_HID);
|
2016-01-11 19:09:20 +00:00
|
|
|
}
|
|
|
|
|
2016-02-10 13:17:41 +00:00
|
|
|
#else /* !CONFIG_APPLE_GMUX */
|
|
|
|
|
|
|
|
static inline bool apple_gmux_present(void)
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif /* !CONFIG_APPLE_GMUX */
|
|
|
|
|
2016-01-11 19:09:20 +00:00
|
|
|
#endif /* LINUX_APPLE_GMUX_H */
|