Searched refs:fintek (Results 1 - 6 of 6) sorted by relevance

/linux-4.4.14/drivers/media/rc/
H A Dfintek-cir.c37 #include "fintek-cir.h"
40 static inline void fintek_cr_write(struct fintek_dev *fintek, u8 val, u8 reg) fintek_cr_write() argument
43 __func__, reg, val, fintek->cr_ip, fintek->cr_dp); fintek_cr_write()
44 outb(reg, fintek->cr_ip); fintek_cr_write()
45 outb(val, fintek->cr_dp); fintek_cr_write()
49 static inline u8 fintek_cr_read(struct fintek_dev *fintek, u8 reg) fintek_cr_read() argument
53 outb(reg, fintek->cr_ip); fintek_cr_read()
54 val = inb(fintek->cr_dp); fintek_cr_read()
57 __func__, reg, val, fintek->cr_ip, fintek->cr_dp); fintek_cr_read()
62 static inline void fintek_set_reg_bit(struct fintek_dev *fintek, u8 val, u8 reg) fintek_set_reg_bit() argument
64 u8 tmp = fintek_cr_read(fintek, reg) | val; fintek_set_reg_bit()
65 fintek_cr_write(fintek, tmp, reg); fintek_set_reg_bit()
69 static inline void fintek_clear_reg_bit(struct fintek_dev *fintek, u8 val, u8 reg) fintek_clear_reg_bit() argument
71 u8 tmp = fintek_cr_read(fintek, reg) & ~val; fintek_clear_reg_bit()
72 fintek_cr_write(fintek, tmp, reg); fintek_clear_reg_bit()
76 static inline void fintek_config_mode_enable(struct fintek_dev *fintek) fintek_config_mode_enable() argument
79 outb(CONFIG_REG_ENABLE, fintek->cr_ip); fintek_config_mode_enable()
80 outb(CONFIG_REG_ENABLE, fintek->cr_ip); fintek_config_mode_enable()
84 static inline void fintek_config_mode_disable(struct fintek_dev *fintek) fintek_config_mode_disable() argument
86 outb(CONFIG_REG_DISABLE, fintek->cr_ip); fintek_config_mode_disable()
93 static inline void fintek_select_logical_dev(struct fintek_dev *fintek, u8 ldev) fintek_select_logical_dev() argument
95 fintek_cr_write(fintek, ldev, GCR_LOGICAL_DEV_NO); fintek_select_logical_dev()
99 static inline void fintek_cir_reg_write(struct fintek_dev *fintek, u8 val, u8 offset) fintek_cir_reg_write() argument
101 outb(val, fintek->cir_addr + offset); fintek_cir_reg_write()
105 static u8 fintek_cir_reg_read(struct fintek_dev *fintek, u8 offset) fintek_cir_reg_read() argument
109 val = inb(fintek->cir_addr + offset); fintek_cir_reg_read()
115 static void cir_dump_regs(struct fintek_dev *fintek) cir_dump_regs() argument
117 fintek_config_mode_enable(fintek); cir_dump_regs()
118 fintek_select_logical_dev(fintek, fintek->logical_dev_cir); cir_dump_regs()
122 (fintek_cr_read(fintek, CIR_CR_BASE_ADDR_HI) << 8) | cir_dump_regs()
123 fintek_cr_read(fintek, CIR_CR_BASE_ADDR_LO)); cir_dump_regs()
125 fintek_cr_read(fintek, CIR_CR_IRQ_SEL)); cir_dump_regs()
127 fintek_config_mode_disable(fintek); cir_dump_regs()
131 fintek_cir_reg_read(fintek, CIR_STATUS)); cir_dump_regs()
133 fintek_cir_reg_read(fintek, CIR_CONTROL)); cir_dump_regs()
135 fintek_cir_reg_read(fintek, CIR_RX_DATA)); cir_dump_regs()
137 fintek_cir_reg_read(fintek, CIR_TX_CONTROL)); cir_dump_regs()
139 fintek_cir_reg_read(fintek, CIR_TX_DATA)); cir_dump_regs()
143 static int fintek_hw_detect(struct fintek_dev *fintek) fintek_hw_detect() argument
151 fintek_config_mode_enable(fintek); fintek_hw_detect()
154 portsel = fintek_cr_read(fintek, GCR_CONFIG_PORT_SEL); fintek_hw_detect()
157 fintek_config_mode_disable(fintek); fintek_hw_detect()
158 fintek->cr_ip = CR_INDEX_PORT2; fintek_hw_detect()
159 fintek->cr_dp = CR_DATA_PORT2; fintek_hw_detect()
160 fintek_config_mode_enable(fintek); fintek_hw_detect()
161 portsel = fintek_cr_read(fintek, GCR_CONFIG_PORT_SEL); fintek_hw_detect()
165 ir_class = fintek_cir_reg_read(fintek, CIR_CR_CLASS); fintek_hw_detect()
171 fintek->hw_tx_capable = true; fintek_hw_detect()
175 fintek->hw_tx_capable = false; fintek_hw_detect()
179 chip_major = fintek_cr_read(fintek, GCR_CHIP_ID_HI); fintek_hw_detect()
180 chip_minor = fintek_cr_read(fintek, GCR_CHIP_ID_LO); fintek_hw_detect()
183 vendor_major = fintek_cr_read(fintek, GCR_VENDOR_ID_HI); fintek_hw_detect()
184 vendor_minor = fintek_cr_read(fintek, GCR_VENDOR_ID_LO); fintek_hw_detect()
192 fintek_config_mode_disable(fintek); fintek_hw_detect()
194 spin_lock_irqsave(&fintek->fintek_lock, flags); fintek_hw_detect()
195 fintek->chip_major = chip_major; fintek_hw_detect()
196 fintek->chip_minor = chip_minor; fintek_hw_detect()
197 fintek->chip_vendor = vendor; fintek_hw_detect()
203 fintek->logical_dev_cir = LOGICAL_DEV_CIR_REV2; fintek_hw_detect()
205 fintek->logical_dev_cir = LOGICAL_DEV_CIR_REV1; fintek_hw_detect()
207 spin_unlock_irqrestore(&fintek->fintek_lock, flags); fintek_hw_detect()
212 static void fintek_cir_ldev_init(struct fintek_dev *fintek) fintek_cir_ldev_init() argument
215 fintek_select_logical_dev(fintek, fintek->logical_dev_cir); fintek_cir_ldev_init()
216 fintek_cr_write(fintek, LOGICAL_DEV_ENABLE, CIR_CR_DEV_EN); fintek_cir_ldev_init()
219 fintek_cr_write(fintek, fintek->cir_addr >> 8, CIR_CR_BASE_ADDR_HI); fintek_cir_ldev_init()
220 fintek_cr_write(fintek, fintek->cir_addr & 0xff, CIR_CR_BASE_ADDR_LO); fintek_cir_ldev_init()
222 fintek_cr_write(fintek, fintek->cir_irq, CIR_CR_IRQ_SEL); fintek_cir_ldev_init()
225 fintek->cir_addr, fintek->cir_irq, fintek->cir_port_len); fintek_cir_ldev_init()
229 static void fintek_enable_cir_irq(struct fintek_dev *fintek) fintek_enable_cir_irq() argument
231 fintek_cir_reg_write(fintek, CIR_STATUS_IRQ_EN, CIR_STATUS); fintek_enable_cir_irq()
234 static void fintek_cir_regs_init(struct fintek_dev *fintek) fintek_cir_regs_init() argument
237 fintek_cir_reg_write(fintek, CIR_STATUS_IRQ_MASK, CIR_STATUS); fintek_cir_regs_init()
240 fintek_enable_cir_irq(fintek); fintek_cir_regs_init()
243 static void fintek_enable_wake(struct fintek_dev *fintek) fintek_enable_wake() argument
245 fintek_config_mode_enable(fintek); fintek_enable_wake()
246 fintek_select_logical_dev(fintek, LOGICAL_DEV_ACPI); fintek_enable_wake()
249 fintek_set_reg_bit(fintek, ACPI_WAKE_EN_CIR_BIT, LDEV_ACPI_WAKE_EN_REG); fintek_enable_wake()
251 fintek_set_reg_bit(fintek, ACPI_PME_CIR_BIT, LDEV_ACPI_PME_EN_REG); fintek_enable_wake()
253 fintek_set_reg_bit(fintek, ACPI_PME_CIR_BIT, LDEV_ACPI_PME_CLR_REG); fintek_enable_wake()
255 fintek_set_reg_bit(fintek, ACPI_STATE_CIR_BIT, LDEV_ACPI_STATE_REG); fintek_enable_wake()
257 fintek_config_mode_disable(fintek); fintek_enable_wake()
292 static void fintek_process_rx_ir_data(struct fintek_dev *fintek) fintek_process_rx_ir_data() argument
299 for (i = 0; i < fintek->pkts; i++) { fintek_process_rx_ir_data()
300 sample = fintek->buf[i]; fintek_process_rx_ir_data()
301 switch (fintek->parser_state) { fintek_process_rx_ir_data()
303 fintek->cmd = sample; fintek_process_rx_ir_data()
304 if ((fintek->cmd == BUF_COMMAND_HEADER) || fintek_process_rx_ir_data()
305 ((fintek->cmd & BUF_COMMAND_MASK) != fintek_process_rx_ir_data()
307 fintek->parser_state = SUBCMD; fintek_process_rx_ir_data()
310 fintek->rem = (fintek->cmd & BUF_LEN_MASK); fintek_process_rx_ir_data()
311 fit_dbg("%s: rem: 0x%02x", __func__, fintek->rem); fintek_process_rx_ir_data()
312 if (fintek->rem) fintek_process_rx_ir_data()
313 fintek->parser_state = PARSE_IRDATA; fintek_process_rx_ir_data()
315 ir_raw_event_reset(fintek->rdev); fintek_process_rx_ir_data()
318 fintek->rem = fintek_cmdsize(fintek->cmd, sample); fintek_process_rx_ir_data()
319 fintek->parser_state = CMD_DATA; fintek_process_rx_ir_data()
322 fintek->rem--; fintek_process_rx_ir_data()
325 fintek->rem--; fintek_process_rx_ir_data()
334 if (ir_raw_event_store_with_filter(fintek->rdev, fintek_process_rx_ir_data()
340 if ((fintek->parser_state != CMD_HEADER) && !fintek->rem) fintek_process_rx_ir_data()
341 fintek->parser_state = CMD_HEADER; fintek_process_rx_ir_data()
344 fintek->pkts = 0; fintek_process_rx_ir_data()
348 ir_raw_event_handle(fintek->rdev); fintek_process_rx_ir_data()
353 static void fintek_get_rx_ir_data(struct fintek_dev *fintek, u8 rx_irqs) fintek_get_rx_ir_data() argument
358 spin_lock_irqsave(&fintek->fintek_lock, flags); fintek_get_rx_ir_data()
366 sample = fintek_cir_reg_read(fintek, CIR_RX_DATA); fintek_get_rx_ir_data()
369 fintek->buf[fintek->pkts] = sample; fintek_get_rx_ir_data()
370 fintek->pkts++; fintek_get_rx_ir_data()
372 status = fintek_cir_reg_read(fintek, CIR_STATUS); fintek_get_rx_ir_data()
377 fintek_process_rx_ir_data(fintek); fintek_get_rx_ir_data()
379 spin_unlock_irqrestore(&fintek->fintek_lock, flags); fintek_get_rx_ir_data()
395 struct fintek_dev *fintek = data; fintek_cir_isr() local
400 fintek_config_mode_enable(fintek); fintek_cir_isr()
401 fintek_select_logical_dev(fintek, fintek->logical_dev_cir); fintek_cir_isr()
402 fintek_config_mode_disable(fintek); fintek_cir_isr()
413 status = fintek_cir_reg_read(fintek, CIR_STATUS); fintek_cir_isr()
416 fintek_cir_reg_write(fintek, CIR_STATUS_IRQ_MASK, CIR_STATUS); fintek_cir_isr()
425 fintek_get_rx_ir_data(fintek, rx_irqs); fintek_cir_isr()
428 fintek_cir_reg_write(fintek, status, CIR_STATUS); fintek_cir_isr()
434 static void fintek_enable_cir(struct fintek_dev *fintek) fintek_enable_cir() argument
437 fintek_cir_reg_write(fintek, CIR_STATUS_IRQ_EN, CIR_STATUS); fintek_enable_cir()
439 fintek_config_mode_enable(fintek); fintek_enable_cir()
442 fintek_select_logical_dev(fintek, fintek->logical_dev_cir); fintek_enable_cir()
443 fintek_cr_write(fintek, LOGICAL_DEV_ENABLE, CIR_CR_DEV_EN); fintek_enable_cir()
445 fintek_config_mode_disable(fintek); fintek_enable_cir()
448 fintek_cir_reg_write(fintek, CIR_STATUS_IRQ_MASK, CIR_STATUS); fintek_enable_cir()
451 fintek_enable_cir_irq(fintek); fintek_enable_cir()
454 static void fintek_disable_cir(struct fintek_dev *fintek) fintek_disable_cir() argument
456 fintek_config_mode_enable(fintek); fintek_disable_cir()
459 fintek_select_logical_dev(fintek, fintek->logical_dev_cir); fintek_disable_cir()
460 fintek_cr_write(fintek, LOGICAL_DEV_DISABLE, CIR_CR_DEV_EN); fintek_disable_cir()
462 fintek_config_mode_disable(fintek); fintek_disable_cir()
467 struct fintek_dev *fintek = dev->priv; fintek_open() local
470 spin_lock_irqsave(&fintek->fintek_lock, flags); fintek_open()
471 fintek_enable_cir(fintek); fintek_open()
472 spin_unlock_irqrestore(&fintek->fintek_lock, flags); fintek_open()
479 struct fintek_dev *fintek = dev->priv; fintek_close() local
482 spin_lock_irqsave(&fintek->fintek_lock, flags); fintek_close()
483 fintek_disable_cir(fintek); fintek_close()
484 spin_unlock_irqrestore(&fintek->fintek_lock, flags); fintek_close()
490 struct fintek_dev *fintek; fintek_probe() local
494 fintek = kzalloc(sizeof(struct fintek_dev), GFP_KERNEL); fintek_probe()
495 if (!fintek) fintek_probe()
515 fintek->cir_addr = pnp_port_start(pdev, 0); fintek_probe()
516 fintek->cir_irq = pnp_irq(pdev, 0); fintek_probe()
517 fintek->cir_port_len = pnp_port_len(pdev, 0); fintek_probe()
519 fintek->cr_ip = CR_INDEX_PORT; fintek_probe()
520 fintek->cr_dp = CR_DATA_PORT; fintek_probe()
522 spin_lock_init(&fintek->fintek_lock); fintek_probe()
524 pnp_set_drvdata(pdev, fintek); fintek_probe()
525 fintek->pdev = pdev; fintek_probe()
527 ret = fintek_hw_detect(fintek); fintek_probe()
532 fintek_config_mode_enable(fintek); fintek_probe()
533 fintek_cir_ldev_init(fintek); fintek_probe()
534 fintek_config_mode_disable(fintek); fintek_probe()
537 fintek_cir_regs_init(fintek); fintek_probe()
540 rdev->priv = fintek; fintek_probe()
546 rdev->input_phys = "fintek/cir0"; fintek_probe()
549 rdev->input_id.product = fintek->chip_major; fintek_probe()
550 rdev->input_id.version = fintek->chip_minor; fintek_probe()
558 fintek->rdev = rdev; fintek_probe()
562 if (!request_region(fintek->cir_addr, fintek_probe()
563 fintek->cir_port_len, FINTEK_DRIVER_NAME)) fintek_probe()
566 if (request_irq(fintek->cir_irq, fintek_cir_isr, IRQF_SHARED, fintek_probe()
567 FINTEK_DRIVER_NAME, (void *)fintek)) fintek_probe()
578 cir_dump_regs(fintek); fintek_probe()
583 free_irq(fintek->cir_irq, fintek); fintek_probe()
585 release_region(fintek->cir_addr, fintek->cir_port_len); fintek_probe()
588 kfree(fintek); fintek_probe()
595 struct fintek_dev *fintek = pnp_get_drvdata(pdev); fintek_remove() local
598 spin_lock_irqsave(&fintek->fintek_lock, flags); fintek_remove()
600 fintek_disable_cir(fintek); fintek_remove()
601 fintek_cir_reg_write(fintek, CIR_STATUS_IRQ_MASK, CIR_STATUS); fintek_remove()
603 fintek_enable_wake(fintek); fintek_remove()
604 spin_unlock_irqrestore(&fintek->fintek_lock, flags); fintek_remove()
607 free_irq(fintek->cir_irq, fintek); fintek_remove()
608 release_region(fintek->cir_addr, fintek->cir_port_len); fintek_remove()
610 rc_unregister_device(fintek->rdev); fintek_remove()
612 kfree(fintek); fintek_remove()
617 struct fintek_dev *fintek = pnp_get_drvdata(pdev); fintek_suspend() local
622 spin_lock_irqsave(&fintek->fintek_lock, flags); fintek_suspend()
625 fintek_cir_reg_write(fintek, CIR_STATUS_IRQ_MASK, CIR_STATUS); fintek_suspend()
627 spin_unlock_irqrestore(&fintek->fintek_lock, flags); fintek_suspend()
629 fintek_config_mode_enable(fintek); fintek_suspend()
632 fintek_select_logical_dev(fintek, fintek->logical_dev_cir); fintek_suspend()
633 fintek_cr_write(fintek, LOGICAL_DEV_DISABLE, CIR_CR_DEV_EN); fintek_suspend()
635 fintek_config_mode_disable(fintek); fintek_suspend()
638 fintek_enable_wake(fintek); fintek_suspend()
645 struct fintek_dev *fintek = pnp_get_drvdata(pdev); fintek_resume() local
650 fintek_enable_cir_irq(fintek); fintek_resume()
653 fintek_config_mode_enable(fintek); fintek_resume()
654 fintek_select_logical_dev(fintek, fintek->logical_dev_cir); fintek_resume()
655 fintek_cr_write(fintek, LOGICAL_DEV_ENABLE, CIR_CR_DEV_EN); fintek_resume()
657 fintek_config_mode_disable(fintek); fintek_resume()
659 fintek_cir_regs_init(fintek); fintek_resume()
666 struct fintek_dev *fintek = pnp_get_drvdata(pdev); fintek_shutdown() local
667 fintek_enable_wake(fintek); fintek_shutdown()
H A DMakefile24 obj-$(CONFIG_IR_FINTEK) += fintek-cir.o
H A Dfintek-cir.h30 #define FINTEK_DRIVER_NAME "fintek-cir"
/linux-4.4.14/drivers/hwmon/
H A Df75375s.c9 * http://www.fintek.com.tw/files/productfiles/F75375_V026P.pdf
12 * http://www.fintek.com.tw/files/productfiles/F75373_V025P.pdf
15 * http://www.fintek.com.tw/files/productfiles/F75387_V027P.pdf
/linux-4.4.14/drivers/usb/serial/
H A Df81232.c693 MODULE_AUTHOR("Peter Hong <peter_hong@fintek.com.tw>");
/linux-4.4.14/drivers/acpi/
H A Dacpi_pnp.c95 /* fintek-cir */

Completed in 213 milliseconds