linux/include/linux/apple-gmux.h

/* SPDX-License-Identifier: GPL-2.0-only */
/*
 * apple-gmux.h - microcontroller built into dual GPU MacBook Pro & Mac Pro
 * Copyright (C) 2015 Lukas Wunner <[email protected]>
 */

#ifndef LINUX_APPLE_GMUX_H
#define LINUX_APPLE_GMUX_H

#include <linux/acpi.h>
#include <linux/io.h>
#include <linux/pnp.h>

#define GMUX_ACPI_HID

/*
 * 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
#define GMUX_PORT_VERSION_MINOR
#define GMUX_PORT_VERSION_RELEASE
#define GMUX_PORT_SWITCH_DISPLAY
#define GMUX_PORT_SWITCH_GET_DISPLAY
#define GMUX_PORT_INTERRUPT_ENABLE
#define GMUX_PORT_INTERRUPT_STATUS
#define GMUX_PORT_SWITCH_DDC
#define GMUX_PORT_SWITCH_EXTERNAL
#define GMUX_PORT_SWITCH_GET_EXTERNAL
#define GMUX_PORT_DISCRETE_POWER
#define GMUX_PORT_MAX_BRIGHTNESS
#define GMUX_PORT_BRIGHTNESS
#define GMUX_PORT_VALUE
#define GMUX_PORT_READ
#define GMUX_PORT_WRITE

#define GMUX_MMIO_PORT_SELECT
#define GMUX_MMIO_COMMAND_SEND

#define GMUX_MMIO_READ
#define GMUX_MMIO_WRITE

#define GMUX_MIN_IO_LEN

enum apple_gmux_type {};

#if IS_ENABLED(CONFIG_APPLE_GMUX)
static inline bool apple_gmux_is_indexed(unsigned long iostart)
{}

static inline bool apple_gmux_is_mmio(unsigned long iostart)
{}

/**
 * apple_gmux_detect() - detect if gmux is built into the machine
 *
 * @pnp_dev:     Device to probe or NULL to use the first matching device
 * @type_ret: Returns (by reference) the apple_gmux_type of the device
 *
 * Detect if a supported gmux device is present by actually probing it.
 * This avoids the false positives returned on some models by
 * apple_gmux_present().
 *
 * Return: %true if a supported gmux ACPI device is detected and the kernel
 * was configured with CONFIG_APPLE_GMUX, %false otherwise.
 */
static inline bool apple_gmux_detect(struct pnp_dev *pnp_dev, enum apple_gmux_type *type_ret)
{}

/**
 * apple_gmux_present() - check if gmux ACPI device is present
 *
 * 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 ACPI device is present and the kernel was configured
 * with CONFIG_APPLE_GMUX, %false otherwise.
 */
static inline bool apple_gmux_present(void)
{}

#else  /* !CONFIG_APPLE_GMUX */

static inline bool apple_gmux_present(void)
{
	return false;
}

static inline bool apple_gmux_detect(struct pnp_dev *pnp_dev, bool *indexed_ret)
{
	return false;
}

#endif /* !CONFIG_APPLE_GMUX */

#endif /* LINUX_APPLE_GMUX_H */