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

1 // SPDX-License-Identifier: GPL-2.0
31 /* Base address of the output. Raster formats must be 4-byte aligned,
32 * T and LT must be 16-byte aligned or maybe utile-aligned (docs are
37 /* Pitch in bytes for raster images, 16-byte aligned. For tiled, it's
41 /* For T-tiled imgaes, DST_PITCH should be the number of tiles wide,
45 /* For LT-tiled images, DST_PITCH should be the number of utiles wide,
50 /* Pre-rotation width/height of the image. Must match HVS config.
52 * If TFORMAT and 32-bit, limit is 1920 for 32-bit and 3840 to 16-bit
53 * and width/height must be tile or utile-aligned as appropriate. If
69 /* Bits 22-23 are set to 0x01 */
113 /* 888s are non-rotated, raster-only */
142 /* Starts a frame. Self-clearing. */
151 readl(txp->regs + (offset)); \
157 writel(val, txp->regs + (offset)); \
187 struct drm_device *dev = connector->dev; in vc4_txp_connector_get_modes()
189 return drm_add_modes_noedid(connector, dev->mode_config.max_width, in vc4_txp_connector_get_modes()
190 dev->mode_config.max_height); in vc4_txp_connector_get_modes()
197 struct drm_device *dev = connector->dev; in vc4_txp_connector_mode_valid()
198 struct drm_mode_config *mode_config = &dev->mode_config; in vc4_txp_connector_mode_valid()
199 int w = mode->hdisplay, h = mode->vdisplay; in vc4_txp_connector_mode_valid()
201 if (w < mode_config->min_width || w > mode_config->max_width) in vc4_txp_connector_mode_valid()
204 if (h < mode_config->min_height || h > mode_config->max_height) in vc4_txp_connector_mode_valid()
240 vc4_state->txp_armed = true; in vc4_txp_armed()
252 if (!conn_state->writeback_job) in vc4_txp_connector_atomic_check()
255 crtc_state = drm_atomic_get_new_crtc_state(state, conn_state->crtc); in vc4_txp_connector_atomic_check()
257 fb = conn_state->writeback_job->fb; in vc4_txp_connector_atomic_check()
258 if (fb->width != crtc_state->mode.hdisplay || in vc4_txp_connector_atomic_check()
259 fb->height != crtc_state->mode.vdisplay) { in vc4_txp_connector_atomic_check()
261 fb->width, fb->height); in vc4_txp_connector_atomic_check()
262 return -EINVAL; in vc4_txp_connector_atomic_check()
266 if (fb->format->format == drm_fmts[i]) in vc4_txp_connector_atomic_check()
271 return -EINVAL; in vc4_txp_connector_atomic_check()
274 if (fb->pitches[0] & GENMASK(3, 0)) in vc4_txp_connector_atomic_check()
275 return -EINVAL; in vc4_txp_connector_atomic_check()
285 struct drm_device *drm = conn->dev; in vc4_txp_connector_atomic_commit()
288 struct vc4_txp *txp = connector_to_vc4_txp(conn); in vc4_txp_connector_atomic_commit() local
296 if (WARN_ON(!conn_state->writeback_job)) in vc4_txp_connector_atomic_commit()
299 mode = &conn_state->crtc->state->adjusted_mode; in vc4_txp_connector_atomic_commit()
300 fb = conn_state->writeback_job->fb; in vc4_txp_connector_atomic_commit()
303 if (fb->format->format == drm_fmts[i]) in vc4_txp_connector_atomic_commit()
314 if (fb->format->has_alpha) in vc4_txp_connector_atomic_commit()
327 TXP_WRITE(TXP_DST_PTR, gem->dma_addr + fb->offsets[0]); in vc4_txp_connector_atomic_commit()
328 TXP_WRITE(TXP_DST_PITCH, fb->pitches[0]); in vc4_txp_connector_atomic_commit()
330 VC4_SET_FIELD(mode->hdisplay, TXP_WIDTH) | in vc4_txp_connector_atomic_commit()
331 VC4_SET_FIELD(mode->vdisplay, TXP_HEIGHT)); in vc4_txp_connector_atomic_commit()
335 drm_writeback_queue_job(&txp->connector, conn_state); in vc4_txp_connector_atomic_commit()
364 struct drm_device *drm = encoder->dev; in vc4_txp_encoder_disable()
365 struct vc4_txp *txp = encoder_to_vc4_txp(encoder); in vc4_txp_encoder_disable() local
421 crtc_state->no_vblank = true; in vc4_txp_atomic_check()
436 struct drm_device *dev = crtc->dev; in vc4_txp_atomic_disable()
447 if (crtc->state->event) { in vc4_txp_atomic_disable()
450 spin_lock_irqsave(&dev->event_lock, flags); in vc4_txp_atomic_disable()
451 drm_crtc_send_vblank_event(crtc, crtc->state->event); in vc4_txp_atomic_disable()
452 crtc->state->event = NULL; in vc4_txp_atomic_disable()
453 spin_unlock_irqrestore(&dev->event_lock, flags); in vc4_txp_atomic_disable()
467 struct vc4_txp *txp = data; in vc4_txp_interrupt() local
468 struct vc4_crtc *vc4_crtc = &txp->base; in vc4_txp_interrupt()
482 drm_writeback_signal_completion(&txp->connector, 0); in vc4_txp_interrupt()
488 .name = "txp",
501 struct vc4_txp *txp; in vc4_txp_bind() local
508 txp = drmm_kzalloc(drm, sizeof(*txp), GFP_KERNEL); in vc4_txp_bind()
509 if (!txp) in vc4_txp_bind()
510 return -ENOMEM; in vc4_txp_bind()
512 txp->pdev = pdev; in vc4_txp_bind()
513 txp->regs = vc4_ioremap_regs(pdev, 0); in vc4_txp_bind()
514 if (IS_ERR(txp->regs)) in vc4_txp_bind()
515 return PTR_ERR(txp->regs); in vc4_txp_bind()
517 vc4_crtc = &txp->base; in vc4_txp_bind()
518 vc4_crtc->regset.base = txp->regs; in vc4_txp_bind()
519 vc4_crtc->regset.regs = txp_regs; in vc4_txp_bind()
520 vc4_crtc->regset.nregs = ARRAY_SIZE(txp_regs); in vc4_txp_bind()
527 vc4_encoder = &txp->encoder; in vc4_txp_bind()
528 txp->encoder.type = VC4_ENCODER_TYPE_TXP; in vc4_txp_bind()
530 encoder = &vc4_encoder->base; in vc4_txp_bind()
531 encoder->possible_crtcs = drm_crtc_mask(&vc4_crtc->base); in vc4_txp_bind()
539 drm_connector_helper_add(&txp->connector.base, in vc4_txp_bind()
541 ret = drm_writeback_connector_init_with_encoder(drm, &txp->connector, in vc4_txp_bind()
549 dev_name(dev), txp); in vc4_txp_bind()
553 dev_set_drvdata(dev, txp); in vc4_txp_bind()
561 struct vc4_txp *txp = dev_get_drvdata(dev); in vc4_txp_unbind() local
563 drm_connector_cleanup(&txp->connector.base); in vc4_txp_unbind()
573 return component_add(&pdev->dev, &vc4_txp_ops); in vc4_txp_probe()
578 component_del(&pdev->dev, &vc4_txp_ops); in vc4_txp_remove()
582 { .compatible = "brcm,bcm2835-txp" },