drivers/gpu/drm/nouveau/nvkm/subdev/i2c/padgm200.c

Source file repositories/reference/linux-study-clean/drivers/gpu/drm/nouveau/nvkm/subdev/i2c/padgm200.c

File Facts

System
Linux kernel
Corpus path
drivers/gpu/drm/nouveau/nvkm/subdev/i2c/padgm200.c
Extension
.c
Size
2506 bytes
Lines
77
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 "pad.h"
#include "auxch.h"
#include "bus.h"

static void
gm200_i2c_pad_mode(struct nvkm_i2c_pad *pad, enum nvkm_i2c_pad_mode mode)
{
	struct nvkm_subdev *subdev = &pad->i2c->subdev;
	struct nvkm_device *device = subdev->device;
	const u32 base = (pad->id - NVKM_I2C_PAD_HYBRID(0)) * 0x50;

	switch (mode) {
	case NVKM_I2C_PAD_OFF:
		nvkm_mask(device, 0x00d97c + base, 0x00000001, 0x00000001);
		break;
	case NVKM_I2C_PAD_I2C:
		nvkm_mask(device, 0x00d970 + base, 0x0000c003, 0x0000c001);
		nvkm_mask(device, 0x00d97c + base, 0x00000001, 0x00000000);
		break;
	case NVKM_I2C_PAD_AUX:
		nvkm_mask(device, 0x00d970 + base, 0x0000c003, 0x00000002);
		nvkm_mask(device, 0x00d97c + base, 0x00000001, 0x00000000);
		break;
	default:
		WARN_ON(1);
		break;
	}
}

static const struct nvkm_i2c_pad_func
gm200_i2c_pad_s_func = {
	.bus_new_4 = gf119_i2c_bus_new,
	.aux_new_6 = gm200_i2c_aux_new,
	.mode = gm200_i2c_pad_mode,
};

int
gm200_i2c_pad_s_new(struct nvkm_i2c *i2c, int id, struct nvkm_i2c_pad **ppad)
{
	return nvkm_i2c_pad_new_(&gm200_i2c_pad_s_func, i2c, id, ppad);
}

static const struct nvkm_i2c_pad_func
gm200_i2c_pad_x_func = {
	.bus_new_4 = gf119_i2c_bus_new,
	.aux_new_6 = gm200_i2c_aux_new,
};

int
gm200_i2c_pad_x_new(struct nvkm_i2c *i2c, int id, struct nvkm_i2c_pad **ppad)
{
	return nvkm_i2c_pad_new_(&gm200_i2c_pad_x_func, i2c, id, ppad);
}

Annotation

Implementation Notes