Skip to contentSkip to conversation

HDMI CEC on ODROID-N2+

DISCUSSION Stefan Agner 3 participants 7 messages Jan 13, 2022 – Jan 16, 2022

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

Hi Neil,

I am trying to use HDMI CEC on ODROID-N2+ using Linux 5.10.91. However, I was unsuccessful: As far as I can tell cec-client uses the right device (I disabled CONFIG_DRM_DW_HDMI_CEC since my kernel is still missing your patch "drm/meson: dw-hdmi: disable DW-HDMI CEC sub-driver"). But communication won't work, and dmesg prints timeout messages:

[   68.831253] cec-meson_g12a_ao_cec: message ff 84 20 00 06 timed out
[   71.134987] cec-meson_g12a_ao_cec: message ff 87 00 15 82 timed out
[   73.438826] cec-meson_g12a_ao_cec: message f0 timed out
[   75.742677] cec-meson_g12a_ao_cec: message f0 timed out
[   78.046555] cec-meson_g12a_ao_cec: message f0 timed out
[   80.350446] cec-meson_g12a_ao_cec: message f0 timed out
[   82.654358] cec-meson_g12a_ao_cec: message 11 timed out
[   84.958285] cec-meson_g12a_ao_cec: message 11 timed out
[   87.262194] cec-meson_g12a_ao_cec: message 11 timed out
[   89.566130] cec-meson_g12a_ao_cec: message 11 timed out

I did a quick test with CoreELEC which uses the 4.9 downstream kernel, CEC seems to work there. So it does not seem to be my hardware setup.

A quick test with the latest Linux 5.16 shows the same errors.

Do you happen to have an idea? Do you know if HDMI CEC using upstream kernels worked at one point on that particular platform?

--
Stefan

_______________________________________________
linux-amlogic mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-amlogic

#1 lore raw

Hi,

Quoted 20 lines · Stefan Agner

Hi Neil,

I am trying to use HDMI CEC on ODROID-N2+ using Linux 5.10.91. However, I was unsuccessful: As far as I can tell cec-client uses the right device (I disabled CONFIG_DRM_DW_HDMI_CEC since my kernel is still missing your patch "drm/meson: dw-hdmi: disable DW-HDMI CEC sub-driver"). But communication won't work, and dmesg prints timeout messages:

[   68.831253] cec-meson_g12a_ao_cec: message ff 84 20 00 06 timed out
[   71.134987] cec-meson_g12a_ao_cec: message ff 87 00 15 82 timed out
[   73.438826] cec-meson_g12a_ao_cec: message f0 timed out
[   75.742677] cec-meson_g12a_ao_cec: message f0 timed out
[   78.046555] cec-meson_g12a_ao_cec: message f0 timed out
[   80.350446] cec-meson_g12a_ao_cec: message f0 timed out
[   82.654358] cec-meson_g12a_ao_cec: message 11 timed out
[   84.958285] cec-meson_g12a_ao_cec: message 11 timed out
[   87.262194] cec-meson_g12a_ao_cec: message 11 timed out
[   89.566130] cec-meson_g12a_ao_cec: message 11 timed out
Quoted 7 lines

I did a quick test with CoreELEC which uses the 4.9 downstream kernel, CEC seems to work there. So it does not seem to be my hardware setup.

A quick test with the latest Linux 5.16 shows the same errors.

Do you happen to have an idea? Do you know if HDMI CEC using upstream kernels worked at one point on that particular platform?

I was reported it works on Yukawa 5.10 kernel, I'll have a check it still works.

Neil

Quoted 4 lines

--
Stefan

#2 lore raw

Re: (EXT) HDMI CEC on ODROID-N2+

In reply to Stefan Agner

Hi Stefan,

Am Donnerstag, 13. Januar 2022, 15:36:38 CET schrieb Stefan Agner:

Quoted 20 lines

Hi Neil,

I am trying to use HDMI CEC on ODROID-N2+ using Linux 5.10.91. However, I was unsuccessful: As far as I can tell cec-client uses the right device (I disabled CONFIG_DRM_DW_HDMI_CEC since my kernel is still missing your patch "drm/meson: dw-hdmi: disable DW-HDMI CEC sub-driver"). But communication won't work, and dmesg prints timeout messages:

