mirror of
https://github.com/coolsnowwolf/lede.git
synced 2025-04-16 04:13:31 +00:00
89 lines
3.3 KiB
Diff
89 lines
3.3 KiB
Diff
From cf544c6a885c52d79e4d8bf139fb8cb63a878512 Mon Sep 17 00:00:00 2001
|
|
From: Sascha Hauer <s.hauer@pengutronix.de>
|
|
Date: Fri, 22 Apr 2022 09:28:20 +0200
|
|
Subject: [PATCH] drm/rockchip: Add crtc_endpoint_id to rockchip_encoder
|
|
|
|
The VOP2 has an interface mux which decides to which encoder(s) a CRTC
|
|
is routed to. The encoders and CRTCs are connected via of_graphs in the
|
|
device tree. When given an encoder the VOP2 driver needs to know to
|
|
which internal register setting this encoder matches. For this the VOP2
|
|
binding offers different endpoints, one for each possible encoder. The
|
|
endpoint ids of these endpoints are used as a key from an encoders
|
|
device tree description to the internal register setting.
|
|
|
|
This patch adds the key aka endpoint id to struct rockchip_encoder plus
|
|
a function to read the endpoint id starting from the encoders device
|
|
node.
|
|
|
|
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|
Tested-by: Michael Riesch <michael.riesch@wolfvision.net>
|
|
Signed-off-by: Heiko Stuebner <heiko@sntech.de>
|
|
Link: https://patchwork.freedesktop.org/patch/msgid/20220422072841.2206452-4-s.hauer@pengutronix.de
|
|
---
|
|
drivers/gpu/drm/rockchip/rockchip_drm_drv.c | 33 +++++++++++++++++++++
|
|
drivers/gpu/drm/rockchip/rockchip_drm_drv.h | 4 ++-
|
|
2 files changed, 36 insertions(+), 1 deletion(-)
|
|
|
|
--- a/drivers/gpu/drm/rockchip/rockchip_drm_drv.c
|
|
+++ b/drivers/gpu/drm/rockchip/rockchip_drm_drv.c
|
|
@@ -256,6 +256,39 @@ static struct platform_driver *rockchip_
|
|
static int num_rockchip_sub_drivers;
|
|
|
|
/*
|
|
+ * Get the endpoint id of the remote endpoint of the given encoder. This
|
|
+ * information is used by the VOP2 driver to identify the encoder.
|
|
+ *
|
|
+ * @rkencoder: The encoder to get the remote endpoint id from
|
|
+ * @np: The encoder device node
|
|
+ * @port: The number of the port leading to the VOP2
|
|
+ * @reg: The endpoint number leading to the VOP2
|
|
+ */
|
|
+int rockchip_drm_encoder_set_crtc_endpoint_id(struct rockchip_encoder *rkencoder,
|
|
+ struct device_node *np, int port, int reg)
|
|
+{
|
|
+ struct of_endpoint ep;
|
|
+ struct device_node *en, *ren;
|
|
+ int ret;
|
|
+
|
|
+ en = of_graph_get_endpoint_by_regs(np, port, reg);
|
|
+ if (!en)
|
|
+ return -ENOENT;
|
|
+
|
|
+ ren = of_graph_get_remote_endpoint(en);
|
|
+ if (!ren)
|
|
+ return -ENOENT;
|
|
+
|
|
+ ret = of_graph_parse_endpoint(ren, &ep);
|
|
+ if (ret)
|
|
+ return ret;
|
|
+
|
|
+ rkencoder->crtc_endpoint_id = ep.id;
|
|
+
|
|
+ return 0;
|
|
+}
|
|
+
|
|
+/*
|
|
* Check if a vop endpoint is leading to a rockchip subdriver or bridge.
|
|
* Should be called from the component bind stage of the drivers
|
|
* to ensure that all subdrivers are probed.
|
|
--- a/drivers/gpu/drm/rockchip/rockchip_drm_drv.h
|
|
+++ b/drivers/gpu/drm/rockchip/rockchip_drm_drv.h
|
|
@@ -53,6 +53,7 @@ struct rockchip_drm_private {
|
|
};
|
|
|
|
struct rockchip_encoder {
|
|
+ int crtc_endpoint_id;
|
|
struct drm_encoder encoder;
|
|
};
|
|
|
|
@@ -61,7 +62,8 @@ int rockchip_drm_dma_attach_device(struc
|
|
void rockchip_drm_dma_detach_device(struct drm_device *drm_dev,
|
|
struct device *dev);
|
|
int rockchip_drm_wait_vact_end(struct drm_crtc *crtc, unsigned int mstimeout);
|
|
-
|
|
+int rockchip_drm_encoder_set_crtc_endpoint_id(struct rockchip_encoder *rencoder,
|
|
+ struct device_node *np, int port, int reg);
|
|
int rockchip_drm_endpoint_is_subdriver(struct device_node *ep);
|
|
extern struct platform_driver cdn_dp_driver;
|
|
extern struct platform_driver dw_hdmi_rockchip_pltfm_driver;
|