How to make non-inverting HDMI Hot plug detect work?

My problem is the same as this:
https://devtalk.nvidia.com/default/topic/949226/jetson-tx1/hdmi-hot-plug-detect/

I am running TX1 24.2.1, I have non-inverted HDMI hot plug detect level shifter, which is supposed to be supported, according to “OEM Product design guide”.
But it does not work. When monitor is attached, it prints “hdmi: unplugged”, when monitor is detached, it prints “hdmi: plugged”.
I tried the pinmux change, as explained in https://devtalk.nvidia.com/default/topic/949226/jetson-tx1/hdmi-hot-plug-detect/, but it does not work.
In fact, I beleive that it cannot work because all that pinmux does is adding a PU (Pull Up) on that line, but that does not cause logic inversion.
That Pull Up only could have an effect when line is not driven by anybody else, but it is in fact being driven by the level shifter and, therefore, Pull Up has no effect.

Could you, please, explain what this phrase “HPD level shifter can be non-inverting or inverting.” in “OEM Product design guide” means and how to configure non-inverting HPD?

Thank you

Could you print the state of hpd under dc.c “tegra_dc_hpd()” ?

Also, for more info inside hpd ops, you could check the logic in hdmi2.0.c “tegra_dc_hdmi_hpd_state()”.

I am not sure, do you want me to add extra prints to your driver and rebuild kernel?

For now I did the following:

  1. Boot with monitor plugged, then
    dmesg | grep hdmi
    [ 1.264763] vdd-hdmi-dp: 1050 mV with ramp delay 100000 uV/us ; Rail ON
    [ 1.270779] vdd-hdmi-dp: supplied by vdd-pre-reg
    [ 2.556816] of_dc_parse_platform_data: nvidia,hdmi-vrr-caps not present
    [ 2.587866] hdmi: couldn’t get regulator vdd_hdmi_5v0

sudo cat /sys/kernel/debug/tegra_hdmi/hdmi_status
hotplug state: 0
SCDC present: 0
Forum VSDB present: 0
YCbCr4:2:0 VDB present: 0

sudo cat /sys/kernel/debug/tegra_hdmi/hotplug
hdmi hpd state: 0

sudo cat /sys/kernel/debug/tegradc.1/hotplug
0

  1. Unplug monitor
    dmesg
    [ 107.201423] tegra-i2c 7000c700.i2c: no acknowledge from address 0x50
    [ 107.202256] tegra-i2c 7000c700.i2c: no acknowledge from address 0x50
    [ 107.269634] tegradc tegradc.1: hdmi: edid read failed
    [ 107.277606] tegradc tegradc.1: hdmi: using fallback edid
    [ 107.202256] tegra-i2c 7000c700.i2c: no acknowledge from address 0x50
    [ 107.269634] tegradc tegradc.1: hdmi: edid read failed
    [ 107.277606] tegradc tegradc.1: hdmi: using fallback edid
    [ 107.285602] tegradc tegradc.1: vrr_setup failed
    [ 107.286734] tegradc tegradc.1: hdmi: plugged
    [ 107.291369] tegradc tegradc.1: blank - powerdown

sudo cat /sys/kernel/debug/tegra_hdmi/hdmi_status
hotplug state: 1
SCDC present: 0
Forum VSDB present: 0
YCbCr4:2:0 VDB present: 0

sudo cat /sys/kernel/debug/tegradc.1/hotplug
0

  1. Plug monitor
    dmesg
    [ 263.751929] tegradc tegradc.1: hdmi: unplugged
    [ 263.756669] tegradc tegradc.1: blank - powerdown

sudo cat /sys/kernel/debug/tegra_hdmi/hdmi_status
hotplug state: 0
SCDC present: 0
Forum VSDB present: 0
YCbCr4:2:0 VDB present: 0

sudo cat /sys/kernel/debug/tegradc.1/hotplug
0

So, as I wrote before, hotplug state reported by the driver is opposite to what it really is.

Question is how to make it straight without patching the driver?

Note: I do know that I can force it to “plugged” state using
sudo sh -c ‘echo 1 > /sys/kernel/debug/tegra_hdmi/hotplug’
but that will disable hot plug detection, so this is not acceptable.

Hi,

Yes, I was asking to add some extra debug print inside the driver.
If the driver shows opposite result, you could just invert it.

If the driver shows opposite result, you could just invert it.

Well, maintaining a modified driver has its costs. I hoped to avoid it.
When I read “HPD level shifter can be non-inverting or inverting.” in “OEM Product design guide” I hoped that there is a setting somewhere, may be in dts.
So, you are saying that there is no solution for that other than modifying the driver?
Thank you

You could also try to change “nvidia,out-flags=<TEGRA_DC_OUT_HOTPLUG_LOW>” to <TEGRA_DC_OUT_HOTPLUG_HIGH> inside your hdmi-display in dts.

Yes, this worked:
hdmi-display {

changed
nvidia,out-flags = <0x2>;
to
nvidia,out-flags = <0x0>;

And now hotplug is correct

Thank you