aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media
diff options
context:
space:
mode:
authorMalcolm Priestley <tvboxspy@gmail.com>2011-05-25 17:28:29 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2011-05-25 20:50:17 -0400
commit616a4b83bd1b4ec2260a91480e211290c35348bb (patch)
treef6fdcd3723f000626e972b930050e1d5ac061d1b /drivers/media
parent5d8f290c051b55dfff6bd7e688a05945246a0861 (diff)
[media] v1.88 DM04/QQBOX Move remote to use rc_core dvb-usb-remote
driver to use dvb-usb-remote. The remote(s) generates 24 bit NEC codes, lme2510 keymaps redefined. Other minor fixes fix le warning. make sure frontend is detached on firmware change. Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media')
-rw-r--r--drivers/media/dvb/dvb-usb/lmedm04.c107
-rw-r--r--drivers/media/rc/keymaps/rc-lme2510.c134
2 files changed, 110 insertions, 131 deletions
diff --git a/drivers/media/dvb/dvb-usb/lmedm04.c b/drivers/media/dvb/dvb-usb/lmedm04.c
index f36f471deae2..37b146961ae2 100644
--- a/drivers/media/dvb/dvb-usb/lmedm04.c
+++ b/drivers/media/dvb/dvb-usb/lmedm04.c
@@ -207,17 +207,6 @@ static int lme2510_stream_restart(struct dvb_usb_device *d)
207 rbuff, sizeof(rbuff)); 207 rbuff, sizeof(rbuff));
208 return ret; 208 return ret;
209} 209}
210static int lme2510_remote_keypress(struct dvb_usb_adapter *adap, u32 keypress)
211{
212 struct dvb_usb_device *d = adap->dev;
213
214 deb_info(1, "INT Key Keypress =%04x", keypress);
215
216 if (keypress > 0)
217 rc_keydown(d->rc_dev, keypress, 0);
218
219 return 0;
220}
221 210
222static int lme2510_enable_pid(struct dvb_usb_device *d, u8 index, u16 pid_out) 211static int lme2510_enable_pid(struct dvb_usb_device *d, u8 index, u16 pid_out)
223{ 212{
@@ -256,6 +245,7 @@ static void lme2510_int_response(struct urb *lme_urb)
256 struct lme2510_state *st = adap->dev->priv; 245 struct lme2510_state *st = adap->dev->priv;
257 static u8 *ibuf, *rbuf; 246 static u8 *ibuf, *rbuf;
258 int i = 0, offset; 247 int i = 0, offset;
248 u32 key;
259 249
260 switch (lme_urb->status) { 250 switch (lme_urb->status) {
261 case 0: 251 case 0:
@@ -282,10 +272,16 @@ static void lme2510_int_response(struct urb *lme_urb)
282 272
283 switch (ibuf[0]) { 273 switch (ibuf[0]) {
284 case 0xaa: 274 case 0xaa:
285 debug_data_snipet(1, "INT Remote data snipet in", ibuf); 275 debug_data_snipet(1, "INT Remote data snipet", ibuf);
286 lme2510_remote_keypress(adap, 276 if ((ibuf[4] + ibuf[5]) == 0xff) {
287 (u32)(ibuf[2] << 24) + (ibuf[3] << 16) + 277 key = ibuf[5];
288 (ibuf[4] << 8) + ibuf[5]); 278 key += (ibuf[3] > 0)
279 ? (ibuf[3] ^ 0xff) << 8 : 0;
280 key += (ibuf[2] ^ 0xff) << 16;
281 deb_info(1, "INT Key =%08x", key);
282 if (adap->dev->rc_dev != NULL)
283 rc_keydown(adap->dev->rc_dev, key, 0);
284 }
289 break; 285 break;
290 case 0xbb: 286 case 0xbb:
291 switch (st->tuner_config) { 287 switch (st->tuner_config) {
@@ -691,45 +687,6 @@ static int lme2510_streaming_ctrl(struct dvb_usb_adapter *adap, int onoff)
691 return (ret < 0) ? -ENODEV : 0; 687 return (ret < 0) ? -ENODEV : 0;
692} 688}
693 689
694static int lme2510_int_service(struct dvb_usb_adapter *adap)
695{
696 struct dvb_usb_device *d = adap->dev;
697 struct rc_dev *rc;
698 int ret;
699
700 info("STA Configuring Remote");
701
702 rc = rc_allocate_device();
703 if (!rc)
704 return -ENOMEM;
705
706 usb_make_path(d->udev, d->rc_phys, sizeof(d->rc_phys));
707 strlcat(d->rc_phys, "/ir0", sizeof(d->rc_phys));
708
709 rc->input_name = "LME2510 Remote Control";
710 rc->input_phys = d->rc_phys;
711 rc->map_name = RC_MAP_LME2510;
712 rc->driver_name = "LME 2510";
713 usb_to_input_id(d->udev, &rc->input_id);
714
715 ret = rc_register_device(rc);
716 if (ret) {
717 rc_free_device(rc);
718 return ret;
719 }
720 d->rc_dev = rc;
721
722 /* Start the Interrupt */
723 ret = lme2510_int_read(adap);
724 if (ret < 0) {
725 rc_unregister_device(rc);
726 info("INT Unable to start Interrupt Service");
727 return -ENODEV;
728 }
729
730 return 0;
731}
732
733static u8 check_sum(u8 *p, u8 len) 690static u8 check_sum(u8 *p, u8 len)
734{ 691{
735 u8 sum = 0; 692 u8 sum = 0;
@@ -831,7 +788,7 @@ static int lme_firmware_switch(struct usb_device *udev, int cold)
831 788
832 cold_fw = !cold; 789 cold_fw = !cold;
833 790
834 if (udev->descriptor.idProduct == 0x1122) { 791 if (le16_to_cpu(udev->descriptor.idProduct) == 0x1122) {
835 switch (dvb_usb_lme2510_firmware) { 792 switch (dvb_usb_lme2510_firmware) {
836 default: 793 default:
837 dvb_usb_lme2510_firmware = TUNER_S0194; 794 dvb_usb_lme2510_firmware = TUNER_S0194;
@@ -1053,8 +1010,11 @@ static int dm04_lme2510_frontend_attach(struct dvb_usb_adapter *adap)
1053 1010
1054 1011
1055end: if (ret) { 1012end: if (ret) {
1056 kfree(adap->fe); 1013 if (adap->fe) {
1057 adap->fe = NULL; 1014 dvb_frontend_detach(adap->fe);
1015 adap->fe = NULL;
1016 }
1017 adap->dev->props.rc.core.rc_codes = NULL;
1058 return -ENODEV; 1018 return -ENODEV;
1059 } 1019 }
1060 1020
@@ -1097,8 +1057,12 @@ static int dm04_lme2510_tuner(struct dvb_usb_adapter *adap)
1097 return -ENODEV; 1057 return -ENODEV;
1098 } 1058 }
1099 1059
1100 /* Start the Interrupt & Remote*/ 1060 /* Start the Interrupt*/
1101 ret = lme2510_int_service(adap); 1061 ret = lme2510_int_read(adap);
1062 if (ret < 0) {
1063 info("INT Unable to start Interrupt Service");
1064 return -ENODEV;
1065 }
1102 1066
1103 return ret; 1067 return ret;
1104} 1068}
@@ -1204,6 +1168,12 @@ static struct dvb_usb_device_properties lme2510_properties = {
1204 } 1168 }
1205 } 1169 }
1206 }, 1170 },
1171 .rc.core = {
1172 .protocol = RC_TYPE_NEC,
1173 .module_name = "LME2510 Remote Control",
1174 .allowed_protos = RC_TYPE_NEC,
1175 .rc_codes = RC_MAP_LME2510,
1176 },
1207 .power_ctrl = lme2510_powerup, 1177 .power_ctrl = lme2510_powerup,
1208 .identify_state = lme2510_identify_state, 1178 .identify_state = lme2510_identify_state,
1209 .i2c_algo = &lme2510_i2c_algo, 1179 .i2c_algo = &lme2510_i2c_algo,
@@ -1246,6 +1216,12 @@ static struct dvb_usb_device_properties lme2510c_properties = {
1246 } 1216 }
1247 } 1217 }
1248 }, 1218 },
1219 .rc.core = {
1220 .protocol = RC_TYPE_NEC,
1221 .module_name = "LME2510 Remote Control",
1222 .allowed_protos = RC_TYPE_NEC,
1223 .rc_codes = RC_MAP_LME2510,
1224 },
1249 .power_ctrl = lme2510_powerup, 1225 .power_ctrl = lme2510_powerup,
1250 .identify_state = lme2510_identify_state, 1226 .identify_state = lme2510_identify_state,
1251 .i2c_algo = &lme2510_i2c_algo, 1227 .i2c_algo = &lme2510_i2c_algo,
@@ -1269,19 +1245,21 @@ static void *lme2510_exit_int(struct dvb_usb_device *d)
1269 adap->feedcount = 0; 1245 adap->feedcount = 0;
1270 } 1246 }
1271 1247
1272 if (st->lme_urb != NULL) { 1248 if (st->usb_buffer != NULL) {
1273 st->i2c_talk_onoff = 1; 1249 st->i2c_talk_onoff = 1;
1274 st->signal_lock = 0; 1250 st->signal_lock = 0;
1275 st->signal_level = 0; 1251 st->signal_level = 0;
1276 st->signal_sn = 0; 1252 st->signal_sn = 0;
1277 buffer = st->usb_buffer; 1253 buffer = st->usb_buffer;
1254 }
1255
1256 if (st->lme_urb != NULL) {
1278 usb_kill_urb(st->lme_urb); 1257 usb_kill_urb(st->lme_urb);
1279 usb_free_coherent(d->udev, 5000, st->buffer, 1258 usb_free_coherent(d->udev, 5000, st->buffer,
1280 st->lme_urb->transfer_dma); 1259 st->lme_urb->transfer_dma);
1281 info("Interrupt Service Stopped"); 1260 info("Interrupt Service Stopped");
1282 rc_unregister_device(d->rc_dev);
1283 info("Remote Stopped");
1284 } 1261 }
1262
1285 return buffer; 1263 return buffer;
1286} 1264}
1287 1265
@@ -1293,7 +1271,8 @@ static void lme2510_exit(struct usb_interface *intf)
1293 if (d != NULL) { 1271 if (d != NULL) {
1294 usb_buffer = lme2510_exit_int(d); 1272 usb_buffer = lme2510_exit_int(d);
1295 dvb_usb_device_exit(intf); 1273 dvb_usb_device_exit(intf);
1296 kfree(usb_buffer); 1274 if (usb_buffer != NULL)
1275 kfree(usb_buffer);
1297 } 1276 }
1298} 1277}
1299 1278
@@ -1327,5 +1306,5 @@ module_exit(lme2510_module_exit);
1327 1306
1328MODULE_AUTHOR("Malcolm Priestley <tvboxspy@gmail.com>"); 1307MODULE_AUTHOR("Malcolm Priestley <tvboxspy@gmail.com>");
1329MODULE_DESCRIPTION("LME2510(C) DVB-S USB2.0"); 1308MODULE_DESCRIPTION("LME2510(C) DVB-S USB2.0");
1330MODULE_VERSION("1.86"); 1309MODULE_VERSION("1.88");
1331MODULE_LICENSE("GPL"); 1310MODULE_LICENSE("GPL");
diff --git a/drivers/media/rc/keymaps/rc-lme2510.c b/drivers/media/rc/keymaps/rc-lme2510.c
index afae14fd152e..129d3f9a461d 100644
--- a/drivers/media/rc/keymaps/rc-lme2510.c
+++ b/drivers/media/rc/keymaps/rc-lme2510.c
@@ -14,81 +14,81 @@
14 14
15static struct rc_map_table lme2510_rc[] = { 15static struct rc_map_table lme2510_rc[] = {
16 /* Type 1 - 26 buttons */ 16 /* Type 1 - 26 buttons */
17 { 0xef12ba45, KEY_0 }, 17 { 0x10ed45, KEY_0 },
18 { 0xef12a05f, KEY_1 }, 18 { 0x10ed5f, KEY_1 },
19 { 0xef12af50, KEY_2 }, 19 { 0x10ed50, KEY_2 },
20 { 0xef12a25d, KEY_3 }, 20 { 0x10ed5d, KEY_3 },
21 { 0xef12be41, KEY_4 }, 21 { 0x10ed41, KEY_4 },
22 { 0xef12f50a, KEY_5 }, 22 { 0x10ed0a, KEY_5 },
23 { 0xef12bd42, KEY_6 }, 23 { 0x10ed42, KEY_6 },
24 { 0xef12b847, KEY_7 }, 24 { 0x10ed47, KEY_7 },
25 { 0xef12b649, KEY_8 }, 25 { 0x10ed49, KEY_8 },
26 { 0xef12fa05, KEY_9 }, 26 { 0x10ed05, KEY_9 },
27 { 0xef12bc43, KEY_POWER }, 27 { 0x10ed43, KEY_POWER },
28 { 0xef12b946, KEY_SUBTITLE }, 28 { 0x10ed46, KEY_SUBTITLE },
29 { 0xef12f906, KEY_PAUSE }, 29 { 0x10ed06, KEY_PAUSE },
30 { 0xef12fc03, KEY_MEDIA_REPEAT}, 30 { 0x10ed03, KEY_MEDIA_REPEAT},
31 { 0xef12fd02, KEY_PAUSE }, 31 { 0x10ed02, KEY_PAUSE },
32 { 0xef12a15e, KEY_VOLUMEUP }, 32 { 0x10ed5e, KEY_VOLUMEUP },
33 { 0xef12a35c, KEY_VOLUMEDOWN }, 33 { 0x10ed5c, KEY_VOLUMEDOWN },
34 { 0xef12f609, KEY_CHANNELUP }, 34 { 0x10ed09, KEY_CHANNELUP },
35 { 0xef12e51a, KEY_CHANNELDOWN }, 35 { 0x10ed1a, KEY_CHANNELDOWN },
36 { 0xef12e11e, KEY_PLAY }, 36 { 0x10ed1e, KEY_PLAY },
37 { 0xef12e41b, KEY_ZOOM }, 37 { 0x10ed1b, KEY_ZOOM },
38 { 0xef12a659, KEY_MUTE }, 38 { 0x10ed59, KEY_MUTE },
39 { 0xef12a55a, KEY_TV }, 39 { 0x10ed5a, KEY_TV },
40 { 0xef12e718, KEY_RECORD }, 40 { 0x10ed18, KEY_RECORD },
41 { 0xef12f807, KEY_EPG }, 41 { 0x10ed07, KEY_EPG },
42 { 0xef12fe01, KEY_STOP }, 42 { 0x10ed01, KEY_STOP },
43 /* Type 2 - 20 buttons */ 43 /* Type 2 - 20 buttons */
44 { 0xff40ea15, KEY_0 }, 44 { 0xbf15, KEY_0 },
45 { 0xff40f708, KEY_1 }, 45 { 0xbf08, KEY_1 },
46 { 0xff40f609, KEY_2 }, 46 { 0xbf09, KEY_2 },
47 { 0xff40f50a, KEY_3 }, 47 { 0xbf0a, KEY_3 },
48 { 0xff40f30c, KEY_4 }, 48 { 0xbf0c, KEY_4 },
49 { 0xff40f20d, KEY_5 }, 49 { 0xbf0d, KEY_5 },
50 { 0xff40f10e, KEY_6 }, 50 { 0xbf0e, KEY_6 },
51 { 0xff40ef10, KEY_7 }, 51 { 0xbf10, KEY_7 },
52 { 0xff40ee11, KEY_8 }, 52 { 0xbf11, KEY_8 },
53 { 0xff40ed12, KEY_9 }, 53 { 0xbf12, KEY_9 },
54 { 0xff40ff00, KEY_POWER }, 54 { 0xbf00, KEY_POWER },
55 { 0xff40fb04, KEY_MEDIA_REPEAT}, /* Recall */ 55 { 0xbf04, KEY_MEDIA_REPEAT}, /* Recall */
56 { 0xff40e51a, KEY_PAUSE }, /* Timeshift */ 56 { 0xbf1a, KEY_PAUSE }, /* Timeshift */
57 { 0xff40fd02, KEY_VOLUMEUP }, /* 2 x -/+ Keys not marked */ 57 { 0xbf02, KEY_VOLUMEUP }, /* 2 x -/+ Keys not marked */
58 { 0xff40f906, KEY_VOLUMEDOWN }, /* Volume defined as right hand*/ 58 { 0xbf06, KEY_VOLUMEDOWN }, /* Volume defined as right hand*/
59 { 0xff40fe01, KEY_CHANNELUP }, 59 { 0xbf01, KEY_CHANNELUP },
60 { 0xff40fa05, KEY_CHANNELDOWN }, 60 { 0xbf05, KEY_CHANNELDOWN },
61 { 0xff40eb14, KEY_ZOOM }, 61 { 0xbf14, KEY_ZOOM },
62 { 0xff40e718, KEY_RECORD }, 62 { 0xbf18, KEY_RECORD },
63 { 0xff40e916, KEY_STOP }, 63 { 0xbf16, KEY_STOP },
64 /* Type 3 - 20 buttons */ 64 /* Type 3 - 20 buttons */
65 { 0xff00e31c, KEY_0 }, 65 { 0x1c, KEY_0 },
66 { 0xff00f807, KEY_1 }, 66 { 0x07, KEY_1 },
67 { 0xff00ea15, KEY_2 }, 67 { 0x15, KEY_2 },
68 { 0xff00f609, KEY_3 }, 68 { 0x09, KEY_3 },
69 { 0xff00e916, KEY_4 }, 69 { 0x16, KEY_4 },
70 { 0xff00e619, KEY_5 }, 70 { 0x19, KEY_5 },
71 { 0xff00f20d, KEY_6 }, 71 { 0x0d, KEY_6 },
72 { 0xff00f30c, KEY_7 }, 72 { 0x0c, KEY_7 },
73 { 0xff00e718, KEY_8 }, 73 { 0x18, KEY_8 },
74 { 0xff00a15e, KEY_9 }, 74 { 0x5e, KEY_9 },
75 { 0xff00ba45, KEY_POWER }, 75 { 0x45, KEY_POWER },
76 { 0xff00bb44, KEY_MEDIA_REPEAT}, /* Recall */ 76 { 0x44, KEY_MEDIA_REPEAT}, /* Recall */
77 { 0xff00b54a, KEY_PAUSE }, /* Timeshift */ 77 { 0x4a, KEY_PAUSE }, /* Timeshift */
78 { 0xff00b847, KEY_VOLUMEUP }, /* 2 x -/+ Keys not marked */ 78 { 0x47, KEY_VOLUMEUP }, /* 2 x -/+ Keys not marked */
79 { 0xff00bc43, KEY_VOLUMEDOWN }, /* Volume defined as right hand*/ 79 { 0x43, KEY_VOLUMEDOWN }, /* Volume defined as right hand*/
80 { 0xff00b946, KEY_CHANNELUP }, 80 { 0x46, KEY_CHANNELUP },
81 { 0xff00bf40, KEY_CHANNELDOWN }, 81 { 0x40, KEY_CHANNELDOWN },
82 { 0xff00f708, KEY_ZOOM }, 82 { 0x08, KEY_ZOOM },
83 { 0xff00bd42, KEY_RECORD }, 83 { 0x42, KEY_RECORD },
84 { 0xff00a55a, KEY_STOP }, 84 { 0x5a, KEY_STOP },
85}; 85};
86 86
87static struct rc_map_list lme2510_map = { 87static struct rc_map_list lme2510_map = {
88 .map = { 88 .map = {
89 .scan = lme2510_rc, 89 .scan = lme2510_rc,
90 .size = ARRAY_SIZE(lme2510_rc), 90 .size = ARRAY_SIZE(lme2510_rc),
91 .rc_type = RC_TYPE_UNKNOWN, 91 .rc_type = RC_TYPE_NEC,
92 .name = RC_MAP_LME2510, 92 .name = RC_MAP_LME2510,
93 } 93 }
94}; 94};