linux-amlogic icon indicating copy to clipboard operation
linux-amlogic copied to clipboard

Allow use GPIO for IR remote receive on Odroid C2.

Open JimmyS83 opened this issue 7 years ago • 7 comments

  • Adding gpioplug-ir-recv is module to allow receive IR from remote through IR diode connected to the GPIO pins (together with gpio-ir-recv, which is already present on LibreELEC). Without gpioplug is not possible to use IR RX through GPIO. Gpioplug-ir-recv is originated by Cloudshell, and later on taken by HK developers as officialy supported method to support IR GPIO receive: 1 / 2 / 3 Cherrypicking from https://github.com/CoreELEC/linux-amlogic/compare/03f89a8aa6c1b3f69f693cbf2ed8d300f4fc1c67...9d8ccf486c84ce33f38fc9accf5bfe4032d1d5ea.

  • backporting the flush timer for gpio-ir-recv

Needed for LibreELEC/LibreELEC.tv#3206

JimmyS83 avatar Jan 08 '19 07:01 JimmyS83

Have you runtime tested this?

From a quick glance the IR backports look fine but I guess probing gpio-ir-recv is going to fail as the meson pinctrl driver doesn't seem to implement to_irq https://github.com/LibreELEC/linux-amlogic/blob/amlogic-3.14.y/include/linux/gpio/driver.h#L86 which is required for gpio_to_irq https://github.com/LibreELEC/linux-amlogic/blob/ada059eaee7eb8ee2c1169d1bab93ffe3ba5d459/drivers/media/rc/gpio-ir-recv.c#L191

HiassofT avatar Jan 08 '19 11:01 HiassofT

I tested whole package (with irq banks side-commit) couple days before. AFAIK, meson-ir shouldnt come into play, when using gpio-ir + gpioplug is meson-ir blacklisted..

JimmyS83 avatar Jan 08 '19 12:01 JimmyS83

Please confirm if the patches in this PR work, ideally both with DVB drivers enabled and disabled in LibreELEC.

We don't have the hardware to check this ourselves and as the pinctrl/IRQ changes that you had in your previous PR #120 are neither in this PR nor in https://github.com/LibreELEC/LibreELEC.tv/pull/3206 I suspect something might be missing and it won't work as is

HiassofT avatar Jan 09 '19 15:01 HiassofT

Please confirm if the patches in this PR work, ideally both with DVB drivers enabled and disabled in LibreELEC.

We don't have the hardware to check this ourselves and as the pinctrl/IRQ changes that you had in your previous PR #120 are neither in this PR nor in LibreELEC/LibreELEC.tv#3206 I suspect something might be missing and it won't work as is

Allright I will try to differentiate patch and test that also. Take a while until I compile that and make some more tests (I am working on another things also)

So do you think that those commits are bad somehow also? (@Kwiboo excludes those) 1 2 3

JimmyS83 avatar Jan 10 '19 08:01 JimmyS83

I can't comment on commits 2 and 3 (this is not exactly my area of expertise) but they seem to be incomplete, otherwise commit 1 would not be needed.

Commit 1 definitely is an ugly workaround and won't work if you enable DVB drivers in LE (unless you adapt that patch so it can be added to the dvb drivers, which isn't worth the hassle IMO).

It would be good if the Hardkernel folks worked with upstream and added the missing IRQ code bits to the meson pinctrl driver. Then we had a reference how a proper solution should look like and we could also be sure it'll still work in LE10 when we switch AML to upstream kernel and get rid of all the ugly out-of-tree vendor patches.

HiassofT avatar Jan 10 '19 10:01 HiassofT

I think that this "won't work if you enable DVB drivers in LE" is quite big problem, although it has far away from affecting majority of users propably. In the other hand, I can understand, that DVB drivers are not coming from HK.


I am really trying to organize and make GPIO IR changes widelly avaible for users. Therefore I made a comprehensive comparation of amlogic kernels related to the GPIO IR possibilities:

HK linux - odroidc2-3.14.y media/rc: Add new IR receiver to specify gpio number for IR sensor ODROID-C2: Adjust request irq routine based on meson gpio irq ODROID-C2: Apply meson_fix_irqbank to find an available gpioirq bank ODROID-C2 : gpio sysfs irq implement.

CoreELEC linux-amlogic amlogic-3.14-nougat Cherrypicked from HK: [PATCH] media/rc: Add new IR receiver to specify gpio number for IR s… [PATCH] ODROID-C2: Adjust request irq routine based on meson gpio irq [PATCH] ODROID-C2: Apply meson_fix_irqbank to find an available gpioi [PATCH] ODROID-C2 : gpio sysfs irq implement.

Custom, implemented in CoreELEC: PD#123733: irq: Add gpio irq mask interface gpio: add new gpio and pinctrl driver drivers/media/rc: adjust gpio-ir-recv timeouts [PATCH] [media] rc: gpio-ir-recv: add timeout on idle

LibreELEC linux-amlogic Cherrypicked from HK, not implemented in LibreELEC: media/rc: Add new IR receiver to specify gpio number for IR sensor

Custom, not implemented in LibreELEC: [media] rc: set IR_MAX_DURATION to 500 ms [media] rc-core: define a default timeout for drivers smsir.h: remove a now duplicated definition (IR_DEFAULT_TIMEOUT) [media] rc: gpio-ir-recv: add timeout on idle [media] gpio-ir: do not allow a timeout of 0


But when we talking about LibreELEC and Odroid (C2), wouldnt make sense to use official HK linux amlogic for that device?

I mean, would be ideal to keep up HK kernel and upstream (I will try to ask), but lets say they wont or dont wanna (some those Gpio changes are there for years), considering LibreELEC and images for Odroid C2 platform, I dont see anything wrong to profit from / use kernel, provided by HW manufacturer, to get best user experience? I will also ask CE devs to try push tuning into HK linux.

JimmyS83 avatar Jan 10 '19 12:01 JimmyS83

Adding separate (vendor) kernel versions, is not really an option as this creates a huge maintenance overhead. Each kernel needs separate testing, fixing, backporting of improvements etc so we aim to reduce the total number of kernels used in LE, not increase it further.

AML 3.14 is basically on life support and we are careful not to add stuff which could break thing or cause major (support) headaches.

HiassofT avatar Jan 10 '19 13:01 HiassofT