drivers/gpu/drm/nouveau/nouveau_backlight.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/nouveau/nouveau_backlight.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/nouveau/nouveau_backlight.c- Extension
.c- Size
- 10861 bytes
- Lines
- 415
- 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.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/apple-gmux.hlinux/backlight.hlinux/idr.hdrm/drm_probe_helper.hnouveau_drv.hnouveau_reg.hnouveau_encoder.hnouveau_connector.hnouveau_acpi.h
Detected Declarations
function nouveau_get_backlight_namefunction nv40_get_intensityfunction nv40_set_intensityfunction nv40_backlight_initfunction nv50_edp_get_brightnessfunction nv50_edp_set_brightnessfunction nv50_get_intensityfunction nv50_set_intensityfunction nv50_backlight_initfunction nouveau_backlight_initfunction nouveau_backlight_finifunction nouveau_backlight_ctorfunction nouveau_backlight_dtor
Annotated Snippet
if (ret < 0) {
NV_ERROR(drm, "Failed to enable backlight on %s: %d\n",
nv_conn->base.name, ret);
return ret;
}
*ops = &nv50_edp_bl_ops;
props->brightness = current_level;
props->max_brightness = bl->edp_info.max;
bl->uses_dpcd = true;
return 0;
}
}
*ops = &nv50_bl_ops;
props->max_brightness = 100;
return 0;
}
int
nouveau_backlight_init(struct drm_connector *connector)
{
struct nouveau_drm *drm = nouveau_drm(connector->dev);
struct nouveau_backlight *bl;
struct nouveau_encoder *nv_encoder = NULL;
struct nvif_device *device = &drm->client.device;
char backlight_name[BL_NAME_SIZE];
struct backlight_properties props = {0};
const struct backlight_ops *ops;
int ret;
if (apple_gmux_present()) {
NV_INFO_ONCE(drm, "Apple GMUX detected: not registering Nouveau backlight interface\n");
return 0;
}
if (connector->connector_type == DRM_MODE_CONNECTOR_LVDS)
nv_encoder = find_encoder(connector, DCB_OUTPUT_LVDS);
else if (connector->connector_type == DRM_MODE_CONNECTOR_eDP)
nv_encoder = find_encoder(connector, DCB_OUTPUT_DP);
else
return 0;
if (!nv_encoder)
return 0;
bl = kzalloc_obj(*bl);
if (!bl)
return -ENOMEM;
switch (device->info.family) {
case NV_DEVICE_INFO_V0_CURIE:
ret = nv40_backlight_init(nv_encoder, &props, &ops);
break;
case NV_DEVICE_INFO_V0_TESLA:
case NV_DEVICE_INFO_V0_FERMI:
case NV_DEVICE_INFO_V0_KEPLER:
case NV_DEVICE_INFO_V0_MAXWELL:
case NV_DEVICE_INFO_V0_PASCAL:
case NV_DEVICE_INFO_V0_VOLTA:
case NV_DEVICE_INFO_V0_TURING:
case NV_DEVICE_INFO_V0_AMPERE: //XXX: not confirmed
ret = nv50_backlight_init(bl, nouveau_connector(connector),
nv_encoder, &props, &ops);
break;
default:
ret = 0;
goto fail_alloc;
}
if (ret) {
if (ret == -ENODEV)
ret = 0;
goto fail_alloc;
}
if (!nouveau_acpi_video_backlight_use_native()) {
NV_INFO(drm, "Skipping nv_backlight registration\n");
goto fail_alloc;
}
if (!nouveau_get_backlight_name(backlight_name, bl)) {
NV_ERROR(drm, "Failed to retrieve a unique name for the backlight interface\n");
goto fail_alloc;
}
props.type = BACKLIGHT_RAW;
bl->dev = backlight_device_register(backlight_name, connector->kdev,
nv_encoder, ops, &props);
if (IS_ERR(bl->dev)) {
Annotation
- Immediate include surface: `linux/apple-gmux.h`, `linux/backlight.h`, `linux/idr.h`, `drm/drm_probe_helper.h`, `nouveau_drv.h`, `nouveau_reg.h`, `nouveau_encoder.h`, `nouveau_connector.h`.
- Detected declarations: `function nouveau_get_backlight_name`, `function nv40_get_intensity`, `function nv40_set_intensity`, `function nv40_backlight_init`, `function nv50_edp_get_brightness`, `function nv50_edp_set_brightness`, `function nv50_get_intensity`, `function nv50_set_intensity`, `function nv50_backlight_init`, `function nouveau_backlight_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.