[Odroid C2] How to change remote IR PIN in devicetree

Post Reply
User avatar
JimmyS
Posts: 55
Joined: Sun Apr 22, 2018 9:37 pm
languages_spoken: english
ODROIDs: C2
Contact:

[Odroid C2] How to change remote IR PIN in devicetree

Unread post by JimmyS » Tue Jan 08, 2019 1:55 am

Hi,
I am trying to modify device tree of odroid C2, and remap IR pin to the GPIO pin. So that meson-ir would use GPIO IR pin instead IR diode on C2's PCB.
I tried to understand exmaple, but I am struggling to get know correct pins, as this is a bit different.

I found meson-ir code in meson64_odroidc2.dts

Code: Select all

meson-ir {
                compatible = "amlogic, meson6-ir";
                reg = <0x0 0xc8100580 0x0 0x20>;
                interrupts = <0 196 1>;
                pinctrl-names = "default";
                pinctrl-0 = <&remote_pins>;
                pulse-inverted;
                status = "ok";
};
and in mesongxbb.dtsi this

Code: Select all

remote_pins:remote_pin{
			amlogic,setmask = <AO 0x1>;
			amlogic,pins = "GPIOAO_7";
};
This is correct place I believe, according schematics GPIOAO.BIT7 is IR_IN for Odroid C2.

cat /sys/kernel/debug/pinctrl/c1109880.pinmux/pinmux-pins confirms that (gxbb.h)

Code: Select all

