nvt                37 drivers/media/rc/nuvoton-cir.c static void nvt_clear_cir_wake_fifo(struct nvt_dev *nvt);
nvt                46 drivers/media/rc/nuvoton-cir.c static inline struct device *nvt_get_dev(const struct nvt_dev *nvt)
nvt                48 drivers/media/rc/nuvoton-cir.c 	return nvt->rdev->dev.parent;
nvt                51 drivers/media/rc/nuvoton-cir.c static inline bool is_w83667hg(struct nvt_dev *nvt)
nvt                53 drivers/media/rc/nuvoton-cir.c 	return nvt->chip_ver == NVT_W83667HG;
nvt                57 drivers/media/rc/nuvoton-cir.c static inline void nvt_cr_write(struct nvt_dev *nvt, u8 val, u8 reg)
nvt                59 drivers/media/rc/nuvoton-cir.c 	outb(reg, nvt->cr_efir);
nvt                60 drivers/media/rc/nuvoton-cir.c 	outb(val, nvt->cr_efdr);
nvt                64 drivers/media/rc/nuvoton-cir.c static inline u8 nvt_cr_read(struct nvt_dev *nvt, u8 reg)
nvt                66 drivers/media/rc/nuvoton-cir.c 	outb(reg, nvt->cr_efir);
nvt                67 drivers/media/rc/nuvoton-cir.c 	return inb(nvt->cr_efdr);
nvt                71 drivers/media/rc/nuvoton-cir.c static inline void nvt_set_reg_bit(struct nvt_dev *nvt, u8 val, u8 reg)
nvt                73 drivers/media/rc/nuvoton-cir.c 	u8 tmp = nvt_cr_read(nvt, reg) | val;
nvt                74 drivers/media/rc/nuvoton-cir.c 	nvt_cr_write(nvt, tmp, reg);
nvt                78 drivers/media/rc/nuvoton-cir.c static inline void nvt_clear_reg_bit(struct nvt_dev *nvt, u8 val, u8 reg)
nvt                80 drivers/media/rc/nuvoton-cir.c 	u8 tmp = nvt_cr_read(nvt, reg) & ~val;
nvt                81 drivers/media/rc/nuvoton-cir.c 	nvt_cr_write(nvt, tmp, reg);
nvt                85 drivers/media/rc/nuvoton-cir.c static inline int nvt_efm_enable(struct nvt_dev *nvt)
nvt                87 drivers/media/rc/nuvoton-cir.c 	if (!request_muxed_region(nvt->cr_efir, 2, NVT_DRIVER_NAME))
nvt                91 drivers/media/rc/nuvoton-cir.c 	outb(EFER_EFM_ENABLE, nvt->cr_efir);
nvt                92 drivers/media/rc/nuvoton-cir.c 	outb(EFER_EFM_ENABLE, nvt->cr_efir);
nvt                98 drivers/media/rc/nuvoton-cir.c static inline void nvt_efm_disable(struct nvt_dev *nvt)
nvt               100 drivers/media/rc/nuvoton-cir.c 	outb(EFER_EFM_DISABLE, nvt->cr_efir);
nvt               102 drivers/media/rc/nuvoton-cir.c 	release_region(nvt->cr_efir, 2);
nvt               110 drivers/media/rc/nuvoton-cir.c static inline void nvt_select_logical_dev(struct nvt_dev *nvt, u8 ldev)
nvt               112 drivers/media/rc/nuvoton-cir.c 	nvt_cr_write(nvt, ldev, CR_LOGICAL_DEV_SEL);
nvt               116 drivers/media/rc/nuvoton-cir.c static inline void nvt_enable_logical_dev(struct nvt_dev *nvt, u8 ldev)
nvt               118 drivers/media/rc/nuvoton-cir.c 	nvt_efm_enable(nvt);
nvt               119 drivers/media/rc/nuvoton-cir.c 	nvt_select_logical_dev(nvt, ldev);
nvt               120 drivers/media/rc/nuvoton-cir.c 	nvt_cr_write(nvt, LOGICAL_DEV_ENABLE, CR_LOGICAL_DEV_EN);
nvt               121 drivers/media/rc/nuvoton-cir.c 	nvt_efm_disable(nvt);
nvt               125 drivers/media/rc/nuvoton-cir.c static inline void nvt_disable_logical_dev(struct nvt_dev *nvt, u8 ldev)
nvt               127 drivers/media/rc/nuvoton-cir.c 	nvt_efm_enable(nvt);
nvt               128 drivers/media/rc/nuvoton-cir.c 	nvt_select_logical_dev(nvt, ldev);
nvt               129 drivers/media/rc/nuvoton-cir.c 	nvt_cr_write(nvt, LOGICAL_DEV_DISABLE, CR_LOGICAL_DEV_EN);
nvt               130 drivers/media/rc/nuvoton-cir.c 	nvt_efm_disable(nvt);
nvt               134 drivers/media/rc/nuvoton-cir.c static inline void nvt_cir_reg_write(struct nvt_dev *nvt, u8 val, u8 offset)
nvt               136 drivers/media/rc/nuvoton-cir.c 	outb(val, nvt->cir_addr + offset);
nvt               140 drivers/media/rc/nuvoton-cir.c static u8 nvt_cir_reg_read(struct nvt_dev *nvt, u8 offset)
nvt               142 drivers/media/rc/nuvoton-cir.c 	return inb(nvt->cir_addr + offset);
nvt               146 drivers/media/rc/nuvoton-cir.c static inline void nvt_cir_wake_reg_write(struct nvt_dev *nvt,
nvt               149 drivers/media/rc/nuvoton-cir.c 	outb(val, nvt->cir_wake_addr + offset);
nvt               153 drivers/media/rc/nuvoton-cir.c static u8 nvt_cir_wake_reg_read(struct nvt_dev *nvt, u8 offset)
nvt               155 drivers/media/rc/nuvoton-cir.c 	return inb(nvt->cir_wake_addr + offset);
nvt               159 drivers/media/rc/nuvoton-cir.c static void nvt_set_ioaddr(struct nvt_dev *nvt, unsigned long *ioaddr)
nvt               163 drivers/media/rc/nuvoton-cir.c 	old_addr = nvt_cr_read(nvt, CR_CIR_BASE_ADDR_HI) << 8;
nvt               164 drivers/media/rc/nuvoton-cir.c 	old_addr |= nvt_cr_read(nvt, CR_CIR_BASE_ADDR_LO);
nvt               169 drivers/media/rc/nuvoton-cir.c 		nvt_cr_write(nvt, *ioaddr >> 8, CR_CIR_BASE_ADDR_HI);
nvt               170 drivers/media/rc/nuvoton-cir.c 		nvt_cr_write(nvt, *ioaddr & 0xff, CR_CIR_BASE_ADDR_LO);
nvt               178 drivers/media/rc/nuvoton-cir.c 	struct nvt_dev *nvt = dev->priv;
nvt               185 drivers/media/rc/nuvoton-cir.c 	spin_lock_irqsave(&nvt->lock, flags);
nvt               187 drivers/media/rc/nuvoton-cir.c 	nvt_clear_cir_wake_fifo(nvt);
nvt               188 drivers/media/rc/nuvoton-cir.c 	nvt_cir_wake_reg_write(nvt, count, CIR_WAKE_FIFO_CMP_DEEP);
nvt               189 drivers/media/rc/nuvoton-cir.c 	nvt_cir_wake_reg_write(nvt, tolerance, CIR_WAKE_FIFO_CMP_TOL);
nvt               191 drivers/media/rc/nuvoton-cir.c 	config = nvt_cir_wake_reg_read(nvt, CIR_WAKE_IRCON);
nvt               194 drivers/media/rc/nuvoton-cir.c 	nvt_cir_wake_reg_write(nvt, config | CIR_WAKE_IRCON_MODE1,
nvt               203 drivers/media/rc/nuvoton-cir.c 		nvt_cir_wake_reg_write(nvt, wbuf[i], CIR_WAKE_WR_FIFO_DATA);
nvt               205 drivers/media/rc/nuvoton-cir.c 	nvt_cir_wake_reg_write(nvt, config, CIR_WAKE_IRCON);
nvt               207 drivers/media/rc/nuvoton-cir.c 	spin_unlock_irqrestore(&nvt->lock, flags);
nvt               215 drivers/media/rc/nuvoton-cir.c 	struct nvt_dev *nvt = rc_dev->priv;
nvt               221 drivers/media/rc/nuvoton-cir.c 	spin_lock_irqsave(&nvt->lock, flags);
nvt               223 drivers/media/rc/nuvoton-cir.c 	fifo_len = nvt_cir_wake_reg_read(nvt, CIR_WAKE_FIFO_COUNT);
nvt               227 drivers/media/rc/nuvoton-cir.c 	while (nvt_cir_wake_reg_read(nvt, CIR_WAKE_RD_FIFO_ONLY_IDX))
nvt               228 drivers/media/rc/nuvoton-cir.c 		nvt_cir_wake_reg_read(nvt, CIR_WAKE_RD_FIFO_ONLY);
nvt               231 drivers/media/rc/nuvoton-cir.c 		duration = nvt_cir_wake_reg_read(nvt, CIR_WAKE_RD_FIFO_ONLY);
nvt               238 drivers/media/rc/nuvoton-cir.c 	spin_unlock_irqrestore(&nvt->lock, flags);
nvt               287 drivers/media/rc/nuvoton-cir.c static void cir_dump_regs(struct nvt_dev *nvt)
nvt               289 drivers/media/rc/nuvoton-cir.c 	nvt_efm_enable(nvt);
nvt               290 drivers/media/rc/nuvoton-cir.c 	nvt_select_logical_dev(nvt, LOGICAL_DEV_CIR);
nvt               294 drivers/media/rc/nuvoton-cir.c 		nvt_cr_read(nvt, CR_LOGICAL_DEV_EN));
nvt               296 drivers/media/rc/nuvoton-cir.c 		(nvt_cr_read(nvt, CR_CIR_BASE_ADDR_HI) << 8) |
nvt               297 drivers/media/rc/nuvoton-cir.c 		nvt_cr_read(nvt, CR_CIR_BASE_ADDR_LO));
nvt               299 drivers/media/rc/nuvoton-cir.c 		nvt_cr_read(nvt, CR_CIR_IRQ_RSRC));
nvt               301 drivers/media/rc/nuvoton-cir.c 	nvt_efm_disable(nvt);
nvt               304 drivers/media/rc/nuvoton-cir.c 	pr_info(" * IRCON:     0x%x\n", nvt_cir_reg_read(nvt, CIR_IRCON));
nvt               305 drivers/media/rc/nuvoton-cir.c 	pr_info(" * IRSTS:     0x%x\n", nvt_cir_reg_read(nvt, CIR_IRSTS));
nvt               306 drivers/media/rc/nuvoton-cir.c 	pr_info(" * IREN:      0x%x\n", nvt_cir_reg_read(nvt, CIR_IREN));
nvt               307 drivers/media/rc/nuvoton-cir.c 	pr_info(" * RXFCONT:   0x%x\n", nvt_cir_reg_read(nvt, CIR_RXFCONT));
nvt               308 drivers/media/rc/nuvoton-cir.c 	pr_info(" * CP:        0x%x\n", nvt_cir_reg_read(nvt, CIR_CP));
nvt               309 drivers/media/rc/nuvoton-cir.c 	pr_info(" * CC:        0x%x\n", nvt_cir_reg_read(nvt, CIR_CC));
nvt               310 drivers/media/rc/nuvoton-cir.c 	pr_info(" * SLCH:      0x%x\n", nvt_cir_reg_read(nvt, CIR_SLCH));
nvt               311 drivers/media/rc/nuvoton-cir.c 	pr_info(" * SLCL:      0x%x\n", nvt_cir_reg_read(nvt, CIR_SLCL));
nvt               312 drivers/media/rc/nuvoton-cir.c 	pr_info(" * FIFOCON:   0x%x\n", nvt_cir_reg_read(nvt, CIR_FIFOCON));
nvt               313 drivers/media/rc/nuvoton-cir.c 	pr_info(" * IRFIFOSTS: 0x%x\n", nvt_cir_reg_read(nvt, CIR_IRFIFOSTS));
nvt               314 drivers/media/rc/nuvoton-cir.c 	pr_info(" * SRXFIFO:   0x%x\n", nvt_cir_reg_read(nvt, CIR_SRXFIFO));
nvt               315 drivers/media/rc/nuvoton-cir.c 	pr_info(" * TXFCONT:   0x%x\n", nvt_cir_reg_read(nvt, CIR_TXFCONT));
nvt               316 drivers/media/rc/nuvoton-cir.c 	pr_info(" * STXFIFO:   0x%x\n", nvt_cir_reg_read(nvt, CIR_STXFIFO));
nvt               317 drivers/media/rc/nuvoton-cir.c 	pr_info(" * FCCH:      0x%x\n", nvt_cir_reg_read(nvt, CIR_FCCH));
nvt               318 drivers/media/rc/nuvoton-cir.c 	pr_info(" * FCCL:      0x%x\n", nvt_cir_reg_read(nvt, CIR_FCCL));
nvt               319 drivers/media/rc/nuvoton-cir.c 	pr_info(" * IRFSM:     0x%x\n", nvt_cir_reg_read(nvt, CIR_IRFSM));
nvt               323 drivers/media/rc/nuvoton-cir.c static void cir_wake_dump_regs(struct nvt_dev *nvt)
nvt               327 drivers/media/rc/nuvoton-cir.c 	nvt_efm_enable(nvt);
nvt               328 drivers/media/rc/nuvoton-cir.c 	nvt_select_logical_dev(nvt, LOGICAL_DEV_CIR_WAKE);
nvt               333 drivers/media/rc/nuvoton-cir.c 		nvt_cr_read(nvt, CR_LOGICAL_DEV_EN));
nvt               335 drivers/media/rc/nuvoton-cir.c 		(nvt_cr_read(nvt, CR_CIR_BASE_ADDR_HI) << 8) |
nvt               336 drivers/media/rc/nuvoton-cir.c 		nvt_cr_read(nvt, CR_CIR_BASE_ADDR_LO));
nvt               338 drivers/media/rc/nuvoton-cir.c 		nvt_cr_read(nvt, CR_CIR_IRQ_RSRC));
nvt               340 drivers/media/rc/nuvoton-cir.c 	nvt_efm_disable(nvt);
nvt               344 drivers/media/rc/nuvoton-cir.c 		nvt_cir_wake_reg_read(nvt, CIR_WAKE_IRCON));
nvt               346 drivers/media/rc/nuvoton-cir.c 		nvt_cir_wake_reg_read(nvt, CIR_WAKE_IRSTS));
nvt               348 drivers/media/rc/nuvoton-cir.c 		nvt_cir_wake_reg_read(nvt, CIR_WAKE_IREN));
nvt               350 drivers/media/rc/nuvoton-cir.c 		nvt_cir_wake_reg_read(nvt, CIR_WAKE_FIFO_CMP_DEEP));
nvt               352 drivers/media/rc/nuvoton-cir.c 		nvt_cir_wake_reg_read(nvt, CIR_WAKE_FIFO_CMP_TOL));
nvt               354 drivers/media/rc/nuvoton-cir.c 		nvt_cir_wake_reg_read(nvt, CIR_WAKE_FIFO_COUNT));
nvt               356 drivers/media/rc/nuvoton-cir.c 		nvt_cir_wake_reg_read(nvt, CIR_WAKE_SLCH));
nvt               358 drivers/media/rc/nuvoton-cir.c 		nvt_cir_wake_reg_read(nvt, CIR_WAKE_SLCL));
nvt               360 drivers/media/rc/nuvoton-cir.c 		nvt_cir_wake_reg_read(nvt, CIR_WAKE_FIFOCON));
nvt               362 drivers/media/rc/nuvoton-cir.c 		nvt_cir_wake_reg_read(nvt, CIR_WAKE_SRXFSTS));
nvt               364 drivers/media/rc/nuvoton-cir.c 		nvt_cir_wake_reg_read(nvt, CIR_WAKE_SAMPLE_RX_FIFO));
nvt               366 drivers/media/rc/nuvoton-cir.c 		nvt_cir_wake_reg_read(nvt, CIR_WAKE_WR_FIFO_DATA));
nvt               368 drivers/media/rc/nuvoton-cir.c 		nvt_cir_wake_reg_read(nvt, CIR_WAKE_RD_FIFO_ONLY));
nvt               370 drivers/media/rc/nuvoton-cir.c 		nvt_cir_wake_reg_read(nvt, CIR_WAKE_RD_FIFO_ONLY_IDX));
nvt               372 drivers/media/rc/nuvoton-cir.c 		nvt_cir_wake_reg_read(nvt, CIR_WAKE_FIFO_IGNORE));
nvt               374 drivers/media/rc/nuvoton-cir.c 		nvt_cir_wake_reg_read(nvt, CIR_WAKE_IRFSM));
nvt               376 drivers/media/rc/nuvoton-cir.c 	fifo_len = nvt_cir_wake_reg_read(nvt, CIR_WAKE_FIFO_COUNT);
nvt               381 drivers/media/rc/nuvoton-cir.c 			nvt_cir_wake_reg_read(nvt, CIR_WAKE_RD_FIFO_ONLY));
nvt               385 drivers/media/rc/nuvoton-cir.c static inline const char *nvt_find_chip(struct nvt_dev *nvt, int id)
nvt               391 drivers/media/rc/nuvoton-cir.c 			nvt->chip_ver = nvt_chips[i].chip_ver;
nvt               400 drivers/media/rc/nuvoton-cir.c static int nvt_hw_detect(struct nvt_dev *nvt)
nvt               402 drivers/media/rc/nuvoton-cir.c 	struct device *dev = nvt_get_dev(nvt);
nvt               406 drivers/media/rc/nuvoton-cir.c 	nvt_efm_enable(nvt);
nvt               409 drivers/media/rc/nuvoton-cir.c 	nvt->chip_major = nvt_cr_read(nvt, CR_CHIP_ID_HI);
nvt               410 drivers/media/rc/nuvoton-cir.c 	if (nvt->chip_major == 0xff) {
nvt               411 drivers/media/rc/nuvoton-cir.c 		nvt_efm_disable(nvt);
nvt               412 drivers/media/rc/nuvoton-cir.c 		nvt->cr_efir = CR_EFIR2;
nvt               413 drivers/media/rc/nuvoton-cir.c 		nvt->cr_efdr = CR_EFDR2;
nvt               414 drivers/media/rc/nuvoton-cir.c 		nvt_efm_enable(nvt);
nvt               415 drivers/media/rc/nuvoton-cir.c 		nvt->chip_major = nvt_cr_read(nvt, CR_CHIP_ID_HI);
nvt               417 drivers/media/rc/nuvoton-cir.c 	nvt->chip_minor = nvt_cr_read(nvt, CR_CHIP_ID_LO);
nvt               419 drivers/media/rc/nuvoton-cir.c 	nvt_efm_disable(nvt);
nvt               421 drivers/media/rc/nuvoton-cir.c 	chip_id = nvt->chip_major << 8 | nvt->chip_minor;
nvt               427 drivers/media/rc/nuvoton-cir.c 	chip_name = nvt_find_chip(nvt, chip_id);
nvt               433 drivers/media/rc/nuvoton-cir.c 			 nvt->chip_major, nvt->chip_minor);
nvt               436 drivers/media/rc/nuvoton-cir.c 			 chip_name, nvt->chip_major, nvt->chip_minor);
nvt               441 drivers/media/rc/nuvoton-cir.c static void nvt_cir_ldev_init(struct nvt_dev *nvt)
nvt               445 drivers/media/rc/nuvoton-cir.c 	if (is_w83667hg(nvt)) {
nvt               456 drivers/media/rc/nuvoton-cir.c 	val = nvt_cr_read(nvt, psreg);
nvt               459 drivers/media/rc/nuvoton-cir.c 	nvt_cr_write(nvt, val, psreg);
nvt               462 drivers/media/rc/nuvoton-cir.c 	nvt_select_logical_dev(nvt, LOGICAL_DEV_CIR);
nvt               464 drivers/media/rc/nuvoton-cir.c 	nvt_set_ioaddr(nvt, &nvt->cir_addr);
nvt               466 drivers/media/rc/nuvoton-cir.c 	nvt_cr_write(nvt, nvt->cir_irq, CR_CIR_IRQ_RSRC);
nvt               469 drivers/media/rc/nuvoton-cir.c 		nvt->cir_addr, nvt->cir_irq);
nvt               472 drivers/media/rc/nuvoton-cir.c static void nvt_cir_wake_ldev_init(struct nvt_dev *nvt)
nvt               475 drivers/media/rc/nuvoton-cir.c 	nvt_select_logical_dev(nvt, LOGICAL_DEV_ACPI);
nvt               476 drivers/media/rc/nuvoton-cir.c 	nvt_cr_write(nvt, LOGICAL_DEV_ENABLE, CR_LOGICAL_DEV_EN);
nvt               479 drivers/media/rc/nuvoton-cir.c 	nvt_set_reg_bit(nvt, CIR_WAKE_ENABLE_BIT, CR_ACPI_CIR_WAKE);
nvt               482 drivers/media/rc/nuvoton-cir.c 	nvt_set_reg_bit(nvt, PME_INTR_CIR_PASS_BIT, CR_ACPI_IRQ_EVENTS2);
nvt               485 drivers/media/rc/nuvoton-cir.c 	nvt_select_logical_dev(nvt, LOGICAL_DEV_CIR_WAKE);
nvt               487 drivers/media/rc/nuvoton-cir.c 	nvt_set_ioaddr(nvt, &nvt->cir_wake_addr);
nvt               490 drivers/media/rc/nuvoton-cir.c 		nvt->cir_wake_addr);
nvt               494 drivers/media/rc/nuvoton-cir.c static void nvt_clear_cir_fifo(struct nvt_dev *nvt)
nvt               496 drivers/media/rc/nuvoton-cir.c 	u8 val = nvt_cir_reg_read(nvt, CIR_FIFOCON);
nvt               497 drivers/media/rc/nuvoton-cir.c 	nvt_cir_reg_write(nvt, val | CIR_FIFOCON_RXFIFOCLR, CIR_FIFOCON);
nvt               501 drivers/media/rc/nuvoton-cir.c static void nvt_clear_cir_wake_fifo(struct nvt_dev *nvt)
nvt               505 drivers/media/rc/nuvoton-cir.c 	config = nvt_cir_wake_reg_read(nvt, CIR_WAKE_IRCON);
nvt               508 drivers/media/rc/nuvoton-cir.c 	nvt_cir_wake_reg_write(nvt, config & ~CIR_WAKE_IRCON_MODE0,
nvt               511 drivers/media/rc/nuvoton-cir.c 	val = nvt_cir_wake_reg_read(nvt, CIR_WAKE_FIFOCON);
nvt               512 drivers/media/rc/nuvoton-cir.c 	nvt_cir_wake_reg_write(nvt, val | CIR_WAKE_FIFOCON_RXFIFOCLR,
nvt               515 drivers/media/rc/nuvoton-cir.c 	nvt_cir_wake_reg_write(nvt, config, CIR_WAKE_IRCON);
nvt               519 drivers/media/rc/nuvoton-cir.c static void nvt_clear_tx_fifo(struct nvt_dev *nvt)
nvt               523 drivers/media/rc/nuvoton-cir.c 	val = nvt_cir_reg_read(nvt, CIR_FIFOCON);
nvt               524 drivers/media/rc/nuvoton-cir.c 	nvt_cir_reg_write(nvt, val | CIR_FIFOCON_TXFIFOCLR, CIR_FIFOCON);
nvt               528 drivers/media/rc/nuvoton-cir.c static void nvt_set_cir_iren(struct nvt_dev *nvt)
nvt               533 drivers/media/rc/nuvoton-cir.c 	nvt_cir_reg_write(nvt, iren, CIR_IREN);
nvt               536 drivers/media/rc/nuvoton-cir.c static void nvt_cir_regs_init(struct nvt_dev *nvt)
nvt               538 drivers/media/rc/nuvoton-cir.c 	nvt_enable_logical_dev(nvt, LOGICAL_DEV_CIR);
nvt               541 drivers/media/rc/nuvoton-cir.c 	nvt_cir_reg_write(nvt, CIR_RX_LIMIT_COUNT >> 8, CIR_SLCH);
nvt               542 drivers/media/rc/nuvoton-cir.c 	nvt_cir_reg_write(nvt, CIR_RX_LIMIT_COUNT & 0xff, CIR_SLCL);
nvt               545 drivers/media/rc/nuvoton-cir.c 	nvt_cir_reg_write(nvt, CIR_FIFOCON_TX_TRIGGER_LEV |
nvt               549 drivers/media/rc/nuvoton-cir.c 	nvt_clear_cir_fifo(nvt);
nvt               550 drivers/media/rc/nuvoton-cir.c 	nvt_clear_tx_fifo(nvt);
nvt               552 drivers/media/rc/nuvoton-cir.c 	nvt_disable_logical_dev(nvt, LOGICAL_DEV_CIR);
nvt               555 drivers/media/rc/nuvoton-cir.c static void nvt_cir_wake_regs_init(struct nvt_dev *nvt)
nvt               557 drivers/media/rc/nuvoton-cir.c 	nvt_enable_logical_dev(nvt, LOGICAL_DEV_CIR_WAKE);
nvt               563 drivers/media/rc/nuvoton-cir.c 	nvt_cir_wake_reg_write(nvt, CIR_WAKE_IRCON_MODE0 |
nvt               569 drivers/media/rc/nuvoton-cir.c 	nvt_cir_wake_reg_write(nvt, 0xff, CIR_WAKE_IRSTS);
nvt               572 drivers/media/rc/nuvoton-cir.c static void nvt_enable_wake(struct nvt_dev *nvt)
nvt               576 drivers/media/rc/nuvoton-cir.c 	nvt_efm_enable(nvt);
nvt               578 drivers/media/rc/nuvoton-cir.c 	nvt_select_logical_dev(nvt, LOGICAL_DEV_ACPI);
nvt               579 drivers/media/rc/nuvoton-cir.c 	nvt_set_reg_bit(nvt, CIR_WAKE_ENABLE_BIT, CR_ACPI_CIR_WAKE);
nvt               580 drivers/media/rc/nuvoton-cir.c 	nvt_set_reg_bit(nvt, PME_INTR_CIR_PASS_BIT, CR_ACPI_IRQ_EVENTS2);
nvt               582 drivers/media/rc/nuvoton-cir.c 	nvt_select_logical_dev(nvt, LOGICAL_DEV_CIR_WAKE);
nvt               583 drivers/media/rc/nuvoton-cir.c 	nvt_cr_write(nvt, LOGICAL_DEV_ENABLE, CR_LOGICAL_DEV_EN);
nvt               585 drivers/media/rc/nuvoton-cir.c 	nvt_efm_disable(nvt);
nvt               587 drivers/media/rc/nuvoton-cir.c 	spin_lock_irqsave(&nvt->lock, flags);
nvt               589 drivers/media/rc/nuvoton-cir.c 	nvt_cir_wake_reg_write(nvt, CIR_WAKE_IRCON_MODE0 | CIR_WAKE_IRCON_RXEN |
nvt               593 drivers/media/rc/nuvoton-cir.c 	nvt_cir_wake_reg_write(nvt, 0xff, CIR_WAKE_IRSTS);
nvt               594 drivers/media/rc/nuvoton-cir.c 	nvt_cir_wake_reg_write(nvt, 0, CIR_WAKE_IREN);
nvt               596 drivers/media/rc/nuvoton-cir.c 	spin_unlock_irqrestore(&nvt->lock, flags);
nvt               601 drivers/media/rc/nuvoton-cir.c static u32 nvt_rx_carrier_detect(struct nvt_dev *nvt)
nvt               606 drivers/media/rc/nuvoton-cir.c 	count = nvt_cir_reg_read(nvt, CIR_FCCL) |
nvt               607 drivers/media/rc/nuvoton-cir.c 		nvt_cir_reg_read(nvt, CIR_FCCH) << 8;
nvt               609 drivers/media/rc/nuvoton-cir.c 	for (i = 0; i < nvt->pkts; i++) {
nvt               610 drivers/media/rc/nuvoton-cir.c 		if (nvt->buf[i] & BUF_PULSE_BIT)
nvt               611 drivers/media/rc/nuvoton-cir.c 			duration += nvt->buf[i] & BUF_LEN_MASK;
nvt               617 drivers/media/rc/nuvoton-cir.c 		dev_notice(nvt_get_dev(nvt),
nvt               643 drivers/media/rc/nuvoton-cir.c 	struct nvt_dev *nvt = dev->priv;
nvt               649 drivers/media/rc/nuvoton-cir.c 	nvt_cir_reg_write(nvt, 1, CIR_CP);
nvt               651 drivers/media/rc/nuvoton-cir.c 	nvt_cir_reg_write(nvt, val & 0xff, CIR_CC);
nvt               654 drivers/media/rc/nuvoton-cir.c 		nvt_cir_reg_read(nvt, CIR_CP), nvt_cir_reg_read(nvt, CIR_CC));
nvt               716 drivers/media/rc/nuvoton-cir.c static void nvt_dump_rx_buf(struct nvt_dev *nvt)
nvt               720 drivers/media/rc/nuvoton-cir.c 	printk(KERN_DEBUG "%s (len %d): ", __func__, nvt->pkts);
nvt               721 drivers/media/rc/nuvoton-cir.c 	for (i = 0; (i < nvt->pkts) && (i < RX_BUF_LEN); i++)
nvt               722 drivers/media/rc/nuvoton-cir.c 		printk(KERN_CONT "0x%02x ", nvt->buf[i]);
nvt               738 drivers/media/rc/nuvoton-cir.c static void nvt_process_rx_ir_data(struct nvt_dev *nvt)
nvt               747 drivers/media/rc/nuvoton-cir.c 		nvt_dump_rx_buf(nvt);
nvt               749 drivers/media/rc/nuvoton-cir.c 	nvt_dbg_verbose("Processing buffer of len %d", nvt->pkts);
nvt               751 drivers/media/rc/nuvoton-cir.c 	for (i = 0; i < nvt->pkts; i++) {
nvt               752 drivers/media/rc/nuvoton-cir.c 		sample = nvt->buf[i];
nvt               761 drivers/media/rc/nuvoton-cir.c 		ir_raw_event_store_with_filter(nvt->rdev, &rawir);
nvt               764 drivers/media/rc/nuvoton-cir.c 	nvt->pkts = 0;
nvt               767 drivers/media/rc/nuvoton-cir.c 	ir_raw_event_handle(nvt->rdev);
nvt               772 drivers/media/rc/nuvoton-cir.c static void nvt_handle_rx_fifo_overrun(struct nvt_dev *nvt)
nvt               774 drivers/media/rc/nuvoton-cir.c 	dev_warn(nvt_get_dev(nvt), "RX FIFO overrun detected, flushing data!");
nvt               776 drivers/media/rc/nuvoton-cir.c 	nvt->pkts = 0;
nvt               777 drivers/media/rc/nuvoton-cir.c 	nvt_clear_cir_fifo(nvt);
nvt               778 drivers/media/rc/nuvoton-cir.c 	ir_raw_event_reset(nvt->rdev);
nvt               782 drivers/media/rc/nuvoton-cir.c static void nvt_get_rx_ir_data(struct nvt_dev *nvt)
nvt               788 drivers/media/rc/nuvoton-cir.c 	fifocount = nvt_cir_reg_read(nvt, CIR_RXFCONT);
nvt               794 drivers/media/rc/nuvoton-cir.c 		nvt->buf[i] = nvt_cir_reg_read(nvt, CIR_SRXFIFO);
nvt               796 drivers/media/rc/nuvoton-cir.c 	nvt->pkts = fifocount;
nvt               797 drivers/media/rc/nuvoton-cir.c 	nvt_dbg("%s: pkts now %d", __func__, nvt->pkts);
nvt               799 drivers/media/rc/nuvoton-cir.c 	nvt_process_rx_ir_data(nvt);
nvt               822 drivers/media/rc/nuvoton-cir.c 	struct nvt_dev *nvt = data;
nvt               827 drivers/media/rc/nuvoton-cir.c 	spin_lock(&nvt->lock);
nvt               842 drivers/media/rc/nuvoton-cir.c 	status = nvt_cir_reg_read(nvt, CIR_IRSTS);
nvt               843 drivers/media/rc/nuvoton-cir.c 	iren = nvt_cir_reg_read(nvt, CIR_IREN);
nvt               849 drivers/media/rc/nuvoton-cir.c 		spin_unlock(&nvt->lock);
nvt               858 drivers/media/rc/nuvoton-cir.c 		spin_unlock(&nvt->lock);
nvt               864 drivers/media/rc/nuvoton-cir.c 	nvt_cir_reg_write(nvt, status, CIR_IRSTS);
nvt               865 drivers/media/rc/nuvoton-cir.c 	nvt_cir_reg_write(nvt, 0, CIR_IRSTS);
nvt               870 drivers/media/rc/nuvoton-cir.c 		nvt_handle_rx_fifo_overrun(nvt);
nvt               872 drivers/media/rc/nuvoton-cir.c 		nvt_get_rx_ir_data(nvt);
nvt               874 drivers/media/rc/nuvoton-cir.c 	spin_unlock(&nvt->lock);
nvt               880 drivers/media/rc/nuvoton-cir.c static void nvt_enable_cir(struct nvt_dev *nvt)
nvt               885 drivers/media/rc/nuvoton-cir.c 	nvt_enable_logical_dev(nvt, LOGICAL_DEV_CIR);
nvt               887 drivers/media/rc/nuvoton-cir.c 	spin_lock_irqsave(&nvt->lock, flags);
nvt               893 drivers/media/rc/nuvoton-cir.c 	nvt_cir_reg_write(nvt, CIR_IRCON_TXEN | CIR_IRCON_RXEN |
nvt               898 drivers/media/rc/nuvoton-cir.c 	nvt_cir_reg_write(nvt, 0xff, CIR_IRSTS);
nvt               901 drivers/media/rc/nuvoton-cir.c 	nvt_set_cir_iren(nvt);
nvt               903 drivers/media/rc/nuvoton-cir.c 	spin_unlock_irqrestore(&nvt->lock, flags);
nvt               906 drivers/media/rc/nuvoton-cir.c static void nvt_disable_cir(struct nvt_dev *nvt)
nvt               910 drivers/media/rc/nuvoton-cir.c 	spin_lock_irqsave(&nvt->lock, flags);
nvt               913 drivers/media/rc/nuvoton-cir.c 	nvt_cir_reg_write(nvt, 0, CIR_IREN);
nvt               916 drivers/media/rc/nuvoton-cir.c 	nvt_cir_reg_write(nvt, 0xff, CIR_IRSTS);
nvt               919 drivers/media/rc/nuvoton-cir.c 	nvt_cir_reg_write(nvt, 0, CIR_IRCON);
nvt               922 drivers/media/rc/nuvoton-cir.c 	nvt_clear_cir_fifo(nvt);
nvt               923 drivers/media/rc/nuvoton-cir.c 	nvt_clear_tx_fifo(nvt);
nvt               925 drivers/media/rc/nuvoton-cir.c 	spin_unlock_irqrestore(&nvt->lock, flags);
nvt               928 drivers/media/rc/nuvoton-cir.c 	nvt_disable_logical_dev(nvt, LOGICAL_DEV_CIR);
nvt               933 drivers/media/rc/nuvoton-cir.c 	struct nvt_dev *nvt = dev->priv;
nvt               935 drivers/media/rc/nuvoton-cir.c 	nvt_enable_cir(nvt);
nvt               942 drivers/media/rc/nuvoton-cir.c 	struct nvt_dev *nvt = dev->priv;
nvt               944 drivers/media/rc/nuvoton-cir.c 	nvt_disable_cir(nvt);
nvt               950 drivers/media/rc/nuvoton-cir.c 	struct nvt_dev *nvt;
nvt               954 drivers/media/rc/nuvoton-cir.c 	nvt = devm_kzalloc(&pdev->dev, sizeof(struct nvt_dev), GFP_KERNEL);
nvt               955 drivers/media/rc/nuvoton-cir.c 	if (!nvt)
nvt               959 drivers/media/rc/nuvoton-cir.c 	nvt->rdev = devm_rc_allocate_device(&pdev->dev, RC_DRIVER_IR_RAW);
nvt               960 drivers/media/rc/nuvoton-cir.c 	if (!nvt->rdev)
nvt               962 drivers/media/rc/nuvoton-cir.c 	rdev = nvt->rdev;
nvt               989 drivers/media/rc/nuvoton-cir.c 	nvt->cir_addr = pnp_port_start(pdev, 0);
nvt               990 drivers/media/rc/nuvoton-cir.c 	nvt->cir_irq  = pnp_irq(pdev, 0);
nvt               992 drivers/media/rc/nuvoton-cir.c 	nvt->cir_wake_addr = pnp_port_start(pdev, 1);
nvt               994 drivers/media/rc/nuvoton-cir.c 	nvt->cr_efir = CR_EFIR;
nvt               995 drivers/media/rc/nuvoton-cir.c 	nvt->cr_efdr = CR_EFDR;
nvt               997 drivers/media/rc/nuvoton-cir.c 	spin_lock_init(&nvt->lock);
nvt               999 drivers/media/rc/nuvoton-cir.c 	pnp_set_drvdata(pdev, nvt);
nvt              1001 drivers/media/rc/nuvoton-cir.c 	ret = nvt_hw_detect(nvt);
nvt              1006 drivers/media/rc/nuvoton-cir.c 	nvt_efm_enable(nvt);
nvt              1007 drivers/media/rc/nuvoton-cir.c 	nvt_cir_ldev_init(nvt);
nvt              1008 drivers/media/rc/nuvoton-cir.c 	nvt_cir_wake_ldev_init(nvt);
nvt              1009 drivers/media/rc/nuvoton-cir.c 	nvt_efm_disable(nvt);
nvt              1015 drivers/media/rc/nuvoton-cir.c 	nvt_cir_regs_init(nvt);
nvt              1016 drivers/media/rc/nuvoton-cir.c 	nvt_cir_wake_regs_init(nvt);
nvt              1019 drivers/media/rc/nuvoton-cir.c 	rdev->priv = nvt;
nvt              1031 drivers/media/rc/nuvoton-cir.c 	rdev->input_id.product = nvt->chip_major;
nvt              1032 drivers/media/rc/nuvoton-cir.c 	rdev->input_id.version = nvt->chip_minor;
nvt              1047 drivers/media/rc/nuvoton-cir.c 	if (!devm_request_region(&pdev->dev, nvt->cir_addr,
nvt              1051 drivers/media/rc/nuvoton-cir.c 	ret = devm_request_irq(&pdev->dev, nvt->cir_irq, nvt_cir_isr,
nvt              1052 drivers/media/rc/nuvoton-cir.c 			       IRQF_SHARED, NVT_DRIVER_NAME, nvt);
nvt              1056 drivers/media/rc/nuvoton-cir.c 	if (!devm_request_region(&pdev->dev, nvt->cir_wake_addr,
nvt              1068 drivers/media/rc/nuvoton-cir.c 		cir_dump_regs(nvt);
nvt              1069 drivers/media/rc/nuvoton-cir.c 		cir_wake_dump_regs(nvt);
nvt              1077 drivers/media/rc/nuvoton-cir.c 	struct nvt_dev *nvt = pnp_get_drvdata(pdev);
nvt              1079 drivers/media/rc/nuvoton-cir.c 	device_remove_file(&nvt->rdev->dev, &dev_attr_wakeup_data);
nvt              1081 drivers/media/rc/nuvoton-cir.c 	nvt_disable_cir(nvt);
nvt              1084 drivers/media/rc/nuvoton-cir.c 	nvt_enable_wake(nvt);
nvt              1089 drivers/media/rc/nuvoton-cir.c 	struct nvt_dev *nvt = pnp_get_drvdata(pdev);
nvt              1093 drivers/media/rc/nuvoton-cir.c 	mutex_lock(&nvt->rdev->lock);
nvt              1094 drivers/media/rc/nuvoton-cir.c 	if (nvt->rdev->users)
nvt              1095 drivers/media/rc/nuvoton-cir.c 		nvt_disable_cir(nvt);
nvt              1096 drivers/media/rc/nuvoton-cir.c 	mutex_unlock(&nvt->rdev->lock);
nvt              1099 drivers/media/rc/nuvoton-cir.c 	nvt_enable_wake(nvt);
nvt              1106 drivers/media/rc/nuvoton-cir.c 	struct nvt_dev *nvt = pnp_get_drvdata(pdev);
nvt              1110 drivers/media/rc/nuvoton-cir.c 	nvt_cir_regs_init(nvt);
nvt              1111 drivers/media/rc/nuvoton-cir.c 	nvt_cir_wake_regs_init(nvt);
nvt              1113 drivers/media/rc/nuvoton-cir.c 	mutex_lock(&nvt->rdev->lock);
nvt              1114 drivers/media/rc/nuvoton-cir.c 	if (nvt->rdev->users)
nvt              1115 drivers/media/rc/nuvoton-cir.c 		nvt_enable_cir(nvt);
nvt              1116 drivers/media/rc/nuvoton-cir.c 	mutex_unlock(&nvt->rdev->lock);
nvt              1123 drivers/media/rc/nuvoton-cir.c 	struct nvt_dev *nvt = pnp_get_drvdata(pdev);
nvt              1125 drivers/media/rc/nuvoton-cir.c 	nvt_enable_wake(nvt);