1 #ifndef __NVKM_GPIO_PRIV_H__
2 #define __NVKM_GPIO_PRIV_H__
3 #include <subdev/gpio.h>
5 #define nvkm_gpio_create(p,e,o,d) \
6 nvkm_gpio_create_((p), (e), (o), sizeof(**d), (void **)d)
7 #define nvkm_gpio_destroy(p) ({ \
8 struct nvkm_gpio *gpio = (p); \
9 _nvkm_gpio_dtor(nv_object(gpio)); \
11 #define nvkm_gpio_init(p) ({ \
12 struct nvkm_gpio *gpio = (p); \
13 _nvkm_gpio_init(nv_object(gpio)); \
15 #define nvkm_gpio_fini(p,s) ({ \
16 struct nvkm_gpio *gpio = (p); \
17 _nvkm_gpio_fini(nv_object(gpio), (s)); \
20 int nvkm_gpio_create_(struct nvkm_object
*, struct nvkm_object
*,
21 struct nvkm_oclass
*, int, void **);
22 int _nvkm_gpio_ctor(struct nvkm_object
*, struct nvkm_object
*,
23 struct nvkm_oclass
*, void *, u32
,
24 struct nvkm_object
**);
25 void _nvkm_gpio_dtor(struct nvkm_object
*);
26 int _nvkm_gpio_init(struct nvkm_object
*);
27 int _nvkm_gpio_fini(struct nvkm_object
*, bool);
29 struct nvkm_gpio_impl
{
30 struct nvkm_oclass base
;
33 /* read and ack pending interrupts, returning only data
34 * for lines that have not been masked off, while still
35 * performing the ack for anything that was pending.
37 void (*intr_stat
)(struct nvkm_gpio
*, u32
*, u32
*);
39 /* mask on/off interrupts for hi/lo transitions on a
40 * given set of gpio lines
42 void (*intr_mask
)(struct nvkm_gpio
*, u32
, u32
, u32
);
44 /* configure gpio direction and output value */
45 int (*drive
)(struct nvkm_gpio
*, int line
, int dir
, int out
);
47 /* sense current state of given gpio line */
48 int (*sense
)(struct nvkm_gpio
*, int line
);
51 void (*reset
)(struct nvkm_gpio
*, u8
);
54 void nv50_gpio_reset(struct nvkm_gpio
*, u8
);
55 int nv50_gpio_drive(struct nvkm_gpio
*, int, int, int);
56 int nv50_gpio_sense(struct nvkm_gpio
*, int);
58 void g94_gpio_intr_stat(struct nvkm_gpio
*, u32
*, u32
*);
59 void g94_gpio_intr_mask(struct nvkm_gpio
*, u32
, u32
, u32
);
61 void gf110_gpio_reset(struct nvkm_gpio
*, u8
);
62 int gf110_gpio_drive(struct nvkm_gpio
*, int, int, int);
63 int gf110_gpio_sense(struct nvkm_gpio
*, int);