drivers/gpu/drm/gma500/cdv_device.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/gma500/cdv_device.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/gma500/cdv_device.c- Extension
.c- Size
- 15826 bytes
- Lines
- 600
- 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/delay.hdrm/drm.hdrm/drm_crtc_helper.hdrm/drm_print.hcdv_device.hgma_device.hintel_bios.hpsb_drv.hpsb_intel_reg.hpsb_reg.h
Detected Declarations
function Copyrightfunction cdv_output_initfunction cdv_backlight_combination_modefunction cdv_get_max_backlightfunction cdv_get_brightnessfunction cdv_set_brightnessfunction cdv_backlight_initfunction CDV_MSG_READ32function CDV_MSG_WRITE32function cdv_init_pmfunction cdv_erratafunction cdv_save_display_registersfunction cdv_restore_display_registersfunction cdv_power_downfunction cdv_power_upfunction cdv_hotplug_work_funcfunction cdv_hotplug_eventfunction cdv_hotplug_enablefunction cdv_intel_attach_force_audio_propertyfunction cdv_intel_attach_broadcast_rgb_propertyfunction cdv_chip_setup
Annotated Snippet
// SPDX-License-Identifier: GPL-2.0-only
/**************************************************************************
* Copyright (c) 2011, Intel Corporation.
* All Rights Reserved.
*
**************************************************************************/
#include <linux/delay.h>
#include <drm/drm.h>
#include <drm/drm_crtc_helper.h>
#include <drm/drm_print.h>
#include "cdv_device.h"
#include "gma_device.h"
#include "intel_bios.h"
#include "psb_drv.h"
#include "psb_intel_reg.h"
#include "psb_reg.h"
#define VGA_SR_INDEX 0x3c4
#define VGA_SR_DATA 0x3c5
static void cdv_disable_vga(struct drm_device *dev)
{
u8 sr1;
u32 vga_reg;
vga_reg = VGACNTRL;
outb(1, VGA_SR_INDEX);
sr1 = inb(VGA_SR_DATA);
outb(sr1 | 1<<5, VGA_SR_DATA);
udelay(300);
REG_WRITE(vga_reg, VGA_DISP_DISABLE);
REG_READ(vga_reg);
}
static int cdv_output_init(struct drm_device *dev)
{
struct drm_psb_private *dev_priv = to_drm_psb_private(dev);
drm_mode_create_scaling_mode_property(dev);
cdv_disable_vga(dev);
cdv_intel_crt_init(dev, &dev_priv->mode_dev);
cdv_intel_lvds_init(dev, &dev_priv->mode_dev);
/* These bits indicate HDMI not SDVO on CDV */
if (REG_READ(SDVOB) & SDVO_DETECTED) {
cdv_hdmi_init(dev, &dev_priv->mode_dev, SDVOB);
if (REG_READ(DP_B) & DP_DETECTED)
cdv_intel_dp_init(dev, &dev_priv->mode_dev, DP_B);
}
if (REG_READ(SDVOC) & SDVO_DETECTED) {
cdv_hdmi_init(dev, &dev_priv->mode_dev, SDVOC);
if (REG_READ(DP_C) & DP_DETECTED)
cdv_intel_dp_init(dev, &dev_priv->mode_dev, DP_C);
}
return 0;
}
/*
* Cedartrail Backlght Interfaces
*/
static int cdv_backlight_combination_mode(struct drm_device *dev)
{
return REG_READ(BLC_PWM_CTL2) & PWM_LEGACY_MODE;
}
static u32 cdv_get_max_backlight(struct drm_device *dev)
{
u32 max = REG_READ(BLC_PWM_CTL);
if (max == 0) {
DRM_DEBUG_KMS("LVDS Panel PWM value is 0!\n");
/* i915 does this, I believe which means that we should not
* smash PWM control as firmware will take control of it. */
return 1;
}
max >>= 16;
if (cdv_backlight_combination_mode(dev))
max *= 0xff;
return max;
}
Annotation
- Immediate include surface: `linux/delay.h`, `drm/drm.h`, `drm/drm_crtc_helper.h`, `drm/drm_print.h`, `cdv_device.h`, `gma_device.h`, `intel_bios.h`, `psb_drv.h`.
- Detected declarations: `function Copyright`, `function cdv_output_init`, `function cdv_backlight_combination_mode`, `function cdv_get_max_backlight`, `function cdv_get_brightness`, `function cdv_set_brightness`, `function cdv_backlight_init`, `function CDV_MSG_READ32`, `function CDV_MSG_WRITE32`, `function cdv_init_pm`.
- 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.