drivers/gpu/drm/panel/panel-lvds.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/panel/panel-lvds.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/panel/panel-lvds.c- Extension
.c- Size
- 6033 bytes
- Lines
- 257
- 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/gpio/consumer.hlinux/module.hlinux/of.hlinux/platform_device.hlinux/regulator/consumer.hlinux/slab.hvideo/display_timing.hvideo/of_display_timing.hvideo/videomode.hdrm/drm_crtc.hdrm/drm_of.hdrm/drm_panel.h
Detected Declarations
struct panel_lvdsfunction panel_lvds_unpreparefunction panel_lvds_preparefunction panel_lvds_get_modesfunction panel_lvds_get_orientationfunction panel_lvds_parse_dtfunction panel_lvds_probefunction panel_lvds_remove
Annotated Snippet
struct panel_lvds {
struct drm_panel panel;
struct device *dev;
const char *label;
struct drm_display_mode dmode;
u32 bus_flags;
unsigned int bus_format;
struct regulator *supply;
struct gpio_desc *enable_gpio;
struct gpio_desc *reset_gpio;
enum drm_panel_orientation orientation;
};
static inline struct panel_lvds *to_panel_lvds(struct drm_panel *panel)
{
return container_of(panel, struct panel_lvds, panel);
}
static int panel_lvds_unprepare(struct drm_panel *panel)
{
struct panel_lvds *lvds = to_panel_lvds(panel);
if (lvds->enable_gpio)
gpiod_set_value_cansleep(lvds->enable_gpio, 0);
if (lvds->supply)
regulator_disable(lvds->supply);
return 0;
}
static int panel_lvds_prepare(struct drm_panel *panel)
{
struct panel_lvds *lvds = to_panel_lvds(panel);
if (lvds->supply) {
int err;
err = regulator_enable(lvds->supply);
if (err < 0) {
dev_err(lvds->dev, "failed to enable supply: %d\n",
err);
return err;
}
}
if (lvds->enable_gpio)
gpiod_set_value_cansleep(lvds->enable_gpio, 1);
return 0;
}
static int panel_lvds_get_modes(struct drm_panel *panel,
struct drm_connector *connector)
{
struct panel_lvds *lvds = to_panel_lvds(panel);
struct drm_display_mode *mode;
mode = drm_mode_duplicate(connector->dev, &lvds->dmode);
if (!mode)
return 0;
mode->type |= DRM_MODE_TYPE_DRIVER | DRM_MODE_TYPE_PREFERRED;
drm_mode_probed_add(connector, mode);
connector->display_info.width_mm = lvds->dmode.width_mm;
connector->display_info.height_mm = lvds->dmode.height_mm;
drm_display_info_set_bus_formats(&connector->display_info,
&lvds->bus_format, 1);
connector->display_info.bus_flags = lvds->bus_flags;
/*
* TODO: Remove once all drm drivers call
* drm_connector_set_orientation_from_panel()
*/
drm_connector_set_panel_orientation(connector, lvds->orientation);
return 1;
}
static enum drm_panel_orientation panel_lvds_get_orientation(struct drm_panel *panel)
{
struct panel_lvds *lvds = to_panel_lvds(panel);
return lvds->orientation;
}
Annotation
- Immediate include surface: `linux/gpio/consumer.h`, `linux/module.h`, `linux/of.h`, `linux/platform_device.h`, `linux/regulator/consumer.h`, `linux/slab.h`, `video/display_timing.h`, `video/of_display_timing.h`.
- Detected declarations: `struct panel_lvds`, `function panel_lvds_unprepare`, `function panel_lvds_prepare`, `function panel_lvds_get_modes`, `function panel_lvds_get_orientation`, `function panel_lvds_parse_dt`, `function panel_lvds_probe`, `function panel_lvds_remove`.
- 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.