Lines Matching +full:all +full:- +full:outputs +full:- +full:2
1 // SPDX-License-Identifier: GPL-2.0-only
10 * signals. On BCM2835, these can be routed out to GPIO0-27 with the
24 #include <linux/media-bus-format.h>
40 # define DPI_ORDER_GRB 2
43 /* The format field takes the ORDER-shuffled pixel valve data and
48 /* This define is named in the hardware, but actually just outputs 0. */
50 /* Outputs 00000000rrrrrggggggbbbbb */
52 /* Outputs 000rrrrr00gggggg000bbbbb */
53 # define DPI_FORMAT_16BIT_565_RGB_2 2
54 /* Outputs 00rrrrr000gggggg00bbbbb0 */
56 /* Outputs 000000rrrrrrggggggbbbbbb */
58 /* Outputs 00rrrrrr00gggggg00bbbbbb */
60 /* Outputs rrrrrrrrggggggggbbbbbbbb */
69 /* Outputs the signal the falling clock edge instead of rising. */
76 # define DPI_VSYNC_DISABLE BIT(2)
79 /* Power gate to the device, full reset at 0 -> 1 transition */
82 /* All other registers besides DPI_C return the ID */
106 readl(dpi->regs + (offset)); \
112 writel(val, dpi->regs + (offset)); \
122 struct drm_device *dev = encoder->dev; in vc4_dpi_encoder_disable()
129 clk_disable_unprepare(dpi->pixel_clock); in vc4_dpi_encoder_disable()
136 struct drm_device *dev = encoder->dev; in vc4_dpi_encoder_enable()
137 struct drm_display_mode *mode = &encoder->crtc->mode; in vc4_dpi_encoder_enable()
152 if (connector_scan->encoder == encoder) { in vc4_dpi_encoder_enable()
163 if (connector->display_info.num_bus_formats) { in vc4_dpi_encoder_enable()
164 u32 bus_format = connector->display_info.bus_formats[0]; in vc4_dpi_encoder_enable()
208 if (connector->display_info.bus_flags & DRM_BUS_FLAG_PIXDATA_DRIVE_NEGEDGE) in vc4_dpi_encoder_enable()
211 if (connector->display_info.bus_flags & DRM_BUS_FLAG_DE_LOW) in vc4_dpi_encoder_enable()
215 if (mode->flags & DRM_MODE_FLAG_CSYNC) { in vc4_dpi_encoder_enable()
216 if (mode->flags & DRM_MODE_FLAG_NCSYNC) in vc4_dpi_encoder_enable()
221 if (mode->flags & DRM_MODE_FLAG_NHSYNC) in vc4_dpi_encoder_enable()
223 else if (!(mode->flags & DRM_MODE_FLAG_PHSYNC)) in vc4_dpi_encoder_enable()
226 if (mode->flags & DRM_MODE_FLAG_NVSYNC) in vc4_dpi_encoder_enable()
228 else if (!(mode->flags & DRM_MODE_FLAG_PVSYNC)) in vc4_dpi_encoder_enable()
237 ret = clk_set_rate(dpi->pixel_clock, mode->clock * 1000); in vc4_dpi_encoder_enable()
241 ret = clk_prepare_enable(dpi->pixel_clock); in vc4_dpi_encoder_enable()
251 if (mode->flags & DRM_MODE_FLAG_INTERLACE) in vc4_dpi_encoder_mode_valid()
265 struct drm_device *drm = encoder->dev; in vc4_dpi_late_register()
268 vc4_debugfs_add_regset32(drm, "dpi_regs", &dpi->regset); in vc4_dpi_late_register()
278 { .compatible = "brcm,bcm2835-dpi", .data = NULL },
287 struct drm_device *drm = dpi->encoder.base.dev; in vc4_dpi_init_bridge()
288 struct device *dev = &dpi->pdev->dev; in vc4_dpi_init_bridge()
291 bridge = drmm_of_get_bridge(drm, dev->of_node, 0, 0); in vc4_dpi_init_bridge()
296 if (PTR_ERR(bridge) == -ENODEV) in vc4_dpi_init_bridge()
302 return drm_bridge_attach(&dpi->encoder.base, bridge, NULL, 0); in vc4_dpi_init_bridge()
309 clk_disable_unprepare(dpi->core_clock); in vc4_dpi_disable_clock()
321 return -ENOMEM; in vc4_dpi_bind()
323 dpi->encoder.type = VC4_ENCODER_TYPE_DPI; in vc4_dpi_bind()
324 dpi->pdev = pdev; in vc4_dpi_bind()
325 dpi->regs = vc4_ioremap_regs(pdev, 0); in vc4_dpi_bind()
326 if (IS_ERR(dpi->regs)) in vc4_dpi_bind()
327 return PTR_ERR(dpi->regs); in vc4_dpi_bind()
328 dpi->regset.base = dpi->regs; in vc4_dpi_bind()
329 dpi->regset.regs = dpi_regs; in vc4_dpi_bind()
330 dpi->regset.nregs = ARRAY_SIZE(dpi_regs); in vc4_dpi_bind()
335 return -ENODEV; in vc4_dpi_bind()
338 dpi->core_clock = devm_clk_get(dev, "core"); in vc4_dpi_bind()
339 if (IS_ERR(dpi->core_clock)) { in vc4_dpi_bind()
340 ret = PTR_ERR(dpi->core_clock); in vc4_dpi_bind()
341 if (ret != -EPROBE_DEFER) in vc4_dpi_bind()
346 dpi->pixel_clock = devm_clk_get(dev, "pixel"); in vc4_dpi_bind()
347 if (IS_ERR(dpi->pixel_clock)) { in vc4_dpi_bind()
348 ret = PTR_ERR(dpi->pixel_clock); in vc4_dpi_bind()
349 if (ret != -EPROBE_DEFER) in vc4_dpi_bind()
354 ret = clk_prepare_enable(dpi->core_clock); in vc4_dpi_bind()
364 ret = drmm_encoder_init(drm, &dpi->encoder.base, in vc4_dpi_bind()
371 drm_encoder_helper_add(&dpi->encoder.base, &vc4_dpi_encoder_helper_funcs); in vc4_dpi_bind()
388 return component_add(&pdev->dev, &vc4_dpi_ops); in vc4_dpi_dev_probe()
393 component_del(&pdev->dev, &vc4_dpi_ops); in vc4_dpi_dev_remove()