Lines Matching +full:hdmi +full:- +full:bridge

1 // SPDX-License-Identifier: GPL-2.0+
30 struct drm_bridge bridge; member
37 to_imx8mp_hdmi_pvi(struct drm_bridge *bridge) in to_imx8mp_hdmi_pvi() argument
39 return container_of(bridge, struct imx8mp_hdmi_pvi, bridge); in to_imx8mp_hdmi_pvi()
42 static int imx8mp_hdmi_pvi_bridge_attach(struct drm_bridge *bridge, in imx8mp_hdmi_pvi_bridge_attach() argument
45 struct imx8mp_hdmi_pvi *pvi = to_imx8mp_hdmi_pvi(bridge); in imx8mp_hdmi_pvi_bridge_attach()
47 return drm_bridge_attach(bridge->encoder, pvi->next_bridge, in imx8mp_hdmi_pvi_bridge_attach()
48 bridge, flags); in imx8mp_hdmi_pvi_bridge_attach()
51 static void imx8mp_hdmi_pvi_bridge_enable(struct drm_bridge *bridge, in imx8mp_hdmi_pvi_bridge_enable() argument
54 struct drm_atomic_state *state = bridge_state->base.state; in imx8mp_hdmi_pvi_bridge_enable()
55 struct imx8mp_hdmi_pvi *pvi = to_imx8mp_hdmi_pvi(bridge); in imx8mp_hdmi_pvi_bridge_enable()
62 connector = drm_atomic_get_new_connector_for_encoder(state, bridge->encoder); in imx8mp_hdmi_pvi_bridge_enable()
64 crtc_state = drm_atomic_get_new_crtc_state(state, conn_state->crtc); in imx8mp_hdmi_pvi_bridge_enable()
66 if (WARN_ON(pm_runtime_resume_and_get(pvi->dev))) in imx8mp_hdmi_pvi_bridge_enable()
69 mode = &crtc_state->adjusted_mode; in imx8mp_hdmi_pvi_bridge_enable()
73 if (mode->flags & DRM_MODE_FLAG_PVSYNC) in imx8mp_hdmi_pvi_bridge_enable()
76 if (mode->flags & DRM_MODE_FLAG_PHSYNC) in imx8mp_hdmi_pvi_bridge_enable()
79 if (pvi->next_bridge->timings) in imx8mp_hdmi_pvi_bridge_enable()
80 bus_flags = pvi->next_bridge->timings->input_bus_flags; in imx8mp_hdmi_pvi_bridge_enable()
82 bus_flags = bridge_state->input_bus_cfg.flags; in imx8mp_hdmi_pvi_bridge_enable()
87 writel(val, pvi->regs + HTX_PVI_CTRL); in imx8mp_hdmi_pvi_bridge_enable()
90 static void imx8mp_hdmi_pvi_bridge_disable(struct drm_bridge *bridge, in imx8mp_hdmi_pvi_bridge_disable() argument
93 struct imx8mp_hdmi_pvi *pvi = to_imx8mp_hdmi_pvi(bridge); in imx8mp_hdmi_pvi_bridge_disable()
95 writel(0x0, pvi->regs + HTX_PVI_CTRL); in imx8mp_hdmi_pvi_bridge_disable()
97 pm_runtime_put(pvi->dev); in imx8mp_hdmi_pvi_bridge_disable()
101 imx8mp_hdmi_pvi_bridge_get_input_bus_fmts(struct drm_bridge *bridge, in imx8mp_hdmi_pvi_bridge_get_input_bus_fmts() argument
108 struct imx8mp_hdmi_pvi *pvi = to_imx8mp_hdmi_pvi(bridge); in imx8mp_hdmi_pvi_bridge_get_input_bus_fmts()
109 struct drm_bridge *next_bridge = pvi->next_bridge; in imx8mp_hdmi_pvi_bridge_get_input_bus_fmts()
112 if (!next_bridge->funcs->atomic_get_input_bus_fmts) in imx8mp_hdmi_pvi_bridge_get_input_bus_fmts()
115 next_state = drm_atomic_get_new_bridge_state(crtc_state->state, in imx8mp_hdmi_pvi_bridge_get_input_bus_fmts()
118 return next_bridge->funcs->atomic_get_input_bus_fmts(next_bridge, in imx8mp_hdmi_pvi_bridge_get_input_bus_fmts()
141 pvi = devm_kzalloc(&pdev->dev, sizeof(*pvi), GFP_KERNEL); in imx8mp_hdmi_pvi_probe()
143 return -ENOMEM; in imx8mp_hdmi_pvi_probe()
146 pvi->dev = &pdev->dev; in imx8mp_hdmi_pvi_probe()
148 pvi->regs = devm_platform_ioremap_resource(pdev, 0); in imx8mp_hdmi_pvi_probe()
149 if (IS_ERR(pvi->regs)) in imx8mp_hdmi_pvi_probe()
150 return PTR_ERR(pvi->regs); in imx8mp_hdmi_pvi_probe()
152 /* Get the next bridge in the pipeline. */ in imx8mp_hdmi_pvi_probe()
153 remote = of_graph_get_remote_node(pdev->dev.of_node, 1, -1); in imx8mp_hdmi_pvi_probe()
155 return -EINVAL; in imx8mp_hdmi_pvi_probe()
157 pvi->next_bridge = of_drm_find_bridge(remote); in imx8mp_hdmi_pvi_probe()
160 if (!pvi->next_bridge) in imx8mp_hdmi_pvi_probe()
161 return dev_err_probe(&pdev->dev, -EPROBE_DEFER, in imx8mp_hdmi_pvi_probe()
162 "could not find next bridge\n"); in imx8mp_hdmi_pvi_probe()
164 pm_runtime_enable(&pdev->dev); in imx8mp_hdmi_pvi_probe()
166 /* Register the bridge. */ in imx8mp_hdmi_pvi_probe()
167 pvi->bridge.funcs = &imx_hdmi_pvi_bridge_funcs; in imx8mp_hdmi_pvi_probe()
168 pvi->bridge.of_node = pdev->dev.of_node; in imx8mp_hdmi_pvi_probe()
169 pvi->bridge.timings = pvi->next_bridge->timings; in imx8mp_hdmi_pvi_probe()
171 drm_bridge_add(&pvi->bridge); in imx8mp_hdmi_pvi_probe()
180 drm_bridge_remove(&pvi->bridge); in imx8mp_hdmi_pvi_remove()
182 pm_runtime_disable(&pdev->dev); in imx8mp_hdmi_pvi_remove()
187 .compatible = "fsl,imx8mp-hdmi-pvi",
198 .name = "imx-hdmi-pvi",
204 MODULE_DESCRIPTION("i.MX8MP HDMI TX Parallel Video Interface bridge driver");