1
2
3
4
5
6
7
8 #ifndef __AOA_GPIO_H
9 #define __AOA_GPIO_H
10 #include <linux/workqueue.h>
11 #include <linux/mutex.h>
12 #include <asm/prom.h>
13
14 typedef void (*notify_func_t)(void *data);
15
16 enum notify_type {
17 AOA_NOTIFY_HEADPHONE,
18 AOA_NOTIFY_LINE_IN,
19 AOA_NOTIFY_LINE_OUT,
20 };
21
22 struct gpio_runtime;
23 struct gpio_methods {
24
25 void (*init)(struct gpio_runtime *rt);
26 void (*exit)(struct gpio_runtime *rt);
27
28
29 void (*all_amps_off)(struct gpio_runtime *rt);
30
31 void (*all_amps_restore)(struct gpio_runtime *rt);
32
33 void (*set_headphone)(struct gpio_runtime *rt, int on);
34 void (*set_speakers)(struct gpio_runtime *rt, int on);
35 void (*set_lineout)(struct gpio_runtime *rt, int on);
36 void (*set_master)(struct gpio_runtime *rt, int on);
37
38 int (*get_headphone)(struct gpio_runtime *rt);
39 int (*get_speakers)(struct gpio_runtime *rt);
40 int (*get_lineout)(struct gpio_runtime *rt);
41 int (*get_master)(struct gpio_runtime *rt);
42
43 void (*set_hw_reset)(struct gpio_runtime *rt, int on);
44
45
46
47
48
49
50
51
52 int (*set_notify)(struct gpio_runtime *rt,
53 enum notify_type type,
54 notify_func_t notify,
55 void *data);
56
57
58 int (*get_detect)(struct gpio_runtime *rt,
59 enum notify_type type);
60 };
61
62 struct gpio_notification {
63 struct delayed_work work;
64 notify_func_t notify;
65 void *data;
66 void *gpio_private;
67 struct mutex mutex;
68 };
69
70 struct gpio_runtime {
71
72 struct device_node *node;
73
74 struct gpio_methods *methods;
75
76 int implementation_private;
77 struct gpio_notification headphone_notify;
78 struct gpio_notification line_in_notify;
79 struct gpio_notification line_out_notify;
80 };
81
82 #endif