0001
0002
0003
0004
0005
0006
0007
0008 #ifndef __AOA_GPIO_H
0009 #define __AOA_GPIO_H
0010 #include <linux/workqueue.h>
0011 #include <linux/mutex.h>
0012 #include <asm/prom.h>
0013
0014 typedef void (*notify_func_t)(void *data);
0015
0016 enum notify_type {
0017 AOA_NOTIFY_HEADPHONE,
0018 AOA_NOTIFY_LINE_IN,
0019 AOA_NOTIFY_LINE_OUT,
0020 };
0021
0022 struct gpio_runtime;
0023 struct gpio_methods {
0024
0025 void (*init)(struct gpio_runtime *rt);
0026 void (*exit)(struct gpio_runtime *rt);
0027
0028
0029 void (*all_amps_off)(struct gpio_runtime *rt);
0030
0031 void (*all_amps_restore)(struct gpio_runtime *rt);
0032
0033 void (*set_headphone)(struct gpio_runtime *rt, int on);
0034 void (*set_speakers)(struct gpio_runtime *rt, int on);
0035 void (*set_lineout)(struct gpio_runtime *rt, int on);
0036 void (*set_master)(struct gpio_runtime *rt, int on);
0037
0038 int (*get_headphone)(struct gpio_runtime *rt);
0039 int (*get_speakers)(struct gpio_runtime *rt);
0040 int (*get_lineout)(struct gpio_runtime *rt);
0041 int (*get_master)(struct gpio_runtime *rt);
0042
0043 void (*set_hw_reset)(struct gpio_runtime *rt, int on);
0044
0045
0046
0047
0048
0049
0050
0051
0052 int (*set_notify)(struct gpio_runtime *rt,
0053 enum notify_type type,
0054 notify_func_t notify,
0055 void *data);
0056
0057
0058 int (*get_detect)(struct gpio_runtime *rt,
0059 enum notify_type type);
0060 };
0061
0062 struct gpio_notification {
0063 struct delayed_work work;
0064 notify_func_t notify;
0065 void *data;
0066 void *gpio_private;
0067 struct mutex mutex;
0068 };
0069
0070 struct gpio_runtime {
0071
0072 struct device_node *node;
0073
0074 struct gpio_methods *methods;
0075
0076 int implementation_private;
0077 struct gpio_notification headphone_notify;
0078 struct gpio_notification line_in_notify;
0079 struct gpio_notification line_out_notify;
0080 };
0081
0082 #endif