MDSS reg bus interconnect
Subsystems (5)
v2 cover MDSS reg bus interconnect
v1 -> v2:
- Fix "Mbps" -> "MBps" [5/5]
- Add an interconnects: entry in dt-bindings (and not only -names..) [1/5]
v1: https://lore.kernel.org/r/[email protected]
Apart from the already handled data bus (MAS_MDP_Pn<->DDR), there's another path that needs to be handled to ensure MDSS functions properly, namely the "reg bus", a.k.a the CPU-MDSS interconnect.
Gating that path may have a variety of effects.. from none to otherwise inexplicable DSI timeouts..
This series tries to address the lack of that.
Example path:
interconnects = <&bimc MASTER_AMPSS_M0 0 &config_noc SLAVE_DISPLAY_CFG 0>;
---
Konrad Dybcio (5):
dt-bindings: display/msm: Add reg bus interconnect drm/msm/dpu1: Rename path references to mdp_path drm/msm/mdss: Rename path references to mdp_path drm/msm/mdss: Handle the reg bus ICC path drm/msm/dpu1: Handle the reg bus ICC path
.../bindings/display/msm/mdss-common.yaml | 2 ++ drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.c | 10 +++---- drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c | 34 ++++++++++++++++----- drivers/gpu/drm/msm/disp/dpu1/dpu_kms.h | 5 ++-- drivers/gpu/drm/msm/msm_mdss.c | 35 ++++++++++++++-------- 5 files changed, 58 insertions(+), 28 deletions(-)
---
base-commit: 4aa1da8d99724f6c0b762b58a71cee7c5e2e109b
change-id: 20230417-topic-dpu_regbus-abc94a770952
Best regards,
Signature · 1 line
Konrad Dybcio <[email protected]>
PATCH v2 1/5 dt-bindings: display/msm: Add reg bus interconnect
Apart from the already handled data bus (MAS_MDP_Pn<->DDR), there's another path that needs to be handled to ensure MDSS functions properly, namely the "reg bus", a.k.a the CPU-MDSS interconnect.
Gating that path may have a variety of effects.. from none to otherwise inexplicable DSI timeouts..
Describe it in bindings to allow for use in device trees.
--- Documentation/devicetree/bindings/display/msm/mdss-common.yaml | 2 ++ 1 file changed, 2 insertions(+)
Documentation/devicetree/bindings/display/msm/mdss-common.yaml +2 -0
@@ -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:
Signature · 1 line
2.40.0
Re: [PATCH v2 1/5] dt-bindings: display/msm: Add reg bus interconnect
Quoted 10 lines · Konrad Dybcio
Apart from the already handled data bus (MAS_MDP_Pn<->DDR), there's another path that needs to be handled to ensure MDSS functions properly, namely the "reg bus", a.k.a the CPU-MDSS interconnect.
Gating that path may have a variety of effects.. from none to otherwise inexplicable DSI timeouts..
Describe it in bindings to allow for use in device trees.
Signed-off-by Konrad Dybcio <[email protected]>
Best regards,
Krzysztof
PATCH v2 2/5 drm/msm/dpu1: Rename path references to mdp_path
In reply to Konrad DybcioThe DPU1 driver needs to handle all MDPn<->DDR paths, as well as CPU<->SLAVE_DISPLAY_CFG. The former ones share how their values are calculated, but the latter one has static predefines spanning all SoCs.
In preparation for supporting the CPU<->SLAVE_DISPLAY_CFG path, rename the path-related struct members to include "mdp_".
--- drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.c | 10 +++++----- drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c | 12 ++++++------ drivers/gpu/drm/msm/disp/dpu1/dpu_kms.h | 4 ++-- 3 files changed, 13 insertions(+), 13 deletions(-)
drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.c +5 -5
@@ -230,18 +230,18 @@ static int _dpu_core_perf_crtc_update_bus(struct dpu_kms *kms,DRM_DEBUG_ATOMIC ("crtc=%d bw=%llu paths:%d\n" , tmp_crtc->base.id, - dpu_cstate->new_perf.bw_ctl, kms->num_paths); + dpu_cstate->new_perf.bw_ctl, kms->num_mdp_paths); } } -if (!kms->num_paths) +if (!kms->num_mdp_paths)return 0 ; avg_bw = perf.bw_ctl; -do_div (avg_bw, (kms->num_paths *1000 ));/*Bps_to_icc*/ +do_div (avg_bw, (kms->num_mdp_paths *1000 ));/*Bps_to_icc*/ -for (i =0 ; i < kms->num_paths; i++) -icc_set_bw (kms->path[i], avg_bw, perf.max_per_pipe_ib); +for (i =0 ; i < kms->num_mdp_paths; i++) +icc_set_bw (kms->mdp_path[i], avg_bw, perf.max_per_pipe_ib);return ret; }
drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c +6 -6
@@ -397,12 +397,12 @@ static int dpu_kms_parse_data_bus_icc_path(struct dpu_kms *dpu_kms)if (IS_ERR_OR_NULL (path0))return PTR_ERR_OR_ZERO (path0); - dpu_kms->path[0 ] = path0; - dpu_kms->num_paths =1 ; + dpu_kms->mdp_path[0 ] = path0; + dpu_kms->num_mdp_paths =1 ;if (!IS_ERR_OR_NULL (path1)) { - dpu_kms->path[1 ] = path1; - dpu_kms->num_paths++; + dpu_kms->mdp_path[1 ] = path1; + dpu_kms->num_mdp_paths++; }return 0 ; }
@@ -1238,8 +1238,8 @@ static int __maybe_unused dpu_runtime_suspend(struct device *dev)dev_pm_opp_set_rate (dev,0 );clk_bulk_disable_unprepare (dpu_kms->num_clocks, dpu_kms->clocks); -for (i =0 ; i < dpu_kms->num_paths; i++) -icc_set_bw (dpu_kms->path[i],0 ,0 ); +for (i =0 ; i < dpu_kms->num_mdp_paths; i++) +icc_set_bw (dpu_kms->mdp_path[i],0 ,0 );return 0 ; }
drivers/gpu/drm/msm/disp/dpu1/dpu_kms.h +2 -2
@@ -109,8 +109,8 @@ struct dpu_kms {* when disabled. */ atomic_t bandwidth_ref; -struct icc_path *path[2 ]; -u32 num_paths; +struct icc_path *mdp_path[2 ]; +u32 num_mdp_paths; };struct vsync_info {
Signature · 1 line
2.40.0
Re: [PATCH v2 2/5] drm/msm/dpu1: Rename path references to mdp_path
Quoted 7 lines · Konrad Dybcio
The DPU1 driver needs to handle all MDPn<->DDR paths, as well as CPU<->SLAVE_DISPLAY_CFG. The former ones share how their values are calculated, but the latter one has static predefines spanning all SoCs.
In preparation for supporting the CPU<->SLAVE_DISPLAY_CFG path, rename the path-related struct members to include "
mdp_".
Quoted 6 lines
Signed-off-by Konrad Dybcio <[email protected]>--- drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.c | 10 +++++----- drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c | 12 ++++++------ drivers/gpu/drm/msm/disp/dpu1/dpu_kms.h | 4 ++-- 3 files changed, 13 insertions(+), 13 deletions(-)
Signature · 2 lines
With best wishes Dmitry
PATCH v2 3/5 drm/msm/mdss: Rename path references to mdp_path
In reply to Konrad DybcioThe DPU1 driver needs to handle all MDPn<->DDR paths, as well as CPU<->SLAVE_DISPLAY_CFG. The former ones share how their values are calculated, but the latter one has static predefines spanning all SoCs.
In preparation for supporting the CPU<->SLAVE_DISPLAY_CFG path, rename the path-related struct members to include "mdp_".
--- drivers/gpu/drm/msm/msm_mdss.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-)
drivers/gpu/drm/msm/msm_mdss.c +10 -10
@@ -48,8 +48,8 @@ struct msm_mdss {struct irq_domain *domain; } irq_controller;const struct msm_mdss_data *mdss_data; -struct icc_path *path[2 ]; -u32 num_paths; +struct icc_path *mdp_path[2 ]; +u32 num_mdp_paths; }; static int msm_mdss_parse_data_bus_icc_path(struct device *dev,
@@ -62,13 +62,13 @@ static int msm_mdss_parse_data_bus_icc_path(struct device *dev,if (IS_ERR_OR_NULL (path0))return PTR_ERR_OR_ZERO (path0); - msm_mdss->path[0 ] = path0; - msm_mdss->num_paths =1 ; + msm_mdss->mdp_path[0 ] = path0; + msm_mdss->num_mdp_paths =1 ; path1 =of_icc_get (dev,"mdp1-mem" );if (!IS_ERR_OR_NULL (path1)) { - msm_mdss->path[1 ] = path1; - msm_mdss->num_paths++; + msm_mdss->mdp_path[1 ] = path1; + msm_mdss->num_mdp_paths++; }return 0 ;
@@ -79,16 +79,16 @@ static void msm_mdss_put_icc_path(void *data)struct msm_mdss *msm_mdss = data;int i; -for (i =0 ; i < msm_mdss->num_paths; i++) -icc_put (msm_mdss->path[i]); +for (i =0 ; i < msm_mdss->num_mdp_paths; i++) +icc_put (msm_mdss->mdp_path[i]); }static void msm_mdss_icc_request_bw (struct msm_mdss *msm_mdss,unsigned long bw) {int i; -for (i =0 ; i < msm_mdss->num_paths; i++) -icc_set_bw (msm_mdss->path[i],0 ,Bps_to_icc (bw)); +for (i =0 ; i < msm_mdss->num_mdp_paths; i++) +icc_set_bw (msm_mdss->mdp_path[i],0 ,Bps_to_icc (bw)); }static void msm_mdss_irq (struct irq_desc *desc)
Signature · 1 line
2.40.0
Re: [PATCH v2 3/5] drm/msm/mdss: Rename path references to mdp_path
Quoted 1 line · Konrad Dybcio
The DPU1 driver needs to handle all MDPn<->DDR paths, as well as
Nit: msm_mdss.c is not DPU1.
Quoted 10 lines
CPU<->SLAVE_DISPLAY_CFG. The former ones share how their values are calculated, but the latter one has static predefines spanning all SoCs.
In preparation for supporting the CPU<->SLAVE_DISPLAY_CFG path, rename the path-related struct members to include "
mdp_".Signed-off-by Konrad Dybcio <[email protected]>--- drivers/gpu/drm/msm/msm_mdss.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-)
Signature · 2 lines
With best wishes Dmitry
PATCH v2 4/5 drm/msm/mdss: Handle the reg bus ICC path
In reply to Konrad DybcioApart from the already handled data bus (MAS_MDP_Pn<->DDR), there's another path that needs to be handled to ensure MDSS functions properly, namely the "reg bus", a.k.a the CPU-MDSS interconnect.
Gating that path may have a variety of effects.. from none to otherwise inexplicable DSI timeouts..
On the MDSS side, we only have to ensure that it's on at what Qualcomm downstream calls "77 MHz", a.k.a 76.8 Mbps and turn it off at suspend.
To achieve that, make msm_mdss_icc_request_bw() accept a boolean to indicate whether we want the busses to be on or off, as this function's only use is to vote for minimum or no bandwidth at all.
--- drivers/gpu/drm/msm/msm_mdss.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-)
drivers/gpu/drm/msm/msm_mdss.c +13 -4
@@ -50,6 +50,7 @@ struct msm_mdss {const struct msm_mdss_data *mdss_data;struct icc_path *mdp_path[2 ];u32 num_mdp_paths; +struct icc_path *reg_bus_path; }; static int msm_mdss_parse_data_bus_icc_path(struct device *dev,
@@ -57,6 +58,7 @@ static int msm_mdss_parse_data_bus_icc_path(struct device *dev, {struct icc_path *path0;struct icc_path *path1; +struct icc_path *reg_bus_path; path0 =of_icc_get (dev,"mdp0-mem" );if (IS_ERR_OR_NULL (path0))
@@ -71,6 +73,10 @@ static int msm_mdss_parse_data_bus_icc_path(struct device *dev, msm_mdss->num_mdp_paths++; } + reg_bus_path =of_icc_get (dev,"cpu-cfg" ); +if (!IS_ERR_OR_NULL (reg_bus_path)) + msm_mdss->reg_bus_path = reg_bus_path; +return 0 ; }
@@ -83,12 +89,15 @@ static void msm_mdss_put_icc_path(void *data)icc_put (msm_mdss->mdp_path[i]); } -static void msm_mdss_icc_request_bw (struct msm_mdss *msm_mdss,unsigned long bw) +static void msm_mdss_icc_request_bw (struct msm_mdss *msm_mdss,bool enable) {int i;for (i =0 ; i < msm_mdss->num_mdp_paths; i++) -icc_set_bw (msm_mdss->mdp_path[i],0 ,Bps_to_icc (bw)); +icc_set_bw (msm_mdss->mdp_path[i],0 , enable ?Bps_to_icc (MIN_IB_BW ) :0 ); + +if (msm_mdss->reg_bus_path) +icc_set_bw (msm_mdss->reg_bus_path,0 , enable ?76800 :0 ); }static void msm_mdss_irq (struct irq_desc *desc)
@@ -241,7 +250,7 @@ static int msm_mdss_enable(struct msm_mdss *msm_mdss)* the interconnect is enabled (non-zero bandwidth). Let's make sure * that the interconnects are at least at a minimum amount. */ -msm_mdss_icc_request_bw (msm_mdss,MIN_IB_BW ); +msm_mdss_icc_request_bw (msm_mdss, true); ret =clk_bulk_prepare_enable (msm_mdss->num_clocks, msm_mdss->clocks);if (ret) {
@@ -289,7 +298,7 @@ static int msm_mdss_enable(struct msm_mdss *msm_mdss)static int msm_mdss_disable (struct msm_mdss *msm_mdss) {clk_bulk_disable_unprepare (msm_mdss->num_clocks, msm_mdss->clocks); -msm_mdss_icc_request_bw (msm_mdss,0 ); +msm_mdss_icc_request_bw (msm_mdss, false);return 0 ; }
Signature · 1 line
2.40.0
Re: [PATCH v2 4/5] drm/msm/mdss: Handle the reg bus ICC path
Hi Konrad,
Quoted 20 lines · Konrad Dybcio
Apart from the already handled data bus (MAS_MDP_Pn<->DDR), there's another path that needs to be handled to ensure MDSS functions properly, namely the "reg bus", a.k.a the CPU-MDSS interconnect.
Gating that path may have a variety of effects.. from none to otherwise inexplicable DSI timeouts..
On the MDSS side, we only have to ensure that it's on at what Qualcomm downstream calls "77 MHz", a.k.a 76.8 Mbps and turn it off at suspend.
To achieve that, make
msm_mdss_icc_request_bw()accept a boolean to indicate whether we want the busses to be on or off, as this function's only use is to vote for minimum or no bandwidth at all.Signed-off-by Konrad Dybcio <[email protected]>--- drivers/gpu/drm/msm/msm_mdss.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-)drivers/gpu/drm/msm/msm_mdss.c +0
-0
[..]
drivers/gpu/drm/msm/msm_mdss.c static void msm_mdss_put_icc_path(void *data) · line 100
Quoted 11 lines
drivers/gpu/drm/msm/msm_mdss.c +5
-2-static void msm_mdss_icc_request_bw (struct msm_mdss *msm_mdss,unsigned long bw) +static void msm_mdss_icc_request_bw (struct msm_mdss *msm_mdss,bool enable) {int i;for (i =0 ; i < msm_mdss->num_mdp_paths; i++) -icc_set_bw (msm_mdss->mdp_path[i],0 ,Bps_to_icc (bw)); +icc_set_bw (msm_mdss->mdp_path[i],0 , enable ?Bps_to_icc (MIN_IB_BW ) :0 ); + +if (msm_mdss->reg_bus_path) +icc_set_bw (msm_mdss->reg_bus_path,0 , enable ?76800 :0 );
Please use Bps_to_icc, kbps_to_icc or any of the other macros.
BR,
Georgi
PATCH v2 5/5 drm/msm/dpu1: Handle the reg bus ICC path
In reply to Konrad DybcioApart from the already handled data bus (MAS_MDP_Pn<->DDR), there's another path that needs to be handled to ensure MDSS functions properly, namely the "reg bus", a.k.a the CPU-MDSS interconnect.
Gating that path may have a variety of effects.. from none to otherwise inexplicable DSI timeouts..
On the DPU side, we need to keep the bus alive. The vendor driver kickstarts it to max (300Mbps) throughput on first commit, but in exchange for some battery life in rare DPU-enabled-panel-disabled usecases, we can request it at DPU init and gate it at suspend.
--- drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c | 22 ++++++++++++++++++++-- drivers/gpu/drm/msm/disp/dpu1/dpu_kms.h | 1 + 2 files changed, 21 insertions(+), 2 deletions(-)
drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c +20 -2
@@ -384,15 +384,17 @@ static int dpu_kms_global_obj_init(struct dpu_kms *dpu_kms)return 0 ; } -static int dpu_kms_parse_data_bus_icc_path (struct dpu_kms *dpu_kms) +static int dpu_kms_parse_icc_paths (struct dpu_kms *dpu_kms) {struct icc_path *path0;struct icc_path *path1; +struct icc_path *reg_bus_path;struct drm_device *dev = dpu_kms->dev;struct device *dpu_dev = dev->dev; path0 =msm_icc_get (dpu_dev,"mdp0-mem" ); path1 =msm_icc_get (dpu_dev,"mdp1-mem" ); + reg_bus_path =msm_icc_get (dpu_dev,"cpu-cfg" );if (IS_ERR_OR_NULL (path0))return PTR_ERR_OR_ZERO (path0);
@@ -404,6 +406,10 @@ static int dpu_kms_parse_data_bus_icc_path(struct dpu_kms *dpu_kms) dpu_kms->mdp_path[1 ] = path1; dpu_kms->num_mdp_paths++; } + +if (!IS_ERR_OR_NULL (reg_bus_path)) + dpu_kms->reg_bus_path = reg_bus_path; +return 0 ; }
@@ -1039,7 +1045,7 @@ static int dpu_kms_hw_init(struct msm_kms *kms)DPU_DEBUG ("REG_DMA is not defined" ); } -dpu_kms_parse_data_bus_icc_path (dpu_kms); +dpu_kms_parse_icc_paths (dpu_kms); rc =pm_runtime_resume_and_get (&dpu_kms->pdev->dev);if (rc <0 )
@@ -1241,6 +1247,9 @@ static int __maybe_unused dpu_runtime_suspend(struct device *dev)for (i =0 ; i < dpu_kms->num_mdp_paths; i++)icc_set_bw (dpu_kms->mdp_path[i],0 ,0 ); +if (dpu_kms->reg_bus_path) +icc_set_bw (dpu_kms->reg_bus_path,0 ,0 ); +return 0 ; }
@@ -1261,6 +1270,15 @@ static int __maybe_unused dpu_runtime_resume(struct device *dev)return rc; } +/* +* The vendor driver supports setting 76.8 / 150 / 300 MBps on this +* path, but it seems to go for the highest level when display output +* is enabled and zero otherwise. For simplicity, we can assume that +* DPU being enabled and running implies that. +*/ +if (dpu_kms->reg_bus_path) +icc_set_bw (dpu_kms->reg_bus_path,0 ,MBps_to_icc (300 )); +dpu_vbif_init_memtypes (dpu_kms);drm_for_each_encoder (encoder, ddev)
drivers/gpu/drm/msm/disp/dpu1/dpu_kms.h +1 -0
@@ -111,6 +111,7 @@ struct dpu_kms {atomic_t bandwidth_ref;struct icc_path *mdp_path[2 ];u32 num_mdp_paths; +struct icc_path *reg_bus_path; };struct vsync_info {
Signature · 1 line
2.40.0