* [PATCH 0/3] Add HDMI support for rk3576
@ 2024-12-25 10:37 Andy Yan
2024-12-25 10:37 ` [PATCH 1/3] drm/rockchip: dw_hdmi_qp: Add platform ctrl callback Andy Yan
` (2 more replies)
0 siblings, 3 replies; 9+ messages in thread
From: Andy Yan @ 2024-12-25 10:37 UTC (permalink / raw)
To: heiko
Cc: cristian.ciocaltea, krzk+dt, mripard, hjc, devicetree, dri-devel,
linux-arm-kernel, linux-kernel, linux-rockchip, Andy Yan
From: Andy Yan <andy.yan@rock-chips.com>
RK3576 HDMI TX Controller is very similar to that of RK3588, but with
some control bits for IO and interrupts status scattered across different
GRF.
PATCH 1/3 is add platform ctrl callback for IO setting and interrupts
status handing.
PATCH 2/3 ~ 3/3 are add support for rk3576
Andy Yan (3):
drm/rockchip: dw_hdmi_qp: Add platform ctrl callback
dt-bindings: display: rockchip: Add support for RK3576 HDMI TX
Controller
drm/rockchip: Add basic RK3576 HDMI output support
.../rockchip/rockchip,rk3588-dw-hdmi-qp.yaml | 1 +
.../gpu/drm/rockchip/dw_hdmi_qp-rockchip.c | 224 +++++++++++++++---
2 files changed, 196 insertions(+), 29 deletions(-)
--
2.34.1
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH 1/3] drm/rockchip: dw_hdmi_qp: Add platform ctrl callback
2024-12-25 10:37 [PATCH 0/3] Add HDMI support for rk3576 Andy Yan
@ 2024-12-25 10:37 ` Andy Yan
2025-01-02 11:51 ` Heiko Stübner
2024-12-25 10:37 ` [PATCH 2/3] dt-bindings: display: rockchip: Add support for RK3576 HDMI TX Controller Andy Yan
2024-12-25 10:37 ` [PATCH 3/3] drm/rockchip: Add basic RK3576 HDMI output support Andy Yan
2 siblings, 1 reply; 9+ messages in thread
From: Andy Yan @ 2024-12-25 10:37 UTC (permalink / raw)
To: heiko
Cc: cristian.ciocaltea, krzk+dt, mripard, hjc, devicetree, dri-devel,
linux-arm-kernel, linux-kernel, linux-rockchip, Andy Yan
From: Andy Yan <andy.yan@rock-chips.com>
There are some control bits for IO and interrupts status scattered
across different GRF on differt SOC.
Add platform callback for this IO setting and interrupts status
handling.
Signed-off-by: Andy Yan <andy.yan@rock-chips.com>
---
.../gpu/drm/rockchip/dw_hdmi_qp-rockchip.c | 81 ++++++++++++-------
1 file changed, 54 insertions(+), 27 deletions(-)
diff --git a/drivers/gpu/drm/rockchip/dw_hdmi_qp-rockchip.c b/drivers/gpu/drm/rockchip/dw_hdmi_qp-rockchip.c
index c36fc130b734..b21e868e7c16 100644
--- a/drivers/gpu/drm/rockchip/dw_hdmi_qp-rockchip.c
+++ b/drivers/gpu/drm/rockchip/dw_hdmi_qp-rockchip.c
@@ -62,6 +62,12 @@ struct rockchip_hdmi_qp {
int port_id;
};
+struct rockchip_hdmi_qp_ctrl_ops {
+ void (*io_init)(struct rockchip_hdmi_qp *hdmi);
+ irqreturn_t (*irq_callback)(int irq, void *dev_id);
+ irqreturn_t (*hardirq_callback)(int irq, void *dev_id);
+};
+
static struct rockchip_hdmi_qp *to_rockchip_hdmi_qp(struct drm_encoder *encoder)
{
struct rockchip_encoder *rkencoder = to_rockchip_encoder(encoder);
@@ -226,9 +232,47 @@ static irqreturn_t dw_hdmi_qp_rk3588_irq(int irq, void *dev_id)
return IRQ_HANDLED;
}
+static void dw_hdmi_qp_rk3588_io_init(struct rockchip_hdmi_qp *hdmi)
+{
+ u32 val;
+
+ val = HIWORD_UPDATE(RK3588_SCLIN_MASK, RK3588_SCLIN_MASK) |
+ HIWORD_UPDATE(RK3588_SDAIN_MASK, RK3588_SDAIN_MASK) |
+ HIWORD_UPDATE(RK3588_MODE_MASK, RK3588_MODE_MASK) |
+ HIWORD_UPDATE(RK3588_I2S_SEL_MASK, RK3588_I2S_SEL_MASK);
+
+ regmap_write(hdmi->vo_regmap,
+ hdmi->port_id ? RK3588_GRF_VO1_CON6 : RK3588_GRF_VO1_CON3,
+ val);
+
+ val = HIWORD_UPDATE(RK3588_SET_HPD_PATH_MASK, RK3588_SET_HPD_PATH_MASK);
+ regmap_write(hdmi->regmap, RK3588_GRF_SOC_CON7, val);
+
+ if (hdmi->port_id)
+ val = HIWORD_UPDATE(RK3588_HDMI1_GRANT_SEL,
+ RK3588_HDMI1_GRANT_SEL);
+ else
+ val = HIWORD_UPDATE(RK3588_HDMI0_GRANT_SEL,
+ RK3588_HDMI0_GRANT_SEL);
+ regmap_write(hdmi->vo_regmap, RK3588_GRF_VO1_CON9, val);
+
+ if (hdmi->port_id)
+ val = HIWORD_UPDATE(RK3588_HDMI1_HPD_INT_MSK, RK3588_HDMI1_HPD_INT_MSK);
+ else
+ val = HIWORD_UPDATE(RK3588_HDMI0_HPD_INT_MSK, RK3588_HDMI0_HPD_INT_MSK);
+ regmap_write(hdmi->regmap, RK3588_GRF_SOC_CON2, val);
+}
+
+static const struct rockchip_hdmi_qp_ctrl_ops rk3588_hdmi_ctrl_ops = {
+ .io_init = dw_hdmi_qp_rk3588_io_init,
+ .irq_callback = dw_hdmi_qp_rk3588_irq,
+ .hardirq_callback = dw_hdmi_qp_rk3588_hardirq,
+};
+
struct rockchip_hdmi_qp_cfg {
unsigned int num_ports;
unsigned int port_ids[MAX_HDMI_PORT_NUM];
+ const struct rockchip_hdmi_qp_ctrl_ops *ctrl_ops;
const struct dw_hdmi_qp_phy_ops *phy_ops;
};
@@ -238,6 +282,7 @@ static const struct rockchip_hdmi_qp_cfg rk3588_hdmi_cfg = {
0xfde80000,
0xfdea0000,
},
+ .ctrl_ops = &rk3588_hdmi_ctrl_ops,
.phy_ops = &rk3588_hdmi_phy_ops,
};
@@ -282,6 +327,12 @@ static int dw_hdmi_qp_rockchip_bind(struct device *dev, struct device *master,
if (!cfg)
return -ENODEV;
+ if (!cfg->ctrl_ops || !cfg->ctrl_ops->io_init ||
+ !cfg->ctrl_ops->irq_callback || !cfg->ctrl_ops->irq_callback) {
+ dev_err(dev, "Missing platform ctrl ops\n");
+ return -ENODEV;
+ }
+
hdmi->dev = &pdev->dev;
hdmi->port_id = -ENODEV;
@@ -357,31 +408,7 @@ static int dw_hdmi_qp_rockchip_bind(struct device *dev, struct device *master,
return ret;
}
- val = HIWORD_UPDATE(RK3588_SCLIN_MASK, RK3588_SCLIN_MASK) |
- HIWORD_UPDATE(RK3588_SDAIN_MASK, RK3588_SDAIN_MASK) |
- HIWORD_UPDATE(RK3588_MODE_MASK, RK3588_MODE_MASK) |
- HIWORD_UPDATE(RK3588_I2S_SEL_MASK, RK3588_I2S_SEL_MASK);
- regmap_write(hdmi->vo_regmap,
- hdmi->port_id ? RK3588_GRF_VO1_CON6 : RK3588_GRF_VO1_CON3,
- val);
-
- val = HIWORD_UPDATE(RK3588_SET_HPD_PATH_MASK,
- RK3588_SET_HPD_PATH_MASK);
- regmap_write(hdmi->regmap, RK3588_GRF_SOC_CON7, val);
-
- if (hdmi->port_id)
- val = HIWORD_UPDATE(RK3588_HDMI1_GRANT_SEL,
- RK3588_HDMI1_GRANT_SEL);
- else
- val = HIWORD_UPDATE(RK3588_HDMI0_GRANT_SEL,
- RK3588_HDMI0_GRANT_SEL);
- regmap_write(hdmi->vo_regmap, RK3588_GRF_VO1_CON9, val);
-
- if (hdmi->port_id)
- val = HIWORD_UPDATE(RK3588_HDMI1_HPD_INT_MSK, RK3588_HDMI1_HPD_INT_MSK);
- else
- val = HIWORD_UPDATE(RK3588_HDMI0_HPD_INT_MSK, RK3588_HDMI0_HPD_INT_MSK);
- regmap_write(hdmi->regmap, RK3588_GRF_SOC_CON2, val);
+ cfg->ctrl_ops->io_init(hdmi);
INIT_DELAYED_WORK(&hdmi->hpd_work, dw_hdmi_qp_rk3588_hpd_work);
@@ -394,8 +421,8 @@ static int dw_hdmi_qp_rockchip_bind(struct device *dev, struct device *master,
return irq;
ret = devm_request_threaded_irq(hdmi->dev, irq,
- dw_hdmi_qp_rk3588_hardirq,
- dw_hdmi_qp_rk3588_irq,
+ cfg->ctrl_ops->hardirq_callback,
+ cfg->ctrl_ops->irq_callback,
IRQF_SHARED, "dw-hdmi-qp-hpd",
hdmi);
if (ret)
--
2.34.1
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 2/3] dt-bindings: display: rockchip: Add support for RK3576 HDMI TX Controller
2024-12-25 10:37 [PATCH 0/3] Add HDMI support for rk3576 Andy Yan
2024-12-25 10:37 ` [PATCH 1/3] drm/rockchip: dw_hdmi_qp: Add platform ctrl callback Andy Yan
@ 2024-12-25 10:37 ` Andy Yan
2025-01-02 7:58 ` Krzysztof Kozlowski
2024-12-25 10:37 ` [PATCH 3/3] drm/rockchip: Add basic RK3576 HDMI output support Andy Yan
2 siblings, 1 reply; 9+ messages in thread
From: Andy Yan @ 2024-12-25 10:37 UTC (permalink / raw)
To: heiko
Cc: cristian.ciocaltea, krzk+dt, mripard, hjc, devicetree, dri-devel,
linux-arm-kernel, linux-kernel, linux-rockchip, Andy Yan
From: Andy Yan <andy.yan@rock-chips.com>
RK3576 HDMI TX Controller is very similar to that of RK3588, but with some
control bits for IO and interrupts status scattered across different GRF.
Signed-off-by: Andy Yan <andy.yan@rock-chips.com>
---
.../bindings/display/rockchip/rockchip,rk3588-dw-hdmi-qp.yaml | 1 +
1 file changed, 1 insertion(+)
diff --git a/Documentation/devicetree/bindings/display/rockchip/rockchip,rk3588-dw-hdmi-qp.yaml b/Documentation/devicetree/bindings/display/rockchip/rockchip,rk3588-dw-hdmi-qp.yaml
index d8e761865f27..b838b5ec2dca 100644
--- a/Documentation/devicetree/bindings/display/rockchip/rockchip,rk3588-dw-hdmi-qp.yaml
+++ b/Documentation/devicetree/bindings/display/rockchip/rockchip,rk3588-dw-hdmi-qp.yaml
@@ -29,6 +29,7 @@ allOf:
properties:
compatible:
enum:
+ - rockchip,rk3576-dw-hdmi-qp
- rockchip,rk3588-dw-hdmi-qp
reg:
--
2.34.1
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 3/3] drm/rockchip: Add basic RK3576 HDMI output support
2024-12-25 10:37 [PATCH 0/3] Add HDMI support for rk3576 Andy Yan
2024-12-25 10:37 ` [PATCH 1/3] drm/rockchip: dw_hdmi_qp: Add platform ctrl callback Andy Yan
2024-12-25 10:37 ` [PATCH 2/3] dt-bindings: display: rockchip: Add support for RK3576 HDMI TX Controller Andy Yan
@ 2024-12-25 10:37 ` Andy Yan
2025-01-02 11:56 ` Heiko Stübner
2 siblings, 1 reply; 9+ messages in thread
From: Andy Yan @ 2024-12-25 10:37 UTC (permalink / raw)
To: heiko
Cc: cristian.ciocaltea, krzk+dt, mripard, hjc, devicetree, dri-devel,
linux-arm-kernel, linux-kernel, linux-rockchip, Andy Yan,
Detlev Casanova
From: Andy Yan <andy.yan@rock-chips.com>
The HDMI on RK3576 shares the same IP block (PHY and Controller)
with rk3588.
However, there are some control bits scattered in different GRF.
Signed-off-by: Andy Yan <andy.yan@rock-chips.com>
Signed-off-by: Detlev Casanova <detlev.casanova@collabora.com>
Tested-by: Detlev Casanova <detlev.casanova@collabora.com>
---
.../gpu/drm/rockchip/dw_hdmi_qp-rockchip.c | 143 +++++++++++++++++-
1 file changed, 141 insertions(+), 2 deletions(-)
diff --git a/drivers/gpu/drm/rockchip/dw_hdmi_qp-rockchip.c b/drivers/gpu/drm/rockchip/dw_hdmi_qp-rockchip.c
index b21e868e7c16..bd9216e45e74 100644
--- a/drivers/gpu/drm/rockchip/dw_hdmi_qp-rockchip.c
+++ b/drivers/gpu/drm/rockchip/dw_hdmi_qp-rockchip.c
@@ -25,6 +25,41 @@
#include "rockchip_drm_drv.h"
+#define RK3576_IOC_MISC_CON0 0xa400
+#define RK3576_HDMI_HPD_INT_MSK BIT(2)
+#define RK3576_HDMI_HPD_INT_CLR BIT(1)
+
+#define RK3576_IOC_HDMI_HPD_STATUS 0xa440
+#define RK3576_HDMI_LEVEL_INT BIT(3)
+
+#define RK3576_VO0_GRF_SOC_CON1 0x0004
+#define RK3576_HDMI_FRL_MOD BIT(0)
+#define RK3576_HDMI_HDCP14_MEM_EN BIT(15)
+
+#define RK3576_VO0_GRF_SOC_CON8 0x0020
+#define RK3576_COLOR_FORMAT_MASK (0xf << 4)
+#define RK3576_COLOR_DEPTH_MASK (0xf << 8)
+#define RK3576_RGB (0 << 4)
+#define RK3576_YUV422 (0x1 << 4)
+#define RK3576_YUV444 (0x2 << 4)
+#define RK3576_YUV420 (0x3 << 4)
+#define RK3576_8BPC (0x0 << 8)
+#define RK3576_10BPC (0x6 << 8)
+#define RK3576_CECIN_MASK BIT(3)
+
+#define RK3576_VO0_GRF_SOC_CON12 0x0030
+#define RK3576_GRF_OSDA_DLYN (0xf << 12)
+#define RK3576_GRF_OSDA_DIV (0x7f << 1)
+#define RK3576_GRF_OSDA_DLY_EN BIT(0)
+
+#define RK3576_VO0_GRF_SOC_CON14 0x0038
+#define RK3576_I2S_SEL_MASK BIT(0)
+#define RK3576_SPDIF_SEL_MASK BIT(1)
+#define HDCP0_P1_GPIO_IN BIT(2)
+#define RK3576_SCLIN_MASK BIT(4)
+#define RK3576_SDAIN_MASK BIT(5)
+#define RK3576_HDMI_GRANT_SEL BIT(6)
+
#define RK3588_GRF_SOC_CON2 0x0308
#define RK3588_HDMI0_HPD_INT_MSK BIT(13)
#define RK3588_HDMI0_HPD_INT_CLR BIT(12)
@@ -167,6 +202,37 @@ static const struct dw_hdmi_qp_phy_ops rk3588_hdmi_phy_ops = {
.setup_hpd = dw_hdmi_qp_rk3588_setup_hpd,
};
+static enum drm_connector_status
+dw_hdmi_qp_rk3576_read_hpd(struct dw_hdmi_qp *dw_hdmi, void *data)
+{
+ struct rockchip_hdmi_qp *hdmi = (struct rockchip_hdmi_qp *)data;
+ u32 val;
+
+ regmap_read(hdmi->regmap, RK3576_IOC_HDMI_HPD_STATUS, &val);
+
+ return val & RK3576_HDMI_LEVEL_INT ?
+ connector_status_connected : connector_status_disconnected;
+}
+
+static void dw_hdmi_qp_rk3576_setup_hpd(struct dw_hdmi_qp *dw_hdmi, void *data)
+{
+ struct rockchip_hdmi_qp *hdmi = (struct rockchip_hdmi_qp *)data;
+ u32 val;
+
+ val = HIWORD_UPDATE(RK3576_HDMI_HPD_INT_CLR,
+ RK3576_HDMI_HPD_INT_CLR | RK3576_HDMI_HPD_INT_MSK);
+
+ regmap_write(hdmi->regmap, RK3576_IOC_MISC_CON0, val);
+ regmap_write(hdmi->regmap, 0xa404, 0xffff0102);
+}
+
+static const struct dw_hdmi_qp_phy_ops rk3576_hdmi_phy_ops = {
+ .init = dw_hdmi_qp_rk3588_phy_init,
+ .disable = dw_hdmi_qp_rk3588_phy_disable,
+ .read_hpd = dw_hdmi_qp_rk3576_read_hpd,
+ .setup_hpd = dw_hdmi_qp_rk3576_setup_hpd,
+};
+
static void dw_hdmi_qp_rk3588_hpd_work(struct work_struct *work)
{
struct rockchip_hdmi_qp *hdmi = container_of(work,
@@ -182,6 +248,45 @@ static void dw_hdmi_qp_rk3588_hpd_work(struct work_struct *work)
}
}
+static irqreturn_t dw_hdmi_qp_rk3576_hardirq(int irq, void *dev_id)
+{
+ struct rockchip_hdmi_qp *hdmi = dev_id;
+ u32 intr_stat, val;
+
+ regmap_read(hdmi->regmap, RK3576_IOC_HDMI_HPD_STATUS, &intr_stat);
+ if (intr_stat) {
+ val = HIWORD_UPDATE(RK3576_HDMI_HPD_INT_MSK,
+ RK3576_HDMI_HPD_INT_MSK);
+
+ regmap_write(hdmi->regmap, RK3576_IOC_MISC_CON0, val);
+ return IRQ_WAKE_THREAD;
+ }
+
+ return IRQ_NONE;
+}
+
+static irqreturn_t dw_hdmi_qp_rk3576_irq(int irq, void *dev_id)
+{
+ struct rockchip_hdmi_qp *hdmi = dev_id;
+ u32 intr_stat, val;
+
+ regmap_read(hdmi->regmap, RK3576_IOC_HDMI_HPD_STATUS, &intr_stat);
+
+ if (!intr_stat)
+ return IRQ_NONE;
+
+ val = HIWORD_UPDATE(RK3576_HDMI_HPD_INT_CLR,
+ RK3576_HDMI_HPD_INT_CLR);
+ regmap_write(hdmi->regmap, RK3576_IOC_MISC_CON0, val);
+ mod_delayed_work(system_wq, &hdmi->hpd_work,
+ msecs_to_jiffies(HOTPLUG_DEBOUNCE_MS));
+
+ val = HIWORD_UPDATE(0, RK3576_HDMI_HPD_INT_MSK);
+ regmap_write(hdmi->regmap, RK3576_IOC_MISC_CON0, val);
+
+ return IRQ_HANDLED;
+}
+
static irqreturn_t dw_hdmi_qp_rk3588_hardirq(int irq, void *dev_id)
{
struct rockchip_hdmi_qp *hdmi = dev_id;
@@ -232,6 +337,21 @@ static irqreturn_t dw_hdmi_qp_rk3588_irq(int irq, void *dev_id)
return IRQ_HANDLED;
}
+static void dw_hdmi_qp_rk3576_io_init(struct rockchip_hdmi_qp *hdmi)
+{
+ u32 val;
+
+ val = HIWORD_UPDATE(RK3576_SCLIN_MASK, RK3576_SCLIN_MASK) |
+ HIWORD_UPDATE(RK3576_SDAIN_MASK, RK3576_SDAIN_MASK) |
+ HIWORD_UPDATE(RK3576_HDMI_GRANT_SEL, RK3576_HDMI_GRANT_SEL) |
+ HIWORD_UPDATE(RK3576_I2S_SEL_MASK, RK3576_I2S_SEL_MASK);
+
+ regmap_write(hdmi->vo_regmap, RK3576_VO0_GRF_SOC_CON14, val);
+
+ val = HIWORD_UPDATE(0, RK3576_HDMI_HPD_INT_MSK);
+ regmap_write(hdmi->regmap, RK3576_IOC_MISC_CON0, val);
+}
+
static void dw_hdmi_qp_rk3588_io_init(struct rockchip_hdmi_qp *hdmi)
{
u32 val;
@@ -263,6 +383,12 @@ static void dw_hdmi_qp_rk3588_io_init(struct rockchip_hdmi_qp *hdmi)
regmap_write(hdmi->regmap, RK3588_GRF_SOC_CON2, val);
}
+static const struct rockchip_hdmi_qp_ctrl_ops rk3576_hdmi_ctrl_ops = {
+ .io_init = dw_hdmi_qp_rk3576_io_init,
+ .irq_callback = dw_hdmi_qp_rk3576_irq,
+ .hardirq_callback = dw_hdmi_qp_rk3576_hardirq,
+};
+
static const struct rockchip_hdmi_qp_ctrl_ops rk3588_hdmi_ctrl_ops = {
.io_init = dw_hdmi_qp_rk3588_io_init,
.irq_callback = dw_hdmi_qp_rk3588_irq,
@@ -276,6 +402,15 @@ struct rockchip_hdmi_qp_cfg {
const struct dw_hdmi_qp_phy_ops *phy_ops;
};
+static const struct rockchip_hdmi_qp_cfg rk3576_hdmi_cfg = {
+ .num_ports = 1,
+ .port_ids = {
+ 0x27da0000,
+ },
+ .ctrl_ops = &rk3576_hdmi_ctrl_ops,
+ .phy_ops = &rk3576_hdmi_phy_ops,
+};
+
static const struct rockchip_hdmi_qp_cfg rk3588_hdmi_cfg = {
.num_ports = 2,
.port_ids = {
@@ -287,8 +422,12 @@ static const struct rockchip_hdmi_qp_cfg rk3588_hdmi_cfg = {
};
static const struct of_device_id dw_hdmi_qp_rockchip_dt_ids[] = {
- { .compatible = "rockchip,rk3588-dw-hdmi-qp",
- .data = &rk3588_hdmi_cfg },
+ { .compatible = "rockchip,rk3576-dw-hdmi-qp",
+ .data = &rk3576_hdmi_cfg
+ }, {
+ .compatible = "rockchip,rk3588-dw-hdmi-qp",
+ .data = &rk3588_hdmi_cfg
+ },
{},
};
MODULE_DEVICE_TABLE(of, dw_hdmi_qp_rockchip_dt_ids);
--
2.34.1
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH 2/3] dt-bindings: display: rockchip: Add support for RK3576 HDMI TX Controller
2024-12-25 10:37 ` [PATCH 2/3] dt-bindings: display: rockchip: Add support for RK3576 HDMI TX Controller Andy Yan
@ 2025-01-02 7:58 ` Krzysztof Kozlowski
0 siblings, 0 replies; 9+ messages in thread
From: Krzysztof Kozlowski @ 2025-01-02 7:58 UTC (permalink / raw)
To: Andy Yan
Cc: heiko, cristian.ciocaltea, krzk+dt, mripard, hjc, devicetree,
dri-devel, linux-arm-kernel, linux-kernel, linux-rockchip,
Andy Yan
On Wed, Dec 25, 2024 at 06:37:30PM +0800, Andy Yan wrote:
> From: Andy Yan <andy.yan@rock-chips.com>
>
> RK3576 HDMI TX Controller is very similar to that of RK3588, but with some
> control bits for IO and interrupts status scattered across different GRF.
>
> Signed-off-by: Andy Yan <andy.yan@rock-chips.com>
> ---
Acked-by: Krzysztof Kozlowski <krzk@kernel.org>
Best regards,
Krzysztof
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 1/3] drm/rockchip: dw_hdmi_qp: Add platform ctrl callback
2024-12-25 10:37 ` [PATCH 1/3] drm/rockchip: dw_hdmi_qp: Add platform ctrl callback Andy Yan
@ 2025-01-02 11:51 ` Heiko Stübner
2025-01-06 8:35 ` Andy Yan
0 siblings, 1 reply; 9+ messages in thread
From: Heiko Stübner @ 2025-01-02 11:51 UTC (permalink / raw)
To: Andy Yan
Cc: cristian.ciocaltea, krzk+dt, mripard, hjc, devicetree, dri-devel,
linux-arm-kernel, linux-kernel, linux-rockchip, Andy Yan
Hi Andy,
Am Mittwoch, 25. Dezember 2024, 11:37:29 CET schrieb Andy Yan:
> From: Andy Yan <andy.yan@rock-chips.com>
>
> There are some control bits for IO and interrupts status scattered
> across different GRF on differt SOC.
> Add platform callback for this IO setting and interrupts status
> handling.
>
> Signed-off-by: Andy Yan <andy.yan@rock-chips.com>
>
> ---
>
> .../gpu/drm/rockchip/dw_hdmi_qp-rockchip.c | 81 ++++++++++++-------
> 1 file changed, 54 insertions(+), 27 deletions(-)
>
> diff --git a/drivers/gpu/drm/rockchip/dw_hdmi_qp-rockchip.c b/drivers/gpu/drm/rockchip/dw_hdmi_qp-rockchip.c
> index c36fc130b734..b21e868e7c16 100644
> --- a/drivers/gpu/drm/rockchip/dw_hdmi_qp-rockchip.c
> +++ b/drivers/gpu/drm/rockchip/dw_hdmi_qp-rockchip.c
> @@ -62,6 +62,12 @@ struct rockchip_hdmi_qp {
> int port_id;
> };
>
> +struct rockchip_hdmi_qp_ctrl_ops {
> + void (*io_init)(struct rockchip_hdmi_qp *hdmi);
> + irqreturn_t (*irq_callback)(int irq, void *dev_id);
> + irqreturn_t (*hardirq_callback)(int irq, void *dev_id);
> +};
> +
> static struct rockchip_hdmi_qp *to_rockchip_hdmi_qp(struct drm_encoder *encoder)
> {
> struct rockchip_encoder *rkencoder = to_rockchip_encoder(encoder);
> @@ -226,9 +232,47 @@ static irqreturn_t dw_hdmi_qp_rk3588_irq(int irq, void *dev_id)
> return IRQ_HANDLED;
> }
>
> +static void dw_hdmi_qp_rk3588_io_init(struct rockchip_hdmi_qp *hdmi)
> +{
> + u32 val;
> +
> + val = HIWORD_UPDATE(RK3588_SCLIN_MASK, RK3588_SCLIN_MASK) |
> + HIWORD_UPDATE(RK3588_SDAIN_MASK, RK3588_SDAIN_MASK) |
> + HIWORD_UPDATE(RK3588_MODE_MASK, RK3588_MODE_MASK) |
> + HIWORD_UPDATE(RK3588_I2S_SEL_MASK, RK3588_I2S_SEL_MASK);
> +
nit: below val = ... and regmap_write don't have a blank line between them
which makes sense to show that they belong together. So the blank above
can probably also go away.
> + regmap_write(hdmi->vo_regmap,
> + hdmi->port_id ? RK3588_GRF_VO1_CON6 : RK3588_GRF_VO1_CON3,
> + val);
> +
> + val = HIWORD_UPDATE(RK3588_SET_HPD_PATH_MASK, RK3588_SET_HPD_PATH_MASK);
> + regmap_write(hdmi->regmap, RK3588_GRF_SOC_CON7, val);
> +
> + if (hdmi->port_id)
> + val = HIWORD_UPDATE(RK3588_HDMI1_GRANT_SEL,
> + RK3588_HDMI1_GRANT_SEL);
> + else
> + val = HIWORD_UPDATE(RK3588_HDMI0_GRANT_SEL,
> + RK3588_HDMI0_GRANT_SEL);
> + regmap_write(hdmi->vo_regmap, RK3588_GRF_VO1_CON9, val);
> +
> + if (hdmi->port_id)
> + val = HIWORD_UPDATE(RK3588_HDMI1_HPD_INT_MSK, RK3588_HDMI1_HPD_INT_MSK);
> + else
> + val = HIWORD_UPDATE(RK3588_HDMI0_HPD_INT_MSK, RK3588_HDMI0_HPD_INT_MSK);
> + regmap_write(hdmi->regmap, RK3588_GRF_SOC_CON2, val);
> +}
> +
> +static const struct rockchip_hdmi_qp_ctrl_ops rk3588_hdmi_ctrl_ops = {
> + .io_init = dw_hdmi_qp_rk3588_io_init,
> + .irq_callback = dw_hdmi_qp_rk3588_irq,
> + .hardirq_callback = dw_hdmi_qp_rk3588_hardirq,
> +};
> +
> struct rockchip_hdmi_qp_cfg {
> unsigned int num_ports;
> unsigned int port_ids[MAX_HDMI_PORT_NUM];
> + const struct rockchip_hdmi_qp_ctrl_ops *ctrl_ops;
> const struct dw_hdmi_qp_phy_ops *phy_ops;
> };
>
> @@ -238,6 +282,7 @@ static const struct rockchip_hdmi_qp_cfg rk3588_hdmi_cfg = {
> 0xfde80000,
> 0xfdea0000,
> },
> + .ctrl_ops = &rk3588_hdmi_ctrl_ops,
> .phy_ops = &rk3588_hdmi_phy_ops,
> };
>
> @@ -282,6 +327,12 @@ static int dw_hdmi_qp_rockchip_bind(struct device *dev, struct device *master,
> if (!cfg)
> return -ENODEV;
>
> + if (!cfg->ctrl_ops || !cfg->ctrl_ops->io_init ||
> + !cfg->ctrl_ops->irq_callback || !cfg->ctrl_ops->irq_callback) {
cfg->ctrl_ops->irq_callback is checked twice, I guess one of them
should've been ctrl_ops->hardirq_callback?
Patch looks good otherwise.
Thanks
Heiko
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 3/3] drm/rockchip: Add basic RK3576 HDMI output support
2024-12-25 10:37 ` [PATCH 3/3] drm/rockchip: Add basic RK3576 HDMI output support Andy Yan
@ 2025-01-02 11:56 ` Heiko Stübner
0 siblings, 0 replies; 9+ messages in thread
From: Heiko Stübner @ 2025-01-02 11:56 UTC (permalink / raw)
To: Andy Yan, Detlev Casanova
Cc: cristian.ciocaltea, krzk+dt, mripard, hjc, devicetree, dri-devel,
linux-arm-kernel, linux-kernel, linux-rockchip, Andy Yan
Am Mittwoch, 25. Dezember 2024, 11:37:31 CET schrieb Andy Yan:
> From: Andy Yan <andy.yan@rock-chips.com>
>
> The HDMI on RK3576 shares the same IP block (PHY and Controller)
> with rk3588.
> However, there are some control bits scattered in different GRF.
>
> Signed-off-by: Andy Yan <andy.yan@rock-chips.com>
> Signed-off-by: Detlev Casanova <detlev.casanova@collabora.com>
> Tested-by: Detlev Casanova <detlev.casanova@collabora.com>
The attribution is strange. Where does the Signed-off from Detlev come
from?
At that position it would mean that he's the sender, but that's obviously
not the case.
I guess it's either just the Tested-by ... or you need an additional
Co-Developed-by if Detlev contributed to this patch.
> ---
>
> .../gpu/drm/rockchip/dw_hdmi_qp-rockchip.c | 143 +++++++++++++++++-
> 1 file changed, 141 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/rockchip/dw_hdmi_qp-rockchip.c b/drivers/gpu/drm/rockchip/dw_hdmi_qp-rockchip.c
> index b21e868e7c16..bd9216e45e74 100644
> --- a/drivers/gpu/drm/rockchip/dw_hdmi_qp-rockchip.c
> +++ b/drivers/gpu/drm/rockchip/dw_hdmi_qp-rockchip.c
[...]
> @@ -287,8 +422,12 @@ static const struct rockchip_hdmi_qp_cfg rk3588_hdmi_cfg = {
> };
>
> static const struct of_device_id dw_hdmi_qp_rockchip_dt_ids[] = {
> - { .compatible = "rockchip,rk3588-dw-hdmi-qp",
> - .data = &rk3588_hdmi_cfg },
> + { .compatible = "rockchip,rk3576-dw-hdmi-qp",
> + .data = &rk3576_hdmi_cfg
> + }, {
> + .compatible = "rockchip,rk3588-dw-hdmi-qp",
> + .data = &rk3588_hdmi_cfg
> + },
nit: please keep consistent styling between the listentries. Right now the
rk3576 and changed rk3588 entries use different styles.
Heiko
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re:Re: [PATCH 1/3] drm/rockchip: dw_hdmi_qp: Add platform ctrl callback
2025-01-02 11:51 ` Heiko Stübner
@ 2025-01-06 8:35 ` Andy Yan
2025-01-06 9:23 ` Heiko Stübner
0 siblings, 1 reply; 9+ messages in thread
From: Andy Yan @ 2025-01-06 8:35 UTC (permalink / raw)
To: Heiko Stübner
Cc: cristian.ciocaltea, krzk+dt, mripard, hjc, devicetree, dri-devel,
linux-arm-kernel, linux-kernel, linux-rockchip, Andy Yan
Hi Heiko,
At 2025-01-02 19:51:58, "Heiko Stübner" <heiko@sntech.de> wrote:
>Hi Andy,
>
>Am Mittwoch, 25. Dezember 2024, 11:37:29 CET schrieb Andy Yan:
>> From: Andy Yan <andy.yan@rock-chips.com>
>>
>> There are some control bits for IO and interrupts status scattered
>> across different GRF on differt SOC.
>> Add platform callback for this IO setting and interrupts status
>> handling.
>>
>> Signed-off-by: Andy Yan <andy.yan@rock-chips.com>
>>
>> ---
>>
>> .../gpu/drm/rockchip/dw_hdmi_qp-rockchip.c | 81 ++++++++++++-------
>> 1 file changed, 54 insertions(+), 27 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/rockchip/dw_hdmi_qp-rockchip.c b/drivers/gpu/drm/rockchip/dw_hdmi_qp-rockchip.c
>> index c36fc130b734..b21e868e7c16 100644
>> --- a/drivers/gpu/drm/rockchip/dw_hdmi_qp-rockchip.c
>> +++ b/drivers/gpu/drm/rockchip/dw_hdmi_qp-rockchip.c
>> @@ -62,6 +62,12 @@ struct rockchip_hdmi_qp {
>> int port_id;
>> };
>>
>> +struct rockchip_hdmi_qp_ctrl_ops {
>> + void (*io_init)(struct rockchip_hdmi_qp *hdmi);
>> + irqreturn_t (*irq_callback)(int irq, void *dev_id);
>> + irqreturn_t (*hardirq_callback)(int irq, void *dev_id);
>> +};
>> +
>> static struct rockchip_hdmi_qp *to_rockchip_hdmi_qp(struct drm_encoder *encoder)
>> {
>> struct rockchip_encoder *rkencoder = to_rockchip_encoder(encoder);
>> @@ -226,9 +232,47 @@ static irqreturn_t dw_hdmi_qp_rk3588_irq(int irq, void *dev_id)
>> return IRQ_HANDLED;
>> }
>>
>> +static void dw_hdmi_qp_rk3588_io_init(struct rockchip_hdmi_qp *hdmi)
>> +{
>> + u32 val;
>> +
>> + val = HIWORD_UPDATE(RK3588_SCLIN_MASK, RK3588_SCLIN_MASK) |
>> + HIWORD_UPDATE(RK3588_SDAIN_MASK, RK3588_SDAIN_MASK) |
>> + HIWORD_UPDATE(RK3588_MODE_MASK, RK3588_MODE_MASK) |
>> + HIWORD_UPDATE(RK3588_I2S_SEL_MASK, RK3588_I2S_SEL_MASK);
>> +
>
>nit: below val = ... and regmap_write don't have a blank line between them
>which makes sense to show that they belong together. So the blank above
>can probably also go away.
Okay, it will be removed in V2.
>
>> + regmap_write(hdmi->vo_regmap,
>> + hdmi->port_id ? RK3588_GRF_VO1_CON6 : RK3588_GRF_VO1_CON3,
>> + val);
>> +
>> + val = HIWORD_UPDATE(RK3588_SET_HPD_PATH_MASK, RK3588_SET_HPD_PATH_MASK);
>> + regmap_write(hdmi->regmap, RK3588_GRF_SOC_CON7, val);
>> +
>> + if (hdmi->port_id)
>> + val = HIWORD_UPDATE(RK3588_HDMI1_GRANT_SEL,
>> + RK3588_HDMI1_GRANT_SEL);
>> + else
>> + val = HIWORD_UPDATE(RK3588_HDMI0_GRANT_SEL,
>> + RK3588_HDMI0_GRANT_SEL);
>> + regmap_write(hdmi->vo_regmap, RK3588_GRF_VO1_CON9, val);
>> +
>> + if (hdmi->port_id)
>> + val = HIWORD_UPDATE(RK3588_HDMI1_HPD_INT_MSK, RK3588_HDMI1_HPD_INT_MSK);
>> + else
>> + val = HIWORD_UPDATE(RK3588_HDMI0_HPD_INT_MSK, RK3588_HDMI0_HPD_INT_MSK);
>> + regmap_write(hdmi->regmap, RK3588_GRF_SOC_CON2, val);
>> +}
>> +
>> +static const struct rockchip_hdmi_qp_ctrl_ops rk3588_hdmi_ctrl_ops = {
>> + .io_init = dw_hdmi_qp_rk3588_io_init,
>> + .irq_callback = dw_hdmi_qp_rk3588_irq,
>> + .hardirq_callback = dw_hdmi_qp_rk3588_hardirq,
>> +};
>> +
>> struct rockchip_hdmi_qp_cfg {
>> unsigned int num_ports;
>> unsigned int port_ids[MAX_HDMI_PORT_NUM];
>> + const struct rockchip_hdmi_qp_ctrl_ops *ctrl_ops;
>> const struct dw_hdmi_qp_phy_ops *phy_ops;
>> };
>>
>> @@ -238,6 +282,7 @@ static const struct rockchip_hdmi_qp_cfg rk3588_hdmi_cfg = {
>> 0xfde80000,
>> 0xfdea0000,
>> },
>> + .ctrl_ops = &rk3588_hdmi_ctrl_ops,
>> .phy_ops = &rk3588_hdmi_phy_ops,
>> };
>>
>> @@ -282,6 +327,12 @@ static int dw_hdmi_qp_rockchip_bind(struct device *dev, struct device *master,
>> if (!cfg)
>> return -ENODEV;
>>
>> + if (!cfg->ctrl_ops || !cfg->ctrl_ops->io_init ||
>> + !cfg->ctrl_ops->irq_callback || !cfg->ctrl_ops->irq_callback) {
>
>cfg->ctrl_ops->irq_callback is checked twice, I guess one of them
>should've been ctrl_ops->hardirq_callback?
Yes,Thank you for catching it。
>
>Patch looks good otherwise.
>
>Thanks
>Heiko
>
>
>
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 1/3] drm/rockchip: dw_hdmi_qp: Add platform ctrl callback
2025-01-06 8:35 ` Andy Yan
@ 2025-01-06 9:23 ` Heiko Stübner
0 siblings, 0 replies; 9+ messages in thread
From: Heiko Stübner @ 2025-01-06 9:23 UTC (permalink / raw)
To: Andy Yan
Cc: cristian.ciocaltea, krzk+dt, mripard, hjc, devicetree, dri-devel,
linux-arm-kernel, linux-kernel, linux-rockchip, Andy Yan
Am Montag, 6. Januar 2025, 09:35:26 CET schrieb Andy Yan:
>
> Hi Heiko,
>
> At 2025-01-02 19:51:58, "Heiko Stübner" <heiko@sntech.de> wrote:
> >Hi Andy,
> >
> >Am Mittwoch, 25. Dezember 2024, 11:37:29 CET schrieb Andy Yan:
> >> From: Andy Yan <andy.yan@rock-chips.com>
> >>
> >> There are some control bits for IO and interrupts status scattered
> >> across different GRF on differt SOC.
> >> Add platform callback for this IO setting and interrupts status
> >> handling.
> >>
> >> Signed-off-by: Andy Yan <andy.yan@rock-chips.com>
> >>
> >> ---
> >>
> >> .../gpu/drm/rockchip/dw_hdmi_qp-rockchip.c | 81 ++++++++++++-------
> >> 1 file changed, 54 insertions(+), 27 deletions(-)
> >>
> >> diff --git a/drivers/gpu/drm/rockchip/dw_hdmi_qp-rockchip.c b/drivers/gpu/drm/rockchip/dw_hdmi_qp-rockchip.c
> >> index c36fc130b734..b21e868e7c16 100644
> >> --- a/drivers/gpu/drm/rockchip/dw_hdmi_qp-rockchip.c
> >> +++ b/drivers/gpu/drm/rockchip/dw_hdmi_qp-rockchip.c
> >> @@ -62,6 +62,12 @@ struct rockchip_hdmi_qp {
> >> int port_id;
> >> };
> >>
> >> +struct rockchip_hdmi_qp_ctrl_ops {
> >> + void (*io_init)(struct rockchip_hdmi_qp *hdmi);
> >> + irqreturn_t (*irq_callback)(int irq, void *dev_id);
> >> + irqreturn_t (*hardirq_callback)(int irq, void *dev_id);
> >> +};
> >> +
> >> static struct rockchip_hdmi_qp *to_rockchip_hdmi_qp(struct drm_encoder *encoder)
> >> {
> >> struct rockchip_encoder *rkencoder = to_rockchip_encoder(encoder);
> >> @@ -226,9 +232,47 @@ static irqreturn_t dw_hdmi_qp_rk3588_irq(int irq, void *dev_id)
> >> return IRQ_HANDLED;
> >> }
> >>
> >> +static void dw_hdmi_qp_rk3588_io_init(struct rockchip_hdmi_qp *hdmi)
> >> +{
> >> + u32 val;
> >> +
> >> + val = HIWORD_UPDATE(RK3588_SCLIN_MASK, RK3588_SCLIN_MASK) |
> >> + HIWORD_UPDATE(RK3588_SDAIN_MASK, RK3588_SDAIN_MASK) |
> >> + HIWORD_UPDATE(RK3588_MODE_MASK, RK3588_MODE_MASK) |
> >> + HIWORD_UPDATE(RK3588_I2S_SEL_MASK, RK3588_I2S_SEL_MASK);
> >> +
> >
> >nit: below val = ... and regmap_write don't have a blank line between them
> >which makes sense to show that they belong together. So the blank above
> >can probably also go away.
>
> Okay, it will be removed in V2.
just realized that I commented on the "wrong" version :-)
https://lore.kernel.org/r/20241231094425.253398-1-andyshrk@163.com
seems to be the most recent one.
Heiko
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2025-01-06 9:25 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-12-25 10:37 [PATCH 0/3] Add HDMI support for rk3576 Andy Yan
2024-12-25 10:37 ` [PATCH 1/3] drm/rockchip: dw_hdmi_qp: Add platform ctrl callback Andy Yan
2025-01-02 11:51 ` Heiko Stübner
2025-01-06 8:35 ` Andy Yan
2025-01-06 9:23 ` Heiko Stübner
2024-12-25 10:37 ` [PATCH 2/3] dt-bindings: display: rockchip: Add support for RK3576 HDMI TX Controller Andy Yan
2025-01-02 7:58 ` Krzysztof Kozlowski
2024-12-25 10:37 ` [PATCH 3/3] drm/rockchip: Add basic RK3576 HDMI output support Andy Yan
2025-01-02 11:56 ` Heiko Stübner
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).