Lines Matching +full:pll +full:- +full:out

1 // SPDX-License-Identifier: GPL-2.0-only
37 struct dss_pll *pll; member
55 /* only used in non-DT mode */
64 * XXX we can't currently use DSI PLL for DPI with OMAP3, as the DSI PLL in dpi_get_pll()
66 * disabled, DISPC clock will be disabled, and TV out will stop. in dpi_get_pll()
132 struct dss_pll *pll; member
155 if (ctx->pck_min >= 100000000) { in dpi_calc_dispc_cb()
163 ctx->dispc_cinfo.lck_div = lckd; in dpi_calc_dispc_cb()
164 ctx->dispc_cinfo.pck_div = pckd; in dpi_calc_dispc_cb()
165 ctx->dispc_cinfo.lck = lck; in dpi_calc_dispc_cb()
166 ctx->dispc_cinfo.pck = pck; in dpi_calc_dispc_cb()
182 if (m_dispc > 1 && m_dispc % 2 != 0 && ctx->pck_min >= 100000000) in dpi_calc_hsdiv_cb()
185 ctx->dsi_cinfo.mX[HSDIV_DISPC] = m_dispc; in dpi_calc_hsdiv_cb()
186 ctx->dsi_cinfo.clkout[HSDIV_DISPC] = dispc; in dpi_calc_hsdiv_cb()
188 return dispc_div_calc(dispc, ctx->pck_min, ctx->pck_max, in dpi_calc_hsdiv_cb()
199 ctx->dsi_cinfo.n = n; in dpi_calc_pll_cb()
200 ctx->dsi_cinfo.m = m; in dpi_calc_pll_cb()
201 ctx->dsi_cinfo.fint = fint; in dpi_calc_pll_cb()
202 ctx->dsi_cinfo.clkdco = clkdco; in dpi_calc_pll_cb()
204 return dss_pll_hsdiv_calc(ctx->pll, clkdco, in dpi_calc_pll_cb()
205 ctx->pck_min, dss_feat_get_param_max(FEAT_PARAM_DSS_FCK), in dpi_calc_pll_cb()
213 ctx->fck = fck; in dpi_calc_dss_cb()
215 return dispc_div_calc(fck, ctx->pck_min, ctx->pck_max, in dpi_calc_dss_cb()
226 ctx->pll = dpi->pll; in dpi_dsi_clk_calc()
227 ctx->pck_min = pck - 1000; in dpi_dsi_clk_calc()
228 ctx->pck_max = pck + 1000; in dpi_dsi_clk_calc()
233 clkin = clk_get_rate(ctx->pll->clkin); in dpi_dsi_clk_calc()
235 return dss_pll_calc(ctx->pll, clkin, in dpi_dsi_clk_calc()
248 * +/- ~15MHz. in dpi_dss_clk_calc()
256 ctx->pck_min = max(pck - 1000 * i * i * i, 0lu); in dpi_dss_clk_calc()
258 ctx->pck_min = 0; in dpi_dss_clk_calc()
259 ctx->pck_max = pck + 1000 * i * i * i; in dpi_dss_clk_calc()
261 ok = dss_div_calc(pck, ctx->pck_min, dpi_calc_dss_cb, ctx); in dpi_dss_clk_calc()
281 return -EINVAL; in dpi_set_dsi_clk()
283 r = dss_pll_set_config(dpi->pll, &ctx.dsi_cinfo); in dpi_set_dsi_clk()
290 dpi->mgr_config.clock_info = ctx.dispc_cinfo; in dpi_set_dsi_clk()
308 return -EINVAL; in dpi_set_dispc_clk()
314 dpi->mgr_config.clock_info = ctx.dispc_cinfo; in dpi_set_dispc_clk()
325 struct omap_dss_device *out = &dpi->output; in dpi_set_mode() local
326 struct omap_overlay_manager *mgr = out->manager; in dpi_set_mode()
327 struct omap_video_timings *t = &dpi->timings; in dpi_set_mode()
333 if (dpi->pll) in dpi_set_mode()
334 r = dpi_set_dsi_clk(dpi, mgr->id, t->pixelclock, &fck, in dpi_set_mode()
337 r = dpi_set_dispc_clk(dpi, t->pixelclock, &fck, in dpi_set_mode()
344 if (pck != t->pixelclock) { in dpi_set_mode()
346 t->pixelclock, pck); in dpi_set_mode()
348 t->pixelclock = pck; in dpi_set_mode()
358 struct omap_dss_device *out = &dpi->output; in dpi_config_lcd_manager() local
359 struct omap_overlay_manager *mgr = out->manager; in dpi_config_lcd_manager()
361 dpi->mgr_config.io_pad_mode = DSS_IO_PAD_MODE_BYPASS; in dpi_config_lcd_manager()
363 dpi->mgr_config.stallmode = false; in dpi_config_lcd_manager()
364 dpi->mgr_config.fifohandcheck = false; in dpi_config_lcd_manager()
366 dpi->mgr_config.video_port_width = dpi->data_lines; in dpi_config_lcd_manager()
368 dpi->mgr_config.lcden_sig_polarity = 0; in dpi_config_lcd_manager()
370 dss_mgr_set_lcd_config(mgr, &dpi->mgr_config); in dpi_config_lcd_manager()
376 struct omap_dss_device *out = &dpi->output; in dpi_display_enable() local
379 mutex_lock(&dpi->lock); in dpi_display_enable()
381 if (dss_has_feature(FEAT_DPI_USES_VDDS_DSI) && !dpi->vdds_dsi_reg) { in dpi_display_enable()
383 r = -ENODEV; in dpi_display_enable()
387 if (out->manager == NULL) { in dpi_display_enable()
389 r = -ENODEV; in dpi_display_enable()
394 r = regulator_enable(dpi->vdds_dsi_reg); in dpi_display_enable()
403 r = dss_dpi_select_source(out->port_num, out->manager->id); in dpi_display_enable()
407 if (dpi->pll) { in dpi_display_enable()
408 r = dss_pll_enable(dpi->pll); in dpi_display_enable()
421 r = dss_mgr_enable(out->manager); in dpi_display_enable()
425 mutex_unlock(&dpi->lock); in dpi_display_enable()
431 if (dpi->pll) in dpi_display_enable()
432 dss_pll_disable(dpi->pll); in dpi_display_enable()
438 regulator_disable(dpi->vdds_dsi_reg); in dpi_display_enable()
442 mutex_unlock(&dpi->lock); in dpi_display_enable()
449 struct omap_overlay_manager *mgr = dpi->output.manager; in dpi_display_disable()
451 mutex_lock(&dpi->lock); in dpi_display_disable()
455 if (dpi->pll) { in dpi_display_disable()
456 dss_select_lcd_clk_source(mgr->id, OMAP_DSS_CLK_SRC_FCK); in dpi_display_disable()
457 dss_pll_disable(dpi->pll); in dpi_display_disable()
463 regulator_disable(dpi->vdds_dsi_reg); in dpi_display_disable()
465 mutex_unlock(&dpi->lock); in dpi_display_disable()
475 mutex_lock(&dpi->lock); in dpi_set_timings()
477 dpi->timings = *timings; in dpi_set_timings()
479 mutex_unlock(&dpi->lock); in dpi_set_timings()
487 mutex_lock(&dpi->lock); in dpi_get_timings()
489 *timings = dpi->timings; in dpi_get_timings()
491 mutex_unlock(&dpi->lock); in dpi_get_timings()
498 struct omap_overlay_manager *mgr = dpi->output.manager; in dpi_check_timings()
505 if (mgr && !dispc_mgr_timings_ok(mgr->id, timings)) in dpi_check_timings()
506 return -EINVAL; in dpi_check_timings()
508 if (timings->pixelclock == 0) in dpi_check_timings()
509 return -EINVAL; in dpi_check_timings()
511 if (dpi->pll) { in dpi_check_timings()
512 ok = dpi_dsi_clk_calc(dpi, timings->pixelclock, &ctx); in dpi_check_timings()
514 return -EINVAL; in dpi_check_timings()
518 ok = dpi_dss_clk_calc(timings->pixelclock, &ctx); in dpi_check_timings()
520 return -EINVAL; in dpi_check_timings()
530 timings->pixelclock = pck; in dpi_check_timings()
539 mutex_lock(&dpi->lock); in dpi_set_data_lines()
541 dpi->data_lines = data_lines; in dpi_set_data_lines()
543 mutex_unlock(&dpi->lock); in dpi_set_data_lines()
546 static int dpi_verify_dsi_pll(struct dss_pll *pll) in dpi_verify_dsi_pll() argument
550 /* do initial setup with the PLL to see if it is operational */ in dpi_verify_dsi_pll()
552 r = dss_pll_enable(pll); in dpi_verify_dsi_pll()
556 dss_pll_disable(pll); in dpi_verify_dsi_pll()
568 if (dpi->vdds_dsi_reg) in dpi_init_regulator()
571 vdds_dsi = devm_regulator_get(&dpi->pdev->dev, "vdds_dsi"); in dpi_init_regulator()
573 if (PTR_ERR(vdds_dsi) != -EPROBE_DEFER) in dpi_init_regulator()
578 dpi->vdds_dsi_reg = vdds_dsi; in dpi_init_regulator()
585 struct dss_pll *pll; in dpi_init_pll() local
587 if (dpi->pll) in dpi_init_pll()
590 pll = dpi_get_pll(dpi->output.dispc_channel); in dpi_init_pll()
591 if (!pll) in dpi_init_pll()
594 /* On DRA7 we need to set a mux to use the PLL */ in dpi_init_pll()
596 dss_ctrl_pll_set_control_mux(pll->id, dpi->output.dispc_channel); in dpi_init_pll()
598 if (dpi_verify_dsi_pll(pll)) { in dpi_init_pll()
599 DSSWARN("DSI PLL not operational\n"); in dpi_init_pll()
603 dpi->pll = pll; in dpi_init_pll()
661 mgr = omap_dss_get_overlay_manager(dssdev->dispc_channel); in dpi_connect()
663 return -ENODEV; in dpi_connect()
672 dst->name); in dpi_connect()
683 WARN_ON(dst != dssdev->dst); in dpi_disconnect()
685 if (dst != dssdev->dst) in dpi_disconnect()
690 if (dssdev->manager) in dpi_disconnect()
691 dss_mgr_disconnect(dssdev->manager, dssdev); in dpi_disconnect()
711 struct omap_dss_device *out = &dpi->output; in dpi_init_output() local
713 out->dev = &pdev->dev; in dpi_init_output()
714 out->id = OMAP_DSS_OUTPUT_DPI; in dpi_init_output()
715 out->output_type = OMAP_DISPLAY_TYPE_DPI; in dpi_init_output()
716 out->name = "dpi.0"; in dpi_init_output()
717 out->dispc_channel = dpi_get_channel(0); in dpi_init_output()
718 out->ops.dpi = &dpi_ops; in dpi_init_output()
719 out->owner = THIS_MODULE; in dpi_init_output()
721 omapdss_register_output(out); in dpi_init_output()
727 struct omap_dss_device *out = &dpi->output; in dpi_uninit_output() local
729 omapdss_unregister_output(out); in dpi_uninit_output()
735 struct dpi_data *dpi = port->data; in dpi_init_output_port()
736 struct omap_dss_device *out = &dpi->output; in dpi_init_output_port() local
746 out->name = "dpi.2"; in dpi_init_output_port()
749 out->name = "dpi.1"; in dpi_init_output_port()
753 out->name = "dpi.0"; in dpi_init_output_port()
757 out->dev = &pdev->dev; in dpi_init_output_port()
758 out->id = OMAP_DSS_OUTPUT_DPI; in dpi_init_output_port()
759 out->output_type = OMAP_DISPLAY_TYPE_DPI; in dpi_init_output_port()
760 out->dispc_channel = dpi_get_channel(port_num); in dpi_init_output_port()
761 out->port_num = port_num; in dpi_init_output_port()
762 out->ops.dpi = &dpi_ops; in dpi_init_output_port()
763 out->owner = THIS_MODULE; in dpi_init_output_port()
765 omapdss_register_output(out); in dpi_init_output_port()
770 struct dpi_data *dpi = port->data; in dpi_uninit_output_port()
771 struct omap_dss_device *out = &dpi->output; in dpi_uninit_output_port() local
773 omapdss_unregister_output(out); in dpi_uninit_output_port()
781 dpi = devm_kzalloc(&pdev->dev, sizeof(*dpi), GFP_KERNEL); in dpi_bind()
783 return -ENOMEM; in dpi_bind()
785 dpi->pdev = pdev; in dpi_bind()
789 mutex_init(&dpi->lock); in dpi_bind()
810 return component_add(&pdev->dev, &dpi_component_ops); in dpi_probe()
815 component_del(&pdev->dev, &dpi_component_ops); in dpi_remove()
844 dpi = devm_kzalloc(&pdev->dev, sizeof(*dpi), GFP_KERNEL); in dpi_init_port()
846 return -ENOMEM; in dpi_init_port()
852 r = of_property_read_u32(ep, "data-lines", &datalines); in dpi_init_port()
858 dpi->data_lines = datalines; in dpi_init_port()
862 dpi->pdev = pdev; in dpi_init_port()
863 port->data = dpi; in dpi_init_port()
865 mutex_init(&dpi->lock); in dpi_init_port()
869 dpi->port_initialized = true; in dpi_init_port()
881 struct dpi_data *dpi = port->data; in dpi_uninit_port()
883 if (!dpi->port_initialized) in dpi_uninit_port()