summaryrefslogtreecommitdiff
path: root/drivers/media/rc/nuvoton-cir.h
diff options
context:
space:
mode:
authorHeiner Kallweit <hkallweit1@gmail.com>2015-10-30 00:21:38 +0300
committerMauro Carvalho Chehab <mchehab@osg.samsung.com>2015-11-19 14:35:32 +0300
commitb5cf725c04003edc4942057ae479f68826cee909 (patch)
treed490ebbec1f6c3150a55de19c637b82e97416a9a /drivers/media/rc/nuvoton-cir.h
parent099256e58ef63ba171d5418fdc662e093cdba1be (diff)
downloadlinux-b5cf725c04003edc4942057ae479f68826cee909.tar.xz
[media] media: rc: nuvoton-cir: improve chip detection
Make the chip detection code more similar to the one used for the same chips in watchdog/w83627hf_wdt.c and hwmon/w83627ehf.c. Apart from better maintainability we gain - unified naming of chips (e.g. 677C -> NCT6776F) - driver works with all revisions of the chips (least 4 bits of id are masked) Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Diffstat (limited to 'drivers/media/rc/nuvoton-cir.h')
-rw-r--r--drivers/media/rc/nuvoton-cir.h24
1 files changed, 15 insertions, 9 deletions
diff --git a/drivers/media/rc/nuvoton-cir.h b/drivers/media/rc/nuvoton-cir.h
index e1cf23c3875b..81b5a09abd3c 100644
--- a/drivers/media/rc/nuvoton-cir.h
+++ b/drivers/media/rc/nuvoton-cir.h
@@ -64,6 +64,20 @@ static int debug;
#define TX_BUF_LEN 256
#define RX_BUF_LEN 32
+#define SIO_ID_MASK 0xfff0
+
+enum nvt_chip_ver {
+ NVT_UNKNOWN = 0,
+ NVT_W83667HG = 0xa510,
+ NVT_6775F = 0xb470,
+ NVT_6776F = 0xc330
+};
+
+struct nvt_chip {
+ const char *name;
+ enum nvt_chip_ver chip_ver;
+};
+
struct nvt_dev {
struct pnp_dev *pdev;
struct rc_dev *rdev;
@@ -93,6 +107,7 @@ struct nvt_dev {
int cir_irq;
int cir_wake_irq;
+ enum nvt_chip_ver chip_ver;
/* hardware id */
u8 chip_major;
u8 chip_minor;
@@ -326,15 +341,6 @@ struct nvt_dev {
#define EFER_EFM_ENABLE 0x87
#define EFER_EFM_DISABLE 0xaa
-/* Chip IDs found in CR_CHIP_ID_{HI,LO} */
-#define CHIP_ID_HIGH_667 0xa5
-#define CHIP_ID_HIGH_677B 0xb4
-#define CHIP_ID_HIGH_677C 0xc3
-#define CHIP_ID_LOW_667 0x13
-#define CHIP_ID_LOW_677B2 0x72
-#define CHIP_ID_LOW_677B3 0x73
-#define CHIP_ID_LOW_677C 0x33
-
/* Config regs we need to care about */
#define CR_SOFTWARE_RESET 0x02
#define CR_LOGICAL_DEV_SEL 0x07