please choosego to mobile | Continue to access the PC version
Author: darqoq

[WIP] HDMI CEC - need support

[Copy link]

12

threads

99

posts

375

credits

Intermediate member

Rank: 3Rank: 3

credits
375
Published in 2016-3-7 16:23:50 | Show all floors
jernej replied at 2016-2-10 17:37
Guys, we are missing something obvious. script.bin gpio for CEC is set to PA14 which is general purp ...

Zidoo Android uses PA21.
  1. [hdmi_cec]
  2. hdmi_cec_used                = 1
  3. hdmi_cec_pin                = port:PA21<0><0><default><default>
Copy code



4

threads

1118

posts

9141

credits

Moderator

Rank: 7Rank: 7Rank: 7

credits
9141
Published in 2016-3-8 04:01:29 | Show all floors
So this is still bitbanged.

However, in latest Pine64 sources there are some traces how that can be done in real HW. Also based on https://linux-sunxi.org/DWC_HDMI_Controller I think we can do something about it. My research is ongoing.

0

threads

9

posts

82

credits

Registered member

Rank: 2

credits
82
Published in 2016-3-9 02:02:08 | Show all floors
Edited by tkk at 2016-3-9 02:04
jernej replied at 2016-3-8 04:01
So this is still bitbanged.

However, in latest Pine64 sources there are some traces how that can be ...

So if that document is correct the obfuscated register addresses for CEC would be:
  1. #define HDMI_CEC_CTRL       0x6f0
  2. #define HDMI_CEC_STAT       0x6f1
  3. #define HDMI_CEC_MASK       0x86f0
  4. #define HDMI_CEC_POLARITY   0x86f1
  5. #define HDMI_CEC_INT        0x6f2
  6. #define HDMI_CEC_ADDR_L     0x6f3
  7. #define HDMI_CEC_ADDR_H     0x86f2
  8. #define HDMI_CEC_TX_CNT     0x86f3
  9. #define HDMI_CEC_RX_CNT     0x46f0
  10. #define HDMI_CEC_TX_DATA0   0x6f4
  11. #define HDMI_CEC_TX_DATA1   0x6f5
  12. #define HDMI_CEC_TX_DATA2   0x86f4
  13. #define HDMI_CEC_TX_DATA3   0x86f5
  14. #define HDMI_CEC_TX_DATA4   0x6f6
  15. #define HDMI_CEC_TX_DATA5   0x6f7
  16. #define HDMI_CEC_TX_DATA6   0x86f6
  17. #define HDMI_CEC_TX_DATA7   0x86f7
  18. #define HDMI_CEC_TX_DATA8   0x46f4
  19. #define HDMI_CEC_TX_DATA9   0x46f5
  20. #define HDMI_CEC_TX_DATA10  0xc6f4
  21. #define HDMI_CEC_TX_DATA11  0xc6f5
  22. #define HDMI_CEC_TX_DATA12  0x46f6
  23. #define HDMI_CEC_TX_DATA13  0x46f7
  24. #define HDMI_CEC_TX_DATA14  0xc6f6
  25. #define HDMI_CEC_TX_DATA15  0xc6f7
  26. #define HDMI_CEC_RX_DATA0   0x26f0
  27. #define HDMI_CEC_RX_DATA1   0x26f1
  28. #define HDMI_CEC_RX_DATA2   0xa6f0
  29. #define HDMI_CEC_RX_DATA3   0xa6f1
  30. #define HDMI_CEC_RX_DATA4   0x26f2
  31. #define HDMI_CEC_RX_DATA5   0x26f3
  32. #define HDMI_CEC_RX_DATA6   0xa6f2
  33. #define HDMI_CEC_RX_DATA7   0xa6f3
  34. #define HDMI_CEC_RX_DATA8   0x66f0
  35. #define HDMI_CEC_RX_DATA9   0x66f1
  36. #define HDMI_CEC_RX_DATA10  0xe6f0
  37. #define HDMI_CEC_RX_DATA11  0xe6f1
  38. #define HDMI_CEC_RX_DATA12  0x66f2
  39. #define HDMI_CEC_RX_DATA13  0x66f3
  40. #define HDMI_CEC_RX_DATA14  0xe6f2
  41. #define HDMI_CEC_RX_DATA15  0xe6f3
  42. #define HDMI_CEC_LOCK       0x26f4
  43. #define HDMI_CEC_WKUPCTRL   0x26f5
Copy code




We still don't have the PHY addresses though.
I tried to create a kernel module that would read from some of the registers but I don't know how to get the actual base address?
Linux drivers aren't my thing...

4

threads

1118

posts

9141

credits

Moderator

Rank: 7Rank: 7Rank: 7

credits
9141
Published in 2016-3-9 06:03:30 | Show all floors
Edited by jernej at 2016-3-8 23:04
tkk replied at 2016-3-8 19:02
So if that document is correct the obfuscated register addresses for CEC would be:

