drivers/gpu/drm/nouveau/nvkm/engine/disp/gk104.c

Source file repositories/reference/linux-study-clean/drivers/gpu/drm/nouveau/nvkm/engine/disp/gk104.c

File Facts

System
Linux kernel
Corpus path
drivers/gpu/drm/nouveau/nvkm/engine/disp/gk104.c
Extension
.c
Size
9033 bytes
Lines
334
Domain
Driver Families
Bucket
drivers/gpu
Inferred role
Driver Families: implementation source
Status
source 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

#include "priv.h"
#include "chan.h"
#include "hdmi.h"
#include "head.h"
#include "ior.h"

#include <nvif/class.h>

void
gk104_sor_hdmi_infoframe_vsi(struct nvkm_ior *ior, int head, void *data, u32 size)
{
	struct nvkm_device *device = ior->disp->engine.subdev.device;
	struct packed_hdmi_infoframe vsi;
	const u32 hoff = head * 0x400;

	pack_hdmi_infoframe(&vsi, data, size);

	/* GENERIC(?) / Vendor InfoFrame? */
	nvkm_mask(device, 0x690100 + hoff, 0x00010001, 0x00000000);
	if (!size)
		return;

	nvkm_wr32(device, 0x690108 + hoff, vsi.header);
	nvkm_wr32(device, 0x69010c + hoff, vsi.subpack0_low);
	nvkm_wr32(device, 0x690110 + hoff, vsi.subpack0_high);
	/* Is there a second (or further?) set of subpack registers here? */
	nvkm_mask(device, 0x690100 + hoff, 0x00000001, 0x00000001);
}

void
gk104_sor_hdmi_infoframe_avi(struct nvkm_ior *ior, int head, void *data, u32 size)
{
	struct nvkm_device *device = ior->disp->engine.subdev.device;
	struct packed_hdmi_infoframe avi;
	const u32 hoff = head * 0x400;

	pack_hdmi_infoframe(&avi, data, size);

	/* AVI InfoFrame */
	nvkm_mask(device, 0x690000 + hoff, 0x00000001, 0x00000000);
	if (!size)
		return;

	nvkm_wr32(device, 0x690008 + hoff, avi.header);
	nvkm_wr32(device, 0x69000c + hoff, avi.subpack0_low);
	nvkm_wr32(device, 0x690010 + hoff, avi.subpack0_high);
	nvkm_wr32(device, 0x690014 + hoff, avi.subpack1_low);
	nvkm_wr32(device, 0x690018 + hoff, avi.subpack1_high);

	nvkm_mask(device, 0x690000 + hoff, 0x00000001, 0x00000001);
}

void
gk104_sor_hdmi_ctrl(struct nvkm_ior *ior, int head, bool enable, u8 max_ac_packet, u8 rekey)
{
	struct nvkm_device *device = ior->disp->engine.subdev.device;
	const u32 ctrl = 0x40000000 * enable |
			 max_ac_packet << 16 |
			 rekey;
	const u32 hoff = head * 0x800;
	const u32 hdmi = head * 0x400;

	if (!(ctrl & 0x40000000)) {
		nvkm_mask(device, 0x616798 + hoff, 0x40000000, 0x00000000);
		nvkm_mask(device, 0x690100 + hdmi, 0x00000001, 0x00000000);
		nvkm_mask(device, 0x6900c0 + hdmi, 0x00000001, 0x00000000);
		nvkm_mask(device, 0x690000 + hdmi, 0x00000001, 0x00000000);
		return;
	}

	/* ??? InfoFrame? */
	nvkm_mask(device, 0x6900c0 + hdmi, 0x00000001, 0x00000000);
	nvkm_wr32(device, 0x6900cc + hdmi, 0x00000010);
	nvkm_mask(device, 0x6900c0 + hdmi, 0x00000001, 0x00000001);

	/* ??? */
	nvkm_wr32(device, 0x690080 + hdmi, 0x82000000);

	/* HDMI_CTRL */
	nvkm_mask(device, 0x616798 + hoff, 0x401f007f, ctrl);
}

const struct nvkm_ior_func_hdmi
gk104_sor_hdmi = {
	.ctrl = gk104_sor_hdmi_ctrl,
	.infoframe_avi = gk104_sor_hdmi_infoframe_avi,
	.infoframe_vsi = gk104_sor_hdmi_infoframe_vsi,
};

static const struct nvkm_ior_func

Annotation

Implementation Notes