1 /* SPDX-License-Identifier: BSD-3-Clause 2 * 3 * Copyright(c) 2019 Intel Corporation. All rights reserved. 4 * 5 * Author: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com> 6 */ 7 8 #ifndef __SOF_DRIVERS_GPIO_H__ 9 #define __SOF_DRIVERS_GPIO_H__ 10 11 #include <sof/drivers/iomux.h> 12 13 struct gpio; 14 15 enum gpio_direction { 16 GPIO_DIRECTION_INPUT, 17 GPIO_DIRECTION_OUTPUT, 18 }; 19 20 enum gpio_level { 21 GPIO_LEVEL_LOW, 22 GPIO_LEVEL_HIGH, 23 }; 24 25 struct gpio_config { 26 enum gpio_direction direction; 27 }; 28 29 struct gpio_pin_config { 30 unsigned int mux_id; 31 struct iomux_pin_config mux_config; 32 }; 33 34 extern const struct gpio_pin_config gpio_data[]; 35 extern const int n_gpios; 36 37 int gpio_write(const struct gpio *gpio, unsigned int port, 38 enum gpio_level level); 39 int gpio_read(const struct gpio *gpio, unsigned int port); 40 int gpio_configure(const struct gpio *gpio, unsigned int port, 41 const struct gpio_config *config); 42 const struct gpio *gpio_get(unsigned int id); 43 int gpio_probe(const struct gpio *gpio); 44 45 #endif /* __SOF_DRIVERS_GPIO_H__ */ 46