drivers/gpu/drm/loongson/lsdc_output_7a1000.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/loongson/lsdc_output_7a1000.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/loongson/lsdc_output_7a1000.c- Extension
.c- Size
- 5134 bytes
- Lines
- 179
- 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_print.hdrm/drm_probe_helper.hlsdc_drv.hlsdc_output.h
Detected Declarations
function Copyrightfunction ls7a1000_dpi_connector_get_best_encoderfunction ls7a1000_dpi_connector_detectfunction ls7a1000_pipe0_encoder_resetfunction ls7a1000_pipe1_encoder_resetfunction ls7a1000_output_init
Annotated Snippet
// SPDX-License-Identifier: GPL-2.0
/*
* Copyright (C) 2023 Loongson Technology Corporation Limited
*/
#include <drm/drm_atomic_helper.h>
#include <drm/drm_edid.h>
#include <drm/drm_print.h>
#include <drm/drm_probe_helper.h>
#include "lsdc_drv.h"
#include "lsdc_output.h"
/*
* The display controller in the LS7A1000 exports two DVO interfaces, thus
* external encoder is required, except connected to the DPI panel directly.
*
* ___________________ _________
* | -------| | |
* | CRTC0 --> | DVO0 ----> Encoder0 ---> Connector0 ---> | Display |
* | _ _ -------| ^ ^ |_________|
* | | | | | +------+ | | |
* | |_| |_| | i2c6 | <--------+-------------+
* | +------+ |
* | |
* | DC in LS7A1000 |
* | |
* | _ _ +------+ |
* | | | | | | i2c7 | <--------+-------------+
* | |_| |_| +------+ | | | _________
* | -------| | | | |
* | CRTC1 --> | DVO1 ----> Encoder1 ---> Connector1 ---> | Panel |
* | -------| |_________|
* |___________________|
*
* Currently, we assume the external encoders connected to the DVO are
* transparent. Loongson's DVO interface can directly drive RGB888 panels.
*
* TODO: Add support for non-transparent encoders
*/
static int ls7a1000_dpi_connector_get_modes(struct drm_connector *conn)
{
int num;
if (conn->ddc) {
const struct drm_edid *drm_edid;
drm_edid = drm_edid_read(conn);
drm_edid_connector_update(conn, drm_edid);
num = drm_edid_connector_add_modes(conn);
drm_edid_free(drm_edid);
return num;
}
num = drm_add_modes_noedid(conn, 1920, 1200);
drm_set_preferred_mode(conn, 1024, 768);
return num;
}
static struct drm_encoder *
ls7a1000_dpi_connector_get_best_encoder(struct drm_connector *connector,
struct drm_atomic_commit *state)
{
struct lsdc_output *output = connector_to_lsdc_output(connector);
return &output->encoder;
}
static const struct drm_connector_helper_funcs
ls7a1000_dpi_connector_helpers = {
.atomic_best_encoder = ls7a1000_dpi_connector_get_best_encoder,
.get_modes = ls7a1000_dpi_connector_get_modes,
};
static enum drm_connector_status
ls7a1000_dpi_connector_detect(struct drm_connector *connector, bool force)
{
struct i2c_adapter *ddc = connector->ddc;
if (ddc) {
if (drm_probe_ddc(ddc))
return connector_status_connected;
return connector_status_disconnected;
}
Annotation
- Immediate include surface: `drm/drm_atomic_helper.h`, `drm/drm_edid.h`, `drm/drm_print.h`, `drm/drm_probe_helper.h`, `lsdc_drv.h`, `lsdc_output.h`.
- Detected declarations: `function Copyright`, `function ls7a1000_dpi_connector_get_best_encoder`, `function ls7a1000_dpi_connector_detect`, `function ls7a1000_pipe0_encoder_reset`, `function ls7a1000_pipe1_encoder_reset`, `function ls7a1000_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.