drivers/gpu/drm/gma500/backlight.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/gma500/backlight.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/gma500/backlight.c- Extension
.c- Size
- 2864 bytes
- Lines
- 120
- 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
linux/backlight.hacpi/video.hdrm/drm_print.hpsb_drv.hpsb_intel_reg.hpsb_intel_drv.hintel_bios.hpower.h
Detected Declarations
function Copyrightfunction gma_backlight_disablefunction gma_backlight_setfunction gma_backlight_get_brightnessfunction gma_backlight_update_statusfunction gma_backlight_initfunction gma_backlight_exit
Annotated Snippet
// SPDX-License-Identifier: GPL-2.0-only
/*
* GMA500 Backlight Interface
*
* Copyright (c) 2009-2011, Intel Corporation.
*
* Authors: Eric Knopp
*/
#include <linux/backlight.h>
#include <acpi/video.h>
#include <drm/drm_print.h>
#include "psb_drv.h"
#include "psb_intel_reg.h"
#include "psb_intel_drv.h"
#include "intel_bios.h"
#include "power.h"
void gma_backlight_enable(struct drm_device *dev)
{
struct drm_psb_private *dev_priv = to_drm_psb_private(dev);
dev_priv->backlight_enabled = true;
dev_priv->ops->backlight_set(dev, dev_priv->backlight_level);
}
void gma_backlight_disable(struct drm_device *dev)
{
struct drm_psb_private *dev_priv = to_drm_psb_private(dev);
dev_priv->backlight_enabled = false;
dev_priv->ops->backlight_set(dev, 0);
}
void gma_backlight_set(struct drm_device *dev, int v)
{
struct drm_psb_private *dev_priv = to_drm_psb_private(dev);
dev_priv->backlight_level = v;
if (dev_priv->backlight_enabled)
dev_priv->ops->backlight_set(dev, v);
}
static int gma_backlight_get_brightness(struct backlight_device *bd)
{
struct drm_device *dev = bl_get_data(bd);
struct drm_psb_private *dev_priv = to_drm_psb_private(dev);
if (dev_priv->ops->backlight_get)
return dev_priv->ops->backlight_get(dev);
return dev_priv->backlight_level;
}
static int gma_backlight_update_status(struct backlight_device *bd)
{
struct drm_device *dev = bl_get_data(bd);
int level = backlight_get_brightness(bd);
/* Percentage 1-100% being valid */
if (level < 1)
level = 1;
gma_backlight_set(dev, level);
return 0;
}
static const struct backlight_ops gma_backlight_ops __maybe_unused = {
.get_brightness = gma_backlight_get_brightness,
.update_status = gma_backlight_update_status,
};
int gma_backlight_init(struct drm_device *dev)
{
struct drm_psb_private *dev_priv = to_drm_psb_private(dev);
struct backlight_properties props __maybe_unused = {};
int ret;
dev_priv->backlight_enabled = true;
dev_priv->backlight_level = 100;
ret = dev_priv->ops->backlight_init(dev);
if (ret)
return ret;
if (!acpi_video_backlight_use_native()) {
drm_info(dev, "Skipping %s backlight registration\n",
Annotation
- Immediate include surface: `linux/backlight.h`, `acpi/video.h`, `drm/drm_print.h`, `psb_drv.h`, `psb_intel_reg.h`, `psb_intel_drv.h`, `intel_bios.h`, `power.h`.
- Detected declarations: `function Copyright`, `function gma_backlight_disable`, `function gma_backlight_set`, `function gma_backlight_get_brightness`, `function gma_backlight_update_status`, `function gma_backlight_init`, `function gma_backlight_exit`.
- 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.