-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
rockchip64: fix wrong GPIO direction in DP virtual extcon driver #7857
rockchip64: fix wrong GPIO direction in DP virtual extcon driver #7857
Conversation
On my rk3399 board (OrangePi 4 LTS) the HDMI is also wired through DP Alt, but the driver is not needed AFAIK. As far as I can remember, this was the patch to make it work. Actually I don't know if this driver or the other patch are "the right way to go" for mainline kernel, but it seems that the other way wires upon already existing things in the kernel and device trees. I have nothing against this solution, but your mileage may vary in the future if this is "non-standard". |
My board was bought from the second-hand market, and there is no specific schematic diagram. I extracted the dtb of the BSP kernel from the original Android system, then decompiled it into dts, and rewritten the dts of the mainline kernel version. In the dts I wrote, enabling the HDMI node does not make the board's HDMI work. In the decompiled dts, there is such a node:
I googled At this time, I realized that the HDMI physical interface on the board is not native, but converted from USB Type-C. This USB Type-C is designed to fixedly output DP signals, and it does not have a Type-C control chip similar to FUSB302. It only uses a GPIO to detect whether the HDMI cable is inserted. The function of the above patch is to tell the cdn-dp driver of RK3399 to output the DP signal at the appropriate time (GPIO is pulled low). It seems like this patch was not accepted by the mainline kernel, but I found it in Armbian's repository and tried using it, and it worked fine on my board. I found that a similar driver exists for rockchip's BSP kernel. It is the driver originally used by the Android system of my board. It should come from the rockchip manufacturer. |
Ok now I understand it better and looking again at the diff, I see that your change is swapping the gpio default from I have two doubts though:
|
I was ashamed that I forgot to set the GPIO pinctrl to input in dts, so when I got home I immediately set it in dts:
Then recompile the dtb and upload it to the board to overwrite the old one. After booting, I confirmed that the changes took effect.
You can see that dp-hpd is indeed configured as input and pulled up. At this time, I changed the gpio request function in the driver back to GPIOD_OUT_LOW, recompiled and loaded it, but it still failed:
Change GPIOD_OUT_LOW in the driver to GPIOD_IN and it will return to normal. According to the error message, I guess that although the default initial state of GPIO is set in dts, Regarding the second point, your concerns are correct, but unfortunately I do not have the Rockpi 4C held by the patch author (the DT binding document example of this patch uses SBC). I don’t know whether my modification will destroy the original HDMI function, but searching for the words |
Did you try with Now I had the chance to verify in the armbian codebase, and it looks to me that no board is actually using this driver. |
I set the GPIO's pinctrl as input in dts, then requested it using the GPIOD_ASIS flag in the driver, and it worked! I'll modify the PR |
The extcon-usbc-virtual-pd driver requests the detection GPIO with the flag GPIOD_OUT_LOW, which leads to a failure in gpiod_to_irq and consequently causes the driver loading to fail. This issue can be fixed by changing GPIOD_OUT_LOW to either GPIOD_IN or GPIOD_ASIS. This patch opts to change GPIOD_OUT_LOW to GPIOD_ASIS, as this is a less invasive approach. For devices intending to use this driver, it's also necessary to set the pinctrl property of the detection GPIO to input mode in the dts file.
c6414b5
to
7b98e61
Compare
Description
When I tried to light up the HDMI screen on a RK3399 Box, I found that it was actually driven by Type-C DP Alt mode. So I used the miniDP-virtual-extcon patch in the build repository.
Modify the device tree:
After compiling the miniDP-virtual-extcon driver and insmoding it, it reported an error:
Then I modified the det GPIO direction in the driver to input, recompiled and loaded it. The driver can be initialized and the HDMI screen also works normally. This is dmesg:
How Has This Been Tested?
Checklist: