Lines Matching +full:bcm2835 +full:- +full:txp

1 // SPDX-License-Identifier: GPL-2.0
29 /* Base address of the output. Raster formats must be 4-byte aligned,
30 * T and LT must be 16-byte aligned or maybe utile-aligned (docs are
35 /* Pitch in bytes for raster images, 16-byte aligned. For tiled, it's
39 /* For T-tiled imgaes, DST_PITCH should be the number of tiles wide,
43 /* For LT-tiled images, DST_PITCH should be the number of utiles wide,
48 /* Pre-rotation width/height of the image. Must match HVS config.
50 * If TFORMAT and 32-bit, limit is 1920 for 32-bit and 3840 to 16-bit
51 * and width/height must be tile or utile-aligned as appropriate. If
67 /* Bits 22-23 are set to 0x01 */
111 /* 888s are non-rotated, raster-only */
140 /* Starts a frame. Self-clearing. */
146 #define TXP_READ(offset) readl(txp->regs + (offset))
147 #define TXP_WRITE(offset, val) writel(val, txp->regs + (offset))
180 struct drm_device *dev = connector->dev; in vc4_txp_connector_get_modes()
182 return drm_add_modes_noedid(connector, dev->mode_config.max_width, in vc4_txp_connector_get_modes()
183 dev->mode_config.max_height); in vc4_txp_connector_get_modes()
190 struct drm_device *dev = connector->dev; in vc4_txp_connector_mode_valid()
191 struct drm_mode_config *mode_config = &dev->mode_config; in vc4_txp_connector_mode_valid()
192 int w = mode->hdisplay, h = mode->vdisplay; in vc4_txp_connector_mode_valid()
194 if (w < mode_config->min_width || w > mode_config->max_width) in vc4_txp_connector_mode_valid()
197 if (h < mode_config->min_height || h > mode_config->max_height) in vc4_txp_connector_mode_valid()
233 vc4_state->txp_armed = true; in vc4_txp_armed()
245 if (!conn_state->writeback_job) in vc4_txp_connector_atomic_check()
248 crtc_state = drm_atomic_get_new_crtc_state(state, conn_state->crtc); in vc4_txp_connector_atomic_check()
250 fb = conn_state->writeback_job->fb; in vc4_txp_connector_atomic_check()
251 if (fb->width != crtc_state->mode.hdisplay || in vc4_txp_connector_atomic_check()
252 fb->height != crtc_state->mode.vdisplay) { in vc4_txp_connector_atomic_check()
254 fb->width, fb->height); in vc4_txp_connector_atomic_check()
255 return -EINVAL; in vc4_txp_connector_atomic_check()
259 if (fb->format->format == drm_fmts[i]) in vc4_txp_connector_atomic_check()
264 return -EINVAL; in vc4_txp_connector_atomic_check()
267 if (fb->pitches[0] & GENMASK(3, 0)) in vc4_txp_connector_atomic_check()
268 return -EINVAL; in vc4_txp_connector_atomic_check()
280 struct vc4_txp *txp = connector_to_vc4_txp(conn); in vc4_txp_connector_atomic_commit() local
287 if (WARN_ON(!conn_state->writeback_job)) in vc4_txp_connector_atomic_commit()
290 mode = &conn_state->crtc->state->adjusted_mode; in vc4_txp_connector_atomic_commit()
291 fb = conn_state->writeback_job->fb; in vc4_txp_connector_atomic_commit()
294 if (fb->format->format == drm_fmts[i]) in vc4_txp_connector_atomic_commit()
305 if (fb->format->has_alpha) in vc4_txp_connector_atomic_commit()
309 TXP_WRITE(TXP_DST_PTR, gem->paddr + fb->offsets[0]); in vc4_txp_connector_atomic_commit()
310 TXP_WRITE(TXP_DST_PITCH, fb->pitches[0]); in vc4_txp_connector_atomic_commit()
312 VC4_SET_FIELD(mode->hdisplay, TXP_WIDTH) | in vc4_txp_connector_atomic_commit()
313 VC4_SET_FIELD(mode->vdisplay, TXP_HEIGHT)); in vc4_txp_connector_atomic_commit()
317 drm_writeback_queue_job(&txp->connector, conn_state); in vc4_txp_connector_atomic_commit()
350 struct vc4_txp *txp = encoder_to_vc4_txp(encoder); in vc4_txp_encoder_disable() local
401 crtc_state->no_vblank = true; in vc4_txp_atomic_check()
402 vc4_state->feed_txp = true; in vc4_txp_atomic_check()
417 struct drm_device *dev = crtc->dev; in vc4_txp_atomic_disable()
428 if (crtc->state->event) { in vc4_txp_atomic_disable()
431 spin_lock_irqsave(&dev->event_lock, flags); in vc4_txp_atomic_disable()
432 drm_crtc_send_vblank_event(crtc, crtc->state->event); in vc4_txp_atomic_disable()
433 crtc->state->event = NULL; in vc4_txp_atomic_disable()
434 spin_unlock_irqrestore(&dev->event_lock, flags); in vc4_txp_atomic_disable()
447 struct vc4_txp *txp = data; in vc4_txp_interrupt() local
448 struct vc4_crtc *vc4_crtc = &txp->base; in vc4_txp_interrupt()
452 drm_writeback_signal_completion(&txp->connector, 0); in vc4_txp_interrupt()
468 struct vc4_txp *txp; in vc4_txp_bind() local
477 txp = devm_kzalloc(dev, sizeof(*txp), GFP_KERNEL); in vc4_txp_bind()
478 if (!txp) in vc4_txp_bind()
479 return -ENOMEM; in vc4_txp_bind()
480 vc4_crtc = &txp->base; in vc4_txp_bind()
481 crtc = &vc4_crtc->base; in vc4_txp_bind()
483 vc4_crtc->pdev = pdev; in vc4_txp_bind()
484 vc4_crtc->data = &vc4_txp_crtc_data; in vc4_txp_bind()
486 txp->pdev = pdev; in vc4_txp_bind()
488 txp->regs = vc4_ioremap_regs(pdev, 0); in vc4_txp_bind()
489 if (IS_ERR(txp->regs)) in vc4_txp_bind()
490 return PTR_ERR(txp->regs); in vc4_txp_bind()
491 txp->regset.base = txp->regs; in vc4_txp_bind()
492 txp->regset.regs = txp_regs; in vc4_txp_bind()
493 txp->regset.nregs = ARRAY_SIZE(txp_regs); in vc4_txp_bind()
495 drm_connector_helper_add(&txp->connector.base, in vc4_txp_bind()
497 ret = drm_writeback_connector_init(drm, &txp->connector, in vc4_txp_bind()
509 encoder = &txp->connector.encoder; in vc4_txp_bind()
510 encoder->possible_crtcs = drm_crtc_mask(crtc); in vc4_txp_bind()
513 dev_name(dev), txp); in vc4_txp_bind()
517 dev_set_drvdata(dev, txp); in vc4_txp_bind()
518 vc4->txp = txp; in vc4_txp_bind()
520 vc4_debugfs_add_regset32(drm, "txp_regs", &txp->regset); in vc4_txp_bind()
530 struct vc4_txp *txp = dev_get_drvdata(dev); in vc4_txp_unbind() local
532 vc4_txp_connector_destroy(&txp->connector.base); in vc4_txp_unbind()
534 vc4->txp = NULL; in vc4_txp_unbind()
544 return component_add(&pdev->dev, &vc4_txp_ops); in vc4_txp_probe()
549 component_del(&pdev->dev, &vc4_txp_ops); in vc4_txp_remove()
554 { .compatible = "brcm,bcm2835-txp" },