You are correct. I also decompiled binary blobs libhdmi_sun50iw1 and libhdmi_sun8iw11 located in drivers/video/sunxi/disp2/hdmi:
  1. int bsp_hdmi_cec_get_simple_msg(unsigned char *msg)
  2. {
  3.   int ret = -1;

  4.   hdmi_write(0x1003Cu, 4u);
  5.   hdmi_write(0x10010u, 0x45u);
  6.   hdmi_write(0x10011u, 0x45u);
  7.   hdmi_write(0x10012u, 0x52u);
  8.   hdmi_write(0x10013u, 0x54u);
  9.   hdmi_write(0x6f3u,   0xffu);
  10.   hdmi_write(0x86f2u,  0xffu);
  11.   hdmi_read(0);

  12.   if(hdmi_read(0x26f4) & 1)
  13.   {
  14.     *msg = hdmi_read(0x26f1);
  15.     hdmi_write(0x26F4u, 0);
  16.     ret = 0;
  17.   }

  18.   hdmi_read(0);
  19.   hdmi_write(0x10010u, 0x52u);
  20.   hdmi_write(0x10011u, 0x54u);
  21.   hdmi_write(0x10012u, 0x41u);
  22.   hdmi_write(0x10013u, 0x57u);

  23.   return ret;
  24. }
Copy code

Only difference is that libhdmi_sun8iw11 doesn't have lines 10 and 11.

Whole code does kind of sense for me, but I'm not sure why those reads from zero offset are.

You can also find these two defines if you include <mach/platform.h>
  1. #define SUNXI_HDMI_PBASE                0x01ee0000
  2. #define SUNXI_HDMI_VBASE                IO_ADDRESS(SUNXI_HDMI_PBASE           )
Copy code


0

threads

9

posts

82

credits

Registered member

Rank: 2

credits
82
Published in 2016-3-9 20:11:14 | Show all floors
jernej replied at 2016-3-9 06:03
You are correct. I also decompiled binary blobs libhdmi_sun50iw1 and libhdmi_sun8iw11 located in dr ...

Thanks, this would be it. If I try to use SUNXI_HDMI_VBASE I still get error though:
  1. error: implicit declaration of function IOMEM
Copy code
I tried including mach/hardware.h aswell, but I still get the error?

4

threads

1118

posts

9141

credits

Moderator

Rank: 7Rank: 7Rank: 7

credits
9141
Published in 2016-3-10 00:36:32 | Show all floors
tkk replied at 2016-3-9 13:11
Thanks, this would be it. If I try to use SUNXI_HDMI_VBASE I still get error though: I tried inclu ...

I'm not sure why it doesn't work for you. You can find my current attempt in attachment - modified imx6 cec driver, but sadly, doesn't work. If same interface is kept, then libcec would work with only few additional patches, which are already available.

This thread contains more resources

You need to Log in to download or view,No account?    Register

x

4

threads

1118

posts

9141

credits

Moderator

Rank: 7Rank: 7Rank: 7

credits
9141
Published in 2016-3-11 02:50:42 | Show all floors
zhao_steven kindly provided source kode of bitbanged driver (https://github.com/jernejsk/Open ... i-cec-support.patch) I will try it in following days. I think that libcec is not needed, only some soldering, unfortunately.

0

threads

9

posts

82

credits

Registered member

Rank: 2

credits
82
Published in 2016-3-16 00:48:38 | Show all floors
jernej replied at 2016-3-11 02:50
zhao_steven kindly provided source kode of bitbanged driver (https://github.com/jernejsk/OpenELEC-OP ...

I could also test this if I can figure out where to cut a trace and solder. I'm thinking it won't work if the CEC pin from hdmi connector is connected directly to GPIO (0ohm resistor), there is at least need for proper pull-up. Sadly the driver seems to include only basic functionality. If we want to effectively use the TV remote as a remote controller, libCEC is still needed, because different TVs have different handshakes etc. This is the "hard" part of CEC, which libcec would provide out of the box.

4

threads

1118

posts

9141

credits

Moderator

Rank: 7Rank: 7Rank: 7

credits
9141
Published in 2016-3-16 03:08:03 | Show all floors
tkk replied at 2016-3-15 17:48
I could also test this if I can figure out where to cut a trace and solder. I'm thinking it won't  ...

Yeah, I also change my mind after some discussion and I think that trace should be cut right before CPU (after mosfet, HCEC signal).

Currently I don't see any sensible way to connect this driver to libcec. The driver can be modified to ease interfacing, though. AFAIK, handshake is hardcoded inside this driver.

11

threads

286

posts

1919

credits

Moderator

Rank: 7Rank: 7Rank: 7

credits
1919
Published in 2016-5-29 22:35:24 | Show all floors
Edited by melanrz at 2016-5-29 22:38

the cut and solder on board its not good idea so i solder cec pin directly to hdmi cable with breadboard cable and cut this pin in hdmi female so no connection between tv-h3 only tv-pin.Openelec not work,zidoo x1 not work,used pa14 and pa21.Please give me some directio i can test it.

This thread contains more resources

You need to Log in to download or view,No account?    Register

x
You need to log in before you can reply login | Register

Points Rule

Quick reply Top Return list