drivers/gpu/drm/gma500/psb_intel_lvds.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/gma500/psb_intel_lvds.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/gma500/psb_intel_lvds.c- Extension
.c- Size
- 22617 bytes
- Lines
- 807
- 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.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- 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/i2c.hlinux/pm_runtime.hdrm/drm_crtc_helper.hdrm/drm_modeset_helper_vtables.hdrm/drm_print.hdrm/drm_simple_kms_helper.hintel_bios.hpower.hpsb_drv.hpsb_intel_drv.hpsb_intel_reg.h
Detected Declarations
struct psb_intel_lvds_privfunction psb_intel_lvds_get_max_backlightfunction nilfunction psb_lvds_pwm_set_brightnessfunction psb_intel_lvds_set_brightnessfunction psb_intel_lvds_set_backlightfunction psb_intel_lvds_set_powerfunction psb_intel_lvds_encoder_dpmsfunction psb_intel_lvds_savefunction psb_intel_lvds_restorefunction psb_intel_lvds_mode_validfunction psb_intel_lvds_mode_fixupfunction psb_intel_lvds_preparefunction psb_intel_lvds_commitfunction psb_intel_lvds_mode_setfunction psb_intel_lvds_get_modesfunction psb_intel_lvds_destroyfunction psb_intel_lvds_set_propertyfunction panelfunction list_for_each_entry
Annotated Snippet
struct psb_intel_lvds_priv {
/*
* Saved LVDO output states
*/
uint32_t savePP_ON;
uint32_t savePP_OFF;
uint32_t saveLVDS;
uint32_t savePP_CONTROL;
uint32_t savePP_CYCLE;
uint32_t savePFIT_CONTROL;
uint32_t savePFIT_PGM_RATIOS;
uint32_t saveBLC_PWM_CTL;
struct gma_i2c_chan *i2c_bus;
};
/*
* Returns the maximum level of the backlight duty cycle field.
*/
static u32 psb_intel_lvds_get_max_backlight(struct drm_device *dev)
{
struct drm_psb_private *dev_priv = to_drm_psb_private(dev);
u32 ret;
if (gma_power_begin(dev, false)) {
ret = REG_READ(BLC_PWM_CTL);
gma_power_end(dev);
} else /* Powered off, use the saved value */
ret = dev_priv->regs.saveBLC_PWM_CTL;
/* Top 15bits hold the frequency mask */
ret = (ret & BACKLIGHT_MODULATION_FREQ_MASK) >>
BACKLIGHT_MODULATION_FREQ_SHIFT;
ret *= 2; /* Return a 16bit range as needed for setting */
if (ret == 0)
dev_err(dev->dev, "BL bug: Reg %08x save %08X\n",
REG_READ(BLC_PWM_CTL), dev_priv->regs.saveBLC_PWM_CTL);
return ret;
}
/*
* Set LVDS backlight level by I2C command
*
* FIXME: at some point we need to both track this for PM and also
* disable runtime pm on MRST if the brightness is nil (ie blanked)
*/
static int psb_lvds_i2c_set_brightness(struct drm_device *dev,
unsigned int level)
{
struct drm_psb_private *dev_priv = to_drm_psb_private(dev);
struct gma_i2c_chan *lvds_i2c_bus = dev_priv->lvds_i2c_bus;
u8 out_buf[2];
unsigned int blc_i2c_brightness;
struct i2c_msg msgs[] = {
{
.addr = lvds_i2c_bus->target_addr,
.flags = 0,
.len = 2,
.buf = out_buf,
}
};
blc_i2c_brightness = BRIGHTNESS_MASK & ((unsigned int)level *
BRIGHTNESS_MASK /
BRIGHTNESS_MAX_LEVEL);
if (dev_priv->lvds_bl->pol == BLC_POLARITY_INVERSE)
blc_i2c_brightness = BRIGHTNESS_MASK - blc_i2c_brightness;
out_buf[0] = dev_priv->lvds_bl->brightnesscmd;
out_buf[1] = (u8)blc_i2c_brightness;
if (i2c_transfer(&lvds_i2c_bus->base, msgs, 1) == 1) {
dev_dbg(dev->dev, "I2C set brightness.(command, value) (%d, %d)\n",
dev_priv->lvds_bl->brightnesscmd,
blc_i2c_brightness);
return 0;
}
dev_err(dev->dev, "I2C transfer error\n");
return -1;
}
static int psb_lvds_pwm_set_brightness(struct drm_device *dev, int level)
{
Annotation
- Immediate include surface: `linux/i2c.h`, `linux/pm_runtime.h`, `drm/drm_crtc_helper.h`, `drm/drm_modeset_helper_vtables.h`, `drm/drm_print.h`, `drm/drm_simple_kms_helper.h`, `intel_bios.h`, `power.h`.
- Detected declarations: `struct psb_intel_lvds_priv`, `function psb_intel_lvds_get_max_backlight`, `function nil`, `function psb_lvds_pwm_set_brightness`, `function psb_intel_lvds_set_brightness`, `function psb_intel_lvds_set_backlight`, `function psb_intel_lvds_set_power`, `function psb_intel_lvds_encoder_dpms`, `function psb_intel_lvds_save`, `function psb_intel_lvds_restore`.
- Atlas domain: Driver Families / drivers/gpu.
- Implementation status: source implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
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.