diff options
Diffstat (limited to 'drivers/media/rc')
-rw-r--r-- | drivers/media/rc/fintek-cir.c | 26 | ||||
-rw-r--r-- | drivers/media/rc/fintek-cir.h | 4 |
2 files changed, 21 insertions, 9 deletions
diff --git a/drivers/media/rc/fintek-cir.c b/drivers/media/rc/fintek-cir.c index 7f7079b12f23..392d4be91f8f 100644 --- a/drivers/media/rc/fintek-cir.c +++ b/drivers/media/rc/fintek-cir.c | |||
@@ -117,7 +117,7 @@ static u8 fintek_cir_reg_read(struct fintek_dev *fintek, u8 offset) | |||
117 | static void cir_dump_regs(struct fintek_dev *fintek) | 117 | static void cir_dump_regs(struct fintek_dev *fintek) |
118 | { | 118 | { |
119 | fintek_config_mode_enable(fintek); | 119 | fintek_config_mode_enable(fintek); |
120 | fintek_select_logical_dev(fintek, LOGICAL_DEV_CIR); | 120 | fintek_select_logical_dev(fintek, fintek->logical_dev_cir); |
121 | 121 | ||
122 | pr_reg("%s: Dump CIR logical device registers:\n", FINTEK_DRIVER_NAME); | 122 | pr_reg("%s: Dump CIR logical device registers:\n", FINTEK_DRIVER_NAME); |
123 | pr_reg(" * CR CIR BASE ADDR: 0x%x\n", | 123 | pr_reg(" * CR CIR BASE ADDR: 0x%x\n", |
@@ -143,7 +143,7 @@ static int fintek_hw_detect(struct fintek_dev *fintek) | |||
143 | u8 chip_major, chip_minor; | 143 | u8 chip_major, chip_minor; |
144 | u8 vendor_major, vendor_minor; | 144 | u8 vendor_major, vendor_minor; |
145 | u8 portsel, ir_class; | 145 | u8 portsel, ir_class; |
146 | u16 vendor; | 146 | u16 vendor, chip; |
147 | int ret = 0; | 147 | int ret = 0; |
148 | 148 | ||
149 | fintek_config_mode_enable(fintek); | 149 | fintek_config_mode_enable(fintek); |
@@ -176,6 +176,7 @@ static int fintek_hw_detect(struct fintek_dev *fintek) | |||
176 | 176 | ||
177 | chip_major = fintek_cr_read(fintek, GCR_CHIP_ID_HI); | 177 | chip_major = fintek_cr_read(fintek, GCR_CHIP_ID_HI); |
178 | chip_minor = fintek_cr_read(fintek, GCR_CHIP_ID_LO); | 178 | chip_minor = fintek_cr_read(fintek, GCR_CHIP_ID_LO); |
179 | chip = chip_major << 8 | chip_minor; | ||
179 | 180 | ||
180 | vendor_major = fintek_cr_read(fintek, GCR_VENDOR_ID_HI); | 181 | vendor_major = fintek_cr_read(fintek, GCR_VENDOR_ID_HI); |
181 | vendor_minor = fintek_cr_read(fintek, GCR_VENDOR_ID_LO); | 182 | vendor_minor = fintek_cr_read(fintek, GCR_VENDOR_ID_LO); |
@@ -192,6 +193,15 @@ static int fintek_hw_detect(struct fintek_dev *fintek) | |||
192 | fintek->chip_major = chip_major; | 193 | fintek->chip_major = chip_major; |
193 | fintek->chip_minor = chip_minor; | 194 | fintek->chip_minor = chip_minor; |
194 | fintek->chip_vendor = vendor; | 195 | fintek->chip_vendor = vendor; |
196 | |||
197 | /* | ||
198 | * Newer reviews of this chipset uses port 8 instead of 5 | ||
199 | */ | ||
200 | if ((chip != 0x0408) || (chip != 0x0804)) | ||
201 | fintek->logical_dev_cir = LOGICAL_DEV_CIR_REV2; | ||
202 | else | ||
203 | fintek->logical_dev_cir = LOGICAL_DEV_CIR_REV1; | ||
204 | |||
195 | spin_unlock_irqrestore(&fintek->fintek_lock, flags); | 205 | spin_unlock_irqrestore(&fintek->fintek_lock, flags); |
196 | 206 | ||
197 | return ret; | 207 | return ret; |
@@ -200,7 +210,7 @@ static int fintek_hw_detect(struct fintek_dev *fintek) | |||
200 | static void fintek_cir_ldev_init(struct fintek_dev *fintek) | 210 | static void fintek_cir_ldev_init(struct fintek_dev *fintek) |
201 | { | 211 | { |
202 | /* Select CIR logical device and enable */ | 212 | /* Select CIR logical device and enable */ |
203 | fintek_select_logical_dev(fintek, LOGICAL_DEV_CIR); | 213 | fintek_select_logical_dev(fintek, fintek->logical_dev_cir); |
204 | fintek_cr_write(fintek, LOGICAL_DEV_ENABLE, CIR_CR_DEV_EN); | 214 | fintek_cr_write(fintek, LOGICAL_DEV_ENABLE, CIR_CR_DEV_EN); |
205 | 215 | ||
206 | /* Write allocated CIR address and IRQ information to hardware */ | 216 | /* Write allocated CIR address and IRQ information to hardware */ |
@@ -381,7 +391,7 @@ static irqreturn_t fintek_cir_isr(int irq, void *data) | |||
381 | fit_dbg_verbose("%s firing", __func__); | 391 | fit_dbg_verbose("%s firing", __func__); |
382 | 392 | ||
383 | fintek_config_mode_enable(fintek); | 393 | fintek_config_mode_enable(fintek); |
384 | fintek_select_logical_dev(fintek, LOGICAL_DEV_CIR); | 394 | fintek_select_logical_dev(fintek, fintek->logical_dev_cir); |
385 | fintek_config_mode_disable(fintek); | 395 | fintek_config_mode_disable(fintek); |
386 | 396 | ||
387 | /* | 397 | /* |
@@ -422,7 +432,7 @@ static void fintek_enable_cir(struct fintek_dev *fintek) | |||
422 | fintek_config_mode_enable(fintek); | 432 | fintek_config_mode_enable(fintek); |
423 | 433 | ||
424 | /* enable the CIR logical device */ | 434 | /* enable the CIR logical device */ |
425 | fintek_select_logical_dev(fintek, LOGICAL_DEV_CIR); | 435 | fintek_select_logical_dev(fintek, fintek->logical_dev_cir); |
426 | fintek_cr_write(fintek, LOGICAL_DEV_ENABLE, CIR_CR_DEV_EN); | 436 | fintek_cr_write(fintek, LOGICAL_DEV_ENABLE, CIR_CR_DEV_EN); |
427 | 437 | ||
428 | fintek_config_mode_disable(fintek); | 438 | fintek_config_mode_disable(fintek); |
@@ -439,7 +449,7 @@ static void fintek_disable_cir(struct fintek_dev *fintek) | |||
439 | fintek_config_mode_enable(fintek); | 449 | fintek_config_mode_enable(fintek); |
440 | 450 | ||
441 | /* disable the CIR logical device */ | 451 | /* disable the CIR logical device */ |
442 | fintek_select_logical_dev(fintek, LOGICAL_DEV_CIR); | 452 | fintek_select_logical_dev(fintek, fintek->logical_dev_cir); |
443 | fintek_cr_write(fintek, LOGICAL_DEV_DISABLE, CIR_CR_DEV_EN); | 453 | fintek_cr_write(fintek, LOGICAL_DEV_DISABLE, CIR_CR_DEV_EN); |
444 | 454 | ||
445 | fintek_config_mode_disable(fintek); | 455 | fintek_config_mode_disable(fintek); |
@@ -611,7 +621,7 @@ static int fintek_suspend(struct pnp_dev *pdev, pm_message_t state) | |||
611 | fintek_config_mode_enable(fintek); | 621 | fintek_config_mode_enable(fintek); |
612 | 622 | ||
613 | /* disable cir logical dev */ | 623 | /* disable cir logical dev */ |
614 | fintek_select_logical_dev(fintek, LOGICAL_DEV_CIR); | 624 | fintek_select_logical_dev(fintek, fintek->logical_dev_cir); |
615 | fintek_cr_write(fintek, LOGICAL_DEV_DISABLE, CIR_CR_DEV_EN); | 625 | fintek_cr_write(fintek, LOGICAL_DEV_DISABLE, CIR_CR_DEV_EN); |
616 | 626 | ||
617 | fintek_config_mode_disable(fintek); | 627 | fintek_config_mode_disable(fintek); |
@@ -634,7 +644,7 @@ static int fintek_resume(struct pnp_dev *pdev) | |||
634 | 644 | ||
635 | /* Enable CIR logical device */ | 645 | /* Enable CIR logical device */ |
636 | fintek_config_mode_enable(fintek); | 646 | fintek_config_mode_enable(fintek); |
637 | fintek_select_logical_dev(fintek, LOGICAL_DEV_CIR); | 647 | fintek_select_logical_dev(fintek, fintek->logical_dev_cir); |
638 | fintek_cr_write(fintek, LOGICAL_DEV_ENABLE, CIR_CR_DEV_EN); | 648 | fintek_cr_write(fintek, LOGICAL_DEV_ENABLE, CIR_CR_DEV_EN); |
639 | 649 | ||
640 | fintek_config_mode_disable(fintek); | 650 | fintek_config_mode_disable(fintek); |
diff --git a/drivers/media/rc/fintek-cir.h b/drivers/media/rc/fintek-cir.h index 1b10b2011f5e..82516a1d39b0 100644 --- a/drivers/media/rc/fintek-cir.h +++ b/drivers/media/rc/fintek-cir.h | |||
@@ -88,6 +88,7 @@ struct fintek_dev { | |||
88 | u8 chip_major; | 88 | u8 chip_major; |
89 | u8 chip_minor; | 89 | u8 chip_minor; |
90 | u16 chip_vendor; | 90 | u16 chip_vendor; |
91 | u8 logical_dev_cir; | ||
91 | 92 | ||
92 | /* hardware features */ | 93 | /* hardware features */ |
93 | bool hw_learning_capable; | 94 | bool hw_learning_capable; |
@@ -172,7 +173,8 @@ struct fintek_dev { | |||
172 | #define LOGICAL_DEV_ENABLE 0x01 | 173 | #define LOGICAL_DEV_ENABLE 0x01 |
173 | 174 | ||
174 | /* Logical device number of the CIR function */ | 175 | /* Logical device number of the CIR function */ |
175 | #define LOGICAL_DEV_CIR 0x05 | 176 | #define LOGICAL_DEV_CIR_REV1 0x05 |
177 | #define LOGICAL_DEV_CIR_REV2 0x08 | ||
176 | 178 | ||
177 | /* CIR Logical Device (LDN 0x08) config registers */ | 179 | /* CIR Logical Device (LDN 0x08) config registers */ |
178 | #define CIR_CR_COMMAND_INDEX 0x04 | 180 | #define CIR_CR_COMMAND_INDEX 0x04 |