Home | History | Annotate | Line # | Download | only in gpio
      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 
      9 struct 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 
     33 int nvkm_gpio_new_(const struct nvkm_gpio_func *, struct nvkm_device *,
     34 		   int index, struct nvkm_gpio **);
     35 
     36 void nv50_gpio_reset(struct nvkm_gpio *, u8);
     37 int  nv50_gpio_drive(struct nvkm_gpio *, int, int, int);
     38 int  nv50_gpio_sense(struct nvkm_gpio *, int);
     39 
     40 void g94_gpio_intr_stat(struct nvkm_gpio *, u32 *, u32 *);
     41 void g94_gpio_intr_mask(struct nvkm_gpio *, u32, u32, u32);
     42 
     43 void gf119_gpio_reset(struct nvkm_gpio *, u8);
     44 int  gf119_gpio_drive(struct nvkm_gpio *, int, int, int);
     45 int  gf119_gpio_sense(struct nvkm_gpio *, int);
     46 #endif
     47