Lines Matching +full:apb +full:- +full:base

1 // SPDX-License-Identifier: GPL-2.0+
11 #include <linux/media-bus-format.h>
52 #define DRIVER_NAME "imx8qxp-pixel-combiner"
73 void __iomem *base; member
78 return readl(pc->base + offset); in imx8qxp_pc_read()
84 writel(value, pc->base + offset); in imx8qxp_pc_write()
104 if (mode->hdisplay > 2560) in imx8qxp_pc_bridge_mode_valid()
113 struct imx8qxp_pc_channel *ch = bridge->driver_private; in imx8qxp_pc_bridge_attach()
114 struct imx8qxp_pc *pc = ch->pc; in imx8qxp_pc_bridge_attach()
117 DRM_DEV_ERROR(pc->dev, in imx8qxp_pc_bridge_attach()
119 return -EINVAL; in imx8qxp_pc_bridge_attach()
122 if (!bridge->encoder) { in imx8qxp_pc_bridge_attach()
123 DRM_DEV_ERROR(pc->dev, "missing encoder\n"); in imx8qxp_pc_bridge_attach()
124 return -ENODEV; in imx8qxp_pc_bridge_attach()
127 return drm_bridge_attach(bridge->encoder, in imx8qxp_pc_bridge_attach()
128 ch->next_bridge, bridge, in imx8qxp_pc_bridge_attach()
137 struct imx8qxp_pc_channel *ch = bridge->driver_private; in imx8qxp_pc_bridge_mode_set()
138 struct imx8qxp_pc *pc = ch->pc; in imx8qxp_pc_bridge_mode_set()
142 ret = pm_runtime_get_sync(pc->dev); in imx8qxp_pc_bridge_mode_set()
144 DRM_DEV_ERROR(pc->dev, in imx8qxp_pc_bridge_mode_set()
147 ret = clk_prepare_enable(pc->clk_apb); in imx8qxp_pc_bridge_mode_set()
149 DRM_DEV_ERROR(pc->dev, "%s: failed to enable apb clock: %d\n", in imx8qxp_pc_bridge_mode_set()
154 PC_DISP_HSYNC_POLARITY(ch->stream_id)); in imx8qxp_pc_bridge_mode_set()
158 PC_DISP_VSYNC_POLARITY(ch->stream_id)); in imx8qxp_pc_bridge_mode_set()
162 PC_DISP_DVALID_POLARITY(ch->stream_id)); in imx8qxp_pc_bridge_mode_set()
169 if (ch->stream_id == 0) { in imx8qxp_pc_bridge_mode_set()
179 imx8qxp_pc_write_set(pc, PC_CTRL_REG, PC_DISP_BYPASS(ch->stream_id)); in imx8qxp_pc_bridge_mode_set()
181 clk_disable_unprepare(pc->clk_apb); in imx8qxp_pc_bridge_mode_set()
188 struct imx8qxp_pc_channel *ch = bridge->driver_private; in imx8qxp_pc_bridge_atomic_disable()
189 struct imx8qxp_pc *pc = ch->pc; in imx8qxp_pc_bridge_atomic_disable()
192 ret = pm_runtime_put(pc->dev); in imx8qxp_pc_bridge_atomic_disable()
194 DRM_DEV_ERROR(pc->dev, "failed to put runtime PM: %d\n", ret); in imx8qxp_pc_bridge_atomic_disable()
279 struct device *dev = &pdev->dev; in imx8qxp_pc_bridge_probe()
280 struct device_node *np = dev->of_node; in imx8qxp_pc_bridge_probe()
287 return -ENOMEM; in imx8qxp_pc_bridge_probe()
289 pc->base = devm_platform_ioremap_resource(pdev, 0); in imx8qxp_pc_bridge_probe()
290 if (IS_ERR(pc->base)) in imx8qxp_pc_bridge_probe()
291 return PTR_ERR(pc->base); in imx8qxp_pc_bridge_probe()
293 pc->dev = dev; in imx8qxp_pc_bridge_probe()
295 pc->clk_apb = devm_clk_get(dev, "apb"); in imx8qxp_pc_bridge_probe()
296 if (IS_ERR(pc->clk_apb)) { in imx8qxp_pc_bridge_probe()
297 ret = PTR_ERR(pc->clk_apb); in imx8qxp_pc_bridge_probe()
298 if (ret != -EPROBE_DEFER) in imx8qxp_pc_bridge_probe()
299 DRM_DEV_ERROR(dev, "failed to get apb clock: %d\n", ret); in imx8qxp_pc_bridge_probe()
309 ret = -EINVAL; in imx8qxp_pc_bridge_probe()
315 ch = &pc->ch[i]; in imx8qxp_pc_bridge_probe()
316 ch->pc = pc; in imx8qxp_pc_bridge_probe()
317 ch->stream_id = i; in imx8qxp_pc_bridge_probe()
321 ret = -ENODEV; in imx8qxp_pc_bridge_probe()
328 ch->next_bridge = of_drm_find_bridge(remote); in imx8qxp_pc_bridge_probe()
329 if (!ch->next_bridge) { in imx8qxp_pc_bridge_probe()
331 ret = -EPROBE_DEFER; in imx8qxp_pc_bridge_probe()
340 ch->bridge.driver_private = ch; in imx8qxp_pc_bridge_probe()
341 ch->bridge.funcs = &imx8qxp_pc_bridge_funcs; in imx8qxp_pc_bridge_probe()
342 ch->bridge.of_node = child; in imx8qxp_pc_bridge_probe()
343 ch->is_available = true; in imx8qxp_pc_bridge_probe()
345 drm_bridge_add(&ch->bridge); in imx8qxp_pc_bridge_probe()
353 if (i == 1 && pc->ch[0].next_bridge) in imx8qxp_pc_bridge_probe()
354 drm_bridge_remove(&pc->ch[0].bridge); in imx8qxp_pc_bridge_probe()
367 ch = &pc->ch[i]; in imx8qxp_pc_bridge_remove()
369 if (!ch->is_available) in imx8qxp_pc_bridge_remove()
372 drm_bridge_remove(&ch->bridge); in imx8qxp_pc_bridge_remove()
373 ch->is_available = false; in imx8qxp_pc_bridge_remove()
376 pm_runtime_disable(&pdev->dev); in imx8qxp_pc_bridge_remove()
387 ret = clk_prepare_enable(pc->clk_apb); in imx8qxp_pc_runtime_suspend()
389 DRM_DEV_ERROR(pc->dev, "%s: failed to enable apb clock: %d\n", in imx8qxp_pc_runtime_suspend()
395 clk_disable_unprepare(pc->clk_apb); in imx8qxp_pc_runtime_suspend()
409 ret = clk_prepare_enable(pc->clk_apb); in imx8qxp_pc_runtime_resume()
411 DRM_DEV_ERROR(pc->dev, "%s: failed to enable apb clock: %d\n", in imx8qxp_pc_runtime_resume()
419 clk_disable_unprepare(pc->clk_apb); in imx8qxp_pc_runtime_resume()
430 { .compatible = "fsl,imx8qm-pixel-combiner", },
431 { .compatible = "fsl,imx8qxp-pixel-combiner", },