1c942fddfSThomas Gleixner // SPDX-License-Identifier: GPL-2.0-or-later
29bdc79eaSJarod Wilson /*
39bdc79eaSJarod Wilson * Driver for Feature Integration Technology Inc. (aka Fintek) LPC CIR
49bdc79eaSJarod Wilson *
59bdc79eaSJarod Wilson * Copyright (C) 2011 Jarod Wilson <jarod@redhat.com>
69bdc79eaSJarod Wilson *
79bdc79eaSJarod Wilson * Special thanks to Fintek for providing hardware and spec sheets.
89bdc79eaSJarod Wilson * This driver is based upon the nuvoton, ite and ene drivers for
99bdc79eaSJarod Wilson * similar hardware.
109bdc79eaSJarod Wilson */
119bdc79eaSJarod Wilson
12563cd5ceSJoe Perches #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
13563cd5ceSJoe Perches
149bdc79eaSJarod Wilson #include <linux/kernel.h>
159bdc79eaSJarod Wilson #include <linux/module.h>
169bdc79eaSJarod Wilson #include <linux/pnp.h>
179bdc79eaSJarod Wilson #include <linux/io.h>
189bdc79eaSJarod Wilson #include <linux/interrupt.h>
199bdc79eaSJarod Wilson #include <linux/sched.h>
209bdc79eaSJarod Wilson #include <linux/slab.h>
219bdc79eaSJarod Wilson #include <media/rc-core.h>
229bdc79eaSJarod Wilson
239bdc79eaSJarod Wilson #include "fintek-cir.h"
249bdc79eaSJarod Wilson
259bdc79eaSJarod Wilson /* write val to config reg */
fintek_cr_write(struct fintek_dev * fintek,u8 val,u8 reg)269bdc79eaSJarod Wilson static inline void fintek_cr_write(struct fintek_dev *fintek, u8 val, u8 reg)
279bdc79eaSJarod Wilson {
289bdc79eaSJarod Wilson fit_dbg("%s: reg 0x%02x, val 0x%02x (ip/dp: %02x/%02x)",
299bdc79eaSJarod Wilson __func__, reg, val, fintek->cr_ip, fintek->cr_dp);
309bdc79eaSJarod Wilson outb(reg, fintek->cr_ip);
319bdc79eaSJarod Wilson outb(val, fintek->cr_dp);
329bdc79eaSJarod Wilson }
339bdc79eaSJarod Wilson
349bdc79eaSJarod Wilson /* read val from config reg */
fintek_cr_read(struct fintek_dev * fintek,u8 reg)359bdc79eaSJarod Wilson static inline u8 fintek_cr_read(struct fintek_dev *fintek, u8 reg)
369bdc79eaSJarod Wilson {
379bdc79eaSJarod Wilson u8 val;
389bdc79eaSJarod Wilson
399bdc79eaSJarod Wilson outb(reg, fintek->cr_ip);
409bdc79eaSJarod Wilson val = inb(fintek->cr_dp);
419bdc79eaSJarod Wilson
429bdc79eaSJarod Wilson fit_dbg("%s: reg 0x%02x, val 0x%02x (ip/dp: %02x/%02x)",
439bdc79eaSJarod Wilson __func__, reg, val, fintek->cr_ip, fintek->cr_dp);
449bdc79eaSJarod Wilson return val;
459bdc79eaSJarod Wilson }
469bdc79eaSJarod Wilson
479bdc79eaSJarod Wilson /* update config register bit without changing other bits */
fintek_set_reg_bit(struct fintek_dev * fintek,u8 val,u8 reg)489bdc79eaSJarod Wilson static inline void fintek_set_reg_bit(struct fintek_dev *fintek, u8 val, u8 reg)
499bdc79eaSJarod Wilson {
509bdc79eaSJarod Wilson u8 tmp = fintek_cr_read(fintek, reg) | val;
519bdc79eaSJarod Wilson fintek_cr_write(fintek, tmp, reg);
529bdc79eaSJarod Wilson }
539bdc79eaSJarod Wilson
549bdc79eaSJarod Wilson /* enter config mode */
fintek_config_mode_enable(struct fintek_dev * fintek)559bdc79eaSJarod Wilson static inline void fintek_config_mode_enable(struct fintek_dev *fintek)
569bdc79eaSJarod Wilson {
579bdc79eaSJarod Wilson /* Enabling Config Mode explicitly requires writing 2x */
589bdc79eaSJarod Wilson outb(CONFIG_REG_ENABLE, fintek->cr_ip);
599bdc79eaSJarod Wilson outb(CONFIG_REG_ENABLE, fintek->cr_ip);
609bdc79eaSJarod Wilson }
619bdc79eaSJarod Wilson
629bdc79eaSJarod Wilson /* exit config mode */
fintek_config_mode_disable(struct fintek_dev * fintek)639bdc79eaSJarod Wilson static inline void fintek_config_mode_disable(struct fintek_dev *fintek)
649bdc79eaSJarod Wilson {
659bdc79eaSJarod Wilson outb(CONFIG_REG_DISABLE, fintek->cr_ip);
669bdc79eaSJarod Wilson }
679bdc79eaSJarod Wilson
689bdc79eaSJarod Wilson /*
699bdc79eaSJarod Wilson * When you want to address a specific logical device, write its logical
709bdc79eaSJarod Wilson * device number to GCR_LOGICAL_DEV_NO
719bdc79eaSJarod Wilson */
fintek_select_logical_dev(struct fintek_dev * fintek,u8 ldev)729bdc79eaSJarod Wilson static inline void fintek_select_logical_dev(struct fintek_dev *fintek, u8 ldev)
739bdc79eaSJarod Wilson {
749bdc79eaSJarod Wilson fintek_cr_write(fintek, ldev, GCR_LOGICAL_DEV_NO);
759bdc79eaSJarod Wilson }
769bdc79eaSJarod Wilson
779bdc79eaSJarod Wilson /* write val to cir config register */
fintek_cir_reg_write(struct fintek_dev * fintek,u8 val,u8 offset)789bdc79eaSJarod Wilson static inline void fintek_cir_reg_write(struct fintek_dev *fintek, u8 val, u8 offset)
799bdc79eaSJarod Wilson {
809bdc79eaSJarod Wilson outb(val, fintek->cir_addr + offset);
819bdc79eaSJarod Wilson }
829bdc79eaSJarod Wilson
839bdc79eaSJarod Wilson /* read val from cir config register */
fintek_cir_reg_read(struct fintek_dev * fintek,u8 offset)849bdc79eaSJarod Wilson static u8 fintek_cir_reg_read(struct fintek_dev *fintek, u8 offset)
859bdc79eaSJarod Wilson {
8629a8d979SMasahiro Yamada return inb(fintek->cir_addr + offset);
879bdc79eaSJarod Wilson }
889bdc79eaSJarod Wilson
899bdc79eaSJarod Wilson /* dump current cir register contents */
cir_dump_regs(struct fintek_dev * fintek)909bdc79eaSJarod Wilson static void cir_dump_regs(struct fintek_dev *fintek)
919bdc79eaSJarod Wilson {
929bdc79eaSJarod Wilson fintek_config_mode_enable(fintek);
9383ec8225SMauro Carvalho Chehab fintek_select_logical_dev(fintek, fintek->logical_dev_cir);
949bdc79eaSJarod Wilson
95563cd5ceSJoe Perches pr_info("%s: Dump CIR logical device registers:\n", FINTEK_DRIVER_NAME);
96563cd5ceSJoe Perches pr_info(" * CR CIR BASE ADDR: 0x%x\n",
979bdc79eaSJarod Wilson (fintek_cr_read(fintek, CIR_CR_BASE_ADDR_HI) << 8) |
989bdc79eaSJarod Wilson fintek_cr_read(fintek, CIR_CR_BASE_ADDR_LO));
99563cd5ceSJoe Perches pr_info(" * CR CIR IRQ NUM: 0x%x\n",
1009bdc79eaSJarod Wilson fintek_cr_read(fintek, CIR_CR_IRQ_SEL));
1019bdc79eaSJarod Wilson
1029bdc79eaSJarod Wilson fintek_config_mode_disable(fintek);
1039bdc79eaSJarod Wilson
104563cd5ceSJoe Perches pr_info("%s: Dump CIR registers:\n", FINTEK_DRIVER_NAME);
105563cd5ceSJoe Perches pr_info(" * STATUS: 0x%x\n",
106563cd5ceSJoe Perches fintek_cir_reg_read(fintek, CIR_STATUS));
107563cd5ceSJoe Perches pr_info(" * CONTROL: 0x%x\n",
108563cd5ceSJoe Perches fintek_cir_reg_read(fintek, CIR_CONTROL));
109563cd5ceSJoe Perches pr_info(" * RX_DATA: 0x%x\n",
110563cd5ceSJoe Perches fintek_cir_reg_read(fintek, CIR_RX_DATA));
111563cd5ceSJoe Perches pr_info(" * TX_CONTROL: 0x%x\n",
112563cd5ceSJoe Perches fintek_cir_reg_read(fintek, CIR_TX_CONTROL));
113563cd5ceSJoe Perches pr_info(" * TX_DATA: 0x%x\n",
114563cd5ceSJoe Perches fintek_cir_reg_read(fintek, CIR_TX_DATA));
1159bdc79eaSJarod Wilson }
1169bdc79eaSJarod Wilson
1179bdc79eaSJarod Wilson /* detect hardware features */
fintek_hw_detect(struct fintek_dev * fintek)1189bdc79eaSJarod Wilson static int fintek_hw_detect(struct fintek_dev *fintek)
1199bdc79eaSJarod Wilson {
1209bdc79eaSJarod Wilson unsigned long flags;
1219bdc79eaSJarod Wilson u8 chip_major, chip_minor;
1229bdc79eaSJarod Wilson u8 vendor_major, vendor_minor;
1239bdc79eaSJarod Wilson u8 portsel, ir_class;
12483ec8225SMauro Carvalho Chehab u16 vendor, chip;
1259bdc79eaSJarod Wilson
1269bdc79eaSJarod Wilson fintek_config_mode_enable(fintek);
1279bdc79eaSJarod Wilson
1289bdc79eaSJarod Wilson /* Check if we're using config port 0x4e or 0x2e */
1299bdc79eaSJarod Wilson portsel = fintek_cr_read(fintek, GCR_CONFIG_PORT_SEL);
1309bdc79eaSJarod Wilson if (portsel == 0xff) {
1319bdc79eaSJarod Wilson fit_pr(KERN_INFO, "first portsel read was bunk, trying alt");
1329bdc79eaSJarod Wilson fintek_config_mode_disable(fintek);
1339bdc79eaSJarod Wilson fintek->cr_ip = CR_INDEX_PORT2;
1349bdc79eaSJarod Wilson fintek->cr_dp = CR_DATA_PORT2;
1359bdc79eaSJarod Wilson fintek_config_mode_enable(fintek);
1369bdc79eaSJarod Wilson portsel = fintek_cr_read(fintek, GCR_CONFIG_PORT_SEL);
1379bdc79eaSJarod Wilson }
1389bdc79eaSJarod Wilson fit_dbg("portsel reg: 0x%02x", portsel);
1399bdc79eaSJarod Wilson
1409bdc79eaSJarod Wilson ir_class = fintek_cir_reg_read(fintek, CIR_CR_CLASS);
1419bdc79eaSJarod Wilson fit_dbg("ir_class reg: 0x%02x", ir_class);
1429bdc79eaSJarod Wilson
1439bdc79eaSJarod Wilson switch (ir_class) {
1449bdc79eaSJarod Wilson case CLASS_RX_2TX:
1459bdc79eaSJarod Wilson case CLASS_RX_1TX:
1469bdc79eaSJarod Wilson fintek->hw_tx_capable = true;
1479bdc79eaSJarod Wilson break;
1489bdc79eaSJarod Wilson case CLASS_RX_ONLY:
1499bdc79eaSJarod Wilson default:
1509bdc79eaSJarod Wilson fintek->hw_tx_capable = false;
1519bdc79eaSJarod Wilson break;
1529bdc79eaSJarod Wilson }
1539bdc79eaSJarod Wilson
1549bdc79eaSJarod Wilson chip_major = fintek_cr_read(fintek, GCR_CHIP_ID_HI);
1559bdc79eaSJarod Wilson chip_minor = fintek_cr_read(fintek, GCR_CHIP_ID_LO);
15683ec8225SMauro Carvalho Chehab chip = chip_major << 8 | chip_minor;
1579bdc79eaSJarod Wilson
1589bdc79eaSJarod Wilson vendor_major = fintek_cr_read(fintek, GCR_VENDOR_ID_HI);
1599bdc79eaSJarod Wilson vendor_minor = fintek_cr_read(fintek, GCR_VENDOR_ID_LO);
1609bdc79eaSJarod Wilson vendor = vendor_major << 8 | vendor_minor;
1619bdc79eaSJarod Wilson
1629bdc79eaSJarod Wilson if (vendor != VENDOR_ID_FINTEK)
1639bdc79eaSJarod Wilson fit_pr(KERN_WARNING, "Unknown vendor ID: 0x%04x", vendor);
1649bdc79eaSJarod Wilson else
1659bdc79eaSJarod Wilson fit_dbg("Read Fintek vendor ID from chip");
1669bdc79eaSJarod Wilson
1679bdc79eaSJarod Wilson fintek_config_mode_disable(fintek);
1689bdc79eaSJarod Wilson
1699bdc79eaSJarod Wilson spin_lock_irqsave(&fintek->fintek_lock, flags);
1709bdc79eaSJarod Wilson fintek->chip_major = chip_major;
1719bdc79eaSJarod Wilson fintek->chip_minor = chip_minor;
1729bdc79eaSJarod Wilson fintek->chip_vendor = vendor;
17383ec8225SMauro Carvalho Chehab
17483ec8225SMauro Carvalho Chehab /*
17583ec8225SMauro Carvalho Chehab * Newer reviews of this chipset uses port 8 instead of 5
17683ec8225SMauro Carvalho Chehab */
1773e1fd478SDan Carpenter if ((chip != 0x0408) && (chip != 0x0804))
17883ec8225SMauro Carvalho Chehab fintek->logical_dev_cir = LOGICAL_DEV_CIR_REV2;
17983ec8225SMauro Carvalho Chehab else
18083ec8225SMauro Carvalho Chehab fintek->logical_dev_cir = LOGICAL_DEV_CIR_REV1;
18183ec8225SMauro Carvalho Chehab
1829bdc79eaSJarod Wilson spin_unlock_irqrestore(&fintek->fintek_lock, flags);
1839bdc79eaSJarod Wilson
1849b08f417SMauro Carvalho Chehab return 0;
1859bdc79eaSJarod Wilson }
1869bdc79eaSJarod Wilson
fintek_cir_ldev_init(struct fintek_dev * fintek)1879bdc79eaSJarod Wilson static void fintek_cir_ldev_init(struct fintek_dev *fintek)
1889bdc79eaSJarod Wilson {
1899bdc79eaSJarod Wilson /* Select CIR logical device and enable */
19083ec8225SMauro Carvalho Chehab fintek_select_logical_dev(fintek, fintek->logical_dev_cir);
1919bdc79eaSJarod Wilson fintek_cr_write(fintek, LOGICAL_DEV_ENABLE, CIR_CR_DEV_EN);
1929bdc79eaSJarod Wilson
1939bdc79eaSJarod Wilson /* Write allocated CIR address and IRQ information to hardware */
1949bdc79eaSJarod Wilson fintek_cr_write(fintek, fintek->cir_addr >> 8, CIR_CR_BASE_ADDR_HI);
1959bdc79eaSJarod Wilson fintek_cr_write(fintek, fintek->cir_addr & 0xff, CIR_CR_BASE_ADDR_LO);
1969bdc79eaSJarod Wilson
1979bdc79eaSJarod Wilson fintek_cr_write(fintek, fintek->cir_irq, CIR_CR_IRQ_SEL);
1989bdc79eaSJarod Wilson
1999bdc79eaSJarod Wilson fit_dbg("CIR initialized, base io address: 0x%lx, irq: %d (len: %d)",
2009bdc79eaSJarod Wilson fintek->cir_addr, fintek->cir_irq, fintek->cir_port_len);
2019bdc79eaSJarod Wilson }
2029bdc79eaSJarod Wilson
2039bdc79eaSJarod Wilson /* enable CIR interrupts */
fintek_enable_cir_irq(struct fintek_dev * fintek)2049bdc79eaSJarod Wilson static void fintek_enable_cir_irq(struct fintek_dev *fintek)
2059bdc79eaSJarod Wilson {
2069bdc79eaSJarod Wilson fintek_cir_reg_write(fintek, CIR_STATUS_IRQ_EN, CIR_STATUS);
2079bdc79eaSJarod Wilson }
2089bdc79eaSJarod Wilson
fintek_cir_regs_init(struct fintek_dev * fintek)2099bdc79eaSJarod Wilson static void fintek_cir_regs_init(struct fintek_dev *fintek)
2109bdc79eaSJarod Wilson {
2119bdc79eaSJarod Wilson /* clear any and all stray interrupts */
2129bdc79eaSJarod Wilson fintek_cir_reg_write(fintek, CIR_STATUS_IRQ_MASK, CIR_STATUS);
2139bdc79eaSJarod Wilson
2149bdc79eaSJarod Wilson /* and finally, enable interrupts */
2159bdc79eaSJarod Wilson fintek_enable_cir_irq(fintek);
2169bdc79eaSJarod Wilson }
2179bdc79eaSJarod Wilson
fintek_enable_wake(struct fintek_dev * fintek)2189bdc79eaSJarod Wilson static void fintek_enable_wake(struct fintek_dev *fintek)
2199bdc79eaSJarod Wilson {
2209bdc79eaSJarod Wilson fintek_config_mode_enable(fintek);
2219bdc79eaSJarod Wilson fintek_select_logical_dev(fintek, LOGICAL_DEV_ACPI);
2229bdc79eaSJarod Wilson
2239bdc79eaSJarod Wilson /* Allow CIR PME's to wake system */
2249bdc79eaSJarod Wilson fintek_set_reg_bit(fintek, ACPI_WAKE_EN_CIR_BIT, LDEV_ACPI_WAKE_EN_REG);
2259bdc79eaSJarod Wilson /* Enable CIR PME's */
2269bdc79eaSJarod Wilson fintek_set_reg_bit(fintek, ACPI_PME_CIR_BIT, LDEV_ACPI_PME_EN_REG);
2279bdc79eaSJarod Wilson /* Clear CIR PME status register */
2289bdc79eaSJarod Wilson fintek_set_reg_bit(fintek, ACPI_PME_CIR_BIT, LDEV_ACPI_PME_CLR_REG);
2299bdc79eaSJarod Wilson /* Save state */
2309bdc79eaSJarod Wilson fintek_set_reg_bit(fintek, ACPI_STATE_CIR_BIT, LDEV_ACPI_STATE_REG);
2319bdc79eaSJarod Wilson
2329bdc79eaSJarod Wilson fintek_config_mode_disable(fintek);
2339bdc79eaSJarod Wilson }
2349bdc79eaSJarod Wilson
fintek_cmdsize(u8 cmd,u8 subcmd)2359bdc79eaSJarod Wilson static int fintek_cmdsize(u8 cmd, u8 subcmd)
2369bdc79eaSJarod Wilson {
2379bdc79eaSJarod Wilson int datasize = 0;
2389bdc79eaSJarod Wilson
2399bdc79eaSJarod Wilson switch (cmd) {
2409bdc79eaSJarod Wilson case BUF_COMMAND_NULL:
2419bdc79eaSJarod Wilson if (subcmd == BUF_HW_CMD_HEADER)
2429bdc79eaSJarod Wilson datasize = 1;
2439bdc79eaSJarod Wilson break;
2449bdc79eaSJarod Wilson case BUF_HW_CMD_HEADER:
2459bdc79eaSJarod Wilson if (subcmd == BUF_CMD_G_REVISION)
2469bdc79eaSJarod Wilson datasize = 2;
2479bdc79eaSJarod Wilson break;
2489bdc79eaSJarod Wilson case BUF_COMMAND_HEADER:
2499bdc79eaSJarod Wilson switch (subcmd) {
2509bdc79eaSJarod Wilson case BUF_CMD_S_CARRIER:
2519bdc79eaSJarod Wilson case BUF_CMD_S_TIMEOUT:
2529bdc79eaSJarod Wilson case BUF_RSP_PULSE_COUNT:
2539bdc79eaSJarod Wilson datasize = 2;
2549bdc79eaSJarod Wilson break;
2559bdc79eaSJarod Wilson case BUF_CMD_SIG_END:
2569bdc79eaSJarod Wilson case BUF_CMD_S_TXMASK:
2579bdc79eaSJarod Wilson case BUF_CMD_S_RXSENSOR:
2589bdc79eaSJarod Wilson datasize = 1;
2599bdc79eaSJarod Wilson break;
2609bdc79eaSJarod Wilson }
2619bdc79eaSJarod Wilson }
2629bdc79eaSJarod Wilson
2639bdc79eaSJarod Wilson return datasize;
2649bdc79eaSJarod Wilson }
2659bdc79eaSJarod Wilson
2669bdc79eaSJarod Wilson /* process ir data stored in driver buffer */
fintek_process_rx_ir_data(struct fintek_dev * fintek)2679bdc79eaSJarod Wilson static void fintek_process_rx_ir_data(struct fintek_dev *fintek)
2689bdc79eaSJarod Wilson {
269183e19f5SSean Young struct ir_raw_event rawir = {};
2709bdc79eaSJarod Wilson u8 sample;
271b83bfd1bSSean Young bool event = false;
2729bdc79eaSJarod Wilson int i;
2739bdc79eaSJarod Wilson
2749bdc79eaSJarod Wilson for (i = 0; i < fintek->pkts; i++) {
2759bdc79eaSJarod Wilson sample = fintek->buf[i];
2769bdc79eaSJarod Wilson switch (fintek->parser_state) {
2779bdc79eaSJarod Wilson case CMD_HEADER:
2789bdc79eaSJarod Wilson fintek->cmd = sample;
2799bdc79eaSJarod Wilson if ((fintek->cmd == BUF_COMMAND_HEADER) ||
2809bdc79eaSJarod Wilson ((fintek->cmd & BUF_COMMAND_MASK) !=
2819bdc79eaSJarod Wilson BUF_PULSE_BIT)) {
2829bdc79eaSJarod Wilson fintek->parser_state = SUBCMD;
2839bdc79eaSJarod Wilson continue;
2849bdc79eaSJarod Wilson }
2859bdc79eaSJarod Wilson fintek->rem = (fintek->cmd & BUF_LEN_MASK);
2869bdc79eaSJarod Wilson fit_dbg("%s: rem: 0x%02x", __func__, fintek->rem);
2879bdc79eaSJarod Wilson if (fintek->rem)
2889bdc79eaSJarod Wilson fintek->parser_state = PARSE_IRDATA;
2899bdc79eaSJarod Wilson else
290*950170d6SSean Young ir_raw_event_overflow(fintek->rdev);
2919bdc79eaSJarod Wilson break;
2929bdc79eaSJarod Wilson case SUBCMD:
2939bdc79eaSJarod Wilson fintek->rem = fintek_cmdsize(fintek->cmd, sample);
2949bdc79eaSJarod Wilson fintek->parser_state = CMD_DATA;
2959bdc79eaSJarod Wilson break;
2969bdc79eaSJarod Wilson case CMD_DATA:
2979bdc79eaSJarod Wilson fintek->rem--;
2989bdc79eaSJarod Wilson break;
2999bdc79eaSJarod Wilson case PARSE_IRDATA:
3009bdc79eaSJarod Wilson fintek->rem--;
3019bdc79eaSJarod Wilson rawir.pulse = ((sample & BUF_PULSE_BIT) != 0);
302528222d8SSean Young rawir.duration = (sample & BUF_SAMPLE_MASK)
303528222d8SSean Young * CIR_SAMPLE_PERIOD;
3049bdc79eaSJarod Wilson
3059bdc79eaSJarod Wilson fit_dbg("Storing %s with duration %d",
3069bdc79eaSJarod Wilson rawir.pulse ? "pulse" : "space",
3079bdc79eaSJarod Wilson rawir.duration);
308b83bfd1bSSean Young if (ir_raw_event_store_with_filter(fintek->rdev,
309b83bfd1bSSean Young &rawir))
310b83bfd1bSSean Young event = true;
3119bdc79eaSJarod Wilson break;
3129bdc79eaSJarod Wilson }
3139bdc79eaSJarod Wilson
3149bdc79eaSJarod Wilson if ((fintek->parser_state != CMD_HEADER) && !fintek->rem)
3159bdc79eaSJarod Wilson fintek->parser_state = CMD_HEADER;
3169bdc79eaSJarod Wilson }
3179bdc79eaSJarod Wilson
3189bdc79eaSJarod Wilson fintek->pkts = 0;
3199bdc79eaSJarod Wilson
320b83bfd1bSSean Young if (event) {
3219bdc79eaSJarod Wilson fit_dbg("Calling ir_raw_event_handle");
3229bdc79eaSJarod Wilson ir_raw_event_handle(fintek->rdev);
3239bdc79eaSJarod Wilson }
324b83bfd1bSSean Young }
3259bdc79eaSJarod Wilson
3269bdc79eaSJarod Wilson /* copy data from hardware rx register into driver buffer */
fintek_get_rx_ir_data(struct fintek_dev * fintek,u8 rx_irqs)3279bdc79eaSJarod Wilson static void fintek_get_rx_ir_data(struct fintek_dev *fintek, u8 rx_irqs)
3289bdc79eaSJarod Wilson {
3299bdc79eaSJarod Wilson unsigned long flags;
3309bdc79eaSJarod Wilson u8 sample, status;
3319bdc79eaSJarod Wilson
3329bdc79eaSJarod Wilson spin_lock_irqsave(&fintek->fintek_lock, flags);
3339bdc79eaSJarod Wilson
3349bdc79eaSJarod Wilson /*
3359bdc79eaSJarod Wilson * We must read data from CIR_RX_DATA until the hardware IR buffer
3369bdc79eaSJarod Wilson * is empty and clears the RX_TIMEOUT and/or RX_RECEIVE flags in
3379bdc79eaSJarod Wilson * the CIR_STATUS register
3389bdc79eaSJarod Wilson */
3399bdc79eaSJarod Wilson do {
3409bdc79eaSJarod Wilson sample = fintek_cir_reg_read(fintek, CIR_RX_DATA);
3419bdc79eaSJarod Wilson fit_dbg("%s: sample: 0x%02x", __func__, sample);
3429bdc79eaSJarod Wilson
3439bdc79eaSJarod Wilson fintek->buf[fintek->pkts] = sample;
3449bdc79eaSJarod Wilson fintek->pkts++;
3459bdc79eaSJarod Wilson
3469bdc79eaSJarod Wilson status = fintek_cir_reg_read(fintek, CIR_STATUS);
3479bdc79eaSJarod Wilson if (!(status & CIR_STATUS_IRQ_EN))
3489bdc79eaSJarod Wilson break;
3499bdc79eaSJarod Wilson } while (status & rx_irqs);
3509bdc79eaSJarod Wilson
3519bdc79eaSJarod Wilson fintek_process_rx_ir_data(fintek);
3529bdc79eaSJarod Wilson
3539bdc79eaSJarod Wilson spin_unlock_irqrestore(&fintek->fintek_lock, flags);
3549bdc79eaSJarod Wilson }
3559bdc79eaSJarod Wilson
fintek_cir_log_irqs(u8 status)3569bdc79eaSJarod Wilson static void fintek_cir_log_irqs(u8 status)
3579bdc79eaSJarod Wilson {
3589bdc79eaSJarod Wilson fit_pr(KERN_INFO, "IRQ 0x%02x:%s%s%s%s%s", status,
3599bdc79eaSJarod Wilson status & CIR_STATUS_IRQ_EN ? " IRQEN" : "",
3609bdc79eaSJarod Wilson status & CIR_STATUS_TX_FINISH ? " TXF" : "",
3619bdc79eaSJarod Wilson status & CIR_STATUS_TX_UNDERRUN ? " TXU" : "",
3629bdc79eaSJarod Wilson status & CIR_STATUS_RX_TIMEOUT ? " RXTO" : "",
3639bdc79eaSJarod Wilson status & CIR_STATUS_RX_RECEIVE ? " RXOK" : "");
3649bdc79eaSJarod Wilson }
3659bdc79eaSJarod Wilson
3669bdc79eaSJarod Wilson /* interrupt service routine for incoming and outgoing CIR data */
fintek_cir_isr(int irq,void * data)3679bdc79eaSJarod Wilson static irqreturn_t fintek_cir_isr(int irq, void *data)
3689bdc79eaSJarod Wilson {
3699bdc79eaSJarod Wilson struct fintek_dev *fintek = data;
3709bdc79eaSJarod Wilson u8 status, rx_irqs;
3719bdc79eaSJarod Wilson
3729bdc79eaSJarod Wilson fit_dbg_verbose("%s firing", __func__);
3739bdc79eaSJarod Wilson
3749bdc79eaSJarod Wilson fintek_config_mode_enable(fintek);
37583ec8225SMauro Carvalho Chehab fintek_select_logical_dev(fintek, fintek->logical_dev_cir);
3769bdc79eaSJarod Wilson fintek_config_mode_disable(fintek);
3779bdc79eaSJarod Wilson
3789bdc79eaSJarod Wilson /*
3799bdc79eaSJarod Wilson * Get IR Status register contents. Write 1 to ack/clear
3809bdc79eaSJarod Wilson *
3819bdc79eaSJarod Wilson * bit: reg name - description
3829bdc79eaSJarod Wilson * 3: TX_FINISH - TX is finished
3839bdc79eaSJarod Wilson * 2: TX_UNDERRUN - TX underrun
3849bdc79eaSJarod Wilson * 1: RX_TIMEOUT - RX data timeout
3859bdc79eaSJarod Wilson * 0: RX_RECEIVE - RX data received
3869bdc79eaSJarod Wilson */
3879bdc79eaSJarod Wilson status = fintek_cir_reg_read(fintek, CIR_STATUS);
3889bdc79eaSJarod Wilson if (!(status & CIR_STATUS_IRQ_MASK) || status == 0xff) {
3899bdc79eaSJarod Wilson fit_dbg_verbose("%s exiting, IRSTS 0x%02x", __func__, status);
3909bdc79eaSJarod Wilson fintek_cir_reg_write(fintek, CIR_STATUS_IRQ_MASK, CIR_STATUS);
3919bdc79eaSJarod Wilson return IRQ_RETVAL(IRQ_NONE);
3929bdc79eaSJarod Wilson }
3939bdc79eaSJarod Wilson
3949bdc79eaSJarod Wilson if (debug)
3959bdc79eaSJarod Wilson fintek_cir_log_irqs(status);
3969bdc79eaSJarod Wilson
3979bdc79eaSJarod Wilson rx_irqs = status & (CIR_STATUS_RX_RECEIVE | CIR_STATUS_RX_TIMEOUT);
3989bdc79eaSJarod Wilson if (rx_irqs)
3999bdc79eaSJarod Wilson fintek_get_rx_ir_data(fintek, rx_irqs);
4009bdc79eaSJarod Wilson
4019bdc79eaSJarod Wilson /* ack/clear all irq flags we've got */
4029bdc79eaSJarod Wilson fintek_cir_reg_write(fintek, status, CIR_STATUS);
4039bdc79eaSJarod Wilson
4049bdc79eaSJarod Wilson fit_dbg_verbose("%s done", __func__);
4059bdc79eaSJarod Wilson return IRQ_RETVAL(IRQ_HANDLED);
4069bdc79eaSJarod Wilson }
4079bdc79eaSJarod Wilson
fintek_enable_cir(struct fintek_dev * fintek)4089bdc79eaSJarod Wilson static void fintek_enable_cir(struct fintek_dev *fintek)
4099bdc79eaSJarod Wilson {
4109bdc79eaSJarod Wilson /* set IRQ enabled */
4119bdc79eaSJarod Wilson fintek_cir_reg_write(fintek, CIR_STATUS_IRQ_EN, CIR_STATUS);
4129bdc79eaSJarod Wilson
4139bdc79eaSJarod Wilson fintek_config_mode_enable(fintek);
4149bdc79eaSJarod Wilson
4159bdc79eaSJarod Wilson /* enable the CIR logical device */
41683ec8225SMauro Carvalho Chehab fintek_select_logical_dev(fintek, fintek->logical_dev_cir);
4179bdc79eaSJarod Wilson fintek_cr_write(fintek, LOGICAL_DEV_ENABLE, CIR_CR_DEV_EN);
4189bdc79eaSJarod Wilson
4199bdc79eaSJarod Wilson fintek_config_mode_disable(fintek);
4209bdc79eaSJarod Wilson
4219bdc79eaSJarod Wilson /* clear all pending interrupts */
4229bdc79eaSJarod Wilson fintek_cir_reg_write(fintek, CIR_STATUS_IRQ_MASK, CIR_STATUS);
4239bdc79eaSJarod Wilson
4249bdc79eaSJarod Wilson /* enable interrupts */
4259bdc79eaSJarod Wilson fintek_enable_cir_irq(fintek);
4269bdc79eaSJarod Wilson }
4279bdc79eaSJarod Wilson
fintek_disable_cir(struct fintek_dev * fintek)4289bdc79eaSJarod Wilson static void fintek_disable_cir(struct fintek_dev *fintek)
4299bdc79eaSJarod Wilson {
4309bdc79eaSJarod Wilson fintek_config_mode_enable(fintek);
4319bdc79eaSJarod Wilson
4329bdc79eaSJarod Wilson /* disable the CIR logical device */
43383ec8225SMauro Carvalho Chehab fintek_select_logical_dev(fintek, fintek->logical_dev_cir);
4349bdc79eaSJarod Wilson fintek_cr_write(fintek, LOGICAL_DEV_DISABLE, CIR_CR_DEV_EN);
4359bdc79eaSJarod Wilson
4369bdc79eaSJarod Wilson fintek_config_mode_disable(fintek);
4379bdc79eaSJarod Wilson }
4389bdc79eaSJarod Wilson
fintek_open(struct rc_dev * dev)4399bdc79eaSJarod Wilson static int fintek_open(struct rc_dev *dev)
4409bdc79eaSJarod Wilson {
4419bdc79eaSJarod Wilson struct fintek_dev *fintek = dev->priv;
4429bdc79eaSJarod Wilson unsigned long flags;
4439bdc79eaSJarod Wilson
4449bdc79eaSJarod Wilson spin_lock_irqsave(&fintek->fintek_lock, flags);
4459bdc79eaSJarod Wilson fintek_enable_cir(fintek);
4469bdc79eaSJarod Wilson spin_unlock_irqrestore(&fintek->fintek_lock, flags);
4479bdc79eaSJarod Wilson
4489bdc79eaSJarod Wilson return 0;
4499bdc79eaSJarod Wilson }
4509bdc79eaSJarod Wilson
fintek_close(struct rc_dev * dev)4519bdc79eaSJarod Wilson static void fintek_close(struct rc_dev *dev)
4529bdc79eaSJarod Wilson {
4539bdc79eaSJarod Wilson struct fintek_dev *fintek = dev->priv;
4549bdc79eaSJarod Wilson unsigned long flags;
4559bdc79eaSJarod Wilson
4569bdc79eaSJarod Wilson spin_lock_irqsave(&fintek->fintek_lock, flags);
4579bdc79eaSJarod Wilson fintek_disable_cir(fintek);
4589bdc79eaSJarod Wilson spin_unlock_irqrestore(&fintek->fintek_lock, flags);
4599bdc79eaSJarod Wilson }
4609bdc79eaSJarod Wilson
4619bdc79eaSJarod Wilson /* Allocate memory, probe hardware, and initialize everything */
fintek_probe(struct pnp_dev * pdev,const struct pnp_device_id * dev_id)4629bdc79eaSJarod Wilson static int fintek_probe(struct pnp_dev *pdev, const struct pnp_device_id *dev_id)
4639bdc79eaSJarod Wilson {
4649bdc79eaSJarod Wilson struct fintek_dev *fintek;
4659bdc79eaSJarod Wilson struct rc_dev *rdev;
4669bdc79eaSJarod Wilson int ret = -ENOMEM;
4679bdc79eaSJarod Wilson
4689bdc79eaSJarod Wilson fintek = kzalloc(sizeof(struct fintek_dev), GFP_KERNEL);
4699bdc79eaSJarod Wilson if (!fintek)
4709bdc79eaSJarod Wilson return ret;
4719bdc79eaSJarod Wilson
4729bdc79eaSJarod Wilson /* input device for IR remote (and tx) */
4730f7499fdSAndi Shyti rdev = rc_allocate_device(RC_DRIVER_IR_RAW);
4749bdc79eaSJarod Wilson if (!rdev)
47570ef6991SMatthijs Kooijman goto exit_free_dev_rdev;
4769bdc79eaSJarod Wilson
4779bdc79eaSJarod Wilson ret = -ENODEV;
4789bdc79eaSJarod Wilson /* validate pnp resources */
4799bdc79eaSJarod Wilson if (!pnp_port_valid(pdev, 0)) {
4809bdc79eaSJarod Wilson dev_err(&pdev->dev, "IR PNP Port not valid!\n");
48170ef6991SMatthijs Kooijman goto exit_free_dev_rdev;
4829bdc79eaSJarod Wilson }
4839bdc79eaSJarod Wilson
4849bdc79eaSJarod Wilson if (!pnp_irq_valid(pdev, 0)) {
4859bdc79eaSJarod Wilson dev_err(&pdev->dev, "IR PNP IRQ not valid!\n");
48670ef6991SMatthijs Kooijman goto exit_free_dev_rdev;
4879bdc79eaSJarod Wilson }
4889bdc79eaSJarod Wilson
4899bdc79eaSJarod Wilson fintek->cir_addr = pnp_port_start(pdev, 0);
4909bdc79eaSJarod Wilson fintek->cir_irq = pnp_irq(pdev, 0);
4919bdc79eaSJarod Wilson fintek->cir_port_len = pnp_port_len(pdev, 0);
4929bdc79eaSJarod Wilson
4939bdc79eaSJarod Wilson fintek->cr_ip = CR_INDEX_PORT;
4949bdc79eaSJarod Wilson fintek->cr_dp = CR_DATA_PORT;
4959bdc79eaSJarod Wilson
4969bdc79eaSJarod Wilson spin_lock_init(&fintek->fintek_lock);
4979bdc79eaSJarod Wilson
4989bdc79eaSJarod Wilson pnp_set_drvdata(pdev, fintek);
4999bdc79eaSJarod Wilson fintek->pdev = pdev;
5009bdc79eaSJarod Wilson
5019bdc79eaSJarod Wilson ret = fintek_hw_detect(fintek);
5029bdc79eaSJarod Wilson if (ret)
50370ef6991SMatthijs Kooijman goto exit_free_dev_rdev;
5049bdc79eaSJarod Wilson
5059bdc79eaSJarod Wilson /* Initialize CIR & CIR Wake Logical Devices */
5069bdc79eaSJarod Wilson fintek_config_mode_enable(fintek);
5079bdc79eaSJarod Wilson fintek_cir_ldev_init(fintek);
5089bdc79eaSJarod Wilson fintek_config_mode_disable(fintek);
5099bdc79eaSJarod Wilson
5109bdc79eaSJarod Wilson /* Initialize CIR & CIR Wake Config Registers */
5119bdc79eaSJarod Wilson fintek_cir_regs_init(fintek);
5129bdc79eaSJarod Wilson
5139bdc79eaSJarod Wilson /* Set up the rc device */
5149bdc79eaSJarod Wilson rdev->priv = fintek;
5156d741bfeSSean Young rdev->allowed_protocols = RC_PROTO_BIT_ALL_IR_DECODER;
5169bdc79eaSJarod Wilson rdev->open = fintek_open;
5179bdc79eaSJarod Wilson rdev->close = fintek_close;
518518f4b26SSean Young rdev->device_name = FINTEK_DESCRIPTION;
5199bdc79eaSJarod Wilson rdev->input_phys = "fintek/cir0";
5209bdc79eaSJarod Wilson rdev->input_id.bustype = BUS_HOST;
5219bdc79eaSJarod Wilson rdev->input_id.vendor = VENDOR_ID_FINTEK;
5229bdc79eaSJarod Wilson rdev->input_id.product = fintek->chip_major;
5239bdc79eaSJarod Wilson rdev->input_id.version = fintek->chip_minor;
5249bdc79eaSJarod Wilson rdev->dev.parent = &pdev->dev;
5259bdc79eaSJarod Wilson rdev->driver_name = FINTEK_DRIVER_NAME;
5269bdc79eaSJarod Wilson rdev->map_name = RC_MAP_RC6_MCE;
527528222d8SSean Young rdev->timeout = 1000;
5289bdc79eaSJarod Wilson /* rx resolution is hardwired to 50us atm, 1, 25, 100 also possible */
529528222d8SSean Young rdev->rx_resolution = CIR_SAMPLE_PERIOD;
5309bdc79eaSJarod Wilson
531d62b6818SMatthijs Kooijman fintek->rdev = rdev;
532d62b6818SMatthijs Kooijman
5339ef449c6SLuis Henriques ret = -EBUSY;
5349ef449c6SLuis Henriques /* now claim resources */
5359ef449c6SLuis Henriques if (!request_region(fintek->cir_addr,
5369ef449c6SLuis Henriques fintek->cir_port_len, FINTEK_DRIVER_NAME))
53770ef6991SMatthijs Kooijman goto exit_free_dev_rdev;
5389ef449c6SLuis Henriques
5399ef449c6SLuis Henriques if (request_irq(fintek->cir_irq, fintek_cir_isr, IRQF_SHARED,
5409ef449c6SLuis Henriques FINTEK_DRIVER_NAME, (void *)fintek))
54170ef6991SMatthijs Kooijman goto exit_free_cir_addr;
5429ef449c6SLuis Henriques
5439bdc79eaSJarod Wilson ret = rc_register_device(rdev);
5449bdc79eaSJarod Wilson if (ret)
54570ef6991SMatthijs Kooijman goto exit_free_irq;
5469bdc79eaSJarod Wilson
5479bdc79eaSJarod Wilson device_init_wakeup(&pdev->dev, true);
548d62b6818SMatthijs Kooijman
5499bdc79eaSJarod Wilson fit_pr(KERN_NOTICE, "driver has been successfully loaded\n");
5509bdc79eaSJarod Wilson if (debug)
5519bdc79eaSJarod Wilson cir_dump_regs(fintek);
5529bdc79eaSJarod Wilson
5539bdc79eaSJarod Wilson return 0;
5549bdc79eaSJarod Wilson
55570ef6991SMatthijs Kooijman exit_free_irq:
5569bdc79eaSJarod Wilson free_irq(fintek->cir_irq, fintek);
55770ef6991SMatthijs Kooijman exit_free_cir_addr:
5589bdc79eaSJarod Wilson release_region(fintek->cir_addr, fintek->cir_port_len);
55970ef6991SMatthijs Kooijman exit_free_dev_rdev:
5609bdc79eaSJarod Wilson rc_free_device(rdev);
5619bdc79eaSJarod Wilson kfree(fintek);
5629bdc79eaSJarod Wilson
5639bdc79eaSJarod Wilson return ret;
5649bdc79eaSJarod Wilson }
5659bdc79eaSJarod Wilson
fintek_remove(struct pnp_dev * pdev)5664c62e976SGreg Kroah-Hartman static void fintek_remove(struct pnp_dev *pdev)
5679bdc79eaSJarod Wilson {
5689bdc79eaSJarod Wilson struct fintek_dev *fintek = pnp_get_drvdata(pdev);
5699bdc79eaSJarod Wilson unsigned long flags;
5709bdc79eaSJarod Wilson
5719bdc79eaSJarod Wilson spin_lock_irqsave(&fintek->fintek_lock, flags);
5729bdc79eaSJarod Wilson /* disable CIR */
5739bdc79eaSJarod Wilson fintek_disable_cir(fintek);
5749bdc79eaSJarod Wilson fintek_cir_reg_write(fintek, CIR_STATUS_IRQ_MASK, CIR_STATUS);
5759bdc79eaSJarod Wilson /* enable CIR Wake (for IR power-on) */
5769bdc79eaSJarod Wilson fintek_enable_wake(fintek);
5779bdc79eaSJarod Wilson spin_unlock_irqrestore(&fintek->fintek_lock, flags);
5789bdc79eaSJarod Wilson
5799bdc79eaSJarod Wilson /* free resources */
5809bdc79eaSJarod Wilson free_irq(fintek->cir_irq, fintek);
5819bdc79eaSJarod Wilson release_region(fintek->cir_addr, fintek->cir_port_len);
5829bdc79eaSJarod Wilson
5839bdc79eaSJarod Wilson rc_unregister_device(fintek->rdev);
5849bdc79eaSJarod Wilson
5859bdc79eaSJarod Wilson kfree(fintek);
5869bdc79eaSJarod Wilson }
5879bdc79eaSJarod Wilson
fintek_suspend(struct pnp_dev * pdev,pm_message_t state)5889bdc79eaSJarod Wilson static int fintek_suspend(struct pnp_dev *pdev, pm_message_t state)
5899bdc79eaSJarod Wilson {
5909bdc79eaSJarod Wilson struct fintek_dev *fintek = pnp_get_drvdata(pdev);
5910ae90252SJarod Wilson unsigned long flags;
5929bdc79eaSJarod Wilson
5939bdc79eaSJarod Wilson fit_dbg("%s called", __func__);
5949bdc79eaSJarod Wilson
5950ae90252SJarod Wilson spin_lock_irqsave(&fintek->fintek_lock, flags);
5960ae90252SJarod Wilson
5979bdc79eaSJarod Wilson /* disable all CIR interrupts */
5989bdc79eaSJarod Wilson fintek_cir_reg_write(fintek, CIR_STATUS_IRQ_MASK, CIR_STATUS);
5999bdc79eaSJarod Wilson
6000ae90252SJarod Wilson spin_unlock_irqrestore(&fintek->fintek_lock, flags);
6010ae90252SJarod Wilson
6029bdc79eaSJarod Wilson fintek_config_mode_enable(fintek);
6039bdc79eaSJarod Wilson
6049bdc79eaSJarod Wilson /* disable cir logical dev */
60583ec8225SMauro Carvalho Chehab fintek_select_logical_dev(fintek, fintek->logical_dev_cir);
6069bdc79eaSJarod Wilson fintek_cr_write(fintek, LOGICAL_DEV_DISABLE, CIR_CR_DEV_EN);
6079bdc79eaSJarod Wilson
6089bdc79eaSJarod Wilson fintek_config_mode_disable(fintek);
6099bdc79eaSJarod Wilson
6109bdc79eaSJarod Wilson /* make sure wake is enabled */
6119bdc79eaSJarod Wilson fintek_enable_wake(fintek);
6129bdc79eaSJarod Wilson
6139bdc79eaSJarod Wilson return 0;
6149bdc79eaSJarod Wilson }
6159bdc79eaSJarod Wilson
fintek_resume(struct pnp_dev * pdev)6169bdc79eaSJarod Wilson static int fintek_resume(struct pnp_dev *pdev)
6179bdc79eaSJarod Wilson {
6189bdc79eaSJarod Wilson struct fintek_dev *fintek = pnp_get_drvdata(pdev);
6199bdc79eaSJarod Wilson
6209bdc79eaSJarod Wilson fit_dbg("%s called", __func__);
6219bdc79eaSJarod Wilson
6229bdc79eaSJarod Wilson /* open interrupt */
6239bdc79eaSJarod Wilson fintek_enable_cir_irq(fintek);
6249bdc79eaSJarod Wilson
6259bdc79eaSJarod Wilson /* Enable CIR logical device */
6269bdc79eaSJarod Wilson fintek_config_mode_enable(fintek);
62783ec8225SMauro Carvalho Chehab fintek_select_logical_dev(fintek, fintek->logical_dev_cir);
6289bdc79eaSJarod Wilson fintek_cr_write(fintek, LOGICAL_DEV_ENABLE, CIR_CR_DEV_EN);
6299bdc79eaSJarod Wilson
6309bdc79eaSJarod Wilson fintek_config_mode_disable(fintek);
6319bdc79eaSJarod Wilson
6329bdc79eaSJarod Wilson fintek_cir_regs_init(fintek);
6339bdc79eaSJarod Wilson
6349b08f417SMauro Carvalho Chehab return 0;
6359bdc79eaSJarod Wilson }
6369bdc79eaSJarod Wilson
fintek_shutdown(struct pnp_dev * pdev)6379bdc79eaSJarod Wilson static void fintek_shutdown(struct pnp_dev *pdev)
6389bdc79eaSJarod Wilson {
6399bdc79eaSJarod Wilson struct fintek_dev *fintek = pnp_get_drvdata(pdev);
6409bdc79eaSJarod Wilson fintek_enable_wake(fintek);
6419bdc79eaSJarod Wilson }
6429bdc79eaSJarod Wilson
6439bdc79eaSJarod Wilson static const struct pnp_device_id fintek_ids[] = {
6449bdc79eaSJarod Wilson { "FIT0002", 0 }, /* CIR */
6459bdc79eaSJarod Wilson { "", 0 },
6469bdc79eaSJarod Wilson };
6479bdc79eaSJarod Wilson
6489bdc79eaSJarod Wilson static struct pnp_driver fintek_driver = {
6499bdc79eaSJarod Wilson .name = FINTEK_DRIVER_NAME,
6509bdc79eaSJarod Wilson .id_table = fintek_ids,
6519bdc79eaSJarod Wilson .flags = PNP_DRIVER_RES_DO_NOT_CHANGE,
6529bdc79eaSJarod Wilson .probe = fintek_probe,
6534c62e976SGreg Kroah-Hartman .remove = fintek_remove,
6549bdc79eaSJarod Wilson .suspend = fintek_suspend,
6559bdc79eaSJarod Wilson .resume = fintek_resume,
6569bdc79eaSJarod Wilson .shutdown = fintek_shutdown,
6579bdc79eaSJarod Wilson };
6589bdc79eaSJarod Wilson
6599bdc79eaSJarod Wilson module_param(debug, int, S_IRUGO | S_IWUSR);
6609bdc79eaSJarod Wilson MODULE_PARM_DESC(debug, "Enable debugging output");
6619bdc79eaSJarod Wilson
6629bdc79eaSJarod Wilson MODULE_DEVICE_TABLE(pnp, fintek_ids);
6639bdc79eaSJarod Wilson MODULE_DESCRIPTION(FINTEK_DESCRIPTION " driver");
6649bdc79eaSJarod Wilson
6659bdc79eaSJarod Wilson MODULE_AUTHOR("Jarod Wilson <jarod@redhat.com>");
6669bdc79eaSJarod Wilson MODULE_LICENSE("GPL");
6679bdc79eaSJarod Wilson
668af638a04SPeter Huewe module_pnp_driver(fintek_driver);
669