From nobody Sun Oct 5 16:20:36 2025 Received: from srv01.abscue.de (abscue.de [89.58.28.240]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CC13022425E; Thu, 31 Jul 2025 16:02:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=89.58.28.240 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1753977777; cv=none; b=Yfzx39eX/TxI4GZmLxlesafb7jVV4KvDRIpPrOD0wD4DUAVONoyjxBokaFsPf6CDXzteiyY6A1ivBygFPnzLn6Y4enPF9ZXS3gDF2/kaRLJ7oenFD4pgXKQrEppgqHfZVR7ZXDh9aGr0d+gsbpblcGMuvkXYgWqF0RC4fOqmNKg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1753977777; c=relaxed/simple; bh=uKSxvnNfrY7KR4qCrsDJ4BK6Q4UM8mA7pD5swc+umnI=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=bkuEz7plsD+ZowHw/Y4CSMb9siyNwFbiLC0snc5VMi65RvRjYtam2AhYGAoFlM8xz2gYeUdwxkGMMkSOBKlKkJwuQ7LQlYdx/tyQ9YviQ72DYrZsoJet3MY6Q4ZfuQhXZPxRp0wlOQz93vJVU+pFQx9SdOvm2QK8/3nwyMEQNow= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=abscue.de; spf=pass smtp.mailfrom=abscue.de; arc=none smtp.client-ip=89.58.28.240 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=abscue.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=abscue.de Received: from srv01.abscue.de (localhost [127.0.0.1]) by spamfilter.srv.local (Postfix) with ESMTP id 967D01C270F; Thu, 31 Jul 2025 17:52:51 +0200 (CEST) X-Spam-Level: Received: from fluffy-mammal.metal.fwg-cag.de (unknown [IPv6:2001:9e8:cdc9:0:1347:874c:9851:58c6]) by srv01.abscue.de (Postfix) with ESMTPSA id AE9F51C270C; Thu, 31 Jul 2025 17:52:50 +0200 (CEST) From: =?utf-8?q?Otto_Pfl=C3=BCger?= Date: Thu, 31 Jul 2025 17:51:14 +0200 Subject: [PATCH v3 01/16] dt-bindings: display: sprd: adapt for UMS9230 support Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20250731-ums9230-drm-v3-1-06d4f57c4b08@abscue.de> References: <20250731-ums9230-drm-v3-0-06d4f57c4b08@abscue.de> In-Reply-To: <20250731-ums9230-drm-v3-0-06d4f57c4b08@abscue.de> 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 , Liviu Dudau , Russell King , Eric Anholt , Kevin Tang Cc: dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, =?utf-8?q?Otto_Pfl=C3=BCger?= X-Mailer: b4 0.14.2 Add new compatible strings for the DPU and DSI controller found in the UMS9230 SoC. Signed-off-by: Otto Pfl=C3=BCger Acked-by: Rob Herring (Arm) Reviewed-by: Cixi Geng --- .../devicetree/bindings/display/sprd/sprd,sharkl3-dpu.yaml | 7 +++= +++- .../devicetree/bindings/display/sprd/sprd,sharkl3-dsi-host.yaml | 4 +++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/Documentation/devicetree/bindings/display/sprd/sprd,sharkl3-dp= u.yaml b/Documentation/devicetree/bindings/display/sprd/sprd,sharkl3-dpu.ya= ml index 8c52fa0ea5f8ee2149ebf1d4b0d5b052832e3d97..cfa162178fe11df149f2f8dcb03= 383dafc44868e 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: | =20 properties: compatible: - const: sprd,sharkl3-dpu + oneOf: + - items: + - enum: + - sprd,ums9230-dpu + - const: sprd,sharkl3-dpu + - const: sprd,sharkl3-dpu =20 reg: maxItems: 1 diff --git a/Documentation/devicetree/bindings/display/sprd/sprd,sharkl3-ds= i-host.yaml b/Documentation/devicetree/bindings/display/sprd/sprd,sharkl3-d= si-host.yaml index 300bf2252c3e8e589dc74927520e24aa4a59f81b..9177ae6aa7a33f7f797b48cfe06= cf8a5391b34a9 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: =20 properties: compatible: - const: sprd,sharkl3-dsi-host + enum: + - sprd,sharkl3-dsi-host + - sprd,ums9230-dsi-host =20 reg: maxItems: 1 --=20 2.50.0 From nobody Sun Oct 5 16:20:36 2025 Received: from srv01.abscue.de (abscue.de [89.58.28.240]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CB3ED2236FC; Thu, 31 Jul 2025 16:02:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=89.58.28.240 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1753977777; cv=none; b=O8eng7ABv6KwsN7xNXNnjTfTUdz+e6zP7YwhKfLzrPdiS2522NBhlRVSTqT1n48ZthL5atI6kEOp+a2rY5smyyJnOix6blF6AwxyVGWuhV2sHulWzxveQPYdkcfPQJiQnaSEOsdCayJMk/Jq/eJyJ/E29l2+k263gDd8vjbwMiE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1753977777; c=relaxed/simple; bh=ptVqnTy6pJHp4ERvk/kSrG/DnxxRwuC1y9ff9/zGedk=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=FBEgbjHVYgO8vawzYwJE8GZd+pyA3QvVSOyXdku0TZRFc08kN+FkpsI/w3to5LDDLtn7s0bKPRXmsMg4h3FqfHtV8bfu4r+kWiUvLHBJGu+RjooM+zHFPRQLHZ0wy0PccihsZuMayOrCVkplm6O8beRcNEen8/9IVV+NzXKvQOY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=abscue.de; spf=pass smtp.mailfrom=abscue.de; arc=none smtp.client-ip=89.58.28.240 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=abscue.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=abscue.de Received: from srv01.abscue.de (localhost [127.0.0.1]) by spamfilter.srv.local (Postfix) with ESMTP id 5BD181C2711; Thu, 31 Jul 2025 17:52:52 +0200 (CEST) X-Spam-Level: Received: from fluffy-mammal.metal.fwg-cag.de (unknown [IPv6:2001:9e8:cdc9:0:1347:874c:9851:58c6]) by srv01.abscue.de (Postfix) with ESMTPSA id 69EC41C270E; Thu, 31 Jul 2025 17:52:51 +0200 (CEST) From: =?utf-8?q?Otto_Pfl=C3=BCger?= Date: Thu, 31 Jul 2025 17:51:15 +0200 Subject: [PATCH v3 02/16] dt-bindings: display: sprd: use more descriptive clock names Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20250731-ums9230-drm-v3-2-06d4f57c4b08@abscue.de> References: <20250731-ums9230-drm-v3-0-06d4f57c4b08@abscue.de> In-Reply-To: <20250731-ums9230-drm-v3-0-06d4f57c4b08@abscue.de> 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 , Liviu Dudau , Russell King , Eric Anholt , Kevin Tang Cc: dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, =?utf-8?q?Otto_Pfl=C3=BCger?= X-Mailer: b4 0.14.2 Introduce new clock names that actually describe what the clock input is used for instead of referring to a specific clock source. The new clock input names are based on information from clock drivers such as drivers/clk/sprd/ums512-clk.c. The 128M clock appears to be CLK_DISPC0_DPI, the clock used for the DPI output from the DPU, while the 384M clock is CLK_DISPC0, the actual DPU core clock. The DSI controller's 96M clock is most likely CLK_DSI_APB, the APB clock used for accessing its control registers. Since it seems possible to configure different frequencies for these clocks, the old bindings do not even accurately describe the hardware. Deprecate the old clock names. Signed-off-by: Otto Pfl=C3=BCger Reviewed-by: Cixi Geng Reviewed-by: Rob Herring (Arm) --- .../bindings/display/sprd/sprd,sharkl3-dpu.yaml | 17 +++++++++++--= ---- .../bindings/display/sprd/sprd,sharkl3-dsi-host.yaml | 11 ++++++++--- 2 files changed, 19 insertions(+), 9 deletions(-) diff --git a/Documentation/devicetree/bindings/display/sprd/sprd,sharkl3-dp= u.yaml b/Documentation/devicetree/bindings/display/sprd/sprd,sharkl3-dpu.ya= ml index cfa162178fe11df149f2f8dcb03383dafc44868e..7f34652080b22e7b7072a709fd3= 90a72375110ef 100644 --- a/Documentation/devicetree/bindings/display/sprd/sprd,sharkl3-dpu.yaml +++ b/Documentation/devicetree/bindings/display/sprd/sprd,sharkl3-dpu.yaml @@ -33,9 +33,14 @@ properties: maxItems: 2 =20 clock-names: - items: - - const: clk_src_128m - - const: clk_src_384m + oneOf: + - deprecated: true + items: + - const: clk_src_128m + - const: clk_src_384m + - items: + - const: core + - const: dpi =20 power-domains: maxItems: 1 @@ -69,10 +74,10 @@ examples: compatible =3D "sprd,sharkl3-dpu"; reg =3D <0x63000000 0x1000>; interrupts =3D ; - clock-names =3D "clk_src_128m", "clk_src_384m"; =20 - clocks =3D <&pll CLK_TWPLL_128M>, - <&pll CLK_TWPLL_384M>; + clocks =3D <&pll CLK_TWPLL_384M>, + <&pll CLK_TWPLL_128M>; + clock-names =3D "core", "dpi"; =20 dpu_port: port { dpu_out: endpoint { diff --git a/Documentation/devicetree/bindings/display/sprd/sprd,sharkl3-ds= i-host.yaml b/Documentation/devicetree/bindings/display/sprd/sprd,sharkl3-d= si-host.yaml index 9177ae6aa7a33f7f797b48cfe06cf8a5391b34a9..71abbc2de8dbb1b674f151a8749= 0c865b187fdd0 100644 --- a/Documentation/devicetree/bindings/display/sprd/sprd,sharkl3-dsi-host.= yaml +++ b/Documentation/devicetree/bindings/display/sprd/sprd,sharkl3-dsi-host.= yaml @@ -25,8 +25,12 @@ properties: maxItems: 1 =20 clock-names: - items: - - const: clk_src_96m + oneOf: + - deprecated: true + items: + - const: clk_src_96m + - items: + - const: pclk =20 power-domains: maxItems: 1 @@ -75,8 +79,9 @@ examples: reg =3D <0x63100000 0x1000>; interrupts =3D , ; - clock-names =3D "clk_src_96m"; clocks =3D <&pll CLK_TWPLL_96M>; + clock-names =3D "pclk"; + ports { #address-cells =3D <1>; #size-cells =3D <0>; --=20 2.50.0 From nobody Sun Oct 5 16:20:36 2025 Received: from srv01.abscue.de (abscue.de [89.58.28.240]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CC18A2253A4; Thu, 31 Jul 2025 16:02:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=89.58.28.240 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1753977778; cv=none; b=fBsrl8Gc7BDWzqIxAgeqgdmnDLU0d5Gyw0U6dV2+VdRvbokgK7D5V8JRMpO6TSSrrLc8aUHzZvN28ZQjQm2qtkST00MePmr5GOLy5CQAPEEewAQgVzqoRQTBsxfkkaZafaYoV2QhqXgtkvG3vysRZd1FuL+zwd5SZAUQ3eNkcDo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1753977778; c=relaxed/simple; bh=SxSoylqh2nQNMTD8ghVhZN6VNO53DKjHkG1IBEctzaY=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=GywnX2KpbGqi4Qp/nOhkuAfD+9WRkyjuYgdJuZblMVXV3acJk/JyZyTKjmaeq27Hf6rjE6SHgrs9ey/+YNZmI5YTQjajxuuDgZux7X+nSbnrr4ARDnfgLFuBSCJ9aZBv3jMd3bQqzc5YRrbIUzn0uXX1whymHSDIeeFAdJk1PmY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=abscue.de; spf=pass smtp.mailfrom=abscue.de; arc=none smtp.client-ip=89.58.28.240 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=abscue.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=abscue.de Received: from srv01.abscue.de (localhost [127.0.0.1]) by spamfilter.srv.local (Postfix) with ESMTP id 8A7EA1C2718; Thu, 31 Jul 2025 17:52:55 +0200 (CEST) X-Spam-Level: Received: from fluffy-mammal.metal.fwg-cag.de (unknown [IPv6:2001:9e8:cdc9:0:1347:874c:9851:58c6]) by srv01.abscue.de (Postfix) with ESMTPSA id 274A41C2710; Thu, 31 Jul 2025 17:52:52 +0200 (CEST) From: =?utf-8?q?Otto_Pfl=C3=BCger?= Date: Thu, 31 Jul 2025 17:51:16 +0200 Subject: [PATCH v3 03/16] dt-bindings: display: sprd: add memory-region property Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20250731-ums9230-drm-v3-3-06d4f57c4b08@abscue.de> References: <20250731-ums9230-drm-v3-0-06d4f57c4b08@abscue.de> In-Reply-To: <20250731-ums9230-drm-v3-0-06d4f57c4b08@abscue.de> 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 , Liviu Dudau , Russell King , Eric Anholt , Kevin Tang Cc: dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, =?utf-8?q?Otto_Pfl=C3=BCger?= , Krzysztof Kozlowski X-Mailer: b4 0.14.2 Explain that the DPU node supports a memory-region property that can be used to describe an initial framebuffer set up by the bootloader, usually in order to create a passthrough mapping for this framebuffer when the IOMMU is used. Acked-by: Krzysztof Kozlowski Signed-off-by: Otto Pfl=C3=BCger --- .../devicetree/bindings/display/sprd/sprd,sharkl3-dpu.yaml | 8 ++++= ++++ 1 file changed, 8 insertions(+) diff --git a/Documentation/devicetree/bindings/display/sprd/sprd,sharkl3-dp= u.yaml b/Documentation/devicetree/bindings/display/sprd/sprd,sharkl3-dpu.ya= ml index 7f34652080b22e7b7072a709fd390a72375110ef..fa9ad2600f150e1023606898322= a1a7b4675bab3 100644 --- a/Documentation/devicetree/bindings/display/sprd/sprd,sharkl3-dpu.yaml +++ b/Documentation/devicetree/bindings/display/sprd/sprd,sharkl3-dpu.yaml @@ -48,6 +48,14 @@ properties: iommus: maxItems: 1 =20 + memory-region: + maxItems: 1 + description: + A phandle to the framebuffer region configured by the bootloader. Th= is + 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. + port: type: object description: --=20 2.50.0 From nobody Sun Oct 5 16:20:36 2025 Received: from srv01.abscue.de (abscue.de [89.58.28.240]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CB38E2222CB; Thu, 31 Jul 2025 16:02:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=89.58.28.240 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1753977778; cv=none; b=ohG4/WyxK/ANee3iGRc88ePUk/S2JT9z1xtQ+o/T3lEBMAJA9tp6m+5fOYCFW+OIbJB0HdSLztZ+pwCleaMp8wCb138jhiekVX8XrYejfq4irYdP8VsQ3k5NuOZH+UN3znIcW4yrSAGHofMSw4Df+bgsTzCm8pw9wFZFXiVrv7A= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1753977778; c=relaxed/simple; bh=vvFSZ89Mn/XWX0tfWxb7bhlASEHgl0/ESlWaVfQ48pI=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=tMkTmh6irL6Ud23rwGgfwNgrYmKzaCVajcr3oBsxenN2tpC0GdsPqvn8KPLYcaMlVH1cxwyovB62lEO5A3QiDzzwkVPA4Ia1Jq4+sN+GcuLCH9YAJdXSYGU9AZoeZJW8yVyfi82B15II4EWy/kdqF1A+utYfQcpyet33i88oDAw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=abscue.de; spf=pass smtp.mailfrom=abscue.de; arc=none smtp.client-ip=89.58.28.240 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=abscue.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=abscue.de Received: from srv01.abscue.de (localhost [127.0.0.1]) by spamfilter.srv.local (Postfix) with ESMTP id E55601C2719; Thu, 31 Jul 2025 17:52:55 +0200 (CEST) X-Spam-Level: Received: from fluffy-mammal.metal.fwg-cag.de (unknown [IPv6:2001:9e8:cdc9:0:1347:874c:9851:58c6]) by srv01.abscue.de (Postfix) with ESMTPSA id DD5991C2712; Thu, 31 Jul 2025 17:52:52 +0200 (CEST) From: =?utf-8?q?Otto_Pfl=C3=BCger?= Date: Thu, 31 Jul 2025 17:51:17 +0200 Subject: [PATCH v3 04/16] dt-bindings: display: sprd: allow attaching a DSI panel Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20250731-ums9230-drm-v3-4-06d4f57c4b08@abscue.de> References: <20250731-ums9230-drm-v3-0-06d4f57c4b08@abscue.de> In-Reply-To: <20250731-ums9230-drm-v3-0-06d4f57c4b08@abscue.de> 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 , Liviu Dudau , Russell King , Eric Anholt , Kevin Tang Cc: dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, =?utf-8?q?Otto_Pfl=C3=BCger?= , Krzysztof Kozlowski X-Mailer: b4 0.14.2 Add a DSI output port and include common DSI controller bindings in the bindings for the Unisoc DSI controller. Reviewed-by: Krzysztof Kozlowski Signed-off-by: Otto Pfl=C3=BCger --- .../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-ds= i-host.yaml b/Documentation/devicetree/bindings/display/sprd/sprd,sharkl3-d= si-host.yaml index 71abbc2de8dbb1b674f151a87490c865b187fdd0..7da68eb026b97932515b470764f= a3948104db4e8 100644 --- a/Documentation/devicetree/bindings/display/sprd/sprd,sharkl3-dsi-host.= yaml +++ b/Documentation/devicetree/bindings/display/sprd/sprd,sharkl3-dsi-host.= yaml @@ -46,12 +46,22 @@ properties: const: 0 =20 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 pan= el =20 required: - "#address-cells" @@ -60,6 +70,9 @@ properties: =20 additionalProperties: false =20 +allOf: + - $ref: /schemas/display/dsi-controller.yaml# + required: - compatible - reg @@ -68,7 +81,7 @@ required: - clock-names - ports =20 -additionalProperties: false +unevaluatedProperties: false =20 examples: - | --=20 2.50.0 From nobody Sun Oct 5 16:20:36 2025 Received: from srv01.abscue.de (abscue.de [89.58.28.240]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DBFEB1ACED9; Thu, 31 Jul 2025 15:53:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=89.58.28.240 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1753977188; cv=none; b=k8ArK04bWOiPQI6AvEyWhiVBWKR0wIabVVAR0jKlESZSagZelluRvpBJM6Tb0z3YcNd0MXePbCaiF4kqgKWHQddp1zRkCxfMmql9QRXQ3jvU0KLGmuMI9s2XLicqNxu/HlGKvhad98/P0AxbUeDgqIbG0o/TGGZPPwlmanGX43o= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1753977188; c=relaxed/simple; bh=/hDMFfib2TZPG22mAzqNwRHidGMVAxYzgUZyc2zrlkw=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=BbMpuM8oQ1aZCKjr2q+WzkG4iWh9fzrhA2HgTX7InMnWXVm6qbfKVCRowF4sMXgMg45QmfWocG/b6HCGh99DgvvwcbSU/iGYLCd46A5CoBw29Z0bKXxko1pc6jWq17/14tCkdIDKDs53v4mUcjlJAdezaiL7JqlJ2OXlVWdRio8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=abscue.de; spf=pass smtp.mailfrom=abscue.de; arc=none smtp.client-ip=89.58.28.240 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=abscue.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=abscue.de Received: from srv01.abscue.de (localhost [127.0.0.1]) by spamfilter.srv.local (Postfix) with ESMTP id 437FA1C2710; Thu, 31 Jul 2025 17:52:56 +0200 (CEST) X-Spam-Level: Received: from fluffy-mammal.metal.fwg-cag.de (unknown [IPv6:2001:9e8:cdc9:0:1347:874c:9851:58c6]) by srv01.abscue.de (Postfix) with ESMTPSA id 9E6131C2713; Thu, 31 Jul 2025 17:52:53 +0200 (CEST) From: =?utf-8?q?Otto_Pfl=C3=BCger?= Date: Thu, 31 Jul 2025 17:51:18 +0200 Subject: [PATCH v3 05/16] drm: of: try binding port parent node instead of the port itself Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20250731-ums9230-drm-v3-5-06d4f57c4b08@abscue.de> References: <20250731-ums9230-drm-v3-0-06d4f57c4b08@abscue.de> In-Reply-To: <20250731-ums9230-drm-v3-0-06d4f57c4b08@abscue.de> 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 , Liviu Dudau , Russell King , Eric Anholt , Kevin Tang Cc: dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, =?utf-8?q?Otto_Pfl=C3=BCger?= X-Mailer: b4 0.14.2 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. Fixes: df785aa87f3a ("drm: Introduce generic probe function for component b= ased masters.") Signed-off-by: Otto Pfl=C3=BCger --- 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..b972facc2ec3fe40a4e10b5d717= 8b5ac8c0158d5 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, =20 if (of_device_is_available(port->parent)) drm_of_component_match_add(dev, &match, compare_of, - port); + port->parent); =20 of_node_put(port); } --=20 2.50.0 From nobody Sun Oct 5 16:20:36 2025 Received: from srv01.abscue.de (abscue.de [89.58.28.240]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DC03F1DE4E7; Thu, 31 Jul 2025 15:53:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=89.58.28.240 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1753977187; cv=none; b=pQtvEB+d364C2uRfOhQ1M2d0H4/a4KhWNOz4OtabTKFaoCpuENS2/y4sp+Qb3xzbiWwet9IgdueBtuqSikc5xMh6eHmD3Xd026FNqnCmO+xvvKBthWFpGoNH3vwMuAJdAe8yLQ47B9ist2WZtuMcY0ikSrRZ/zgbJsRIjQgtgNA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1753977187; c=relaxed/simple; bh=i8xOmknQviXTgLQ18uBJa5tsi0mjbgA7Qm8Zy4OKC/M=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=LpVgNAzAX00Fcvo0KEv+0rk3pL8OtjtDHGLIr7t0fXnxiL3mdAcB1ZtQ8Zm7IZlmC+3q/aQeYx8reppoCo3EuuROjWy/NpKA+V/g2/EF2qBDV8S6VVro2AxtYRDoaDjZhcAYzQndTvcqfIdMZ0pIREI5V5kurlISAqEGScpYBdQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=abscue.de; spf=pass smtp.mailfrom=abscue.de; arc=none smtp.client-ip=89.58.28.240 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=abscue.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=abscue.de Received: from srv01.abscue.de (localhost [127.0.0.1]) by spamfilter.srv.local (Postfix) with ESMTP id 615671C270E; Thu, 31 Jul 2025 17:52:56 +0200 (CEST) X-Spam-Level: Received: from fluffy-mammal.metal.fwg-cag.de (unknown [IPv6:2001:9e8:cdc9:0:1347:874c:9851:58c6]) by srv01.abscue.de (Postfix) with ESMTPSA id 597D81C2714; Thu, 31 Jul 2025 17:52:54 +0200 (CEST) From: =?utf-8?q?Otto_Pfl=C3=BCger?= Date: Thu, 31 Jul 2025 17:51:19 +0200 Subject: [PATCH v3 06/16] drm: sprd: remove plane and CRTC destroy callbacks Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20250731-ums9230-drm-v3-6-06d4f57c4b08@abscue.de> References: <20250731-ums9230-drm-v3-0-06d4f57c4b08@abscue.de> In-Reply-To: <20250731-ums9230-drm-v3-0-06d4f57c4b08@abscue.de> 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 , Liviu Dudau , Russell King , Eric Anholt , Kevin Tang Cc: dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, =?utf-8?q?Otto_Pfl=C3=BCger?= X-Mailer: b4 0.14.2 When the driver allocates planes and CRTCs as managed resources, the destroy callbacks must be NULL and trigger a runtime warning if they are present. Fixes: b07bcf34b6c9 ("drm/sprd: add Unisoc's drm display controller driver") Signed-off-by: Otto Pfl=C3=BCger --- 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_dp= u.c index a3447622a33cd612e34be038e833222567bdcd2c..0d9eb778794d92418b39f8535d9= 4abde3566de43 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_h= elper_funcs =3D { static const struct drm_plane_funcs sprd_plane_funcs =3D { .update_plane =3D drm_atomic_helper_update_plane, .disable_plane =3D drm_atomic_helper_disable_plane, - .destroy =3D drm_plane_cleanup, .reset =3D drm_atomic_helper_plane_reset, .atomic_duplicate_state =3D drm_atomic_helper_plane_duplicate_state, .atomic_destroy_state =3D drm_atomic_helper_plane_destroy_state, @@ -704,7 +703,6 @@ static const struct drm_crtc_helper_funcs sprd_crtc_hel= per_funcs =3D { }; =20 static const struct drm_crtc_funcs sprd_crtc_funcs =3D { - .destroy =3D drm_crtc_cleanup, .set_config =3D drm_atomic_helper_set_config, .page_flip =3D drm_atomic_helper_page_flip, .reset =3D drm_atomic_helper_crtc_reset, --=20 2.50.0 From nobody Sun Oct 5 16:20:36 2025 Received: from srv01.abscue.de (abscue.de [89.58.28.240]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DBF44141987; Thu, 31 Jul 2025 15:53:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=89.58.28.240 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1753977188; cv=none; b=ipWqfDA8ZR/1ptXEpnRPAxts7rh6KTcwpwFQa3F2+Zf9ypEmGfl4jxq4ZdWmhkzptVI6ttX4VJM8wpmW1tyHZm0lTI35z8v+39zl0HQwFMvfnvJC9Od5iT+A+DPEJwJkCQBUy/8nHgchs3lUpdQoUWtb68sHBn9tRhWOiP032aM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1753977188; c=relaxed/simple; bh=FR7Mmvk6WLPU8asy8AHjS8J4M04+Y+wfQTQ0GYvzs00=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=EtnedUAsvThYZQhUvwnCi0BpPn5HslUP5QM/d/nB8db1AFCGLRY0GVnrUDOJfrqddRVZ9+aluY/xmlj12f8r5IxSw87xrD5qxEgF/clCE3roXVyMIkxvUes8Orj2CjT4LQ39HoULQ2oHDuiXlwLc6F94XNWFv23epg4Ebqbi4dY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=abscue.de; spf=pass smtp.mailfrom=abscue.de; arc=none smtp.client-ip=89.58.28.240 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=abscue.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=abscue.de Received: from srv01.abscue.de (localhost [127.0.0.1]) by spamfilter.srv.local (Postfix) with ESMTP id C7C301C271A; Thu, 31 Jul 2025 17:52:56 +0200 (CEST) X-Spam-Level: Received: from fluffy-mammal.metal.fwg-cag.de (unknown [IPv6:2001:9e8:cdc9:0:1347:874c:9851:58c6]) by srv01.abscue.de (Postfix) with ESMTPSA id 133EB1C2715; Thu, 31 Jul 2025 17:52:55 +0200 (CEST) From: =?utf-8?q?Otto_Pfl=C3=BCger?= Date: Thu, 31 Jul 2025 17:51:20 +0200 Subject: [PATCH v3 07/16] drm: sprd: register a DSI bridge and initialize in pre_enable Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20250731-ums9230-drm-v3-7-06d4f57c4b08@abscue.de> References: <20250731-ums9230-drm-v3-0-06d4f57c4b08@abscue.de> In-Reply-To: <20250731-ums9230-drm-v3-0-06d4f57c4b08@abscue.de> 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 , Liviu Dudau , Russell King , Eric Anholt , Kevin Tang Cc: dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, =?utf-8?q?Otto_Pfl=C3=BCger?= X-Mailer: b4 0.14.2 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. Make the pre_enable function initialize the host in command mode without starting the DPU. Video mode (if supported by the panel) and the DPU are then started in the enable function after the panel is initialized. Signed-off-by: Otto Pfl=C3=BCger --- drivers/gpu/drm/sprd/Kconfig | 2 + drivers/gpu/drm/sprd/sprd_dsi.c | 188 +++++++++++++++++++++++++-----------= ---- drivers/gpu/drm/sprd/sprd_dsi.h | 7 +- 3 files changed, 125 insertions(+), 72 deletions(-) diff --git a/drivers/gpu/drm/sprd/Kconfig b/drivers/gpu/drm/sprd/Kconfig index e22b780fe82248296a7153d02269faf8cd63294f..1afcdbf6f0ee3304f2297835241= c9bb10d422154 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_ds= i.c index 23b0e1dc547a5023ee6ad7d5e1c49e2cec986bf0..22f300654a1903ecb7002c1e643= 361c6c51623d4 100644 --- a/drivers/gpu/drm/sprd/sprd_dsi.c +++ b/drivers/gpu/drm/sprd/sprd_dsi.c @@ -11,6 +11,7 @@ =20 #include #include +#include #include #include =20 @@ -778,26 +779,60 @@ static void sprd_dphy_fini(struct dsi_context *ctx) dsi_reg_up(ctx, PHY_INTERFACE_CTRL, RF_PHY_RESET_N, RF_PHY_RESET_N); } =20 -static void sprd_dsi_encoder_mode_set(struct drm_encoder *encoder, - struct drm_display_mode *mode, - struct drm_display_mode *adj_mode) +static const struct drm_encoder_funcs sprd_encoder_funcs =3D { + .destroy =3D drm_encoder_cleanup, +}; + +static int sprd_dsi_encoder_init(struct sprd_dsi *dsi, + struct device *dev) +{ + struct drm_encoder *encoder =3D &dsi->encoder; + u32 crtc_mask; + int ret; + + crtc_mask =3D 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 =3D crtc_mask; + ret =3D 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; + } + + 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 =3D encoder_to_dsi(encoder); + struct sprd_dsi *dsi =3D 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 =3D bridge_to_dsi(bridge); =20 drm_display_mode_to_videomode(adj_mode, &dsi->ctx.vm); } =20 -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 =3D encoder_to_dsi(encoder); - struct sprd_dpu *dpu =3D to_sprd_crtc(encoder->crtc); + struct sprd_dsi *dsi =3D bridge_to_dsi(bridge); struct dsi_context *ctx =3D &dsi->ctx; =20 - if (ctx->enabled) { - drm_warn(dsi->drm, "dsi is initialized\n"); - return; - } - sprd_dsi_init(ctx); if (ctx->work_mode =3D=3D DSI_MODE_VIDEO) sprd_dsi_dpi_video(ctx); @@ -806,6 +841,18 @@ static void sprd_dsi_encoder_enable(struct drm_encoder= *encoder) =20 sprd_dphy_init(ctx); =20 + /* + * Initialize in command mode to allow panels to prepare by sending + * DSI commands before the DPU is started. + */ + sprd_dsi_set_work_mode(ctx, DSI_MODE_CMD); +} + +static void sprd_dsi_bridge_enable(struct drm_bridge *bridge) +{ + struct sprd_dsi *dsi =3D bridge_to_dsi(bridge); + struct dsi_context *ctx =3D &dsi->ctx; + sprd_dsi_set_work_mode(ctx, ctx->work_mode); sprd_dsi_state_reset(ctx); =20 @@ -819,67 +866,38 @@ static void sprd_dsi_encoder_enable(struct drm_encode= r *encoder) dphy_wait_pll_locked(ctx); } =20 - sprd_dpu_run(dpu); - - ctx->enabled =3D true; + sprd_dpu_run(to_sprd_crtc(dsi->encoder.crtc)); } =20 -static void sprd_dsi_encoder_disable(struct drm_encoder *encoder) +static void sprd_dsi_bridge_disable(struct drm_bridge *bridge) { - struct sprd_dsi *dsi =3D encoder_to_dsi(encoder); - struct sprd_dpu *dpu =3D to_sprd_crtc(encoder->crtc); + struct sprd_dsi *dsi =3D bridge_to_dsi(bridge); struct dsi_context *ctx =3D &dsi->ctx; =20 - if (!ctx->enabled) { - drm_warn(dsi->drm, "dsi isn't initialized\n"); - return; - } - - sprd_dpu_stop(dpu); - sprd_dphy_fini(ctx); - sprd_dsi_fini(ctx); + sprd_dpu_stop(to_sprd_crtc(dsi->encoder.crtc)); =20 - ctx->enabled =3D false; + /* Switch to command mode to allow panels to unprepare */ + sprd_dsi_set_work_mode(ctx, DSI_MODE_CMD); } =20 -static const struct drm_encoder_helper_funcs sprd_encoder_helper_funcs =3D= { - .mode_set =3D sprd_dsi_encoder_mode_set, - .enable =3D sprd_dsi_encoder_enable, - .disable =3D sprd_dsi_encoder_disable -}; - -static const struct drm_encoder_funcs sprd_encoder_funcs =3D { - .destroy =3D drm_encoder_cleanup, -}; - -static int sprd_dsi_encoder_init(struct sprd_dsi *dsi, - struct device *dev) +static void sprd_dsi_bridge_post_disable(struct drm_bridge *bridge) { - struct drm_encoder *encoder =3D &dsi->encoder; - u32 crtc_mask; - int ret; - - crtc_mask =3D 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 =3D crtc_mask; - ret =3D 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); + struct sprd_dsi *dsi =3D bridge_to_dsi(bridge); + struct dsi_context *ctx =3D &dsi->ctx; =20 - return 0; + sprd_dphy_fini(ctx); + sprd_dsi_fini(ctx); } =20 +static const struct drm_bridge_funcs sprd_dsi_bridge_funcs =3D { + .attach =3D sprd_dsi_bridge_attach, + .mode_set =3D sprd_dsi_bridge_mode_set, + .pre_enable =3D sprd_dsi_bridge_pre_enable, + .enable =3D sprd_dsi_bridge_enable, + .disable =3D sprd_dsi_bridge_disable, + .post_disable =3D sprd_dsi_bridge_post_disable, +}; + static int sprd_dsi_bridge_init(struct sprd_dsi *dsi, struct device *dev) { @@ -889,11 +907,34 @@ static int sprd_dsi_bridge_init(struct sprd_dsi *dsi, if (IS_ERR(dsi->panel_bridge)) return PTR_ERR(dsi->panel_bridge); =20 - ret =3D drm_bridge_attach(&dsi->encoder, dsi->panel_bridge, NULL, 0); + dsi->bridge.of_node =3D dev->of_node; + dsi->bridge.type =3D DRM_MODE_CONNECTOR_DSI; + + drm_bridge_add(&dsi->bridge); + + ret =3D drm_bridge_attach(&dsi->encoder, &dsi->bridge, NULL, + DRM_BRIDGE_ATTACH_NO_CONNECTOR); if (ret) - return ret; + goto err_cleanup; + + dsi->connector =3D drm_bridge_connector_init(dsi->drm, &dsi->encoder); + if (IS_ERR(dsi->connector)) { + drm_err(dsi->drm, "Unable to create bridge connector\n"); + ret =3D PTR_ERR(dsi->connector); + goto err_cleanup; + } + + ret =3D drm_connector_attach_encoder(dsi->connector, &dsi->encoder); + if (ret < 0) + goto err_cleanup; =20 return 0; + +err_cleanup: + drm_bridge_remove(&dsi->bridge); + drm_of_panel_bridge_remove(dev->of_node, 1, 0); + + return ret; } =20 static int sprd_dsi_context_init(struct sprd_dsi *dsi, @@ -921,7 +962,6 @@ static int sprd_dsi_context_init(struct sprd_dsi *dsi, ctx->max_rd_time =3D 6000; ctx->int0_mask =3D 0xffffffff; ctx->int1_mask =3D 0xffffffff; - ctx->enabled =3D true; =20 return 0; } @@ -940,13 +980,21 @@ static int sprd_dsi_bind(struct device *dev, struct d= evice *master, void *data) =20 ret =3D sprd_dsi_bridge_init(dsi, dev); if (ret) - return ret; + goto err_cleanup_encoder; =20 ret =3D sprd_dsi_context_init(dsi, dev); if (ret) - return ret; + goto err_cleanup_bridge; =20 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; } =20 static void sprd_dsi_unbind(struct device *dev, @@ -954,6 +1002,7 @@ static void sprd_dsi_unbind(struct device *dev, { struct sprd_dsi *dsi =3D dev_get_drvdata(dev); =20 + drm_bridge_remove(&dsi->bridge); drm_of_panel_bridge_remove(dev->of_node, 1, 0); =20 drm_encoder_cleanup(&dsi->encoder); @@ -1032,9 +1081,10 @@ static int sprd_dsi_probe(struct platform_device *pd= ev) struct device *dev =3D &pdev->dev; struct sprd_dsi *dsi; =20 - dsi =3D devm_kzalloc(dev, sizeof(*dsi), GFP_KERNEL); - if (!dsi) - return -ENOMEM; + dsi =3D devm_drm_bridge_alloc(dev, struct sprd_dsi, bridge, + &sprd_dsi_bridge_funcs); + if (IS_ERR(dsi)) + return PTR_ERR(dsi); =20 dev_set_drvdata(dev, dsi); =20 diff --git a/drivers/gpu/drm/sprd/sprd_dsi.h b/drivers/gpu/drm/sprd/sprd_ds= i.h index d858ebb111150546e99403a87bc7cea42cad0158..d15b8bfd61f2e69f877aa727fbb= be4b61e9cb0fe 100644 --- a/drivers/gpu/drm/sprd/sprd_dsi.h +++ b/drivers/gpu/drm/sprd/sprd_dsi.h @@ -18,8 +18,8 @@ #include #include =20 -#define encoder_to_dsi(encoder) \ - container_of(encoder, struct sprd_dsi, encoder) +#define bridge_to_dsi(x) container_of(x, struct sprd_dsi, bridge) +#define encoder_to_dsi(x) container_of(x, struct sprd_dsi, encoder) =20 enum dsi_work_mode { DSI_MODE_CMD =3D 0, @@ -88,7 +88,6 @@ struct dsi_context { struct regmap *regmap; struct dphy_pll pll; struct videomode vm; - bool enabled; =20 u8 work_mode; u8 burst_mode; @@ -116,7 +115,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; }; =20 --=20 2.50.0 From nobody Sun Oct 5 16:20:36 2025 Received: from srv01.abscue.de (abscue.de [89.58.28.240]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 96FDF1DF991; Thu, 31 Jul 2025 15:53:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=89.58.28.240 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1753977188; cv=none; b=XLuRJF1q+jKU+SZhQ6zrBFfZou6PCkIuSw76pyffadjnLPWJoIXOiymeRQz7ydB5qLc9KiVa6pbi66zhREwH06vCPQCwe9DbxIegL41s1YSpnVMHqpMFNAqzZofV17vKn6adXnZfSlIvAk1kiO4EwBb5PjTLVD6+V0sJ+sTTbYM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1753977188; c=relaxed/simple; bh=K8BHA+iA1iydveDUvp/YesIVTsMaDiSb18vKNRsmk48=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=e4pyn4H+y2FF/3VJjpG3lZB/gqx/5wlCy0muYuDUiEAAp+/YVgtap24n7yWNJOYyYgRakLcjyJkRWYHDVDzEAYK/xmT6Fv/Xh4itDewNpbvwdcfnUUZj5KQAsCUz/Lmu1X7VLjYbVgiIfIQFEkUTolnAmq07xpDuY2FXNt9GEX8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=abscue.de; spf=pass smtp.mailfrom=abscue.de; arc=none smtp.client-ip=89.58.28.240 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=abscue.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=abscue.de Received: from srv01.abscue.de (localhost [127.0.0.1]) by spamfilter.srv.local (Postfix) with ESMTP id 0F55C1C271E; Thu, 31 Jul 2025 17:52:59 +0200 (CEST) X-Spam-Level: Received: from fluffy-mammal.metal.fwg-cag.de (unknown [IPv6:2001:9e8:cdc9:0:1347:874c:9851:58c6]) by srv01.abscue.de (Postfix) with ESMTPSA id CA3B71C270C; Thu, 31 Jul 2025 17:52:55 +0200 (CEST) From: =?utf-8?q?Otto_Pfl=C3=BCger?= Date: Thu, 31 Jul 2025 17:51:21 +0200 Subject: [PATCH v3 08/16] drm: sprd: add support for UMS9230 DSI PLL Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20250731-ums9230-drm-v3-8-06d4f57c4b08@abscue.de> References: <20250731-ums9230-drm-v3-0-06d4f57c4b08@abscue.de> In-Reply-To: <20250731-ums9230-drm-v3-0-06d4f57c4b08@abscue.de> 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 , Liviu Dudau , Russell King , Eric Anholt , Kevin Tang Cc: dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, =?utf-8?q?Otto_Pfl=C3=BCger?= X-Mailer: b4 0.14.2 Move platform-specific PLL parameters to the device tree match data and add the parameters for UMS9230. Signed-off-by: Otto Pfl=C3=BCger --- 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/me= gacores_pll.c index 3091dfdc11e3b547a05a9edaa4047a1e367c1596..e5a18599678ab6e3771cd732dcc= a409ab2d59f72 100644 --- a/drivers/gpu/drm/sprd/megacores_pll.c +++ b/drivers/gpu/drm/sprd/megacores_pll.c @@ -21,12 +21,6 @@ =20 #define AVERAGE(a, b) (min(a, b) + abs((b) - (a)) / 2) =20 -/* 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 =3D 1000; @@ -36,11 +30,10 @@ static int dphy_calc_pll_param(struct dphy_pll *pll) int i; =20 pll->potential_fvco =3D pll->freq / khz; - pll->ref_clk =3D PHY_REF_CLK / khz; =20 for (i =3D 0; i < 4; ++i) { - if (pll->potential_fvco >=3D VCO_BAND_LOW && - pll->potential_fvco <=3D VCO_BAND_HIGH) { + if (pll->potential_fvco >=3D pll->platform->band_low && + pll->potential_fvco <=3D pll->platform->band_high) { pll->fvco =3D pll->potential_fvco; pll->out_sel =3D BIT(i); break; @@ -50,21 +43,23 @@ static int dphy_calc_pll_param(struct dphy_pll *pll) if (pll->fvco =3D=3D 0) return -EINVAL; =20 - if (pll->fvco >=3D VCO_BAND_LOW && pll->fvco <=3D VCO_BAND_MID) { + if (pll->fvco >=3D pll->platform->band_low && + pll->fvco <=3D pll->platform->band_mid) { /* vco band control */ pll->vco_band =3D 0x0; /* low pass filter control */ pll->lpf_sel =3D 1; - } else if (pll->fvco > VCO_BAND_MID && pll->fvco <=3D VCO_BAND_HIGH) { + } else if (pll->fvco > pll->platform->band_mid && + pll->fvco <=3D pll->platform->band_high) { pll->vco_band =3D 0x1; pll->lpf_sel =3D 0; } else { return -EINVAL; } =20 - pll->nint =3D pll->fvco / pll->ref_clk; + pll->nint =3D pll->fvco / pll->platform->ref_clk; tmp =3D pll->fvco * factor * mhz; - do_div(tmp, pll->ref_clk); + do_div(tmp, pll->platform->ref_clk); tmp =3D tmp - pll->nint * factor * mhz; tmp *=3D BIT(20); do_div(tmp, 100000000); diff --git a/drivers/gpu/drm/sprd/sprd_dsi.c b/drivers/gpu/drm/sprd/sprd_ds= i.c index 22f300654a1903ecb7002c1e643361c6c51623d4..106a0e7dac5cb89e6a96cc33a16= 98ec48c9f2745 100644 --- a/drivers/gpu/drm/sprd/sprd_dsi.c +++ b/drivers/gpu/drm/sprd/sprd_dsi.c @@ -1071,8 +1071,23 @@ static const struct mipi_dsi_host_ops sprd_dsi_host_= ops =3D { .transfer =3D sprd_dsi_host_transfer, }; =20 +static const struct dphy_pll_platform dphy_pll_sharkl3 =3D { + .band_low =3D 750, + .band_mid =3D 1100, + .band_high =3D 1500, + .ref_clk =3D 26, +}; + +static const struct dphy_pll_platform dphy_pll_ums9230 =3D { + .band_low =3D 1250, + .band_mid =3D 1800, + .band_high =3D 2500, + .ref_clk =3D 26, +}; + static const struct of_device_id dsi_match_table[] =3D { - { .compatible =3D "sprd,sharkl3-dsi-host" }, + { .compatible =3D "sprd,sharkl3-dsi-host", .data =3D &dphy_pll_sharkl3 }, + { .compatible =3D "sprd,ums9230-dsi-host", .data =3D &dphy_pll_ums9230 }, { /* sentinel */ }, }; =20 @@ -1091,6 +1106,10 @@ static int sprd_dsi_probe(struct platform_device *pd= ev) dsi->host.ops =3D &sprd_dsi_host_ops; dsi->host.dev =3D dev; =20 + dsi->ctx.pll.platform =3D of_device_get_match_data(dev); + if (!dsi->ctx.pll.platform) + return -EINVAL; + return mipi_dsi_host_register(&dsi->host); } =20 diff --git a/drivers/gpu/drm/sprd/sprd_dsi.h b/drivers/gpu/drm/sprd/sprd_ds= i.h index d15b8bfd61f2e69f877aa727fbbbe4b61e9cb0fe..1aa609b1da33601217941390673= 553552f2923b1 100644 --- a/drivers/gpu/drm/sprd/sprd_dsi.h +++ b/drivers/gpu/drm/sprd/sprd_dsi.h @@ -64,6 +64,13 @@ enum pll_timing { TA_WAIT, }; =20 +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=3D1, 10: SDM_EN=3D0 */ @@ -71,7 +78,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; @@ -81,6 +87,7 @@ struct dphy_pll { u8 out_sel; /* post divider control */ u8 vco_band; /* vco range */ u8 det_delay; + const struct dphy_pll_platform *platform; }; =20 struct dsi_context { --=20 2.50.0 From nobody Sun Oct 5 16:20:36 2025 Received: from srv01.abscue.de (abscue.de [89.58.28.240]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DBF921714C6; Thu, 31 Jul 2025 15:53:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=89.58.28.240 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1753977188; cv=none; b=GVs41/KNqGIgTvlbnL7qqB7Q3V6RvDilzU8NRagyiRjdqMHOh4CInzh1fPDXugZCAD1eNskkdqDKXC5+RHfRTVXWSd+P0M1hc6eXgdje57/TW5iowOKqKAx1YppzEEj6sWvLWNBvEUH3VLB6pcNFpmvTKoQYm7t4m1hHridEUeM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1753977188; c=relaxed/simple; bh=g0G7XYNv76Ui/n2QbdZ3v+0NlnsKXvm8GwhIBAxnAB4=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=mVNMDZw17fDPX3jmUL+VXsgGCnSlGJSlhvQ5UgW//BoO+jd4oARDh/gCqTxohxUZ6IQWQQBuxVUYaXPaw/l+Fo6Yt+fDhI4sVN8c1iGjS1qJKMx6Kms0Ovbfvjx+7XkKd9JB0ICsLXkVWxKEasYjzkPCv5XytsvTQS789LDu2ig= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=abscue.de; spf=pass smtp.mailfrom=abscue.de; arc=none smtp.client-ip=89.58.28.240 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=abscue.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=abscue.de Received: from srv01.abscue.de (localhost [127.0.0.1]) by spamfilter.srv.local (Postfix) with ESMTP id 45CB71C26E9; Thu, 31 Jul 2025 17:52:57 +0200 (CEST) X-Spam-Level: Received: from fluffy-mammal.metal.fwg-cag.de (unknown [IPv6:2001:9e8:cdc9:0:1347:874c:9851:58c6]) by srv01.abscue.de (Postfix) with ESMTPSA id 93AB61C2712; Thu, 31 Jul 2025 17:52:56 +0200 (CEST) From: =?utf-8?q?Otto_Pfl=C3=BCger?= Date: Thu, 31 Jul 2025 17:51:22 +0200 Subject: [PATCH v3 09/16] drm: sprd: fix DSI rate and PLL setup code Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20250731-ums9230-drm-v3-9-06d4f57c4b08@abscue.de> References: <20250731-ums9230-drm-v3-0-06d4f57c4b08@abscue.de> In-Reply-To: <20250731-ums9230-drm-v3-0-06d4f57c4b08@abscue.de> 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 , Liviu Dudau , Russell King , Eric Anholt , Kevin Tang Cc: dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, =?utf-8?q?Otto_Pfl=C3=BCger?= X-Mailer: b4 0.14.2 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. Fixes: 1c66496b1391 ("drm/sprd: add Unisoc's drm mipi dsi&dphy driver") Signed-off-by: Otto Pfl=C3=BCger --- 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/me= gacores_pll.c index e5a18599678ab6e3771cd732dcca409ab2d59f72..f214f906b58fb006c4305de9b8b= 86b4a934f2074 100644 --- a/drivers/gpu/drm/sprd/megacores_pll.c +++ b/drivers/gpu/drm/sprd/megacores_pll.c @@ -23,13 +23,12 @@ =20 static int dphy_calc_pll_param(struct dphy_pll *pll) { - const u32 khz =3D 1000; const u32 mhz =3D 1000000; const unsigned long long factor =3D 100; unsigned long long tmp; int i; =20 - pll->potential_fvco =3D pll->freq / khz; + pll->potential_fvco =3D pll->freq / mhz; =20 for (i =3D 0; i < 4; ++i) { if (pll->potential_fvco >=3D pll->platform->band_low && @@ -89,7 +88,7 @@ static void dphy_set_pll_reg(struct dphy_pll *pll, struct= regmap *regmap) reg_val[3] =3D pll->vco_band | (pll->sdm_en << 1) | (pll->refin << 2); reg_val[4] =3D pll->kint >> 12; reg_val[5] =3D pll->kint >> 4; - reg_val[6] =3D pll->out_sel | ((pll->kint << 4) & 0xf); + reg_val[6] =3D pll->out_sel | ((pll->kint & 0xf) << 4); reg_val[7] =3D 1 << 4; reg_val[8] =3D pll->det_delay; =20 @@ -218,7 +217,7 @@ void dphy_timing_config(struct dsi_context *ctx) u32 tmp =3D 0; =20 /* t_ui: 1 ui, byteck: 8 ui, half byteck: 4 ui */ - t_ui =3D 1000 * scale / (pll->freq / 1000); + t_ui =3D 1000 * scale / (pll->freq / 1000000); t_byteck =3D t_ui << 3; t_half_byteck =3D t_ui << 2; constant =3D t_ui << 1; diff --git a/drivers/gpu/drm/sprd/sprd_dsi.c b/drivers/gpu/drm/sprd/sprd_ds= i.c index 106a0e7dac5cb89e6a96cc33a1698ec48c9f2745..071313b605447525326f6b869bc= 09991d4fcd691 100644 --- a/drivers/gpu/drm/sprd/sprd_dsi.c +++ b/drivers/gpu/drm/sprd/sprd_dsi.c @@ -390,7 +390,7 @@ static u32 fmt_to_coding(u32 fmt) static void sprd_dsi_init(struct dsi_context *ctx) { struct sprd_dsi *dsi =3D container_of(ctx, struct sprd_dsi, ctx); - u32 byte_clk =3D dsi->slave->hs_rate / 8; + u32 byte_clk =3D dsi->slave->hs_rate / 8000; u16 data_hs2lp, data_lp2hs, clk_hs2lp, clk_lp2hs; u16 max_rd_time; int div; @@ -407,7 +407,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); =20 - div =3D DIV_ROUND_UP(byte_clk, dsi->slave->lp_rate); + div =3D DIV_ROUND_UP(byte_clk, dsi->slave->lp_rate / 1000); writel(div, ctx->base + TX_ESC_CLK_CONFIG); =20 max_rd_time =3D ns_to_cycle(ctx->max_rd_time, byte_clk); @@ -449,7 +449,6 @@ static int sprd_dsi_dpi_video(struct dsi_context *ctx) { struct sprd_dsi *dsi =3D container_of(ctx, struct sprd_dsi, ctx); struct videomode *vm =3D &ctx->vm; - u32 byte_clk =3D dsi->slave->hs_rate / 8; u16 bpp_x100; u16 video_size; u32 ratio_x1000; @@ -471,7 +470,7 @@ static int sprd_dsi_dpi_video(struct dsi_context *ctx) video_size =3D round_video_size(coding, vm->hactive); bpp_x100 =3D calc_bytes_per_pixel_x100(coding); video_size_step =3D calc_video_size_step(coding); - ratio_x1000 =3D byte_clk * 1000 / (vm->pixelclock / 1000); + ratio_x1000 =3D dsi->slave->hs_rate / 8 / (vm->pixelclock / 1000); hline =3D vm->hactive + vm->hsync_len + vm->hfront_porch + vm->hback_porch; =20 --=20 2.50.0 From nobody Sun Oct 5 16:20:36 2025 Received: from srv01.abscue.de (abscue.de [89.58.28.240]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 984A11DFE12; Thu, 31 Jul 2025 15:53:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=89.58.28.240 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1753977188; cv=none; b=RIWRorrg0KDWiU7aLrrUGkO0XWHI6UpJdb0msD7lw802BO1IR9F0yKAjMndWfvNKZxBlW8HI/aWGYDPf5WuNWLNwzmJaVtXdWW7EKr8epE4oTjAMSucbxzZZGJBCAep1QUZb3nuiK00V2aVLXH6WRhAwZn8CAyM/624iyLNIIyo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1753977188; c=relaxed/simple; bh=Z2tdpQq5DGUjjwCGWt2bvx3VydpE+aR5ixAM4PiKKG4=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=rvRKCDneEEDxj6JYsC1gNGPH/U+29dZRR/HmE9NT+Y8MiS0KzHGfMxTslzADJ+sDWFSir9pQIKj+taMh8zhawHWpQQFjMydgJ1DJdVAH4STBQgOrpMcFPDyeNwT701bj4EvKXRjdVh1vZEFy5PTIoyprpAU0YhyxNSPAienuRWs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=abscue.de; spf=pass smtp.mailfrom=abscue.de; arc=none smtp.client-ip=89.58.28.240 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=abscue.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=abscue.de Received: from srv01.abscue.de (localhost [127.0.0.1]) by spamfilter.srv.local (Postfix) with ESMTP id 0336C1C2712; Thu, 31 Jul 2025 17:52:58 +0200 (CEST) X-Spam-Level: Received: from fluffy-mammal.metal.fwg-cag.de (unknown [IPv6:2001:9e8:cdc9:0:1347:874c:9851:58c6]) by srv01.abscue.de (Postfix) with ESMTPSA id 53D6E1C2714; Thu, 31 Jul 2025 17:52:57 +0200 (CEST) From: =?utf-8?q?Otto_Pfl=C3=BCger?= Date: Thu, 31 Jul 2025 17:51:23 +0200 Subject: [PATCH v3 10/16] drm: sprd: select REGMAP in Kconfig Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20250731-ums9230-drm-v3-10-06d4f57c4b08@abscue.de> References: <20250731-ums9230-drm-v3-0-06d4f57c4b08@abscue.de> In-Reply-To: <20250731-ums9230-drm-v3-0-06d4f57c4b08@abscue.de> 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 , Liviu Dudau , Russell King , Eric Anholt , Kevin Tang Cc: dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, =?utf-8?q?Otto_Pfl=C3=BCger?= X-Mailer: b4 0.14.2 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. Fixes: 1c66496b1391 ("drm/sprd: add Unisoc's drm mipi dsi&dphy driver") Signed-off-by: Otto Pfl=C3=BCger --- 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..828384d42c5aac4bf194558f22d= 9a77f7c693572 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. --=20 2.50.0 From nobody Sun Oct 5 16:20:36 2025 Received: from srv01.abscue.de (abscue.de [89.58.28.240]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 99A641E25F8; Thu, 31 Jul 2025 15:53:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=89.58.28.240 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1753977189; cv=none; b=CfB3azJGdbhnaGhhCIOSq0ek+o7Qx8a0DaB7awXx0Doq2CIQg/hNaFYfuMEZK9sUifW5p8m3IVnsRxuJc847Qpp+ExIxaMGhAz3yrJo2XfgmNGJM+DuO4/dZLd718mdv733JacbIV0vejlkaCnmoKMbxQ/SdaG8hVks1Olj0Y24= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1753977189; c=relaxed/simple; bh=HTPc1UvuM/9u3VpIMl/pl7TbdQEONkbtPQ3JDrKQ0yc=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=Fxl0w1Pw+FrXnKemh8vrmdlsnokM3J+wM8ZQIX8zBhxXnBn/YOBoZeURqzdGCpaiI1+uVpF824ZWPm0jwQ9hBwvsX26lerT8+Kw34NyvCvH7qPUyNs9lh5Qwfyu/ouadE2JZ8IJ4bv1SSoU/w/+aI++KDt/kx17x7aPKsM7y2t8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=abscue.de; spf=pass smtp.mailfrom=abscue.de; arc=none smtp.client-ip=89.58.28.240 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=abscue.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=abscue.de Received: from srv01.abscue.de (localhost [127.0.0.1]) by spamfilter.srv.local (Postfix) with ESMTP id B04891C2714; Thu, 31 Jul 2025 17:52:58 +0200 (CEST) X-Spam-Level: Received: from fluffy-mammal.metal.fwg-cag.de (unknown [IPv6:2001:9e8:cdc9:0:1347:874c:9851:58c6]) by srv01.abscue.de (Postfix) with ESMTPSA id 114CB1C2713; Thu, 31 Jul 2025 17:52:58 +0200 (CEST) From: =?utf-8?q?Otto_Pfl=C3=BCger?= Date: Thu, 31 Jul 2025 17:51:24 +0200 Subject: [PATCH v3 11/16] drm: sprd: add clock gating support Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20250731-ums9230-drm-v3-11-06d4f57c4b08@abscue.de> References: <20250731-ums9230-drm-v3-0-06d4f57c4b08@abscue.de> In-Reply-To: <20250731-ums9230-drm-v3-0-06d4f57c4b08@abscue.de> 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 , Liviu Dudau , Russell King , Eric Anholt , Kevin Tang Cc: dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, =?utf-8?q?Otto_Pfl=C3=BCger?= X-Mailer: b4 0.14.2 Enable the DPU and DSI clocks specified in the device tree. Disable the DSI clock when it is not needed. Signed-off-by: Otto Pfl=C3=BCger --- drivers/gpu/drm/sprd/sprd_dpu.c | 7 +++++++ drivers/gpu/drm/sprd/sprd_dpu.h | 1 + drivers/gpu/drm/sprd/sprd_dsi.c | 9 +++++++++ drivers/gpu/drm/sprd/sprd_dsi.h | 4 +++- 4 files changed, 20 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/sprd/sprd_dpu.c b/drivers/gpu/drm/sprd/sprd_dp= u.c index 0d9eb778794d92418b39f8535d94abde3566de43..9d274600e6a80bdfc435f6c6eff= 77c9dd71cb38c 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. */ =20 +#include #include #include #include @@ -794,6 +795,12 @@ static int sprd_dpu_context_init(struct sprd_dpu *dpu, if (ctx->irq < 0) return ctx->irq; =20 + ctx->clk =3D devm_clk_get_optional_enabled(dev, "core"); + if (IS_ERR(ctx->clk)) { + dev_err(dev, "failed to get DPU core 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_dp= u.h index 157a78f24dc18b071602552ea9d005af66525263..d48b922de580a8a4bf07c4610c4= 31d3321f7b810 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_ds= i.c index 071313b605447525326f6b869bc09991d4fcd691..0edb626eb35a7eeb759c2a2f5b8= 428cd3b092d1f 100644 --- a/drivers/gpu/drm/sprd/sprd_dsi.c +++ b/drivers/gpu/drm/sprd/sprd_dsi.c @@ -832,6 +832,8 @@ static void sprd_dsi_bridge_pre_enable(struct drm_bridg= e *bridge) struct sprd_dsi *dsi =3D bridge_to_dsi(bridge); struct dsi_context *ctx =3D &dsi->ctx; =20 + clk_prepare_enable(ctx->clk); + sprd_dsi_init(ctx); if (ctx->work_mode =3D=3D DSI_MODE_VIDEO) sprd_dsi_dpi_video(ctx); @@ -886,6 +888,8 @@ static void sprd_dsi_bridge_post_disable(struct drm_bri= dge *bridge) =20 sprd_dphy_fini(ctx); sprd_dsi_fini(ctx); + + clk_disable_unprepare(ctx->clk); } =20 static const struct drm_bridge_funcs sprd_dsi_bridge_funcs =3D { @@ -1109,6 +1113,11 @@ static int sprd_dsi_probe(struct platform_device *pd= ev) if (!dsi->ctx.pll.platform) return -EINVAL; =20 + dsi->ctx.clk =3D devm_clk_get_optional(dev, "pclk"); + if (IS_ERR(dsi->ctx.clk)) + return dev_err_probe(dev, PTR_ERR(dsi->ctx.clk), + "failed to get pclk\n"); + return mipi_dsi_host_register(&dsi->host); } =20 diff --git a/drivers/gpu/drm/sprd/sprd_dsi.h b/drivers/gpu/drm/sprd/sprd_ds= i.h index 1aa609b1da33601217941390673553552f2923b1..14d06236087255f15b2704a0aff= 2589889fda5e9 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__ =20 -#include +#include #include +#include #include #include