Re: [PATCH v5 0/6] Add DSC support to DSI video panel

2024-05-28 Thread neil . armstrong

On 27/05/2024 16:21, Jun Nie wrote:

This is follow up update to Jonathan's patch set.

Changes vs V4:
- Polish width calculation with helper function
- Split cfg2 compression bit into another patch

Changes vs V3:
- Rebase to latest msm-next-lumag branch.
- Drop the slice_per_pkt change as it does impact basic DSC feature.
- Remove change in generated dsi header
- update DSC compressed width calculation with bpp and bpc
- split wide bus impact on width into another patch
- rename patch tile of VIDEO_COMPRESSION_MODE_CTRL_WC change
- Polish warning usage
- Add tags from reviewers

Changes vs V2:
- Drop the INTF_CFG2_DATA_HCTL_EN change as it is handled in
latest mainline code.
- Drop the bonded DSI patch as I do not have device to test it.
- Address comments from version 2.

Signed-off-by: Jun Nie 
---
Changes in v5:
- Link to v4: 
https://lore.kernel.org/r/20240524-msm-drm-dsc-dsi-video-upstream-4-v4-0-e61c05b40...@linaro.org

---
Jonathan Marek (4):
   drm/msm/dpu: fix video mode DSC for DSI
   drm/msm/dsi: set video mode widebus enable bit when widebus is enabled
   drm/msm/dsi: set VIDEO_COMPRESSION_MODE_CTRL_WC
   drm/msm/dsi: add a comment to explain pkt_per_line encoding

Jun Nie (2):
   drm/msm/dpu: adjust data width for widen bus case
   drm/msm/dpu: enable compression bit in cfg2 for DSC

  drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c  |  2 +-
  drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys.h |  8 
  drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_vid.c | 18 ++
  drivers/gpu/drm/msm/disp/dpu1/dpu_hw_intf.c  | 13 +
  drivers/gpu/drm/msm/dsi/dsi_host.c   | 10 +-
  5 files changed, 49 insertions(+), 2 deletions(-)
---
base-commit: e6428bcb611f6c164856a41fc5a1ae8471a9b5a9
change-id: 20240524-msm-drm-dsc-dsi-video-upstream-4-22e2266fbe89

Best regards,


Tested-by: Neil Armstrong  # on SM8550-QRD
Tested-by: Neil Armstrong  # on SM8650-QRD
Tested-by: Neil Armstrong  # on SM8650-HDK

with 
https://lore.kernel.org/all/20230728012623.22991-1-quic_parel...@quicinc.com/ 
and enforce-video-mode in panel node.

Thanks,
Neil


Re: [PATCH v3 2/3] drm/panel/lg-sw43408: select CONFIG_DRM_DISPLAY_DP_HELPER

2024-05-22 Thread Neil Armstrong

On 22/05/2024 08:25, Dmitry Baryshkov wrote:

This panel driver uses DSC PPS functions and as such depends on the
DRM_DISPLAY_DP_HELPER. Select this symbol to make required functions
available to the driver.

Reported-by: kernel test robot 
Closes: 
https://lore.kernel.org/oe-kbuild-all/202404200800.kysryyli-...@intel.com/
Fixes: 069a6c0e94f9 ("drm: panel: Add LG sw43408 panel driver")
Signed-off-by: Dmitry Baryshkov 
---
  drivers/gpu/drm/panel/Kconfig | 2 ++
  1 file changed, 2 insertions(+)

diff --git a/drivers/gpu/drm/panel/Kconfig b/drivers/gpu/drm/panel/Kconfig
index 4a2f621433ef..3e3f63479544 100644
--- a/drivers/gpu/drm/panel/Kconfig
+++ b/drivers/gpu/drm/panel/Kconfig
@@ -340,6 +340,8 @@ config DRM_PANEL_LG_SW43408
depends on OF
depends on DRM_MIPI_DSI
depends on BACKLIGHT_CLASS_DEVICE
+   select DRM_DISPLAY_DSC_HELPER
+   select DRM_DISPLAY_HELPER
help
  Say Y here if you want to enable support for LG sw43408 panel.
  The panel has a 1080x2160@60Hz resolution and uses 24 bit RGB per



Reviewed-by: Neil Armstrong 


Re: [PATCH v3 3/3] drm/panel/lg-sw43408: mark sw43408_backlight_ops as static

2024-05-22 Thread Neil Armstrong

On 22/05/2024 08:25, Dmitry Baryshkov wrote:

Fix sparse warning regarding symbol 'sw43408_backlight_ops' not being
declared.

Reported-by: kernel test robot 
Closes: 
https://lore.kernel.org/oe-kbuild-all/202404200739.hbwzvohr-...@intel.com/
Reviewed-by: Neil Armstrong 
Fixes: 069a6c0e94f9 ("drm: panel: Add LG sw43408 panel driver")
Signed-off-by: Dmitry Baryshkov 
---
  drivers/gpu/drm/panel/panel-lg-sw43408.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/panel/panel-lg-sw43408.c 
b/drivers/gpu/drm/panel/panel-lg-sw43408.c
index 115f4702d59f..2b3a73696dce 100644
--- a/drivers/gpu/drm/panel/panel-lg-sw43408.c
+++ b/drivers/gpu/drm/panel/panel-lg-sw43408.c
@@ -182,7 +182,7 @@ static int sw43408_backlight_update_status(struct 
backlight_device *bl)
return mipi_dsi_dcs_set_display_brightness_large(dsi, brightness);
  }
  
-const struct backlight_ops sw43408_backlight_ops = {

+static const struct backlight_ops sw43408_backlight_ops = {
.update_status = sw43408_backlight_update_status,
  };
  



Reviewed-by: Neil Armstrong 


Re: [PATCH v3 1/6] arm64: dts: qcom: sm8650: Fix GPU cx_mem size

2024-05-02 Thread Neil Armstrong

On 30/04/2024 12:43, Connor Abbott wrote:

This is doubled compared to previous GPUs. We can't access the new
SW_FUSE_VALUE register without this.

Fixes: db33633b05c0 ("arm64: dts: qcom: sm8650: add GPU nodes")
Reviewed-by: Konrad Dybcio 
Reviewed-by: Dmitry Baryshkov 
Signed-off-by: Connor Abbott 
---
  arch/arm64/boot/dts/qcom/sm8650.dtsi | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm64/boot/dts/qcom/sm8650.dtsi 
b/arch/arm64/boot/dts/qcom/sm8650.dtsi
index 658ad2b41c5a..78b8944eaab2 100644
--- a/arch/arm64/boot/dts/qcom/sm8650.dtsi
+++ b/arch/arm64/boot/dts/qcom/sm8650.dtsi
@@ -2607,7 +2607,7 @@ tcsr: clock-controller@1fc {
gpu: gpu@3d0 {
compatible = "qcom,adreno-43051401", "qcom,adreno";
reg = <0x0 0x03d0 0x0 0x4>,
- <0x0 0x03d9e000 0x0 0x1000>,
+ <0x0 0x03d9e000 0x0 0x2000>,
  <0x0 0x03d61000 0x0 0x800>;
reg-names = "kgsl_3d0_reg_memory",
    "cx_mem",



Reviewed-by: Neil Armstrong 


Re: [PATCH v2 1/6] arm64: dts: qcom: sm8650: Fix GPU cx_mem size

2024-05-02 Thread Neil Armstrong

On 26/04/2024 20:33, Connor Abbott wrote:

This is doubled compared to previous GPUs. We can't access the new
SW_FUSE_VALUE register without this.

Fixes: db33633b05c0 ("arm64: dts: qcom: sm8650: add GPU nodes")
Signed-off-by: Connor Abbott 
---
  arch/arm64/boot/dts/qcom/sm8650.dtsi | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm64/boot/dts/qcom/sm8650.dtsi 
b/arch/arm64/boot/dts/qcom/sm8650.dtsi
index 658ad2b41c5a..78b8944eaab2 100644
--- a/arch/arm64/boot/dts/qcom/sm8650.dtsi
+++ b/arch/arm64/boot/dts/qcom/sm8650.dtsi
@@ -2607,7 +2607,7 @@ tcsr: clock-controller@1fc {
gpu: gpu@3d0 {
compatible = "qcom,adreno-43051401", "qcom,adreno";
reg = <0x0 0x03d0 0x0 0x4>,
- <0x0 0x03d9e000 0x0 0x1000>,
+ <0x0 0x03d9e000 0x0 0x2000>,
  <0x0 0x03d61000 0x0 0x800>;
reg-names = "kgsl_3d0_reg_memory",
    "cx_mem",



Reviewed-by: Neil Armstrong 


Re: [PATCH v3 6/7] arm64: dts: qcom: sm8650: add GPU nodes

2024-03-12 Thread Neil Armstrong

On 12/03/2024 01:20, Konrad Dybcio wrote:



On 2/16/24 12:03, Neil Armstrong wrote:

Add GPU nodes for the SM8650 platform.

Signed-off-by: Neil Armstrong 
---
  arch/arm64/boot/dts/qcom/sm8650.dtsi | 166 +++
  1 file changed, 166 insertions(+)

diff --git a/arch/arm64/boot/dts/qcom/sm8650.dtsi 
b/arch/arm64/boot/dts/qcom/sm8650.dtsi
index 62e6ae93a9a8..27dcef27b6ad 100644
--- a/arch/arm64/boot/dts/qcom/sm8650.dtsi
+++ b/arch/arm64/boot/dts/qcom/sm8650.dtsi
@@ -2589,6 +2589,128 @@ tcsr: clock-controller@1fc {
  #reset-cells = <1>;
  };
+    gpu: gpu@3d0 {
+    compatible = "qcom,adreno-43051401", "qcom,adreno";
+    reg = <0x0 0x03d0 0x0 0x4>,
+  <0x0 0x03d9e000 0x0 0x1000>,
+  <0x0 0x03d61000 0x0 0x800>;
+    reg-names = "kgsl_3d0_reg_memory",
+    "cx_mem",
+    "cx_dbgc";
+
+    interrupts = ;
+
+    iommus = <_smmu 0 0x0>,
+ <_smmu 1 0x0>;
+
+    operating-points-v2 = <_opp_table>;
+
+    qcom,gmu = <>;
+
+    status = "disabled";
+
+    zap-shader {
+    memory-region = <_micro_code_mem>;
+    };
+
+    /* Speedbin needs more work on A740+, keep only lower freqs */
+    gpu_opp_table: opp-table {
+    compatible = "operating-points-v2";
+
+    opp-68000 {
+    opp-hz = /bits/ 64 <68000>;
+    opp-level = ;
+    };


I got a memo from krzk that we should be sorting OPPs low-to-high,
could you please reorder these (and under gmu)?


Ack, I also add 3 more OPPs that works with all speedbins.

Neil



Otherwise lgtm

Konrad




Re: [PATCH] Revert "drm/msm/dp: use drm_bridge_hpd_notify() to report HPD status changes"

2024-02-28 Thread neil . armstrong

On 27/02/2024 23:08, Dmitry Baryshkov wrote:

This reverts commit e467e0bde881 ("drm/msm/dp: use
drm_bridge_hpd_notify() to report HPD status changes").

The commit changed the way how the MSM DP driver communicates
HPD-related events to the userspace. The mentioned commit made some of
the HPD events being reported earlier. This way userspace starts poking
around. It interacts in a bad way with the dp_bridge_detect and the
driver's state machine, ending up either with the very long delays
during hotplug detection or even inability of the DP driver to report
the display as connected.

A proper fix will involve redesigning of the HPD handling in the MSM DP
driver. It is underway, but it will be intrusive and can not be thought
about as a simple fix for the issue. Thus, revert the offending commit.

Fixes: e467e0bde881 ("drm/msm/dp: use drm_bridge_hpd_notify() to report HPD status 
changes")
Link: https://gitlab.freedesktop.org/drm/msm/-/issues/50
Reported-by: Johan Hovold 
Link: https://lore.kernel.org/r/zd3ypgmrprxv-...@hovoldconsulting.com/
Signed-off-by: Dmitry Baryshkov 
---
  drivers/gpu/drm/msm/dp/dp_display.c | 20 ++--
  1 file changed, 18 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/msm/dp/dp_display.c 
b/drivers/gpu/drm/msm/dp/dp_display.c
index d37d599aec27..4c72124ffb5d 100644
--- a/drivers/gpu/drm/msm/dp/dp_display.c
+++ b/drivers/gpu/drm/msm/dp/dp_display.c
@@ -329,10 +329,26 @@ static const struct component_ops dp_display_comp_ops = {
.unbind = dp_display_unbind,
  };
  
+static void dp_display_send_hpd_event(struct msm_dp *dp_display)

+{
+   struct dp_display_private *dp;
+   struct drm_connector *connector;
+
+   dp = container_of(dp_display, struct dp_display_private, dp_display);
+
+   connector = dp->dp_display.connector;
+   drm_helper_hpd_irq_event(connector->dev);
+}
+
  static int dp_display_send_hpd_notification(struct dp_display_private *dp,
bool hpd)
  {
-   struct drm_bridge *bridge = dp->dp_display.bridge;
+   if ((hpd && dp->dp_display.link_ready) ||
+   (!hpd && !dp->dp_display.link_ready)) {
+   drm_dbg_dp(dp->drm_dev, "HPD already %s\n",
+   (hpd ? "on" : "off"));
+   return 0;
+   }
  
  	/* reset video pattern flag on disconnect */

if (!hpd) {
@@ -348,7 +364,7 @@ static int dp_display_send_hpd_notification(struct 
dp_display_private *dp,
  
  	drm_dbg_dp(dp->drm_dev, "type=%d hpd=%d\n",

dp->dp_display.connector_type, hpd);
-   drm_bridge_hpd_notify(bridge, dp->dp_display.link_ready);
+   dp_display_send_hpd_event(>dp_display);
  
  	return 0;

  }


Tested-by: Neil Armstrong  # on SM8650-HDK


Re: [PATCH 0/6] soc: qcom: pmic_glink_altmode: fix drm bridge use-after-free

2024-02-23 Thread Neil Armstrong

On 23/02/2024 15:52, Johan Hovold wrote:

On Fri, Feb 23, 2024 at 03:38:13PM +0100, Neil Armstrong wrote:

On 23/02/2024 15:21, Johan Hovold wrote:



But it is *not* standalone as I tried to explain above.

So you have to drop it again as the later patches depend on it and
cannot be merged (through a different tree) without it.


drm-misc branches cannot be rebased, it must be reverted, but it can still be 
applied
on drm-misc-next and I'll send a revert patch for drm-misc-fixes if needed, not 
a big deal.


I thought you had all the acks you needed to take this through drm-misc,
but we can wait a bit more if necessary (and there's no rush to get the
first one in).


If you want it to be in v6.9, it's too late since the last drm-misc-next PR has 
been sent
yesterday 
(https://cgit.freedesktop.org/drm/drm-misc/tag/?h=drm-misc-next-2024-02-22)

Please ping Thomas or Maxime, perhaps it's not too late since the drm-misc-next 
tree
really closes on sunday.


I don't want this in 6.9, this is needed for *6.8* as this fixes a DRM
regression in 6.8-rc1 that breaks the display on machines like the X13s.

If you guys can't sort this out in time, then perhaps Bjorn can take
this through the Qualcomm tree instead (with DRM acks).

But again, this is fixing a severe *regression* in 6.8-rc1. It can not
wait for 6.9.


Right, I can't apply them right now, I send a patchset ack so it can be applied 
ASAP,

Thanks,
Neil



Johan




Re: [PATCH 0/6] soc: qcom: pmic_glink_altmode: fix drm bridge use-after-free

2024-02-23 Thread Neil Armstrong

On 17/02/2024 16:02, Johan Hovold wrote:

Starting with 6.8-rc1 the internal display sometimes fails to come up on
machines like the Lenovo ThinkPad X13s and the logs indicate that this
is due to a regression in the DRM subsystem [1].

This series fixes a race in the pmic_glink_altmode driver which was
exposed / triggered by the transparent DRM bridges rework that went into
6.8-rc1 and that manifested itself as a bridge failing to attach and
sometimes triggering a NULL-pointer dereference.

The intermittent hard resets that have also been reported since 6.8-rc1
unfortunately still remains and suggests that we are dealing with two
separate regressions. There is some indication that also the hard resets
(e.g. due to register accesses to unclocked hardware) are also due to
changes in the DRM subsystem as it happens around the time that the eDP
panel and display controller would be initialised during boot (the
runtime PM rework?). This remains to be verified, however.

Included is also a fix for a related OF node reference leak in the
aux-hpd driver found through inspection when reworking the driver.

The use-after-free bug is triggered by a probe deferral and highlighted
some further bugs in the involved drivers, which were registering child
devices before deferring probe. This behaviour is not correct and can
both trigger probe deferral loops and potentially also further issues
with the DRM bridge implementation.

This series can either go through the Qualcomm SoC tree (pmic_glink) or
the DRM tree. The PHY patches do not depend on the rest of the series
and could possibly be merged separately through the PHY tree.

Whichever gets this to mainline the fastest.

Johan


[1] https://lore.kernel.org/lkml/zctvmlk4ztwcp...@hovoldconsulting.com/


Johan Hovold (5):
   drm/bridge: aux-hpd: fix OF node leaks
   drm/bridge: aux-hpd: separate allocation and registration
   soc: qcom: pmic_glink_altmode: fix drm bridge use-after-free
   phy: qcom-qmp-combo: fix drm bridge registration
   phy: qcom-qmp-combo: fix type-c switch registration

Rob Clark (1):
   soc: qcom: pmic_glink: Fix boot when QRTR=m

  drivers/gpu/drm/bridge/aux-hpd-bridge.c   | 70 ++-
  drivers/phy/qualcomm/phy-qcom-qmp-combo.c | 16 +++---
  drivers/soc/qcom/pmic_glink.c | 21 +++
  drivers/soc/qcom/pmic_glink_altmode.c | 16 +-
  include/drm/bridge/aux-bridge.h   | 15 +
  5 files changed, 102 insertions(+), 36 deletions(-)



For the serie:
Acked-by: Neil Armstrong 

After an offline discussion, Dmitry, it's ok to push the remaining patches to 
drm-misc-fixes.

Thanks,
Neil


Re: [PATCH 0/6] soc: qcom: pmic_glink_altmode: fix drm bridge use-after-free

2024-02-23 Thread Neil Armstrong

On 23/02/2024 15:21, Johan Hovold wrote:

On Fri, Feb 23, 2024 at 02:52:28PM +0100, Neil Armstrong wrote:

On 23/02/2024 13:51, Johan Hovold wrote:

On Fri, Feb 23, 2024 at 12:03:10PM +0100, Neil Armstrong wrote:

On 23/02/2024 12:02, Neil Armstrong wrote:



Thanks, Applied to https://anongit.freedesktop.org/git/drm/drm-misc.git 
(drm-misc-fixes)

[1/6] drm/bridge: aux-hpd: fix OF node leaks
 
https://cgit.freedesktop.org/drm/drm-misc/commit/?id=9ee485bdda68d6d3f5728cbe3150eb9013d7d22b
[2/6] drm/bridge: aux-hpd: separate allocation and registration
 (no commit info)
[3/6] soc: qcom: pmic_glink_altmode: fix drm bridge use-after-free
 (no commit info)
[4/6] soc: qcom: pmic_glink: Fix boot when QRTR=m
 (no commit info)
[5/6] phy: qcom-qmp-combo: fix drm bridge registration
 (no commit info)
[6/6] phy: qcom-qmp-combo: fix type-c switch registration
 (no commit info)



To clarify, I only applied patch 1 to drm-misc-fixes


Ok, but can you please not do that? :)

These patches should go in through the same tree to avoid conflicts.

I discussed this with Bjorn and Dmitry the other day and the conclusion
was that it was easiest to take all of these through DRM.


I only applied patch 1, which is a standalone fix and goes into a separate tree,
for the next patches it would be indeed simpler for them to go via drm-misc when
they are properly acked.


But it is *not* standalone as I tried to explain above.

So you have to drop it again as the later patches depend on it and
cannot be merged (through a different tree) without it.


drm-misc branches cannot be rebased, it must be reverted, but it can still be 
applied
on drm-misc-next and I'll send a revert patch for drm-misc-fixes if needed, not 
a big deal.


I thought you had all the acks you needed to take this through drm-misc,
but we can wait a bit more if necessary (and there's no rush to get the
first one in).


If you want it to be in v6.9, it's too late since the last drm-misc-next PR has 
been sent
yesterday 
(https://cgit.freedesktop.org/drm/drm-misc/tag/?h=drm-misc-next-2024-02-22)

Please ping Thomas or Maxime, perhaps it's not too late since the drm-misc-next 
tree
really closes on sunday.

Neil




Johan




Re: [PATCH 0/6] soc: qcom: pmic_glink_altmode: fix drm bridge use-after-free

2024-02-23 Thread Neil Armstrong

On 23/02/2024 13:51, Johan Hovold wrote:

On Fri, Feb 23, 2024 at 12:03:10PM +0100, Neil Armstrong wrote:

On 23/02/2024 12:02, Neil Armstrong wrote:

Hi,

On Sat, 17 Feb 2024 16:02:22 +0100, Johan Hovold wrote:

Starting with 6.8-rc1 the internal display sometimes fails to come up on
machines like the Lenovo ThinkPad X13s and the logs indicate that this
is due to a regression in the DRM subsystem [1].

This series fixes a race in the pmic_glink_altmode driver which was
exposed / triggered by the transparent DRM bridges rework that went into
6.8-rc1 and that manifested itself as a bridge failing to attach and
sometimes triggering a NULL-pointer dereference.

[...]


Thanks, Applied to https://anongit.freedesktop.org/git/drm/drm-misc.git 
(drm-misc-fixes)

[1/6] drm/bridge: aux-hpd: fix OF node leaks

https://cgit.freedesktop.org/drm/drm-misc/commit/?id=9ee485bdda68d6d3f5728cbe3150eb9013d7d22b
[2/6] drm/bridge: aux-hpd: separate allocation and registration
(no commit info)
[3/6] soc: qcom: pmic_glink_altmode: fix drm bridge use-after-free
(no commit info)
[4/6] soc: qcom: pmic_glink: Fix boot when QRTR=m
(no commit info)
[5/6] phy: qcom-qmp-combo: fix drm bridge registration
(no commit info)
[6/6] phy: qcom-qmp-combo: fix type-c switch registration
(no commit info)



To clarify, I only applied patch 1 to drm-misc-fixes


Ok, but can you please not do that? :)

These patches should go in through the same tree to avoid conflicts.

I discussed this with Bjorn and Dmitry the other day and the conclusion
was that it was easiest to take all of these through DRM.


I only applied patch 1, which is a standalone fix and goes into a separate tree,
for the next patches it would be indeed simpler for them to go via drm-misc when
they are properly acked.

Neil



With Vinod acking the PHY patches, I believe you have what you need to
merge the whole series now?

Johan




Re: [PATCH 4/6] soc: qcom: pmic_glink: Fix boot when QRTR=m

2024-02-23 Thread Neil Armstrong

On 17/02/2024 16:02, Johan Hovold wrote:

From: Rob Clark 

We need to bail out before adding/removing devices if we are going to
-EPROBE_DEFER. Otherwise boot can get stuck in a probe deferral loop due
to a long-standing issue in driver core (see fbc35b45f9f6 ("Add
documentation on meaning of -EPROBE_DEFER")).

Deregistering the altmode child device can potentially also trigger bugs
in the DRM bridge implementation, which does not expect bridges to go
away.

Suggested-by: Dmitry Baryshkov 
Signed-off-by: Rob Clark 
Link: https://lore.kernel.org/r/20231213210644.8702-1-robdcl...@gmail.com
[ johan: rebase on 6.8-rc4, amend commit message and mention DRM ]
Fixes: 58ef4ece1e41 ("soc: qcom: pmic_glink: Introduce base PMIC GLINK driver")
Cc: sta...@vger.kernel.org  # 6.3
Cc: Bjorn Andersson 
Signed-off-by: Johan Hovold 
---
  drivers/soc/qcom/pmic_glink.c | 21 +++--
  1 file changed, 11 insertions(+), 10 deletions(-)

diff --git a/drivers/soc/qcom/pmic_glink.c b/drivers/soc/qcom/pmic_glink.c
index f4bfd24386f1..f913e9bd57ed 100644
--- a/drivers/soc/qcom/pmic_glink.c
+++ b/drivers/soc/qcom/pmic_glink.c
@@ -265,10 +265,17 @@ static int pmic_glink_probe(struct platform_device *pdev)
  
  	pg->client_mask = *match_data;
  
+	pg->pdr = pdr_handle_alloc(pmic_glink_pdr_callback, pg);

+   if (IS_ERR(pg->pdr)) {
+   ret = dev_err_probe(>dev, PTR_ERR(pg->pdr),
+   "failed to initialize pdr\n");
+   return ret;
+   }
+
if (pg->client_mask & BIT(PMIC_GLINK_CLIENT_UCSI)) {
ret = pmic_glink_add_aux_device(pg, >ucsi_aux, "ucsi");
if (ret)
-   return ret;
+   goto out_release_pdr_handle;
}
if (pg->client_mask & BIT(PMIC_GLINK_CLIENT_ALTMODE)) {
ret = pmic_glink_add_aux_device(pg, >altmode_aux, 
"altmode");
@@ -281,17 +288,11 @@ static int pmic_glink_probe(struct platform_device *pdev)
goto out_release_altmode_aux;
}
  
-	pg->pdr = pdr_handle_alloc(pmic_glink_pdr_callback, pg);

-   if (IS_ERR(pg->pdr)) {
-   ret = dev_err_probe(>dev, PTR_ERR(pg->pdr), "failed to 
initialize pdr\n");
-   goto out_release_aux_devices;
-   }
-
service = pdr_add_lookup(pg->pdr, "tms/servreg", "msm/adsp/charger_pd");
if (IS_ERR(service)) {
ret = dev_err_probe(>dev, PTR_ERR(service),
"failed adding pdr lookup for 
charger_pd\n");
-   goto out_release_pdr_handle;
+   goto out_release_aux_devices;
}
  
  	mutex_lock(&__pmic_glink_lock);

@@ -300,8 +301,6 @@ static int pmic_glink_probe(struct platform_device *pdev)
  
  	return 0;
  
-out_release_pdr_handle:

-   pdr_handle_release(pg->pdr);
  out_release_aux_devices:
if (pg->client_mask & BIT(PMIC_GLINK_CLIENT_BATT))
pmic_glink_del_aux_device(pg, >ps_aux);
@@ -311,6 +310,8 @@ static int pmic_glink_probe(struct platform_device *pdev)
  out_release_ucsi_aux:
if (pg->client_mask & BIT(PMIC_GLINK_CLIENT_UCSI))
    pmic_glink_del_aux_device(pg, >ucsi_aux);
+out_release_pdr_handle:
+   pdr_handle_release(pg->pdr);
  
  	return ret;

  }


Reviewed-by: Neil Armstrong 


Re: [PATCH 0/6] soc: qcom: pmic_glink_altmode: fix drm bridge use-after-free

2024-02-23 Thread Neil Armstrong

On 23/02/2024 12:02, Neil Armstrong wrote:

Hi,

On Sat, 17 Feb 2024 16:02:22 +0100, Johan Hovold wrote:

Starting with 6.8-rc1 the internal display sometimes fails to come up on
machines like the Lenovo ThinkPad X13s and the logs indicate that this
is due to a regression in the DRM subsystem [1].

This series fixes a race in the pmic_glink_altmode driver which was
exposed / triggered by the transparent DRM bridges rework that went into
6.8-rc1 and that manifested itself as a bridge failing to attach and
sometimes triggering a NULL-pointer dereference.

[...]


Thanks, Applied to https://anongit.freedesktop.org/git/drm/drm-misc.git 
(drm-misc-fixes)

[1/6] drm/bridge: aux-hpd: fix OF node leaks
   
https://cgit.freedesktop.org/drm/drm-misc/commit/?id=9ee485bdda68d6d3f5728cbe3150eb9013d7d22b
[2/6] drm/bridge: aux-hpd: separate allocation and registration
   (no commit info)
[3/6] soc: qcom: pmic_glink_altmode: fix drm bridge use-after-free
   (no commit info)
[4/6] soc: qcom: pmic_glink: Fix boot when QRTR=m
   (no commit info)
[5/6] phy: qcom-qmp-combo: fix drm bridge registration
   (no commit info)
[6/6] phy: qcom-qmp-combo: fix type-c switch registration
   (no commit info)



To clarify, I only applied patch 1 to drm-misc-fixes

Thanks,
Neil


Re: [PATCH 0/6] soc: qcom: pmic_glink_altmode: fix drm bridge use-after-free

2024-02-23 Thread Neil Armstrong
Hi,

On Sat, 17 Feb 2024 16:02:22 +0100, Johan Hovold wrote:
> Starting with 6.8-rc1 the internal display sometimes fails to come up on
> machines like the Lenovo ThinkPad X13s and the logs indicate that this
> is due to a regression in the DRM subsystem [1].
> 
> This series fixes a race in the pmic_glink_altmode driver which was
> exposed / triggered by the transparent DRM bridges rework that went into
> 6.8-rc1 and that manifested itself as a bridge failing to attach and
> sometimes triggering a NULL-pointer dereference.
> 
> [...]

Thanks, Applied to https://anongit.freedesktop.org/git/drm/drm-misc.git 
(drm-misc-fixes)

[1/6] drm/bridge: aux-hpd: fix OF node leaks
  
https://cgit.freedesktop.org/drm/drm-misc/commit/?id=9ee485bdda68d6d3f5728cbe3150eb9013d7d22b
[2/6] drm/bridge: aux-hpd: separate allocation and registration
  (no commit info)
[3/6] soc: qcom: pmic_glink_altmode: fix drm bridge use-after-free
  (no commit info)
[4/6] soc: qcom: pmic_glink: Fix boot when QRTR=m
  (no commit info)
[5/6] phy: qcom-qmp-combo: fix drm bridge registration
  (no commit info)
[6/6] phy: qcom-qmp-combo: fix type-c switch registration
  (no commit info)

-- 
Neil



Re: [PATCH 1/6] drm/bridge: aux-hpd: fix OF node leaks

2024-02-23 Thread Neil Armstrong

On 17/02/2024 16:02, Johan Hovold wrote:

The two device node references taken during allocation need to be
dropped when the auxiliary device is freed.

Fixes: 6914968a0b52 ("drm/bridge: properly refcount DT nodes in aux bridge 
drivers")
Cc: Dmitry Baryshkov 
Cc: Neil Armstrong 
Signed-off-by: Johan Hovold 
---
  drivers/gpu/drm/bridge/aux-hpd-bridge.c | 3 +++
  1 file changed, 3 insertions(+)

diff --git a/drivers/gpu/drm/bridge/aux-hpd-bridge.c 
b/drivers/gpu/drm/bridge/aux-hpd-bridge.c
index bb55f697a181..9e71daf95bde 100644
--- a/drivers/gpu/drm/bridge/aux-hpd-bridge.c
+++ b/drivers/gpu/drm/bridge/aux-hpd-bridge.c
@@ -25,6 +25,7 @@ static void drm_aux_hpd_bridge_release(struct device *dev)
ida_free(_aux_hpd_bridge_ida, adev->id);
  
  	of_node_put(adev->dev.platform_data);

+   of_node_put(adev->dev.of_node);
  
  	kfree(adev);

  }
@@ -74,6 +75,8 @@ struct device *drm_dp_hpd_bridge_register(struct device 
*parent,
  
  	ret = auxiliary_device_init(adev);

if (ret) {
+   of_node_put(adev->dev.platform_data);
+   of_node_put(adev->dev.of_node);
ida_free(_aux_hpd_bridge_ida, adev->id);
kfree(adev);
return ERR_PTR(ret);


Reviewed-by: Neil Armstrong 


Re: [PATCH 1/6] drm/bridge: aux-hpd: fix OF node leaks

2024-02-23 Thread Neil Armstrong

On 17/02/2024 16:02, Johan Hovold wrote:

The two device node references taken during allocation need to be
dropped when the auxiliary device is freed.

Fixes: 6914968a0b52 ("drm/bridge: properly refcount DT nodes in aux bridge 
drivers")
Cc: Dmitry Baryshkov 
Cc: Neil Armstrong 
Signed-off-by: Johan Hovold 
---
  drivers/gpu/drm/bridge/aux-hpd-bridge.c | 3 +++
  1 file changed, 3 insertions(+)

diff --git a/drivers/gpu/drm/bridge/aux-hpd-bridge.c 
b/drivers/gpu/drm/bridge/aux-hpd-bridge.c
index bb55f697a181..9e71daf95bde 100644
--- a/drivers/gpu/drm/bridge/aux-hpd-bridge.c
+++ b/drivers/gpu/drm/bridge/aux-hpd-bridge.c
@@ -25,6 +25,7 @@ static void drm_aux_hpd_bridge_release(struct device *dev)
ida_free(_aux_hpd_bridge_ida, adev->id);
  
  	of_node_put(adev->dev.platform_data);

+   of_node_put(adev->dev.of_node);
  
  	kfree(adev);

  }
@@ -74,6 +75,8 @@ struct device *drm_dp_hpd_bridge_register(struct device 
*parent,
  
  	ret = auxiliary_device_init(adev);

if (ret) {
+   of_node_put(adev->dev.platform_data);
+   of_node_put(adev->dev.of_node);
ida_free(_aux_hpd_bridge_ida, adev->id);
kfree(adev);
return ERR_PTR(ret);


Reviewed-by: Neil Armstrong 


Re: [PATCH 8/9] arm64: dts: qcom: qcs6490-rb3gen2: Enable USB Type-C display

2024-02-22 Thread neil . armstrong

On 22/02/2024 00:19, Bjorn Andersson wrote:

With MDSS, pmic_glink, and the redriver in place, wire up the various
components to enable USB Type-C display on the RB3gen2.

Signed-off-by: Bjorn Andersson 
---
  arch/arm64/boot/dts/qcom/qcs6490-rb3gen2.dts | 63 +++-
  1 file changed, 61 insertions(+), 2 deletions(-)

diff --git a/arch/arm64/boot/dts/qcom/qcs6490-rb3gen2.dts 
b/arch/arm64/boot/dts/qcom/qcs6490-rb3gen2.dts
index 171ed979d55f..4bf1c6351467 100644
--- a/arch/arm64/boot/dts/qcom/qcs6490-rb3gen2.dts
+++ b/arch/arm64/boot/dts/qcom/qcs6490-rb3gen2.dts
@@ -149,7 +149,15 @@ port@1 {
reg = <1>;
  
  	pmic_glink_ss_in: endpoint {

-   remote-endpoint = 
<_1_dwc3_ss>;
+   remote-endpoint = 
<_usb_con_ss>;
+   };
+   };
+
+   port@2 {
+   reg = <2>;
+
+   pmic_glink_sbu_in: endpoint {
+   remote-endpoint = 
<_usb_con_sbu>;
};
};
};
@@ -476,6 +484,36 @@ typec-mux@1c {
  
  		retimer-switch;

orientation-switch;
+
+   ports {
+   #address-cells = <1>;
+   #size-cells = <0>;
+
+   port@0 {
+   reg = <0>;
+
+   redriver_usb_con_ss: endpoint {
+   remote-endpoint = <_glink_ss_in>;
+   };
+   };
+
+   port@1 {
+   reg = <1>;
+
+   redriver_phy_con_ss: endpoint {
+   remote-endpoint = <_dp_qmpphy_out>;
+   data-lanes = <0 1 2 3>;
+   };
+   };
+
+   port@2 {
+   reg = <2>;
+
+   redriver_usb_con_sbu: endpoint {
+   remote-endpoint = <_glink_sbu_in>;
+   };
+       };


Nice to see the SBU switching works :-)


Reviewed-by: Neil Armstrong 



+   };
};
  };
  
@@ -483,6 +521,15 @@  {

status = "okay";
  };
  
+_dp {

+   status = "okay";
+};
+
+_dp_out {
+   data-lanes = <0 1>;
+   remote-endpoint = <_dp_qmpphy_dp_in>;
+};
+
  _edp {
status = "okay";
  };
@@ -534,7 +581,7 @@ _1_dwc3_hs {
  };
  
  _1_dwc3_ss {

-   remote-endpoint = <_glink_ss_in>;
+   remote-endpoint = <_dp_qmpphy_usb_ss_in>;
  };
  
  _1_hsphy {

@@ -554,6 +601,18 @@ _1_qmpphy {
status = "okay";
  };
  
+_dp_qmpphy_out {

+   remote-endpoint = <_phy_con_ss>;
+};
+
+_dp_qmpphy_usb_ss_in {
+   remote-endpoint = <_1_dwc3_ss>;
+};
+
+_dp_qmpphy_dp_in {
+   remote-endpoint = <_dp_out>;
+};
+
   {
memory-region = <_fw_mem>;
  };



Re: [PATCH 8/8] arm64: dts: qcom: qrb2210-rb1: Enable the GPU

2024-02-20 Thread neil . armstrong

On 19/02/2024 22:37, Konrad Dybcio wrote:

On 19.02.2024 15:49, Dmitry Baryshkov wrote:

On Mon, 19 Feb 2024 at 15:36, Konrad Dybcio  wrote:


Enable the A702 GPU (also marketed as "3D accelerator by qcom [1], lol).


Is it not?


Sure, every electronic device is also a heater, I suppose.. I found
this wording extremely funny though



GPU (Graphics Processing Unit) isn't accurate either since it can also run 
compute shaders do to non graphics processing,
so 3D Accelerator isn't that different.

A proper term would be Vectorized Mathematical Computing Complex or something 
similar.

Neil







[1] 
https://docs.qualcomm.com/bundle/publicresource/87-61720-1_REV_A_QUALCOMM_ROBOTICS_RB1_PLATFORM__QUALCOMM_QRB2210__PRODUCT_BRIEF.pdf
Signed-off-by: Konrad Dybcio 


With the exception of the commit message:


:(

Konrad



Reviewed-by: Dmitry Baryshkov 


---
  arch/arm64/boot/dts/qcom/qrb2210-rb1.dts | 8 
  1 file changed, 8 insertions(+)









Re: [PATCH 5/6] phy: qcom-qmp-combo: fix drm bridge registration

2024-02-19 Thread Neil Armstrong

On 17/02/2024 16:02, Johan Hovold wrote:

Due to a long-standing issue in driver core, drivers may not probe defer
after having registered child devices to avoid triggering a probe
deferral loop (see fbc35b45f9f6 ("Add documentation on meaning of
-EPROBE_DEFER")).

This could potentially also trigger a bug in the DRM bridge
implementation which does not expect bridges to go away even if device
links may avoid triggering this (when enabled).

Move registration of the DRM aux bridge to after looking up clocks and
other resources.

Note that PHY creation can in theory also trigger a probe deferral when
a 'phy' supply is used. This does not seem to affect the QMP PHY driver
but the PHY subsystem should be reworked to address this (i.e. by
separating initialisation and registration of the PHY).

Fixes: 35921910bbd0 ("phy: qcom: qmp-combo: switch to DRM_AUX_BRIDGE")
Fixes: 1904c3f578dc ("phy: qcom-qmp-combo: Introduce drm_bridge")
Cc: sta...@vger.kernel.org  # 6.5
Cc: Bjorn Andersson 
Cc: Dmitry Baryshkov 
Signed-off-by: Johan Hovold 
---
  drivers/phy/qualcomm/phy-qcom-qmp-combo.c | 8 
  1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/phy/qualcomm/phy-qcom-qmp-combo.c 
b/drivers/phy/qualcomm/phy-qcom-qmp-combo.c
index 1ad10110dd25..e19d6a084f10 100644
--- a/drivers/phy/qualcomm/phy-qcom-qmp-combo.c
+++ b/drivers/phy/qualcomm/phy-qcom-qmp-combo.c
@@ -3566,10 +3566,6 @@ static int qmp_combo_probe(struct platform_device *pdev)
if (ret)
return ret;
  
-	ret = drm_aux_bridge_register(dev);

-   if (ret)
-   return ret;
-
/* Check for legacy binding with child nodes. */
usb_np = of_get_child_by_name(dev->of_node, "usb3-phy");
if (usb_np) {
@@ -3589,6 +3585,10 @@ static int qmp_combo_probe(struct platform_device *pdev)
if (ret)
goto err_node_put;
  
+	ret = drm_aux_bridge_register(dev);

+   if (ret)
+   goto err_node_put;
+
pm_runtime_set_active(dev);
ret = devm_pm_runtime_enable(dev);
    if (ret)


Reviewed-by: Neil Armstrong 


[PATCH v3 4/7] drm/msm/a6xx: Add missing regs for A750

2024-02-16 Thread Neil Armstrong
Sync missing regs for A750 clock gating control related registers
from Mesa a6xx.xml.h generated file.

Those registers were added in the !27576 merge request [1].

[1] https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27576

Signed-off-by: Neil Armstrong 
---
 drivers/gpu/drm/msm/adreno/a6xx.xml.h | 9 +
 1 file changed, 9 insertions(+)

diff --git a/drivers/gpu/drm/msm/adreno/a6xx.xml.h 
b/drivers/gpu/drm/msm/adreno/a6xx.xml.h
index 863b5e3b0e67..58877464692a 100644
--- a/drivers/gpu/drm/msm/adreno/a6xx.xml.h
+++ b/drivers/gpu/drm/msm/adreno/a6xx.xml.h
@@ -1725,6 +1725,8 @@ static inline uint32_t 
REG_A6XX_RBBM_PERFCTR_RBBM_SEL(uint32_t i0) { return 0x00
 
 #define REG_A6XX_RBBM_BLOCK_SW_RESET_CMD2  0x0046
 
+#define REG_A7XX_RBBM_CLOCK_CNTL_GLOBAL
0x00ad
+
 #define REG_A6XX_RBBM_CLOCK_CNTL   0x00ae
 
 #define REG_A6XX_RBBM_CLOCK_CNTL_SP0   0x00b0
@@ -1939,12 +1941,19 @@ static inline uint32_t 
REG_A6XX_RBBM_PERFCTR_RBBM_SEL(uint32_t i0) { return 0x00
 
 #define REG_A6XX_RBBM_CLOCK_HYST_HLSQ  0x011d
 
+#define REG_A7XX_RBBM_CGC_GLOBAL_LOAD_CMD  0x011e
+
+#define REG_A7XX_RBBM_CGC_P2S_TRIG_CMD 0x011f
+
 #define REG_A6XX_RBBM_CLOCK_CNTL_TEX_FCHE  0x0120
 
 #define REG_A6XX_RBBM_CLOCK_DELAY_TEX_FCHE 0x0121
 
 #define REG_A6XX_RBBM_CLOCK_HYST_TEX_FCHE  0x0122
 
+#define REG_A7XX_RBBM_CGC_P2S_STATUS   0x0122
+#define A7XX_RBBM_CGC_P2S_STATUS_TXDONE
0x0001
+
 #define REG_A7XX_RBBM_CLOCK_HYST2_VFD  0x012f
 
 #define REG_A6XX_RBBM_LPAC_GBIF_CLIENT_QOS_CNTL
0x05ff

-- 
2.34.1



[PATCH v3 5/7] drm/msm: add support for A750 GPU

2024-02-16 Thread Neil Armstrong
Add support for the A750 GPU found on the SM8650 platform

Unlike the the very close A740 GPU on the SM8550 SoC, the A750 GPU
doesn't have an HWCFG block but a separate register set.

The A750 GPU info are added under the adreno_is_a750() macro and
the ADRENO_7XX_GEN3 family id.

Reviewed-by: Konrad Dybcio 
Signed-off-by: Neil Armstrong 
---
 drivers/gpu/drm/msm/adreno/a6xx_gmu.c  |  2 ++
 drivers/gpu/drm/msm/adreno/a6xx_gpu.c  | 28 +---
 drivers/gpu/drm/msm/adreno/adreno_device.c | 14 ++
 drivers/gpu/drm/msm/adreno/adreno_gpu.h| 10 --
 4 files changed, 49 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/msm/adreno/a6xx_gmu.c 
b/drivers/gpu/drm/msm/adreno/a6xx_gmu.c
index 8c4900444b2c..325881d8ff08 100644
--- a/drivers/gpu/drm/msm/adreno/a6xx_gmu.c
+++ b/drivers/gpu/drm/msm/adreno/a6xx_gmu.c
@@ -842,6 +842,8 @@ static int a6xx_gmu_fw_start(struct a6xx_gmu *gmu, unsigned 
int state)
 */
if (adreno_is_a740(adreno_gpu))
chipid_min = 2;
+   else if (adreno_is_a750(adreno_gpu))
+   chipid_min = 9;
else
return -EINVAL;
 
diff --git a/drivers/gpu/drm/msm/adreno/a6xx_gpu.c 
b/drivers/gpu/drm/msm/adreno/a6xx_gpu.c
index c9c55e2ea584..475b601a48ee 100644
--- a/drivers/gpu/drm/msm/adreno/a6xx_gpu.c
+++ b/drivers/gpu/drm/msm/adreno/a6xx_gpu.c
@@ -961,7 +961,7 @@ static void a6xx_set_hwcg(struct msm_gpu *gpu, bool state)
unsigned int i;
u32 val, clock_cntl_on, cgc_mode;
 
-   if (!adreno_gpu->info->hwcg)
+   if (!(adreno_gpu->info->hwcg || adreno_is_a7xx(adreno_gpu)))
return;
 
if (adreno_is_a630(adreno_gpu))
@@ -982,6 +982,25 @@ static void a6xx_set_hwcg(struct msm_gpu *gpu, bool state)
  state ? 0x : 0);
}
 
+   if (!adreno_gpu->info->hwcg) {
+   gpu_write(gpu, REG_A7XX_RBBM_CLOCK_CNTL_GLOBAL, 1);
+   gpu_write(gpu, REG_A7XX_RBBM_CGC_GLOBAL_LOAD_CMD, state ? 1 : 
0);
+
+   if (state) {
+   gpu_write(gpu, REG_A7XX_RBBM_CGC_P2S_TRIG_CMD, 1);
+
+   if (gpu_poll_timeout(gpu, REG_A7XX_RBBM_CGC_P2S_STATUS, 
val,
+val & 
A7XX_RBBM_CGC_P2S_STATUS_TXDONE, 1, 10)) {
+   dev_err(>pdev->dev, "RBBM_CGC_P2S_STATUS 
TXDONE Poll failed\n");
+   return;
+   }
+
+   gpu_write(gpu, REG_A7XX_RBBM_CLOCK_CNTL_GLOBAL, 0);
+   }
+
+   return;
+   }
+
val = gpu_read(gpu, REG_A6XX_RBBM_CLOCK_CNTL);
 
/* Don't re-program the registers if they are already correct */
@@ -1239,7 +1258,9 @@ static void a6xx_set_cp_protect(struct msm_gpu *gpu)
count = ARRAY_SIZE(a660_protect);
count_max = 48;
BUILD_BUG_ON(ARRAY_SIZE(a660_protect) > 48);
-   } else if (adreno_is_a730(adreno_gpu) || adreno_is_a740(adreno_gpu)) {
+   } else if (adreno_is_a730(adreno_gpu) ||
+  adreno_is_a740(adreno_gpu) ||
+  adreno_is_a750(adreno_gpu)) {
regs = a730_protect;
count = ARRAY_SIZE(a730_protect);
count_max = 48;
@@ -2880,7 +2901,8 @@ struct msm_gpu *a6xx_gpu_init(struct drm_device *dev)
 
/* gpu->info only gets assigned in adreno_gpu_init() */
is_a7xx = config->info->family == ADRENO_7XX_GEN1 ||
- config->info->family == ADRENO_7XX_GEN2;
+ config->info->family == ADRENO_7XX_GEN2 ||
+ config->info->family == ADRENO_7XX_GEN3;
 
a6xx_llc_slices_init(pdev, a6xx_gpu, is_a7xx);
 
diff --git a/drivers/gpu/drm/msm/adreno/adreno_device.c 
b/drivers/gpu/drm/msm/adreno/adreno_device.c
index 2ce7d7b1690d..e2582c91d7e7 100644
--- a/drivers/gpu/drm/msm/adreno/adreno_device.c
+++ b/drivers/gpu/drm/msm/adreno/adreno_device.c
@@ -522,6 +522,20 @@ static const struct adreno_info gpulist[] = {
.zapfw = "a740_zap.mdt",
.hwcg = a740_hwcg,
.address_space_size = SZ_16G,
+   }, {
+   .chip_ids = ADRENO_CHIP_IDS(0x43051401), /* "C520v2" */
+   .family = ADRENO_7XX_GEN3,
+   .fw = {
+   [ADRENO_FW_SQE] = "gen70900_sqe.fw",
+   [ADRENO_FW_GMU] = "gmu_gen70900.bin",
+   },
+   .gmem = 3 * SZ_1M,
+   .inactive_period = DRM_MSM_INACTIVE_PERIOD,
+   .quirks = ADRENO_QUIRK_HAS_CACHED_COHERENT |
+ ADRENO_QUIRK_HAS_HW_APRIV,
+   .init = a6xx_gpu_init,
+   .zapfw = "gen70900_zap.mbn",
+   .address_space_size = SZ_16G,

[PATCH v3 7/7] arm64: dts: qcom: sm8650-qrd: enable GPU

2024-02-16 Thread Neil Armstrong
Add path of the GPU firmware for the SM8650-QRD board

Reviewed-by: Konrad Dybcio 
Signed-off-by: Neil Armstrong 
---
 arch/arm64/boot/dts/qcom/sm8650-qrd.dts | 8 
 1 file changed, 8 insertions(+)

diff --git a/arch/arm64/boot/dts/qcom/sm8650-qrd.dts 
b/arch/arm64/boot/dts/qcom/sm8650-qrd.dts
index b07cac2e5bc8..dc91f0bf4b8c 100644
--- a/arch/arm64/boot/dts/qcom/sm8650-qrd.dts
+++ b/arch/arm64/boot/dts/qcom/sm8650-qrd.dts
@@ -766,6 +766,14 @@  {
status = "okay";
 };
 
+ {
+   status = "okay";
+
+   zap-shader {
+   firmware-name = "qcom/sm8650/gen70900_zap.mbn";
+   };
+};
+
 _tlmm {
spkr_1_sd_n_active: spkr-1-sd-n-active-state {
pins = "gpio21";

-- 
2.34.1



[PATCH v3 6/7] arm64: dts: qcom: sm8650: add GPU nodes

2024-02-16 Thread Neil Armstrong
Add GPU nodes for the SM8650 platform.

Signed-off-by: Neil Armstrong 
---
 arch/arm64/boot/dts/qcom/sm8650.dtsi | 166 +++
 1 file changed, 166 insertions(+)

diff --git a/arch/arm64/boot/dts/qcom/sm8650.dtsi 
b/arch/arm64/boot/dts/qcom/sm8650.dtsi
index 62e6ae93a9a8..27dcef27b6ad 100644
--- a/arch/arm64/boot/dts/qcom/sm8650.dtsi
+++ b/arch/arm64/boot/dts/qcom/sm8650.dtsi
@@ -2589,6 +2589,128 @@ tcsr: clock-controller@1fc {
#reset-cells = <1>;
};
 
+   gpu: gpu@3d0 {
+   compatible = "qcom,adreno-43051401", "qcom,adreno";
+   reg = <0x0 0x03d0 0x0 0x4>,
+ <0x0 0x03d9e000 0x0 0x1000>,
+ <0x0 0x03d61000 0x0 0x800>;
+   reg-names = "kgsl_3d0_reg_memory",
+   "cx_mem",
+   "cx_dbgc";
+
+   interrupts = ;
+
+   iommus = <_smmu 0 0x0>,
+<_smmu 1 0x0>;
+
+   operating-points-v2 = <_opp_table>;
+
+   qcom,gmu = <>;
+
+   status = "disabled";
+
+   zap-shader {
+   memory-region = <_micro_code_mem>;
+   };
+
+   /* Speedbin needs more work on A740+, keep only lower 
freqs */
+   gpu_opp_table: opp-table {
+   compatible = "operating-points-v2";
+
+   opp-68000 {
+   opp-hz = /bits/ 64 <68000>;
+   opp-level = 
;
+   };
+
+   opp-62900 {
+   opp-hz = /bits/ 64 <62900>;
+   opp-level = 
;
+   };
+
+   opp-57800 {
+   opp-hz = /bits/ 64 <57800>;
+   opp-level = ;
+   };
+
+   opp-5 {
+   opp-hz = /bits/ 64 <5>;
+   opp-level = 
;
+   };
+
+   opp-42200 {
+   opp-hz = /bits/ 64 <42200>;
+   opp-level = 
;
+   };
+
+   opp-36600 {
+   opp-hz = /bits/ 64 <36600>;
+   opp-level = 
;
+   };
+
+   opp-31000 {
+   opp-hz = /bits/ 64 <31000>;
+   opp-level = 
;
+   };
+
+   opp-23100 {
+   opp-hz = /bits/ 64 <23100>;
+   opp-level = 
;
+   };
+   };
+   };
+
+   gmu: gmu@3d6a000 {
+   compatible = "qcom,adreno-gmu-750.1", "qcom,adreno-gmu";
+   reg = <0x0 0x03d6a000 0x0 0x35000>,
+ <0x0 0x03d5 0x0 0x1>,
+ <0x0 0x0b28 0x0 0x1>;
+   reg-names = "gmu", "rscc", "gmu_pdc";
+
+   interrupts = ,
+;
+   interrupt-names = "hfi", "gmu";
+
+   clocks = < GPU_CC_AHB_CLK>,
+< GPU_CC_CX_GMU_CLK>,
+< GPU_CC_CXO_CLK>,
+< GCC_DDRSS_GPU_AXI_CLK>,
+< GCC_GPU_MEMNOC_GFX_CLK>,
+< GPU_CC_HUB_CX_INT_CLK>,
+< GPU_CC_DEMET_CLK>;
+   clock-names = "ahb",
+ "gmu",
+ "cxo",
+ "axi",
+ "memnoc",
+ "hub",
+ "demet";
+
+   power-domains = < GPU_

[PATCH v3 1/7] dt-bindings: display/msm/gmu: Document Adreno 750 GMU

2024-02-16 Thread Neil Armstrong
Document the Adreno 750 GMU found on the SM8650 platform.

Reviewed-by: Konrad Dybcio 
Acked-by: Conor Dooley 
Signed-off-by: Neil Armstrong 
---
 Documentation/devicetree/bindings/display/msm/gmu.yaml | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Documentation/devicetree/bindings/display/msm/gmu.yaml 
b/Documentation/devicetree/bindings/display/msm/gmu.yaml
index 4e1c25b42908..b3837368a260 100644
--- a/Documentation/devicetree/bindings/display/msm/gmu.yaml
+++ b/Documentation/devicetree/bindings/display/msm/gmu.yaml
@@ -224,6 +224,7 @@ allOf:
 enum:
   - qcom,adreno-gmu-730.1
   - qcom,adreno-gmu-740.1
+  - qcom,adreno-gmu-750.1
 then:
   properties:
 reg:

-- 
2.34.1



[PATCH v3 3/7] dt-bindings: arm-smmu: Document SM8650 GPU SMMU

2024-02-16 Thread Neil Armstrong
Document the GPU SMMU found on the SM8650 platform.

Signed-off-by: Neil Armstrong 
---
 Documentation/devicetree/bindings/iommu/arm,smmu.yaml | 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/Documentation/devicetree/bindings/iommu/arm,smmu.yaml 
b/Documentation/devicetree/bindings/iommu/arm,smmu.yaml
index 38c48131e6e7..740631782540 100644
--- a/Documentation/devicetree/bindings/iommu/arm,smmu.yaml
+++ b/Documentation/devicetree/bindings/iommu/arm,smmu.yaml
@@ -93,6 +93,7 @@ properties:
   - qcom,sm8350-smmu-500
   - qcom,sm8450-smmu-500
   - qcom,sm8550-smmu-500
+  - qcom,sm8650-smmu-500
   - const: qcom,adreno-smmu
   - const: qcom,smmu-500
   - const: arm,mmu-500
@@ -514,7 +515,9 @@ allOf:
   properties:
 compatible:
   items:
-- const: qcom,sm8550-smmu-500
+- enum:
+- qcom,sm8550-smmu-500
+- qcom,sm8650-smmu-500
 - const: qcom,adreno-smmu
 - const: qcom,smmu-500
 - const: arm,mmu-500
@@ -553,7 +556,6 @@ allOf:
   - qcom,sdx65-smmu-500
   - qcom,sm6350-smmu-500
   - qcom,sm6375-smmu-500
-  - qcom,sm8650-smmu-500
   - qcom,x1e80100-smmu-500
 then:
   properties:

-- 
2.34.1



[PATCH v3 2/7] dt-bindings: arm-smmu: fix SM8[45]50 GPU SMMU if condition

2024-02-16 Thread Neil Armstrong
The if condition for the SM8[45]50 GPU SMMU is too large,
add the other compatible strings to the condition to only
allow the clocks for the GPU SMMU nodes.

Fixes: 4fff78dc2490 ("dt-bindings: arm-smmu: Document SM8[45]50 GPU SMMU")
Suggested-by: Dmitry Baryshkov 
Signed-off-by: Neil Armstrong 
---
 Documentation/devicetree/bindings/iommu/arm,smmu.yaml | 13 +++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/Documentation/devicetree/bindings/iommu/arm,smmu.yaml 
b/Documentation/devicetree/bindings/iommu/arm,smmu.yaml
index a4042ae24770..38c48131e6e7 100644
--- a/Documentation/devicetree/bindings/iommu/arm,smmu.yaml
+++ b/Documentation/devicetree/bindings/iommu/arm,smmu.yaml
@@ -484,7 +484,12 @@ allOf:
   - if:
   properties:
 compatible:
-  const: qcom,sm8450-smmu-500
+  items:
+- const: qcom,sm8450-smmu-500
+- const: qcom,adreno-smmu
+- const: qcom,smmu-500
+- const: arm,mmu-500
+
 then:
   properties:
 clock-names:
@@ -508,7 +513,11 @@ allOf:
   - if:
   properties:
 compatible:
-  const: qcom,sm8550-smmu-500
+  items:
+- const: qcom,sm8550-smmu-500
+- const: qcom,adreno-smmu
+- const: qcom,smmu-500
+- const: arm,mmu-500
 then:
   properties:
 clock-names:

-- 
2.34.1



[PATCH v3 0/7] drm/msm: Add support for the A750 GPU found on the SM8650 platform

2024-02-16 Thread Neil Armstrong
Unlike the the very close A740 GPU on the SM8550 SoC, the A750 GPU
doesn't have an HWCFG block but a separate register set.

The missing registers are added in the a6xx.xml.h file that would
require a subsequent sync and the non-existent hwcfg is handled
in a6xx_set_hwcg().

The A750 GPU info are added under the adreno_is_a750() macro and
the ADRENO_7XX_GEN3 family id.

This adds:
- the GMU and SMMU bindings
- DRM driver changes
- DT nodes

Dependencies: None

Tested using Mesa's !26934 Merge Request [0] on the SM8650-QRD
and with kmscube & vkcube to test basic rendering.

[0] https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26934

Signed-off-by: Neil Armstrong 
---
Changes in v3:
- Fixed smmu bindings if condition for GMU smmu
- Collected reviews
- Link to v2: 
https://lore.kernel.org/r/20240215-topic-sm8650-gpu-v2-0-6be0b4bf2...@linaro.org

Changes in v2:
- Added separate a6xx.xml.h sync from 
https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27576
- Collected review tags
- Inlined skip_programming
- Use A7XX_RBBM_CGC_P2S_STATUS_TXDONE instead of BIT(0)
- Drop now useless placeholder comment
- Removed interconnect properties
- Rebased on current linux-next
- Link to v1: 
https://lore.kernel.org/r/20240212-topic-sm8650-gpu-v1-0-708a40b74...@linaro.org

---
Neil Armstrong (7):
  dt-bindings: display/msm/gmu: Document Adreno 750 GMU
  dt-bindings: arm-smmu: fix SM8[45]50 GPU SMMU if condition
  dt-bindings: arm-smmu: Document SM8650 GPU SMMU
  drm/msm/a6xx: Add missing regs for A750
  drm/msm: add support for A750 GPU
  arm64: dts: qcom: sm8650: add GPU nodes
  arm64: dts: qcom: sm8650-qrd: enable GPU

 .../devicetree/bindings/display/msm/gmu.yaml   |   1 +
 .../devicetree/bindings/iommu/arm,smmu.yaml|  17 ++-
 arch/arm64/boot/dts/qcom/sm8650-qrd.dts|   8 +
 arch/arm64/boot/dts/qcom/sm8650.dtsi   | 166 +
 drivers/gpu/drm/msm/adreno/a6xx.xml.h  |   9 ++
 drivers/gpu/drm/msm/adreno/a6xx_gmu.c  |   2 +
 drivers/gpu/drm/msm/adreno/a6xx_gpu.c  |  28 +++-
 drivers/gpu/drm/msm/adreno/adreno_device.c |  14 ++
 drivers/gpu/drm/msm/adreno/adreno_gpu.h|  10 +-
 9 files changed, 247 insertions(+), 8 deletions(-)
---
base-commit: 2c3b09aac00d7835023bbc4473ee06696be64fa8
change-id: 20240208-topic-sm8650-gpu-489d5e2c2b17

Best regards,
-- 
Neil Armstrong 



Re: [PATCH v2 2/6] dt-bindings: arm-smmu: Document SM8650 GPU SMMU

2024-02-15 Thread neil . armstrong

On 15/02/2024 10:32, Dmitry Baryshkov wrote:

On Thu, 15 Feb 2024 at 11:29, Neil Armstrong  wrote:


On 15/02/2024 10:25, Dmitry Baryshkov wrote:

On Thu, 15 Feb 2024 at 11:20, Neil Armstrong  wrote:


Document the GPU SMMU found on the SM8650 platform.

Signed-off-by: Neil Armstrong 
---
   Documentation/devicetree/bindings/iommu/arm,smmu.yaml | 7 +--
   1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/Documentation/devicetree/bindings/iommu/arm,smmu.yaml 
b/Documentation/devicetree/bindings/iommu/arm,smmu.yaml
index a4042ae24770..3ad5c850f3bf 100644
--- a/Documentation/devicetree/bindings/iommu/arm,smmu.yaml
+++ b/Documentation/devicetree/bindings/iommu/arm,smmu.yaml
@@ -93,6 +93,7 @@ properties:
 - qcom,sm8350-smmu-500
 - qcom,sm8450-smmu-500
 - qcom,sm8550-smmu-500
+  - qcom,sm8650-smmu-500
 - const: qcom,adreno-smmu
 - const: qcom,smmu-500
 - const: arm,mmu-500
@@ -508,7 +509,10 @@ allOf:
 - if:
 properties:
   compatible:
-  const: qcom,sm8550-smmu-500
+  contains:
+enum:
+  - qcom,sm8550-smmu-500
+  - qcom,sm8650-smmu-500


Doesn't this cause warnings for non-GPU SMMU on this platform?


No because it doesn't add those to required, it simply allows clock the 
properties.


Can we further constrain this branch so that it is applicable only to
the Adreno SMMUs (and enforce requirement)? And maybe constrain the
second if-branch so that it doesn't apply to the Adreno SMMUs?


Indeed, it's done like that for the a6 gpu, I'll send a fix for that

Neil








   then:
 properties:
   clock-names:
@@ -544,7 +548,6 @@ allOf:
 - qcom,sdx65-smmu-500
 - qcom,sm6350-smmu-500
 - qcom,sm6375-smmu-500
-  - qcom,sm8650-smmu-500
 - qcom,x1e80100-smmu-500
   then:
 properties:

--
2.34.1













Re: [PATCH v2 2/6] dt-bindings: arm-smmu: Document SM8650 GPU SMMU

2024-02-15 Thread Neil Armstrong

On 15/02/2024 10:25, Dmitry Baryshkov wrote:

On Thu, 15 Feb 2024 at 11:20, Neil Armstrong  wrote:


Document the GPU SMMU found on the SM8650 platform.

Signed-off-by: Neil Armstrong 
---
  Documentation/devicetree/bindings/iommu/arm,smmu.yaml | 7 +--
  1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/Documentation/devicetree/bindings/iommu/arm,smmu.yaml 
b/Documentation/devicetree/bindings/iommu/arm,smmu.yaml
index a4042ae24770..3ad5c850f3bf 100644
--- a/Documentation/devicetree/bindings/iommu/arm,smmu.yaml
+++ b/Documentation/devicetree/bindings/iommu/arm,smmu.yaml
@@ -93,6 +93,7 @@ properties:
- qcom,sm8350-smmu-500
- qcom,sm8450-smmu-500
- qcom,sm8550-smmu-500
+  - qcom,sm8650-smmu-500
- const: qcom,adreno-smmu
- const: qcom,smmu-500
- const: arm,mmu-500
@@ -508,7 +509,10 @@ allOf:
- if:
properties:
  compatible:
-  const: qcom,sm8550-smmu-500
+  contains:
+enum:
+  - qcom,sm8550-smmu-500
+  - qcom,sm8650-smmu-500


Doesn't this cause warnings for non-GPU SMMU on this platform?


No because it doesn't add those to required, it simply allows clock the 
properties.




  then:
properties:
  clock-names:
@@ -544,7 +548,6 @@ allOf:
- qcom,sdx65-smmu-500
- qcom,sm6350-smmu-500
- qcom,sm6375-smmu-500
-  - qcom,sm8650-smmu-500
- qcom,x1e80100-smmu-500
  then:
properties:

--
2.34.1








[PATCH v2 3/6] drm/msm/a6xx: Add missing regs for A750

2024-02-15 Thread Neil Armstrong
Sync missing regs for A750 clock gating control related registers
from Mesa a6xx.xml.h generated file.

Those registers were added in the !27576 merge request [1].

[1] https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27576

Signed-off-by: Neil Armstrong 
---
 drivers/gpu/drm/msm/adreno/a6xx.xml.h | 9 +
 1 file changed, 9 insertions(+)

diff --git a/drivers/gpu/drm/msm/adreno/a6xx.xml.h 
b/drivers/gpu/drm/msm/adreno/a6xx.xml.h
index 863b5e3b0e67..58877464692a 100644
--- a/drivers/gpu/drm/msm/adreno/a6xx.xml.h
+++ b/drivers/gpu/drm/msm/adreno/a6xx.xml.h
@@ -1725,6 +1725,8 @@ static inline uint32_t 
REG_A6XX_RBBM_PERFCTR_RBBM_SEL(uint32_t i0) { return 0x00
 
 #define REG_A6XX_RBBM_BLOCK_SW_RESET_CMD2  0x0046
 
+#define REG_A7XX_RBBM_CLOCK_CNTL_GLOBAL
0x00ad
+
 #define REG_A6XX_RBBM_CLOCK_CNTL   0x00ae
 
 #define REG_A6XX_RBBM_CLOCK_CNTL_SP0   0x00b0
@@ -1939,12 +1941,19 @@ static inline uint32_t 
REG_A6XX_RBBM_PERFCTR_RBBM_SEL(uint32_t i0) { return 0x00
 
 #define REG_A6XX_RBBM_CLOCK_HYST_HLSQ  0x011d
 
+#define REG_A7XX_RBBM_CGC_GLOBAL_LOAD_CMD  0x011e
+
+#define REG_A7XX_RBBM_CGC_P2S_TRIG_CMD 0x011f
+
 #define REG_A6XX_RBBM_CLOCK_CNTL_TEX_FCHE  0x0120
 
 #define REG_A6XX_RBBM_CLOCK_DELAY_TEX_FCHE 0x0121
 
 #define REG_A6XX_RBBM_CLOCK_HYST_TEX_FCHE  0x0122
 
+#define REG_A7XX_RBBM_CGC_P2S_STATUS   0x0122
+#define A7XX_RBBM_CGC_P2S_STATUS_TXDONE
0x0001
+
 #define REG_A7XX_RBBM_CLOCK_HYST2_VFD  0x012f
 
 #define REG_A6XX_RBBM_LPAC_GBIF_CLIENT_QOS_CNTL
0x05ff

-- 
2.34.1



[PATCH v2 6/6] arm64: dts: qcom: sm8650-qrd: enable GPU

2024-02-15 Thread Neil Armstrong
Add path of the GPU firmware for the SM8650-QRD board

Reviewed-by: Konrad Dybcio 
Signed-off-by: Neil Armstrong 
---
 arch/arm64/boot/dts/qcom/sm8650-qrd.dts | 8 
 1 file changed, 8 insertions(+)

diff --git a/arch/arm64/boot/dts/qcom/sm8650-qrd.dts 
b/arch/arm64/boot/dts/qcom/sm8650-qrd.dts
index b07cac2e5bc8..dc91f0bf4b8c 100644
--- a/arch/arm64/boot/dts/qcom/sm8650-qrd.dts
+++ b/arch/arm64/boot/dts/qcom/sm8650-qrd.dts
@@ -766,6 +766,14 @@  {
status = "okay";
 };
 
+ {
+   status = "okay";
+
+   zap-shader {
+   firmware-name = "qcom/sm8650/gen70900_zap.mbn";
+   };
+};
+
 _tlmm {
spkr_1_sd_n_active: spkr-1-sd-n-active-state {
pins = "gpio21";

-- 
2.34.1



[PATCH v2 5/6] arm64: dts: qcom: sm8650: add GPU nodes

2024-02-15 Thread Neil Armstrong
Add GPU nodes for the SM8650 platform.

Signed-off-by: Neil Armstrong 
---
 arch/arm64/boot/dts/qcom/sm8650.dtsi | 166 +++
 1 file changed, 166 insertions(+)

diff --git a/arch/arm64/boot/dts/qcom/sm8650.dtsi 
b/arch/arm64/boot/dts/qcom/sm8650.dtsi
index 62e6ae93a9a8..27dcef27b6ad 100644
--- a/arch/arm64/boot/dts/qcom/sm8650.dtsi
+++ b/arch/arm64/boot/dts/qcom/sm8650.dtsi
@@ -2589,6 +2589,128 @@ tcsr: clock-controller@1fc {
#reset-cells = <1>;
};
 
+   gpu: gpu@3d0 {
+   compatible = "qcom,adreno-43051401", "qcom,adreno";
+   reg = <0x0 0x03d0 0x0 0x4>,
+ <0x0 0x03d9e000 0x0 0x1000>,
+ <0x0 0x03d61000 0x0 0x800>;
+   reg-names = "kgsl_3d0_reg_memory",
+   "cx_mem",
+   "cx_dbgc";
+
+   interrupts = ;
+
+   iommus = <_smmu 0 0x0>,
+<_smmu 1 0x0>;
+
+   operating-points-v2 = <_opp_table>;
+
+   qcom,gmu = <>;
+
+   status = "disabled";
+
+   zap-shader {
+   memory-region = <_micro_code_mem>;
+   };
+
+   /* Speedbin needs more work on A740+, keep only lower 
freqs */
+   gpu_opp_table: opp-table {
+   compatible = "operating-points-v2";
+
+   opp-68000 {
+   opp-hz = /bits/ 64 <68000>;
+   opp-level = 
;
+   };
+
+   opp-62900 {
+   opp-hz = /bits/ 64 <62900>;
+   opp-level = 
;
+   };
+
+   opp-57800 {
+   opp-hz = /bits/ 64 <57800>;
+   opp-level = ;
+   };
+
+   opp-5 {
+   opp-hz = /bits/ 64 <5>;
+   opp-level = 
;
+   };
+
+   opp-42200 {
+   opp-hz = /bits/ 64 <42200>;
+   opp-level = 
;
+   };
+
+   opp-36600 {
+   opp-hz = /bits/ 64 <36600>;
+   opp-level = 
;
+   };
+
+   opp-31000 {
+   opp-hz = /bits/ 64 <31000>;
+   opp-level = 
;
+   };
+
+   opp-23100 {
+   opp-hz = /bits/ 64 <23100>;
+   opp-level = 
;
+   };
+   };
+   };
+
+   gmu: gmu@3d6a000 {
+   compatible = "qcom,adreno-gmu-750.1", "qcom,adreno-gmu";
+   reg = <0x0 0x03d6a000 0x0 0x35000>,
+ <0x0 0x03d5 0x0 0x1>,
+ <0x0 0x0b28 0x0 0x1>;
+   reg-names = "gmu", "rscc", "gmu_pdc";
+
+   interrupts = ,
+;
+   interrupt-names = "hfi", "gmu";
+
+   clocks = < GPU_CC_AHB_CLK>,
+< GPU_CC_CX_GMU_CLK>,
+< GPU_CC_CXO_CLK>,
+< GCC_DDRSS_GPU_AXI_CLK>,
+< GCC_GPU_MEMNOC_GFX_CLK>,
+< GPU_CC_HUB_CX_INT_CLK>,
+< GPU_CC_DEMET_CLK>;
+   clock-names = "ahb",
+ "gmu",
+ "cxo",
+ "axi",
+ "memnoc",
+ "hub",
+ "demet";
+
+   power-domains = < GPU_

[PATCH v2 4/6] drm/msm: add support for A750 GPU

2024-02-15 Thread Neil Armstrong
Add support for the A750 GPU found on the SM8650 platform

Unlike the the very close A740 GPU on the SM8550 SoC, the A750 GPU
doesn't have an HWCFG block but a separate register set.

The A750 GPU info are added under the adreno_is_a750() macro and
the ADRENO_7XX_GEN3 family id.

Signed-off-by: Neil Armstrong 
---
 drivers/gpu/drm/msm/adreno/a6xx_gmu.c  |  2 ++
 drivers/gpu/drm/msm/adreno/a6xx_gpu.c  | 28 +---
 drivers/gpu/drm/msm/adreno/adreno_device.c | 14 ++
 drivers/gpu/drm/msm/adreno/adreno_gpu.h| 10 --
 4 files changed, 49 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/msm/adreno/a6xx_gmu.c 
b/drivers/gpu/drm/msm/adreno/a6xx_gmu.c
index 8c4900444b2c..325881d8ff08 100644
--- a/drivers/gpu/drm/msm/adreno/a6xx_gmu.c
+++ b/drivers/gpu/drm/msm/adreno/a6xx_gmu.c
@@ -842,6 +842,8 @@ static int a6xx_gmu_fw_start(struct a6xx_gmu *gmu, unsigned 
int state)
 */
if (adreno_is_a740(adreno_gpu))
chipid_min = 2;
+   else if (adreno_is_a750(adreno_gpu))
+   chipid_min = 9;
else
return -EINVAL;
 
diff --git a/drivers/gpu/drm/msm/adreno/a6xx_gpu.c 
b/drivers/gpu/drm/msm/adreno/a6xx_gpu.c
index c9c55e2ea584..475b601a48ee 100644
--- a/drivers/gpu/drm/msm/adreno/a6xx_gpu.c
+++ b/drivers/gpu/drm/msm/adreno/a6xx_gpu.c
@@ -961,7 +961,7 @@ static void a6xx_set_hwcg(struct msm_gpu *gpu, bool state)
unsigned int i;
u32 val, clock_cntl_on, cgc_mode;
 
-   if (!adreno_gpu->info->hwcg)
+   if (!(adreno_gpu->info->hwcg || adreno_is_a7xx(adreno_gpu)))
return;
 
if (adreno_is_a630(adreno_gpu))
@@ -982,6 +982,25 @@ static void a6xx_set_hwcg(struct msm_gpu *gpu, bool state)
  state ? 0x : 0);
}
 
+   if (!adreno_gpu->info->hwcg) {
+   gpu_write(gpu, REG_A7XX_RBBM_CLOCK_CNTL_GLOBAL, 1);
+   gpu_write(gpu, REG_A7XX_RBBM_CGC_GLOBAL_LOAD_CMD, state ? 1 : 
0);
+
+   if (state) {
+   gpu_write(gpu, REG_A7XX_RBBM_CGC_P2S_TRIG_CMD, 1);
+
+   if (gpu_poll_timeout(gpu, REG_A7XX_RBBM_CGC_P2S_STATUS, 
val,
+val & 
A7XX_RBBM_CGC_P2S_STATUS_TXDONE, 1, 10)) {
+   dev_err(>pdev->dev, "RBBM_CGC_P2S_STATUS 
TXDONE Poll failed\n");
+   return;
+   }
+
+   gpu_write(gpu, REG_A7XX_RBBM_CLOCK_CNTL_GLOBAL, 0);
+   }
+
+   return;
+   }
+
val = gpu_read(gpu, REG_A6XX_RBBM_CLOCK_CNTL);
 
/* Don't re-program the registers if they are already correct */
@@ -1239,7 +1258,9 @@ static void a6xx_set_cp_protect(struct msm_gpu *gpu)
count = ARRAY_SIZE(a660_protect);
count_max = 48;
BUILD_BUG_ON(ARRAY_SIZE(a660_protect) > 48);
-   } else if (adreno_is_a730(adreno_gpu) || adreno_is_a740(adreno_gpu)) {
+   } else if (adreno_is_a730(adreno_gpu) ||
+  adreno_is_a740(adreno_gpu) ||
+  adreno_is_a750(adreno_gpu)) {
regs = a730_protect;
count = ARRAY_SIZE(a730_protect);
count_max = 48;
@@ -2880,7 +2901,8 @@ struct msm_gpu *a6xx_gpu_init(struct drm_device *dev)
 
/* gpu->info only gets assigned in adreno_gpu_init() */
is_a7xx = config->info->family == ADRENO_7XX_GEN1 ||
- config->info->family == ADRENO_7XX_GEN2;
+ config->info->family == ADRENO_7XX_GEN2 ||
+ config->info->family == ADRENO_7XX_GEN3;
 
a6xx_llc_slices_init(pdev, a6xx_gpu, is_a7xx);
 
diff --git a/drivers/gpu/drm/msm/adreno/adreno_device.c 
b/drivers/gpu/drm/msm/adreno/adreno_device.c
index 2ce7d7b1690d..e2582c91d7e7 100644
--- a/drivers/gpu/drm/msm/adreno/adreno_device.c
+++ b/drivers/gpu/drm/msm/adreno/adreno_device.c
@@ -522,6 +522,20 @@ static const struct adreno_info gpulist[] = {
.zapfw = "a740_zap.mdt",
.hwcg = a740_hwcg,
.address_space_size = SZ_16G,
+   }, {
+   .chip_ids = ADRENO_CHIP_IDS(0x43051401), /* "C520v2" */
+   .family = ADRENO_7XX_GEN3,
+   .fw = {
+   [ADRENO_FW_SQE] = "gen70900_sqe.fw",
+   [ADRENO_FW_GMU] = "gmu_gen70900.bin",
+   },
+   .gmem = 3 * SZ_1M,
+   .inactive_period = DRM_MSM_INACTIVE_PERIOD,
+   .quirks = ADRENO_QUIRK_HAS_CACHED_COHERENT |
+ ADRENO_QUIRK_HAS_HW_APRIV,
+   .init = a6xx_gpu_init,
+   .zapfw = "gen70900_zap.mbn",
+   .address_space_size = SZ_16G,
},
 };
 
diff --git

[PATCH v2 2/6] dt-bindings: arm-smmu: Document SM8650 GPU SMMU

2024-02-15 Thread Neil Armstrong
Document the GPU SMMU found on the SM8650 platform.

Signed-off-by: Neil Armstrong 
---
 Documentation/devicetree/bindings/iommu/arm,smmu.yaml | 7 +--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/Documentation/devicetree/bindings/iommu/arm,smmu.yaml 
b/Documentation/devicetree/bindings/iommu/arm,smmu.yaml
index a4042ae24770..3ad5c850f3bf 100644
--- a/Documentation/devicetree/bindings/iommu/arm,smmu.yaml
+++ b/Documentation/devicetree/bindings/iommu/arm,smmu.yaml
@@ -93,6 +93,7 @@ properties:
   - qcom,sm8350-smmu-500
   - qcom,sm8450-smmu-500
   - qcom,sm8550-smmu-500
+  - qcom,sm8650-smmu-500
   - const: qcom,adreno-smmu
   - const: qcom,smmu-500
   - const: arm,mmu-500
@@ -508,7 +509,10 @@ allOf:
   - if:
   properties:
 compatible:
-  const: qcom,sm8550-smmu-500
+  contains:
+enum:
+  - qcom,sm8550-smmu-500
+  - qcom,sm8650-smmu-500
 then:
   properties:
 clock-names:
@@ -544,7 +548,6 @@ allOf:
   - qcom,sdx65-smmu-500
   - qcom,sm6350-smmu-500
   - qcom,sm6375-smmu-500
-  - qcom,sm8650-smmu-500
   - qcom,x1e80100-smmu-500
 then:
   properties:

-- 
2.34.1



[PATCH v2 0/6] drm/msm: Add support for the A750 GPU found on the SM8650 platform

2024-02-15 Thread Neil Armstrong
Unlike the the very close A740 GPU on the SM8550 SoC, the A750 GPU
doesn't have an HWCFG block but a separate register set.

The missing registers are added in the a6xx.xml.h file that would
require a subsequent sync and the non-existent hwcfg is handled
in a6xx_set_hwcg().

The A750 GPU info are added under the adreno_is_a750() macro and
the ADRENO_7XX_GEN3 family id.

This adds:
- the GMU and SMMU bindings
- DRM driver changes
- DT nodes

Dependencies: None

Tested using Mesa's !26934 Merge Request [0] on the SM8650-QRD
and with kmscube & vkcube to test basic rendering.

[0] https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26934

Signed-off-by: Neil Armstrong 
---
Changes in v2:
- Added separate a6xx.xml.h sync from 
https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27576
- Collected review tags
- Inlined skip_programming
- Use A7XX_RBBM_CGC_P2S_STATUS_TXDONE instead of BIT(0)
- Drop now useless placeholder comment
- Removed interconnect properties
- Rebased on current linux-next
- Link to v1: 
https://lore.kernel.org/r/20240212-topic-sm8650-gpu-v1-0-708a40b74...@linaro.org

---
Neil Armstrong (6):
  dt-bindings: display/msm/gmu: Document Adreno 750 GMU
  dt-bindings: arm-smmu: Document SM8650 GPU SMMU
  drm/msm/a6xx: Add missing regs for A750
  drm/msm: add support for A750 GPU
  arm64: dts: qcom: sm8650: add GPU nodes
  arm64: dts: qcom: sm8650-qrd: enable GPU

 .../devicetree/bindings/display/msm/gmu.yaml   |   1 +
 .../devicetree/bindings/iommu/arm,smmu.yaml|   7 +-
 arch/arm64/boot/dts/qcom/sm8650-qrd.dts|   8 +
 arch/arm64/boot/dts/qcom/sm8650.dtsi   | 166 +
 drivers/gpu/drm/msm/adreno/a6xx.xml.h  |   9 ++
 drivers/gpu/drm/msm/adreno/a6xx_gmu.c  |   2 +
 drivers/gpu/drm/msm/adreno/a6xx_gpu.c  |  28 +++-
 drivers/gpu/drm/msm/adreno/adreno_device.c |  14 ++
 drivers/gpu/drm/msm/adreno/adreno_gpu.h|  10 +-
 9 files changed, 238 insertions(+), 7 deletions(-)
---
base-commit: 5a30f6bdb84228f160b331eed2ccfde00bfb3ab4
change-id: 20240208-topic-sm8650-gpu-489d5e2c2b17

Best regards,
-- 
Neil Armstrong 



[PATCH v2 1/6] dt-bindings: display/msm/gmu: Document Adreno 750 GMU

2024-02-15 Thread Neil Armstrong
Document the Adreno 750 GMU found on the SM8650 platform.

Reviewed-by: Konrad Dybcio 
Signed-off-by: Neil Armstrong 
---
 Documentation/devicetree/bindings/display/msm/gmu.yaml | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Documentation/devicetree/bindings/display/msm/gmu.yaml 
b/Documentation/devicetree/bindings/display/msm/gmu.yaml
index 4e1c25b42908..b3837368a260 100644
--- a/Documentation/devicetree/bindings/display/msm/gmu.yaml
+++ b/Documentation/devicetree/bindings/display/msm/gmu.yaml
@@ -224,6 +224,7 @@ allOf:
 enum:
   - qcom,adreno-gmu-730.1
   - qcom,adreno-gmu-740.1
+  - qcom,adreno-gmu-750.1
 then:
   properties:
 reg:

-- 
2.34.1



Re: [PATCH 3/5] drm: msm: add support for A750 GPU

2024-02-15 Thread neil . armstrong

On 14/02/2024 22:43, Konrad Dybcio wrote:

On 12.02.2024 15:45, Neil Armstrong wrote:

On 12/02/2024 11:46, Konrad Dybcio wrote:

On 12.02.2024 11:37, Neil Armstrong wrote:

Add support for the A750 GPU found on the SM8650 platform

Unlike the the very close A740 GPU on the SM8550 SoC, the A750 GPU
doesn't have an HWCFG block but a separate register set.

The missing registers are added in the a6xx.xml.h file that would
require a subsequent sync and the non-existent hwcfg is handled
in a6xx_set_hwcg().


These should also be submitted to mesa to make sure the next header sync
doesn't wipe them


Ack submitting them right now: 
https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27576


Thanks





[...]


--- a/drivers/gpu/drm/msm/adreno/a6xx_gpu.c
+++ b/drivers/gpu/drm/msm/adreno/a6xx_gpu.c
@@ -958,10 +958,11 @@ static void a6xx_set_hwcg(struct msm_gpu *gpu, bool state)
   struct a6xx_gpu *a6xx_gpu = to_a6xx_gpu(adreno_gpu);
   struct a6xx_gmu *gmu = _gpu->gmu;
   const struct adreno_reglist *reg;
+    bool skip_programming = !(adreno_gpu->info->hwcg || 
adreno_is_a7xx(adreno_gpu));


is_a750?


OK right, I was thinking of the next gpu which will probably also miss an hwcfg




   unsigned int i;
   u32 val, clock_cntl_on, cgc_mode;
   -    if (!adreno_gpu->info->hwcg)
+    if (skip_programming)
   return;
     if (adreno_is_a630(adreno_gpu))
@@ -982,6 +983,25 @@ static void a6xx_set_hwcg(struct msm_gpu *gpu, bool state)
     state ? 0x : 0);
   }
   +    if (!adreno_gpu->info->hwcg) {


I don't think this block of code is reachable now, no?


It is because we didn't skip when adreno_is_a7xx(adreno_gpu)


Ahh I misread the brackets within the assignment





Maybe remove the skip_programming and if_a750 here?

This would require:

-    if (!adreno_gpu->info->hwcg || )
+    if (!(adreno_gpu->info->hwcg || adreno_is_a750(adreno_gpu)))


and:


+    if (adreno_is_a750(adreno_gpu)) {


But if the next gpu also doesn't have an hwcfg, we will need to use
the current design...

I just tried with:
><===
@@ -961,7 +961,7 @@ static void a6xx_set_hwcg(struct msm_gpu *gpu, bool state)
     unsigned int i;
     u32 val, clock_cntl_on, cgc_mode;

-   if (!adreno_gpu->info->hwcg)
+   if (!(adreno_gpu->info->hwcg || adreno_is_a750(adreno_gpu)))
     return;

     if (adreno_is_a630(adreno_gpu))
@@ -982,6 +982,25 @@ static void a6xx_set_hwcg(struct msm_gpu *gpu, bool state)
   state ? 0x : 0);
     }

+   if (adreno_is_a750(adreno_gpu)) {
+   gpu_write(gpu, REG_A7XX_RBBM_CLOCK_CNTL_GLOBAL, 1);
+   gpu_write(gpu, REG_A7XX_RBBM_CGC_GLOBAL_LOAD_CMD, state ? 1 : 
0);
+
+   if (state) {
+   gpu_write(gpu, REG_A7XX_RBBM_CGC_P2S_TRIG_CMD, 1);
+
+   if (gpu_poll_timeout(gpu, REG_A7XX_RBBM_CGC_P2S_STATUS, 
val,
+    val & 
A7XX_RBBM_CGC_P2S_STATUS_TXDONE, 1, 10)) {
+   dev_err(>pdev->dev, "RBBM_CGC_P2S_STATUS TXDONE 
Poll failed\n");
+   return;
+   }
+
+   gpu_write(gpu, REG_A7XX_RBBM_CLOCK_CNTL_GLOBAL, 0);
+   }
+
+   return;
+   }
+
     val = gpu_read(gpu, REG_A6XX_RBBM_CLOCK_CNTL);

     /* Don't re-program the registers if they are already correct */
><===

And it works fine, does it work it for you ?


Let's keep it as-is in the original submission, as I've mentioned, I had
misread the code


Ack thanks

Neil



Konrad






+    gpu_write(gpu, REG_A7XX_RBBM_CLOCK_CNTL_GLOBAL, 1);
+    gpu_write(gpu, REG_A7XX_RBBM_CGC_GLOBAL_LOAD_CMD, state ? 1 : 0);
+
+    if (state) {
+    gpu_write(gpu, REG_A7XX_RBBM_CGC_P2S_TRIG_CMD, 1);
+
+    if (gpu_poll_timeout(gpu, REG_A7XX_RBBM_CGC_P2S_STATUS, val,
+ val & BIT(0), 1, 10)) {


We should define that bit name (the err suggests it's
REG_A7XX_RBBM_GCC_P2S_STATUS_TXDONE or so)

[...]


+static inline int adreno_is_a750(struct adreno_gpu *gpu)
+{
+    return gpu->info->chip_ids[0] == 0x43051401;
+}
+
   /* Placeholder to make future diffs smaller */


Please also remove this comment now that it's invalid


Ack



Konrad


Thanks,
Neil





Re: [PATCH 3/5] drm: msm: add support for A750 GPU

2024-02-12 Thread Neil Armstrong

On 12/02/2024 11:46, Konrad Dybcio wrote:

On 12.02.2024 11:37, Neil Armstrong wrote:

Add support for the A750 GPU found on the SM8650 platform

Unlike the the very close A740 GPU on the SM8550 SoC, the A750 GPU
doesn't have an HWCFG block but a separate register set.

The missing registers are added in the a6xx.xml.h file that would
require a subsequent sync and the non-existent hwcfg is handled
in a6xx_set_hwcg().


These should also be submitted to mesa to make sure the next header sync
doesn't wipe them


Ack submitting them right now: 
https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27576



[...]


--- a/drivers/gpu/drm/msm/adreno/a6xx_gpu.c
+++ b/drivers/gpu/drm/msm/adreno/a6xx_gpu.c
@@ -958,10 +958,11 @@ static void a6xx_set_hwcg(struct msm_gpu *gpu, bool state)
struct a6xx_gpu *a6xx_gpu = to_a6xx_gpu(adreno_gpu);
struct a6xx_gmu *gmu = _gpu->gmu;
const struct adreno_reglist *reg;
+   bool skip_programming = !(adreno_gpu->info->hwcg || 
adreno_is_a7xx(adreno_gpu));


is_a750?


OK right, I was thinking of the next gpu which will probably also miss an hwcfg




unsigned int i;
u32 val, clock_cntl_on, cgc_mode;
  
-	if (!adreno_gpu->info->hwcg)

+   if (skip_programming)
return;
  
  	if (adreno_is_a630(adreno_gpu))

@@ -982,6 +983,25 @@ static void a6xx_set_hwcg(struct msm_gpu *gpu, bool state)
  state ? 0x : 0);
}
  
+	if (!adreno_gpu->info->hwcg) {


I don't think this block of code is reachable now, no?


It is because we didn't skip when adreno_is_a7xx(adreno_gpu)



Maybe remove the skip_programming and if_a750 here?

This would require:
>> -  if (!adreno_gpu->info->hwcg || )
>> +  if (!(adreno_gpu->info->hwcg || adreno_is_a750(adreno_gpu)))

and:

>> +  if (adreno_is_a750(adreno_gpu)) {

But if the next gpu also doesn't have an hwcfg, we will need to use
the current design...

I just tried with:
><===
@@ -961,7 +961,7 @@ static void a6xx_set_hwcg(struct msm_gpu *gpu, bool state)
unsigned int i;
u32 val, clock_cntl_on, cgc_mode;

-   if (!adreno_gpu->info->hwcg)
+   if (!(adreno_gpu->info->hwcg || adreno_is_a750(adreno_gpu)))
return;

if (adreno_is_a630(adreno_gpu))
@@ -982,6 +982,25 @@ static void a6xx_set_hwcg(struct msm_gpu *gpu, bool state)
  state ? 0x : 0);
}

+   if (adreno_is_a750(adreno_gpu)) {
+   gpu_write(gpu, REG_A7XX_RBBM_CLOCK_CNTL_GLOBAL, 1);
+   gpu_write(gpu, REG_A7XX_RBBM_CGC_GLOBAL_LOAD_CMD, state ? 1 : 
0);
+
+   if (state) {
+   gpu_write(gpu, REG_A7XX_RBBM_CGC_P2S_TRIG_CMD, 1);
+
+   if (gpu_poll_timeout(gpu, REG_A7XX_RBBM_CGC_P2S_STATUS, 
val,
+val & 
A7XX_RBBM_CGC_P2S_STATUS_TXDONE, 1, 10)) {
+   dev_err(>pdev->dev, "RBBM_CGC_P2S_STATUS TXDONE 
Poll failed\n");
+   return;
+   }
+
+   gpu_write(gpu, REG_A7XX_RBBM_CLOCK_CNTL_GLOBAL, 0);
+   }
+
+   return;
+   }
+
val = gpu_read(gpu, REG_A6XX_RBBM_CLOCK_CNTL);

/* Don't re-program the registers if they are already correct */
><===

And it works fine, does it work it for you ?




+   gpu_write(gpu, REG_A7XX_RBBM_CLOCK_CNTL_GLOBAL, 1);
+   gpu_write(gpu, REG_A7XX_RBBM_CGC_GLOBAL_LOAD_CMD, state ? 1 : 
0);
+
+   if (state) {
+   gpu_write(gpu, REG_A7XX_RBBM_CGC_P2S_TRIG_CMD, 1);
+
+   if (gpu_poll_timeout(gpu, REG_A7XX_RBBM_CGC_P2S_STATUS, 
val,
+val & BIT(0), 1, 10)) {


We should define that bit name (the err suggests it's
REG_A7XX_RBBM_GCC_P2S_STATUS_TXDONE or so)

[...]


+static inline int adreno_is_a750(struct adreno_gpu *gpu)
+{
+   return gpu->info->chip_ids[0] == 0x43051401;
+}
+
  /* Placeholder to make future diffs smaller */


Please also remove this comment now that it's invalid


Ack



Konrad


Thanks,
Neil



Re: [PATCH 4/5] arm64: dts: qcom: sm8650: add GPU nodes

2024-02-12 Thread Neil Armstrong

On 12/02/2024 11:50, Konrad Dybcio wrote:

On 12.02.2024 11:37, Neil Armstrong wrote:

Add GPU nodes for the SM8650 platform.

Signed-off-by: Neil Armstrong 
---
  arch/arm64/boot/dts/qcom/sm8650.dtsi | 169 +++
  1 file changed, 169 insertions(+)

diff --git a/arch/arm64/boot/dts/qcom/sm8650.dtsi 
b/arch/arm64/boot/dts/qcom/sm8650.dtsi
index c455ca4e6475..f6f9e603fb2f 100644
--- a/arch/arm64/boot/dts/qcom/sm8650.dtsi
+++ b/arch/arm64/boot/dts/qcom/sm8650.dtsi
@@ -2582,6 +2582,131 @@ tcsr: clock-controller@1fc {
#reset-cells = <1>;
};
  
+		gpu: gpu@3d0 {

+   compatible = "qcom,adreno-43051401", "qcom,adreno";
+   reg = <0x0 0x03d0 0x0 0x4>,
+ <0x0 0x03d9e000 0x0 0x1000>,
+ <0x0 0x03d61000 0x0 0x800>;
+   reg-names = "kgsl_3d0_reg_memory",
+   "cx_mem",
+   "cx_dbgc";
+
+   interrupts = ;
+
+   iommus = <_smmu 0 0x0>,
+<_smmu 1 0x0>;
+
+   operating-points-v2 = <_opp_table>;
+
+   interconnects = <_noc MASTER_GFX3D 0 _virt 
SLAVE_EBI1 0>;
+   interconnect-names = "gfx-mem";


ICC should be unnecessary


Ack I'll remove

Neil



Konrad




Re: [PATCH 5/5] arm64: dts: qcom: sm8650-qrd: enable GPU

2024-02-12 Thread Neil Armstrong

Hi,

On 12/02/2024 14:32, Dmitry Baryshkov wrote:

On Mon, 12 Feb 2024 at 12:37, Neil Armstrong  wrote:


Add path of the GPU firmware for the SM8650-QRD board

Signed-off-by: Neil Armstrong 
---
  arch/arm64/boot/dts/qcom/sm8650-qrd.dts | 8 
  1 file changed, 8 insertions(+)

diff --git a/arch/arm64/boot/dts/qcom/sm8650-qrd.dts 
b/arch/arm64/boot/dts/qcom/sm8650-qrd.dts
index 8515498553bf..7151f3dc67c4 100644
--- a/arch/arm64/boot/dts/qcom/sm8650-qrd.dts
+++ b/arch/arm64/boot/dts/qcom/sm8650-qrd.dts
@@ -525,6 +525,14 @@  {
 status = "okay";
  };

+ {
+   status = "okay";
+
+   zap-shader {
+   firmware-name = "qcom/sm8650/gen70900_zap.mbn";


But why? For sm8450 / sm8550 we had "a730_zap.mbn" and "a740_zap.mbn"


No idea why, this is the vendor's fw name, it uses the chipid (2 for sm8550, 9 
for sm8650) instead of the commercial name like the seq file (gen70900_sqe.fw).

Neil




+   };
+};
+
   {
 status = "okay";
  };

--
2.34.1








[PATCH 4/5] arm64: dts: qcom: sm8650: add GPU nodes

2024-02-12 Thread Neil Armstrong
Add GPU nodes for the SM8650 platform.

Signed-off-by: Neil Armstrong 
---
 arch/arm64/boot/dts/qcom/sm8650.dtsi | 169 +++
 1 file changed, 169 insertions(+)

diff --git a/arch/arm64/boot/dts/qcom/sm8650.dtsi 
b/arch/arm64/boot/dts/qcom/sm8650.dtsi
index c455ca4e6475..f6f9e603fb2f 100644
--- a/arch/arm64/boot/dts/qcom/sm8650.dtsi
+++ b/arch/arm64/boot/dts/qcom/sm8650.dtsi
@@ -2582,6 +2582,131 @@ tcsr: clock-controller@1fc {
#reset-cells = <1>;
};
 
+   gpu: gpu@3d0 {
+   compatible = "qcom,adreno-43051401", "qcom,adreno";
+   reg = <0x0 0x03d0 0x0 0x4>,
+ <0x0 0x03d9e000 0x0 0x1000>,
+ <0x0 0x03d61000 0x0 0x800>;
+   reg-names = "kgsl_3d0_reg_memory",
+   "cx_mem",
+   "cx_dbgc";
+
+   interrupts = ;
+
+   iommus = <_smmu 0 0x0>,
+<_smmu 1 0x0>;
+
+   operating-points-v2 = <_opp_table>;
+
+   interconnects = <_noc MASTER_GFX3D 0 _virt 
SLAVE_EBI1 0>;
+   interconnect-names = "gfx-mem";
+
+   qcom,gmu = <>;
+
+   status = "disabled";
+
+   zap-shader {
+   memory-region = <_micro_code_mem>;
+   };
+
+   /* Speedbin needs more work on A740+, keep only lower 
freqs */
+   gpu_opp_table: opp-table {
+   compatible = "operating-points-v2";
+
+   opp-68000 {
+   opp-hz = /bits/ 64 <68000>;
+   opp-level = 
;
+   };
+
+   opp-62900 {
+   opp-hz = /bits/ 64 <62900>;
+   opp-level = 
;
+   };
+
+   opp-57800 {
+   opp-hz = /bits/ 64 <57800>;
+   opp-level = ;
+   };
+
+   opp-5 {
+   opp-hz = /bits/ 64 <5>;
+   opp-level = 
;
+   };
+
+   opp-42200 {
+   opp-hz = /bits/ 64 <42200>;
+   opp-level = 
;
+   };
+
+   opp-36600 {
+   opp-hz = /bits/ 64 <36600>;
+   opp-level = 
;
+   };
+
+   opp-31000 {
+   opp-hz = /bits/ 64 <31000>;
+   opp-level = 
;
+   };
+
+   opp-23100 {
+   opp-hz = /bits/ 64 <23100>;
+   opp-level = 
;
+   };
+   };
+   };
+
+   gmu: gmu@3d6a000 {
+   compatible = "qcom,adreno-gmu-750.1", "qcom,adreno-gmu";
+   reg = <0x0 0x03d6a000 0x0 0x35000>,
+ <0x0 0x03d5 0x0 0x1>,
+ <0x0 0x0b28 0x0 0x1>;
+   reg-names = "gmu", "rscc", "gmu_pdc";
+
+   interrupts = ,
+;
+   interrupt-names = "hfi", "gmu";
+
+   clocks = < GPU_CC_AHB_CLK>,
+< GPU_CC_CX_GMU_CLK>,
+< GPU_CC_CXO_CLK>,
+< GCC_DDRSS_GPU_AXI_CLK>,
+< GCC_GPU_MEMNOC_GFX_CLK>,
+< GPU_CC_HUB_CX_INT_CLK>,
+< GPU_CC_DEMET_CLK>;
+   clock-names = "ahb",
+ "gmu",
+ "cxo",
+ "axi",
+ "memnoc",
+   

[PATCH 5/5] arm64: dts: qcom: sm8650-qrd: enable GPU

2024-02-12 Thread Neil Armstrong
Add path of the GPU firmware for the SM8650-QRD board

Signed-off-by: Neil Armstrong 
---
 arch/arm64/boot/dts/qcom/sm8650-qrd.dts | 8 
 1 file changed, 8 insertions(+)

diff --git a/arch/arm64/boot/dts/qcom/sm8650-qrd.dts 
b/arch/arm64/boot/dts/qcom/sm8650-qrd.dts
index 8515498553bf..7151f3dc67c4 100644
--- a/arch/arm64/boot/dts/qcom/sm8650-qrd.dts
+++ b/arch/arm64/boot/dts/qcom/sm8650-qrd.dts
@@ -525,6 +525,14 @@  {
status = "okay";
 };
 
+ {
+   status = "okay";
+
+   zap-shader {
+   firmware-name = "qcom/sm8650/gen70900_zap.mbn";
+   };
+};
+
  {
status = "okay";
 };

-- 
2.34.1



[PATCH 2/5] dt-bindings: arm-smmu: Document SM8650 GPU SMMU

2024-02-12 Thread Neil Armstrong
Document the GPU SMMU found on the SM8650 platform.

Signed-off-by: Neil Armstrong 
---
 Documentation/devicetree/bindings/iommu/arm,smmu.yaml | 7 +--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/Documentation/devicetree/bindings/iommu/arm,smmu.yaml 
b/Documentation/devicetree/bindings/iommu/arm,smmu.yaml
index a4042ae24770..3ad5c850f3bf 100644
--- a/Documentation/devicetree/bindings/iommu/arm,smmu.yaml
+++ b/Documentation/devicetree/bindings/iommu/arm,smmu.yaml
@@ -93,6 +93,7 @@ properties:
   - qcom,sm8350-smmu-500
   - qcom,sm8450-smmu-500
   - qcom,sm8550-smmu-500
+  - qcom,sm8650-smmu-500
   - const: qcom,adreno-smmu
   - const: qcom,smmu-500
   - const: arm,mmu-500
@@ -508,7 +509,10 @@ allOf:
   - if:
   properties:
 compatible:
-  const: qcom,sm8550-smmu-500
+  contains:
+enum:
+  - qcom,sm8550-smmu-500
+  - qcom,sm8650-smmu-500
 then:
   properties:
 clock-names:
@@ -544,7 +548,6 @@ allOf:
   - qcom,sdx65-smmu-500
   - qcom,sm6350-smmu-500
   - qcom,sm6375-smmu-500
-  - qcom,sm8650-smmu-500
   - qcom,x1e80100-smmu-500
 then:
   properties:

-- 
2.34.1



[PATCH 3/5] drm: msm: add support for A750 GPU

2024-02-12 Thread Neil Armstrong
Add support for the A750 GPU found on the SM8650 platform

Unlike the the very close A740 GPU on the SM8550 SoC, the A750 GPU
doesn't have an HWCFG block but a separate register set.

The missing registers are added in the a6xx.xml.h file that would
require a subsequent sync and the non-existent hwcfg is handled
in a6xx_set_hwcg().

The A750 GPU info are added under the adreno_is_a750() macro and
the ADRENO_7XX_GEN3 family id.

Signed-off-by: Neil Armstrong 
---
 drivers/gpu/drm/msm/adreno/a6xx.xml.h  |  8 
 drivers/gpu/drm/msm/adreno/a6xx_gmu.c  |  2 ++
 drivers/gpu/drm/msm/adreno/a6xx_gpu.c  | 29 ++---
 drivers/gpu/drm/msm/adreno/adreno_device.c | 14 ++
 drivers/gpu/drm/msm/adreno/adreno_gpu.h|  9 -
 5 files changed, 58 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/msm/adreno/a6xx.xml.h 
b/drivers/gpu/drm/msm/adreno/a6xx.xml.h
index 863b5e3b0e67..c4db4e0c0819 100644
--- a/drivers/gpu/drm/msm/adreno/a6xx.xml.h
+++ b/drivers/gpu/drm/msm/adreno/a6xx.xml.h
@@ -1725,6 +1725,8 @@ static inline uint32_t 
REG_A6XX_RBBM_PERFCTR_RBBM_SEL(uint32_t i0) { return 0x00
 
 #define REG_A6XX_RBBM_BLOCK_SW_RESET_CMD2  0x0046
 
+#define REG_A7XX_RBBM_CLOCK_CNTL_GLOBAL
0x00ad
+
 #define REG_A6XX_RBBM_CLOCK_CNTL   0x00ae
 
 #define REG_A6XX_RBBM_CLOCK_CNTL_SP0   0x00b0
@@ -1939,12 +1941,18 @@ static inline uint32_t 
REG_A6XX_RBBM_PERFCTR_RBBM_SEL(uint32_t i0) { return 0x00
 
 #define REG_A6XX_RBBM_CLOCK_HYST_HLSQ  0x011d
 
+#define REG_A7XX_RBBM_CGC_GLOBAL_LOAD_CMD  0x011e
+
+#define REG_A7XX_RBBM_CGC_P2S_TRIG_CMD 0x011f
+
 #define REG_A6XX_RBBM_CLOCK_CNTL_TEX_FCHE  0x0120
 
 #define REG_A6XX_RBBM_CLOCK_DELAY_TEX_FCHE 0x0121
 
 #define REG_A6XX_RBBM_CLOCK_HYST_TEX_FCHE  0x0122
 
+#define REG_A7XX_RBBM_CGC_P2S_STATUS   0x0122
+
 #define REG_A7XX_RBBM_CLOCK_HYST2_VFD  0x012f
 
 #define REG_A6XX_RBBM_LPAC_GBIF_CLIENT_QOS_CNTL
0x05ff
diff --git a/drivers/gpu/drm/msm/adreno/a6xx_gmu.c 
b/drivers/gpu/drm/msm/adreno/a6xx_gmu.c
index 8c4900444b2c..325881d8ff08 100644
--- a/drivers/gpu/drm/msm/adreno/a6xx_gmu.c
+++ b/drivers/gpu/drm/msm/adreno/a6xx_gmu.c
@@ -842,6 +842,8 @@ static int a6xx_gmu_fw_start(struct a6xx_gmu *gmu, unsigned 
int state)
 */
if (adreno_is_a740(adreno_gpu))
chipid_min = 2;
+   else if (adreno_is_a750(adreno_gpu))
+   chipid_min = 9;
else
return -EINVAL;
 
diff --git a/drivers/gpu/drm/msm/adreno/a6xx_gpu.c 
b/drivers/gpu/drm/msm/adreno/a6xx_gpu.c
index c0bc924cd302..472991584053 100644
--- a/drivers/gpu/drm/msm/adreno/a6xx_gpu.c
+++ b/drivers/gpu/drm/msm/adreno/a6xx_gpu.c
@@ -958,10 +958,11 @@ static void a6xx_set_hwcg(struct msm_gpu *gpu, bool state)
struct a6xx_gpu *a6xx_gpu = to_a6xx_gpu(adreno_gpu);
struct a6xx_gmu *gmu = _gpu->gmu;
const struct adreno_reglist *reg;
+   bool skip_programming = !(adreno_gpu->info->hwcg || 
adreno_is_a7xx(adreno_gpu));
unsigned int i;
u32 val, clock_cntl_on, cgc_mode;
 
-   if (!adreno_gpu->info->hwcg)
+   if (skip_programming)
return;
 
if (adreno_is_a630(adreno_gpu))
@@ -982,6 +983,25 @@ static void a6xx_set_hwcg(struct msm_gpu *gpu, bool state)
  state ? 0x : 0);
}
 
+   if (!adreno_gpu->info->hwcg) {
+   gpu_write(gpu, REG_A7XX_RBBM_CLOCK_CNTL_GLOBAL, 1);
+   gpu_write(gpu, REG_A7XX_RBBM_CGC_GLOBAL_LOAD_CMD, state ? 1 : 
0);
+
+   if (state) {
+   gpu_write(gpu, REG_A7XX_RBBM_CGC_P2S_TRIG_CMD, 1);
+
+   if (gpu_poll_timeout(gpu, REG_A7XX_RBBM_CGC_P2S_STATUS, 
val,
+val & BIT(0), 1, 10)) {
+   dev_err(>pdev->dev, "RBBM_CGC_P2S_STATUS 
TXDONE Poll failed\n");
+   return;
+   }
+
+   gpu_write(gpu, REG_A7XX_RBBM_CLOCK_CNTL_GLOBAL, 0);
+   }
+
+   return;
+   }
+
val = gpu_read(gpu, REG_A6XX_RBBM_CLOCK_CNTL);
 
/* Don't re-program the registers if they are already correct */
@@ -1239,7 +1259,9 @@ static void a6xx_set_cp_protect(struct msm_gpu *gpu)
count = ARRAY_SIZE(a660_protect);
count_max = 48;
BUILD_BUG_ON(ARRAY_SIZE(a660_protect) > 48);
-   } else if (adreno_is_a730(adreno_gpu) || adreno_is_a740(adreno_gpu)) {
+   } else if (adreno_is_a730(adre

[PATCH 1/5] dt-bindings: display/msm/gmu: Document Adreno 750 GMU

2024-02-12 Thread Neil Armstrong
Document the Adreno 750 GMU found on the SM8650 platform.

Signed-off-by: Neil Armstrong 
---
 Documentation/devicetree/bindings/display/msm/gmu.yaml | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Documentation/devicetree/bindings/display/msm/gmu.yaml 
b/Documentation/devicetree/bindings/display/msm/gmu.yaml
index 4e1c25b42908..b3837368a260 100644
--- a/Documentation/devicetree/bindings/display/msm/gmu.yaml
+++ b/Documentation/devicetree/bindings/display/msm/gmu.yaml
@@ -224,6 +224,7 @@ allOf:
 enum:
   - qcom,adreno-gmu-730.1
   - qcom,adreno-gmu-740.1
+  - qcom,adreno-gmu-750.1
 then:
   properties:
 reg:

-- 
2.34.1



[PATCH 0/5] drm/msm: Add support for the A750 GPU found on the SM8650 platform

2024-02-12 Thread Neil Armstrong
Unlike the the very close A740 GPU on the SM8550 SoC, the A750 GPU
doesn't have an HWCFG block but a separate register set.

The missing registers are added in the a6xx.xml.h file that would
require a subsequent sync and the non-existent hwcfg is handled
in a6xx_set_hwcg().

The A750 GPU info are added under the adreno_is_a750() macro and
the ADRENO_7XX_GEN3 family id.

This adds:
- the GMU and SMMU bindings
- DRM driver changes
- DT nodes

Dependencies: None

Tested using Mesa's !26934 Merge Request [0] on the SM8650-QRD
and with kmscube & vkcube to test basic rendering.

[0] https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26934

Signed-off-by: Neil Armstrong 
---
Neil Armstrong (5):
  dt-bindings: display/msm/gmu: Document Adreno 750 GMU
  dt-bindings: arm-smmu: Document SM8650 GPU SMMU
  drm: msm: add support for A750 GPU
  arm64: dts: qcom: sm8650: add GPU nodes
  arm64: dts: qcom: sm8650-qrd: enable GPU

 .../devicetree/bindings/display/msm/gmu.yaml   |   1 +
 .../devicetree/bindings/iommu/arm,smmu.yaml|   7 +-
 arch/arm64/boot/dts/qcom/sm8650-qrd.dts|   8 +
 arch/arm64/boot/dts/qcom/sm8650.dtsi   | 169 +
 drivers/gpu/drm/msm/adreno/a6xx.xml.h  |   8 +
 drivers/gpu/drm/msm/adreno/a6xx_gmu.c  |   2 +
 drivers/gpu/drm/msm/adreno/a6xx_gpu.c  |  29 +++-
 drivers/gpu/drm/msm/adreno/adreno_device.c |  14 ++
 drivers/gpu/drm/msm/adreno/adreno_gpu.h|   9 +-
 9 files changed, 241 insertions(+), 6 deletions(-)
---
base-commit: 84baf172e2fa30d6d6d0fb8ed076b47e836b74f1
change-id: 20240208-topic-sm8650-gpu-489d5e2c2b17

Best regards,
-- 
Neil Armstrong 



Re: [PATCH][next] drm/msm/dp: Fix spelling mistake "enale" -> "enable"

2024-02-12 Thread neil . armstrong

On 12/02/2024 10:16, Colin Ian King wrote:

There is a spelling mistake in a drm_dbg_dp message. Fix it.

Signed-off-by: Colin Ian King 
---
  drivers/gpu/drm/msm/dp/dp_ctrl.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/msm/dp/dp_ctrl.c b/drivers/gpu/drm/msm/dp/dp_ctrl.c
index 03bbdf865d26..320f17fce9a6 100644
--- a/drivers/gpu/drm/msm/dp/dp_ctrl.c
+++ b/drivers/gpu/drm/msm/dp/dp_ctrl.c
@@ -1409,7 +1409,7 @@ static int dp_ctrl_link_clk_enable(struct dp_ctrl 
*dp_ctrl)
  
  	ctrl->link_clks_on = true;
  
-	drm_dbg_dp(ctrl->drm_dev, "enale link clocks\n");

+   drm_dbg_dp(ctrl->drm_dev, "enable link clocks\n");
drm_dbg_dp(ctrl->drm_dev, "stream_clks:%s link_clks:%s core_clks:%s\n",
   ctrl->stream_clks_on ? "on" : "off",
   ctrl->link_clks_on ? "on" : "off",


Reviewed-by: Neil Armstrong 


Re: [PATCH] drm/bridge: properly refcount DT nodes in aux bridge drivers

2023-12-18 Thread Neil Armstrong

On 17/12/2023 00:59, Dmitry Baryshkov wrote:

The aux-bridge and aux-hpd-bridge drivers didn't call of_node_get() on
the device nodes further used for dev->of_node and platform data. When
bridge devices are released, the reference counts are decreased,
resulting in refcount underflow / use-after-free warnings. Get
corresponding refcounts during AUX bridge allocation.

Reported-by: Luca Weiss 
Fixes: 2a04739139b2 ("drm/bridge: add transparent bridge helper")
Fixes: 26f4bac3d884 ("drm/bridge: aux-hpd: Replace of_device.h with explicit 
include")
Signed-off-by: Dmitry Baryshkov 
---
  drivers/gpu/drm/bridge/aux-bridge.c | 2 +-
  drivers/gpu/drm/bridge/aux-hpd-bridge.c | 4 ++--
  2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/bridge/aux-bridge.c 
b/drivers/gpu/drm/bridge/aux-bridge.c
index 49d7c2ab1ecc..54d721db0ea6 100644
--- a/drivers/gpu/drm/bridge/aux-bridge.c
+++ b/drivers/gpu/drm/bridge/aux-bridge.c
@@ -57,7 +57,7 @@ int drm_aux_bridge_register(struct device *parent)
adev->id = ret;
adev->name = "aux_bridge";
adev->dev.parent = parent;
-   adev->dev.of_node = parent->of_node;
+   adev->dev.of_node = of_node_get(parent->of_node);
adev->dev.release = drm_aux_bridge_release;
  
  	ret = auxiliary_device_init(adev);

diff --git a/drivers/gpu/drm/bridge/aux-hpd-bridge.c 
b/drivers/gpu/drm/bridge/aux-hpd-bridge.c
index 1999a053d59b..bb55f697a181 100644
--- a/drivers/gpu/drm/bridge/aux-hpd-bridge.c
+++ b/drivers/gpu/drm/bridge/aux-hpd-bridge.c
@@ -68,9 +68,9 @@ struct device *drm_dp_hpd_bridge_register(struct device 
*parent,
adev->id = ret;
adev->name = "dp_hpd_bridge";
adev->dev.parent = parent;
-   adev->dev.of_node = parent->of_node;
+   adev->dev.of_node = of_node_get(parent->of_node);
adev->dev.release = drm_aux_hpd_bridge_release;
-   adev->dev.platform_data = np;
+   adev->dev.platform_data = of_node_get(np);
  
  	ret = auxiliary_device_init(adev);

if (ret) {


Reviewed-by: Neil Armstrong 


Re: [PATCH 7/9] arm64: dts: qcom: sm8150: add USB-C ports to the USB+DP QMP PHY

2023-12-13 Thread neil . armstrong

On 11/12/2023 10:50, Konrad Dybcio wrote:

On 11.12.2023 10:46, Dmitry Baryshkov wrote:

On Mon, 11 Dec 2023 at 11:33, Konrad Dybcio  wrote:


On 10.12.2023 00:21, Dmitry Baryshkov wrote:

Expand Combo USB+DP QMP PHY device node with the OF ports required to
support USB-C / DisplayPort switching.

Signed-off-by: Dmitry Baryshkov 
---
  arch/arm64/boot/dts/qcom/sm8150.dtsi | 23 +++
  1 file changed, 23 insertions(+)

diff --git a/arch/arm64/boot/dts/qcom/sm8150.dtsi 
b/arch/arm64/boot/dts/qcom/sm8150.dtsi
index ea7c92c0e405..38423a9f8408 100644
--- a/arch/arm64/boot/dts/qcom/sm8150.dtsi
+++ b/arch/arm64/boot/dts/qcom/sm8150.dtsi
@@ -3447,6 +3447,29 @@ usb_1_qmpphy: phy@88e8000 {
   #phy-cells = <1>;

   status = "disabled";
+
+ ports {
+ #address-cells = <1>;
+ #size-cells = <0>;
+
+ port@0 {
+ reg = <0>;
+ usb_1_qmpphy_out: endpoint {};

style 1

+ };
+
+ port@1 {
+ reg = <1>;
+
+ usb_1_qmpphy_usb_ss_in: endpoint {
+ };

style 2

+ };
+
+ port@2 {
+ reg = <2>;
+
+ usb_1_qmpphy_dp_in: endpoint {};

style 3

:(


Which one should I stick to?

style 2 seems to be used in 8650


I used style 2 for 8450/8550/8650 usb & dp ports, but the 3 styles are present 
in the qcom dts.

Neil



Konrad





Re: [PATCH 3/3] arm64: dts: qcom: sm8650: Add DisplayPort device nodes

2023-12-08 Thread Neil Armstrong

On 08/12/2023 04:38, Bjorn Andersson wrote:

On Thu, Dec 07, 2023 at 05:37:19PM +0100, Neil Armstrong wrote:

diff --git a/arch/arm64/boot/dts/qcom/sm8650.dtsi 
b/arch/arm64/boot/dts/qcom/sm8650.dtsi

[..]

+
+   mdss_dp0: displayport-controller@af54000 {
+   compatible = "qcom,sm8650-dp";
+   reg = <0 0xaf54000 0 0x200>,
+ <0 0xaf54200 0 0x200>,
+ <0 0xaf55000 0 0xc00>,
+ <0 0xaf56000 0 0x400>,
+ <0 0xaf57000 0 0x400>;
+
+   interrupts-extended = < 12>;
+
+   clocks = < DISP_CC_MDSS_AHB_CLK>,
+< DISP_CC_MDSS_DPTX0_AUX_CLK>,
+< DISP_CC_MDSS_DPTX0_LINK_CLK>,
+< 
DISP_CC_MDSS_DPTX0_LINK_INTF_CLK>,
+< 
DISP_CC_MDSS_DPTX0_PIXEL0_CLK>;
+   clock-names = "core_iface",
+ "core_aux",
+ "ctrl_link",
+ "ctrl_link_iface",
+ "stream_pixel";
+
+   assigned-clocks = < 
DISP_CC_MDSS_DPTX0_LINK_CLK_SRC>,
+ < 
DISP_CC_MDSS_DPTX0_PIXEL0_CLK_SRC>;
+   assigned-clock-parents = <_dp_qmpphy 
QMP_USB43DP_DP_LINK_CLK>,
+<_dp_qmpphy 
QMP_USB43DP_DP_VCO_DIV_CLK>;
+
+   operating-points-v2 = <_opp_table>;
+
+   power-domains = < RPMHPD_MX>;


Are you sure the DP TX block sits in MX? I'd expect this to be
RPMHPD_MMCX, and then the PHY partially in MX...


Hmm, yeah probably, will switch to MMCX




+
+   phys = <_dp_qmpphy QMP_USB43DP_DP_PHY>;
+   phy-names = "dp";
+
+   #sound-dai-cells = <0>;
+
+   status = "disabled";
+
+   ports {
+   #address-cells = <1>;
+   #size-cells = <0>;
+
+   port@0 {
+   reg = <0>;
+
+   mdss_dp0_in: endpoint {
+   remote-endpoint = 
<_intf0_out>;
+   };
+   };
+
+   port@1 {
+   reg = <1>;
+
+   mdss_dp0_out: endpoint {
+   };
+   };
+   };
+
+   dp_opp_table: opp-table {


Is there any reason why we keep sorting 'o' after 'p' in these nodes?


No, seems it's a copy-paste issue, will fix

Thanks,
Neil



Regards,
Bjorn




Re: [PATCH 3/3] arm64: dts: qcom: sm8650: Add DisplayPort device nodes

2023-12-08 Thread Neil Armstrong

On 07/12/2023 20:47, Konrad Dybcio wrote:



On 12/7/23 17:37, Neil Armstrong wrote:

Declare the displayport controller present on the Qualcomm SM8650 SoC
and connected to the USB3/DP Combo PHY.

Signed-off-by: Neil Armstrong 
---

[...]


+    clocks = < DISP_CC_MDSS_AHB_CLK>,
+ < DISP_CC_MDSS_DPTX0_AUX_CLK>,
+ < DISP_CC_MDSS_DPTX0_LINK_CLK>,
+ < DISP_CC_MDSS_DPTX0_LINK_INTF_CLK>,
+ < DISP_CC_MDSS_DPTX0_PIXEL0_CLK>;

What about PIXEL1 clocks?


PIXEL1 is not defined yet in the bindings, but available since SM8150...

# grep -l PIXEL1 include/dt-bindings/ -R
include/dt-bindings/clock/qcom,dispcc-sm8350.h
include/dt-bindings/clock/qcom,sm8650-dispcc.h
include/dt-bindings/clock/qcom,dispcc-sm8250.h
include/dt-bindings/clock/qcom,sm8450-dispcc.h
include/dt-bindings/clock/qcom,sm8550-dispcc.h
include/dt-bindings/clock/qcom,dispcc-sdm845.h
include/dt-bindings/clock/qcom,dispcc-sm8150.h
include/dt-bindings/clock/qcom,dispcc-sc8280xp.h




[...]


+    opp-16200 {
+    opp-hz = /bits/ 64 <16200>;
+    required-opps = <_opp_low_svs_d1>;
+    };
+
+    opp-27000 {
+    opp-hz = /bits/ 64 <27000>;
+    required-opps = <_opp_low_svs>;
+    };
+
+    opp-54000 {
+    opp-hz = /bits/ 64 <54000>;
+    required-opps = <_opp_svs_l1>;
+    };
+
+    opp-81000 {
+    opp-hz = /bits/ 64 <81000>;
+    required-opps = <_opp_nom>;
+    };
+    };
+    };
  };
  dispcc: clock-controller@af0 {
@@ -2996,8 +3086,8 @@ dispcc: clock-controller@af0 {
   <_dsi0_phy 1>,
   <_dsi1_phy 0>,
   <_dsi1_phy 1>,
- <0>, /* dp0 */
- <0>,
+ <_dp_qmpphy QMP_USB43DP_DP_LINK_CLK>,
+ <_dp_qmpphy QMP_USB43DP_DP_VCO_DIV_CLK>,
   <0>, /* dp1 */
   <0>,
   <0>, /* dp2 */

I noticed that this is not in line with your mdss patch [1]
where there are only two DP INTFs available.. Unless all of
these controllers can work using some sharing/only some at
one time...


So, yes there's some more eDP PHYs and MDSS Interfaces, like SM8450 and SM8550 
BTW,
but they are not used on the current SoC Packages, they will perhaps be used
in SoC variants, but for now there's clock inputs but no physical output
for those DP interfaces so they're ignored, in upstream and downstream.

$ grep -l -E "DPTX[1-3]" include/dt-bindings/clock/qcom,* -R
include/dt-bindings/clock/qcom,sm8450-dispcc.h
include/dt-bindings/clock/qcom,sm8550-dispcc.h
include/dt-bindings/clock/qcom,sm8650-dispcc.h

Neil



Konrad

[1] 
https://lore.kernel.org/all/20231030-topic-sm8650-upstream-mdss-v2-5-43f1887c8...@linaro.org/




[PATCH 3/3] arm64: dts: qcom: sm8650: Add DisplayPort device nodes

2023-12-07 Thread Neil Armstrong
Declare the displayport controller present on the Qualcomm SM8650 SoC
and connected to the USB3/DP Combo PHY.

Signed-off-by: Neil Armstrong 
---
 arch/arm64/boot/dts/qcom/sm8650.dtsi | 120 ++-
 1 file changed, 118 insertions(+), 2 deletions(-)

diff --git a/arch/arm64/boot/dts/qcom/sm8650.dtsi 
b/arch/arm64/boot/dts/qcom/sm8650.dtsi
index d1442b100e79..b2a50686d419 100644
--- a/arch/arm64/boot/dts/qcom/sm8650.dtsi
+++ b/arch/arm64/boot/dts/qcom/sm8650.dtsi
@@ -2781,6 +2781,14 @@ dpu_intf2_out: endpoint {
remote-endpoint = 
<_dsi1_in>;
};
};
+
+   port@2 {
+   reg = <2>;
+
+   dpu_intf0_out: endpoint {
+   remote-endpoint = 
<_dp0_in>;
+   };
+   };
};
 
mdp_opp_table: opp-table {
@@ -2982,6 +2990,88 @@ mdss_dsi1_phy: phy@ae97000 {
 
status = "disabled";
};
+
+   mdss_dp0: displayport-controller@af54000 {
+   compatible = "qcom,sm8650-dp";
+   reg = <0 0xaf54000 0 0x200>,
+ <0 0xaf54200 0 0x200>,
+ <0 0xaf55000 0 0xc00>,
+ <0 0xaf56000 0 0x400>,
+ <0 0xaf57000 0 0x400>;
+
+   interrupts-extended = < 12>;
+
+   clocks = < DISP_CC_MDSS_AHB_CLK>,
+< DISP_CC_MDSS_DPTX0_AUX_CLK>,
+< DISP_CC_MDSS_DPTX0_LINK_CLK>,
+< 
DISP_CC_MDSS_DPTX0_LINK_INTF_CLK>,
+< 
DISP_CC_MDSS_DPTX0_PIXEL0_CLK>;
+   clock-names = "core_iface",
+ "core_aux",
+ "ctrl_link",
+ "ctrl_link_iface",
+ "stream_pixel";
+
+   assigned-clocks = < 
DISP_CC_MDSS_DPTX0_LINK_CLK_SRC>,
+ < 
DISP_CC_MDSS_DPTX0_PIXEL0_CLK_SRC>;
+   assigned-clock-parents = <_dp_qmpphy 
QMP_USB43DP_DP_LINK_CLK>,
+<_dp_qmpphy 
QMP_USB43DP_DP_VCO_DIV_CLK>;
+
+   operating-points-v2 = <_opp_table>;
+
+   power-domains = < RPMHPD_MX>;
+
+   phys = <_dp_qmpphy QMP_USB43DP_DP_PHY>;
+   phy-names = "dp";
+
+   #sound-dai-cells = <0>;
+
+   status = "disabled";
+
+   ports {
+   #address-cells = <1>;
+   #size-cells = <0>;
+
+   port@0 {
+   reg = <0>;
+
+   mdss_dp0_in: endpoint {
+   remote-endpoint = 
<_intf0_out>;
+   };
+   };
+
+   port@1 {
+   reg = <1>;
+
+   mdss_dp0_out: endpoint {
+   };
+   };
+   };
+
+   dp_opp_table: opp-table {
+   compatible = "operating-points-v2";
+
+   opp-16200 {
+   opp-hz = /bits/ 64 <16200>;
+   required-opps = 
<_opp_low_svs_d1>;
+   };
+
+   opp-27000 {
+   opp-hz = /bits/ 64 <27000>;
+   required-op

[PATCH 2/3] drm/msm/dp: Add DisplayPort controller for SM8650

2023-12-07 Thread Neil Armstrong
The Qualcomm SM8650 platform comes with a DisplayPort controller
with a different base offset than the previous SM8550 SoC,
add support for this in the DisplayPort driver.

Signed-off-by: Neil Armstrong 
---
 drivers/gpu/drm/msm/dp/dp_display.c | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/drivers/gpu/drm/msm/dp/dp_display.c 
b/drivers/gpu/drm/msm/dp/dp_display.c
index b57ff6c3215d..923517046ab6 100644
--- a/drivers/gpu/drm/msm/dp/dp_display.c
+++ b/drivers/gpu/drm/msm/dp/dp_display.c
@@ -168,6 +168,11 @@ static const struct msm_dp_desc sm8350_dp_descs[] = {
{}
 };
 
+static const struct msm_dp_desc sm8650_dp_descs[] = {
+   { .io_start = 0x0af54000, .id = MSM_DP_CONTROLLER_0, .connector_type = 
DRM_MODE_CONNECTOR_DisplayPort },
+   {}
+};
+
 static const struct of_device_id dp_dt_match[] = {
{ .compatible = "qcom,sc7180-dp", .data = _dp_descs },
{ .compatible = "qcom,sc7280-dp", .data = _dp_descs },
@@ -178,6 +183,7 @@ static const struct of_device_id dp_dt_match[] = {
{ .compatible = "qcom,sc8280xp-edp", .data = _edp_descs },
{ .compatible = "qcom,sdm845-dp", .data = _dp_descs },
{ .compatible = "qcom,sm8350-dp", .data = _dp_descs },
+   { .compatible = "qcom,sm8650-dp", .data = _dp_descs },
{}
 };
 

-- 
2.34.1



[PATCH 1/3] dt-bindings: display: msm: dp-controller: document SM8650 compatible

2023-12-07 Thread Neil Armstrong
Document the DisplayPort controller found in the Qualcomm SM8650 SoC,
the Controller base addresses and layout differ and thus cannot use
the SM8350 compatible as fallback.

Signed-off-by: Neil Armstrong 
---
 Documentation/devicetree/bindings/display/msm/dp-controller.yaml| 1 +
 Documentation/devicetree/bindings/display/msm/qcom,sm8650-mdss.yaml | 6 ++
 2 files changed, 7 insertions(+)

diff --git a/Documentation/devicetree/bindings/display/msm/dp-controller.yaml 
b/Documentation/devicetree/bindings/display/msm/dp-controller.yaml
index dbe398f84ffb..93ded71c52d7 100644
--- a/Documentation/devicetree/bindings/display/msm/dp-controller.yaml
+++ b/Documentation/devicetree/bindings/display/msm/dp-controller.yaml
@@ -26,6 +26,7 @@ properties:
   - qcom,sc8280xp-edp
   - qcom,sdm845-dp
   - qcom,sm8350-dp
+  - qcom,sm8650-dp
   - items:
   - enum:
   - qcom,sm8250-dp
diff --git 
a/Documentation/devicetree/bindings/display/msm/qcom,sm8650-mdss.yaml 
b/Documentation/devicetree/bindings/display/msm/qcom,sm8650-mdss.yaml
index 5638c1ea692e..bd9dc93d 100644
--- a/Documentation/devicetree/bindings/display/msm/qcom,sm8650-mdss.yaml
+++ b/Documentation/devicetree/bindings/display/msm/qcom,sm8650-mdss.yaml
@@ -41,6 +41,12 @@ patternProperties:
   compatible:
 const: qcom,sm8650-dpu
 
+  "^displayport-controller@[0-9a-f]+$":
+type: object
+properties:
+  compatible:
+const: qcom,sm8650-dp
+
   "^dsi@[0-9a-f]+$":
 type: object
 properties:

-- 
2.34.1



[PATCH 0/3] arm64: qcom: sm8650: add support for DisplayPort Controller

2023-12-07 Thread Neil Armstrong
This adds support for the DisplayPort Controller found in the SM8650
SoC, but it requires a specific compatible because the registers offsets
has changed since SM8550.

This also updates the SM8650 MDSS bindings to allow a displayport subnode,
and adds the necessary changes in the SM8650 DTSI to declare the DisplayPort
Controller.

Dependencies:
- DT: 
https://lore.kernel.org/all/20231130-topic-sm8650-upstream-dt-v5-0-b25fb781d...@linaro.org/

Signed-off-by: Neil Armstrong 
---
Neil Armstrong (3):
  dt-bindings: display: msm: dp-controller: document SM8650 compatible
  drm/msm/dp: Add DisplayPort controller for SM8650
  arm64: dts: qcom: sm8650: Add DisplayPort device nodes

 .../bindings/display/msm/dp-controller.yaml|   1 +
 .../bindings/display/msm/qcom,sm8650-mdss.yaml |   6 ++
 arch/arm64/boot/dts/qcom/sm8650.dtsi   | 120 -
 drivers/gpu/drm/msm/dp/dp_display.c|   6 ++
 4 files changed, 131 insertions(+), 2 deletions(-)
---
base-commit: 9ea914fd2cc702e8be88c0666d4df3e58ffe8131
change-id: 20231207-topic-sm8650-upstream-dp-ab1fc1bf0c76

Best regards,
-- 
Neil Armstrong 



Re: [Freedreno] [RFC PATCH 03/10] drm/mipi-dsi: add API for manual control over the DSI link power state

2023-11-29 Thread Neil Armstrong

On 08/11/2023 16:58, Laurent Pinchart wrote:

On Wed, Nov 08, 2023 at 04:34:39PM +0100, Maxime Ripard wrote:

On Tue, Nov 07, 2023 at 04:26:34PM +0100, Greg Kroah-Hartman wrote:

On Tue, Nov 07, 2023 at 01:18:14PM +0100, Maxime Ripard wrote:

On Tue, Nov 07, 2023 at 12:22:21PM +0100, Greg Kroah-Hartman wrote:

On Tue, Nov 07, 2023 at 11:57:49AM +0100, Maxime Ripard wrote:

+GKH


Why?  I don't see a question for me here, sorry.


I guess the question is: we have a bus with various power states
(powered off, low power, high speed)


Great, have fun!  And is this per-device or per-bus-instance?


Per bus instance


To be precise, those power states are link states. They don't
necessarily translate directly to device power states, and they're not
so much about power management than speed (and bus turn-around for
reads) management.


So the DSI core should support handling and tracking the current DSI
link state, and DSI devices should be able to request for a particular
link state.



Also, while DSI allows for multiple peripherals on a bus, the link is
point-to-point, with the peripherals being all behind a single DSI RX. >

low power is typically used to send commands to a device, high speed to
transmit pixels, but still allows to send commands.


Low power (LP) is a link state where commands can be transmitted at a
low speed, as opposed to the high speed (HS) link state that is used to
transmit both video data and commands at high speed. Any device-to-host
data transfer (in response to read commands) occurs exclusively in LP
mode (at least with DSI v1.3, I don't have acces to newer
specifications).


Depending on the devices, there's different requirements about the state
devices expect the bus to be in to send commands. Some will need to send
all the commands in the low power state, some don't care, etc. See
the mail I was replying too for more details.

We've tried so far to model that in KMS itself, so the framework the
drivers would register too, but we're kind of reaching the limits of
what we can do there. It also feels to me that "the driver can't access
its device" is more of a problem for the bus to solve rather than the
framework.


This is up to the specific bus to resolve, there's nothing special
needed in the driver core for it, right?


Yeah, we weren't really looking to handle this into the driver core, but
rather if there was a set of guidelines or feedback on implementing
those kind of features for a bus.


Do you agree? Are you aware of any other bus in Linux with similar
requirements we could look at? Or any suggestion on how to solve it?


There might be others, yes, look at how the dynamic power management
works for different devices on most busses, that might help you out
here.


Thanks for the pointers, we'll have a look






Re: [Freedreno] [PATCH v6 1/6] drm/bridge: add transparent bridge helper

2023-11-21 Thread Neil Armstrong
,
+  const struct auxiliary_device_id *id)
+{
+   struct drm_aux_bridge_data *data;
+
+   data = devm_kzalloc(>dev, sizeof(*data), GFP_KERNEL);
+   if (!data)
+   return -ENOMEM;
+
+   data->dev = >dev;
+   data->next_bridge = devm_drm_of_get_bridge(>dev, 
auxdev->dev.of_node, 0, 0);
+   if (IS_ERR(data->next_bridge))
+   return dev_err_probe(>dev, PTR_ERR(data->next_bridge),
+"failed to acquire drm_bridge\n");
+
+   data->bridge.funcs = _aux_bridge_funcs;
+   data->bridge.of_node = data->dev->of_node;
+
+   return devm_drm_bridge_add(data->dev, >bridge);
+}
+
+static const struct auxiliary_device_id drm_aux_bridge_table[] = {
+   { .name = KBUILD_MODNAME ".aux_bridge" },
+   {},
+};
+MODULE_DEVICE_TABLE(auxiliary, drm_aux_bridge_table);
+
+static struct auxiliary_driver drm_aux_bridge_drv = {
+   .name = "aux_bridge",
+   .id_table = drm_aux_bridge_table,
+   .probe = drm_aux_bridge_probe,
+};
+module_auxiliary_driver(drm_aux_bridge_drv);
+
+MODULE_AUTHOR("Dmitry Baryshkov ");
+MODULE_DESCRIPTION("DRM transparent bridge");
+MODULE_LICENSE("GPL");
diff --git a/include/drm/bridge/aux-bridge.h b/include/drm/bridge/aux-bridge.h
new file mode 100644
index ..441ab3f0e920
--- /dev/null
+++ b/include/drm/bridge/aux-bridge.h
@@ -0,0 +1,19 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright (C) 2023 Linaro Ltd.
+ *
+ * Author: Dmitry Baryshkov 
+ */
+#ifndef DRM_AUX_BRIDGE_H
+#define DRM_AUX_BRIDGE_H
+
+#if IS_ENABLED(CONFIG_DRM_AUX_BRIDGE)
+int drm_aux_bridge_register(struct device *parent);
+#else
+static inline int drm_aux_bridge_register(struct device *parent)
+{
+   return 0;
+}
+#endif
+
+#endif


LGTM:
Reviewed-by: Neil Armstrong 


Re: [Freedreno] [PATCH v6 4/6] drm/bridge: implement generic DP HPD bridge

2023-11-21 Thread Neil Armstrong
struct device *dev, enum drm_connector_status 
status)
+{
+   struct auxiliary_device *adev = to_auxiliary_dev(dev);
+   struct drm_aux_hpd_bridge_data *data = auxiliary_get_drvdata(adev);
+
+   if (!data)
+   return;
+
+   drm_bridge_hpd_notify(>bridge, status);
+}
+EXPORT_SYMBOL_GPL(drm_aux_hpd_bridge_notify);
+
+static int drm_aux_hpd_bridge_attach(struct drm_bridge *bridge,
+   enum drm_bridge_attach_flags flags)
+{
+   return flags & DRM_BRIDGE_ATTACH_NO_CONNECTOR ? 0 : -EINVAL;
+}
+
+static const struct drm_bridge_funcs drm_aux_hpd_bridge_funcs = {
+   .attach = drm_aux_hpd_bridge_attach,
+};
+
+static int drm_aux_hpd_bridge_probe(struct auxiliary_device *auxdev,
+  const struct auxiliary_device_id *id)
+{
+   struct drm_aux_hpd_bridge_data *data;
+
+   data = devm_kzalloc(>dev, sizeof(*data), GFP_KERNEL);
+   if (!data)
+   return -ENOMEM;
+
+   data->dev = >dev;
+   data->bridge.funcs = _aux_hpd_bridge_funcs;
+   data->bridge.of_node = dev_get_platdata(data->dev);
+   data->bridge.ops = DRM_BRIDGE_OP_HPD;
+   data->bridge.type = id->driver_data;
+
+   auxiliary_set_drvdata(auxdev, data);
+
+   return devm_drm_bridge_add(data->dev, >bridge);
+}
+
+static const struct auxiliary_device_id drm_aux_hpd_bridge_table[] = {
+   { .name = KBUILD_MODNAME ".dp_hpd_bridge", .driver_data = 
DRM_MODE_CONNECTOR_DisplayPort, },
+   {},
+};
+MODULE_DEVICE_TABLE(auxiliary, drm_aux_hpd_bridge_table);
+
+static struct auxiliary_driver drm_aux_hpd_bridge_drv = {
+   .name = "aux_hpd_bridge",
+   .id_table = drm_aux_hpd_bridge_table,
+   .probe = drm_aux_hpd_bridge_probe,
+};
+module_auxiliary_driver(drm_aux_hpd_bridge_drv);
+
+MODULE_AUTHOR("Dmitry Baryshkov ");
+MODULE_DESCRIPTION("DRM HPD bridge");
+MODULE_LICENSE("GPL");
diff --git a/include/drm/bridge/aux-bridge.h b/include/drm/bridge/aux-bridge.h
index 441ab3f0e920..33adaf4e4daa 100644
--- a/include/drm/bridge/aux-bridge.h
+++ b/include/drm/bridge/aux-bridge.h
@@ -7,6 +7,8 @@
  #ifndef DRM_AUX_BRIDGE_H
  #define DRM_AUX_BRIDGE_H
  
+#include 

+
  #if IS_ENABLED(CONFIG_DRM_AUX_BRIDGE)
  int drm_aux_bridge_register(struct device *parent);
  #else
@@ -16,4 +18,20 @@ static inline int drm_aux_bridge_register(struct device 
*parent)
  }
  #endif
  
+#if IS_ENABLED(CONFIG_DRM_AUX_HPD_BRIDGE)

+struct device *drm_dp_hpd_bridge_register(struct device *parent,
+ struct device_node *np);
+void drm_aux_hpd_bridge_notify(struct device *dev, enum drm_connector_status 
status);
+#else
+static inline struct device *drm_dp_hpd_bridge_register(struct device *parent,
+   struct device_node *np)
+{
+   return 0;
+}
+
+static inline void drm_aux_hpd_bridge_notify(struct device *dev, enum 
drm_connector_status status)
+{
+}
+#endif
+
  #endif


LGTM:
Acked-by: Neil Armstrong 


Re: [Freedreno] [PATCH v3 2/6] dt-bindings: display/msm: Add reg bus and rotator interconnects

2023-11-06 Thread Neil Armstrong

Hi,

On 28/09/2023 13:35, Dmitry Baryshkov wrote:

From: Konrad Dybcio 

Apart from the already handled data bus (MAS_MDP_Pn<->DDR), there are
other connection paths:
- a path that connects rotator block to the DDR.
- a path that needs to be handled to ensure MDSS register access
   functions properly, namely the "reg bus", a.k.a the CPU-MDSS CFG
   interconnect.

Describe these paths bindings to allow using them in device trees and in
the driver

Signed-off-by: Konrad Dybcio 
Acked-by: Krzysztof Kozlowski 
Signed-off-by: Dmitry Baryshkov 
---
  Documentation/devicetree/bindings/display/msm/mdss-common.yaml | 2 ++
  1 file changed, 2 insertions(+)

diff --git a/Documentation/devicetree/bindings/display/msm/mdss-common.yaml 
b/Documentation/devicetree/bindings/display/msm/mdss-common.yaml
index f69196e4cc76..6b4ce08a60dc 100644
--- a/Documentation/devicetree/bindings/display/msm/mdss-common.yaml
+++ b/Documentation/devicetree/bindings/display/msm/mdss-common.yaml
@@ -66,12 +66,14 @@ properties:
  items:
- description: Interconnect path from mdp0 (or a single mdp) port to 
the data bus
- description: Interconnect path from mdp1 port to the data bus
+  - description: Interconnect path from CPU to the reg bus
  
interconnect-names:

  minItems: 1
  items:
- const: mdp0-mem
- const: mdp1-mem
+  - const: cpu-cfg
  
resets:

  items:


This is not enough, on sm8450 this still appears with patch applied:
arch/arm64/boot/dts/qcom/sm8450-hdk.dtb: display-subsystem@ae0: 
interconnects: [[182, 14, 0, 30, 3, 0], [182, 14, 0, 30, 3, 0], [53, 2, 3, 183, 
14, 3]] is too long
from schema $id: 
http://devicetree.org/schemas/display/msm/qcom,sm8450-mdss.yaml#
arch/arm64/boot/dts/qcom/sm8450-hdk.dtb: display-subsystem@ae0: 
interconnect-names: ['mdp0-mem', 'mdp1-mem', 'cpu-cfg'] is too long
from schema $id: 
http://devicetree.org/schemas/display/msm/qcom,sm8450-mdss.yaml#

This is also needed:
==><
diff --git 
a/Documentation/devicetree/bindings/display/msm/qcom,sm8450-mdss.yaml 
b/Documentation/devicetree/bindings/display/msm/qcom,sm8450-mdss.yaml
index 001b26e65301..e94e8630cc85 100644
--- a/Documentation/devicetree/bindings/display/msm/qcom,sm8450-mdss.yaml
+++ b/Documentation/devicetree/bindings/display/msm/qcom,sm8450-mdss.yaml
@@ -30,10 +30,10 @@ properties:
 maxItems: 1

   interconnects:
-maxItems: 2
+maxItems: 3

   interconnect-names:
-maxItems: 2
+maxItems: 3

 patternProperties:
   "^display-controller@[0-9a-f]+$":
==

Thanks,
Neil


[Freedreno] [PATCH v2 4/8] dt-bindings: display: msm: document the SM8650 Mobile Display Subsystem

2023-10-30 Thread Neil Armstrong
Document the Mobile Display Subsystem (MDSS) on the SM8650 Platform.

Reviewed-by: Krzysztof Kozlowski 
Signed-off-by: Neil Armstrong 
---
 .../bindings/display/msm/qcom,sm8650-mdss.yaml | 322 +
 1 file changed, 322 insertions(+)

diff --git 
a/Documentation/devicetree/bindings/display/msm/qcom,sm8650-mdss.yaml 
b/Documentation/devicetree/bindings/display/msm/qcom,sm8650-mdss.yaml
new file mode 100644
index ..5638c1ea692e
--- /dev/null
+++ b/Documentation/devicetree/bindings/display/msm/qcom,sm8650-mdss.yaml
@@ -0,0 +1,322 @@
+# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/display/msm/qcom,sm8650-mdss.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Qualcomm SM8650 Display MDSS
+
+maintainers:
+  - Neil Armstrong 
+
+description:
+  SM8650 MSM Mobile Display Subsystem(MDSS), which encapsulates sub-blocks like
+  DPU display controller, DSI and DP interfaces etc.
+
+$ref: /schemas/display/msm/mdss-common.yaml#
+
+properties:
+  compatible:
+const: qcom,sm8650-mdss
+
+  clocks:
+items:
+  - description: Display AHB
+  - description: Display hf AXI
+  - description: Display core
+
+  iommus:
+maxItems: 1
+
+  interconnects:
+maxItems: 2
+
+  interconnect-names:
+maxItems: 2
+
+patternProperties:
+  "^display-controller@[0-9a-f]+$":
+type: object
+properties:
+  compatible:
+const: qcom,sm8650-dpu
+
+  "^dsi@[0-9a-f]+$":
+type: object
+properties:
+  compatible:
+items:
+  - const: qcom,sm8650-dsi-ctrl
+  - const: qcom,mdss-dsi-ctrl
+
+  "^phy@[0-9a-f]+$":
+type: object
+properties:
+  compatible:
+const: qcom,sm8650-dsi-phy-4nm
+
+required:
+  - compatible
+
+unevaluatedProperties: false
+
+examples:
+  - |
+#include 
+#include 
+#include 
+
+display-subsystem@ae0 {
+compatible = "qcom,sm8650-mdss";
+reg = <0x0ae0 0x1000>;
+reg-names = "mdss";
+
+resets = <_core_bcr>;
+
+power-domains = <_gdsc>;
+
+clocks = <_ahb_clk>,
+ <_axi_clk>,
+ <_mdp_clk>;
+clock-names = "bus", "nrt_bus", "core";
+
+interrupts = ;
+interrupt-controller;
+#interrupt-cells = <1>;
+
+iommus = <_smmu 0x1c00 0x2>;
+
+#address-cells = <1>;
+#size-cells = <1>;
+ranges;
+
+display-controller@ae01000 {
+compatible = "qcom,sm8650-dpu";
+reg = <0x0ae01000 0x8f000>,
+  <0x0aeb 0x2008>;
+reg-names = "mdp", "vbif";
+
+clocks = <_axi_clk>,
+ <_ahb_clk>,
+ <_mdp_lut_clk>,
+ <_mdp_clk>,
+ <_mdp_vsync_clk>;
+clock-names = "nrt_bus",
+  "iface",
+  "lut",
+  "core",
+  "vsync";
+
+assigned-clocks = <_mdp_vsync_clk>;
+assigned-clock-rates = <1920>;
+
+operating-points-v2 = <_opp_table>;
+power-domains = < RPMHPD_MMCX>;
+
+interrupt-parent = <>;
+interrupts = <0>;
+
+ports {
+#address-cells = <1>;
+#size-cells = <0>;
+
+port@0 {
+reg = <0>;
+dpu_intf1_out: endpoint {
+remote-endpoint = <_in>;
+};
+};
+
+port@1 {
+reg = <1>;
+dpu_intf2_out: endpoint {
+remote-endpoint = <_in>;
+};
+};
+};
+
+mdp_opp_table: opp-table {
+compatible = "operating-points-v2";
+
+opp-2 {
+opp-hz = /bits/ 64 <2>;
+required-opps = <_opp_low_svs>;
+};
+
+opp-32500 {
+opp-hz = /bits/ 64 <32500>;
+required-opps = <_opp_svs>;
+};
+
+opp-37500 {
+opp-hz = /bits/ 64 <37500>;
+required-opps = <_opp_svs_l1>;
+};
+
+opp-51400 {
+opp-hz = /bits/ 64 <51400>;
+required-opps = <_opp_nom>;
+};
+};
+};
+
+dsi@ae9

[Freedreno] [PATCH v2 6/8] drm/msm: mdss: add support for SM8650

2023-10-30 Thread Neil Armstrong
Add Mobile Display Subsystem (MDSS) support for the SM8650 platform.

Reviewed-by: Dmitry Baryshkov 
Signed-off-by: Neil Armstrong 
---
 drivers/gpu/drm/msm/msm_mdss.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/gpu/drm/msm/msm_mdss.c b/drivers/gpu/drm/msm/msm_mdss.c
index 6865db1e3ce8..33947a2e313c 100644
--- a/drivers/gpu/drm/msm/msm_mdss.c
+++ b/drivers/gpu/drm/msm/msm_mdss.c
@@ -621,6 +621,7 @@ static const struct of_device_id mdss_dt_match[] = {
{ .compatible = "qcom,sm8350-mdss", .data = _data },
{ .compatible = "qcom,sm8450-mdss", .data = _data },
{ .compatible = "qcom,sm8550-mdss", .data = _data },
+   { .compatible = "qcom,sm8650-mdss", .data = _data},
{}
 };
 MODULE_DEVICE_TABLE(of, mdss_dt_match);

-- 
2.34.1



[Freedreno] [PATCH v2 8/8] drm/msm: dsi: add support for DSI 2.8.0

2023-10-30 Thread Neil Armstrong
Add DSI Controller version 2.8.0 support for the SM8650 platform.

Reviewed-by: Dmitry Baryshkov 
Signed-off-by: Neil Armstrong 
---
 drivers/gpu/drm/msm/dsi/dsi_cfg.c | 17 +
 drivers/gpu/drm/msm/dsi/dsi_cfg.h |  1 +
 2 files changed, 18 insertions(+)

diff --git a/drivers/gpu/drm/msm/dsi/dsi_cfg.c 
b/drivers/gpu/drm/msm/dsi/dsi_cfg.c
index 1f98ff74ceb0..10ba7d153d1c 100644
--- a/drivers/gpu/drm/msm/dsi/dsi_cfg.c
+++ b/drivers/gpu/drm/msm/dsi/dsi_cfg.c
@@ -190,6 +190,21 @@ static const struct msm_dsi_config sm8550_dsi_cfg = {
},
 };
 
+static const struct regulator_bulk_data sm8650_dsi_regulators[] = {
+   { .supply = "vdda", .init_load_uA = 16600 },/* 1.2 V */
+};
+
+static const struct msm_dsi_config sm8650_dsi_cfg = {
+   .io_offset = DSI_6G_REG_SHIFT,
+   .regulator_data = sm8650_dsi_regulators,
+   .num_regulators = ARRAY_SIZE(sm8650_dsi_regulators),
+   .bus_clk_names = dsi_v2_4_clk_names,
+   .num_bus_clks = ARRAY_SIZE(dsi_v2_4_clk_names),
+   .io_start = {
+   { 0xae94000, 0xae96000 },
+   },
+};
+
 static const struct regulator_bulk_data sc7280_dsi_regulators[] = {
{ .supply = "vdda", .init_load_uA = 8350 }, /* 1.2 V */
{ .supply = "refgen" },
@@ -281,6 +296,8 @@ static const struct msm_dsi_cfg_handler dsi_cfg_handlers[] 
= {
_dsi_cfg, _dsi_6g_v2_host_ops},
{MSM_DSI_VER_MAJOR_6G, MSM_DSI_6G_VER_MINOR_V2_7_0,
_dsi_cfg, _dsi_6g_v2_host_ops},
+   {MSM_DSI_VER_MAJOR_6G, MSM_DSI_6G_VER_MINOR_V2_8_0,
+   _dsi_cfg, _dsi_6g_v2_host_ops},
 };
 
 const struct msm_dsi_cfg_handler *msm_dsi_cfg_get(u32 major, u32 minor)
diff --git a/drivers/gpu/drm/msm/dsi/dsi_cfg.h 
b/drivers/gpu/drm/msm/dsi/dsi_cfg.h
index 43f0dd74edb6..4c9b4b37681b 100644
--- a/drivers/gpu/drm/msm/dsi/dsi_cfg.h
+++ b/drivers/gpu/drm/msm/dsi/dsi_cfg.h
@@ -28,6 +28,7 @@
 #define MSM_DSI_6G_VER_MINOR_V2_5_00x2005
 #define MSM_DSI_6G_VER_MINOR_V2_6_00x2006
 #define MSM_DSI_6G_VER_MINOR_V2_7_00x2007
+#define MSM_DSI_6G_VER_MINOR_V2_8_00x2008
 
 #define MSM_DSI_V2_VER_MINOR_8064  0x0
 

-- 
2.34.1



[Freedreno] [PATCH v2 5/8] drm/msm/dpu: add support for SM8650 DPU

2023-10-30 Thread Neil Armstrong
Add DPU version 10.0 support for the SM8650 platform.

Signed-off-by: Neil Armstrong 
---
 .../drm/msm/disp/dpu1/catalog/dpu_10_0_sm8650.h| 457 +
 drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.c |  26 ++
 drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.h |   1 +
 drivers/gpu/drm/msm/disp/dpu1/dpu_hw_mdss.h|   3 +
 drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c|   1 +
 5 files changed, 488 insertions(+)

diff --git a/drivers/gpu/drm/msm/disp/dpu1/catalog/dpu_10_0_sm8650.h 
b/drivers/gpu/drm/msm/disp/dpu1/catalog/dpu_10_0_sm8650.h
new file mode 100644
index ..04d2a73dd942
--- /dev/null
+++ b/drivers/gpu/drm/msm/disp/dpu1/catalog/dpu_10_0_sm8650.h
@@ -0,0 +1,457 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+/*
+ * Copyright (c) 2022. Qualcomm Innovation Center, Inc. All rights reserved.
+ * Copyright (c) 2015-2018, 2020 The Linux Foundation. All rights reserved.
+ */
+
+#ifndef _DPU_10_0_SM8650_H
+#define _DPU_10_0_SM8650_H
+
+static const struct dpu_caps sm8650_dpu_caps = {
+   .max_mixer_width = DEFAULT_DPU_OUTPUT_LINE_WIDTH,
+   .max_mixer_blendstages = 0xb,
+   .has_src_split = true,
+   .has_dim_layer = true,
+   .has_idle_pc = true,
+   .has_3d_merge = true,
+   .max_linewidth = 8192,
+   .pixel_ram_size = DEFAULT_PIXEL_RAM_SIZE,
+};
+
+static const struct dpu_mdp_cfg sm8650_mdp = {
+   .name = "top_0",
+   .base = 0, .len = 0x494,
+   .features = BIT(DPU_MDP_PERIPH_0_REMOVED),
+   .clk_ctrls = {
+   [DPU_CLK_CTRL_REG_DMA] = { .reg_off = 0x2bc, .bit_off = 20 },
+   },
+};
+
+/* FIXME: get rid of DPU_CTL_SPLIT_DISPLAY in favour of proper ACTIVE_CTL 
support */
+static const struct dpu_ctl_cfg sm8650_ctl[] = {
+   {
+   .name = "ctl_0", .id = CTL_0,
+   .base = 0x15000, .len = 0x1000,
+   .features = CTL_SM8550_MASK | BIT(DPU_CTL_SPLIT_DISPLAY),
+   .intr_start = DPU_IRQ_IDX(MDP_SSPP_TOP0_INTR2, 9),
+   }, {
+   .name = "ctl_1", .id = CTL_1,
+   .base = 0x16000, .len = 0x1000,
+   .features = CTL_SM8550_MASK | BIT(DPU_CTL_SPLIT_DISPLAY),
+   .intr_start = DPU_IRQ_IDX(MDP_SSPP_TOP0_INTR2, 10),
+   }, {
+   .name = "ctl_2", .id = CTL_2,
+   .base = 0x17000, .len = 0x1000,
+   .features = CTL_SM8550_MASK,
+   .intr_start = DPU_IRQ_IDX(MDP_SSPP_TOP0_INTR2, 11),
+   }, {
+   .name = "ctl_3", .id = CTL_3,
+   .base = 0x18000, .len = 0x1000,
+   .features = CTL_SM8550_MASK,
+   .intr_start = DPU_IRQ_IDX(MDP_SSPP_TOP0_INTR2, 12),
+   }, {
+   .name = "ctl_4", .id = CTL_4,
+   .base = 0x19000, .len = 0x1000,
+   .features = CTL_SM8550_MASK,
+   .intr_start = DPU_IRQ_IDX(MDP_SSPP_TOP0_INTR2, 13),
+   }, {
+   .name = "ctl_5", .id = CTL_5,
+   .base = 0x1a000, .len = 0x1000,
+   .features = CTL_SM8550_MASK,
+   .intr_start = DPU_IRQ_IDX(MDP_SSPP_TOP0_INTR2, 23),
+   },
+};
+
+static const struct dpu_sspp_cfg sm8650_sspp[] = {
+   {
+   .name = "sspp_0", .id = SSPP_VIG0,
+   .base = 0x4000, .len = 0x344,
+   .features = VIG_SDM845_MASK_SDMA,
+   .sblk = _vig_sblk_qseed3_3_3,
+   .xin_id = 0,
+   .type = SSPP_TYPE_VIG,
+   }, {
+   .name = "sspp_1", .id = SSPP_VIG1,
+   .base = 0x6000, .len = 0x344,
+   .features = VIG_SDM845_MASK_SDMA,
+   .sblk = _vig_sblk_qseed3_3_3,
+   .xin_id = 4,
+   .type = SSPP_TYPE_VIG,
+   }, {
+   .name = "sspp_2", .id = SSPP_VIG2,
+   .base = 0x8000, .len = 0x344,
+   .features = VIG_SDM845_MASK_SDMA,
+   .sblk = _vig_sblk_qseed3_3_3,
+   .xin_id = 8,
+   .type = SSPP_TYPE_VIG,
+   }, {
+   .name = "sspp_3", .id = SSPP_VIG3,
+   .base = 0xa000, .len = 0x344,
+   .features = VIG_SDM845_MASK_SDMA,
+   .sblk = _vig_sblk_qseed3_3_3,
+   .xin_id = 12,
+   .type = SSPP_TYPE_VIG,
+   }, {
+   .name = "sspp_8", .id = SSPP_DMA0,
+   .base = 0x24000, .len = 0x344,
+   .features = DMA_SDM845_MASK_SDMA,
+   .sblk = _dma_sblk,
+   .xin_id = 1,
+   .type = SSPP_TYPE_DMA,
+   }, {
+   .name = "sspp_9", .id = SSPP_DMA1,
+   .base = 0x26000, .len = 0x344,
+   .features = DMA_SDM845_MASK_SDMA,
+   .sblk = _dma_sblk,
+   .xin_id = 5,
+   .type = SSPP_TYPE_DMA,
+   }, {
+   .

[Freedreno] [PATCH v2 7/8] drm/msm: dsi: add support for DSI-PHY on SM8650

2023-10-30 Thread Neil Armstrong
Add DSI PHY support for the SM8650 platform.

Reviewed-by: Dmitry Baryshkov 
Signed-off-by: Neil Armstrong 
---
 drivers/gpu/drm/msm/dsi/phy/dsi_phy.c |  2 ++
 drivers/gpu/drm/msm/dsi/phy/dsi_phy.h |  1 +
 drivers/gpu/drm/msm/dsi/phy/dsi_phy_7nm.c | 27 +++
 3 files changed, 30 insertions(+)

diff --git a/drivers/gpu/drm/msm/dsi/phy/dsi_phy.c 
b/drivers/gpu/drm/msm/dsi/phy/dsi_phy.c
index 05621e5e7d63..7612be6c3618 100644
--- a/drivers/gpu/drm/msm/dsi/phy/dsi_phy.c
+++ b/drivers/gpu/drm/msm/dsi/phy/dsi_phy.c
@@ -585,6 +585,8 @@ static const struct of_device_id dsi_phy_dt_match[] = {
  .data = _phy_5nm_8450_cfgs },
{ .compatible = "qcom,sm8550-dsi-phy-4nm",
  .data = _phy_4nm_8550_cfgs },
+   { .compatible = "qcom,sm8650-dsi-phy-4nm",
+ .data = _phy_4nm_8650_cfgs },
 #endif
{}
 };
diff --git a/drivers/gpu/drm/msm/dsi/phy/dsi_phy.h 
b/drivers/gpu/drm/msm/dsi/phy/dsi_phy.h
index 8b640d174785..e4275d3ad581 100644
--- a/drivers/gpu/drm/msm/dsi/phy/dsi_phy.h
+++ b/drivers/gpu/drm/msm/dsi/phy/dsi_phy.h
@@ -62,6 +62,7 @@ extern const struct msm_dsi_phy_cfg dsi_phy_7nm_7280_cfgs;
 extern const struct msm_dsi_phy_cfg dsi_phy_5nm_8350_cfgs;
 extern const struct msm_dsi_phy_cfg dsi_phy_5nm_8450_cfgs;
 extern const struct msm_dsi_phy_cfg dsi_phy_4nm_8550_cfgs;
+extern const struct msm_dsi_phy_cfg dsi_phy_4nm_8650_cfgs;
 
 struct msm_dsi_dphy_timing {
u32 clk_zero;
diff --git a/drivers/gpu/drm/msm/dsi/phy/dsi_phy_7nm.c 
b/drivers/gpu/drm/msm/dsi/phy/dsi_phy_7nm.c
index 3b1ed02f644d..c66193f2dc0d 100644
--- a/drivers/gpu/drm/msm/dsi/phy/dsi_phy_7nm.c
+++ b/drivers/gpu/drm/msm/dsi/phy/dsi_phy_7nm.c
@@ -1121,6 +1121,10 @@ static const struct regulator_bulk_data 
dsi_phy_7nm_37750uA_regulators[] = {
{ .supply = "vdds", .init_load_uA = 37550 },
 };
 
+static const struct regulator_bulk_data dsi_phy_7nm_98000uA_regulators[] = {
+   { .supply = "vdds", .init_load_uA = 98000 },
+};
+
 static const struct regulator_bulk_data dsi_phy_7nm_97800uA_regulators[] = {
{ .supply = "vdds", .init_load_uA = 97800 },
 };
@@ -1281,3 +1285,26 @@ const struct msm_dsi_phy_cfg dsi_phy_4nm_8550_cfgs = {
.num_dsi_phy = 2,
.quirks = DSI_PHY_7NM_QUIRK_V5_2,
 };
+
+const struct msm_dsi_phy_cfg dsi_phy_4nm_8650_cfgs = {
+   .has_phy_lane = true,
+   .regulator_data = dsi_phy_7nm_98000uA_regulators,
+   .num_regulators = ARRAY_SIZE(dsi_phy_7nm_98000uA_regulators),
+   .ops = {
+   .enable = dsi_7nm_phy_enable,
+   .disable = dsi_7nm_phy_disable,
+   .pll_init = dsi_pll_7nm_init,
+   .save_pll_state = dsi_7nm_pll_save_state,
+   .restore_pll_state = dsi_7nm_pll_restore_state,
+   .set_continuous_clock = dsi_7nm_set_continuous_clock,
+   },
+   .min_pll_rate = 6UL,
+#ifdef CONFIG_64BIT
+   .max_pll_rate = 50UL,
+#else
+   .max_pll_rate = ULONG_MAX,
+#endif
+   .io_start = { 0xae95000, 0xae97000 },
+   .num_dsi_phy = 2,
+   .quirks = DSI_PHY_7NM_QUIRK_V5_2,
+};

-- 
2.34.1



[Freedreno] [PATCH v2 3/8] dt-bindings: display: msm: document the SM8650 DPU

2023-10-30 Thread Neil Armstrong
Document the DPU Display Controller on the SM8650 Platform.

Reviewed-by: Krzysztof Kozlowski 
Signed-off-by: Neil Armstrong 
---
 .../bindings/display/msm/qcom,sm8650-dpu.yaml  | 127 +
 1 file changed, 127 insertions(+)

diff --git a/Documentation/devicetree/bindings/display/msm/qcom,sm8650-dpu.yaml 
b/Documentation/devicetree/bindings/display/msm/qcom,sm8650-dpu.yaml
new file mode 100644
index ..a01d15a03317
--- /dev/null
+++ b/Documentation/devicetree/bindings/display/msm/qcom,sm8650-dpu.yaml
@@ -0,0 +1,127 @@
+# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/display/msm/qcom,sm8650-dpu.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Qualcomm SM8650 Display DPU
+
+maintainers:
+  - Neil Armstrong 
+
+$ref: /schemas/display/msm/dpu-common.yaml#
+
+properties:
+  compatible:
+const: qcom,sm8650-dpu
+
+  reg:
+items:
+  - description: Address offset and size for mdp register set
+  - description: Address offset and size for vbif register set
+
+  reg-names:
+items:
+  - const: mdp
+  - const: vbif
+
+  clocks:
+items:
+  - description: Display hf axi
+  - description: Display MDSS ahb
+  - description: Display lut
+  - description: Display core
+  - description: Display vsync
+
+  clock-names:
+items:
+  - const: nrt_bus
+  - const: iface
+  - const: lut
+  - const: core
+  - const: vsync
+
+required:
+  - compatible
+  - reg
+  - reg-names
+  - clocks
+  - clock-names
+
+unevaluatedProperties: false
+
+examples:
+  - |
+#include 
+#include 
+
+display-controller@ae01000 {
+compatible = "qcom,sm8650-dpu";
+reg = <0x0ae01000 0x8f000>,
+  <0x0aeb 0x2008>;
+reg-names = "mdp", "vbif";
+
+clocks = <_axi_clk>,
+ <_ahb_clk>,
+ <_mdp_lut_clk>,
+ <_mdp_clk>,
+ <_vsync_clk>;
+clock-names = "nrt_bus",
+  "iface",
+  "lut",
+  "core",
+  "vsync";
+
+assigned-clocks = <_vsync_clk>;
+assigned-clock-rates = <1920>;
+
+operating-points-v2 = <_opp_table>;
+power-domains = < RPMHPD_MMCX>;
+
+interrupt-parent = <>;
+interrupts = <0>;
+
+ports {
+#address-cells = <1>;
+#size-cells = <0>;
+
+port@0 {
+reg = <0>;
+dpu_intf1_out: endpoint {
+remote-endpoint = <_in>;
+};
+};
+
+port@1 {
+reg = <1>;
+dpu_intf2_out: endpoint {
+remote-endpoint = <_in>;
+};
+};
+};
+
+mdp_opp_table: opp-table {
+compatible = "operating-points-v2";
+
+opp-2 {
+opp-hz = /bits/ 64 <2>;
+required-opps = <_opp_low_svs>;
+};
+
+opp-32500 {
+opp-hz = /bits/ 64 <32500>;
+required-opps = <_opp_svs>;
+};
+
+opp-37500 {
+opp-hz = /bits/ 64 <37500>;
+required-opps = <_opp_svs_l1>;
+};
+
+opp-51400 {
+opp-hz = /bits/ 64 <51400>;
+required-opps = <_opp_nom>;
+};
+};
+};
+...

-- 
2.34.1



[Freedreno] [PATCH v2 2/8] dt-bindings: display: msm-dsi-controller-main: document the SM8650 DSI Controller

2023-10-30 Thread Neil Armstrong
Document the DSI Controller on the SM8650 Platform.

Reviewed-by: Krzysztof Kozlowski 
Signed-off-by: Neil Armstrong 
---
 Documentation/devicetree/bindings/display/msm/dsi-controller-main.yaml | 2 ++
 1 file changed, 2 insertions(+)

diff --git 
a/Documentation/devicetree/bindings/display/msm/dsi-controller-main.yaml 
b/Documentation/devicetree/bindings/display/msm/dsi-controller-main.yaml
index c6dbab65d5f7..24944979d500 100644
--- a/Documentation/devicetree/bindings/display/msm/dsi-controller-main.yaml
+++ b/Documentation/devicetree/bindings/display/msm/dsi-controller-main.yaml
@@ -35,6 +35,7 @@ properties:
   - qcom,sm8350-dsi-ctrl
   - qcom,sm8450-dsi-ctrl
   - qcom,sm8550-dsi-ctrl
+  - qcom,sm8650-dsi-ctrl
   - const: qcom,mdss-dsi-ctrl
   - enum:
   - qcom,dsi-ctrl-6g-qcm2290
@@ -333,6 +334,7 @@ allOf:
   - qcom,sm8350-dsi-ctrl
   - qcom,sm8450-dsi-ctrl
   - qcom,sm8550-dsi-ctrl
+  - qcom,sm8650-dsi-ctrl
 then:
   properties:
 clocks:

-- 
2.34.1



[Freedreno] [PATCH v2 1/8] dt-bindings: display: msm-dsi-phy-7nm: document the SM8650 DSI PHY

2023-10-30 Thread Neil Armstrong
Document the DSI PHY on the SM8650 Platform.

Reviewed-by: Krzysztof Kozlowski 
Signed-off-by: Neil Armstrong 
---
 Documentation/devicetree/bindings/display/msm/dsi-phy-7nm.yaml | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Documentation/devicetree/bindings/display/msm/dsi-phy-7nm.yaml 
b/Documentation/devicetree/bindings/display/msm/dsi-phy-7nm.yaml
index dd6619555a12..7e764eac3ef3 100644
--- a/Documentation/devicetree/bindings/display/msm/dsi-phy-7nm.yaml
+++ b/Documentation/devicetree/bindings/display/msm/dsi-phy-7nm.yaml
@@ -22,6 +22,7 @@ properties:
   - qcom,sm8350-dsi-phy-5nm
   - qcom,sm8450-dsi-phy-5nm
   - qcom,sm8550-dsi-phy-4nm
+  - qcom,sm8650-dsi-phy-4nm
 
   reg:
 items:

-- 
2.34.1



[Freedreno] [PATCH v2 0/8] drm/msm: Introduce display support for SM8650

2023-10-30 Thread Neil Armstrong
The SM8650 MDSS is very close from the MDSS 9.0.0 found
on the SM8550 SoC, with the following difference:
- DSI PHY 2.8.8, no significant differences
- DPU 10.0.0:
  - Enhanced max_linewidth to 8k
  - PINGPONG_8 & PINGPONG_9
  - MERGE_3D_4
  - DSC_4 & DSC_5, DSC_NATIVE_42x on DSC0/1

This patchset contains DSI PHY, DSI Controller, DPU & MDSS bindings
in addition to the driver changes.

Support for Display Port output is expected for later.

Dependencies: None

For convenience, a regularly refreshed linux-next based git tree containing
all the SM8650 related work is available at:
https://git.codelinaro.org/neil.armstrong/linux/-/tree/topic/sm8650/upstream/integ

Signed-off-by: Neil Armstrong 
---
Changes in v2:
- Rebased on top of https://patchwork.freedesktop.org/series/119804/ 
- Enabled SDMA
- Fixed sm8650_rt_pri_lvl table
- Collected Reviewed-by tags
- Link to v1: 
https://lore.kernel.org/r/20231025-topic-sm8650-upstream-mdss-v1-0-bb219b8c7...@linaro.org

---
Neil Armstrong (8):
  dt-bindings: display: msm-dsi-phy-7nm: document the SM8650 DSI PHY
  dt-bindings: display: msm-dsi-controller-main: document the SM8650 DSI 
Controller
  dt-bindings: display: msm: document the SM8650 DPU
  dt-bindings: display: msm: document the SM8650 Mobile Display Subsystem
  drm/msm/dpu: add support for SM8650 DPU
  drm/msm: mdss: add support for SM8650
  drm/msm: dsi: add support for DSI-PHY on SM8650
  drm/msm: dsi: add support for DSI 2.8.0

 .../bindings/display/msm/dsi-controller-main.yaml  |   2 +
 .../bindings/display/msm/dsi-phy-7nm.yaml  |   1 +
 .../bindings/display/msm/qcom,sm8650-dpu.yaml  | 127 ++
 .../bindings/display/msm/qcom,sm8650-mdss.yaml | 322 +++
 .../drm/msm/disp/dpu1/catalog/dpu_10_0_sm8650.h| 457 +
 drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.c |  26 ++
 drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.h |   1 +
 drivers/gpu/drm/msm/disp/dpu1/dpu_hw_mdss.h|   3 +
 drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c|   1 +
 drivers/gpu/drm/msm/dsi/dsi_cfg.c  |  17 +
 drivers/gpu/drm/msm/dsi/dsi_cfg.h  |   1 +
 drivers/gpu/drm/msm/dsi/phy/dsi_phy.c  |   2 +
 drivers/gpu/drm/msm/dsi/phy/dsi_phy.h  |   1 +
 drivers/gpu/drm/msm/dsi/phy/dsi_phy_7nm.c  |  27 ++
 drivers/gpu/drm/msm/msm_mdss.c |   1 +
 15 files changed, 989 insertions(+)
---
base-commit: 8c53ca7d71a2d7274b51ec14a0d91b6ede09fd83
change-id: 20231016-topic-sm8650-upstream-mdss-e3d95e09c7b8

Best regards,
-- 
Neil Armstrong 



Re: [Freedreno] [PATCH 7/8] drm/msm: dsi: add support for DSI-PHY on SM8650

2023-10-26 Thread Neil Armstrong

On 25/10/2023 10:03, Dmitry Baryshkov wrote:

On Wed, 25 Oct 2023 at 10:35, Neil Armstrong  wrote:


Add DSI PHY support for the SM8650 platform.

Signed-off-by: Neil Armstrong 
---
  drivers/gpu/drm/msm/dsi/phy/dsi_phy.c |  2 ++
  drivers/gpu/drm/msm/dsi/phy/dsi_phy.h |  1 +
  drivers/gpu/drm/msm/dsi/phy/dsi_phy_7nm.c | 27 +++
  3 files changed, 30 insertions(+)

diff --git a/drivers/gpu/drm/msm/dsi/phy/dsi_phy.c 
b/drivers/gpu/drm/msm/dsi/phy/dsi_phy.c
index 05621e5e7d63..7612be6c3618 100644
--- a/drivers/gpu/drm/msm/dsi/phy/dsi_phy.c
+++ b/drivers/gpu/drm/msm/dsi/phy/dsi_phy.c
@@ -585,6 +585,8 @@ static const struct of_device_id dsi_phy_dt_match[] = {
   .data = _phy_5nm_8450_cfgs },
 { .compatible = "qcom,sm8550-dsi-phy-4nm",
   .data = _phy_4nm_8550_cfgs },
+   { .compatible = "qcom,sm8650-dsi-phy-4nm",
+ .data = _phy_4nm_8650_cfgs },
  #endif
 {}
  };
diff --git a/drivers/gpu/drm/msm/dsi/phy/dsi_phy.h 
b/drivers/gpu/drm/msm/dsi/phy/dsi_phy.h
index 8b640d174785..e4275d3ad581 100644
--- a/drivers/gpu/drm/msm/dsi/phy/dsi_phy.h
+++ b/drivers/gpu/drm/msm/dsi/phy/dsi_phy.h
@@ -62,6 +62,7 @@ extern const struct msm_dsi_phy_cfg dsi_phy_7nm_7280_cfgs;
  extern const struct msm_dsi_phy_cfg dsi_phy_5nm_8350_cfgs;
  extern const struct msm_dsi_phy_cfg dsi_phy_5nm_8450_cfgs;
  extern const struct msm_dsi_phy_cfg dsi_phy_4nm_8550_cfgs;
+extern const struct msm_dsi_phy_cfg dsi_phy_4nm_8650_cfgs;

  struct msm_dsi_dphy_timing {
 u32 clk_zero;
diff --git a/drivers/gpu/drm/msm/dsi/phy/dsi_phy_7nm.c 
b/drivers/gpu/drm/msm/dsi/phy/dsi_phy_7nm.c
index 3b1ed02f644d..c66193f2dc0d 100644
--- a/drivers/gpu/drm/msm/dsi/phy/dsi_phy_7nm.c
+++ b/drivers/gpu/drm/msm/dsi/phy/dsi_phy_7nm.c
@@ -1121,6 +1121,10 @@ static const struct regulator_bulk_data 
dsi_phy_7nm_37750uA_regulators[] = {
 { .supply = "vdds", .init_load_uA = 37550 },
  };

+static const struct regulator_bulk_data dsi_phy_7nm_98000uA_regulators[] = {
+   { .supply = "vdds", .init_load_uA = 98000 },
+};
+
  static const struct regulator_bulk_data dsi_phy_7nm_97800uA_regulators[] = {
 { .supply = "vdds", .init_load_uA = 97800 },
  };
@@ -1281,3 +1285,26 @@ const struct msm_dsi_phy_cfg dsi_phy_4nm_8550_cfgs = {
 .num_dsi_phy = 2,
 .quirks = DSI_PHY_7NM_QUIRK_V5_2,
  };
+
+const struct msm_dsi_phy_cfg dsi_phy_4nm_8650_cfgs = {


So, this is the same as sm8550 config, just using 400 uA less? I
wonder if it makes sense to go for setting the regulator mode instead
of setting the load.


I have no idea, we keep changing this but indeed we should instead change
the regulator mode, it's safer to keep it that way until we figure that out.

I'll double check anyway



Nevertheless (unless you'd like to reuse sm8550 config entry):

Reviewed-by: Dmitry Baryshkov 


Thanks,
Neil




+   .has_phy_lane = true,
+   .regulator_data = dsi_phy_7nm_98000uA_regulators,
+   .num_regulators = ARRAY_SIZE(dsi_phy_7nm_98000uA_regulators),
+   .ops = {
+   .enable = dsi_7nm_phy_enable,
+   .disable = dsi_7nm_phy_disable,
+   .pll_init = dsi_pll_7nm_init,
+   .save_pll_state = dsi_7nm_pll_save_state,
+   .restore_pll_state = dsi_7nm_pll_restore_state,
+   .set_continuous_clock = dsi_7nm_set_continuous_clock,
+   },
+   .min_pll_rate = 6UL,
+#ifdef CONFIG_64BIT
+   .max_pll_rate = 50UL,
+#else
+   .max_pll_rate = ULONG_MAX,
+#endif
+   .io_start = { 0xae95000, 0xae97000 },
+   .num_dsi_phy = 2,
+   .quirks = DSI_PHY_7NM_QUIRK_V5_2,
+};

--
2.34.1








Re: [Freedreno] [PATCH 5/8] drm/msm: dpu1: add support for SM8650 DPU

2023-10-25 Thread Neil Armstrong

On 25/10/2023 09:49, Dmitry Baryshkov wrote:

On Wed, 25 Oct 2023 at 10:35, Neil Armstrong  wrote:


Add DPU version 10.0 support for the SM8650 platform.

Signed-off-by: Neil Armstrong 


Thanks for your patch. Could you please rebase it on top of
https://patchwork.freedesktop.org/series/119804/ ?


Sure, will do

Thanks,
Neil




---
  .../drm/msm/disp/dpu1/catalog/dpu_10_0_sm8650.h| 458 +
  drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.c |  23 ++
  drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.h |   1 +
  drivers/gpu/drm/msm/disp/dpu1/dpu_hw_mdss.h|   3 +
  drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c|   1 +
  5 files changed, 486 insertions(+)

diff --git a/drivers/gpu/drm/msm/disp/dpu1/catalog/dpu_10_0_sm8650.h 
b/drivers/gpu/drm/msm/disp/dpu1/catalog/dpu_10_0_sm8650.h
new file mode 100644
index ..3a37d78804e7
--- /dev/null
+++ b/drivers/gpu/drm/msm/disp/dpu1/catalog/dpu_10_0_sm8650.h
@@ -0,0 +1,458 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+/*
+ * Copyright (c) 2022. Qualcomm Innovation Center, Inc. All rights reserved.
+ * Copyright (c) 2015-2018, 2020 The Linux Foundation. All rights reserved.
+ */
+
+#ifndef _DPU_10_0_SM8650_H
+#define _DPU_10_0_SM8650_H
+
+static const struct dpu_caps sm8650_dpu_caps = {
+   .max_mixer_width = DEFAULT_DPU_OUTPUT_LINE_WIDTH,
+   .max_mixer_blendstages = 0xb,
+   .qseed_type = DPU_SSPP_SCALER_QSEED4,
+   .has_src_split = true,
+   .has_dim_layer = true,
+   .has_idle_pc = true,
+   .has_3d_merge = true,
+   .max_linewidth = 8192,
+   .pixel_ram_size = DEFAULT_PIXEL_RAM_SIZE,
+};
+
+static const struct dpu_mdp_cfg sm8650_mdp = {
+   .name = "top_0",
+   .base = 0, .len = 0x494,
+   .features = BIT(DPU_MDP_PERIPH_0_REMOVED),
+   .clk_ctrls = {
+   [DPU_CLK_CTRL_REG_DMA] = { .reg_off = 0x2bc, .bit_off = 20 },
+   },
+};
+
+/* FIXME: get rid of DPU_CTL_SPLIT_DISPLAY in favour of proper ACTIVE_CTL 
support */
+static const struct dpu_ctl_cfg sm8650_ctl[] = {
+   {
+   .name = "ctl_0", .id = CTL_0,
+   .base = 0x15000, .len = 0x1000,
+   .features = CTL_SM8550_MASK | BIT(DPU_CTL_SPLIT_DISPLAY),
+   .intr_start = DPU_IRQ_IDX(MDP_SSPP_TOP0_INTR2, 9),
+   }, {
+   .name = "ctl_1", .id = CTL_1,
+   .base = 0x16000, .len = 0x1000,
+   .features = CTL_SM8550_MASK | BIT(DPU_CTL_SPLIT_DISPLAY),
+   .intr_start = DPU_IRQ_IDX(MDP_SSPP_TOP0_INTR2, 10),
+   }, {
+   .name = "ctl_2", .id = CTL_2,
+   .base = 0x17000, .len = 0x1000,
+   .features = CTL_SM8550_MASK,
+   .intr_start = DPU_IRQ_IDX(MDP_SSPP_TOP0_INTR2, 11),
+   }, {
+   .name = "ctl_3", .id = CTL_3,
+   .base = 0x18000, .len = 0x1000,
+   .features = CTL_SM8550_MASK,
+   .intr_start = DPU_IRQ_IDX(MDP_SSPP_TOP0_INTR2, 12),
+   }, {
+   .name = "ctl_4", .id = CTL_4,
+   .base = 0x19000, .len = 0x1000,
+   .features = CTL_SM8550_MASK,
+   .intr_start = DPU_IRQ_IDX(MDP_SSPP_TOP0_INTR2, 13),
+   }, {
+   .name = "ctl_5", .id = CTL_5,
+   .base = 0x1a000, .len = 0x1000,
+   .features = CTL_SM8550_MASK,
+   .intr_start = DPU_IRQ_IDX(MDP_SSPP_TOP0_INTR2, 23),
+   },
+};
+
+static const struct dpu_sspp_cfg sm8650_sspp[] = {
+   {
+   .name = "sspp_0", .id = SSPP_VIG0,
+   .base = 0x4000, .len = 0x344,
+   .features = VIG_SC7180_MASK,


Could you please use _SDMA mask here after testing that SmartDMA works
as expected?


+   .sblk = _vig_sblk_0,
+   .xin_id = 0,
+   .type = SSPP_TYPE_VIG,
+   }, {
+   .name = "sspp_1", .id = SSPP_VIG1,
+   .base = 0x6000, .len = 0x344,
+   .features = VIG_SC7180_MASK,
+   .sblk = _vig_sblk_1,
+   .xin_id = 4,
+   .type = SSPP_TYPE_VIG,
+   }, {
+   .name = "sspp_2", .id = SSPP_VIG2,
+   .base = 0x8000, .len = 0x344,
+   .features = VIG_SC7180_MASK,
+   .sblk = _vig_sblk_2,
+   .xin_id = 8,
+   .type = SSPP_TYPE_VIG,
+   }, {
+   .name = "sspp_3", .id = SSPP_VIG3,
+   .base = 0xa000, .len = 0x344,
+   .features = VIG_SC7180_MASK,
+   .sblk = _vig_sblk_3,
+   .xin_id = 12,
+   .type = SSPP_TYPE_VIG,
+   }, {
+   .name = "sspp_8", .id = SSPP_DMA0,
+   .base = 0x24000, .len = 0x344,
+   .features = DMA_SDM845_MASK,
+   .sblk = _dma_sblk_0,
+   .xin_id = 1,
+   .typ

[Freedreno] [PATCH 8/8] drm/msm: dsi: add support for DSI 2.8.0

2023-10-25 Thread Neil Armstrong
Add DSI Controller version 2.8.0 support for the SM8650 platform.

Signed-off-by: Neil Armstrong 
---
 drivers/gpu/drm/msm/dsi/dsi_cfg.c | 17 +
 drivers/gpu/drm/msm/dsi/dsi_cfg.h |  1 +
 2 files changed, 18 insertions(+)

diff --git a/drivers/gpu/drm/msm/dsi/dsi_cfg.c 
b/drivers/gpu/drm/msm/dsi/dsi_cfg.c
index 1f98ff74ceb0..10ba7d153d1c 100644
--- a/drivers/gpu/drm/msm/dsi/dsi_cfg.c
+++ b/drivers/gpu/drm/msm/dsi/dsi_cfg.c
@@ -190,6 +190,21 @@ static const struct msm_dsi_config sm8550_dsi_cfg = {
},
 };
 
+static const struct regulator_bulk_data sm8650_dsi_regulators[] = {
+   { .supply = "vdda", .init_load_uA = 16600 },/* 1.2 V */
+};
+
+static const struct msm_dsi_config sm8650_dsi_cfg = {
+   .io_offset = DSI_6G_REG_SHIFT,
+   .regulator_data = sm8650_dsi_regulators,
+   .num_regulators = ARRAY_SIZE(sm8650_dsi_regulators),
+   .bus_clk_names = dsi_v2_4_clk_names,
+   .num_bus_clks = ARRAY_SIZE(dsi_v2_4_clk_names),
+   .io_start = {
+   { 0xae94000, 0xae96000 },
+   },
+};
+
 static const struct regulator_bulk_data sc7280_dsi_regulators[] = {
{ .supply = "vdda", .init_load_uA = 8350 }, /* 1.2 V */
{ .supply = "refgen" },
@@ -281,6 +296,8 @@ static const struct msm_dsi_cfg_handler dsi_cfg_handlers[] 
= {
_dsi_cfg, _dsi_6g_v2_host_ops},
{MSM_DSI_VER_MAJOR_6G, MSM_DSI_6G_VER_MINOR_V2_7_0,
_dsi_cfg, _dsi_6g_v2_host_ops},
+   {MSM_DSI_VER_MAJOR_6G, MSM_DSI_6G_VER_MINOR_V2_8_0,
+   _dsi_cfg, _dsi_6g_v2_host_ops},
 };
 
 const struct msm_dsi_cfg_handler *msm_dsi_cfg_get(u32 major, u32 minor)
diff --git a/drivers/gpu/drm/msm/dsi/dsi_cfg.h 
b/drivers/gpu/drm/msm/dsi/dsi_cfg.h
index 43f0dd74edb6..4c9b4b37681b 100644
--- a/drivers/gpu/drm/msm/dsi/dsi_cfg.h
+++ b/drivers/gpu/drm/msm/dsi/dsi_cfg.h
@@ -28,6 +28,7 @@
 #define MSM_DSI_6G_VER_MINOR_V2_5_00x2005
 #define MSM_DSI_6G_VER_MINOR_V2_6_00x2006
 #define MSM_DSI_6G_VER_MINOR_V2_7_00x2007
+#define MSM_DSI_6G_VER_MINOR_V2_8_00x2008
 
 #define MSM_DSI_V2_VER_MINOR_8064  0x0
 

-- 
2.34.1



[Freedreno] [PATCH 7/8] drm/msm: dsi: add support for DSI-PHY on SM8650

2023-10-25 Thread Neil Armstrong
Add DSI PHY support for the SM8650 platform.

Signed-off-by: Neil Armstrong 
---
 drivers/gpu/drm/msm/dsi/phy/dsi_phy.c |  2 ++
 drivers/gpu/drm/msm/dsi/phy/dsi_phy.h |  1 +
 drivers/gpu/drm/msm/dsi/phy/dsi_phy_7nm.c | 27 +++
 3 files changed, 30 insertions(+)

diff --git a/drivers/gpu/drm/msm/dsi/phy/dsi_phy.c 
b/drivers/gpu/drm/msm/dsi/phy/dsi_phy.c
index 05621e5e7d63..7612be6c3618 100644
--- a/drivers/gpu/drm/msm/dsi/phy/dsi_phy.c
+++ b/drivers/gpu/drm/msm/dsi/phy/dsi_phy.c
@@ -585,6 +585,8 @@ static const struct of_device_id dsi_phy_dt_match[] = {
  .data = _phy_5nm_8450_cfgs },
{ .compatible = "qcom,sm8550-dsi-phy-4nm",
  .data = _phy_4nm_8550_cfgs },
+   { .compatible = "qcom,sm8650-dsi-phy-4nm",
+ .data = _phy_4nm_8650_cfgs },
 #endif
{}
 };
diff --git a/drivers/gpu/drm/msm/dsi/phy/dsi_phy.h 
b/drivers/gpu/drm/msm/dsi/phy/dsi_phy.h
index 8b640d174785..e4275d3ad581 100644
--- a/drivers/gpu/drm/msm/dsi/phy/dsi_phy.h
+++ b/drivers/gpu/drm/msm/dsi/phy/dsi_phy.h
@@ -62,6 +62,7 @@ extern const struct msm_dsi_phy_cfg dsi_phy_7nm_7280_cfgs;
 extern const struct msm_dsi_phy_cfg dsi_phy_5nm_8350_cfgs;
 extern const struct msm_dsi_phy_cfg dsi_phy_5nm_8450_cfgs;
 extern const struct msm_dsi_phy_cfg dsi_phy_4nm_8550_cfgs;
+extern const struct msm_dsi_phy_cfg dsi_phy_4nm_8650_cfgs;
 
 struct msm_dsi_dphy_timing {
u32 clk_zero;
diff --git a/drivers/gpu/drm/msm/dsi/phy/dsi_phy_7nm.c 
b/drivers/gpu/drm/msm/dsi/phy/dsi_phy_7nm.c
index 3b1ed02f644d..c66193f2dc0d 100644
--- a/drivers/gpu/drm/msm/dsi/phy/dsi_phy_7nm.c
+++ b/drivers/gpu/drm/msm/dsi/phy/dsi_phy_7nm.c
@@ -1121,6 +1121,10 @@ static const struct regulator_bulk_data 
dsi_phy_7nm_37750uA_regulators[] = {
{ .supply = "vdds", .init_load_uA = 37550 },
 };
 
+static const struct regulator_bulk_data dsi_phy_7nm_98000uA_regulators[] = {
+   { .supply = "vdds", .init_load_uA = 98000 },
+};
+
 static const struct regulator_bulk_data dsi_phy_7nm_97800uA_regulators[] = {
{ .supply = "vdds", .init_load_uA = 97800 },
 };
@@ -1281,3 +1285,26 @@ const struct msm_dsi_phy_cfg dsi_phy_4nm_8550_cfgs = {
.num_dsi_phy = 2,
.quirks = DSI_PHY_7NM_QUIRK_V5_2,
 };
+
+const struct msm_dsi_phy_cfg dsi_phy_4nm_8650_cfgs = {
+   .has_phy_lane = true,
+   .regulator_data = dsi_phy_7nm_98000uA_regulators,
+   .num_regulators = ARRAY_SIZE(dsi_phy_7nm_98000uA_regulators),
+   .ops = {
+   .enable = dsi_7nm_phy_enable,
+   .disable = dsi_7nm_phy_disable,
+   .pll_init = dsi_pll_7nm_init,
+   .save_pll_state = dsi_7nm_pll_save_state,
+   .restore_pll_state = dsi_7nm_pll_restore_state,
+   .set_continuous_clock = dsi_7nm_set_continuous_clock,
+   },
+   .min_pll_rate = 6UL,
+#ifdef CONFIG_64BIT
+   .max_pll_rate = 50UL,
+#else
+   .max_pll_rate = ULONG_MAX,
+#endif
+   .io_start = { 0xae95000, 0xae97000 },
+   .num_dsi_phy = 2,
+   .quirks = DSI_PHY_7NM_QUIRK_V5_2,
+};

-- 
2.34.1



[Freedreno] [PATCH 5/8] drm/msm: dpu1: add support for SM8650 DPU

2023-10-25 Thread Neil Armstrong
Add DPU version 10.0 support for the SM8650 platform.

Signed-off-by: Neil Armstrong 
---
 .../drm/msm/disp/dpu1/catalog/dpu_10_0_sm8650.h| 458 +
 drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.c |  23 ++
 drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.h |   1 +
 drivers/gpu/drm/msm/disp/dpu1/dpu_hw_mdss.h|   3 +
 drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c|   1 +
 5 files changed, 486 insertions(+)

diff --git a/drivers/gpu/drm/msm/disp/dpu1/catalog/dpu_10_0_sm8650.h 
b/drivers/gpu/drm/msm/disp/dpu1/catalog/dpu_10_0_sm8650.h
new file mode 100644
index ..3a37d78804e7
--- /dev/null
+++ b/drivers/gpu/drm/msm/disp/dpu1/catalog/dpu_10_0_sm8650.h
@@ -0,0 +1,458 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+/*
+ * Copyright (c) 2022. Qualcomm Innovation Center, Inc. All rights reserved.
+ * Copyright (c) 2015-2018, 2020 The Linux Foundation. All rights reserved.
+ */
+
+#ifndef _DPU_10_0_SM8650_H
+#define _DPU_10_0_SM8650_H
+
+static const struct dpu_caps sm8650_dpu_caps = {
+   .max_mixer_width = DEFAULT_DPU_OUTPUT_LINE_WIDTH,
+   .max_mixer_blendstages = 0xb,
+   .qseed_type = DPU_SSPP_SCALER_QSEED4,
+   .has_src_split = true,
+   .has_dim_layer = true,
+   .has_idle_pc = true,
+   .has_3d_merge = true,
+   .max_linewidth = 8192,
+   .pixel_ram_size = DEFAULT_PIXEL_RAM_SIZE,
+};
+
+static const struct dpu_mdp_cfg sm8650_mdp = {
+   .name = "top_0",
+   .base = 0, .len = 0x494,
+   .features = BIT(DPU_MDP_PERIPH_0_REMOVED),
+   .clk_ctrls = {
+   [DPU_CLK_CTRL_REG_DMA] = { .reg_off = 0x2bc, .bit_off = 20 },
+   },
+};
+
+/* FIXME: get rid of DPU_CTL_SPLIT_DISPLAY in favour of proper ACTIVE_CTL 
support */
+static const struct dpu_ctl_cfg sm8650_ctl[] = {
+   {
+   .name = "ctl_0", .id = CTL_0,
+   .base = 0x15000, .len = 0x1000,
+   .features = CTL_SM8550_MASK | BIT(DPU_CTL_SPLIT_DISPLAY),
+   .intr_start = DPU_IRQ_IDX(MDP_SSPP_TOP0_INTR2, 9),
+   }, {
+   .name = "ctl_1", .id = CTL_1,
+   .base = 0x16000, .len = 0x1000,
+   .features = CTL_SM8550_MASK | BIT(DPU_CTL_SPLIT_DISPLAY),
+   .intr_start = DPU_IRQ_IDX(MDP_SSPP_TOP0_INTR2, 10),
+   }, {
+   .name = "ctl_2", .id = CTL_2,
+   .base = 0x17000, .len = 0x1000,
+   .features = CTL_SM8550_MASK,
+   .intr_start = DPU_IRQ_IDX(MDP_SSPP_TOP0_INTR2, 11),
+   }, {
+   .name = "ctl_3", .id = CTL_3,
+   .base = 0x18000, .len = 0x1000,
+   .features = CTL_SM8550_MASK,
+   .intr_start = DPU_IRQ_IDX(MDP_SSPP_TOP0_INTR2, 12),
+   }, {
+   .name = "ctl_4", .id = CTL_4,
+   .base = 0x19000, .len = 0x1000,
+   .features = CTL_SM8550_MASK,
+   .intr_start = DPU_IRQ_IDX(MDP_SSPP_TOP0_INTR2, 13),
+   }, {
+   .name = "ctl_5", .id = CTL_5,
+   .base = 0x1a000, .len = 0x1000,
+   .features = CTL_SM8550_MASK,
+   .intr_start = DPU_IRQ_IDX(MDP_SSPP_TOP0_INTR2, 23),
+   },
+};
+
+static const struct dpu_sspp_cfg sm8650_sspp[] = {
+   {
+   .name = "sspp_0", .id = SSPP_VIG0,
+   .base = 0x4000, .len = 0x344,
+   .features = VIG_SC7180_MASK,
+   .sblk = _vig_sblk_0,
+   .xin_id = 0,
+   .type = SSPP_TYPE_VIG,
+   }, {
+   .name = "sspp_1", .id = SSPP_VIG1,
+   .base = 0x6000, .len = 0x344,
+   .features = VIG_SC7180_MASK,
+   .sblk = _vig_sblk_1,
+   .xin_id = 4,
+   .type = SSPP_TYPE_VIG,
+   }, {
+   .name = "sspp_2", .id = SSPP_VIG2,
+   .base = 0x8000, .len = 0x344,
+   .features = VIG_SC7180_MASK,
+   .sblk = _vig_sblk_2,
+   .xin_id = 8,
+   .type = SSPP_TYPE_VIG,
+   }, {
+   .name = "sspp_3", .id = SSPP_VIG3,
+   .base = 0xa000, .len = 0x344,
+   .features = VIG_SC7180_MASK,
+   .sblk = _vig_sblk_3,
+   .xin_id = 12,
+   .type = SSPP_TYPE_VIG,
+   }, {
+   .name = "sspp_8", .id = SSPP_DMA0,
+   .base = 0x24000, .len = 0x344,
+   .features = DMA_SDM845_MASK,
+   .sblk = _dma_sblk_0,
+   .xin_id = 1,
+   .type = SSPP_TYPE_DMA,
+   }, {
+   .name = "sspp_9", .id = SSPP_DMA1,
+   .base = 0x26000, .len = 0x344,
+   .features = DMA_SDM845_MASK,
+   .sblk = _dma_sblk_1,
+   .xin_id = 5,
+   .type = SSPP_TYPE_DMA,
+   }, {
+   .name = "sspp_

[Freedreno] [PATCH 6/8] drm/msm: mdss: add support for SM8650

2023-10-25 Thread Neil Armstrong
Add Mobile Display Subsystem (MDSS) support for the SM8650 platform.

Signed-off-by: Neil Armstrong 
---
 drivers/gpu/drm/msm/msm_mdss.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/gpu/drm/msm/msm_mdss.c b/drivers/gpu/drm/msm/msm_mdss.c
index 6865db1e3ce8..33947a2e313c 100644
--- a/drivers/gpu/drm/msm/msm_mdss.c
+++ b/drivers/gpu/drm/msm/msm_mdss.c
@@ -621,6 +621,7 @@ static const struct of_device_id mdss_dt_match[] = {
{ .compatible = "qcom,sm8350-mdss", .data = _data },
{ .compatible = "qcom,sm8450-mdss", .data = _data },
{ .compatible = "qcom,sm8550-mdss", .data = _data },
+   { .compatible = "qcom,sm8650-mdss", .data = _data},
{}
 };
 MODULE_DEVICE_TABLE(of, mdss_dt_match);

-- 
2.34.1



[Freedreno] [PATCH 4/8] dt-bindings: display: msm: document the SM8650 Mobile Display Subsystem

2023-10-25 Thread Neil Armstrong
Document the Mobile Display Subsystem (MDSS) on the SM8650 Platform.

Signed-off-by: Neil Armstrong 
---
 .../bindings/display/msm/qcom,sm8650-mdss.yaml | 322 +
 1 file changed, 322 insertions(+)

diff --git 
a/Documentation/devicetree/bindings/display/msm/qcom,sm8650-mdss.yaml 
b/Documentation/devicetree/bindings/display/msm/qcom,sm8650-mdss.yaml
new file mode 100644
index ..5638c1ea692e
--- /dev/null
+++ b/Documentation/devicetree/bindings/display/msm/qcom,sm8650-mdss.yaml
@@ -0,0 +1,322 @@
+# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/display/msm/qcom,sm8650-mdss.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Qualcomm SM8650 Display MDSS
+
+maintainers:
+  - Neil Armstrong 
+
+description:
+  SM8650 MSM Mobile Display Subsystem(MDSS), which encapsulates sub-blocks like
+  DPU display controller, DSI and DP interfaces etc.
+
+$ref: /schemas/display/msm/mdss-common.yaml#
+
+properties:
+  compatible:
+const: qcom,sm8650-mdss
+
+  clocks:
+items:
+  - description: Display AHB
+  - description: Display hf AXI
+  - description: Display core
+
+  iommus:
+maxItems: 1
+
+  interconnects:
+maxItems: 2
+
+  interconnect-names:
+maxItems: 2
+
+patternProperties:
+  "^display-controller@[0-9a-f]+$":
+type: object
+properties:
+  compatible:
+const: qcom,sm8650-dpu
+
+  "^dsi@[0-9a-f]+$":
+type: object
+properties:
+  compatible:
+items:
+  - const: qcom,sm8650-dsi-ctrl
+  - const: qcom,mdss-dsi-ctrl
+
+  "^phy@[0-9a-f]+$":
+type: object
+properties:
+  compatible:
+const: qcom,sm8650-dsi-phy-4nm
+
+required:
+  - compatible
+
+unevaluatedProperties: false
+
+examples:
+  - |
+#include 
+#include 
+#include 
+
+display-subsystem@ae0 {
+compatible = "qcom,sm8650-mdss";
+reg = <0x0ae0 0x1000>;
+reg-names = "mdss";
+
+resets = <_core_bcr>;
+
+power-domains = <_gdsc>;
+
+clocks = <_ahb_clk>,
+ <_axi_clk>,
+ <_mdp_clk>;
+clock-names = "bus", "nrt_bus", "core";
+
+interrupts = ;
+interrupt-controller;
+#interrupt-cells = <1>;
+
+iommus = <_smmu 0x1c00 0x2>;
+
+#address-cells = <1>;
+#size-cells = <1>;
+ranges;
+
+display-controller@ae01000 {
+compatible = "qcom,sm8650-dpu";
+reg = <0x0ae01000 0x8f000>,
+  <0x0aeb 0x2008>;
+reg-names = "mdp", "vbif";
+
+clocks = <_axi_clk>,
+ <_ahb_clk>,
+ <_mdp_lut_clk>,
+ <_mdp_clk>,
+ <_mdp_vsync_clk>;
+clock-names = "nrt_bus",
+  "iface",
+  "lut",
+  "core",
+  "vsync";
+
+assigned-clocks = <_mdp_vsync_clk>;
+assigned-clock-rates = <1920>;
+
+operating-points-v2 = <_opp_table>;
+power-domains = < RPMHPD_MMCX>;
+
+interrupt-parent = <>;
+interrupts = <0>;
+
+ports {
+#address-cells = <1>;
+#size-cells = <0>;
+
+port@0 {
+reg = <0>;
+dpu_intf1_out: endpoint {
+remote-endpoint = <_in>;
+};
+};
+
+port@1 {
+reg = <1>;
+dpu_intf2_out: endpoint {
+remote-endpoint = <_in>;
+};
+};
+};
+
+mdp_opp_table: opp-table {
+compatible = "operating-points-v2";
+
+opp-2 {
+opp-hz = /bits/ 64 <2>;
+required-opps = <_opp_low_svs>;
+};
+
+opp-32500 {
+opp-hz = /bits/ 64 <32500>;
+required-opps = <_opp_svs>;
+};
+
+opp-37500 {
+opp-hz = /bits/ 64 <37500>;
+required-opps = <_opp_svs_l1>;
+};
+
+opp-51400 {
+opp-hz = /bits/ 64 <51400>;
+required-opps = <_opp_nom>;
+};
+};
+};
+
+dsi@ae94000 {
+compatible = &

[Freedreno] [PATCH 3/8] dt-bindings: display: msm: document the SM8650 DPU

2023-10-25 Thread Neil Armstrong
Document the DPU Display Controller on the SM8650 Platform.

Signed-off-by: Neil Armstrong 
---
 .../bindings/display/msm/qcom,sm8650-dpu.yaml  | 127 +
 1 file changed, 127 insertions(+)

diff --git a/Documentation/devicetree/bindings/display/msm/qcom,sm8650-dpu.yaml 
b/Documentation/devicetree/bindings/display/msm/qcom,sm8650-dpu.yaml
new file mode 100644
index ..a01d15a03317
--- /dev/null
+++ b/Documentation/devicetree/bindings/display/msm/qcom,sm8650-dpu.yaml
@@ -0,0 +1,127 @@
+# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/display/msm/qcom,sm8650-dpu.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Qualcomm SM8650 Display DPU
+
+maintainers:
+  - Neil Armstrong 
+
+$ref: /schemas/display/msm/dpu-common.yaml#
+
+properties:
+  compatible:
+const: qcom,sm8650-dpu
+
+  reg:
+items:
+  - description: Address offset and size for mdp register set
+  - description: Address offset and size for vbif register set
+
+  reg-names:
+items:
+  - const: mdp
+  - const: vbif
+
+  clocks:
+items:
+  - description: Display hf axi
+  - description: Display MDSS ahb
+  - description: Display lut
+  - description: Display core
+  - description: Display vsync
+
+  clock-names:
+items:
+  - const: nrt_bus
+  - const: iface
+  - const: lut
+  - const: core
+  - const: vsync
+
+required:
+  - compatible
+  - reg
+  - reg-names
+  - clocks
+  - clock-names
+
+unevaluatedProperties: false
+
+examples:
+  - |
+#include 
+#include 
+
+display-controller@ae01000 {
+compatible = "qcom,sm8650-dpu";
+reg = <0x0ae01000 0x8f000>,
+  <0x0aeb 0x2008>;
+reg-names = "mdp", "vbif";
+
+clocks = <_axi_clk>,
+ <_ahb_clk>,
+ <_mdp_lut_clk>,
+ <_mdp_clk>,
+ <_vsync_clk>;
+clock-names = "nrt_bus",
+  "iface",
+  "lut",
+  "core",
+  "vsync";
+
+assigned-clocks = <_vsync_clk>;
+assigned-clock-rates = <1920>;
+
+operating-points-v2 = <_opp_table>;
+power-domains = < RPMHPD_MMCX>;
+
+interrupt-parent = <>;
+interrupts = <0>;
+
+ports {
+#address-cells = <1>;
+#size-cells = <0>;
+
+port@0 {
+reg = <0>;
+dpu_intf1_out: endpoint {
+remote-endpoint = <_in>;
+};
+};
+
+port@1 {
+reg = <1>;
+dpu_intf2_out: endpoint {
+remote-endpoint = <_in>;
+};
+};
+};
+
+mdp_opp_table: opp-table {
+compatible = "operating-points-v2";
+
+opp-2 {
+opp-hz = /bits/ 64 <2>;
+required-opps = <_opp_low_svs>;
+};
+
+opp-32500 {
+opp-hz = /bits/ 64 <32500>;
+required-opps = <_opp_svs>;
+};
+
+opp-37500 {
+opp-hz = /bits/ 64 <37500>;
+required-opps = <_opp_svs_l1>;
+};
+
+opp-51400 {
+opp-hz = /bits/ 64 <51400>;
+required-opps = <_opp_nom>;
+};
+};
+};
+...

-- 
2.34.1



[Freedreno] [PATCH 2/8] dt-bindings: display: msm-dsi-controller-main: document the SM8650 DSI Controller

2023-10-25 Thread Neil Armstrong
Document the DSI Controller on the SM8650 Platform.

Signed-off-by: Neil Armstrong 
---
 Documentation/devicetree/bindings/display/msm/dsi-controller-main.yaml | 2 ++
 1 file changed, 2 insertions(+)

diff --git 
a/Documentation/devicetree/bindings/display/msm/dsi-controller-main.yaml 
b/Documentation/devicetree/bindings/display/msm/dsi-controller-main.yaml
index c6dbab65d5f7..24944979d500 100644
--- a/Documentation/devicetree/bindings/display/msm/dsi-controller-main.yaml
+++ b/Documentation/devicetree/bindings/display/msm/dsi-controller-main.yaml
@@ -35,6 +35,7 @@ properties:
   - qcom,sm8350-dsi-ctrl
   - qcom,sm8450-dsi-ctrl
   - qcom,sm8550-dsi-ctrl
+  - qcom,sm8650-dsi-ctrl
   - const: qcom,mdss-dsi-ctrl
   - enum:
   - qcom,dsi-ctrl-6g-qcm2290
@@ -333,6 +334,7 @@ allOf:
   - qcom,sm8350-dsi-ctrl
   - qcom,sm8450-dsi-ctrl
   - qcom,sm8550-dsi-ctrl
+  - qcom,sm8650-dsi-ctrl
 then:
   properties:
 clocks:

-- 
2.34.1



[Freedreno] [PATCH 1/8] dt-bindings: display: msm-dsi-phy-7nm: document the SM8650 DSI PHY

2023-10-25 Thread Neil Armstrong
Document the DSI PHY on the SM8650 Platform.

Signed-off-by: Neil Armstrong 
---
 Documentation/devicetree/bindings/display/msm/dsi-phy-7nm.yaml | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Documentation/devicetree/bindings/display/msm/dsi-phy-7nm.yaml 
b/Documentation/devicetree/bindings/display/msm/dsi-phy-7nm.yaml
index dd6619555a12..7e764eac3ef3 100644
--- a/Documentation/devicetree/bindings/display/msm/dsi-phy-7nm.yaml
+++ b/Documentation/devicetree/bindings/display/msm/dsi-phy-7nm.yaml
@@ -22,6 +22,7 @@ properties:
   - qcom,sm8350-dsi-phy-5nm
   - qcom,sm8450-dsi-phy-5nm
   - qcom,sm8550-dsi-phy-4nm
+  - qcom,sm8650-dsi-phy-4nm
 
   reg:
 items:

-- 
2.34.1



[Freedreno] [PATCH 0/8] drm/msm: Introduce display support for SM8650

2023-10-25 Thread Neil Armstrong
The SM8650 MDSS is very close from the MDSS 9.0.0 found
on the SM8550 SoC, with the following difference:
- DSI PHY 2.8.8, no significant differences
- DPU 10.0.0:
  - Enhanced max_linewidth to 8k
  - PINGPONG_8 & PINGPONG_9
  - MERGE_3D_4
  - DSC_4 & DSC_5, DSC_NATIVE_42x on DSC0/1

This patchset contains DSI PHY, DSI Controller, DPU & MDSS bindings
in addition to the driver changes.

Support for Display Port output is expected for later.

Dependencies: None

For convenience, a regularly refreshed linux-next based git tree containing
all the SM8650 related work is available at:
https://git.codelinaro.org/neil.armstrong/linux/-/tree/topic/sm85650/upstream/integ

Signed-off-by: Neil Armstrong 
---
Neil Armstrong (8):
  dt-bindings: display: msm-dsi-phy-7nm: document the SM8650 DSI PHY
  dt-bindings: display: msm-dsi-controller-main: document the SM8650 DSI 
Controller
  dt-bindings: display: msm: document the SM8650 DPU
  dt-bindings: display: msm: document the SM8650 Mobile Display Subsystem
  drm/msm: dpu1: add support for SM8650 DPU
  drm/msm: mdss: add support for SM8650
  drm/msm: dsi: add support for DSI-PHY on SM8650
  drm/msm: dsi: add support for DSI 2.8.0

 .../bindings/display/msm/dsi-controller-main.yaml  |   2 +
 .../bindings/display/msm/dsi-phy-7nm.yaml  |   1 +
 .../bindings/display/msm/qcom,sm8650-dpu.yaml  | 127 ++
 .../bindings/display/msm/qcom,sm8650-mdss.yaml | 322 +++
 .../drm/msm/disp/dpu1/catalog/dpu_10_0_sm8650.h| 458 +
 drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.c |  23 ++
 drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.h |   1 +
 drivers/gpu/drm/msm/disp/dpu1/dpu_hw_mdss.h|   3 +
 drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c|   1 +
 drivers/gpu/drm/msm/dsi/dsi_cfg.c  |  17 +
 drivers/gpu/drm/msm/dsi/dsi_cfg.h  |   1 +
 drivers/gpu/drm/msm/dsi/phy/dsi_phy.c  |   2 +
 drivers/gpu/drm/msm/dsi/phy/dsi_phy.h  |   1 +
 drivers/gpu/drm/msm/dsi/phy/dsi_phy_7nm.c  |  27 ++
 drivers/gpu/drm/msm/msm_mdss.c |   1 +
 15 files changed, 987 insertions(+)
---
base-commit: fe1998aa935b44ef873193c0772c43bce74f17dc
change-id: 20231016-topic-sm8650-upstream-mdss-e3d95e09c7b8

Best regards,
-- 
Neil Armstrong 



Re: [Freedreno] [RFC PATCH 03/10] drm/mipi-dsi: add API for manual control over the DSI link power state

2023-10-23 Thread Neil Armstrong

On 16/10/2023 18:53, Dmitry Baryshkov wrote:

The MIPI DSI links do not fully fall into the DRM callbacks model. The
drm_bridge_funcs abstraction. Instead of having just two states (off and
on) the DSI hosts have separate LP-11 state. In this state the host is
on, but the video stream is not yet enabled.

Introduce API that allows DSI bridges / panels to control the DSI host
power up state.

Signed-off-by: Dmitry Baryshkov 
---
  drivers/gpu/drm/drm_mipi_dsi.c | 31 +++
  include/drm/drm_mipi_dsi.h | 29 +
  2 files changed, 56 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/drm_mipi_dsi.c b/drivers/gpu/drm/drm_mipi_dsi.c
index 14201f73aab1..c467162cb7d8 100644
--- a/drivers/gpu/drm/drm_mipi_dsi.c
+++ b/drivers/gpu/drm/drm_mipi_dsi.c
@@ -428,6 +428,37 @@ int devm_mipi_dsi_attach(struct device *dev,
  }
  EXPORT_SYMBOL_GPL(devm_mipi_dsi_attach);
  
+bool mipi_dsi_host_power_control_available(struct mipi_dsi_host *host)

+{
+   const struct mipi_dsi_host_ops *ops = host->ops;
+
+   return ops && ops->power_up;
+}
+EXPORT_SYMBOL_GPL(mipi_dsi_host_power_control_available);
+
+int mipi_dsi_host_power_up(struct mipi_dsi_host *host)
+{
+   const struct mipi_dsi_host_ops *ops = host->ops;
+
+   if (!mipi_dsi_host_power_control_available(host))
+   return -EOPNOTSUPP;
+
+   return ops->power_up ? ops->power_up(host) : 0;
+}
+EXPORT_SYMBOL_GPL(mipi_dsi_host_power_up);
+
+void mipi_dsi_host_power_down(struct mipi_dsi_host *host)
+{
+   const struct mipi_dsi_host_ops *ops = host->ops;
+
+   if (!mipi_dsi_host_power_control_available(host))
+   return;
+
+   if (ops->power_down)
+   ops->power_down(host);
+}
+EXPORT_SYMBOL_GPL(mipi_dsi_host_power_down);
+
  static ssize_t mipi_dsi_device_transfer(struct mipi_dsi_device *dsi,
struct mipi_dsi_msg *msg)
  {
diff --git a/include/drm/drm_mipi_dsi.h b/include/drm/drm_mipi_dsi.h
index 167742e579e3..e503c3e4d057 100644
--- a/include/drm/drm_mipi_dsi.h
+++ b/include/drm/drm_mipi_dsi.h
@@ -68,6 +68,8 @@ int mipi_dsi_create_packet(struct mipi_dsi_packet *packet,
   * @attach: attach DSI device to DSI host
   * @detach: detach DSI device from DSI host
   * @transfer: transmit a DSI packet
+ * @power_up: enable DSI link and bring it to the LP-11 state
+ * @power_down: fully disable DSI link
   *
   * DSI packets transmitted by .transfer() are passed in as mipi_dsi_msg
   * structures. This structure contains information about the type of packet
@@ -81,10 +83,18 @@ int mipi_dsi_create_packet(struct mipi_dsi_packet *packet,
   * function will seldomly return anything other than the number of bytes
   * contained in the transmit buffer on success.
   *
- * Also note that those callbacks can be called no matter the state the
- * host is in. Drivers that need the underlying device to be powered to
- * perform these operations will first need to make sure it's been
- * properly enabled.
+ * Note: currently there are two modes of DSI power control. Legacy drivers
+ * will call those callbacks no matter the state the host is in. DSI host
+ * drivers that need the underlying device to be powered to perform these
+ * operations will first need to make sure it's been properly enabled.
+ *
+ * Newer drivers will set the @MIPI_DSI_MANUAL_POWERUP flag to indicate that
+ * they will call @mipi_dsi_power_up() and @mipi_dsi_power_down() to control
+ * the link state of the DSI host or they will set @MIPI_DSI_AUTO_POWERUP to
+ * indicate that the driver is fine with the link being powered up in DSI
+ * host's (atomic_)pre_enable() callback and then being disabled in the
+ * (atomic_)post_disable() callback. The transfer callback must only be called
+ * if the DSI host has been powered up and was not brought down.
   *
   * Note: some hosts (sunxi) can not send LP commands between HS video
   * packets. Thus all DSI transfers sent in LP mode should be limited to the
@@ -97,6 +107,8 @@ struct mipi_dsi_host_ops {
  struct mipi_dsi_device *dsi);
ssize_t (*transfer)(struct mipi_dsi_host *host,
const struct mipi_dsi_msg *msg);
+   int (*power_up)(struct mipi_dsi_host *host);
+   void (*power_down)(struct mipi_dsi_host *host);
  };
  
  /**

@@ -143,6 +155,10 @@ struct mipi_dsi_host *of_find_mipi_dsi_host_by_node(struct 
device_node *node);
  #define MIPI_DSI_MODE_LPM BIT(11)
  /* transmit data ending at the same time for all lanes within one hsync */
  #define MIPI_DSI_HS_PKT_END_ALIGNED   BIT(12)
+/* DSI peripheral driver manually controls DSI link powerup */
+#define MIPI_DSI_MANUAL_POWERUPBIT(13)
+/* DSI peripheral driver is fine with automatic DSI link power control */
+#define MIPI_DSI_AUTO_POWERUP  BIT(14)


What happens if none of the bits are in the flags ?

Can't we implement "opportunistic power-up" on the first DSI 

[Freedreno] [PATCH v3 4/5] drm/msm/dpu: sm8550: remove unused VIG and DMA clock controls entries

2023-10-12 Thread Neil Armstrong
The SM8550 has the SSPP clk_ctrl in the SSPP registers, remove the
duplicate clock controls from the MDP top.

Reviewed-by: Dmitry Baryshkov 
Signed-off-by: Neil Armstrong 
---
 .../gpu/drm/msm/disp/dpu1/catalog/dpu_9_0_sm8550.h   | 20 
 1 file changed, 20 deletions(-)

diff --git a/drivers/gpu/drm/msm/disp/dpu1/catalog/dpu_9_0_sm8550.h 
b/drivers/gpu/drm/msm/disp/dpu1/catalog/dpu_9_0_sm8550.h
index 7bed819dfc39..4590a01c1252 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/catalog/dpu_9_0_sm8550.h
+++ b/drivers/gpu/drm/msm/disp/dpu1/catalog/dpu_9_0_sm8550.h
@@ -24,16 +24,6 @@ static const struct dpu_mdp_cfg sm8550_mdp = {
.base = 0, .len = 0x494,
.features = BIT(DPU_MDP_PERIPH_0_REMOVED),
.clk_ctrls = {
-   [DPU_CLK_CTRL_VIG0] = { .reg_off = 0x4330, .bit_off = 0 },
-   [DPU_CLK_CTRL_VIG1] = { .reg_off = 0x6330, .bit_off = 0 },
-   [DPU_CLK_CTRL_VIG2] = { .reg_off = 0x8330, .bit_off = 0 },
-   [DPU_CLK_CTRL_VIG3] = { .reg_off = 0xa330, .bit_off = 0 },
-   [DPU_CLK_CTRL_DMA0] = { .reg_off = 0x24330, .bit_off = 0 },
-   [DPU_CLK_CTRL_DMA1] = { .reg_off = 0x26330, .bit_off = 0 },
-   [DPU_CLK_CTRL_DMA2] = { .reg_off = 0x28330, .bit_off = 0 },
-   [DPU_CLK_CTRL_DMA3] = { .reg_off = 0x2a330, .bit_off = 0 },
-   [DPU_CLK_CTRL_DMA4] = { .reg_off = 0x2c330, .bit_off = 0 },
-   [DPU_CLK_CTRL_DMA5] = { .reg_off = 0x2e330, .bit_off = 0 },
[DPU_CLK_CTRL_REG_DMA] = { .reg_off = 0x2bc, .bit_off = 20 },
},
 };
@@ -81,7 +71,6 @@ static const struct dpu_sspp_cfg sm8550_sspp[] = {
.sblk = _vig_sblk_0,
.xin_id = 0,
.type = SSPP_TYPE_VIG,
-   .clk_ctrl = DPU_CLK_CTRL_VIG0,
}, {
.name = "sspp_1", .id = SSPP_VIG1,
.base = 0x6000, .len = 0x344,
@@ -89,7 +78,6 @@ static const struct dpu_sspp_cfg sm8550_sspp[] = {
.sblk = _vig_sblk_1,
.xin_id = 4,
.type = SSPP_TYPE_VIG,
-   .clk_ctrl = DPU_CLK_CTRL_VIG1,
}, {
.name = "sspp_2", .id = SSPP_VIG2,
.base = 0x8000, .len = 0x344,
@@ -97,7 +85,6 @@ static const struct dpu_sspp_cfg sm8550_sspp[] = {
.sblk = _vig_sblk_2,
.xin_id = 8,
.type = SSPP_TYPE_VIG,
-   .clk_ctrl = DPU_CLK_CTRL_VIG2,
}, {
.name = "sspp_3", .id = SSPP_VIG3,
.base = 0xa000, .len = 0x344,
@@ -105,7 +92,6 @@ static const struct dpu_sspp_cfg sm8550_sspp[] = {
.sblk = _vig_sblk_3,
.xin_id = 12,
.type = SSPP_TYPE_VIG,
-   .clk_ctrl = DPU_CLK_CTRL_VIG3,
}, {
.name = "sspp_8", .id = SSPP_DMA0,
.base = 0x24000, .len = 0x344,
@@ -113,7 +99,6 @@ static const struct dpu_sspp_cfg sm8550_sspp[] = {
.sblk = _dma_sblk_0,
.xin_id = 1,
.type = SSPP_TYPE_DMA,
-   .clk_ctrl = DPU_CLK_CTRL_DMA0,
}, {
.name = "sspp_9", .id = SSPP_DMA1,
.base = 0x26000, .len = 0x344,
@@ -121,7 +106,6 @@ static const struct dpu_sspp_cfg sm8550_sspp[] = {
.sblk = _dma_sblk_1,
.xin_id = 5,
.type = SSPP_TYPE_DMA,
-   .clk_ctrl = DPU_CLK_CTRL_DMA1,
}, {
.name = "sspp_10", .id = SSPP_DMA2,
.base = 0x28000, .len = 0x344,
@@ -129,7 +113,6 @@ static const struct dpu_sspp_cfg sm8550_sspp[] = {
.sblk = _dma_sblk_2,
.xin_id = 9,
.type = SSPP_TYPE_DMA,
-   .clk_ctrl = DPU_CLK_CTRL_DMA2,
}, {
.name = "sspp_11", .id = SSPP_DMA3,
.base = 0x2a000, .len = 0x344,
@@ -137,7 +120,6 @@ static const struct dpu_sspp_cfg sm8550_sspp[] = {
.sblk = _dma_sblk_3,
.xin_id = 13,
.type = SSPP_TYPE_DMA,
-   .clk_ctrl = DPU_CLK_CTRL_DMA3,
}, {
.name = "sspp_12", .id = SSPP_DMA4,
.base = 0x2c000, .len = 0x344,
@@ -145,7 +127,6 @@ static const struct dpu_sspp_cfg sm8550_sspp[] = {
.sblk = _dma_sblk_4,
.xin_id = 14,
.type = SSPP_TYPE_DMA,
-   .clk_ctrl = DPU_CLK_CTRL_DMA4,
}, {
.name = "sspp_13", .id = SSPP_DMA5,
.base = 0x2e000, .len = 0x344,
@@ -153,7 +134,6 @@ static const struct dpu_sspp_cfg sm8550_sspp[] = {
.sblk = _dma_sblk_5,
.xin_id = 15,
.type = SSPP_TYPE_DMA,
-   .clk_ctrl = DPU_CLK_CTRL_DMA5,
},
 };
 

-- 
2.34.1



[Freedreno] [PATCH v3 5/5] drm/msm/dpu: enable writeback on SM8550

2023-10-12 Thread Neil Armstrong
Enable WB2 hardware block, enabling writeback support on this platform.

Reviewed-by: Dmitry Baryshkov 
Signed-off-by: Neil Armstrong 
---
 drivers/gpu/drm/msm/disp/dpu1/catalog/dpu_9_0_sm8550.h | 16 
 1 file changed, 16 insertions(+)

diff --git a/drivers/gpu/drm/msm/disp/dpu1/catalog/dpu_9_0_sm8550.h 
b/drivers/gpu/drm/msm/disp/dpu1/catalog/dpu_9_0_sm8550.h
index 4590a01c1252..d83a68a2cc0a 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/catalog/dpu_9_0_sm8550.h
+++ b/drivers/gpu/drm/msm/disp/dpu1/catalog/dpu_9_0_sm8550.h
@@ -321,6 +321,20 @@ static const struct dpu_dsc_cfg sm8550_dsc[] = {
},
 };
 
+static const struct dpu_wb_cfg sm8550_wb[] = {
+   {
+   .name = "wb_2", .id = WB_2,
+   .base = 0x65000, .len = 0x2c8,
+   .features = WB_SM8250_MASK,
+   .format_list = wb2_formats,
+   .num_formats = ARRAY_SIZE(wb2_formats),
+   .xin_id = 6,
+   .vbif_idx = VBIF_RT,
+   .maxlinewidth = 4096,
+   .intr_wb_done = DPU_IRQ_IDX(MDP_SSPP_TOP0_INTR, 4),
+   },
+};
+
 static const struct dpu_intf_cfg sm8550_intf[] = {
{
.name = "intf_0", .id = INTF_0,
@@ -418,6 +432,8 @@ const struct dpu_mdss_cfg dpu_sm8550_cfg = {
.dsc = sm8550_dsc,
.merge_3d_count = ARRAY_SIZE(sm8550_merge_3d),
.merge_3d = sm8550_merge_3d,
+   .wb_count = ARRAY_SIZE(sm8550_wb),
+   .wb = sm8550_wb,
.intf_count = ARRAY_SIZE(sm8550_intf),
.intf = sm8550_intf,
.vbif_count = ARRAY_SIZE(sm8550_vbif),

-- 
2.34.1



[Freedreno] [PATCH v3 3/5] drm/msm/dpu: move setup_force_clk_ctrl handling into plane and wb

2023-10-12 Thread Neil Armstrong
Now SSPP and WB can have setup_force_clk_ctrl() ops, it's simpler to call
them from the plane and wb code and call into the mdp ops if not present.

Reviewed-by: Dmitry Baryshkov 
Signed-off-by: Neil Armstrong 
---
 .../gpu/drm/msm/disp/dpu1/dpu_encoder_phys_wb.c| 37 +--
 drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c  | 42 +++---
 drivers/gpu/drm/msm/disp/dpu1/dpu_vbif.c   | 30 +++-
 drivers/gpu/drm/msm/disp/dpu1/dpu_vbif.h   |  4 ---
 4 files changed, 77 insertions(+), 36 deletions(-)

diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_wb.c 
b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_wb.c
index 78037a697633..8802e007f8e2 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_wb.c
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_wb.c
@@ -34,6 +34,23 @@ static bool dpu_encoder_phys_wb_is_master(struct 
dpu_encoder_phys *phys_enc)
return true;
 }
 
+static bool _dpu_encoder_phys_wb_clk_force_ctrl(struct dpu_hw_wb *wb,
+   struct dpu_hw_mdp *mdp,
+   bool enable, bool *forced_on)
+{
+   if (wb->ops.setup_clk_force_ctrl) {
+   *forced_on = wb->ops.setup_clk_force_ctrl(wb, enable);
+   return true;
+   }
+
+   if (mdp->ops.setup_clk_force_ctrl) {
+   *forced_on = mdp->ops.setup_clk_force_ctrl(mdp, 
wb->caps->clk_ctrl, enable);
+   return true;
+   }
+
+   return false;
+}
+
 /**
  * dpu_encoder_phys_wb_set_ot_limit - set OT limit for writeback interface
  * @phys_enc:  Pointer to physical encoder
@@ -43,6 +60,7 @@ static void dpu_encoder_phys_wb_set_ot_limit(
 {
struct dpu_hw_wb *hw_wb = phys_enc->hw_wb;
struct dpu_vbif_set_ot_params ot_params;
+   bool forced_on = false;
 
memset(_params, 0, sizeof(ot_params));
ot_params.xin_id = hw_wb->caps->xin_id;
@@ -52,10 +70,17 @@ static void dpu_encoder_phys_wb_set_ot_limit(
ot_params.is_wfd = true;
ot_params.frame_rate = drm_mode_vrefresh(_enc->cached_mode);
ot_params.vbif_idx = hw_wb->caps->vbif_idx;
-   ot_params.clk_ctrl = hw_wb->caps->clk_ctrl;
ot_params.rd = false;
 
+   if (!_dpu_encoder_phys_wb_clk_force_ctrl(hw_wb, 
phys_enc->dpu_kms->hw_mdp,
+true, _on))
+   return;
+
dpu_vbif_set_ot_limit(phys_enc->dpu_kms, _params);
+
+   if (forced_on)
+   _dpu_encoder_phys_wb_clk_force_ctrl(hw_wb, 
phys_enc->dpu_kms->hw_mdp,
+   false, _on);
 }
 
 /**
@@ -67,6 +92,7 @@ static void dpu_encoder_phys_wb_set_qos_remap(
 {
struct dpu_hw_wb *hw_wb;
struct dpu_vbif_set_qos_params qos_params;
+   bool forced_on = false;
 
if (!phys_enc || !phys_enc->parent || !phys_enc->parent->crtc) {
DPU_ERROR("invalid arguments\n");
@@ -83,7 +109,6 @@ static void dpu_encoder_phys_wb_set_qos_remap(
memset(_params, 0, sizeof(qos_params));
qos_params.vbif_idx = hw_wb->caps->vbif_idx;
qos_params.xin_id = hw_wb->caps->xin_id;
-   qos_params.clk_ctrl = hw_wb->caps->clk_ctrl;
qos_params.num = hw_wb->idx - WB_0;
qos_params.is_rt = false;
 
@@ -92,7 +117,15 @@ static void dpu_encoder_phys_wb_set_qos_remap(
qos_params.vbif_idx,
qos_params.xin_id, qos_params.is_rt);
 
+   if (!_dpu_encoder_phys_wb_clk_force_ctrl(hw_wb, 
phys_enc->dpu_kms->hw_mdp,
+true, _on))
+   return;
+
dpu_vbif_set_qos_remap(phys_enc->dpu_kms, _params);
+
+   if (forced_on)
+   _dpu_encoder_phys_wb_clk_force_ctrl(hw_wb, 
phys_enc->dpu_kms->hw_mdp,
+   false, _on);
 }
 
 /**
diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c 
b/drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c
index c2aaaded07ed..c63cae8fb35c 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c
@@ -333,6 +333,23 @@ static void _dpu_plane_set_qos_ctrl(struct drm_plane 
*plane,
   enable);
 }
 
+static bool _dpu_plane_sspp_clk_force_ctrl(struct dpu_hw_sspp *sspp,
+  struct dpu_hw_mdp *mdp,
+  bool enable, bool *forced_on)
+{
+   if (sspp->ops.setup_clk_force_ctrl) {
+   *forced_on = sspp->ops.setup_clk_force_ctrl(sspp, enable);
+   return true;
+   }
+
+   if (mdp->ops.setup_clk_force_ctrl) {
+   *forced_on = mdp->ops.setup_clk_force_ctrl(mdp, 
sspp->cap->clk_ctrl, enable);
+   return true;
+   

[Freedreno] [PATCH v3 1/5] drm/msm/dpu: create a dpu_hw_clk_force_ctrl() helper

2023-10-12 Thread Neil Armstrong
Add an helper to setup the force clock control as it will
be used in multiple HW files.

Reviewed-by: Dmitry Baryshkov 
Signed-off-by: Neil Armstrong 
---
 drivers/gpu/drm/msm/disp/dpu1/dpu_hw_top.c  | 23 +--
 drivers/gpu/drm/msm/disp/dpu1/dpu_hw_util.c | 21 +
 drivers/gpu/drm/msm/disp/dpu1/dpu_hw_util.h |  4 
 3 files changed, 26 insertions(+), 22 deletions(-)

diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_top.c 
b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_top.c
index cff48763ce25..24e734768a72 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_top.c
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_top.c
@@ -66,34 +66,13 @@ static void dpu_hw_setup_split_pipe(struct dpu_hw_mdp *mdp,
 static bool dpu_hw_setup_clk_force_ctrl(struct dpu_hw_mdp *mdp,
enum dpu_clk_ctrl_type clk_ctrl, bool enable)
 {
-   struct dpu_hw_blk_reg_map *c;
-   u32 reg_off, bit_off;
-   u32 reg_val, new_val;
-   bool clk_forced_on;
-
if (!mdp)
return false;
 
-   c = >hw;
-
if (clk_ctrl <= DPU_CLK_CTRL_NONE || clk_ctrl >= DPU_CLK_CTRL_MAX)
return false;
 
-   reg_off = mdp->caps->clk_ctrls[clk_ctrl].reg_off;
-   bit_off = mdp->caps->clk_ctrls[clk_ctrl].bit_off;
-
-   reg_val = DPU_REG_READ(c, reg_off);
-
-   if (enable)
-   new_val = reg_val | BIT(bit_off);
-   else
-   new_val = reg_val & ~BIT(bit_off);
-
-   DPU_REG_WRITE(c, reg_off, new_val);
-
-   clk_forced_on = !(reg_val & BIT(bit_off));
-
-   return clk_forced_on;
+   return dpu_hw_clk_force_ctrl(>hw, >caps->clk_ctrls[clk_ctrl], 
enable);
 }
 
 
diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_util.c 
b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_util.c
index 9d2273fd2fed..18b16b2d2bf5 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_util.c
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_util.c
@@ -546,3 +546,24 @@ void dpu_setup_cdp(struct dpu_hw_blk_reg_map *c, u32 
offset,
 
DPU_REG_WRITE(c, offset, cdp_cntl);
 }
+
+bool dpu_hw_clk_force_ctrl(struct dpu_hw_blk_reg_map *c,
+  const struct dpu_clk_ctrl_reg *clk_ctrl_reg,
+  bool enable)
+{
+   u32 reg_val, new_val;
+   bool clk_forced_on;
+
+   reg_val = DPU_REG_READ(c, clk_ctrl_reg->reg_off);
+
+   if (enable)
+   new_val = reg_val | BIT(clk_ctrl_reg->bit_off);
+   else
+   new_val = reg_val & ~BIT(clk_ctrl_reg->bit_off);
+
+   DPU_REG_WRITE(c, clk_ctrl_reg->reg_off, new_val);
+
+   clk_forced_on = !(reg_val & BIT(clk_ctrl_reg->bit_off));
+
+   return clk_forced_on;
+}
diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_util.h 
b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_util.h
index 1f6079f47071..4bea139081bc 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_util.h
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_util.h
@@ -367,4 +367,8 @@ int dpu_hw_collect_misr(struct dpu_hw_blk_reg_map *c,
u32 misr_signature_offset,
u32 *misr_value);
 
+bool dpu_hw_clk_force_ctrl(struct dpu_hw_blk_reg_map *c,
+  const struct dpu_clk_ctrl_reg *clk_ctrl_reg,
+  bool enable);
+
 #endif /* _DPU_HW_UTIL_H */

-- 
2.34.1



[Freedreno] [PATCH v3 2/5] drm/msm/dpu: add setup_clk_force_ctrl() op to sspp & wb

2023-10-12 Thread Neil Armstrong
Starting from SM8550, the SSPP & WB clock controls are moved
the SSPP and WB register range, as it's called "VBIF_CLK_SPLIT"
downstream.

Implement setup_clk_force_ctrl() only starting from major version 9
which corresponds to SM8550 MDSS.

Reviewed-by: Dmitry Baryshkov 
Signed-off-by: Neil Armstrong 
---
 drivers/gpu/drm/msm/disp/dpu1/dpu_hw_sspp.c | 21 ++---
 drivers/gpu/drm/msm/disp/dpu1/dpu_hw_sspp.h | 12 +++-
 drivers/gpu/drm/msm/disp/dpu1/dpu_hw_wb.c   | 20 +---
 drivers/gpu/drm/msm/disp/dpu1/dpu_hw_wb.h   |  7 ++-
 drivers/gpu/drm/msm/disp/dpu1/dpu_rm.c  |  4 ++--
 5 files changed, 54 insertions(+), 10 deletions(-)

diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_sspp.c 
b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_sspp.c
index f2192de93713..8e3c65989c49 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_sspp.c
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_sspp.c
@@ -69,6 +69,7 @@
 #define SSPP_EXCL_REC_XY_REC1  0x188
 #define SSPP_EXCL_REC_SIZE 0x1B4
 #define SSPP_EXCL_REC_XY   0x1B8
+#define SSPP_CLK_CTRL  0x330
 
 /* SSPP_SRC_OP_MODE & OP_MODE_REC1 */
 #define MDSS_MDP_OP_DEINTERLACEBIT(22)
@@ -581,8 +582,18 @@ static void dpu_hw_sspp_setup_cdp(struct dpu_sw_pipe *pipe,
dpu_setup_cdp(>hw, cdp_cntl_offset, fmt, enable);
 }
 
+static bool dpu_hw_sspp_setup_clk_force_ctrl(struct dpu_hw_sspp *ctx, bool 
enable)
+{
+   static const struct dpu_clk_ctrl_reg sspp_clk_ctrl = {
+   .reg_off = SSPP_CLK_CTRL,
+   .bit_off = 0
+   };
+
+   return dpu_hw_clk_force_ctrl(>hw, _clk_ctrl, enable);
+}
+
 static void _setup_layer_ops(struct dpu_hw_sspp *c,
-   unsigned long features)
+   unsigned long features, const struct dpu_mdss_version *mdss_rev)
 {
c->ops.setup_format = dpu_hw_sspp_setup_format;
c->ops.setup_rects = dpu_hw_sspp_setup_rects;
@@ -612,6 +623,9 @@ static void _setup_layer_ops(struct dpu_hw_sspp *c,
 
if (test_bit(DPU_SSPP_CDP, ))
c->ops.setup_cdp = dpu_hw_sspp_setup_cdp;
+
+   if (mdss_rev->core_major_ver >= 9)
+   c->ops.setup_clk_force_ctrl = dpu_hw_sspp_setup_clk_force_ctrl;
 }
 
 #ifdef CONFIG_DEBUG_FS
@@ -672,7 +686,8 @@ int _dpu_hw_sspp_init_debugfs(struct dpu_hw_sspp *hw_pipe, 
struct dpu_kms *kms,
 #endif
 
 struct dpu_hw_sspp *dpu_hw_sspp_init(const struct dpu_sspp_cfg *cfg,
-   void __iomem *addr, const struct msm_mdss_data *mdss_data)
+   void __iomem *addr, const struct msm_mdss_data *mdss_data,
+   const struct dpu_mdss_version *mdss_rev)
 {
struct dpu_hw_sspp *hw_pipe;
 
@@ -690,7 +705,7 @@ struct dpu_hw_sspp *dpu_hw_sspp_init(const struct 
dpu_sspp_cfg *cfg,
hw_pipe->ubwc = mdss_data;
hw_pipe->idx = cfg->id;
hw_pipe->cap = cfg;
-   _setup_layer_ops(hw_pipe, hw_pipe->cap->features);
+   _setup_layer_ops(hw_pipe, hw_pipe->cap->features, mdss_rev);
 
return hw_pipe;
 }
diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_sspp.h 
b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_sspp.h
index cbf4f95ff0fd..f93969fddb22 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_sspp.h
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_sspp.h
@@ -271,6 +271,14 @@ struct dpu_hw_sspp_ops {
void (*setup_qos_ctrl)(struct dpu_hw_sspp *ctx,
   bool danger_safe_en);
 
+   /**
+* setup_clk_force_ctrl - setup clock force control
+* @ctx: Pointer to pipe context
+* @enable: enable clock force if true
+*/
+   bool (*setup_clk_force_ctrl)(struct dpu_hw_sspp *ctx,
+bool enable);
+
/**
 * setup_histogram - setup histograms
 * @ctx: Pointer to pipe context
@@ -334,9 +342,11 @@ struct dpu_kms;
  * @cfg:  Pipe catalog entry for which driver object is required
  * @addr: Mapped register io address of MDP
  * @mdss_data: UBWC / MDSS configuration data
+ * @mdss_rev: dpu core's major and minor versions
  */
 struct dpu_hw_sspp *dpu_hw_sspp_init(const struct dpu_sspp_cfg *cfg,
-   void __iomem *addr, const struct msm_mdss_data *mdss_data);
+   void __iomem *addr, const struct msm_mdss_data *mdss_data,
+   const struct dpu_mdss_version *mdss_rev);
 
 /**
  * dpu_hw_sspp_destroy(): Destroys SSPP driver context
diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_wb.c 
b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_wb.c
index ebc416400382..9668fb97c047 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_wb.c
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_wb.c
@@ -43,6 +43,7 @@
 #define WB_MUX0x150
 #define WB_CROP_CTRL  0x154
 #define WB_CROP_OFFSET0x158
+#define WB_CLK_CTRL   0x178
 #define WB_CSC_B

[Freedreno] [PATCH v3 0/5] drm/msm/dpu: correctly implement SSPP & WB Clock Control Split

2023-10-12 Thread Neil Armstrong
Starting with the SM8550 platform, the SSPP & WB Clock Controls are
no more in the MDP TOP registers, but in the SSPP & WB register space.

Add the corresponding SSPP & WB ops and use them before/after calling the
QoS and OT limit setup functions.

WB tested with:
$ modetest -M msm -a -s 40@103:1024x768 -o test.d -P 47@103:1024x768

Signed-off-by: Neil Armstrong 
---
Changes in v3:
- Collected reviews
- Add static const to clk_ctrl struct in sspp/wb
- Link to v2: 
https://lore.kernel.org/r/20231011-topic-sm8550-graphics-sspp-split-clk-v2-0-b219c945d...@linaro.org

Changes in v2:
- moved all force_clk_ctrl code out of vbif
- use major ver test to add force_clk_ctrl op
- do not add clk_ctrl reg into sspp/wb cap struct
- add WB2 on sm8550
- Link to v1: 
https://lore.kernel.org/r/20231009-topic-sm8550-graphics-sspp-split-clk-v1-0-806c0dee4...@linaro.org

---
Neil Armstrong (5):
  drm/msm/dpu: create a dpu_hw_clk_force_ctrl() helper
  drm/msm/dpu: add setup_clk_force_ctrl() op to sspp & wb
  drm/msm/dpu: move setup_force_clk_ctrl handling into plane and wb
  drm/msm/dpu: sm8550: remove unused VIG and DMA clock controls entries
  drm/msm/dpu: enable writeback on SM8550

 .../gpu/drm/msm/disp/dpu1/catalog/dpu_9_0_sm8550.h | 36 +--
 .../gpu/drm/msm/disp/dpu1/dpu_encoder_phys_wb.c| 37 +--
 drivers/gpu/drm/msm/disp/dpu1/dpu_hw_sspp.c| 21 +--
 drivers/gpu/drm/msm/disp/dpu1/dpu_hw_sspp.h| 12 ++-
 drivers/gpu/drm/msm/disp/dpu1/dpu_hw_top.c | 23 +---
 drivers/gpu/drm/msm/disp/dpu1/dpu_hw_util.c| 21 +++
 drivers/gpu/drm/msm/disp/dpu1/dpu_hw_util.h|  4 +++
 drivers/gpu/drm/msm/disp/dpu1/dpu_hw_wb.c  | 20 +--
 drivers/gpu/drm/msm/disp/dpu1/dpu_hw_wb.h  |  7 +++-
 drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c  | 42 +++---
 drivers/gpu/drm/msm/disp/dpu1/dpu_rm.c |  4 +--
 drivers/gpu/drm/msm/disp/dpu1/dpu_vbif.c   | 30 +++-
 drivers/gpu/drm/msm/disp/dpu1/dpu_vbif.h   |  4 ---
 13 files changed, 173 insertions(+), 88 deletions(-)
---
base-commit: 9119cf579b4432b36be9d33a92f4331922067d92
change-id: 20231009-topic-sm8550-graphics-sspp-split-clk-43c32e37b6aa

Best regards,
-- 
Neil Armstrong 



Re: [Freedreno] [PATCH v2 2/5] drm/msm/dpu: add setup_clk_force_ctrl() op to sspp & wb

2023-10-11 Thread Neil Armstrong

On 11/10/2023 14:45, Dmitry Baryshkov wrote:

On Wed, 11 Oct 2023 at 14:59, Neil Armstrong  wrote:


Starting from SM8550, the SSPP & WB clock controls are moved
the SSPP and WB register range, as it's called "VBIF_CLK_SPLIT"
downstream.

Implement setup_clk_force_ctrl() only starting from major version 9
which corresponds to SM8550 MDSS.

Signed-off-by: Neil Armstrong 


With two minor issues below fixed:

Reviewed-by: Dmitry Baryshkov 


---
  drivers/gpu/drm/msm/disp/dpu1/dpu_hw_sspp.c | 21 ++---
  drivers/gpu/drm/msm/disp/dpu1/dpu_hw_sspp.h | 12 +++-
  drivers/gpu/drm/msm/disp/dpu1/dpu_hw_wb.c   | 20 +---
  drivers/gpu/drm/msm/disp/dpu1/dpu_hw_wb.h   |  7 ++-
  drivers/gpu/drm/msm/disp/dpu1/dpu_rm.c  |  4 ++--
  5 files changed, 54 insertions(+), 10 deletions(-)

diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_sspp.c 
b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_sspp.c
index f2192de93713..5fd213ed6491 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_sspp.c
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_sspp.c
@@ -69,6 +69,7 @@
  #define SSPP_EXCL_REC_XY_REC1  0x188
  #define SSPP_EXCL_REC_SIZE 0x1B4
  #define SSPP_EXCL_REC_XY   0x1B8
+#define SSPP_CLK_CTRL  0x330

  /* SSPP_SRC_OP_MODE & OP_MODE_REC1 */
  #define MDSS_MDP_OP_DEINTERLACEBIT(22)
@@ -581,8 +582,18 @@ static void dpu_hw_sspp_setup_cdp(struct dpu_sw_pipe *pipe,
 dpu_setup_cdp(>hw, cdp_cntl_offset, fmt, enable);
  }

+static bool dpu_hw_sspp_setup_clk_force_ctrl(struct dpu_hw_sspp *ctx, bool 
enable)
+{
+   struct dpu_clk_ctrl_reg sspp_clk_ctrl = {


Nit: static const?


Yep will add




+   .reg_off = SSPP_CLK_CTRL,
+   .bit_off = 0
+   };
+
+   return dpu_hw_clk_force_ctrl(>hw, _clk_ctrl, enable);
+}
+
  static void _setup_layer_ops(struct dpu_hw_sspp *c,
-   unsigned long features)
+   unsigned long features, const struct dpu_mdss_version *mdss_rev)
  {
 c->ops.setup_format = dpu_hw_sspp_setup_format;
 c->ops.setup_rects = dpu_hw_sspp_setup_rects;
@@ -612,6 +623,9 @@ static void _setup_layer_ops(struct dpu_hw_sspp *c,

 if (test_bit(DPU_SSPP_CDP, ))
 c->ops.setup_cdp = dpu_hw_sspp_setup_cdp;
+
+   if (mdss_rev->core_major_ver >= 9)
+   c->ops.setup_clk_force_ctrl = dpu_hw_sspp_setup_clk_force_ctrl;
  }

  #ifdef CONFIG_DEBUG_FS
@@ -672,7 +686,8 @@ int _dpu_hw_sspp_init_debugfs(struct dpu_hw_sspp *hw_pipe, 
struct dpu_kms *kms,
  #endif

  struct dpu_hw_sspp *dpu_hw_sspp_init(const struct dpu_sspp_cfg *cfg,
-   void __iomem *addr, const struct msm_mdss_data *mdss_data)
+   void __iomem *addr, const struct msm_mdss_data *mdss_data,
+   const struct dpu_mdss_version *mdss_rev)
  {
 struct dpu_hw_sspp *hw_pipe;

@@ -690,7 +705,7 @@ struct dpu_hw_sspp *dpu_hw_sspp_init(const struct 
dpu_sspp_cfg *cfg,
 hw_pipe->ubwc = mdss_data;
 hw_pipe->idx = cfg->id;
 hw_pipe->cap = cfg;
-   _setup_layer_ops(hw_pipe, hw_pipe->cap->features);
+   _setup_layer_ops(hw_pipe, hw_pipe->cap->features, mdss_rev);

 return hw_pipe;
  }
diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_sspp.h 
b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_sspp.h
index cbf4f95ff0fd..f93969fddb22 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_sspp.h
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_sspp.h
@@ -271,6 +271,14 @@ struct dpu_hw_sspp_ops {
 void (*setup_qos_ctrl)(struct dpu_hw_sspp *ctx,
bool danger_safe_en);

+   /**
+* setup_clk_force_ctrl - setup clock force control
+* @ctx: Pointer to pipe context
+* @enable: enable clock force if true
+*/
+   bool (*setup_clk_force_ctrl)(struct dpu_hw_sspp *ctx,
+bool enable);
+
 /**
  * setup_histogram - setup histograms
  * @ctx: Pointer to pipe context
@@ -334,9 +342,11 @@ struct dpu_kms;
   * @cfg:  Pipe catalog entry for which driver object is required
   * @addr: Mapped register io address of MDP
   * @mdss_data: UBWC / MDSS configuration data
+ * @mdss_rev: dpu core's major and minor versions
   */
  struct dpu_hw_sspp *dpu_hw_sspp_init(const struct dpu_sspp_cfg *cfg,
-   void __iomem *addr, const struct msm_mdss_data *mdss_data);
+   void __iomem *addr, const struct msm_mdss_data *mdss_data,
+   const struct dpu_mdss_version *mdss_rev);

  /**
   * dpu_hw_sspp_destroy(): Destroys SSPP driver context
diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_wb.c 
b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_wb.c
index ebc416400382..374c2c64c9e4 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_wb.c
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_wb.c
@@ -43,6 +43,7 @@
  #define 

[Freedreno] [PATCH v2 3/5] drm/msm/dpu: move setup_force_clk_ctrl handling into plane and wb

2023-10-11 Thread Neil Armstrong
Now SSPP and WB can have setup_force_clk_ctrl() ops, it's simpler to call
them from the plane and wb code and call into the mdp ops if not present.

Signed-off-by: Neil Armstrong 
---
 .../gpu/drm/msm/disp/dpu1/dpu_encoder_phys_wb.c| 37 +--
 drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c  | 42 +++---
 drivers/gpu/drm/msm/disp/dpu1/dpu_vbif.c   | 30 +++-
 drivers/gpu/drm/msm/disp/dpu1/dpu_vbif.h   |  4 ---
 4 files changed, 77 insertions(+), 36 deletions(-)

diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_wb.c 
b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_wb.c
index 78037a697633..8802e007f8e2 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_wb.c
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_wb.c
@@ -34,6 +34,23 @@ static bool dpu_encoder_phys_wb_is_master(struct 
dpu_encoder_phys *phys_enc)
return true;
 }
 
+static bool _dpu_encoder_phys_wb_clk_force_ctrl(struct dpu_hw_wb *wb,
+   struct dpu_hw_mdp *mdp,
+   bool enable, bool *forced_on)
+{
+   if (wb->ops.setup_clk_force_ctrl) {
+   *forced_on = wb->ops.setup_clk_force_ctrl(wb, enable);
+   return true;
+   }
+
+   if (mdp->ops.setup_clk_force_ctrl) {
+   *forced_on = mdp->ops.setup_clk_force_ctrl(mdp, 
wb->caps->clk_ctrl, enable);
+   return true;
+   }
+
+   return false;
+}
+
 /**
  * dpu_encoder_phys_wb_set_ot_limit - set OT limit for writeback interface
  * @phys_enc:  Pointer to physical encoder
@@ -43,6 +60,7 @@ static void dpu_encoder_phys_wb_set_ot_limit(
 {
struct dpu_hw_wb *hw_wb = phys_enc->hw_wb;
struct dpu_vbif_set_ot_params ot_params;
+   bool forced_on = false;
 
memset(_params, 0, sizeof(ot_params));
ot_params.xin_id = hw_wb->caps->xin_id;
@@ -52,10 +70,17 @@ static void dpu_encoder_phys_wb_set_ot_limit(
ot_params.is_wfd = true;
ot_params.frame_rate = drm_mode_vrefresh(_enc->cached_mode);
ot_params.vbif_idx = hw_wb->caps->vbif_idx;
-   ot_params.clk_ctrl = hw_wb->caps->clk_ctrl;
ot_params.rd = false;
 
+   if (!_dpu_encoder_phys_wb_clk_force_ctrl(hw_wb, 
phys_enc->dpu_kms->hw_mdp,
+true, _on))
+   return;
+
dpu_vbif_set_ot_limit(phys_enc->dpu_kms, _params);
+
+   if (forced_on)
+   _dpu_encoder_phys_wb_clk_force_ctrl(hw_wb, 
phys_enc->dpu_kms->hw_mdp,
+   false, _on);
 }
 
 /**
@@ -67,6 +92,7 @@ static void dpu_encoder_phys_wb_set_qos_remap(
 {
struct dpu_hw_wb *hw_wb;
struct dpu_vbif_set_qos_params qos_params;
+   bool forced_on = false;
 
if (!phys_enc || !phys_enc->parent || !phys_enc->parent->crtc) {
DPU_ERROR("invalid arguments\n");
@@ -83,7 +109,6 @@ static void dpu_encoder_phys_wb_set_qos_remap(
memset(_params, 0, sizeof(qos_params));
qos_params.vbif_idx = hw_wb->caps->vbif_idx;
qos_params.xin_id = hw_wb->caps->xin_id;
-   qos_params.clk_ctrl = hw_wb->caps->clk_ctrl;
qos_params.num = hw_wb->idx - WB_0;
qos_params.is_rt = false;
 
@@ -92,7 +117,15 @@ static void dpu_encoder_phys_wb_set_qos_remap(
qos_params.vbif_idx,
qos_params.xin_id, qos_params.is_rt);
 
+   if (!_dpu_encoder_phys_wb_clk_force_ctrl(hw_wb, 
phys_enc->dpu_kms->hw_mdp,
+true, _on))
+   return;
+
dpu_vbif_set_qos_remap(phys_enc->dpu_kms, _params);
+
+   if (forced_on)
+   _dpu_encoder_phys_wb_clk_force_ctrl(hw_wb, 
phys_enc->dpu_kms->hw_mdp,
+   false, _on);
 }
 
 /**
diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c 
b/drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c
index c2aaaded07ed..c63cae8fb35c 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c
@@ -333,6 +333,23 @@ static void _dpu_plane_set_qos_ctrl(struct drm_plane 
*plane,
   enable);
 }
 
+static bool _dpu_plane_sspp_clk_force_ctrl(struct dpu_hw_sspp *sspp,
+  struct dpu_hw_mdp *mdp,
+  bool enable, bool *forced_on)
+{
+   if (sspp->ops.setup_clk_force_ctrl) {
+   *forced_on = sspp->ops.setup_clk_force_ctrl(sspp, enable);
+   return true;
+   }
+
+   if (mdp->ops.setup_clk_force_ctrl) {
+   *forced_on = mdp->ops.setup_clk_force_ctrl(mdp, 
sspp->cap->clk_ctrl, enable);
+   return true;
+   }
+
+   return false;
+}
+

[Freedreno] [PATCH v2 5/5] drm/msm/dpu: enable writeback on SM8550

2023-10-11 Thread Neil Armstrong
Enable WB2 hardware block, enabling writeback support on this platform.

Signed-off-by: Neil Armstrong 
---
 drivers/gpu/drm/msm/disp/dpu1/catalog/dpu_9_0_sm8550.h | 16 
 1 file changed, 16 insertions(+)

diff --git a/drivers/gpu/drm/msm/disp/dpu1/catalog/dpu_9_0_sm8550.h 
b/drivers/gpu/drm/msm/disp/dpu1/catalog/dpu_9_0_sm8550.h
index 4590a01c1252..d83a68a2cc0a 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/catalog/dpu_9_0_sm8550.h
+++ b/drivers/gpu/drm/msm/disp/dpu1/catalog/dpu_9_0_sm8550.h
@@ -321,6 +321,20 @@ static const struct dpu_dsc_cfg sm8550_dsc[] = {
},
 };
 
+static const struct dpu_wb_cfg sm8550_wb[] = {
+   {
+   .name = "wb_2", .id = WB_2,
+   .base = 0x65000, .len = 0x2c8,
+   .features = WB_SM8250_MASK,
+   .format_list = wb2_formats,
+   .num_formats = ARRAY_SIZE(wb2_formats),
+   .xin_id = 6,
+   .vbif_idx = VBIF_RT,
+   .maxlinewidth = 4096,
+   .intr_wb_done = DPU_IRQ_IDX(MDP_SSPP_TOP0_INTR, 4),
+   },
+};
+
 static const struct dpu_intf_cfg sm8550_intf[] = {
{
.name = "intf_0", .id = INTF_0,
@@ -418,6 +432,8 @@ const struct dpu_mdss_cfg dpu_sm8550_cfg = {
.dsc = sm8550_dsc,
.merge_3d_count = ARRAY_SIZE(sm8550_merge_3d),
.merge_3d = sm8550_merge_3d,
+   .wb_count = ARRAY_SIZE(sm8550_wb),
+   .wb = sm8550_wb,
.intf_count = ARRAY_SIZE(sm8550_intf),
.intf = sm8550_intf,
.vbif_count = ARRAY_SIZE(sm8550_vbif),

-- 
2.34.1



[Freedreno] [PATCH v2 4/5] drm/msm/dpu: sm8550: remove unused VIG and DMA clock controls entries

2023-10-11 Thread Neil Armstrong
The SM8550 has the SSPP clk_ctrl in the SSPP registers, remove the
duplicate clock controls from the MDP top.

Signed-off-by: Neil Armstrong 
---
 .../gpu/drm/msm/disp/dpu1/catalog/dpu_9_0_sm8550.h   | 20 
 1 file changed, 20 deletions(-)

diff --git a/drivers/gpu/drm/msm/disp/dpu1/catalog/dpu_9_0_sm8550.h 
b/drivers/gpu/drm/msm/disp/dpu1/catalog/dpu_9_0_sm8550.h
index 7bed819dfc39..4590a01c1252 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/catalog/dpu_9_0_sm8550.h
+++ b/drivers/gpu/drm/msm/disp/dpu1/catalog/dpu_9_0_sm8550.h
@@ -24,16 +24,6 @@ static const struct dpu_mdp_cfg sm8550_mdp = {
.base = 0, .len = 0x494,
.features = BIT(DPU_MDP_PERIPH_0_REMOVED),
.clk_ctrls = {
-   [DPU_CLK_CTRL_VIG0] = { .reg_off = 0x4330, .bit_off = 0 },
-   [DPU_CLK_CTRL_VIG1] = { .reg_off = 0x6330, .bit_off = 0 },
-   [DPU_CLK_CTRL_VIG2] = { .reg_off = 0x8330, .bit_off = 0 },
-   [DPU_CLK_CTRL_VIG3] = { .reg_off = 0xa330, .bit_off = 0 },
-   [DPU_CLK_CTRL_DMA0] = { .reg_off = 0x24330, .bit_off = 0 },
-   [DPU_CLK_CTRL_DMA1] = { .reg_off = 0x26330, .bit_off = 0 },
-   [DPU_CLK_CTRL_DMA2] = { .reg_off = 0x28330, .bit_off = 0 },
-   [DPU_CLK_CTRL_DMA3] = { .reg_off = 0x2a330, .bit_off = 0 },
-   [DPU_CLK_CTRL_DMA4] = { .reg_off = 0x2c330, .bit_off = 0 },
-   [DPU_CLK_CTRL_DMA5] = { .reg_off = 0x2e330, .bit_off = 0 },
[DPU_CLK_CTRL_REG_DMA] = { .reg_off = 0x2bc, .bit_off = 20 },
},
 };
@@ -81,7 +71,6 @@ static const struct dpu_sspp_cfg sm8550_sspp[] = {
.sblk = _vig_sblk_0,
.xin_id = 0,
.type = SSPP_TYPE_VIG,
-   .clk_ctrl = DPU_CLK_CTRL_VIG0,
}, {
.name = "sspp_1", .id = SSPP_VIG1,
.base = 0x6000, .len = 0x344,
@@ -89,7 +78,6 @@ static const struct dpu_sspp_cfg sm8550_sspp[] = {
.sblk = _vig_sblk_1,
.xin_id = 4,
.type = SSPP_TYPE_VIG,
-   .clk_ctrl = DPU_CLK_CTRL_VIG1,
}, {
.name = "sspp_2", .id = SSPP_VIG2,
.base = 0x8000, .len = 0x344,
@@ -97,7 +85,6 @@ static const struct dpu_sspp_cfg sm8550_sspp[] = {
.sblk = _vig_sblk_2,
.xin_id = 8,
.type = SSPP_TYPE_VIG,
-   .clk_ctrl = DPU_CLK_CTRL_VIG2,
}, {
.name = "sspp_3", .id = SSPP_VIG3,
.base = 0xa000, .len = 0x344,
@@ -105,7 +92,6 @@ static const struct dpu_sspp_cfg sm8550_sspp[] = {
.sblk = _vig_sblk_3,
.xin_id = 12,
.type = SSPP_TYPE_VIG,
-   .clk_ctrl = DPU_CLK_CTRL_VIG3,
}, {
.name = "sspp_8", .id = SSPP_DMA0,
.base = 0x24000, .len = 0x344,
@@ -113,7 +99,6 @@ static const struct dpu_sspp_cfg sm8550_sspp[] = {
.sblk = _dma_sblk_0,
.xin_id = 1,
.type = SSPP_TYPE_DMA,
-   .clk_ctrl = DPU_CLK_CTRL_DMA0,
}, {
.name = "sspp_9", .id = SSPP_DMA1,
.base = 0x26000, .len = 0x344,
@@ -121,7 +106,6 @@ static const struct dpu_sspp_cfg sm8550_sspp[] = {
.sblk = _dma_sblk_1,
.xin_id = 5,
.type = SSPP_TYPE_DMA,
-   .clk_ctrl = DPU_CLK_CTRL_DMA1,
}, {
.name = "sspp_10", .id = SSPP_DMA2,
.base = 0x28000, .len = 0x344,
@@ -129,7 +113,6 @@ static const struct dpu_sspp_cfg sm8550_sspp[] = {
.sblk = _dma_sblk_2,
.xin_id = 9,
.type = SSPP_TYPE_DMA,
-   .clk_ctrl = DPU_CLK_CTRL_DMA2,
}, {
.name = "sspp_11", .id = SSPP_DMA3,
.base = 0x2a000, .len = 0x344,
@@ -137,7 +120,6 @@ static const struct dpu_sspp_cfg sm8550_sspp[] = {
.sblk = _dma_sblk_3,
.xin_id = 13,
.type = SSPP_TYPE_DMA,
-   .clk_ctrl = DPU_CLK_CTRL_DMA3,
}, {
.name = "sspp_12", .id = SSPP_DMA4,
.base = 0x2c000, .len = 0x344,
@@ -145,7 +127,6 @@ static const struct dpu_sspp_cfg sm8550_sspp[] = {
.sblk = _dma_sblk_4,
.xin_id = 14,
.type = SSPP_TYPE_DMA,
-   .clk_ctrl = DPU_CLK_CTRL_DMA4,
}, {
.name = "sspp_13", .id = SSPP_DMA5,
.base = 0x2e000, .len = 0x344,
@@ -153,7 +134,6 @@ static const struct dpu_sspp_cfg sm8550_sspp[] = {
.sblk = _dma_sblk_5,
.xin_id = 15,
.type = SSPP_TYPE_DMA,
-   .clk_ctrl = DPU_CLK_CTRL_DMA5,
},
 };
 

-- 
2.34.1



[Freedreno] [PATCH v2 2/5] drm/msm/dpu: add setup_clk_force_ctrl() op to sspp & wb

2023-10-11 Thread Neil Armstrong
Starting from SM8550, the SSPP & WB clock controls are moved
the SSPP and WB register range, as it's called "VBIF_CLK_SPLIT"
downstream.

Implement setup_clk_force_ctrl() only starting from major version 9
which corresponds to SM8550 MDSS.

Signed-off-by: Neil Armstrong 
---
 drivers/gpu/drm/msm/disp/dpu1/dpu_hw_sspp.c | 21 ++---
 drivers/gpu/drm/msm/disp/dpu1/dpu_hw_sspp.h | 12 +++-
 drivers/gpu/drm/msm/disp/dpu1/dpu_hw_wb.c   | 20 +---
 drivers/gpu/drm/msm/disp/dpu1/dpu_hw_wb.h   |  7 ++-
 drivers/gpu/drm/msm/disp/dpu1/dpu_rm.c  |  4 ++--
 5 files changed, 54 insertions(+), 10 deletions(-)

diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_sspp.c 
b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_sspp.c
index f2192de93713..5fd213ed6491 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_sspp.c
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_sspp.c
@@ -69,6 +69,7 @@
 #define SSPP_EXCL_REC_XY_REC1  0x188
 #define SSPP_EXCL_REC_SIZE 0x1B4
 #define SSPP_EXCL_REC_XY   0x1B8
+#define SSPP_CLK_CTRL  0x330
 
 /* SSPP_SRC_OP_MODE & OP_MODE_REC1 */
 #define MDSS_MDP_OP_DEINTERLACEBIT(22)
@@ -581,8 +582,18 @@ static void dpu_hw_sspp_setup_cdp(struct dpu_sw_pipe *pipe,
dpu_setup_cdp(>hw, cdp_cntl_offset, fmt, enable);
 }
 
+static bool dpu_hw_sspp_setup_clk_force_ctrl(struct dpu_hw_sspp *ctx, bool 
enable)
+{
+   struct dpu_clk_ctrl_reg sspp_clk_ctrl = {
+   .reg_off = SSPP_CLK_CTRL,
+   .bit_off = 0
+   };
+
+   return dpu_hw_clk_force_ctrl(>hw, _clk_ctrl, enable);
+}
+
 static void _setup_layer_ops(struct dpu_hw_sspp *c,
-   unsigned long features)
+   unsigned long features, const struct dpu_mdss_version *mdss_rev)
 {
c->ops.setup_format = dpu_hw_sspp_setup_format;
c->ops.setup_rects = dpu_hw_sspp_setup_rects;
@@ -612,6 +623,9 @@ static void _setup_layer_ops(struct dpu_hw_sspp *c,
 
if (test_bit(DPU_SSPP_CDP, ))
c->ops.setup_cdp = dpu_hw_sspp_setup_cdp;
+
+   if (mdss_rev->core_major_ver >= 9)
+   c->ops.setup_clk_force_ctrl = dpu_hw_sspp_setup_clk_force_ctrl;
 }
 
 #ifdef CONFIG_DEBUG_FS
@@ -672,7 +686,8 @@ int _dpu_hw_sspp_init_debugfs(struct dpu_hw_sspp *hw_pipe, 
struct dpu_kms *kms,
 #endif
 
 struct dpu_hw_sspp *dpu_hw_sspp_init(const struct dpu_sspp_cfg *cfg,
-   void __iomem *addr, const struct msm_mdss_data *mdss_data)
+   void __iomem *addr, const struct msm_mdss_data *mdss_data,
+   const struct dpu_mdss_version *mdss_rev)
 {
struct dpu_hw_sspp *hw_pipe;
 
@@ -690,7 +705,7 @@ struct dpu_hw_sspp *dpu_hw_sspp_init(const struct 
dpu_sspp_cfg *cfg,
hw_pipe->ubwc = mdss_data;
hw_pipe->idx = cfg->id;
hw_pipe->cap = cfg;
-   _setup_layer_ops(hw_pipe, hw_pipe->cap->features);
+   _setup_layer_ops(hw_pipe, hw_pipe->cap->features, mdss_rev);
 
return hw_pipe;
 }
diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_sspp.h 
b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_sspp.h
index cbf4f95ff0fd..f93969fddb22 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_sspp.h
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_sspp.h
@@ -271,6 +271,14 @@ struct dpu_hw_sspp_ops {
void (*setup_qos_ctrl)(struct dpu_hw_sspp *ctx,
   bool danger_safe_en);
 
+   /**
+* setup_clk_force_ctrl - setup clock force control
+* @ctx: Pointer to pipe context
+* @enable: enable clock force if true
+*/
+   bool (*setup_clk_force_ctrl)(struct dpu_hw_sspp *ctx,
+bool enable);
+
/**
 * setup_histogram - setup histograms
 * @ctx: Pointer to pipe context
@@ -334,9 +342,11 @@ struct dpu_kms;
  * @cfg:  Pipe catalog entry for which driver object is required
  * @addr: Mapped register io address of MDP
  * @mdss_data: UBWC / MDSS configuration data
+ * @mdss_rev: dpu core's major and minor versions
  */
 struct dpu_hw_sspp *dpu_hw_sspp_init(const struct dpu_sspp_cfg *cfg,
-   void __iomem *addr, const struct msm_mdss_data *mdss_data);
+   void __iomem *addr, const struct msm_mdss_data *mdss_data,
+   const struct dpu_mdss_version *mdss_rev);
 
 /**
  * dpu_hw_sspp_destroy(): Destroys SSPP driver context
diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_wb.c 
b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_wb.c
index ebc416400382..374c2c64c9e4 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_wb.c
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_wb.c
@@ -43,6 +43,7 @@
 #define WB_MUX0x150
 #define WB_CROP_CTRL  0x154
 #define WB_CROP_OFFSET0x158
+#define WB_CLK_CTRL   0x178
 #define WB_CSC_BASE   0x260
 #defin

[Freedreno] [PATCH v2 1/5] drm/msm/dpu: create a dpu_hw_clk_force_ctrl() helper

2023-10-11 Thread Neil Armstrong
Add an helper to setup the force clock control as it will
be used in multiple HW files.

Reviewed-by: Dmitry Baryshkov 
Signed-off-by: Neil Armstrong 
---
 drivers/gpu/drm/msm/disp/dpu1/dpu_hw_top.c  | 23 +--
 drivers/gpu/drm/msm/disp/dpu1/dpu_hw_util.c | 21 +
 drivers/gpu/drm/msm/disp/dpu1/dpu_hw_util.h |  4 
 3 files changed, 26 insertions(+), 22 deletions(-)

diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_top.c 
b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_top.c
index cff48763ce25..24e734768a72 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_top.c
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_top.c
@@ -66,34 +66,13 @@ static void dpu_hw_setup_split_pipe(struct dpu_hw_mdp *mdp,
 static bool dpu_hw_setup_clk_force_ctrl(struct dpu_hw_mdp *mdp,
enum dpu_clk_ctrl_type clk_ctrl, bool enable)
 {
-   struct dpu_hw_blk_reg_map *c;
-   u32 reg_off, bit_off;
-   u32 reg_val, new_val;
-   bool clk_forced_on;
-
if (!mdp)
return false;
 
-   c = >hw;
-
if (clk_ctrl <= DPU_CLK_CTRL_NONE || clk_ctrl >= DPU_CLK_CTRL_MAX)
return false;
 
-   reg_off = mdp->caps->clk_ctrls[clk_ctrl].reg_off;
-   bit_off = mdp->caps->clk_ctrls[clk_ctrl].bit_off;
-
-   reg_val = DPU_REG_READ(c, reg_off);
-
-   if (enable)
-   new_val = reg_val | BIT(bit_off);
-   else
-   new_val = reg_val & ~BIT(bit_off);
-
-   DPU_REG_WRITE(c, reg_off, new_val);
-
-   clk_forced_on = !(reg_val & BIT(bit_off));
-
-   return clk_forced_on;
+   return dpu_hw_clk_force_ctrl(>hw, >caps->clk_ctrls[clk_ctrl], 
enable);
 }
 
 
diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_util.c 
b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_util.c
index 9d2273fd2fed..18b16b2d2bf5 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_util.c
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_util.c
@@ -546,3 +546,24 @@ void dpu_setup_cdp(struct dpu_hw_blk_reg_map *c, u32 
offset,
 
DPU_REG_WRITE(c, offset, cdp_cntl);
 }
+
+bool dpu_hw_clk_force_ctrl(struct dpu_hw_blk_reg_map *c,
+  const struct dpu_clk_ctrl_reg *clk_ctrl_reg,
+  bool enable)
+{
+   u32 reg_val, new_val;
+   bool clk_forced_on;
+
+   reg_val = DPU_REG_READ(c, clk_ctrl_reg->reg_off);
+
+   if (enable)
+   new_val = reg_val | BIT(clk_ctrl_reg->bit_off);
+   else
+   new_val = reg_val & ~BIT(clk_ctrl_reg->bit_off);
+
+   DPU_REG_WRITE(c, clk_ctrl_reg->reg_off, new_val);
+
+   clk_forced_on = !(reg_val & BIT(clk_ctrl_reg->bit_off));
+
+   return clk_forced_on;
+}
diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_util.h 
b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_util.h
index 1f6079f47071..4bea139081bc 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_util.h
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_util.h
@@ -367,4 +367,8 @@ int dpu_hw_collect_misr(struct dpu_hw_blk_reg_map *c,
u32 misr_signature_offset,
u32 *misr_value);
 
+bool dpu_hw_clk_force_ctrl(struct dpu_hw_blk_reg_map *c,
+  const struct dpu_clk_ctrl_reg *clk_ctrl_reg,
+  bool enable);
+
 #endif /* _DPU_HW_UTIL_H */

-- 
2.34.1



[Freedreno] [PATCH v2 0/5] drm/msm/dpu: correctly implement SSPP & WB Clock Control Split

2023-10-11 Thread Neil Armstrong
Starting with the SM8550 platform, the SSPP & WB Clock Controls are
no more in the MDP TOP registers, but in the SSPP & WB register space.

Add the corresponding SSPP & WB ops and use them before/after calling the
QoS and OT limit setup functions.

Signed-off-by: Neil Armstrong 
---
Changes in v2:
- moved all force_clk_ctrl code out of vbif
- use major ver test to add force_clk_ctrl op
- do not add clk_ctrl reg into sspp/wb cap struct
- add WB2 on sm8550
- Link to v1: 
https://lore.kernel.org/r/20231009-topic-sm8550-graphics-sspp-split-clk-v1-0-806c0dee4...@linaro.org

---
Neil Armstrong (5):
  drm/msm/dpu: create a dpu_hw_clk_force_ctrl() helper
  drm/msm/dpu: add setup_clk_force_ctrl() op to sspp & wb
  drm/msm/dpu: move setup_force_clk_ctrl handling into plane and wb
  drm/msm/dpu: sm8550: remove unused VIG and DMA clock controls entries
  drm/msm/dpu: enable writeback on SM8550

 .../gpu/drm/msm/disp/dpu1/catalog/dpu_9_0_sm8550.h | 36 +--
 .../gpu/drm/msm/disp/dpu1/dpu_encoder_phys_wb.c| 37 +--
 drivers/gpu/drm/msm/disp/dpu1/dpu_hw_sspp.c| 21 +--
 drivers/gpu/drm/msm/disp/dpu1/dpu_hw_sspp.h| 12 ++-
 drivers/gpu/drm/msm/disp/dpu1/dpu_hw_top.c | 23 +---
 drivers/gpu/drm/msm/disp/dpu1/dpu_hw_util.c| 21 +++
 drivers/gpu/drm/msm/disp/dpu1/dpu_hw_util.h|  4 +++
 drivers/gpu/drm/msm/disp/dpu1/dpu_hw_wb.c  | 20 +--
 drivers/gpu/drm/msm/disp/dpu1/dpu_hw_wb.h  |  7 +++-
 drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c  | 42 +++---
 drivers/gpu/drm/msm/disp/dpu1/dpu_rm.c |  4 +--
 drivers/gpu/drm/msm/disp/dpu1/dpu_vbif.c   | 30 +++-
 drivers/gpu/drm/msm/disp/dpu1/dpu_vbif.h   |  4 ---
 13 files changed, 173 insertions(+), 88 deletions(-)
---
base-commit: 9119cf579b4432b36be9d33a92f4331922067d92
change-id: 20231009-topic-sm8550-graphics-sspp-split-clk-43c32e37b6aa

Best regards,
-- 
Neil Armstrong 



Re: [Freedreno] [PATCH] soc: qcom: pmic_glink: fix connector type to be DisplayPort

2023-10-11 Thread Neil Armstrong

On 11/10/2023 00:52, Dmitry Baryshkov wrote:

As it was pointed out by Simon Ser, the DRM_MODE_CONNECTOR_USB connector
is reserved for the GUD devices. Other drivers (i915, amdgpu) use
DRM_MODE_CONNECTOR_DisplayPort even if the DP stream is handled by the
USB-C altmode. While we are still working on implementing the proper way
to let userspace know that the DP is wrapped into USB-C, change
connector type to be DRM_MODE_CONNECTOR_DisplayPort.

Fixes: 080b4e24852b ("soc: qcom: pmic_glink: Introduce altmode support")
Cc: Simon Ser 
Signed-off-by: Dmitry Baryshkov 
---
  drivers/soc/qcom/pmic_glink_altmode.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/soc/qcom/pmic_glink_altmode.c 
b/drivers/soc/qcom/pmic_glink_altmode.c
index 9569d999391d..6f8b2f7ae3cc 100644
--- a/drivers/soc/qcom/pmic_glink_altmode.c
+++ b/drivers/soc/qcom/pmic_glink_altmode.c
@@ -467,7 +467,7 @@ static int pmic_glink_altmode_probe(struct auxiliary_device 
*adev,
alt_port->bridge.funcs = _glink_altmode_bridge_funcs;
alt_port->bridge.of_node = to_of_node(fwnode);
alt_port->bridge.ops = DRM_BRIDGE_OP_HPD;
-   alt_port->bridge.type = DRM_MODE_CONNECTOR_USB;
+   alt_port->bridge.type = DRM_MODE_CONNECTOR_DisplayPort;
  
  		ret = devm_drm_bridge_add(dev, _port->bridge);

    if (ret) {


Reviewed-by: Neil Armstrong 


Re: [Freedreno] [PATCH RFC 0/5] drm/msm: dpu1: correctly implement SSPP & WB Clock Control Split

2023-10-10 Thread Neil Armstrong

On 10/10/2023 10:10, Marijn Suijten wrote:

On 2023-10-09 18:36:11, Neil Armstrong wrote:

Starting with the SM8550 platform, the SSPP & WB Clock Controls are
no more in the MDP TOP registers, but in the SSPP & WB register space.

Add the corresponding SSPP & WB ops and use them from the vbif QoS
and OT limit setup functions.

Signed-off-by: Neil Armstrong 
---
Neil Armstrong (5):
   drm/msm: dpu1: create a dpu_hw_clk_force_ctrl() helper
   drm/msm: dpu1: add setup_clk_force_ctrl() op to sspp & wb
   drm/msm: dpu1: vbif: add dpu_vbif_setup_clk_force_ctrl() helper
   drm/msm: dpu1: call wb & sspp clk_force_ctrl op if split clock control
   drm/msm: dpu1: sm8550: move split clock controls to sspp entries


Fyi we're all using drm/msm/dpu: now :)


Ack, thx, will change for v2



- Marijn



  .../gpu/drm/msm/disp/dpu1/catalog/dpu_9_0_sm8550.h | 35 +---
  .../gpu/drm/msm/disp/dpu1/dpu_encoder_phys_wb.c|  4 +--
  drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.h |  4 +++
  drivers/gpu/drm/msm/disp/dpu1/dpu_hw_sspp.c|  9 +
  drivers/gpu/drm/msm/disp/dpu1/dpu_hw_sspp.h|  9 +
  drivers/gpu/drm/msm/disp/dpu1/dpu_hw_top.c | 23 +
  drivers/gpu/drm/msm/disp/dpu1/dpu_hw_util.c| 21 
  drivers/gpu/drm/msm/disp/dpu1/dpu_hw_util.h|  4 +++
  drivers/gpu/drm/msm/disp/dpu1/dpu_hw_wb.c  |  9 +
  drivers/gpu/drm/msm/disp/dpu1/dpu_hw_wb.h  |  4 +++
  drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c  |  9 +++--
  drivers/gpu/drm/msm/disp/dpu1/dpu_vbif.c   | 38 +-
  drivers/gpu/drm/msm/disp/dpu1/dpu_vbif.h   | 12 ---
  13 files changed, 120 insertions(+), 61 deletions(-)
---
base-commit: 9119cf579b4432b36be9d33a92f4331922067d92
change-id: 20231009-topic-sm8550-graphics-sspp-split-clk-43c32e37b6aa

Best regards,
--
Neil Armstrong 





Re: [Freedreno] [PATCH RFC 5/5] drm/msm: dpu1: sm8550: move split clock controls to sspp entries

2023-10-10 Thread Neil Armstrong

On 09/10/2023 19:10, Dmitry Baryshkov wrote:

On 09/10/2023 19:36, Neil Armstrong wrote:

The SM8550 has the SSPP clk_ctrl in the SSPP registers, move them
out of the MDP top.

Signed-off-by: Neil Armstrong 
---
  .../gpu/drm/msm/disp/dpu1/catalog/dpu_9_0_sm8550.h | 35 ++
  1 file changed, 15 insertions(+), 20 deletions(-)

diff --git a/drivers/gpu/drm/msm/disp/dpu1/catalog/dpu_9_0_sm8550.h 
b/drivers/gpu/drm/msm/disp/dpu1/catalog/dpu_9_0_sm8550.h
index 7bed819dfc39..527ec020fba4 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/catalog/dpu_9_0_sm8550.h
+++ b/drivers/gpu/drm/msm/disp/dpu1/catalog/dpu_9_0_sm8550.h
@@ -24,16 +24,6 @@ static const struct dpu_mdp_cfg sm8550_mdp = {
  .base = 0, .len = 0x494,
  .features = BIT(DPU_MDP_PERIPH_0_REMOVED),
  .clk_ctrls = {
-    [DPU_CLK_CTRL_VIG0] = { .reg_off = 0x4330, .bit_off = 0 },
-    [DPU_CLK_CTRL_VIG1] = { .reg_off = 0x6330, .bit_off = 0 },
-    [DPU_CLK_CTRL_VIG2] = { .reg_off = 0x8330, .bit_off = 0 },
-    [DPU_CLK_CTRL_VIG3] = { .reg_off = 0xa330, .bit_off = 0 },
-    [DPU_CLK_CTRL_DMA0] = { .reg_off = 0x24330, .bit_off = 0 },
-    [DPU_CLK_CTRL_DMA1] = { .reg_off = 0x26330, .bit_off = 0 },
-    [DPU_CLK_CTRL_DMA2] = { .reg_off = 0x28330, .bit_off = 0 },
-    [DPU_CLK_CTRL_DMA3] = { .reg_off = 0x2a330, .bit_off = 0 },
-    [DPU_CLK_CTRL_DMA4] = { .reg_off = 0x2c330, .bit_off = 0 },
-    [DPU_CLK_CTRL_DMA5] = { .reg_off = 0x2e330, .bit_off = 0 },
  [DPU_CLK_CTRL_REG_DMA] = { .reg_off = 0x2bc, .bit_off = 20 },


Hmm, interesting. I even double-checked this. SSPP and WB have their own clock 
registers now. But the REG_DMA uses the main area (0x2bc).


yeah




  },
  };
@@ -73,6 +63,11 @@ static const struct dpu_ctl_cfg sm8550_ctl[] = {
  },
  };
+static const struct dpu_clk_ctrl_reg sm8550_sspp_clk_ctrl = {
+    .reg_off = 0x330,
+    .bit_off = 0
+};


I don't think we even need this outside of dpu_hw_sspp. You can use 
core_major_rev to check whether the driver should use global clocks or per-SSPP 
/ per-WB clocks register instead.


Ack




+
  static const struct dpu_sspp_cfg sm8550_sspp[] = {
  {
  .name = "sspp_0", .id = SSPP_VIG0,
@@ -81,7 +76,7 @@ static const struct dpu_sspp_cfg sm8550_sspp[] = {
  .sblk = _vig_sblk_0,
  .xin_id = 0,
  .type = SSPP_TYPE_VIG,
-    .clk_ctrl = DPU_CLK_CTRL_VIG0,
+    .clk_ctrl_reg = _sspp_clk_ctrl,
  }, {
  .name = "sspp_1", .id = SSPP_VIG1,
  .base = 0x6000, .len = 0x344,
@@ -89,7 +84,7 @@ static const struct dpu_sspp_cfg sm8550_sspp[] = {
  .sblk = _vig_sblk_1,
  .xin_id = 4,
  .type = SSPP_TYPE_VIG,
-    .clk_ctrl = DPU_CLK_CTRL_VIG1,
+    .clk_ctrl_reg = _sspp_clk_ctrl,
  }, {
  .name = "sspp_2", .id = SSPP_VIG2,
  .base = 0x8000, .len = 0x344,
@@ -97,7 +92,7 @@ static const struct dpu_sspp_cfg sm8550_sspp[] = {
  .sblk = _vig_sblk_2,
  .xin_id = 8,
  .type = SSPP_TYPE_VIG,
-    .clk_ctrl = DPU_CLK_CTRL_VIG2,
+    .clk_ctrl_reg = _sspp_clk_ctrl,
  }, {
  .name = "sspp_3", .id = SSPP_VIG3,
  .base = 0xa000, .len = 0x344,
@@ -105,7 +100,7 @@ static const struct dpu_sspp_cfg sm8550_sspp[] = {
  .sblk = _vig_sblk_3,
  .xin_id = 12,
  .type = SSPP_TYPE_VIG,
-    .clk_ctrl = DPU_CLK_CTRL_VIG3,
+    .clk_ctrl_reg = _sspp_clk_ctrl,
  }, {
  .name = "sspp_8", .id = SSPP_DMA0,
  .base = 0x24000, .len = 0x344,
@@ -113,7 +108,7 @@ static const struct dpu_sspp_cfg sm8550_sspp[] = {
  .sblk = _dma_sblk_0,
  .xin_id = 1,
  .type = SSPP_TYPE_DMA,
-    .clk_ctrl = DPU_CLK_CTRL_DMA0,
+    .clk_ctrl_reg = _sspp_clk_ctrl,
  }, {
  .name = "sspp_9", .id = SSPP_DMA1,
  .base = 0x26000, .len = 0x344,
@@ -121,7 +116,7 @@ static const struct dpu_sspp_cfg sm8550_sspp[] = {
  .sblk = _dma_sblk_1,
  .xin_id = 5,
  .type = SSPP_TYPE_DMA,
-    .clk_ctrl = DPU_CLK_CTRL_DMA1,
+    .clk_ctrl_reg = _sspp_clk_ctrl,
  }, {
  .name = "sspp_10", .id = SSPP_DMA2,
  .base = 0x28000, .len = 0x344,
@@ -129,7 +124,7 @@ static const struct dpu_sspp_cfg sm8550_sspp[] = {
  .sblk = _dma_sblk_2,
  .xin_id = 9,
  .type = SSPP_TYPE_DMA,
-    .clk_ctrl = DPU_CLK_CTRL_DMA2,
+    .clk_ctrl_reg = _sspp_clk_ctrl,
  }, {
  .name = "sspp_11", .id = SSPP_DMA3,
  .base = 0x2a000, .len = 0x344,
@@ -137,7 +132,7 @@ static const struct dpu_sspp_cfg sm8550_sspp[] = {
  .sblk = _dma_sblk_3,
  .xin_id = 13,
  .type = SSPP_TYPE_DMA,
-    .clk_ctrl = DPU_CLK_CTRL_DMA3,
+    .clk_ctrl_reg = _sspp_clk_ctrl,
  }, {
  .name = "sspp_12", .id = SSPP_DMA4,
  .base = 0x2c000, .len = 0x3

Re: [Freedreno] [PATCH RFC 5/5] drm/msm: dpu1: sm8550: move split clock controls to sspp entries

2023-10-10 Thread Neil Armstrong

On 09/10/2023 19:10, Dmitry Baryshkov wrote:

On 09/10/2023 19:36, Neil Armstrong wrote:

The SM8550 has the SSPP clk_ctrl in the SSPP registers, move them
out of the MDP top.

Signed-off-by: Neil Armstrong 
---
  .../gpu/drm/msm/disp/dpu1/catalog/dpu_9_0_sm8550.h | 35 ++
  1 file changed, 15 insertions(+), 20 deletions(-)

diff --git a/drivers/gpu/drm/msm/disp/dpu1/catalog/dpu_9_0_sm8550.h 
b/drivers/gpu/drm/msm/disp/dpu1/catalog/dpu_9_0_sm8550.h
index 7bed819dfc39..527ec020fba4 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/catalog/dpu_9_0_sm8550.h
+++ b/drivers/gpu/drm/msm/disp/dpu1/catalog/dpu_9_0_sm8550.h
@@ -24,16 +24,6 @@ static const struct dpu_mdp_cfg sm8550_mdp = {
  .base = 0, .len = 0x494,
  .features = BIT(DPU_MDP_PERIPH_0_REMOVED),
  .clk_ctrls = {
-    [DPU_CLK_CTRL_VIG0] = { .reg_off = 0x4330, .bit_off = 0 },
-    [DPU_CLK_CTRL_VIG1] = { .reg_off = 0x6330, .bit_off = 0 },
-    [DPU_CLK_CTRL_VIG2] = { .reg_off = 0x8330, .bit_off = 0 },
-    [DPU_CLK_CTRL_VIG3] = { .reg_off = 0xa330, .bit_off = 0 },
-    [DPU_CLK_CTRL_DMA0] = { .reg_off = 0x24330, .bit_off = 0 },
-    [DPU_CLK_CTRL_DMA1] = { .reg_off = 0x26330, .bit_off = 0 },
-    [DPU_CLK_CTRL_DMA2] = { .reg_off = 0x28330, .bit_off = 0 },
-    [DPU_CLK_CTRL_DMA3] = { .reg_off = 0x2a330, .bit_off = 0 },
-    [DPU_CLK_CTRL_DMA4] = { .reg_off = 0x2c330, .bit_off = 0 },
-    [DPU_CLK_CTRL_DMA5] = { .reg_off = 0x2e330, .bit_off = 0 },
  [DPU_CLK_CTRL_REG_DMA] = { .reg_off = 0x2bc, .bit_off = 20 },


Hmm, interesting. I even double-checked this. SSPP and WB have their own clock 
registers now. But the REG_DMA uses the main area (0x2bc).


yeah




  },
  };
@@ -73,6 +63,11 @@ static const struct dpu_ctl_cfg sm8550_ctl[] = {
  },
  };
+static const struct dpu_clk_ctrl_reg sm8550_sspp_clk_ctrl = {
+    .reg_off = 0x330,
+    .bit_off = 0
+};


I don't think we even need this outside of dpu_hw_sspp. You can use 
core_major_rev to check whether the driver should use global clocks or per-SSPP 
/ per-WB clocks register instead.


Ack




+
  static const struct dpu_sspp_cfg sm8550_sspp[] = {
  {
  .name = "sspp_0", .id = SSPP_VIG0,
@@ -81,7 +76,7 @@ static const struct dpu_sspp_cfg sm8550_sspp[] = {
  .sblk = _vig_sblk_0,
  .xin_id = 0,
  .type = SSPP_TYPE_VIG,
-    .clk_ctrl = DPU_CLK_CTRL_VIG0,
+    .clk_ctrl_reg = _sspp_clk_ctrl,
  }, {
  .name = "sspp_1", .id = SSPP_VIG1,
  .base = 0x6000, .len = 0x344,
@@ -89,7 +84,7 @@ static const struct dpu_sspp_cfg sm8550_sspp[] = {
  .sblk = _vig_sblk_1,
  .xin_id = 4,
  .type = SSPP_TYPE_VIG,
-    .clk_ctrl = DPU_CLK_CTRL_VIG1,
+    .clk_ctrl_reg = _sspp_clk_ctrl,
  }, {
  .name = "sspp_2", .id = SSPP_VIG2,
  .base = 0x8000, .len = 0x344,
@@ -97,7 +92,7 @@ static const struct dpu_sspp_cfg sm8550_sspp[] = {
  .sblk = _vig_sblk_2,
  .xin_id = 8,
  .type = SSPP_TYPE_VIG,
-    .clk_ctrl = DPU_CLK_CTRL_VIG2,
+    .clk_ctrl_reg = _sspp_clk_ctrl,
  }, {
  .name = "sspp_3", .id = SSPP_VIG3,
  .base = 0xa000, .len = 0x344,
@@ -105,7 +100,7 @@ static const struct dpu_sspp_cfg sm8550_sspp[] = {
  .sblk = _vig_sblk_3,
  .xin_id = 12,
  .type = SSPP_TYPE_VIG,
-    .clk_ctrl = DPU_CLK_CTRL_VIG3,
+    .clk_ctrl_reg = _sspp_clk_ctrl,
  }, {
  .name = "sspp_8", .id = SSPP_DMA0,
  .base = 0x24000, .len = 0x344,
@@ -113,7 +108,7 @@ static const struct dpu_sspp_cfg sm8550_sspp[] = {
  .sblk = _dma_sblk_0,
  .xin_id = 1,
  .type = SSPP_TYPE_DMA,
-    .clk_ctrl = DPU_CLK_CTRL_DMA0,
+    .clk_ctrl_reg = _sspp_clk_ctrl,
  }, {
  .name = "sspp_9", .id = SSPP_DMA1,
  .base = 0x26000, .len = 0x344,
@@ -121,7 +116,7 @@ static const struct dpu_sspp_cfg sm8550_sspp[] = {
  .sblk = _dma_sblk_1,
  .xin_id = 5,
  .type = SSPP_TYPE_DMA,
-    .clk_ctrl = DPU_CLK_CTRL_DMA1,
+    .clk_ctrl_reg = _sspp_clk_ctrl,
  }, {
  .name = "sspp_10", .id = SSPP_DMA2,
  .base = 0x28000, .len = 0x344,
@@ -129,7 +124,7 @@ static const struct dpu_sspp_cfg sm8550_sspp[] = {
  .sblk = _dma_sblk_2,
  .xin_id = 9,
  .type = SSPP_TYPE_DMA,
-    .clk_ctrl = DPU_CLK_CTRL_DMA2,
+    .clk_ctrl_reg = _sspp_clk_ctrl,
  }, {
  .name = "sspp_11", .id = SSPP_DMA3,
  .base = 0x2a000, .len = 0x344,
@@ -137,7 +132,7 @@ static const struct dpu_sspp_cfg sm8550_sspp[] = {
  .sblk = _dma_sblk_3,
  .xin_id = 13,
  .type = SSPP_TYPE_DMA,
-    .clk_ctrl = DPU_CLK_CTRL_DMA3,
+    .clk_ctrl_reg = _sspp_clk_ctrl,
  }, {
  .name = "sspp_12", .id = SSPP_DMA4,
  .base = 0x2c000, .len = 0x3

Re: [Freedreno] [PATCH RFC 4/5] drm/msm: dpu1: call wb & sspp clk_force_ctrl op if split clock control

2023-10-10 Thread Neil Armstrong

On 09/10/2023 19:07, Dmitry Baryshkov wrote:

On 09/10/2023 19:36, Neil Armstrong wrote:

Now clk_ctrl IDs can be optional and the clk_ctrl_reg can be specified
on the SSPP & WB caps directly, pass the SSPP & WB hw struct to the
qos & limit params then call the clk_force_ctrl() op accordingly.

Signed-off-by: Neil Armstrong 
---
  .../gpu/drm/msm/disp/dpu1/dpu_encoder_phys_wb.c    |  4 +--
  drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c  |  9 +++---
  drivers/gpu/drm/msm/disp/dpu1/dpu_vbif.c   | 37 +++---
  drivers/gpu/drm/msm/disp/dpu1/dpu_vbif.h   | 12 ---
  4 files changed, 40 insertions(+), 22 deletions(-)

diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_wb.c 
b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_wb.c
index 78037a697633..e4dfe0be7207 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_wb.c
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder_phys_wb.c
@@ -45,6 +45,7 @@ static void dpu_encoder_phys_wb_set_ot_limit(
  struct dpu_vbif_set_ot_params ot_params;
  memset(_params, 0, sizeof(ot_params));
+    ot_params.wb = hw_wb;
  ot_params.xin_id = hw_wb->caps->xin_id;
  ot_params.num = hw_wb->idx - WB_0;
  ot_params.width = phys_enc->cached_mode.hdisplay;
@@ -52,7 +53,6 @@ static void dpu_encoder_phys_wb_set_ot_limit(
  ot_params.is_wfd = true;
  ot_params.frame_rate = drm_mode_vrefresh(_enc->cached_mode);
  ot_params.vbif_idx = hw_wb->caps->vbif_idx;
-    ot_params.clk_ctrl = hw_wb->caps->clk_ctrl;
  ot_params.rd = false;
  dpu_vbif_set_ot_limit(phys_enc->dpu_kms, _params);
@@ -81,9 +81,9 @@ static void dpu_encoder_phys_wb_set_qos_remap(
  hw_wb = phys_enc->hw_wb;
  memset(_params, 0, sizeof(qos_params));
+    qos_params.wb = hw_wb;
  qos_params.vbif_idx = hw_wb->caps->vbif_idx;
  qos_params.xin_id = hw_wb->caps->xin_id;
-    qos_params.clk_ctrl = hw_wb->caps->clk_ctrl;
  qos_params.num = hw_wb->idx - WB_0;
  qos_params.is_rt = false;
diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c 
b/drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c
index c2aaaded07ed..b0b662068377 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_plane.c
@@ -350,6 +350,7 @@ static void _dpu_plane_set_ot_limit(struct drm_plane *plane,
  struct dpu_kms *dpu_kms = _dpu_plane_get_kms(plane);
  memset(_params, 0, sizeof(ot_params));
+    ot_params.sspp = pipe->sspp;
  ot_params.xin_id = pipe->sspp->cap->xin_id;
  ot_params.num = pipe->sspp->idx - SSPP_NONE;
  ot_params.width = drm_rect_width(_cfg->src_rect);
@@ -357,7 +358,6 @@ static void _dpu_plane_set_ot_limit(struct drm_plane *plane,
  ot_params.is_wfd = !pdpu->is_rt_pipe;
  ot_params.frame_rate = frame_rate;
  ot_params.vbif_idx = VBIF_RT;
-    ot_params.clk_ctrl = pipe->sspp->cap->clk_ctrl;
  ot_params.rd = true;
  dpu_vbif_set_ot_limit(dpu_kms, _params);
@@ -377,16 +377,15 @@ static void _dpu_plane_set_qos_remap(struct drm_plane 
*plane,
  memset(_params, 0, sizeof(qos_params));
  qos_params.vbif_idx = VBIF_RT;
-    qos_params.clk_ctrl = pipe->sspp->cap->clk_ctrl;
+    qos_params.sspp = pipe->sspp;
  qos_params.xin_id = pipe->sspp->cap->xin_id;
  qos_params.num = pipe->sspp->idx - SSPP_VIG0;
  qos_params.is_rt = pdpu->is_rt_pipe;
-    DPU_DEBUG_PLANE(pdpu, "pipe:%d vbif:%d xin:%d rt:%d, clk_ctrl:%d\n",
+    DPU_DEBUG_PLANE(pdpu, "pipe:%d vbif:%d xin:%d rt:%d\n",
  qos_params.num,
  qos_params.vbif_idx,
-    qos_params.xin_id, qos_params.is_rt,
-    qos_params.clk_ctrl);
+    qos_params.xin_id, qos_params.is_rt);
  dpu_vbif_set_qos_remap(dpu_kms, _params);
  }
diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_vbif.c 
b/drivers/gpu/drm/msm/disp/dpu1/dpu_vbif.c
index 2ae5cba1848b..a79559084a91 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_vbif.c
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_vbif.c
@@ -158,11 +158,19 @@ static u32 _dpu_vbif_get_ot_limit(struct dpu_hw_vbif 
*vbif,
  return ot_lim;
  }
-static bool dpu_vbif_setup_clk_force_ctrl(struct dpu_hw_mdp *mdp,
-  unsigned int clk_ctrl,
+static bool dpu_vbif_setup_clk_force_ctrl(struct dpu_hw_sspp *sspp,
+  struct dpu_hw_wb *wb,
+  struct dpu_hw_mdp *mdp,
    bool enable)
  {
-    return mdp->ops.setup_clk_force_ctrl(mdp, clk_ctrl, enable);
+    if (sspp && sspp->cap->clk_ctrl_reg)
+    return sspp->ops.setup_clk_force_ctrl(sspp, enable);
+    else if (wb && wb->caps->clk_ctrl_reg)
+    return wb->ops.setup_clk_force_ctrl(wb, enable);
+    else


This is what I wanted to avoid.

If we move the caller function to the sspp / WB, we will not need this kind of 
wrapper.


I tried it

[Freedreno] [PATCH RFC 5/5] drm/msm: dpu1: sm8550: move split clock controls to sspp entries

2023-10-09 Thread Neil Armstrong
The SM8550 has the SSPP clk_ctrl in the SSPP registers, move them
out of the MDP top.

Signed-off-by: Neil Armstrong 
---
 .../gpu/drm/msm/disp/dpu1/catalog/dpu_9_0_sm8550.h | 35 ++
 1 file changed, 15 insertions(+), 20 deletions(-)

diff --git a/drivers/gpu/drm/msm/disp/dpu1/catalog/dpu_9_0_sm8550.h 
b/drivers/gpu/drm/msm/disp/dpu1/catalog/dpu_9_0_sm8550.h
index 7bed819dfc39..527ec020fba4 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/catalog/dpu_9_0_sm8550.h
+++ b/drivers/gpu/drm/msm/disp/dpu1/catalog/dpu_9_0_sm8550.h
@@ -24,16 +24,6 @@ static const struct dpu_mdp_cfg sm8550_mdp = {
.base = 0, .len = 0x494,
.features = BIT(DPU_MDP_PERIPH_0_REMOVED),
.clk_ctrls = {
-   [DPU_CLK_CTRL_VIG0] = { .reg_off = 0x4330, .bit_off = 0 },
-   [DPU_CLK_CTRL_VIG1] = { .reg_off = 0x6330, .bit_off = 0 },
-   [DPU_CLK_CTRL_VIG2] = { .reg_off = 0x8330, .bit_off = 0 },
-   [DPU_CLK_CTRL_VIG3] = { .reg_off = 0xa330, .bit_off = 0 },
-   [DPU_CLK_CTRL_DMA0] = { .reg_off = 0x24330, .bit_off = 0 },
-   [DPU_CLK_CTRL_DMA1] = { .reg_off = 0x26330, .bit_off = 0 },
-   [DPU_CLK_CTRL_DMA2] = { .reg_off = 0x28330, .bit_off = 0 },
-   [DPU_CLK_CTRL_DMA3] = { .reg_off = 0x2a330, .bit_off = 0 },
-   [DPU_CLK_CTRL_DMA4] = { .reg_off = 0x2c330, .bit_off = 0 },
-   [DPU_CLK_CTRL_DMA5] = { .reg_off = 0x2e330, .bit_off = 0 },
[DPU_CLK_CTRL_REG_DMA] = { .reg_off = 0x2bc, .bit_off = 20 },
},
 };
@@ -73,6 +63,11 @@ static const struct dpu_ctl_cfg sm8550_ctl[] = {
},
 };
 
+static const struct dpu_clk_ctrl_reg sm8550_sspp_clk_ctrl = {
+   .reg_off = 0x330,
+   .bit_off = 0
+};
+
 static const struct dpu_sspp_cfg sm8550_sspp[] = {
{
.name = "sspp_0", .id = SSPP_VIG0,
@@ -81,7 +76,7 @@ static const struct dpu_sspp_cfg sm8550_sspp[] = {
.sblk = _vig_sblk_0,
.xin_id = 0,
.type = SSPP_TYPE_VIG,
-   .clk_ctrl = DPU_CLK_CTRL_VIG0,
+   .clk_ctrl_reg = _sspp_clk_ctrl,
}, {
.name = "sspp_1", .id = SSPP_VIG1,
.base = 0x6000, .len = 0x344,
@@ -89,7 +84,7 @@ static const struct dpu_sspp_cfg sm8550_sspp[] = {
.sblk = _vig_sblk_1,
.xin_id = 4,
.type = SSPP_TYPE_VIG,
-   .clk_ctrl = DPU_CLK_CTRL_VIG1,
+   .clk_ctrl_reg = _sspp_clk_ctrl,
}, {
.name = "sspp_2", .id = SSPP_VIG2,
.base = 0x8000, .len = 0x344,
@@ -97,7 +92,7 @@ static const struct dpu_sspp_cfg sm8550_sspp[] = {
.sblk = _vig_sblk_2,
.xin_id = 8,
.type = SSPP_TYPE_VIG,
-   .clk_ctrl = DPU_CLK_CTRL_VIG2,
+   .clk_ctrl_reg = _sspp_clk_ctrl,
}, {
.name = "sspp_3", .id = SSPP_VIG3,
.base = 0xa000, .len = 0x344,
@@ -105,7 +100,7 @@ static const struct dpu_sspp_cfg sm8550_sspp[] = {
.sblk = _vig_sblk_3,
.xin_id = 12,
.type = SSPP_TYPE_VIG,
-   .clk_ctrl = DPU_CLK_CTRL_VIG3,
+   .clk_ctrl_reg = _sspp_clk_ctrl,
}, {
.name = "sspp_8", .id = SSPP_DMA0,
.base = 0x24000, .len = 0x344,
@@ -113,7 +108,7 @@ static const struct dpu_sspp_cfg sm8550_sspp[] = {
.sblk = _dma_sblk_0,
.xin_id = 1,
.type = SSPP_TYPE_DMA,
-   .clk_ctrl = DPU_CLK_CTRL_DMA0,
+   .clk_ctrl_reg = _sspp_clk_ctrl,
}, {
.name = "sspp_9", .id = SSPP_DMA1,
.base = 0x26000, .len = 0x344,
@@ -121,7 +116,7 @@ static const struct dpu_sspp_cfg sm8550_sspp[] = {
.sblk = _dma_sblk_1,
.xin_id = 5,
.type = SSPP_TYPE_DMA,
-   .clk_ctrl = DPU_CLK_CTRL_DMA1,
+   .clk_ctrl_reg = _sspp_clk_ctrl,
}, {
.name = "sspp_10", .id = SSPP_DMA2,
.base = 0x28000, .len = 0x344,
@@ -129,7 +124,7 @@ static const struct dpu_sspp_cfg sm8550_sspp[] = {
.sblk = _dma_sblk_2,
.xin_id = 9,
.type = SSPP_TYPE_DMA,
-   .clk_ctrl = DPU_CLK_CTRL_DMA2,
+   .clk_ctrl_reg = _sspp_clk_ctrl,
}, {
.name = "sspp_11", .id = SSPP_DMA3,
.base = 0x2a000, .len = 0x344,
@@ -137,7 +132,7 @@ static const struct dpu_sspp_cfg sm8550_sspp[] = {
.sblk = _dma_sblk_3,
.xin_id = 13,
.type = SSPP_TYPE_DMA,
-   .clk_ctrl = DPU_CLK_CTRL_DMA3,
+   .clk_ctrl_reg = _sspp_clk_ctrl,
}, {
.name = "sspp_12", .id = SSPP_DMA4,
.base

[Freedreno] [PATCH RFC 2/5] drm/msm: dpu1: add setup_clk_force_ctrl() op to sspp & wb

2023-10-09 Thread Neil Armstrong
Starting from SM8550, the SSPP & WB clock controls are moved
the SSPP and WB register range, as it's called "VBIF_CLK_SPLIT"
downstream.

An optional clk_ctrl struct is added to the SSPP & WB caps,
which can be used by the setup_clk_force_ctrl() op.

Signed-off-by: Neil Armstrong 
---
 drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.h | 4 
 drivers/gpu/drm/msm/disp/dpu1/dpu_hw_sspp.c| 9 +
 drivers/gpu/drm/msm/disp/dpu1/dpu_hw_sspp.h| 9 +
 drivers/gpu/drm/msm/disp/dpu1/dpu_hw_wb.c  | 9 +
 drivers/gpu/drm/msm/disp/dpu1/dpu_hw_wb.h  | 4 
 5 files changed, 35 insertions(+)

diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.h 
b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.h
index 6c9634209e9f..d9e8673e46f7 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.h
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.h
@@ -505,6 +505,7 @@ struct dpu_ctl_cfg {
  * @sblk:  SSPP sub-blocks information
  * @xin_id:bus client identifier
  * @clk_ctrl   clock control identifier
+ * @clk_ctrl_reg   local sspp clock control register
  * @type   sspp type identifier
  */
 struct dpu_sspp_cfg {
@@ -512,6 +513,7 @@ struct dpu_sspp_cfg {
const struct dpu_sspp_sub_blks *sblk;
u32 xin_id;
enum dpu_clk_ctrl_type clk_ctrl;
+   const struct dpu_clk_ctrl_reg *clk_ctrl_reg;
u32 type;
 };
 
@@ -620,6 +622,7 @@ struct dpu_intf_cfg  {
  * @format_list:   list of formats supported by this writeback block
  * @num_formats:   number of formats supported by this writeback block
  * @clk_ctrl:  clock control identifier
+ * @clk_ctrl_reglocal wb clock control register
  */
 struct dpu_wb_cfg {
DPU_HW_BLK_INFO;
@@ -630,6 +633,7 @@ struct dpu_wb_cfg {
const u32 *format_list;
u32 num_formats;
enum dpu_clk_ctrl_type clk_ctrl;
+   const struct dpu_clk_ctrl_reg *clk_ctrl_reg;
 };
 
 /**
diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_sspp.c 
b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_sspp.c
index f2192de93713..cc4c7141791f 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_sspp.c
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_sspp.c
@@ -581,6 +581,14 @@ static void dpu_hw_sspp_setup_cdp(struct dpu_sw_pipe *pipe,
dpu_setup_cdp(>hw, cdp_cntl_offset, fmt, enable);
 }
 
+static bool dpu_hw_sspp_setup_clk_force_ctrl(struct dpu_hw_sspp *ctx, bool 
enable)
+{
+   if (!ctx->cap->clk_ctrl_reg)
+   return false;
+
+   return dpu_hw_clk_force_ctrl(>hw, ctx->cap->clk_ctrl_reg, enable);
+}
+
 static void _setup_layer_ops(struct dpu_hw_sspp *c,
unsigned long features)
 {
@@ -589,6 +597,7 @@ static void _setup_layer_ops(struct dpu_hw_sspp *c,
c->ops.setup_sourceaddress = dpu_hw_sspp_setup_sourceaddress;
c->ops.setup_solidfill = dpu_hw_sspp_setup_solidfill;
c->ops.setup_pe = dpu_hw_sspp_setup_pe_config;
+   c->ops.setup_clk_force_ctrl = dpu_hw_sspp_setup_clk_force_ctrl;
 
if (test_bit(DPU_SSPP_QOS, )) {
c->ops.setup_qos_lut = dpu_hw_sspp_setup_qos_lut;
diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_sspp.h 
b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_sspp.h
index cbf4f95ff0fd..4a77734e83a7 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_sspp.h
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_sspp.h
@@ -11,6 +11,7 @@
 #include "dpu_formats.h"
 
 struct dpu_hw_sspp;
+struct dpu_hw_mdp;
 
 /**
  * Flags
@@ -271,6 +272,14 @@ struct dpu_hw_sspp_ops {
void (*setup_qos_ctrl)(struct dpu_hw_sspp *ctx,
   bool danger_safe_en);
 
+   /**
+* setup_clk_force_ctrl - setup clock force control
+* @ctx: Pointer to pipe context
+* @enable: enable clock force if true
+*/
+   bool (*setup_clk_force_ctrl)(struct dpu_hw_sspp *ctx,
+bool enable);
+
/**
 * setup_histogram - setup histograms
 * @ctx: Pointer to pipe context
diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_wb.c 
b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_wb.c
index ebc416400382..045a4545a8c5 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_wb.c
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_wb.c
@@ -175,11 +175,20 @@ static void dpu_hw_wb_bind_pingpong_blk(
DPU_REG_WRITE(c, WB_MUX, mux_cfg);
 }
 
+static bool dpu_hw_wb_setup_clk_force_ctrl(struct dpu_hw_wb *ctx, bool enable)
+{
+   if (!ctx->caps->clk_ctrl_reg)
+   return false;
+
+   return dpu_hw_clk_force_ctrl(>hw, ctx->caps->clk_ctrl_reg, enable);
+}
+
 static void _setup_wb_ops(struct dpu_hw_wb_ops *ops,
unsigned long features)
 {
ops->setup_outaddress = dpu_hw_wb_setup_outaddress;
ops->setup_outformat = dpu_hw_wb_setup_format;
+   ops->setup_clk_force_ctrl = dpu_hw_wb_setup_clk_force_ctrl;
 
if (t

  1   2   3   4   >