From acff5f24732acc8a55d0a0f0ee1d19442267df63 Mon Sep 17 00:00:00 2001 From: James Hogan Date: Fri, 28 Feb 2014 20:17:04 -0300 Subject: [media] rc: add allowed/enabled wakeup protocol masks MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Only a single allowed and enabled protocol mask currently exists in struct rc_dev, however to support a separate wakeup filter protocol two of each are needed, ideally as an array. Therefore make both rc_dev::allowed_protos and rc_dev::enabled_protocols arrays, update all users to reference the first element (RC_FILTER_NORMAL), and add a couple more helper functions for drivers to use for setting the allowed and enabled wakeup protocols. We also rename allowed_protos to allowed_protocols while we're at it, which is more consistent with enabled_protocols. Signed-off-by: James Hogan Reviewed-by: Antti Seppälä Signed-off-by: Mauro Carvalho Chehab --- include/media/rc-core.h | 32 ++++++++++++++++++++++++-------- 1 file changed, 24 insertions(+), 8 deletions(-) (limited to 'include/media') diff --git a/include/media/rc-core.h b/include/media/rc-core.h index 6f3c3d977c81..f165115597f5 100644 --- a/include/media/rc-core.h +++ b/include/media/rc-core.h @@ -73,8 +73,10 @@ 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_protos: bitmask with the supported RC_BIT_* protocols - * @enabled_protocols: bitmask with the enabled RC_BIT_* protocols + * @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 * 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 @@ -124,8 +126,8 @@ struct rc_dev { struct input_dev *input_dev; enum rc_driver_type driver_type; bool idle; - u64 allowed_protos; - u64 enabled_protocols; + u64 allowed_protocols[RC_FILTER_MAX]; + u64 enabled_protocols[RC_FILTER_MAX]; u32 users; u32 scanmask; void *priv; @@ -162,24 +164,38 @@ struct rc_dev { static inline bool rc_protocols_allowed(struct rc_dev *rdev, u64 protos) { - return rdev->allowed_protos & 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_protos = protos; + rdev->allowed_protocols[RC_FILTER_NORMAL] = protos; } static inline bool rc_protocols_enabled(struct rc_dev *rdev, u64 protos) { - return rdev->enabled_protocols & 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 = 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; } /* -- cgit v1.2.3