aboutsummaryrefslogtreecommitdiff
path: root/src/drivers/apple/hybrid_graphics/gmux.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/drivers/apple/hybrid_graphics/gmux.h')
-rw-r--r--src/drivers/apple/hybrid_graphics/gmux.h43
1 files changed, 43 insertions, 0 deletions
diff --git a/src/drivers/apple/hybrid_graphics/gmux.h b/src/drivers/apple/hybrid_graphics/gmux.h
new file mode 100644
index 0000000000..075f9b6ca5
--- /dev/null
+++ b/src/drivers/apple/hybrid_graphics/gmux.h
@@ -0,0 +1,43 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+
+#ifndef DRIVERS_APPLE_GMUX_H
+#define DRIVERS_APPLE_GMUX_H
+
+#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_DDC 0x28
+#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_PORT_INTERRUPT_ENABLE 0x14
+#define GMUX_INTERRUPT_ENABLE 0xff
+#define GMUX_INTERRUPT_DISABLE 0x00
+
+#define GMUX_BRIGHTNESS_MASK 0x00ffffff
+#define GMUX_MAX_BRIGHTNESS GMUX_BRIGHTNESS_MASK
+
+#define GMUX_IOSTART 0x700
+
+u8 gmux_index_read8(u8 port);
+u8 gmux_pio_read8(u8 port);
+u8 gmux_read8(const struct device *dev, u8 port);
+
+void gmux_index_write8(u8 port, u8 val);
+void gmux_pio_write8(u8 port, u8 val);
+void gmux_write8(const struct device *dev, u8 port, u8 val);
+
+u32 gmux_index_read32(u8 port);
+u32 gmux_pio_read32(u8 port);
+u32 gmux_read32(const struct device *dev, u8 port);
+
+void gmux_switch(const struct device *dev, bool dgpu);
+void gmux_dgpu_power_enable(const struct device *dev, bool enable);
+
+#endif /* DRIVERS_APPLE_GMUX_H */