Skip to content

Commit

Permalink
media: rc: nuvoton: Keep device enabled during reg init
Browse files Browse the repository at this point in the history
Doing writes when the device is disabled seems to be a NOOP.
For CIR device, we should enable it, initialize it, and then disable it
until it's opened. CIR_WAKE should always be enabled.

Signed-off-by: Michał Winiarski <[email protected]>
Cc: Jarod Wilson <[email protected]>
Signed-off-by: Sean Young <[email protected]>
Signed-off-by: Mauro Carvalho Chehab <[email protected]>
  • Loading branch information
mwiniars authored and mchehab committed May 28, 2018
1 parent adbe6cf commit d24e56f
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions drivers/media/rc/nuvoton-cir.c
Original file line number Diff line number Diff line change
Expand Up @@ -535,6 +535,8 @@ static void nvt_set_cir_iren(struct nvt_dev *nvt)

static void nvt_cir_regs_init(struct nvt_dev *nvt)
{
nvt_enable_logical_dev(nvt, LOGICAL_DEV_CIR);

/* set sample limit count (PE interrupt raised when reached) */
nvt_cir_reg_write(nvt, CIR_RX_LIMIT_COUNT >> 8, CIR_SLCH);
nvt_cir_reg_write(nvt, CIR_RX_LIMIT_COUNT & 0xff, CIR_SLCL);
Expand All @@ -546,10 +548,14 @@ static void nvt_cir_regs_init(struct nvt_dev *nvt)
/* clear hardware rx and tx fifos */
nvt_clear_cir_fifo(nvt);
nvt_clear_tx_fifo(nvt);

nvt_disable_logical_dev(nvt, LOGICAL_DEV_CIR);
}

static void nvt_cir_wake_regs_init(struct nvt_dev *nvt)
{
nvt_enable_logical_dev(nvt, LOGICAL_DEV_CIR_WAKE);

/*
* Disable RX, set specific carrier on = low, off = high,
* and sample period (currently 50us)
Expand All @@ -561,9 +567,6 @@ static void nvt_cir_wake_regs_init(struct nvt_dev *nvt)

/* clear any and all stray interrupts */
nvt_cir_wake_reg_write(nvt, 0xff, CIR_WAKE_IRSTS);

/* enable the CIR WAKE logical device */
nvt_enable_logical_dev(nvt, LOGICAL_DEV_CIR_WAKE);
}

static void nvt_enable_wake(struct nvt_dev *nvt)
Expand Down

0 comments on commit d24e56f

Please sign in to comment.