[   68.831253] cec-meson_g12a_ao_cec: message ff 84 20 00 06 timed out
[   71.134987] cec-meson_g12a_ao_cec: message ff 87 00 15 82 timed out
[   73.438826] cec-meson_g12a_ao_cec: message f0 timed out
[   75.742677] cec-meson_g12a_ao_cec: message f0 timed out
[   78.046555] cec-meson_g12a_ao_cec: message f0 timed out
[   80.350446] cec-meson_g12a_ao_cec: message f0 timed out
[   82.654358] cec-meson_g12a_ao_cec: message 11 timed out
[   84.958285] cec-meson_g12a_ao_cec: message 11 timed out
[   87.262194] cec-meson_g12a_ao_cec: message 11 timed out
[   89.566130] cec-meson_g12a_ao_cec: message 11 timed out
Quoted 7 lines

I did a quick test with CoreELEC which uses the 4.9 downstream kernel, CEC seems to work there. So it does not seem to be my hardware setup.

A quick test with the latest Linux 5.16 shows the same errors.

Do you happen to have an idea? Do you know if HDMI CEC using upstream kernels worked at one point on that particular platform?

I'm using Arch Linux on my ODROID-n2 (non-plus) and HDMI CEC works as expected.
Currently I'm running a 5.15.13-1-aarch64-ARCH kernel. AFAICS the mentioned patch is mainline since v5.14. I can see my TV without issues. I have to add that not every cable is suitable for HDMI CEC, I have one where CEC does not work (in general).

HTH
Alexander
------

$ cec-ctl --playback
$ cec-ctl -S
Driver Info:
        Driver Name                : meson-ao-cec-g12a
        Adapter Name               : meson_g12a_ao_cec
        Capabilities               : 0x0000011e
                Logical Addresses
                Transmit
                Passthrough
                Remote Control Support
                Connector Info
        Driver version             : 5.15.13
        Available Logical Addresses: 4
        DRM Connector Info         : card 1, connector 32
        Physical Address           : 1.0.0.0
        Logical Address Mask       : 0x0010
        CEC Version                : 2.0
        Vendor ID                  : 0x000c03 (HDMI)
        OSD Name                   : 'Playback'
        Logical Addresses          : 1 (Allow RC Passthrough)
          Logical Address          : 4 (Playback Device 1)
            Primary Device Type    : Playback
            Logical Address Type   : Playback
            All Device Types       : Playback
            RC TV Profile          : None
            Device Features        :

None

System Information for device 0 (TV) from device 4 (Playback Device
1):

                CEC Version                : 1.4
                Physical Address           : 0.0.0.0
                Primary Device Type        : TV
                Vendor ID                  : 0x080046 (Sony)
                OSD Name                   : 'TV'
                Power Status               : Standby
        Topology:

            0.0.0.0: TV
                1.0.0.0: Playback Device 1
#3 lore raw

Re: (EXT) HDMI CEC on ODROID-N2+

Hi Alexander,

Quoted 31 lines · Alexander Stein

Hi Stefan,

Am Donnerstag, 13. Januar 2022, 15:36:38 CET schrieb Stefan Agner:

Quoted 20 lines

Hi Neil,

I am trying to use HDMI CEC on ODROID-N2+ using Linux 5.10.91. However, I was unsuccessful: As far as I can tell cec-client uses the right device (I disabled CONFIG_DRM_DW_HDMI_CEC since my kernel is still missing your patch "drm/meson: dw-hdmi: disable DW-HDMI CEC sub-driver"). But communication won't work, and dmesg prints timeout messages:

[   68.831253] cec-meson_g12a_ao_cec: message ff 84 20 00 06 timed out
[   71.134987] cec-meson_g12a_ao_cec: message ff 87 00 15 82 timed out
[   73.438826] cec-meson_g12a_ao_cec: message f0 timed out
[   75.742677] cec-meson_g12a_ao_cec: message f0 timed out
[   78.046555] cec-meson_g12a_ao_cec: message f0 timed out
[   80.350446] cec-meson_g12a_ao_cec: message f0 timed out
[   82.654358] cec-meson_g12a_ao_cec: message 11 timed out
[   84.958285] cec-meson_g12a_ao_cec: message 11 timed out
[   87.262194] cec-meson_g12a_ao_cec: message 11 timed out
[   89.566130] cec-meson_g12a_ao_cec: message 11 timed out
Quoted 7 lines

