Lines Matching +full:panel +full:- +full:timing
1 // SPDX-License-Identifier: GPL-2.0
59 struct awg_timing *timing);
81 * @panel_node: panel node reference from device tree
82 * @panel: reference to the panel connected to the dvo
96 struct drm_panel *panel; member
115 struct drm_display_mode *mode = &dvo->mode; in dvo_awg_generate_code()
116 struct dvo_config *config = dvo->config; in dvo_awg_generate_code()
118 struct awg_timing timing; in dvo_awg_generate_code() local
123 timing.total_lines = mode->vtotal; in dvo_awg_generate_code()
124 timing.active_lines = mode->vdisplay; in dvo_awg_generate_code()
125 timing.blanking_lines = mode->vsync_start - mode->vdisplay; in dvo_awg_generate_code()
126 timing.trailing_lines = mode->vtotal - mode->vsync_start; in dvo_awg_generate_code()
127 timing.total_pixels = mode->htotal; in dvo_awg_generate_code()
128 timing.active_pixels = mode->hdisplay; in dvo_awg_generate_code()
129 timing.blanking_pixels = mode->hsync_start - mode->hdisplay; in dvo_awg_generate_code()
130 timing.trailing_pixels = mode->htotal - mode->hsync_start; in dvo_awg_generate_code()
131 timing.blanking_level = BLANKING_LEVEL; in dvo_awg_generate_code()
133 if (config->awg_fwgen_fct(&fw_gen_params, &timing)) { in dvo_awg_generate_code()
135 return -EINVAL; in dvo_awg_generate_code()
157 dvo->regs + DVO_DIGSYNC_INSTR_I + i * 4); in dvo_awg_configure()
159 writel(0, dvo->regs + DVO_DIGSYNC_INSTR_I + i * 4); in dvo_awg_configure()
161 writel(DVO_AWG_CTRL_EN, dvo->regs + DVO_AWG_DIGSYNC_CTRL); in dvo_awg_configure()
164 #define DBGFS_DUMP(reg) seq_printf(s, "\n %-25s 0x%08X", #reg, \
165 readl(dvo->regs + reg))
182 struct drm_info_node *node = s->private; in dvo_dbg_show()
183 struct sti_dvo *dvo = (struct sti_dvo *)node->info_ent->data; in dvo_dbg_show()
185 seq_printf(s, "DVO: (vaddr = 0x%p)", dvo->regs); in dvo_dbg_show()
191 dvo_dbg_awg_microcode(s, dvo->regs + DVO_DIGSYNC_INSTR_I); in dvo_dbg_show()
209 minor->debugfs_root, minor); in dvo_debugfs_init()
214 struct sti_dvo *dvo = bridge->driver_private; in sti_dvo_disable()
216 if (!dvo->enabled) in sti_dvo_disable()
221 if (dvo->config->awg_fwgen_fct) in sti_dvo_disable()
222 writel(0x00000000, dvo->regs + DVO_AWG_DIGSYNC_CTRL); in sti_dvo_disable()
224 writel(0x00000000, dvo->regs + DVO_DOF_CFG); in sti_dvo_disable()
226 drm_panel_disable(dvo->panel); in sti_dvo_disable()
229 clk_disable_unprepare(dvo->clk_pix); in sti_dvo_disable()
230 clk_disable_unprepare(dvo->clk); in sti_dvo_disable()
232 dvo->enabled = false; in sti_dvo_disable()
237 struct sti_dvo *dvo = bridge->driver_private; in sti_dvo_pre_enable()
238 struct dvo_config *config = dvo->config; in sti_dvo_pre_enable()
243 if (dvo->enabled) in sti_dvo_pre_enable()
247 writel(0x00000000, dvo->regs + DVO_DOF_CFG); in sti_dvo_pre_enable()
248 writel(0x00000000, dvo->regs + DVO_AWG_DIGSYNC_CTRL); in sti_dvo_pre_enable()
250 if (config->awg_fwgen_fct) { in sti_dvo_pre_enable()
261 if (clk_prepare_enable(dvo->clk_pix)) in sti_dvo_pre_enable()
263 if (clk_prepare_enable(dvo->clk)) in sti_dvo_pre_enable()
266 drm_panel_enable(dvo->panel); in sti_dvo_pre_enable()
269 writel(config->lowbyte, dvo->regs + DVO_LUT_PROG_LOW); in sti_dvo_pre_enable()
270 writel(config->midbyte, dvo->regs + DVO_LUT_PROG_MID); in sti_dvo_pre_enable()
271 writel(config->highbyte, dvo->regs + DVO_LUT_PROG_HIGH); in sti_dvo_pre_enable()
274 val = (config->flags | DVO_DOF_EN); in sti_dvo_pre_enable()
275 writel(val, dvo->regs + DVO_DOF_CFG); in sti_dvo_pre_enable()
277 dvo->enabled = true; in sti_dvo_pre_enable()
284 struct sti_dvo *dvo = bridge->driver_private; in sti_dvo_set_mode()
285 struct sti_mixer *mixer = to_sti_mixer(dvo->encoder->crtc); in sti_dvo_set_mode()
286 int rate = mode->clock * 1000; in sti_dvo_set_mode()
292 drm_mode_copy(&dvo->mode, mode); in sti_dvo_set_mode()
296 if (mixer->id == STI_MIXER_MAIN) in sti_dvo_set_mode()
297 clkp = dvo->clk_main_parent; in sti_dvo_set_mode()
299 clkp = dvo->clk_aux_parent; in sti_dvo_set_mode()
302 clk_set_parent(dvo->clk_pix, clkp); in sti_dvo_set_mode()
303 clk_set_parent(dvo->clk, clkp); in sti_dvo_set_mode()
307 ret = clk_set_rate(dvo->clk_pix, rate); in sti_dvo_set_mode()
313 ret = clk_set_rate(dvo->clk, rate); in sti_dvo_set_mode()
320 dvo->config = &rgb_24bit_de_cfg; in sti_dvo_set_mode()
340 struct sti_dvo *dvo = dvo_connector->dvo; in sti_dvo_connector_get_modes()
342 if (dvo->panel) in sti_dvo_connector_get_modes()
343 return drm_panel_get_modes(dvo->panel, connector); in sti_dvo_connector_get_modes()
354 int target = mode->clock * 1000; in sti_dvo_connector_mode_valid()
355 int target_min = target - CLK_TOLERANCE_HZ; in sti_dvo_connector_mode_valid()
360 struct sti_dvo *dvo = dvo_connector->dvo; in sti_dvo_connector_mode_valid()
362 result = clk_round_rate(dvo->clk_pix, target); in sti_dvo_connector_mode_valid()
386 struct sti_dvo *dvo = dvo_connector->dvo; in sti_dvo_connector_detect()
390 if (!dvo->panel) { in sti_dvo_connector_detect()
391 dvo->panel = of_drm_find_panel(dvo->panel_node); in sti_dvo_connector_detect()
392 if (IS_ERR(dvo->panel)) in sti_dvo_connector_detect()
393 dvo->panel = NULL; in sti_dvo_connector_detect()
396 if (dvo->panel) in sti_dvo_connector_detect()
406 struct sti_dvo *dvo = dvo_connector->dvo; in sti_dvo_late_register()
408 dvo_debugfs_init(dvo, dvo->drm_dev->primary); in sti_dvo_late_register()
427 list_for_each_entry(encoder, &dev->mode_config.encoder_list, head) { in sti_dvo_find_encoder()
428 if (encoder->encoder_type == DRM_MODE_ENCODER_LVDS) in sti_dvo_find_encoder()
446 dvo->drm_dev = drm_dev; in sti_dvo_bind()
450 return -ENOMEM; in sti_dvo_bind()
454 return -ENOMEM; in sti_dvo_bind()
456 connector->dvo = dvo; in sti_dvo_bind()
460 return -ENOMEM; in sti_dvo_bind()
462 bridge->driver_private = dvo; in sti_dvo_bind()
463 bridge->funcs = &sti_dvo_bridge_funcs; in sti_dvo_bind()
464 bridge->of_node = dvo->dev.of_node; in sti_dvo_bind()
471 dvo->bridge = bridge; in sti_dvo_bind()
472 connector->encoder = encoder; in sti_dvo_bind()
473 dvo->encoder = encoder; in sti_dvo_bind()
477 drm_connector->polled = DRM_CONNECTOR_POLL_HPD; in sti_dvo_bind()
494 return -EINVAL; in sti_dvo_bind()
502 drm_bridge_remove(dvo->bridge); in sti_dvo_unbind()
512 struct device *dev = &pdev->dev; in sti_dvo_probe()
515 struct device_node *np = dev->of_node; in sti_dvo_probe()
522 return -ENOMEM; in sti_dvo_probe()
525 dvo->dev = pdev->dev; in sti_dvo_probe()
527 res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "dvo-reg"); in sti_dvo_probe()
530 return -ENOMEM; in sti_dvo_probe()
532 dvo->regs = devm_ioremap(dev, res->start, in sti_dvo_probe()
534 if (!dvo->regs) in sti_dvo_probe()
535 return -ENOMEM; in sti_dvo_probe()
537 dvo->clk_pix = devm_clk_get(dev, "dvo_pix"); in sti_dvo_probe()
538 if (IS_ERR(dvo->clk_pix)) { in sti_dvo_probe()
540 return PTR_ERR(dvo->clk_pix); in sti_dvo_probe()
543 dvo->clk = devm_clk_get(dev, "dvo"); in sti_dvo_probe()
544 if (IS_ERR(dvo->clk)) { in sti_dvo_probe()
546 return PTR_ERR(dvo->clk); in sti_dvo_probe()
549 dvo->clk_main_parent = devm_clk_get(dev, "main_parent"); in sti_dvo_probe()
550 if (IS_ERR(dvo->clk_main_parent)) { in sti_dvo_probe()
552 dvo->clk_main_parent = NULL; in sti_dvo_probe()
555 dvo->clk_aux_parent = devm_clk_get(dev, "aux_parent"); in sti_dvo_probe()
556 if (IS_ERR(dvo->clk_aux_parent)) { in sti_dvo_probe()
558 dvo->clk_aux_parent = NULL; in sti_dvo_probe()
561 dvo->panel_node = of_parse_phandle(np, "sti,panel", 0); in sti_dvo_probe()
562 if (!dvo->panel_node) in sti_dvo_probe()
563 DRM_ERROR("No panel associated to the dvo output\n"); in sti_dvo_probe()
564 of_node_put(dvo->panel_node); in sti_dvo_probe()
568 return component_add(&pdev->dev, &sti_dvo_ops); in sti_dvo_probe()
573 component_del(&pdev->dev, &sti_dvo_ops); in sti_dvo_remove()
577 { .compatible = "st,stih407-dvo", },
584 .name = "sti-dvo",