aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/dvb/dvb-usb/dvb-usb-remote.c
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab@redhat.com>2010-07-31 17:04:09 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2010-08-02 15:43:45 -0400
commitf72a27b8ed4458bb9f7203408441d27382bc93f4 (patch)
tree667c20a22af36fecdfb770384afb3ef85a9578e2 /drivers/media/dvb/dvb-usb/dvb-usb-remote.c
parent34abf2194499571b2efa6b4aface8c0ea0c47ce1 (diff)
V4L/DVB: dvb-usb: prepare drivers for using rc-core
This is a big patch, yet trivial. It just move the RC properties to a separate struct, in order to prepare the dvb-usb drivers to use rc-core. There's no change on the behavior of the drivers. With this change, it is possible to have both legacy and rc-core based code inside the dvb-usb-remote, allowing a gradual migration to rc-core, driver per driver. Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/dvb/dvb-usb/dvb-usb-remote.c')
-rw-r--r--drivers/media/dvb/dvb-usb/dvb-usb-remote.c44
1 files changed, 22 insertions, 22 deletions
diff --git a/drivers/media/dvb/dvb-usb/dvb-usb-remote.c b/drivers/media/dvb/dvb-usb/dvb-usb-remote.c
index e210f2f14d86..7951076e8e06 100644
--- a/drivers/media/dvb/dvb-usb/dvb-usb-remote.c
+++ b/drivers/media/dvb/dvb-usb/dvb-usb-remote.c
@@ -13,11 +13,11 @@ static int dvb_usb_getkeycode(struct input_dev *dev,
13{ 13{
14 struct dvb_usb_device *d = input_get_drvdata(dev); 14 struct dvb_usb_device *d = input_get_drvdata(dev);
15 15
16 struct ir_scancode *keymap = d->props.rc_key_map; 16 struct ir_scancode *keymap = d->props.rc.legacy.rc_key_map;
17 int i; 17 int i;
18 18
19 /* See if we can match the raw key code. */ 19 /* See if we can match the raw key code. */
20 for (i = 0; i < d->props.rc_key_map_size; i++) 20 for (i = 0; i < d->props.rc.legacy.rc_key_map_size; i++)
21 if (keymap[i].scancode == scancode) { 21 if (keymap[i].scancode == scancode) {
22 *keycode = keymap[i].keycode; 22 *keycode = keymap[i].keycode;
23 return 0; 23 return 0;
@@ -28,7 +28,7 @@ static int dvb_usb_getkeycode(struct input_dev *dev,
28 * otherwise, input core won't let dvb_usb_setkeycode 28 * otherwise, input core won't let dvb_usb_setkeycode
29 * to work 29 * to work
30 */ 30 */
31 for (i = 0; i < d->props.rc_key_map_size; i++) 31 for (i = 0; i < d->props.rc.legacy.rc_key_map_size; i++)
32 if (keymap[i].keycode == KEY_RESERVED || 32 if (keymap[i].keycode == KEY_RESERVED ||
33 keymap[i].keycode == KEY_UNKNOWN) { 33 keymap[i].keycode == KEY_UNKNOWN) {
34 *keycode = KEY_RESERVED; 34 *keycode = KEY_RESERVED;
@@ -43,18 +43,18 @@ static int dvb_usb_setkeycode(struct input_dev *dev,
43{ 43{
44 struct dvb_usb_device *d = input_get_drvdata(dev); 44 struct dvb_usb_device *d = input_get_drvdata(dev);
45 45
46 struct ir_scancode *keymap = d->props.rc_key_map; 46 struct ir_scancode *keymap = d->props.rc.legacy.rc_key_map;
47 int i; 47 int i;
48 48
49 /* Search if it is replacing an existing keycode */ 49 /* Search if it is replacing an existing keycode */
50 for (i = 0; i < d->props.rc_key_map_size; i++) 50 for (i = 0; i < d->props.rc.legacy.rc_key_map_size; i++)
51 if (keymap[i].scancode == scancode) { 51 if (keymap[i].scancode == scancode) {
52 keymap[i].keycode = keycode; 52 keymap[i].keycode = keycode;
53 return 0; 53 return 0;
54 } 54 }
55 55
56 /* Search if is there a clean entry. If so, use it */ 56 /* Search if is there a clean entry. If so, use it */
57 for (i = 0; i < d->props.rc_key_map_size; i++) 57 for (i = 0; i < d->props.rc.legacy.rc_key_map_size; i++)
58 if (keymap[i].keycode == KEY_RESERVED || 58 if (keymap[i].keycode == KEY_RESERVED ||
59 keymap[i].keycode == KEY_UNKNOWN) { 59 keymap[i].keycode == KEY_UNKNOWN) {
60 keymap[i].scancode = scancode; 60 keymap[i].scancode = scancode;
@@ -92,7 +92,7 @@ static void dvb_usb_read_remote_control(struct work_struct *work)
92 if (dvb_usb_disable_rc_polling) 92 if (dvb_usb_disable_rc_polling)
93 return; 93 return;
94 94
95 if (d->props.rc_query(d,&event,&state)) { 95 if (d->props.rc.legacy.rc_query(d,&event,&state)) {
96 err("error while querying for an remote control event."); 96 err("error while querying for an remote control event.");
97 goto schedule; 97 goto schedule;
98 } 98 }
@@ -151,7 +151,7 @@ static void dvb_usb_read_remote_control(struct work_struct *work)
151*/ 151*/
152 152
153schedule: 153schedule:
154 schedule_delayed_work(&d->rc_query_work,msecs_to_jiffies(d->props.rc_interval)); 154 schedule_delayed_work(&d->rc_query_work,msecs_to_jiffies(d->props.rc.legacy.rc_interval));
155} 155}
156 156
157int dvb_usb_remote_init(struct dvb_usb_device *d) 157int dvb_usb_remote_init(struct dvb_usb_device *d)
@@ -160,8 +160,8 @@ int dvb_usb_remote_init(struct dvb_usb_device *d)
160 int i; 160 int i;
161 int err; 161 int err;
162 162
163 if (d->props.rc_key_map == NULL || 163 if (d->props.rc.legacy.rc_key_map == NULL ||
164 d->props.rc_query == NULL || 164 d->props.rc.legacy.rc_query == NULL ||
165 dvb_usb_disable_rc_polling) 165 dvb_usb_disable_rc_polling)
166 return 0; 166 return 0;
167 167
@@ -181,20 +181,20 @@ int dvb_usb_remote_init(struct dvb_usb_device *d)
181 input_dev->setkeycode = dvb_usb_setkeycode; 181 input_dev->setkeycode = dvb_usb_setkeycode;
182 182
183 /* set the bits for the keys */ 183 /* set the bits for the keys */
184 deb_rc("key map size: %d\n", d->props.rc_key_map_size); 184 deb_rc("key map size: %d\n", d->props.rc.legacy.rc_key_map_size);
185 for (i = 0; i < d->props.rc_key_map_size; i++) { 185 for (i = 0; i < d->props.rc.legacy.rc_key_map_size; i++) {
186 deb_rc("setting bit for event %d item %d\n", 186 deb_rc("setting bit for event %d item %d\n",
187 d->props.rc_key_map[i].keycode, i); 187 d->props.rc.legacy.rc_key_map[i].keycode, i);
188 set_bit(d->props.rc_key_map[i].keycode, input_dev->keybit); 188 set_bit(d->props.rc.legacy.rc_key_map[i].keycode, input_dev->keybit);
189 } 189 }
190 190
191 /* Start the remote-control polling. */ 191 /* Start the remote-control polling. */
192 if (d->props.rc_interval < 40) 192 if (d->props.rc.legacy.rc_interval < 40)
193 d->props.rc_interval = 100; /* default */ 193 d->props.rc.legacy.rc_interval = 100; /* default */
194 194
195 /* setting these two values to non-zero, we have to manage key repeats */ 195 /* setting these two values to non-zero, we have to manage key repeats */
196 input_dev->rep[REP_PERIOD] = d->props.rc_interval; 196 input_dev->rep[REP_PERIOD] = d->props.rc.legacy.rc_interval;
197 input_dev->rep[REP_DELAY] = d->props.rc_interval + 150; 197 input_dev->rep[REP_DELAY] = d->props.rc.legacy.rc_interval + 150;
198 198
199 input_set_drvdata(input_dev, d); 199 input_set_drvdata(input_dev, d);
200 200
@@ -208,8 +208,8 @@ int dvb_usb_remote_init(struct dvb_usb_device *d)
208 208
209 INIT_DELAYED_WORK(&d->rc_query_work, dvb_usb_read_remote_control); 209 INIT_DELAYED_WORK(&d->rc_query_work, dvb_usb_read_remote_control);
210 210
211 info("schedule remote query interval to %d msecs.", d->props.rc_interval); 211 info("schedule remote query interval to %d msecs.", d->props.rc.legacy.rc_interval);
212 schedule_delayed_work(&d->rc_query_work,msecs_to_jiffies(d->props.rc_interval)); 212 schedule_delayed_work(&d->rc_query_work,msecs_to_jiffies(d->props.rc.legacy.rc_interval));
213 213
214 d->state |= DVB_USB_STATE_REMOTE; 214 d->state |= DVB_USB_STATE_REMOTE;
215 215
@@ -234,7 +234,7 @@ int dvb_usb_nec_rc_key_to_event(struct dvb_usb_device *d,
234 u8 keybuf[5], u32 *event, int *state) 234 u8 keybuf[5], u32 *event, int *state)
235{ 235{
236 int i; 236 int i;
237 struct ir_scancode *keymap = d->props.rc_key_map; 237 struct ir_scancode *keymap = d->props.rc.legacy.rc_key_map;
238 *event = 0; 238 *event = 0;
239 *state = REMOTE_NO_KEY_PRESSED; 239 *state = REMOTE_NO_KEY_PRESSED;
240 switch (keybuf[0]) { 240 switch (keybuf[0]) {
@@ -247,7 +247,7 @@ int dvb_usb_nec_rc_key_to_event(struct dvb_usb_device *d,
247 break; 247 break;
248 } 248 }
249 /* See if we can match the raw key code. */ 249 /* See if we can match the raw key code. */
250 for (i = 0; i < d->props.rc_key_map_size; i++) 250 for (i = 0; i < d->props.rc.legacy.rc_key_map_size; i++)
251 if (rc5_custom(&keymap[i]) == keybuf[1] && 251 if (rc5_custom(&keymap[i]) == keybuf[1] &&
252 rc5_data(&keymap[i]) == keybuf[3]) { 252 rc5_data(&keymap[i]) == keybuf[3]) {
253 *event = keymap[i].keycode; 253 *event = keymap[i].keycode;