Revert "[media] rc: rc-ir-raw: Add scancode encoder callback"
[linux-2.6-block.git] / include / media / rc-core.h
index fde142e5f25a430de2cc9fc5bdff691faefae448..644bdc61c387581c29a29d20c0cf1c3fc5085830 100644 (file)
@@ -26,7 +26,7 @@ extern int rc_core_debug;
 #define IR_dprintk(level, fmt, ...)                            \
 do {                                                           \
        if (rc_core_debug >= level)                             \
-               pr_debug("%s: " fmt, __func__, ##__VA_ARGS__);  \
+               printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__);  \
 } while (0)
 
 enum rc_driver_type {
@@ -74,21 +74,25 @@ enum rc_filter_type {
  * @input_dev: the input child device used to communicate events to userspace
  * @driver_type: specifies if protocol decoding is done in hardware or software
  * @idle: used to keep track of RX state
- * @allowed_protocols: bitmask with the supported RC_BIT_* protocols for each
- *     filter type
- * @enabled_protocols: bitmask with the enabled RC_BIT_* protocols for each
- *     filter type
- * @scanmask: some hardware decoders are not capable of providing the full
+ * @allowed_protocols: bitmask with the supported RC_BIT_* protocols
+ * @enabled_protocols: bitmask with the enabled RC_BIT_* protocols
+ * @allowed_wakeup_protocols: bitmask with the supported RC_BIT_* wakeup protocols
+ * @enabled_wakeup_protocols: bitmask with the enabled RC_BIT_* wakeup protocols
+ * @scancode_filter: scancode filter
+ * @scancode_wakeup_filter: scancode wakeup filters
+ * @scancode_mask: some hardware decoders are not capable of providing the full
  *     scancode to the application. As this is a hardware limit, we can't do
  *     anything with it. Yet, as the same keycode table can be used with other
  *     devices, a mask is provided to allow its usage. Drivers should generally
  *     leave this field in blank
+ * @users: number of current users of the device
  * @priv: driver-specific data
  * @keylock: protects the remaining members of the struct
  * @keypressed: whether a key is currently pressed
  * @keyup_jiffies: time (in jiffies) when the current keypress should be released
  * @timer_keyup: timer for releasing a keypress
  * @last_keycode: keycode of last keypress
+ * @last_protocol: protocol of last keypress
  * @last_scancode: scancode of last keypress
  * @last_toggle: toggle value of last command
  * @timeout: optional time after which device stops sending data
@@ -96,7 +100,6 @@ enum rc_filter_type {
  * @max_timeout: maximum timeout supported by device
  * @rx_resolution : resolution (in ns) of input sampler
  * @tx_resolution: resolution (in ns) of output sampler
- * @scancode_filters: scancode filters (indexed by enum rc_filter_type)
  * @change_protocol: allow changing the protocol used on hardware decoders
  * @change_wakeup_protocol: allow changing the protocol used for wakeup
  *     filtering
@@ -113,7 +116,7 @@ enum rc_filter_type {
  *     device doesn't interrupt host until it sees IR pulses
  * @s_learning_mode: enable wide band receiver used for learning
  * @s_carrier_report: enable carrier reports
- * @s_filter: set the scancode filter 
+ * @s_filter: set the scancode filter
  * @s_wakeup_filter: set the wakeup scancode filter
  */
 struct rc_dev {
@@ -131,16 +134,21 @@ struct rc_dev {
        struct input_dev                *input_dev;
        enum rc_driver_type             driver_type;
        bool                            idle;
-       u64                             allowed_protocols[RC_FILTER_MAX];
-       u64                             enabled_protocols[RC_FILTER_MAX];
+       u64                             allowed_protocols;
+       u64                             enabled_protocols;
+       u64                             allowed_wakeup_protocols;
+       u64                             enabled_wakeup_protocols;
+       struct rc_scancode_filter       scancode_filter;
+       struct rc_scancode_filter       scancode_wakeup_filter;
+       u32                             scancode_mask;
        u32                             users;
-       u32                             scanmask;
        void                            *priv;
        spinlock_t                      keylock;
        bool                            keypressed;
        unsigned long                   keyup_jiffies;
        struct timer_list               timer_keyup;
        u32                             last_keycode;
+       enum rc_type                    last_protocol;
        u32                             last_scancode;
        u8                              last_toggle;
        u32                             timeout;
@@ -148,7 +156,6 @@ struct rc_dev {
        u32                             max_timeout;
        u32                             rx_resolution;
        u32                             tx_resolution;
-       struct rc_scancode_filter       scancode_filters[RC_FILTER_MAX];
        int                             (*change_protocol)(struct rc_dev *dev, u64 *rc_type);
        int                             (*change_wakeup_protocol)(struct rc_dev *dev, u64 *rc_type);
        int                             (*open)(struct rc_dev *dev);
@@ -169,42 +176,6 @@ struct rc_dev {
 
 #define to_rc_dev(d) container_of(d, struct rc_dev, dev)
 
-static inline bool rc_protocols_allowed(struct rc_dev *rdev, u64 protos)
-{
-       return rdev->allowed_protocols[RC_FILTER_NORMAL] & protos;
-}
-
-/* should be called prior to registration or with mutex held */
-static inline void rc_set_allowed_protocols(struct rc_dev *rdev, u64 protos)
-{
-       rdev->allowed_protocols[RC_FILTER_NORMAL] = protos;
-}
-
-static inline bool rc_protocols_enabled(struct rc_dev *rdev, u64 protos)
-{
-       return rdev->enabled_protocols[RC_FILTER_NORMAL] & protos;
-}
-
-/* should be called prior to registration or with mutex held */
-static inline void rc_set_enabled_protocols(struct rc_dev *rdev, u64 protos)
-{
-       rdev->enabled_protocols[RC_FILTER_NORMAL] = protos;
-}
-
-/* should be called prior to registration or with mutex held */
-static inline void rc_set_allowed_wakeup_protocols(struct rc_dev *rdev,
-                                                  u64 protos)
-{
-       rdev->allowed_protocols[RC_FILTER_WAKEUP] = protos;
-}
-
-/* should be called prior to registration or with mutex held */
-static inline void rc_set_enabled_wakeup_protocols(struct rc_dev *rdev,
-                                                  u64 protos)
-{
-       rdev->enabled_protocols[RC_FILTER_WAKEUP] = protos;
-}
-
 /*
  * From rc-main.c
  * Those functions can be used on any type of Remote Controller. They
@@ -221,8 +192,8 @@ int rc_open(struct rc_dev *rdev);
 void rc_close(struct rc_dev *rdev);
 
 void rc_repeat(struct rc_dev *dev);
-void rc_keydown(struct rc_dev *dev, int scancode, u8 toggle);
-void rc_keydown_notimeout(struct rc_dev *dev, int scancode, u8 toggle);
+void rc_keydown(struct rc_dev *dev, enum rc_type protocol, u32 scancode, u8 toggle);
+void rc_keydown_notimeout(struct rc_dev *dev, enum rc_type protocol, u32 scancode, u8 toggle);
 void rc_keyup(struct rc_dev *dev);
 u32 rc_g_keycode_from_table(struct rc_dev *dev, u32 scancode);
 
@@ -268,7 +239,7 @@ static inline void init_ir_raw_event(struct ir_raw_event *ev)
        memset(ev, 0, sizeof(*ev));
 }
 
-#define IR_MAX_DURATION         0xFFFFFFFF      /* a bit more than 4 seconds */
+#define IR_MAX_DURATION         500000000      /* 500 ms */
 #define US_TO_NS(usec)         ((usec) * 1000)
 #define MS_TO_US(msec)         ((msec) * 1000)
 #define MS_TO_NS(msec)         ((msec) * 1000 * 1000)