diff options
Diffstat (limited to 'drivers/media/dvb/dvb-usb/lmedm04.c')
-rw-r--r-- | drivers/media/dvb/dvb-usb/lmedm04.c | 107 |
1 files changed, 43 insertions, 64 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 | } |
210 | static 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 | ||
222 | static int lme2510_enable_pid(struct dvb_usb_device *d, u8 index, u16 pid_out) | 211 | static 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 | ||
694 | static 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 | |||
733 | static u8 check_sum(u8 *p, u8 len) | 690 | static 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 | ||
1055 | end: if (ret) { | 1012 | end: 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 | ||
1328 | MODULE_AUTHOR("Malcolm Priestley <tvboxspy@gmail.com>"); | 1307 | MODULE_AUTHOR("Malcolm Priestley <tvboxspy@gmail.com>"); |
1329 | MODULE_DESCRIPTION("LME2510(C) DVB-S USB2.0"); | 1308 | MODULE_DESCRIPTION("LME2510(C) DVB-S USB2.0"); |
1330 | MODULE_VERSION("1.86"); | 1309 | MODULE_VERSION("1.88"); |
1331 | MODULE_LICENSE("GPL"); | 1310 | MODULE_LICENSE("GPL"); |