aboutsummaryrefslogtreecommitdiffstats
path: root/include/media/rc-core.h
diff options
context:
space:
mode:
authorDavid Härdeman <david@hardeman.nu>2014-04-03 19:32:21 -0400
committerMauro Carvalho Chehab <m.chehab@samsung.com>2014-07-25 18:10:43 -0400
commitc5540fbb9de39ceec108a889133664a887c2f55a (patch)
tree92d1523fa4ab99fc27d14dcd3ee00627eeb8a346 /include/media/rc-core.h
parentda6e162d6a4607362f8478c715c797d84d449f8b (diff)
[media] rc-core: remove protocol arrays
The basic API of rc-core used to be: dev = rc_allocate_device(); dev->x = a; dev->y = b; dev->z = c; rc_register_device(); which is a pretty common pattern in the kernel, after the introduction of protocol arrays the API looks something like: dev = rc_allocate_device(); dev->x = a; rc_set_allowed_protocols(dev, RC_BIT_X); dev->z = c; rc_register_device(); There's no real need for the protocols to be an array, so change it back to be consistent (and in preparation for the following patches). [m.chehab@samsung.com: added missing changes at some files] Signed-off-by: David Härdeman <david@hardeman.nu> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
Diffstat (limited to 'include/media/rc-core.h')
-rw-r--r--include/media/rc-core.h56
1 files changed, 12 insertions, 44 deletions
diff --git a/include/media/rc-core.h b/include/media/rc-core.h
index 00811c9e22b0..4f9e187d05bf 100644
--- a/include/media/rc-core.h
+++ b/include/media/rc-core.h
@@ -74,10 +74,12 @@ enum rc_filter_type {
74 * @input_dev: the input child device used to communicate events to userspace 74 * @input_dev: the input child device used to communicate events to userspace
75 * @driver_type: specifies if protocol decoding is done in hardware or software 75 * @driver_type: specifies if protocol decoding is done in hardware or software
76 * @idle: used to keep track of RX state 76 * @idle: used to keep track of RX state
77 * @allowed_protocols: bitmask with the supported RC_BIT_* protocols for each 77 * @allowed_protocols: bitmask with the supported RC_BIT_* protocols
78 * filter type 78 * @enabled_protocols: bitmask with the enabled RC_BIT_* protocols
79 * @enabled_protocols: bitmask with the enabled RC_BIT_* protocols for each 79 * @allowed_wakeup_protocols: bitmask with the supported RC_BIT_* wakeup protocols
80 * filter type 80 * @enabled_wakeup_protocols: bitmask with the enabled RC_BIT_* wakeup protocols
81 * @scancode_filter: scancode filter
82 * @scancode_wakeup_filter: scancode wakeup filters
81 * @scanmask: some hardware decoders are not capable of providing the full 83 * @scanmask: some hardware decoders are not capable of providing the full
82 * scancode to the application. As this is a hardware limit, we can't do 84 * scancode to the application. As this is a hardware limit, we can't do
83 * anything with it. Yet, as the same keycode table can be used with other 85 * anything with it. Yet, as the same keycode table can be used with other
@@ -97,7 +99,6 @@ enum rc_filter_type {
97 * @max_timeout: maximum timeout supported by device 99 * @max_timeout: maximum timeout supported by device
98 * @rx_resolution : resolution (in ns) of input sampler 100 * @rx_resolution : resolution (in ns) of input sampler
99 * @tx_resolution: resolution (in ns) of output sampler 101 * @tx_resolution: resolution (in ns) of output sampler
100 * @scancode_filters: scancode filters (indexed by enum rc_filter_type)
101 * @change_protocol: allow changing the protocol used on hardware decoders 102 * @change_protocol: allow changing the protocol used on hardware decoders
102 * @change_wakeup_protocol: allow changing the protocol used for wakeup 103 * @change_wakeup_protocol: allow changing the protocol used for wakeup
103 * filtering 104 * filtering
@@ -132,8 +133,12 @@ struct rc_dev {
132 struct input_dev *input_dev; 133 struct input_dev *input_dev;
133 enum rc_driver_type driver_type; 134 enum rc_driver_type driver_type;
134 bool idle; 135 bool idle;
135 u64 allowed_protocols[RC_FILTER_MAX]; 136 u64 allowed_protocols;
136 u64 enabled_protocols[RC_FILTER_MAX]; 137 u64 enabled_protocols;
138 u64 allowed_wakeup_protocols;
139 u64 enabled_wakeup_protocols;
140 struct rc_scancode_filter scancode_filter;
141 struct rc_scancode_filter scancode_wakeup_filter;
137 u32 users; 142 u32 users;
138 u32 scanmask; 143 u32 scanmask;
139 void *priv; 144 void *priv;
@@ -150,7 +155,6 @@ struct rc_dev {
150 u32 max_timeout; 155 u32 max_timeout;
151 u32 rx_resolution; 156 u32 rx_resolution;
152 u32 tx_resolution; 157 u32 tx_resolution;
153 struct rc_scancode_filter scancode_filters[RC_FILTER_MAX];
154 int (*change_protocol)(struct rc_dev *dev, u64 *rc_type); 158 int (*change_protocol)(struct rc_dev *dev, u64 *rc_type);
155 int (*change_wakeup_protocol)(struct rc_dev *dev, u64 *rc_type); 159 int (*change_wakeup_protocol)(struct rc_dev *dev, u64 *rc_type);
156 int (*open)(struct rc_dev *dev); 160 int (*open)(struct rc_dev *dev);
@@ -171,42 +175,6 @@ struct rc_dev {
171 175
172#define to_rc_dev(d) container_of(d, struct rc_dev, dev) 176#define to_rc_dev(d) container_of(d, struct rc_dev, dev)
173 177
174static inline bool rc_protocols_allowed(struct rc_dev *rdev, u64 protos)
175{
176 return rdev->allowed_protocols[RC_FILTER_NORMAL] & protos;
177}
178
179/* should be called prior to registration or with mutex held */
180static inline void rc_set_allowed_protocols(struct rc_dev *rdev, u64 protos)
181{
182 rdev->allowed_protocols[RC_FILTER_NORMAL] = protos;
183}
184
185static inline bool rc_protocols_enabled(struct rc_dev *rdev, u64 protos)
186{
187 return rdev->enabled_protocols[RC_FILTER_NORMAL] & protos;
188}
189
190/* should be called prior to registration or with mutex held */
191static inline void rc_set_enabled_protocols(struct rc_dev *rdev, u64 protos)
192{
193 rdev->enabled_protocols[RC_FILTER_NORMAL] = protos;
194}
195
196/* should be called prior to registration or with mutex held */
197static inline void rc_set_allowed_wakeup_protocols(struct rc_dev *rdev,
198 u64 protos)
199{
200 rdev->allowed_protocols[RC_FILTER_WAKEUP] = protos;
201}
202
203/* should be called prior to registration or with mutex held */
204static inline void rc_set_enabled_wakeup_protocols(struct rc_dev *rdev,
205 u64 protos)
206{
207 rdev->enabled_protocols[RC_FILTER_WAKEUP] = protos;
208}
209
210/* 178/*
211 * From rc-main.c 179 * From rc-main.c
212 * Those functions can be used on any type of Remote Controller. They 180 * Those functions can be used on any type of Remote Controller. They