[Q] GT-I930x: State of HDMI/MHL implementation for AOSP based ROMs

scholbert

Senior Member
Aug 1, 2007
1,347
812
0
Hi folks,

i did a little research these days and tried to sort out,
what in fact is missing to make HDMI/MHL work in AOSP based ROMs for the S3 series.

It is really hard to find some useful stuff about it.
All i noticed were some ancient posts about attaching MHL cable causing reboots.
Everyone keeps repeating MHL will not work on AOSP.
I know that HDMI/MHL is weird stuff and reference manual for MHL transceiver SII9244 is not available.
On the other hand this chip is only working as a phy and should be set up correctly at kernel level.

I also know that there'd been many attempts to make it work but i am to dumb to find some reference to tech talks about it.

So it really seems that most parts are implemented and ready to be put together.
At least that's the way it seems to me... and might be bit noobish of course.

Anyway i found something, which might be another key to solve this issue.

Some snippets from the sources at kernel level.
mach-midas.c:

Code:
#ifdef CONFIG_SAMSUNG_MHL
/* I2C15 */
static struct i2c_gpio_platform_data gpio_i2c_data15 = {
    .sda_pin = GPIO_MHL_SDA_1_8V,        /* GPB2, I2C5_SDA */
    .scl_pin = GPIO_MHL_SCL_1_8V,        /* GPB3, I2C5_SCL */
    .udelay = 3,
    .timeout = 0,
};

struct platform_device s3c_device_i2c15 = {
    .name = "i2c-gpio",
    .id = 15,
    .dev = {
        .platform_data = &gpio_i2c_data15,
    }
};

static struct i2c_board_info i2c_devs15_emul[] __initdata = {
};

/* I2C16 */
#if !defined(CONFIG_MACH_T0) && !defined(CONFIG_MACH_M3) \
    && !defined(CONFIG_MACH_GD2)
static struct i2c_gpio_platform_data gpio_i2c_data16 = {
    .sda_pin = GPIO_MHL_DSDA_2_8V,
    .scl_pin = GPIO_MHL_DSCL_2_8V,
};

struct platform_device s3c_device_i2c16 = {
    .name = "i2c-gpio",
    .id = 16,
    .dev.platform_data = &gpio_i2c_data16,
};
#endif /* !defined(CONFIG_MACH_T0) */

static struct i2c_board_info i2c_devs16_emul[] __initdata = {
};
#endif
midas-mhl.c:
Code:
static int __init midas_mhl_init(void)
{
    int ret;
#define I2C_BUS_ID_MHL  15
    ret = i2c_add_devices(I2C_BUS_ID_MHL, i2c_devs_sii9234,
            ARRAY_SIZE(i2c_devs_sii9234));

    if (ret < 0) {
        printk(KERN_ERR "[MHL] adding i2c fail - nodevice\n");
        return -ENODEV;
    }
#if defined(CONFIG_MACH_T0_EUR_OPEN) || defined(CONFIG_MACH_T0_CHN_OPEN)
    sii9234_pdata.ddc_i2c_num = 6;
#elif defined(CONFIG_MACH_P4NOTE) || defined(CONFIG_MACH_SP7160LTE) || defined(CONFIG_MACH_T0) \
     || defined(CONFIG_MACH_KONA) || defined(CONFIG_MACH_TAB3) || \
    defined(CONFIG_MACH_GD2) || defined(CONFIG_MACH_GC2PD)
    sii9234_pdata.ddc_i2c_num = 5;
#else
    sii9234_pdata.ddc_i2c_num = (system_rev == 3 ? 16 : 5);
#endif

#ifdef CONFIG_MACH_SLP_PQ_LTE
    sii9234_pdata.ddc_i2c_num = 16;
#endif
    ret = i2c_add_devices(sii9234_pdata.ddc_i2c_num, &i2c_dev_hdmi_ddc, 1);
    if (ret < 0) {
        printk(KERN_ERR "[MHL] adding ddc fail - nodevice\n");
        return -ENODEV;
    }

    return 0;
}

This could be found in the AOSP source trees of the Android hal:
https://github.com/omnirom/android_...ynos4/hal/libhdmi/libsForhdmi/libddc/libddc.c

Code:
/**
* @brief DDC device name.
* User should change this.
*/
#ifdef DDC_CH_I2C_1
#define DEV_NAME "/dev/i2c-1"
#endif
#ifdef DDC_CH_I2C_2
#define DEV_NAME "/dev/i2c-2"
#endif
#ifdef DDC_CH_I2C_7
#define DEV_NAME "/dev/i2c-7"
#endif
So i really wonder if someone ever tried to add device "i2c-15" here and compile.

See the implementation for odroid-u3 here as well (which is the base for NamelessROM):
https://github.com/codewalkerster/android_hardware_samsung_slsi_exynos4

Additionally this should be added to the S3 BoardConfig.mk then:
Code:
BOARD_USES_HDMI_SUBTITLES := true
BOARD_USES_HDMI := true
BOARD_HDMI_STD := STD_720P
BOARD_HDMI_DDC_CH := DDC_CH_I2C_15
BOARD_USES_FIMGAPI := true
Please leave some comments and help me to understand what in fact is missing to watch TV with AOSP ROMs :angel:

Regards,

scholbert
 
Last edited:

scholbert

Senior Member
Aug 1, 2007
1,347
812
0
Hi [email protected],

thanks for your reply!
I'll try to contact codeworkx, though it seems he had not only left CM team but XDA-devs as well.

