diff options
Diffstat (limited to 'drivers/media/rc')
31 files changed, 318 insertions, 298 deletions
diff --git a/drivers/media/rc/Kconfig b/drivers/media/rc/Kconfig index c111af820ae4..f560fc38895f 100644 --- a/drivers/media/rc/Kconfig +++ b/drivers/media/rc/Kconfig @@ -15,15 +15,6 @@ menuconfig RC_CORE Say Y when you have a TV or an IR device. if RC_CORE -source "drivers/media/rc/keymaps/Kconfig" - -config LIRC - bool "LIRC user interface" - help - Enable this option to enable the Linux Infrared Remote - Control user interface (e.g. /dev/lirc*). This interface - passes raw IR to and from userspace, which is needed for - IR transmitting (aka "blasting") and for the lirc daemon. config BPF_LIRC_MODE2 bool "Support for eBPF programs attached to lirc devices" @@ -38,10 +29,45 @@ config BPF_LIRC_MODE2 These eBPF programs can be used to decode IR into scancodes, for IR protocols not supported by the kernel decoders. +config LIRC + bool "LIRC user interface" + help + Enable this option to enable the Linux Infrared Remote + Control user interface (e.g. /dev/lirc*). This interface + passes raw IR to and from userspace, which is needed for + IR transmitting (aka "blasting") and for the lirc daemon. + +source "drivers/media/rc/keymaps/Kconfig" + menuconfig RC_DECODERS bool "Remote controller decoders" if RC_DECODERS + +config IR_IMON_DECODER + tristate "Enable IR raw decoder for the iMON protocol" + help + Enable this option if you have iMON PAD or Antec Veris infrared + remote control and you would like to use it with a raw IR + receiver, or if you wish to use an encoder to transmit this IR. + +config IR_JVC_DECODER + tristate "Enable IR raw decoder for the JVC protocol" + select BITREVERSE + + help + Enable this option if you have an infrared remote control which + uses the JVC protocol, and you need software decoding support. + +config IR_MCE_KBD_DECODER + tristate "Enable IR raw decoder for the MCE keyboard/mouse protocol" + select BITREVERSE + + help + Enable this option if you have a Microsoft Remote Keyboard for + Windows Media Center Edition, which you would like to use with + a raw IR receiver in your system. + config IR_NEC_DECODER tristate "Enable IR raw decoder for the NEC protocol" select BITREVERSE @@ -66,21 +92,17 @@ config IR_RC6_DECODER Enable this option if you have an infrared remote control which uses the RC6 protocol, and you need software decoding support. -config IR_JVC_DECODER - tristate "Enable IR raw decoder for the JVC protocol" - select BITREVERSE - +config IR_RCMM_DECODER + tristate "Enable IR raw decoder for the RC-MM protocol" help - Enable this option if you have an infrared remote control which - uses the JVC protocol, and you need software decoding support. - -config IR_SONY_DECODER - tristate "Enable IR raw decoder for the Sony protocol" - select BITREVERSE + Enable this option when you have IR with RC-MM protocol, and + you need the software decoder. The driver supports 12, + 24 and 32 bits RC-MM variants. You can enable or disable the + different modes using the following RC protocol keywords: + 'rc-mm-12', 'rc-mm-24' and 'rc-mm-32'. - help - Enable this option if you have an infrared remote control which - uses the Sony protocol, and you need software decoding support. + To compile this driver as a module, choose M here: the module + will be called ir-rcmm-decoder. config IR_SANYO_DECODER tristate "Enable IR raw decoder for the Sanyo protocol" @@ -100,14 +122,13 @@ config IR_SHARP_DECODER uses the Sharp protocol (Sharp, Denon), and you need software decoding support. -config IR_MCE_KBD_DECODER - tristate "Enable IR raw decoder for the MCE keyboard/mouse protocol" +config IR_SONY_DECODER + tristate "Enable IR raw decoder for the Sony protocol" select BITREVERSE help - Enable this option if you have a Microsoft Remote Keyboard for - Windows Media Center Edition, which you would like to use with - a raw IR receiver in your system. + Enable this option if you have an infrared remote control which + uses the Sony protocol, and you need software decoding support. config IR_XMP_DECODER tristate "Enable IR raw decoder for the XMP protocol" @@ -117,25 +138,6 @@ config IR_XMP_DECODER Enable this option if you have IR with XMP protocol, and if the IR is decoded in software -config IR_IMON_DECODER - tristate "Enable IR raw decoder for the iMON protocol" - help - Enable this option if you have iMON PAD or Antec Veris infrared - remote control and you would like to use it with a raw IR - receiver, or if you wish to use an encoder to transmit this IR. - -config IR_RCMM_DECODER - tristate "Enable IR raw decoder for the RC-MM protocol" - help - Enable this option when you have IR with RC-MM protocol, and - you need the software decoder. The driver supports 12, - 24 and 32 bits RC-MM variants. You can enable or disable the - different modes using the following RC protocol keywords: - 'rc-mm-12', 'rc-mm-24' and 'rc-mm-32'. - - To compile this driver as a module, choose M here: the module - will be called ir-rcmm-decoder. - endif #RC_DECODERS menuconfig RC_DEVICES @@ -143,23 +145,6 @@ menuconfig RC_DEVICES if RC_DEVICES -config RC_ATI_REMOTE - tristate "ATI / X10 based USB RF remote controls" - depends on USB - help - Say Y here if you want to use an X10 based USB remote control. - These are RF remotes with USB receivers. - - Such devices include the ATI remote that comes with many of ATI's - All-In-Wonder video cards, the X10 "Lola" remote, NVIDIA RF remote, - Medion RF remote, and SnapStream FireFly remote. - - This driver provides mouse pointer, left and right mouse buttons, - and maps all the other remote buttons to keypress events. - - To compile this driver as a module, choose M here: the module will be - called ati_remote. - config IR_ENE tristate "ENE eHome Receiver/Transceiver (pnp id: ENE0100/ENE02xxx)" depends on PNP || COMPILE_TEST @@ -173,6 +158,37 @@ config IR_ENE To compile this driver as a module, choose M here: the module will be called ene_ir. +config IR_FINTEK + tristate "Fintek Consumer Infrared Transceiver" + depends on PNP || COMPILE_TEST + help + Say Y here to enable support for integrated infrared receiver + /transceiver made by Fintek. This chip is found on assorted + Jetway motherboards (and of course, possibly others). + + To compile this driver as a module, choose M here: the + module will be called fintek-cir. + +config IR_GPIO_CIR + tristate "GPIO IR remote control" + depends on (OF && GPIOLIB) || COMPILE_TEST + help + Say Y if you want to use GPIO based IR Receiver. + + To compile this driver as a module, choose M here: the module will + be called gpio-ir-recv. + +config IR_GPIO_TX + tristate "GPIO IR Bit Banging Transmitter" + depends on LIRC + depends on (OF && GPIOLIB) || COMPILE_TEST + help + Say Y if you want to a GPIO based IR transmitter. This is a + bit banging driver. + + To compile this driver as a module, choose M here: the module will + be called gpio-ir-tx. + config IR_HIX5HD2 tristate "Hisilicon hix5hd2 IR remote control" depends on (OF && HAS_IOMEM) || COMPILE_TEST @@ -183,6 +199,33 @@ config IR_HIX5HD2 If you're not sure, select N here +config IR_IGORPLUGUSB + tristate "IgorPlug-USB IR Receiver" + depends on USB + help + Say Y here if you want to use the IgorPlug-USB IR Receiver by + Igor Cesko. This device is included on the Fit-PC2. + + Note that this device can only record bursts of 36 IR pulses and + spaces, which is not enough for the NEC, Sanyo and RC-6 protocol. + + To compile this driver as a module, choose M here: the module will + be called igorplugusb. + +config IR_IGUANA + tristate "IguanaWorks USB IR Transceiver" + depends on USB + help + Say Y here if you want to use the IguanaWorks USB IR Transceiver. + Both infrared receive and send are supported. If you want to + change the ID or the pin config, use the user space driver from + IguanaWorks. + + Only firmware 0x0205 and later is supported. + + To compile this driver as a module, choose M here: the module will + be called iguanair. + config IR_IMON tristate "SoundGraph iMON Receiver and Display" depends on USB @@ -203,16 +246,6 @@ config IR_IMON_RAW To compile this driver as a module, choose M here: the module will be called imon_raw. -config IR_MCEUSB - tristate "Windows Media Center Ed. eHome Infrared Transceiver" - depends on USB - help - Say Y here if you want to use a Windows Media Center Edition - eHome Infrared Transceiver. - - To compile this driver as a module, choose M here: the - module will be called mceusb. - config IR_ITE_CIR tristate "ITE Tech Inc. IT8712/IT8512 Consumer Infrared Transceiver" depends on PNP || COMPILE_TEST @@ -225,16 +258,15 @@ config IR_ITE_CIR To compile this driver as a module, choose M here: the module will be called ite-cir. -config IR_FINTEK - tristate "Fintek Consumer Infrared Transceiver" - depends on PNP || COMPILE_TEST +config IR_MCEUSB + tristate "Windows Media Center Ed. eHome Infrared Transceiver" + depends on USB help - Say Y here to enable support for integrated infrared receiver - /transceiver made by Fintek. This chip is found on assorted - Jetway motherboards (and of course, possibly others). + Say Y here if you want to use a Windows Media Center Edition + eHome Infrared Transceiver. To compile this driver as a module, choose M here: the - module will be called fintek-cir. + module will be called mceusb. config IR_MESON tristate "Amlogic Meson IR remote receiver" @@ -278,6 +310,18 @@ config IR_NUVOTON To compile this driver as a module, choose M here: the module will be called nuvoton-cir. +config IR_PWM_TX + tristate "PWM IR transmitter" + depends on LIRC + depends on PWM + depends on OF || COMPILE_TEST + help + Say Y if you want to use a PWM based IR transmitter. This is + more power efficient than the bit banging gpio driver. + + To compile this driver as a module, choose M here: the module will + be called pwm-ir-tx. + config IR_REDRAT3 tristate "RedRat3 IR Transceiver" depends on USB @@ -289,6 +333,31 @@ config IR_REDRAT3 To compile this driver as a module, choose M here: the module will be called redrat3. +config IR_RX51 + tristate "Nokia N900 IR transmitter diode" + depends on (OMAP_DM_TIMER && PWM_OMAP_DMTIMER && ARCH_OMAP2PLUS || COMPILE_TEST) && RC_CORE + help + Say Y or M here if you want to enable support for the IR + transmitter diode built in the Nokia N900 (RX51) device. + + The driver uses omap DM timers for generating the carrier + wave and pulses. + +config IR_SERIAL + tristate "Homebrew Serial Port Receiver" + help + Say Y if you want to use Homebrew Serial Port Receivers and + Transceivers. + + To compile this driver as a module, choose M here: the module will + be called serial-ir. + +config IR_SERIAL_TRANSMITTER + bool "Serial Port Transmitter" + depends on IR_SERIAL + help + Serial Port Transmitter support + config IR_SPI tristate "SPI connected IR LED" depends on SPI && LIRC @@ -309,47 +378,24 @@ config IR_STREAMZAP To compile this driver as a module, choose M here: the module will be called streamzap. -config IR_WINBOND_CIR - tristate "Winbond IR remote control" - depends on (X86 && PNP) || COMPILE_TEST - select NEW_LEDS - select LEDS_CLASS - select BITREVERSE - help - Say Y here if you want to use the IR remote functionality found - in some Winbond SuperI/O chips. Currently only the WPCD376I - chip is supported (included in some Intel Media series - motherboards). - - To compile this driver as a module, choose M here: the module will - be called winbond_cir. - -config IR_IGORPLUGUSB - tristate "IgorPlug-USB IR Receiver" - depends on USB +config IR_SUNXI + tristate "SUNXI IR remote control" + depends on ARCH_SUNXI || COMPILE_TEST help - Say Y here if you want to use the IgorPlug-USB IR Receiver by - Igor Cesko. This device is included on the Fit-PC2. - - Note that this device can only record bursts of 36 IR pulses and - spaces, which is not enough for the NEC, Sanyo and RC-6 protocol. + Say Y if you want to use sunXi internal IR Controller To compile this driver as a module, choose M here: the module will - be called igorplugusb. + be called sunxi-ir. -config IR_IGUANA - tristate "IguanaWorks USB IR Transceiver" +config IR_TOY + tristate "Infrared Toy and IR Droid" depends on USB help - Say Y here if you want to use the IguanaWorks USB IR Transceiver. - Both infrared receive and send are supported. If you want to - change the ID or the pin config, use the user space driver from - IguanaWorks. - - Only firmware 0x0205 and later is supported. + Say Y here if you want to use the Infrared Toy or IR Droid, USB + versions. - To compile this driver as a module, choose M here: the module will - be called iguanair. + To compile this driver as a module, choose M here: the module will be + called ir_toy. config IR_TTUSBIR tristate "TechnoTrend USB IR Receiver" @@ -363,17 +409,37 @@ config IR_TTUSBIR To compile this driver as a module, choose M here: the module will be called ttusbir. -config IR_RX51 - tristate "Nokia N900 IR transmitter diode" - depends on (OMAP_DM_TIMER && PWM_OMAP_DMTIMER && ARCH_OMAP2PLUS || COMPILE_TEST) && RC_CORE +config IR_WINBOND_CIR + tristate "Winbond IR remote control" + depends on (X86 && PNP) || COMPILE_TEST + select NEW_LEDS + select LEDS_CLASS + select BITREVERSE help - Say Y or M here if you want to enable support for the IR - transmitter diode built in the Nokia N900 (RX51) device. + Say Y here if you want to use the IR remote functionality found + in some Winbond SuperI/O chips. Currently only the WPCD376I + chip is supported (included in some Intel Media series + motherboards). - The driver uses omap DM timers for generating the carrier - wave and pulses. + To compile this driver as a module, choose M here: the module will + be called winbond_cir. -source "drivers/media/rc/img-ir/Kconfig" +config RC_ATI_REMOTE + tristate "ATI / X10 based USB RF remote controls" + depends on USB + help + Say Y here if you want to use an X10 based USB remote control. + These are RF remotes with USB receivers. + + Such devices include the ATI remote that comes with many of ATI's + All-In-Wonder video cards, the X10 "Lola" remote, NVIDIA RF remote, + Medion RF remote, and SnapStream FireFly remote. + + This driver provides mouse pointer, left and right mouse buttons, + and maps all the other remote buttons to keypress events. + + To compile this driver as a module, choose M here: the module will be + called ati_remote. config RC_LOOPBACK tristate "Remote Control Loopback Driver" @@ -387,38 +453,6 @@ config RC_LOOPBACK To compile this driver as a module, choose M here: the module will be called rc_loopback. -config IR_GPIO_CIR - tristate "GPIO IR remote control" - depends on (OF && GPIOLIB) || COMPILE_TEST - help - Say Y if you want to use GPIO based IR Receiver. - - To compile this driver as a module, choose M here: the module will - be called gpio-ir-recv. - -config IR_GPIO_TX - tristate "GPIO IR Bit Banging Transmitter" - depends on LIRC - depends on (OF && GPIOLIB) || COMPILE_TEST - help - Say Y if you want to a GPIO based IR transmitter. This is a - bit banging driver. - - To compile this driver as a module, choose M here: the module will - be called gpio-ir-tx. - -config IR_PWM_TX - tristate "PWM IR transmitter" - depends on LIRC - depends on PWM - depends on OF || COMPILE_TEST - help - Say Y if you want to use a PWM based IR transmitter. This is - more power efficient than the bit banging gpio driver. - - To compile this driver as a module, choose M here: the module will - be called pwm-ir-tx. - config RC_ST tristate "ST remote control receiver" depends on ARCH_STI || COMPILE_TEST @@ -429,30 +463,6 @@ config RC_ST If you're not sure, select N here. -config IR_SUNXI - tristate "SUNXI IR remote control" - depends on ARCH_SUNXI || COMPILE_TEST - help - Say Y if you want to use sunXi internal IR Controller - - To compile this driver as a module, choose M here: the module will - be called sunxi-ir. - -config IR_SERIAL - tristate "Homebrew Serial Port Receiver" - help - Say Y if you want to use Homebrew Serial Port Receivers and - Transceivers. - - To compile this driver as a module, choose M here: the module will - be called serial-ir. - -config IR_SERIAL_TRANSMITTER - bool "Serial Port Transmitter" - depends on IR_SERIAL - help - Serial Port Transmitter support - config RC_XBOX_DVD tristate "Xbox DVD Movie Playback Kit" depends on USB @@ -463,15 +473,7 @@ config RC_XBOX_DVD To compile this driver as a module, choose M here: the module will be called xbox_remote. -config IR_TOY - tristate "Infrared Toy and IR Droid" - depends on USB - help - Say Y here if you want to use the Infrared Toy or IR Droid, USB - versions. - - To compile this driver as a module, choose M here: the module will be - called ir_toy. +source "drivers/media/rc/img-ir/Kconfig" endif #RC_DEVICES diff --git a/drivers/media/rc/Makefile b/drivers/media/rc/Makefile index 378d62d21e06..a9285266e944 100644 --- a/drivers/media/rc/Makefile +++ b/drivers/media/rc/Makefile @@ -2,51 +2,56 @@ obj-y += keymaps/ -obj-$(CONFIG_RC_CORE) += rc-core.o rc-core-y := rc-main.o rc-ir-raw.o rc-core-$(CONFIG_LIRC) += lirc_dev.o rc-core-$(CONFIG_MEDIA_CEC_RC) += keymaps/rc-cec.o rc-core-$(CONFIG_BPF_LIRC_MODE2) += bpf-lirc.o + +obj-$(CONFIG_RC_CORE) += rc-core.o + +# IR decoders - please keep it alphabetically sorted by Kconfig name +# (e. g. LC_ALL=C sort Makefile) +obj-$(CONFIG_IR_IMON_DECODER) += ir-imon-decoder.o +obj-$(CONFIG_IR_JVC_DECODER) += ir-jvc-decoder.o +obj-$(CONFIG_IR_MCE_KBD_DECODER) += ir-mce_kbd-decoder.o obj-$(CONFIG_IR_NEC_DECODER) += ir-nec-decoder.o obj-$(CONFIG_IR_RC5_DECODER) += ir-rc5-decoder.o obj-$(CONFIG_IR_RC6_DECODER) += ir-rc6-decoder.o -obj-$(CONFIG_IR_JVC_DECODER) += ir-jvc-decoder.o -obj-$(CONFIG_IR_SONY_DECODER) += ir-sony-decoder.o +obj-$(CONFIG_IR_RCMM_DECODER) += ir-rcmm-decoder.o obj-$(CONFIG_IR_SANYO_DECODER) += ir-sanyo-decoder.o obj-$(CONFIG_IR_SHARP_DECODER) += ir-sharp-decoder.o -obj-$(CONFIG_IR_MCE_KBD_DECODER) += ir-mce_kbd-decoder.o +obj-$(CONFIG_IR_SONY_DECODER) += ir-sony-decoder.o obj-$(CONFIG_IR_XMP_DECODER) += ir-xmp-decoder.o -obj-$(CONFIG_IR_IMON_DECODER) += ir-imon-decoder.o -obj-$(CONFIG_IR_RCMM_DECODER) += ir-rcmm-decoder.o -# stand-alone IR receivers/transmitters -obj-$(CONFIG_RC_ATI_REMOTE) += ati_remote.o +# stand-alone IR receivers/transmitters - please keep it alphabetically +# sorted by Kconfig name (e. g. LC_ALL=C sort Makefile) +obj-$(CONFIG_IR_ENE) += ene_ir.o +obj-$(CONFIG_IR_FINTEK) += fintek-cir.o +obj-$(CONFIG_IR_GPIO_CIR) += gpio-ir-recv.o +obj-$(CONFIG_IR_GPIO_TX) += gpio-ir-tx.o obj-$(CONFIG_IR_HIX5HD2) += ir-hix5hd2.o +obj-$(CONFIG_IR_IGORPLUGUSB) += igorplugusb.o +obj-$(CONFIG_IR_IGUANA) += iguanair.o +obj-$(CONFIG_IR_IMG) += img-ir/ obj-$(CONFIG_IR_IMON) += imon.o obj-$(CONFIG_IR_IMON_RAW) += imon_raw.o obj-$(CONFIG_IR_ITE_CIR) += ite-cir.o obj-$(CONFIG_IR_MCEUSB) += mceusb.o -obj-$(CONFIG_IR_FINTEK) += fintek-cir.o obj-$(CONFIG_IR_MESON) += meson-ir.o obj-$(CONFIG_IR_MESON_TX) += meson-ir-tx.o +obj-$(CONFIG_IR_MTK) += mtk-cir.o obj-$(CONFIG_IR_NUVOTON) += nuvoton-cir.o -obj-$(CONFIG_IR_ENE) += ene_ir.o +obj-$(CONFIG_IR_PWM_TX) += pwm-ir-tx.o obj-$(CONFIG_IR_REDRAT3) += redrat3.o obj-$(CONFIG_IR_RX51) += ir-rx51.o +obj-$(CONFIG_IR_SERIAL) += serial_ir.o obj-$(CONFIG_IR_SPI) += ir-spi.o obj-$(CONFIG_IR_STREAMZAP) += streamzap.o +obj-$(CONFIG_IR_SUNXI) += sunxi-cir.o +obj-$(CONFIG_IR_TOY) += ir_toy.o +obj-$(CONFIG_IR_TTUSBIR) += ttusbir.o obj-$(CONFIG_IR_WINBOND_CIR) += winbond-cir.o +obj-$(CONFIG_RC_ATI_REMOTE) += ati_remote.o obj-$(CONFIG_RC_LOOPBACK) += rc-loopback.o -obj-$(CONFIG_IR_GPIO_CIR) += gpio-ir-recv.o -obj-$(CONFIG_IR_GPIO_TX) += gpio-ir-tx.o -obj-$(CONFIG_IR_PWM_TX) += pwm-ir-tx.o -obj-$(CONFIG_IR_IGORPLUGUSB) += igorplugusb.o -obj-$(CONFIG_IR_IGUANA) += iguanair.o -obj-$(CONFIG_IR_TTUSBIR) += ttusbir.o obj-$(CONFIG_RC_ST) += st_rc.o -obj-$(CONFIG_IR_SUNXI) += sunxi-cir.o -obj-$(CONFIG_IR_IMG) += img-ir/ -obj-$(CONFIG_IR_SERIAL) += serial_ir.o -obj-$(CONFIG_IR_MTK) += mtk-cir.o obj-$(CONFIG_RC_XBOX_DVD) += xbox_remote.o -obj-$(CONFIG_IR_TOY) += ir_toy.o diff --git a/drivers/media/rc/fintek-cir.c b/drivers/media/rc/fintek-cir.c index b0d580566e4e..3fb0968efd57 100644 --- a/drivers/media/rc/fintek-cir.c +++ b/drivers/media/rc/fintek-cir.c @@ -287,7 +287,7 @@ static void fintek_process_rx_ir_data(struct fintek_dev *fintek) if (fintek->rem) fintek->parser_state = PARSE_IRDATA; else - ir_raw_event_reset(fintek->rdev); + ir_raw_event_overflow(fintek->rdev); break; case SUBCMD: fintek->rem = fintek_cmdsize(fintek->cmd, sample); diff --git a/drivers/media/rc/gpio-ir-tx.c b/drivers/media/rc/gpio-ir-tx.c index c6cd2e6d8e65..a50701cfbbd7 100644 --- a/drivers/media/rc/gpio-ir-tx.c +++ b/drivers/media/rc/gpio-ir-tx.c @@ -48,11 +48,29 @@ static int gpio_ir_tx_set_carrier(struct rc_dev *dev, u32 carrier) return 0; } +static void delay_until(ktime_t until) +{ + /* + * delta should never exceed 0.5 seconds (IR_MAX_DURATION) and on + * m68k ndelay(s64) does not compile; so use s32 rather than s64. + */ + s32 delta; + + while (true) { + delta = ktime_us_delta(until, ktime_get()); + if (delta <= 0) + return; + + /* udelay more than 1ms may not work */ + delta = min(delta, 1000); + udelay(delta); + } +} + static void gpio_ir_tx_unmodulated(struct gpio_ir *gpio_ir, uint *txbuf, uint count) { ktime_t edge; - s32 delta; int i; local_irq_disable(); @@ -63,9 +81,7 @@ static void gpio_ir_tx_unmodulated(struct gpio_ir *gpio_ir, uint *txbuf, gpiod_set_value(gpio_ir->gpio, !(i % 2)); edge = ktime_add_us(edge, txbuf[i]); - delta = ktime_us_delta(edge, ktime_get()); - if (delta > 0) - udelay(delta); + delay_until(edge); } gpiod_set_value(gpio_ir->gpio, 0); @@ -97,9 +113,7 @@ static void gpio_ir_tx_modulated(struct gpio_ir *gpio_ir, uint *txbuf, if (i % 2) { // space edge = ktime_add_us(edge, txbuf[i]); - delta = ktime_us_delta(edge, ktime_get()); - if (delta > 0) - udelay(delta); + delay_until(edge); } else { // pulse ktime_t last = ktime_add_us(edge, txbuf[i]); diff --git a/drivers/media/rc/igorplugusb.c b/drivers/media/rc/igorplugusb.c index 3e9988ee785f..b40dbf500186 100644 --- a/drivers/media/rc/igorplugusb.c +++ b/drivers/media/rc/igorplugusb.c @@ -67,7 +67,7 @@ static void igorplugusb_irdata(struct igorplugusb *ir, unsigned len) if (overflow > 0) { dev_warn(ir->dev, "receive overflow, at least %u lost", overflow); - ir_raw_event_reset(ir->rc); + ir_raw_event_overflow(ir->rc); } do { diff --git a/drivers/media/rc/iguanair.c b/drivers/media/rc/iguanair.c index f8d080e41f4c..c9cb8277723f 100644 --- a/drivers/media/rc/iguanair.c +++ b/drivers/media/rc/iguanair.c @@ -109,7 +109,7 @@ static void process_ir_data(struct iguanair *ir, unsigned len) break; case CMD_RX_OVERFLOW: dev_warn(ir->dev, "receive overflow\n"); - ir_raw_event_reset(ir->rc); + ir_raw_event_overflow(ir->rc); break; default: dev_warn(ir->dev, "control code %02x received\n", diff --git a/drivers/media/rc/ir-hix5hd2.c b/drivers/media/rc/ir-hix5hd2.c index e0be6471afe5..4ff954b11dc7 100644 --- a/drivers/media/rc/ir-hix5hd2.c +++ b/drivers/media/rc/ir-hix5hd2.c @@ -194,7 +194,7 @@ static irqreturn_t hix5hd2_ir_rx_interrupt(int irq, void *data) * IR_INTS availably since logic would not clear * fifo when overflow, drv do the job */ - ir_raw_event_reset(priv->rdev); + ir_raw_event_overflow(priv->rdev); symb_num = readl_relaxed(priv->base + IR_DATAH); for (i = 0; i < symb_num; i++) readl_relaxed(priv->base + IR_DATAL); diff --git a/drivers/media/rc/ir-imon-decoder.c b/drivers/media/rc/ir-imon-decoder.c index 41dbbef27fa6..dc68f64e7b51 100644 --- a/drivers/media/rc/ir-imon-decoder.c +++ b/drivers/media/rc/ir-imon-decoder.c @@ -95,7 +95,7 @@ static int ir_imon_decode(struct rc_dev *dev, struct ir_raw_event ev) struct imon_dec *data = &dev->raw->imon; if (!is_timing_event(ev)) { - if (ev.reset) + if (ev.overflow) data->state = STATE_INACTIVE; return 0; } diff --git a/drivers/media/rc/ir-jvc-decoder.c b/drivers/media/rc/ir-jvc-decoder.c index 470f2e1fd507..8b10954d2b6b 100644 --- a/drivers/media/rc/ir-jvc-decoder.c +++ b/drivers/media/rc/ir-jvc-decoder.c @@ -40,7 +40,7 @@ static int ir_jvc_decode(struct rc_dev *dev, struct ir_raw_event ev) struct jvc_dec *data = &dev->raw->jvc; if (!is_timing_event(ev)) { - if (ev.reset) + if (ev.overflow) data->state = STATE_INACTIVE; return 0; } diff --git a/drivers/media/rc/ir-mce_kbd-decoder.c b/drivers/media/rc/ir-mce_kbd-decoder.c index 1524dc0fc566..66e8feb9a569 100644 --- a/drivers/media/rc/ir-mce_kbd-decoder.c +++ b/drivers/media/rc/ir-mce_kbd-decoder.c @@ -221,7 +221,7 @@ static int ir_mce_kbd_decode(struct rc_dev *dev, struct ir_raw_event ev) struct lirc_scancode lsc = {}; if (!is_timing_event(ev)) { - if (ev.reset) + if (ev.overflow) data->state = STATE_INACTIVE; return 0; } diff --git a/drivers/media/rc/ir-nec-decoder.c b/drivers/media/rc/ir-nec-decoder.c index b4c3e4baf34d..37b99432ad0d 100644 --- a/drivers/media/rc/ir-nec-decoder.c +++ b/drivers/media/rc/ir-nec-decoder.c @@ -44,7 +44,7 @@ static int ir_nec_decode(struct rc_dev *dev, struct ir_raw_event ev) u8 address, not_address, command, not_command; if (!is_timing_event(ev)) { - if (ev.reset) + if (ev.overflow) data->state = STATE_INACTIVE; return 0; } diff --git a/drivers/media/rc/ir-rc5-decoder.c b/drivers/media/rc/ir-rc5-decoder.c index d58b6226afeb..82d7f6ad2338 100644 --- a/drivers/media/rc/ir-rc5-decoder.c +++ b/drivers/media/rc/ir-rc5-decoder.c @@ -45,7 +45,7 @@ static int ir_rc5_decode(struct rc_dev *dev, struct ir_raw_event ev) enum rc_proto protocol; if (!is_timing_event(ev)) { - if (ev.reset) + if (ev.overflow) data->state = STATE_INACTIVE; return 0; } diff --git a/drivers/media/rc/ir-rc6-decoder.c b/drivers/media/rc/ir-rc6-decoder.c index 0657ad5eef48..3b2c8bab3e73 100644 --- a/drivers/media/rc/ir-rc6-decoder.c +++ b/drivers/media/rc/ir-rc6-decoder.c @@ -85,7 +85,7 @@ static int ir_rc6_decode(struct rc_dev *dev, struct ir_raw_event ev) enum rc_proto protocol; if (!is_timing_event(ev)) { - if (ev.reset) + if (ev.overflow) data->state = STATE_INACTIVE; return 0; } diff --git a/drivers/media/rc/ir-rcmm-decoder.c b/drivers/media/rc/ir-rcmm-decoder.c index fd9ec69a3718..a8a34436fe85 100644 --- a/drivers/media/rc/ir-rcmm-decoder.c +++ b/drivers/media/rc/ir-rcmm-decoder.c @@ -69,7 +69,7 @@ static int ir_rcmm_decode(struct rc_dev *dev, struct ir_raw_event ev) return 0; if (!is_timing_event(ev)) { - if (ev.reset) + if (ev.overflow) data->state = STATE_INACTIVE; return 0; } diff --git a/drivers/media/rc/ir-sanyo-decoder.c b/drivers/media/rc/ir-sanyo-decoder.c index bfc181be1044..2bc98c342882 100644 --- a/drivers/media/rc/ir-sanyo-decoder.c +++ b/drivers/media/rc/ir-sanyo-decoder.c @@ -51,8 +51,8 @@ static int ir_sanyo_decode(struct rc_dev *dev, struct ir_raw_event ev) u8 command, not_command; if (!is_timing_event(ev)) { - if (ev.reset) { - dev_dbg(&dev->dev, "SANYO event reset received. reset to state 0\n"); + if (ev.overflow) { + dev_dbg(&dev->dev, "SANYO event overflow received. reset to state 0\n"); data->state = STATE_INACTIVE; } return 0; diff --git a/drivers/media/rc/ir-sharp-decoder.c b/drivers/media/rc/ir-sharp-decoder.c index d09c38c07dbd..3d8488c39c56 100644 --- a/drivers/media/rc/ir-sharp-decoder.c +++ b/drivers/media/rc/ir-sharp-decoder.c @@ -41,7 +41,7 @@ static int ir_sharp_decode(struct rc_dev *dev, struct ir_raw_event ev) u32 msg, echo, address, command, scancode; if (!is_timing_event(ev)) { - if (ev.reset) + if (ev.overflow) data->state = STATE_INACTIVE; return 0; } diff --git a/drivers/media/rc/ir-sony-decoder.c b/drivers/media/rc/ir-sony-decoder.c index d760d52abaa2..bb25867ecb5e 100644 --- a/drivers/media/rc/ir-sony-decoder.c +++ b/drivers/media/rc/ir-sony-decoder.c @@ -39,7 +39,7 @@ static int ir_sony_decode(struct rc_dev *dev, struct ir_raw_event ev) u8 device, subdevice, function; if (!is_timing_event(ev)) { - if (ev.reset) + if (ev.overflow) data->state = STATE_INACTIVE; return 0; } diff --git a/drivers/media/rc/ir-xmp-decoder.c b/drivers/media/rc/ir-xmp-decoder.c index ff94f48bda32..dc36b68739cb 100644 --- a/drivers/media/rc/ir-xmp-decoder.c +++ b/drivers/media/rc/ir-xmp-decoder.c @@ -37,7 +37,7 @@ static int ir_xmp_decode(struct rc_dev *dev, struct ir_raw_event ev) struct xmp_dec *data = &dev->raw->xmp; if (!is_timing_event(ev)) { - if (ev.reset) + if (ev.overflow) data->state = STATE_INACTIVE; return 0; } diff --git a/drivers/media/rc/ir_toy.c b/drivers/media/rc/ir_toy.c index 7e98e7e3aace..196806709259 100644 --- a/drivers/media/rc/ir_toy.c +++ b/drivers/media/rc/ir_toy.c @@ -458,7 +458,7 @@ static int irtoy_probe(struct usb_interface *intf, err = usb_submit_urb(irtoy->urb_in, GFP_KERNEL); if (err != 0) { dev_err(irtoy->dev, "fail to submit in urb: %d\n", err); - return err; + goto free_rcdev; } err = irtoy_setup(irtoy); diff --git a/drivers/media/rc/ite-cir.c b/drivers/media/rc/ite-cir.c index 4f77d4ebacdc..fcfadd7ea31c 100644 --- a/drivers/media/rc/ite-cir.c +++ b/drivers/media/rc/ite-cir.c @@ -238,7 +238,7 @@ static irqreturn_t ite_cir_isr(int irq, void *data) /* Check for RX overflow */ if (iflags & ITE_IRQ_RX_FIFO_OVERRUN) { dev_warn(&dev->rdev->dev, "receive overflow\n"); - ir_raw_event_reset(dev->rdev); + ir_raw_event_overflow(dev->rdev); } /* check for the receive interrupt */ diff --git a/drivers/media/rc/keymaps/Makefile b/drivers/media/rc/keymaps/Makefile index 5fe5c9e1a46d..f513ff5caf4e 100644 --- a/drivers/media/rc/keymaps/Makefile +++ b/drivers/media/rc/keymaps/Makefile @@ -1,5 +1,9 @@ # SPDX-License-Identifier: GPL-2.0 -obj-$(CONFIG_RC_MAP) += rc-adstech-dvb-t-pci.o \ + +# Please keep keymaps alphabetically sorted by directory name +#(e. g. LC_ALL=C sort Makefile) +obj-$(CONFIG_RC_MAP) += \ + rc-adstech-dvb-t-pci.o \ rc-alink-dtu-m.o \ rc-anysee.o \ rc-apac-viewcomp.o \ @@ -9,17 +13,17 @@ obj-$(CONFIG_RC_MAP) += rc-adstech-dvb-t-pci.o \ rc-ati-tv-wonder-hd-600.o \ rc-ati-x10.o \ rc-avermedia-a16d.o \ - rc-avermedia.o \ rc-avermedia-cardbus.o \ rc-avermedia-dvbt.o \ rc-avermedia-m135a.o \ rc-avermedia-m733a-rm-k6.o \ + rc-avermedia.o \ rc-avermedia-rm-ks.o \ rc-avertv-303.o \ rc-azurewave-ad-tu700.o \ rc-beelink-gs1.o \ - rc-behold.o \ rc-behold-columbus.o \ + rc-behold.o \ rc-budget-ci-old.o \ rc-cinergy-1400.o \ rc-cinergy.o \ @@ -39,8 +43,8 @@ obj-$(CONFIG_RC_MAP) += rc-adstech-dvb-t-pci.o \ rc-dvico-portable.o \ rc-em-terratec.o \ rc-encore-enltv2.o \ - rc-encore-enltv.o \ rc-encore-enltv-fm53.o \ + rc-encore-enltv.o \ rc-evga-indtube.o \ rc-eztv.o \ rc-flydvb.o \ @@ -50,6 +54,7 @@ obj-$(CONFIG_RC_MAP) += rc-adstech-dvb-t-pci.o \ rc-geekbox.o \ rc-genius-tvgo-a11mce.o \ rc-gotview7135.o \ + rc-hauppauge.o \ rc-hisi-poplar.o \ rc-hisi-tv-demo.o \ rc-imon-mce.o \ @@ -67,14 +72,14 @@ obj-$(CONFIG_RC_MAP) += rc-adstech-dvb-t-pci.o \ rc-leadtek-y04g0051.o \ rc-lme2510.o \ rc-manli.o \ - rc-mecool-kii-pro.o \ rc-mecool-kiii-pro.o \ - rc-medion-x10.o \ + rc-mecool-kii-pro.o \ rc-medion-x10-digitainer.o \ + rc-medion-x10.o \ rc-medion-x10-or2x.o \ rc-minix-neo.o \ - rc-msi-digivox-ii.o \ rc-msi-digivox-iii.o \ + rc-msi-digivox-ii.o \ rc-msi-tvanywhere.o \ rc-msi-tvanywhere-plus.o \ rc-nebula.o \ @@ -87,20 +92,20 @@ obj-$(CONFIG_RC_MAP) += rc-adstech-dvb-t-pci.o \ rc-pinnacle-color.o \ rc-pinnacle-grey.o \ rc-pinnacle-pctv-hd.o \ - rc-pixelview.o \ - rc-pixelview-mk12.o \ rc-pixelview-002t.o \ + rc-pixelview-mk12.o \ rc-pixelview-new.o \ + rc-pixelview.o \ rc-powercolor-real-angel.o \ rc-proteus-2309.o \ rc-purpletv.o \ rc-pv951.o \ - rc-hauppauge.o \ rc-rc6-mce.o \ rc-real-audio-220-32-keys.o \ rc-reddo.o \ rc-snapstream-firefly.o \ rc-streamzap.o \ + rc-su3000.o \ rc-tanix-tx3mini.o \ rc-tanix-tx5max.o \ rc-tbs-nec.o \ @@ -109,16 +114,16 @@ obj-$(CONFIG_RC_MAP) += rc-adstech-dvb-t-pci.o \ rc-terratec-cinergy-c-pci.o \ rc-terratec-cinergy-s2-hd.o \ rc-terratec-cinergy-xs.o \ - rc-terratec-slim.o \ rc-terratec-slim-2.o \ + rc-terratec-slim.o \ rc-tevii-nec.o \ rc-tivo.o \ - rc-total-media-in-hand.o \ rc-total-media-in-hand-02.o \ + rc-total-media-in-hand.o \ rc-trekstor.o \ rc-tt-1500.o \ - rc-twinhan-dtv-cab-ci.o \ rc-twinhan1027.o \ + rc-twinhan-dtv-cab-ci.o \ rc-vega-s9x.o \ rc-videomate-m1f.o \ rc-videomate-s350.o \ @@ -128,8 +133,7 @@ obj-$(CONFIG_RC_MAP) += rc-adstech-dvb-t-pci.o \ rc-wetek-play2.o \ rc-winfast.o \ rc-winfast-usbii-deluxe.o \ - rc-su3000.o \ + rc-x96max.o \ rc-xbox-360.o \ rc-xbox-dvd.o \ - rc-x96max.o \ rc-zx-irdec.o diff --git a/drivers/media/rc/lirc_dev.c b/drivers/media/rc/lirc_dev.c index c7c5157725f8..765375bda0c6 100644 --- a/drivers/media/rc/lirc_dev.c +++ b/drivers/media/rc/lirc_dev.c @@ -41,17 +41,16 @@ void lirc_raw_event(struct rc_dev *dev, struct ir_raw_event ev) struct lirc_fh *fh; int sample; - /* Packet start */ - if (ev.reset) { + /* Receiver overflow, data missing */ + if (ev.overflow) { /* - * Userspace expects a long space event before the start of - * the signal to use as a sync. This may be done with repeat - * packets and normal samples. But if a reset has been sent - * then we assume that a long time has passed, so we send a - * space with the maximum time value. + * Send lirc overflow message. This message is unknown to + * lircd, but it will interpret this as a long space as + * long as the value is set to high value. This resets its + * decoder state. */ - sample = LIRC_SPACE(LIRC_VALUE_MASK); - dev_dbg(&dev->dev, "delivering reset sync space to lirc_dev\n"); + sample = LIRC_OVERFLOW(LIRC_VALUE_MASK); + dev_dbg(&dev->dev, "delivering overflow to lirc_dev\n"); /* Carrier reports */ } else if (ev.carrier_report) { @@ -60,32 +59,25 @@ void lirc_raw_event(struct rc_dev *dev, struct ir_raw_event ev) /* Packet end */ } else if (ev.timeout) { - if (dev->gap) - return; - dev->gap_start = ktime_get(); - dev->gap = true; - dev->gap_duration = ev.duration; sample = LIRC_TIMEOUT(ev.duration); dev_dbg(&dev->dev, "timeout report (duration: %d)\n", sample); /* Normal sample */ } else { - if (dev->gap) { - dev->gap_duration += ktime_to_us(ktime_sub(ktime_get(), - dev->gap_start)); + if (dev->gap_start) { + u64 duration = ktime_us_delta(ktime_get(), + dev->gap_start); /* Cap by LIRC_VALUE_MASK */ - dev->gap_duration = min_t(u64, dev->gap_duration, - LIRC_VALUE_MASK); + duration = min_t(u64, duration, LIRC_VALUE_MASK); spin_lock_irqsave(&dev->lirc_fh_lock, flags); list_for_each_entry(fh, &dev->lirc_fh, list) - kfifo_put(&fh->rawir, - LIRC_SPACE(dev->gap_duration)); + kfifo_put(&fh->rawir, LIRC_SPACE(duration)); spin_unlock_irqrestore(&dev->lirc_fh_lock, flags); - dev->gap = false; + dev->gap_start = 0; } sample = ev.pulse ? LIRC_PULSE(ev.duration) : diff --git a/drivers/media/rc/meson-ir-tx.c b/drivers/media/rc/meson-ir-tx.c index c22cd26a5c07..63e1dbf0a4e9 100644 --- a/drivers/media/rc/meson-ir-tx.c +++ b/drivers/media/rc/meson-ir-tx.c @@ -1,5 +1,5 @@ // SPDX-License-Identifier: GPL-2.0-only -/** +/* * meson-ir-tx.c - Amlogic Meson IR TX driver * * Copyright (c) 2021, SberDevices. All Rights Reserved. diff --git a/drivers/media/rc/mtk-cir.c b/drivers/media/rc/mtk-cir.c index 840e7aec5c21..27b7412d02a5 100644 --- a/drivers/media/rc/mtk-cir.c +++ b/drivers/media/rc/mtk-cir.c @@ -24,7 +24,8 @@ * Register to setting ok count whose unit based on hardware sampling period * indicating IR receiving completion and then making IRQ fires */ -#define MTK_OK_COUNT(x) (((x) & GENMASK(23, 16)) << 16) +#define MTK_OK_COUNT_MASK (GENMASK(22, 16)) +#define MTK_OK_COUNT(x) ((x) << 16) /* Bit to enable IR hardware function */ #define MTK_IR_EN BIT(0) @@ -202,25 +203,24 @@ static inline void mtk_irq_enable(struct mtk_ir *ir, u32 mask) static irqreturn_t mtk_ir_irq(int irqno, void *dev_id) { + struct ir_raw_event rawir = {}; struct mtk_ir *ir = dev_id; - u8 wid = 0; u32 i, j, val; - struct ir_raw_event rawir = {}; + u8 wid; /* - * Reset decoder state machine explicitly is required - * because 1) the longest duration for space MTK IR hardware - * could record is not safely long. e.g 12ms if rx resolution - * is 46us by default. There is still the risk to satisfying - * every decoder to reset themselves through long enough - * trailing spaces and 2) the IRQ handler guarantees that - * start of IR message is always contained in and starting - * from register mtk_chkdata_reg(ir, i). + * Each pulse and space is encoded as a single byte, each byte + * alternating between pulse and space. If a pulse or space is longer + * than can be encoded in a single byte, it is encoded as the maximum + * value 0xff. + * + * If a space is longer than ok_count (about 23ms), the value is + * encoded as zero, and all following bytes are zero. Any IR that + * follows will be presented in the next interrupt. + * + * If there are more than 68 (=MTK_CHKDATA_SZ * 4) pulses and spaces, + * then the only the first 68 will be presented; the rest is lost. */ - ir_raw_event_reset(ir->rc); - - /* First message must be pulse */ - rawir.pulse = false; /* Handle all pulse and space IR controller captures */ for (i = 0 ; i < MTK_CHKDATA_SZ ; i++) { @@ -228,7 +228,8 @@ static irqreturn_t mtk_ir_irq(int irqno, void *dev_id) dev_dbg(ir->dev, "@reg%d=0x%08x\n", i, val); for (j = 0 ; j < 4 ; j++) { - wid = (val & (MTK_WIDTH_MASK << j * 8)) >> j * 8; + wid = val & MTK_WIDTH_MASK; + val >>= 8; rawir.pulse = !rawir.pulse; rawir.duration = wid * (MTK_IR_SAMPLE + 1); ir_raw_event_store_with_filter(ir->rc, &rawir); @@ -268,7 +269,7 @@ static irqreturn_t mtk_ir_irq(int irqno, void *dev_id) static const struct mtk_ir_data mt7623_data = { .regs = mt7623_regs, .fields = mt7623_fields, - .ok_count = 0xf, + .ok_count = 3, .hw_period = 0xff, .div = 4, }; @@ -276,7 +277,7 @@ static const struct mtk_ir_data mt7623_data = { static const struct mtk_ir_data mt7622_data = { .regs = mt7622_regs, .fields = mt7622_fields, - .ok_count = 0xf, + .ok_count = 3, .hw_period = 0xffff, .div = 32, }; @@ -400,7 +401,7 @@ static int mtk_ir_probe(struct platform_device *pdev) mtk_w32_mask(ir, MTK_DG_CNT(1), MTK_DG_CNT_MASK, MTK_IRTHD); /* Enable IR and PWM */ - val = mtk_r32(ir, MTK_CONFIG_HIGH_REG); + val = mtk_r32(ir, MTK_CONFIG_HIGH_REG) & ~MTK_OK_COUNT_MASK; val |= MTK_OK_COUNT(ir->data->ok_count) | MTK_PWM_EN | MTK_IR_EN; mtk_w32(ir, val, MTK_CONFIG_HIGH_REG); diff --git a/drivers/media/rc/nuvoton-cir.c b/drivers/media/rc/nuvoton-cir.c index 8a37f083fe3d..2214d41ef579 100644 --- a/drivers/media/rc/nuvoton-cir.c +++ b/drivers/media/rc/nuvoton-cir.c @@ -742,7 +742,7 @@ static void nvt_handle_rx_fifo_overrun(struct nvt_dev *nvt) nvt->pkts = 0; nvt_clear_cir_fifo(nvt); - ir_raw_event_reset(nvt->rdev); + ir_raw_event_overflow(nvt->rdev); } /* copy data from hardware rx fifo into driver buffer */ diff --git a/drivers/media/rc/rc-core-priv.h b/drivers/media/rc/rc-core-priv.h index 62f032dffd33..ef1e95e1af7f 100644 --- a/drivers/media/rc/rc-core-priv.h +++ b/drivers/media/rc/rc-core-priv.h @@ -190,7 +190,7 @@ static inline void decrease_duration(struct ir_raw_event *ev, unsigned duration) /* Returns true if event is normal pulse/space event */ static inline bool is_timing_event(struct ir_raw_event ev) { - return !ev.carrier_report && !ev.reset; + return !ev.carrier_report && !ev.overflow; } #define TO_STR(is_pulse) ((is_pulse) ? "pulse" : "space") diff --git a/drivers/media/rc/rc-ir-raw.c b/drivers/media/rc/rc-ir-raw.c index c65bba4ec473..16e33d7eaaa2 100644 --- a/drivers/media/rc/rc-ir-raw.c +++ b/drivers/media/rc/rc-ir-raw.c @@ -35,8 +35,6 @@ static int ir_raw_event_thread(void *data) !is_transition(&ev, &raw->prev_ev)) dev_warn_once(&dev->dev, "two consecutive events of type %s", TO_STR(ev.pulse)); - if (raw->prev_ev.reset && ev.pulse == 0) - dev_warn_once(&dev->dev, "timing event after reset should be pulse"); } list_for_each_entry(handler, &ir_raw_handler_list, list) if (dev->enabled_protocols & diff --git a/drivers/media/rc/rc-loopback.c b/drivers/media/rc/rc-loopback.c index 6441879fcba1..b356041c5c00 100644 --- a/drivers/media/rc/rc-loopback.c +++ b/drivers/media/rc/rc-loopback.c @@ -112,7 +112,11 @@ static int loop_tx_ir(struct rc_dev *dev, unsigned *txbuf, unsigned count) rawir.pulse = i % 2 ? false : true; rawir.duration = txbuf[i]; - ir_raw_event_store_with_filter(dev, &rawir); + /* simulate overflow if ridiculously long pulse was sent */ + if (rawir.pulse && rawir.duration > MS_TO_US(50)) + ir_raw_event_overflow(dev); + else + ir_raw_event_store_with_filter(dev, &rawir); } if (lodev->carrierreport) { diff --git a/drivers/media/rc/st_rc.c b/drivers/media/rc/st_rc.c index 4e419dbbacd3..19e987a048cc 100644 --- a/drivers/media/rc/st_rc.c +++ b/drivers/media/rc/st_rc.c @@ -111,7 +111,7 @@ static irqreturn_t st_rc_rx_interrupt(int irq, void *data) int_status = readl(dev->rx_base + IRB_RX_INT_STATUS); if (unlikely(int_status & IRB_RX_OVERRUN_INT)) { /* discard the entire collection in case of errors! */ - ir_raw_event_reset(dev->rdev); + ir_raw_event_overflow(dev->rdev); dev_info(dev->dev, "IR RX overrun\n"); writel(IRB_RX_OVERRUN_INT, dev->rx_base + IRB_RX_INT_CLEAR); diff --git a/drivers/media/rc/sunxi-cir.c b/drivers/media/rc/sunxi-cir.c index 391a591c1b75..b631a81e58bb 100644 --- a/drivers/media/rc/sunxi-cir.c +++ b/drivers/media/rc/sunxi-cir.c @@ -126,7 +126,7 @@ static irqreturn_t sunxi_ir_irq(int irqno, void *dev_id) } if (status & REG_RXSTA_ROI) { - ir_raw_event_reset(ir->rc); + ir_raw_event_overflow(ir->rc); } else if (status & REG_RXSTA_RPE) { ir_raw_event_set_idle(ir->rc, true); ir_raw_event_handle(ir->rc); diff --git a/drivers/media/rc/winbond-cir.c b/drivers/media/rc/winbond-cir.c index 94efb035d21b..25884a79985c 100644 --- a/drivers/media/rc/winbond-cir.c +++ b/drivers/media/rc/winbond-cir.c @@ -470,7 +470,7 @@ wbcir_irq_handler(int irqno, void *cookie) /* RX overflow? (read clears bit) */ if (inb(data->sbase + WBCIR_REG_SP3_LSR) & WBCIR_RX_OVERRUN) { data->rxstate = WBCIR_RXSTATE_ERROR; - ir_raw_event_reset(data->dev); + ir_raw_event_overflow(data->dev); } /* TX underflow? */ |