Add an optional reference to the MDSS_CORE reset, which when specified can be used by the implementation to reset the hardware blocks.
Reviewed-by: Dmitry Baryshkov dmitry.baryshkov@linaro.org Acked-by: Krzysztof Kozlowski krzysztof.kozlowski@linaro.org Signed-off-by: Bjorn Andersson bjorn.andersson@linaro.org ---
Changes since v3: - None
.../devicetree/bindings/display/msm/dpu-qcm2290.yaml | 4 ++++ Documentation/devicetree/bindings/display/msm/dpu-sc7180.yaml | 4 ++++ Documentation/devicetree/bindings/display/msm/dpu-sc7280.yaml | 4 ++++ Documentation/devicetree/bindings/display/msm/dpu-sdm845.yaml | 4 ++++ 4 files changed, 16 insertions(+)
diff --git a/Documentation/devicetree/bindings/display/msm/dpu-qcm2290.yaml b/Documentation/devicetree/bindings/display/msm/dpu-qcm2290.yaml index 6fb7e321f011..734d14de966d 100644 --- a/Documentation/devicetree/bindings/display/msm/dpu-qcm2290.yaml +++ b/Documentation/devicetree/bindings/display/msm/dpu-qcm2290.yaml @@ -66,6 +66,10 @@ properties: interconnect-names: const: mdp0-mem
+ resets: + items: + - description: MDSS_CORE reset + patternProperties: "^display-controller@[0-9a-f]+$": type: object diff --git a/Documentation/devicetree/bindings/display/msm/dpu-sc7180.yaml b/Documentation/devicetree/bindings/display/msm/dpu-sc7180.yaml index 12a86b1ec1bc..b41991eaa454 100644 --- a/Documentation/devicetree/bindings/display/msm/dpu-sc7180.yaml +++ b/Documentation/devicetree/bindings/display/msm/dpu-sc7180.yaml @@ -65,6 +65,10 @@ properties: interconnect-names: const: mdp0-mem
+ resets: + items: + - description: MDSS_CORE reset + patternProperties: "^display-controller@[0-9a-f]+$": type: object diff --git a/Documentation/devicetree/bindings/display/msm/dpu-sc7280.yaml b/Documentation/devicetree/bindings/display/msm/dpu-sc7280.yaml index fbeb931a026e..6e417d06fc79 100644 --- a/Documentation/devicetree/bindings/display/msm/dpu-sc7280.yaml +++ b/Documentation/devicetree/bindings/display/msm/dpu-sc7280.yaml @@ -64,6 +64,10 @@ properties: interconnect-names: const: mdp0-mem
+ resets: + items: + - description: MDSS_CORE reset + patternProperties: "^display-controller@[0-9a-f]+$": type: object diff --git a/Documentation/devicetree/bindings/display/msm/dpu-sdm845.yaml b/Documentation/devicetree/bindings/display/msm/dpu-sdm845.yaml index 0dca4b3d66e4..1a42491efdbc 100644 --- a/Documentation/devicetree/bindings/display/msm/dpu-sdm845.yaml +++ b/Documentation/devicetree/bindings/display/msm/dpu-sdm845.yaml @@ -57,6 +57,10 @@ properties:
ranges: true
+ resets: + items: + - description: MDSS_CORE reset + patternProperties: "^display-controller@[0-9a-f]+$": type: object
It's typical for the bootloader to bring up the display for showing a boot splash or efi framebuffer. But in some cases the kernel driver ends up only partially configuring (in particular) the DPU, which might result in e.g. that two different data paths attempts to push data to the interface - with resulting graphical artifacts.
Naturally the end goal would be to inherit the bootloader's configuration and provide the user with a glitch free handover from the boot configuration to a running DPU.
But as implementing seamless transition from the bootloader configuration to the running OS will be a considerable effort, start by simply resetting the entire MDSS to its power-on state, to avoid the partial configuration.
Signed-off-by: Bjorn Andersson bjorn.andersson@linaro.org ---
Changes since v3: - Rebased upon the mdss dpu/mdp restructuring (https://patchwork.freedesktop.org/series/98525/)
drivers/gpu/drm/msm/msm_mdss.c | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+)
diff --git a/drivers/gpu/drm/msm/msm_mdss.c b/drivers/gpu/drm/msm/msm_mdss.c index f6f0d0fa5ab2..20f154dda9cf 100644 --- a/drivers/gpu/drm/msm/msm_mdss.c +++ b/drivers/gpu/drm/msm/msm_mdss.c @@ -4,11 +4,13 @@ */
#include <linux/clk.h> +#include <linux/delay.h> #include <linux/irq.h> #include <linux/irqchip.h> #include <linux/irqdesc.h> #include <linux/irqchip/chained_irq.h> #include <linux/pm_runtime.h> +#include <linux/reset.h>
#include "msm_drv.h" #include "msm_kms.h" @@ -193,6 +195,32 @@ static void msm_mdss_destroy(struct msm_mdss *msm_mdss) irq_set_chained_handler_and_data(irq, NULL, NULL); }
+static int msm_mdss_reset(struct device *dev) +{ + struct reset_control *reset; + + reset = reset_control_get_optional_exclusive(dev, NULL); + if (!reset) { + /* Optional reset not specified */ + return 0; + } else if (IS_ERR(reset)) { + return dev_err_probe(dev, PTR_ERR(reset), + "failed to acquire mdss reset\n"); + } + + reset_control_assert(reset); + /* + * Tests indicate that reset has to be held for some period of time, + * make it one frame in a typical system + */ + msleep(20); + reset_control_deassert(reset); + + reset_control_put(reset); + + return 0; +} + /* * MDP5 MDSS uses at most three specified clocks. */ @@ -229,6 +257,10 @@ static struct msm_mdss *msm_mdss_init(struct platform_device *pdev, bool is_mdp5 int ret; int irq;
+ ret = msm_mdss_reset(&pdev->dev); + if (ret) + return ERR_PTR(ret); + msm_mdss = devm_kzalloc(&pdev->dev, sizeof(*msm_mdss), GFP_KERNEL); if (!msm_mdss) return ERR_PTR(-ENOMEM);
On 21/04/2022 07:15, Bjorn Andersson wrote:
It's typical for the bootloader to bring up the display for showing a boot splash or efi framebuffer. But in some cases the kernel driver ends up only partially configuring (in particular) the DPU, which might result in e.g. that two different data paths attempts to push data to the interface - with resulting graphical artifacts.
Naturally the end goal would be to inherit the bootloader's configuration and provide the user with a glitch free handover from the boot configuration to a running DPU.
But as implementing seamless transition from the bootloader configuration to the running OS will be a considerable effort, start by simply resetting the entire MDSS to its power-on state, to avoid the partial configuration.
Signed-off-by: Bjorn Andersson bjorn.andersson@linaro.org
Reviewed-by: Dmitry Baryshkov dmitry.baryshkov@linaro.org
Changes since v3:
Rebased upon the mdss dpu/mdp restructuring (https://patchwork.freedesktop.org/series/98525/)
drivers/gpu/drm/msm/msm_mdss.c | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+)
diff --git a/drivers/gpu/drm/msm/msm_mdss.c b/drivers/gpu/drm/msm/msm_mdss.c index f6f0d0fa5ab2..20f154dda9cf 100644 --- a/drivers/gpu/drm/msm/msm_mdss.c +++ b/drivers/gpu/drm/msm/msm_mdss.c @@ -4,11 +4,13 @@ */
#include <linux/clk.h> +#include <linux/delay.h> #include <linux/irq.h> #include <linux/irqchip.h> #include <linux/irqdesc.h> #include <linux/irqchip/chained_irq.h> #include <linux/pm_runtime.h> +#include <linux/reset.h>
#include "msm_drv.h" #include "msm_kms.h" @@ -193,6 +195,32 @@ static void msm_mdss_destroy(struct msm_mdss *msm_mdss) irq_set_chained_handler_and_data(irq, NULL, NULL); }
+static int msm_mdss_reset(struct device *dev) +{
- struct reset_control *reset;
- reset = reset_control_get_optional_exclusive(dev, NULL);
- if (!reset) {
/* Optional reset not specified */
return 0;
- } else if (IS_ERR(reset)) {
return dev_err_probe(dev, PTR_ERR(reset),
"failed to acquire mdss reset\n");
- }
- reset_control_assert(reset);
- /*
* Tests indicate that reset has to be held for some period of time,
* make it one frame in a typical system
*/
- msleep(20);
- reset_control_deassert(reset);
- reset_control_put(reset);
- return 0;
+}
- /*
*/
- MDP5 MDSS uses at most three specified clocks.
@@ -229,6 +257,10 @@ static struct msm_mdss *msm_mdss_init(struct platform_device *pdev, bool is_mdp5 int ret; int irq;
- ret = msm_mdss_reset(&pdev->dev);
- if (ret)
return ERR_PTR(ret);
- msm_mdss = devm_kzalloc(&pdev->dev, sizeof(*msm_mdss), GFP_KERNEL); if (!msm_mdss) return ERR_PTR(-ENOMEM);
dri-devel@lists.freedesktop.org