Bug 199597 - Nuvoton w836x7hg IR Transceiver not working any more since 4.16
Summary: Nuvoton w836x7hg IR Transceiver not working any more since 4.16
Status: NEW
Alias: None
Product: Drivers
Classification: Unclassified
Component: Other (show other bugs)
Hardware: All Linux
: P1 normal
Assignee: drivers_other
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-05-02 21:06 UTC by Ingo Lafrenz
Modified: 2018-07-02 08:48 UTC (History)
4 users (show)

See Also:
Kernel Version: 4.16
Tree: Mainline
Regression: Yes


Attachments
Series of 3 patches, you only need the first one though (8.09 KB, patch)
2018-05-21 14:34 UTC, Michał Winiarski
Details | Diff

Description Ingo Lafrenz 2018-05-02 21:06:49 UTC
Starting with Kernel 4.16 the infrared remote has stopped working. Using "ir-keytable -t" does not produce any result when pressing keys on the IR remote.


On 4.15.x kernels the same command works as expected. I have specifically tested it with 4.15.15-1 and 4.16.1-1 kernels, so it is a regression from 4.15 to 4.16. 


I have compared the kernel source between those versions and indeed there was some refactoring in exactly this area (drivers/media/rc).


My hardware is a Zotac ZBOX nano ID62 (http://old.zotac.com/au/products/mini-pcs/zbox-m-series/product/zbox-m-series/detail/zbox-nano-id62.html).


On a different hardware with an iMON remote everything works as expected.


Cheers, Curly060 =;->
Comment 1 Bj87 2018-05-11 22:22:43 UTC
I can confirm this bug on a ASRock Beebox-S 7200U.
Comment 2 Michał Winiarski 2018-05-21 14:34:39 UTC
Created attachment 276093 [details]
Series of 3 patches, you only need the first one though

I'm seeing the same issue.
It seems that we're not getting any interrupts since v4.16.

I bisected it to:

commit cb84343fced1febb5b21a9ef9082a07bfc3e7427
Author: Sean Young <sean@mess.org>
Date:   Sat Sep 23 17:44:03 2017 -0400

    media: lirc: do not call close() or open() on unregistered devices

    If a lirc chardev is held open after a device is unplugged, rc_close()
    will be called after rc_unregister_device(). The driver is not expecting
    any calls at this point, and the iguanair driver causes an oops in
    this scenario.

    rc_open() can be called when the device is removed too, by calling open
    on the chardev whilst the device is being removed.

    Signed-off-by: Sean Young <sean@mess.org>
    Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>

But the commit looks good, so I don't think it's the real problem.
I think that the real problem is caused by the fact that in nuvoton-cir we're writing to registers when the device is disabled...

I've attached a series that fixes the issue, first patch should be enough to fix the issue, the other two are just minor refactoring.

I'd appreciate if you could test it.
Comment 3 Ingo Lafrenz 2018-05-22 06:52:43 UTC
I have compiled the 4.16 kernel with all your patches applied and it does work indeed now. Great, thank you!

Cheers, Curly060 =;->
Comment 4 David 2018-07-01 07:25:47 UTC
Any chance of this getting merged in soon?  The first patch at least is super trivial so that could be merged without the refactor if desired.
Comment 5 Michał Winiarski 2018-07-02 08:48:15 UTC
Nuvoton fixups are merged (for 4.18).

Sean also created a fix in media/rc (enough to make this bug no longer reproducable), and that is also merged:
d7832cd2a3c8 ("media: rc: ensure input/lirc device can be opened after register")

This one has Cc:stable and is available in v4.17.3:
b72cee00bc77 ("media: rc: ensure input/lirc device can be opened after register")

Note You need to log in before you can comment on or make changes to this bug.