Pinmux settings per pin
Format: pin (name): mux_owner gpio_owner hog?
pin 0 (GPIOAO_0): (MUX UNCLAIMED) (GPIO UNCLAIMED)
pin 1 (GPIOAO_1): (MUX UNCLAIMED) (GPIO UNCLAIMED)
pin 2 (GPIOAO_2): (MUX UNCLAIMED) (GPIO UNCLAIMED)
pin 3 (GPIOAO_3): (MUX UNCLAIMED) ao-bank:125
pin 4 (GPIOAO_4): (MUX UNCLAIMED) (GPIO UNCLAIMED)
pin 5 (GPIOAO_5): (MUX UNCLAIMED) ao-bank:127
pin 6 (GPIOAO_6): dummy-spdif-dit.0 (GPIO UNCLAIMED) function audio_pin1 group audio_pin1
pin 7 (GPIOAO_7): c8100580.meson-ir (GPIO UNCLAIMED) function remote_pin group remote_pin
pin 8 (GPIOAO_8): aml_m8_snd.41 (GPIO UNCLAIMED) function audio_pin group audio_pin
pin 9 (GPIOAO_9): aml_m8_snd.41 (GPIO UNCLAIMED) function audio_pin group audio_pin
pin 10 (GPIOAO_10): aml_m8_snd.41 (GPIO UNCLAIMED) function audio_pin group audio_pin
pin 11 (GPIOAO_11): aml_m8_snd.41 (GPIO UNCLAIMED) function audio_pin group audio_pin
pin 12 (GPIOAO_12): c810023c.aocec (GPIO UNCLAIMED) function hdmitx_aocec group hdmitx_aocec
pin 13 (GPIOAO_13): (MUX UNCLAIMED) ao-bank:135
pin 14 (GPIOZ_0): c9410000.ethernet (GPIO UNCLAIMED) function eth_pins group eth_pins
pin 15 (GPIOZ_1): c9410000.ethernet (GPIO UNCLAIMED) function eth_pins group eth_pins
pin 16 (GPIOZ_2): c9410000.ethernet (GPIO UNCLAIMED) function eth_pins group eth_pins
pin 17 (GPIOZ_3): c9410000.ethernet (GPIO UNCLAIMED) function eth_pins group eth_pins
pin 18 (GPIOZ_4): c9410000.ethernet (GPIO UNCLAIMED) function eth_pins group eth_pins
pin 19 (GPIOZ_5): c9410000.ethernet (GPIO UNCLAIMED) function eth_pins group eth_pins
pin 20 (GPIOZ_6): c9410000.ethernet (GPIO UNCLAIMED) function eth_pins group eth_pins
pin 21 (GPIOZ_7): c9410000.ethernet (GPIO UNCLAIMED) function eth_pins group eth_pins
pin 22 (GPIOZ_8): c9410000.ethernet (GPIO UNCLAIMED) function eth_pins group eth_pins
pin 23 (GPIOZ_9): c9410000.ethernet (GPIO UNCLAIMED) function eth_pins group eth_pins
pin 24 (GPIOZ_10): c9410000.ethernet (GPIO UNCLAIMED) function eth_pins group eth_pins
pin 25 (GPIOZ_11): c9410000.ethernet (GPIO UNCLAIMED) function eth_pins group eth_pins
pin 26 (GPIOZ_12): c9410000.ethernet (GPIO UNCLAIMED) function eth_pins group eth_pins
pin 27 (GPIOZ_13): c9410000.ethernet (GPIO UNCLAIMED) function eth_pins group eth_pins
pin 28 (GPIOZ_14): (MUX UNCLAIMED) (GPIO UNCLAIMED)
pin 29 (GPIOZ_15): c9410000.ethernet (GPIO UNCLAIMED) function eth_pins group eth_pins
pin 30 (GPIOH_0): (MUX UNCLAIMED) (GPIO UNCLAIMED)
pin 31 (GPIOH_1): (MUX UNCLAIMED) (GPIO UNCLAIMED)
pin 32 (GPIOH_2): (MUX UNCLAIMED) (GPIO UNCLAIMED)
pin 33 (GPIOH_3): (MUX UNCLAIMED) banks:155
pin 34 (BOOT_0): (MUX UNCLAIMED) (GPIO UNCLAIMED)
pin 35 (BOOT_1): (MUX UNCLAIMED) (GPIO UNCLAIMED)
pin 36 (BOOT_2): (MUX UNCLAIMED) (GPIO UNCLAIMED)
pin 37 (BOOT_3): (MUX UNCLAIMED) (GPIO UNCLAIMED)
pin 38 (BOOT_4): (MUX UNCLAIMED) (GPIO UNCLAIMED)
pin 39 (BOOT_5): (MUX UNCLAIMED) (GPIO UNCLAIMED)
pin 40 (BOOT_6): (MUX UNCLAIMED) (GPIO UNCLAIMED)
pin 41 (BOOT_7): (MUX UNCLAIMED) (GPIO UNCLAIMED)
pin 42 (BOOT_8): (MUX UNCLAIMED) (GPIO UNCLAIMED)
pin 43 (BOOT_9): (MUX UNCLAIMED) (GPIO UNCLAIMED)
pin 44 (BOOT_10): (MUX UNCLAIMED) (GPIO UNCLAIMED)
pin 45 (BOOT_11): (MUX UNCLAIMED) (GPIO UNCLAIMED)
pin 46 (BOOT_12): (MUX UNCLAIMED) (GPIO UNCLAIMED)
pin 47 (BOOT_13): (MUX UNCLAIMED) (GPIO UNCLAIMED)
pin 48 (BOOT_14): (MUX UNCLAIMED) (GPIO UNCLAIMED)
pin 49 (BOOT_15): (MUX UNCLAIMED) (GPIO UNCLAIMED)
pin 50 (BOOT_16): (MUX UNCLAIMED) (GPIO UNCLAIMED)
pin 51 (BOOT_17): (MUX UNCLAIMED) (GPIO UNCLAIMED)
pin 52 (CARD_0): d0072000.sd (GPIO UNCLAIMED) function sd_all_pins group sd_all_pins
pin 53 (CARD_1): d0072000.sd (GPIO UNCLAIMED) function sd_all_pins group sd_all_pins
pin 54 (CARD_2): d0072000.sd (GPIO UNCLAIMED) function sd_all_pins group sd_all_pins
pin 55 (CARD_3): d0072000.sd (GPIO UNCLAIMED) function sd_all_pins group sd_all_pins
pin 56 (CARD_4): d0072000.sd (GPIO UNCLAIMED) function sd_all_pins group sd_all_pins
pin 57 (CARD_5): d0072000.sd (GPIO UNCLAIMED) function sd_all_pins group sd_all_pins
pin 58 (CARD_6): (MUX UNCLAIMED) banks:180
pin 59 (GPIODV_0): (MUX UNCLAIMED) (GPIO UNCLAIMED)
pin 60 (GPIODV_1): (MUX UNCLAIMED) (GPIO UNCLAIMED)
pin 61 (GPIODV_2): (MUX UNCLAIMED) (GPIO UNCLAIMED)
pin 62 (GPIODV_3): (MUX UNCLAIMED) (GPIO UNCLAIMED)
pin 63 (GPIODV_4): (MUX UNCLAIMED) (GPIO UNCLAIMED)
pin 64 (GPIODV_5): (MUX UNCLAIMED) (GPIO UNCLAIMED)
pin 65 (GPIODV_6): (MUX UNCLAIMED) (GPIO UNCLAIMED)
pin 66 (GPIODV_7): (MUX UNCLAIMED) (GPIO UNCLAIMED)
pin 67 (GPIODV_8): (MUX UNCLAIMED) (GPIO UNCLAIMED)
pin 68 (GPIODV_9): (MUX UNCLAIMED) (GPIO UNCLAIMED)
pin 69 (GPIODV_10): (MUX UNCLAIMED) (GPIO UNCLAIMED)
pin 70 (GPIODV_11): (MUX UNCLAIMED) (GPIO UNCLAIMED)
pin 71 (GPIODV_12): (MUX UNCLAIMED) (GPIO UNCLAIMED)
pin 72 (GPIODV_13): (MUX UNCLAIMED) (GPIO UNCLAIMED)
pin 73 (GPIODV_14): (MUX UNCLAIMED) (GPIO UNCLAIMED)
pin 74 (GPIODV_15): (MUX UNCLAIMED) (GPIO UNCLAIMED)
pin 75 (GPIODV_16): (MUX UNCLAIMED) (GPIO UNCLAIMED)
pin 76 (GPIODV_17): (MUX UNCLAIMED) (GPIO UNCLAIMED)
pin 77 (GPIODV_18): (MUX UNCLAIMED) (GPIO UNCLAIMED)
pin 78 (GPIODV_19): (MUX UNCLAIMED) (GPIO UNCLAIMED)
pin 79 (GPIODV_20): (MUX UNCLAIMED) (GPIO UNCLAIMED)
pin 80 (GPIODV_21): (MUX UNCLAIMED) (GPIO UNCLAIMED)
pin 81 (GPIODV_22): (MUX UNCLAIMED) (GPIO UNCLAIMED)
pin 82 (GPIODV_23): (MUX UNCLAIMED) (GPIO UNCLAIMED)
pin 83 (GPIODV_24): c1108500.i2c (GPIO UNCLAIMED) function a_i2c group a_i2c
pin 84 (GPIODV_25): c1108500.i2c (GPIO UNCLAIMED) function a_i2c group a_i2c
pin 85 (GPIODV_26): (MUX UNCLAIMED) (GPIO UNCLAIMED)
pin 86 (GPIODV_27): (MUX UNCLAIMED) (GPIO UNCLAIMED)
pin 87 (GPIODV_28): (MUX UNCLAIMED) (GPIO UNCLAIMED)
pin 88 (GPIODV_29): (MUX UNCLAIMED) (GPIO UNCLAIMED)
pin 89 (GPIOY_0): (MUX UNCLAIMED) (GPIO UNCLAIMED)
pin 90 (GPIOY_1): (MUX UNCLAIMED) (GPIO UNCLAIMED)
pin 91 (GPIOY_2): (MUX UNCLAIMED) (GPIO UNCLAIMED)
pin 92 (GPIOY_3): (MUX UNCLAIMED) (GPIO UNCLAIMED)
pin 93 (GPIOY_4): (MUX UNCLAIMED) (GPIO UNCLAIMED)
pin 94 (GPIOY_5): (MUX UNCLAIMED) (GPIO UNCLAIMED)
pin 95 (GPIOY_6): (MUX UNCLAIMED) (GPIO UNCLAIMED)
pin 96 (GPIOY_7): (MUX UNCLAIMED) (GPIO UNCLAIMED)
pin 97 (GPIOY_8): (MUX UNCLAIMED) (GPIO UNCLAIMED)
pin 98 (GPIOY_9): (MUX UNCLAIMED) (GPIO UNCLAIMED)
pin 99 (GPIOY_10): (MUX UNCLAIMED) (GPIO UNCLAIMED)
pin 100 (GPIOY_11): (MUX UNCLAIMED) (GPIO UNCLAIMED)
pin 101 (GPIOY_12): (MUX UNCLAIMED) (GPIO UNCLAIMED)
pin 102 (GPIOY_13): (MUX UNCLAIMED) (GPIO UNCLAIMED)
pin 103 (GPIOY_14): (MUX UNCLAIMED) (GPIO UNCLAIMED)
pin 104 (GPIOY_15): (MUX UNCLAIMED) (GPIO UNCLAIMED)
pin 105 (GPIOY_16): (MUX UNCLAIMED) (GPIO UNCLAIMED)
pin 106 (GPIOX_0): (MUX UNCLAIMED) (GPIO UNCLAIMED)
pin 107 (GPIOX_1): (MUX UNCLAIMED) banks:229
pin 108 (GPIOX_2): (MUX UNCLAIMED) banks:230
pin 109 (GPIOX_3): (MUX UNCLAIMED) (GPIO UNCLAIMED)
pin 110 (GPIOX_4): (MUX UNCLAIMED) banks:232
pin 111 (GPIOX_5): (MUX UNCLAIMED) (GPIO UNCLAIMED)
pin 112 (GPIOX_6): (MUX UNCLAIMED) (GPIO UNCLAIMED)
pin 113 (GPIOX_7): (MUX UNCLAIMED) banks:235
pin 114 (GPIOX_8): PCM.36 (GPIO UNCLAIMED) function audio_btpcm_pins group audio_btpcm_pins
pin 115 (GPIOX_9): PCM.36 (GPIO UNCLAIMED) function audio_btpcm_pins group audio_btpcm_pins
pin 116 (GPIOX_10): PCM.36 (GPIO UNCLAIMED) function audio_btpcm_pins group audio_btpcm_pins
pin 117 (GPIOX_11): PCM.36 (GPIO UNCLAIMED) function audio_btpcm_pins group audio_btpcm_pins
pin 118 (GPIOX_12): c11084c0.serial (GPIO UNCLAIMED) function a_uart group a_uart
pin 119 (GPIOX_13): c11084c0.serial (GPIO UNCLAIMED) function a_uart group a_uart
pin 120 (GPIOX_14): c11084c0.serial (GPIO UNCLAIMED) function a_uart group a_uart
pin 121 (GPIOX_15): c11084c0.serial (GPIO UNCLAIMED) function a_uart group a_uart
pin 122 (GPIOX_16): (MUX UNCLAIMED) (GPIO UNCLAIMED)
pin 123 (GPIOX_17): (MUX UNCLAIMED) (GPIO UNCLAIMED)
pin 124 (GPIOX_18): (MUX UNCLAIMED) (GPIO UNCLAIMED)
pin 125 (GPIOX_19): (MUX UNCLAIMED) (GPIO UNCLAIMED)
pin 126 (GPIOX_20): (MUX UNCLAIMED) (GPIO UNCLAIMED)
pin 127 (GPIOX_21): (MUX UNCLAIMED) (GPIO UNCLAIMED)
pin 128 (GPIOX_22): (MUX UNCLAIMED) (GPIO UNCLAIMED)
pin 129 (GPIOCLK_0): (MUX UNCLAIMED) (GPIO UNCLAIMED)
pin 130 (GPIOCLK_1): (MUX UNCLAIMED) (GPIO UNCLAIMED)
pin 131 (GPIOCLK_2): (MUX UNCLAIMED) (GPIO UNCLAIMED)
pin 132 (GPIOCLK_3): (MUX UNCLAIMED) (GPIO UNCLAIMED)
pin 133 (GPIO_TEST_N): (MUX UNCLAIMED) (GPIO UNCLAIMED)
I understand, I must somehow edit

