aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/rc
diff options
context:
space:
mode:
authorJarod Wilson <jarod@redhat.com>2011-04-12 12:38:27 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2011-05-20 08:27:35 -0400
commit39381d4fcd97462f0262bef382b7643f17787587 (patch)
tree0b24dc25a6575c08ebbf55227cb71e50f803b8a7 /drivers/media/rc
parent362d3a3a9592598cef1d3e211ad998eb844dc5f3 (diff)
[media] rc/nuvoton-cir: enable CIR on w83667hg chip variant
Thanks to some excellent investigative work by Douglas Clowes, it was uncovered that the older w83667hg Nuvoton chip functions with this driver after actually enabling the CIR function via its multi-function chip config register. The CIR and CIR wide-band sensor enable bits are just in a different place on this hardware, so we only poke register 0x27 on 677 hardware now, and we poke register 0x2c on the 667 now. Reported-by: Douglas Clowes <dclowes1@optusnet.com.au> Signed-off-by: Jarod Wilson <jarod@redhat.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/rc')
-rw-r--r--drivers/media/rc/nuvoton-cir.c22
-rw-r--r--drivers/media/rc/nuvoton-cir.h7
2 files changed, 23 insertions, 6 deletions
diff --git a/drivers/media/rc/nuvoton-cir.c b/drivers/media/rc/nuvoton-cir.c
index bc5c1e267512..5d93384d2d35 100644
--- a/drivers/media/rc/nuvoton-cir.c
+++ b/drivers/media/rc/nuvoton-cir.c
@@ -291,13 +291,23 @@ static int nvt_hw_detect(struct nvt_dev *nvt)
291 291
292static void nvt_cir_ldev_init(struct nvt_dev *nvt) 292static void nvt_cir_ldev_init(struct nvt_dev *nvt)
293{ 293{
294 u8 val; 294 u8 val, psreg, psmask, psval;
295
296 if (nvt->chip_major == CHIP_ID_HIGH_667) {
297 psreg = CR_MULTIFUNC_PIN_SEL;
298 psmask = MULTIFUNC_PIN_SEL_MASK;
299 psval = MULTIFUNC_ENABLE_CIR | MULTIFUNC_ENABLE_CIRWB;
300 } else {
301 psreg = CR_OUTPUT_PIN_SEL;
302 psmask = OUTPUT_PIN_SEL_MASK;
303 psval = OUTPUT_ENABLE_CIR | OUTPUT_ENABLE_CIRWB;
304 }
295 305
296 /* output pin selection (Pin95=CIRRX, Pin96=CIRTX1, WB enabled */ 306 /* output pin selection: enable CIR, with WB sensor enabled */
297 val = nvt_cr_read(nvt, CR_OUTPUT_PIN_SEL); 307 val = nvt_cr_read(nvt, psreg);
298 val &= OUTPUT_PIN_SEL_MASK; 308 val &= psmask;
299 val |= (OUTPUT_ENABLE_CIR | OUTPUT_ENABLE_CIRWB); 309 val |= psval;
300 nvt_cr_write(nvt, val, CR_OUTPUT_PIN_SEL); 310 nvt_cr_write(nvt, val, psreg);
301 311
302 /* Select CIR logical device and enable */ 312 /* Select CIR logical device and enable */
303 nvt_select_logical_dev(nvt, LOGICAL_DEV_CIR); 313 nvt_select_logical_dev(nvt, LOGICAL_DEV_CIR);
diff --git a/drivers/media/rc/nuvoton-cir.h b/drivers/media/rc/nuvoton-cir.h
index cc8cee34c54f..379795d61ea7 100644
--- a/drivers/media/rc/nuvoton-cir.h
+++ b/drivers/media/rc/nuvoton-cir.h
@@ -345,6 +345,7 @@ struct nvt_dev {
345#define CR_CHIP_ID_LO 0x21 345#define CR_CHIP_ID_LO 0x21
346#define CR_DEV_POWER_DOWN 0x22 /* bit 2 is CIR power, default power on */ 346#define CR_DEV_POWER_DOWN 0x22 /* bit 2 is CIR power, default power on */
347#define CR_OUTPUT_PIN_SEL 0x27 347#define CR_OUTPUT_PIN_SEL 0x27
348#define CR_MULTIFUNC_PIN_SEL 0x2c
348#define CR_LOGICAL_DEV_EN 0x30 /* valid for all logical devices */ 349#define CR_LOGICAL_DEV_EN 0x30 /* valid for all logical devices */
349/* next three regs valid for both the CIR and CIR_WAKE logical devices */ 350/* next three regs valid for both the CIR and CIR_WAKE logical devices */
350#define CR_CIR_BASE_ADDR_HI 0x60 351#define CR_CIR_BASE_ADDR_HI 0x60
@@ -368,10 +369,16 @@ struct nvt_dev {
368#define CIR_INTR_MOUSE_IRQ_BIT 0x80 369#define CIR_INTR_MOUSE_IRQ_BIT 0x80
369#define PME_INTR_CIR_PASS_BIT 0x08 370#define PME_INTR_CIR_PASS_BIT 0x08
370 371
372/* w83677hg CIR pin config */
371#define OUTPUT_PIN_SEL_MASK 0xbc 373#define OUTPUT_PIN_SEL_MASK 0xbc
372#define OUTPUT_ENABLE_CIR 0x01 /* Pin95=CIRRX, Pin96=CIRTX1 */ 374#define OUTPUT_ENABLE_CIR 0x01 /* Pin95=CIRRX, Pin96=CIRTX1 */
373#define OUTPUT_ENABLE_CIRWB 0x40 /* enable wide-band sensor */ 375#define OUTPUT_ENABLE_CIRWB 0x40 /* enable wide-band sensor */
374 376
377/* w83667hg CIR pin config */
378#define MULTIFUNC_PIN_SEL_MASK 0x1f
379#define MULTIFUNC_ENABLE_CIR 0x80 /* Pin75=CIRRX, Pin76=CIRTX1 */
380#define MULTIFUNC_ENABLE_CIRWB 0x20 /* enable wide-band sensor */
381
375/* MCE CIR signal length, related on sample period */ 382/* MCE CIR signal length, related on sample period */
376 383
377/* MCE CIR controller signal length: about 43ms 384/* MCE CIR controller signal length: about 43ms