drivers/gpu/drm/nouveau/nvkm/subdev/volt/gpio.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/nouveau/nvkm/subdev/volt/gpio.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/nouveau/nvkm/subdev/volt/gpio.c- Extension
.c- Size
- 2844 bytes
- Lines
- 99
- 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.
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
subdev/volt.hsubdev/bios.hsubdev/bios/gpio.hsubdev/gpio.hpriv.h
Detected Declarations
function nvkm_voltgpio_getfunction nvkm_voltgpio_setfunction nvkm_voltgpio_init
Annotated Snippet
if (volt->vid_mask & (1 << i)) {
int ret = nvkm_gpio_get(gpio, 0, tags[i], 0xff);
if (ret < 0)
return ret;
vid |= ret << i;
}
}
return vid;
}
int
nvkm_voltgpio_set(struct nvkm_volt *volt, u8 vid)
{
struct nvkm_gpio *gpio = volt->subdev.device->gpio;
int i;
for (i = 0; i < ARRAY_SIZE(tags); i++, vid >>= 1) {
if (volt->vid_mask & (1 << i)) {
int ret = nvkm_gpio_set(gpio, 0, tags[i], 0xff, vid & 1);
if (ret < 0)
return ret;
}
}
return 0;
}
int
nvkm_voltgpio_init(struct nvkm_volt *volt)
{
struct nvkm_subdev *subdev = &volt->subdev;
struct nvkm_gpio *gpio = subdev->device->gpio;
struct dcb_gpio_func func;
int i;
/* check we have gpio function info for each vid bit. on some
* boards (ie. nvs295) the vid mask has more bits than there
* are valid gpio functions... from traces, nvidia appear to
* just touch the existing ones, so let's mask off the invalid
* bits and continue with life
*/
for (i = 0; i < ARRAY_SIZE(tags); i++) {
if (volt->vid_mask & (1 << i)) {
int ret = nvkm_gpio_find(gpio, 0, tags[i], 0xff, &func);
if (ret) {
if (ret != -ENOENT)
return ret;
nvkm_debug(subdev, "VID bit %d has no GPIO\n", i);
volt->vid_mask &= ~(1 << i);
}
}
}
return 0;
}
Annotation
- Immediate include surface: `subdev/volt.h`, `subdev/bios.h`, `subdev/bios/gpio.h`, `subdev/gpio.h`, `priv.h`.
- Detected declarations: `function nvkm_voltgpio_get`, `function nvkm_voltgpio_set`, `function nvkm_voltgpio_init`.
- Atlas domain: Driver Families / drivers/gpu.
- Implementation status: source implementation candidate.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.