That'd be awesome thing having HDMI/MHL out in AOSP. That's the main reason why I'm using stock rom. @codeworkx is the guy you need to talk to but he's no longer in the cyanogenmod team.
Anyway, i know that there are many parts of code involved to make the MHL interface work, so the main part for me is to know about the missing link.
I guess i'll try to get a better understanding about the kernel side the next days, as there are:
- do we have all parts to map the virtual I2C port for SII9244
- does the initialization of the SII9244 look complete
- what's the state of the HPD GPIO

Next would be of course, to understand how the interaction of framebuffer mapping takes place.
There's the GPU MALI stuff which uses parts of RAM and some framebuffer as well :p
The internal HDMI logic of Exynos needs some mapping of course to get access to this memory.
This could be the most complex part and maybe this information is missing or done by proprietary stuff...

Let's see if we could get more detailed information about it in the next weeks.
So please help out with useful comments :eek:

Best regards,

scholbert
 
Last edited:

scholbert

Senior Member
Aug 1, 2007
1,347
812
0
Hi there,

again thanks for the reply so far.
I did some further research on this issue on my own....
- Yes, there are proprietary files which handle HDMI (TVOUT) in stock ROMs
- Yes, these libs and services do not seem to match the AOSP implementation

After some investigation on the proprietary files and searching for some ASCII snippets in the binaries, it seems that at least some parts, or better call it functionality, is covered in the HAL present in the AOSP source tree, which had been released for the SMDK4412.
My guessing is that the "framework" is little different in these sources and some of the libraries of the AOSP version have other names, if we manage to compile them.
I still wonder, if someone did ever try to set all necessary compile flags for HDMI and give it a try with the settings i posted in my first thread. So i guess i'll have to do it...

Maybe it's all nonsense and the sources of Exynos HAL which are used by the AOSP ROMs are completely unusable, if it comes to HDMI implementation.
On the other hand there's Hardkernel's odroid platform which has a working HDMI port.
So what's the secret here?

Cheers,

scholbert
 

scholbert

Senior Member
Aug 1, 2007
1,347
812
0
Hi DerTeufel1980,

thanks for pointing to this patchset... i've already seen some other related patches some days ago.
Looks promising and hopefully this time these hacks will be successful!

Though i'm not sure about the management of the i2c ports at kernel level or maybe i just don't understand its mapping.
While it is correct that the MHL PHY is connected to the physical interface i2c-5 (the pins), it seems that the kernel uses some virtualisation based on the devices address connected to this port...
AFAIK Exynos 4412 got five physical I2C ports, which are used by a variety of physical devices (the real chips).
Each physical device should have a unique i2c address to get addressed by the CPU.
In the end we got multiple chips with different addresses connected to the physical ports which are presented as virtual device starting from i2c-0 up to i2c-21.

So if i interpret the sources correctly, the device id for DDC function should be i2c-15 at userland, or better spoken: Android world.
But as already stated maybe i'm wrong here...
Time will show :eek:

Thanks for contributing!!

EDIT:
Just contacted one of the hard working developers at Nameless ROM and he pointed me to another more frustrating issue, which is the missing source code for HWC.
See this information (which is quite old, but you need to find it :p ) which covers the Exynos CPU's in general:
https://plus.google.com/+AndrewDodd/posts/DHg5z62CHHu

So this snippet says it all:
Edit - HDMI
Insignal's latest reference source has new HDMI code. However, it's tightly integrated with HWC. As covered above, HWC is totally broken in their source release. No HWC, no HDMI.
EDIT2:
Some more tech talk to understand the flaw:
https://jira.cyanogenmod.org/browse/ESDB-1

Cheers,

scholbert
 
Last edited:

scholbert

Senior Member
Aug 1, 2007
1,347
812
0
Hey there... it's me again :eek:

I thought about missing source code and how all stuff get's arranged in the variety of ROM's.
Especially MALI, HWC and proprietary stuff...
Quite irritating though because i'm no hardcore software developer :angel:
Anyway found this:
http://forum.xda-developers.com/showpost.php?p=55809089&postcount=1508

In other words, there is some HWC source code for exynos4.
Why was it dropped then and latest release of Nameless Lollipop ROM stepped back to the older MALI release?
This led to a more proprietary codebase.

I read about r4p0 would not be the best choice for mobile device or is there another reason :confused:

Please leave a comment, if you know more about it.
Would be nice to have some open discussion here anyway...

Have fun!

scholbert
 

KNIGHT97

Senior Member
Jan 30, 2014
2,111
1,635
0
Mumbai
The problem came with r4p0 when the proprietary HWC blob was made working with the kernel rebase from fni1 source drop of n7100. The amount of glitches occurring were too high, and the r4p0 drivers used in the device were blobs. There aren't any display related open source Hals for exynos to have a reference from and fix the graphics part having glitches.
As is already notable with chrome, GPU rasterization is broken and had even more issues with newer blobs, which actually even I'm not sure of why so. R3p2 drivers we use actually are based on a newer api as compared to r4p0 and as a result, the blobs are more updated than the r4p0 taken from the Odroid board.

̿ ̿̿’̿’\̵͇̿̿\з==(*͡° ͜ʖ ͡°)==ε/̵͇̿̿/’̿’̿ ̿ ̿̿*
 
Our Apps
Get our official app!
The best way to access XDA on your phone
Nav Gestures
Add swipe gestures to any Android
One Handed Mode
Eases uses one hand with your phone