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-rockchip@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,
dmitry.baryshkov@linaro.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 v5 15/20] drm/rockchip: analogix_dp: Add support for RK3588
Date: Thu, 9 Jan 2025 11:27:20 +0800 [thread overview]
Message-ID: <20250109032725.1102465-16-damon.ding@rock-chips.com> (raw)
In-Reply-To: <20250109032725.1102465-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. There are also two independent
eDP display interface with different address on RK3588 Soc.
The patch currently adds only the basic support, specifically RGB output
up to 4K@60Hz, without the tests for audio, PSR and other eDP 1.3 specific
features.
In additon, the above Analogix IP has always been utilized as eDP on
Rockchip platform, despite its capability to also support the DP v1.2.
Therefore, the newly added logs will contain the term 'edp' rather than
'dp'. And the newly added 'apb' reset control is to ensure the APB bus
of eDP controller works well on the RK3588 SoC.
Signed-off-by: Damon Ding <damon.ding@rock-chips.com>
---
Changes in v2:
- Add support for the other eDP output edp1
Changes in v3:
- Fix the unexpected use of alias
- Add more details in commit message
Changes in v4:
- Add the 'apb' reset control
Changes in v5:
- Use drm_...()/dev_...() instead of DRM_...()
- Clean &rockchip_dp_chip_data.reg related comments in commit message
- Move the modifications in anlogix_dp.h to the Analogix side in order
to avoid the warning:
drivers/gpu/drm/bridge/analogix/analogix_dp_core.c:1506:10: warning:
enumeration value 'RK3588_EDP' not handled in switch [-Wswitch]
switch (dp->plat_data->dev_type) {
---
.../gpu/drm/rockchip/analogix_dp-rockchip.c | 61 ++++++++++++++++++-
1 file changed, 58 insertions(+), 3 deletions(-)
diff --git a/drivers/gpu/drm/rockchip/analogix_dp-rockchip.c b/drivers/gpu/drm/rockchip/analogix_dp-rockchip.c
index 3ae01b870f49..de24999f5b61 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;
u32 reg;
};
@@ -69,6 +71,7 @@ struct rockchip_dp_device {
struct clk *grfclk;
struct regmap *grf;
struct reset_control *rst;
+ struct reset_control *apbrst;
const struct rockchip_dp_chip_data *data;
@@ -114,6 +117,10 @@ static int rockchip_dp_pre_init(struct rockchip_dp_device *dp)
usleep_range(10, 20);
reset_control_deassert(dp->rst);
+ reset_control_assert(dp->apbrst);
+ usleep_range(10, 20);
+ reset_control_deassert(dp->apbrst);
+
return 0;
}
@@ -135,12 +142,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)
+ dev_err(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)
+ dev_err(dp->dev, "failed to set edp mode %d\n", ret);
clk_disable_unprepare(dp->pclk);
@@ -205,6 +221,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);
@@ -222,13 +242,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_dbg_core(dp->drm_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_dbg_core(dp->drm_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_err(dp->drm_dev, "Could not write to GRF: %d\n", ret);
@@ -322,6 +356,12 @@ static int rockchip_dp_of_probe(struct rockchip_dp_device *dp)
return PTR_ERR(dp->rst);
}
+ dp->apbrst = devm_reset_control_get_optional(dev, "apb");
+ if (IS_ERR(dp->apbrst)) {
+ dev_err(dev, "failed to get apb reset control\n");
+ return PTR_ERR(dp->apbrst);
+ }
+
return 0;
}
@@ -521,9 +561,24 @@ static const struct rockchip_dp_chip_data rk3288_dp[] = {
{ /* sentinel */ }
};
+static const struct rockchip_dp_chip_data rk3588_edp[] = {
+ {
+ .edp_mode = GRF_REG_FIELD(0x0000, 0, 0),
+ .chip_type = RK3588_EDP,
+ .reg = 0xfdec0000,
+ },
+ {
+ .edp_mode = GRF_REG_FIELD(0x0004, 0, 0),
+ .chip_type = RK3588_EDP,
+ .reg = 0xfded0000,
+ },
+ { /* sentinel */ }
+};
+
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);
--
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:[~2025-01-09 3:36 UTC|newest]
Thread overview: 42+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-01-09 3:27 [PATCH v5 00/20] Add eDP support for RK3588 Damon Ding
2025-01-09 3:27 ` [PATCH v5 01/20] phy: phy-rockchip-samsung-hdptx: Swap the definitions of LCPLL_REF and ROPLL_REF Damon Ding
2025-01-09 3:27 ` [PATCH v5 02/20] phy: phy-rockchip-samsung-hdptx: Supplement some register names with their full version Damon Ding
2025-01-09 3:27 ` [PATCH v5 03/20] phy: phy-rockchip-samsung-hdptx: Add the '_MASK' suffix to all registers Damon Ding
2025-01-09 3:27 ` [PATCH v5 04/20] phy: phy-rockchip-samsung-hdptx: Add eDP mode support for RK3588 Damon Ding
2025-01-09 12:39 ` Dmitry Baryshkov
2025-01-09 3:27 ` [PATCH v5 05/20] drm/rockchip: analogix_dp: Replace DRM_...() functions with drm_...() or dev_...() Damon Ding
2025-01-09 6:28 ` Andy Yan
2025-01-22 8:46 ` [PATCH " Damon Ding
2025-01-23 12:27 ` Jani Nikula
2025-01-24 9:41 ` Andy Yan
2025-01-24 10:55 ` Dmitry Baryshkov
2025-01-09 3:27 ` [PATCH v5 06/20] drm/rockchip: analogix_dp: Use formalized struct definition for grf field Damon Ding
2025-01-09 3:27 ` [PATCH v5 07/20] drm/rockchip: analogix_dp: Expand device data to support multiple edp display Damon Ding
2025-01-10 6:24 ` kernel test robot
2025-01-09 3:27 ` [PATCH v5 08/20] drm/bridge: analogix_dp: Add support for phy configuration Damon Ding
2025-01-09 12:41 ` Dmitry Baryshkov
2025-01-09 3:27 ` [PATCH v5 09/20] dt-bindings: display: rockchip: analogix-dp: Add support to get panel from the DP AUX bus Damon Ding
2025-01-09 3:27 ` [PATCH v5 10/20] drm/bridge: analogix_dp: support to get &analogix_dp_device.plat_data and &analogix_dp_device.aux Damon Ding
2025-01-09 12:42 ` Dmitry Baryshkov
2025-01-09 12:58 ` Dmitry Baryshkov
2025-01-09 3:27 ` [PATCH v5 11/20] drm/bridge: analogix_dp: Add support to get panel from the DP AUX bus Damon Ding
2025-01-09 12:45 ` Dmitry Baryshkov
2025-01-22 8:06 ` Damon Ding
2025-01-09 3:27 ` [PATCH v5 12/20] drm/rockchip: " Damon Ding
2025-01-09 12:48 ` Dmitry Baryshkov
2025-01-22 8:17 ` Damon Ding
2025-01-22 9:37 ` Damon Ding
2025-01-22 18:56 ` Dmitry Baryshkov
2025-01-09 3:27 ` [PATCH v5 13/20] dt-bindings: display: rockchip: analogix-dp: Add support for RK3588 Damon Ding
2025-01-09 8:54 ` Krzysztof Kozlowski
2025-01-20 7:08 ` Damon Ding
2025-01-09 3:27 ` [PATCH v5 14/20] drm/bridge: analogix_dp: " Damon Ding
2025-01-09 12:49 ` Dmitry Baryshkov
2025-01-09 3:27 ` Damon Ding [this message]
2025-01-09 3:27 ` [PATCH v5 16/20] drm/edp-panel: Add LG Display panel model LP079QX1-SP0V Damon Ding
2025-01-09 3:27 ` [PATCH v5 17/20] dt-bindings: display: rockchip: Fix label name of hdptxphy for RK3588 HDMI TX Controller Damon Ding
2025-01-09 3:27 ` [PATCH v5 18/20] arm64: dts: rockchip: Fix label name of hdptxphy for RK3588 Damon Ding
2025-01-09 3:27 ` [PATCH v5 19/20] arm64: dts: rockchip: Add eDP0 node " Damon Ding
2025-01-09 3:27 ` [PATCH v5 20/20] arm64: dts: rockchip: Enable eDP0 display on RK3588S EVB1 board Damon Ding
2025-01-11 10:28 ` Andy Yan
2025-01-22 9:05 ` [PATCH " 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=20250109032725.1102465-16-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=dmitry.baryshkov@linaro.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