1/* $NetBSD: gpio.h,v 1.3 2021/12/18 23:45:33 riastradh Exp $ */ 2 3/* SPDX-License-Identifier: MIT */ 4#ifndef __NVBIOS_GPIO_H__ 5#define __NVBIOS_GPIO_H__ 6enum dcb_gpio_func_name { 7 DCB_GPIO_PANEL_POWER = 0x01, 8 DCB_GPIO_FAN = 0x09, 9 DCB_GPIO_TVDAC0 = 0x0c, 10 DCB_GPIO_THERM_EXT_POWER_EVENT = 0x10, 11 DCB_GPIO_TVDAC1 = 0x2d, 12 DCB_GPIO_FAN_SENSE = 0x3d, 13 DCB_GPIO_POWER_ALERT = 0x4c, 14 DCB_GPIO_EXT_POWER_LOW = 0x79, 15 DCB_GPIO_LOGO_LED_PWM = 0x84, 16 DCB_GPIO_UNUSED = 0xff, 17 DCB_GPIO_VID0 = 0x04, 18 DCB_GPIO_VID1 = 0x05, 19 DCB_GPIO_VID2 = 0x06, 20 DCB_GPIO_VID3 = 0x1a, 21 DCB_GPIO_VID4 = 0x73, 22 DCB_GPIO_VID5 = 0x74, 23 DCB_GPIO_VID6 = 0x75, 24 DCB_GPIO_VID7 = 0x76, 25 DCB_GPIO_VID_PWM = 0x81, 26}; 27 28#define DCB_GPIO_LOG_DIR 0x02 29#define DCB_GPIO_LOG_DIR_OUT 0x00 30#define DCB_GPIO_LOG_DIR_IN 0x02 31#define DCB_GPIO_LOG_VAL 0x01 32#define DCB_GPIO_LOG_VAL_LO 0x00 33#define DCB_GPIO_LOG_VAL_HI 0x01 34 35struct dcb_gpio_func { 36 u8 func; 37 u8 line; 38 u8 log[2]; 39 40 /* so far, "param" seems to only have an influence on PWM-related 41 * GPIOs such as FAN_CONTROL and PANEL_BACKLIGHT_LEVEL. 42 * if param equals 1, hardware PWM is available 43 * if param equals 0, the host should toggle the GPIO itself 44 */ 45 u8 param; 46}; 47 48u16 dcb_gpio_table(struct nvkm_bios *, u8 *ver, u8 *hdr, u8 *cnt, u8 *len); 49u16 dcb_gpio_entry(struct nvkm_bios *, int idx, int ent, u8 *ver, u8 *len); 50u16 dcb_gpio_parse(struct nvkm_bios *, int idx, int ent, u8 *ver, u8 *len, 51 struct dcb_gpio_func *); 52u16 dcb_gpio_match(struct nvkm_bios *, int idx, u8 func, u8 line, 53 u8 *ver, u8 *len, struct dcb_gpio_func *); 54#endif 55