]> git.kernelconcepts.de Git - karo-tx-linux.git/blob - drivers/gpu/drm/nouveau/core/include/subdev/gpio.h
Merge branch 'drm-next' of git://people.freedesktop.org/~airlied/linux
[karo-tx-linux.git] / drivers / gpu / drm / nouveau / core / include / subdev / gpio.h
1 #ifndef __NOUVEAU_GPIO_H__
2 #define __NOUVEAU_GPIO_H__
3
4 #include <core/subdev.h>
5 #include <core/device.h>
6 #include <core/event.h>
7
8 #include <subdev/bios.h>
9 #include <subdev/bios/gpio.h>
10
11 struct nouveau_gpio {
12         struct nouveau_subdev base;
13
14         struct nouveau_event *events;
15
16         /* hardware interfaces */
17         void (*reset)(struct nouveau_gpio *, u8 func);
18         int  (*drive)(struct nouveau_gpio *, int line, int dir, int out);
19         int  (*sense)(struct nouveau_gpio *, int line);
20
21         /* software interfaces */
22         int  (*find)(struct nouveau_gpio *, int idx, u8 tag, u8 line,
23                      struct dcb_gpio_func *);
24         int  (*set)(struct nouveau_gpio *, int idx, u8 tag, u8 line, int state);
25         int  (*get)(struct nouveau_gpio *, int idx, u8 tag, u8 line);
26 };
27
28 static inline struct nouveau_gpio *
29 nouveau_gpio(void *obj)
30 {
31         return (void *)nv_device(obj)->subdev[NVDEV_SUBDEV_GPIO];
32 }
33
34 #define nouveau_gpio_create(p,e,o,l,d)                                         \
35         nouveau_gpio_create_((p), (e), (o), (l), sizeof(**d), (void **)d)
36 #define nouveau_gpio_destroy(p) ({                                             \
37         struct nouveau_gpio *gpio = (p);                                       \
38         _nouveau_gpio_dtor(nv_object(gpio));                                   \
39 })
40 #define nouveau_gpio_fini(p,s)                                                 \
41         nouveau_subdev_fini(&(p)->base, (s))
42
43 int  nouveau_gpio_create_(struct nouveau_object *, struct nouveau_object *,
44                           struct nouveau_oclass *, int, int, void **);
45 void _nouveau_gpio_dtor(struct nouveau_object *);
46 int  nouveau_gpio_init(struct nouveau_gpio *);
47
48 extern struct nouveau_oclass nv10_gpio_oclass;
49 extern struct nouveau_oclass nv50_gpio_oclass;
50 extern struct nouveau_oclass nvd0_gpio_oclass;
51 extern struct nouveau_oclass nve0_gpio_oclass;
52
53 #endif