aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media
diff options
context:
space:
mode:
authorSean Young <sean@mess.org>2013-01-06 11:19:43 -0500
committerMauro Carvalho Chehab <mchehab@redhat.com>2013-02-05 15:59:23 -0500
commit6f2627c29f6619ebdbc6de8934b33c23b73be8e6 (patch)
tree86602ab2d00ca893e25f1be0020c23fab7319e5c /drivers/media
parent3e85a44aacd68744765f2fc7f0645645b34e64f8 (diff)
[media] winbond-cir: only enable higher sample resolution if needed
A sample resolution of 2us generates more than 300 interrupts per key and this resolution is not needed unless carrier reports are enabled. Revert to a resolution of 10us unless carrier reports are needed. This generates up to a fifth of the interrupts. Signed-off-by: Sean Young <sean@mess.org> Acked-by: David Härdeman <david@hardeman.nu> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media')
-rw-r--r--drivers/media/rc/winbond-cir.c27
1 files changed, 19 insertions, 8 deletions
diff --git a/drivers/media/rc/winbond-cir.c b/drivers/media/rc/winbond-cir.c
index 85424856ae7f..535a18dccbd0 100644
--- a/drivers/media/rc/winbond-cir.c
+++ b/drivers/media/rc/winbond-cir.c
@@ -154,6 +154,8 @@
154#define WBCIR_CNTR_R 0x02 154#define WBCIR_CNTR_R 0x02
155/* Invert TX */ 155/* Invert TX */
156#define WBCIR_IRTX_INV 0x04 156#define WBCIR_IRTX_INV 0x04
157/* Receiver oversampling */
158#define WBCIR_RX_T_OV 0x40
157 159
158/* Valid banks for the SP3 UART */ 160/* Valid banks for the SP3 UART */
159enum wbcir_bank { 161enum wbcir_bank {
@@ -394,7 +396,8 @@ wbcir_irq_rx(struct wbcir_data *data, struct pnp_dev *device)
394 if (data->rxstate == WBCIR_RXSTATE_ERROR) 396 if (data->rxstate == WBCIR_RXSTATE_ERROR)
395 continue; 397 continue;
396 398
397 duration = ((irdata & 0x7F) + 1) * 2; 399 duration = ((irdata & 0x7F) + 1) *
400 (data->carrier_report_enabled ? 2 : 10);
398 rawir.pulse = irdata & 0x80 ? false : true; 401 rawir.pulse = irdata & 0x80 ? false : true;
399 rawir.duration = US_TO_NS(duration); 402 rawir.duration = US_TO_NS(duration);
400 403
@@ -550,6 +553,17 @@ wbcir_set_carrier_report(struct rc_dev *dev, int enable)
550 wbcir_set_bits(data->ebase + WBCIR_REG_ECEIR_CCTL, 553 wbcir_set_bits(data->ebase + WBCIR_REG_ECEIR_CCTL,
551 WBCIR_CNTR_EN, WBCIR_CNTR_EN | WBCIR_CNTR_R); 554 WBCIR_CNTR_EN, WBCIR_CNTR_EN | WBCIR_CNTR_R);
552 555
556 /* Set a higher sampling resolution if carrier reports are enabled */
557 wbcir_select_bank(data, WBCIR_BANK_2);
558 data->dev->rx_resolution = US_TO_NS(enable ? 2 : 10);
559 outb(enable ? 0x03 : 0x0f, data->sbase + WBCIR_REG_SP3_BGDL);
560 outb(0x00, data->sbase + WBCIR_REG_SP3_BGDH);
561
562 /* Enable oversampling if carrier reports are enabled */
563 wbcir_select_bank(data, WBCIR_BANK_7);
564 wbcir_set_bits(data->sbase + WBCIR_REG_SP3_RCCFG,
565 enable ? WBCIR_RX_T_OV : 0, WBCIR_RX_T_OV);
566
553 data->carrier_report_enabled = enable; 567 data->carrier_report_enabled = enable;
554 spin_unlock_irqrestore(&data->spinlock, flags); 568 spin_unlock_irqrestore(&data->spinlock, flags);
555 569
@@ -931,8 +945,8 @@ wbcir_init_hw(struct wbcir_data *data)
931 /* prescaler 1.0, tx/rx fifo lvl 16 */ 945 /* prescaler 1.0, tx/rx fifo lvl 16 */
932 outb(0x30, data->sbase + WBCIR_REG_SP3_EXCR2); 946 outb(0x30, data->sbase + WBCIR_REG_SP3_EXCR2);
933 947
934 /* Set baud divisor to sample every 2 ns */ 948 /* Set baud divisor to sample every 10 us */
935 outb(0x03, data->sbase + WBCIR_REG_SP3_BGDL); 949 outb(0x0f, data->sbase + WBCIR_REG_SP3_BGDL);
936 outb(0x00, data->sbase + WBCIR_REG_SP3_BGDH); 950 outb(0x00, data->sbase + WBCIR_REG_SP3_BGDH);
937 951
938 /* Set CEIR mode */ 952 /* Set CEIR mode */
@@ -941,12 +955,9 @@ wbcir_init_hw(struct wbcir_data *data)
941 inb(data->sbase + WBCIR_REG_SP3_LSR); /* Clear LSR */ 955 inb(data->sbase + WBCIR_REG_SP3_LSR); /* Clear LSR */
942 inb(data->sbase + WBCIR_REG_SP3_MSR); /* Clear MSR */ 956 inb(data->sbase + WBCIR_REG_SP3_MSR); /* Clear MSR */
943 957
944 /* 958 /* Disable RX demod, enable run-length enc/dec, set freq span */
945 * Disable RX demod, enable run-length enc/dec, set freq span and
946 * enable over-sampling
947 */
948 wbcir_select_bank(data, WBCIR_BANK_7); 959 wbcir_select_bank(data, WBCIR_BANK_7);
949 outb(0xd0, data->sbase + WBCIR_REG_SP3_RCCFG); 960 outb(0x90, data->sbase + WBCIR_REG_SP3_RCCFG);
950 961
951 /* Disable timer */ 962 /* Disable timer */
952 wbcir_select_bank(data, WBCIR_BANK_4); 963 wbcir_select_bank(data, WBCIR_BANK_4);