Lines Matching +full:bcm2835 +full:- +full:txp
1 // SPDX-License-Identifier: GPL-2.0
28 /* Base address of the output. Raster formats must be 4-byte aligned,
29 * T and LT must be 16-byte aligned or maybe utile-aligned (docs are
34 /* Pitch in bytes for raster images, 16-byte aligned. For tiled, it's
38 /* For T-tiled imgaes, DST_PITCH should be the number of tiles wide,
42 /* For LT-tiled images, DST_PITCH should be the number of utiles wide,
47 /* Pre-rotation width/height of the image. Must match HVS config.
49 * If TFORMAT and 32-bit, limit is 1920 for 32-bit and 3840 to 16-bit
50 * and width/height must be tile or utile-aligned as appropriate. If
66 /* Bits 22-23 are set to 0x01 */
110 /* 888s are non-rotated, raster-only */
139 /* Starts a frame. Self-clearing. */
145 #define TXP_READ(offset) readl(txp->regs + (offset))
146 #define TXP_WRITE(offset, val) writel(val, txp->regs + (offset))
179 struct drm_device *dev = connector->dev; in vc4_txp_connector_get_modes()
181 return drm_add_modes_noedid(connector, dev->mode_config.max_width, in vc4_txp_connector_get_modes()
182 dev->mode_config.max_height); in vc4_txp_connector_get_modes()
189 struct drm_device *dev = connector->dev; in vc4_txp_connector_mode_valid()
190 struct drm_mode_config *mode_config = &dev->mode_config; in vc4_txp_connector_mode_valid()
191 int w = mode->hdisplay, h = mode->vdisplay; in vc4_txp_connector_mode_valid()
193 if (w < mode_config->min_width || w > mode_config->max_width) in vc4_txp_connector_mode_valid()
196 if (h < mode_config->min_height || h > mode_config->max_height) in vc4_txp_connector_mode_valid()
232 vc4_state->txp_armed = true; in vc4_txp_armed()
244 if (!conn_state->writeback_job) in vc4_txp_connector_atomic_check()
247 crtc_state = drm_atomic_get_new_crtc_state(state, conn_state->crtc); in vc4_txp_connector_atomic_check()
249 fb = conn_state->writeback_job->fb; in vc4_txp_connector_atomic_check()
250 if (fb->width != crtc_state->mode.hdisplay || in vc4_txp_connector_atomic_check()
251 fb->height != crtc_state->mode.vdisplay) { in vc4_txp_connector_atomic_check()
253 fb->width, fb->height); in vc4_txp_connector_atomic_check()
254 return -EINVAL; in vc4_txp_connector_atomic_check()
258 if (fb->format->format == drm_fmts[i]) in vc4_txp_connector_atomic_check()
263 return -EINVAL; in vc4_txp_connector_atomic_check()
266 if (fb->pitches[0] & GENMASK(3, 0)) in vc4_txp_connector_atomic_check()
267 return -EINVAL; in vc4_txp_connector_atomic_check()
277 struct vc4_txp *txp = connector_to_vc4_txp(conn); in vc4_txp_connector_atomic_commit() local
284 if (WARN_ON(!conn_state->writeback_job)) in vc4_txp_connector_atomic_commit()
287 mode = &conn_state->crtc->state->adjusted_mode; in vc4_txp_connector_atomic_commit()
288 fb = conn_state->writeback_job->fb; in vc4_txp_connector_atomic_commit()
291 if (fb->format->format == drm_fmts[i]) in vc4_txp_connector_atomic_commit()
302 if (fb->format->has_alpha) in vc4_txp_connector_atomic_commit()
306 TXP_WRITE(TXP_DST_PTR, gem->paddr + fb->offsets[0]); in vc4_txp_connector_atomic_commit()
307 TXP_WRITE(TXP_DST_PITCH, fb->pitches[0]); in vc4_txp_connector_atomic_commit()
309 VC4_SET_FIELD(mode->hdisplay, TXP_WIDTH) | in vc4_txp_connector_atomic_commit()
310 VC4_SET_FIELD(mode->vdisplay, TXP_HEIGHT)); in vc4_txp_connector_atomic_commit()
314 drm_writeback_queue_job(&txp->connector, conn_state); in vc4_txp_connector_atomic_commit()
347 struct vc4_txp *txp = encoder_to_vc4_txp(encoder); in vc4_txp_encoder_disable() local
397 state->no_vblank = true; in vc4_txp_atomic_check()
398 vc4_state->feed_txp = true; in vc4_txp_atomic_check()
413 struct drm_device *dev = crtc->dev; in vc4_txp_atomic_disable()
424 if (crtc->state->event) { in vc4_txp_atomic_disable()
427 spin_lock_irqsave(&dev->event_lock, flags); in vc4_txp_atomic_disable()
428 drm_crtc_send_vblank_event(crtc, crtc->state->event); in vc4_txp_atomic_disable()
429 crtc->state->event = NULL; in vc4_txp_atomic_disable()
430 spin_unlock_irqrestore(&dev->event_lock, flags); in vc4_txp_atomic_disable()
443 struct vc4_txp *txp = data; in vc4_txp_interrupt() local
444 struct vc4_crtc *vc4_crtc = &txp->base; in vc4_txp_interrupt()
448 drm_writeback_signal_completion(&txp->connector, 0); in vc4_txp_interrupt()
464 struct vc4_txp *txp; in vc4_txp_bind() local
473 txp = devm_kzalloc(dev, sizeof(*txp), GFP_KERNEL); in vc4_txp_bind()
474 if (!txp) in vc4_txp_bind()
475 return -ENOMEM; in vc4_txp_bind()
476 vc4_crtc = &txp->base; in vc4_txp_bind()
477 crtc = &vc4_crtc->base; in vc4_txp_bind()
479 vc4_crtc->pdev = pdev; in vc4_txp_bind()
480 vc4_crtc->data = &vc4_txp_crtc_data; in vc4_txp_bind()
482 txp->pdev = pdev; in vc4_txp_bind()
484 txp->regs = vc4_ioremap_regs(pdev, 0); in vc4_txp_bind()
485 if (IS_ERR(txp->regs)) in vc4_txp_bind()
486 return PTR_ERR(txp->regs); in vc4_txp_bind()
487 txp->regset.base = txp->regs; in vc4_txp_bind()
488 txp->regset.regs = txp_regs; in vc4_txp_bind()
489 txp->regset.nregs = ARRAY_SIZE(txp_regs); in vc4_txp_bind()
491 drm_connector_helper_add(&txp->connector.base, in vc4_txp_bind()
493 ret = drm_writeback_connector_init(drm, &txp->connector, in vc4_txp_bind()
505 encoder = &txp->connector.encoder; in vc4_txp_bind()
506 encoder->possible_crtcs |= drm_crtc_mask(crtc); in vc4_txp_bind()
509 dev_name(dev), txp); in vc4_txp_bind()
513 dev_set_drvdata(dev, txp); in vc4_txp_bind()
514 vc4->txp = txp; in vc4_txp_bind()
516 vc4_debugfs_add_regset32(drm, "txp_regs", &txp->regset); in vc4_txp_bind()
526 struct vc4_txp *txp = dev_get_drvdata(dev); in vc4_txp_unbind() local
528 vc4_txp_connector_destroy(&txp->connector.base); in vc4_txp_unbind()
530 vc4->txp = NULL; in vc4_txp_unbind()
540 return component_add(&pdev->dev, &vc4_txp_ops); in vc4_txp_probe()
545 component_del(&pdev->dev, &vc4_txp_ops); in vc4_txp_remove()
550 { .compatible = "brcm,bcm2835-txp" },