Skip to contentSkip to conversation

video: rockchip: Add missing dpcd_write() call to link_train_ce()

PATCH New Alper Nebi Yasak 5 participants 14 messages Oct 6, 2020 – Oct 30, 2020

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 video: rockchip: Add missing dpcd_write() call to link_train_ce()

Found this by comparing it to the coreboot driver, a form of this call was introduced there in their commit b9a7877568cf ("rockchip/*: refactor edp driver"). This is copy-pasted from U-Boot's link_train_cr() slightly above it.

Without this on a gru-kevin chromebook, I have:

clock recovery at voltage 0 pre-emphasis 0
requested signal parameters: lane 0 voltage 0.4V pre_emph 3.5dB requested signal parameters: lane 1 voltage 0.4V pre_emph 3.5dB requested signal parameters: lane 2 voltage 0.4V pre_emph 3.5dB requested signal parameters: lane 3 voltage 0.4V pre_emph 3.5dB using signal parameters: voltage 0.4V pre_emph 3.5dB requested signal parameters: lane 0 voltage 0.4V pre_emph 3.5dB requested signal parameters: lane 1 voltage 0.4V pre_emph 3.5dB requested signal parameters: lane 2 voltage 0.4V pre_emph 3.5dB requested signal parameters: lane 3 voltage 0.4V pre_emph 3.5dB using signal parameters: voltage 0.4V pre_emph 3.5dB requested signal parameters: lane 0 voltage 0.4V pre_emph 3.5dB requested signal parameters: lane 1 voltage 0.4V pre_emph 3.5dB requested signal parameters: lane 2 voltage 0.4V pre_emph 3.5dB requested signal parameters: lane 3 voltage 0.4V pre_emph 3.5dB using signal parameters: voltage 0.4V pre_emph 3.5dB requested signal parameters: lane 0 voltage 0.4V pre_emph 3.5dB requested signal parameters: lane 1 voltage 0.4V pre_emph 3.5dB requested signal parameters: lane 2 voltage 0.4V pre_emph 3.5dB requested signal parameters: lane 3 voltage 0.4V pre_emph 3.5dB using signal parameters: voltage 0.4V pre_emph 3.5dB requested signal parameters: lane 0 voltage 0.4V pre_emph 3.5dB requested signal parameters: lane 1 voltage 0.4V pre_emph 3.5dB requested signal parameters: lane 2 voltage 0.4V pre_emph 3.5dB requested signal parameters: lane 3 voltage 0.4V pre_emph 3.5dB using signal parameters: voltage 0.4V pre_emph 3.5dB channel eq failed, ret=-5
link train failed!
rk_vop_probe() Device failed: ret=-5

With this, it looks like training succeeds:

clock recovery at voltage 0 pre-emphasis 0
requested signal parameters: lane 0 voltage 0.4V pre_emph 3.5dB requested signal parameters: lane 1 voltage 0.4V pre_emph 3.5dB requested signal parameters: lane 2 voltage 0.4V pre_emph 3.5dB requested signal parameters: lane 3 voltage 0.4V pre_emph 3.5dB using signal parameters: voltage 0.4V pre_emph 3.5dB requested signal parameters: lane 0 voltage 0.4V pre_emph 6dB requested signal parameters: lane 1 voltage 0.4V pre_emph 6dB requested signal parameters: lane 2 voltage 0.4V pre_emph 6dB requested signal parameters: lane 3 voltage 0.4V pre_emph 6dB using signal parameters: voltage 0.4V pre_emph 6dB requested signal parameters: lane 0 voltage 0.4V pre_emph 0dB requested signal parameters: lane 1 voltage 0.4V pre_emph 0dB requested signal parameters: lane 2 voltage 0.4V pre_emph 0dB requested signal parameters: lane 3 voltage 0.4V pre_emph 0dB using signal parameters: voltage 0.4V pre_emph 0dB channel eq at voltage 0 pre-emphasis 0
config video failed
rk_vop_probe() Device failed: ret=-110

The "config video failed" error also goes away when I disable higher log levels, and it claims to have successfully probed the device.

---
I'm testing this with a lot of other patches to make the board work. The actual tree I'm using is available here:

    https://github.com/alpernebbi/u-boot/commits/rk3399-gru-kevin/wip
    (currently at commit c0dc4b42afe770671ce7bb0dd519d894a3acdea0)
 drivers/video/rockchip/rk_edp.c | 6 ++++++
 1 file changed, 6 insertions(+)
