From: Damon Ding <damon.ding@rock-chips.com>
To: heiko@sntech.de
Cc: robh@kernel.org, conor+dt@kernel.org, algea.cao@rock-chips.com,
rfoss@kernel.org, devicetree@vger.kernel.org,
linux-phy@lists.infradead.org, linux-kernel@vger.kernel.org,
sebastian.reichel@collabora.com, dri-devel@lists.freedesktop.org,
hjc@rock-chips.com, kever.yang@rock-chips.com,
linux-rockchip@lists.infradead.org, vkoul@kernel.org,
Damon Ding <damon.ding@rock-chips.com>,
andy.yan@rock-chips.com, krzk+dt@kernel.org,
linux-arm-kernel@lists.infradead.org, l.stach@pengutronix.de
Subject: [PATCH v1 03/10] drm/rockchip: analogix_dp: Add support for RK3588
Date: Wed, 27 Nov 2024 15:51:50 +0800 [thread overview]
Message-ID: <20241127075157.856029-4-damon.ding@rock-chips.com> (raw)
In-Reply-To: <20241127075157.856029-1-damon.ding@rock-chips.com>
RK3588 integrates the analogix eDP 1.3 TX controller IP and the HDMI/eDP
TX Combo PHY based on a Samsung IP block.
Add just the basic support for now, i.e. RGB output up to 4K@60Hz, without
the tests of audio, PSR and other eDP 1.3 specific features.
Signed-off-by: Damon Ding <damon.ding@rock-chips.com>
---
.../gpu/drm/rockchip/analogix_dp-rockchip.c | 41 +++++++++++++++++--
include/drm/bridge/analogix_dp.h | 3 +-
2 files changed, 40 insertions(+), 4 deletions(-)
diff --git a/drivers/gpu/drm/rockchip/analogix_dp-rockchip.c b/drivers/gpu/drm/rockchip/analogix_dp-rockchip.c
index edb08a816c3f..e5792deb7885 100644
--- a/drivers/gpu/drm/rockchip/analogix_dp-rockchip.c
+++ b/drivers/gpu/drm/rockchip/analogix_dp-rockchip.c
@@ -51,10 +51,12 @@ struct rockchip_grf_reg_field {
/**
* struct rockchip_dp_chip_data - splite the grf setting of kind of chips
* @lcdc_sel: grf register field of lcdc_sel
+ * @edp_mode: grf register field of edp_mode
* @chip_type: specific chip type
*/
struct rockchip_dp_chip_data {
const struct rockchip_grf_reg_field lcdc_sel;
+ const struct rockchip_grf_reg_field edp_mode;
u32 chip_type;
};
@@ -134,12 +136,21 @@ static int rockchip_dp_poweron(struct analogix_dp_plat_data *plat_data)
return ret;
}
+ ret = rockchip_grf_field_write(dp->grf, &dp->data->edp_mode, 1);
+ if (ret != 0)
+ DRM_DEV_ERROR(dp->dev, "failed to set edp mode %d\n", ret);
+
return ret;
}
static int rockchip_dp_powerdown(struct analogix_dp_plat_data *plat_data)
{
struct rockchip_dp_device *dp = pdata_encoder_to_dp(plat_data);
+ int ret;
+
+ ret = rockchip_grf_field_write(dp->grf, &dp->data->edp_mode, 0);
+ if (ret != 0)
+ DRM_DEV_ERROR(dp->dev, "failed to set edp mode %d\n", ret);
clk_disable_unprepare(dp->pclk);
@@ -203,6 +214,10 @@ static void rockchip_dp_drm_encoder_enable(struct drm_encoder *encoder,
struct rockchip_dp_device *dp = encoder_to_dp(encoder);
struct drm_crtc *crtc;
struct drm_crtc_state *old_crtc_state;
+ struct of_endpoint endpoint;
+ struct device_node *remote_port, *remote_port_parent;
+ char name[32];
+ u32 port_id;
int ret;
crtc = rockchip_dp_drm_get_new_crtc(encoder, state);
@@ -220,13 +235,27 @@ static void rockchip_dp_drm_encoder_enable(struct drm_encoder *encoder,
return;
}
- ret = drm_of_encoder_active_endpoint_id(dp->dev->of_node, encoder);
+ ret = drm_of_encoder_active_endpoint(dp->dev->of_node, encoder, &endpoint);
if (ret < 0)
return;
- DRM_DEV_DEBUG(dp->dev, "vop %s output to dp\n", (ret) ? "LIT" : "BIG");
+ remote_port_parent = of_graph_get_remote_port_parent(endpoint.local_node);
+ if (remote_port_parent) {
+ if (of_get_child_by_name(remote_port_parent, "ports")) {
+ remote_port = of_graph_get_remote_port(endpoint.local_node);
+ of_property_read_u32(remote_port, "reg", &port_id);
+ of_node_put(remote_port);
+ sprintf(name, "%s vp%d", remote_port_parent->full_name, port_id);
+ } else {
+ sprintf(name, "%s %s",
+ remote_port_parent->full_name, endpoint.id ? "vopl" : "vopb");
+ }
+ of_node_put(remote_port_parent);
+
+ DRM_DEV_DEBUG(dp->dev, "%s output to edp\n", name);
+ }
- ret = rockchip_grf_field_write(dp->grf, &dp->data->lcdc_sel, ret);
+ ret = rockchip_grf_field_write(dp->grf, &dp->data->lcdc_sel, endpoint.id);
if (ret != 0)
DRM_DEV_ERROR(dp->dev, "Could not write to GRF: %d\n", ret);
@@ -474,9 +503,15 @@ static const struct rockchip_dp_chip_data rk3288_dp = {
.lcdc_sel = GRF_REG_FIELD(0x025c, 5, 5),
};
+static const struct rockchip_dp_chip_data rk3588_edp = {
+ .edp_mode = GRF_REG_FIELD(0x0000, 0, 0),
+ .chip_type = RK3588_EDP,
+};
+
static const struct of_device_id rockchip_dp_dt_ids[] = {
{.compatible = "rockchip,rk3288-dp", .data = &rk3288_dp },
{.compatible = "rockchip,rk3399-edp", .data = &rk3399_edp },
+ {.compatible = "rockchip,rk3588-edp", .data = &rk3588_edp },
{}
};
MODULE_DEVICE_TABLE(of, rockchip_dp_dt_ids);
diff --git a/include/drm/bridge/analogix_dp.h b/include/drm/bridge/analogix_dp.h
index 6002c5666031..54086cb2d97d 100644
--- a/include/drm/bridge/analogix_dp.h
+++ b/include/drm/bridge/analogix_dp.h
@@ -15,11 +15,12 @@ enum analogix_dp_devtype {
EXYNOS_DP,
RK3288_DP,
RK3399_EDP,
+ RK3588_EDP,
};
static inline bool is_rockchip(enum analogix_dp_devtype type)
{
- return type == RK3288_DP || type == RK3399_EDP;
+ return type == RK3288_DP || type == RK3399_EDP || type == RK3588_EDP;
}
struct analogix_dp_plat_data {
--
2.34.1
_______________________________________________
Linux-rockchip mailing list
Linux-rockchip@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-rockchip
next prev parent reply other threads:[~2024-11-27 7:56 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-27 7:51 [PATCH v1 00/10] Add eDP support for RK3588 Damon Ding
2024-11-27 7:51 ` [PATCH v1 01/10] drm/rockchip: analogix_dp: Use formalized struct definition for grf field Damon Ding
2024-11-27 7:51 ` [PATCH v1 02/10] dt-bindings: display: rockchip: analogix-dp: Add support for RK3588 Damon Ding
2024-11-27 10:23 ` Krzysztof Kozlowski
2024-12-02 2:03 ` Damon Ding
2024-11-27 7:51 ` Damon Ding [this message]
2024-11-27 7:51 ` [PATCH v1 04/10] phy: phy-rockchip-samsung-hdptx: Add support for eDP mode Damon Ding
2024-11-27 9:29 ` Heiko Stübner
2024-11-27 11:00 ` Damon Ding
2024-11-27 11:04 ` Heiko Stübner
2024-11-29 2:43 ` Damon Ding
2024-11-30 20:25 ` Heiko Stübner
2024-12-01 22:59 ` Sebastian Reichel
2024-12-02 3:28 ` Damon Ding
2024-12-02 14:41 ` Sebastian Reichel
2024-12-05 1:13 ` Damon Ding
2024-12-05 18:04 ` Sebastian Reichel
2024-12-06 3:28 ` Damon Ding
2024-11-27 7:51 ` [PATCH v1 05/10] drm/bridge: analogix_dp: add support for RK3588 Damon Ding
2024-11-27 7:51 ` [PATCH v1 06/10] drm/bridge: analogix_dp: Add support for phy configuration Damon Ding
2024-11-30 8:53 ` Dmitry Baryshkov
2024-12-12 8:55 ` Damon Ding
2024-11-27 7:51 ` [PATCH v1 07/10] dt-bindings: display: rockchip: Fix label name of hdptxphy for RK3588 HDMI TX Controller Damon Ding
2024-12-03 16:58 ` Rob Herring (Arm)
2024-11-27 7:51 ` [PATCH v1 08/10] arm64: dts: rockchip: Fix label name of hdptxphy for RK3588 Damon Ding
2024-11-27 7:51 ` [PATCH v1 09/10] arm64: dts: rockchip: Add eDP0 node " Damon Ding
2024-11-27 7:51 ` [PATCH v1 10/10] arch64: dts: rockchip: Enable eDP0 display on RK3588S EVB1 board Damon Ding
2024-11-27 9:02 ` Heiko Stübner
2024-12-06 14:35 ` [PATCH v1 00/10] Add eDP support for RK3588 Heiko Stübner
2024-12-15 2:32 ` Damon Ding
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20241127075157.856029-4-damon.ding@rock-chips.com \
--to=damon.ding@rock-chips.com \
--cc=algea.cao@rock-chips.com \
--cc=andy.yan@rock-chips.com \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=heiko@sntech.de \
--cc=hjc@rock-chips.com \
--cc=kever.yang@rock-chips.com \
--cc=krzk+dt@kernel.org \
--cc=l.stach@pengutronix.de \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-phy@lists.infradead.org \
--cc=linux-rockchip@lists.infradead.org \
--cc=rfoss@kernel.org \
--cc=robh@kernel.org \
--cc=sebastian.reichel@collabora.com \
--cc=vkoul@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox