Allwinner H3: Orange Pi PC CEC degraded for SONY TV in 11.0 and 12.0-devel from working perfectly in 10.X

  • The Allwinner H3 support on the Orange Pi PC matured a lot over the years, appreciate that! Unfortunately the once perfectly working CEC control somehow degraded in newer versions. I checked the older 10.X standard image available for direct download - working like a charm. In 11.0 and the development branch it is really sluggish for SONY KDL50W805B (works perfect for some older SAMSUNG model):

    • In many cases it switches the TV (SONY FullHD, 5y) on and switches to the proper HDMI
    • The message that the CEC adapter got recognized takes longer to appear compared to 10.X version (in kodi main screen)
    • Sometimes the Orange Pi reacts to key presses on the TV remote, often not. Usually, double presses do not get recognized. If running for a while, nothing happens any more
    • When switching off kodi and getting down to the commandline (cec-ctl) it won't react as well
    • I checked CPU frequencies and scaling governors if they could have an impact on that - no changes in behavior

    Other devices like a Pine Rock64 work with the newest version without problems.

    From cec-ctl I get (kodi stopped to avoid blocking of the device):

    I can provide the kodi debug messages for CEC, but they pretty much say the same as for the command line tool.

    I checked for differences in the kernel code for CEC, didn't see much changes here from the kernel used in 10.X and the latest ones (I'm not an expert though). I've no idea what might influence the CEC implementation showing such effects :( Any ideas where to look for a solution/fix?

    I'd like to do some minor modifications to the image and thus compile the package by my self. Works perfectly for 11.0 and the latest stuff, but not for 10.X any more.

    Thank you!

  • Hi! Thank you for the pointer! But sorry, I'm a bit lost here: Checked the build directory, the patch you name got applied for the kernel. How (where) can I change the board name as you indicate (doing it for making the image results in "invalid choice")?

  • Edit the patch (you can do that directly, just replace any board name with yours), build the image and update your current system with it.

    If done properly, you should see different CEC driver name.

  • Wow, cool! Replaced *pc-plus with *pc (wondering why that board is not listed), recompiled, restarted. That fixed the problem :) Thanks a lot!!

  • Well, I'm glad it works for you, but that's just workaround. It uses software implementation of CEC instead of HW. It would be great to figure what's wrong.

  • I've got only a rough understanding of CEC, so no idea what is hardware/software doing in here: How could I help? I've got two working devices on that particular TV: Pine64 (RK3328 SoC) and an older ODRIOD C2 (Amlogic 905). All three devices work properly with the named Samsung without flaw.

  • difference is only if CEC protocol is completely implemented in software (algorithm in kernel determines when pin goes to 1 or 0, determined by timer) or in hardware (driver only reads what message was received or sends one out). Obviously, you want hardware to do as much as possible, as that leaves CPU to do better things. Also, time sensitive events, like when pin has to go to 1 or 0, are completely done in hardware and thus not dependent on CPU load which might introduce some lag.

    So, it's interesting to me that software implementation works better than hardware. Usually, it's other way around. Only explanation for that is 32k clock accuracy, which is used by HW CEC implementation for timing events. But I don't see a reason why that would be a problem. Maybe you can confirm that indeed dedicated crystal is used by executing devmem 0x01f00004 w. It should have value 1.

    Best way to determine what happened would be to first find PR on github which broke HW CEC. That could be done via git bisect.

  • I was distracted with other stuff and boards for a while: Came back to the Orange Pi PC. The new images work really great. Unfortunately the patch for software CEC does not work any more, running the build linux throws a message that it assumes the patch was already applied. Same state with the Sony (non-working) and Samsung TVs like before, but without the mitigation option.

  • I just took the patch from an earlier kernel (which fixed the aforementioned problem):

    maybe, this was not the brightest idea :)

  • It looks quite confusing: The first part of the patch is (already) applied and visible in the kernel sources, later stuff is missing at all (the to be replaced stuff as well). I have to look deeper into that ...