I did a quick test with CoreELEC which uses the 4.9 downstream kernel, CEC seems to work there. So it does not seem to be my hardware setup.

A quick test with the latest Linux 5.16 shows the same errors.

Do you happen to have an idea? Do you know if HDMI CEC using upstream kernels worked at one point on that particular platform?

Quoted 6 lines

I'm using Arch Linux on my ODROID-n2 (non-plus) and HDMI CEC works as expected.
Currently I'm running a 5.15.13-1-aarch64-ARCH kernel. AFAICS the mentioned patch is mainline since v5.14. I can see my TV without issues. I have to add that not every cable is suitable for HDMI CEC, I have one where CEC does not work (in general).

Hm, interesting, thanks for the datapoint!

I tried to reproduce your findings, unfortunately I am not successful in booting mainline using Arch Linux ARM so far. It seems it comes with downstream 4.9 kernel by default (where CEC seems to work in this case too). I then installed linux-aarch64 and adjusted the device tree, but it seems that the downstream U-Boot 2015.01-10 has some hardcoded "rsvmem" command which fails. How are you booting v5.14?

It is a bit surprising that 5.15.13 works for you but 5.16 didn't for me. That makes me wonder, could it be bootloader dependent? Are you using downstream U-Boot?

--
Stefan

Quoted 46 lines

HTH
Alexander
------

$ cec-ctl --playback
$ cec-ctl -S
Driver Info:
        Driver Name                : meson-ao-cec-g12a
        Adapter Name               : meson_g12a_ao_cec
        Capabilities               : 0x0000011e
                Logical Addresses
                Transmit
                Passthrough
                Remote Control Support
                Connector Info
        Driver version             : 5.15.13
        Available Logical Addresses: 4
        DRM Connector Info         : card 1, connector 32
        Physical Address           : 1.0.0.0
        Logical Address Mask       : 0x0010
        CEC Version                : 2.0
        Vendor ID                  : 0x000c03 (HDMI)
        OSD Name                   : 'Playback'
        Logical Addresses          : 1 (Allow RC Passthrough)
          Logical Address          : 4 (Playback Device 1)
            Primary Device Type    : Playback
            Logical Address Type   : Playback
            All Device Types       : Playback
            RC TV Profile          : None
            Device Features        :

None

System Information for device 0 (TV) from device 4 (Playback Device
1):

                CEC Version                : 1.4
                Physical Address           : 0.0.0.0
                Primary Device Type        : TV
                Vendor ID                  : 0x080046 (Sony)
                OSD Name                   : 'TV'
                Power Status               : Standby
        Topology:

            0.0.0.0: TV
                1.0.0.0: Playback Device 1
#4 lore raw

Re: (EXT) HDMI CEC on ODROID-N2+

Hi Alexander, Hi Neil,

Quoted 41 lines · Stefan Agner

Hi Alexander,

Quoted 31 lines · Alexander Stein

Hi Stefan,

Am Donnerstag, 13. Januar 2022, 15:36:38 CET schrieb Stefan Agner:

Quoted 20 lines

Hi Neil,

I am trying to use HDMI CEC on ODROID-N2+ using Linux 5.10.91. However, I was unsuccessful: As far as I can tell cec-client uses the right device (I disabled CONFIG_DRM_DW_HDMI_CEC since my kernel is still missing your patch "drm/meson: dw-hdmi: disable DW-HDMI CEC sub-driver"). But communication won't work, and dmesg prints timeout messages:

[   68.831253] cec-meson_g12a_ao_cec: message ff 84 20 00 06 timed out
[   71.134987] cec-meson_g12a_ao_cec: message ff 87 00 15 82 timed out
[   73.438826] cec-meson_g12a_ao_cec: message f0 timed out
[   75.742677] cec-meson_g12a_ao_cec: message f0 timed out
[   78.046555] cec-meson_g12a_ao_cec: message f0 timed out
[   80.350446] cec-meson_g12a_ao_cec: message f0 timed out
[   82.654358] cec-meson_g12a_ao_cec: message 11 timed out
[   84.958285] cec-meson_g12a_ao_cec: message 11 timed out
[   87.262194] cec-meson_g12a_ao_cec: message 11 timed out
[   89.566130] cec-meson_g12a_ao_cec: message 11 timed out
Quoted 7 lines

