drivers/gpu/drm/meson/meson_venc.c

Source file repositories/reference/linux-study-clean/drivers/gpu/drm/meson/meson_venc.c

File Facts

System
Linux kernel
Corpus path
drivers/gpu/drm/meson/meson_venc.c
Extension
.c
Size
58512 bytes
Lines
2001
Domain
Driver Families
Bucket
drivers/gpu
Inferred role
Driver Families: exported/initcall integration point
Status
integration implementation candidate

Why This File Exists

Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.

Dependency Surface

Detected Declarations

Annotated Snippet

if (!vmode) {
			dev_err(priv->dev, "%s: Fatal Error, unsupported mode "
				DRM_MODE_FMT "\n", __func__,
				DRM_MODE_ARG(mode));
			return;
		}
	} else {
		meson_venc_hdmi_get_dmt_vmode(mode, &vmode_dmt);
		vmode = &vmode_dmt;
		use_enci = false;
	}

	/* Repeat VENC pixels for 480/576i/p, 720p50/60 and 1080p50/60 */
	if (meson_venc_hdmi_venc_repeat(vic))
		venc_repeat = true;

	eof_lines = mode->vsync_start - mode->vdisplay;
	if (mode->flags & DRM_MODE_FLAG_INTERLACE)
		eof_lines /= 2;
	sof_lines = mode->vtotal - mode->vsync_end;
	if (mode->flags & DRM_MODE_FLAG_INTERLACE)
		sof_lines /= 2;
	vsync_lines = mode->vsync_end - mode->vsync_start;
	if (mode->flags & DRM_MODE_FLAG_INTERLACE)
		vsync_lines /= 2;

	total_pixels_venc = mode->htotal;
	if (hdmi_repeat)
		total_pixels_venc /= 2;
	if (venc_repeat)
		total_pixels_venc *= 2;

	active_pixels_venc = mode->hdisplay;
	if (hdmi_repeat)
		active_pixels_venc /= 2;
	if (venc_repeat)
		active_pixels_venc *= 2;

	front_porch_venc = (mode->hsync_start - mode->hdisplay);
	if (hdmi_repeat)
		front_porch_venc /= 2;
	if (venc_repeat)
		front_porch_venc *= 2;

	hsync_pixels_venc = (mode->hsync_end - mode->hsync_start);
	if (hdmi_repeat)
		hsync_pixels_venc /= 2;
	if (venc_repeat)
		hsync_pixels_venc *= 2;

	/* Disable VDACs */
	writel_bits_relaxed(0xff, 0xff,
			priv->io_base + _REG(VENC_VDAC_SETTING));

	writel_relaxed(0, priv->io_base + _REG(ENCI_VIDEO_EN));
	writel_relaxed(0, priv->io_base + _REG(ENCP_VIDEO_EN));

	if (use_enci) {
		unsigned int lines_f0;
		unsigned int lines_f1;

		/* CVBS Filter settings */
		writel_relaxed(ENCI_CFILT_CMPT_SEL_HIGH | 0x10,
			       priv->io_base + _REG(ENCI_CFILT_CTRL));
		writel_relaxed(ENCI_CFILT_CMPT_CR_DLY(2) |
			       ENCI_CFILT_CMPT_CB_DLY(1),
			       priv->io_base + _REG(ENCI_CFILT_CTRL2));

		/* Digital Video Select : Interlace, clk27 clk, external */
		writel_relaxed(0, priv->io_base + _REG(VENC_DVI_SETTING));

		/* Reset Video Mode */
		writel_relaxed(0, priv->io_base + _REG(ENCI_VIDEO_MODE));
		writel_relaxed(0, priv->io_base + _REG(ENCI_VIDEO_MODE_ADV));

		/* Horizontal sync signal output */
		writel_relaxed(vmode->enci.hso_begin,
				priv->io_base + _REG(ENCI_SYNC_HSO_BEGIN));
		writel_relaxed(vmode->enci.hso_end,
				priv->io_base + _REG(ENCI_SYNC_HSO_END));

		/* Vertical Sync lines */
		writel_relaxed(vmode->enci.vso_even,
				priv->io_base + _REG(ENCI_SYNC_VSO_EVNLN));
		writel_relaxed(vmode->enci.vso_odd,
				priv->io_base + _REG(ENCI_SYNC_VSO_ODDLN));

		/* Macrovision max amplitude change */
		writel_relaxed(ENCI_MACV_MAX_AMP_ENABLE_CHANGE |
			       ENCI_MACV_MAX_AMP_VAL(vmode->enci.macv_max_amp),

Annotation

Implementation Notes