Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: MIT */
0002 #ifndef __NVKM_GPIO_PRIV_H__
0003 #define __NVKM_GPIO_PRIV_H__
0004 #define nvkm_gpio(p) container_of((p), struct nvkm_gpio, subdev)
0005 #include <subdev/gpio.h>
0006 
0007 struct nvkm_gpio_func {
0008     int lines;
0009 
0010     /* read and ack pending interrupts, returning only data
0011      * for lines that have not been masked off, while still
0012      * performing the ack for anything that was pending.
0013      */
0014     void (*intr_stat)(struct nvkm_gpio *, u32 *, u32 *);
0015 
0016     /* mask on/off interrupts for hi/lo transitions on a
0017      * given set of gpio lines
0018      */
0019     void (*intr_mask)(struct nvkm_gpio *, u32, u32, u32);
0020 
0021     /* configure gpio direction and output value */
0022     int  (*drive)(struct nvkm_gpio *, int line, int dir, int out);
0023 
0024     /* sense current state of given gpio line */
0025     int  (*sense)(struct nvkm_gpio *, int line);
0026 
0027     /*XXX*/
0028     void (*reset)(struct nvkm_gpio *, u8);
0029 };
0030 
0031 int nvkm_gpio_new_(const struct nvkm_gpio_func *, struct nvkm_device *, enum nvkm_subdev_type, int,
0032            struct nvkm_gpio **);
0033 
0034 void nv50_gpio_reset(struct nvkm_gpio *, u8);
0035 int  nv50_gpio_drive(struct nvkm_gpio *, int, int, int);
0036 int  nv50_gpio_sense(struct nvkm_gpio *, int);
0037 
0038 void g94_gpio_intr_stat(struct nvkm_gpio *, u32 *, u32 *);
0039 void g94_gpio_intr_mask(struct nvkm_gpio *, u32, u32, u32);
0040 
0041 void gf119_gpio_reset(struct nvkm_gpio *, u8);
0042 int  gf119_gpio_drive(struct nvkm_gpio *, int, int, int);
0043 int  gf119_gpio_sense(struct nvkm_gpio *, int);
0044 #endif