aboutsummaryrefslogtreecommitdiffstats
path: root/include/media
diff options
context:
space:
mode:
authorJames Hogan <james.hogan@imgtec.com>2014-02-28 18:17:04 -0500
committerMauro Carvalho Chehab <m.chehab@samsung.com>2014-03-11 12:25:49 -0400
commitacff5f24732acc8a55d0a0f0ee1d19442267df63 (patch)
tree54c8b9db77a01b286c6e1dedf93cb19556448483 /include/media
parent1a1934fab0c920f0d3bceeb60c9fe2dae8a56be9 (diff)
[media] rc: add allowed/enabled wakeup protocol masks
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 <james.hogan@imgtec.com> Reviewed-by: Antti Seppälä <a.seppala@gmail.com> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
Diffstat (limited to 'include/media')
-rw-r--r--include/media/rc-core.h32
1 files changed, 24 insertions, 8 deletions
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 {
73 * @input_dev: the input child device used to communicate events to userspace 73 * @input_dev: the input child device used to communicate events to userspace
74 * @driver_type: specifies if protocol decoding is done in hardware or software 74 * @driver_type: specifies if protocol decoding is done in hardware or software
75 * @idle: used to keep track of RX state 75 * @idle: used to keep track of RX state
76 * @allowed_protos: bitmask with the supported RC_BIT_* protocols 76 * @allowed_protocols: bitmask with the supported RC_BIT_* protocols for each
77 * @enabled_protocols: bitmask with the enabled RC_BIT_* protocols 77 * filter type
78 * @enabled_protocols: bitmask with the enabled RC_BIT_* protocols for each
79 * filter type
78 * @scanmask: some hardware decoders are not capable of providing the full 80 * @scanmask: some hardware decoders are not capable of providing the full
79 * scancode to the application. As this is a hardware limit, we can't do 81 * scancode to the application. As this is a hardware limit, we can't do
80 * anything with it. Yet, as the same keycode table can be used with other 82 * anything with it. Yet, as the same keycode table can be used with other
@@ -124,8 +126,8 @@ struct rc_dev {
124 struct input_dev *input_dev; 126 struct input_dev *input_dev;
125 enum rc_driver_type driver_type; 127 enum rc_driver_type driver_type;
126 bool idle; 128 bool idle;
127 u64 allowed_protos; 129 u64 allowed_protocols[RC_FILTER_MAX];
128 u64 enabled_protocols; 130 u64 enabled_protocols[RC_FILTER_MAX];
129 u32 users; 131 u32 users;
130 u32 scanmask; 132 u32 scanmask;
131 void *priv; 133 void *priv;
@@ -162,24 +164,38 @@ struct rc_dev {
162 164
163static inline bool rc_protocols_allowed(struct rc_dev *rdev, u64 protos) 165static inline bool rc_protocols_allowed(struct rc_dev *rdev, u64 protos)
164{ 166{
165 return rdev->allowed_protos & protos; 167 return rdev->allowed_protocols[RC_FILTER_NORMAL] & protos;
166} 168}
167 169
168/* should be called prior to registration or with mutex held */ 170/* should be called prior to registration or with mutex held */
169static inline void rc_set_allowed_protocols(struct rc_dev *rdev, u64 protos) 171static inline void rc_set_allowed_protocols(struct rc_dev *rdev, u64 protos)
170{ 172{
171 rdev->allowed_protos = protos; 173 rdev->allowed_protocols[RC_FILTER_NORMAL] = protos;
172} 174}
173 175
174static inline bool rc_protocols_enabled(struct rc_dev *rdev, u64 protos) 176static inline bool rc_protocols_enabled(struct rc_dev *rdev, u64 protos)
175{ 177{
176 return rdev->enabled_protocols & protos; 178 return rdev->enabled_protocols[RC_FILTER_NORMAL] & protos;
177} 179}
178 180
179/* should be called prior to registration or with mutex held */ 181/* should be called prior to registration or with mutex held */
180static inline void rc_set_enabled_protocols(struct rc_dev *rdev, u64 protos) 182static inline void rc_set_enabled_protocols(struct rc_dev *rdev, u64 protos)
181{ 183{
182 rdev->enabled_protocols = protos; 184 rdev->enabled_protocols[RC_FILTER_NORMAL] = protos;
185}
186
187/* should be called prior to registration or with mutex held */
188static inline void rc_set_allowed_wakeup_protocols(struct rc_dev *rdev,
189 u64 protos)
190{
191 rdev->allowed_protocols[RC_FILTER_WAKEUP] = protos;
192}
193
194/* should be called prior to registration or with mutex held */
195static inline void rc_set_enabled_wakeup_protocols(struct rc_dev *rdev,
196 u64 protos)
197{
198 rdev->enabled_protocols[RC_FILTER_WAKEUP] = protos;
183} 199}
184 200
185/* 201/*