I did a quick test with CoreELEC which uses the 4.9 downstream kernel, CEC seems to work there. So it does not seem to be my hardware setup.

A quick test with the latest Linux 5.16 shows the same errors.

Do you happen to have an idea? Do you know if HDMI CEC using upstream kernels worked at one point on that particular platform?

Quoted 6 lines

I'm using Arch Linux on my ODROID-n2 (non-plus) and HDMI CEC works as expected.
Currently I'm running a 5.15.13-1-aarch64-ARCH kernel. AFAICS the mentioned patch is mainline since v5.14. I can see my TV without issues. I have to add that not every cable is suitable for HDMI CEC, I have one where CEC does not work (in general).

Quoted 8 lines

Hm, interesting, thanks for the datapoint!

I tried to reproduce your findings, unfortunately I am not successful in booting mainline using Arch Linux ARM so far. It seems it comes with downstream 4.9 kernel by default (where CEC seems to work in this case too). I then installed linux-aarch64 and adjusted the device tree, but it seems that the downstream U-Boot 2015.01-10 has some hardcoded "rsvmem" command which fails. How are you booting v5.14?

FWIW, adjusted U-Boot load addresses fixed that issue:
# Set load addresses
setenv dtb_loadaddr "0x20000000"
setenv loadaddr "0x1080000"
setenv initrd_loadaddr "0x4080000"

And I can confirm, HDMI CEC works with Arch Linux 5.15.13 kernel!

Quoted 4 lines

It is a bit surprising that 5.15.13 works for you but 5.16 didn't for me. That makes me wonder, could it be bootloader dependent? Are you using downstream U-Boot?

That assumption turned out to be wrong: I used our mainline based U-Boot 2021.10 instead of the Arch Linux ARM U-Boot, and HDMI CEC continued to work.

I then moved to 5.15.13 as well to rule out any kernel changes. But still, in our configuration HDMI CEC did not work. I ended up diffing configuration, and noticed that we are using built-in CONFIG_CEC_CORE whereas Arch Linux uses it as a module. To build CONFIG_CEC_CORE as a module I had to change some other configuration from built-in to module, namely:

- CONFIG_CEC_CORE=m
- CONFIG_DRM_DW_HDMI=m
- CONFIG_DRM_MESON=m
- CONFIG_DRM_MESON_DW_HDMI=m

With that change, HDMI CEC started to work in my builds too!

With that change, it also works on Linux 5.10.

I guess there is some ordering issue or something which makes it fail when those drivers are built-in? Note that I did not change CONFIG_CEC_MESON_G12A_AO, that driver was already a module before.

--
Stefan

#5 lore raw

Re: (EXT) HDMI CEC on ODROID-N2+

Hi Stefan,

Am Samstag, 15. Januar 2022, 14:28:01 CET schrieb Stefan Agner:

Quoted 7 lines
Quoted 6 lines

I tried to reproduce your findings, unfortunately I am not successful in booting mainline using Arch Linux ARM so far. It seems it comes with downstream 4.9 kernel by default (where CEC seems to work in this case too). I then installed linux-aarch64 and adjusted the device tree, but it seems that the downstream U-Boot 2015.01-10 has some hardcoded "rsvmem" command which fails. How are you booting v5.14?

Quoted 7 lines

FWIW, adjusted U-Boot load addresses fixed that issue:
# Set load addresses
setenv dtb_loadaddr "0x20000000"
setenv loadaddr "0x1080000"
setenv initrd_loadaddr "0x4080000"

And I can confirm, HDMI CEC works with Arch Linux 5.15.13 kernel!

Yes, you need to modify the loading addresses as with newer kernels the size increased. With the load addresses you will hit a memory hole which aborts the boot process.
I'm on downstream u-boot BTW.

Quoted 3 lines

That assumption turned out to be wrong: I used our mainline based U-Boot 2021.10 instead of the Arch Linux ARM U-Boot, and HDMI CEC continued to work.

Does the mainstream U-Boot work out of the box? Or does it require some additional configuration?

Quoted 12 lines

