Lines Matching refs:dvo
106 struct sti_dvo *dvo; member
113 static int dvo_awg_generate_code(struct sti_dvo *dvo, u8 *ram_size, u32 *ram_code) in dvo_awg_generate_code() argument
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()
149 static void dvo_awg_configure(struct sti_dvo *dvo, u32 *awg_ram_code, int nb) in dvo_awg_configure() argument
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()
165 readl(dvo->regs + reg))
183 struct sti_dvo *dvo = (struct sti_dvo *)node->info_ent->data; in dvo_dbg_show() local
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()
200 static void dvo_debugfs_init(struct sti_dvo *dvo, struct drm_minor *minor) in dvo_debugfs_init() argument
205 dvo_debugfs_files[i].data = dvo; in dvo_debugfs_init()
214 struct sti_dvo *dvo = bridge->driver_private; in sti_dvo_disable() local
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() local
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()
254 if (!dvo_awg_generate_code(dvo, &nb_instr, awg_ram_code)) in sti_dvo_pre_enable()
255 dvo_awg_configure(dvo, awg_ram_code, nb_instr); 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()
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() local
285 struct sti_mixer *mixer = to_sti_mixer(dvo->encoder->crtc); in sti_dvo_set_mode()
292 drm_mode_copy(&dvo->mode, mode); 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() local
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()
360 struct sti_dvo *dvo = dvo_connector->dvo; in sti_dvo_connector_mode_valid() local
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() local
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() local
408 dvo_debugfs_init(dvo, dvo->drm_dev->primary); in sti_dvo_late_register()
437 struct sti_dvo *dvo = dev_get_drvdata(dev); in sti_dvo_bind() local
446 dvo->drm_dev = drm_dev; in sti_dvo_bind()
456 connector->dvo = dvo; in sti_dvo_bind()
462 bridge->driver_private = dvo; in sti_dvo_bind()
464 bridge->of_node = dvo->dev.of_node; in sti_dvo_bind()
471 dvo->bridge = bridge; in sti_dvo_bind()
473 dvo->encoder = encoder; in sti_dvo_bind()
500 struct sti_dvo *dvo = dev_get_drvdata(dev); in sti_dvo_unbind() local
502 drm_bridge_remove(dvo->bridge); in sti_dvo_unbind()
513 struct sti_dvo *dvo; in sti_dvo_probe() local
519 dvo = devm_kzalloc(dev, sizeof(*dvo), GFP_KERNEL); in sti_dvo_probe()
520 if (!dvo) { in sti_dvo_probe()
525 dvo->dev = pdev->dev; in sti_dvo_probe()
532 dvo->regs = devm_ioremap(dev, res->start, in sti_dvo_probe()
534 if (!dvo->regs) 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()
564 of_node_put(dvo->panel_node); in sti_dvo_probe()
566 platform_set_drvdata(pdev, dvo); in sti_dvo_probe()