drivers/gpu/drm/mgag200/mgag200_vga_bmc.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/mgag200/mgag200_vga_bmc.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/mgag200/mgag200_vga_bmc.c- Extension
.c- Size
- 4796 bytes
- Lines
- 158
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
drm/drm_atomic_helper.hdrm/drm_edid.hdrm/drm_modeset_helper_vtables.hdrm/drm_print.hdrm/drm_probe_helper.hmgag200_ddc.hmgag200_drv.h
Detected Declarations
function mgag200_vga_bmc_encoder_atomic_disablefunction mgag200_vga_bmc_encoder_atomic_enablefunction mgag200_vga_bmc_encoder_atomic_checkfunction mgag200_vga_bmc_connector_helper_get_modesfunction mgag200_vga_bmc_connector_helper_detect_ctxfunction mgag200_vga_bmc_output_init
Annotated Snippet
// SPDX-License-Identifier: GPL-2.0-only
#include <drm/drm_atomic_helper.h>
#include <drm/drm_edid.h>
#include <drm/drm_modeset_helper_vtables.h>
#include <drm/drm_print.h>
#include <drm/drm_probe_helper.h>
#include "mgag200_ddc.h"
#include "mgag200_drv.h"
static void mgag200_vga_bmc_encoder_atomic_disable(struct drm_encoder *encoder,
struct drm_atomic_commit *state)
{
struct mga_device *mdev = to_mga_device(encoder->dev);
if (mdev->info->sync_bmc)
mgag200_bmc_stop_scanout(mdev);
}
static void mgag200_vga_bmc_encoder_atomic_enable(struct drm_encoder *encoder,
struct drm_atomic_commit *state)
{
struct mga_device *mdev = to_mga_device(encoder->dev);
if (mdev->info->sync_bmc)
mgag200_bmc_start_scanout(mdev);
}
static int mgag200_vga_bmc_encoder_atomic_check(struct drm_encoder *encoder,
struct drm_crtc_state *new_crtc_state,
struct drm_connector_state *new_connector_state)
{
struct mga_device *mdev = to_mga_device(encoder->dev);
struct mgag200_crtc_state *new_mgag200_crtc_state = to_mgag200_crtc_state(new_crtc_state);
new_mgag200_crtc_state->set_vidrst = mdev->info->sync_bmc;
return 0;
}
static const struct drm_encoder_helper_funcs mgag200_dac_encoder_helper_funcs = {
.atomic_disable = mgag200_vga_bmc_encoder_atomic_disable,
.atomic_enable = mgag200_vga_bmc_encoder_atomic_enable,
.atomic_check = mgag200_vga_bmc_encoder_atomic_check,
};
static const struct drm_encoder_funcs mgag200_dac_encoder_funcs = {
.destroy = drm_encoder_cleanup
};
static int mgag200_vga_bmc_connector_helper_get_modes(struct drm_connector *connector)
{
struct mga_device *mdev = to_mga_device(connector->dev);
const struct mgag200_device_info *minfo = mdev->info;
int count;
count = drm_connector_helper_get_modes(connector);
if (!count) {
/*
* There's no EDID data without a connected monitor. Set BMC-
* compatible modes in this case. The XGA default resolution
* should work well for all BMCs.
*/
count = drm_add_modes_noedid(connector, minfo->max_hdisplay, minfo->max_vdisplay);
if (count)
drm_set_preferred_mode(connector, 1024, 768);
}
return count;
}
/*
* There's no monitor connected if the DDC did not return an EDID. Still
* return 'connected' as there's always a BMC. Incrementing the connector's
* epoch counter triggers an update of the related properties.
*/
static int mgag200_vga_bmc_connector_helper_detect_ctx(struct drm_connector *connector,
struct drm_modeset_acquire_ctx *ctx,
bool force)
{
enum drm_connector_status old_status, status;
if (connector->edid_blob_ptr)
old_status = connector_status_connected;
else
old_status = connector_status_disconnected;
status = drm_connector_helper_detect_from_ddc(connector, ctx, force);
Annotation
- Immediate include surface: `drm/drm_atomic_helper.h`, `drm/drm_edid.h`, `drm/drm_modeset_helper_vtables.h`, `drm/drm_print.h`, `drm/drm_probe_helper.h`, `mgag200_ddc.h`, `mgag200_drv.h`.
- Detected declarations: `function mgag200_vga_bmc_encoder_atomic_disable`, `function mgag200_vga_bmc_encoder_atomic_enable`, `function mgag200_vga_bmc_encoder_atomic_check`, `function mgag200_vga_bmc_connector_helper_get_modes`, `function mgag200_vga_bmc_connector_helper_detect_ctx`, `function mgag200_vga_bmc_output_init`.
- 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.