I then moved to 5.15.13 as well to rule out any kernel changes. But still, in our configuration HDMI CEC did not work. I ended up diffing configuration, and noticed that we are using built-in CONFIG_CEC_CORE whereas Arch Linux uses it as a module. To build CONFIG_CEC_CORE as a module I had to change some other configuration from built-in to module, namely:

- CONFIG_CEC_CORE=m
- CONFIG_DRM_DW_HDMI=m
- CONFIG_DRM_MESON=m
- CONFIG_DRM_MESON_DW_HDMI=m

Quoted 7 lines

With that change, HDMI CEC started to work in my builds too!

With that change, it also works on Linux 5.10.

I guess there is some ordering issue or something which makes it fail when those drivers are built-in? Note that I did not change CONFIG_CEC_MESON_G12A_AO, that driver was already a module before.

You need all 4 options above to be modules? Or is it maybe enough to set CONFIG_DRM_DW_HDMI_CEC=m? This should make CONFIG_CEC_CORE=m as well, while the other modules are built-in.
I suspect at some point a -EPROBE_DEFER is missing.

Just FYI: Arch Linux aarch64 kernel config currently lacks some drivers for HDMI audio. See [1].

Best regards,
Alexander

[1] https://github.com/archlinuxarm/PKGBUILDs/pull/1864

#6 lore raw

Re: (EXT) HDMI CEC on ODROID-N2+

Hi Alexander,

Quoted 10 lines · Alexander Stein

Hi Stefan,

Am Samstag, 15. Januar 2022, 14:28:01 CET schrieb Stefan Agner:

Quoted 3 lines

That assumption turned out to be wrong: I used our mainline based U-Boot 2021.10 instead of the Arch Linux ARM U-Boot, and HDMI CEC continued to work.

Does the mainstream U-Boot work out of the box? Or does it require some additional configuration?

Yes mainline U-Boot works out of the box. Building it is somewhat involved since it requires extra firmwares (there are build instructions in the source tree in board/amlogic/w400/README.odroid-n2).

You need to add a boot script to your boot partition. I used the script part of the uboot-odroid-n2-mainline package as inspiration [1]. It needs some adjustments as it seems to try to boot from the root file system directly (and my setup used the FAT/ext4 setup still).

We carry a single patch which improved reliability booting from eMMC, see [2].

Quoted 16 lines
Quoted 16 lines

I then moved to 5.15.13 as well to rule out any kernel changes. But still, in our configuration HDMI CEC did not work. I ended up diffing configuration, and noticed that we are using built-in CONFIG_CEC_CORE whereas Arch Linux uses it as a module. To build CONFIG_CEC_CORE as a module I had to change some other configuration from built-in to module, namely:

- CONFIG_CEC_CORE=m
- CONFIG_DRM_DW_HDMI=m
- CONFIG_DRM_MESON=m
- CONFIG_DRM_MESON_DW_HDMI=m

With that change, HDMI CEC started to work in my builds too!

With that change, it also works on Linux 5.10.

Quoted 7 lines
Quoted 3 lines

I guess there is some ordering issue or something which makes it fail when those drivers are built-in? Note that I did not change CONFIG_CEC_MESON_G12A_AO, that driver was already a module before.

You need all 4 options above to be modules? Or is it maybe enough to set CONFIG_DRM_DW_HDMI_CEC=m? This should make CONFIG_CEC_CORE=m as well, while the other modules are built-in.

In our builds I disabled CONFIG_DRM_DW_HDMI_CEC entirely actually.

It seems that CONFIG_DRM_DW_HDMI is tied to CEC_CORE through this dependency:

config DRM_DW_HDMI
...
select CEC_CORE if CEC_NOTIFIER

Quoted 4 lines

I suspect at some point a -EPROBE_DEFER is missing.

Just FYI: Arch Linux aarch64 kernel config currently lacks some drivers for HDMI audio. See [1].

Thanks for the link, just checked, it seems our kernel configuration covers those.

--
Stefan

Quoted 5 lines

Best regards,
Alexander

[1] https://github.com/archlinuxarm/PKGBUILDs/pull/1864

[1]
https://github.com/archlinuxarm/PKGBUILDs/blob/master/alarm/uboot-odroid-c2-mainline/boot.txt
[2]
https://github.com/home-assistant/operating-system/blob/rel-7/buildroot-external/board/hardkernel/patches/uboot/0001-HACK-mmc-meson-gx-limit-to-24MHz.patch