diff options
author | Heiner Kallweit | 2015-12-30 14:40:12 -0200 |
---|---|---|
committer | Mauro Carvalho Chehab | 2016-01-25 15:45:40 -0200 |
commit | 0890655c29a88765924c46460f38f33f7e34b5fc (patch) | |
tree | d51c850698cfbcdd9a078de892b5d9223249450f | |
parent | f2c2ba0e251d0b5211ce0397081b087ac623136f (diff) |
[media] nuvoton-cir: factor out logical device enabling
Factor out enabling of a logical device.
Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
-rw-r--r-- | drivers/media/rc/nuvoton-cir.c | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/drivers/media/rc/nuvoton-cir.c b/drivers/media/rc/nuvoton-cir.c index 5f36227a9059..f6248519b31e 100644 --- a/drivers/media/rc/nuvoton-cir.c +++ b/drivers/media/rc/nuvoton-cir.c @@ -110,6 +110,15 @@ static inline void nvt_select_logical_dev(struct nvt_dev *nvt, u8 ldev) nvt_cr_write(nvt, ldev, CR_LOGICAL_DEV_SEL); } +/* select and enable logical device with setting EFM mode*/ +static inline void nvt_enable_logical_dev(struct nvt_dev *nvt, u8 ldev) +{ + nvt_efm_enable(nvt); + nvt_select_logical_dev(nvt, ldev); + nvt_cr_write(nvt, LOGICAL_DEV_ENABLE, CR_LOGICAL_DEV_EN); + nvt_efm_disable(nvt); +} + /* select and disable logical device with setting EFM mode*/ static inline void nvt_disable_logical_dev(struct nvt_dev *nvt, u8 ldev) { @@ -924,13 +933,8 @@ static void nvt_enable_cir(struct nvt_dev *nvt) CIR_IRCON_RXINV | CIR_IRCON_SAMPLE_PERIOD_SEL, CIR_IRCON); - nvt_efm_enable(nvt); - /* enable the CIR logical device */ - nvt_select_logical_dev(nvt, LOGICAL_DEV_CIR); - nvt_cr_write(nvt, LOGICAL_DEV_ENABLE, CR_LOGICAL_DEV_EN); - - nvt_efm_disable(nvt); + nvt_enable_logical_dev(nvt, LOGICAL_DEV_CIR); /* clear all pending interrupts */ nvt_cir_reg_write(nvt, 0xff, CIR_IRSTS); @@ -1176,11 +1180,7 @@ static int nvt_resume(struct pnp_dev *pdev) nvt_set_cir_iren(nvt); /* Enable CIR logical device */ - nvt_efm_enable(nvt); - nvt_select_logical_dev(nvt, LOGICAL_DEV_CIR); - nvt_cr_write(nvt, LOGICAL_DEV_ENABLE, CR_LOGICAL_DEV_EN); - - nvt_efm_disable(nvt); + nvt_enable_logical_dev(nvt, LOGICAL_DEV_CIR); nvt_cir_regs_init(nvt); nvt_cir_wake_regs_init(nvt); |