aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hid/hid-wiimote.h
diff options
context:
space:
mode:
authorDavid Herrmann <dh.herrmann@googlemail.com>2011-11-17 08:12:01 -0500
committerJiri Kosina <jkosina@suse.cz>2011-11-22 17:08:28 -0500
commitcb99221ba74bb16576a9c3b7e49357b6b12ff3ea (patch)
tree3aee851b0643491ba0208b022c92335e0e9550dd /drivers/hid/hid-wiimote.h
parentfad8c0e34323eb7789f93750258a2cf02dc6cf69 (diff)
HID: wiimote: Add extension support stub
The wiimote supports several extensions. This adds a separate source file which handles all extensions and can be disabled at compile-time. The driver reacts on "plug"-events on the extension port and starts a worker which initializes or deinitializes the extensions. Currently, the initialization logic is not fully understood and we can only detect and enable all extensions when all extensions are deactivated. Therefore, we need to disable all extensions, then detect and activate them again to react on "plug"-events. However, deactivating extensions will generate a new "plug"-event and we will never leave that loop. Hence, we only support extensions if they are plugged before the wiimote is connected (or before the ext-input device is opened). In the future we may support full extension hotplug support, but reverse-engineering this may take a while. Signed-off-by: David Herrmann <dh.herrmann@googlemail.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Diffstat (limited to 'drivers/hid/hid-wiimote.h')
-rw-r--r--drivers/hid/hid-wiimote.h17
1 files changed, 17 insertions, 0 deletions
diff --git a/drivers/hid/hid-wiimote.h b/drivers/hid/hid-wiimote.h
index 865740d3a3fe..abbfab8f60b7 100644
--- a/drivers/hid/hid-wiimote.h
+++ b/drivers/hid/hid-wiimote.h
@@ -73,6 +73,7 @@ struct wiimote_data {
73 struct input_dev *accel; 73 struct input_dev *accel;
74 struct input_dev *ir; 74 struct input_dev *ir;
75 struct power_supply battery; 75 struct power_supply battery;
76 struct wiimote_ext *ext;
76 77
77 spinlock_t qlock; 78 spinlock_t qlock;
78 __u8 head; 79 __u8 head;
@@ -118,6 +119,22 @@ extern int wiimote_cmd_write(struct wiimote_data *wdata, __u32 offset,
118extern ssize_t wiimote_cmd_read(struct wiimote_data *wdata, __u32 offset, 119extern ssize_t wiimote_cmd_read(struct wiimote_data *wdata, __u32 offset,
119 __u8 *rmem, __u8 size); 120 __u8 *rmem, __u8 size);
120 121
122#ifdef CONFIG_HID_WIIMOTE_EXT
123
124extern int wiiext_init(struct wiimote_data *wdata);
125extern void wiiext_deinit(struct wiimote_data *wdata);
126extern void wiiext_event(struct wiimote_data *wdata, bool plugged);
127extern bool wiiext_active(struct wiimote_data *wdata);
128
129#else
130
131static inline int wiiext_init(void *u) { return 0; }
132static inline void wiiext_deinit(void *u) { }
133static inline void wiiext_event(void *u, bool p) { }
134static inline bool wiiext_active(void *u) { return false; }
135
136#endif
137
121/* requires the state.lock spinlock to be held */ 138/* requires the state.lock spinlock to be held */
122static inline bool wiimote_cmd_pending(struct wiimote_data *wdata, int cmd, 139static inline bool wiimote_cmd_pending(struct wiimote_data *wdata, int cmd,
123 __u32 opt) 140 __u32 opt)