Code: Select all

remote_pins:remote_pin{
			amlogic,setmask = <AO 0x1>;
			amlogic,pins = "GPIOAO_7";
};
to the setmask + pin from GPIO 2x20 J2 - 2x20 Expansion header (For example GPIO #249). Or even better rewrite some values through fdtget/fdtput.

But I just cant find out, what values those should be - which identifies GPIO #249 ?

When I dumped current device tree, its

Code: Select all

meson-ir {
		compatible = "amlogic, meson6-ir";
                reg = <0x0 0xc8100580 0x0 0x20>;
                interrupts = <0x0 0xc4 0x1>;
                pinctrl-names = "default";
                pinctrl-0 = <0x18>;
                pulse-inverted;
                status = "ok";

remote_pin {
			amlogic,setmask = <0x10 0x1>;
			amlogic,pins = "GPIOAO_7";
			linux,phandle = <0x18>;
			phandle = <0x18>;
		};
Could it be that way, or there is some problem with mismatching gpio / pinctrl-0? And how I could use fdtget/fdtput for the remote_pins:remote_pin?

Code: Select all

remote_pins:remote_pin{
			amlogic,setmask = <&gpio>;
			amlogic,pins = "GPIOX_11";
		};
Thanks in advance
Last edited by JimmyS on Tue Jan 08, 2019 10:26 am, edited 1 time in total.
Odroid C2 + ??? - proof of concept, trying to find out best ELEC version supporting: GPIO IR, Mysql(for Kodi library), DVB-T2 drivers, TVHeadend. Not sucessfull yet.

6x RPi2 + Various TV's + LE 7.0.3, 2x Win7 Kodi 16.1 + MySQL from vPeter's LAMP plugin as Library DB + .zip patch + EAC3 patch .

joy
Posts: 675
Joined: Fri Oct 02, 2015 1:44 pm
languages_spoken: english
ODROIDs: ODROID-C1+, XU4, X
Contact:

Re: [Odroid C2] How to change remote IR PIN in devicetree

Unread post by joy » Tue Jan 08, 2019 8:31 am

Hi, JimmyS.

The IR_RX pin is a dedicated port with infrared remote IP of S905 chipset.
And with S905, IR input pin is assigned only to GPIOAO_7 port,
no other alternate port that works as REMOTE_INPUT function.

Please refer to this datasheet.
https://dn.odroid.com/S905/DataSheet/S9 ... V1.1.4.pdf

You can check the port configuration in these pages.
Page 34, [ Table II.8.15 Remote Interface Signal Description ]
Page 84, [ Table III.23.8. GPIO Bank AO Pin Multiplexing Table ]

Also you can find the registers' description here.
Page 312, [ Chapter 42. Infrared Remote ]
The meson-ir driver is written based on the IP registers so, it's available with GPIOAO_7.

So, I think you'd better to consider the approach using GPIO IR RX if you want to use another port except GPIOAO_7.

User avatar
JimmyS
Posts: 55
Joined: Sun Apr 22, 2018 9:37 pm
languages_spoken: english
ODROIDs: C2
Contact:

Re: [Odroid C2] How to change remote IR PIN in devicetree

Unread post by JimmyS » Tue Jan 08, 2019 8:50 am

Thank you for reply, even its kinda confuse me a bit more..

Should I understand it that way, that meson-ir cant be used with any other GPIO, than GPIOAO_7, no matter how remote_pin or pinctrl-0 is defined in device tree? :( I mean, its not possible to "redirect" REMOTE_INPUT to the J2 Expansion header, instead of soldered IR diode through device tree?

Or, could it be possible to just change meson-ir, to use different pin than REMOTE_INPUT? Something like:

Code: Select all

meson-ir {
                compatible = "amlogic, meson6-ir";
                reg = <0x0 0xc8100580 0x0 0x20>;
                interrupts = <0 196 1>;
                pinctrl-names = "default";
                pinctrl-0 = <&gpio GPIOX_11 GPIO_ACTIVE_LOW>;
                pulse-inverted;
                status = "ok";
};
or is that pinctrl-0 are totally incompatible with gpios format?
Odroid C2 + ??? - proof of concept, trying to find out best ELEC version supporting: GPIO IR, Mysql(for Kodi library), DVB-T2 drivers, TVHeadend. Not sucessfull yet.

6x RPi2 + Various TV's + LE 7.0.3, 2x Win7 Kodi 16.1 + MySQL from vPeter's LAMP plugin as Library DB + .zip patch + EAC3 patch .

joy
Posts: 675
Joined: Fri Oct 02, 2015 1:44 pm
languages_spoken: english
ODROIDs: ODROID-C1+, XU4, X
Contact:

Re: [Odroid C2] How to change remote IR PIN in devicetree

Unread post by joy » Tue Jan 08, 2019 12:19 pm

JimmyS wrote:
Tue Jan 08, 2019 8:50 am
Thank you for reply, even its kinda confuse me a bit more..

Should I understand it that way, that meson-ir cant be used with any other GPIO, than GPIOAO_7, no matter how remote_pin or pinctrl-0 is defined in device tree? :( I mean, its not possible to "redirect" REMOTE_INPUT to the J2 Expansion header, instead of soldered IR diode through device tree?

Or, could it be possible to just change meson-ir, to use different pin than REMOTE_INPUT? Something like:

Code: Select all

meson-ir {
                compatible = "amlogic, meson6-ir";
                reg = <0x0 0xc8100580 0x0 0x20>;
                interrupts = <0 196 1>;
                pinctrl-names = "default";
                pinctrl-0 = <&gpio GPIOX_11 GPIO_ACTIVE_LOW>;
                pulse-inverted;
                status = "ok";
};
or is that pinctrl-0 are totally incompatible with gpios format?
There is only one port that is connected to infrared remote controller IP of S905 internally, that means the connected port can work as the alternate function of IR_REMOTE_IN.
If you use the "S905 remote controller IP" with "meson-ir driver", unfortunately, there is no alternate way that can use other ports like redirection or something as aforementioned.
For example, GPIOX_11 can NOT be configured as IR_REMOTE_IN, other ports, neither..... :(
It's a kind of HW limitation. (CPU chip side)

As I know, you may already know how to use GPIO IR RX.
I saw some your posts related to IR here in ODROID forum.
https://wiki.odroid.com/odroid-c2/appli ... te/gpio/ir
With this approach, you can assign IR remote rx pin to other ports (like one of 40pins expansion).
But you need to handle gpio-ir-recv and gpioplug-ir-recv drivers instead of meson-ir driver.

User avatar
JimmyS
Posts: 55
Joined: Sun Apr 22, 2018 9:37 pm
languages_spoken: english
ODROIDs: C2
Contact:

Re: [Odroid C2] How to change remote IR PIN in devicetree

Unread post by JimmyS » Tue Jan 08, 2019 4:16 pm

Yes,
I am trying to find out / learn all possibilities around GPIO IR :)
Thank you for explanation!
Odroid C2 + ??? - proof of concept, trying to find out best ELEC version supporting: GPIO IR, Mysql(for Kodi library), DVB-T2 drivers, TVHeadend. Not sucessfull yet.

6x RPi2 + Various TV's + LE 7.0.3, 2x Win7 Kodi 16.1 + MySQL from vPeter's LAMP plugin as Library DB + .zip patch + EAC3 patch .

Post Reply

Return to “General Topics”

Who is online

Users browsing this forum: No registered users and 0 guests