5.19 fixes for msm-next - Fix to add minimum ICC vote in the msm_mdss pm_resume path to address bootup splats - Fix to avoid dereferencing without checking in WB encoder - Fix to avoid crash during suspend in DP driver by ensuring interrupt mask bits are updated - Remove unused code from dpu_encoder_virt_atomic_check() - Fix to remove redundant init of dsc variable Signed-off-by: Dave Airlie <airlied@redhat.com>
Unified · Split
| @@ -541,7 +541,6 @@ static int dpu_encoder_virt_atomic_check( · 540 unmodified lines | ||
| 541 | 541 | struct dpu_encoder_virt *dpu_enc; |
| 542 | 542 | struct msm_drm_private *priv; |
| 543 | 543 | struct dpu_kms *dpu_kms; |
| 544 | − const struct drm_display_mode *mode; | |
| 545 | 544 | struct drm_display_mode *adj_mode; |
| 546 | 545 | struct msm_display_topology topology; |
| 547 | 546 | struct dpu_global_state *global_state; |
| @@ -559,7 +558,6 @@ static int dpu_encoder_virt_atomic_check( · 11 unmodified lines | ||
| 559 | 558 | |
| 560 | 559 | priv = drm_enc->dev->dev_private; |
| 561 | 560 | dpu_kms = to_dpu_kms(priv->kms); |
| 562 | − mode = &crtc_state->mode; | |
| 563 | 561 | adj_mode = &crtc_state->adjusted_mode; |
| 564 | 562 | global_state = dpu_kms_get_global_state(crtc_state->state); |
| 565 | 563 | if (IS_ERR(global_state)) |
| @@ -1814,7 +1812,6 @@ static void dpu_encoder_prep_dsc(struct dpu_encoder_virt *dpu_enc, · 1248 unmodified lines | ||
| 1814 | 1812 | } |
| 1815 | 1813 | } |
| 1816 | 1814 | |
| 1817 | − dsc_common_mode = 0; | |
| 1818 | 1815 | pic_width = dsc->drm->pic_width; |
| 1819 | 1816 | |
| 1820 | 1817 | dsc_common_mode = DSC_MODE_MULTIPLEX | DSC_MODE_SPLIT_PANEL; |
| @@ -574,11 +574,11 @@ static void dpu_encoder_phys_wb_disable(struct dpu_encoder_phys *phys_enc) · 573 unmodified lines | ||
| 574 | 574 | */ |
| 575 | 575 | static void dpu_encoder_phys_wb_destroy(struct dpu_encoder_phys *phys_enc) |
| 576 | 576 | { |
| 577 | − DPU_DEBUG("[wb:%d]\n", phys_enc->wb_idx - WB_0); | |
| 578 | − | |
| 579 | 577 | if (!phys_enc) |
| 580 | 578 | return; |
| 581 | 579 | |
| 580 | + DPU_DEBUG("[wb:%d]\n", phys_enc->wb_idx - WB_0); | |
| 581 | + | |
| 582 | 582 | kfree(phys_enc); |
| 583 | 583 | } |
| 584 | 584 | |
| @@ -49,8 +49,6 @@ · 48 unmodified lines | ||
| 49 | 49 | #define DPU_DEBUGFS_DIR "msm_dpu" |
| 50 | 50 | #define DPU_DEBUGFS_HWMASKNAME "hw_log_mask" |
| 51 | 51 | |
| 52 | −#define MIN_IB_BW 400000000ULL /* Min ib vote 400MB */ | |
| 53 | − | |
| 54 | 52 | static int dpu_kms_hw_init(struct msm_kms *kms); |
| 55 | 53 | static void _dpu_kms_mmu_destroy(struct dpu_kms *dpu_kms); |
| 56 | 54 | |
| @@ -1305,15 +1303,9 @@ static int __maybe_unused dpu_runtime_resume(struct device *dev) · 1248 unmodified lines | ||
| 1305 | 1303 | struct dpu_kms *dpu_kms = to_dpu_kms(priv->kms); |
| 1306 | 1304 | struct drm_encoder *encoder; |
| 1307 | 1305 | struct drm_device *ddev; |
| 1308 | − int i; | |
| 1309 | 1306 | |
| 1310 | 1307 | ddev = dpu_kms->dev; |
| 1311 | 1308 | |
| 1312 | − WARN_ON(!(dpu_kms->num_paths)); | |
| 1313 | − /* Min vote of BW is required before turning on AXI clk */ | |
| 1314 | − for (i = 0; i < dpu_kms->num_paths; i++) | |
| 1315 | − icc_set_bw(dpu_kms->path[i], 0, Bps_to_icc(MIN_IB_BW)); | |
| 1316 | − | |
| 1317 | 1309 | rc = clk_bulk_prepare_enable(dpu_kms->num_clocks, dpu_kms->clocks); |
| 1318 | 1310 | if (rc) { |
| 1319 | 1311 | DPU_ERROR("clock enable failed rc:%d\n", rc); |
| @@ -1390,8 +1390,13 @@ void dp_ctrl_reset_irq_ctrl(struct dp_ctrl *dp_ctrl, bool enable) · 1389 unmodified lines | ||
| 1390 | 1390 | |
| 1391 | 1391 | dp_catalog_ctrl_reset(ctrl->catalog); |
| 1392 | 1392 | |
| 1393 | − if (enable) | |
| 1394 | − dp_catalog_ctrl_enable_irq(ctrl->catalog, enable); | |
| 1393 | + /* | |
| 1394 | + * all dp controller programmable registers will not | |
| 1395 | + * be reset to default value after DP_SW_RESET | |
| 1396 | + * therefore interrupt mask bits have to be updated | |
| 1397 | + * to enable/disable interrupts | |
| 1398 | + */ | |
| 1399 | + dp_catalog_ctrl_enable_irq(ctrl->catalog, enable); | |
| 1395 | 1400 | } |
| 1396 | 1401 | |
| 1397 | 1402 | void dp_ctrl_phy_init(struct dp_ctrl *dp_ctrl) |
| @@ -5,6 +5,7 @@ · 4 unmodified lines | ||
| 5 | 5 | |
| 6 | 6 | #include <linux/clk.h> |
| 7 | 7 | #include <linux/delay.h> |
| 8 | +#include <linux/interconnect.h> | |
| 8 | 9 | #include <linux/irq.h> |
| 9 | 10 | #include <linux/irqchip.h> |
| 10 | 11 | #include <linux/irqdesc.h> |
| @@ -25,6 +26,8 @@ · 14 unmodified lines | ||
| 25 | 26 | #define UBWC_CTRL_2 0x150 |
| 26 | 27 | #define UBWC_PREDICTION_MODE 0x154 |
| 27 | 28 | |
| 29 | +#define MIN_IB_BW 400000000UL /* Min ib vote 400MB */ | |
| 30 | + | |
| 28 | 31 | struct msm_mdss { |
| 29 | 32 | struct device *dev; |
| 30 | 33 | |
| @@ -36,8 +39,47 @@ struct msm_mdss { · 5 unmodified lines | ||
| 36 | 39 | unsigned long enabled_mask; |
| 37 | 40 | struct irq_domain *domain; |
| 38 | 41 | } irq_controller; |
| 42 | + struct icc_path *path[2]; | |
| 43 | + u32 num_paths; | |
| 39 | 44 | }; |
| 40 | 45 | |
| 46 | +static int msm_mdss_parse_data_bus_icc_path(struct device *dev, | |
| 47 | + struct msm_mdss *msm_mdss) | |
| 48 | +{ | |
| 49 | + struct icc_path *path0 = of_icc_get(dev, "mdp0-mem"); | |
| 50 | + struct icc_path *path1 = of_icc_get(dev, "mdp1-mem"); | |
| 51 | + | |
| 52 | + if (IS_ERR_OR_NULL(path0)) | |
| 53 | + return PTR_ERR_OR_ZERO(path0); | |
| 54 | + | |
| 55 | + msm_mdss->path[0] = path0; | |
| 56 | + msm_mdss->num_paths = 1; | |
| 57 | + | |
| 58 | + if (!IS_ERR_OR_NULL(path1)) { | |
| 59 | + msm_mdss->path[1] = path1; | |
| 60 | + msm_mdss->num_paths++; | |
| 61 | + } | |
| 62 | + | |
| 63 | + return 0; | |
| 64 | +} | |
| 65 | + | |
| 66 | +static void msm_mdss_put_icc_path(void *data) | |
| 67 | +{ | |
| 68 | + struct msm_mdss *msm_mdss = data; | |
| 69 | + int i; | |
| 70 | + | |
| 71 | + for (i = 0; i < msm_mdss->num_paths; i++) | |
| 72 | + icc_put(msm_mdss->path[i]); | |
| 73 | +} | |
| 74 | + | |
| 75 | +static void msm_mdss_icc_request_bw(struct msm_mdss *msm_mdss, unsigned long bw) | |
| 76 | +{ | |
| 77 | + int i; | |
| 78 | + | |
| 79 | + for (i = 0; i < msm_mdss->num_paths; i++) | |
| 80 | + icc_set_bw(msm_mdss->path[i], 0, Bps_to_icc(bw)); | |
| 81 | +} | |
| 82 | + | |
| 41 | 83 | static void msm_mdss_irq(struct irq_desc *desc) |
| 42 | 84 | { |
| 43 | 85 | struct msm_mdss *msm_mdss = irq_desc_get_handler_data(desc); |
| @@ -136,6 +178,13 @@ static int msm_mdss_enable(struct msm_mdss *msm_mdss) · 92 unmodified lines | ||
| 136 | 178 | { |
| 137 | 179 | int ret; |
| 138 | 180 | |
| 181 | + /* | |
| 182 | + * Several components have AXI clocks that can only be turned on if | |
| 183 | + * the interconnect is enabled (non-zero bandwidth). Let's make sure | |
| 184 | + * that the interconnects are at least at a minimum amount. | |
| 185 | + */ | |
| 186 | + msm_mdss_icc_request_bw(msm_mdss, MIN_IB_BW); | |
| 187 | + | |
| 139 | 188 | ret = clk_bulk_prepare_enable(msm_mdss->num_clocks, msm_mdss->clocks); |
| 140 | 189 | if (ret) { |
| 141 | 190 | dev_err(msm_mdss->dev, "clock enable failed, ret:%d\n", ret); |
| @@ -178,6 +227,7 @@ static int msm_mdss_enable(struct msm_mdss *msm_mdss) · 36 unmodified lines | ||
| 178 | 227 | static int msm_mdss_disable(struct msm_mdss *msm_mdss) |
| 179 | 228 | { |
| 180 | 229 | clk_bulk_disable_unprepare(msm_mdss->num_clocks, msm_mdss->clocks); |
| 230 | + msm_mdss_icc_request_bw(msm_mdss, 0); | |
| 181 | 231 | |
| 182 | 232 | return 0; |
| 183 | 233 | } |
| @@ -271,6 +321,13 @@ static struct msm_mdss *msm_mdss_init(struct platform_device *pdev, bool is_mdp5 · 87 unmodified lines | ||
| 271 | 321 | |
| 272 | 322 | dev_dbg(&pdev->dev, "mapped mdss address space @%pK\n", msm_mdss->mmio); |
| 273 | 323 | |
| 324 | + ret = msm_mdss_parse_data_bus_icc_path(&pdev->dev, msm_mdss); | |
| 325 | + if (ret) | |
| 326 | + return ERR_PTR(ret); | |
| 327 | + ret = devm_add_action_or_reset(&pdev->dev, msm_mdss_put_icc_path, msm_mdss); | |
| 328 | + if (ret) | |
| 329 | + return ERR_PTR(ret); | |
| 330 | + | |
| 274 | 331 | if (is_mdp5) |
| 275 | 332 | ret = mdp5_mdss_parse_clock(pdev, &msm_mdss->clocks); |
| 276 | 333 | else |