Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 250165
b: refs/heads/master
c: 362d3a3
h: refs/heads/master
i:
  250163: 79a81a1
v: v3
  • Loading branch information
Jarod Wilson authored and Mauro Carvalho Chehab committed May 20, 2011
1 parent fca701a commit da0d636
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 12 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: 56c0893c4f66a5d249b8981101755bec5890500d
refs/heads/master: 362d3a3a9592598cef1d3e211ad998eb844dc5f3
40 changes: 32 additions & 8 deletions trunk/drivers/media/rc/nuvoton-cir.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,6 @@

#include "nuvoton-cir.h"

static char *chip_id = "w836x7hg";

/* write val to config reg */
static inline void nvt_cr_write(struct nvt_dev *nvt, u8 val, u8 reg)
{
Expand Down Expand Up @@ -233,6 +231,8 @@ static int nvt_hw_detect(struct nvt_dev *nvt)
unsigned long flags;
u8 chip_major, chip_minor;
int ret = 0;
char chip_id[12];
bool chip_unknown = false;

nvt_efm_enable(nvt);

Expand All @@ -246,15 +246,39 @@ static int nvt_hw_detect(struct nvt_dev *nvt)
}

chip_minor = nvt_cr_read(nvt, CR_CHIP_ID_LO);
nvt_dbg("%s: chip id: 0x%02x 0x%02x", chip_id, chip_major, chip_minor);

if (chip_major != CHIP_ID_HIGH ||
(chip_minor != CHIP_ID_LOW && chip_minor != CHIP_ID_LOW2)) {
nvt_pr(KERN_ERR, "%s: unsupported chip, id: 0x%02x 0x%02x",
chip_id, chip_major, chip_minor);
ret = -ENODEV;
/* these are the known working chip revisions... */
switch (chip_major) {
case CHIP_ID_HIGH_667:
strcpy(chip_id, "w83667hg\0");
if (chip_minor != CHIP_ID_LOW_667)
chip_unknown = true;
break;
case CHIP_ID_HIGH_677B:
strcpy(chip_id, "w83677hg\0");
if (chip_minor != CHIP_ID_LOW_677B2 &&
chip_minor != CHIP_ID_LOW_677B3)
chip_unknown = true;
break;
case CHIP_ID_HIGH_677C:
strcpy(chip_id, "w83677hg-c\0");
if (chip_minor != CHIP_ID_LOW_677C)
chip_unknown = true;
break;
default:
strcpy(chip_id, "w836x7hg\0");
chip_unknown = true;
break;
}

/* warn, but still let the driver load, if we don't know this chip */
if (chip_unknown)
nvt_pr(KERN_WARNING, "%s: unknown chip, id: 0x%02x 0x%02x, "
"it may not work...", chip_id, chip_major, chip_minor);
else
nvt_dbg("%s: chip id: 0x%02x 0x%02x",
chip_id, chip_major, chip_minor);

nvt_efm_disable(nvt);

spin_lock_irqsave(&nvt->nvt_lock, flags);
Expand Down
10 changes: 7 additions & 3 deletions trunk/drivers/media/rc/nuvoton-cir.h
Original file line number Diff line number Diff line change
Expand Up @@ -330,9 +330,13 @@ struct nvt_dev {
#define EFER_EFM_DISABLE 0xaa

/* Chip IDs found in CR_CHIP_ID_{HI,LO} */
#define CHIP_ID_HIGH 0xb4
#define CHIP_ID_LOW 0x72
#define CHIP_ID_LOW2 0x73
#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
Expand Down

0 comments on commit da0d636

Please sign in to comment.