diff options
Diffstat (limited to 'drivers/media/dvb')
55 files changed, 1295 insertions, 1391 deletions
diff --git a/drivers/media/dvb/bt8xx/dst_ca.c b/drivers/media/dvb/bt8xx/dst_ca.c index 770243c720d..cf870516284 100644 --- a/drivers/media/dvb/bt8xx/dst_ca.c +++ b/drivers/media/dvb/bt8xx/dst_ca.c | |||
| @@ -565,7 +565,7 @@ static long dst_ca_ioctl(struct file *file, unsigned int cmd, unsigned long ioct | |||
| 565 | int result = 0; | 565 | int result = 0; |
| 566 | 566 | ||
| 567 | lock_kernel(); | 567 | lock_kernel(); |
| 568 | dvbdev = (struct dvb_device *)file->private_data; | 568 | dvbdev = file->private_data; |
| 569 | state = (struct dst_state *)dvbdev->priv; | 569 | state = (struct dst_state *)dvbdev->priv; |
| 570 | p_ca_message = kmalloc(sizeof (struct ca_msg), GFP_KERNEL); | 570 | p_ca_message = kmalloc(sizeof (struct ca_msg), GFP_KERNEL); |
| 571 | p_ca_slot_info = kmalloc(sizeof (struct ca_slot_info), GFP_KERNEL); | 571 | p_ca_slot_info = kmalloc(sizeof (struct ca_slot_info), GFP_KERNEL); |
diff --git a/drivers/media/dvb/dvb-core/dmxdev.c b/drivers/media/dvb/dvb-core/dmxdev.c index 425862ffb28..0042306ea11 100644 --- a/drivers/media/dvb/dvb-core/dmxdev.c +++ b/drivers/media/dvb/dvb-core/dmxdev.c | |||
| @@ -207,7 +207,7 @@ static int dvb_dvr_release(struct inode *inode, struct file *file) | |||
| 207 | } | 207 | } |
| 208 | /* TODO */ | 208 | /* TODO */ |
| 209 | dvbdev->users--; | 209 | dvbdev->users--; |
| 210 | if(dvbdev->users==-1 && dmxdev->exit==1) { | 210 | if (dvbdev->users == 1 && dmxdev->exit == 1) { |
| 211 | fops_put(file->f_op); | 211 | fops_put(file->f_op); |
| 212 | file->f_op = NULL; | 212 | file->f_op = NULL; |
| 213 | mutex_unlock(&dmxdev->mutex); | 213 | mutex_unlock(&dmxdev->mutex); |
diff --git a/drivers/media/dvb/dvb-core/dvb_ca_en50221.c b/drivers/media/dvb/dvb-core/dvb_ca_en50221.c index ef259a0718a..cb97e6b8543 100644 --- a/drivers/media/dvb/dvb-core/dvb_ca_en50221.c +++ b/drivers/media/dvb/dvb-core/dvb_ca_en50221.c | |||
| @@ -1318,8 +1318,11 @@ static ssize_t dvb_ca_en50221_io_write(struct file *file, | |||
| 1318 | 1318 | ||
| 1319 | fragbuf[0] = connection_id; | 1319 | fragbuf[0] = connection_id; |
| 1320 | fragbuf[1] = ((fragpos + fraglen) < count) ? 0x80 : 0x00; | 1320 | fragbuf[1] = ((fragpos + fraglen) < count) ? 0x80 : 0x00; |
| 1321 | if ((status = copy_from_user(fragbuf + 2, buf + fragpos, fraglen)) != 0) | 1321 | status = copy_from_user(fragbuf + 2, buf + fragpos, fraglen); |
| 1322 | if (status) { | ||
| 1323 | status = -EFAULT; | ||
| 1322 | goto exit; | 1324 | goto exit; |
| 1325 | } | ||
| 1323 | 1326 | ||
| 1324 | timeout = jiffies + HZ / 2; | 1327 | timeout = jiffies + HZ / 2; |
| 1325 | written = 0; | 1328 | written = 0; |
| @@ -1494,8 +1497,11 @@ static ssize_t dvb_ca_en50221_io_read(struct file *file, char __user * buf, | |||
| 1494 | 1497 | ||
| 1495 | hdr[0] = slot; | 1498 | hdr[0] = slot; |
| 1496 | hdr[1] = connection_id; | 1499 | hdr[1] = connection_id; |
| 1497 | if ((status = copy_to_user(buf, hdr, 2)) != 0) | 1500 | status = copy_to_user(buf, hdr, 2); |
| 1501 | if (status) { | ||
| 1502 | status = -EFAULT; | ||
| 1498 | goto exit; | 1503 | goto exit; |
| 1504 | } | ||
| 1499 | status = pktlen; | 1505 | status = pktlen; |
| 1500 | 1506 | ||
| 1501 | exit: | 1507 | exit: |
diff --git a/drivers/media/dvb/dvb-core/dvb_demux.c b/drivers/media/dvb/dvb-core/dvb_demux.c index 977ddba3e23..4a88a3e4db2 100644 --- a/drivers/media/dvb/dvb-core/dvb_demux.c +++ b/drivers/media/dvb/dvb-core/dvb_demux.c | |||
| @@ -1130,13 +1130,9 @@ static int dvbdmx_write(struct dmx_demux *demux, const char __user *buf, size_t | |||
| 1130 | if ((!demux->frontend) || (demux->frontend->source != DMX_MEMORY_FE)) | 1130 | if ((!demux->frontend) || (demux->frontend->source != DMX_MEMORY_FE)) |
| 1131 | return -EINVAL; | 1131 | return -EINVAL; |
| 1132 | 1132 | ||
| 1133 | p = kmalloc(count, GFP_USER); | 1133 | p = memdup_user(buf, count); |
| 1134 | if (!p) | 1134 | if (IS_ERR(p)) |
| 1135 | return -ENOMEM; | 1135 | return PTR_ERR(p); |
| 1136 | if (copy_from_user(p, buf, count)) { | ||
| 1137 | kfree(p); | ||
| 1138 | return -EFAULT; | ||
| 1139 | } | ||
| 1140 | if (mutex_lock_interruptible(&dvbdemux->mutex)) { | 1136 | if (mutex_lock_interruptible(&dvbdemux->mutex)) { |
| 1141 | kfree(p); | 1137 | kfree(p); |
| 1142 | return -ERESTARTSYS; | 1138 | return -ERESTARTSYS; |
diff --git a/drivers/media/dvb/dvb-core/dvb_frontend.c b/drivers/media/dvb/dvb-core/dvb_frontend.c index 44ae89ecef9..4d45b7d6b3f 100644 --- a/drivers/media/dvb/dvb-core/dvb_frontend.c +++ b/drivers/media/dvb/dvb-core/dvb_frontend.c | |||
| @@ -465,7 +465,7 @@ static void dvb_frontend_swzigzag(struct dvb_frontend *fe) | |||
| 465 | if ((fepriv->state & FESTATE_SEARCHING_FAST) || (fepriv->state & FESTATE_RETUNE)) { | 465 | if ((fepriv->state & FESTATE_SEARCHING_FAST) || (fepriv->state & FESTATE_RETUNE)) { |
| 466 | fepriv->delay = fepriv->min_delay; | 466 | fepriv->delay = fepriv->min_delay; |
| 467 | 467 | ||
| 468 | /* peform a tune */ | 468 | /* perform a tune */ |
| 469 | retval = dvb_frontend_swzigzag_autotune(fe, | 469 | retval = dvb_frontend_swzigzag_autotune(fe, |
| 470 | fepriv->check_wrapped); | 470 | fepriv->check_wrapped); |
| 471 | if (retval < 0) { | 471 | if (retval < 0) { |
| @@ -791,7 +791,7 @@ static int dvb_frontend_start(struct dvb_frontend *fe) | |||
| 791 | return 0; | 791 | return 0; |
| 792 | } | 792 | } |
| 793 | 793 | ||
| 794 | static void dvb_frontend_get_frequeny_limits(struct dvb_frontend *fe, | 794 | static void dvb_frontend_get_frequency_limits(struct dvb_frontend *fe, |
| 795 | u32 *freq_min, u32 *freq_max) | 795 | u32 *freq_min, u32 *freq_max) |
| 796 | { | 796 | { |
| 797 | *freq_min = max(fe->ops.info.frequency_min, fe->ops.tuner_ops.info.frequency_min); | 797 | *freq_min = max(fe->ops.info.frequency_min, fe->ops.tuner_ops.info.frequency_min); |
| @@ -815,7 +815,7 @@ static int dvb_frontend_check_parameters(struct dvb_frontend *fe, | |||
| 815 | u32 freq_max; | 815 | u32 freq_max; |
| 816 | 816 | ||
| 817 | /* range check: frequency */ | 817 | /* range check: frequency */ |
| 818 | dvb_frontend_get_frequeny_limits(fe, &freq_min, &freq_max); | 818 | dvb_frontend_get_frequency_limits(fe, &freq_min, &freq_max); |
| 819 | if ((freq_min && parms->frequency < freq_min) || | 819 | if ((freq_min && parms->frequency < freq_min) || |
| 820 | (freq_max && parms->frequency > freq_max)) { | 820 | (freq_max && parms->frequency > freq_max)) { |
| 821 | printk(KERN_WARNING "DVB: adapter %i frontend %i frequency %u out of range (%u..%u)\n", | 821 | printk(KERN_WARNING "DVB: adapter %i frontend %i frequency %u out of range (%u..%u)\n", |
| @@ -1627,7 +1627,7 @@ static int dvb_frontend_ioctl_legacy(struct file *file, | |||
| 1627 | case FE_GET_INFO: { | 1627 | case FE_GET_INFO: { |
| 1628 | struct dvb_frontend_info* info = parg; | 1628 | struct dvb_frontend_info* info = parg; |
| 1629 | memcpy(info, &fe->ops.info, sizeof(struct dvb_frontend_info)); | 1629 | memcpy(info, &fe->ops.info, sizeof(struct dvb_frontend_info)); |
| 1630 | dvb_frontend_get_frequeny_limits(fe, &info->frequency_min, &info->frequency_max); | 1630 | dvb_frontend_get_frequency_limits(fe, &info->frequency_min, &info->frequency_max); |
| 1631 | 1631 | ||
| 1632 | /* Force the CAN_INVERSION_AUTO bit on. If the frontend doesn't | 1632 | /* Force the CAN_INVERSION_AUTO bit on. If the frontend doesn't |
| 1633 | * do it, it is done for it. */ | 1633 | * do it, it is done for it. */ |
| @@ -1726,7 +1726,7 @@ static int dvb_frontend_ioctl_legacy(struct file *file, | |||
| 1726 | * (stv0299 for instance) take longer than 8msec to | 1726 | * (stv0299 for instance) take longer than 8msec to |
| 1727 | * respond to a set_voltage command. Those switches | 1727 | * respond to a set_voltage command. Those switches |
| 1728 | * need custom routines to switch properly. For all | 1728 | * need custom routines to switch properly. For all |
| 1729 | * other frontends, the following shoule work ok. | 1729 | * other frontends, the following should work ok. |
| 1730 | * Dish network legacy switches (as used by Dish500) | 1730 | * Dish network legacy switches (as used by Dish500) |
| 1731 | * are controlled by sending 9-bit command words | 1731 | * are controlled by sending 9-bit command words |
| 1732 | * spaced 8msec apart. | 1732 | * spaced 8msec apart. |
diff --git a/drivers/media/dvb/dvb-usb/a800.c b/drivers/media/dvb/dvb-usb/a800.c index b6cbb1dfc5f..a5c36372713 100644 --- a/drivers/media/dvb/dvb-usb/a800.c +++ b/drivers/media/dvb/dvb-usb/a800.c | |||
| @@ -37,7 +37,7 @@ static int a800_identify_state(struct usb_device *udev, struct dvb_usb_device_pr | |||
| 37 | return 0; | 37 | return 0; |
| 38 | } | 38 | } |
| 39 | 39 | ||
| 40 | static struct dvb_usb_rc_key ir_codes_a800_table[] = { | 40 | static struct ir_scancode ir_codes_a800_table[] = { |
| 41 | { 0x0201, KEY_PROG1 }, /* SOURCE */ | 41 | { 0x0201, KEY_PROG1 }, /* SOURCE */ |
| 42 | { 0x0200, KEY_POWER }, /* POWER */ | 42 | { 0x0200, KEY_POWER }, /* POWER */ |
| 43 | { 0x0205, KEY_1 }, /* 1 */ | 43 | { 0x0205, KEY_1 }, /* 1 */ |
| @@ -146,10 +146,12 @@ static struct dvb_usb_device_properties a800_properties = { | |||
| 146 | .power_ctrl = a800_power_ctrl, | 146 | .power_ctrl = a800_power_ctrl, |
| 147 | .identify_state = a800_identify_state, | 147 | .identify_state = a800_identify_state, |
| 148 | 148 | ||
| 149 | .rc_interval = DEFAULT_RC_INTERVAL, | 149 | .rc.legacy = { |
| 150 | .rc_key_map = ir_codes_a800_table, | 150 | .rc_interval = DEFAULT_RC_INTERVAL, |
| 151 | .rc_key_map_size = ARRAY_SIZE(ir_codes_a800_table), | 151 | .rc_key_map = ir_codes_a800_table, |
| 152 | .rc_query = a800_rc_query, | 152 | .rc_key_map_size = ARRAY_SIZE(ir_codes_a800_table), |
| 153 | .rc_query = a800_rc_query, | ||
| 154 | }, | ||
| 153 | 155 | ||
| 154 | .i2c_algo = &dibusb_i2c_algo, | 156 | .i2c_algo = &dibusb_i2c_algo, |
| 155 | 157 | ||
diff --git a/drivers/media/dvb/dvb-usb/af9005-remote.c b/drivers/media/dvb/dvb-usb/af9005-remote.c index b41fa873b04..696207fe37e 100644 --- a/drivers/media/dvb/dvb-usb/af9005-remote.c +++ b/drivers/media/dvb/dvb-usb/af9005-remote.c | |||
| @@ -33,7 +33,7 @@ MODULE_PARM_DESC(debug, | |||
| 33 | 33 | ||
| 34 | #define deb_decode(args...) dprintk(dvb_usb_af9005_remote_debug,0x01,args) | 34 | #define deb_decode(args...) dprintk(dvb_usb_af9005_remote_debug,0x01,args) |
| 35 | 35 | ||
| 36 | struct dvb_usb_rc_key ir_codes_af9005_table[] = { | 36 | struct ir_scancode ir_codes_af9005_table[] = { |
| 37 | 37 | ||
| 38 | {0x01b7, KEY_POWER}, | 38 | {0x01b7, KEY_POWER}, |
| 39 | {0x01a7, KEY_VOLUMEUP}, | 39 | {0x01a7, KEY_VOLUMEUP}, |
| @@ -133,7 +133,7 @@ int af9005_rc_decode(struct dvb_usb_device *d, u8 * data, int len, u32 * event, | |||
| 133 | for (i = 0; i < ir_codes_af9005_table_size; i++) { | 133 | for (i = 0; i < ir_codes_af9005_table_size; i++) { |
| 134 | if (rc5_custom(&ir_codes_af9005_table[i]) == cust | 134 | if (rc5_custom(&ir_codes_af9005_table[i]) == cust |
| 135 | && rc5_data(&ir_codes_af9005_table[i]) == dat) { | 135 | && rc5_data(&ir_codes_af9005_table[i]) == dat) { |
| 136 | *event = ir_codes_af9005_table[i].event; | 136 | *event = ir_codes_af9005_table[i].keycode; |
| 137 | *state = REMOTE_KEY_PRESSED; | 137 | *state = REMOTE_KEY_PRESSED; |
| 138 | deb_decode | 138 | deb_decode |
| 139 | ("key pressed, event %x\n", *event); | 139 | ("key pressed, event %x\n", *event); |
diff --git a/drivers/media/dvb/dvb-usb/af9005.c b/drivers/media/dvb/dvb-usb/af9005.c index cfd6107d534..8ecba8848bc 100644 --- a/drivers/media/dvb/dvb-usb/af9005.c +++ b/drivers/media/dvb/dvb-usb/af9005.c | |||
| @@ -54,50 +54,6 @@ struct af9005_device_state { | |||
| 54 | int led_state; | 54 | int led_state; |
| 55 | }; | 55 | }; |
| 56 | 56 | ||
| 57 | static int af9005_usb_generic_rw(struct dvb_usb_device *d, u8 *wbuf, u16 wlen, | ||
| 58 | u8 *rbuf, u16 rlen, int delay_ms) | ||
| 59 | { | ||
| 60 | int actlen, ret = -ENOMEM; | ||
| 61 | |||
| 62 | if (wbuf == NULL || wlen == 0) | ||
| 63 | return -EINVAL; | ||
| 64 | |||
| 65 | if ((ret = mutex_lock_interruptible(&d->usb_mutex))) | ||
| 66 | return ret; | ||
| 67 | |||
| 68 | deb_xfer(">>> "); | ||
| 69 | debug_dump(wbuf, wlen, deb_xfer); | ||
| 70 | |||
| 71 | ret = usb_bulk_msg(d->udev, usb_sndbulkpipe(d->udev, | ||
| 72 | 2), wbuf, wlen, | ||
| 73 | &actlen, 2000); | ||
| 74 | |||
| 75 | if (ret) | ||
| 76 | err("bulk message failed: %d (%d/%d)", ret, wlen, actlen); | ||
| 77 | else | ||
| 78 | ret = actlen != wlen ? -1 : 0; | ||
| 79 | |||
| 80 | /* an answer is expected, and no error before */ | ||
| 81 | if (!ret && rbuf && rlen) { | ||
| 82 | if (delay_ms) | ||
| 83 | msleep(delay_ms); | ||
| 84 | |||
| 85 | ret = usb_bulk_msg(d->udev, usb_rcvbulkpipe(d->udev, | ||
| 86 | 0x01), rbuf, | ||
| 87 | rlen, &actlen, 2000); | ||
| 88 | |||
| 89 | if (ret) | ||
| 90 | err("recv bulk message failed: %d", ret); | ||
| 91 | else { | ||
| 92 | deb_xfer("<<< "); | ||
| 93 | debug_dump(rbuf, actlen, deb_xfer); | ||
| 94 | } | ||
| 95 | } | ||
| 96 | |||
| 97 | mutex_unlock(&d->usb_mutex); | ||
| 98 | return ret; | ||
| 99 | } | ||
| 100 | |||
| 101 | static int af9005_generic_read_write(struct dvb_usb_device *d, u16 reg, | 57 | static int af9005_generic_read_write(struct dvb_usb_device *d, u16 reg, |
| 102 | int readwrite, int type, u8 * values, int len) | 58 | int readwrite, int type, u8 * values, int len) |
| 103 | { | 59 | { |
| @@ -146,7 +102,7 @@ static int af9005_generic_read_write(struct dvb_usb_device *d, u16 reg, | |||
| 146 | obuf[8] = values[0]; | 102 | obuf[8] = values[0]; |
| 147 | obuf[7] = command; | 103 | obuf[7] = command; |
| 148 | 104 | ||
| 149 | ret = af9005_usb_generic_rw(d, obuf, 16, ibuf, 17, 0); | 105 | ret = dvb_usb_generic_rw(d, obuf, 16, ibuf, 17, 0); |
| 150 | if (ret) | 106 | if (ret) |
| 151 | return ret; | 107 | return ret; |
| 152 | 108 | ||
| @@ -534,7 +490,7 @@ int af9005_send_command(struct dvb_usb_device *d, u8 command, u8 * wbuf, | |||
| 534 | buf[6] = wlen; | 490 | buf[6] = wlen; |
| 535 | for (i = 0; i < wlen; i++) | 491 | for (i = 0; i < wlen; i++) |
| 536 | buf[7 + i] = wbuf[i]; | 492 | buf[7 + i] = wbuf[i]; |
| 537 | ret = af9005_usb_generic_rw(d, buf, wlen + 7, ibuf, rlen + 7, 0); | 493 | ret = dvb_usb_generic_rw(d, buf, wlen + 7, ibuf, rlen + 7, 0); |
| 538 | if (ret) | 494 | if (ret) |
| 539 | return ret; | 495 | return ret; |
| 540 | if (ibuf[2] != 0x27) { | 496 | if (ibuf[2] != 0x27) { |
| @@ -581,7 +537,7 @@ int af9005_read_eeprom(struct dvb_usb_device *d, u8 address, u8 * values, | |||
| 581 | 537 | ||
| 582 | obuf[6] = len; | 538 | obuf[6] = len; |
| 583 | obuf[7] = address; | 539 | obuf[7] = address; |
| 584 | ret = af9005_usb_generic_rw(d, obuf, 16, ibuf, 14, 0); | 540 | ret = dvb_usb_generic_rw(d, obuf, 16, ibuf, 14, 0); |
| 585 | if (ret) | 541 | if (ret) |
| 586 | return ret; | 542 | return ret; |
| 587 | if (ibuf[2] != 0x2b) { | 543 | if (ibuf[2] != 0x2b) { |
| @@ -882,7 +838,7 @@ static int af9005_rc_query(struct dvb_usb_device *d, u32 * event, int *state) | |||
| 882 | obuf[2] = 0x40; /* read remote */ | 838 | obuf[2] = 0x40; /* read remote */ |
| 883 | obuf[3] = 1; /* rest of packet length */ | 839 | obuf[3] = 1; /* rest of packet length */ |
| 884 | obuf[4] = st->sequence++; /* sequence number */ | 840 | obuf[4] = st->sequence++; /* sequence number */ |
| 885 | ret = af9005_usb_generic_rw(d, obuf, 5, ibuf, 256, 0); | 841 | ret = dvb_usb_generic_rw(d, obuf, 5, ibuf, 256, 0); |
| 886 | if (ret) { | 842 | if (ret) { |
| 887 | err("rc query failed"); | 843 | err("rc query failed"); |
| 888 | return ret; | 844 | return ret; |
| @@ -1069,10 +1025,15 @@ static struct dvb_usb_device_properties af9005_properties = { | |||
| 1069 | 1025 | ||
| 1070 | .i2c_algo = &af9005_i2c_algo, | 1026 | .i2c_algo = &af9005_i2c_algo, |
| 1071 | 1027 | ||
| 1072 | .rc_interval = 200, | 1028 | .rc.legacy = { |
| 1073 | .rc_key_map = NULL, | 1029 | .rc_interval = 200, |
| 1074 | .rc_key_map_size = 0, | 1030 | .rc_key_map = NULL, |
| 1075 | .rc_query = af9005_rc_query, | 1031 | .rc_key_map_size = 0, |
| 1032 | .rc_query = af9005_rc_query, | ||
| 1033 | }, | ||
| 1034 | |||
| 1035 | .generic_bulk_ctrl_endpoint = 2, | ||
| 1036 | .generic_bulk_ctrl_endpoint_response = 1, | ||
| 1076 | 1037 | ||
| 1077 | .num_device_descs = 3, | 1038 | .num_device_descs = 3, |
| 1078 | .devices = { | 1039 | .devices = { |
| @@ -1113,10 +1074,10 @@ static int __init af9005_usb_module_init(void) | |||
| 1113 | rc_keys_size = symbol_request(ir_codes_af9005_table_size); | 1074 | rc_keys_size = symbol_request(ir_codes_af9005_table_size); |
| 1114 | if (rc_decode == NULL || rc_keys == NULL || rc_keys_size == NULL) { | 1075 | if (rc_decode == NULL || rc_keys == NULL || rc_keys_size == NULL) { |
| 1115 | err("af9005_rc_decode function not found, disabling remote"); | 1076 | err("af9005_rc_decode function not found, disabling remote"); |
| 1116 | af9005_properties.rc_query = NULL; | 1077 | af9005_properties.rc.legacy.rc_query = NULL; |
| 1117 | } else { | 1078 | } else { |
| 1118 | af9005_properties.rc_key_map = rc_keys; | 1079 | af9005_properties.rc.legacy.rc_key_map = rc_keys; |
| 1119 | af9005_properties.rc_key_map_size = *rc_keys_size; | 1080 | af9005_properties.rc.legacy.rc_key_map_size = *rc_keys_size; |
| 1120 | } | 1081 | } |
| 1121 | 1082 | ||
| 1122 | return 0; | 1083 | return 0; |
diff --git a/drivers/media/dvb/dvb-usb/af9005.h b/drivers/media/dvb/dvb-usb/af9005.h index 088e7083a39..3c1fbd1c5d6 100644 --- a/drivers/media/dvb/dvb-usb/af9005.h +++ b/drivers/media/dvb/dvb-usb/af9005.h | |||
| @@ -3490,7 +3490,7 @@ extern u8 regmask[8]; | |||
| 3490 | /* remote control decoder */ | 3490 | /* remote control decoder */ |
| 3491 | extern int af9005_rc_decode(struct dvb_usb_device *d, u8 * data, int len, | 3491 | extern int af9005_rc_decode(struct dvb_usb_device *d, u8 * data, int len, |
| 3492 | u32 * event, int *state); | 3492 | u32 * event, int *state); |
| 3493 | extern struct dvb_usb_rc_key ir_codes_af9005_table[]; | 3493 | extern struct ir_scancode ir_codes_af9005_table[]; |
| 3494 | extern int ir_codes_af9005_table_size; | 3494 | extern int ir_codes_af9005_table_size; |
| 3495 | 3495 | ||
| 3496 | #endif | 3496 | #endif |
diff --git a/drivers/media/dvb/dvb-usb/af9015.c b/drivers/media/dvb/dvb-usb/af9015.c index 66c7c3ea799..ea1ed3b4592 100644 --- a/drivers/media/dvb/dvb-usb/af9015.c +++ b/drivers/media/dvb/dvb-usb/af9015.c | |||
| @@ -735,7 +735,7 @@ error: | |||
| 735 | 735 | ||
| 736 | struct af9015_setup { | 736 | struct af9015_setup { |
| 737 | unsigned int id; | 737 | unsigned int id; |
| 738 | struct dvb_usb_rc_key *rc_key_map; | 738 | struct ir_scancode *rc_key_map; |
| 739 | unsigned int rc_key_map_size; | 739 | unsigned int rc_key_map_size; |
| 740 | u8 *ir_table; | 740 | u8 *ir_table; |
| 741 | unsigned int ir_table_size; | 741 | unsigned int ir_table_size; |
| @@ -847,8 +847,8 @@ static void af9015_set_remote_config(struct usb_device *udev, | |||
| 847 | } | 847 | } |
| 848 | 848 | ||
| 849 | if (table) { | 849 | if (table) { |
| 850 | props->rc_key_map = table->rc_key_map; | 850 | props->rc.legacy.rc_key_map = table->rc_key_map; |
| 851 | props->rc_key_map_size = table->rc_key_map_size; | 851 | props->rc.legacy.rc_key_map_size = table->rc_key_map_size; |
| 852 | af9015_config.ir_table = table->ir_table; | 852 | af9015_config.ir_table = table->ir_table; |
| 853 | af9015_config.ir_table_size = table->ir_table_size; | 853 | af9015_config.ir_table_size = table->ir_table_size; |
| 854 | } | 854 | } |
| @@ -878,8 +878,8 @@ static int af9015_read_config(struct usb_device *udev) | |||
| 878 | deb_info("%s: IR mode:%d\n", __func__, val); | 878 | deb_info("%s: IR mode:%d\n", __func__, val); |
| 879 | for (i = 0; i < af9015_properties_count; i++) { | 879 | for (i = 0; i < af9015_properties_count; i++) { |
| 880 | if (val == AF9015_IR_MODE_DISABLED) { | 880 | if (val == AF9015_IR_MODE_DISABLED) { |
| 881 | af9015_properties[i].rc_key_map = NULL; | 881 | af9015_properties[i].rc.legacy.rc_key_map = NULL; |
| 882 | af9015_properties[i].rc_key_map_size = 0; | 882 | af9015_properties[i].rc.legacy.rc_key_map_size = 0; |
| 883 | } else | 883 | } else |
| 884 | af9015_set_remote_config(udev, &af9015_properties[i]); | 884 | af9015_set_remote_config(udev, &af9015_properties[i]); |
| 885 | } | 885 | } |
| @@ -1063,7 +1063,7 @@ static int af9015_rc_query(struct dvb_usb_device *d, u32 *event, int *state) | |||
| 1063 | { | 1063 | { |
| 1064 | u8 buf[8]; | 1064 | u8 buf[8]; |
| 1065 | struct req_t req = {GET_IR_CODE, 0, 0, 0, 0, sizeof(buf), buf}; | 1065 | struct req_t req = {GET_IR_CODE, 0, 0, 0, 0, sizeof(buf), buf}; |
| 1066 | struct dvb_usb_rc_key *keymap = d->props.rc_key_map; | 1066 | struct ir_scancode *keymap = d->props.rc.legacy.rc_key_map; |
| 1067 | int i, ret; | 1067 | int i, ret; |
| 1068 | 1068 | ||
| 1069 | memset(buf, 0, sizeof(buf)); | 1069 | memset(buf, 0, sizeof(buf)); |
| @@ -1075,10 +1075,10 @@ static int af9015_rc_query(struct dvb_usb_device *d, u32 *event, int *state) | |||
| 1075 | *event = 0; | 1075 | *event = 0; |
| 1076 | *state = REMOTE_NO_KEY_PRESSED; | 1076 | *state = REMOTE_NO_KEY_PRESSED; |
| 1077 | 1077 | ||
| 1078 | for (i = 0; i < d->props.rc_key_map_size; i++) { | 1078 | for (i = 0; i < d->props.rc.legacy.rc_key_map_size; i++) { |
| 1079 | if (!buf[1] && rc5_custom(&keymap[i]) == buf[0] && | 1079 | if (!buf[1] && rc5_custom(&keymap[i]) == buf[0] && |
| 1080 | rc5_data(&keymap[i]) == buf[2]) { | 1080 | rc5_data(&keymap[i]) == buf[2]) { |
| 1081 | *event = keymap[i].event; | 1081 | *event = keymap[i].keycode; |
| 1082 | *state = REMOTE_KEY_PRESSED; | 1082 | *state = REMOTE_KEY_PRESSED; |
| 1083 | break; | 1083 | break; |
| 1084 | } | 1084 | } |
| @@ -1299,6 +1299,7 @@ static struct usb_device_id af9015_usb_table[] = { | |||
| 1299 | {USB_DEVICE(USB_VID_LEADTEK, USB_PID_WINFAST_DTV2000DS)}, | 1299 | {USB_DEVICE(USB_VID_LEADTEK, USB_PID_WINFAST_DTV2000DS)}, |
| 1300 | /* 30 */{USB_DEVICE(USB_VID_KWORLD_2, USB_PID_KWORLD_UB383_T)}, | 1300 | /* 30 */{USB_DEVICE(USB_VID_KWORLD_2, USB_PID_KWORLD_UB383_T)}, |
| 1301 | {USB_DEVICE(USB_VID_KWORLD_2, USB_PID_KWORLD_395U_4)}, | 1301 | {USB_DEVICE(USB_VID_KWORLD_2, USB_PID_KWORLD_395U_4)}, |
| 1302 | {USB_DEVICE(USB_VID_AVERMEDIA, USB_PID_AVERMEDIA_A815M)}, | ||
| 1302 | {0}, | 1303 | {0}, |
| 1303 | }; | 1304 | }; |
| 1304 | MODULE_DEVICE_TABLE(usb, af9015_usb_table); | 1305 | MODULE_DEVICE_TABLE(usb, af9015_usb_table); |
| @@ -1353,8 +1354,10 @@ static struct dvb_usb_device_properties af9015_properties[] = { | |||
| 1353 | 1354 | ||
| 1354 | .identify_state = af9015_identify_state, | 1355 | .identify_state = af9015_identify_state, |
| 1355 | 1356 | ||
| 1356 | .rc_query = af9015_rc_query, | 1357 | .rc.legacy = { |
| 1357 | .rc_interval = 150, | 1358 | .rc_query = af9015_rc_query, |
| 1359 | .rc_interval = 150, | ||
| 1360 | }, | ||
| 1358 | 1361 | ||
| 1359 | .i2c_algo = &af9015_i2c_algo, | 1362 | .i2c_algo = &af9015_i2c_algo, |
| 1360 | 1363 | ||
| @@ -1460,8 +1463,10 @@ static struct dvb_usb_device_properties af9015_properties[] = { | |||
| 1460 | 1463 | ||
| 1461 | .identify_state = af9015_identify_state, | 1464 | .identify_state = af9015_identify_state, |
| 1462 | 1465 | ||
| 1463 | .rc_query = af9015_rc_query, | 1466 | .rc.legacy = { |
| 1464 | .rc_interval = 150, | 1467 | .rc_query = af9015_rc_query, |
| 1468 | .rc_interval = 150, | ||
| 1469 | }, | ||
| 1465 | 1470 | ||
| 1466 | .i2c_algo = &af9015_i2c_algo, | 1471 | .i2c_algo = &af9015_i2c_algo, |
| 1467 | 1472 | ||
| @@ -1567,12 +1572,14 @@ static struct dvb_usb_device_properties af9015_properties[] = { | |||
| 1567 | 1572 | ||
| 1568 | .identify_state = af9015_identify_state, | 1573 | .identify_state = af9015_identify_state, |
| 1569 | 1574 | ||
| 1570 | .rc_query = af9015_rc_query, | 1575 | .rc.legacy = { |
| 1571 | .rc_interval = 150, | 1576 | .rc_query = af9015_rc_query, |
| 1577 | .rc_interval = 150, | ||
| 1578 | }, | ||
| 1572 | 1579 | ||
| 1573 | .i2c_algo = &af9015_i2c_algo, | 1580 | .i2c_algo = &af9015_i2c_algo, |
| 1574 | 1581 | ||
| 1575 | .num_device_descs = 8, /* max 9 */ | 1582 | .num_device_descs = 9, /* max 9 */ |
| 1576 | .devices = { | 1583 | .devices = { |
| 1577 | { | 1584 | { |
| 1578 | .name = "AverMedia AVerTV Volar GPS 805 (A805)", | 1585 | .name = "AverMedia AVerTV Volar GPS 805 (A805)", |
| @@ -1617,6 +1624,11 @@ static struct dvb_usb_device_properties af9015_properties[] = { | |||
| 1617 | .cold_ids = {&af9015_usb_table[30], NULL}, | 1624 | .cold_ids = {&af9015_usb_table[30], NULL}, |
| 1618 | .warm_ids = {NULL}, | 1625 | .warm_ids = {NULL}, |
| 1619 | }, | 1626 | }, |
| 1627 | { | ||
| 1628 | .name = "AverMedia AVerTV Volar M (A815Mac)", | ||
| 1629 | .cold_ids = {&af9015_usb_table[32], NULL}, | ||
| 1630 | .warm_ids = {NULL}, | ||
| 1631 | }, | ||
| 1620 | } | 1632 | } |
| 1621 | }, | 1633 | }, |
| 1622 | }; | 1634 | }; |
diff --git a/drivers/media/dvb/dvb-usb/af9015.h b/drivers/media/dvb/dvb-usb/af9015.h index 63b2a4907b7..c8e9349742e 100644 --- a/drivers/media/dvb/dvb-usb/af9015.h +++ b/drivers/media/dvb/dvb-usb/af9015.h | |||
| @@ -123,7 +123,7 @@ enum af9015_remote { | |||
| 123 | 123 | ||
| 124 | /* LeadTek - Y04G0051 */ | 124 | /* LeadTek - Y04G0051 */ |
| 125 | /* Leadtek WinFast DTV Dongle Gold */ | 125 | /* Leadtek WinFast DTV Dongle Gold */ |
| 126 | static struct dvb_usb_rc_key ir_codes_af9015_table_leadtek[] = { | 126 | static struct ir_scancode ir_codes_af9015_table_leadtek[] = { |
| 127 | { 0x001e, KEY_1 }, | 127 | { 0x001e, KEY_1 }, |
| 128 | { 0x001f, KEY_2 }, | 128 | { 0x001f, KEY_2 }, |
| 129 | { 0x0020, KEY_3 }, | 129 | { 0x0020, KEY_3 }, |
| @@ -227,7 +227,7 @@ static u8 af9015_ir_table_leadtek[] = { | |||
| 227 | }; | 227 | }; |
| 228 | 228 | ||
| 229 | /* TwinHan AzureWave AD-TU700(704J) */ | 229 | /* TwinHan AzureWave AD-TU700(704J) */ |
| 230 | static struct dvb_usb_rc_key ir_codes_af9015_table_twinhan[] = { | 230 | static struct ir_scancode ir_codes_af9015_table_twinhan[] = { |
| 231 | { 0x053f, KEY_POWER }, | 231 | { 0x053f, KEY_POWER }, |
| 232 | { 0x0019, KEY_FAVORITES }, /* Favorite List */ | 232 | { 0x0019, KEY_FAVORITES }, /* Favorite List */ |
| 233 | { 0x0004, KEY_TEXT }, /* Teletext */ | 233 | { 0x0004, KEY_TEXT }, /* Teletext */ |
| @@ -338,7 +338,7 @@ static u8 af9015_ir_table_twinhan[] = { | |||
| 338 | }; | 338 | }; |
| 339 | 339 | ||
| 340 | /* A-Link DTU(m) */ | 340 | /* A-Link DTU(m) */ |
| 341 | static struct dvb_usb_rc_key ir_codes_af9015_table_a_link[] = { | 341 | static struct ir_scancode ir_codes_af9015_table_a_link[] = { |
| 342 | { 0x001e, KEY_1 }, | 342 | { 0x001e, KEY_1 }, |
| 343 | { 0x001f, KEY_2 }, | 343 | { 0x001f, KEY_2 }, |
| 344 | { 0x0020, KEY_3 }, | 344 | { 0x0020, KEY_3 }, |
| @@ -381,7 +381,7 @@ static u8 af9015_ir_table_a_link[] = { | |||
| 381 | }; | 381 | }; |
| 382 | 382 | ||
| 383 | /* MSI DIGIVOX mini II V3.0 */ | 383 | /* MSI DIGIVOX mini II V3.0 */ |
| 384 | static struct dvb_usb_rc_key ir_codes_af9015_table_msi[] = { | 384 | static struct ir_scancode ir_codes_af9015_table_msi[] = { |
| 385 | { 0x001e, KEY_1 }, | 385 | { 0x001e, KEY_1 }, |
| 386 | { 0x001f, KEY_2 }, | 386 | { 0x001f, KEY_2 }, |
| 387 | { 0x0020, KEY_3 }, | 387 | { 0x0020, KEY_3 }, |
| @@ -424,7 +424,7 @@ static u8 af9015_ir_table_msi[] = { | |||
| 424 | }; | 424 | }; |
| 425 | 425 | ||
| 426 | /* MYGICTV U718 */ | 426 | /* MYGICTV U718 */ |
| 427 | static struct dvb_usb_rc_key ir_codes_af9015_table_mygictv[] = { | 427 | static struct ir_scancode ir_codes_af9015_table_mygictv[] = { |
| 428 | { 0x003d, KEY_SWITCHVIDEOMODE }, | 428 | { 0x003d, KEY_SWITCHVIDEOMODE }, |
| 429 | /* TV / AV */ | 429 | /* TV / AV */ |
| 430 | { 0x0545, KEY_POWER }, | 430 | { 0x0545, KEY_POWER }, |
| @@ -550,7 +550,7 @@ static u8 af9015_ir_table_kworld[] = { | |||
| 550 | }; | 550 | }; |
| 551 | 551 | ||
| 552 | /* AverMedia Volar X */ | 552 | /* AverMedia Volar X */ |
| 553 | static struct dvb_usb_rc_key ir_codes_af9015_table_avermedia[] = { | 553 | static struct ir_scancode ir_codes_af9015_table_avermedia[] = { |
| 554 | { 0x053d, KEY_PROG1 }, /* SOURCE */ | 554 | { 0x053d, KEY_PROG1 }, /* SOURCE */ |
| 555 | { 0x0512, KEY_POWER }, /* POWER */ | 555 | { 0x0512, KEY_POWER }, /* POWER */ |
| 556 | { 0x051e, KEY_1 }, /* 1 */ | 556 | { 0x051e, KEY_1 }, /* 1 */ |
| @@ -656,7 +656,7 @@ static u8 af9015_ir_table_avermedia_ks[] = { | |||
| 656 | }; | 656 | }; |
| 657 | 657 | ||
| 658 | /* Digittrade DVB-T USB Stick */ | 658 | /* Digittrade DVB-T USB Stick */ |
| 659 | static struct dvb_usb_rc_key ir_codes_af9015_table_digittrade[] = { | 659 | static struct ir_scancode ir_codes_af9015_table_digittrade[] = { |
| 660 | { 0x010f, KEY_LAST }, /* RETURN */ | 660 | { 0x010f, KEY_LAST }, /* RETURN */ |
| 661 | { 0x0517, KEY_TEXT }, /* TELETEXT */ | 661 | { 0x0517, KEY_TEXT }, /* TELETEXT */ |
| 662 | { 0x0108, KEY_EPG }, /* EPG */ | 662 | { 0x0108, KEY_EPG }, /* EPG */ |
| @@ -719,7 +719,7 @@ static u8 af9015_ir_table_digittrade[] = { | |||
| 719 | }; | 719 | }; |
| 720 | 720 | ||
| 721 | /* TREKSTOR DVB-T USB Stick */ | 721 | /* TREKSTOR DVB-T USB Stick */ |
| 722 | static struct dvb_usb_rc_key ir_codes_af9015_table_trekstor[] = { | 722 | static struct ir_scancode ir_codes_af9015_table_trekstor[] = { |
| 723 | { 0x0704, KEY_AGAIN }, /* Home */ | 723 | { 0x0704, KEY_AGAIN }, /* Home */ |
| 724 | { 0x0705, KEY_MUTE }, /* Mute */ | 724 | { 0x0705, KEY_MUTE }, /* Mute */ |
| 725 | { 0x0706, KEY_UP }, /* Up */ | 725 | { 0x0706, KEY_UP }, /* Up */ |
| @@ -782,7 +782,7 @@ static u8 af9015_ir_table_trekstor[] = { | |||
| 782 | }; | 782 | }; |
| 783 | 783 | ||
| 784 | /* MSI DIGIVOX mini III */ | 784 | /* MSI DIGIVOX mini III */ |
| 785 | static struct dvb_usb_rc_key ir_codes_af9015_table_msi_digivox_iii[] = { | 785 | static struct ir_scancode ir_codes_af9015_table_msi_digivox_iii[] = { |
| 786 | { 0x0713, KEY_POWER }, /* [red power button] */ | 786 | { 0x0713, KEY_POWER }, /* [red power button] */ |
| 787 | { 0x073b, KEY_VIDEO }, /* Source */ | 787 | { 0x073b, KEY_VIDEO }, /* Source */ |
| 788 | { 0x073e, KEY_ZOOM }, /* Zoom */ | 788 | { 0x073e, KEY_ZOOM }, /* Zoom */ |
diff --git a/drivers/media/dvb/dvb-usb/anysee.c b/drivers/media/dvb/dvb-usb/anysee.c index faca1ad88a6..4685259e161 100644 --- a/drivers/media/dvb/dvb-usb/anysee.c +++ b/drivers/media/dvb/dvb-usb/anysee.c | |||
| @@ -377,7 +377,7 @@ static int anysee_tuner_attach(struct dvb_usb_adapter *adap) | |||
| 377 | static int anysee_rc_query(struct dvb_usb_device *d, u32 *event, int *state) | 377 | static int anysee_rc_query(struct dvb_usb_device *d, u32 *event, int *state) |
| 378 | { | 378 | { |
| 379 | u8 buf[] = {CMD_GET_IR_CODE}; | 379 | u8 buf[] = {CMD_GET_IR_CODE}; |
| 380 | struct dvb_usb_rc_key *keymap = d->props.rc_key_map; | 380 | struct ir_scancode *keymap = d->props.rc.legacy.rc_key_map; |
| 381 | u8 ircode[2]; | 381 | u8 ircode[2]; |
| 382 | int i, ret; | 382 | int i, ret; |
| 383 | 383 | ||
| @@ -388,10 +388,10 @@ static int anysee_rc_query(struct dvb_usb_device *d, u32 *event, int *state) | |||
| 388 | *event = 0; | 388 | *event = 0; |
| 389 | *state = REMOTE_NO_KEY_PRESSED; | 389 | *state = REMOTE_NO_KEY_PRESSED; |
| 390 | 390 | ||
| 391 | for (i = 0; i < d->props.rc_key_map_size; i++) { | 391 | for (i = 0; i < d->props.rc.legacy.rc_key_map_size; i++) { |
| 392 | if (rc5_custom(&keymap[i]) == ircode[0] && | 392 | if (rc5_custom(&keymap[i]) == ircode[0] && |
| 393 | rc5_data(&keymap[i]) == ircode[1]) { | 393 | rc5_data(&keymap[i]) == ircode[1]) { |
| 394 | *event = keymap[i].event; | 394 | *event = keymap[i].keycode; |
| 395 | *state = REMOTE_KEY_PRESSED; | 395 | *state = REMOTE_KEY_PRESSED; |
| 396 | return 0; | 396 | return 0; |
| 397 | } | 397 | } |
| @@ -399,7 +399,7 @@ static int anysee_rc_query(struct dvb_usb_device *d, u32 *event, int *state) | |||
| 399 | return 0; | 399 | return 0; |
| 400 | } | 400 | } |
| 401 | 401 | ||
| 402 | static struct dvb_usb_rc_key ir_codes_anysee_table[] = { | 402 | static struct ir_scancode ir_codes_anysee_table[] = { |
| 403 | { 0x0100, KEY_0 }, | 403 | { 0x0100, KEY_0 }, |
| 404 | { 0x0101, KEY_1 }, | 404 | { 0x0101, KEY_1 }, |
| 405 | { 0x0102, KEY_2 }, | 405 | { 0x0102, KEY_2 }, |
| @@ -463,6 +463,11 @@ static int anysee_probe(struct usb_interface *intf, | |||
| 463 | if (intf->num_altsetting < 1) | 463 | if (intf->num_altsetting < 1) |
| 464 | return -ENODEV; | 464 | return -ENODEV; |
| 465 | 465 | ||
| 466 | /* | ||
| 467 | * Anysee is always warm (its USB-bridge, Cypress FX2, uploads | ||
| 468 | * firmware from eeprom). If dvb_usb_device_init() succeeds that | ||
| 469 | * means d is a valid pointer. | ||
| 470 | */ | ||
| 466 | ret = dvb_usb_device_init(intf, &anysee_properties, THIS_MODULE, &d, | 471 | ret = dvb_usb_device_init(intf, &anysee_properties, THIS_MODULE, &d, |
| 467 | adapter_nr); | 472 | adapter_nr); |
| 468 | if (ret) | 473 | if (ret) |
| @@ -479,10 +484,7 @@ static int anysee_probe(struct usb_interface *intf, | |||
| 479 | if (ret) | 484 | if (ret) |
| 480 | return ret; | 485 | return ret; |
| 481 | 486 | ||
| 482 | if (d) | 487 | return anysee_init(d); |
| 483 | ret = anysee_init(d); | ||
| 484 | |||
| 485 | return ret; | ||
| 486 | } | 488 | } |
| 487 | 489 | ||
| 488 | static struct usb_device_id anysee_table[] = { | 490 | static struct usb_device_id anysee_table[] = { |
| @@ -518,10 +520,12 @@ static struct dvb_usb_device_properties anysee_properties = { | |||
| 518 | } | 520 | } |
| 519 | }, | 521 | }, |
| 520 | 522 | ||
| 521 | .rc_key_map = ir_codes_anysee_table, | 523 | .rc.legacy = { |
| 522 | .rc_key_map_size = ARRAY_SIZE(ir_codes_anysee_table), | 524 | .rc_key_map = ir_codes_anysee_table, |
| 523 | .rc_query = anysee_rc_query, | 525 | .rc_key_map_size = ARRAY_SIZE(ir_codes_anysee_table), |
| 524 | .rc_interval = 200, /* windows driver uses 500ms */ | 526 | .rc_query = anysee_rc_query, |
| 527 | .rc_interval = 200, /* windows driver uses 500ms */ | ||
| 528 | }, | ||
| 525 | 529 | ||
| 526 | .i2c_algo = &anysee_i2c_algo, | 530 | .i2c_algo = &anysee_i2c_algo, |
| 527 | 531 | ||
diff --git a/drivers/media/dvb/dvb-usb/az6027.c b/drivers/media/dvb/dvb-usb/az6027.c index 6681ac1c56e..62c58288469 100644 --- a/drivers/media/dvb/dvb-usb/az6027.c +++ b/drivers/media/dvb/dvb-usb/az6027.c | |||
| @@ -386,7 +386,7 @@ static int az6027_streaming_ctrl(struct dvb_usb_adapter *adap, int onoff) | |||
| 386 | } | 386 | } |
| 387 | 387 | ||
| 388 | /* keys for the enclosed remote control */ | 388 | /* keys for the enclosed remote control */ |
| 389 | static struct dvb_usb_rc_key ir_codes_az6027_table[] = { | 389 | static struct ir_scancode ir_codes_az6027_table[] = { |
| 390 | { 0x01, KEY_1 }, | 390 | { 0x01, KEY_1 }, |
| 391 | { 0x02, KEY_2 }, | 391 | { 0x02, KEY_2 }, |
| 392 | }; | 392 | }; |
| @@ -1125,10 +1125,13 @@ static struct dvb_usb_device_properties az6027_properties = { | |||
| 1125 | .power_ctrl = az6027_power_ctrl, | 1125 | .power_ctrl = az6027_power_ctrl, |
| 1126 | .read_mac_address = az6027_read_mac_addr, | 1126 | .read_mac_address = az6027_read_mac_addr, |
| 1127 | */ | 1127 | */ |
| 1128 | .rc_key_map = ir_codes_az6027_table, | 1128 | .rc.legacy = { |
| 1129 | .rc_key_map_size = ARRAY_SIZE(ir_codes_az6027_table), | 1129 | .rc_key_map = ir_codes_az6027_table, |
| 1130 | .rc_interval = 400, | 1130 | .rc_key_map_size = ARRAY_SIZE(ir_codes_az6027_table), |
| 1131 | .rc_query = az6027_rc_query, | 1131 | .rc_interval = 400, |
| 1132 | .rc_query = az6027_rc_query, | ||
| 1133 | }, | ||
| 1134 | |||
| 1132 | .i2c_algo = &az6027_i2c_algo, | 1135 | .i2c_algo = &az6027_i2c_algo, |
| 1133 | 1136 | ||
| 1134 | .num_device_descs = 5, | 1137 | .num_device_descs = 5, |
diff --git a/drivers/media/dvb/dvb-usb/cinergyT2-core.c b/drivers/media/dvb/dvb-usb/cinergyT2-core.c index 5a9c14bdc98..4f5aa83fc1f 100644 --- a/drivers/media/dvb/dvb-usb/cinergyT2-core.c +++ b/drivers/media/dvb/dvb-usb/cinergyT2-core.c | |||
| @@ -84,7 +84,7 @@ static int cinergyt2_frontend_attach(struct dvb_usb_adapter *adap) | |||
| 84 | return 0; | 84 | return 0; |
| 85 | } | 85 | } |
| 86 | 86 | ||
| 87 | static struct dvb_usb_rc_key ir_codes_cinergyt2_table[] = { | 87 | static struct ir_scancode ir_codes_cinergyt2_table[] = { |
| 88 | { 0x0401, KEY_POWER }, | 88 | { 0x0401, KEY_POWER }, |
| 89 | { 0x0402, KEY_1 }, | 89 | { 0x0402, KEY_1 }, |
| 90 | { 0x0403, KEY_2 }, | 90 | { 0x0403, KEY_2 }, |
| @@ -217,10 +217,12 @@ static struct dvb_usb_device_properties cinergyt2_properties = { | |||
| 217 | 217 | ||
| 218 | .power_ctrl = cinergyt2_power_ctrl, | 218 | .power_ctrl = cinergyt2_power_ctrl, |
| 219 | 219 | ||
| 220 | .rc_interval = 50, | 220 | .rc.legacy = { |
| 221 | .rc_key_map = ir_codes_cinergyt2_table, | 221 | .rc_interval = 50, |
| 222 | .rc_key_map_size = ARRAY_SIZE(ir_codes_cinergyt2_table), | 222 | .rc_key_map = ir_codes_cinergyt2_table, |
| 223 | .rc_query = cinergyt2_rc_query, | 223 | .rc_key_map_size = ARRAY_SIZE(ir_codes_cinergyt2_table), |
| 224 | .rc_query = cinergyt2_rc_query, | ||
| 225 | }, | ||
| 224 | 226 | ||
| 225 | .generic_bulk_ctrl_endpoint = 1, | 227 | .generic_bulk_ctrl_endpoint = 1, |
| 226 | 228 | ||
diff --git a/drivers/media/dvb/dvb-usb/cxusb.c b/drivers/media/dvb/dvb-usb/cxusb.c index 11e9e85dac8..cd9f362c37b 100644 --- a/drivers/media/dvb/dvb-usb/cxusb.c +++ b/drivers/media/dvb/dvb-usb/cxusb.c | |||
| @@ -385,7 +385,7 @@ static int cxusb_d680_dmb_streaming_ctrl( | |||
| 385 | 385 | ||
| 386 | static int cxusb_rc_query(struct dvb_usb_device *d, u32 *event, int *state) | 386 | static int cxusb_rc_query(struct dvb_usb_device *d, u32 *event, int *state) |
| 387 | { | 387 | { |
| 388 | struct dvb_usb_rc_key *keymap = d->props.rc_key_map; | 388 | struct ir_scancode *keymap = d->props.rc.legacy.rc_key_map; |
| 389 | u8 ircode[4]; | 389 | u8 ircode[4]; |
| 390 | int i; | 390 | int i; |
| 391 | 391 | ||
| @@ -394,10 +394,10 @@ static int cxusb_rc_query(struct dvb_usb_device *d, u32 *event, int *state) | |||
| 394 | *event = 0; | 394 | *event = 0; |
| 395 | *state = REMOTE_NO_KEY_PRESSED; | 395 | *state = REMOTE_NO_KEY_PRESSED; |
| 396 | 396 | ||
| 397 | for (i = 0; i < d->props.rc_key_map_size; i++) { | 397 | for (i = 0; i < d->props.rc.legacy.rc_key_map_size; i++) { |
| 398 | if (rc5_custom(&keymap[i]) == ircode[2] && | 398 | if (rc5_custom(&keymap[i]) == ircode[2] && |
| 399 | rc5_data(&keymap[i]) == ircode[3]) { | 399 | rc5_data(&keymap[i]) == ircode[3]) { |
| 400 | *event = keymap[i].event; | 400 | *event = keymap[i].keycode; |
| 401 | *state = REMOTE_KEY_PRESSED; | 401 | *state = REMOTE_KEY_PRESSED; |
| 402 | 402 | ||
| 403 | return 0; | 403 | return 0; |
| @@ -410,7 +410,7 @@ static int cxusb_rc_query(struct dvb_usb_device *d, u32 *event, int *state) | |||
| 410 | static int cxusb_bluebird2_rc_query(struct dvb_usb_device *d, u32 *event, | 410 | static int cxusb_bluebird2_rc_query(struct dvb_usb_device *d, u32 *event, |
| 411 | int *state) | 411 | int *state) |
| 412 | { | 412 | { |
| 413 | struct dvb_usb_rc_key *keymap = d->props.rc_key_map; | 413 | struct ir_scancode *keymap = d->props.rc.legacy.rc_key_map; |
| 414 | u8 ircode[4]; | 414 | u8 ircode[4]; |
| 415 | int i; | 415 | int i; |
| 416 | struct i2c_msg msg = { .addr = 0x6b, .flags = I2C_M_RD, | 416 | struct i2c_msg msg = { .addr = 0x6b, .flags = I2C_M_RD, |
| @@ -422,10 +422,10 @@ static int cxusb_bluebird2_rc_query(struct dvb_usb_device *d, u32 *event, | |||
| 422 | if (cxusb_i2c_xfer(&d->i2c_adap, &msg, 1) != 1) | 422 | if (cxusb_i2c_xfer(&d->i2c_adap, &msg, 1) != 1) |
| 423 | return 0; | 423 | return 0; |
| 424 | 424 | ||
| 425 | for (i = 0; i < d->props.rc_key_map_size; i++) { | 425 | for (i = 0; i < d->props.rc.legacy.rc_key_map_size; i++) { |
| 426 | if (rc5_custom(&keymap[i]) == ircode[1] && | 426 | if (rc5_custom(&keymap[i]) == ircode[1] && |
| 427 | rc5_data(&keymap[i]) == ircode[2]) { | 427 | rc5_data(&keymap[i]) == ircode[2]) { |
| 428 | *event = keymap[i].event; | 428 | *event = keymap[i].keycode; |
| 429 | *state = REMOTE_KEY_PRESSED; | 429 | *state = REMOTE_KEY_PRESSED; |
| 430 | 430 | ||
| 431 | return 0; | 431 | return 0; |
| @@ -438,7 +438,7 @@ static int cxusb_bluebird2_rc_query(struct dvb_usb_device *d, u32 *event, | |||
| 438 | static int cxusb_d680_dmb_rc_query(struct dvb_usb_device *d, u32 *event, | 438 | static int cxusb_d680_dmb_rc_query(struct dvb_usb_device *d, u32 *event, |
| 439 | int *state) | 439 | int *state) |
| 440 | { | 440 | { |
| 441 | struct dvb_usb_rc_key *keymap = d->props.rc_key_map; | 441 | struct ir_scancode *keymap = d->props.rc.legacy.rc_key_map; |
| 442 | u8 ircode[2]; | 442 | u8 ircode[2]; |
| 443 | int i; | 443 | int i; |
| 444 | 444 | ||
| @@ -448,10 +448,10 @@ static int cxusb_d680_dmb_rc_query(struct dvb_usb_device *d, u32 *event, | |||
| 448 | if (cxusb_ctrl_msg(d, 0x10, NULL, 0, ircode, 2) < 0) | 448 | if (cxusb_ctrl_msg(d, 0x10, NULL, 0, ircode, 2) < 0) |
| 449 | return 0; | 449 | return 0; |
| 450 | 450 | ||
| 451 | for (i = 0; i < d->props.rc_key_map_size; i++) { | 451 | for (i = 0; i < d->props.rc.legacy.rc_key_map_size; i++) { |
| 452 | if (rc5_custom(&keymap[i]) == ircode[0] && | 452 | if (rc5_custom(&keymap[i]) == ircode[0] && |
| 453 | rc5_data(&keymap[i]) == ircode[1]) { | 453 | rc5_data(&keymap[i]) == ircode[1]) { |
| 454 | *event = keymap[i].event; | 454 | *event = keymap[i].keycode; |
| 455 | *state = REMOTE_KEY_PRESSED; | 455 | *state = REMOTE_KEY_PRESSED; |
| 456 | 456 | ||
| 457 | return 0; | 457 | return 0; |
| @@ -461,7 +461,7 @@ static int cxusb_d680_dmb_rc_query(struct dvb_usb_device *d, u32 *event, | |||
| 461 | return 0; | 461 | return 0; |
| 462 | } | 462 | } |
| 463 | 463 | ||
| 464 | static struct dvb_usb_rc_key ir_codes_dvico_mce_table[] = { | 464 | static struct ir_scancode ir_codes_dvico_mce_table[] = { |
| 465 | { 0xfe02, KEY_TV }, | 465 | { 0xfe02, KEY_TV }, |
| 466 | { 0xfe0e, KEY_MP3 }, | 466 | { 0xfe0e, KEY_MP3 }, |
| 467 | { 0xfe1a, KEY_DVD }, | 467 | { 0xfe1a, KEY_DVD }, |
| @@ -509,7 +509,7 @@ static struct dvb_usb_rc_key ir_codes_dvico_mce_table[] = { | |||
| 509 | { 0xfe4e, KEY_POWER }, | 509 | { 0xfe4e, KEY_POWER }, |
| 510 | }; | 510 | }; |
| 511 | 511 | ||
| 512 | static struct dvb_usb_rc_key ir_codes_dvico_portable_table[] = { | 512 | static struct ir_scancode ir_codes_dvico_portable_table[] = { |
| 513 | { 0xfc02, KEY_SETUP }, /* Profile */ | 513 | { 0xfc02, KEY_SETUP }, /* Profile */ |
| 514 | { 0xfc43, KEY_POWER2 }, | 514 | { 0xfc43, KEY_POWER2 }, |
| 515 | { 0xfc06, KEY_EPG }, | 515 | { 0xfc06, KEY_EPG }, |
| @@ -548,7 +548,7 @@ static struct dvb_usb_rc_key ir_codes_dvico_portable_table[] = { | |||
| 548 | { 0xfc00, KEY_UNKNOWN }, /* HD */ | 548 | { 0xfc00, KEY_UNKNOWN }, /* HD */ |
| 549 | }; | 549 | }; |
| 550 | 550 | ||
| 551 | static struct dvb_usb_rc_key ir_codes_d680_dmb_table[] = { | 551 | static struct ir_scancode ir_codes_d680_dmb_table[] = { |
| 552 | { 0x0038, KEY_UNKNOWN }, /* TV/AV */ | 552 | { 0x0038, KEY_UNKNOWN }, /* TV/AV */ |
| 553 | { 0x080c, KEY_ZOOM }, | 553 | { 0x080c, KEY_ZOOM }, |
| 554 | { 0x0800, KEY_0 }, | 554 | { 0x0800, KEY_0 }, |
| @@ -923,7 +923,7 @@ static int cxusb_dualdig4_frontend_attach(struct dvb_usb_adapter *adap) | |||
| 923 | return -EIO; | 923 | return -EIO; |
| 924 | 924 | ||
| 925 | /* try to determine if there is no IR decoder on the I2C bus */ | 925 | /* try to determine if there is no IR decoder on the I2C bus */ |
| 926 | for (i = 0; adap->dev->props.rc_key_map != NULL && i < 5; i++) { | 926 | for (i = 0; adap->dev->props.rc.legacy.rc_key_map != NULL && i < 5; i++) { |
| 927 | msleep(20); | 927 | msleep(20); |
| 928 | if (cxusb_i2c_xfer(&adap->dev->i2c_adap, &msg, 1) != 1) | 928 | if (cxusb_i2c_xfer(&adap->dev->i2c_adap, &msg, 1) != 1) |
| 929 | goto no_IR; | 929 | goto no_IR; |
| @@ -931,7 +931,7 @@ static int cxusb_dualdig4_frontend_attach(struct dvb_usb_adapter *adap) | |||
| 931 | continue; | 931 | continue; |
| 932 | if (ircode[2] + ircode[3] != 0xff) { | 932 | if (ircode[2] + ircode[3] != 0xff) { |
| 933 | no_IR: | 933 | no_IR: |
| 934 | adap->dev->props.rc_key_map = NULL; | 934 | adap->dev->props.rc.legacy.rc_key_map = NULL; |
| 935 | info("No IR receiver detected on this device."); | 935 | info("No IR receiver detected on this device."); |
| 936 | break; | 936 | break; |
| 937 | } | 937 | } |
| @@ -1451,10 +1451,12 @@ static struct dvb_usb_device_properties cxusb_bluebird_lgh064f_properties = { | |||
| 1451 | 1451 | ||
| 1452 | .i2c_algo = &cxusb_i2c_algo, | 1452 | .i2c_algo = &cxusb_i2c_algo, |
| 1453 | 1453 | ||
| 1454 | .rc_interval = 100, | 1454 | .rc.legacy = { |
| 1455 | .rc_key_map = ir_codes_dvico_portable_table, | 1455 | .rc_interval = 100, |
| 1456 | .rc_key_map_size = ARRAY_SIZE(ir_codes_dvico_portable_table), | 1456 | .rc_key_map = ir_codes_dvico_portable_table, |
| 1457 | .rc_query = cxusb_rc_query, | 1457 | .rc_key_map_size = ARRAY_SIZE(ir_codes_dvico_portable_table), |
| 1458 | .rc_query = cxusb_rc_query, | ||
| 1459 | }, | ||
| 1458 | 1460 | ||
| 1459 | .generic_bulk_ctrl_endpoint = 0x01, | 1461 | .generic_bulk_ctrl_endpoint = 0x01, |
| 1460 | 1462 | ||
| @@ -1502,10 +1504,12 @@ static struct dvb_usb_device_properties cxusb_bluebird_dee1601_properties = { | |||
| 1502 | 1504 | ||
| 1503 | .i2c_algo = &cxusb_i2c_algo, | 1505 | .i2c_algo = &cxusb_i2c_algo, |
| 1504 | 1506 | ||
| 1505 | .rc_interval = 150, | 1507 | .rc.legacy = { |
| 1506 | .rc_key_map = ir_codes_dvico_mce_table, | 1508 | .rc_interval = 150, |
| 1507 | .rc_key_map_size = ARRAY_SIZE(ir_codes_dvico_mce_table), | 1509 | .rc_key_map = ir_codes_dvico_mce_table, |
| 1508 | .rc_query = cxusb_rc_query, | 1510 | .rc_key_map_size = ARRAY_SIZE(ir_codes_dvico_mce_table), |
| 1511 | .rc_query = cxusb_rc_query, | ||
| 1512 | }, | ||
| 1509 | 1513 | ||
| 1510 | .generic_bulk_ctrl_endpoint = 0x01, | 1514 | .generic_bulk_ctrl_endpoint = 0x01, |
| 1511 | 1515 | ||
| @@ -1561,10 +1565,12 @@ static struct dvb_usb_device_properties cxusb_bluebird_lgz201_properties = { | |||
| 1561 | 1565 | ||
| 1562 | .i2c_algo = &cxusb_i2c_algo, | 1566 | .i2c_algo = &cxusb_i2c_algo, |
| 1563 | 1567 | ||
| 1564 | .rc_interval = 100, | 1568 | .rc.legacy = { |
| 1565 | .rc_key_map = ir_codes_dvico_portable_table, | 1569 | .rc_interval = 100, |
| 1566 | .rc_key_map_size = ARRAY_SIZE(ir_codes_dvico_portable_table), | 1570 | .rc_key_map = ir_codes_dvico_portable_table, |
| 1567 | .rc_query = cxusb_rc_query, | 1571 | .rc_key_map_size = ARRAY_SIZE(ir_codes_dvico_portable_table), |
| 1572 | .rc_query = cxusb_rc_query, | ||
| 1573 | }, | ||
| 1568 | 1574 | ||
| 1569 | .generic_bulk_ctrl_endpoint = 0x01, | 1575 | .generic_bulk_ctrl_endpoint = 0x01, |
| 1570 | .num_device_descs = 1, | 1576 | .num_device_descs = 1, |
| @@ -1611,10 +1617,12 @@ static struct dvb_usb_device_properties cxusb_bluebird_dtt7579_properties = { | |||
| 1611 | 1617 | ||
| 1612 | .i2c_algo = &cxusb_i2c_algo, | 1618 | .i2c_algo = &cxusb_i2c_algo, |
| 1613 | 1619 | ||
| 1614 | .rc_interval = 100, | 1620 | .rc.legacy = { |
| 1615 | .rc_key_map = ir_codes_dvico_portable_table, | 1621 | .rc_interval = 100, |
| 1616 | .rc_key_map_size = ARRAY_SIZE(ir_codes_dvico_portable_table), | 1622 | .rc_key_map = ir_codes_dvico_portable_table, |
| 1617 | .rc_query = cxusb_rc_query, | 1623 | .rc_key_map_size = ARRAY_SIZE(ir_codes_dvico_portable_table), |
| 1624 | .rc_query = cxusb_rc_query, | ||
| 1625 | }, | ||
| 1618 | 1626 | ||
| 1619 | .generic_bulk_ctrl_endpoint = 0x01, | 1627 | .generic_bulk_ctrl_endpoint = 0x01, |
| 1620 | 1628 | ||
| @@ -1660,10 +1668,12 @@ static struct dvb_usb_device_properties cxusb_bluebird_dualdig4_properties = { | |||
| 1660 | 1668 | ||
| 1661 | .generic_bulk_ctrl_endpoint = 0x01, | 1669 | .generic_bulk_ctrl_endpoint = 0x01, |
| 1662 | 1670 | ||
| 1663 | .rc_interval = 100, | 1671 | .rc.legacy = { |
| 1664 | .rc_key_map = ir_codes_dvico_mce_table, | 1672 | .rc_interval = 100, |
| 1665 | .rc_key_map_size = ARRAY_SIZE(ir_codes_dvico_mce_table), | 1673 | .rc_key_map = ir_codes_dvico_mce_table, |
| 1666 | .rc_query = cxusb_bluebird2_rc_query, | 1674 | .rc_key_map_size = ARRAY_SIZE(ir_codes_dvico_mce_table), |
| 1675 | .rc_query = cxusb_bluebird2_rc_query, | ||
| 1676 | }, | ||
| 1667 | 1677 | ||
| 1668 | .num_device_descs = 1, | 1678 | .num_device_descs = 1, |
| 1669 | .devices = { | 1679 | .devices = { |
| @@ -1708,10 +1718,12 @@ static struct dvb_usb_device_properties cxusb_bluebird_nano2_properties = { | |||
| 1708 | 1718 | ||
| 1709 | .generic_bulk_ctrl_endpoint = 0x01, | 1719 | .generic_bulk_ctrl_endpoint = 0x01, |
| 1710 | 1720 | ||
| 1711 | .rc_interval = 100, | 1721 | .rc.legacy = { |
| 1712 | .rc_key_map = ir_codes_dvico_portable_table, | 1722 | .rc_interval = 100, |
| 1713 | .rc_key_map_size = ARRAY_SIZE(ir_codes_dvico_portable_table), | 1723 | .rc_key_map = ir_codes_dvico_portable_table, |
| 1714 | .rc_query = cxusb_bluebird2_rc_query, | 1724 | .rc_key_map_size = ARRAY_SIZE(ir_codes_dvico_portable_table), |
| 1725 | .rc_query = cxusb_bluebird2_rc_query, | ||
| 1726 | }, | ||
| 1715 | 1727 | ||
| 1716 | .num_device_descs = 1, | 1728 | .num_device_descs = 1, |
| 1717 | .devices = { | 1729 | .devices = { |
| @@ -1758,10 +1770,12 @@ static struct dvb_usb_device_properties cxusb_bluebird_nano2_needsfirmware_prope | |||
| 1758 | 1770 | ||
| 1759 | .generic_bulk_ctrl_endpoint = 0x01, | 1771 | .generic_bulk_ctrl_endpoint = 0x01, |
| 1760 | 1772 | ||
| 1761 | .rc_interval = 100, | 1773 | .rc.legacy = { |
| 1762 | .rc_key_map = ir_codes_dvico_portable_table, | 1774 | .rc_interval = 100, |
| 1763 | .rc_key_map_size = ARRAY_SIZE(ir_codes_dvico_portable_table), | 1775 | .rc_key_map = ir_codes_dvico_portable_table, |
| 1764 | .rc_query = cxusb_rc_query, | 1776 | .rc_key_map_size = ARRAY_SIZE(ir_codes_dvico_portable_table), |
| 1777 | .rc_query = cxusb_rc_query, | ||
| 1778 | }, | ||
| 1765 | 1779 | ||
| 1766 | .num_device_descs = 1, | 1780 | .num_device_descs = 1, |
| 1767 | .devices = { | 1781 | .devices = { |
| @@ -1849,10 +1863,12 @@ struct dvb_usb_device_properties cxusb_bluebird_dualdig4_rev2_properties = { | |||
| 1849 | 1863 | ||
| 1850 | .generic_bulk_ctrl_endpoint = 0x01, | 1864 | .generic_bulk_ctrl_endpoint = 0x01, |
| 1851 | 1865 | ||
| 1852 | .rc_interval = 100, | 1866 | .rc.legacy = { |
| 1853 | .rc_key_map = ir_codes_dvico_mce_table, | 1867 | .rc_interval = 100, |
| 1854 | .rc_key_map_size = ARRAY_SIZE(ir_codes_dvico_mce_table), | 1868 | .rc_key_map = ir_codes_dvico_mce_table, |
| 1855 | .rc_query = cxusb_rc_query, | 1869 | .rc_key_map_size = ARRAY_SIZE(ir_codes_dvico_mce_table), |
| 1870 | .rc_query = cxusb_rc_query, | ||
| 1871 | }, | ||
| 1856 | 1872 | ||
| 1857 | .num_device_descs = 1, | 1873 | .num_device_descs = 1, |
| 1858 | .devices = { | 1874 | .devices = { |
| @@ -1897,10 +1913,12 @@ static struct dvb_usb_device_properties cxusb_d680_dmb_properties = { | |||
| 1897 | 1913 | ||
| 1898 | .generic_bulk_ctrl_endpoint = 0x01, | 1914 | .generic_bulk_ctrl_endpoint = 0x01, |
| 1899 | 1915 | ||
| 1900 | .rc_interval = 100, | 1916 | .rc.legacy = { |
| 1901 | .rc_key_map = ir_codes_d680_dmb_table, | 1917 | .rc_interval = 100, |
| 1902 | .rc_key_map_size = ARRAY_SIZE(ir_codes_d680_dmb_table), | 1918 | .rc_key_map = ir_codes_d680_dmb_table, |
| 1903 | .rc_query = cxusb_d680_dmb_rc_query, | 1919 | .rc_key_map_size = ARRAY_SIZE(ir_codes_d680_dmb_table), |
| 1920 | .rc_query = cxusb_d680_dmb_rc_query, | ||
| 1921 | }, | ||
| 1904 | 1922 | ||
| 1905 | .num_device_descs = 1, | 1923 | .num_device_descs = 1, |
| 1906 | .devices = { | 1924 | .devices = { |
| @@ -1946,10 +1964,12 @@ static struct dvb_usb_device_properties cxusb_mygica_d689_properties = { | |||
| 1946 | 1964 | ||
| 1947 | .generic_bulk_ctrl_endpoint = 0x01, | 1965 | .generic_bulk_ctrl_endpoint = 0x01, |
| 1948 | 1966 | ||
| 1949 | .rc_interval = 100, | 1967 | .rc.legacy = { |
| 1950 | .rc_key_map = ir_codes_d680_dmb_table, | 1968 | .rc_interval = 100, |
| 1951 | .rc_key_map_size = ARRAY_SIZE(ir_codes_d680_dmb_table), | 1969 | .rc_key_map = ir_codes_d680_dmb_table, |
| 1952 | .rc_query = cxusb_d680_dmb_rc_query, | 1970 | .rc_key_map_size = ARRAY_SIZE(ir_codes_d680_dmb_table), |
| 1971 | .rc_query = cxusb_d680_dmb_rc_query, | ||
| 1972 | }, | ||
| 1953 | 1973 | ||
| 1954 | .num_device_descs = 1, | 1974 | .num_device_descs = 1, |
| 1955 | .devices = { | 1975 | .devices = { |
diff --git a/drivers/media/dvb/dvb-usb/dib0700.h b/drivers/media/dvb/dvb-usb/dib0700.h index 83fc24a6c31..c2c9d236ec7 100644 --- a/drivers/media/dvb/dvb-usb/dib0700.h +++ b/drivers/media/dvb/dvb-usb/dib0700.h | |||
| @@ -60,6 +60,7 @@ extern int dib0700_streaming_ctrl(struct dvb_usb_adapter *adap, int onoff); | |||
| 60 | extern struct i2c_algorithm dib0700_i2c_algo; | 60 | extern struct i2c_algorithm dib0700_i2c_algo; |
| 61 | extern int dib0700_identify_state(struct usb_device *udev, struct dvb_usb_device_properties *props, | 61 | extern int dib0700_identify_state(struct usb_device *udev, struct dvb_usb_device_properties *props, |
| 62 | struct dvb_usb_device_description **desc, int *cold); | 62 | struct dvb_usb_device_description **desc, int *cold); |
| 63 | extern int dib0700_change_protocol(void *priv, u64 ir_type); | ||
| 63 | 64 | ||
| 64 | extern int dib0700_device_count; | 65 | extern int dib0700_device_count; |
| 65 | extern int dvb_usb_dib0700_ir_proto; | 66 | extern int dvb_usb_dib0700_ir_proto; |
diff --git a/drivers/media/dvb/dvb-usb/dib0700_core.c b/drivers/media/dvb/dvb-usb/dib0700_core.c index 4f961d2d181..fe818348b8a 100644 --- a/drivers/media/dvb/dvb-usb/dib0700_core.c +++ b/drivers/media/dvb/dvb-usb/dib0700_core.c | |||
| @@ -13,10 +13,6 @@ int dvb_usb_dib0700_debug; | |||
| 13 | module_param_named(debug,dvb_usb_dib0700_debug, int, 0644); | 13 | module_param_named(debug,dvb_usb_dib0700_debug, int, 0644); |
| 14 | MODULE_PARM_DESC(debug, "set debugging level (1=info,2=fw,4=fwdata,8=data (or-able))." DVB_USB_DEBUG_STATUS); | 14 | MODULE_PARM_DESC(debug, "set debugging level (1=info,2=fw,4=fwdata,8=data (or-able))." DVB_USB_DEBUG_STATUS); |
| 15 | 15 | ||
| 16 | int dvb_usb_dib0700_ir_proto = 1; | ||
| 17 | module_param(dvb_usb_dib0700_ir_proto, int, 0644); | ||
| 18 | MODULE_PARM_DESC(dvb_usb_dib0700_ir_proto, "set ir protocol (0=NEC, 1=RC5 (default), 2=RC6)."); | ||
| 19 | |||
| 20 | static int nb_packet_buffer_size = 21; | 16 | static int nb_packet_buffer_size = 21; |
| 21 | module_param(nb_packet_buffer_size, int, 0644); | 17 | module_param(nb_packet_buffer_size, int, 0644); |
| 22 | MODULE_PARM_DESC(nb_packet_buffer_size, | 18 | MODULE_PARM_DESC(nb_packet_buffer_size, |
| @@ -53,7 +49,7 @@ static int dib0700_ctrl_wr(struct dvb_usb_device *d, u8 *tx, u8 txlen) | |||
| 53 | int status; | 49 | int status; |
| 54 | 50 | ||
| 55 | deb_data(">>> "); | 51 | deb_data(">>> "); |
| 56 | debug_dump(tx,txlen,deb_data); | 52 | debug_dump(tx, txlen, deb_data); |
| 57 | 53 | ||
| 58 | status = usb_control_msg(d->udev, usb_sndctrlpipe(d->udev,0), | 54 | status = usb_control_msg(d->udev, usb_sndctrlpipe(d->udev,0), |
| 59 | tx[0], USB_TYPE_VENDOR | USB_DIR_OUT, 0, 0, tx, txlen, | 55 | tx[0], USB_TYPE_VENDOR | USB_DIR_OUT, 0, 0, tx, txlen, |
| @@ -98,7 +94,7 @@ int dib0700_ctrl_rd(struct dvb_usb_device *d, u8 *tx, u8 txlen, u8 *rx, u8 rxlen | |||
| 98 | deb_info("ep 0 read error (status = %d)\n",status); | 94 | deb_info("ep 0 read error (status = %d)\n",status); |
| 99 | 95 | ||
| 100 | deb_data("<<< "); | 96 | deb_data("<<< "); |
| 101 | debug_dump(rx,rxlen,deb_data); | 97 | debug_dump(rx, rxlen, deb_data); |
| 102 | 98 | ||
| 103 | return status; /* length in case of success */ | 99 | return status; /* length in case of success */ |
| 104 | } | 100 | } |
| @@ -106,28 +102,29 @@ int dib0700_ctrl_rd(struct dvb_usb_device *d, u8 *tx, u8 txlen, u8 *rx, u8 rxlen | |||
| 106 | int dib0700_set_gpio(struct dvb_usb_device *d, enum dib07x0_gpios gpio, u8 gpio_dir, u8 gpio_val) | 102 | int dib0700_set_gpio(struct dvb_usb_device *d, enum dib07x0_gpios gpio, u8 gpio_dir, u8 gpio_val) |
| 107 | { | 103 | { |
| 108 | u8 buf[3] = { REQUEST_SET_GPIO, gpio, ((gpio_dir & 0x01) << 7) | ((gpio_val & 0x01) << 6) }; | 104 | u8 buf[3] = { REQUEST_SET_GPIO, gpio, ((gpio_dir & 0x01) << 7) | ((gpio_val & 0x01) << 6) }; |
| 109 | return dib0700_ctrl_wr(d,buf,3); | 105 | return dib0700_ctrl_wr(d, buf, sizeof(buf)); |
| 110 | } | 106 | } |
| 111 | 107 | ||
| 112 | static int dib0700_set_usb_xfer_len(struct dvb_usb_device *d, u16 nb_ts_packets) | 108 | static int dib0700_set_usb_xfer_len(struct dvb_usb_device *d, u16 nb_ts_packets) |
| 113 | { | 109 | { |
| 114 | struct dib0700_state *st = d->priv; | 110 | struct dib0700_state *st = d->priv; |
| 115 | u8 b[3]; | 111 | u8 b[3]; |
| 116 | int ret; | 112 | int ret; |
| 117 | 113 | ||
| 118 | if (st->fw_version >= 0x10201) { | 114 | if (st->fw_version >= 0x10201) { |
| 119 | b[0] = REQUEST_SET_USB_XFER_LEN; | 115 | b[0] = REQUEST_SET_USB_XFER_LEN; |
| 120 | b[1] = (nb_ts_packets >> 8)&0xff; | 116 | b[1] = (nb_ts_packets >> 8) & 0xff; |
| 121 | b[2] = nb_ts_packets & 0xff; | 117 | b[2] = nb_ts_packets & 0xff; |
| 122 | 118 | ||
| 123 | deb_info("set the USB xfer len to %i Ts packet\n", nb_ts_packets); | 119 | deb_info("set the USB xfer len to %i Ts packet\n", nb_ts_packets); |
| 124 | 120 | ||
| 125 | ret = dib0700_ctrl_wr(d, b, 3); | 121 | ret = dib0700_ctrl_wr(d, b, sizeof(b)); |
| 126 | } else { | 122 | } else { |
| 127 | deb_info("this firmware does not allow to change the USB xfer len\n"); | 123 | deb_info("this firmware does not allow to change the USB xfer len\n"); |
| 128 | ret = -EIO; | 124 | ret = -EIO; |
| 129 | } | 125 | } |
| 130 | return ret; | 126 | |
| 127 | return ret; | ||
| 131 | } | 128 | } |
| 132 | 129 | ||
| 133 | /* | 130 | /* |
| @@ -178,7 +175,8 @@ static int dib0700_i2c_xfer_new(struct i2c_adapter *adap, struct i2c_msg *msg, | |||
| 178 | value = ((en_start << 7) | (en_stop << 6) | | 175 | value = ((en_start << 7) | (en_stop << 6) | |
| 179 | (msg[i].len & 0x3F)) << 8 | i2c_dest; | 176 | (msg[i].len & 0x3F)) << 8 | i2c_dest; |
| 180 | /* I2C ctrl + FE bus; */ | 177 | /* I2C ctrl + FE bus; */ |
| 181 | index = ((gen_mode<<6)&0xC0) | ((bus_mode<<4)&0x30); | 178 | index = ((gen_mode << 6) & 0xC0) | |
| 179 | ((bus_mode << 4) & 0x30); | ||
| 182 | 180 | ||
| 183 | result = usb_control_msg(d->udev, | 181 | result = usb_control_msg(d->udev, |
| 184 | usb_rcvctrlpipe(d->udev, 0), | 182 | usb_rcvctrlpipe(d->udev, 0), |
| @@ -198,11 +196,12 @@ static int dib0700_i2c_xfer_new(struct i2c_adapter *adap, struct i2c_msg *msg, | |||
| 198 | } else { | 196 | } else { |
| 199 | /* Write request */ | 197 | /* Write request */ |
| 200 | buf[0] = REQUEST_NEW_I2C_WRITE; | 198 | buf[0] = REQUEST_NEW_I2C_WRITE; |
| 201 | buf[1] = (msg[i].addr << 1); | 199 | buf[1] = msg[i].addr << 1; |
| 202 | buf[2] = (en_start << 7) | (en_stop << 6) | | 200 | buf[2] = (en_start << 7) | (en_stop << 6) | |
| 203 | (msg[i].len & 0x3F); | 201 | (msg[i].len & 0x3F); |
| 204 | /* I2C ctrl + FE bus; */ | 202 | /* I2C ctrl + FE bus; */ |
| 205 | buf[3] = ((gen_mode<<6)&0xC0) | ((bus_mode<<4)&0x30); | 203 | buf[3] = ((gen_mode << 6) & 0xC0) | |
| 204 | ((bus_mode << 4) & 0x30); | ||
| 206 | /* The Actual i2c payload */ | 205 | /* The Actual i2c payload */ |
| 207 | memcpy(&buf[4], msg[i].buf, msg[i].len); | 206 | memcpy(&buf[4], msg[i].buf, msg[i].len); |
| 208 | 207 | ||
| @@ -240,7 +239,7 @@ static int dib0700_i2c_xfer_legacy(struct i2c_adapter *adap, | |||
| 240 | 239 | ||
| 241 | for (i = 0; i < num; i++) { | 240 | for (i = 0; i < num; i++) { |
| 242 | /* fill in the address */ | 241 | /* fill in the address */ |
| 243 | buf[1] = (msg[i].addr << 1); | 242 | buf[1] = msg[i].addr << 1; |
| 244 | /* fill the buffer */ | 243 | /* fill the buffer */ |
| 245 | memcpy(&buf[2], msg[i].buf, msg[i].len); | 244 | memcpy(&buf[2], msg[i].buf, msg[i].len); |
| 246 | 245 | ||
| @@ -368,7 +367,8 @@ int dib0700_download_firmware(struct usb_device *udev, const struct firmware *fw | |||
| 368 | u8 buf[260]; | 367 | u8 buf[260]; |
| 369 | 368 | ||
| 370 | while ((ret = dvb_usb_get_hexline(fw, &hx, &pos)) > 0) { | 369 | while ((ret = dvb_usb_get_hexline(fw, &hx, &pos)) > 0) { |
| 371 | deb_fwdata("writing to address 0x%08x (buffer: 0x%02x %02x)\n",hx.addr, hx.len, hx.chk); | 370 | deb_fwdata("writing to address 0x%08x (buffer: 0x%02x %02x)\n", |
| 371 | hx.addr, hx.len, hx.chk); | ||
| 372 | 372 | ||
| 373 | buf[0] = hx.len; | 373 | buf[0] = hx.len; |
| 374 | buf[1] = (hx.addr >> 8) & 0xff; | 374 | buf[1] = (hx.addr >> 8) & 0xff; |
| @@ -408,16 +408,16 @@ int dib0700_download_firmware(struct usb_device *udev, const struct firmware *fw | |||
| 408 | REQUEST_GET_VERSION, | 408 | REQUEST_GET_VERSION, |
| 409 | USB_TYPE_VENDOR | USB_DIR_IN, 0, 0, | 409 | USB_TYPE_VENDOR | USB_DIR_IN, 0, 0, |
| 410 | b, sizeof(b), USB_CTRL_GET_TIMEOUT); | 410 | b, sizeof(b), USB_CTRL_GET_TIMEOUT); |
| 411 | fw_version = (b[8] << 24) | (b[9] << 16) | (b[10] << 8) | b[11]; | 411 | fw_version = (b[8] << 24) | (b[9] << 16) | (b[10] << 8) | b[11]; |
| 412 | 412 | ||
| 413 | /* set the buffer size - DVB-USB is allocating URB buffers | 413 | /* set the buffer size - DVB-USB is allocating URB buffers |
| 414 | * only after the firwmare download was successful */ | 414 | * only after the firwmare download was successful */ |
| 415 | for (i = 0; i < dib0700_device_count; i++) { | 415 | for (i = 0; i < dib0700_device_count; i++) { |
| 416 | for (adap_num = 0; adap_num < dib0700_devices[i].num_adapters; | 416 | for (adap_num = 0; adap_num < dib0700_devices[i].num_adapters; |
| 417 | adap_num++) { | 417 | adap_num++) { |
| 418 | if (fw_version >= 0x10201) | 418 | if (fw_version >= 0x10201) { |
| 419 | dib0700_devices[i].adapter[adap_num].stream.u.bulk.buffersize = 188*nb_packet_buffer_size; | 419 | dib0700_devices[i].adapter[adap_num].stream.u.bulk.buffersize = 188*nb_packet_buffer_size; |
| 420 | else { | 420 | } else { |
| 421 | /* for fw version older than 1.20.1, | 421 | /* for fw version older than 1.20.1, |
| 422 | * the buffersize has to be n times 512 */ | 422 | * the buffersize has to be n times 512 */ |
| 423 | dib0700_devices[i].adapter[adap_num].stream.u.bulk.buffersize = ((188*nb_packet_buffer_size+188/2)/512)*512; | 423 | dib0700_devices[i].adapter[adap_num].stream.u.bulk.buffersize = ((188*nb_packet_buffer_size+188/2)/512)*512; |
| @@ -453,7 +453,7 @@ int dib0700_streaming_ctrl(struct dvb_usb_adapter *adap, int onoff) | |||
| 453 | if (st->disable_streaming_master_mode == 1) | 453 | if (st->disable_streaming_master_mode == 1) |
| 454 | b[2] = 0x00; | 454 | b[2] = 0x00; |
| 455 | else | 455 | else |
| 456 | b[2] = (0x01 << 4); /* Master mode */ | 456 | b[2] = 0x01 << 4; /* Master mode */ |
| 457 | 457 | ||
| 458 | b[3] = 0x00; | 458 | b[3] = 0x00; |
| 459 | 459 | ||
| @@ -466,11 +466,44 @@ int dib0700_streaming_ctrl(struct dvb_usb_adapter *adap, int onoff) | |||
| 466 | 466 | ||
| 467 | b[2] |= st->channel_state; | 467 | b[2] |= st->channel_state; |
| 468 | 468 | ||
| 469 | deb_info("data for streaming: %x %x\n",b[1],b[2]); | 469 | deb_info("data for streaming: %x %x\n", b[1], b[2]); |
| 470 | 470 | ||
| 471 | return dib0700_ctrl_wr(adap->dev, b, 4); | 471 | return dib0700_ctrl_wr(adap->dev, b, 4); |
| 472 | } | 472 | } |
| 473 | 473 | ||
| 474 | int dib0700_change_protocol(void *priv, u64 ir_type) | ||
| 475 | { | ||
| 476 | struct dvb_usb_device *d = priv; | ||
| 477 | struct dib0700_state *st = d->priv; | ||
| 478 | u8 rc_setup[3] = { REQUEST_SET_RC, 0, 0 }; | ||
| 479 | int new_proto, ret; | ||
| 480 | |||
| 481 | /* Set the IR mode */ | ||
| 482 | if (ir_type == IR_TYPE_RC5) | ||
| 483 | new_proto = 1; | ||
| 484 | else if (ir_type == IR_TYPE_NEC) | ||
| 485 | new_proto = 0; | ||
| 486 | else if (ir_type == IR_TYPE_RC6) { | ||
| 487 | if (st->fw_version < 0x10200) | ||
| 488 | return -EINVAL; | ||
| 489 | |||
| 490 | new_proto = 2; | ||
| 491 | } else | ||
| 492 | return -EINVAL; | ||
| 493 | |||
| 494 | rc_setup[1] = new_proto; | ||
| 495 | |||
| 496 | ret = dib0700_ctrl_wr(d, rc_setup, sizeof(rc_setup)); | ||
| 497 | if (ret < 0) { | ||
| 498 | err("ir protocol setup failed"); | ||
| 499 | return ret; | ||
| 500 | } | ||
| 501 | |||
| 502 | d->props.rc.core.protocol = ir_type; | ||
| 503 | |||
| 504 | return ret; | ||
| 505 | } | ||
| 506 | |||
| 474 | /* Number of keypresses to ignore before start repeating */ | 507 | /* Number of keypresses to ignore before start repeating */ |
| 475 | #define RC_REPEAT_DELAY_V1_20 10 | 508 | #define RC_REPEAT_DELAY_V1_20 10 |
| 476 | 509 | ||
| @@ -478,7 +511,13 @@ int dib0700_streaming_ctrl(struct dvb_usb_adapter *adap, int onoff) | |||
| 478 | struct dib0700_rc_response { | 511 | struct dib0700_rc_response { |
| 479 | u8 report_id; | 512 | u8 report_id; |
| 480 | u8 data_state; | 513 | u8 data_state; |
| 481 | u16 system; | 514 | union { |
| 515 | u16 system16; | ||
| 516 | struct { | ||
| 517 | u8 system; | ||
| 518 | u8 not_system; | ||
| 519 | }; | ||
| 520 | }; | ||
| 482 | u8 data; | 521 | u8 data; |
| 483 | u8 not_data; | 522 | u8 not_data; |
| 484 | }; | 523 | }; |
| @@ -487,14 +526,10 @@ struct dib0700_rc_response { | |||
| 487 | static void dib0700_rc_urb_completion(struct urb *purb) | 526 | static void dib0700_rc_urb_completion(struct urb *purb) |
| 488 | { | 527 | { |
| 489 | struct dvb_usb_device *d = purb->context; | 528 | struct dvb_usb_device *d = purb->context; |
| 490 | struct dvb_usb_rc_key *keymap; | ||
| 491 | struct dib0700_state *st; | 529 | struct dib0700_state *st; |
| 492 | struct dib0700_rc_response poll_reply; | 530 | struct dib0700_rc_response *poll_reply; |
| 493 | u8 *buf; | 531 | u32 uninitialized_var(keycode); |
| 494 | int found = 0; | 532 | u8 toggle; |
| 495 | u32 event; | ||
| 496 | int state; | ||
| 497 | int i; | ||
| 498 | 533 | ||
| 499 | deb_info("%s()\n", __func__); | 534 | deb_info("%s()\n", __func__); |
| 500 | if (d == NULL) | 535 | if (d == NULL) |
| @@ -506,9 +541,8 @@ static void dib0700_rc_urb_completion(struct urb *purb) | |||
| 506 | return; | 541 | return; |
| 507 | } | 542 | } |
| 508 | 543 | ||
| 509 | keymap = d->props.rc_key_map; | ||
| 510 | st = d->priv; | 544 | st = d->priv; |
| 511 | buf = (u8 *)purb->transfer_buffer; | 545 | poll_reply = purb->transfer_buffer; |
| 512 | 546 | ||
| 513 | if (purb->status < 0) { | 547 | if (purb->status < 0) { |
| 514 | deb_info("discontinuing polling\n"); | 548 | deb_info("discontinuing polling\n"); |
| @@ -521,104 +555,52 @@ static void dib0700_rc_urb_completion(struct urb *purb) | |||
| 521 | goto resubmit; | 555 | goto resubmit; |
| 522 | } | 556 | } |
| 523 | 557 | ||
| 524 | /* Set initial results in case we exit the function early */ | 558 | deb_data("IR ID = %02X state = %02X System = %02X %02X Cmd = %02X %02X (len %d)\n", |
| 525 | event = 0; | 559 | poll_reply->report_id, poll_reply->data_state, |
| 526 | state = REMOTE_NO_KEY_PRESSED; | 560 | poll_reply->system, poll_reply->not_system, |
| 527 | 561 | poll_reply->data, poll_reply->not_data, | |
| 528 | deb_data("IR raw %02X %02X %02X %02X %02X %02X (len %d)\n", buf[0], | 562 | purb->actual_length); |
| 529 | buf[1], buf[2], buf[3], buf[4], buf[5], purb->actual_length); | ||
| 530 | 563 | ||
| 531 | switch (dvb_usb_dib0700_ir_proto) { | 564 | switch (d->props.rc.core.protocol) { |
| 532 | case 0: | 565 | case IR_TYPE_NEC: |
| 533 | /* NEC Protocol */ | 566 | toggle = 0; |
| 534 | poll_reply.report_id = 0; | ||
| 535 | poll_reply.data_state = 1; | ||
| 536 | poll_reply.system = buf[2]; | ||
| 537 | poll_reply.data = buf[4]; | ||
| 538 | poll_reply.not_data = buf[5]; | ||
| 539 | 567 | ||
| 540 | /* NEC protocol sends repeat code as 0 0 0 FF */ | 568 | /* NEC protocol sends repeat code as 0 0 0 FF */ |
| 541 | if ((poll_reply.system == 0x00) && (poll_reply.data == 0x00) | 569 | if ((poll_reply->system == 0x00) && (poll_reply->data == 0x00) |
| 542 | && (poll_reply.not_data == 0xff)) { | 570 | && (poll_reply->not_data == 0xff)) { |
| 543 | poll_reply.data_state = 2; | 571 | poll_reply->data_state = 2; |
| 544 | break; | 572 | break; |
| 545 | } | 573 | } |
| 574 | |||
| 575 | if ((poll_reply->system ^ poll_reply->not_system) != 0xff) { | ||
| 576 | deb_data("NEC extended protocol\n"); | ||
| 577 | /* NEC extended code - 24 bits */ | ||
| 578 | keycode = poll_reply->system16 << 8 | poll_reply->data; | ||
| 579 | } else { | ||
| 580 | deb_data("NEC normal protocol\n"); | ||
| 581 | /* normal NEC code - 16 bits */ | ||
| 582 | keycode = poll_reply->system << 8 | poll_reply->data; | ||
| 583 | } | ||
| 584 | |||
| 546 | break; | 585 | break; |
| 547 | default: | 586 | default: |
| 587 | deb_data("RC5 protocol\n"); | ||
| 548 | /* RC5 Protocol */ | 588 | /* RC5 Protocol */ |
| 549 | poll_reply.report_id = buf[0]; | 589 | toggle = poll_reply->report_id; |
| 550 | poll_reply.data_state = buf[1]; | 590 | keycode = poll_reply->system16 << 8 | poll_reply->data; |
| 551 | poll_reply.system = (buf[2] << 8) | buf[3]; | 591 | |
| 552 | poll_reply.data = buf[4]; | ||
| 553 | poll_reply.not_data = buf[5]; | ||
| 554 | break; | 592 | break; |
| 555 | } | 593 | } |
| 556 | 594 | ||
| 557 | if ((poll_reply.data + poll_reply.not_data) != 0xff) { | 595 | if ((poll_reply->data + poll_reply->not_data) != 0xff) { |
| 558 | /* Key failed integrity check */ | 596 | /* Key failed integrity check */ |
| 559 | err("key failed integrity check: %04x %02x %02x", | 597 | err("key failed integrity check: %04x %02x %02x", |
| 560 | poll_reply.system, | 598 | poll_reply->system, |
| 561 | poll_reply.data, poll_reply.not_data); | 599 | poll_reply->data, poll_reply->not_data); |
| 562 | goto resubmit; | ||
| 563 | } | ||
| 564 | |||
| 565 | deb_data("rid=%02x ds=%02x sm=%04x d=%02x nd=%02x\n", | ||
| 566 | poll_reply.report_id, poll_reply.data_state, | ||
| 567 | poll_reply.system, poll_reply.data, poll_reply.not_data); | ||
| 568 | |||
| 569 | /* Find the key in the map */ | ||
| 570 | for (i = 0; i < d->props.rc_key_map_size; i++) { | ||
| 571 | if (rc5_custom(&keymap[i]) == (poll_reply.system & 0xff) && | ||
| 572 | rc5_data(&keymap[i]) == poll_reply.data) { | ||
| 573 | event = keymap[i].event; | ||
| 574 | found = 1; | ||
| 575 | break; | ||
| 576 | } | ||
| 577 | } | ||
| 578 | |||
| 579 | if (found == 0) { | ||
| 580 | err("Unknown remote controller key: %04x %02x %02x", | ||
| 581 | poll_reply.system, poll_reply.data, poll_reply.not_data); | ||
| 582 | d->last_event = 0; | ||
| 583 | goto resubmit; | 600 | goto resubmit; |
| 584 | } | 601 | } |
| 585 | 602 | ||
| 586 | if (poll_reply.data_state == 1) { | 603 | ir_keydown(d->rc_input_dev, keycode, toggle); |
| 587 | /* New key hit */ | ||
| 588 | st->rc_counter = 0; | ||
| 589 | event = keymap[i].event; | ||
| 590 | state = REMOTE_KEY_PRESSED; | ||
| 591 | d->last_event = keymap[i].event; | ||
| 592 | } else if (poll_reply.data_state == 2) { | ||
| 593 | /* Key repeated */ | ||
| 594 | st->rc_counter++; | ||
| 595 | |||
| 596 | /* prevents unwanted double hits */ | ||
| 597 | if (st->rc_counter > RC_REPEAT_DELAY_V1_20) { | ||
| 598 | event = d->last_event; | ||
| 599 | state = REMOTE_KEY_PRESSED; | ||
| 600 | st->rc_counter = RC_REPEAT_DELAY_V1_20; | ||
| 601 | } | ||
| 602 | } else { | ||
| 603 | err("Unknown data state [%d]", poll_reply.data_state); | ||
| 604 | } | ||
| 605 | |||
| 606 | switch (state) { | ||
| 607 | case REMOTE_NO_KEY_PRESSED: | ||
| 608 | break; | ||
| 609 | case REMOTE_KEY_PRESSED: | ||
| 610 | deb_info("key pressed\n"); | ||
| 611 | d->last_event = event; | ||
| 612 | case REMOTE_KEY_REPEAT: | ||
| 613 | deb_info("key repeated\n"); | ||
| 614 | input_event(d->rc_input_dev, EV_KEY, event, 1); | ||
| 615 | input_sync(d->rc_input_dev); | ||
| 616 | input_event(d->rc_input_dev, EV_KEY, d->last_event, 0); | ||
| 617 | input_sync(d->rc_input_dev); | ||
| 618 | break; | ||
| 619 | default: | ||
| 620 | break; | ||
| 621 | } | ||
| 622 | 604 | ||
| 623 | resubmit: | 605 | resubmit: |
| 624 | /* Clean the buffer before we requeue */ | 606 | /* Clean the buffer before we requeue */ |
| @@ -631,21 +613,10 @@ resubmit: | |||
| 631 | int dib0700_rc_setup(struct dvb_usb_device *d) | 613 | int dib0700_rc_setup(struct dvb_usb_device *d) |
| 632 | { | 614 | { |
| 633 | struct dib0700_state *st = d->priv; | 615 | struct dib0700_state *st = d->priv; |
| 634 | u8 rc_setup[3] = {REQUEST_SET_RC, dvb_usb_dib0700_ir_proto, 0}; | ||
| 635 | struct urb *purb; | 616 | struct urb *purb; |
| 636 | int ret; | 617 | int ret; |
| 637 | int i; | ||
| 638 | |||
| 639 | if (d->props.rc_key_map == NULL) | ||
| 640 | return 0; | ||
| 641 | |||
| 642 | /* Set the IR mode */ | ||
| 643 | i = dib0700_ctrl_wr(d, rc_setup, 3); | ||
| 644 | if (i<0) { | ||
| 645 | err("ir protocol setup failed"); | ||
| 646 | return -1; | ||
| 647 | } | ||
| 648 | 618 | ||
| 619 | /* Poll-based. Don't initialize bulk mode */ | ||
| 649 | if (st->fw_version < 0x10200) | 620 | if (st->fw_version < 0x10200) |
| 650 | return 0; | 621 | return 0; |
| 651 | 622 | ||
| @@ -653,14 +624,14 @@ int dib0700_rc_setup(struct dvb_usb_device *d) | |||
| 653 | purb = usb_alloc_urb(0, GFP_KERNEL); | 624 | purb = usb_alloc_urb(0, GFP_KERNEL); |
| 654 | if (purb == NULL) { | 625 | if (purb == NULL) { |
| 655 | err("rc usb alloc urb failed\n"); | 626 | err("rc usb alloc urb failed\n"); |
| 656 | return -1; | 627 | return -ENOMEM; |
| 657 | } | 628 | } |
| 658 | 629 | ||
| 659 | purb->transfer_buffer = kzalloc(RC_MSG_SIZE_V1_20, GFP_KERNEL); | 630 | purb->transfer_buffer = kzalloc(RC_MSG_SIZE_V1_20, GFP_KERNEL); |
| 660 | if (purb->transfer_buffer == NULL) { | 631 | if (purb->transfer_buffer == NULL) { |
| 661 | err("rc kzalloc failed\n"); | 632 | err("rc kzalloc failed\n"); |
| 662 | usb_free_urb(purb); | 633 | usb_free_urb(purb); |
| 663 | return -1; | 634 | return -ENOMEM; |
| 664 | } | 635 | } |
| 665 | 636 | ||
| 666 | purb->status = -EINPROGRESS; | 637 | purb->status = -EINPROGRESS; |
| @@ -669,12 +640,10 @@ int dib0700_rc_setup(struct dvb_usb_device *d) | |||
| 669 | dib0700_rc_urb_completion, d); | 640 | dib0700_rc_urb_completion, d); |
| 670 | 641 | ||
| 671 | ret = usb_submit_urb(purb, GFP_ATOMIC); | 642 | ret = usb_submit_urb(purb, GFP_ATOMIC); |
| 672 | if (ret != 0) { | 643 | if (ret) |
| 673 | err("rc submit urb failed\n"); | 644 | err("rc submit urb failed\n"); |
| 674 | return -1; | ||
| 675 | } | ||
| 676 | 645 | ||
| 677 | return 0; | 646 | return ret; |
| 678 | } | 647 | } |
| 679 | 648 | ||
| 680 | static int dib0700_probe(struct usb_interface *intf, | 649 | static int dib0700_probe(struct usb_interface *intf, |
| @@ -698,6 +667,15 @@ static int dib0700_probe(struct usb_interface *intf, | |||
| 698 | st->fw_version = fw_version; | 667 | st->fw_version = fw_version; |
| 699 | st->nb_packet_buffer_size = (u32)nb_packet_buffer_size; | 668 | st->nb_packet_buffer_size = (u32)nb_packet_buffer_size; |
| 700 | 669 | ||
| 670 | /* Disable polling mode on newer firmwares */ | ||
| 671 | if (st->fw_version >= 0x10200) | ||
| 672 | dev->props.rc.core.bulk_mode = true; | ||
| 673 | else | ||
| 674 | dev->props.rc.core.bulk_mode = false; | ||
| 675 | |||
| 676 | /* Need a higher delay, to avoid wrong repeat */ | ||
| 677 | dev->rc_input_dev->rep[REP_DELAY] = 500; | ||
| 678 | |||
| 701 | dib0700_rc_setup(dev); | 679 | dib0700_rc_setup(dev); |
| 702 | 680 | ||
| 703 | return 0; | 681 | return 0; |
diff --git a/drivers/media/dvb/dvb-usb/dib0700_devices.c b/drivers/media/dvb/dvb-usb/dib0700_devices.c index 800800a9649..f634d2e784b 100644 --- a/drivers/media/dvb/dvb-usb/dib0700_devices.c +++ b/drivers/media/dvb/dvb-usb/dib0700_devices.c | |||
| @@ -473,16 +473,19 @@ static u8 rc_request[] = { REQUEST_POLL_RC, 0 }; | |||
| 473 | /* Number of keypresses to ignore before start repeating */ | 473 | /* Number of keypresses to ignore before start repeating */ |
| 474 | #define RC_REPEAT_DELAY 6 | 474 | #define RC_REPEAT_DELAY 6 |
| 475 | 475 | ||
| 476 | static int dib0700_rc_query(struct dvb_usb_device *d, u32 *event, int *state) | 476 | /* |
| 477 | * This function is used only when firmware is < 1.20 version. Newer | ||
| 478 | * firmwares use bulk mode, with functions implemented at dib0700_core, | ||
| 479 | * at dib0700_rc_urb_completion() | ||
| 480 | */ | ||
| 481 | static int dib0700_rc_query_old_firmware(struct dvb_usb_device *d) | ||
| 477 | { | 482 | { |
| 478 | u8 key[4]; | 483 | u8 key[4]; |
| 484 | u32 keycode; | ||
| 485 | u8 toggle; | ||
| 479 | int i; | 486 | int i; |
| 480 | struct dvb_usb_rc_key *keymap = d->props.rc_key_map; | ||
| 481 | struct dib0700_state *st = d->priv; | 487 | struct dib0700_state *st = d->priv; |
| 482 | 488 | ||
| 483 | *event = 0; | ||
| 484 | *state = REMOTE_NO_KEY_PRESSED; | ||
| 485 | |||
| 486 | if (st->fw_version >= 0x10200) { | 489 | if (st->fw_version >= 0x10200) { |
| 487 | /* For 1.20 firmware , We need to keep the RC polling | 490 | /* For 1.20 firmware , We need to keep the RC polling |
| 488 | callback so we can reuse the input device setup in | 491 | callback so we can reuse the input device setup in |
| @@ -491,348 +494,45 @@ static int dib0700_rc_query(struct dvb_usb_device *d, u32 *event, int *state) | |||
| 491 | return 0; | 494 | return 0; |
| 492 | } | 495 | } |
| 493 | 496 | ||
| 494 | i=dib0700_ctrl_rd(d,rc_request,2,key,4); | 497 | i = dib0700_ctrl_rd(d, rc_request, 2, key, 4); |
| 495 | if (i<=0) { | 498 | if (i <= 0) { |
| 496 | err("RC Query Failed"); | 499 | err("RC Query Failed"); |
| 497 | return -1; | 500 | return -1; |
| 498 | } | 501 | } |
| 499 | 502 | ||
| 500 | /* losing half of KEY_0 events from Philipps rc5 remotes.. */ | 503 | /* losing half of KEY_0 events from Philipps rc5 remotes.. */ |
| 501 | if (key[0]==0 && key[1]==0 && key[2]==0 && key[3]==0) return 0; | 504 | if (key[0] == 0 && key[1] == 0 && key[2] == 0 && key[3] == 0) |
| 505 | return 0; | ||
| 502 | 506 | ||
| 503 | /* info("%d: %2X %2X %2X %2X",dvb_usb_dib0700_ir_proto,(int)key[3-2],(int)key[3-3],(int)key[3-1],(int)key[3]); */ | 507 | /* info("%d: %2X %2X %2X %2X",dvb_usb_dib0700_ir_proto,(int)key[3-2],(int)key[3-3],(int)key[3-1],(int)key[3]); */ |
| 504 | 508 | ||
| 505 | dib0700_rc_setup(d); /* reset ir sensor data to prevent false events */ | 509 | dib0700_rc_setup(d); /* reset ir sensor data to prevent false events */ |
| 506 | 510 | ||
| 507 | switch (dvb_usb_dib0700_ir_proto) { | 511 | d->last_event = 0; |
| 508 | case 0: { | 512 | switch (d->props.rc.core.protocol) { |
| 513 | case IR_TYPE_NEC: | ||
| 509 | /* NEC protocol sends repeat code as 0 0 0 FF */ | 514 | /* NEC protocol sends repeat code as 0 0 0 FF */ |
| 510 | if ((key[3-2] == 0x00) && (key[3-3] == 0x00) && | 515 | if ((key[3-2] == 0x00) && (key[3-3] == 0x00) && |
| 511 | (key[3] == 0xFF)) { | 516 | (key[3] == 0xff)) |
| 512 | st->rc_counter++; | 517 | keycode = d->last_event; |
| 513 | if (st->rc_counter > RC_REPEAT_DELAY) { | 518 | else { |
| 514 | *event = d->last_event; | 519 | keycode = key[3-2] << 8 | key[3-3]; |
| 515 | *state = REMOTE_KEY_PRESSED; | 520 | d->last_event = keycode; |
| 516 | st->rc_counter = RC_REPEAT_DELAY; | ||
| 517 | } | ||
| 518 | return 0; | ||
| 519 | } | ||
| 520 | for (i=0;i<d->props.rc_key_map_size; i++) { | ||
| 521 | if (rc5_custom(&keymap[i]) == key[3-2] && | ||
| 522 | rc5_data(&keymap[i]) == key[3-3]) { | ||
| 523 | st->rc_counter = 0; | ||
| 524 | *event = keymap[i].event; | ||
| 525 | *state = REMOTE_KEY_PRESSED; | ||
| 526 | d->last_event = keymap[i].event; | ||
| 527 | return 0; | ||
| 528 | } | ||
| 529 | } | 521 | } |
| 522 | |||
| 523 | ir_keydown(d->rc_input_dev, keycode, 0); | ||
| 530 | break; | 524 | break; |
| 531 | } | 525 | default: |
| 532 | default: { | ||
| 533 | /* RC-5 protocol changes toggle bit on new keypress */ | 526 | /* RC-5 protocol changes toggle bit on new keypress */ |
| 534 | for (i = 0; i < d->props.rc_key_map_size; i++) { | 527 | keycode = key[3-2] << 8 | key[3-3]; |
| 535 | if (rc5_custom(&keymap[i]) == key[3-2] && | 528 | toggle = key[3-1]; |
| 536 | rc5_data(&keymap[i]) == key[3-3]) { | 529 | ir_keydown(d->rc_input_dev, keycode, toggle); |
| 537 | if (d->last_event == keymap[i].event && | 530 | |
| 538 | key[3-1] == st->rc_toggle) { | ||
| 539 | st->rc_counter++; | ||
| 540 | /* prevents unwanted double hits */ | ||
| 541 | if (st->rc_counter > RC_REPEAT_DELAY) { | ||
| 542 | *event = d->last_event; | ||
| 543 | *state = REMOTE_KEY_PRESSED; | ||
| 544 | st->rc_counter = RC_REPEAT_DELAY; | ||
| 545 | } | ||
| 546 | |||
| 547 | return 0; | ||
| 548 | } | ||
| 549 | st->rc_counter = 0; | ||
| 550 | *event = keymap[i].event; | ||
| 551 | *state = REMOTE_KEY_PRESSED; | ||
| 552 | st->rc_toggle = key[3-1]; | ||
| 553 | d->last_event = keymap[i].event; | ||
| 554 | return 0; | ||
| 555 | } | ||
| 556 | } | ||
| 557 | break; | 531 | break; |
| 558 | } | 532 | } |
| 559 | } | ||
| 560 | err("Unknown remote controller key: %2X %2X %2X %2X", (int) key[3-2], (int) key[3-3], (int) key[3-1], (int) key[3]); | ||
| 561 | d->last_event = 0; | ||
| 562 | return 0; | 533 | return 0; |
| 563 | } | 534 | } |
| 564 | 535 | ||
| 565 | static struct dvb_usb_rc_key ir_codes_dib0700_table[] = { | ||
| 566 | /* Key codes for the tiny Pinnacle remote*/ | ||
| 567 | { 0x0700, KEY_MUTE }, | ||
| 568 | { 0x0701, KEY_MENU }, /* Pinnacle logo */ | ||
| 569 | { 0x0739, KEY_POWER }, | ||
| 570 | { 0x0703, KEY_VOLUMEUP }, | ||
| 571 | { 0x0709, KEY_VOLUMEDOWN }, | ||
| 572 | { 0x0706, KEY_CHANNELUP }, | ||
| 573 | { 0x070c, KEY_CHANNELDOWN }, | ||
| 574 | { 0x070f, KEY_1 }, | ||
| 575 | { 0x0715, KEY_2 }, | ||
| 576 | { 0x0710, KEY_3 }, | ||
| 577 | { 0x0718, KEY_4 }, | ||
| 578 | { 0x071b, KEY_5 }, | ||
| 579 | { 0x071e, KEY_6 }, | ||
| 580 | { 0x0711, KEY_7 }, | ||
| 581 | { 0x0721, KEY_8 }, | ||
| 582 | { 0x0712, KEY_9 }, | ||
| 583 | { 0x0727, KEY_0 }, | ||
| 584 | { 0x0724, KEY_SCREEN }, /* 'Square' key */ | ||
| 585 | { 0x072a, KEY_TEXT }, /* 'T' key */ | ||
| 586 | { 0x072d, KEY_REWIND }, | ||
| 587 | { 0x0730, KEY_PLAY }, | ||
| 588 | { 0x0733, KEY_FASTFORWARD }, | ||
| 589 | { 0x0736, KEY_RECORD }, | ||
| 590 | { 0x073c, KEY_STOP }, | ||
| 591 | { 0x073f, KEY_CANCEL }, /* '?' key */ | ||
| 592 | /* Key codes for the Terratec Cinergy DT XS Diversity, similar to cinergyT2.c */ | ||
| 593 | { 0xeb01, KEY_POWER }, | ||
| 594 | { 0xeb02, KEY_1 }, | ||
| 595 | { 0xeb03, KEY_2 }, | ||
| 596 | { 0xeb04, KEY_3 }, | ||
| 597 | { 0xeb05, KEY_4 }, | ||
| 598 | { 0xeb06, KEY_5 }, | ||
| 599 | { 0xeb07, KEY_6 }, | ||
| 600 | { 0xeb08, KEY_7 }, | ||
| 601 | { 0xeb09, KEY_8 }, | ||
| 602 | { 0xeb0a, KEY_9 }, | ||
| 603 | { 0xeb0b, KEY_VIDEO }, | ||
| 604 | { 0xeb0c, KEY_0 }, | ||
| 605 | { 0xeb0d, KEY_REFRESH }, | ||
| 606 | { 0xeb0f, KEY_EPG }, | ||
| 607 | { 0xeb10, KEY_UP }, | ||
| 608 | { 0xeb11, KEY_LEFT }, | ||
| 609 | { 0xeb12, KEY_OK }, | ||
| 610 | { 0xeb13, KEY_RIGHT }, | ||
| 611 | { 0xeb14, KEY_DOWN }, | ||
| 612 | { 0xeb16, KEY_INFO }, | ||
| 613 | { 0xeb17, KEY_RED }, | ||
| 614 | { 0xeb18, KEY_GREEN }, | ||
| 615 | { 0xeb19, KEY_YELLOW }, | ||
| 616 | { 0xeb1a, KEY_BLUE }, | ||
| 617 | { 0xeb1b, KEY_CHANNELUP }, | ||
| 618 | { 0xeb1c, KEY_VOLUMEUP }, | ||
| 619 | { 0xeb1d, KEY_MUTE }, | ||
| 620 | { 0xeb1e, KEY_VOLUMEDOWN }, | ||
| 621 | { 0xeb1f, KEY_CHANNELDOWN }, | ||
| 622 | { 0xeb40, KEY_PAUSE }, | ||
| 623 | { 0xeb41, KEY_HOME }, | ||
| 624 | { 0xeb42, KEY_MENU }, /* DVD Menu */ | ||
| 625 | { 0xeb43, KEY_SUBTITLE }, | ||
| 626 | { 0xeb44, KEY_TEXT }, /* Teletext */ | ||
| 627 | { 0xeb45, KEY_DELETE }, | ||
| 628 | { 0xeb46, KEY_TV }, | ||
| 629 | { 0xeb47, KEY_DVD }, | ||
| 630 | { 0xeb48, KEY_STOP }, | ||
| 631 | { 0xeb49, KEY_VIDEO }, | ||
| 632 | { 0xeb4a, KEY_AUDIO }, /* Music */ | ||
| 633 | { 0xeb4b, KEY_SCREEN }, /* Pic */ | ||
| 634 | { 0xeb4c, KEY_PLAY }, | ||
| 635 | { 0xeb4d, KEY_BACK }, | ||
| 636 | { 0xeb4e, KEY_REWIND }, | ||
| 637 | { 0xeb4f, KEY_FASTFORWARD }, | ||
| 638 | { 0xeb54, KEY_PREVIOUS }, | ||
| 639 | { 0xeb58, KEY_RECORD }, | ||
| 640 | { 0xeb5c, KEY_NEXT }, | ||
| 641 | |||
| 642 | /* Key codes for the Haupauge WinTV Nova-TD, copied from nova-t-usb2.c (Nova-T USB2) */ | ||
| 643 | { 0x1e00, KEY_0 }, | ||
| 644 | { 0x1e01, KEY_1 }, | ||
| 645 | { 0x1e02, KEY_2 }, | ||
| 646 | { 0x1e03, KEY_3 }, | ||
| 647 | { 0x1e04, KEY_4 }, | ||
| 648 | { 0x1e05, KEY_5 }, | ||
| 649 | { 0x1e06, KEY_6 }, | ||
| 650 | { 0x1e07, KEY_7 }, | ||
| 651 | { 0x1e08, KEY_8 }, | ||
| 652 | { 0x1e09, KEY_9 }, | ||
| 653 | { 0x1e0a, KEY_KPASTERISK }, | ||
| 654 | { 0x1e0b, KEY_RED }, | ||
| 655 | { 0x1e0c, KEY_RADIO }, | ||
| 656 | { 0x1e0d, KEY_MENU }, | ||
| 657 | { 0x1e0e, KEY_GRAVE }, /* # */ | ||
| 658 | { 0x1e0f, KEY_MUTE }, | ||
| 659 | { 0x1e10, KEY_VOLUMEUP }, | ||
| 660 | { 0x1e11, KEY_VOLUMEDOWN }, | ||
| 661 | { 0x1e12, KEY_CHANNEL }, | ||
| 662 | { 0x1e14, KEY_UP }, | ||
| 663 | { 0x1e15, KEY_DOWN }, | ||
| 664 | { 0x1e16, KEY_LEFT }, | ||
| 665 | { 0x1e17, KEY_RIGHT }, | ||
| 666 | { 0x1e18, KEY_VIDEO }, | ||
| 667 | { 0x1e19, KEY_AUDIO }, | ||
| 668 | { 0x1e1a, KEY_MEDIA }, | ||
| 669 | { 0x1e1b, KEY_EPG }, | ||
| 670 | { 0x1e1c, KEY_TV }, | ||
| 671 | { 0x1e1e, KEY_NEXT }, | ||
| 672 | { 0x1e1f, KEY_BACK }, | ||
| 673 | { 0x1e20, KEY_CHANNELUP }, | ||
| 674 | { 0x1e21, KEY_CHANNELDOWN }, | ||
| 675 | { 0x1e24, KEY_LAST }, /* Skip backwards */ | ||
| 676 | { 0x1e25, KEY_OK }, | ||
| 677 | { 0x1e29, KEY_BLUE}, | ||
| 678 | { 0x1e2e, KEY_GREEN }, | ||
| 679 | { 0x1e30, KEY_PAUSE }, | ||
| 680 | { 0x1e32, KEY_REWIND }, | ||
| 681 | { 0x1e34, KEY_FASTFORWARD }, | ||
| 682 | { 0x1e35, KEY_PLAY }, | ||
| 683 | { 0x1e36, KEY_STOP }, | ||
| 684 | { 0x1e37, KEY_RECORD }, | ||
| 685 | { 0x1e38, KEY_YELLOW }, | ||
| 686 | { 0x1e3b, KEY_GOTO }, | ||
| 687 | { 0x1e3d, KEY_POWER }, | ||
| 688 | |||
| 689 | /* Key codes for the Leadtek Winfast DTV Dongle */ | ||
| 690 | { 0x0042, KEY_POWER }, | ||
| 691 | { 0x077c, KEY_TUNER }, | ||
| 692 | { 0x0f4e, KEY_PRINT }, /* PREVIEW */ | ||
| 693 | { 0x0840, KEY_SCREEN }, /* full screen toggle*/ | ||
| 694 | { 0x0f71, KEY_DOT }, /* frequency */ | ||
| 695 | { 0x0743, KEY_0 }, | ||
| 696 | { 0x0c41, KEY_1 }, | ||
| 697 | { 0x0443, KEY_2 }, | ||
| 698 | { 0x0b7f, KEY_3 }, | ||
| 699 | { 0x0e41, KEY_4 }, | ||
| 700 | { 0x0643, KEY_5 }, | ||
| 701 | { 0x097f, KEY_6 }, | ||
| 702 | { 0x0d7e, KEY_7 }, | ||
| 703 | { 0x057c, KEY_8 }, | ||
| 704 | { 0x0a40, KEY_9 }, | ||
| 705 | { 0x0e4e, KEY_CLEAR }, | ||
| 706 | { 0x047c, KEY_CHANNEL }, /* show channel number */ | ||
| 707 | { 0x0f41, KEY_LAST }, /* recall */ | ||
| 708 | { 0x0342, KEY_MUTE }, | ||
| 709 | { 0x064c, KEY_RESERVED }, /* PIP button*/ | ||
| 710 | { 0x0172, KEY_SHUFFLE }, /* SNAPSHOT */ | ||
| 711 | { 0x0c4e, KEY_PLAYPAUSE }, /* TIMESHIFT */ | ||
| 712 | { 0x0b70, KEY_RECORD }, | ||
| 713 | { 0x037d, KEY_VOLUMEUP }, | ||
| 714 | { 0x017d, KEY_VOLUMEDOWN }, | ||
| 715 | { 0x0242, KEY_CHANNELUP }, | ||
| 716 | { 0x007d, KEY_CHANNELDOWN }, | ||
| 717 | |||
| 718 | /* Key codes for Nova-TD "credit card" remote control. */ | ||
| 719 | { 0x1d00, KEY_0 }, | ||
| 720 | { 0x1d01, KEY_1 }, | ||
| 721 | { 0x1d02, KEY_2 }, | ||
| 722 | { 0x1d03, KEY_3 }, | ||
| 723 | { 0x1d04, KEY_4 }, | ||
| 724 | { 0x1d05, KEY_5 }, | ||
| 725 | { 0x1d06, KEY_6 }, | ||
| 726 | { 0x1d07, KEY_7 }, | ||
| 727 | { 0x1d08, KEY_8 }, | ||
| 728 | { 0x1d09, KEY_9 }, | ||
| 729 | { 0x1d0a, KEY_TEXT }, | ||
| 730 | { 0x1d0d, KEY_MENU }, | ||
| 731 | { 0x1d0f, KEY_MUTE }, | ||
| 732 | { 0x1d10, KEY_VOLUMEUP }, | ||
| 733 | { 0x1d11, KEY_VOLUMEDOWN }, | ||
| 734 | { 0x1d12, KEY_CHANNEL }, | ||
| 735 | { 0x1d14, KEY_UP }, | ||
| 736 | { 0x1d15, KEY_DOWN }, | ||
| 737 | { 0x1d16, KEY_LEFT }, | ||
| 738 | { 0x1d17, KEY_RIGHT }, | ||
| 739 | { 0x1d1c, KEY_TV }, | ||
| 740 | { 0x1d1e, KEY_NEXT }, | ||
| 741 | { 0x1d1f, KEY_BACK }, | ||
| 742 | { 0x1d20, KEY_CHANNELUP }, | ||
| 743 | { 0x1d21, KEY_CHANNELDOWN }, | ||
| 744 | { 0x1d24, KEY_LAST }, | ||
| 745 | { 0x1d25, KEY_OK }, | ||
| 746 | { 0x1d30, KEY_PAUSE }, | ||
| 747 | { 0x1d32, KEY_REWIND }, | ||
| 748 | { 0x1d34, KEY_FASTFORWARD }, | ||
| 749 | { 0x1d35, KEY_PLAY }, | ||
| 750 | { 0x1d36, KEY_STOP }, | ||
| 751 | { 0x1d37, KEY_RECORD }, | ||
| 752 | { 0x1d3b, KEY_GOTO }, | ||
| 753 | { 0x1d3d, KEY_POWER }, | ||
| 754 | |||
| 755 | /* Key codes for the Pixelview SBTVD remote (proto NEC) */ | ||
| 756 | { 0x8613, KEY_MUTE }, | ||
| 757 | { 0x8612, KEY_POWER }, | ||
| 758 | { 0x8601, KEY_1 }, | ||
| 759 | { 0x8602, KEY_2 }, | ||
| 760 | { 0x8603, KEY_3 }, | ||
| 761 | { 0x8604, KEY_4 }, | ||
| 762 | { 0x8605, KEY_5 }, | ||
| 763 | { 0x8606, KEY_6 }, | ||
| 764 | { 0x8607, KEY_7 }, | ||
| 765 | { 0x8608, KEY_8 }, | ||
| 766 | { 0x8609, KEY_9 }, | ||
| 767 | { 0x8600, KEY_0 }, | ||
| 768 | { 0x860d, KEY_CHANNELUP }, | ||
| 769 | { 0x8619, KEY_CHANNELDOWN }, | ||
| 770 | { 0x8610, KEY_VOLUMEUP }, | ||
| 771 | { 0x860c, KEY_VOLUMEDOWN }, | ||
| 772 | |||
| 773 | { 0x860a, KEY_CAMERA }, | ||
| 774 | { 0x860b, KEY_ZOOM }, | ||
| 775 | { 0x861b, KEY_BACKSPACE }, | ||
| 776 | { 0x8615, KEY_ENTER }, | ||
| 777 | |||
| 778 | { 0x861d, KEY_UP }, | ||
| 779 | { 0x861e, KEY_DOWN }, | ||
| 780 | { 0x860e, KEY_LEFT }, | ||
| 781 | { 0x860f, KEY_RIGHT }, | ||
| 782 | |||
| 783 | { 0x8618, KEY_RECORD }, | ||
| 784 | { 0x861a, KEY_STOP }, | ||
| 785 | |||
| 786 | /* Key codes for the EvolutePC TVWay+ remote (proto NEC) */ | ||
| 787 | { 0x7a00, KEY_MENU }, | ||
| 788 | { 0x7a01, KEY_RECORD }, | ||
| 789 | { 0x7a02, KEY_PLAY }, | ||
| 790 | { 0x7a03, KEY_STOP }, | ||
| 791 | { 0x7a10, KEY_CHANNELUP }, | ||
| 792 | { 0x7a11, KEY_CHANNELDOWN }, | ||
| 793 | { 0x7a12, KEY_VOLUMEUP }, | ||
| 794 | { 0x7a13, KEY_VOLUMEDOWN }, | ||
| 795 | { 0x7a40, KEY_POWER }, | ||
| 796 | { 0x7a41, KEY_MUTE }, | ||
| 797 | |||
| 798 | /* Key codes for the Elgato EyeTV Diversity silver remote, | ||
| 799 | set dvb_usb_dib0700_ir_proto=0 */ | ||
| 800 | { 0x4501, KEY_POWER }, | ||
| 801 | { 0x4502, KEY_MUTE }, | ||
| 802 | { 0x4503, KEY_1 }, | ||
| 803 | { 0x4504, KEY_2 }, | ||
| 804 | { 0x4505, KEY_3 }, | ||
| 805 | { 0x4506, KEY_4 }, | ||
| 806 | { 0x4507, KEY_5 }, | ||
| 807 | { 0x4508, KEY_6 }, | ||
| 808 | { 0x4509, KEY_7 }, | ||
| 809 | { 0x450a, KEY_8 }, | ||
| 810 | { 0x450b, KEY_9 }, | ||
| 811 | { 0x450c, KEY_LAST }, | ||
| 812 | { 0x450d, KEY_0 }, | ||
| 813 | { 0x450e, KEY_ENTER }, | ||
| 814 | { 0x450f, KEY_RED }, | ||
| 815 | { 0x4510, KEY_CHANNELUP }, | ||
| 816 | { 0x4511, KEY_GREEN }, | ||
| 817 | { 0x4512, KEY_VOLUMEDOWN }, | ||
| 818 | { 0x4513, KEY_OK }, | ||
| 819 | { 0x4514, KEY_VOLUMEUP }, | ||
| 820 | { 0x4515, KEY_YELLOW }, | ||
| 821 | { 0x4516, KEY_CHANNELDOWN }, | ||
| 822 | { 0x4517, KEY_BLUE }, | ||
| 823 | { 0x4518, KEY_LEFT }, /* Skip backwards */ | ||
| 824 | { 0x4519, KEY_PLAYPAUSE }, | ||
| 825 | { 0x451a, KEY_RIGHT }, /* Skip forward */ | ||
| 826 | { 0x451b, KEY_REWIND }, | ||
| 827 | { 0x451c, KEY_L }, /* Live */ | ||
| 828 | { 0x451d, KEY_FASTFORWARD }, | ||
| 829 | { 0x451e, KEY_STOP }, /* 'Reveal' for Teletext */ | ||
| 830 | { 0x451f, KEY_MENU }, /* KEY_TEXT for Teletext */ | ||
| 831 | { 0x4540, KEY_RECORD }, /* Font 'Size' for Teletext */ | ||
| 832 | { 0x4541, KEY_SCREEN }, /* Full screen toggle, 'Hold' for Teletext */ | ||
| 833 | { 0x4542, KEY_SELECT }, /* Select video input, 'Select' for Teletext */ | ||
| 834 | }; | ||
| 835 | |||
| 836 | /* STK7700P: Hauppauge Nova-T Stick, AVerMedia Volar */ | 536 | /* STK7700P: Hauppauge Nova-T Stick, AVerMedia Volar */ |
| 837 | static struct dibx000_agc_config stk7700p_7000m_mt2060_agc_config = { | 537 | static struct dibx000_agc_config stk7700p_7000m_mt2060_agc_config = { |
| 838 | BAND_UHF | BAND_VHF, | 538 | BAND_UHF | BAND_VHF, |
| @@ -2168,10 +1868,17 @@ struct dvb_usb_device_properties dib0700_devices[] = { | |||
| 2168 | } | 1868 | } |
| 2169 | }, | 1869 | }, |
| 2170 | 1870 | ||
| 2171 | .rc_interval = DEFAULT_RC_INTERVAL, | 1871 | .rc.core = { |
| 2172 | .rc_key_map = ir_codes_dib0700_table, | 1872 | .rc_interval = DEFAULT_RC_INTERVAL, |
| 2173 | .rc_key_map_size = ARRAY_SIZE(ir_codes_dib0700_table), | 1873 | .rc_codes = RC_MAP_DIB0700_RC5_TABLE, |
| 2174 | .rc_query = dib0700_rc_query | 1874 | .rc_query = dib0700_rc_query_old_firmware, |
| 1875 | .rc_props = { | ||
| 1876 | .allowed_protos = IR_TYPE_RC5 | | ||
| 1877 | IR_TYPE_RC6 | | ||
| 1878 | IR_TYPE_NEC, | ||
| 1879 | .change_protocol = dib0700_change_protocol, | ||
| 1880 | }, | ||
| 1881 | }, | ||
| 2175 | }, { DIB0700_DEFAULT_DEVICE_PROPERTIES, | 1882 | }, { DIB0700_DEFAULT_DEVICE_PROPERTIES, |
| 2176 | 1883 | ||
| 2177 | .num_adapters = 2, | 1884 | .num_adapters = 2, |
| @@ -2197,10 +1904,17 @@ struct dvb_usb_device_properties dib0700_devices[] = { | |||
| 2197 | }, | 1904 | }, |
| 2198 | }, | 1905 | }, |
| 2199 | 1906 | ||
| 2200 | .rc_interval = DEFAULT_RC_INTERVAL, | 1907 | .rc.core = { |
| 2201 | .rc_key_map = ir_codes_dib0700_table, | 1908 | .rc_interval = DEFAULT_RC_INTERVAL, |
| 2202 | .rc_key_map_size = ARRAY_SIZE(ir_codes_dib0700_table), | 1909 | .rc_codes = RC_MAP_DIB0700_RC5_TABLE, |
| 2203 | .rc_query = dib0700_rc_query | 1910 | .rc_query = dib0700_rc_query_old_firmware, |
| 1911 | .rc_props = { | ||
| 1912 | .allowed_protos = IR_TYPE_RC5 | | ||
| 1913 | IR_TYPE_RC6 | | ||
| 1914 | IR_TYPE_NEC, | ||
| 1915 | .change_protocol = dib0700_change_protocol, | ||
| 1916 | }, | ||
| 1917 | }, | ||
| 2204 | }, { DIB0700_DEFAULT_DEVICE_PROPERTIES, | 1918 | }, { DIB0700_DEFAULT_DEVICE_PROPERTIES, |
| 2205 | 1919 | ||
| 2206 | .num_adapters = 2, | 1920 | .num_adapters = 2, |
| @@ -2251,11 +1965,17 @@ struct dvb_usb_device_properties dib0700_devices[] = { | |||
| 2251 | 1965 | ||
| 2252 | }, | 1966 | }, |
| 2253 | 1967 | ||
| 2254 | .rc_interval = DEFAULT_RC_INTERVAL, | 1968 | .rc.core = { |
| 2255 | .rc_key_map = ir_codes_dib0700_table, | 1969 | .rc_interval = DEFAULT_RC_INTERVAL, |
| 2256 | .rc_key_map_size = ARRAY_SIZE(ir_codes_dib0700_table), | 1970 | .rc_codes = RC_MAP_DIB0700_RC5_TABLE, |
| 2257 | .rc_query = dib0700_rc_query | 1971 | .rc_query = dib0700_rc_query_old_firmware, |
| 2258 | 1972 | .rc_props = { | |
| 1973 | .allowed_protos = IR_TYPE_RC5 | | ||
| 1974 | IR_TYPE_RC6 | | ||
| 1975 | IR_TYPE_NEC, | ||
| 1976 | .change_protocol = dib0700_change_protocol, | ||
| 1977 | }, | ||
| 1978 | }, | ||
| 2259 | }, { DIB0700_DEFAULT_DEVICE_PROPERTIES, | 1979 | }, { DIB0700_DEFAULT_DEVICE_PROPERTIES, |
| 2260 | 1980 | ||
| 2261 | .num_adapters = 1, | 1981 | .num_adapters = 1, |
| @@ -2288,10 +2008,18 @@ struct dvb_usb_device_properties dib0700_devices[] = { | |||
| 2288 | } | 2008 | } |
| 2289 | }, | 2009 | }, |
| 2290 | 2010 | ||
| 2291 | .rc_interval = DEFAULT_RC_INTERVAL, | 2011 | .rc.core = { |
| 2292 | .rc_key_map = ir_codes_dib0700_table, | 2012 | .rc_interval = DEFAULT_RC_INTERVAL, |
| 2293 | .rc_key_map_size = ARRAY_SIZE(ir_codes_dib0700_table), | 2013 | .rc_codes = RC_MAP_DIB0700_RC5_TABLE, |
| 2294 | .rc_query = dib0700_rc_query | 2014 | .module_name = "dib0700", |
| 2015 | .rc_query = dib0700_rc_query_old_firmware, | ||
| 2016 | .rc_props = { | ||
| 2017 | .allowed_protos = IR_TYPE_RC5 | | ||
| 2018 | IR_TYPE_RC6 | | ||
| 2019 | IR_TYPE_NEC, | ||
| 2020 | .change_protocol = dib0700_change_protocol, | ||
| 2021 | }, | ||
| 2022 | }, | ||
| 2295 | }, { DIB0700_DEFAULT_DEVICE_PROPERTIES, | 2023 | }, { DIB0700_DEFAULT_DEVICE_PROPERTIES, |
| 2296 | 2024 | ||
| 2297 | .num_adapters = 1, | 2025 | .num_adapters = 1, |
| @@ -2358,11 +2086,18 @@ struct dvb_usb_device_properties dib0700_devices[] = { | |||
| 2358 | }, | 2086 | }, |
| 2359 | }, | 2087 | }, |
| 2360 | 2088 | ||
| 2361 | .rc_interval = DEFAULT_RC_INTERVAL, | 2089 | .rc.core = { |
| 2362 | .rc_key_map = ir_codes_dib0700_table, | 2090 | .rc_interval = DEFAULT_RC_INTERVAL, |
| 2363 | .rc_key_map_size = ARRAY_SIZE(ir_codes_dib0700_table), | 2091 | .rc_codes = RC_MAP_DIB0700_RC5_TABLE, |
| 2364 | .rc_query = dib0700_rc_query | 2092 | .module_name = "dib0700", |
| 2365 | 2093 | .rc_query = dib0700_rc_query_old_firmware, | |
| 2094 | .rc_props = { | ||
| 2095 | .allowed_protos = IR_TYPE_RC5 | | ||
| 2096 | IR_TYPE_RC6 | | ||
| 2097 | IR_TYPE_NEC, | ||
| 2098 | .change_protocol = dib0700_change_protocol, | ||
| 2099 | }, | ||
| 2100 | }, | ||
| 2366 | }, { DIB0700_DEFAULT_DEVICE_PROPERTIES, | 2101 | }, { DIB0700_DEFAULT_DEVICE_PROPERTIES, |
| 2367 | 2102 | ||
| 2368 | .num_adapters = 1, | 2103 | .num_adapters = 1, |
| @@ -2397,11 +2132,18 @@ struct dvb_usb_device_properties dib0700_devices[] = { | |||
| 2397 | }, | 2132 | }, |
| 2398 | }, | 2133 | }, |
| 2399 | 2134 | ||
| 2400 | .rc_interval = DEFAULT_RC_INTERVAL, | 2135 | .rc.core = { |
| 2401 | .rc_key_map = ir_codes_dib0700_table, | 2136 | .rc_interval = DEFAULT_RC_INTERVAL, |
| 2402 | .rc_key_map_size = ARRAY_SIZE(ir_codes_dib0700_table), | 2137 | .rc_codes = RC_MAP_DIB0700_RC5_TABLE, |
| 2403 | .rc_query = dib0700_rc_query | 2138 | .module_name = "dib0700", |
| 2404 | 2139 | .rc_query = dib0700_rc_query_old_firmware, | |
| 2140 | .rc_props = { | ||
| 2141 | .allowed_protos = IR_TYPE_RC5 | | ||
| 2142 | IR_TYPE_RC6 | | ||
| 2143 | IR_TYPE_NEC, | ||
| 2144 | .change_protocol = dib0700_change_protocol, | ||
| 2145 | }, | ||
| 2146 | }, | ||
| 2405 | }, { DIB0700_DEFAULT_DEVICE_PROPERTIES, | 2147 | }, { DIB0700_DEFAULT_DEVICE_PROPERTIES, |
| 2406 | 2148 | ||
| 2407 | .num_adapters = 2, | 2149 | .num_adapters = 2, |
| @@ -2431,7 +2173,7 @@ struct dvb_usb_device_properties dib0700_devices[] = { | |||
| 2431 | } | 2173 | } |
| 2432 | }, | 2174 | }, |
| 2433 | 2175 | ||
| 2434 | .num_device_descs = 7, | 2176 | .num_device_descs = 6, |
| 2435 | .devices = { | 2177 | .devices = { |
| 2436 | { "DiBcom STK7070PD reference design", | 2178 | { "DiBcom STK7070PD reference design", |
| 2437 | { &dib0700_usb_id_table[17], NULL }, | 2179 | { &dib0700_usb_id_table[17], NULL }, |
| @@ -2458,15 +2200,69 @@ struct dvb_usb_device_properties dib0700_devices[] = { | |||
| 2458 | { &dib0700_usb_id_table[44], NULL }, | 2200 | { &dib0700_usb_id_table[44], NULL }, |
| 2459 | { NULL }, | 2201 | { NULL }, |
| 2460 | }, | 2202 | }, |
| 2203 | }, | ||
| 2204 | |||
| 2205 | .rc.core = { | ||
| 2206 | .rc_interval = DEFAULT_RC_INTERVAL, | ||
| 2207 | .rc_codes = RC_MAP_DIB0700_RC5_TABLE, | ||
| 2208 | .module_name = "dib0700", | ||
| 2209 | .rc_query = dib0700_rc_query_old_firmware, | ||
| 2210 | .rc_props = { | ||
| 2211 | .allowed_protos = IR_TYPE_RC5 | | ||
| 2212 | IR_TYPE_RC6 | | ||
| 2213 | IR_TYPE_NEC, | ||
| 2214 | .change_protocol = dib0700_change_protocol, | ||
| 2215 | }, | ||
| 2216 | }, | ||
| 2217 | }, { DIB0700_DEFAULT_DEVICE_PROPERTIES, | ||
| 2218 | |||
| 2219 | .num_adapters = 2, | ||
| 2220 | .adapter = { | ||
| 2221 | { | ||
| 2222 | .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF, | ||
| 2223 | .pid_filter_count = 32, | ||
| 2224 | .pid_filter = stk70x0p_pid_filter, | ||
| 2225 | .pid_filter_ctrl = stk70x0p_pid_filter_ctrl, | ||
| 2226 | .frontend_attach = stk7070pd_frontend_attach0, | ||
| 2227 | .tuner_attach = dib7070p_tuner_attach, | ||
| 2228 | |||
| 2229 | DIB0700_DEFAULT_STREAMING_CONFIG(0x02), | ||
| 2230 | |||
| 2231 | .size_of_priv = sizeof(struct dib0700_adapter_state), | ||
| 2232 | }, { | ||
| 2233 | .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF, | ||
| 2234 | .pid_filter_count = 32, | ||
| 2235 | .pid_filter = stk70x0p_pid_filter, | ||
| 2236 | .pid_filter_ctrl = stk70x0p_pid_filter_ctrl, | ||
| 2237 | .frontend_attach = stk7070pd_frontend_attach1, | ||
| 2238 | .tuner_attach = dib7070p_tuner_attach, | ||
| 2239 | |||
| 2240 | DIB0700_DEFAULT_STREAMING_CONFIG(0x03), | ||
| 2241 | |||
| 2242 | .size_of_priv = sizeof(struct dib0700_adapter_state), | ||
| 2243 | } | ||
| 2244 | }, | ||
| 2245 | |||
| 2246 | .num_device_descs = 1, | ||
| 2247 | .devices = { | ||
| 2461 | { "Elgato EyeTV Diversity", | 2248 | { "Elgato EyeTV Diversity", |
| 2462 | { &dib0700_usb_id_table[68], NULL }, | 2249 | { &dib0700_usb_id_table[68], NULL }, |
| 2463 | { NULL }, | 2250 | { NULL }, |
| 2464 | }, | 2251 | }, |
| 2465 | }, | 2252 | }, |
| 2466 | .rc_interval = DEFAULT_RC_INTERVAL, | 2253 | |
| 2467 | .rc_key_map = ir_codes_dib0700_table, | 2254 | .rc.core = { |
| 2468 | .rc_key_map_size = ARRAY_SIZE(ir_codes_dib0700_table), | 2255 | .rc_interval = DEFAULT_RC_INTERVAL, |
| 2469 | .rc_query = dib0700_rc_query | 2256 | .rc_codes = RC_MAP_DIB0700_NEC_TABLE, |
| 2257 | .module_name = "dib0700", | ||
| 2258 | .rc_query = dib0700_rc_query_old_firmware, | ||
| 2259 | .rc_props = { | ||
| 2260 | .allowed_protos = IR_TYPE_RC5 | | ||
| 2261 | IR_TYPE_RC6 | | ||
| 2262 | IR_TYPE_NEC, | ||
| 2263 | .change_protocol = dib0700_change_protocol, | ||
| 2264 | }, | ||
| 2265 | }, | ||
| 2470 | }, { DIB0700_DEFAULT_DEVICE_PROPERTIES, | 2266 | }, { DIB0700_DEFAULT_DEVICE_PROPERTIES, |
| 2471 | 2267 | ||
| 2472 | .num_adapters = 1, | 2268 | .num_adapters = 1, |
| @@ -2525,10 +2321,19 @@ struct dvb_usb_device_properties dib0700_devices[] = { | |||
| 2525 | { NULL }, | 2321 | { NULL }, |
| 2526 | }, | 2322 | }, |
| 2527 | }, | 2323 | }, |
| 2528 | .rc_interval = DEFAULT_RC_INTERVAL, | 2324 | |
| 2529 | .rc_key_map = ir_codes_dib0700_table, | 2325 | .rc.core = { |
| 2530 | .rc_key_map_size = ARRAY_SIZE(ir_codes_dib0700_table), | 2326 | .rc_interval = DEFAULT_RC_INTERVAL, |
| 2531 | .rc_query = dib0700_rc_query | 2327 | .rc_codes = RC_MAP_DIB0700_RC5_TABLE, |
| 2328 | .module_name = "dib0700", | ||
| 2329 | .rc_query = dib0700_rc_query_old_firmware, | ||
| 2330 | .rc_props = { | ||
| 2331 | .allowed_protos = IR_TYPE_RC5 | | ||
| 2332 | IR_TYPE_RC6 | | ||
| 2333 | IR_TYPE_NEC, | ||
| 2334 | .change_protocol = dib0700_change_protocol, | ||
| 2335 | }, | ||
| 2336 | }, | ||
| 2532 | }, { DIB0700_DEFAULT_DEVICE_PROPERTIES, | 2337 | }, { DIB0700_DEFAULT_DEVICE_PROPERTIES, |
| 2533 | .num_adapters = 1, | 2338 | .num_adapters = 1, |
| 2534 | .adapter = { | 2339 | .adapter = { |
| @@ -2554,10 +2359,19 @@ struct dvb_usb_device_properties dib0700_devices[] = { | |||
| 2554 | { NULL }, | 2359 | { NULL }, |
| 2555 | }, | 2360 | }, |
| 2556 | }, | 2361 | }, |
| 2557 | .rc_interval = DEFAULT_RC_INTERVAL, | 2362 | |
| 2558 | .rc_key_map = ir_codes_dib0700_table, | 2363 | .rc.core = { |
| 2559 | .rc_key_map_size = ARRAY_SIZE(ir_codes_dib0700_table), | 2364 | .rc_interval = DEFAULT_RC_INTERVAL, |
| 2560 | .rc_query = dib0700_rc_query | 2365 | .rc_codes = RC_MAP_DIB0700_RC5_TABLE, |
| 2366 | .module_name = "dib0700", | ||
| 2367 | .rc_query = dib0700_rc_query_old_firmware, | ||
| 2368 | .rc_props = { | ||
| 2369 | .allowed_protos = IR_TYPE_RC5 | | ||
| 2370 | IR_TYPE_RC6 | | ||
| 2371 | IR_TYPE_NEC, | ||
| 2372 | .change_protocol = dib0700_change_protocol, | ||
| 2373 | }, | ||
| 2374 | }, | ||
| 2561 | }, { DIB0700_DEFAULT_DEVICE_PROPERTIES, | 2375 | }, { DIB0700_DEFAULT_DEVICE_PROPERTIES, |
| 2562 | .num_adapters = 1, | 2376 | .num_adapters = 1, |
| 2563 | .adapter = { | 2377 | .adapter = { |
| @@ -2615,10 +2429,19 @@ struct dvb_usb_device_properties dib0700_devices[] = { | |||
| 2615 | { NULL }, | 2429 | { NULL }, |
| 2616 | }, | 2430 | }, |
| 2617 | }, | 2431 | }, |
| 2618 | .rc_interval = DEFAULT_RC_INTERVAL, | 2432 | |
| 2619 | .rc_key_map = ir_codes_dib0700_table, | 2433 | .rc.core = { |
| 2620 | .rc_key_map_size = ARRAY_SIZE(ir_codes_dib0700_table), | 2434 | .rc_interval = DEFAULT_RC_INTERVAL, |
| 2621 | .rc_query = dib0700_rc_query | 2435 | .rc_codes = RC_MAP_DIB0700_RC5_TABLE, |
| 2436 | .module_name = "dib0700", | ||
| 2437 | .rc_query = dib0700_rc_query_old_firmware, | ||
| 2438 | .rc_props = { | ||
| 2439 | .allowed_protos = IR_TYPE_RC5 | | ||
| 2440 | IR_TYPE_RC6 | | ||
| 2441 | IR_TYPE_NEC, | ||
| 2442 | .change_protocol = dib0700_change_protocol, | ||
| 2443 | }, | ||
| 2444 | }, | ||
| 2622 | }, { DIB0700_DEFAULT_DEVICE_PROPERTIES, | 2445 | }, { DIB0700_DEFAULT_DEVICE_PROPERTIES, |
| 2623 | .num_adapters = 1, | 2446 | .num_adapters = 1, |
| 2624 | .adapter = { | 2447 | .adapter = { |
| @@ -2653,11 +2476,18 @@ struct dvb_usb_device_properties dib0700_devices[] = { | |||
| 2653 | }, | 2476 | }, |
| 2654 | }, | 2477 | }, |
| 2655 | 2478 | ||
| 2656 | .rc_interval = DEFAULT_RC_INTERVAL, | 2479 | .rc.core = { |
| 2657 | .rc_key_map = ir_codes_dib0700_table, | 2480 | .rc_interval = DEFAULT_RC_INTERVAL, |
| 2658 | .rc_key_map_size = ARRAY_SIZE(ir_codes_dib0700_table), | 2481 | .rc_codes = RC_MAP_DIB0700_NEC_TABLE, |
| 2659 | .rc_query = dib0700_rc_query | 2482 | .module_name = "dib0700", |
| 2660 | 2483 | .rc_query = dib0700_rc_query_old_firmware, | |
| 2484 | .rc_props = { | ||
| 2485 | .allowed_protos = IR_TYPE_RC5 | | ||
| 2486 | IR_TYPE_RC6 | | ||
| 2487 | IR_TYPE_NEC, | ||
| 2488 | .change_protocol = dib0700_change_protocol, | ||
| 2489 | }, | ||
| 2490 | }, | ||
| 2661 | }, { DIB0700_DEFAULT_DEVICE_PROPERTIES, | 2491 | }, { DIB0700_DEFAULT_DEVICE_PROPERTIES, |
| 2662 | .num_adapters = 2, | 2492 | .num_adapters = 2, |
| 2663 | .adapter = { | 2493 | .adapter = { |
| @@ -2697,10 +2527,18 @@ struct dvb_usb_device_properties dib0700_devices[] = { | |||
| 2697 | }, | 2527 | }, |
| 2698 | }, | 2528 | }, |
| 2699 | 2529 | ||
| 2700 | .rc_interval = DEFAULT_RC_INTERVAL, | 2530 | .rc.core = { |
| 2701 | .rc_key_map = ir_codes_dib0700_table, | 2531 | .rc_interval = DEFAULT_RC_INTERVAL, |
| 2702 | .rc_key_map_size = ARRAY_SIZE(ir_codes_dib0700_table), | 2532 | .rc_codes = RC_MAP_DIB0700_RC5_TABLE, |
| 2703 | .rc_query = dib0700_rc_query | 2533 | .module_name = "dib0700", |
| 2534 | .rc_query = dib0700_rc_query_old_firmware, | ||
| 2535 | .rc_props = { | ||
| 2536 | .allowed_protos = IR_TYPE_RC5 | | ||
| 2537 | IR_TYPE_RC6 | | ||
| 2538 | IR_TYPE_NEC, | ||
| 2539 | .change_protocol = dib0700_change_protocol, | ||
| 2540 | }, | ||
| 2541 | }, | ||
| 2704 | }, { DIB0700_DEFAULT_DEVICE_PROPERTIES, | 2542 | }, { DIB0700_DEFAULT_DEVICE_PROPERTIES, |
| 2705 | .num_adapters = 1, | 2543 | .num_adapters = 1, |
| 2706 | .adapter = { | 2544 | .adapter = { |
| @@ -2728,10 +2566,18 @@ struct dvb_usb_device_properties dib0700_devices[] = { | |||
| 2728 | }, | 2566 | }, |
| 2729 | }, | 2567 | }, |
| 2730 | 2568 | ||
| 2731 | .rc_interval = DEFAULT_RC_INTERVAL, | 2569 | .rc.core = { |
| 2732 | .rc_key_map = ir_codes_dib0700_table, | 2570 | .rc_interval = DEFAULT_RC_INTERVAL, |
| 2733 | .rc_key_map_size = ARRAY_SIZE(ir_codes_dib0700_table), | 2571 | .rc_codes = RC_MAP_DIB0700_RC5_TABLE, |
| 2734 | .rc_query = dib0700_rc_query | 2572 | .module_name = "dib0700", |
| 2573 | .rc_query = dib0700_rc_query_old_firmware, | ||
| 2574 | .rc_props = { | ||
| 2575 | .allowed_protos = IR_TYPE_RC5 | | ||
| 2576 | IR_TYPE_RC6 | | ||
| 2577 | IR_TYPE_NEC, | ||
| 2578 | .change_protocol = dib0700_change_protocol, | ||
| 2579 | }, | ||
| 2580 | }, | ||
| 2735 | }, | 2581 | }, |
| 2736 | }; | 2582 | }; |
| 2737 | 2583 | ||
diff --git a/drivers/media/dvb/dvb-usb/dibusb-common.c b/drivers/media/dvb/dvb-usb/dibusb-common.c index bc08bc0b723..ba991aa21af 100644 --- a/drivers/media/dvb/dvb-usb/dibusb-common.c +++ b/drivers/media/dvb/dvb-usb/dibusb-common.c | |||
| @@ -327,7 +327,7 @@ EXPORT_SYMBOL(dibusb_dib3000mc_tuner_attach); | |||
| 327 | /* | 327 | /* |
| 328 | * common remote control stuff | 328 | * common remote control stuff |
| 329 | */ | 329 | */ |
| 330 | struct dvb_usb_rc_key ir_codes_dibusb_table[] = { | 330 | struct ir_scancode ir_codes_dibusb_table[] = { |
| 331 | /* Key codes for the little Artec T1/Twinhan/HAMA/ remote. */ | 331 | /* Key codes for the little Artec T1/Twinhan/HAMA/ remote. */ |
| 332 | { 0x0016, KEY_POWER }, | 332 | { 0x0016, KEY_POWER }, |
| 333 | { 0x0010, KEY_MUTE }, | 333 | { 0x0010, KEY_MUTE }, |
diff --git a/drivers/media/dvb/dvb-usb/dibusb-mb.c b/drivers/media/dvb/dvb-usb/dibusb-mb.c index eb2e6f050fb..8e3c0d2cce1 100644 --- a/drivers/media/dvb/dvb-usb/dibusb-mb.c +++ b/drivers/media/dvb/dvb-usb/dibusb-mb.c | |||
| @@ -211,10 +211,12 @@ static struct dvb_usb_device_properties dibusb1_1_properties = { | |||
| 211 | 211 | ||
| 212 | .power_ctrl = dibusb_power_ctrl, | 212 | .power_ctrl = dibusb_power_ctrl, |
| 213 | 213 | ||
| 214 | .rc_interval = DEFAULT_RC_INTERVAL, | 214 | .rc.legacy = { |
| 215 | .rc_key_map = ir_codes_dibusb_table, | 215 | .rc_interval = DEFAULT_RC_INTERVAL, |
| 216 | .rc_key_map_size = 111, /* wow, that is ugly ... I want to load it to the driver dynamically */ | 216 | .rc_key_map = ir_codes_dibusb_table, |
| 217 | .rc_query = dibusb_rc_query, | 217 | .rc_key_map_size = 111, /* wow, that is ugly ... I want to load it to the driver dynamically */ |
| 218 | .rc_query = dibusb_rc_query, | ||
| 219 | }, | ||
| 218 | 220 | ||
| 219 | .i2c_algo = &dibusb_i2c_algo, | 221 | .i2c_algo = &dibusb_i2c_algo, |
| 220 | 222 | ||
| @@ -295,10 +297,12 @@ static struct dvb_usb_device_properties dibusb1_1_an2235_properties = { | |||
| 295 | }, | 297 | }, |
| 296 | .power_ctrl = dibusb_power_ctrl, | 298 | .power_ctrl = dibusb_power_ctrl, |
| 297 | 299 | ||
| 298 | .rc_interval = DEFAULT_RC_INTERVAL, | 300 | .rc.legacy = { |
| 299 | .rc_key_map = ir_codes_dibusb_table, | 301 | .rc_interval = DEFAULT_RC_INTERVAL, |
| 300 | .rc_key_map_size = 111, /* wow, that is ugly ... I want to load it to the driver dynamically */ | 302 | .rc_key_map = ir_codes_dibusb_table, |
| 301 | .rc_query = dibusb_rc_query, | 303 | .rc_key_map_size = 111, /* wow, that is ugly ... I want to load it to the driver dynamically */ |
| 304 | .rc_query = dibusb_rc_query, | ||
| 305 | }, | ||
| 302 | 306 | ||
| 303 | .i2c_algo = &dibusb_i2c_algo, | 307 | .i2c_algo = &dibusb_i2c_algo, |
| 304 | 308 | ||
| @@ -359,10 +363,12 @@ static struct dvb_usb_device_properties dibusb2_0b_properties = { | |||
| 359 | }, | 363 | }, |
| 360 | .power_ctrl = dibusb2_0_power_ctrl, | 364 | .power_ctrl = dibusb2_0_power_ctrl, |
| 361 | 365 | ||
| 362 | .rc_interval = DEFAULT_RC_INTERVAL, | 366 | .rc.legacy = { |
| 363 | .rc_key_map = ir_codes_dibusb_table, | 367 | .rc_interval = DEFAULT_RC_INTERVAL, |
| 364 | .rc_key_map_size = 111, /* wow, that is ugly ... I want to load it to the driver dynamically */ | 368 | .rc_key_map = ir_codes_dibusb_table, |
| 365 | .rc_query = dibusb_rc_query, | 369 | .rc_key_map_size = 111, /* wow, that is ugly ... I want to load it to the driver dynamically */ |
| 370 | .rc_query = dibusb_rc_query, | ||
| 371 | }, | ||
| 366 | 372 | ||
| 367 | .i2c_algo = &dibusb_i2c_algo, | 373 | .i2c_algo = &dibusb_i2c_algo, |
| 368 | 374 | ||
| @@ -416,10 +422,12 @@ static struct dvb_usb_device_properties artec_t1_usb2_properties = { | |||
| 416 | }, | 422 | }, |
| 417 | .power_ctrl = dibusb2_0_power_ctrl, | 423 | .power_ctrl = dibusb2_0_power_ctrl, |
| 418 | 424 | ||
| 419 | .rc_interval = DEFAULT_RC_INTERVAL, | 425 | .rc.legacy = { |
| 420 | .rc_key_map = ir_codes_dibusb_table, | 426 | .rc_interval = DEFAULT_RC_INTERVAL, |
| 421 | .rc_key_map_size = 111, /* wow, that is ugly ... I want to load it to the driver dynamically */ | 427 | .rc_key_map = ir_codes_dibusb_table, |
| 422 | .rc_query = dibusb_rc_query, | 428 | .rc_key_map_size = 111, /* wow, that is ugly ... I want to load it to the driver dynamically */ |
| 429 | .rc_query = dibusb_rc_query, | ||
| 430 | }, | ||
| 423 | 431 | ||
| 424 | .i2c_algo = &dibusb_i2c_algo, | 432 | .i2c_algo = &dibusb_i2c_algo, |
| 425 | 433 | ||
diff --git a/drivers/media/dvb/dvb-usb/dibusb-mc.c b/drivers/media/dvb/dvb-usb/dibusb-mc.c index 588308eb663..1cbc41cb4e8 100644 --- a/drivers/media/dvb/dvb-usb/dibusb-mc.c +++ b/drivers/media/dvb/dvb-usb/dibusb-mc.c | |||
| @@ -81,10 +81,12 @@ static struct dvb_usb_device_properties dibusb_mc_properties = { | |||
| 81 | }, | 81 | }, |
| 82 | .power_ctrl = dibusb2_0_power_ctrl, | 82 | .power_ctrl = dibusb2_0_power_ctrl, |
| 83 | 83 | ||
| 84 | .rc_interval = DEFAULT_RC_INTERVAL, | 84 | .rc.legacy = { |
| 85 | .rc_key_map = ir_codes_dibusb_table, | 85 | .rc_interval = DEFAULT_RC_INTERVAL, |
| 86 | .rc_key_map_size = 111, /* FIXME */ | 86 | .rc_key_map = ir_codes_dibusb_table, |
| 87 | .rc_query = dibusb_rc_query, | 87 | .rc_key_map_size = 111, /* FIXME */ |
| 88 | .rc_query = dibusb_rc_query, | ||
| 89 | }, | ||
| 88 | 90 | ||
| 89 | .i2c_algo = &dibusb_i2c_algo, | 91 | .i2c_algo = &dibusb_i2c_algo, |
| 90 | 92 | ||
diff --git a/drivers/media/dvb/dvb-usb/dibusb.h b/drivers/media/dvb/dvb-usb/dibusb.h index 3d50ac59088..61a6bf38947 100644 --- a/drivers/media/dvb/dvb-usb/dibusb.h +++ b/drivers/media/dvb/dvb-usb/dibusb.h | |||
| @@ -124,7 +124,7 @@ extern int dibusb2_0_power_ctrl(struct dvb_usb_device *, int); | |||
| 124 | #define DEFAULT_RC_INTERVAL 150 | 124 | #define DEFAULT_RC_INTERVAL 150 |
| 125 | //#define DEFAULT_RC_INTERVAL 100000 | 125 | //#define DEFAULT_RC_INTERVAL 100000 |
| 126 | 126 | ||
| 127 | extern struct dvb_usb_rc_key ir_codes_dibusb_table[]; | 127 | extern struct ir_scancode ir_codes_dibusb_table[]; |
| 128 | extern int dibusb_rc_query(struct dvb_usb_device *, u32 *, int *); | 128 | extern int dibusb_rc_query(struct dvb_usb_device *, u32 *, int *); |
| 129 | extern int dibusb_read_eeprom_byte(struct dvb_usb_device *, u8, u8 *); | 129 | extern int dibusb_read_eeprom_byte(struct dvb_usb_device *, u8, u8 *); |
| 130 | 130 | ||
diff --git a/drivers/media/dvb/dvb-usb/digitv.c b/drivers/media/dvb/dvb-usb/digitv.c index e826077094f..13d006bb19d 100644 --- a/drivers/media/dvb/dvb-usb/digitv.c +++ b/drivers/media/dvb/dvb-usb/digitv.c | |||
| @@ -161,7 +161,7 @@ static int digitv_tuner_attach(struct dvb_usb_adapter *adap) | |||
| 161 | return 0; | 161 | return 0; |
| 162 | } | 162 | } |
| 163 | 163 | ||
| 164 | static struct dvb_usb_rc_key ir_codes_digitv_table[] = { | 164 | static struct ir_scancode ir_codes_digitv_table[] = { |
| 165 | { 0x5f55, KEY_0 }, | 165 | { 0x5f55, KEY_0 }, |
| 166 | { 0x6f55, KEY_1 }, | 166 | { 0x6f55, KEY_1 }, |
| 167 | { 0x9f55, KEY_2 }, | 167 | { 0x9f55, KEY_2 }, |
| @@ -237,10 +237,10 @@ static int digitv_rc_query(struct dvb_usb_device *d, u32 *event, int *state) | |||
| 237 | /* if something is inside the buffer, simulate key press */ | 237 | /* if something is inside the buffer, simulate key press */ |
| 238 | if (key[1] != 0) | 238 | if (key[1] != 0) |
| 239 | { | 239 | { |
| 240 | for (i = 0; i < d->props.rc_key_map_size; i++) { | 240 | for (i = 0; i < d->props.rc.legacy.rc_key_map_size; i++) { |
| 241 | if (rc5_custom(&d->props.rc_key_map[i]) == key[1] && | 241 | if (rc5_custom(&d->props.rc.legacy.rc_key_map[i]) == key[1] && |
| 242 | rc5_data(&d->props.rc_key_map[i]) == key[2]) { | 242 | rc5_data(&d->props.rc.legacy.rc_key_map[i]) == key[2]) { |
| 243 | *event = d->props.rc_key_map[i].event; | 243 | *event = d->props.rc.legacy.rc_key_map[i].keycode; |
| 244 | *state = REMOTE_KEY_PRESSED; | 244 | *state = REMOTE_KEY_PRESSED; |
| 245 | return 0; | 245 | return 0; |
| 246 | } | 246 | } |
| @@ -310,10 +310,12 @@ static struct dvb_usb_device_properties digitv_properties = { | |||
| 310 | }, | 310 | }, |
| 311 | .identify_state = digitv_identify_state, | 311 | .identify_state = digitv_identify_state, |
| 312 | 312 | ||
| 313 | .rc_interval = 1000, | 313 | .rc.legacy = { |
| 314 | .rc_key_map = ir_codes_digitv_table, | 314 | .rc_interval = 1000, |
| 315 | .rc_key_map_size = ARRAY_SIZE(ir_codes_digitv_table), | 315 | .rc_key_map = ir_codes_digitv_table, |
| 316 | .rc_query = digitv_rc_query, | 316 | .rc_key_map_size = ARRAY_SIZE(ir_codes_digitv_table), |
| 317 | .rc_query = digitv_rc_query, | ||
| 318 | }, | ||
| 317 | 319 | ||
| 318 | .i2c_algo = &digitv_i2c_algo, | 320 | .i2c_algo = &digitv_i2c_algo, |
| 319 | 321 | ||
diff --git a/drivers/media/dvb/dvb-usb/dtt200u.c b/drivers/media/dvb/dvb-usb/dtt200u.c index f57e59044d4..ca495e07f35 100644 --- a/drivers/media/dvb/dvb-usb/dtt200u.c +++ b/drivers/media/dvb/dvb-usb/dtt200u.c | |||
| @@ -57,7 +57,7 @@ static int dtt200u_pid_filter(struct dvb_usb_adapter *adap, int index, u16 pid, | |||
| 57 | 57 | ||
| 58 | /* remote control */ | 58 | /* remote control */ |
| 59 | /* key list for the tiny remote control (Yakumo, don't know about the others) */ | 59 | /* key list for the tiny remote control (Yakumo, don't know about the others) */ |
| 60 | static struct dvb_usb_rc_key ir_codes_dtt200u_table[] = { | 60 | static struct ir_scancode ir_codes_dtt200u_table[] = { |
| 61 | { 0x8001, KEY_MUTE }, | 61 | { 0x8001, KEY_MUTE }, |
| 62 | { 0x8002, KEY_CHANNELDOWN }, | 62 | { 0x8002, KEY_CHANNELDOWN }, |
| 63 | { 0x8003, KEY_VOLUMEDOWN }, | 63 | { 0x8003, KEY_VOLUMEDOWN }, |
| @@ -161,10 +161,12 @@ static struct dvb_usb_device_properties dtt200u_properties = { | |||
| 161 | }, | 161 | }, |
| 162 | .power_ctrl = dtt200u_power_ctrl, | 162 | .power_ctrl = dtt200u_power_ctrl, |
| 163 | 163 | ||
| 164 | .rc_interval = 300, | 164 | .rc.legacy = { |
| 165 | .rc_key_map = ir_codes_dtt200u_table, | 165 | .rc_interval = 300, |
| 166 | .rc_key_map_size = ARRAY_SIZE(ir_codes_dtt200u_table), | 166 | .rc_key_map = ir_codes_dtt200u_table, |
| 167 | .rc_query = dtt200u_rc_query, | 167 | .rc_key_map_size = ARRAY_SIZE(ir_codes_dtt200u_table), |
| 168 | .rc_query = dtt200u_rc_query, | ||
| 169 | }, | ||
| 168 | 170 | ||
| 169 | .generic_bulk_ctrl_endpoint = 0x01, | 171 | .generic_bulk_ctrl_endpoint = 0x01, |
| 170 | 172 | ||
| @@ -206,10 +208,12 @@ static struct dvb_usb_device_properties wt220u_properties = { | |||
| 206 | }, | 208 | }, |
| 207 | .power_ctrl = dtt200u_power_ctrl, | 209 | .power_ctrl = dtt200u_power_ctrl, |
| 208 | 210 | ||
| 209 | .rc_interval = 300, | 211 | .rc.legacy = { |
| 210 | .rc_key_map = ir_codes_dtt200u_table, | 212 | .rc_interval = 300, |
| 211 | .rc_key_map_size = ARRAY_SIZE(ir_codes_dtt200u_table), | 213 | .rc_key_map = ir_codes_dtt200u_table, |
| 212 | .rc_query = dtt200u_rc_query, | 214 | .rc_key_map_size = ARRAY_SIZE(ir_codes_dtt200u_table), |
| 215 | .rc_query = dtt200u_rc_query, | ||
| 216 | }, | ||
| 213 | 217 | ||
| 214 | .generic_bulk_ctrl_endpoint = 0x01, | 218 | .generic_bulk_ctrl_endpoint = 0x01, |
| 215 | 219 | ||
| @@ -251,10 +255,12 @@ static struct dvb_usb_device_properties wt220u_fc_properties = { | |||
| 251 | }, | 255 | }, |
| 252 | .power_ctrl = dtt200u_power_ctrl, | 256 | .power_ctrl = dtt200u_power_ctrl, |
| 253 | 257 | ||
| 254 | .rc_interval = 300, | 258 | .rc.legacy = { |
| 255 | .rc_key_map = ir_codes_dtt200u_table, | 259 | .rc_interval = 300, |
| 256 | .rc_key_map_size = ARRAY_SIZE(ir_codes_dtt200u_table), | 260 | .rc_key_map = ir_codes_dtt200u_table, |
| 257 | .rc_query = dtt200u_rc_query, | 261 | .rc_key_map_size = ARRAY_SIZE(ir_codes_dtt200u_table), |
| 262 | .rc_query = dtt200u_rc_query, | ||
| 263 | }, | ||
| 258 | 264 | ||
| 259 | .generic_bulk_ctrl_endpoint = 0x01, | 265 | .generic_bulk_ctrl_endpoint = 0x01, |
| 260 | 266 | ||
| @@ -296,10 +302,12 @@ static struct dvb_usb_device_properties wt220u_zl0353_properties = { | |||
| 296 | }, | 302 | }, |
| 297 | .power_ctrl = dtt200u_power_ctrl, | 303 | .power_ctrl = dtt200u_power_ctrl, |
| 298 | 304 | ||
| 299 | .rc_interval = 300, | 305 | .rc.legacy = { |
| 300 | .rc_key_map = ir_codes_dtt200u_table, | 306 | .rc_interval = 300, |
| 301 | .rc_key_map_size = ARRAY_SIZE(ir_codes_dtt200u_table), | 307 | .rc_key_map = ir_codes_dtt200u_table, |
| 302 | .rc_query = dtt200u_rc_query, | 308 | .rc_key_map_size = ARRAY_SIZE(ir_codes_dtt200u_table), |
| 309 | .rc_query = dtt200u_rc_query, | ||
| 310 | }, | ||
| 303 | 311 | ||
| 304 | .generic_bulk_ctrl_endpoint = 0x01, | 312 | .generic_bulk_ctrl_endpoint = 0x01, |
| 305 | 313 | ||
diff --git a/drivers/media/dvb/dvb-usb/dvb-usb-ids.h b/drivers/media/dvb/dvb-usb/dvb-usb-ids.h index b4afe6f8ed1..1a774d58d66 100644 --- a/drivers/media/dvb/dvb-usb/dvb-usb-ids.h +++ b/drivers/media/dvb/dvb-usb/dvb-usb-ids.h | |||
| @@ -197,6 +197,7 @@ | |||
| 197 | #define USB_PID_AVERMEDIA_A310 0xa310 | 197 | #define USB_PID_AVERMEDIA_A310 0xa310 |
| 198 | #define USB_PID_AVERMEDIA_A850 0x850a | 198 | #define USB_PID_AVERMEDIA_A850 0x850a |
| 199 | #define USB_PID_AVERMEDIA_A805 0xa805 | 199 | #define USB_PID_AVERMEDIA_A805 0xa805 |
| 200 | #define USB_PID_AVERMEDIA_A815M 0x815a | ||
| 200 | #define USB_PID_TECHNOTREND_CONNECT_S2400 0x3006 | 201 | #define USB_PID_TECHNOTREND_CONNECT_S2400 0x3006 |
| 201 | #define USB_PID_TECHNOTREND_CONNECT_CT3650 0x300d | 202 | #define USB_PID_TECHNOTREND_CONNECT_CT3650 0x300d |
| 202 | #define USB_PID_TERRATEC_CINERGY_DT_XS_DIVERSITY 0x005a | 203 | #define USB_PID_TERRATEC_CINERGY_DT_XS_DIVERSITY 0x005a |
diff --git a/drivers/media/dvb/dvb-usb/dvb-usb-init.c b/drivers/media/dvb/dvb-usb/dvb-usb-init.c index 5d91f70d2d2..2e3ea0fa28e 100644 --- a/drivers/media/dvb/dvb-usb/dvb-usb-init.c +++ b/drivers/media/dvb/dvb-usb/dvb-usb-init.c | |||
| @@ -15,7 +15,7 @@ | |||
| 15 | 15 | ||
| 16 | /* debug */ | 16 | /* debug */ |
| 17 | int dvb_usb_debug; | 17 | int dvb_usb_debug; |
| 18 | module_param_named(debug,dvb_usb_debug, int, 0644); | 18 | module_param_named(debug, dvb_usb_debug, int, 0644); |
| 19 | MODULE_PARM_DESC(debug, "set debugging level (1=info,xfer=2,pll=4,ts=8,err=16,rc=32,fw=64,mem=128,uxfer=256 (or-able))." DVB_USB_DEBUG_STATUS); | 19 | MODULE_PARM_DESC(debug, "set debugging level (1=info,xfer=2,pll=4,ts=8,err=16,rc=32,fw=64,mem=128,uxfer=256 (or-able))." DVB_USB_DEBUG_STATUS); |
| 20 | 20 | ||
| 21 | int dvb_usb_disable_rc_polling; | 21 | int dvb_usb_disable_rc_polling; |
| @@ -29,7 +29,7 @@ MODULE_PARM_DESC(force_pid_filter_usage, "force all dvb-usb-devices to use a PID | |||
| 29 | static int dvb_usb_adapter_init(struct dvb_usb_device *d, short *adapter_nrs) | 29 | static int dvb_usb_adapter_init(struct dvb_usb_device *d, short *adapter_nrs) |
| 30 | { | 30 | { |
| 31 | struct dvb_usb_adapter *adap; | 31 | struct dvb_usb_adapter *adap; |
| 32 | int ret,n; | 32 | int ret, n; |
| 33 | 33 | ||
| 34 | for (n = 0; n < d->props.num_adapters; n++) { | 34 | for (n = 0; n < d->props.num_adapters; n++) { |
| 35 | adap = &d->adapter[n]; | 35 | adap = &d->adapter[n]; |
| @@ -38,7 +38,7 @@ static int dvb_usb_adapter_init(struct dvb_usb_device *d, short *adapter_nrs) | |||
| 38 | 38 | ||
| 39 | memcpy(&adap->props, &d->props.adapter[n], sizeof(struct dvb_usb_adapter_properties)); | 39 | memcpy(&adap->props, &d->props.adapter[n], sizeof(struct dvb_usb_adapter_properties)); |
| 40 | 40 | ||
| 41 | /* speed - when running at FULL speed we need a HW PID filter */ | 41 | /* speed - when running at FULL speed we need a HW PID filter */ |
| 42 | if (d->udev->speed == USB_SPEED_FULL && !(adap->props.caps & DVB_USB_ADAP_HAS_PID_FILTER)) { | 42 | if (d->udev->speed == USB_SPEED_FULL && !(adap->props.caps & DVB_USB_ADAP_HAS_PID_FILTER)) { |
| 43 | err("This USB2.0 device cannot be run on a USB1.1 port. (it lacks a hardware PID filter)"); | 43 | err("This USB2.0 device cannot be run on a USB1.1 port. (it lacks a hardware PID filter)"); |
| 44 | return -ENODEV; | 44 | return -ENODEV; |
| @@ -46,7 +46,7 @@ static int dvb_usb_adapter_init(struct dvb_usb_device *d, short *adapter_nrs) | |||
| 46 | 46 | ||
| 47 | if ((d->udev->speed == USB_SPEED_FULL && adap->props.caps & DVB_USB_ADAP_HAS_PID_FILTER) || | 47 | if ((d->udev->speed == USB_SPEED_FULL && adap->props.caps & DVB_USB_ADAP_HAS_PID_FILTER) || |
| 48 | (adap->props.caps & DVB_USB_ADAP_NEED_PID_FILTERING)) { | 48 | (adap->props.caps & DVB_USB_ADAP_NEED_PID_FILTERING)) { |
| 49 | info("will use the device's hardware PID filter (table count: %d).",adap->props.pid_filter_count); | 49 | info("will use the device's hardware PID filter (table count: %d).", adap->props.pid_filter_count); |
| 50 | adap->pid_filtering = 1; | 50 | adap->pid_filtering = 1; |
| 51 | adap->max_feed_count = adap->props.pid_filter_count; | 51 | adap->max_feed_count = adap->props.pid_filter_count; |
| 52 | } else { | 52 | } else { |
| @@ -64,9 +64,9 @@ static int dvb_usb_adapter_init(struct dvb_usb_device *d, short *adapter_nrs) | |||
| 64 | } | 64 | } |
| 65 | 65 | ||
| 66 | if (adap->props.size_of_priv > 0) { | 66 | if (adap->props.size_of_priv > 0) { |
| 67 | adap->priv = kzalloc(adap->props.size_of_priv,GFP_KERNEL); | 67 | adap->priv = kzalloc(adap->props.size_of_priv, GFP_KERNEL); |
| 68 | if (adap->priv == NULL) { | 68 | if (adap->priv == NULL) { |
| 69 | err("no memory for priv for adapter %d.",n); | 69 | err("no memory for priv for adapter %d.", n); |
| 70 | return -ENOMEM; | 70 | return -ENOMEM; |
| 71 | } | 71 | } |
| 72 | } | 72 | } |
| @@ -86,8 +86,8 @@ static int dvb_usb_adapter_init(struct dvb_usb_device *d, short *adapter_nrs) | |||
| 86 | * sometimes a timeout occures, this helps | 86 | * sometimes a timeout occures, this helps |
| 87 | */ | 87 | */ |
| 88 | if (d->props.generic_bulk_ctrl_endpoint != 0) { | 88 | if (d->props.generic_bulk_ctrl_endpoint != 0) { |
| 89 | usb_clear_halt(d->udev,usb_sndbulkpipe(d->udev,d->props.generic_bulk_ctrl_endpoint)); | 89 | usb_clear_halt(d->udev, usb_sndbulkpipe(d->udev, d->props.generic_bulk_ctrl_endpoint)); |
| 90 | usb_clear_halt(d->udev,usb_rcvbulkpipe(d->udev,d->props.generic_bulk_ctrl_endpoint)); | 90 | usb_clear_halt(d->udev, usb_rcvbulkpipe(d->udev, d->props.generic_bulk_ctrl_endpoint)); |
| 91 | } | 91 | } |
| 92 | 92 | ||
| 93 | return 0; | 93 | return 0; |
| @@ -96,6 +96,7 @@ static int dvb_usb_adapter_init(struct dvb_usb_device *d, short *adapter_nrs) | |||
| 96 | static int dvb_usb_adapter_exit(struct dvb_usb_device *d) | 96 | static int dvb_usb_adapter_exit(struct dvb_usb_device *d) |
| 97 | { | 97 | { |
| 98 | int n; | 98 | int n; |
| 99 | |||
| 99 | for (n = 0; n < d->num_adapters_initialized; n++) { | 100 | for (n = 0; n < d->num_adapters_initialized; n++) { |
| 100 | dvb_usb_adapter_frontend_exit(&d->adapter[n]); | 101 | dvb_usb_adapter_frontend_exit(&d->adapter[n]); |
| 101 | dvb_usb_adapter_dvb_exit(&d->adapter[n]); | 102 | dvb_usb_adapter_dvb_exit(&d->adapter[n]); |
| @@ -111,11 +112,11 @@ static int dvb_usb_adapter_exit(struct dvb_usb_device *d) | |||
| 111 | /* general initialization functions */ | 112 | /* general initialization functions */ |
| 112 | static int dvb_usb_exit(struct dvb_usb_device *d) | 113 | static int dvb_usb_exit(struct dvb_usb_device *d) |
| 113 | { | 114 | { |
| 114 | deb_info("state before exiting everything: %x\n",d->state); | 115 | deb_info("state before exiting everything: %x\n", d->state); |
| 115 | dvb_usb_remote_exit(d); | 116 | dvb_usb_remote_exit(d); |
| 116 | dvb_usb_adapter_exit(d); | 117 | dvb_usb_adapter_exit(d); |
| 117 | dvb_usb_i2c_exit(d); | 118 | dvb_usb_i2c_exit(d); |
| 118 | deb_info("state should be zero now: %x\n",d->state); | 119 | deb_info("state should be zero now: %x\n", d->state); |
| 119 | d->state = DVB_USB_STATE_INIT; | 120 | d->state = DVB_USB_STATE_INIT; |
| 120 | kfree(d->priv); | 121 | kfree(d->priv); |
| 121 | kfree(d); | 122 | kfree(d); |
| @@ -132,14 +133,14 @@ static int dvb_usb_init(struct dvb_usb_device *d, short *adapter_nums) | |||
| 132 | d->state = DVB_USB_STATE_INIT; | 133 | d->state = DVB_USB_STATE_INIT; |
| 133 | 134 | ||
| 134 | if (d->props.size_of_priv > 0) { | 135 | if (d->props.size_of_priv > 0) { |
| 135 | d->priv = kzalloc(d->props.size_of_priv,GFP_KERNEL); | 136 | d->priv = kzalloc(d->props.size_of_priv, GFP_KERNEL); |
| 136 | if (d->priv == NULL) { | 137 | if (d->priv == NULL) { |
| 137 | err("no memory for priv in 'struct dvb_usb_device'"); | 138 | err("no memory for priv in 'struct dvb_usb_device'"); |
| 138 | return -ENOMEM; | 139 | return -ENOMEM; |
| 139 | } | 140 | } |
| 140 | } | 141 | } |
| 141 | 142 | ||
| 142 | /* check the capabilities and set appropriate variables */ | 143 | /* check the capabilities and set appropriate variables */ |
| 143 | dvb_usb_device_power_ctrl(d, 1); | 144 | dvb_usb_device_power_ctrl(d, 1); |
| 144 | 145 | ||
| 145 | if ((ret = dvb_usb_i2c_init(d)) || | 146 | if ((ret = dvb_usb_i2c_init(d)) || |
| @@ -157,16 +158,17 @@ static int dvb_usb_init(struct dvb_usb_device *d, short *adapter_nums) | |||
| 157 | } | 158 | } |
| 158 | 159 | ||
| 159 | /* determine the name and the state of the just found USB device */ | 160 | /* determine the name and the state of the just found USB device */ |
| 160 | static struct dvb_usb_device_description * dvb_usb_find_device(struct usb_device *udev,struct dvb_usb_device_properties *props, int *cold) | 161 | static struct dvb_usb_device_description *dvb_usb_find_device(struct usb_device *udev, struct dvb_usb_device_properties *props, int *cold) |
| 161 | { | 162 | { |
| 162 | int i,j; | 163 | int i, j; |
| 163 | struct dvb_usb_device_description *desc = NULL; | 164 | struct dvb_usb_device_description *desc = NULL; |
| 165 | |||
| 164 | *cold = -1; | 166 | *cold = -1; |
| 165 | 167 | ||
| 166 | for (i = 0; i < props->num_device_descs; i++) { | 168 | for (i = 0; i < props->num_device_descs; i++) { |
| 167 | 169 | ||
| 168 | for (j = 0; j < DVB_USB_ID_MAX_NUM && props->devices[i].cold_ids[j] != NULL; j++) { | 170 | for (j = 0; j < DVB_USB_ID_MAX_NUM && props->devices[i].cold_ids[j] != NULL; j++) { |
| 169 | deb_info("check for cold %x %x\n",props->devices[i].cold_ids[j]->idVendor, props->devices[i].cold_ids[j]->idProduct); | 171 | deb_info("check for cold %x %x\n", props->devices[i].cold_ids[j]->idVendor, props->devices[i].cold_ids[j]->idProduct); |
| 170 | if (props->devices[i].cold_ids[j]->idVendor == le16_to_cpu(udev->descriptor.idVendor) && | 172 | if (props->devices[i].cold_ids[j]->idVendor == le16_to_cpu(udev->descriptor.idVendor) && |
| 171 | props->devices[i].cold_ids[j]->idProduct == le16_to_cpu(udev->descriptor.idProduct)) { | 173 | props->devices[i].cold_ids[j]->idProduct == le16_to_cpu(udev->descriptor.idProduct)) { |
| 172 | *cold = 1; | 174 | *cold = 1; |
| @@ -179,7 +181,7 @@ static struct dvb_usb_device_description * dvb_usb_find_device(struct usb_device | |||
| 179 | break; | 181 | break; |
| 180 | 182 | ||
| 181 | for (j = 0; j < DVB_USB_ID_MAX_NUM && props->devices[i].warm_ids[j] != NULL; j++) { | 183 | for (j = 0; j < DVB_USB_ID_MAX_NUM && props->devices[i].warm_ids[j] != NULL; j++) { |
| 182 | deb_info("check for warm %x %x\n",props->devices[i].warm_ids[j]->idVendor, props->devices[i].warm_ids[j]->idProduct); | 184 | deb_info("check for warm %x %x\n", props->devices[i].warm_ids[j]->idVendor, props->devices[i].warm_ids[j]->idProduct); |
| 183 | if (props->devices[i].warm_ids[j]->idVendor == le16_to_cpu(udev->descriptor.idVendor) && | 185 | if (props->devices[i].warm_ids[j]->idVendor == le16_to_cpu(udev->descriptor.idVendor) && |
| 184 | props->devices[i].warm_ids[j]->idProduct == le16_to_cpu(udev->descriptor.idProduct)) { | 186 | props->devices[i].warm_ids[j]->idProduct == le16_to_cpu(udev->descriptor.idProduct)) { |
| 185 | *cold = 0; | 187 | *cold = 0; |
| @@ -190,7 +192,7 @@ static struct dvb_usb_device_description * dvb_usb_find_device(struct usb_device | |||
| 190 | } | 192 | } |
| 191 | 193 | ||
| 192 | if (desc != NULL && props->identify_state != NULL) | 194 | if (desc != NULL && props->identify_state != NULL) |
| 193 | props->identify_state(udev,props,&desc,cold); | 195 | props->identify_state(udev, props, &desc, cold); |
| 194 | 196 | ||
| 195 | return desc; | 197 | return desc; |
| 196 | } | 198 | } |
| @@ -202,7 +204,7 @@ int dvb_usb_device_power_ctrl(struct dvb_usb_device *d, int onoff) | |||
| 202 | else | 204 | else |
| 203 | d->powered--; | 205 | d->powered--; |
| 204 | 206 | ||
| 205 | if (d->powered == 0 || (onoff && d->powered == 1)) { // when switching from 1 to 0 or from 0 to 1 | 207 | if (d->powered == 0 || (onoff && d->powered == 1)) { /* when switching from 1 to 0 or from 0 to 1 */ |
| 206 | deb_info("power control: %d\n", onoff); | 208 | deb_info("power control: %d\n", onoff); |
| 207 | if (d->props.power_ctrl) | 209 | if (d->props.power_ctrl) |
| 208 | return d->props.power_ctrl(d, onoff); | 210 | return d->props.power_ctrl(d, onoff); |
| @@ -222,32 +224,32 @@ int dvb_usb_device_init(struct usb_interface *intf, | |||
| 222 | struct dvb_usb_device *d = NULL; | 224 | struct dvb_usb_device *d = NULL; |
| 223 | struct dvb_usb_device_description *desc = NULL; | 225 | struct dvb_usb_device_description *desc = NULL; |
| 224 | 226 | ||
| 225 | int ret = -ENOMEM,cold=0; | 227 | int ret = -ENOMEM, cold = 0; |
| 226 | 228 | ||
| 227 | if (du != NULL) | 229 | if (du != NULL) |
| 228 | *du = NULL; | 230 | *du = NULL; |
| 229 | 231 | ||
| 230 | if ((desc = dvb_usb_find_device(udev,props,&cold)) == NULL) { | 232 | if ((desc = dvb_usb_find_device(udev, props, &cold)) == NULL) { |
| 231 | deb_err("something went very wrong, device was not found in current device list - let's see what comes next.\n"); | 233 | deb_err("something went very wrong, device was not found in current device list - let's see what comes next.\n"); |
| 232 | return -ENODEV; | 234 | return -ENODEV; |
| 233 | } | 235 | } |
| 234 | 236 | ||
| 235 | if (cold) { | 237 | if (cold) { |
| 236 | info("found a '%s' in cold state, will try to load a firmware",desc->name); | 238 | info("found a '%s' in cold state, will try to load a firmware", desc->name); |
| 237 | ret = dvb_usb_download_firmware(udev,props); | 239 | ret = dvb_usb_download_firmware(udev, props); |
| 238 | if (!props->no_reconnect || ret != 0) | 240 | if (!props->no_reconnect || ret != 0) |
| 239 | return ret; | 241 | return ret; |
| 240 | } | 242 | } |
| 241 | 243 | ||
| 242 | info("found a '%s' in warm state.",desc->name); | 244 | info("found a '%s' in warm state.", desc->name); |
| 243 | d = kzalloc(sizeof(struct dvb_usb_device),GFP_KERNEL); | 245 | d = kzalloc(sizeof(struct dvb_usb_device), GFP_KERNEL); |
| 244 | if (d == NULL) { | 246 | if (d == NULL) { |
| 245 | err("no memory for 'struct dvb_usb_device'"); | 247 | err("no memory for 'struct dvb_usb_device'"); |
| 246 | return -ENOMEM; | 248 | return -ENOMEM; |
| 247 | } | 249 | } |
| 248 | 250 | ||
| 249 | d->udev = udev; | 251 | d->udev = udev; |
| 250 | memcpy(&d->props,props,sizeof(struct dvb_usb_device_properties)); | 252 | memcpy(&d->props, props, sizeof(struct dvb_usb_device_properties)); |
| 251 | d->desc = desc; | 253 | d->desc = desc; |
| 252 | d->owner = owner; | 254 | d->owner = owner; |
| 253 | 255 | ||
| @@ -259,9 +261,9 @@ int dvb_usb_device_init(struct usb_interface *intf, | |||
| 259 | ret = dvb_usb_init(d, adapter_nums); | 261 | ret = dvb_usb_init(d, adapter_nums); |
| 260 | 262 | ||
| 261 | if (ret == 0) | 263 | if (ret == 0) |
| 262 | info("%s successfully initialized and connected.",desc->name); | 264 | info("%s successfully initialized and connected.", desc->name); |
| 263 | else | 265 | else |
| 264 | info("%s error while loading driver (%d)",desc->name,ret); | 266 | info("%s error while loading driver (%d)", desc->name, ret); |
| 265 | return ret; | 267 | return ret; |
| 266 | } | 268 | } |
| 267 | EXPORT_SYMBOL(dvb_usb_device_init); | 269 | EXPORT_SYMBOL(dvb_usb_device_init); |
| @@ -271,12 +273,12 @@ void dvb_usb_device_exit(struct usb_interface *intf) | |||
| 271 | struct dvb_usb_device *d = usb_get_intfdata(intf); | 273 | struct dvb_usb_device *d = usb_get_intfdata(intf); |
| 272 | const char *name = "generic DVB-USB module"; | 274 | const char *name = "generic DVB-USB module"; |
| 273 | 275 | ||
| 274 | usb_set_intfdata(intf,NULL); | 276 | usb_set_intfdata(intf, NULL); |
| 275 | if (d != NULL && d->desc != NULL) { | 277 | if (d != NULL && d->desc != NULL) { |
| 276 | name = d->desc->name; | 278 | name = d->desc->name; |
| 277 | dvb_usb_exit(d); | 279 | dvb_usb_exit(d); |
| 278 | } | 280 | } |
| 279 | info("%s successfully deinitialized and disconnected.",name); | 281 | info("%s successfully deinitialized and disconnected.", name); |
| 280 | 282 | ||
| 281 | } | 283 | } |
| 282 | EXPORT_SYMBOL(dvb_usb_device_exit); | 284 | EXPORT_SYMBOL(dvb_usb_device_exit); |
diff --git a/drivers/media/dvb/dvb-usb/dvb-usb-remote.c b/drivers/media/dvb/dvb-usb/dvb-usb-remote.c index 852fe89539c..b579fed3ab3 100644 --- a/drivers/media/dvb/dvb-usb/dvb-usb-remote.c +++ b/drivers/media/dvb/dvb-usb/dvb-usb-remote.c | |||
| @@ -8,29 +8,29 @@ | |||
| 8 | #include "dvb-usb-common.h" | 8 | #include "dvb-usb-common.h" |
| 9 | #include <linux/usb/input.h> | 9 | #include <linux/usb/input.h> |
| 10 | 10 | ||
| 11 | static int dvb_usb_getkeycode(struct input_dev *dev, | 11 | static int legacy_dvb_usb_getkeycode(struct input_dev *dev, |
| 12 | unsigned int scancode, unsigned int *keycode) | 12 | unsigned int scancode, unsigned int *keycode) |
| 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 dvb_usb_rc_key *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].scan == scancode) { | 21 | if (keymap[i].scancode == scancode) { |
| 22 | *keycode = keymap[i].event; | 22 | *keycode = keymap[i].keycode; |
| 23 | return 0; | 23 | return 0; |
| 24 | } | 24 | } |
| 25 | 25 | ||
| 26 | /* | 26 | /* |
| 27 | * If is there extra space, returns KEY_RESERVED, | 27 | * If is there extra space, returns KEY_RESERVED, |
| 28 | * otherwise, input core won't let dvb_usb_setkeycode | 28 | * otherwise, input core won't let legacy_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].event == KEY_RESERVED || | 32 | if (keymap[i].keycode == KEY_RESERVED || |
| 33 | keymap[i].event == KEY_UNKNOWN) { | 33 | keymap[i].keycode == KEY_UNKNOWN) { |
| 34 | *keycode = KEY_RESERVED; | 34 | *keycode = KEY_RESERVED; |
| 35 | return 0; | 35 | return 0; |
| 36 | } | 36 | } |
| @@ -38,27 +38,27 @@ static int dvb_usb_getkeycode(struct input_dev *dev, | |||
| 38 | return -EINVAL; | 38 | return -EINVAL; |
| 39 | } | 39 | } |
| 40 | 40 | ||
| 41 | static int dvb_usb_setkeycode(struct input_dev *dev, | 41 | static int legacy_dvb_usb_setkeycode(struct input_dev *dev, |
| 42 | unsigned int scancode, unsigned int keycode) | 42 | unsigned int scancode, unsigned int keycode) |
| 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 dvb_usb_rc_key *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].scan == scancode) { | 51 | if (keymap[i].scancode == scancode) { |
| 52 | keymap[i].event = 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].event == KEY_RESERVED || | 58 | if (keymap[i].keycode == KEY_RESERVED || |
| 59 | keymap[i].event == KEY_UNKNOWN) { | 59 | keymap[i].keycode == KEY_UNKNOWN) { |
| 60 | keymap[i].scan = scancode; | 60 | keymap[i].scancode = scancode; |
| 61 | keymap[i].event = keycode; | 61 | keymap[i].keycode = keycode; |
| 62 | return 0; | 62 | return 0; |
| 63 | } | 63 | } |
| 64 | 64 | ||
| @@ -78,7 +78,7 @@ static int dvb_usb_setkeycode(struct input_dev *dev, | |||
| 78 | * | 78 | * |
| 79 | * TODO: Fix the repeat rate of the input device. | 79 | * TODO: Fix the repeat rate of the input device. |
| 80 | */ | 80 | */ |
| 81 | static void dvb_usb_read_remote_control(struct work_struct *work) | 81 | static void legacy_dvb_usb_read_remote_control(struct work_struct *work) |
| 82 | { | 82 | { |
| 83 | struct dvb_usb_device *d = | 83 | struct dvb_usb_device *d = |
| 84 | container_of(work, struct dvb_usb_device, rc_query_work.work); | 84 | container_of(work, struct dvb_usb_device, rc_query_work.work); |
| @@ -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,18 +151,117 @@ static void dvb_usb_read_remote_control(struct work_struct *work) | |||
| 151 | */ | 151 | */ |
| 152 | 152 | ||
| 153 | schedule: | 153 | schedule: |
| 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 | } | ||
| 156 | |||
| 157 | static int legacy_dvb_usb_remote_init(struct dvb_usb_device *d, | ||
| 158 | struct input_dev *input_dev) | ||
| 159 | { | ||
| 160 | int i, err, rc_interval; | ||
| 161 | |||
| 162 | input_dev->getkeycode = legacy_dvb_usb_getkeycode; | ||
| 163 | input_dev->setkeycode = legacy_dvb_usb_setkeycode; | ||
| 164 | |||
| 165 | /* set the bits for the keys */ | ||
| 166 | deb_rc("key map size: %d\n", d->props.rc.legacy.rc_key_map_size); | ||
| 167 | for (i = 0; i < d->props.rc.legacy.rc_key_map_size; i++) { | ||
| 168 | deb_rc("setting bit for event %d item %d\n", | ||
| 169 | d->props.rc.legacy.rc_key_map[i].keycode, i); | ||
| 170 | set_bit(d->props.rc.legacy.rc_key_map[i].keycode, input_dev->keybit); | ||
| 171 | } | ||
| 172 | |||
| 173 | /* setting these two values to non-zero, we have to manage key repeats */ | ||
| 174 | input_dev->rep[REP_PERIOD] = d->props.rc.legacy.rc_interval; | ||
| 175 | input_dev->rep[REP_DELAY] = d->props.rc.legacy.rc_interval + 150; | ||
| 176 | |||
| 177 | input_set_drvdata(input_dev, d); | ||
| 178 | |||
| 179 | err = input_register_device(input_dev); | ||
| 180 | if (err) | ||
| 181 | input_free_device(input_dev); | ||
| 182 | |||
| 183 | rc_interval = d->props.rc.legacy.rc_interval; | ||
| 184 | |||
| 185 | INIT_DELAYED_WORK(&d->rc_query_work, legacy_dvb_usb_read_remote_control); | ||
| 186 | |||
| 187 | info("schedule remote query interval to %d msecs.", rc_interval); | ||
| 188 | schedule_delayed_work(&d->rc_query_work, | ||
| 189 | msecs_to_jiffies(rc_interval)); | ||
| 190 | |||
| 191 | d->state |= DVB_USB_STATE_REMOTE; | ||
| 192 | |||
| 193 | return err; | ||
| 194 | } | ||
| 195 | |||
| 196 | /* Remote-control poll function - called every dib->rc_query_interval ms to see | ||
| 197 | * whether the remote control has received anything. | ||
| 198 | * | ||
| 199 | * TODO: Fix the repeat rate of the input device. | ||
| 200 | */ | ||
| 201 | static void dvb_usb_read_remote_control(struct work_struct *work) | ||
| 202 | { | ||
| 203 | struct dvb_usb_device *d = | ||
| 204 | container_of(work, struct dvb_usb_device, rc_query_work.work); | ||
| 205 | int err; | ||
| 206 | |||
| 207 | /* TODO: need a lock here. We can simply skip checking for the remote control | ||
| 208 | if we're busy. */ | ||
| 209 | |||
| 210 | /* when the parameter has been set to 1 via sysfs while the | ||
| 211 | * driver was running, or when bulk mode is enabled after IR init | ||
| 212 | */ | ||
| 213 | if (dvb_usb_disable_rc_polling || d->props.rc.core.bulk_mode) | ||
| 214 | return; | ||
| 215 | |||
| 216 | err = d->props.rc.core.rc_query(d); | ||
| 217 | if (err) | ||
| 218 | err("error %d while querying for an remote control event.", err); | ||
| 219 | |||
| 220 | schedule_delayed_work(&d->rc_query_work, | ||
| 221 | msecs_to_jiffies(d->props.rc.core.rc_interval)); | ||
| 222 | } | ||
| 223 | |||
| 224 | static int rc_core_dvb_usb_remote_init(struct dvb_usb_device *d, | ||
| 225 | struct input_dev *input_dev) | ||
| 226 | { | ||
| 227 | int err, rc_interval; | ||
| 228 | |||
| 229 | d->props.rc.core.rc_props.priv = d; | ||
| 230 | err = ir_input_register(input_dev, | ||
| 231 | d->props.rc.core.rc_codes, | ||
| 232 | &d->props.rc.core.rc_props, | ||
| 233 | d->props.rc.core.module_name); | ||
| 234 | if (err < 0) | ||
| 235 | return err; | ||
| 236 | |||
| 237 | if (!d->props.rc.core.rc_query || d->props.rc.core.bulk_mode) | ||
| 238 | return 0; | ||
| 239 | |||
| 240 | /* Polling mode - initialize a work queue for handling it */ | ||
| 241 | INIT_DELAYED_WORK(&d->rc_query_work, dvb_usb_read_remote_control); | ||
| 242 | |||
| 243 | rc_interval = d->props.rc.core.rc_interval; | ||
| 244 | |||
| 245 | info("schedule remote query interval to %d msecs.", rc_interval); | ||
| 246 | schedule_delayed_work(&d->rc_query_work, | ||
| 247 | msecs_to_jiffies(rc_interval)); | ||
| 248 | |||
| 249 | return 0; | ||
| 155 | } | 250 | } |
| 156 | 251 | ||
| 157 | int dvb_usb_remote_init(struct dvb_usb_device *d) | 252 | int dvb_usb_remote_init(struct dvb_usb_device *d) |
| 158 | { | 253 | { |
| 159 | struct input_dev *input_dev; | 254 | struct input_dev *input_dev; |
| 160 | int i; | ||
| 161 | int err; | 255 | int err; |
| 162 | 256 | ||
| 163 | if (d->props.rc_key_map == NULL || | 257 | if (dvb_usb_disable_rc_polling) |
| 164 | d->props.rc_query == NULL || | 258 | return 0; |
| 165 | dvb_usb_disable_rc_polling) | 259 | |
| 260 | if (d->props.rc.legacy.rc_key_map && d->props.rc.legacy.rc_query) | ||
| 261 | d->props.rc.mode = DVB_RC_LEGACY; | ||
| 262 | else if (d->props.rc.core.rc_codes) | ||
| 263 | d->props.rc.mode = DVB_RC_CORE; | ||
| 264 | else | ||
| 166 | return 0; | 265 | return 0; |
| 167 | 266 | ||
| 168 | usb_make_path(d->udev, d->rc_phys, sizeof(d->rc_phys)); | 267 | usb_make_path(d->udev, d->rc_phys, sizeof(d->rc_phys)); |
| @@ -177,39 +276,19 @@ int dvb_usb_remote_init(struct dvb_usb_device *d) | |||
| 177 | input_dev->phys = d->rc_phys; | 276 | input_dev->phys = d->rc_phys; |
| 178 | usb_to_input_id(d->udev, &input_dev->id); | 277 | usb_to_input_id(d->udev, &input_dev->id); |
| 179 | input_dev->dev.parent = &d->udev->dev; | 278 | input_dev->dev.parent = &d->udev->dev; |
| 180 | input_dev->getkeycode = dvb_usb_getkeycode; | ||
| 181 | input_dev->setkeycode = dvb_usb_setkeycode; | ||
| 182 | |||
| 183 | /* set the bits for the keys */ | ||
| 184 | deb_rc("key map size: %d\n", d->props.rc_key_map_size); | ||
| 185 | for (i = 0; i < d->props.rc_key_map_size; i++) { | ||
| 186 | deb_rc("setting bit for event %d item %d\n", | ||
| 187 | d->props.rc_key_map[i].event, i); | ||
| 188 | set_bit(d->props.rc_key_map[i].event, input_dev->keybit); | ||
| 189 | } | ||
| 190 | 279 | ||
| 191 | /* Start the remote-control polling. */ | 280 | /* Start the remote-control polling. */ |
| 192 | if (d->props.rc_interval < 40) | 281 | if (d->props.rc.legacy.rc_interval < 40) |
| 193 | d->props.rc_interval = 100; /* default */ | 282 | d->props.rc.legacy.rc_interval = 100; /* default */ |
| 194 | |||
| 195 | /* setting these two values to non-zero, we have to manage key repeats */ | ||
| 196 | input_dev->rep[REP_PERIOD] = d->props.rc_interval; | ||
| 197 | input_dev->rep[REP_DELAY] = d->props.rc_interval + 150; | ||
| 198 | |||
| 199 | input_set_drvdata(input_dev, d); | ||
| 200 | |||
| 201 | err = input_register_device(input_dev); | ||
| 202 | if (err) { | ||
| 203 | input_free_device(input_dev); | ||
| 204 | return err; | ||
| 205 | } | ||
| 206 | 283 | ||
| 207 | d->rc_input_dev = input_dev; | 284 | d->rc_input_dev = input_dev; |
| 208 | 285 | ||
| 209 | INIT_DELAYED_WORK(&d->rc_query_work, dvb_usb_read_remote_control); | 286 | if (d->props.rc.mode == DVB_RC_LEGACY) |
| 210 | 287 | err = legacy_dvb_usb_remote_init(d, input_dev); | |
| 211 | info("schedule remote query interval to %d msecs.", d->props.rc_interval); | 288 | else |
| 212 | schedule_delayed_work(&d->rc_query_work,msecs_to_jiffies(d->props.rc_interval)); | 289 | err = rc_core_dvb_usb_remote_init(d, input_dev); |
| 290 | if (err) | ||
| 291 | return err; | ||
| 213 | 292 | ||
| 214 | d->state |= DVB_USB_STATE_REMOTE; | 293 | d->state |= DVB_USB_STATE_REMOTE; |
| 215 | 294 | ||
| @@ -221,7 +300,10 @@ int dvb_usb_remote_exit(struct dvb_usb_device *d) | |||
| 221 | if (d->state & DVB_USB_STATE_REMOTE) { | 300 | if (d->state & DVB_USB_STATE_REMOTE) { |
| 222 | cancel_rearming_delayed_work(&d->rc_query_work); | 301 | cancel_rearming_delayed_work(&d->rc_query_work); |
| 223 | flush_scheduled_work(); | 302 | flush_scheduled_work(); |
| 224 | input_unregister_device(d->rc_input_dev); | 303 | if (d->props.rc.mode == DVB_RC_LEGACY) |
| 304 | input_unregister_device(d->rc_input_dev); | ||
| 305 | else | ||
| 306 | ir_input_unregister(d->rc_input_dev); | ||
| 225 | } | 307 | } |
| 226 | d->state &= ~DVB_USB_STATE_REMOTE; | 308 | d->state &= ~DVB_USB_STATE_REMOTE; |
| 227 | return 0; | 309 | return 0; |
| @@ -234,7 +316,7 @@ int dvb_usb_nec_rc_key_to_event(struct dvb_usb_device *d, | |||
| 234 | u8 keybuf[5], u32 *event, int *state) | 316 | u8 keybuf[5], u32 *event, int *state) |
| 235 | { | 317 | { |
| 236 | int i; | 318 | int i; |
| 237 | struct dvb_usb_rc_key *keymap = d->props.rc_key_map; | 319 | struct ir_scancode *keymap = d->props.rc.legacy.rc_key_map; |
| 238 | *event = 0; | 320 | *event = 0; |
| 239 | *state = REMOTE_NO_KEY_PRESSED; | 321 | *state = REMOTE_NO_KEY_PRESSED; |
| 240 | switch (keybuf[0]) { | 322 | switch (keybuf[0]) { |
| @@ -247,10 +329,10 @@ int dvb_usb_nec_rc_key_to_event(struct dvb_usb_device *d, | |||
| 247 | break; | 329 | break; |
| 248 | } | 330 | } |
| 249 | /* See if we can match the raw key code. */ | 331 | /* See if we can match the raw key code. */ |
| 250 | for (i = 0; i < d->props.rc_key_map_size; i++) | 332 | for (i = 0; i < d->props.rc.legacy.rc_key_map_size; i++) |
| 251 | if (rc5_custom(&keymap[i]) == keybuf[1] && | 333 | if (rc5_custom(&keymap[i]) == keybuf[1] && |
| 252 | rc5_data(&keymap[i]) == keybuf[3]) { | 334 | rc5_data(&keymap[i]) == keybuf[3]) { |
| 253 | *event = keymap[i].event; | 335 | *event = keymap[i].keycode; |
| 254 | *state = REMOTE_KEY_PRESSED; | 336 | *state = REMOTE_KEY_PRESSED; |
| 255 | return 0; | 337 | return 0; |
| 256 | } | 338 | } |
diff --git a/drivers/media/dvb/dvb-usb/dvb-usb.h b/drivers/media/dvb/dvb-usb/dvb-usb.h index 4a9f676087b..34f7b3ba8cc 100644 --- a/drivers/media/dvb/dvb-usb/dvb-usb.h +++ b/drivers/media/dvb/dvb-usb/dvb-usb.h | |||
| @@ -14,6 +14,7 @@ | |||
| 14 | #include <linux/usb.h> | 14 | #include <linux/usb.h> |
| 15 | #include <linux/firmware.h> | 15 | #include <linux/firmware.h> |
| 16 | #include <linux/mutex.h> | 16 | #include <linux/mutex.h> |
| 17 | #include <media/ir-core.h> | ||
| 17 | 18 | ||
| 18 | #include "dvb_frontend.h" | 19 | #include "dvb_frontend.h" |
| 19 | #include "dvb_demux.h" | 20 | #include "dvb_demux.h" |
| @@ -74,30 +75,19 @@ struct dvb_usb_device_description { | |||
| 74 | struct usb_device_id *warm_ids[DVB_USB_ID_MAX_NUM]; | 75 | struct usb_device_id *warm_ids[DVB_USB_ID_MAX_NUM]; |
| 75 | }; | 76 | }; |
| 76 | 77 | ||
| 77 | /** | 78 | static inline u8 rc5_custom(struct ir_scancode *key) |
| 78 | * struct dvb_usb_rc_key - a remote control key and its input-event | ||
| 79 | * @custom: the vendor/custom part of the key | ||
| 80 | * @data: the actual key part | ||
| 81 | * @event: the input event assigned to key identified by custom and data | ||
| 82 | */ | ||
| 83 | struct dvb_usb_rc_key { | ||
| 84 | u16 scan; | ||
| 85 | u32 event; | ||
| 86 | }; | ||
| 87 | |||
| 88 | static inline u8 rc5_custom(struct dvb_usb_rc_key *key) | ||
| 89 | { | 79 | { |
| 90 | return (key->scan >> 8) & 0xff; | 80 | return (key->scancode >> 8) & 0xff; |
| 91 | } | 81 | } |
| 92 | 82 | ||
| 93 | static inline u8 rc5_data(struct dvb_usb_rc_key *key) | 83 | static inline u8 rc5_data(struct ir_scancode *key) |
| 94 | { | 84 | { |
| 95 | return key->scan & 0xff; | 85 | return key->scancode & 0xff; |
| 96 | } | 86 | } |
| 97 | 87 | ||
| 98 | static inline u8 rc5_scan(struct dvb_usb_rc_key *key) | 88 | static inline u8 rc5_scan(struct ir_scancode *key) |
| 99 | { | 89 | { |
| 100 | return key->scan & 0xffff; | 90 | return key->scancode & 0xffff; |
| 101 | } | 91 | } |
| 102 | 92 | ||
| 103 | struct dvb_usb_device; | 93 | struct dvb_usb_device; |
| @@ -168,6 +158,55 @@ struct dvb_usb_adapter_properties { | |||
| 168 | }; | 158 | }; |
| 169 | 159 | ||
| 170 | /** | 160 | /** |
| 161 | * struct dvb_rc_legacy - old properties of remote controller | ||
| 162 | * @rc_key_map: a hard-wired array of struct ir_scancode (NULL to disable | ||
| 163 | * remote control handling). | ||
| 164 | * @rc_key_map_size: number of items in @rc_key_map. | ||
| 165 | * @rc_query: called to query an event event. | ||
| 166 | * @rc_interval: time in ms between two queries. | ||
| 167 | */ | ||
| 168 | struct dvb_rc_legacy { | ||
| 169 | /* remote control properties */ | ||
| 170 | #define REMOTE_NO_KEY_PRESSED 0x00 | ||
| 171 | #define REMOTE_KEY_PRESSED 0x01 | ||
| 172 | #define REMOTE_KEY_REPEAT 0x02 | ||
| 173 | struct ir_scancode *rc_key_map; | ||
| 174 | int rc_key_map_size; | ||
| 175 | int (*rc_query) (struct dvb_usb_device *, u32 *, int *); | ||
| 176 | int rc_interval; | ||
| 177 | }; | ||
| 178 | |||
| 179 | /** | ||
| 180 | * struct dvb_rc properties of remote controller, using rc-core | ||
| 181 | * @rc_codes: name of rc codes table | ||
| 182 | * @protocol: type of protocol(s) currently used by the driver | ||
| 183 | * @rc_query: called to query an event event. | ||
| 184 | * @rc_interval: time in ms between two queries. | ||
| 185 | * @rc_props: remote controller properties | ||
| 186 | * @bulk_mode: device supports bulk mode for RC (disable polling mode) | ||
| 187 | */ | ||
| 188 | struct dvb_rc { | ||
| 189 | char *rc_codes; | ||
| 190 | u64 protocol; | ||
| 191 | char *module_name; | ||
| 192 | int (*rc_query) (struct dvb_usb_device *d); | ||
| 193 | int rc_interval; | ||
| 194 | struct ir_dev_props rc_props; | ||
| 195 | bool bulk_mode; /* uses bulk mode */ | ||
| 196 | }; | ||
| 197 | |||
| 198 | /** | ||
| 199 | * enum dvb_usb_mode - Specifies if it is using a legacy driver or a new one | ||
| 200 | * based on rc-core | ||
| 201 | * This is initialized/used only inside dvb-usb-remote.c. | ||
| 202 | * It shouldn't be set by the drivers. | ||
| 203 | */ | ||
| 204 | enum dvb_usb_mode { | ||
| 205 | DVB_RC_LEGACY, | ||
| 206 | DVB_RC_CORE, | ||
| 207 | }; | ||
| 208 | |||
| 209 | /** | ||
| 171 | * struct dvb_usb_device_properties - properties of a dvb-usb-device | 210 | * struct dvb_usb_device_properties - properties of a dvb-usb-device |
| 172 | * @usb_ctrl: which USB device-side controller is in use. Needed for firmware | 211 | * @usb_ctrl: which USB device-side controller is in use. Needed for firmware |
| 173 | * download. | 212 | * download. |
| @@ -185,11 +224,7 @@ struct dvb_usb_adapter_properties { | |||
| 185 | * @identify_state: called to determine the state (cold or warm), when it | 224 | * @identify_state: called to determine the state (cold or warm), when it |
| 186 | * is not distinguishable by the USB IDs. | 225 | * is not distinguishable by the USB IDs. |
| 187 | * | 226 | * |
| 188 | * @rc_key_map: a hard-wired array of struct dvb_usb_rc_key (NULL to disable | 227 | * @rc: remote controller properties |
| 189 | * remote control handling). | ||
| 190 | * @rc_key_map_size: number of items in @rc_key_map. | ||
| 191 | * @rc_query: called to query an event event. | ||
| 192 | * @rc_interval: time in ms between two queries. | ||
| 193 | * | 228 | * |
| 194 | * @i2c_algo: i2c_algorithm if the device has I2CoverUSB. | 229 | * @i2c_algo: i2c_algorithm if the device has I2CoverUSB. |
| 195 | * | 230 | * |
| @@ -233,14 +268,11 @@ struct dvb_usb_device_properties { | |||
| 233 | int (*identify_state) (struct usb_device *, struct dvb_usb_device_properties *, | 268 | int (*identify_state) (struct usb_device *, struct dvb_usb_device_properties *, |
| 234 | struct dvb_usb_device_description **, int *); | 269 | struct dvb_usb_device_description **, int *); |
| 235 | 270 | ||
| 236 | /* remote control properties */ | 271 | struct { |
| 237 | #define REMOTE_NO_KEY_PRESSED 0x00 | 272 | enum dvb_usb_mode mode; /* Drivers shouldn't touch on it */ |
| 238 | #define REMOTE_KEY_PRESSED 0x01 | 273 | struct dvb_rc_legacy legacy; |
| 239 | #define REMOTE_KEY_REPEAT 0x02 | 274 | struct dvb_rc core; |
| 240 | struct dvb_usb_rc_key *rc_key_map; | 275 | } rc; |
| 241 | int rc_key_map_size; | ||
| 242 | int (*rc_query) (struct dvb_usb_device *, u32 *, int *); | ||
| 243 | int rc_interval; | ||
| 244 | 276 | ||
| 245 | struct i2c_algorithm *i2c_algo; | 277 | struct i2c_algorithm *i2c_algo; |
| 246 | 278 | ||
diff --git a/drivers/media/dvb/dvb-usb/dw2102.c b/drivers/media/dvb/dvb-usb/dw2102.c index e8fb8538067..774df88dc6e 100644 --- a/drivers/media/dvb/dvb-usb/dw2102.c +++ b/drivers/media/dvb/dvb-usb/dw2102.c | |||
| @@ -74,7 +74,7 @@ | |||
| 74 | "on firmware-problems." | 74 | "on firmware-problems." |
| 75 | 75 | ||
| 76 | struct ir_codes_dvb_usb_table_table { | 76 | struct ir_codes_dvb_usb_table_table { |
| 77 | struct dvb_usb_rc_key *rc_keys; | 77 | struct ir_scancode *rc_keys; |
| 78 | int rc_keys_size; | 78 | int rc_keys_size; |
| 79 | }; | 79 | }; |
| 80 | 80 | ||
| @@ -948,7 +948,7 @@ static int dw3101_tuner_attach(struct dvb_usb_adapter *adap) | |||
| 948 | return 0; | 948 | return 0; |
| 949 | } | 949 | } |
| 950 | 950 | ||
| 951 | static struct dvb_usb_rc_key ir_codes_dw210x_table[] = { | 951 | static struct ir_scancode ir_codes_dw210x_table[] = { |
| 952 | { 0xf80a, KEY_Q }, /*power*/ | 952 | { 0xf80a, KEY_Q }, /*power*/ |
| 953 | { 0xf80c, KEY_M }, /*mute*/ | 953 | { 0xf80c, KEY_M }, /*mute*/ |
| 954 | { 0xf811, KEY_1 }, | 954 | { 0xf811, KEY_1 }, |
| @@ -982,7 +982,7 @@ static struct dvb_usb_rc_key ir_codes_dw210x_table[] = { | |||
| 982 | { 0xf81b, KEY_B }, /*recall*/ | 982 | { 0xf81b, KEY_B }, /*recall*/ |
| 983 | }; | 983 | }; |
| 984 | 984 | ||
| 985 | static struct dvb_usb_rc_key ir_codes_tevii_table[] = { | 985 | static struct ir_scancode ir_codes_tevii_table[] = { |
| 986 | { 0xf80a, KEY_POWER }, | 986 | { 0xf80a, KEY_POWER }, |
| 987 | { 0xf80c, KEY_MUTE }, | 987 | { 0xf80c, KEY_MUTE }, |
| 988 | { 0xf811, KEY_1 }, | 988 | { 0xf811, KEY_1 }, |
| @@ -1032,7 +1032,7 @@ static struct dvb_usb_rc_key ir_codes_tevii_table[] = { | |||
| 1032 | { 0xf858, KEY_SWITCHVIDEOMODE }, | 1032 | { 0xf858, KEY_SWITCHVIDEOMODE }, |
| 1033 | }; | 1033 | }; |
| 1034 | 1034 | ||
| 1035 | static struct dvb_usb_rc_key ir_codes_tbs_table[] = { | 1035 | static struct ir_scancode ir_codes_tbs_table[] = { |
| 1036 | { 0xf884, KEY_POWER }, | 1036 | { 0xf884, KEY_POWER }, |
| 1037 | { 0xf894, KEY_MUTE }, | 1037 | { 0xf894, KEY_MUTE }, |
| 1038 | { 0xf887, KEY_1 }, | 1038 | { 0xf887, KEY_1 }, |
| @@ -1075,8 +1075,8 @@ static struct ir_codes_dvb_usb_table_table keys_tables[] = { | |||
| 1075 | 1075 | ||
| 1076 | static int dw2102_rc_query(struct dvb_usb_device *d, u32 *event, int *state) | 1076 | static int dw2102_rc_query(struct dvb_usb_device *d, u32 *event, int *state) |
| 1077 | { | 1077 | { |
| 1078 | struct dvb_usb_rc_key *keymap = d->props.rc_key_map; | 1078 | struct ir_scancode *keymap = d->props.rc.legacy.rc_key_map; |
| 1079 | int keymap_size = d->props.rc_key_map_size; | 1079 | int keymap_size = d->props.rc.legacy.rc_key_map_size; |
| 1080 | u8 key[2]; | 1080 | u8 key[2]; |
| 1081 | struct i2c_msg msg = { | 1081 | struct i2c_msg msg = { |
| 1082 | .addr = DW2102_RC_QUERY, | 1082 | .addr = DW2102_RC_QUERY, |
| @@ -1096,7 +1096,7 @@ static int dw2102_rc_query(struct dvb_usb_device *d, u32 *event, int *state) | |||
| 1096 | for (i = 0; i < keymap_size ; i++) { | 1096 | for (i = 0; i < keymap_size ; i++) { |
| 1097 | if (rc5_data(&keymap[i]) == msg.buf[0]) { | 1097 | if (rc5_data(&keymap[i]) == msg.buf[0]) { |
| 1098 | *state = REMOTE_KEY_PRESSED; | 1098 | *state = REMOTE_KEY_PRESSED; |
| 1099 | *event = keymap[i].event; | 1099 | *event = keymap[i].keycode; |
| 1100 | break; | 1100 | break; |
| 1101 | } | 1101 | } |
| 1102 | 1102 | ||
| @@ -1185,13 +1185,13 @@ static int dw2102_load_firmware(struct usb_device *dev, | |||
| 1185 | /* init registers */ | 1185 | /* init registers */ |
| 1186 | switch (dev->descriptor.idProduct) { | 1186 | switch (dev->descriptor.idProduct) { |
| 1187 | case USB_PID_PROF_1100: | 1187 | case USB_PID_PROF_1100: |
| 1188 | s6x0_properties.rc_key_map = ir_codes_tbs_table; | 1188 | s6x0_properties.rc.legacy.rc_key_map = ir_codes_tbs_table; |
| 1189 | s6x0_properties.rc_key_map_size = | 1189 | s6x0_properties.rc.legacy.rc_key_map_size = |
| 1190 | ARRAY_SIZE(ir_codes_tbs_table); | 1190 | ARRAY_SIZE(ir_codes_tbs_table); |
| 1191 | break; | 1191 | break; |
| 1192 | case USB_PID_TEVII_S650: | 1192 | case USB_PID_TEVII_S650: |
| 1193 | dw2104_properties.rc_key_map = ir_codes_tevii_table; | 1193 | dw2104_properties.rc.legacy.rc_key_map = ir_codes_tevii_table; |
| 1194 | dw2104_properties.rc_key_map_size = | 1194 | dw2104_properties.rc.legacy.rc_key_map_size = |
| 1195 | ARRAY_SIZE(ir_codes_tevii_table); | 1195 | ARRAY_SIZE(ir_codes_tevii_table); |
| 1196 | case USB_PID_DW2104: | 1196 | case USB_PID_DW2104: |
| 1197 | reset = 1; | 1197 | reset = 1; |
| @@ -1255,10 +1255,13 @@ static struct dvb_usb_device_properties dw2102_properties = { | |||
| 1255 | .no_reconnect = 1, | 1255 | .no_reconnect = 1, |
| 1256 | 1256 | ||
| 1257 | .i2c_algo = &dw2102_serit_i2c_algo, | 1257 | .i2c_algo = &dw2102_serit_i2c_algo, |
| 1258 | .rc_key_map = ir_codes_dw210x_table, | 1258 | |
| 1259 | .rc_key_map_size = ARRAY_SIZE(ir_codes_dw210x_table), | 1259 | .rc.legacy = { |
| 1260 | .rc_interval = 150, | 1260 | .rc_key_map = ir_codes_dw210x_table, |
| 1261 | .rc_query = dw2102_rc_query, | 1261 | .rc_key_map_size = ARRAY_SIZE(ir_codes_dw210x_table), |
| 1262 | .rc_interval = 150, | ||
| 1263 | .rc_query = dw2102_rc_query, | ||
| 1264 | }, | ||
| 1262 | 1265 | ||
| 1263 | .generic_bulk_ctrl_endpoint = 0x81, | 1266 | .generic_bulk_ctrl_endpoint = 0x81, |
| 1264 | /* parameter for the MPEG2-data transfer */ | 1267 | /* parameter for the MPEG2-data transfer */ |
| @@ -1306,10 +1309,12 @@ static struct dvb_usb_device_properties dw2104_properties = { | |||
| 1306 | .no_reconnect = 1, | 1309 | .no_reconnect = 1, |
| 1307 | 1310 | ||
| 1308 | .i2c_algo = &dw2104_i2c_algo, | 1311 | .i2c_algo = &dw2104_i2c_algo, |
| 1309 | .rc_key_map = ir_codes_dw210x_table, | 1312 | .rc.legacy = { |
| 1310 | .rc_key_map_size = ARRAY_SIZE(ir_codes_dw210x_table), | 1313 | .rc_key_map = ir_codes_dw210x_table, |
| 1311 | .rc_interval = 150, | 1314 | .rc_key_map_size = ARRAY_SIZE(ir_codes_dw210x_table), |
| 1312 | .rc_query = dw2102_rc_query, | 1315 | .rc_interval = 150, |
| 1316 | .rc_query = dw2102_rc_query, | ||
| 1317 | }, | ||
| 1313 | 1318 | ||
| 1314 | .generic_bulk_ctrl_endpoint = 0x81, | 1319 | .generic_bulk_ctrl_endpoint = 0x81, |
| 1315 | /* parameter for the MPEG2-data transfer */ | 1320 | /* parameter for the MPEG2-data transfer */ |
| @@ -1353,10 +1358,12 @@ static struct dvb_usb_device_properties dw3101_properties = { | |||
| 1353 | .no_reconnect = 1, | 1358 | .no_reconnect = 1, |
| 1354 | 1359 | ||
| 1355 | .i2c_algo = &dw3101_i2c_algo, | 1360 | .i2c_algo = &dw3101_i2c_algo, |
| 1356 | .rc_key_map = ir_codes_dw210x_table, | 1361 | .rc.legacy = { |
| 1357 | .rc_key_map_size = ARRAY_SIZE(ir_codes_dw210x_table), | 1362 | .rc_key_map = ir_codes_dw210x_table, |
| 1358 | .rc_interval = 150, | 1363 | .rc_key_map_size = ARRAY_SIZE(ir_codes_dw210x_table), |
| 1359 | .rc_query = dw2102_rc_query, | 1364 | .rc_interval = 150, |
| 1365 | .rc_query = dw2102_rc_query, | ||
| 1366 | }, | ||
| 1360 | 1367 | ||
| 1361 | .generic_bulk_ctrl_endpoint = 0x81, | 1368 | .generic_bulk_ctrl_endpoint = 0x81, |
| 1362 | /* parameter for the MPEG2-data transfer */ | 1369 | /* parameter for the MPEG2-data transfer */ |
| @@ -1396,10 +1403,12 @@ static struct dvb_usb_device_properties s6x0_properties = { | |||
| 1396 | .no_reconnect = 1, | 1403 | .no_reconnect = 1, |
| 1397 | 1404 | ||
| 1398 | .i2c_algo = &s6x0_i2c_algo, | 1405 | .i2c_algo = &s6x0_i2c_algo, |
| 1399 | .rc_key_map = ir_codes_tevii_table, | 1406 | .rc.legacy = { |
| 1400 | .rc_key_map_size = ARRAY_SIZE(ir_codes_tevii_table), | 1407 | .rc_key_map = ir_codes_tevii_table, |
| 1401 | .rc_interval = 150, | 1408 | .rc_key_map_size = ARRAY_SIZE(ir_codes_tevii_table), |
| 1402 | .rc_query = dw2102_rc_query, | 1409 | .rc_interval = 150, |
| 1410 | .rc_query = dw2102_rc_query, | ||
| 1411 | }, | ||
| 1403 | 1412 | ||
| 1404 | .generic_bulk_ctrl_endpoint = 0x81, | 1413 | .generic_bulk_ctrl_endpoint = 0x81, |
| 1405 | .num_adapters = 1, | 1414 | .num_adapters = 1, |
| @@ -1459,8 +1468,8 @@ static int dw2102_probe(struct usb_interface *intf, | |||
| 1459 | /* fill only different fields */ | 1468 | /* fill only different fields */ |
| 1460 | p7500->firmware = "dvb-usb-p7500.fw"; | 1469 | p7500->firmware = "dvb-usb-p7500.fw"; |
| 1461 | p7500->devices[0] = d7500; | 1470 | p7500->devices[0] = d7500; |
| 1462 | p7500->rc_key_map = ir_codes_tbs_table; | 1471 | p7500->rc.legacy.rc_key_map = ir_codes_tbs_table; |
| 1463 | p7500->rc_key_map_size = ARRAY_SIZE(ir_codes_tbs_table); | 1472 | p7500->rc.legacy.rc_key_map_size = ARRAY_SIZE(ir_codes_tbs_table); |
| 1464 | p7500->adapter->frontend_attach = prof_7500_frontend_attach; | 1473 | p7500->adapter->frontend_attach = prof_7500_frontend_attach; |
| 1465 | 1474 | ||
| 1466 | if (0 == dvb_usb_device_init(intf, &dw2102_properties, | 1475 | if (0 == dvb_usb_device_init(intf, &dw2102_properties, |
diff --git a/drivers/media/dvb/dvb-usb/gp8psk-fe.c b/drivers/media/dvb/dvb-usb/gp8psk-fe.c index 7a7f1b2b681..dbdb5347b2a 100644 --- a/drivers/media/dvb/dvb-usb/gp8psk-fe.c +++ b/drivers/media/dvb/dvb-usb/gp8psk-fe.c | |||
| @@ -349,7 +349,7 @@ static struct dvb_frontend_ops gp8psk_fe_ops = { | |||
| 349 | * FE_CAN_QAM_16 is for compatibility | 349 | * FE_CAN_QAM_16 is for compatibility |
| 350 | * (Myth incorrectly detects Turbo-QPSK as plain QAM-16) | 350 | * (Myth incorrectly detects Turbo-QPSK as plain QAM-16) |
| 351 | */ | 351 | */ |
| 352 | FE_CAN_QPSK | FE_CAN_QAM_16 | 352 | FE_CAN_QPSK | FE_CAN_QAM_16 | FE_CAN_TURBO_FEC |
| 353 | }, | 353 | }, |
| 354 | 354 | ||
| 355 | .release = gp8psk_fe_release, | 355 | .release = gp8psk_fe_release, |
diff --git a/drivers/media/dvb/dvb-usb/m920x.c b/drivers/media/dvb/dvb-usb/m920x.c index c211fef45fc..bdef1a18b66 100644 --- a/drivers/media/dvb/dvb-usb/m920x.c +++ b/drivers/media/dvb/dvb-usb/m920x.c | |||
| @@ -69,7 +69,7 @@ static int m920x_init(struct dvb_usb_device *d, struct m920x_inits *rc_seq) | |||
| 69 | int adap_enabled[M9206_MAX_ADAPTERS] = { 0 }; | 69 | int adap_enabled[M9206_MAX_ADAPTERS] = { 0 }; |
| 70 | 70 | ||
| 71 | /* Remote controller init. */ | 71 | /* Remote controller init. */ |
| 72 | if (d->props.rc_query) { | 72 | if (d->props.rc.legacy.rc_query) { |
| 73 | deb("Initialising remote control\n"); | 73 | deb("Initialising remote control\n"); |
| 74 | while (rc_seq->address) { | 74 | while (rc_seq->address) { |
| 75 | if ((ret = m920x_write(d->udev, M9206_CORE, | 75 | if ((ret = m920x_write(d->udev, M9206_CORE, |
| @@ -142,9 +142,9 @@ static int m920x_rc_query(struct dvb_usb_device *d, u32 *event, int *state) | |||
| 142 | if ((ret = m920x_read(d->udev, M9206_CORE, 0x0, M9206_RC_KEY, rc_state + 1, 1)) != 0) | 142 | if ((ret = m920x_read(d->udev, M9206_CORE, 0x0, M9206_RC_KEY, rc_state + 1, 1)) != 0) |
| 143 | goto unlock; | 143 | goto unlock; |
| 144 | 144 | ||
| 145 | for (i = 0; i < d->props.rc_key_map_size; i++) | 145 | for (i = 0; i < d->props.rc.legacy.rc_key_map_size; i++) |
| 146 | if (rc5_data(&d->props.rc_key_map[i]) == rc_state[1]) { | 146 | if (rc5_data(&d->props.rc.legacy.rc_key_map[i]) == rc_state[1]) { |
| 147 | *event = d->props.rc_key_map[i].event; | 147 | *event = d->props.rc.legacy.rc_key_map[i].keycode; |
| 148 | 148 | ||
| 149 | switch(rc_state[0]) { | 149 | switch(rc_state[0]) { |
| 150 | case 0x80: | 150 | case 0x80: |
| @@ -589,7 +589,7 @@ static struct m920x_inits pinnacle310e_init[] = { | |||
| 589 | }; | 589 | }; |
| 590 | 590 | ||
| 591 | /* ir keymaps */ | 591 | /* ir keymaps */ |
| 592 | static struct dvb_usb_rc_key ir_codes_megasky_table [] = { | 592 | static struct ir_scancode ir_codes_megasky_table[] = { |
| 593 | { 0x0012, KEY_POWER }, | 593 | { 0x0012, KEY_POWER }, |
| 594 | { 0x001e, KEY_CYCLEWINDOWS }, /* min/max */ | 594 | { 0x001e, KEY_CYCLEWINDOWS }, /* min/max */ |
| 595 | { 0x0002, KEY_CHANNELUP }, | 595 | { 0x0002, KEY_CHANNELUP }, |
| @@ -608,7 +608,7 @@ static struct dvb_usb_rc_key ir_codes_megasky_table [] = { | |||
| 608 | { 0x000e, KEY_COFFEE }, /* "MTS" */ | 608 | { 0x000e, KEY_COFFEE }, /* "MTS" */ |
| 609 | }; | 609 | }; |
| 610 | 610 | ||
| 611 | static struct dvb_usb_rc_key ir_codes_tvwalkertwin_table [] = { | 611 | static struct ir_scancode ir_codes_tvwalkertwin_table[] = { |
| 612 | { 0x0001, KEY_ZOOM }, /* Full Screen */ | 612 | { 0x0001, KEY_ZOOM }, /* Full Screen */ |
| 613 | { 0x0002, KEY_CAMERA }, /* snapshot */ | 613 | { 0x0002, KEY_CAMERA }, /* snapshot */ |
| 614 | { 0x0003, KEY_MUTE }, | 614 | { 0x0003, KEY_MUTE }, |
| @@ -628,7 +628,7 @@ static struct dvb_usb_rc_key ir_codes_tvwalkertwin_table [] = { | |||
| 628 | { 0x001e, KEY_VOLUMEUP }, | 628 | { 0x001e, KEY_VOLUMEUP }, |
| 629 | }; | 629 | }; |
| 630 | 630 | ||
| 631 | static struct dvb_usb_rc_key ir_codes_pinnacle310e_table[] = { | 631 | static struct ir_scancode ir_codes_pinnacle310e_table[] = { |
| 632 | { 0x16, KEY_POWER }, | 632 | { 0x16, KEY_POWER }, |
| 633 | { 0x17, KEY_FAVORITES }, | 633 | { 0x17, KEY_FAVORITES }, |
| 634 | { 0x0f, KEY_TEXT }, | 634 | { 0x0f, KEY_TEXT }, |
| @@ -784,10 +784,12 @@ static struct dvb_usb_device_properties megasky_properties = { | |||
| 784 | .firmware = "dvb-usb-megasky-02.fw", | 784 | .firmware = "dvb-usb-megasky-02.fw", |
| 785 | .download_firmware = m920x_firmware_download, | 785 | .download_firmware = m920x_firmware_download, |
| 786 | 786 | ||
| 787 | .rc_interval = 100, | 787 | .rc.legacy = { |
| 788 | .rc_key_map = ir_codes_megasky_table, | 788 | .rc_interval = 100, |
| 789 | .rc_key_map_size = ARRAY_SIZE(ir_codes_megasky_table), | 789 | .rc_key_map = ir_codes_megasky_table, |
| 790 | .rc_query = m920x_rc_query, | 790 | .rc_key_map_size = ARRAY_SIZE(ir_codes_megasky_table), |
| 791 | .rc_query = m920x_rc_query, | ||
| 792 | }, | ||
| 791 | 793 | ||
| 792 | .size_of_priv = sizeof(struct m920x_state), | 794 | .size_of_priv = sizeof(struct m920x_state), |
| 793 | 795 | ||
| @@ -885,10 +887,12 @@ static struct dvb_usb_device_properties tvwalkertwin_properties = { | |||
| 885 | .firmware = "dvb-usb-tvwalkert.fw", | 887 | .firmware = "dvb-usb-tvwalkert.fw", |
| 886 | .download_firmware = m920x_firmware_download, | 888 | .download_firmware = m920x_firmware_download, |
| 887 | 889 | ||
| 888 | .rc_interval = 100, | 890 | .rc.legacy = { |
| 889 | .rc_key_map = ir_codes_tvwalkertwin_table, | 891 | .rc_interval = 100, |
| 890 | .rc_key_map_size = ARRAY_SIZE(ir_codes_tvwalkertwin_table), | 892 | .rc_key_map = ir_codes_tvwalkertwin_table, |
| 891 | .rc_query = m920x_rc_query, | 893 | .rc_key_map_size = ARRAY_SIZE(ir_codes_tvwalkertwin_table), |
| 894 | .rc_query = m920x_rc_query, | ||
| 895 | }, | ||
| 892 | 896 | ||
| 893 | .size_of_priv = sizeof(struct m920x_state), | 897 | .size_of_priv = sizeof(struct m920x_state), |
| 894 | 898 | ||
| @@ -992,10 +996,12 @@ static struct dvb_usb_device_properties pinnacle_pctv310e_properties = { | |||
| 992 | .usb_ctrl = DEVICE_SPECIFIC, | 996 | .usb_ctrl = DEVICE_SPECIFIC, |
| 993 | .download_firmware = NULL, | 997 | .download_firmware = NULL, |
| 994 | 998 | ||
| 995 | .rc_interval = 100, | 999 | .rc.legacy = { |
| 996 | .rc_key_map = ir_codes_pinnacle310e_table, | 1000 | .rc_interval = 100, |
| 997 | .rc_key_map_size = ARRAY_SIZE(ir_codes_pinnacle310e_table), | 1001 | .rc_key_map = ir_codes_pinnacle310e_table, |
| 998 | .rc_query = m920x_rc_query, | 1002 | .rc_key_map_size = ARRAY_SIZE(ir_codes_pinnacle310e_table), |
| 1003 | .rc_query = m920x_rc_query, | ||
| 1004 | }, | ||
| 999 | 1005 | ||
| 1000 | .size_of_priv = sizeof(struct m920x_state), | 1006 | .size_of_priv = sizeof(struct m920x_state), |
| 1001 | 1007 | ||
diff --git a/drivers/media/dvb/dvb-usb/nova-t-usb2.c b/drivers/media/dvb/dvb-usb/nova-t-usb2.c index d195a587cc6..181f36a12e2 100644 --- a/drivers/media/dvb/dvb-usb/nova-t-usb2.c +++ b/drivers/media/dvb/dvb-usb/nova-t-usb2.c | |||
| @@ -21,7 +21,7 @@ DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr); | |||
| 21 | #define deb_ee(args...) dprintk(debug,0x02,args) | 21 | #define deb_ee(args...) dprintk(debug,0x02,args) |
| 22 | 22 | ||
| 23 | /* Hauppauge NOVA-T USB2 keys */ | 23 | /* Hauppauge NOVA-T USB2 keys */ |
| 24 | static struct dvb_usb_rc_key ir_codes_haupp_table [] = { | 24 | static struct ir_scancode ir_codes_haupp_table[] = { |
| 25 | { 0x1e00, KEY_0 }, | 25 | { 0x1e00, KEY_0 }, |
| 26 | { 0x1e01, KEY_1 }, | 26 | { 0x1e01, KEY_1 }, |
| 27 | { 0x1e02, KEY_2 }, | 27 | { 0x1e02, KEY_2 }, |
| @@ -98,7 +98,7 @@ static int nova_t_rc_query(struct dvb_usb_device *d, u32 *event, int *state) | |||
| 98 | deb_rc("c: %x, d: %x\n", rc5_data(&ir_codes_haupp_table[i]), | 98 | deb_rc("c: %x, d: %x\n", rc5_data(&ir_codes_haupp_table[i]), |
| 99 | rc5_custom(&ir_codes_haupp_table[i])); | 99 | rc5_custom(&ir_codes_haupp_table[i])); |
| 100 | 100 | ||
| 101 | *event = ir_codes_haupp_table[i].event; | 101 | *event = ir_codes_haupp_table[i].keycode; |
| 102 | *state = REMOTE_KEY_PRESSED; | 102 | *state = REMOTE_KEY_PRESSED; |
| 103 | if (st->old_toggle == toggle) { | 103 | if (st->old_toggle == toggle) { |
| 104 | if (st->last_repeat_count++ < 2) | 104 | if (st->last_repeat_count++ < 2) |
| @@ -195,10 +195,12 @@ static struct dvb_usb_device_properties nova_t_properties = { | |||
| 195 | .power_ctrl = dibusb2_0_power_ctrl, | 195 | .power_ctrl = dibusb2_0_power_ctrl, |
| 196 | .read_mac_address = nova_t_read_mac_address, | 196 | .read_mac_address = nova_t_read_mac_address, |
| 197 | 197 | ||
| 198 | .rc_interval = 100, | 198 | .rc.legacy = { |
| 199 | .rc_key_map = ir_codes_haupp_table, | 199 | .rc_interval = 100, |
| 200 | .rc_key_map_size = ARRAY_SIZE(ir_codes_haupp_table), | 200 | .rc_key_map = ir_codes_haupp_table, |
| 201 | .rc_query = nova_t_rc_query, | 201 | .rc_key_map_size = ARRAY_SIZE(ir_codes_haupp_table), |
| 202 | .rc_query = nova_t_rc_query, | ||
| 203 | }, | ||
| 202 | 204 | ||
| 203 | .i2c_algo = &dibusb_i2c_algo, | 205 | .i2c_algo = &dibusb_i2c_algo, |
| 204 | 206 | ||
diff --git a/drivers/media/dvb/dvb-usb/opera1.c b/drivers/media/dvb/dvb-usb/opera1.c index dfb81ff1d9a..6b22ec64ab0 100644 --- a/drivers/media/dvb/dvb-usb/opera1.c +++ b/drivers/media/dvb/dvb-usb/opera1.c | |||
| @@ -331,7 +331,7 @@ static int opera1_pid_filter_control(struct dvb_usb_adapter *adap, int onoff) | |||
| 331 | return 0; | 331 | return 0; |
| 332 | } | 332 | } |
| 333 | 333 | ||
| 334 | static struct dvb_usb_rc_key ir_codes_opera1_table[] = { | 334 | static struct ir_scancode ir_codes_opera1_table[] = { |
| 335 | {0x5fa0, KEY_1}, | 335 | {0x5fa0, KEY_1}, |
| 336 | {0x51af, KEY_2}, | 336 | {0x51af, KEY_2}, |
| 337 | {0x5da2, KEY_3}, | 337 | {0x5da2, KEY_3}, |
| @@ -407,9 +407,9 @@ static int opera1_rc_query(struct dvb_usb_device *dev, u32 * event, int *state) | |||
| 407 | for (i = 0; i < ARRAY_SIZE(ir_codes_opera1_table); i++) { | 407 | for (i = 0; i < ARRAY_SIZE(ir_codes_opera1_table); i++) { |
| 408 | if (rc5_scan(&ir_codes_opera1_table[i]) == (send_key & 0xffff)) { | 408 | if (rc5_scan(&ir_codes_opera1_table[i]) == (send_key & 0xffff)) { |
| 409 | *state = REMOTE_KEY_PRESSED; | 409 | *state = REMOTE_KEY_PRESSED; |
| 410 | *event = ir_codes_opera1_table[i].event; | 410 | *event = ir_codes_opera1_table[i].keycode; |
| 411 | opst->last_key_pressed = | 411 | opst->last_key_pressed = |
| 412 | ir_codes_opera1_table[i].event; | 412 | ir_codes_opera1_table[i].keycode; |
| 413 | break; | 413 | break; |
| 414 | } | 414 | } |
| 415 | opst->last_key_pressed = 0; | 415 | opst->last_key_pressed = 0; |
| @@ -498,10 +498,12 @@ static struct dvb_usb_device_properties opera1_properties = { | |||
| 498 | .power_ctrl = opera1_power_ctrl, | 498 | .power_ctrl = opera1_power_ctrl, |
| 499 | .i2c_algo = &opera1_i2c_algo, | 499 | .i2c_algo = &opera1_i2c_algo, |
| 500 | 500 | ||
| 501 | .rc_key_map = ir_codes_opera1_table, | 501 | .rc.legacy = { |
| 502 | .rc_key_map_size = ARRAY_SIZE(ir_codes_opera1_table), | 502 | .rc_key_map = ir_codes_opera1_table, |
| 503 | .rc_interval = 200, | 503 | .rc_key_map_size = ARRAY_SIZE(ir_codes_opera1_table), |
| 504 | .rc_query = opera1_rc_query, | 504 | .rc_interval = 200, |
| 505 | .rc_query = opera1_rc_query, | ||
| 506 | }, | ||
| 505 | .read_mac_address = opera1_read_mac_address, | 507 | .read_mac_address = opera1_read_mac_address, |
| 506 | .generic_bulk_ctrl_endpoint = 0x00, | 508 | .generic_bulk_ctrl_endpoint = 0x00, |
| 507 | /* parameter for the MPEG2-data transfer */ | 509 | /* parameter for the MPEG2-data transfer */ |
diff --git a/drivers/media/dvb/dvb-usb/vp702x.c b/drivers/media/dvb/dvb-usb/vp702x.c index 4d332451653..5c9f3275aaa 100644 --- a/drivers/media/dvb/dvb-usb/vp702x.c +++ b/drivers/media/dvb/dvb-usb/vp702x.c | |||
| @@ -174,7 +174,7 @@ static int vp702x_streaming_ctrl(struct dvb_usb_adapter *adap, int onoff) | |||
| 174 | } | 174 | } |
| 175 | 175 | ||
| 176 | /* keys for the enclosed remote control */ | 176 | /* keys for the enclosed remote control */ |
| 177 | static struct dvb_usb_rc_key ir_codes_vp702x_table[] = { | 177 | static struct ir_scancode ir_codes_vp702x_table[] = { |
| 178 | { 0x0001, KEY_1 }, | 178 | { 0x0001, KEY_1 }, |
| 179 | { 0x0002, KEY_2 }, | 179 | { 0x0002, KEY_2 }, |
| 180 | }; | 180 | }; |
| @@ -200,7 +200,7 @@ static int vp702x_rc_query(struct dvb_usb_device *d, u32 *event, int *state) | |||
| 200 | for (i = 0; i < ARRAY_SIZE(ir_codes_vp702x_table); i++) | 200 | for (i = 0; i < ARRAY_SIZE(ir_codes_vp702x_table); i++) |
| 201 | if (rc5_custom(&ir_codes_vp702x_table[i]) == key[1]) { | 201 | if (rc5_custom(&ir_codes_vp702x_table[i]) == key[1]) { |
| 202 | *state = REMOTE_KEY_PRESSED; | 202 | *state = REMOTE_KEY_PRESSED; |
| 203 | *event = ir_codes_vp702x_table[i].event; | 203 | *event = ir_codes_vp702x_table[i].keycode; |
| 204 | break; | 204 | break; |
| 205 | } | 205 | } |
| 206 | return 0; | 206 | return 0; |
| @@ -283,10 +283,12 @@ static struct dvb_usb_device_properties vp702x_properties = { | |||
| 283 | }, | 283 | }, |
| 284 | .read_mac_address = vp702x_read_mac_addr, | 284 | .read_mac_address = vp702x_read_mac_addr, |
| 285 | 285 | ||
| 286 | .rc_key_map = ir_codes_vp702x_table, | 286 | .rc.legacy = { |
| 287 | .rc_key_map_size = ARRAY_SIZE(ir_codes_vp702x_table), | 287 | .rc_key_map = ir_codes_vp702x_table, |
| 288 | .rc_interval = 400, | 288 | .rc_key_map_size = ARRAY_SIZE(ir_codes_vp702x_table), |
| 289 | .rc_query = vp702x_rc_query, | 289 | .rc_interval = 400, |
| 290 | .rc_query = vp702x_rc_query, | ||
| 291 | }, | ||
| 290 | 292 | ||
| 291 | .num_device_descs = 1, | 293 | .num_device_descs = 1, |
| 292 | .devices = { | 294 | .devices = { |
diff --git a/drivers/media/dvb/dvb-usb/vp7045.c b/drivers/media/dvb/dvb-usb/vp7045.c index 036893fa448..f13791ca599 100644 --- a/drivers/media/dvb/dvb-usb/vp7045.c +++ b/drivers/media/dvb/dvb-usb/vp7045.c | |||
| @@ -99,7 +99,7 @@ static int vp7045_power_ctrl(struct dvb_usb_device *d, int onoff) | |||
| 99 | 99 | ||
| 100 | /* The keymapping struct. Somehow this should be loaded to the driver, but | 100 | /* The keymapping struct. Somehow this should be loaded to the driver, but |
| 101 | * currently it is hardcoded. */ | 101 | * currently it is hardcoded. */ |
| 102 | static struct dvb_usb_rc_key ir_codes_vp7045_table[] = { | 102 | static struct ir_scancode ir_codes_vp7045_table[] = { |
| 103 | { 0x0016, KEY_POWER }, | 103 | { 0x0016, KEY_POWER }, |
| 104 | { 0x0010, KEY_MUTE }, | 104 | { 0x0010, KEY_MUTE }, |
| 105 | { 0x0003, KEY_1 }, | 105 | { 0x0003, KEY_1 }, |
| @@ -168,7 +168,7 @@ static int vp7045_rc_query(struct dvb_usb_device *d, u32 *event, int *state) | |||
| 168 | for (i = 0; i < ARRAY_SIZE(ir_codes_vp7045_table); i++) | 168 | for (i = 0; i < ARRAY_SIZE(ir_codes_vp7045_table); i++) |
| 169 | if (rc5_data(&ir_codes_vp7045_table[i]) == key) { | 169 | if (rc5_data(&ir_codes_vp7045_table[i]) == key) { |
| 170 | *state = REMOTE_KEY_PRESSED; | 170 | *state = REMOTE_KEY_PRESSED; |
| 171 | *event = ir_codes_vp7045_table[i].event; | 171 | *event = ir_codes_vp7045_table[i].keycode; |
| 172 | break; | 172 | break; |
| 173 | } | 173 | } |
| 174 | return 0; | 174 | return 0; |
| @@ -259,10 +259,12 @@ static struct dvb_usb_device_properties vp7045_properties = { | |||
| 259 | .power_ctrl = vp7045_power_ctrl, | 259 | .power_ctrl = vp7045_power_ctrl, |
| 260 | .read_mac_address = vp7045_read_mac_addr, | 260 | .read_mac_address = vp7045_read_mac_addr, |
| 261 | 261 | ||
| 262 | .rc_interval = 400, | 262 | .rc.legacy = { |
| 263 | .rc_key_map = ir_codes_vp7045_table, | 263 | .rc_interval = 400, |
| 264 | .rc_key_map_size = ARRAY_SIZE(ir_codes_vp7045_table), | 264 | .rc_key_map = ir_codes_vp7045_table, |
| 265 | .rc_query = vp7045_rc_query, | 265 | .rc_key_map_size = ARRAY_SIZE(ir_codes_vp7045_table), |
| 266 | .rc_query = vp7045_rc_query, | ||
| 267 | }, | ||
| 266 | 268 | ||
| 267 | .num_device_descs = 2, | 269 | .num_device_descs = 2, |
| 268 | .devices = { | 270 | .devices = { |
diff --git a/drivers/media/dvb/frontends/Kconfig b/drivers/media/dvb/frontends/Kconfig index cd7f9b7cbff..51d578a758a 100644 --- a/drivers/media/dvb/frontends/Kconfig +++ b/drivers/media/dvb/frontends/Kconfig | |||
| @@ -584,6 +584,7 @@ config DVB_LGS8GL5 | |||
| 584 | config DVB_LGS8GXX | 584 | config DVB_LGS8GXX |
| 585 | tristate "Legend Silicon LGS8913/LGS8GL5/LGS8GXX DMB-TH demodulator" | 585 | tristate "Legend Silicon LGS8913/LGS8GL5/LGS8GXX DMB-TH demodulator" |
| 586 | depends on DVB_CORE && I2C | 586 | depends on DVB_CORE && I2C |
| 587 | select FW_LOADER | ||
| 587 | default m if DVB_FE_CUSTOMISE | 588 | default m if DVB_FE_CUSTOMISE |
| 588 | help | 589 | help |
| 589 | A DMB-TH tuner module. Say Y when you want to support this frontend. | 590 | A DMB-TH tuner module. Say Y when you want to support this frontend. |
diff --git a/drivers/media/dvb/frontends/af9013.c b/drivers/media/dvb/frontends/af9013.c index 12e018b4107..dac917f7bb7 100644 --- a/drivers/media/dvb/frontends/af9013.c +++ b/drivers/media/dvb/frontends/af9013.c | |||
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | * DVB USB Linux driver for Afatech AF9015 DVB-T USB2.0 receiver | 2 | * Afatech AF9013 demodulator driver |
| 3 | * | 3 | * |
| 4 | * Copyright (C) 2007 Antti Palosaari <crope@iki.fi> | 4 | * Copyright (C) 2007 Antti Palosaari <crope@iki.fi> |
| 5 | * | 5 | * |
| @@ -761,6 +761,10 @@ static int af9013_set_frontend(struct dvb_frontend *fe, | |||
| 761 | 761 | ||
| 762 | state->frequency = params->frequency; | 762 | state->frequency = params->frequency; |
| 763 | 763 | ||
| 764 | /* program tuner */ | ||
| 765 | if (fe->ops.tuner_ops.set_params) | ||
| 766 | fe->ops.tuner_ops.set_params(fe, params); | ||
| 767 | |||
| 764 | /* program CFOE coefficients */ | 768 | /* program CFOE coefficients */ |
| 765 | ret = af9013_set_coeff(state, params->u.ofdm.bandwidth); | 769 | ret = af9013_set_coeff(state, params->u.ofdm.bandwidth); |
| 766 | if (ret) | 770 | if (ret) |
| @@ -791,10 +795,6 @@ static int af9013_set_frontend(struct dvb_frontend *fe, | |||
| 791 | if (ret) | 795 | if (ret) |
| 792 | goto error; | 796 | goto error; |
| 793 | 797 | ||
| 794 | /* program tuner */ | ||
| 795 | if (fe->ops.tuner_ops.set_params) | ||
| 796 | fe->ops.tuner_ops.set_params(fe, params); | ||
| 797 | |||
| 798 | /* program TPS and bandwidth, check if auto mode needed */ | 798 | /* program TPS and bandwidth, check if auto mode needed */ |
| 799 | ret = af9013_set_ofdm_params(state, ¶ms->u.ofdm, &auto_mode); | 799 | ret = af9013_set_ofdm_params(state, ¶ms->u.ofdm, &auto_mode); |
| 800 | if (ret) | 800 | if (ret) |
| @@ -1184,45 +1184,49 @@ static int af9013_read_status(struct dvb_frontend *fe, fe_status_t *status) | |||
| 1184 | u8 tmp; | 1184 | u8 tmp; |
| 1185 | *status = 0; | 1185 | *status = 0; |
| 1186 | 1186 | ||
| 1187 | /* TPS lock */ | ||
| 1188 | ret = af9013_read_reg_bits(state, 0xd330, 3, 1, &tmp); | ||
| 1189 | if (ret) | ||
| 1190 | goto error; | ||
| 1191 | if (tmp) | ||
| 1192 | *status |= FE_HAS_VITERBI | FE_HAS_CARRIER | FE_HAS_SIGNAL; | ||
| 1193 | |||
| 1194 | /* MPEG2 lock */ | 1187 | /* MPEG2 lock */ |
| 1195 | ret = af9013_read_reg_bits(state, 0xd507, 6, 1, &tmp); | 1188 | ret = af9013_read_reg_bits(state, 0xd507, 6, 1, &tmp); |
| 1196 | if (ret) | 1189 | if (ret) |
| 1197 | goto error; | 1190 | goto error; |
| 1198 | if (tmp) | 1191 | if (tmp) |
| 1199 | *status |= FE_HAS_SYNC | FE_HAS_LOCK; | 1192 | *status |= FE_HAS_SIGNAL | FE_HAS_CARRIER | FE_HAS_VITERBI | |
| 1193 | FE_HAS_SYNC | FE_HAS_LOCK; | ||
| 1200 | 1194 | ||
| 1201 | if (!(*status & FE_HAS_SIGNAL)) { | 1195 | if (!*status) { |
| 1202 | /* AGC lock */ | 1196 | /* TPS lock */ |
| 1203 | ret = af9013_read_reg_bits(state, 0xd1a0, 6, 1, &tmp); | 1197 | ret = af9013_read_reg_bits(state, 0xd330, 3, 1, &tmp); |
| 1204 | if (ret) | 1198 | if (ret) |
| 1205 | goto error; | 1199 | goto error; |
| 1206 | if (tmp) | 1200 | if (tmp) |
| 1207 | *status |= FE_HAS_SIGNAL; | 1201 | *status |= FE_HAS_SIGNAL | FE_HAS_CARRIER | |
| 1202 | FE_HAS_VITERBI; | ||
| 1208 | } | 1203 | } |
| 1209 | 1204 | ||
| 1210 | if (!(*status & FE_HAS_CARRIER)) { | 1205 | if (!*status) { |
| 1211 | /* CFO lock */ | 1206 | /* CFO lock */ |
| 1212 | ret = af9013_read_reg_bits(state, 0xd333, 7, 1, &tmp); | 1207 | ret = af9013_read_reg_bits(state, 0xd333, 7, 1, &tmp); |
| 1213 | if (ret) | 1208 | if (ret) |
| 1214 | goto error; | 1209 | goto error; |
| 1215 | if (tmp) | 1210 | if (tmp) |
| 1216 | *status |= FE_HAS_CARRIER; | 1211 | *status |= FE_HAS_SIGNAL | FE_HAS_CARRIER; |
| 1217 | } | 1212 | } |
| 1218 | 1213 | ||
| 1219 | if (!(*status & FE_HAS_CARRIER)) { | 1214 | if (!*status) { |
| 1220 | /* SFOE lock */ | 1215 | /* SFOE lock */ |
| 1221 | ret = af9013_read_reg_bits(state, 0xd334, 6, 1, &tmp); | 1216 | ret = af9013_read_reg_bits(state, 0xd334, 6, 1, &tmp); |
| 1222 | if (ret) | 1217 | if (ret) |
| 1223 | goto error; | 1218 | goto error; |
| 1224 | if (tmp) | 1219 | if (tmp) |
| 1225 | *status |= FE_HAS_CARRIER; | 1220 | *status |= FE_HAS_SIGNAL | FE_HAS_CARRIER; |
| 1221 | } | ||
| 1222 | |||
| 1223 | if (!*status) { | ||
| 1224 | /* AGC lock */ | ||
| 1225 | ret = af9013_read_reg_bits(state, 0xd1a0, 6, 1, &tmp); | ||
| 1226 | if (ret) | ||
| 1227 | goto error; | ||
| 1228 | if (tmp) | ||
| 1229 | *status |= FE_HAS_SIGNAL; | ||
| 1226 | } | 1230 | } |
| 1227 | 1231 | ||
| 1228 | ret = af9013_update_statistics(fe); | 1232 | ret = af9013_update_statistics(fe); |
| @@ -1574,7 +1578,7 @@ struct dvb_frontend *af9013_attach(const struct af9013_config *config, | |||
| 1574 | { | 1578 | { |
| 1575 | int ret; | 1579 | int ret; |
| 1576 | struct af9013_state *state = NULL; | 1580 | struct af9013_state *state = NULL; |
| 1577 | u8 buf[3], i; | 1581 | u8 buf[4], i; |
| 1578 | 1582 | ||
| 1579 | /* allocate memory for the internal state */ | 1583 | /* allocate memory for the internal state */ |
| 1580 | state = kzalloc(sizeof(struct af9013_state), GFP_KERNEL); | 1584 | state = kzalloc(sizeof(struct af9013_state), GFP_KERNEL); |
| @@ -1607,12 +1611,12 @@ struct dvb_frontend *af9013_attach(const struct af9013_config *config, | |||
| 1607 | } | 1611 | } |
| 1608 | 1612 | ||
| 1609 | /* firmware version */ | 1613 | /* firmware version */ |
| 1610 | for (i = 0; i < 3; i++) { | 1614 | for (i = 0; i < 4; i++) { |
| 1611 | ret = af9013_read_reg(state, 0x5103 + i, &buf[i]); | 1615 | ret = af9013_read_reg(state, 0x5103 + i, &buf[i]); |
| 1612 | if (ret) | 1616 | if (ret) |
| 1613 | goto error; | 1617 | goto error; |
| 1614 | } | 1618 | } |
| 1615 | info("firmware version:%d.%d.%d", buf[0], buf[1], buf[2]); | 1619 | info("firmware version:%d.%d.%d.%d", buf[0], buf[1], buf[2], buf[3]); |
| 1616 | 1620 | ||
| 1617 | /* settings for mp2if */ | 1621 | /* settings for mp2if */ |
| 1618 | if (state->config.output_mode == AF9013_OUTPUT_MODE_USB) { | 1622 | if (state->config.output_mode == AF9013_OUTPUT_MODE_USB) { |
diff --git a/drivers/media/dvb/frontends/af9013.h b/drivers/media/dvb/frontends/af9013.h index e90fa92b1c1..72c71bb5d11 100644 --- a/drivers/media/dvb/frontends/af9013.h +++ b/drivers/media/dvb/frontends/af9013.h | |||
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | * DVB USB Linux driver for Afatech AF9015 DVB-T USB2.0 receiver | 2 | * Afatech AF9013 demodulator driver |
| 3 | * | 3 | * |
| 4 | * Copyright (C) 2007 Antti Palosaari <crope@iki.fi> | 4 | * Copyright (C) 2007 Antti Palosaari <crope@iki.fi> |
| 5 | * | 5 | * |
diff --git a/drivers/media/dvb/frontends/af9013_priv.h b/drivers/media/dvb/frontends/af9013_priv.h index 163e251d0b7..0fd42b7e248 100644 --- a/drivers/media/dvb/frontends/af9013_priv.h +++ b/drivers/media/dvb/frontends/af9013_priv.h | |||
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | * DVB USB Linux driver for Afatech AF9015 DVB-T USB2.0 receiver | 2 | * Afatech AF9013 demodulator driver |
| 3 | * | 3 | * |
| 4 | * Copyright (C) 2007 Antti Palosaari <crope@iki.fi> | 4 | * Copyright (C) 2007 Antti Palosaari <crope@iki.fi> |
| 5 | * | 5 | * |
| @@ -132,6 +132,8 @@ static struct regdesc ofsm_init[] = { | |||
| 132 | { 0xd740, 2, 1, 0x00 }, | 132 | { 0xd740, 2, 1, 0x00 }, |
| 133 | { 0xd740, 3, 1, 0x01 }, | 133 | { 0xd740, 3, 1, 0x01 }, |
| 134 | { 0xd3c1, 4, 1, 0x01 }, | 134 | { 0xd3c1, 4, 1, 0x01 }, |
| 135 | { 0x9124, 0, 8, 0x58 }, | ||
| 136 | { 0x9125, 0, 2, 0x02 }, | ||
| 135 | { 0xd3a2, 0, 8, 0x00 }, | 137 | { 0xd3a2, 0, 8, 0x00 }, |
| 136 | { 0xd3a3, 0, 8, 0x04 }, | 138 | { 0xd3a3, 0, 8, 0x04 }, |
| 137 | { 0xd305, 0, 8, 0x32 }, | 139 | { 0xd305, 0, 8, 0x32 }, |
| @@ -143,7 +145,7 @@ static struct regdesc ofsm_init[] = { | |||
| 143 | { 0x911b, 0, 1, 0x01 }, | 145 | { 0x911b, 0, 1, 0x01 }, |
| 144 | { 0x9bce, 0, 4, 0x02 }, | 146 | { 0x9bce, 0, 4, 0x02 }, |
| 145 | { 0x9116, 0, 1, 0x01 }, | 147 | { 0x9116, 0, 1, 0x01 }, |
| 146 | { 0x9bd1, 0, 1, 0x01 }, | 148 | { 0x9122, 0, 8, 0xd0 }, |
| 147 | { 0xd2e0, 0, 8, 0xd0 }, | 149 | { 0xd2e0, 0, 8, 0xd0 }, |
| 148 | { 0xd2e9, 0, 4, 0x0d }, | 150 | { 0xd2e9, 0, 4, 0x0d }, |
| 149 | { 0xd38c, 0, 8, 0xfc }, | 151 | { 0xd38c, 0, 8, 0xfc }, |
| @@ -165,7 +167,6 @@ static struct regdesc ofsm_init[] = { | |||
| 165 | { 0xd081, 4, 4, 0x09 }, | 167 | { 0xd081, 4, 4, 0x09 }, |
| 166 | { 0xd098, 4, 4, 0x0f }, | 168 | { 0xd098, 4, 4, 0x0f }, |
| 167 | { 0xd098, 0, 4, 0x03 }, | 169 | { 0xd098, 0, 4, 0x03 }, |
| 168 | { 0xdbc0, 3, 1, 0x01 }, | ||
| 169 | { 0xdbc0, 4, 1, 0x01 }, | 170 | { 0xdbc0, 4, 1, 0x01 }, |
| 170 | { 0xdbc7, 0, 8, 0x08 }, | 171 | { 0xdbc7, 0, 8, 0x08 }, |
| 171 | { 0xdbc8, 4, 4, 0x00 }, | 172 | { 0xdbc8, 4, 4, 0x00 }, |
| @@ -179,6 +180,7 @@ static struct regdesc ofsm_init[] = { | |||
| 179 | { 0xd0f0, 0, 7, 0x1a }, | 180 | { 0xd0f0, 0, 7, 0x1a }, |
| 180 | { 0xd0f1, 4, 1, 0x01 }, | 181 | { 0xd0f1, 4, 1, 0x01 }, |
| 181 | { 0xd0f2, 0, 8, 0x0c }, | 182 | { 0xd0f2, 0, 8, 0x0c }, |
| 183 | { 0xd101, 5, 3, 0x06 }, | ||
| 182 | { 0xd103, 0, 4, 0x08 }, | 184 | { 0xd103, 0, 4, 0x08 }, |
| 183 | { 0xd0f8, 0, 7, 0x20 }, | 185 | { 0xd0f8, 0, 7, 0x20 }, |
| 184 | { 0xd111, 5, 1, 0x00 }, | 186 | { 0xd111, 5, 1, 0x00 }, |
diff --git a/drivers/media/dvb/frontends/dib3000mb.c b/drivers/media/dvb/frontends/dib3000mb.c index ad4c8cfd809..e80c5979636 100644 --- a/drivers/media/dvb/frontends/dib3000mb.c +++ b/drivers/media/dvb/frontends/dib3000mb.c | |||
| @@ -38,11 +38,10 @@ | |||
| 38 | #define DRIVER_DESC "DiBcom 3000M-B DVB-T demodulator" | 38 | #define DRIVER_DESC "DiBcom 3000M-B DVB-T demodulator" |
| 39 | #define DRIVER_AUTHOR "Patrick Boettcher, patrick.boettcher@desy.de" | 39 | #define DRIVER_AUTHOR "Patrick Boettcher, patrick.boettcher@desy.de" |
| 40 | 40 | ||
| 41 | #ifdef CONFIG_DVB_DIBCOM_DEBUG | ||
| 42 | static int debug; | 41 | static int debug; |
| 43 | module_param(debug, int, 0644); | 42 | module_param(debug, int, 0644); |
| 44 | MODULE_PARM_DESC(debug, "set debugging level (1=info,2=xfer,4=setfe,8=getfe (|-able))."); | 43 | MODULE_PARM_DESC(debug, "set debugging level (1=info,2=xfer,4=setfe,8=getfe (|-able))."); |
| 45 | #endif | 44 | |
| 46 | #define deb_info(args...) dprintk(0x01,args) | 45 | #define deb_info(args...) dprintk(0x01,args) |
| 47 | #define deb_i2c(args...) dprintk(0x02,args) | 46 | #define deb_i2c(args...) dprintk(0x02,args) |
| 48 | #define deb_srch(args...) dprintk(0x04,args) | 47 | #define deb_srch(args...) dprintk(0x04,args) |
| @@ -51,12 +50,6 @@ MODULE_PARM_DESC(debug, "set debugging level (1=info,2=xfer,4=setfe,8=getfe (|-a | |||
| 51 | #define deb_setf(args...) dprintk(0x04,args) | 50 | #define deb_setf(args...) dprintk(0x04,args) |
| 52 | #define deb_getf(args...) dprintk(0x08,args) | 51 | #define deb_getf(args...) dprintk(0x08,args) |
| 53 | 52 | ||
| 54 | #ifdef CONFIG_DVB_DIBCOM_DEBUG | ||
| 55 | static int debug; | ||
| 56 | module_param(debug, int, 0644); | ||
| 57 | MODULE_PARM_DESC(debug, "set debugging level (1=info,2=i2c,4=srch (|-able))."); | ||
| 58 | #endif | ||
| 59 | |||
| 60 | static int dib3000_read_reg(struct dib3000_state *state, u16 reg) | 53 | static int dib3000_read_reg(struct dib3000_state *state, u16 reg) |
| 61 | { | 54 | { |
| 62 | u8 wb[] = { ((reg >> 8) | 0x80) & 0xff, reg & 0xff }; | 55 | u8 wb[] = { ((reg >> 8) | 0x80) & 0xff, reg & 0xff }; |
diff --git a/drivers/media/dvb/frontends/dib3000mb_priv.h b/drivers/media/dvb/frontends/dib3000mb_priv.h index 1a12747fdc9..16c526591f3 100644 --- a/drivers/media/dvb/frontends/dib3000mb_priv.h +++ b/drivers/media/dvb/frontends/dib3000mb_priv.h | |||
| @@ -37,12 +37,8 @@ | |||
| 37 | 37 | ||
| 38 | /* debug */ | 38 | /* debug */ |
| 39 | 39 | ||
| 40 | #ifdef CONFIG_DVB_DIBCOM_DEBUG | ||
| 41 | #define dprintk(level,args...) \ | 40 | #define dprintk(level,args...) \ |
| 42 | do { if ((debug & level)) { printk(args); } } while (0) | 41 | do { if ((debug & level)) { printk(args); } } while (0) |
| 43 | #else | ||
| 44 | #define dprintk(args...) do { } while (0) | ||
| 45 | #endif | ||
| 46 | 42 | ||
| 47 | /* mask for enabling a specific pid for the pid_filter */ | 43 | /* mask for enabling a specific pid for the pid_filter */ |
| 48 | #define DIB3000_ACTIVATE_PID_FILTERING (0x2000) | 44 | #define DIB3000_ACTIVATE_PID_FILTERING (0x2000) |
diff --git a/drivers/media/dvb/frontends/dib3000mc.c b/drivers/media/dvb/frontends/dib3000mc.c index afad252abf4..088e7fadbe3 100644 --- a/drivers/media/dvb/frontends/dib3000mc.c +++ b/drivers/media/dvb/frontends/dib3000mc.c | |||
| @@ -822,7 +822,7 @@ int dib3000mc_i2c_enumeration(struct i2c_adapter *i2c, int no_of_demods, u8 defa | |||
| 822 | 822 | ||
| 823 | dmcst = kzalloc(sizeof(struct dib3000mc_state), GFP_KERNEL); | 823 | dmcst = kzalloc(sizeof(struct dib3000mc_state), GFP_KERNEL); |
| 824 | if (dmcst == NULL) | 824 | if (dmcst == NULL) |
| 825 | return -ENODEV; | 825 | return -ENOMEM; |
| 826 | 826 | ||
| 827 | dmcst->i2c_adap = i2c; | 827 | dmcst->i2c_adap = i2c; |
| 828 | 828 | ||
diff --git a/drivers/media/dvb/frontends/lgdt3305.c b/drivers/media/dvb/frontends/lgdt3305.c index d69c775f864..3272881cb11 100644 --- a/drivers/media/dvb/frontends/lgdt3305.c +++ b/drivers/media/dvb/frontends/lgdt3305.c | |||
| @@ -1,7 +1,9 @@ | |||
| 1 | /* | 1 | /* |
| 2 | * Support for LGDT3305 - VSB/QAM | 2 | * Support for LG Electronics LGDT3304 and LGDT3305 - VSB/QAM |
| 3 | * | 3 | * |
| 4 | * Copyright (C) 2008, 2009 Michael Krufky <mkrufky@linuxtv.org> | 4 | * Copyright (C) 2008, 2009, 2010 Michael Krufky <mkrufky@linuxtv.org> |
| 5 | * | ||
| 6 | * LGDT3304 support by Jarod Wilson <jarod@redhat.com> | ||
| 5 | * | 7 | * |
| 6 | * This program is free software; you can redistribute it and/or modify | 8 | * This program is free software; you can redistribute it and/or modify |
| 7 | * it under the terms of the GNU General Public License as published by | 9 | * it under the terms of the GNU General Public License as published by |
| @@ -65,6 +67,8 @@ struct lgdt3305_state { | |||
| 65 | 67 | ||
| 66 | /* ------------------------------------------------------------------------ */ | 68 | /* ------------------------------------------------------------------------ */ |
| 67 | 69 | ||
| 70 | /* FIXME: verify & document the LGDT3304 registers */ | ||
| 71 | |||
| 68 | #define LGDT3305_GEN_CTRL_1 0x0000 | 72 | #define LGDT3305_GEN_CTRL_1 0x0000 |
| 69 | #define LGDT3305_GEN_CTRL_2 0x0001 | 73 | #define LGDT3305_GEN_CTRL_2 0x0001 |
| 70 | #define LGDT3305_GEN_CTRL_3 0x0002 | 74 | #define LGDT3305_GEN_CTRL_3 0x0002 |
| @@ -358,7 +362,12 @@ static int lgdt3305_rfagc_loop(struct lgdt3305_state *state, | |||
| 358 | case QAM_256: | 362 | case QAM_256: |
| 359 | agcdelay = 0x046b; | 363 | agcdelay = 0x046b; |
| 360 | rfbw = 0x8889; | 364 | rfbw = 0x8889; |
| 361 | ifbw = 0x8888; | 365 | /* FIXME: investigate optimal ifbw & rfbw values for the |
| 366 | * DT3304 and re-write this switch..case block */ | ||
| 367 | if (state->cfg->demod_chip == LGDT3304) | ||
| 368 | ifbw = 0x6666; | ||
| 369 | else /* (state->cfg->demod_chip == LGDT3305) */ | ||
| 370 | ifbw = 0x8888; | ||
| 362 | break; | 371 | break; |
| 363 | default: | 372 | default: |
| 364 | return -EINVAL; | 373 | return -EINVAL; |
| @@ -410,8 +419,18 @@ static int lgdt3305_agc_setup(struct lgdt3305_state *state, | |||
| 410 | lg_dbg("lockdten = %d, acqen = %d\n", lockdten, acqen); | 419 | lg_dbg("lockdten = %d, acqen = %d\n", lockdten, acqen); |
| 411 | 420 | ||
| 412 | /* control agc function */ | 421 | /* control agc function */ |
| 413 | lgdt3305_write_reg(state, LGDT3305_AGC_CTRL_4, 0xe1 | lockdten << 1); | 422 | switch (state->cfg->demod_chip) { |
| 414 | lgdt3305_set_reg_bit(state, LGDT3305_AGC_CTRL_1, 2, acqen); | 423 | case LGDT3304: |
| 424 | lgdt3305_write_reg(state, 0x0314, 0xe1 | lockdten << 1); | ||
| 425 | lgdt3305_set_reg_bit(state, 0x030e, 2, acqen); | ||
| 426 | break; | ||
| 427 | case LGDT3305: | ||
| 428 | lgdt3305_write_reg(state, LGDT3305_AGC_CTRL_4, 0xe1 | lockdten << 1); | ||
| 429 | lgdt3305_set_reg_bit(state, LGDT3305_AGC_CTRL_1, 2, acqen); | ||
| 430 | break; | ||
| 431 | default: | ||
| 432 | return -EINVAL; | ||
| 433 | } | ||
| 415 | 434 | ||
| 416 | return lgdt3305_rfagc_loop(state, param); | 435 | return lgdt3305_rfagc_loop(state, param); |
| 417 | } | 436 | } |
| @@ -577,61 +596,79 @@ static int lgdt3305_init(struct dvb_frontend *fe) | |||
| 577 | struct lgdt3305_state *state = fe->demodulator_priv; | 596 | struct lgdt3305_state *state = fe->demodulator_priv; |
| 578 | int ret; | 597 | int ret; |
| 579 | 598 | ||
| 599 | static struct lgdt3305_reg lgdt3304_init_data[] = { | ||
| 600 | { .reg = LGDT3305_GEN_CTRL_1, .val = 0x03, }, | ||
| 601 | { .reg = 0x000d, .val = 0x02, }, | ||
| 602 | { .reg = 0x000e, .val = 0x02, }, | ||
| 603 | { .reg = LGDT3305_DGTL_AGC_REF_1, .val = 0x32, }, | ||
| 604 | { .reg = LGDT3305_DGTL_AGC_REF_2, .val = 0xc4, }, | ||
| 605 | { .reg = LGDT3305_CR_CTR_FREQ_1, .val = 0x00, }, | ||
| 606 | { .reg = LGDT3305_CR_CTR_FREQ_2, .val = 0x00, }, | ||
| 607 | { .reg = LGDT3305_CR_CTR_FREQ_3, .val = 0x00, }, | ||
| 608 | { .reg = LGDT3305_CR_CTR_FREQ_4, .val = 0x00, }, | ||
| 609 | { .reg = LGDT3305_CR_CTRL_7, .val = 0xf9, }, | ||
| 610 | { .reg = 0x0112, .val = 0x17, }, | ||
| 611 | { .reg = 0x0113, .val = 0x15, }, | ||
| 612 | { .reg = 0x0114, .val = 0x18, }, | ||
| 613 | { .reg = 0x0115, .val = 0xff, }, | ||
| 614 | { .reg = 0x0116, .val = 0x3c, }, | ||
| 615 | { .reg = 0x0214, .val = 0x67, }, | ||
| 616 | { .reg = 0x0424, .val = 0x8d, }, | ||
| 617 | { .reg = 0x0427, .val = 0x12, }, | ||
| 618 | { .reg = 0x0428, .val = 0x4f, }, | ||
| 619 | { .reg = LGDT3305_IFBW_1, .val = 0x80, }, | ||
| 620 | { .reg = LGDT3305_IFBW_2, .val = 0x00, }, | ||
| 621 | { .reg = 0x030a, .val = 0x08, }, | ||
| 622 | { .reg = 0x030b, .val = 0x9b, }, | ||
| 623 | { .reg = 0x030d, .val = 0x00, }, | ||
| 624 | { .reg = 0x030e, .val = 0x1c, }, | ||
| 625 | { .reg = 0x0314, .val = 0xe1, }, | ||
| 626 | { .reg = 0x000d, .val = 0x82, }, | ||
| 627 | { .reg = LGDT3305_TP_CTRL_1, .val = 0x5b, }, | ||
| 628 | { .reg = LGDT3305_TP_CTRL_1, .val = 0x5b, }, | ||
| 629 | }; | ||
| 630 | |||
| 580 | static struct lgdt3305_reg lgdt3305_init_data[] = { | 631 | static struct lgdt3305_reg lgdt3305_init_data[] = { |
| 581 | { .reg = LGDT3305_GEN_CTRL_1, | 632 | { .reg = LGDT3305_GEN_CTRL_1, .val = 0x03, }, |
| 582 | .val = 0x03, }, | 633 | { .reg = LGDT3305_GEN_CTRL_2, .val = 0xb0, }, |
| 583 | { .reg = LGDT3305_GEN_CTRL_2, | 634 | { .reg = LGDT3305_GEN_CTRL_3, .val = 0x01, }, |
| 584 | .val = 0xb0, }, | 635 | { .reg = LGDT3305_GEN_CONTROL, .val = 0x6f, }, |
| 585 | { .reg = LGDT3305_GEN_CTRL_3, | 636 | { .reg = LGDT3305_GEN_CTRL_4, .val = 0x03, }, |
| 586 | .val = 0x01, }, | 637 | { .reg = LGDT3305_DGTL_AGC_REF_1, .val = 0x32, }, |
| 587 | { .reg = LGDT3305_GEN_CONTROL, | 638 | { .reg = LGDT3305_DGTL_AGC_REF_2, .val = 0xc4, }, |
| 588 | .val = 0x6f, }, | 639 | { .reg = LGDT3305_CR_CTR_FREQ_1, .val = 0x00, }, |
| 589 | { .reg = LGDT3305_GEN_CTRL_4, | 640 | { .reg = LGDT3305_CR_CTR_FREQ_2, .val = 0x00, }, |
| 590 | .val = 0x03, }, | 641 | { .reg = LGDT3305_CR_CTR_FREQ_3, .val = 0x00, }, |
| 591 | { .reg = LGDT3305_DGTL_AGC_REF_1, | 642 | { .reg = LGDT3305_CR_CTR_FREQ_4, .val = 0x00, }, |
| 592 | .val = 0x32, }, | 643 | { .reg = LGDT3305_CR_CTRL_7, .val = 0x79, }, |
| 593 | { .reg = LGDT3305_DGTL_AGC_REF_2, | 644 | { .reg = LGDT3305_AGC_POWER_REF_1, .val = 0x32, }, |
| 594 | .val = 0xc4, }, | 645 | { .reg = LGDT3305_AGC_POWER_REF_2, .val = 0xc4, }, |
| 595 | { .reg = LGDT3305_CR_CTR_FREQ_1, | 646 | { .reg = LGDT3305_AGC_DELAY_PT_1, .val = 0x0d, }, |
| 596 | .val = 0x00, }, | 647 | { .reg = LGDT3305_AGC_DELAY_PT_2, .val = 0x30, }, |
| 597 | { .reg = LGDT3305_CR_CTR_FREQ_2, | 648 | { .reg = LGDT3305_RFAGC_LOOP_FLTR_BW_1, .val = 0x80, }, |
| 598 | .val = 0x00, }, | 649 | { .reg = LGDT3305_RFAGC_LOOP_FLTR_BW_2, .val = 0x00, }, |
| 599 | { .reg = LGDT3305_CR_CTR_FREQ_3, | 650 | { .reg = LGDT3305_IFBW_1, .val = 0x80, }, |
| 600 | .val = 0x00, }, | 651 | { .reg = LGDT3305_IFBW_2, .val = 0x00, }, |
| 601 | { .reg = LGDT3305_CR_CTR_FREQ_4, | 652 | { .reg = LGDT3305_AGC_CTRL_1, .val = 0x30, }, |
| 602 | .val = 0x00, }, | 653 | { .reg = LGDT3305_AGC_CTRL_4, .val = 0x61, }, |
| 603 | { .reg = LGDT3305_CR_CTRL_7, | 654 | { .reg = LGDT3305_FEC_BLOCK_CTRL, .val = 0xff, }, |
| 604 | .val = 0x79, }, | 655 | { .reg = LGDT3305_TP_CTRL_1, .val = 0x1b, }, |
| 605 | { .reg = LGDT3305_AGC_POWER_REF_1, | ||
| 606 | .val = 0x32, }, | ||
| 607 | { .reg = LGDT3305_AGC_POWER_REF_2, | ||
| 608 | .val = 0xc4, }, | ||
| 609 | { .reg = LGDT3305_AGC_DELAY_PT_1, | ||
| 610 | .val = 0x0d, }, | ||
| 611 | { .reg = LGDT3305_AGC_DELAY_PT_2, | ||
| 612 | .val = 0x30, }, | ||
| 613 | { .reg = LGDT3305_RFAGC_LOOP_FLTR_BW_1, | ||
| 614 | .val = 0x80, }, | ||
| 615 | { .reg = LGDT3305_RFAGC_LOOP_FLTR_BW_2, | ||
| 616 | .val = 0x00, }, | ||
| 617 | { .reg = LGDT3305_IFBW_1, | ||
| 618 | .val = 0x80, }, | ||
| 619 | { .reg = LGDT3305_IFBW_2, | ||
| 620 | .val = 0x00, }, | ||
| 621 | { .reg = LGDT3305_AGC_CTRL_1, | ||
| 622 | .val = 0x30, }, | ||
| 623 | { .reg = LGDT3305_AGC_CTRL_4, | ||
| 624 | .val = 0x61, }, | ||
| 625 | { .reg = LGDT3305_FEC_BLOCK_CTRL, | ||
| 626 | .val = 0xff, }, | ||
| 627 | { .reg = LGDT3305_TP_CTRL_1, | ||
| 628 | .val = 0x1b, }, | ||
| 629 | }; | 656 | }; |
| 630 | 657 | ||
| 631 | lg_dbg("\n"); | 658 | lg_dbg("\n"); |
| 632 | 659 | ||
| 633 | ret = lgdt3305_write_regs(state, lgdt3305_init_data, | 660 | switch (state->cfg->demod_chip) { |
| 634 | ARRAY_SIZE(lgdt3305_init_data)); | 661 | case LGDT3304: |
| 662 | ret = lgdt3305_write_regs(state, lgdt3304_init_data, | ||
| 663 | ARRAY_SIZE(lgdt3304_init_data)); | ||
| 664 | break; | ||
| 665 | case LGDT3305: | ||
| 666 | ret = lgdt3305_write_regs(state, lgdt3305_init_data, | ||
| 667 | ARRAY_SIZE(lgdt3305_init_data)); | ||
| 668 | break; | ||
| 669 | default: | ||
| 670 | ret = -EINVAL; | ||
| 671 | } | ||
| 635 | if (lg_fail(ret)) | 672 | if (lg_fail(ret)) |
| 636 | goto fail; | 673 | goto fail; |
| 637 | 674 | ||
| @@ -640,6 +677,76 @@ fail: | |||
| 640 | return ret; | 677 | return ret; |
| 641 | } | 678 | } |
| 642 | 679 | ||
| 680 | static int lgdt3304_set_parameters(struct dvb_frontend *fe, | ||
| 681 | struct dvb_frontend_parameters *param) | ||
| 682 | { | ||
| 683 | struct lgdt3305_state *state = fe->demodulator_priv; | ||
| 684 | int ret; | ||
| 685 | |||
| 686 | lg_dbg("(%d, %d)\n", param->frequency, param->u.vsb.modulation); | ||
| 687 | |||
| 688 | if (fe->ops.tuner_ops.set_params) { | ||
| 689 | ret = fe->ops.tuner_ops.set_params(fe, param); | ||
| 690 | if (fe->ops.i2c_gate_ctrl) | ||
| 691 | fe->ops.i2c_gate_ctrl(fe, 0); | ||
| 692 | if (lg_fail(ret)) | ||
| 693 | goto fail; | ||
| 694 | state->current_frequency = param->frequency; | ||
| 695 | } | ||
| 696 | |||
| 697 | ret = lgdt3305_set_modulation(state, param); | ||
| 698 | if (lg_fail(ret)) | ||
| 699 | goto fail; | ||
| 700 | |||
| 701 | ret = lgdt3305_passband_digital_agc(state, param); | ||
| 702 | if (lg_fail(ret)) | ||
| 703 | goto fail; | ||
| 704 | |||
| 705 | ret = lgdt3305_agc_setup(state, param); | ||
| 706 | if (lg_fail(ret)) | ||
| 707 | goto fail; | ||
| 708 | |||
| 709 | /* reg 0x030d is 3304-only... seen in vsb and qam usbsnoops... */ | ||
| 710 | switch (param->u.vsb.modulation) { | ||
| 711 | case VSB_8: | ||
| 712 | lgdt3305_write_reg(state, 0x030d, 0x00); | ||
| 713 | lgdt3305_write_reg(state, LGDT3305_CR_CTR_FREQ_1, 0x4f); | ||
| 714 | lgdt3305_write_reg(state, LGDT3305_CR_CTR_FREQ_2, 0x0c); | ||
| 715 | lgdt3305_write_reg(state, LGDT3305_CR_CTR_FREQ_3, 0xac); | ||
| 716 | lgdt3305_write_reg(state, LGDT3305_CR_CTR_FREQ_4, 0xba); | ||
| 717 | break; | ||
| 718 | case QAM_64: | ||
| 719 | case QAM_256: | ||
| 720 | lgdt3305_write_reg(state, 0x030d, 0x14); | ||
| 721 | ret = lgdt3305_set_if(state, param); | ||
| 722 | if (lg_fail(ret)) | ||
| 723 | goto fail; | ||
| 724 | break; | ||
| 725 | default: | ||
| 726 | return -EINVAL; | ||
| 727 | } | ||
| 728 | |||
| 729 | |||
| 730 | ret = lgdt3305_spectral_inversion(state, param, | ||
| 731 | state->cfg->spectral_inversion | ||
| 732 | ? 1 : 0); | ||
| 733 | if (lg_fail(ret)) | ||
| 734 | goto fail; | ||
| 735 | |||
| 736 | state->current_modulation = param->u.vsb.modulation; | ||
| 737 | |||
| 738 | ret = lgdt3305_mpeg_mode(state, state->cfg->mpeg_mode); | ||
| 739 | if (lg_fail(ret)) | ||
| 740 | goto fail; | ||
| 741 | |||
| 742 | /* lgdt3305_mpeg_mode_polarity calls lgdt3305_soft_reset */ | ||
| 743 | ret = lgdt3305_mpeg_mode_polarity(state, | ||
| 744 | state->cfg->tpclk_edge, | ||
| 745 | state->cfg->tpvalid_polarity); | ||
| 746 | fail: | ||
| 747 | return ret; | ||
| 748 | } | ||
| 749 | |||
| 643 | static int lgdt3305_set_parameters(struct dvb_frontend *fe, | 750 | static int lgdt3305_set_parameters(struct dvb_frontend *fe, |
| 644 | struct dvb_frontend_parameters *param) | 751 | struct dvb_frontend_parameters *param) |
| 645 | { | 752 | { |
| @@ -848,6 +955,10 @@ static int lgdt3305_read_status(struct dvb_frontend *fe, fe_status_t *status) | |||
| 848 | switch (state->current_modulation) { | 955 | switch (state->current_modulation) { |
| 849 | case QAM_256: | 956 | case QAM_256: |
| 850 | case QAM_64: | 957 | case QAM_64: |
| 958 | /* signal bit is unreliable on the DT3304 in QAM mode */ | ||
| 959 | if (((LGDT3304 == state->cfg->demod_chip)) && (cr_lock)) | ||
| 960 | *status |= FE_HAS_SIGNAL; | ||
| 961 | |||
| 851 | ret = lgdt3305_read_fec_lock_status(state, &fec_lock); | 962 | ret = lgdt3305_read_fec_lock_status(state, &fec_lock); |
| 852 | if (lg_fail(ret)) | 963 | if (lg_fail(ret)) |
| 853 | goto fail; | 964 | goto fail; |
| @@ -993,6 +1104,7 @@ static void lgdt3305_release(struct dvb_frontend *fe) | |||
| 993 | kfree(state); | 1104 | kfree(state); |
| 994 | } | 1105 | } |
| 995 | 1106 | ||
| 1107 | static struct dvb_frontend_ops lgdt3304_ops; | ||
| 996 | static struct dvb_frontend_ops lgdt3305_ops; | 1108 | static struct dvb_frontend_ops lgdt3305_ops; |
| 997 | 1109 | ||
| 998 | struct dvb_frontend *lgdt3305_attach(const struct lgdt3305_config *config, | 1110 | struct dvb_frontend *lgdt3305_attach(const struct lgdt3305_config *config, |
| @@ -1013,11 +1125,21 @@ struct dvb_frontend *lgdt3305_attach(const struct lgdt3305_config *config, | |||
| 1013 | state->cfg = config; | 1125 | state->cfg = config; |
| 1014 | state->i2c_adap = i2c_adap; | 1126 | state->i2c_adap = i2c_adap; |
| 1015 | 1127 | ||
| 1016 | memcpy(&state->frontend.ops, &lgdt3305_ops, | 1128 | switch (config->demod_chip) { |
| 1017 | sizeof(struct dvb_frontend_ops)); | 1129 | case LGDT3304: |
| 1130 | memcpy(&state->frontend.ops, &lgdt3304_ops, | ||
| 1131 | sizeof(struct dvb_frontend_ops)); | ||
| 1132 | break; | ||
| 1133 | case LGDT3305: | ||
| 1134 | memcpy(&state->frontend.ops, &lgdt3305_ops, | ||
| 1135 | sizeof(struct dvb_frontend_ops)); | ||
| 1136 | break; | ||
| 1137 | default: | ||
| 1138 | goto fail; | ||
| 1139 | } | ||
| 1018 | state->frontend.demodulator_priv = state; | 1140 | state->frontend.demodulator_priv = state; |
| 1019 | 1141 | ||
| 1020 | /* verify that we're talking to a lg dt3305 */ | 1142 | /* verify that we're talking to a lg dt3304/5 */ |
| 1021 | ret = lgdt3305_read_reg(state, LGDT3305_GEN_CTRL_2, &val); | 1143 | ret = lgdt3305_read_reg(state, LGDT3305_GEN_CTRL_2, &val); |
| 1022 | if ((lg_fail(ret)) | (val == 0)) | 1144 | if ((lg_fail(ret)) | (val == 0)) |
| 1023 | goto fail; | 1145 | goto fail; |
| @@ -1036,12 +1158,35 @@ struct dvb_frontend *lgdt3305_attach(const struct lgdt3305_config *config, | |||
| 1036 | 1158 | ||
| 1037 | return &state->frontend; | 1159 | return &state->frontend; |
| 1038 | fail: | 1160 | fail: |
| 1039 | lg_warn("unable to detect LGDT3305 hardware\n"); | 1161 | lg_warn("unable to detect %s hardware\n", |
| 1162 | config->demod_chip ? "LGDT3304" : "LGDT3305"); | ||
| 1040 | kfree(state); | 1163 | kfree(state); |
| 1041 | return NULL; | 1164 | return NULL; |
| 1042 | } | 1165 | } |
| 1043 | EXPORT_SYMBOL(lgdt3305_attach); | 1166 | EXPORT_SYMBOL(lgdt3305_attach); |
| 1044 | 1167 | ||
| 1168 | static struct dvb_frontend_ops lgdt3304_ops = { | ||
| 1169 | .info = { | ||
| 1170 | .name = "LG Electronics LGDT3304 VSB/QAM Frontend", | ||
| 1171 | .type = FE_ATSC, | ||
| 1172 | .frequency_min = 54000000, | ||
| 1173 | .frequency_max = 858000000, | ||
| 1174 | .frequency_stepsize = 62500, | ||
| 1175 | .caps = FE_CAN_QAM_64 | FE_CAN_QAM_256 | FE_CAN_8VSB | ||
| 1176 | }, | ||
| 1177 | .i2c_gate_ctrl = lgdt3305_i2c_gate_ctrl, | ||
| 1178 | .init = lgdt3305_init, | ||
| 1179 | .set_frontend = lgdt3304_set_parameters, | ||
| 1180 | .get_frontend = lgdt3305_get_frontend, | ||
| 1181 | .get_tune_settings = lgdt3305_get_tune_settings, | ||
| 1182 | .read_status = lgdt3305_read_status, | ||
| 1183 | .read_ber = lgdt3305_read_ber, | ||
| 1184 | .read_signal_strength = lgdt3305_read_signal_strength, | ||
| 1185 | .read_snr = lgdt3305_read_snr, | ||
| 1186 | .read_ucblocks = lgdt3305_read_ucblocks, | ||
| 1187 | .release = lgdt3305_release, | ||
| 1188 | }; | ||
| 1189 | |||
| 1045 | static struct dvb_frontend_ops lgdt3305_ops = { | 1190 | static struct dvb_frontend_ops lgdt3305_ops = { |
| 1046 | .info = { | 1191 | .info = { |
| 1047 | .name = "LG Electronics LGDT3305 VSB/QAM Frontend", | 1192 | .name = "LG Electronics LGDT3305 VSB/QAM Frontend", |
| @@ -1065,10 +1210,10 @@ static struct dvb_frontend_ops lgdt3305_ops = { | |||
| 1065 | .release = lgdt3305_release, | 1210 | .release = lgdt3305_release, |
| 1066 | }; | 1211 | }; |
| 1067 | 1212 | ||
| 1068 | MODULE_DESCRIPTION("LG Electronics LGDT3305 ATSC/QAM-B Demodulator Driver"); | 1213 | MODULE_DESCRIPTION("LG Electronics LGDT3304/5 ATSC/QAM-B Demodulator Driver"); |
| 1069 | MODULE_AUTHOR("Michael Krufky <mkrufky@linuxtv.org>"); | 1214 | MODULE_AUTHOR("Michael Krufky <mkrufky@linuxtv.org>"); |
| 1070 | MODULE_LICENSE("GPL"); | 1215 | MODULE_LICENSE("GPL"); |
| 1071 | MODULE_VERSION("0.1"); | 1216 | MODULE_VERSION("0.2"); |
| 1072 | 1217 | ||
| 1073 | /* | 1218 | /* |
| 1074 | * Local variables: | 1219 | * Local variables: |
diff --git a/drivers/media/dvb/frontends/lgdt3305.h b/drivers/media/dvb/frontends/lgdt3305.h index 9cb11c9cae5..02172eca4d4 100644 --- a/drivers/media/dvb/frontends/lgdt3305.h +++ b/drivers/media/dvb/frontends/lgdt3305.h | |||
| @@ -1,7 +1,7 @@ | |||
| 1 | /* | 1 | /* |
| 2 | * Support for LGDT3305 - VSB/QAM | 2 | * Support for LG Electronics LGDT3304 and LGDT3305 - VSB/QAM |
| 3 | * | 3 | * |
| 4 | * Copyright (C) 2008, 2009 Michael Krufky <mkrufky@linuxtv.org> | 4 | * Copyright (C) 2008, 2009, 2010 Michael Krufky <mkrufky@linuxtv.org> |
| 5 | * | 5 | * |
| 6 | * This program is free software; you can redistribute it and/or modify | 6 | * This program is free software; you can redistribute it and/or modify |
| 7 | * it under the terms of the GNU General Public License as published by | 7 | * it under the terms of the GNU General Public License as published by |
| @@ -41,6 +41,11 @@ enum lgdt3305_tp_valid_polarity { | |||
| 41 | LGDT3305_TP_VALID_HIGH = 1, | 41 | LGDT3305_TP_VALID_HIGH = 1, |
| 42 | }; | 42 | }; |
| 43 | 43 | ||
| 44 | enum lgdt_demod_chip_type { | ||
| 45 | LGDT3305 = 0, | ||
| 46 | LGDT3304 = 1, | ||
| 47 | }; | ||
| 48 | |||
| 44 | struct lgdt3305_config { | 49 | struct lgdt3305_config { |
| 45 | u8 i2c_addr; | 50 | u8 i2c_addr; |
| 46 | 51 | ||
| @@ -65,6 +70,7 @@ struct lgdt3305_config { | |||
| 65 | enum lgdt3305_mpeg_mode mpeg_mode; | 70 | enum lgdt3305_mpeg_mode mpeg_mode; |
| 66 | enum lgdt3305_tp_clock_edge tpclk_edge; | 71 | enum lgdt3305_tp_clock_edge tpclk_edge; |
| 67 | enum lgdt3305_tp_valid_polarity tpvalid_polarity; | 72 | enum lgdt3305_tp_valid_polarity tpvalid_polarity; |
| 73 | enum lgdt_demod_chip_type demod_chip; | ||
| 68 | }; | 74 | }; |
| 69 | 75 | ||
| 70 | #if defined(CONFIG_DVB_LGDT3305) || (defined(CONFIG_DVB_LGDT3305_MODULE) && \ | 76 | #if defined(CONFIG_DVB_LGDT3305) || (defined(CONFIG_DVB_LGDT3305_MODULE) && \ |
diff --git a/drivers/media/dvb/frontends/lgs8gxx.c b/drivers/media/dvb/frontends/lgs8gxx.c index dee53960e7e..5ea28ae2ba8 100644 --- a/drivers/media/dvb/frontends/lgs8gxx.c +++ b/drivers/media/dvb/frontends/lgs8gxx.c | |||
| @@ -24,6 +24,7 @@ | |||
| 24 | */ | 24 | */ |
| 25 | 25 | ||
| 26 | #include <asm/div64.h> | 26 | #include <asm/div64.h> |
| 27 | #include <linux/firmware.h> | ||
| 27 | 28 | ||
| 28 | #include "dvb_frontend.h" | 29 | #include "dvb_frontend.h" |
| 29 | 30 | ||
| @@ -46,42 +47,6 @@ module_param(fake_signal_str, int, 0644); | |||
| 46 | MODULE_PARM_DESC(fake_signal_str, "fake signal strength for LGS8913." | 47 | MODULE_PARM_DESC(fake_signal_str, "fake signal strength for LGS8913." |
| 47 | "Signal strength calculation is slow.(default:on)."); | 48 | "Signal strength calculation is slow.(default:on)."); |
| 48 | 49 | ||
| 49 | static const u8 lgs8g75_initdat[] = { | ||
| 50 | 0x01, 0x30, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, | ||
| 51 | 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, | ||
| 52 | 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, | ||
| 53 | 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, | ||
| 54 | 0x00, 0x01, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, | ||
| 55 | 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, | ||
| 56 | 0xE4, 0xF5, 0xA8, 0xF5, 0xB8, 0xF5, 0x88, 0xF5, | ||
| 57 | 0x89, 0xF5, 0x87, 0x75, 0xD0, 0x00, 0x11, 0x50, | ||
| 58 | 0x11, 0x50, 0xF4, 0xF5, 0x80, 0xF5, 0x90, 0xF5, | ||
| 59 | 0xA0, 0xF5, 0xB0, 0x75, 0x81, 0x30, 0x80, 0x01, | ||
| 60 | 0x32, 0x90, 0x80, 0x12, 0x74, 0xFF, 0xF0, 0x90, | ||
| 61 | 0x80, 0x13, 0x74, 0x1F, 0xF0, 0x90, 0x80, 0x23, | ||
| 62 | 0x74, 0x01, 0xF0, 0x90, 0x80, 0x22, 0xF0, 0x90, | ||
| 63 | 0x00, 0x48, 0x74, 0x00, 0xF0, 0x90, 0x80, 0x4D, | ||
| 64 | 0x74, 0x05, 0xF0, 0x90, 0x80, 0x09, 0xE0, 0x60, | ||
| 65 | 0x21, 0x12, 0x00, 0xDD, 0x14, 0x60, 0x1B, 0x12, | ||
| 66 | 0x00, 0xDD, 0x14, 0x60, 0x15, 0x12, 0x00, 0xDD, | ||
| 67 | 0x14, 0x60, 0x0F, 0x12, 0x00, 0xDD, 0x14, 0x60, | ||
| 68 | 0x09, 0x12, 0x00, 0xDD, 0x14, 0x60, 0x03, 0x12, | ||
| 69 | 0x00, 0xDD, 0x90, 0x80, 0x42, 0xE0, 0x60, 0x0B, | ||
| 70 | 0x14, 0x60, 0x0C, 0x14, 0x60, 0x0D, 0x14, 0x60, | ||
| 71 | 0x0E, 0x01, 0xB3, 0x74, 0x04, 0x01, 0xB9, 0x74, | ||
| 72 | 0x05, 0x01, 0xB9, 0x74, 0x07, 0x01, 0xB9, 0x74, | ||
| 73 | 0x0A, 0xC0, 0xE0, 0x74, 0xC8, 0x12, 0x00, 0xE2, | ||
| 74 | 0xD0, 0xE0, 0x14, 0x70, 0xF4, 0x90, 0x80, 0x09, | ||
| 75 | 0xE0, 0x70, 0xAE, 0x12, 0x00, 0xF6, 0x12, 0x00, | ||
| 76 | 0xFE, 0x90, 0x00, 0x48, 0xE0, 0x04, 0xF0, 0x90, | ||
| 77 | 0x80, 0x4E, 0xF0, 0x01, 0x73, 0x90, 0x80, 0x08, | ||
| 78 | 0xF0, 0x22, 0xF8, 0x7A, 0x0C, 0x79, 0xFD, 0x00, | ||
| 79 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xD9, | ||
| 80 | 0xF6, 0xDA, 0xF2, 0xD8, 0xEE, 0x22, 0x90, 0x80, | ||
| 81 | 0x65, 0xE0, 0x54, 0xFD, 0xF0, 0x22, 0x90, 0x80, | ||
| 82 | 0x65, 0xE0, 0x44, 0xC2, 0xF0, 0x22 | ||
| 83 | }; | ||
| 84 | |||
| 85 | /* LGS8GXX internal helper functions */ | 50 | /* LGS8GXX internal helper functions */ |
| 86 | 51 | ||
| 87 | static int lgs8gxx_write_reg(struct lgs8gxx_state *priv, u8 reg, u8 data) | 52 | static int lgs8gxx_write_reg(struct lgs8gxx_state *priv, u8 reg, u8 data) |
| @@ -627,9 +592,14 @@ static int lgs8913_init(struct lgs8gxx_state *priv) | |||
| 627 | 592 | ||
| 628 | static int lgs8g75_init_data(struct lgs8gxx_state *priv) | 593 | static int lgs8g75_init_data(struct lgs8gxx_state *priv) |
| 629 | { | 594 | { |
| 630 | const u8 *p = lgs8g75_initdat; | 595 | const struct firmware *fw; |
| 596 | int rc; | ||
| 631 | int i; | 597 | int i; |
| 632 | 598 | ||
| 599 | rc = request_firmware(&fw, "lgs8g75.fw", &priv->i2c->dev); | ||
| 600 | if (rc) | ||
| 601 | return rc; | ||
| 602 | |||
| 633 | lgs8gxx_write_reg(priv, 0xC6, 0x40); | 603 | lgs8gxx_write_reg(priv, 0xC6, 0x40); |
| 634 | 604 | ||
| 635 | lgs8gxx_write_reg(priv, 0x3D, 0x04); | 605 | lgs8gxx_write_reg(priv, 0x3D, 0x04); |
| @@ -640,16 +610,16 @@ static int lgs8g75_init_data(struct lgs8gxx_state *priv) | |||
| 640 | lgs8gxx_write_reg(priv, 0x3B, 0x00); | 610 | lgs8gxx_write_reg(priv, 0x3B, 0x00); |
| 641 | lgs8gxx_write_reg(priv, 0x38, 0x00); | 611 | lgs8gxx_write_reg(priv, 0x38, 0x00); |
| 642 | 612 | ||
| 643 | for (i = 0; i < sizeof(lgs8g75_initdat); i++) { | 613 | for (i = 0; i < fw->size; i++) { |
| 644 | lgs8gxx_write_reg(priv, 0x38, 0x00); | 614 | lgs8gxx_write_reg(priv, 0x38, 0x00); |
| 645 | lgs8gxx_write_reg(priv, 0x3A, (u8)(i&0xff)); | 615 | lgs8gxx_write_reg(priv, 0x3A, (u8)(i&0xff)); |
| 646 | lgs8gxx_write_reg(priv, 0x3B, (u8)(i>>8)); | 616 | lgs8gxx_write_reg(priv, 0x3B, (u8)(i>>8)); |
| 647 | lgs8gxx_write_reg(priv, 0x3C, *p); | 617 | lgs8gxx_write_reg(priv, 0x3C, fw->data[i]); |
| 648 | p++; | ||
| 649 | } | 618 | } |
| 650 | 619 | ||
| 651 | lgs8gxx_write_reg(priv, 0x38, 0x00); | 620 | lgs8gxx_write_reg(priv, 0x38, 0x00); |
| 652 | 621 | ||
| 622 | release_firmware(fw); | ||
| 653 | return 0; | 623 | return 0; |
| 654 | } | 624 | } |
| 655 | 625 | ||
diff --git a/drivers/media/dvb/frontends/mb86a16.c b/drivers/media/dvb/frontends/mb86a16.c index 599d1aa519a..33b63235b86 100644 --- a/drivers/media/dvb/frontends/mb86a16.c +++ b/drivers/media/dvb/frontends/mb86a16.c | |||
| @@ -1833,7 +1833,6 @@ static struct dvb_frontend_ops mb86a16_ops = { | |||
| 1833 | 1833 | ||
| 1834 | .get_frontend_algo = mb86a16_frontend_algo, | 1834 | .get_frontend_algo = mb86a16_frontend_algo, |
| 1835 | .search = mb86a16_search, | 1835 | .search = mb86a16_search, |
| 1836 | .read_status = mb86a16_read_status, | ||
| 1837 | .init = mb86a16_init, | 1836 | .init = mb86a16_init, |
| 1838 | .sleep = mb86a16_sleep, | 1837 | .sleep = mb86a16_sleep, |
| 1839 | .read_status = mb86a16_read_status, | 1838 | .read_status = mb86a16_read_status, |
diff --git a/drivers/media/dvb/frontends/tda10048.c b/drivers/media/dvb/frontends/tda10048.c index 4e2a7c8b2f6..93f6a75c238 100644 --- a/drivers/media/dvb/frontends/tda10048.c +++ b/drivers/media/dvb/frontends/tda10048.c | |||
| @@ -25,6 +25,7 @@ | |||
| 25 | #include <linux/string.h> | 25 | #include <linux/string.h> |
| 26 | #include <linux/slab.h> | 26 | #include <linux/slab.h> |
| 27 | #include <linux/delay.h> | 27 | #include <linux/delay.h> |
| 28 | #include <linux/math64.h> | ||
| 28 | #include <asm/div64.h> | 29 | #include <asm/div64.h> |
| 29 | #include "dvb_frontend.h" | 30 | #include "dvb_frontend.h" |
| 30 | #include "dvb_math.h" | 31 | #include "dvb_math.h" |
| @@ -49,8 +50,8 @@ | |||
| 49 | #define TDA10048_CONF_C4_1 0x1E | 50 | #define TDA10048_CONF_C4_1 0x1E |
| 50 | #define TDA10048_CONF_C4_2 0x1F | 51 | #define TDA10048_CONF_C4_2 0x1F |
| 51 | #define TDA10048_CODE_IN_RAM 0x20 | 52 | #define TDA10048_CODE_IN_RAM 0x20 |
| 52 | #define TDA10048_CHANNEL_INFO_1_R 0x22 | 53 | #define TDA10048_CHANNEL_INFO1_R 0x22 |
| 53 | #define TDA10048_CHANNEL_INFO_2_R 0x23 | 54 | #define TDA10048_CHANNEL_INFO2_R 0x23 |
| 54 | #define TDA10048_CHANNEL_INFO1 0x24 | 55 | #define TDA10048_CHANNEL_INFO1 0x24 |
| 55 | #define TDA10048_CHANNEL_INFO2 0x25 | 56 | #define TDA10048_CHANNEL_INFO2 0x25 |
| 56 | #define TDA10048_TIME_ERROR_R 0x26 | 57 | #define TDA10048_TIME_ERROR_R 0x26 |
| @@ -63,8 +64,8 @@ | |||
| 63 | #define TDA10048_IT_STAT 0x32 | 64 | #define TDA10048_IT_STAT 0x32 |
| 64 | #define TDA10048_DSP_AD_LSB 0x3C | 65 | #define TDA10048_DSP_AD_LSB 0x3C |
| 65 | #define TDA10048_DSP_AD_MSB 0x3D | 66 | #define TDA10048_DSP_AD_MSB 0x3D |
| 66 | #define TDA10048_DSP_REF_LSB 0x3E | 67 | #define TDA10048_DSP_REG_LSB 0x3E |
| 67 | #define TDA10048_DSP_REF_MSB 0x3F | 68 | #define TDA10048_DSP_REG_MSB 0x3F |
| 68 | #define TDA10048_CONF_TRISTATE1 0x44 | 69 | #define TDA10048_CONF_TRISTATE1 0x44 |
| 69 | #define TDA10048_CONF_TRISTATE2 0x45 | 70 | #define TDA10048_CONF_TRISTATE2 0x45 |
| 70 | #define TDA10048_CONF_POLARITY 0x46 | 71 | #define TDA10048_CONF_POLARITY 0x46 |
| @@ -112,7 +113,7 @@ | |||
| 112 | #define TDA10048_FREE_REG_1 0xB2 | 113 | #define TDA10048_FREE_REG_1 0xB2 |
| 113 | #define TDA10048_FREE_REG_2 0xB3 | 114 | #define TDA10048_FREE_REG_2 0xB3 |
| 114 | #define TDA10048_CONF_C3_1 0xC0 | 115 | #define TDA10048_CONF_C3_1 0xC0 |
| 115 | #define TDA10048_CYBER_CTRL 0xC2 | 116 | #define TDA10048_CVBER_CTRL 0xC2 |
| 116 | #define TDA10048_CBER_NMAX_LSB 0xC4 | 117 | #define TDA10048_CBER_NMAX_LSB 0xC4 |
| 117 | #define TDA10048_CBER_NMAX_MSB 0xC5 | 118 | #define TDA10048_CBER_NMAX_MSB 0xC5 |
| 118 | #define TDA10048_CBER_LSB 0xC6 | 119 | #define TDA10048_CBER_LSB 0xC6 |
| @@ -120,7 +121,7 @@ | |||
| 120 | #define TDA10048_VBER_LSB 0xC8 | 121 | #define TDA10048_VBER_LSB 0xC8 |
| 121 | #define TDA10048_VBER_MID 0xC9 | 122 | #define TDA10048_VBER_MID 0xC9 |
| 122 | #define TDA10048_VBER_MSB 0xCA | 123 | #define TDA10048_VBER_MSB 0xCA |
| 123 | #define TDA10048_CYBER_LUT 0xCC | 124 | #define TDA10048_CVBER_LUT 0xCC |
| 124 | #define TDA10048_UNCOR_CTRL 0xCD | 125 | #define TDA10048_UNCOR_CTRL 0xCD |
| 125 | #define TDA10048_UNCOR_CPT_LSB 0xCE | 126 | #define TDA10048_UNCOR_CPT_LSB 0xCE |
| 126 | #define TDA10048_UNCOR_CPT_MSB 0xCF | 127 | #define TDA10048_UNCOR_CPT_MSB 0xCF |
| @@ -183,7 +184,7 @@ static struct init_tab { | |||
| 183 | { TDA10048_AGC_IF_MAX, 0xff }, | 184 | { TDA10048_AGC_IF_MAX, 0xff }, |
| 184 | { TDA10048_AGC_THRESHOLD_MSB, 0x00 }, | 185 | { TDA10048_AGC_THRESHOLD_MSB, 0x00 }, |
| 185 | { TDA10048_AGC_THRESHOLD_LSB, 0x70 }, | 186 | { TDA10048_AGC_THRESHOLD_LSB, 0x70 }, |
| 186 | { TDA10048_CYBER_CTRL, 0x38 }, | 187 | { TDA10048_CVBER_CTRL, 0x38 }, |
| 187 | { TDA10048_AGC_GAINS, 0x12 }, | 188 | { TDA10048_AGC_GAINS, 0x12 }, |
| 188 | { TDA10048_CONF_XO, 0x00 }, | 189 | { TDA10048_CONF_XO, 0x00 }, |
| 189 | { TDA10048_CONF_TS1, 0x07 }, | 190 | { TDA10048_CONF_TS1, 0x07 }, |
| @@ -688,7 +689,7 @@ static int tda10048_get_tps(struct tda10048_state *state, | |||
| 688 | p->guard_interval = GUARD_INTERVAL_1_4; | 689 | p->guard_interval = GUARD_INTERVAL_1_4; |
| 689 | break; | 690 | break; |
| 690 | } | 691 | } |
| 691 | switch (val & 0x02) { | 692 | switch (val & 0x03) { |
| 692 | case 0: | 693 | case 0: |
| 693 | p->transmission_mode = TRANSMISSION_MODE_2K; | 694 | p->transmission_mode = TRANSMISSION_MODE_2K; |
| 694 | break; | 695 | break; |
| @@ -765,6 +766,8 @@ static int tda10048_set_frontend(struct dvb_frontend *fe, | |||
| 765 | 766 | ||
| 766 | /* Enable demod TPS auto detection and begin acquisition */ | 767 | /* Enable demod TPS auto detection and begin acquisition */ |
| 767 | tda10048_writereg(state, TDA10048_AUTO, 0x57); | 768 | tda10048_writereg(state, TDA10048_AUTO, 0x57); |
| 769 | /* trigger cber and vber acquisition */ | ||
| 770 | tda10048_writereg(state, TDA10048_CVBER_CTRL, 0x3B); | ||
| 768 | 771 | ||
| 769 | return 0; | 772 | return 0; |
| 770 | } | 773 | } |
| @@ -830,12 +833,27 @@ static int tda10048_read_status(struct dvb_frontend *fe, fe_status_t *status) | |||
| 830 | static int tda10048_read_ber(struct dvb_frontend *fe, u32 *ber) | 833 | static int tda10048_read_ber(struct dvb_frontend *fe, u32 *ber) |
| 831 | { | 834 | { |
| 832 | struct tda10048_state *state = fe->demodulator_priv; | 835 | struct tda10048_state *state = fe->demodulator_priv; |
| 836 | static u32 cber_current; | ||
| 837 | u32 cber_nmax; | ||
| 838 | u64 cber_tmp; | ||
| 833 | 839 | ||
| 834 | dprintk(1, "%s()\n", __func__); | 840 | dprintk(1, "%s()\n", __func__); |
| 835 | 841 | ||
| 836 | /* TODO: A reset may be required here */ | 842 | /* update cber on interrupt */ |
| 837 | *ber = tda10048_readreg(state, TDA10048_CBER_MSB) << 8 | | 843 | if (tda10048_readreg(state, TDA10048_SOFT_IT_C3) & 0x01) { |
| 838 | tda10048_readreg(state, TDA10048_CBER_LSB); | 844 | cber_tmp = tda10048_readreg(state, TDA10048_CBER_MSB) << 8 | |
| 845 | tda10048_readreg(state, TDA10048_CBER_LSB); | ||
| 846 | cber_nmax = tda10048_readreg(state, TDA10048_CBER_NMAX_MSB) << 8 | | ||
| 847 | tda10048_readreg(state, TDA10048_CBER_NMAX_LSB); | ||
| 848 | cber_tmp *= 100000000; | ||
| 849 | cber_tmp *= 2; | ||
| 850 | cber_tmp = div_u64(cber_tmp, (cber_nmax * 32) + 1); | ||
| 851 | cber_current = (u32)cber_tmp; | ||
| 852 | /* retrigger cber acquisition */ | ||
| 853 | tda10048_writereg(state, TDA10048_CVBER_CTRL, 0x39); | ||
| 854 | } | ||
| 855 | /* actual cber is (*ber)/1e8 */ | ||
| 856 | *ber = cber_current; | ||
| 839 | 857 | ||
| 840 | return 0; | 858 | return 0; |
| 841 | } | 859 | } |
| @@ -1015,6 +1033,9 @@ static int tda10048_read_ucblocks(struct dvb_frontend *fe, u32 *ucblocks) | |||
| 1015 | 1033 | ||
| 1016 | *ucblocks = tda10048_readreg(state, TDA10048_UNCOR_CPT_MSB) << 8 | | 1034 | *ucblocks = tda10048_readreg(state, TDA10048_UNCOR_CPT_MSB) << 8 | |
| 1017 | tda10048_readreg(state, TDA10048_UNCOR_CPT_LSB); | 1035 | tda10048_readreg(state, TDA10048_UNCOR_CPT_LSB); |
| 1036 | /* clear the uncorrected TS packets counter when saturated */ | ||
| 1037 | if (*ucblocks == 0xFFFF) | ||
| 1038 | tda10048_writereg(state, TDA10048_UNCOR_CTRL, 0x80); | ||
| 1018 | 1039 | ||
| 1019 | return 0; | 1040 | return 0; |
| 1020 | } | 1041 | } |
diff --git a/drivers/media/dvb/mantis/Kconfig b/drivers/media/dvb/mantis/Kconfig index f7b72a32adf..decdeda840d 100644 --- a/drivers/media/dvb/mantis/Kconfig +++ b/drivers/media/dvb/mantis/Kconfig | |||
| @@ -10,9 +10,15 @@ config MANTIS_CORE | |||
| 10 | config DVB_MANTIS | 10 | config DVB_MANTIS |
| 11 | tristate "MANTIS based cards" | 11 | tristate "MANTIS based cards" |
| 12 | depends on MANTIS_CORE && DVB_CORE && PCI && I2C | 12 | depends on MANTIS_CORE && DVB_CORE && PCI && I2C |
| 13 | select DVB_MB86A16 | 13 | select DVB_MB86A16 if !DVB_FE_CUSTOMISE |
| 14 | select DVB_ZL10353 | 14 | select DVB_ZL10353 if !DVB_FE_CUSTOMISE |
| 15 | select DVB_STV0299 | 15 | select DVB_STV0299 if !DVB_FE_CUSTOMISE |
| 16 | select DVB_LNBP21 if !DVB_FE_CUSTOMISE | ||
| 17 | select DVB_STB0899 if !DVB_FE_CUSTOMISE | ||
| 18 | select DVB_STB6100 if !DVB_FE_CUSTOMISE | ||
| 19 | select DVB_TDA665x if !DVB_FE_CUSTOMISE | ||
| 20 | select DVB_TDA10021 if !DVB_FE_CUSTOMISE | ||
| 21 | select DVB_TDA10023 if !DVB_FE_CUSTOMISE | ||
| 16 | select DVB_PLL | 22 | select DVB_PLL |
| 17 | help | 23 | help |
| 18 | Support for PCI cards based on the Mantis PCI bridge. | 24 | Support for PCI cards based on the Mantis PCI bridge. |
| @@ -23,7 +29,7 @@ config DVB_MANTIS | |||
| 23 | config DVB_HOPPER | 29 | config DVB_HOPPER |
| 24 | tristate "HOPPER based cards" | 30 | tristate "HOPPER based cards" |
| 25 | depends on MANTIS_CORE && DVB_CORE && PCI && I2C | 31 | depends on MANTIS_CORE && DVB_CORE && PCI && I2C |
| 26 | select DVB_ZL10353 | 32 | select DVB_ZL10353 if !DVB_FE_CUSTOMISE |
| 27 | select DVB_PLL | 33 | select DVB_PLL |
| 28 | help | 34 | help |
| 29 | Support for PCI cards based on the Hopper PCI bridge. | 35 | Support for PCI cards based on the Hopper PCI bridge. |
diff --git a/drivers/media/dvb/mantis/mantis_input.c b/drivers/media/dvb/mantis/mantis_input.c index 3d4e4663220..a99489b8418 100644 --- a/drivers/media/dvb/mantis/mantis_input.c +++ b/drivers/media/dvb/mantis/mantis_input.c | |||
| @@ -19,7 +19,7 @@ | |||
| 19 | */ | 19 | */ |
| 20 | 20 | ||
| 21 | #include <linux/input.h> | 21 | #include <linux/input.h> |
| 22 | #include <media/ir-common.h> | 22 | #include <media/ir-core.h> |
| 23 | #include <linux/pci.h> | 23 | #include <linux/pci.h> |
| 24 | 24 | ||
| 25 | #include "dmxdev.h" | 25 | #include "dmxdev.h" |
| @@ -104,7 +104,6 @@ EXPORT_SYMBOL_GPL(ir_mantis); | |||
| 104 | int mantis_input_init(struct mantis_pci *mantis) | 104 | int mantis_input_init(struct mantis_pci *mantis) |
| 105 | { | 105 | { |
| 106 | struct input_dev *rc; | 106 | struct input_dev *rc; |
| 107 | struct ir_input_state rc_state; | ||
| 108 | char name[80], dev[80]; | 107 | char name[80], dev[80]; |
| 109 | int err; | 108 | int err; |
| 110 | 109 | ||
| @@ -120,8 +119,6 @@ int mantis_input_init(struct mantis_pci *mantis) | |||
| 120 | rc->name = name; | 119 | rc->name = name; |
| 121 | rc->phys = dev; | 120 | rc->phys = dev; |
| 122 | 121 | ||
| 123 | ir_input_init(rc, &rc_state, IR_TYPE_OTHER); | ||
| 124 | |||
| 125 | rc->id.bustype = BUS_PCI; | 122 | rc->id.bustype = BUS_PCI; |
| 126 | rc->id.vendor = mantis->vendor_id; | 123 | rc->id.vendor = mantis->vendor_id; |
| 127 | rc->id.product = mantis->device_id; | 124 | rc->id.product = mantis->device_id; |
diff --git a/drivers/media/dvb/siano/sms-cards.c b/drivers/media/dvb/siano/sms-cards.c index cff77e2eb55..25b43e587fa 100644 --- a/drivers/media/dvb/siano/sms-cards.c +++ b/drivers/media/dvb/siano/sms-cards.c | |||
| @@ -64,9 +64,11 @@ static struct sms_board sms_boards[] = { | |||
| 64 | .type = SMS_NOVA_B0, | 64 | .type = SMS_NOVA_B0, |
| 65 | .fw[DEVICE_MODE_ISDBT_BDA] = "sms1xxx-hcw-55xxx-isdbt-02.fw", | 65 | .fw[DEVICE_MODE_ISDBT_BDA] = "sms1xxx-hcw-55xxx-isdbt-02.fw", |
| 66 | .fw[DEVICE_MODE_DVBT_BDA] = "sms1xxx-hcw-55xxx-dvbt-02.fw", | 66 | .fw[DEVICE_MODE_DVBT_BDA] = "sms1xxx-hcw-55xxx-dvbt-02.fw", |
| 67 | .rc_codes = RC_MAP_RC5_HAUPPAUGE_NEW, | ||
| 67 | .board_cfg.leds_power = 26, | 68 | .board_cfg.leds_power = 26, |
| 68 | .board_cfg.led0 = 27, | 69 | .board_cfg.led0 = 27, |
| 69 | .board_cfg.led1 = 28, | 70 | .board_cfg.led1 = 28, |
| 71 | .board_cfg.ir = 9, | ||
| 70 | .led_power = 26, | 72 | .led_power = 26, |
| 71 | .led_lo = 27, | 73 | .led_lo = 27, |
| 72 | .led_hi = 28, | 74 | .led_hi = 28, |
diff --git a/drivers/media/dvb/siano/sms-cards.h b/drivers/media/dvb/siano/sms-cards.h index 8f19fc000b4..d8cdf756f7c 100644 --- a/drivers/media/dvb/siano/sms-cards.h +++ b/drivers/media/dvb/siano/sms-cards.h | |||
| @@ -75,7 +75,7 @@ struct sms_board { | |||
| 75 | enum sms_device_type_st type; | 75 | enum sms_device_type_st type; |
| 76 | char *name, *fw[DEVICE_MODE_MAX]; | 76 | char *name, *fw[DEVICE_MODE_MAX]; |
| 77 | struct sms_board_gpio_cfg board_cfg; | 77 | struct sms_board_gpio_cfg board_cfg; |
| 78 | enum ir_kb_type ir_kb_type; | 78 | char *rc_codes; /* Name of IR codes table */ |
| 79 | 79 | ||
| 80 | /* gpios */ | 80 | /* gpios */ |
| 81 | int led_power, led_hi, led_lo, lna_ctrl, rf_switch; | 81 | int led_power, led_hi, led_lo, lna_ctrl, rf_switch; |
diff --git a/drivers/media/dvb/siano/smscoreapi.c b/drivers/media/dvb/siano/smscoreapi.c index 0c87a3c3899..828bcc2e129 100644 --- a/drivers/media/dvb/siano/smscoreapi.c +++ b/drivers/media/dvb/siano/smscoreapi.c | |||
| @@ -116,9 +116,7 @@ static struct smscore_registry_entry_t *smscore_find_registry(char *devpath) | |||
| 116 | return entry; | 116 | return entry; |
| 117 | } | 117 | } |
| 118 | } | 118 | } |
| 119 | entry = (struct smscore_registry_entry_t *) | 119 | entry = kmalloc(sizeof(struct smscore_registry_entry_t), GFP_KERNEL); |
| 120 | kmalloc(sizeof(struct smscore_registry_entry_t), | ||
| 121 | GFP_KERNEL); | ||
| 122 | if (entry) { | 120 | if (entry) { |
| 123 | entry->mode = default_mode; | 121 | entry->mode = default_mode; |
| 124 | strcpy(entry->devpath, devpath); | 122 | strcpy(entry->devpath, devpath); |
diff --git a/drivers/media/dvb/siano/smsir.c b/drivers/media/dvb/siano/smsir.c index a56eac76e0f..d0e4639ee9d 100644 --- a/drivers/media/dvb/siano/smsir.c +++ b/drivers/media/dvb/siano/smsir.c | |||
| @@ -4,6 +4,11 @@ | |||
| 4 | MDTV receiver kernel modules. | 4 | MDTV receiver kernel modules. |
| 5 | Copyright (C) 2006-2009, Uri Shkolnik | 5 | Copyright (C) 2006-2009, Uri Shkolnik |
| 6 | 6 | ||
| 7 | Copyright (c) 2010 - Mauro Carvalho Chehab | ||
| 8 | - Ported the driver to use rc-core | ||
| 9 | - IR raw event decoding is now done at rc-core | ||
| 10 | - Code almost re-written | ||
| 11 | |||
| 7 | This program is free software: you can redistribute it and/or modify | 12 | This program is free software: you can redistribute it and/or modify |
| 8 | it under the terms of the GNU General Public License as published by | 13 | it under the terms of the GNU General Public License as published by |
| 9 | the Free Software Foundation, either version 2 of the License, or | 14 | the Free Software Foundation, either version 2 of the License, or |
| @@ -27,226 +32,28 @@ | |||
| 27 | #include "smsir.h" | 32 | #include "smsir.h" |
| 28 | #include "sms-cards.h" | 33 | #include "sms-cards.h" |
| 29 | 34 | ||
| 30 | /* In order to add new IR remote control - | 35 | #define MODULE_NAME "smsmdtv" |
| 31 | * 1) Add it to the <enum ir_kb_type> @ smsir,h, | ||
| 32 | * 2) Add its map to keyboard_layout_maps below | ||
| 33 | * 3) Set your board (sms-cards sub-module) to use it | ||
| 34 | */ | ||
| 35 | |||
| 36 | static struct keyboard_layout_map_t keyboard_layout_maps[] = { | ||
| 37 | [SMS_IR_KB_DEFAULT_TV] = { | ||
| 38 | .ir_protocol = IR_RC5, | ||
| 39 | .rc5_kbd_address = KEYBOARD_ADDRESS_TV1, | ||
| 40 | .keyboard_layout_map = { | ||
| 41 | KEY_0, KEY_1, KEY_2, | ||
| 42 | KEY_3, KEY_4, KEY_5, | ||
| 43 | KEY_6, KEY_7, KEY_8, | ||
| 44 | KEY_9, 0, 0, KEY_POWER, | ||
| 45 | KEY_MUTE, 0, 0, | ||
| 46 | KEY_VOLUMEUP, KEY_VOLUMEDOWN, | ||
| 47 | KEY_BRIGHTNESSUP, | ||
| 48 | KEY_BRIGHTNESSDOWN, KEY_CHANNELUP, | ||
| 49 | KEY_CHANNELDOWN, | ||
| 50 | 0, 0, 0, 0, 0, 0, 0, 0, | ||
| 51 | 0, 0, 0, 0, 0, 0, 0, 0, | ||
| 52 | 0, 0, 0, 0, 0, 0, 0, 0, | ||
| 53 | 0, 0, 0, 0, 0, 0, 0, 0, | ||
| 54 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 | ||
| 55 | } | ||
| 56 | }, | ||
| 57 | [SMS_IR_KB_HCW_SILVER] = { | ||
| 58 | .ir_protocol = IR_RC5, | ||
| 59 | .rc5_kbd_address = KEYBOARD_ADDRESS_LIGHTING1, | ||
| 60 | .keyboard_layout_map = { | ||
| 61 | KEY_0, KEY_1, KEY_2, | ||
| 62 | KEY_3, KEY_4, KEY_5, | ||
| 63 | KEY_6, KEY_7, KEY_8, | ||
| 64 | KEY_9, KEY_TEXT, KEY_RED, | ||
| 65 | KEY_RADIO, KEY_MENU, | ||
| 66 | KEY_SUBTITLE, | ||
| 67 | KEY_MUTE, KEY_VOLUMEUP, | ||
| 68 | KEY_VOLUMEDOWN, KEY_PREVIOUS, 0, | ||
| 69 | KEY_UP, KEY_DOWN, KEY_LEFT, | ||
| 70 | KEY_RIGHT, KEY_VIDEO, KEY_AUDIO, | ||
| 71 | KEY_MHP, KEY_EPG, KEY_TV, | ||
| 72 | 0, KEY_NEXTSONG, KEY_EXIT, | ||
| 73 | KEY_CHANNELUP, KEY_CHANNELDOWN, | ||
| 74 | KEY_CHANNEL, 0, | ||
| 75 | KEY_PREVIOUSSONG, KEY_ENTER, | ||
| 76 | KEY_SLEEP, 0, 0, KEY_BLUE, | ||
| 77 | 0, 0, 0, 0, KEY_GREEN, 0, | ||
| 78 | KEY_PAUSE, 0, KEY_REWIND, | ||
| 79 | 0, KEY_FASTFORWARD, KEY_PLAY, | ||
| 80 | KEY_STOP, KEY_RECORD, | ||
| 81 | KEY_YELLOW, 0, 0, KEY_SELECT, | ||
| 82 | KEY_ZOOM, KEY_POWER, 0, 0 | ||
| 83 | } | ||
| 84 | }, | ||
| 85 | { } /* Terminating entry */ | ||
| 86 | }; | ||
| 87 | |||
| 88 | static u32 ir_pos; | ||
| 89 | static u32 ir_word; | ||
| 90 | static u32 ir_toggle; | ||
| 91 | |||
| 92 | #define RC5_PUSH_BIT(dst, bit, pos) \ | ||
| 93 | { dst <<= 1; dst |= bit; pos++; } | ||
| 94 | |||
| 95 | |||
| 96 | static void sms_ir_rc5_event(struct smscore_device_t *coredev, | ||
| 97 | u32 toggle, u32 addr, u32 cmd) | ||
| 98 | { | ||
| 99 | bool toggle_changed; | ||
| 100 | u16 keycode; | ||
| 101 | |||
| 102 | sms_log("IR RC5 word: address %d, command %d, toggle %d", | ||
| 103 | addr, cmd, toggle); | ||
| 104 | |||
| 105 | toggle_changed = ir_toggle != toggle; | ||
| 106 | /* keep toggle */ | ||
| 107 | ir_toggle = toggle; | ||
| 108 | |||
| 109 | if (addr != | ||
| 110 | keyboard_layout_maps[coredev->ir.ir_kb_type].rc5_kbd_address) | ||
| 111 | return; /* Check for valid address */ | ||
| 112 | |||
| 113 | keycode = | ||
| 114 | keyboard_layout_maps | ||
| 115 | [coredev->ir.ir_kb_type].keyboard_layout_map[cmd]; | ||
| 116 | 36 | ||
| 117 | if (!toggle_changed && | 37 | void sms_ir_event(struct smscore_device_t *coredev, const char *buf, int len) |
| 118 | (keycode != KEY_VOLUMEUP && keycode != KEY_VOLUMEDOWN)) | ||
| 119 | return; /* accept only repeated volume, reject other keys */ | ||
| 120 | |||
| 121 | sms_log("kernel input keycode (from ir) %d", keycode); | ||
| 122 | input_report_key(coredev->ir.input_dev, keycode, 1); | ||
| 123 | input_sync(coredev->ir.input_dev); | ||
| 124 | |||
| 125 | } | ||
| 126 | |||
| 127 | /* decode raw bit pattern to RC5 code */ | ||
| 128 | /* taken from ir-functions.c */ | ||
| 129 | static u32 ir_rc5_decode(unsigned int code) | ||
| 130 | { | 38 | { |
| 131 | /* unsigned int org_code = code;*/ | ||
| 132 | unsigned int pair; | ||
| 133 | unsigned int rc5 = 0; | ||
| 134 | int i; | 39 | int i; |
| 40 | const s32 *samples = (const void *)buf; | ||
| 135 | 41 | ||
| 136 | for (i = 0; i < 14; ++i) { | 42 | for (i = 0; i < len >> 2; i++) { |
| 137 | pair = code & 0x3; | 43 | struct ir_raw_event ev; |
| 138 | code >>= 2; | ||
| 139 | |||
| 140 | rc5 <<= 1; | ||
| 141 | switch (pair) { | ||
| 142 | case 0: | ||
| 143 | case 2: | ||
| 144 | break; | ||
| 145 | case 1: | ||
| 146 | rc5 |= 1; | ||
| 147 | break; | ||
| 148 | case 3: | ||
| 149 | /* dprintk(1, "ir-common: ir_rc5_decode(%x) bad code\n", org_code);*/ | ||
| 150 | sms_log("bad code"); | ||
| 151 | return 0; | ||
| 152 | } | ||
| 153 | } | ||
| 154 | /* | ||
| 155 | dprintk(1, "ir-common: code=%x, rc5=%x, start=%x, | ||
| 156 | toggle=%x, address=%x, " | ||
| 157 | "instr=%x\n", rc5, org_code, RC5_START(rc5), | ||
| 158 | RC5_TOGGLE(rc5), RC5_ADDR(rc5), RC5_INSTR(rc5)); | ||
| 159 | */ | ||
| 160 | return rc5; | ||
| 161 | } | ||
| 162 | |||
| 163 | static void sms_rc5_parse_word(struct smscore_device_t *coredev) | ||
| 164 | { | ||
| 165 | #define RC5_START(x) (((x)>>12)&3) | ||
| 166 | #define RC5_TOGGLE(x) (((x)>>11)&1) | ||
| 167 | #define RC5_ADDR(x) (((x)>>6)&0x1F) | ||
| 168 | #define RC5_INSTR(x) ((x)&0x3F) | ||
| 169 | |||
| 170 | int i, j; | ||
| 171 | u32 rc5_word = 0; | ||
| 172 | |||
| 173 | /* Reverse the IR word direction */ | ||
| 174 | for (i = 0 ; i < 28 ; i++) | ||
| 175 | RC5_PUSH_BIT(rc5_word, (ir_word>>i)&1, j) | ||
| 176 | |||
| 177 | rc5_word = ir_rc5_decode(rc5_word); | ||
| 178 | /* sms_log("temp = 0x%x, rc5_code = 0x%x", ir_word, rc5_word); */ | ||
| 179 | |||
| 180 | sms_ir_rc5_event(coredev, | ||
| 181 | RC5_TOGGLE(rc5_word), | ||
| 182 | RC5_ADDR(rc5_word), | ||
| 183 | RC5_INSTR(rc5_word)); | ||
| 184 | } | ||
| 185 | |||
| 186 | |||
| 187 | static void sms_rc5_accumulate_bits(struct smscore_device_t *coredev, | ||
| 188 | s32 ir_sample) | ||
| 189 | { | ||
| 190 | #define RC5_TIME_GRANULARITY 200 | ||
| 191 | #define RC5_DEF_BIT_TIME 889 | ||
| 192 | #define RC5_MAX_SAME_BIT_CONT 4 | ||
| 193 | #define RC5_WORD_LEN 27 /* 28 bit */ | ||
| 194 | |||
| 195 | u32 i, j; | ||
| 196 | s32 delta_time; | ||
| 197 | u32 time = (ir_sample > 0) ? ir_sample : (0-ir_sample); | ||
| 198 | u32 level = (ir_sample < 0) ? 0 : 1; | ||
| 199 | |||
| 200 | for (i = RC5_MAX_SAME_BIT_CONT; i > 0; i--) { | ||
| 201 | delta_time = time - (i*RC5_DEF_BIT_TIME) + RC5_TIME_GRANULARITY; | ||
| 202 | if (delta_time < 0) | ||
| 203 | continue; /* not so many consecutive bits */ | ||
| 204 | if (delta_time > (2 * RC5_TIME_GRANULARITY)) { | ||
| 205 | /* timeout */ | ||
| 206 | if (ir_pos == (RC5_WORD_LEN-1)) | ||
| 207 | /* complete last bit */ | ||
| 208 | RC5_PUSH_BIT(ir_word, level, ir_pos) | ||
| 209 | |||
| 210 | if (ir_pos == RC5_WORD_LEN) | ||
| 211 | sms_rc5_parse_word(coredev); | ||
| 212 | else if (ir_pos) /* timeout within a word */ | ||
| 213 | sms_log("IR error parsing a word"); | ||
| 214 | 44 | ||
| 215 | ir_pos = 0; | 45 | ev.duration = abs(samples[i]) * 1000; /* Convert to ns */ |
| 216 | ir_word = 0; | 46 | ev.pulse = (samples[i] > 0) ? false : true; |
| 217 | /* sms_log("timeout %d", time); */ | ||
| 218 | break; | ||
| 219 | } | ||
| 220 | /* The time is within the range of this number of bits */ | ||
| 221 | for (j = 0 ; j < i ; j++) | ||
| 222 | RC5_PUSH_BIT(ir_word, level, ir_pos) | ||
| 223 | 47 | ||
| 224 | break; | 48 | ir_raw_event_store(coredev->ir.input_dev, &ev); |
| 225 | } | 49 | } |
| 226 | } | 50 | ir_raw_event_handle(coredev->ir.input_dev); |
| 227 | |||
| 228 | void sms_ir_event(struct smscore_device_t *coredev, const char *buf, int len) | ||
| 229 | { | ||
| 230 | #define IR_DATA_RECEIVE_MAX_LEN 520 /* 128*4 + 4 + 4 */ | ||
| 231 | u32 i; | ||
| 232 | enum ir_protocol ir_protocol = | ||
| 233 | keyboard_layout_maps[coredev->ir.ir_kb_type] | ||
| 234 | .ir_protocol; | ||
| 235 | s32 *samples; | ||
| 236 | int count = len>>2; | ||
| 237 | |||
| 238 | samples = (s32 *)buf; | ||
| 239 | /* sms_log("IR buffer received, length = %d", count);*/ | ||
| 240 | |||
| 241 | for (i = 0; i < count; i++) | ||
| 242 | if (ir_protocol == IR_RC5) | ||
| 243 | sms_rc5_accumulate_bits(coredev, samples[i]); | ||
| 244 | /* IR_RCMM not implemented */ | ||
| 245 | } | 51 | } |
| 246 | 52 | ||
| 247 | int sms_ir_init(struct smscore_device_t *coredev) | 53 | int sms_ir_init(struct smscore_device_t *coredev) |
| 248 | { | 54 | { |
| 249 | struct input_dev *input_dev; | 55 | struct input_dev *input_dev; |
| 56 | int board_id = smscore_get_board_id(coredev); | ||
| 250 | 57 | ||
| 251 | sms_log("Allocating input device"); | 58 | sms_log("Allocating input device"); |
| 252 | input_dev = input_allocate_device(); | 59 | input_dev = input_allocate_device(); |
| @@ -256,33 +63,38 @@ int sms_ir_init(struct smscore_device_t *coredev) | |||
| 256 | } | 63 | } |
| 257 | 64 | ||
| 258 | coredev->ir.input_dev = input_dev; | 65 | coredev->ir.input_dev = input_dev; |
| 259 | coredev->ir.ir_kb_type = | ||
| 260 | sms_get_board(smscore_get_board_id(coredev))->ir_kb_type; | ||
| 261 | coredev->ir.keyboard_layout_map = | ||
| 262 | keyboard_layout_maps[coredev->ir.ir_kb_type]. | ||
| 263 | keyboard_layout_map; | ||
| 264 | sms_log("IR remote keyboard type is %d", coredev->ir.ir_kb_type); | ||
| 265 | 66 | ||
| 266 | coredev->ir.controller = 0; /* Todo: vega/nova SPI number */ | 67 | coredev->ir.controller = 0; /* Todo: vega/nova SPI number */ |
| 267 | coredev->ir.timeout = IR_DEFAULT_TIMEOUT; | 68 | coredev->ir.timeout = IR_DEFAULT_TIMEOUT; |
| 268 | sms_log("IR port %d, timeout %d ms", | 69 | sms_log("IR port %d, timeout %d ms", |
| 269 | coredev->ir.controller, coredev->ir.timeout); | 70 | coredev->ir.controller, coredev->ir.timeout); |
| 270 | 71 | ||
| 271 | snprintf(coredev->ir.name, | 72 | snprintf(coredev->ir.name, sizeof(coredev->ir.name), |
| 272 | IR_DEV_NAME_MAX_LEN, | 73 | "SMS IR (%s)", sms_get_board(board_id)->name); |
| 273 | "SMS IR w/kbd type %d", | 74 | |
| 274 | coredev->ir.ir_kb_type); | 75 | strlcpy(coredev->ir.phys, coredev->devpath, sizeof(coredev->ir.phys)); |
| 76 | strlcat(coredev->ir.phys, "/ir0", sizeof(coredev->ir.phys)); | ||
| 77 | |||
| 275 | input_dev->name = coredev->ir.name; | 78 | input_dev->name = coredev->ir.name; |
| 276 | input_dev->phys = coredev->ir.name; | 79 | input_dev->phys = coredev->ir.phys; |
| 277 | input_dev->dev.parent = coredev->device; | 80 | input_dev->dev.parent = coredev->device; |
| 278 | 81 | ||
| 279 | /* Key press events only */ | 82 | #if 0 |
| 280 | input_dev->evbit[0] = BIT_MASK(EV_KEY); | 83 | /* TODO: properly initialize the parameters bellow */ |
| 281 | input_dev->keybit[BIT_WORD(BTN_0)] = BIT_MASK(BTN_0); | 84 | input_dev->id.bustype = BUS_USB; |
| 85 | input_dev->id.version = 1; | ||
| 86 | input_dev->id.vendor = le16_to_cpu(dev->udev->descriptor.idVendor); | ||
| 87 | input_dev->id.product = le16_to_cpu(dev->udev->descriptor.idProduct); | ||
| 88 | #endif | ||
| 89 | |||
| 90 | coredev->ir.props.priv = coredev; | ||
| 91 | coredev->ir.props.driver_type = RC_DRIVER_IR_RAW; | ||
| 92 | coredev->ir.props.allowed_protos = IR_TYPE_ALL; | ||
| 282 | 93 | ||
| 283 | sms_log("Input device (IR) %s is set for key events", input_dev->name); | 94 | sms_log("Input device (IR) %s is set for key events", input_dev->name); |
| 284 | 95 | ||
| 285 | if (input_register_device(input_dev)) { | 96 | if (ir_input_register(input_dev, sms_get_board(board_id)->rc_codes, |
| 97 | &coredev->ir.props, MODULE_NAME)) { | ||
| 286 | sms_err("Failed to register device"); | 98 | sms_err("Failed to register device"); |
| 287 | input_free_device(input_dev); | 99 | input_free_device(input_dev); |
| 288 | return -EACCES; | 100 | return -EACCES; |
| @@ -294,8 +106,7 @@ int sms_ir_init(struct smscore_device_t *coredev) | |||
| 294 | void sms_ir_exit(struct smscore_device_t *coredev) | 106 | void sms_ir_exit(struct smscore_device_t *coredev) |
| 295 | { | 107 | { |
| 296 | if (coredev->ir.input_dev) | 108 | if (coredev->ir.input_dev) |
| 297 | input_unregister_device(coredev->ir.input_dev); | 109 | ir_input_unregister(coredev->ir.input_dev); |
| 298 | 110 | ||
| 299 | sms_log(""); | 111 | sms_log(""); |
| 300 | } | 112 | } |
| 301 | |||
diff --git a/drivers/media/dvb/siano/smsir.h b/drivers/media/dvb/siano/smsir.h index b7d703e2d33..926e247523b 100644 --- a/drivers/media/dvb/siano/smsir.h +++ b/drivers/media/dvb/siano/smsir.h | |||
| @@ -4,6 +4,11 @@ Siano Mobile Silicon, Inc. | |||
| 4 | MDTV receiver kernel modules. | 4 | MDTV receiver kernel modules. |
| 5 | Copyright (C) 2006-2009, Uri Shkolnik | 5 | Copyright (C) 2006-2009, Uri Shkolnik |
| 6 | 6 | ||
| 7 | Copyright (c) 2010 - Mauro Carvalho Chehab | ||
| 8 | - Ported the driver to use rc-core | ||
| 9 | - IR raw event decoding is now done at rc-core | ||
| 10 | - Code almost re-written | ||
| 11 | |||
| 7 | This program is free software: you can redistribute it and/or modify | 12 | This program is free software: you can redistribute it and/or modify |
| 8 | it under the terms of the GNU General Public License as published by | 13 | it under the terms of the GNU General Public License as published by |
| 9 | the Free Software Foundation, either version 2 of the License, or | 14 | the Free Software Foundation, either version 2 of the License, or |
| @@ -23,63 +28,21 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
| 23 | #define __SMS_IR_H__ | 28 | #define __SMS_IR_H__ |
| 24 | 29 | ||
| 25 | #include <linux/input.h> | 30 | #include <linux/input.h> |
| 31 | #include <media/ir-core.h> | ||
| 26 | 32 | ||
| 27 | #define IR_DEV_NAME_MAX_LEN 23 /* "SMS IR kbd type nn\0" */ | ||
| 28 | #define IR_KEYBOARD_LAYOUT_SIZE 64 | ||
| 29 | #define IR_DEFAULT_TIMEOUT 100 | 33 | #define IR_DEFAULT_TIMEOUT 100 |
| 30 | 34 | ||
| 31 | enum ir_kb_type { | ||
| 32 | SMS_IR_KB_DEFAULT_TV, | ||
| 33 | SMS_IR_KB_HCW_SILVER | ||
| 34 | }; | ||
| 35 | |||
| 36 | enum rc5_keyboard_address { | ||
| 37 | KEYBOARD_ADDRESS_TV1 = 0, | ||
| 38 | KEYBOARD_ADDRESS_TV2 = 1, | ||
| 39 | KEYBOARD_ADDRESS_TELETEXT = 2, | ||
| 40 | KEYBOARD_ADDRESS_VIDEO = 3, | ||
| 41 | KEYBOARD_ADDRESS_LV1 = 4, | ||
| 42 | KEYBOARD_ADDRESS_VCR1 = 5, | ||
| 43 | KEYBOARD_ADDRESS_VCR2 = 6, | ||
| 44 | KEYBOARD_ADDRESS_EXPERIMENTAL = 7, | ||
| 45 | KEYBOARD_ADDRESS_SAT1 = 8, | ||
| 46 | KEYBOARD_ADDRESS_CAMERA = 9, | ||
| 47 | KEYBOARD_ADDRESS_SAT2 = 10, | ||
| 48 | KEYBOARD_ADDRESS_CDV = 12, | ||
| 49 | KEYBOARD_ADDRESS_CAMCORDER = 13, | ||
| 50 | KEYBOARD_ADDRESS_PRE_AMP = 16, | ||
| 51 | KEYBOARD_ADDRESS_TUNER = 17, | ||
| 52 | KEYBOARD_ADDRESS_RECORDER1 = 18, | ||
| 53 | KEYBOARD_ADDRESS_PRE_AMP1 = 19, | ||
| 54 | KEYBOARD_ADDRESS_CD_PLAYER = 20, | ||
| 55 | KEYBOARD_ADDRESS_PHONO = 21, | ||
| 56 | KEYBOARD_ADDRESS_SATA = 22, | ||
| 57 | KEYBOARD_ADDRESS_RECORDER2 = 23, | ||
| 58 | KEYBOARD_ADDRESS_CDR = 26, | ||
| 59 | KEYBOARD_ADDRESS_LIGHTING = 29, | ||
| 60 | KEYBOARD_ADDRESS_LIGHTING1 = 30, /* KEYBOARD_ADDRESS_HCW_SILVER */ | ||
| 61 | KEYBOARD_ADDRESS_PHONE = 31, | ||
| 62 | KEYBOARD_ADDRESS_NOT_RC5 = 0xFFFF | ||
| 63 | }; | ||
| 64 | |||
| 65 | enum ir_protocol { | ||
| 66 | IR_RC5, | ||
| 67 | IR_RCMM | ||
| 68 | }; | ||
| 69 | |||
| 70 | struct keyboard_layout_map_t { | ||
| 71 | enum ir_protocol ir_protocol; | ||
| 72 | enum rc5_keyboard_address rc5_kbd_address; | ||
| 73 | u16 keyboard_layout_map[IR_KEYBOARD_LAYOUT_SIZE]; | ||
| 74 | }; | ||
| 75 | |||
| 76 | struct smscore_device_t; | 35 | struct smscore_device_t; |
| 77 | 36 | ||
| 78 | struct ir_t { | 37 | struct ir_t { |
| 79 | struct input_dev *input_dev; | 38 | struct input_dev *input_dev; |
| 80 | enum ir_kb_type ir_kb_type; | 39 | char name[40]; |
| 81 | char name[IR_DEV_NAME_MAX_LEN+1]; | 40 | char phys[32]; |
| 82 | u16 *keyboard_layout_map; | 41 | |
| 42 | char *rc_codes; | ||
| 43 | u64 protocol; | ||
| 44 | struct ir_dev_props props; | ||
| 45 | |||
| 83 | u32 timeout; | 46 | u32 timeout; |
| 84 | u32 controller; | 47 | u32 controller; |
| 85 | }; | 48 | }; |
diff --git a/drivers/media/dvb/siano/smsusb.c b/drivers/media/dvb/siano/smsusb.c index a9c27fb69ba..50d4338610e 100644 --- a/drivers/media/dvb/siano/smsusb.c +++ b/drivers/media/dvb/siano/smsusb.c | |||
| @@ -352,8 +352,7 @@ static int smsusb_init_device(struct usb_interface *intf, int board_id) | |||
| 352 | params.num_buffers = MAX_BUFFERS; | 352 | params.num_buffers = MAX_BUFFERS; |
| 353 | params.sendrequest_handler = smsusb_sendrequest; | 353 | params.sendrequest_handler = smsusb_sendrequest; |
| 354 | params.context = dev; | 354 | params.context = dev; |
| 355 | snprintf(params.devpath, sizeof(params.devpath), | 355 | usb_make_path(dev->udev, params.devpath, sizeof(params.devpath)); |
| 356 | "usb\\%d-%s", dev->udev->bus->busnum, dev->udev->devpath); | ||
| 357 | 356 | ||
| 358 | /* register in smscore */ | 357 | /* register in smscore */ |
| 359 | rc = smscore_register_device(¶ms, &dev->coredev); | 358 | rc = smscore_register_device(¶ms, &dev->coredev); |
