aboutsummaryrefslogtreecommitdiffstats
path: root/sound/aoa/aoa-gpio.h
diff options
context:
space:
mode:
authorJohannes Berg <johannes@sipsolutions.net>2006-06-21 09:42:43 -0400
committerJaroslav Kysela <perex@suse.cz>2006-06-22 15:34:38 -0400
commitf3d9478b2ce468c3115b02ecae7e975990697f15 (patch)
tree8397671cbf251c54bf539016468164e08d0c45ee /sound/aoa/aoa-gpio.h
parent41f0cd3a0c4c6547860cf3b1c2d7968008e6c071 (diff)
[ALSA] snd-aoa: add snd-aoa
This large patch adds all of snd-aoa. Consisting of many modules, it currently replaces snd-powermac for all layout-id based machines and handles many more (for example new powerbooks and powermacs with digital output that previously couldn't be used at all). It also has support for all layout-IDs that Apple has (judging from their Info.plist file) but not all are tested. The driver currently has 2 known regressions over snd-powermac: * it doesn't handle powermac 7,2 and 7,3 * it doesn't have a DRC control on snapper-based machines I will fix those during the 2.6.18 development cycle. Signed-off-by: Johannes Berg <johannes@sipsolutions.net> Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/aoa/aoa-gpio.h')
-rw-r--r--sound/aoa/aoa-gpio.h81
1 files changed, 81 insertions, 0 deletions
diff --git a/sound/aoa/aoa-gpio.h b/sound/aoa/aoa-gpio.h
new file mode 100644
index 000000000000..3a61f3115573
--- /dev/null
+++ b/sound/aoa/aoa-gpio.h
@@ -0,0 +1,81 @@
1/*
2 * Apple Onboard Audio GPIO definitions
3 *
4 * Copyright 2006 Johannes Berg <johannes@sipsolutions.net>
5 *
6 * GPL v2, can be found in COPYING.
7 */
8
9#ifndef __AOA_GPIO_H
10#define __AOA_GPIO_H
11#include <linux/workqueue.h>
12#include <linux/mutex.h>
13#include <asm/prom.h>
14
15typedef void (*notify_func_t)(void *data);
16
17enum notify_type {
18 AOA_NOTIFY_HEADPHONE,
19 AOA_NOTIFY_LINE_IN,
20 AOA_NOTIFY_LINE_OUT,
21};
22
23struct gpio_runtime;
24struct gpio_methods {
25 /* for initialisation/de-initialisation of the GPIO layer */
26 void (*init)(struct gpio_runtime *rt);
27 void (*exit)(struct gpio_runtime *rt);
28
29 /* turn off headphone, speakers, lineout */
30 void (*all_amps_off)(struct gpio_runtime *rt);
31 /* turn headphone, speakers, lineout back to previous setting */
32 void (*all_amps_restore)(struct gpio_runtime *rt);
33
34 void (*set_headphone)(struct gpio_runtime *rt, int on);
35 void (*set_speakers)(struct gpio_runtime *rt, int on);
36 void (*set_lineout)(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
42 void (*set_hw_reset)(struct gpio_runtime *rt, int on);
43
44 /* use this to be notified of any events. The notification
45 * function is passed the data, and is called in process
46 * context by the use of schedule_work.
47 * The interface for it is that setting a function to NULL
48 * removes it, and they return 0 if the operation succeeded,
49 * and -EBUSY if the notification is already assigned by
50 * someone else. */
51 int (*set_notify)(struct gpio_runtime *rt,
52 enum notify_type type,
53 notify_func_t notify,
54 void *data);
55 /* returns 0 if not plugged in, 1 if plugged in
56 * or a negative error code */
57 int (*get_detect)(struct gpio_runtime *rt,
58 enum notify_type type);
59};
60
61struct gpio_notification {
62 notify_func_t notify;
63 void *data;
64 void *gpio_private;
65 struct work_struct work;
66 struct mutex mutex;
67};
68
69struct gpio_runtime {
70 /* to be assigned by fabric */
71 struct device_node *node;
72 /* since everyone needs this pointer anyway... */
73 struct gpio_methods *methods;
74 /* to be used by the gpio implementation */
75 int implementation_private;
76 struct gpio_notification headphone_notify;
77 struct gpio_notification line_in_notify;
78 struct gpio_notification line_out_notify;
79};
80
81#endif /* __AOA_GPIO_H */