Skip to content

Commit

Permalink
ODROID-COMMON: video/drm: fix to initiate DRM with upstream kernel
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
tobetter committed Jan 17, 2024
1 parent 9094cea commit ab38cd1
Showing 1 changed file with 27 additions and 2 deletions.
29 changes: 27 additions & 2 deletions drivers/video/drm/inno_video_combo_phy.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#include <linux/ioport.h>
#include <linux/iopoll.h>
#include <linux/math64.h>
#include <dm/of_access.h>

#include "rockchip_phy.h"

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

ret = dev_read_resource(dev, 1, &inno->host);
if (ret < 0) {
dev_err(dev, "resource \"host\" not found\n");
return ret;
int node;
const fdt32_t *php = NULL;
struct fdt_resource fres;

fdt_for_each_subnode(node, gd->fdt_blob, 0) {
php = fdt_getprop(gd->fdt_blob, node, "phys", NULL);
if (fdt32_to_cpu(*php) == dev->node.np->phandle) {
if (fdt_get_resource(gd->fdt_blob, node, "reg", 0, &fres))
php = NULL;
break;
}
}

if (!php) {
dev_err(dev, "resource \"host\" not found\n");
return ret;
}

inno->host.start = fres.start;
inno->host.end = fres.end;
}

phy->dev = dev;
Expand Down Expand Up @@ -966,6 +985,12 @@ static const struct udevice_id inno_video_phy_ids[] = {
.compatible = "rockchip,rk3568-video-phy",
.data = (ulong)&rk3568_inno_video_phy_driver_data,
},
#if defined(CONFIG_TARGET_ODROID_M1) || defined(CONFIG_TARGET_ODROID_M1S)
{
.compatible = "rockchip,rk3568-dsi-dphy",
.data = (ulong)&rk3568_inno_video_phy_driver_data,
},
#endif
{}
};

Expand Down

0 comments on commit ab38cd1

Please sign in to comment.