MDSS reg bus interconnect
Subsystems (6)
v3 cover MDSS reg bus interconnect
Per agreement with Konrad, picked up this patch series.
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.
Changes since v2:
- Rebased on top of msm/next aka 6.6-rc2, Dropped merged patches.
- Dropped the *1000 factor from reg-bus BW values (Konrad).
Changes since v1:
- Dropped the DPU part, the MDSS vote seems to be enough
- Reworked MDSS voting patch. Replaced static bw value with the per-platform confgurable values.
- Added sm8450 DT patch.
Dmitry Baryshkov (3):
drm/msm/mdss: switch mdss to use devm_of_icc_get() drm/msm/mdss: inline msm_mdss_icc_request_bw() drm/msm/mdss: Handle the reg bus ICC path
Konrad Dybcio (2):
dt-bindings: display/msm: Add reg bus and rotator interconnects drm/msm/mdss: Rename path references to mdp_path
Linus Torvalds (1):
Linux 6.6-rc2
.../bindings/display/msm/mdss-common.yaml | 2 + Makefile | 2 +- drivers/gpu/drm/msm/msm_mdss.c | 96 ++++++++++++------- drivers/gpu/drm/msm/msm_mdss.h | 1 + 4 files changed, 65 insertions(+), 36 deletions(-)
Signature · 1 line
2.39.2
PATCH v3 1/6 Linux 6.6-rc2
From: Linus Torvalds <[email protected]>
--- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Makefile +1 -1
@@ -2,7 +2,7 @@ VERSION = 6 PATCHLEVEL = 6 SUBLEVEL = 0 -EXTRAVERSION = -rc1 +EXTRAVERSION = -rc2 NAME = Hurr durr I'ma ninja sloth # *DOCUMENTATION*
Signature · 1 line
2.39.2
PATCH v3 2/6 dt-bindings: display/msm: Add reg bus and rotator interconnects
In reply to Dmitry BaryshkovFrom: Konrad Dybcio <[email protected]>
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
--- 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.39.2
Re: [PATCH v3 2/6] dt-bindings: display/msm: Add reg bus and rotator interconnects
Hi,
Quoted 28 lines · Dmitry Baryshkov
From: Konrad Dybcio <[email protected]>
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 <[email protected]>Signed-off-by Dmitry Baryshkov <[email protected]>--- Documentation/devicetree/bindings/display/msm/mdss-common.yaml | 2 ++ 1 file changed, 2 insertions(+)Documentation/devicetree/bindings/display/msm/mdss-common.yaml +1
-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
Documentation/devicetree/bindings/display/msm/mdss-common.yaml properties: · line 79
Quoted 10 lines
Documentation/devicetree/bindings/display/msm/mdss-common.yaml +1
-0interconnect-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@ae00000: 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@ae00000: 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:
==========><================================
Documentation/devicetree/bindings/display/msm/qcom,sm8450-mdss.yaml +2 -2
@@ -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
Re: [PATCH v3 2/6] dt-bindings: display/msm: Add reg bus and rotator interconnects
Quoted 37 lines · Neil Armstrong
Hi,
Quoted 34 lines · Dmitry Baryshkov
From: Konrad Dybcio <[email protected]>
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 <[email protected]>Signed-off-by Dmitry Baryshkov <[email protected]>---
Documentation/devicetree/bindings/display/msm/mdss-common.yaml| 2 ++1 file changed, 2 insertions(+)Documentation/devicetree/bindings/display/msm/mdss-common.yaml +0
-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
Quoted 8 lines
Quoted 2 lines
resets:
items:This is not enough, on sm8450 this still appears with patch applied:
arch/arm64/boot/dts/qcom/sm8450-hdk.dtb: display-subsystem@ae00000: 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@ae00000: interconnect-names: ['mdp0-mem', 'mdp1-mem', 'cpu-cfg'] is too long
from schema $id: http://devicetree.org/schemas/display/msm/qcom,sm8450-mdss.yaml#
I assume this is with the path actually added in the dt, and not just with this patch applied?
I guess increasing the numbers from the getgo would probably be good idea too :)
Konrad
PATCH v3 3/6 drm/msm/mdss: switch mdss to use devm_of_icc_get()
In reply to Dmitry BaryshkovStop using hand-written reset function for ICC release, use devm_of_icc_get() instead.
--- drivers/gpu/drm/msm/msm_mdss.c | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-)
drivers/gpu/drm/msm/msm_mdss.c +2 -14
@@ -50,14 +50,14 @@ static int msm_mdss_parse_data_bus_icc_path(struct device *dev,struct icc_path *path0;struct icc_path *path1; - path0 =of_icc_get (dev,"mdp0-mem" ); + path0 =devm_of_icc_get (dev,"mdp0-mem" );if (IS_ERR_OR_NULL (path0))return PTR_ERR_OR_ZERO (path0); msm_mdss->path[0 ] = path0; msm_mdss->num_paths =1 ; - path1 =of_icc_get (dev,"mdp1-mem" ); + path1 =devm_of_icc_get (dev,"mdp1-mem" );if (!IS_ERR_OR_NULL (path1)) { msm_mdss->path[1 ] = path1; msm_mdss->num_paths++;
@@ -66,15 +66,6 @@ static int msm_mdss_parse_data_bus_icc_path(struct device *dev,return 0 ; } -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]); -} -static void msm_mdss_icc_request_bw (struct msm_mdss *msm_mdss,unsigned long bw) {int i;
@@ -391,9 +382,6 @@ static struct msm_mdss *msm_mdss_init(struct platform_device *pdev, bool is_mdp5dev_dbg (&pdev->dev,"mapped mdss address space @%pK\n" , msm_mdss->mmio); ret =msm_mdss_parse_data_bus_icc_path (&pdev->dev, msm_mdss); -if (ret) -return ERR_PTR (ret); - ret =devm_add_action_or_reset (&pdev->dev, msm_mdss_put_icc_path, msm_mdss);if (ret)return ERR_PTR (ret);
Signature · 1 line
2.39.2
PATCH v3 4/6 drm/msm/mdss: Rename path references to mdp_path
In reply to Dmitry BaryshkovFrom: Konrad Dybcio <[email protected]>
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_".
--- drivers/gpu/drm/msm/msm_mdss.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-)
drivers/gpu/drm/msm/msm_mdss.c +8 -8
@@ -40,8 +40,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,
@@ -54,13 +54,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 =devm_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 ;
@@ -70,8 +70,8 @@ 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.39.2
PATCH v3 5/6 drm/msm/mdss: inline msm_mdss_icc_request_bw()
In reply to Dmitry BaryshkovThere are just two places where we set the bandwidth: in the resume and in the suspend paths. Drop the wrapping function msm_mdss_icc_request_bw() and call icc_set_bw() directly.
--- drivers/gpu/drm/msm/msm_mdss.c | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-)
drivers/gpu/drm/msm/msm_mdss.c +8 -11
@@ -66,14 +66,6 @@ static int msm_mdss_parse_data_bus_icc_path(struct device *dev,return 0 ; } -static void msm_mdss_icc_request_bw (struct msm_mdss *msm_mdss,unsigned long bw) -{ -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)); -} -static void msm_mdss_irq (struct irq_desc *desc) {struct msm_mdss *msm_mdss =irq_desc_get_handler_data (desc);
@@ -227,14 +219,15 @@ const struct msm_mdss_data *msm_mdss_get_mdss_data(struct device *dev)static int msm_mdss_enable (struct msm_mdss *msm_mdss) { -int ret; +int ret, i;/* * Several components have AXI clocks that can only be turned on if * 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 ); +for (i =0 ; i < msm_mdss->num_mdp_paths; i++) +icc_set_bw (msm_mdss->mdp_path[i],0 ,Bps_to_icc (MIN_IB_BW )); ret =clk_bulk_prepare_enable (msm_mdss->num_clocks, msm_mdss->clocks);if (ret) {
@@ -286,8 +279,12 @@ static int msm_mdss_enable(struct msm_mdss *msm_mdss)static int msm_mdss_disable (struct msm_mdss *msm_mdss) { +int i; +clk_bulk_disable_unprepare (msm_mdss->num_clocks, msm_mdss->clocks); -msm_mdss_icc_request_bw (msm_mdss,0 ); + +for (i =0 ; i < msm_mdss->num_mdp_paths; i++) +icc_set_bw (msm_mdss->mdp_path[i],0 ,0 );return 0 ; }
Signature · 1 line
2.39.2
PATCH v3 6/6 drm/msm/mdss: Handle the reg bus ICC path
In reply to Dmitry BaryshkovApart 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.
Provide a way for MDSS driver to vote on this bus.
A note regarding vote values. Newer platforms have corresponding bandwidth values in the vendor DT files. For the older platforms there was a static vote in the mdss_mdp and rotator drivers. I choose to be conservative here and choose this value as a default.
--- drivers/gpu/drm/msm/msm_mdss.c | 49 +++++++++++++++++++++++++++++++--- drivers/gpu/drm/msm/msm_mdss.h | 1 + 2 files changed, 46 insertions(+), 4 deletions(-)
drivers/gpu/drm/msm/msm_mdss.c +45 -4
@@ -28,6 +28,8 @@#define MIN_IB_BW 400000000UL/* Min ib vote 400MB */ +#define DEFAULT_REG_BW 153600/* Used in mdss fbdev driver */ +struct msm_mdss {struct device *dev;
@@ -42,6 +44,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,
@@ -49,6 +52,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 =devm_of_icc_get (dev,"mdp0-mem" );if (IS_ERR_OR_NULL (path0))
@@ -63,6 +67,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 ; }
@@ -229,6 +237,13 @@ static int msm_mdss_enable(struct msm_mdss *msm_mdss)for (i =0 ; i < msm_mdss->num_mdp_paths; i++)icc_set_bw (msm_mdss->mdp_path[i],0 ,Bps_to_icc (MIN_IB_BW )); +if (msm_mdss->mdss_data && msm_mdss->mdss_data->reg_bus_bw) +icc_set_bw (msm_mdss->reg_bus_path,0 , + msm_mdss->mdss_data->reg_bus_bw); +else +icc_set_bw (msm_mdss->reg_bus_path,0 , +DEFAULT_REG_BW ); + ret =clk_bulk_prepare_enable (msm_mdss->num_clocks, msm_mdss->clocks);if (ret) {dev_err (msm_mdss->dev,"clock enable failed, ret:%d\n" , ret);
@@ -286,6 +301,9 @@ static int msm_mdss_disable(struct msm_mdss *msm_mdss)for (i =0 ; i < msm_mdss->num_mdp_paths; i++)icc_set_bw (msm_mdss->mdp_path[i],0 ,0 ); +if (msm_mdss->reg_bus_path) +icc_set_bw (msm_mdss->reg_bus_path,0 ,0 ); +return 0 ; }
@@ -372,6 +390,8 @@ static struct msm_mdss *msm_mdss_init(struct platform_device *pdev, bool is_mdp5if (!msm_mdss)return ERR_PTR (-ENOMEM ); + msm_mdss->mdss_data =of_device_get_match_data (&pdev->dev); + msm_mdss->mmio =devm_platform_ioremap_resource_byname (pdev, is_mdp5 ?"mdss_phys" :"mdss" );if (IS_ERR (msm_mdss->mmio))return ERR_CAST (msm_mdss->mmio);
@@ -462,8 +482,6 @@ static int mdss_probe(struct platform_device *pdev)if (IS_ERR (mdss))return PTR_ERR (mdss); - mdss->mdss_data =of_device_get_match_data (&pdev->dev); -platform_set_drvdata (pdev, mdss);/*
@@ -497,11 +515,13 @@ static const struct msm_mdss_data msm8998_data = { .ubwc_enc_version = UBWC_1_0, .ubwc_dec_version = UBWC_1_0, .highest_bank_bit = 1, + .reg_bus_bw = 76800, };static const struct msm_mdss_data qcm2290_data = {/* no UBWC */ .highest_bank_bit =0x2 , + .reg_bus_bw =76800 , };static const struct msm_mdss_data sc7180_data = {
@@ -509,6 +529,7 @@ static const struct msm_mdss_data sc7180_data = { .ubwc_dec_version = UBWC_2_0, .ubwc_static = 0x1e, .highest_bank_bit = 0x3, + .reg_bus_bw = 76800, };static const struct msm_mdss_data sc7280_data = {
@@ -518,6 +539,7 @@ static const struct msm_mdss_data sc7280_data = { .ubwc_static = 1, .highest_bank_bit = 1, .macrotile_mode = 1, + .reg_bus_bw = 74000, };static const struct msm_mdss_data sc8180x_data = {
@@ -525,6 +547,7 @@ static const struct msm_mdss_data sc8180x_data = { .ubwc_dec_version = UBWC_3_0, .highest_bank_bit = 3, .macrotile_mode = 1, + .reg_bus_bw = 76800, };static const struct msm_mdss_data sc8280xp_data = {
@@ -534,12 +557,14 @@ static const struct msm_mdss_data sc8280xp_data = { .ubwc_static = 1, .highest_bank_bit = 2, .macrotile_mode = 1, + .reg_bus_bw = 76800, };static const struct msm_mdss_data sdm845_data = { .ubwc_enc_version =UBWC_2_0 , .ubwc_dec_version =UBWC_2_0 , .highest_bank_bit =2 , + .reg_bus_bw =76800 , };static const struct msm_mdss_data sm6350_data = {
@@ -548,12 +573,14 @@ static const struct msm_mdss_data sm6350_data = { .ubwc_swizzle = 6, .ubwc_static = 0x1e, .highest_bank_bit = 1, + .reg_bus_bw = 76800, };static const struct msm_mdss_data sm8150_data = { .ubwc_enc_version =UBWC_3_0 , .ubwc_dec_version =UBWC_3_0 , .highest_bank_bit =2 , + .reg_bus_bw =76800 , };static const struct msm_mdss_data sm6115_data = {
@@ -562,6 +589,7 @@ static const struct msm_mdss_data sm6115_data = { .ubwc_swizzle = 7, .ubwc_static = 0x11f, .highest_bank_bit = 0x1, + .reg_bus_bw = 76800, };static const struct msm_mdss_data sm6125_data = {
@@ -579,6 +607,18 @@ static const struct msm_mdss_data sm8250_data = {/* TODO: highest_bank_bit = 2 for LP_DDR4 */ .highest_bank_bit = 3, .macrotile_mode = 1, + .reg_bus_bw = 76800, +}; + +static const struct msm_mdss_data sm8350_data = { + .ubwc_enc_version =UBWC_4_0 , + .ubwc_dec_version =UBWC_4_0 , + .ubwc_swizzle =6 , + .ubwc_static =1 , +/* TODO: highest_bank_bit = 2 for LP_DDR4 */ + .highest_bank_bit =3 , + .macrotile_mode =1 , + .reg_bus_bw =74000 , };static const struct msm_mdss_data sm8550_data = {
@@ -589,6 +629,7 @@ static const struct msm_mdss_data sm8550_data = {/* TODO: highest_bank_bit = 2 for LP_DDR4 */ .highest_bank_bit = 3, .macrotile_mode = 1, + .reg_bus_bw = 57000, };static const struct of_device_id mdss_dt_match[] = { { .compatible ="qcom,mdss" },
@@ -605,8 +646,8 @@ static const struct of_device_id mdss_dt_match[] = { { .compatible = "qcom,sm6375-mdss", .data = &sm6350_data }, { .compatible = "qcom,sm8150-mdss", .data = &sm8150_data }, { .compatible = "qcom,sm8250-mdss", .data = &sm8250_data }, - { .compatible = "qcom,sm8350-mdss", .data = &sm8250_data }, - { .compatible = "qcom,sm8450-mdss", .data = &sm8250_data }, + { .compatible = "qcom,sm8350-mdss", .data = &sm8350_data }, + { .compatible = "qcom,sm8450-mdss", .data = &sm8350_data }, { .compatible = "qcom,sm8550-mdss", .data = &sm8550_data }, {} };
drivers/gpu/drm/msm/msm_mdss.h +1 -0
@@ -14,6 +14,7 @@ struct msm_mdss_data {u32 ubwc_static;u32 highest_bank_bit;u32 macrotile_mode; +u32 reg_bus_bw; };#define UBWC_1_0 0x10000000
Signature · 1 line
2.39.2