Merge branch 'x86-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel...
[deliverable/linux.git] / drivers / hid / hid-wiimote.h
index d78f79c0890188441d2d9bcbd93f4117f82e6ebc..c81dbeb086c556b097dbfb3030bdf2dc62b382f3 100644 (file)
@@ -52,6 +52,7 @@ struct wiimote_state {
        spinlock_t lock;
        __u8 flags;
        __u8 accel_split[2];
+       __u8 drm;
 
        /* synchronous cmd requests */
        struct mutex sync;
@@ -62,6 +63,8 @@ struct wiimote_state {
        /* results of synchronous requests */
        __u8 cmd_battery;
        __u8 cmd_err;
+       __u8 *cmd_read_buf;
+       __u8 cmd_read_size;
 };
 
 struct wiimote_data {
@@ -71,6 +74,8 @@ struct wiimote_data {
        struct input_dev *accel;
        struct input_dev *ir;
        struct power_supply battery;
+       struct wiimote_ext *ext;
+       struct wiimote_debug *debug;
 
        spinlock_t qlock;
        __u8 head;
@@ -105,6 +110,7 @@ enum wiiproto_reqs {
        WIIPROTO_REQ_DRM_E = 0x3d,
        WIIPROTO_REQ_DRM_SKAI1 = 0x3e,
        WIIPROTO_REQ_DRM_SKAI2 = 0x3f,
+       WIIPROTO_REQ_MAX
 };
 
 #define dev_to_wii(pdev) hid_get_drvdata(container_of(pdev, struct hid_device, \
@@ -113,6 +119,45 @@ enum wiiproto_reqs {
 extern void wiiproto_req_drm(struct wiimote_data *wdata, __u8 drm);
 extern int wiimote_cmd_write(struct wiimote_data *wdata, __u32 offset,
                                                const __u8 *wmem, __u8 size);
+extern ssize_t wiimote_cmd_read(struct wiimote_data *wdata, __u32 offset,
+                                                       __u8 *rmem, __u8 size);
+
+#define wiiproto_req_rreg(wdata, os, sz) \
+                               wiiproto_req_rmem((wdata), false, (os), (sz))
+#define wiiproto_req_reeprom(wdata, os, sz) \
+                               wiiproto_req_rmem((wdata), true, (os), (sz))
+extern void wiiproto_req_rmem(struct wiimote_data *wdata, bool eeprom,
+                                               __u32 offset, __u16 size);
+
+#ifdef CONFIG_HID_WIIMOTE_EXT
+
+extern int wiiext_init(struct wiimote_data *wdata);
+extern void wiiext_deinit(struct wiimote_data *wdata);
+extern void wiiext_event(struct wiimote_data *wdata, bool plugged);
+extern bool wiiext_active(struct wiimote_data *wdata);
+extern void wiiext_handle(struct wiimote_data *wdata, const __u8 *payload);
+
+#else
+
+static inline int wiiext_init(void *u) { return 0; }
+static inline void wiiext_deinit(void *u) { }
+static inline void wiiext_event(void *u, bool p) { }
+static inline bool wiiext_active(void *u) { return false; }
+static inline void wiiext_handle(void *u, const __u8 *p) { }
+
+#endif
+
+#ifdef CONFIG_DEBUG_FS
+
+extern int wiidebug_init(struct wiimote_data *wdata);
+extern void wiidebug_deinit(struct wiimote_data *wdata);
+
+#else
+
+static inline int wiidebug_init(void *u) { return 0; }
+static inline void wiidebug_deinit(void *u) { }
+
+#endif
 
 /* requires the state.lock spinlock to be held */
 static inline bool wiimote_cmd_pending(struct wiimote_data *wdata, int cmd,
This page took 0.027258 seconds and 5 git commands to generate.