drivers/video/rockchip/rk_edp.c +6 -0
index 000bd48140..a032eb6889 100644
@@ -559,6 +559,12 @@ static int rk_edp_link_train_ce(struct rk_edp_priv *edp)
 	channel_eq = 0;
 	for (tries = 0; tries < 5; tries++) {
 		rk_edp_set_link_training(edp, edp->train_set);
+		ret = rk_edp_dpcd_write(regs, DPCD_TRAINING_LANE0_SET,
+					edp->train_set,
+					edp->link_train.lane_count);
+		if (ret)
+			return ret;
+
 		udelay(400);
 
 		if (rk_edp_dpcd_read_link_status(edp, status) < 0) {
Signature · 1 line
2.28.0
#1 lore raw

PATCH 1/1 video: rockchip: Add missing dpcd_write() call to link_train_ce()

Quoted 68 lines · Alper Nebi Yasak

Found this by comparing it to the coreboot driver, a form of this call was introduced there in their commit b9a7877568cf ("rockchip/*: refactor edp driver"). This is copy-pasted from U-Boot's link_train_cr() slightly above it.

Without this on a gru-kevin chromebook, I have:

clock recovery at voltage 0 pre-emphasis 0
requested signal parameters: lane 0 voltage 0.4V pre_emph 3.5dB requested signal parameters: lane 1 voltage 0.4V pre_emph 3.5dB requested signal parameters: lane 2 voltage 0.4V pre_emph 3.5dB requested signal parameters: lane 3 voltage 0.4V pre_emph 3.5dB using signal parameters: voltage 0.4V pre_emph 3.5dB requested signal parameters: lane 0 voltage 0.4V pre_emph 3.5dB requested signal parameters: lane 1 voltage 0.4V pre_emph 3.5dB requested signal parameters: lane 2 voltage 0.4V pre_emph 3.5dB requested signal parameters: lane 3 voltage 0.4V pre_emph 3.5dB using signal parameters: voltage 0.4V pre_emph 3.5dB requested signal parameters: lane 0 voltage 0.4V pre_emph 3.5dB requested signal parameters: lane 1 voltage 0.4V pre_emph 3.5dB requested signal parameters: lane 2 voltage 0.4V pre_emph 3.5dB requested signal parameters: lane 3 voltage 0.4V pre_emph 3.5dB using signal parameters: voltage 0.4V pre_emph 3.5dB requested signal parameters: lane 0 voltage 0.4V pre_emph 3.5dB requested signal parameters: lane 1 voltage 0.4V pre_emph 3.5dB requested signal parameters: lane 2 voltage 0.4V pre_emph 3.5dB requested signal parameters: lane 3 voltage 0.4V pre_emph 3.5dB using signal parameters: voltage 0.4V pre_emph 3.5dB requested signal parameters: lane 0 voltage 0.4V pre_emph 3.5dB requested signal parameters: lane 1 voltage 0.4V pre_emph 3.5dB requested signal parameters: lane 2 voltage 0.4V pre_emph 3.5dB requested signal parameters: lane 3 voltage 0.4V pre_emph 3.5dB using signal parameters: voltage 0.4V pre_emph 3.5dB channel eq failed, ret=-5
link train failed!
rk_vop_probe() Device failed: ret=-5

With this, it looks like training succeeds:

clock recovery at voltage 0 pre-emphasis 0
requested signal parameters: lane 0 voltage 0.4V pre_emph 3.5dB requested signal parameters: lane 1 voltage 0.4V pre_emph 3.5dB requested signal parameters: lane 2 voltage 0.4V pre_emph 3.5dB requested signal parameters: lane 3 voltage 0.4V pre_emph 3.5dB using signal parameters: voltage 0.4V pre_emph 3.5dB requested signal parameters: lane 0 voltage 0.4V pre_emph 6dB requested signal parameters: lane 1 voltage 0.4V pre_emph 6dB requested signal parameters: lane 2 voltage 0.4V pre_emph 6dB requested signal parameters: lane 3 voltage 0.4V pre_emph 6dB using signal parameters: voltage 0.4V pre_emph 6dB requested signal parameters: lane 0 voltage 0.4V pre_emph 0dB requested signal parameters: lane 1 voltage 0.4V pre_emph 0dB requested signal parameters: lane 2 voltage 0.4V pre_emph 0dB requested signal parameters: lane 3 voltage 0.4V pre_emph 0dB using signal parameters: voltage 0.4V pre_emph 0dB channel eq at voltage 0 pre-emphasis 0
config video failed
rk_vop_probe() Device failed: ret=-110

The "config video failed" error also goes away when I disable higher log levels, and it claims to have successfully probed the device.

---
I'm testing this with a lot of other patches to make the board work. The actual tree I'm using is available here:

Quoted 6 lines
    https://github.com/alpernebbi/u-boot/commits/rk3399-gru-kevin/wip
    (currently at commit c0dc4b42afe770671ce7bb0dd519d894a3acdea0)
 drivers/video/rockchip/rk_edp.c | 6 ++++++
 1 file changed, 6 insertions(+)
#2 lore raw

PATCH 1/1 video: rockchip: Add missing dpcd_write() call to link_train_ce()

Quoted 10 lines · Simon Glass
Quoted 7 lines · Alper Nebi Yasak

Found this by comparing it to the coreboot driver, a form of this call was introduced there in their commit b9a7877568cf ("rockchip/*: refactor edp driver"). This is copy-pasted from U-Boot's link_train_cr() slightly above it.

Simon, I noticed the coreboot driver is GPL-2.0-only, but the U-Boot driver is GPL-2.0+, is that a problem for this patch?

They also seem to be almost the same especially in their earlier revisions (even had the same typos in some comments). It could be good to sync the two drivers to pick improvements from it e.g. support for rk3399 (though there's an RFC series for that [1]), but the license difference makes it difficult. Could the coreboot parts be relicensed to GPL-2.0+ by Google and/or Rockchip? Alternatively, is it OK to change the U-Boot one to GPL-2.0-only to sync things from coreboot?

[1] https://patchwork.ozlabs.org/project/uboot/list/?series=204229&state=*

#3 lore raw

PATCH 1/1 video: rockchip: Add missing dpcd_write() call to link_train_ce()

Hi Alper,

Quoted 16 lines · Alper Nebi Yasak
Quoted 10 lines · Simon Glass
Quoted 7 lines · Alper Nebi Yasak

Found this by comparing it to the coreboot driver, a form of this call was introduced there in their commit b9a7877568cf ("rockchip/*: refactor edp driver"). This is copy-pasted from U-Boot's link_train_cr() slightly above it.

Simon, I noticed the coreboot driver is GPL-2.0-only, but the U-Boot driver is GPL-2.0+, is that a problem for this patch?

Quoted 7 lines

They also seem to be almost the same especially in their earlier revisions (even had the same typos in some comments). It could be good to sync the two drivers to pick improvements from it e.g. support for rk3399 (though there's an RFC series for that [1]), but the license difference makes it difficult. Could the coreboot parts be relicensed to GPL-2.0+ by Google and/or Rockchip? Alternatively, is it OK to change the U-Boot one to GPL-2.0-only to sync things from coreboot?

I think it is OK to change the file to GPL2. I'm not sure if changing coreboot parts to 2.0+ is an option. I believe the use of 2+ in U-Boot is for fairly narrow reasons, but I'm not sure if that is documented anywhere.

+Tom Rini might have a comment

Quoted 2 lines

[1] https://patchwork.ozlabs.org/project/uboot/list/?series=204229&state=*

Regards,
Simon

#4 lore raw

PATCH 1/1 video: rockchip: Add missing dpcd_write() call to link_train_ce()

Quoted 27 lines · Simon Glass

Hi Alper,

Quoted 16 lines · Alper Nebi Yasak
Quoted 10 lines · Simon Glass
Quoted 7 lines · Alper Nebi Yasak

Found this by comparing it to the coreboot driver, a form of this call was introduced there in their commit b9a7877568cf ("rockchip/*: refactor edp driver"). This is copy-pasted from U-Boot's link_train_cr() slightly above it.

Simon, I noticed the coreboot driver is GPL-2.0-only, but the U-Boot driver is GPL-2.0+, is that a problem for this patch?

Quoted 7 lines

They also seem to be almost the same especially in their earlier revisions (even had the same typos in some comments). It could be good to sync the two drivers to pick improvements from it e.g. support for rk3399 (though there's an RFC series for that [1]), but the license difference makes it difficult. Could the coreboot parts be relicensed to GPL-2.0+ by Google and/or Rockchip? Alternatively, is it OK to change the U-Boot one to GPL-2.0-only to sync things from coreboot?

Quoted 6 lines

I think it is OK to change the file to GPL2. I'm not sure if changing coreboot parts to 2.0+ is an option. I believe the use of 2+ in U-Boot is for fairly narrow reasons, but I'm not sure if that is documented anywhere.

+Tom Rini might have a comment

Ugh. In so far as anything can be re-licensed, who did it all originally? I suspect coreboot isn't interested in 2.0+ but we can do 2.0-only.

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 659 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20201014/f45263c8/attachment.sig>
#5 lore raw

PATCH 1/1 video: rockchip: Add missing dpcd_write() call to link_train_ce()

Quoted 11 lines · Tom Rini
Quoted 6 lines · Simon Glass

I think it is OK to change the file to GPL2. I'm not sure if changing coreboot parts to 2.0+ is an option. I believe the use of 2+ in U-Boot is for fairly narrow reasons, but I'm not sure if that is documented anywhere.

+Tom Rini might have a comment

Ugh. In so far as anything can be re-licensed, who did it all originally? I suspect coreboot isn't interested in 2.0+ but we can do 2.0-only.

For this patch, coreboot commit b9a7877568cf ("rockchip/*: refactor edp driver") introduces the related change to src/soc/rockchip/common/edp.c renamed from .../rk3288/edp.c, which was introduced at coreboot commit 40f558e8f4f7 ("rockchip: support display").

    $ git shortlog -s -e b9a7877568cf -- src/soc/rockchip/{common,rk3288}/edp.c
Quoted 5 lines
    2  Julius Werner <[email protected]>
    1  Lin Huang <[email protected]>
    1  Patrick Georgi <[email protected]>
    1  Patrick Georgi <[email protected]>
    4  huang lin <[email protected]>

The sign-offs are:

    $ git log b9a7877568cf -- src/soc/rockchip/{common,rk3288}/edp.c \
        | grep -i "Signed-off-by:" | sort -u
Quoted 5 lines

That file at that refactor-commit has two more fixes I'm interested in, and it's not the only file things could be ported from. If I run the above on a wider list of files upto current master I get 16 authors or 20 signoffs with duplicates (including e.g. original-signed-off-by), most of them either @google.com, @chromium.org, or @rock-chips.com.

    $ git shortlog -s -e -- src/soc/rockchip/{common,rk3288,rk3399}/{include/soc/,include/,}{edp,vop,display,mipi}{.c,.h}
Quoted 8 lines
    1  Angel Pons <[email protected]>
    1  Arthur Heymans <[email protected]>
    3  David Hendricks <[email protected]>
    1  Ege Mihmanli <[email protected]>
   15  Elyes HAOUAS <[email protected]>
    1  Jacob Garber <[email protected]>
    7  Julius Werner <[email protected]>
    1  Ky?sti M?lkki <[email protected]>
Quoted 8 lines
   13  Lin Huang <[email protected]>
    1  Martin Roth <[email protected]>
    2  Nickey Yang <[email protected]>
    1  Patrick Georgi <[email protected]>
    3  Patrick Georgi <[email protected]>
    2  Shunqian Zheng <[email protected]>
    2  Yakir Yang <[email protected]>
    5  huang lin <[email protected]>
    $ git log -- src/soc/rockchip/{common,rk3288,rk3399}/{include/soc/,include/,}{edp,vop,display,mipi}{.c,.h} \
        | grep -i "Signed-off-by:" | sort -u
Quoted 12 lines
Quoted 8 lines

(There's also hdmi{.c,.h} licensed w/ GPL-2.0-or-later, and clock{.c,.h} for which the U-Boot counterpart is already "GPL-2.0" assuming thats GPL-2.0-only, so I've excluded both.)

#6 lore raw

PATCH 1/1 video: rockchip: Add missing dpcd_write() call to link_train_ce()

Quoted 82 lines · Alper Nebi Yasak
Quoted 11 lines · Tom Rini
Quoted 6 lines · Simon Glass

I think it is OK to change the file to GPL2. I'm not sure if changing coreboot parts to 2.0+ is an option. I believe the use of 2+ in U-Boot is for fairly narrow reasons, but I'm not sure if that is documented anywhere.

+Tom Rini might have a comment

Ugh. In so far as anything can be re-licensed, who did it all originally? I suspect coreboot isn't interested in 2.0+ but we can do 2.0-only.

For this patch, coreboot commit b9a7877568cf ("rockchip/*: refactor edp driver") introduces the related change to src/soc/rockchip/common/edp.c renamed from .../rk3288/edp.c, which was introduced at coreboot commit 40f558e8f4f7 ("rockchip: support display").

    $ git shortlog -s -e b9a7877568cf -- src/soc/rockchip/{common,rk3288}/edp.c
Quoted 5 lines
    2  Julius Werner <[email protected]>
    1  Lin Huang <[email protected]>
    1  Patrick Georgi <[email protected]>
    1  Patrick Georgi <[email protected]>
    4  huang lin <[email protected]>

The sign-offs are:

    $ git log b9a7877568cf -- src/soc/rockchip/{common,rk3288}/edp.c \
        | grep -i "Signed-off-by:" | sort -u
Quoted 5 lines

That file at that refactor-commit has two more fixes I'm interested in, and it's not the only file things could be ported from. If I run the above on a wider list of files upto current master I get 16 authors or 20 signoffs with duplicates (including e.g. original-signed-off-by), most of them either @google.com, @chromium.org, or @rock-chips.com.

    $ git shortlog -s -e -- src/soc/rockchip/{common,rk3288,rk3399}/{include/soc/,include/,}{edp,vop,display,mipi}{.c,.h}
Quoted 8 lines
    1  Angel Pons <[email protected]>
    1  Arthur Heymans <[email protected]>
    3  David Hendricks <[email protected]>
    1  Ege Mihmanli <[email protected]>
   15  Elyes HAOUAS <[email protected]>
    1  Jacob Garber <[email protected]>
    7  Julius Werner <[email protected]>
    1  Ky?sti M?lkki <[email protected]>
Quoted 8 lines
   13  Lin Huang <[email protected]>
    1  Martin Roth <[email protected]>
    2  Nickey Yang <[email protected]>
    1  Patrick Georgi <[email protected]>
    3  Patrick Georgi <[email protected]>
    2  Shunqian Zheng <[email protected]>
    2  Yakir Yang <[email protected]>
    5  huang lin <[email protected]>
    $ git log -- src/soc/rockchip/{common,rk3288,rk3399}/{include/soc/,include/,}{edp,vop,display,mipi}{.c,.h} \
        | grep -i "Signed-off-by:" | sort -u
Quoted 12 lines
Quoted 8 lines
Quoted 3 lines

(There's also hdmi{.c,.h} licensed w/ GPL-2.0-or-later, and clock{.c,.h} for which the U-Boot counterpart is already "GPL-2.0" assuming thats GPL-2.0-only, so I've excluded both.)

Right, sorry. I mean, on the U-Boot side, where did things come from? I wonder how we got a different license text, and perhaps if we shouldn't just re-port the coreboot code over as a clean/clear way to re-license it to GPL-2.0-only.

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 659 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20201014/606a4a01/attachment.sig>
#7 lore raw

PATCH 1/1 video: rockchip: Add missing dpcd_write() call to link_train_ce()

Quoted 11 lines · Tom Rini
Quoted 9 lines · Alper Nebi Yasak
Quoted 3 lines · Tom Rini

Ugh. In so far as anything can be re-licensed, who did it all originally? I suspect coreboot isn't interested in 2.0+ but we can do 2.0-only.

For this patch, coreboot commit b9a7877568cf ("rockchip/*: refactor edp driver") introduces the related change to src/soc/rockchip/common/edp.c renamed from .../rk3288/edp.c, which was introduced at coreboot commit 40f558e8f4f7 ("rockchip: support display").

Quoted 4 lines

Right, sorry. I mean, on the U-Boot side, where did things come from? I wonder how we got a different license text, and perhaps if we shouldn't just re-port the coreboot code over as a clean/clear way to re-license it to GPL-2.0-only.

I'm not sure re-porting is a great idea from the technical perspective. I've been reading both drivers to compare them, there are also things in U-Boot that're missing from coreboot. Things like DM integration are also not there as they're U-Boot specific.

I checked some files with git log and checked the first commit that showed up for each.

Simon Glass <[email protected]> added:
- drivers/video/rockchip/rk_edp.c
- drivers/video/rockchip/rk_hdmi.c
- drivers/video/rockchip/rk_vop.c
- arch/arm/include/asm/arch-rockchip/vop_rk3288.h
- arch/arm/include/asm/arch-rockchip/edp_rk3288.h
as Copyright (c) 2015 Google, Inc
Copyright 2014 Rockchip Inc.

Philipp Tomsich <[email protected]> added:
- drivers/video/rockchip/rk3288_hdmi.c
- drivers/video/rockchip/rk3399_hdmi.c
- drivers/video/rockchip/rk_hdmi.h
- drivers/video/rockchip/rk_vop.h
as Copyright (c) 2017 Theobroma Systems Design und Consulting GmbH
- drivers/video/rockchip/rk3288_vop.c
- drivers/video/rockchip/rk3399_vop.c
as Copyright (c) 2017 Theobroma Systems Design und Consulting GmbH
Copyright (c) 2015 Google, Inc
Copyright 2014 Rockchip Inc.

Eric Gao <[email protected]> added:
- drivers/video/rockchip/rk3288_mipi.c
- drivers/video/rockchip/rk3399_mipi.c
- drivers/video/rockchip/rk_mipi.c
- drivers/video/rockchip/rk_mipi.h
- arch/arm/include/asm/arch-rockchip/rockchip_mipi_dsi.h as Copyright (C) 2017 Fuzhou Rockchip Electronics Co., Ltd

Jacob Chen <[email protected]> added:
- drivers/video/rockchip/rk_lvds.c
- arch/arm/include/asm/arch-rockchip/lvds_rk3288.h as Copyright 2016 Rockchip Inc.

#8 lore raw

PATCH 1/1 video: rockchip: Add missing dpcd_write() call to link_train_ce()

Quoted 17 lines · Alper Nebi Yasak
Quoted 11 lines · Tom Rini
Quoted 9 lines · Alper Nebi Yasak
Quoted 3 lines · Tom Rini

Ugh. In so far as anything can be re-licensed, who did it all originally? I suspect coreboot isn't interested in 2.0+ but we can do 2.0-only.

For this patch, coreboot commit b9a7877568cf ("rockchip/*: refactor edp driver") introduces the related change to src/soc/rockchip/common/edp.c renamed from .../rk3288/edp.c, which was introduced at coreboot commit 40f558e8f4f7 ("rockchip: support display").

Quoted 4 lines

Right, sorry. I mean, on the U-Boot side, where did things come from? I wonder how we got a different license text, and perhaps if we shouldn't just re-port the coreboot code over as a clean/clear way to re-license it to GPL-2.0-only.

Quoted 5 lines

I'm not sure re-porting is a great idea from the technical perspective. I've been reading both drivers to compare them, there are also things in U-Boot that're missing from coreboot. Things like DM integration are also not there as they're U-Boot specific.

I think it would be better to use fixes from the kernel or coreboot (if license allows it) than copying coreboot blindly. Doing that will possibly regress support from some systems as I fear that coreboot is missing some HW support.

tbh, I've not looked at the coreboot code but given most HW vendor history, it would be not so surprising that only the support for what's needed on kevin or bob (EDP and CDN DP or HDMI on rk3399) has been added to coreboot.

I've also seen some uboot sources with rockchip linux drm code [1]. I've no idea if it's used in practice but this means that people may even ask "Why merging coreboot code while it's possible to use linux drm code ?" ...

Arnaud

[1] https://gitlab.collabora.com/nicolas/rockchip-uboot/-/tree/rk3399-roc-pc/drivers/video/drm

#9 lore raw

PATCH 1/1 video: rockchip: Add missing dpcd_write() call to link_train_ce()

Quoted 10 lines · Arnaud Patard (Rtp)
Quoted 4 lines · Alper Nebi Yasak

I'm not sure re-porting is a great idea from the technical perspective. I've been reading both drivers to compare them, there are also things in U-Boot that're missing from coreboot. Things like DM integration are also not there as they're U-Boot specific.

I think it would be better to use fixes from the kernel or coreboot (if license allows it) than copying coreboot blindly. Doing that will possibly regress support from some systems as I fear that coreboot is missing some HW support.

I was planning on picking changes that look like improvements, yeah.

Quoted 4 lines

tbh, I've not looked at the coreboot code but given most HW vendor history, it would be not so surprising that only the support for what's needed on kevin or bob (EDP and CDN DP or HDMI on rk3399) has been added to coreboot.

I could only find veyron-based and gru-based Chrome OS devices (but the latter also includes gru-scarlet w/ MIPI), as their vendor firmware is coreboot-based. I'd guess other vendors are more focused on U-Boot.

Quoted 4 lines

I've also seen some uboot sources with rockchip linux drm code [1]. I've no idea if it's used in practice but this means that people may even ask "Why merging coreboot code while it's possible to use linux drm code ?" ...

AFAIK, Rockchip-downstream U-Boot [2] does it that way. Maybe that's not being done upstream for e.g. code size reasons?

[2] https://github.com/rockchip-linux/u-boot/

#10 lore raw

PATCH 1/1 video: rockchip: Add missing dpcd_write() call to link_train_ce()

In reply to Alper Nebi Yasak
Quoted 54 lines · Alper Nebi Yasak
Quoted 11 lines · Tom Rini
Quoted 9 lines · Alper Nebi Yasak
Quoted 3 lines · Tom Rini

Ugh. In so far as anything can be re-licensed, who did it all originally? I suspect coreboot isn't interested in 2.0+ but we can do 2.0-only.

For this patch, coreboot commit b9a7877568cf ("rockchip/*: refactor edp driver") introduces the related change to src/soc/rockchip/common/edp.c renamed from .../rk3288/edp.c, which was introduced at coreboot commit 40f558e8f4f7 ("rockchip: support display").

Quoted 4 lines

Right, sorry. I mean, on the U-Boot side, where did things come from? I wonder how we got a different license text, and perhaps if we shouldn't just re-port the coreboot code over as a clean/clear way to re-license it to GPL-2.0-only.

I'm not sure re-porting is a great idea from the technical perspective. I've been reading both drivers to compare them, there are also things in U-Boot that're missing from coreboot. Things like DM integration are also not there as they're U-Boot specific.

I checked some files with git log and checked the first commit that showed up for each.

Simon Glass <[email protected]> added:
- drivers/video/rockchip/rk_edp.c
- drivers/video/rockchip/rk_hdmi.c
- drivers/video/rockchip/rk_vop.c
- arch/arm/include/asm/arch-rockchip/vop_rk3288.h
- arch/arm/include/asm/arch-rockchip/edp_rk3288.h
as Copyright (c) 2015 Google, Inc
Copyright 2014 Rockchip Inc.

Philipp Tomsich <[email protected]> added:
- drivers/video/rockchip/rk3288_hdmi.c
- drivers/video/rockchip/rk3399_hdmi.c
- drivers/video/rockchip/rk_hdmi.h
- drivers/video/rockchip/rk_vop.h
as Copyright (c) 2017 Theobroma Systems Design und Consulting GmbH
- drivers/video/rockchip/rk3288_vop.c
- drivers/video/rockchip/rk3399_vop.c
as Copyright (c) 2017 Theobroma Systems Design und Consulting GmbH
Copyright (c) 2015 Google, Inc
Copyright 2014 Rockchip Inc.

Eric Gao <[email protected]> added:
- drivers/video/rockchip/rk3288_mipi.c
- drivers/video/rockchip/rk3399_mipi.c
- drivers/video/rockchip/rk_mipi.c
- drivers/video/rockchip/rk_mipi.h
- arch/arm/include/asm/arch-rockchip/rockchip_mipi_dsi.h as Copyright (C) 2017 Fuzhou Rockchip Electronics Co., Ltd

Quoted 4 lines

Jacob Chen <[email protected]> added:
- drivers/video/rockchip/rk_lvds.c
- arch/arm/include/asm/arch-rockchip/lvds_rk3288.h as Copyright 2016 Rockchip Inc.

Probably then the best "I am not a lawyer" answer is to have Philipp Tomsich, Eric Gao and Jacob Chen all acked-by a patch to mark our driver as GPL-2.0-only so that it's very clear that we can take improvements from other GPL-2.0-only sources.

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 659 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20201015/d7c8335e/attachment.sig>
#11 lore raw

PATCH 1/1 video: rockchip: Add missing dpcd_write() call to link_train_ce()

Hi,

Quoted 52 lines · Tom Rini
Quoted 51 lines · Alper Nebi Yasak
Quoted 5 lines · Tom Rini
Quoted 4 lines · Alper Nebi Yasak
Quoted 3 lines · Tom Rini

Ugh. In so far as anything can be re-licensed, who did it all originally? I suspect coreboot isn't interested in 2.0+ but we can do 2.0-only.

Quoted 8 lines
Quoted 4 lines

For this patch, coreboot commit b9a7877568cf ("rockchip/*: refactor edp driver") introduces the related change to src/soc/rockchip/common/edp.c renamed from .../rk3288/edp.c, which was introduced at coreboot commit 40f558e8f4f7 ("rockchip: support display").

Right, sorry. I mean, on the U-Boot side, where did things come from? I wonder how we got a different license text, and perhaps if we shouldn't just re-port the coreboot code over as a clean/clear way to re-license it to GPL-2.0-only.

I'm not sure re-porting is a great idea from the technical perspective. I've been reading both drivers to compare them, there are also things in U-Boot that're missing from coreboot. Things like DM integration are also not there as they're U-Boot specific.

I checked some files with git log and checked the first commit that showed up for each.

Simon Glass <[email protected]> added:
- drivers/video/rockchip/rk_edp.c
- drivers/video/rockchip/rk_hdmi.c
- drivers/video/rockchip/rk_vop.c
- arch/arm/include/asm/arch-rockchip/vop_rk3288.h
- arch/arm/include/asm/arch-rockchip/edp_rk3288.h
as Copyright (c) 2015 Google, Inc
Copyright 2014 Rockchip Inc.

Philipp Tomsich <[email protected]> added:
- drivers/video/rockchip/rk3288_hdmi.c
- drivers/video/rockchip/rk3399_hdmi.c
- drivers/video/rockchip/rk_hdmi.h
- drivers/video/rockchip/rk_vop.h
as Copyright (c) 2017 Theobroma Systems Design und Consulting GmbH
- drivers/video/rockchip/rk3288_vop.c
- drivers/video/rockchip/rk3399_vop.c
as Copyright (c) 2017 Theobroma Systems Design und Consulting GmbH
Copyright (c) 2015 Google, Inc
Copyright 2014 Rockchip Inc.

Eric Gao <[email protected]> added:
- drivers/video/rockchip/rk3288_mipi.c
- drivers/video/rockchip/rk3399_mipi.c
- drivers/video/rockchip/rk_mipi.c
- drivers/video/rockchip/rk_mipi.h
- arch/arm/include/asm/arch-rockchip/rockchip_mipi_dsi.h as Copyright (C) 2017 Fuzhou Rockchip Electronics Co., Ltd

Quoted 8 lines
Quoted 4 lines

Jacob Chen <[email protected]> added:
- drivers/video/rockchip/rk_lvds.c
- arch/arm/include/asm/arch-rockchip/lvds_rk3288.h as Copyright 2016 Rockchip Inc.

Probably then the best "I am not a lawyer" answer is to have Philipp Tomsich, Eric Gao and Jacob Chen all acked-by a patch to mark our driver as GPL-2.0-only so that it's very clear that we can take improvements from other GPL-2.0-only sources.

It's OK for Rockchip to make this change update license to GPL-2.0+.

Thanks,
- Kever

#12 lore raw

PATCH 1/1 video: rockchip: Add missing dpcd_write() call to link_train_ce()

In reply to Tom Rini

Hi,

Quoted 34 lines · Tom Rini
Quoted 32 lines · Simon Glass

Hi Alper,

Quoted 16 lines · Alper Nebi Yasak
Quoted 10 lines · Simon Glass
Quoted 7 lines · Alper Nebi Yasak

Found this by comparing it to the coreboot driver, a form of this call was introduced there in their commit b9a7877568cf ("rockchip/*: refactor edp driver"). This is copy-pasted from U-Boot's link_train_cr() slightly above it.

Simon, I noticed the coreboot driver is GPL-2.0-only, but the U-Boot driver is GPL-2.0+, is that a problem for this patch?

Quoted 7 lines

They also seem to be almost the same especially in their earlier revisions (even had the same typos in some comments). It could be good to sync the two drivers to pick improvements from it e.g. support for rk3399 (though there's an RFC series for that [1]), but the license difference makes it difficult. Could the coreboot parts be relicensed to GPL-2.0+ by Google and/or Rockchip? Alternatively, is it OK to change the U-Boot one to GPL-2.0-only to sync things from coreboot?

I think it is OK to change the file to GPL2. I'm not sure if changing coreboot parts to 2.0+ is an option. I believe the use of 2+ in U-Boot is for fairly narrow reasons, but I'm not sure if that is documented anywhere.

Quoted 5 lines
Quoted 1 line

+Tom Rini might have a comment

Ugh. In so far as anything can be re-licensed, who did it all originally? I suspect coreboot isn't interested in 2.0+ but we can do 2.0-only.

Well I think the Rockchip engineers wrote it originally, so perhaps they can just relicense when contributing to another project.

Regards,
Simon

#13 lore raw

PATCH 1/1 video: rockchip: Add missing dpcd_write() call to link_train_ce()

In reply to Alper Nebi Yasak
Quoted 59 lines · Alper Nebi Yasak

Found this by comparing it to the coreboot driver, a form of this call was introduced there in their commit b9a7877568cf ("rockchip/*: refactor edp driver"). This is copy-pasted from U-Boot's link_train_cr() slightly above it.

Without this on a gru-kevin chromebook, I have:

clock recovery at voltage 0 pre-emphasis 0
requested signal parameters: lane 0 voltage 0.4V pre_emph 3.5dB requested signal parameters: lane 1 voltage 0.4V pre_emph 3.5dB requested signal parameters: lane 2 voltage 0.4V pre_emph 3.5dB requested signal parameters: lane 3 voltage 0.4V pre_emph 3.5dB using signal parameters: voltage 0.4V pre_emph 3.5dB requested signal parameters: lane 0 voltage 0.4V pre_emph 3.5dB requested signal parameters: lane 1 voltage 0.4V pre_emph 3.5dB requested signal parameters: lane 2 voltage 0.4V pre_emph 3.5dB requested signal parameters: lane 3 voltage 0.4V pre_emph 3.5dB using signal parameters: voltage 0.4V pre_emph 3.5dB requested signal parameters: lane 0 voltage 0.4V pre_emph 3.5dB requested signal parameters: lane 1 voltage 0.4V pre_emph 3.5dB requested signal parameters: lane 2 voltage 0.4V pre_emph 3.5dB requested signal parameters: lane 3 voltage 0.4V pre_emph 3.5dB using signal parameters: voltage 0.4V pre_emph 3.5dB requested signal parameters: lane 0 voltage 0.4V pre_emph 3.5dB requested signal parameters: lane 1 voltage 0.4V pre_emph 3.5dB requested signal parameters: lane 2 voltage 0.4V pre_emph 3.5dB requested signal parameters: lane 3 voltage 0.4V pre_emph 3.5dB using signal parameters: voltage 0.4V pre_emph 3.5dB requested signal parameters: lane 0 voltage 0.4V pre_emph 3.5dB requested signal parameters: lane 1 voltage 0.4V pre_emph 3.5dB requested signal parameters: lane 2 voltage 0.4V pre_emph 3.5dB requested signal parameters: lane 3 voltage 0.4V pre_emph 3.5dB using signal parameters: voltage 0.4V pre_emph 3.5dB channel eq failed, ret=-5
link train failed!
rk_vop_probe() Device failed: ret=-5

With this, it looks like training succeeds:

clock recovery at voltage 0 pre-emphasis 0
requested signal parameters: lane 0 voltage 0.4V pre_emph 3.5dB requested signal parameters: lane 1 voltage 0.4V pre_emph 3.5dB requested signal parameters: lane 2 voltage 0.4V pre_emph 3.5dB requested signal parameters: lane 3 voltage 0.4V pre_emph 3.5dB using signal parameters: voltage 0.4V pre_emph 3.5dB requested signal parameters: lane 0 voltage 0.4V pre_emph 6dB requested signal parameters: lane 1 voltage 0.4V pre_emph 6dB requested signal parameters: lane 2 voltage 0.4V pre_emph 6dB requested signal parameters: lane 3 voltage 0.4V pre_emph 6dB using signal parameters: voltage 0.4V pre_emph 6dB requested signal parameters: lane 0 voltage 0.4V pre_emph 0dB requested signal parameters: lane 1 voltage 0.4V pre_emph 0dB requested signal parameters: lane 2 voltage 0.4V pre_emph 0dB requested signal parameters: lane 3 voltage 0.4V pre_emph 0dB using signal parameters: voltage 0.4V pre_emph 0dB channel eq at voltage 0 pre-emphasis 0
config video failed
rk_vop_probe() Device failed: ret=-110

Quoted 4 lines

The "config video failed" error also goes away when I disable higher log levels, and it claims to have successfully probed the device.

Thanks,
- Kever

Quoted 27 lines

---
I'm testing this with a lot of other patches to make the board work. The actual tree I'm using is available here:

     https://github.com/alpernebbi/u-boot/commits/rk3399-gru-kevin/wip
     (currently at commit c0dc4b42afe770671ce7bb0dd519d894a3acdea0)
  drivers/video/rockchip/rk_edp.c | 6 ++++++
  1 file changed, 6 insertions(+)
drivers/video/rockchip/rk_edp.c +6 -0
index 000bd48140..a032eb6889 100644
@@ -559,6 +559,12 @@ static int rk_edp_link_train_ce(struct rk_edp_priv *edp)
  	channel_eq = 0;
  	for (tries = 0; tries < 5; tries++) {
  		rk_edp_set_link_training(edp, edp->train_set);
+		ret = rk_edp_dpcd_write(regs, DPCD_TRAINING_LANE0_SET,
+					edp->train_set,
+					edp->link_train.lane_count);
+		if (ret)
+			return ret;
+
  		udelay(400);
 
  		if (rk_edp_dpcd_read_link_status(edp, status) < 0) {