Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 357464
b: refs/heads/master
c: 6f2627c
h: refs/heads/master
v: v3
  • Loading branch information
Sean Young authored and Mauro Carvalho Chehab committed Feb 5, 2013
1 parent d963516 commit 569e9d8
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 9 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 3e85a44aacd68744765f2fc7f0645645b34e64f8
refs/heads/master: 6f2627c29f6619ebdbc6de8934b33c23b73be8e6
27 changes: 19 additions & 8 deletions trunk/drivers/media/rc/winbond-cir.c
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,8 @@
#define WBCIR_CNTR_R 0x02
/* Invert TX */
#define WBCIR_IRTX_INV 0x04
/* Receiver oversampling */
#define WBCIR_RX_T_OV 0x40

/* Valid banks for the SP3 UART */
enum wbcir_bank {
Expand Down Expand Up @@ -394,7 +396,8 @@ wbcir_irq_rx(struct wbcir_data *data, struct pnp_dev *device)
if (data->rxstate == WBCIR_RXSTATE_ERROR)
continue;

duration = ((irdata & 0x7F) + 1) * 2;
duration = ((irdata & 0x7F) + 1) *
(data->carrier_report_enabled ? 2 : 10);
rawir.pulse = irdata & 0x80 ? false : true;
rawir.duration = US_TO_NS(duration);

Expand Down Expand Up @@ -550,6 +553,17 @@ wbcir_set_carrier_report(struct rc_dev *dev, int enable)
wbcir_set_bits(data->ebase + WBCIR_REG_ECEIR_CCTL,
WBCIR_CNTR_EN, WBCIR_CNTR_EN | WBCIR_CNTR_R);

/* Set a higher sampling resolution if carrier reports are enabled */
wbcir_select_bank(data, WBCIR_BANK_2);
data->dev->rx_resolution = US_TO_NS(enable ? 2 : 10);
outb(enable ? 0x03 : 0x0f, data->sbase + WBCIR_REG_SP3_BGDL);
outb(0x00, data->sbase + WBCIR_REG_SP3_BGDH);

/* Enable oversampling if carrier reports are enabled */
wbcir_select_bank(data, WBCIR_BANK_7);
wbcir_set_bits(data->sbase + WBCIR_REG_SP3_RCCFG,
enable ? WBCIR_RX_T_OV : 0, WBCIR_RX_T_OV);

data->carrier_report_enabled = enable;
spin_unlock_irqrestore(&data->spinlock, flags);

Expand Down Expand Up @@ -931,8 +945,8 @@ wbcir_init_hw(struct wbcir_data *data)
/* prescaler 1.0, tx/rx fifo lvl 16 */
outb(0x30, data->sbase + WBCIR_REG_SP3_EXCR2);

/* Set baud divisor to sample every 2 ns */
outb(0x03, data->sbase + WBCIR_REG_SP3_BGDL);
/* Set baud divisor to sample every 10 us */
outb(0x0f, data->sbase + WBCIR_REG_SP3_BGDL);
outb(0x00, data->sbase + WBCIR_REG_SP3_BGDH);

/* Set CEIR mode */
Expand All @@ -941,12 +955,9 @@ wbcir_init_hw(struct wbcir_data *data)
inb(data->sbase + WBCIR_REG_SP3_LSR); /* Clear LSR */
inb(data->sbase + WBCIR_REG_SP3_MSR); /* Clear MSR */

/*
* Disable RX demod, enable run-length enc/dec, set freq span and
* enable over-sampling
*/
/* Disable RX demod, enable run-length enc/dec, set freq span */
wbcir_select_bank(data, WBCIR_BANK_7);
outb(0xd0, data->sbase + WBCIR_REG_SP3_RCCFG);
outb(0x90, data->sbase + WBCIR_REG_SP3_RCCFG);

/* Disable timer */
wbcir_select_bank(data, WBCIR_BANK_4);
Expand Down

0 comments on commit 569e9d8

Please sign in to comment.