Lines Matching +full:malidp +full:- +full:arqos +full:- +full:value

1 // SPDX-License-Identifier: GPL-2.0-only
56 hwdev->hw->map.coeffs_base + MALIDP_COEF_TABLE_ADDR); in malidp_write_gamma_table()
59 hwdev->hw->map.coeffs_base + in malidp_write_gamma_table()
66 struct malidp_drm *malidp = crtc_to_malidp_device(crtc); in malidp_atomic_commit_update_gamma() local
67 struct malidp_hw_device *hwdev = malidp->dev; in malidp_atomic_commit_update_gamma()
69 if (!crtc->state->color_mgmt_changed) in malidp_atomic_commit_update_gamma()
72 if (!crtc->state->gamma_lut) { in malidp_atomic_commit_update_gamma()
78 to_malidp_crtc_state(crtc->state); in malidp_atomic_commit_update_gamma()
80 if (!old_state->gamma_lut || (crtc->state->gamma_lut->base.id != in malidp_atomic_commit_update_gamma()
81 old_state->gamma_lut->base.id)) in malidp_atomic_commit_update_gamma()
82 malidp_write_gamma_table(hwdev, mc->gamma_coeffs); in malidp_atomic_commit_update_gamma()
93 struct malidp_drm *malidp = crtc_to_malidp_device(crtc); in malidp_atomic_commit_update_coloradj() local
94 struct malidp_hw_device *hwdev = malidp->dev; in malidp_atomic_commit_update_coloradj()
97 if (!crtc->state->color_mgmt_changed) in malidp_atomic_commit_update_coloradj()
100 if (!crtc->state->ctm) { in malidp_atomic_commit_update_coloradj()
105 to_malidp_crtc_state(crtc->state); in malidp_atomic_commit_update_coloradj()
107 if (!old_state->ctm || (crtc->state->ctm->base.id != in malidp_atomic_commit_update_coloradj()
108 old_state->ctm->base.id)) in malidp_atomic_commit_update_coloradj()
111 mc->coloradj_coeffs[i], in malidp_atomic_commit_update_coloradj()
112 hwdev->hw->map.coeffs_base + in malidp_atomic_commit_update_coloradj()
123 struct malidp_crtc_state *cs = to_malidp_crtc_state(crtc->state); in malidp_atomic_commit_se_config()
125 struct malidp_drm *malidp = crtc_to_malidp_device(crtc); in malidp_atomic_commit_se_config() local
126 struct malidp_hw_device *hwdev = malidp->dev; in malidp_atomic_commit_se_config()
127 struct malidp_se_config *s = &cs->scaler_config; in malidp_atomic_commit_se_config()
128 struct malidp_se_config *old_s = &old_cs->scaler_config; in malidp_atomic_commit_se_config()
129 u32 se_control = hwdev->hw->map.se_base + in malidp_atomic_commit_se_config()
130 ((hwdev->hw->map.features & MALIDP_REGMAP_HAS_CLEARIRQ) ? in malidp_atomic_commit_se_config()
137 if (!s->scale_enable) { in malidp_atomic_commit_se_config()
144 hwdev->hw->se_set_scaling_coeffs(hwdev, s, old_s); in malidp_atomic_commit_se_config()
149 val |= s->enhancer_enable ? MALIDP_SE_ENH(3) : 0; in malidp_atomic_commit_se_config()
155 val = MALIDP_SE_SET_V_SIZE(s->input_h) | in malidp_atomic_commit_se_config()
156 MALIDP_SE_SET_H_SIZE(s->input_w); in malidp_atomic_commit_se_config()
158 val = MALIDP_SE_SET_V_SIZE(s->output_h) | in malidp_atomic_commit_se_config()
159 MALIDP_SE_SET_H_SIZE(s->output_w); in malidp_atomic_commit_se_config()
163 malidp_hw_write(hwdev, s->h_init_phase, scr + MALIDP_SE_H_INIT_PH); in malidp_atomic_commit_se_config()
164 malidp_hw_write(hwdev, s->h_delta_phase, scr + MALIDP_SE_H_DELTA_PH); in malidp_atomic_commit_se_config()
165 malidp_hw_write(hwdev, s->v_init_phase, scr + MALIDP_SE_V_INIT_PH); in malidp_atomic_commit_se_config()
166 malidp_hw_write(hwdev, s->v_delta_phase, scr + MALIDP_SE_V_DELTA_PH); in malidp_atomic_commit_se_config()
174 struct malidp_drm *malidp = drm_to_malidp(drm); in malidp_set_and_wait_config_valid() local
175 struct malidp_hw_device *hwdev = malidp->dev; in malidp_set_and_wait_config_valid()
178 hwdev->hw->set_config_valid(hwdev, 1); in malidp_set_and_wait_config_valid()
180 if (hwdev->hw->in_config_mode(hwdev)) { in malidp_set_and_wait_config_valid()
181 atomic_set(&malidp->config_valid, MALIDP_CONFIG_VALID_DONE); in malidp_set_and_wait_config_valid()
185 ret = wait_event_interruptible_timeout(malidp->wq, in malidp_set_and_wait_config_valid()
186 atomic_read(&malidp->config_valid) == MALIDP_CONFIG_VALID_DONE, in malidp_set_and_wait_config_valid()
189 return (ret > 0) ? 0 : -ETIMEDOUT; in malidp_set_and_wait_config_valid()
194 struct drm_device *drm = state->dev; in malidp_atomic_commit_hw_done()
195 struct malidp_drm *malidp = drm_to_malidp(drm); in malidp_atomic_commit_hw_done() local
198 malidp->event = malidp->crtc.state->event; in malidp_atomic_commit_hw_done()
199 malidp->crtc.state->event = NULL; in malidp_atomic_commit_hw_done()
201 if (malidp->crtc.state->active) { in malidp_atomic_commit_hw_done()
207 if (malidp->event) in malidp_atomic_commit_hw_done()
208 drm_crtc_vblank_get(&malidp->crtc); in malidp_atomic_commit_hw_done()
216 while (loop--) { in malidp_atomic_commit_hw_done()
223 } else if (malidp->event) { in malidp_atomic_commit_hw_done()
225 spin_lock_irq(&drm->event_lock); in malidp_atomic_commit_hw_done()
226 drm_crtc_send_vblank_event(&malidp->crtc, malidp->event); in malidp_atomic_commit_hw_done()
227 malidp->event = NULL; in malidp_atomic_commit_hw_done()
228 spin_unlock_irq(&drm->event_lock); in malidp_atomic_commit_hw_done()
235 struct drm_device *drm = state->dev; in malidp_atomic_commit_tail()
236 struct malidp_drm *malidp = drm_to_malidp(drm); in malidp_atomic_commit_tail() local
242 pm_runtime_get_sync(drm->dev); in malidp_atomic_commit_tail()
245 * set config_valid to a special value to let IRQ handlers in malidp_atomic_commit_tail()
248 atomic_set(&malidp->config_valid, MALIDP_CONFIG_START); in malidp_atomic_commit_tail()
249 malidp->dev->hw->set_config_valid(malidp->dev, 0); in malidp_atomic_commit_tail()
269 pm_runtime_put(drm->dev); in malidp_atomic_commit_tail()
282 if (malidp_format_mod_supported(dev, mode_cmd->pixel_format, in malidp_verify_afbc_framebuffer_caps()
283 mode_cmd->modifier[0]) == false) in malidp_verify_afbc_framebuffer_caps()
286 if (mode_cmd->offsets[0] != 0) { in malidp_verify_afbc_framebuffer_caps()
291 switch (mode_cmd->modifier[0] & AFBC_SIZE_MASK) { in malidp_verify_afbc_framebuffer_caps()
293 if ((mode_cmd->width % 16) || (mode_cmd->height % 16)) { in malidp_verify_afbc_framebuffer_caps()
318 switch (mode_cmd->modifier[0] & AFBC_SIZE_MASK) { in malidp_verify_afbc_framebuffer_size()
330 n_superblocks = (mode_cmd->width / afbc_superblock_width) * in malidp_verify_afbc_framebuffer_size()
331 (mode_cmd->height / afbc_superblock_height); in malidp_verify_afbc_framebuffer_size()
333 bpp = malidp_format_get_bpp(info->format); in malidp_verify_afbc_framebuffer_size()
341 if ((mode_cmd->width * bpp) != (mode_cmd->pitches[0] * BITS_PER_BYTE)) { in malidp_verify_afbc_framebuffer_size()
342 DRM_DEBUG_KMS("Invalid value of (pitch * BITS_PER_BYTE) (=%u) " in malidp_verify_afbc_framebuffer_size()
344 (mode_cmd->pitches[0] * BITS_PER_BYTE), in malidp_verify_afbc_framebuffer_size()
345 mode_cmd->width, bpp); in malidp_verify_afbc_framebuffer_size()
349 objs = drm_gem_object_lookup(file, mode_cmd->handles[0]); in malidp_verify_afbc_framebuffer_size()
355 if (objs->size < afbc_size) { in malidp_verify_afbc_framebuffer_size()
357 objs->size, afbc_size); in malidp_verify_afbc_framebuffer_size()
381 if (mode_cmd->modifier[0]) { in malidp_fb_create()
383 return ERR_PTR(-EINVAL); in malidp_fb_create()
398 struct malidp_drm *malidp = drm_to_malidp(drm); in malidp_init() local
399 struct malidp_hw_device *hwdev = malidp->dev; in malidp_init()
405 drm->mode_config.min_width = hwdev->min_line_size; in malidp_init()
406 drm->mode_config.min_height = hwdev->min_line_size; in malidp_init()
407 drm->mode_config.max_width = hwdev->max_line_size; in malidp_init()
408 drm->mode_config.max_height = hwdev->max_line_size; in malidp_init()
409 drm->mode_config.funcs = &malidp_mode_config_funcs; in malidp_init()
410 drm->mode_config.helper_private = &malidp_mode_config_helpers; in malidp_init()
427 struct drm_device *drm = dev_get_drvdata(&pdev->dev); in malidp_irq_init()
428 struct malidp_drm *malidp = drm_to_malidp(drm); in malidp_irq_init() local
429 struct malidp_hw_device *hwdev = malidp->dev; in malidp_irq_init()
462 struct malidp_drm *malidp = drm_to_malidp(drm); in malidp_dumb_create() local
464 u8 alignment = malidp_hw_get_pitch_align(malidp->dev, 1); in malidp_dumb_create()
466 args->pitch = ALIGN(DIV_ROUND_UP(args->width * args->bpp, 8), alignment); in malidp_dumb_create()
475 error_stats->num_errors = 0; in malidp_error_stats_init()
476 error_stats->last_error_status = 0; in malidp_error_stats_init()
477 error_stats->last_error_vblank = -1; in malidp_error_stats_init()
480 void malidp_error(struct malidp_drm *malidp, in malidp_error() argument
486 spin_lock_irqsave(&malidp->errors_lock, irqflags); in malidp_error()
487 error_stats->last_error_status = status; in malidp_error()
488 error_stats->last_error_vblank = vblank; in malidp_error()
489 error_stats->num_errors++; in malidp_error()
490 spin_unlock_irqrestore(&malidp->errors_lock, irqflags); in malidp_error()
507 struct drm_device *drm = m->private; in malidp_show_stats()
508 struct malidp_drm *malidp = drm_to_malidp(drm); in malidp_show_stats() local
512 spin_lock_irqsave(&malidp->errors_lock, irqflags); in malidp_show_stats()
513 de_errors = malidp->de_errors; in malidp_show_stats()
514 se_errors = malidp->se_errors; in malidp_show_stats()
515 spin_unlock_irqrestore(&malidp->errors_lock, irqflags); in malidp_show_stats()
523 return single_open(file, malidp_show_stats, inode->i_private); in malidp_debugfs_open()
529 struct seq_file *m = file->private_data; in malidp_debugfs_write()
530 struct drm_device *drm = m->private; in malidp_debugfs_write()
531 struct malidp_drm *malidp = drm_to_malidp(drm); in malidp_debugfs_write() local
534 spin_lock_irqsave(&malidp->errors_lock, irqflags); in malidp_debugfs_write()
535 malidp_error_stats_init(&malidp->de_errors); in malidp_debugfs_write()
536 malidp_error_stats_init(&malidp->se_errors); in malidp_debugfs_write()
537 spin_unlock_irqrestore(&malidp->errors_lock, irqflags); in malidp_debugfs_write()
552 struct malidp_drm *malidp = drm_to_malidp(minor->dev); in malidp_debugfs_init() local
554 malidp_error_stats_init(&malidp->de_errors); in malidp_debugfs_init()
555 malidp_error_stats_init(&malidp->se_errors); in malidp_debugfs_init()
556 spin_lock_init(&malidp->errors_lock); in malidp_debugfs_init()
557 debugfs_create_file("debug", S_IRUGO | S_IWUSR, minor->debugfs_root, in malidp_debugfs_init()
558 minor->dev, &malidp_debugfs_fops); in malidp_debugfs_init()
571 .name = "mali-dp",
580 .compatible = "arm,mali-dp500",
584 .compatible = "arm,mali-dp550",
588 .compatible = "arm,mali-dp650",
599 const char *compatstr_dp500 = "arm,mali-dp500"; in malidp_is_compatible_hw_id()
611 dt_is_dp500 = strnstr(dev_id->compatible, compatstr_dp500, in malidp_is_compatible_hw_id()
612 sizeof(dev_id->compatible)) != NULL; in malidp_is_compatible_hw_id()
614 DRM_ERROR("Device-tree expects %s, but hardware %s DP500.\n", in malidp_is_compatible_hw_id()
615 dev_id->compatible, is_dp500 ? "is" : "is not"); in malidp_is_compatible_hw_id()
624 snprintf(buf, sizeof(buf), "arm,mali-dp%X", product_id); in malidp_is_compatible_hw_id()
625 if (!strnstr(dev_id->compatible, buf, in malidp_is_compatible_hw_id()
626 sizeof(dev_id->compatible))) { in malidp_is_compatible_hw_id()
627 DRM_ERROR("Device-tree expects %s, but hardware is DP%03X.\n", in malidp_is_compatible_hw_id()
628 dev_id->compatible, product_id); in malidp_is_compatible_hw_id()
639 const char *compatstr_dp500 = "arm,mali-dp500"; in malidp_has_sufficient_address_space()
641 if (!strnstr(dev_id->compatible, compatstr_dp500, in malidp_has_sufficient_address_space()
642 sizeof(dev_id->compatible))) in malidp_has_sufficient_address_space()
653 struct malidp_drm *malidp = drm_to_malidp(drm); in core_id_show() local
655 return sysfs_emit(buf, "%08x\n", malidp->core_id); in core_id_show()
671 struct malidp_drm *malidp = drm_to_malidp(drm); in malidp_runtime_pm_suspend() local
672 struct malidp_hw_device *hwdev = malidp->dev; in malidp_runtime_pm_suspend()
675 WARN_ON(!hwdev->hw->in_config_mode(hwdev)); in malidp_runtime_pm_suspend()
679 hwdev->pm_suspended = true; in malidp_runtime_pm_suspend()
680 clk_disable_unprepare(hwdev->mclk); in malidp_runtime_pm_suspend()
681 clk_disable_unprepare(hwdev->aclk); in malidp_runtime_pm_suspend()
682 clk_disable_unprepare(hwdev->pclk); in malidp_runtime_pm_suspend()
690 struct malidp_drm *malidp = drm_to_malidp(drm); in malidp_runtime_pm_resume() local
691 struct malidp_hw_device *hwdev = malidp->dev; in malidp_runtime_pm_resume()
693 clk_prepare_enable(hwdev->pclk); in malidp_runtime_pm_resume()
694 clk_prepare_enable(hwdev->aclk); in malidp_runtime_pm_resume()
695 clk_prepare_enable(hwdev->mclk); in malidp_runtime_pm_resume()
696 hwdev->pm_suspended = false; in malidp_runtime_pm_resume()
707 struct malidp_drm *malidp; in malidp_bind() local
717 malidp = devm_drm_dev_alloc(dev, &malidp_driver, typeof(*malidp), base); in malidp_bind()
718 if (IS_ERR(malidp)) in malidp_bind()
719 return PTR_ERR(malidp); in malidp_bind()
721 drm = &malidp->base; in malidp_bind()
725 return -ENOMEM; in malidp_bind()
727 hwdev->hw = (struct malidp_hw *)of_device_get_match_data(dev); in malidp_bind()
728 malidp->dev = hwdev; in malidp_bind()
730 hwdev->regs = devm_platform_get_and_ioremap_resource(pdev, 0, &res); in malidp_bind()
731 if (IS_ERR(hwdev->regs)) in malidp_bind()
732 return PTR_ERR(hwdev->regs); in malidp_bind()
734 hwdev->pclk = devm_clk_get(dev, "pclk"); in malidp_bind()
735 if (IS_ERR(hwdev->pclk)) in malidp_bind()
736 return PTR_ERR(hwdev->pclk); in malidp_bind()
738 hwdev->aclk = devm_clk_get(dev, "aclk"); in malidp_bind()
739 if (IS_ERR(hwdev->aclk)) in malidp_bind()
740 return PTR_ERR(hwdev->aclk); in malidp_bind()
742 hwdev->mclk = devm_clk_get(dev, "mclk"); in malidp_bind()
743 if (IS_ERR(hwdev->mclk)) in malidp_bind()
744 return PTR_ERR(hwdev->mclk); in malidp_bind()
746 hwdev->pxlclk = devm_clk_get(dev, "pxlclk"); in malidp_bind()
747 if (IS_ERR(hwdev->pxlclk)) in malidp_bind()
748 return PTR_ERR(hwdev->pxlclk); in malidp_bind()
752 if (ret && ret != -ENODEV) in malidp_bind()
768 ret = -EINVAL; in malidp_bind()
773 DRM_ERROR("Insufficient address space in device-tree.\n"); in malidp_bind()
774 ret = -EINVAL; in malidp_bind()
779 ret = -EINVAL; in malidp_bind()
783 ret = hwdev->hw->query_hw(hwdev); in malidp_bind()
789 version = malidp_hw_read(hwdev, hwdev->hw->map.dc_base + MALIDP_DE_CORE_ID); in malidp_bind()
790 DRM_INFO("found ARM Mali-DP%3x version r%dp%d\n", version >> 16, in malidp_bind()
793 malidp->core_id = version; in malidp_bind()
795 ret = of_property_read_u32(dev->of_node, in malidp_bind()
796 "arm,malidp-arqos-value", in malidp_bind()
797 &hwdev->arqos_value); in malidp_bind()
799 hwdev->arqos_value = 0x0; in malidp_bind()
802 ret = of_property_read_u8_array(dev->of_node, in malidp_bind()
803 "arm,malidp-output-port-lines", in malidp_bind()
810 malidp_hw_write(hwdev, out_depth, hwdev->hw->map.out_depth_base); in malidp_bind()
811 hwdev->output_color_depth = out_depth; in malidp_bind()
813 atomic_set(&malidp->config_valid, MALIDP_CONFIG_VALID_INIT); in malidp_bind()
814 init_waitqueue_head(&malidp->wq); in malidp_bind()
821 malidp->crtc.port = of_graph_get_port_by_id(dev->of_node, 0); in malidp_bind()
832 WARN_ON(drm->mode_config.num_encoder > 2); in malidp_bind()
833 list_for_each_entry(encoder, &drm->mode_config.encoder_list, head) { in malidp_bind()
834 encoder->possible_clones = in malidp_bind()
835 (1 << drm->mode_config.num_encoder) - 1; in malidp_bind()
842 ret = drm_vblank_init(drm, drm->mode_config.num_crtc); in malidp_bind()
871 of_node_put(malidp->crtc.port); in malidp_bind()
872 malidp->crtc.port = NULL; in malidp_bind()
888 struct malidp_drm *malidp = drm_to_malidp(drm); in malidp_unbind() local
889 struct malidp_hw_device *hwdev = malidp->dev; in malidp_unbind()
898 of_node_put(malidp->crtc.port); in malidp_unbind()
899 malidp->crtc.port = NULL; in malidp_unbind()
918 return dev->of_node == np; in malidp_compare_dev()
926 if (!pdev->dev.of_node) in malidp_platform_probe()
927 return -ENODEV; in malidp_platform_probe()
930 port = of_graph_get_remote_node(pdev->dev.of_node, 0, 0); in malidp_platform_probe()
932 return -ENODEV; in malidp_platform_probe()
934 drm_of_component_match_add(&pdev->dev, &match, malidp_compare_dev, in malidp_platform_probe()
937 return component_master_add_with_match(&pdev->dev, &malidp_master_ops, in malidp_platform_probe()
943 component_master_del(&pdev->dev, &malidp_master_ops); in malidp_platform_remove()
994 .name = "mali-dp",