1/* $NetBSD: priv.h,v 1.3 2021/12/18 23:45:39 riastradh Exp $ */ 2 3/* SPDX-License-Identifier: MIT */ 4#ifndef __NVKM_GPIO_PRIV_H__ 5#define __NVKM_GPIO_PRIV_H__ 6#define nvkm_gpio(p) container_of((p), struct nvkm_gpio, subdev) 7#include <subdev/gpio.h> 8 9struct nvkm_gpio_func { 10 int lines; 11 12 /* read and ack pending interrupts, returning only data 13 * for lines that have not been masked off, while still 14 * performing the ack for anything that was pending. 15 */ 16 void (*intr_stat)(struct nvkm_gpio *, u32 *, u32 *); 17 18 /* mask on/off interrupts for hi/lo transitions on a 19 * given set of gpio lines 20 */ 21 void (*intr_mask)(struct nvkm_gpio *, u32, u32, u32); 22 23 /* configure gpio direction and output value */ 24 int (*drive)(struct nvkm_gpio *, int line, int dir, int out); 25 26 /* sense current state of given gpio line */ 27 int (*sense)(struct nvkm_gpio *, int line); 28 29 /*XXX*/ 30 void (*reset)(struct nvkm_gpio *, u8); 31}; 32 33int nvkm_gpio_new_(const struct nvkm_gpio_func *, struct nvkm_device *, 34 int index, struct nvkm_gpio **); 35 36void nv50_gpio_reset(struct nvkm_gpio *, u8); 37int nv50_gpio_drive(struct nvkm_gpio *, int, int, int); 38int nv50_gpio_sense(struct nvkm_gpio *, int); 39 40void g94_gpio_intr_stat(struct nvkm_gpio *, u32 *, u32 *); 41void g94_gpio_intr_mask(struct nvkm_gpio *, u32, u32, u32); 42 43void gf119_gpio_reset(struct nvkm_gpio *, u8); 44int gf119_gpio_drive(struct nvkm_gpio *, int, int, int); 45int gf119_gpio_sense(struct nvkm_gpio *, int); 46#endif 47