1 /** 2 * 3 * Copyright (C) 2018, Marvell International Ltd. and its affiliates. 4 * 5 * SPDX-License-Identifier: BSD-2-Clause-Patent 6 * 7 **/ 8 #ifndef __MV_GPIO_LIB_H__ 9 #define __MV_GPIO_LIB_H__ 10 11 #include <Protocol/EmbeddedGpio.h> 12 13 typedef enum { 14 MV_GPIO_DRIVER_TYPE_SOC_CONTROLLER, 15 MV_GPIO_DRIVER_TYPE_PCA95XX, 16 } MV_GPIO_DRIVER_TYPE; 17 18 typedef enum { 19 MV_GPIO_AP806_CONTROLLER0, 20 MV_GPIO_CP0_CONTROLLER0, 21 MV_GPIO_CP0_CONTROLLER1, 22 MV_GPIO_CP1_CONTROLLER0, 23 MV_GPIO_CP1_CONTROLLER1, 24 MV_GPIO_CP2_CONTROLLER0, 25 MV_GPIO_CP2_CONTROLLER1, 26 } MV_GPIO_SOC_CONTROLLER_TYPE; 27 28 typedef enum { 29 PCA9505_ID, 30 PCA9534_ID, 31 PCA9535_ID, 32 PCA9536_ID, 33 PCA9537_ID, 34 PCA9538_ID, 35 PCA9539_ID, 36 PCA9554_ID, 37 PCA9555_ID, 38 PCA9556_ID, 39 PCA9557_ID, 40 PCA95XX_MAX_ID, 41 } MV_GPIO_EXPANDER_TYPE_PCA95XX; 42 43 typedef struct { 44 VENDOR_DEVICE_PATH Header; 45 MV_GPIO_DRIVER_TYPE GpioDriverType; 46 EFI_DEVICE_PATH_PROTOCOL End; 47 } MV_GPIO_DEVICE_PATH; 48 49 typedef struct { 50 MV_GPIO_DRIVER_TYPE ControllerType; 51 UINTN ControllerId; 52 UINTN PinNumber; 53 BOOLEAN ActiveHigh; 54 } MV_GPIO_PIN; 55 56 EFI_STATUS 57 EFIAPI 58 MvGpioGetProtocol ( 59 IN MV_GPIO_DRIVER_TYPE GpioDriverType, 60 IN OUT EMBEDDED_GPIO **GpioProtocol 61 ); 62 63 #endif // __MV_GPIO_LIB_H__ 64