Skip to content

Commit ab38cd1

Browse files
committed
ODROID-COMMON: video/drm: fix to initiate DRM with upstream kernel
Upstream kernel does not have resouce for 'host' in device tree that is defined like this in 5.10 kernel. video_phy0: phy@fe850000 { compatible = "rockchip,rk3568-dsi-dphy", "rockchip,rk3568-video-phy"; reg = <0x0 0xfe850000 0x0 0x10000>, <0x0 0xfe060000 0x0 0x10000>; reg-names = "phy", "host"; clocks = <&pmucru CLK_MIPIDSIPHY0_REF>, '0xfe060000' is the address of 'dsi0', so instead of adding 'host' resouce/reg, this patch will travers the device tree pool in order to find out the node by phandle and use its resource/reg. Also 5.10 kernel have two compatible strings for 'video_phy0' while upstream kernel only have 'rockchip,rk3568-dsi-phy'. So adding ' rockchip,rk3568-video-dphy' will trick to initiate the DSI phy with upstream kernel. Change-Id: I83c0e7b0c56f5cfe6e802bb34b9b9dfdcb509a66 Signed-off-by: Dongjin Kim <[email protected]>
1 parent 9094cea commit ab38cd1

File tree

1 file changed

+27
-2
lines changed

1 file changed

+27
-2
lines changed

drivers/video/drm/inno_video_combo_phy.c

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
#include <linux/ioport.h>
1616
#include <linux/iopoll.h>
1717
#include <linux/math64.h>
18+
#include <dm/of_access.h>
1819

1920
#include "rockchip_phy.h"
2021

@@ -899,8 +900,26 @@ static int inno_video_phy_probe(struct udevice *dev)
899900

900901
ret = dev_read_resource(dev, 1, &inno->host);
901902
if (ret < 0) {
902-
dev_err(dev, "resource \"host\" not found\n");
903-
return ret;
903+
int node;
904+
const fdt32_t *php = NULL;
905+
struct fdt_resource fres;
906+
907+
fdt_for_each_subnode(node, gd->fdt_blob, 0) {
908+
php = fdt_getprop(gd->fdt_blob, node, "phys", NULL);
909+
if (fdt32_to_cpu(*php) == dev->node.np->phandle) {
910+
if (fdt_get_resource(gd->fdt_blob, node, "reg", 0, &fres))
911+
php = NULL;
912+
break;
913+
}
914+
}
915+
916+
if (!php) {
917+
dev_err(dev, "resource \"host\" not found\n");
918+
return ret;
919+
}
920+
921+
inno->host.start = fres.start;
922+
inno->host.end = fres.end;
904923
}
905924

906925
phy->dev = dev;
@@ -966,6 +985,12 @@ static const struct udevice_id inno_video_phy_ids[] = {
966985
.compatible = "rockchip,rk3568-video-phy",
967986
.data = (ulong)&rk3568_inno_video_phy_driver_data,
968987
},
988+
#if defined(CONFIG_TARGET_ODROID_M1) || defined(CONFIG_TARGET_ODROID_M1S)
989+
{
990+
.compatible = "rockchip,rk3568-dsi-dphy",
991+
.data = (ulong)&rk3568_inno_video_phy_driver_data,
992+
},
993+
#endif
969994
{}
970995
};
971996

0 commit comments

Comments
 (0)