* [PATCH 00/12] drm: sprd: Make the Unisoc DRM driver usable on UMS9230
@ 2025-07-19 12:09 Otto Pflüger
2025-07-19 12:09 ` [PATCH 01/12] dt-bindings: display: sprd: adapt for UMS9230 support Otto Pflüger
` (11 more replies)
0 siblings, 12 replies; 22+ messages in thread
From: Otto Pflüger @ 2025-07-19 12:09 UTC (permalink / raw)
To: David Airlie, Simona Vetter, Maarten Lankhorst, Maxime Ripard,
Thomas Zimmermann, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
Orson Zhai, Baolin Wang, Chunyan Zhang, Kevin Tang
Cc: dri-devel, devicetree, linux-kernel, Otto Pflüger
Fix some existing bugs that prevent the driver from working properly
and adapt the platform-specific code to support the UMS9230 SoC.
Signed-off-by: Otto Pflüger <otto.pflueger@abscue.de>
---
Otto Pflüger (12):
dt-bindings: display: sprd: adapt for UMS9230 support
dt-bindings: display: sprd: allow attaching a DSI panel
drm: of: try binding port parent node instead of the port itself
drm: sprd: remove plane and crtc destroy callbacks
drm: sprd: register a DSI bridge and move init code to pre_enable
drm: sprd: add support for UMS9230 DSI PLL
drm: sprd: fix DSI rate and PLL setup code
drm: sprd: add gate clock support
drm: sprd: add support for newer DPU versions
drm: sprd: always initialize DPU and DSI registers
drm: sprd: add fbdev support
drm: sprd: select REGMAP in Kconfig
.../display/sprd/sprd,display-subsystem.yaml | 11 ++
.../bindings/display/sprd/sprd,sharkl3-dpu.yaml | 18 +-
.../display/sprd/sprd,sharkl3-dsi-host.yaml | 38 +++--
drivers/gpu/drm/drm_of.c | 2 +-
drivers/gpu/drm/sprd/Kconfig | 3 +
drivers/gpu/drm/sprd/megacores_pll.c | 28 ++--
drivers/gpu/drm/sprd/sprd_dpu.c | 47 ++++--
drivers/gpu/drm/sprd/sprd_dpu.h | 1 +
drivers/gpu/drm/sprd/sprd_drm.c | 5 +
drivers/gpu/drm/sprd/sprd_dsi.c | 182 ++++++++++++++-------
drivers/gpu/drm/sprd/sprd_dsi.h | 17 +-
11 files changed, 247 insertions(+), 105 deletions(-)
---
base-commit: d086c886ceb9f59dea6c3a9dae7eb89e780a20c9
change-id: 20250719-ums9230-drm-eb271289bfcd
Best regards,
--
Otto Pflüger <otto.pflueger@abscue.de>
^ permalink raw reply [flat|nested] 22+ messages in thread
* [PATCH 01/12] dt-bindings: display: sprd: adapt for UMS9230 support
2025-07-19 12:09 [PATCH 00/12] drm: sprd: Make the Unisoc DRM driver usable on UMS9230 Otto Pflüger
@ 2025-07-19 12:09 ` Otto Pflüger
2025-07-19 13:24 ` Rob Herring (Arm)
2025-07-20 12:26 ` Krzysztof Kozlowski
2025-07-19 12:09 ` [PATCH 02/12] dt-bindings: display: sprd: allow attaching a DSI panel Otto Pflüger
` (10 subsequent siblings)
11 siblings, 2 replies; 22+ messages in thread
From: Otto Pflüger @ 2025-07-19 12:09 UTC (permalink / raw)
To: David Airlie, Simona Vetter, Maarten Lankhorst, Maxime Ripard,
Thomas Zimmermann, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
Orson Zhai, Baolin Wang, Chunyan Zhang, Kevin Tang
Cc: dri-devel, devicetree, linux-kernel, Otto Pflüger
Add the compatible strings for the display controller found in the
UMS9230 SoC and bindings for a gate clock. Add IOMMU-related bindings
to the display-subsystem node.
Signed-off-by: Otto Pflüger <otto.pflueger@abscue.de>
---
.../bindings/display/sprd/sprd,display-subsystem.yaml | 11 +++++++++++
.../bindings/display/sprd/sprd,sharkl3-dpu.yaml | 18 +++++++++++++-----
.../bindings/display/sprd/sprd,sharkl3-dsi-host.yaml | 11 ++++++++---
3 files changed, 32 insertions(+), 8 deletions(-)
diff --git a/Documentation/devicetree/bindings/display/sprd/sprd,display-subsystem.yaml b/Documentation/devicetree/bindings/display/sprd/sprd,display-subsystem.yaml
index b3d5e1b96fae2f24ff2afb26c9c3ce0212856be4..d02f79c602f515533f60a993539ed7cd82ce22ec 100644
--- a/Documentation/devicetree/bindings/display/sprd/sprd,display-subsystem.yaml
+++ b/Documentation/devicetree/bindings/display/sprd/sprd,display-subsystem.yaml
@@ -43,6 +43,17 @@ properties:
compatible:
const: sprd,display-subsystem
+ iommus:
+ maxItems: 1
+
+ memory-region:
+ maxItems: 1
+ description:
+ A phandle to the framebuffer region configured by the bootloader. This
+ can be used together with an iommu-addresses property on the reserved
+ memory region to create an initial passthrough mapping for the boot
+ splash framebuffer.
+
ports:
$ref: /schemas/types.yaml#/definitions/phandle-array
items:
diff --git a/Documentation/devicetree/bindings/display/sprd/sprd,sharkl3-dpu.yaml b/Documentation/devicetree/bindings/display/sprd/sprd,sharkl3-dpu.yaml
index 4ebea60b8c5ba5f177854e3a8d89e93e7304e18b..6fedb6e508b247eb71da17ced589b8ed09085592 100644
--- a/Documentation/devicetree/bindings/display/sprd/sprd,sharkl3-dpu.yaml
+++ b/Documentation/devicetree/bindings/display/sprd/sprd,sharkl3-dpu.yaml
@@ -16,7 +16,12 @@ description: |
properties:
compatible:
- const: sprd,sharkl3-dpu
+ oneOf:
+ - items:
+ - enum:
+ - sprd,ums9230-dpu
+ - const: sprd,sharkl3-dpu
+ - const: sprd,sharkl3-dpu
reg:
maxItems: 1
@@ -25,12 +30,15 @@ properties:
maxItems: 1
clocks:
- minItems: 2
+ minItems: 1
clock-names:
- items:
- - const: clk_src_128m
- - const: clk_src_384m
+ oneOf:
+ - items:
+ - const: clk_src_128m
+ - const: clk_src_384m
+ - items:
+ - const: enable
power-domains:
maxItems: 1
diff --git a/Documentation/devicetree/bindings/display/sprd/sprd,sharkl3-dsi-host.yaml b/Documentation/devicetree/bindings/display/sprd/sprd,sharkl3-dsi-host.yaml
index bc5594d18643010b91376c92a8f235a522d7dc3d..8438d2da0a4277db03e30b13cb270684c0c360cb 100644
--- a/Documentation/devicetree/bindings/display/sprd/sprd,sharkl3-dsi-host.yaml
+++ b/Documentation/devicetree/bindings/display/sprd/sprd,sharkl3-dsi-host.yaml
@@ -11,7 +11,9 @@ maintainers:
properties:
compatible:
- const: sprd,sharkl3-dsi-host
+ enum:
+ - sprd,sharkl3-dsi-host
+ - sprd,ums9230-dsi-host
reg:
maxItems: 1
@@ -23,8 +25,11 @@ properties:
minItems: 1
clock-names:
- items:
- - const: clk_src_96m
+ oneOf:
+ - items:
+ - const: clk_src_96m
+ - items:
+ - const: enable
power-domains:
maxItems: 1
--
2.50.0
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [PATCH 02/12] dt-bindings: display: sprd: allow attaching a DSI panel
2025-07-19 12:09 [PATCH 00/12] drm: sprd: Make the Unisoc DRM driver usable on UMS9230 Otto Pflüger
2025-07-19 12:09 ` [PATCH 01/12] dt-bindings: display: sprd: adapt for UMS9230 support Otto Pflüger
@ 2025-07-19 12:09 ` Otto Pflüger
2025-07-19 12:09 ` [PATCH 03/12] drm: of: try binding port parent node instead of the port itself Otto Pflüger
` (9 subsequent siblings)
11 siblings, 0 replies; 22+ messages in thread
From: Otto Pflüger @ 2025-07-19 12:09 UTC (permalink / raw)
To: David Airlie, Simona Vetter, Maarten Lankhorst, Maxime Ripard,
Thomas Zimmermann, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
Orson Zhai, Baolin Wang, Chunyan Zhang, Kevin Tang
Cc: dri-devel, devicetree, linux-kernel, Otto Pflüger
Add a DSI output port and include common DSI controller bindings in the
bindings for the Unisoc DSI controller.
Signed-off-by: Otto Pflüger <otto.pflueger@abscue.de>
---
.../display/sprd/sprd,sharkl3-dsi-host.yaml | 27 ++++++++++++++++------
1 file changed, 20 insertions(+), 7 deletions(-)
diff --git a/Documentation/devicetree/bindings/display/sprd/sprd,sharkl3-dsi-host.yaml b/Documentation/devicetree/bindings/display/sprd/sprd,sharkl3-dsi-host.yaml
index 8438d2da0a4277db03e30b13cb270684c0c360cb..d9a77f7228e145b955b57746967e08e56f5a0c89 100644
--- a/Documentation/devicetree/bindings/display/sprd/sprd,sharkl3-dsi-host.yaml
+++ b/Documentation/devicetree/bindings/display/sprd/sprd,sharkl3-dsi-host.yaml
@@ -45,12 +45,22 @@ properties:
const: 0
port@0:
- type: object
- description:
- A port node with endpoint definitions as defined in
- Documentation/devicetree/bindings/media/video-interfaces.txt.
- That port should be the input endpoint, usually coming from
- the associated DPU.
+ $ref: /schemas/graph.yaml#/$defs/port-base
+ unevaluatedProperties: false
+ properties:
+ endpoint:
+ $ref: /schemas/media/video-interfaces.yaml#
+ unevaluatedProperties: false
+ description: The input endpoint, usually connected to the DPU
+
+ port@1:
+ $ref: /schemas/graph.yaml#/$defs/port-base
+ unevaluatedProperties: false
+ properties:
+ endpoint:
+ $ref: /schemas/media/video-interfaces.yaml#
+ unevaluatedProperties: false
+ description: The output endpoint, usually connected to the panel
required:
- "#address-cells"
@@ -59,6 +69,9 @@ properties:
additionalProperties: false
+allOf:
+ - $ref: /schemas/display/dsi-controller.yaml#
+
required:
- compatible
- reg
@@ -67,7 +80,7 @@ required:
- clock-names
- ports
-additionalProperties: false
+unevaluatedProperties: false
examples:
- |
--
2.50.0
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [PATCH 03/12] drm: of: try binding port parent node instead of the port itself
2025-07-19 12:09 [PATCH 00/12] drm: sprd: Make the Unisoc DRM driver usable on UMS9230 Otto Pflüger
2025-07-19 12:09 ` [PATCH 01/12] dt-bindings: display: sprd: adapt for UMS9230 support Otto Pflüger
2025-07-19 12:09 ` [PATCH 02/12] dt-bindings: display: sprd: allow attaching a DSI panel Otto Pflüger
@ 2025-07-19 12:09 ` Otto Pflüger
2025-07-28 15:41 ` Dmitry Baryshkov
2025-07-19 12:09 ` [PATCH 04/12] drm: sprd: remove plane and crtc destroy callbacks Otto Pflüger
` (8 subsequent siblings)
11 siblings, 1 reply; 22+ messages in thread
From: Otto Pflüger @ 2025-07-19 12:09 UTC (permalink / raw)
To: David Airlie, Simona Vetter, Maarten Lankhorst, Maxime Ripard,
Thomas Zimmermann, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
Orson Zhai, Baolin Wang, Chunyan Zhang, Kevin Tang
Cc: dri-devel, devicetree, linux-kernel, Otto Pflüger
The drm_of_component_probe function is intended to bind all devices in
an OF graph given a set of ports linked using the "ports" property on a
main device node. This means that it should also bind the components
providing these ports, not just the components of other ports connected
to them. In order to do this, it calls drm_of_component_match_add with
a pointer to each port node after checking that its parent node is a
device.
However, when given a pointer to the port node, the compare_of callback
does not match it with a device node and thus fails to detect that the
node belongs to a component. Fix this by passing a pointer to the parent
node here too.
Currently only the Unisoc platform driver relies on this feature, which
was previously broken and is fixed by this change. On other platforms,
the "ports" property points to ports that are not part of a component,
i.e. the components only have indirect connections to the main node.
Signed-off-by: Otto Pflüger <otto.pflueger@abscue.de>
---
drivers/gpu/drm/drm_of.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/drm_of.c b/drivers/gpu/drm/drm_of.c
index d0183dea770308e77f05da364ffe087d53f3be36..b972facc2ec3fe40a4e10b5d7178b5ac8c0158d5 100644
--- a/drivers/gpu/drm/drm_of.c
+++ b/drivers/gpu/drm/drm_of.c
@@ -132,7 +132,7 @@ int drm_of_component_probe(struct device *dev,
if (of_device_is_available(port->parent))
drm_of_component_match_add(dev, &match, compare_of,
- port);
+ port->parent);
of_node_put(port);
}
--
2.50.0
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [PATCH 04/12] drm: sprd: remove plane and crtc destroy callbacks
2025-07-19 12:09 [PATCH 00/12] drm: sprd: Make the Unisoc DRM driver usable on UMS9230 Otto Pflüger
` (2 preceding siblings ...)
2025-07-19 12:09 ` [PATCH 03/12] drm: of: try binding port parent node instead of the port itself Otto Pflüger
@ 2025-07-19 12:09 ` Otto Pflüger
2025-07-28 15:41 ` Dmitry Baryshkov
2025-07-19 12:09 ` [PATCH 05/12] drm: sprd: register a DSI bridge and move init code to pre_enable Otto Pflüger
` (7 subsequent siblings)
11 siblings, 1 reply; 22+ messages in thread
From: Otto Pflüger @ 2025-07-19 12:09 UTC (permalink / raw)
To: David Airlie, Simona Vetter, Maarten Lankhorst, Maxime Ripard,
Thomas Zimmermann, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
Orson Zhai, Baolin Wang, Chunyan Zhang, Kevin Tang
Cc: dri-devel, devicetree, linux-kernel, Otto Pflüger
These callbacks are now required to be NULL and trigger a runtime
warning if they are present.
Signed-off-by: Otto Pflüger <otto.pflueger@abscue.de>
---
drivers/gpu/drm/sprd/sprd_dpu.c | 2 --
1 file changed, 2 deletions(-)
diff --git a/drivers/gpu/drm/sprd/sprd_dpu.c b/drivers/gpu/drm/sprd/sprd_dpu.c
index a3447622a33cd612e34be038e833222567bdcd2c..0d9eb778794d92418b39f8535d94abde3566de43 100644
--- a/drivers/gpu/drm/sprd/sprd_dpu.c
+++ b/drivers/gpu/drm/sprd/sprd_dpu.c
@@ -577,7 +577,6 @@ static const struct drm_plane_helper_funcs sprd_plane_helper_funcs = {
static const struct drm_plane_funcs sprd_plane_funcs = {
.update_plane = drm_atomic_helper_update_plane,
.disable_plane = drm_atomic_helper_disable_plane,
- .destroy = drm_plane_cleanup,
.reset = drm_atomic_helper_plane_reset,
.atomic_duplicate_state = drm_atomic_helper_plane_duplicate_state,
.atomic_destroy_state = drm_atomic_helper_plane_destroy_state,
@@ -704,7 +703,6 @@ static const struct drm_crtc_helper_funcs sprd_crtc_helper_funcs = {
};
static const struct drm_crtc_funcs sprd_crtc_funcs = {
- .destroy = drm_crtc_cleanup,
.set_config = drm_atomic_helper_set_config,
.page_flip = drm_atomic_helper_page_flip,
.reset = drm_atomic_helper_crtc_reset,
--
2.50.0
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [PATCH 05/12] drm: sprd: register a DSI bridge and move init code to pre_enable
2025-07-19 12:09 [PATCH 00/12] drm: sprd: Make the Unisoc DRM driver usable on UMS9230 Otto Pflüger
` (3 preceding siblings ...)
2025-07-19 12:09 ` [PATCH 04/12] drm: sprd: remove plane and crtc destroy callbacks Otto Pflüger
@ 2025-07-19 12:09 ` Otto Pflüger
2025-07-28 15:43 ` Dmitry Baryshkov
2025-07-19 12:09 ` [PATCH 06/12] drm: sprd: add support for UMS9230 DSI PLL Otto Pflüger
` (6 subsequent siblings)
11 siblings, 1 reply; 22+ messages in thread
From: Otto Pflüger @ 2025-07-19 12:09 UTC (permalink / raw)
To: David Airlie, Simona Vetter, Maarten Lankhorst, Maxime Ripard,
Thomas Zimmermann, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
Orson Zhai, Baolin Wang, Chunyan Zhang, Kevin Tang
Cc: dri-devel, devicetree, linux-kernel, Otto Pflüger
If a panel needs to send DSI commands during initialization, it sets the
prepare_prev_first flag, which allows the DSI host to initialize itself
before the panel's prepare function is called. To support this, the DSI
host must register a bridge and perform the necessary initialization
steps in its pre_enable function.
Implement this for the Unisoc DSI driver by moving the initialization
code from the encoder callbacks to a bridge and simplify the remaining
encoder-related code which no longer needs any callbacks.
Signed-off-by: Otto Pflüger <otto.pflueger@abscue.de>
---
drivers/gpu/drm/sprd/Kconfig | 2 +
drivers/gpu/drm/sprd/sprd_dsi.c | 143 +++++++++++++++++++++++++---------------
drivers/gpu/drm/sprd/sprd_dsi.h | 4 ++
3 files changed, 97 insertions(+), 52 deletions(-)
diff --git a/drivers/gpu/drm/sprd/Kconfig b/drivers/gpu/drm/sprd/Kconfig
index e22b780fe82248296a7153d02269faf8cd63294f..1afcdbf6f0ee3304f2297835241c9bb10d422154 100644
--- a/drivers/gpu/drm/sprd/Kconfig
+++ b/drivers/gpu/drm/sprd/Kconfig
@@ -2,6 +2,8 @@ config DRM_SPRD
tristate "DRM Support for Unisoc SoCs Platform"
depends on ARCH_SPRD || COMPILE_TEST
depends on DRM && OF
+ select DRM_BRIDGE_CONNECTOR
+ select DRM_DISPLAY_HELPER
select DRM_GEM_DMA_HELPER
select DRM_KMS_HELPER
select DRM_MIPI_DSI
diff --git a/drivers/gpu/drm/sprd/sprd_dsi.c b/drivers/gpu/drm/sprd/sprd_dsi.c
index 23b0e1dc547a5023ee6ad7d5e1c49e2cec986bf0..43fff12d73f12619da57606a3c4785924e2c1507 100644
--- a/drivers/gpu/drm/sprd/sprd_dsi.c
+++ b/drivers/gpu/drm/sprd/sprd_dsi.c
@@ -11,8 +11,10 @@
#include <drm/drm_atomic_helper.h>
#include <drm/drm_bridge.h>
+#include <drm/drm_bridge_connector.h>
#include <drm/drm_of.h>
#include <drm/drm_probe_helper.h>
+#include <drm/drm_simple_kms_helper.h>
#include "sprd_drm.h"
#include "sprd_dpu.h"
@@ -778,19 +780,53 @@ static void sprd_dphy_fini(struct dsi_context *ctx)
dsi_reg_up(ctx, PHY_INTERFACE_CTRL, RF_PHY_RESET_N, RF_PHY_RESET_N);
}
-static void sprd_dsi_encoder_mode_set(struct drm_encoder *encoder,
- struct drm_display_mode *mode,
- struct drm_display_mode *adj_mode)
+static int sprd_dsi_encoder_init(struct sprd_dsi *dsi,
+ struct device *dev)
+{
+ struct drm_encoder *encoder = &dsi->encoder;
+ u32 crtc_mask;
+ int ret;
+
+ crtc_mask = drm_of_find_possible_crtcs(dsi->drm, dev->of_node);
+ if (!crtc_mask) {
+ drm_err(dsi->drm, "failed to find crtc mask\n");
+ return -EINVAL;
+ }
+
+ drm_dbg(dsi->drm, "find possible crtcs: 0x%08x\n", crtc_mask);
+
+ encoder->possible_crtcs = crtc_mask;
+ ret = drm_simple_encoder_init(dsi->drm, encoder, DRM_MODE_ENCODER_DSI);
+ if (ret) {
+ drm_err(dsi->drm, "failed to init dsi encoder\n");
+ return ret;
+ }
+
+ return 0;
+}
+
+static int sprd_dsi_bridge_attach(struct drm_bridge *bridge,
+ struct drm_encoder *encoder,
+ enum drm_bridge_attach_flags flags)
+{
+ struct sprd_dsi *dsi = bridge_to_dsi(bridge);
+
+ return drm_bridge_attach(&dsi->encoder, dsi->panel_bridge,
+ bridge, flags);
+}
+
+static void sprd_dsi_bridge_mode_set(struct drm_bridge *bridge,
+ const struct drm_display_mode *mode,
+ const struct drm_display_mode *adj_mode)
{
- struct sprd_dsi *dsi = encoder_to_dsi(encoder);
+ struct sprd_dsi *dsi = bridge_to_dsi(bridge);
drm_display_mode_to_videomode(adj_mode, &dsi->ctx.vm);
}
-static void sprd_dsi_encoder_enable(struct drm_encoder *encoder)
+static void sprd_dsi_bridge_pre_enable(struct drm_bridge *bridge)
{
- struct sprd_dsi *dsi = encoder_to_dsi(encoder);
- struct sprd_dpu *dpu = to_sprd_crtc(encoder->crtc);
+ struct sprd_dsi *dsi = bridge_to_dsi(bridge);
struct dsi_context *ctx = &dsi->ctx;
if (ctx->enabled) {
@@ -819,15 +855,15 @@ static void sprd_dsi_encoder_enable(struct drm_encoder *encoder)
dphy_wait_pll_locked(ctx);
}
- sprd_dpu_run(dpu);
+ /* DSI commands cannot be issued unless the DPU is running. */
+ sprd_dpu_run(to_sprd_crtc(dsi->encoder.crtc));
ctx->enabled = true;
}
-static void sprd_dsi_encoder_disable(struct drm_encoder *encoder)
+static void sprd_dsi_bridge_post_disable(struct drm_bridge *bridge)
{
- struct sprd_dsi *dsi = encoder_to_dsi(encoder);
- struct sprd_dpu *dpu = to_sprd_crtc(encoder->crtc);
+ struct sprd_dsi *dsi = bridge_to_dsi(bridge);
struct dsi_context *ctx = &dsi->ctx;
if (!ctx->enabled) {
@@ -835,51 +871,21 @@ static void sprd_dsi_encoder_disable(struct drm_encoder *encoder)
return;
}
- sprd_dpu_stop(dpu);
+ sprd_dpu_stop(to_sprd_crtc(dsi->encoder.crtc));
+
sprd_dphy_fini(ctx);
sprd_dsi_fini(ctx);
ctx->enabled = false;
}
-static const struct drm_encoder_helper_funcs sprd_encoder_helper_funcs = {
- .mode_set = sprd_dsi_encoder_mode_set,
- .enable = sprd_dsi_encoder_enable,
- .disable = sprd_dsi_encoder_disable
+static const struct drm_bridge_funcs sprd_dsi_bridge_funcs = {
+ .attach = sprd_dsi_bridge_attach,
+ .mode_set = sprd_dsi_bridge_mode_set,
+ .pre_enable = sprd_dsi_bridge_pre_enable,
+ .post_disable = sprd_dsi_bridge_post_disable,
};
-static const struct drm_encoder_funcs sprd_encoder_funcs = {
- .destroy = drm_encoder_cleanup,
-};
-
-static int sprd_dsi_encoder_init(struct sprd_dsi *dsi,
- struct device *dev)
-{
- struct drm_encoder *encoder = &dsi->encoder;
- u32 crtc_mask;
- int ret;
-
- crtc_mask = drm_of_find_possible_crtcs(dsi->drm, dev->of_node);
- if (!crtc_mask) {
- drm_err(dsi->drm, "failed to find crtc mask\n");
- return -EINVAL;
- }
-
- drm_dbg(dsi->drm, "find possible crtcs: 0x%08x\n", crtc_mask);
-
- encoder->possible_crtcs = crtc_mask;
- ret = drm_encoder_init(dsi->drm, encoder, &sprd_encoder_funcs,
- DRM_MODE_ENCODER_DSI, NULL);
- if (ret) {
- drm_err(dsi->drm, "failed to init dsi encoder\n");
- return ret;
- }
-
- drm_encoder_helper_add(encoder, &sprd_encoder_helper_funcs);
-
- return 0;
-}
-
static int sprd_dsi_bridge_init(struct sprd_dsi *dsi,
struct device *dev)
{
@@ -889,11 +895,35 @@ static int sprd_dsi_bridge_init(struct sprd_dsi *dsi,
if (IS_ERR(dsi->panel_bridge))
return PTR_ERR(dsi->panel_bridge);
- ret = drm_bridge_attach(&dsi->encoder, dsi->panel_bridge, NULL, 0);
+ dsi->bridge.funcs = &sprd_dsi_bridge_funcs;
+ dsi->bridge.of_node = dev->of_node;
+ dsi->bridge.type = DRM_MODE_CONNECTOR_DSI;
+
+ drm_bridge_add(&dsi->bridge);
+
+ ret = drm_bridge_attach(&dsi->encoder, &dsi->bridge, NULL,
+ DRM_BRIDGE_ATTACH_NO_CONNECTOR);
if (ret)
- return ret;
+ goto err_cleanup;
+
+ dsi->connector = drm_bridge_connector_init(dsi->drm, &dsi->encoder);
+ if (IS_ERR(dsi->connector)) {
+ drm_err(dsi->drm, "Unable to create bridge connector\n");
+ ret = PTR_ERR(dsi->connector);
+ goto err_cleanup;
+ }
+
+ ret = drm_connector_attach_encoder(dsi->connector, &dsi->encoder);
+ if (ret < 0)
+ goto err_cleanup;
return 0;
+
+err_cleanup:
+ drm_bridge_remove(&dsi->bridge);
+ drm_of_panel_bridge_remove(dev->of_node, 1, 0);
+
+ return ret;
}
static int sprd_dsi_context_init(struct sprd_dsi *dsi,
@@ -940,13 +970,21 @@ static int sprd_dsi_bind(struct device *dev, struct device *master, void *data)
ret = sprd_dsi_bridge_init(dsi, dev);
if (ret)
- return ret;
+ goto err_cleanup_encoder;
ret = sprd_dsi_context_init(dsi, dev);
if (ret)
- return ret;
+ goto err_cleanup_bridge;
return 0;
+
+err_cleanup_encoder:
+ drm_encoder_cleanup(&dsi->encoder);
+err_cleanup_bridge:
+ drm_bridge_remove(&dsi->bridge);
+ drm_of_panel_bridge_remove(dev->of_node, 1, 0);
+
+ return ret;
}
static void sprd_dsi_unbind(struct device *dev,
@@ -954,6 +992,7 @@ static void sprd_dsi_unbind(struct device *dev,
{
struct sprd_dsi *dsi = dev_get_drvdata(dev);
+ drm_bridge_remove(&dsi->bridge);
drm_of_panel_bridge_remove(dev->of_node, 1, 0);
drm_encoder_cleanup(&dsi->encoder);
diff --git a/drivers/gpu/drm/sprd/sprd_dsi.h b/drivers/gpu/drm/sprd/sprd_dsi.h
index d858ebb111150546e99403a87bc7cea42cad0158..f18f7398df6fa995df7ec2c59cf5c2745fbd28bd 100644
--- a/drivers/gpu/drm/sprd/sprd_dsi.h
+++ b/drivers/gpu/drm/sprd/sprd_dsi.h
@@ -18,6 +18,8 @@
#include <drm/drm_print.h>
#include <drm/drm_panel.h>
+#define bridge_to_dsi(bridge) \
+ container_of(bridge, struct sprd_dsi, bridge)
#define encoder_to_dsi(encoder) \
container_of(encoder, struct sprd_dsi, encoder)
@@ -116,7 +118,9 @@ struct sprd_dsi {
struct mipi_dsi_host host;
struct mipi_dsi_device *slave;
struct drm_encoder encoder;
+ struct drm_bridge bridge;
struct drm_bridge *panel_bridge;
+ struct drm_connector *connector;
struct dsi_context ctx;
};
--
2.50.0
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [PATCH 06/12] drm: sprd: add support for UMS9230 DSI PLL
2025-07-19 12:09 [PATCH 00/12] drm: sprd: Make the Unisoc DRM driver usable on UMS9230 Otto Pflüger
` (4 preceding siblings ...)
2025-07-19 12:09 ` [PATCH 05/12] drm: sprd: register a DSI bridge and move init code to pre_enable Otto Pflüger
@ 2025-07-19 12:09 ` Otto Pflüger
2025-07-19 12:09 ` [PATCH 07/12] drm: sprd: fix DSI rate and PLL setup code Otto Pflüger
` (5 subsequent siblings)
11 siblings, 0 replies; 22+ messages in thread
From: Otto Pflüger @ 2025-07-19 12:09 UTC (permalink / raw)
To: David Airlie, Simona Vetter, Maarten Lankhorst, Maxime Ripard,
Thomas Zimmermann, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
Orson Zhai, Baolin Wang, Chunyan Zhang, Kevin Tang
Cc: dri-devel, devicetree, linux-kernel, Otto Pflüger
Move platform-specific PLL parameters to the device tree match data and
add the parameters for UMS9230.
Signed-off-by: Otto Pflüger <otto.pflueger@abscue.de>
---
drivers/gpu/drm/sprd/megacores_pll.c | 21 ++++++++-------------
drivers/gpu/drm/sprd/sprd_dsi.c | 21 ++++++++++++++++++++-
drivers/gpu/drm/sprd/sprd_dsi.h | 9 ++++++++-
3 files changed, 36 insertions(+), 15 deletions(-)
diff --git a/drivers/gpu/drm/sprd/megacores_pll.c b/drivers/gpu/drm/sprd/megacores_pll.c
index 3091dfdc11e3b547a05a9edaa4047a1e367c1596..e5a18599678ab6e3771cd732dcca409ab2d59f72 100644
--- a/drivers/gpu/drm/sprd/megacores_pll.c
+++ b/drivers/gpu/drm/sprd/megacores_pll.c
@@ -21,12 +21,6 @@
#define AVERAGE(a, b) (min(a, b) + abs((b) - (a)) / 2)
-/* sharkle */
-#define VCO_BAND_LOW 750
-#define VCO_BAND_MID 1100
-#define VCO_BAND_HIGH 1500
-#define PHY_REF_CLK 26000
-
static int dphy_calc_pll_param(struct dphy_pll *pll)
{
const u32 khz = 1000;
@@ -36,11 +30,10 @@ static int dphy_calc_pll_param(struct dphy_pll *pll)
int i;
pll->potential_fvco = pll->freq / khz;
- pll->ref_clk = PHY_REF_CLK / khz;
for (i = 0; i < 4; ++i) {
- if (pll->potential_fvco >= VCO_BAND_LOW &&
- pll->potential_fvco <= VCO_BAND_HIGH) {
+ if (pll->potential_fvco >= pll->platform->band_low &&
+ pll->potential_fvco <= pll->platform->band_high) {
pll->fvco = pll->potential_fvco;
pll->out_sel = BIT(i);
break;
@@ -50,21 +43,23 @@ static int dphy_calc_pll_param(struct dphy_pll *pll)
if (pll->fvco == 0)
return -EINVAL;
- if (pll->fvco >= VCO_BAND_LOW && pll->fvco <= VCO_BAND_MID) {
+ if (pll->fvco >= pll->platform->band_low &&
+ pll->fvco <= pll->platform->band_mid) {
/* vco band control */
pll->vco_band = 0x0;
/* low pass filter control */
pll->lpf_sel = 1;
- } else if (pll->fvco > VCO_BAND_MID && pll->fvco <= VCO_BAND_HIGH) {
+ } else if (pll->fvco > pll->platform->band_mid &&
+ pll->fvco <= pll->platform->band_high) {
pll->vco_band = 0x1;
pll->lpf_sel = 0;
} else {
return -EINVAL;
}
- pll->nint = pll->fvco / pll->ref_clk;
+ pll->nint = pll->fvco / pll->platform->ref_clk;
tmp = pll->fvco * factor * mhz;
- do_div(tmp, pll->ref_clk);
+ do_div(tmp, pll->platform->ref_clk);
tmp = tmp - pll->nint * factor * mhz;
tmp *= BIT(20);
do_div(tmp, 100000000);
diff --git a/drivers/gpu/drm/sprd/sprd_dsi.c b/drivers/gpu/drm/sprd/sprd_dsi.c
index 43fff12d73f12619da57606a3c4785924e2c1507..db5f9bcbb2500096402b9d44b9cc4428070e69ba 100644
--- a/drivers/gpu/drm/sprd/sprd_dsi.c
+++ b/drivers/gpu/drm/sprd/sprd_dsi.c
@@ -1061,8 +1061,23 @@ static const struct mipi_dsi_host_ops sprd_dsi_host_ops = {
.transfer = sprd_dsi_host_transfer,
};
+static const struct dphy_pll_platform dphy_pll_sharkl3 = {
+ .band_low = 750,
+ .band_mid = 1100,
+ .band_high = 1500,
+ .ref_clk = 26,
+};
+
+static const struct dphy_pll_platform dphy_pll_ums9230 = {
+ .band_low = 1250,
+ .band_mid = 1800,
+ .band_high = 2500,
+ .ref_clk = 26,
+};
+
static const struct of_device_id dsi_match_table[] = {
- { .compatible = "sprd,sharkl3-dsi-host" },
+ { .compatible = "sprd,sharkl3-dsi-host", .data = &dphy_pll_sharkl3 },
+ { .compatible = "sprd,ums9230-dsi-host", .data = &dphy_pll_ums9230 },
{ /* sentinel */ },
};
@@ -1080,6 +1095,10 @@ static int sprd_dsi_probe(struct platform_device *pdev)
dsi->host.ops = &sprd_dsi_host_ops;
dsi->host.dev = dev;
+ dsi->ctx.pll.platform = of_device_get_match_data(dev);
+ if (!dsi->ctx.pll.platform)
+ return -EINVAL;
+
return mipi_dsi_host_register(&dsi->host);
}
diff --git a/drivers/gpu/drm/sprd/sprd_dsi.h b/drivers/gpu/drm/sprd/sprd_dsi.h
index f18f7398df6fa995df7ec2c59cf5c2745fbd28bd..0b9f1cabe71570743cbc68a8061e95a249f27191 100644
--- a/drivers/gpu/drm/sprd/sprd_dsi.h
+++ b/drivers/gpu/drm/sprd/sprd_dsi.h
@@ -66,6 +66,13 @@ enum pll_timing {
TA_WAIT,
};
+struct dphy_pll_platform {
+ u32 band_low;
+ u32 band_mid;
+ u32 band_high;
+ u32 ref_clk; /* dphy reference clock, unit: MHz */
+};
+
struct dphy_pll {
u8 refin; /* Pre-divider control signal */
u8 cp_s; /* 00: SDM_EN=1, 10: SDM_EN=0 */
@@ -73,7 +80,6 @@ struct dphy_pll {
u8 sdm_en;
u8 div;
u8 int_n; /* integer N PLL */
- u32 ref_clk; /* dphy reference clock, unit: MHz */
u32 freq; /* panel config, unit: KHz */
u32 fvco;
u32 potential_fvco;
@@ -83,6 +89,7 @@ struct dphy_pll {
u8 out_sel; /* post divider control */
u8 vco_band; /* vco range */
u8 det_delay;
+ const struct dphy_pll_platform *platform;
};
struct dsi_context {
--
2.50.0
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [PATCH 07/12] drm: sprd: fix DSI rate and PLL setup code
2025-07-19 12:09 [PATCH 00/12] drm: sprd: Make the Unisoc DRM driver usable on UMS9230 Otto Pflüger
` (5 preceding siblings ...)
2025-07-19 12:09 ` [PATCH 06/12] drm: sprd: add support for UMS9230 DSI PLL Otto Pflüger
@ 2025-07-19 12:09 ` Otto Pflüger
2025-07-19 12:09 ` [PATCH 08/12] drm: sprd: add gate clock support Otto Pflüger
` (4 subsequent siblings)
11 siblings, 0 replies; 22+ messages in thread
From: Otto Pflüger @ 2025-07-19 12:09 UTC (permalink / raw)
To: David Airlie, Simona Vetter, Maarten Lankhorst, Maxime Ripard,
Thomas Zimmermann, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
Orson Zhai, Baolin Wang, Chunyan Zhang, Kevin Tang
Cc: dri-devel, devicetree, linux-kernel, Otto Pflüger
Correct the initialization code to treat the hs_rate and lp_rate values
as hertz instead of kilohertz. While at it, fix a bit operation bug in
the PLL initialization code which caused a PLL register to be set to
zero instead of the desired value.
Signed-off-by: Otto Pflüger <otto.pflueger@abscue.de>
---
drivers/gpu/drm/sprd/megacores_pll.c | 7 +++----
drivers/gpu/drm/sprd/sprd_dsi.c | 7 +++----
2 files changed, 6 insertions(+), 8 deletions(-)
diff --git a/drivers/gpu/drm/sprd/megacores_pll.c b/drivers/gpu/drm/sprd/megacores_pll.c
index e5a18599678ab6e3771cd732dcca409ab2d59f72..f214f906b58fb006c4305de9b8b86b4a934f2074 100644
--- a/drivers/gpu/drm/sprd/megacores_pll.c
+++ b/drivers/gpu/drm/sprd/megacores_pll.c
@@ -23,13 +23,12 @@
static int dphy_calc_pll_param(struct dphy_pll *pll)
{
- const u32 khz = 1000;
const u32 mhz = 1000000;
const unsigned long long factor = 100;
unsigned long long tmp;
int i;
- pll->potential_fvco = pll->freq / khz;
+ pll->potential_fvco = pll->freq / mhz;
for (i = 0; i < 4; ++i) {
if (pll->potential_fvco >= pll->platform->band_low &&
@@ -89,7 +88,7 @@ static void dphy_set_pll_reg(struct dphy_pll *pll, struct regmap *regmap)
reg_val[3] = pll->vco_band | (pll->sdm_en << 1) | (pll->refin << 2);
reg_val[4] = pll->kint >> 12;
reg_val[5] = pll->kint >> 4;
- reg_val[6] = pll->out_sel | ((pll->kint << 4) & 0xf);
+ reg_val[6] = pll->out_sel | ((pll->kint & 0xf) << 4);
reg_val[7] = 1 << 4;
reg_val[8] = pll->det_delay;
@@ -218,7 +217,7 @@ void dphy_timing_config(struct dsi_context *ctx)
u32 tmp = 0;
/* t_ui: 1 ui, byteck: 8 ui, half byteck: 4 ui */
- t_ui = 1000 * scale / (pll->freq / 1000);
+ t_ui = 1000 * scale / (pll->freq / 1000000);
t_byteck = t_ui << 3;
t_half_byteck = t_ui << 2;
constant = t_ui << 1;
diff --git a/drivers/gpu/drm/sprd/sprd_dsi.c b/drivers/gpu/drm/sprd/sprd_dsi.c
index db5f9bcbb2500096402b9d44b9cc4428070e69ba..e01d1d28fe579644ec2e0c83ec9170269932adfe 100644
--- a/drivers/gpu/drm/sprd/sprd_dsi.c
+++ b/drivers/gpu/drm/sprd/sprd_dsi.c
@@ -391,7 +391,7 @@ static u32 fmt_to_coding(u32 fmt)
static void sprd_dsi_init(struct dsi_context *ctx)
{
struct sprd_dsi *dsi = container_of(ctx, struct sprd_dsi, ctx);
- u32 byte_clk = dsi->slave->hs_rate / 8;
+ u32 byte_clk = dsi->slave->hs_rate / 8000;
u16 data_hs2lp, data_lp2hs, clk_hs2lp, clk_lp2hs;
u16 max_rd_time;
int div;
@@ -408,7 +408,7 @@ static void sprd_dsi_init(struct dsi_context *ctx)
dsi_reg_up(ctx, VIRTUAL_CHANNEL_ID, VIDEO_PKT_VCID, 0);
dsi_reg_up(ctx, VIRTUAL_CHANNEL_ID, GEN_RX_VCID, 0);
- div = DIV_ROUND_UP(byte_clk, dsi->slave->lp_rate);
+ div = DIV_ROUND_UP(byte_clk, dsi->slave->lp_rate / 1000);
writel(div, ctx->base + TX_ESC_CLK_CONFIG);
max_rd_time = ns_to_cycle(ctx->max_rd_time, byte_clk);
@@ -450,7 +450,6 @@ static int sprd_dsi_dpi_video(struct dsi_context *ctx)
{
struct sprd_dsi *dsi = container_of(ctx, struct sprd_dsi, ctx);
struct videomode *vm = &ctx->vm;
- u32 byte_clk = dsi->slave->hs_rate / 8;
u16 bpp_x100;
u16 video_size;
u32 ratio_x1000;
@@ -472,7 +471,7 @@ static int sprd_dsi_dpi_video(struct dsi_context *ctx)
video_size = round_video_size(coding, vm->hactive);
bpp_x100 = calc_bytes_per_pixel_x100(coding);
video_size_step = calc_video_size_step(coding);
- ratio_x1000 = byte_clk * 1000 / (vm->pixelclock / 1000);
+ ratio_x1000 = dsi->slave->hs_rate / 8 / (vm->pixelclock / 1000);
hline = vm->hactive + vm->hsync_len + vm->hfront_porch +
vm->hback_porch;
--
2.50.0
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [PATCH 08/12] drm: sprd: add gate clock support
2025-07-19 12:09 [PATCH 00/12] drm: sprd: Make the Unisoc DRM driver usable on UMS9230 Otto Pflüger
` (6 preceding siblings ...)
2025-07-19 12:09 ` [PATCH 07/12] drm: sprd: fix DSI rate and PLL setup code Otto Pflüger
@ 2025-07-19 12:09 ` Otto Pflüger
2025-07-19 12:09 ` [PATCH 09/12] drm: sprd: add support for newer DPU versions Otto Pflüger
` (3 subsequent siblings)
11 siblings, 0 replies; 22+ messages in thread
From: Otto Pflüger @ 2025-07-19 12:09 UTC (permalink / raw)
To: David Airlie, Simona Vetter, Maarten Lankhorst, Maxime Ripard,
Thomas Zimmermann, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
Orson Zhai, Baolin Wang, Chunyan Zhang, Kevin Tang
Cc: dri-devel, devicetree, linux-kernel, Otto Pflüger
Enable the DPU and DSI gate clocks specified in the device tree.
Disable the DSI clock when it is not needed.
Signed-off-by: Otto Pflüger <otto.pflueger@abscue.de>
---
drivers/gpu/drm/sprd/sprd_dpu.c | 7 +++++++
drivers/gpu/drm/sprd/sprd_dpu.h | 1 +
drivers/gpu/drm/sprd/sprd_dsi.c | 10 ++++++++++
drivers/gpu/drm/sprd/sprd_dsi.h | 4 +++-
4 files changed, 21 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/sprd/sprd_dpu.c b/drivers/gpu/drm/sprd/sprd_dpu.c
index 0d9eb778794d92418b39f8535d94abde3566de43..575bcdb0e0bb30055ac5c3d0e65178cc9f6611f3 100644
--- a/drivers/gpu/drm/sprd/sprd_dpu.c
+++ b/drivers/gpu/drm/sprd/sprd_dpu.c
@@ -3,6 +3,7 @@
* Copyright (C) 2020 Unisoc Inc.
*/
+#include <linux/clk.h>
#include <linux/component.h>
#include <linux/delay.h>
#include <linux/dma-buf.h>
@@ -794,6 +795,12 @@ static int sprd_dpu_context_init(struct sprd_dpu *dpu,
if (ctx->irq < 0)
return ctx->irq;
+ ctx->clk = devm_clk_get_optional_enabled(dev, "enable");
+ if (IS_ERR(ctx->clk)) {
+ dev_err(dev, "failed to get dpu enable clock\n");
+ return PTR_ERR(ctx->clk);
+ }
+
/* disable and clear interrupts before register dpu IRQ. */
writel(0x00, ctx->base + REG_DPU_INT_EN);
writel(0xff, ctx->base + REG_DPU_INT_CLR);
diff --git a/drivers/gpu/drm/sprd/sprd_dpu.h b/drivers/gpu/drm/sprd/sprd_dpu.h
index 157a78f24dc18b071602552ea9d005af66525263..d48b922de580a8a4bf07c4610c431d3321f7b810 100644
--- a/drivers/gpu/drm/sprd/sprd_dpu.h
+++ b/drivers/gpu/drm/sprd/sprd_dpu.h
@@ -44,6 +44,7 @@ enum {
*/
struct dpu_context {
void __iomem *base;
+ struct clk *clk;
int irq;
u8 if_type;
struct videomode vm;
diff --git a/drivers/gpu/drm/sprd/sprd_dsi.c b/drivers/gpu/drm/sprd/sprd_dsi.c
index e01d1d28fe579644ec2e0c83ec9170269932adfe..e781e6c84860402f37352e768244d88ca6ffd4c9 100644
--- a/drivers/gpu/drm/sprd/sprd_dsi.c
+++ b/drivers/gpu/drm/sprd/sprd_dsi.c
@@ -828,6 +828,8 @@ static void sprd_dsi_bridge_pre_enable(struct drm_bridge *bridge)
struct sprd_dsi *dsi = bridge_to_dsi(bridge);
struct dsi_context *ctx = &dsi->ctx;
+ clk_prepare_enable(ctx->clk);
+
if (ctx->enabled) {
drm_warn(dsi->drm, "dsi is initialized\n");
return;
@@ -875,6 +877,8 @@ static void sprd_dsi_bridge_post_disable(struct drm_bridge *bridge)
sprd_dphy_fini(ctx);
sprd_dsi_fini(ctx);
+ clk_disable_unprepare(ctx->clk);
+
ctx->enabled = false;
}
@@ -1098,6 +1102,12 @@ static int sprd_dsi_probe(struct platform_device *pdev)
if (!dsi->ctx.pll.platform)
return -EINVAL;
+ dsi->ctx.clk = devm_clk_get_optional(dev, "enable");
+ if (IS_ERR(dsi->ctx.clk)) {
+ dev_err(dev, "failed to get dsi enable clock\n");
+ return PTR_ERR(dsi->ctx.clk);
+ }
+
return mipi_dsi_host_register(&dsi->host);
}
diff --git a/drivers/gpu/drm/sprd/sprd_dsi.h b/drivers/gpu/drm/sprd/sprd_dsi.h
index 0b9f1cabe71570743cbc68a8061e95a249f27191..15e57f3f49f8e5c4f856fb496a0c88f1b0414ced 100644
--- a/drivers/gpu/drm/sprd/sprd_dsi.h
+++ b/drivers/gpu/drm/sprd/sprd_dsi.h
@@ -6,8 +6,9 @@
#ifndef __SPRD_DSI_H__
#define __SPRD_DSI_H__
-#include <linux/of.h>
+#include <linux/clk.h>
#include <linux/device.h>
+#include <linux/of.h>
#include <linux/regmap.h>
#include <video/videomode.h>
@@ -95,6 +96,7 @@ struct dphy_pll {
struct dsi_context {
void __iomem *base;
struct regmap *regmap;
+ struct clk *clk;
struct dphy_pll pll;
struct videomode vm;
bool enabled;
--
2.50.0
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [PATCH 09/12] drm: sprd: add support for newer DPU versions
2025-07-19 12:09 [PATCH 00/12] drm: sprd: Make the Unisoc DRM driver usable on UMS9230 Otto Pflüger
` (7 preceding siblings ...)
2025-07-19 12:09 ` [PATCH 08/12] drm: sprd: add gate clock support Otto Pflüger
@ 2025-07-19 12:09 ` Otto Pflüger
2025-07-19 12:09 ` [PATCH 10/12] drm: sprd: always initialize DPU and DSI registers Otto Pflüger
` (2 subsequent siblings)
11 siblings, 0 replies; 22+ messages in thread
From: Otto Pflüger @ 2025-07-19 12:09 UTC (permalink / raw)
To: David Airlie, Simona Vetter, Maarten Lankhorst, Maxime Ripard,
Thomas Zimmermann, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
Orson Zhai, Baolin Wang, Chunyan Zhang, Kevin Tang
Cc: dri-devel, devicetree, linux-kernel, Otto Pflüger
Newer DPU revisions such as the one used in UMS9230 (version 5) do not
have internal MMU registers and also require different defaults for the
display interface configuration.
Check the DPU version register to account for these configuration
differences.
Signed-off-by: Otto Pflüger <otto.pflueger@abscue.de>
---
drivers/gpu/drm/sprd/sprd_dpu.c | 30 ++++++++++++++++++++----------
1 file changed, 20 insertions(+), 10 deletions(-)
diff --git a/drivers/gpu/drm/sprd/sprd_dpu.c b/drivers/gpu/drm/sprd/sprd_dpu.c
index 575bcdb0e0bb30055ac5c3d0e65178cc9f6611f3..01906243a93e3306fbce5bf617838b517822a2b6 100644
--- a/drivers/gpu/drm/sprd/sprd_dpu.c
+++ b/drivers/gpu/drm/sprd/sprd_dpu.c
@@ -27,6 +27,7 @@
#include "sprd_dsi.h"
/* Global control registers */
+#define REG_DPU_VERSION 0x00
#define REG_DPU_CTRL 0x04
#define REG_DPU_CFG0 0x08
#define REG_PANEL_SIZE 0x20
@@ -406,22 +407,31 @@ static void sprd_dpu_init(struct sprd_dpu *dpu)
{
struct dpu_context *ctx = &dpu->ctx;
u32 int_mask = 0;
+ u32 dpu_version = readl(ctx->base + REG_DPU_VERSION);
writel(0x00, ctx->base + REG_BG_COLOR);
- writel(0x00, ctx->base + REG_MMU_EN);
- writel(0x00, ctx->base + REG_MMU_PPN1);
- writel(0xffff, ctx->base + REG_MMU_RANGE1);
- writel(0x00, ctx->base + REG_MMU_PPN2);
- writel(0xffff, ctx->base + REG_MMU_RANGE2);
- writel(0x1ffff, ctx->base + REG_MMU_VPN_RANGE);
+ if (dpu_version < 0x300) {
+ writel(0x00, ctx->base + REG_MMU_EN);
+ writel(0x00, ctx->base + REG_MMU_PPN1);
+ writel(0xffff, ctx->base + REG_MMU_RANGE1);
+ writel(0x00, ctx->base + REG_MMU_PPN2);
+ writel(0xffff, ctx->base + REG_MMU_RANGE2);
+ writel(0x1ffff, ctx->base + REG_MMU_VPN_RANGE);
+ }
if (ctx->if_type == SPRD_DPU_IF_DPI) {
/* use dpi as interface */
dpu_reg_clr(ctx, REG_DPU_CFG0, BIT_DPU_IF_EDPI);
- /* disable Halt function for SPRD DSI */
- dpu_reg_clr(ctx, REG_DPI_CTRL, BIT_DPU_DPI_HALT_EN);
- /* select te from external pad */
- dpu_reg_set(ctx, REG_DPI_CTRL, BIT_DPU_EDPI_FROM_EXTERNAL_PAD);
+
+ if (dpu_version < 0x300) {
+ /* disable Halt function for SPRD DSI */
+ dpu_reg_clr(ctx, REG_DPI_CTRL, BIT_DPU_DPI_HALT_EN);
+ /* select te from external pad */
+ dpu_reg_set(ctx, REG_DPI_CTRL, BIT_DPU_EDPI_FROM_EXTERNAL_PAD);
+ } else {
+ /* enable Halt function for SPRD DSI */
+ dpu_reg_set(ctx, REG_DPI_CTRL, BIT_DPU_DPI_HALT_EN);
+ }
/* enable dpu update done INT */
int_mask |= BIT_DPU_INT_UPDATE_DONE;
--
2.50.0
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [PATCH 10/12] drm: sprd: always initialize DPU and DSI registers
2025-07-19 12:09 [PATCH 00/12] drm: sprd: Make the Unisoc DRM driver usable on UMS9230 Otto Pflüger
` (8 preceding siblings ...)
2025-07-19 12:09 ` [PATCH 09/12] drm: sprd: add support for newer DPU versions Otto Pflüger
@ 2025-07-19 12:09 ` Otto Pflüger
2025-07-19 12:09 ` [PATCH 11/12] drm: sprd: add fbdev support Otto Pflüger
2025-07-19 12:09 ` [PATCH 12/12] drm: sprd: select REGMAP in Kconfig Otto Pflüger
11 siblings, 0 replies; 22+ messages in thread
From: Otto Pflüger @ 2025-07-19 12:09 UTC (permalink / raw)
To: David Airlie, Simona Vetter, Maarten Lankhorst, Maxime Ripard,
Thomas Zimmermann, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
Orson Zhai, Baolin Wang, Chunyan Zhang, Kevin Tang
Cc: dri-devel, devicetree, linux-kernel, Otto Pflüger
When the Unisoc DRM driver is initialized for the first time to display
an image on the screen, reinitialize the display properly instead of
relying on the bootloader.
Signed-off-by: Otto Pflüger <otto.pflueger@abscue.de>
---
drivers/gpu/drm/sprd/sprd_dpu.c | 8 ++++++++
drivers/gpu/drm/sprd/sprd_dsi.c | 1 -
2 files changed, 8 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/sprd/sprd_dpu.c b/drivers/gpu/drm/sprd/sprd_dpu.c
index 01906243a93e3306fbce5bf617838b517822a2b6..be7758ef445b1b87b8ce6bd2001a15fa0f24f4d3 100644
--- a/drivers/gpu/drm/sprd/sprd_dpu.c
+++ b/drivers/gpu/drm/sprd/sprd_dpu.c
@@ -458,6 +458,14 @@ static void sprd_dpu_init(struct sprd_dpu *dpu)
}
writel(int_mask, ctx->base + REG_DPU_INT_EN);
+
+ /*
+ * The DPU is usually enabled by the bootloader to show
+ * a splash screen. Stop it here when the kernel initializes
+ * the display.
+ */
+ if (!ctx->stopped)
+ sprd_dpu_stop(dpu);
}
static void sprd_dpu_fini(struct sprd_dpu *dpu)
diff --git a/drivers/gpu/drm/sprd/sprd_dsi.c b/drivers/gpu/drm/sprd/sprd_dsi.c
index e781e6c84860402f37352e768244d88ca6ffd4c9..dd9e3179cef985ec39155994c122a6288ac4b2f8 100644
--- a/drivers/gpu/drm/sprd/sprd_dsi.c
+++ b/drivers/gpu/drm/sprd/sprd_dsi.c
@@ -954,7 +954,6 @@ static int sprd_dsi_context_init(struct sprd_dsi *dsi,
ctx->max_rd_time = 6000;
ctx->int0_mask = 0xffffffff;
ctx->int1_mask = 0xffffffff;
- ctx->enabled = true;
return 0;
}
--
2.50.0
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [PATCH 11/12] drm: sprd: add fbdev support
2025-07-19 12:09 [PATCH 00/12] drm: sprd: Make the Unisoc DRM driver usable on UMS9230 Otto Pflüger
` (9 preceding siblings ...)
2025-07-19 12:09 ` [PATCH 10/12] drm: sprd: always initialize DPU and DSI registers Otto Pflüger
@ 2025-07-19 12:09 ` Otto Pflüger
2025-07-19 12:09 ` [PATCH 12/12] drm: sprd: select REGMAP in Kconfig Otto Pflüger
11 siblings, 0 replies; 22+ messages in thread
From: Otto Pflüger @ 2025-07-19 12:09 UTC (permalink / raw)
To: David Airlie, Simona Vetter, Maarten Lankhorst, Maxime Ripard,
Thomas Zimmermann, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
Orson Zhai, Baolin Wang, Chunyan Zhang, Kevin Tang
Cc: dri-devel, devicetree, linux-kernel, Otto Pflüger
Set up the internal fbdev client in the Unisoc DRM driver. This is
needed to make the framebuffer console work.
Signed-off-by: Otto Pflüger <otto.pflueger@abscue.de>
---
drivers/gpu/drm/sprd/sprd_drm.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/drivers/gpu/drm/sprd/sprd_drm.c b/drivers/gpu/drm/sprd/sprd_drm.c
index ceacdcb7c566d00b98d83c27dbab80523bc6a7d5..db6b3790d29ac324a88ecb57a66247f55d40a794 100644
--- a/drivers/gpu/drm/sprd/sprd_drm.c
+++ b/drivers/gpu/drm/sprd/sprd_drm.c
@@ -11,8 +11,10 @@
#include <linux/of_graph.h>
#include <linux/platform_device.h>
+#include <drm/clients/drm_client_setup.h>
#include <drm/drm_atomic_helper.h>
#include <drm/drm_drv.h>
+#include <drm/drm_fbdev_dma.h>
#include <drm/drm_gem_dma_helper.h>
#include <drm/drm_gem_framebuffer_helper.h>
#include <drm/drm_of.h>
@@ -55,6 +57,7 @@ static struct drm_driver sprd_drm_drv = {
/* GEM Operations */
DRM_GEM_DMA_DRIVER_OPS,
+ DRM_FBDEV_DMA_DRIVER_OPS,
.name = DRIVER_NAME,
.desc = DRIVER_DESC,
@@ -106,6 +109,8 @@ static int sprd_drm_bind(struct device *dev)
if (ret < 0)
goto err_kms_helper_poll_fini;
+ drm_client_setup(drm, NULL);
+
return 0;
err_kms_helper_poll_fini:
--
2.50.0
^ permalink raw reply related [flat|nested] 22+ messages in thread
* [PATCH 12/12] drm: sprd: select REGMAP in Kconfig
2025-07-19 12:09 [PATCH 00/12] drm: sprd: Make the Unisoc DRM driver usable on UMS9230 Otto Pflüger
` (10 preceding siblings ...)
2025-07-19 12:09 ` [PATCH 11/12] drm: sprd: add fbdev support Otto Pflüger
@ 2025-07-19 12:09 ` Otto Pflüger
11 siblings, 0 replies; 22+ messages in thread
From: Otto Pflüger @ 2025-07-19 12:09 UTC (permalink / raw)
To: David Airlie, Simona Vetter, Maarten Lankhorst, Maxime Ripard,
Thomas Zimmermann, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
Orson Zhai, Baolin Wang, Chunyan Zhang, Kevin Tang
Cc: dri-devel, devicetree, linux-kernel, Otto Pflüger
When compile-testing this driver with all other drivers disabled,
sprd_dsi.c fails to compile due to a missing definition of struct
regmap_bus. Ensure that this does not happen by declaring the
compile-time dependency on regmap in Kconfig.
Signed-off-by: Otto Pflüger <otto.pflueger@abscue.de>
---
drivers/gpu/drm/sprd/Kconfig | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/gpu/drm/sprd/Kconfig b/drivers/gpu/drm/sprd/Kconfig
index 1afcdbf6f0ee3304f2297835241c9bb10d422154..828384d42c5aac4bf194558f22d9a77f7c693572 100644
--- a/drivers/gpu/drm/sprd/Kconfig
+++ b/drivers/gpu/drm/sprd/Kconfig
@@ -7,6 +7,7 @@ config DRM_SPRD
select DRM_GEM_DMA_HELPER
select DRM_KMS_HELPER
select DRM_MIPI_DSI
+ select REGMAP
select VIDEOMODE_HELPERS
help
Choose this option if you have a Unisoc chipset.
--
2.50.0
^ permalink raw reply related [flat|nested] 22+ messages in thread
* Re: [PATCH 01/12] dt-bindings: display: sprd: adapt for UMS9230 support
2025-07-19 12:09 ` [PATCH 01/12] dt-bindings: display: sprd: adapt for UMS9230 support Otto Pflüger
@ 2025-07-19 13:24 ` Rob Herring (Arm)
2025-07-20 12:26 ` Krzysztof Kozlowski
1 sibling, 0 replies; 22+ messages in thread
From: Rob Herring (Arm) @ 2025-07-19 13:24 UTC (permalink / raw)
To: Otto Pflüger
Cc: Thomas Zimmermann, Orson Zhai, dri-devel, David Airlie,
Conor Dooley, Kevin Tang, devicetree, Baolin Wang, Maxime Ripard,
Chunyan Zhang, Simona Vetter, Maarten Lankhorst,
Krzysztof Kozlowski, linux-kernel
On Sat, 19 Jul 2025 14:09:37 +0200, Otto Pflüger wrote:
> Add the compatible strings for the display controller found in the
> UMS9230 SoC and bindings for a gate clock. Add IOMMU-related bindings
> to the display-subsystem node.
>
> Signed-off-by: Otto Pflüger <otto.pflueger@abscue.de>
> ---
> .../bindings/display/sprd/sprd,display-subsystem.yaml | 11 +++++++++++
> .../bindings/display/sprd/sprd,sharkl3-dpu.yaml | 18 +++++++++++++-----
> .../bindings/display/sprd/sprd,sharkl3-dsi-host.yaml | 11 ++++++++---
> 3 files changed, 32 insertions(+), 8 deletions(-)
>
My bot found errors running 'make dt_binding_check' on your patch:
yamllint warnings/errors:
./Documentation/devicetree/bindings/display/sprd/sprd,sharkl3-dpu.yaml:38:9: [warning] wrong indentation: expected 10 but found 8 (indentation)
./Documentation/devicetree/bindings/display/sprd/sprd,sharkl3-dpu.yaml:41:9: [warning] wrong indentation: expected 10 but found 8 (indentation)
dtschema/dtc warnings/errors:
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/display/sprd/sprd,sharkl3-dpu.example.dtb: dpu@63000000 (sprd,sharkl3-dpu): clocks: [[4294967295, 21], [4294967295, 13]] is too long
from schema $id: http://devicetree.org/schemas/display/sprd/sprd,sharkl3-dpu.yaml#
doc reference errors (make refcheckdocs):
See https://patchwork.ozlabs.org/project/devicetree-bindings/patch/20250719-ums9230-drm-v1-1-e4344a05eb3d@abscue.de
The base for the series is generally the latest rc1. A different dependency
should be noted in *this* patch.
If you already ran 'make dt_binding_check' and didn't see the above
error(s), then make sure 'yamllint' is installed and dt-schema is up to
date:
pip3 install dtschema --upgrade
Please check and re-submit after running the above command yourself. Note
that DT_SCHEMA_FILES can be set to your schema file to speed up checking
your schema. However, it must be unset to test all examples with your schema.
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [PATCH 01/12] dt-bindings: display: sprd: adapt for UMS9230 support
2025-07-19 12:09 ` [PATCH 01/12] dt-bindings: display: sprd: adapt for UMS9230 support Otto Pflüger
2025-07-19 13:24 ` Rob Herring (Arm)
@ 2025-07-20 12:26 ` Krzysztof Kozlowski
2025-07-20 13:55 ` Otto Pflüger
1 sibling, 1 reply; 22+ messages in thread
From: Krzysztof Kozlowski @ 2025-07-20 12:26 UTC (permalink / raw)
To: Otto Pflüger, David Airlie, Simona Vetter, Maarten Lankhorst,
Maxime Ripard, Thomas Zimmermann, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Orson Zhai, Baolin Wang,
Chunyan Zhang, Kevin Tang
Cc: dri-devel, devicetree, linux-kernel
On 19/07/2025 14:09, Otto Pflüger wrote:
> diff --git a/Documentation/devicetree/bindings/display/sprd/sprd,sharkl3-dpu.yaml b/Documentation/devicetree/bindings/display/sprd/sprd,sharkl3-dpu.yaml
> index 4ebea60b8c5ba5f177854e3a8d89e93e7304e18b..6fedb6e508b247eb71da17ced589b8ed09085592 100644
> --- a/Documentation/devicetree/bindings/display/sprd/sprd,sharkl3-dpu.yaml
> +++ b/Documentation/devicetree/bindings/display/sprd/sprd,sharkl3-dpu.yaml
> @@ -16,7 +16,12 @@ description: |
>
> properties:
> compatible:
> - const: sprd,sharkl3-dpu
> + oneOf:
> + - items:
> + - enum:
> + - sprd,ums9230-dpu
> + - const: sprd,sharkl3-dpu
> + - const: sprd,sharkl3-dpu
>
> reg:
> maxItems: 1
> @@ -25,12 +30,15 @@ properties:
> maxItems: 1
>
> clocks:
> - minItems: 2
> + minItems: 1
This is wrong. You miss maxItems. I will fix existing bindings.
>
> clock-names:
> - items:
> - - const: clk_src_128m
> - - const: clk_src_384m
> + oneOf:
> + - items:
> + - const: clk_src_128m
> + - const: clk_src_384m
> + - items:
> + - const: enable
>
> power-domains:
> maxItems: 1
> diff --git a/Documentation/devicetree/bindings/display/sprd/sprd,sharkl3-dsi-host.yaml b/Documentation/devicetree/bindings/display/sprd/sprd,sharkl3-dsi-host.yaml
> index bc5594d18643010b91376c92a8f235a522d7dc3d..8438d2da0a4277db03e30b13cb270684c0c360cb 100644
> --- a/Documentation/devicetree/bindings/display/sprd/sprd,sharkl3-dsi-host.yaml
> +++ b/Documentation/devicetree/bindings/display/sprd/sprd,sharkl3-dsi-host.yaml
> @@ -11,7 +11,9 @@ maintainers:
>
> properties:
> compatible:
> - const: sprd,sharkl3-dsi-host
> + enum:
> + - sprd,sharkl3-dsi-host
> + - sprd,ums9230-dsi-host
>
> reg:
> maxItems: 1
> @@ -23,8 +25,11 @@ properties:
> minItems: 1
>
> clock-names:
> - items:
> - - const: clk_src_96m
> + oneOf:
> + - items:
> + - const: clk_src_96m
> + - items:
> + - const: enable
Why this is completely different clock? How same class device could have
completely different clock INPUT?
>
> power-domains:
> maxItems: 1
>
Best regards,
Krzysztof
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [PATCH 01/12] dt-bindings: display: sprd: adapt for UMS9230 support
2025-07-20 12:26 ` Krzysztof Kozlowski
@ 2025-07-20 13:55 ` Otto Pflüger
2025-07-20 15:38 ` Krzysztof Kozlowski
0 siblings, 1 reply; 22+ messages in thread
From: Otto Pflüger @ 2025-07-20 13:55 UTC (permalink / raw)
To: Krzysztof Kozlowski
Cc: David Airlie, Simona Vetter, Maarten Lankhorst, Maxime Ripard,
Thomas Zimmermann, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
Orson Zhai, Baolin Wang, Chunyan Zhang, Kevin Tang, dri-devel,
devicetree, linux-kernel
On Sun, Jul 20, 2025 at 02:26:19PM +0200, Krzysztof Kozlowski wrote:
> On 19/07/2025 14:09, Otto Pflüger wrote:
> > diff --git a/Documentation/devicetree/bindings/display/sprd/sprd,sharkl3-dpu.yaml b/Documentation/devicetree/bindings/display/sprd/sprd,sharkl3-dpu.yaml
> > index 4ebea60b8c5ba5f177854e3a8d89e93e7304e18b..6fedb6e508b247eb71da17ced589b8ed09085592 100644
> > --- a/Documentation/devicetree/bindings/display/sprd/sprd,sharkl3-dpu.yaml
> > +++ b/Documentation/devicetree/bindings/display/sprd/sprd,sharkl3-dpu.yaml
> > @@ -16,7 +16,12 @@ description: |
> >
> > properties:
> > compatible:
> > - const: sprd,sharkl3-dpu
> > + oneOf:
> > + - items:
> > + - enum:
> > + - sprd,ums9230-dpu
> > + - const: sprd,sharkl3-dpu
> > + - const: sprd,sharkl3-dpu
> >
> > reg:
> > maxItems: 1
> > @@ -25,12 +30,15 @@ properties:
> > maxItems: 1
> >
> > clocks:
> > - minItems: 2
> > + minItems: 1
>
> This is wrong. You miss maxItems. I will fix existing bindings.
Will fix this, thanks.
>
> >
> > clock-names:
> > - items:
> > - - const: clk_src_128m
> > - - const: clk_src_384m
> > + oneOf:
> > + - items:
> > + - const: clk_src_128m
> > + - const: clk_src_384m
> > + - items:
> > + - const: enable
> >
> > power-domains:
> > maxItems: 1
> > diff --git a/Documentation/devicetree/bindings/display/sprd/sprd,sharkl3-dsi-host.yaml b/Documentation/devicetree/bindings/display/sprd/sprd,sharkl3-dsi-host.yaml
> > index bc5594d18643010b91376c92a8f235a522d7dc3d..8438d2da0a4277db03e30b13cb270684c0c360cb 100644
> > --- a/Documentation/devicetree/bindings/display/sprd/sprd,sharkl3-dsi-host.yaml
> > +++ b/Documentation/devicetree/bindings/display/sprd/sprd,sharkl3-dsi-host.yaml
> > @@ -11,7 +11,9 @@ maintainers:
> >
> > properties:
> > compatible:
> > - const: sprd,sharkl3-dsi-host
> > + enum:
> > + - sprd,sharkl3-dsi-host
> > + - sprd,ums9230-dsi-host
> >
> > reg:
> > maxItems: 1
> > @@ -23,8 +25,11 @@ properties:
> > minItems: 1
> >
> > clock-names:
> > - items:
> > - - const: clk_src_96m
> > + oneOf:
> > + - items:
> > + - const: clk_src_96m
> > + - items:
> > + - const: enable
>
> Why this is completely different clock? How same class device could have
> completely different clock INPUT?
The clocks should be the same on sharkl3 (sc9863a) and ums9230, but
the existing bindings don't really make sense here or are incomplete.
AFAIK there is no SoC in which this display controller is directly
connected to the PLL as shown in the example. The DSI controller is
connected to a clock gate. The DPU actually does have two clocks, both
of which are clock muxes that allow selecting different frequencies and
one of which is behind a clock gate. I can add the second clock for the
DPU if needed.
Since nothing seems to be using these bindings at the moment, would it
be okay to drop the old clock names that refer to specific frequencies?
>
> >
> > power-domains:
> > maxItems: 1
> >
>
>
> Best regards,
> Krzysztof
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [PATCH 01/12] dt-bindings: display: sprd: adapt for UMS9230 support
2025-07-20 13:55 ` Otto Pflüger
@ 2025-07-20 15:38 ` Krzysztof Kozlowski
2025-07-20 17:35 ` Otto Pflüger
0 siblings, 1 reply; 22+ messages in thread
From: Krzysztof Kozlowski @ 2025-07-20 15:38 UTC (permalink / raw)
To: Otto Pflüger
Cc: David Airlie, Simona Vetter, Maarten Lankhorst, Maxime Ripard,
Thomas Zimmermann, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
Orson Zhai, Baolin Wang, Chunyan Zhang, Kevin Tang, dri-devel,
devicetree, linux-kernel
On 20/07/2025 15:55, Otto Pflüger wrote:
>>>
>>> clock-names:
>>> - items:
>>> - - const: clk_src_96m
>>> + oneOf:
>>> + - items:
>>> + - const: clk_src_96m
>>> + - items:
>>> + - const: enable
>>
>> Why this is completely different clock? How same class device could have
>> completely different clock INPUT?
>
> The clocks should be the same on sharkl3 (sc9863a) and ums9230, but
> the existing bindings don't really make sense here or are incomplete.
> AFAIK there is no SoC in which this display controller is directly
> connected to the PLL as shown in the example. The DSI controller is
This is not the PLL. Gate either. You are looking from wrong side - how
clock is generated.
You describe here CLOCK INPUT.
> connected to a clock gate. The DPU actually does have two clocks, both
> of which are clock muxes that allow selecting different frequencies and
> one of which is behind a clock gate. I can add the second clock for the
> DPU if needed.
>
> Since nothing seems to be using these bindings at the moment, would it
> be okay to drop the old clock names that refer to specific frequencies?
It is still completely irrelevant whether these are muxes. Dropping
existing properties is ABI change, but anyway first figure out what is
here really.
Best regards,
Krzysztof
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [PATCH 01/12] dt-bindings: display: sprd: adapt for UMS9230 support
2025-07-20 15:38 ` Krzysztof Kozlowski
@ 2025-07-20 17:35 ` Otto Pflüger
2025-07-22 7:19 ` Krzysztof Kozlowski
0 siblings, 1 reply; 22+ messages in thread
From: Otto Pflüger @ 2025-07-20 17:35 UTC (permalink / raw)
To: Krzysztof Kozlowski
Cc: David Airlie, Simona Vetter, Maarten Lankhorst, Maxime Ripard,
Thomas Zimmermann, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
Orson Zhai, Baolin Wang, Chunyan Zhang, Kevin Tang, dri-devel,
devicetree, linux-kernel
On Sun, Jul 20, 2025 at 05:38:02PM +0200, Krzysztof Kozlowski wrote:
> >
> > The clocks should be the same on sharkl3 (sc9863a) and ums9230, but
> > the existing bindings don't really make sense here or are incomplete.
> > AFAIK there is no SoC in which this display controller is directly
> > connected to the PLL as shown in the example. The DSI controller is
>
> This is not the PLL. Gate either. You are looking from wrong side - how
> clock is generated.
>
> You describe here CLOCK INPUT.
>
> > connected to a clock gate. The DPU actually does have two clocks, both
> > of which are clock muxes that allow selecting different frequencies and
> > one of which is behind a clock gate. I can add the second clock for the
> > DPU if needed.
> >
> > Since nothing seems to be using these bindings at the moment, would it
> > be okay to drop the old clock names that refer to specific frequencies?
>
> It is still completely irrelevant whether these are muxes. Dropping
> existing properties is ABI change, but anyway first figure out what is
> here really.
I was trying to point out that the existing clock names are incorrect
because they refer to a specific source that is not necessarily used
for these clocks, instead of giving a name for the clock input.
For the DPU, would "core" and "dpi" be more appropriate as clock names?
DPI refers to the interface used internally between the DPU and the DSI
controller.
For the DSI controller, it seems that the clock is actually an APB bus
clock needed for accessing the control registers. Again, it is not
required to be connected to a 96MHz clock source as the name used in the
binding suggests. Would something like "apb_clk" or "pclk" be more
descriptive?
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [PATCH 01/12] dt-bindings: display: sprd: adapt for UMS9230 support
2025-07-20 17:35 ` Otto Pflüger
@ 2025-07-22 7:19 ` Krzysztof Kozlowski
0 siblings, 0 replies; 22+ messages in thread
From: Krzysztof Kozlowski @ 2025-07-22 7:19 UTC (permalink / raw)
To: Otto Pflüger
Cc: David Airlie, Simona Vetter, Maarten Lankhorst, Maxime Ripard,
Thomas Zimmermann, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
Orson Zhai, Baolin Wang, Chunyan Zhang, Kevin Tang, dri-devel,
devicetree, linux-kernel
On Sun, Jul 20, 2025 at 07:35:24PM +0200, Otto Pflüger wrote:
> On Sun, Jul 20, 2025 at 05:38:02PM +0200, Krzysztof Kozlowski wrote:
> > >
> > > The clocks should be the same on sharkl3 (sc9863a) and ums9230, but
> > > the existing bindings don't really make sense here or are incomplete.
> > > AFAIK there is no SoC in which this display controller is directly
> > > connected to the PLL as shown in the example. The DSI controller is
> >
> > This is not the PLL. Gate either. You are looking from wrong side - how
> > clock is generated.
> >
> > You describe here CLOCK INPUT.
> >
> > > connected to a clock gate. The DPU actually does have two clocks, both
> > > of which are clock muxes that allow selecting different frequencies and
> > > one of which is behind a clock gate. I can add the second clock for the
> > > DPU if needed.
> > >
> > > Since nothing seems to be using these bindings at the moment, would it
> > > be okay to drop the old clock names that refer to specific frequencies?
> >
> > It is still completely irrelevant whether these are muxes. Dropping
> > existing properties is ABI change, but anyway first figure out what is
> > here really.
>
> I was trying to point out that the existing clock names are incorrect
> because they refer to a specific source that is not necessarily used
> for these clocks, instead of giving a name for the clock input.
OK, if the old name refers to the same clock input as in your new
device, you can deprecate old case in the binding.
>
> For the DPU, would "core" and "dpi" be more appropriate as clock names?
> DPI refers to the interface used internally between the DPU and the DSI
> controller.
Sounds fine.
>
> For the DSI controller, it seems that the clock is actually an APB bus
> clock needed for accessing the control registers. Again, it is not
> required to be connected to a 96MHz clock source as the name used in the
> binding suggests. Would something like "apb_clk" or "pclk" be more
> descriptive?
Yeah, both are correct. I think pclk is preferred.
Best regards,
Krzysztof
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [PATCH 04/12] drm: sprd: remove plane and crtc destroy callbacks
2025-07-19 12:09 ` [PATCH 04/12] drm: sprd: remove plane and crtc destroy callbacks Otto Pflüger
@ 2025-07-28 15:41 ` Dmitry Baryshkov
0 siblings, 0 replies; 22+ messages in thread
From: Dmitry Baryshkov @ 2025-07-28 15:41 UTC (permalink / raw)
To: Otto Pflüger
Cc: David Airlie, Simona Vetter, Maarten Lankhorst, Maxime Ripard,
Thomas Zimmermann, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
Orson Zhai, Baolin Wang, Chunyan Zhang, Kevin Tang, dri-devel,
devicetree, linux-kernel
On Sat, Jul 19, 2025 at 02:09:40PM +0200, Otto Pflüger wrote:
> These callbacks are now required to be NULL and trigger a runtime
> warning if they are present.
Fixes ?
>
> Signed-off-by: Otto Pflüger <otto.pflueger@abscue.de>
> ---
> drivers/gpu/drm/sprd/sprd_dpu.c | 2 --
> 1 file changed, 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/sprd/sprd_dpu.c b/drivers/gpu/drm/sprd/sprd_dpu.c
> index a3447622a33cd612e34be038e833222567bdcd2c..0d9eb778794d92418b39f8535d94abde3566de43 100644
> --- a/drivers/gpu/drm/sprd/sprd_dpu.c
> +++ b/drivers/gpu/drm/sprd/sprd_dpu.c
> @@ -577,7 +577,6 @@ static const struct drm_plane_helper_funcs sprd_plane_helper_funcs = {
> static const struct drm_plane_funcs sprd_plane_funcs = {
> .update_plane = drm_atomic_helper_update_plane,
> .disable_plane = drm_atomic_helper_disable_plane,
> - .destroy = drm_plane_cleanup,
> .reset = drm_atomic_helper_plane_reset,
> .atomic_duplicate_state = drm_atomic_helper_plane_duplicate_state,
> .atomic_destroy_state = drm_atomic_helper_plane_destroy_state,
> @@ -704,7 +703,6 @@ static const struct drm_crtc_helper_funcs sprd_crtc_helper_funcs = {
> };
>
> static const struct drm_crtc_funcs sprd_crtc_funcs = {
> - .destroy = drm_crtc_cleanup,
> .set_config = drm_atomic_helper_set_config,
> .page_flip = drm_atomic_helper_page_flip,
> .reset = drm_atomic_helper_crtc_reset,
>
> --
> 2.50.0
--
With best wishes
Dmitry
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [PATCH 03/12] drm: of: try binding port parent node instead of the port itself
2025-07-19 12:09 ` [PATCH 03/12] drm: of: try binding port parent node instead of the port itself Otto Pflüger
@ 2025-07-28 15:41 ` Dmitry Baryshkov
0 siblings, 0 replies; 22+ messages in thread
From: Dmitry Baryshkov @ 2025-07-28 15:41 UTC (permalink / raw)
To: Otto Pflüger
Cc: David Airlie, Simona Vetter, Maarten Lankhorst, Maxime Ripard,
Thomas Zimmermann, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
Orson Zhai, Baolin Wang, Chunyan Zhang, Kevin Tang, dri-devel,
devicetree, linux-kernel
On Sat, Jul 19, 2025 at 02:09:39PM +0200, Otto Pflüger wrote:
> The drm_of_component_probe function is intended to bind all devices in
> an OF graph given a set of ports linked using the "ports" property on a
> main device node. This means that it should also bind the components
> providing these ports, not just the components of other ports connected
> to them. In order to do this, it calls drm_of_component_match_add with
> a pointer to each port node after checking that its parent node is a
> device.
>
> However, when given a pointer to the port node, the compare_of callback
> does not match it with a device node and thus fails to detect that the
> node belongs to a component. Fix this by passing a pointer to the parent
> node here too.
>
> Currently only the Unisoc platform driver relies on this feature, which
> was previously broken and is fixed by this change. On other platforms,
> the "ports" property points to ports that are not part of a component,
> i.e. the components only have indirect connections to the main node.
>
> Signed-off-by: Otto Pflüger <otto.pflueger@abscue.de>
Missing Fixes tag.
> ---
> drivers/gpu/drm/drm_of.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/drm_of.c b/drivers/gpu/drm/drm_of.c
> index d0183dea770308e77f05da364ffe087d53f3be36..b972facc2ec3fe40a4e10b5d7178b5ac8c0158d5 100644
> --- a/drivers/gpu/drm/drm_of.c
> +++ b/drivers/gpu/drm/drm_of.c
> @@ -132,7 +132,7 @@ int drm_of_component_probe(struct device *dev,
>
> if (of_device_is_available(port->parent))
> drm_of_component_match_add(dev, &match, compare_of,
> - port);
> + port->parent);
>
> of_node_put(port);
> }
>
> --
> 2.50.0
--
With best wishes
Dmitry
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [PATCH 05/12] drm: sprd: register a DSI bridge and move init code to pre_enable
2025-07-19 12:09 ` [PATCH 05/12] drm: sprd: register a DSI bridge and move init code to pre_enable Otto Pflüger
@ 2025-07-28 15:43 ` Dmitry Baryshkov
0 siblings, 0 replies; 22+ messages in thread
From: Dmitry Baryshkov @ 2025-07-28 15:43 UTC (permalink / raw)
To: Otto Pflüger
Cc: David Airlie, Simona Vetter, Maarten Lankhorst, Maxime Ripard,
Thomas Zimmermann, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
Orson Zhai, Baolin Wang, Chunyan Zhang, Kevin Tang, dri-devel,
devicetree, linux-kernel
On Sat, Jul 19, 2025 at 02:09:41PM +0200, Otto Pflüger wrote:
> If a panel needs to send DSI commands during initialization, it sets the
> prepare_prev_first flag, which allows the DSI host to initialize itself
> before the panel's prepare function is called. To support this, the DSI
> host must register a bridge and perform the necessary initialization
> steps in its pre_enable function.
>
> Implement this for the Unisoc DSI driver by moving the initialization
> code from the encoder callbacks to a bridge and simplify the remaining
> encoder-related code which no longer needs any callbacks.
>
> Signed-off-by: Otto Pflüger <otto.pflueger@abscue.de>
> ---
> drivers/gpu/drm/sprd/Kconfig | 2 +
> drivers/gpu/drm/sprd/sprd_dsi.c | 143 +++++++++++++++++++++++++---------------
> drivers/gpu/drm/sprd/sprd_dsi.h | 4 ++
> 3 files changed, 97 insertions(+), 52 deletions(-)
>
> diff --git a/drivers/gpu/drm/sprd/Kconfig b/drivers/gpu/drm/sprd/Kconfig
> index e22b780fe82248296a7153d02269faf8cd63294f..1afcdbf6f0ee3304f2297835241c9bb10d422154 100644
> --- a/drivers/gpu/drm/sprd/Kconfig
> +++ b/drivers/gpu/drm/sprd/Kconfig
> @@ -2,6 +2,8 @@ config DRM_SPRD
> tristate "DRM Support for Unisoc SoCs Platform"
> depends on ARCH_SPRD || COMPILE_TEST
> depends on DRM && OF
> + select DRM_BRIDGE_CONNECTOR
> + select DRM_DISPLAY_HELPER
> select DRM_GEM_DMA_HELPER
> select DRM_KMS_HELPER
> select DRM_MIPI_DSI
> diff --git a/drivers/gpu/drm/sprd/sprd_dsi.c b/drivers/gpu/drm/sprd/sprd_dsi.c
> index 23b0e1dc547a5023ee6ad7d5e1c49e2cec986bf0..43fff12d73f12619da57606a3c4785924e2c1507 100644
> --- a/drivers/gpu/drm/sprd/sprd_dsi.c
> +++ b/drivers/gpu/drm/sprd/sprd_dsi.c
> @@ -11,8 +11,10 @@
>
> #include <drm/drm_atomic_helper.h>
> #include <drm/drm_bridge.h>
> +#include <drm/drm_bridge_connector.h>
> #include <drm/drm_of.h>
> #include <drm/drm_probe_helper.h>
> +#include <drm/drm_simple_kms_helper.h>
>
> #include "sprd_drm.h"
> #include "sprd_dpu.h"
> @@ -778,19 +780,53 @@ static void sprd_dphy_fini(struct dsi_context *ctx)
> dsi_reg_up(ctx, PHY_INTERFACE_CTRL, RF_PHY_RESET_N, RF_PHY_RESET_N);
> }
>
> -static void sprd_dsi_encoder_mode_set(struct drm_encoder *encoder,
> - struct drm_display_mode *mode,
> - struct drm_display_mode *adj_mode)
> +static int sprd_dsi_encoder_init(struct sprd_dsi *dsi,
> + struct device *dev)
> +{
> + struct drm_encoder *encoder = &dsi->encoder;
> + u32 crtc_mask;
> + int ret;
> +
> + crtc_mask = drm_of_find_possible_crtcs(dsi->drm, dev->of_node);
> + if (!crtc_mask) {
> + drm_err(dsi->drm, "failed to find crtc mask\n");
> + return -EINVAL;
> + }
> +
> + drm_dbg(dsi->drm, "find possible crtcs: 0x%08x\n", crtc_mask);
> +
> + encoder->possible_crtcs = crtc_mask;
> + ret = drm_simple_encoder_init(dsi->drm, encoder, DRM_MODE_ENCODER_DSI);
The drm_simple_* components are being deprecated. Please open-code
corresponding functionality.
> + if (ret) {
> + drm_err(dsi->drm, "failed to init dsi encoder\n");
> + return ret;
> + }
> +
> + return 0;
> +}
> +
--
With best wishes
Dmitry
^ permalink raw reply [flat|nested] 22+ messages in thread
end of thread, other threads:[~2025-07-28 15:43 UTC | newest]
Thread overview: 22+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-07-19 12:09 [PATCH 00/12] drm: sprd: Make the Unisoc DRM driver usable on UMS9230 Otto Pflüger
2025-07-19 12:09 ` [PATCH 01/12] dt-bindings: display: sprd: adapt for UMS9230 support Otto Pflüger
2025-07-19 13:24 ` Rob Herring (Arm)
2025-07-20 12:26 ` Krzysztof Kozlowski
2025-07-20 13:55 ` Otto Pflüger
2025-07-20 15:38 ` Krzysztof Kozlowski
2025-07-20 17:35 ` Otto Pflüger
2025-07-22 7:19 ` Krzysztof Kozlowski
2025-07-19 12:09 ` [PATCH 02/12] dt-bindings: display: sprd: allow attaching a DSI panel Otto Pflüger
2025-07-19 12:09 ` [PATCH 03/12] drm: of: try binding port parent node instead of the port itself Otto Pflüger
2025-07-28 15:41 ` Dmitry Baryshkov
2025-07-19 12:09 ` [PATCH 04/12] drm: sprd: remove plane and crtc destroy callbacks Otto Pflüger
2025-07-28 15:41 ` Dmitry Baryshkov
2025-07-19 12:09 ` [PATCH 05/12] drm: sprd: register a DSI bridge and move init code to pre_enable Otto Pflüger
2025-07-28 15:43 ` Dmitry Baryshkov
2025-07-19 12:09 ` [PATCH 06/12] drm: sprd: add support for UMS9230 DSI PLL Otto Pflüger
2025-07-19 12:09 ` [PATCH 07/12] drm: sprd: fix DSI rate and PLL setup code Otto Pflüger
2025-07-19 12:09 ` [PATCH 08/12] drm: sprd: add gate clock support Otto Pflüger
2025-07-19 12:09 ` [PATCH 09/12] drm: sprd: add support for newer DPU versions Otto Pflüger
2025-07-19 12:09 ` [PATCH 10/12] drm: sprd: always initialize DPU and DSI registers Otto Pflüger
2025-07-19 12:09 ` [PATCH 11/12] drm: sprd: add fbdev support Otto Pflüger
2025-07-19 12:09 ` [PATCH 12/12] drm: sprd: select REGMAP in Kconfig Otto Pflüger
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).