drivers/gpu/drm/drm_panel.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/drm_panel.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/drm_panel.c- Extension
.c- Size
- 21394 bytes
- Lines
- 759
- Domain
- Driver Families
- Bucket
- drivers/gpu
- Inferred role
- Driver Families: exported/initcall integration point
- Status
- integration 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.
- Exports symbols or registers init work; inspect boot/module ordering and who consumes the exported contract.
- 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/backlight.hlinux/err.hlinux/export.hlinux/module.hlinux/of.hdrm/drm_crtc.hdrm/drm_panel.hdrm/drm_print.h
Detected Declarations
function drm_panel_bridge_addfunction devm_drm_panel_allocfunction drm_panel_removefunction drm_panel_add_releasefunction devm_drm_panel_allocfunction drm_panel_disablefunction list_for_each_entryfunction panelfunction shutdownfunction list_for_each_entryfunction drm_panel_enablefunction list_for_each_entryfunction drm_panel_disablefunction shutdownfunction list_for_each_entryfunction failurefunction __drm_panel_freefunction drm_panel_putfunction drm_panel_putfunction ERR_PTRfunction list_for_each_entryfunction of_drm_get_panel_orientationfunction list_for_each_entryfunction drm_is_panel_followerfunction drm_panel_add_followerfunction drm_panel_remove_followerfunction drm_panel_remove_follower_voidfunction devm_drm_panel_add_followerfunction drm_panel_of_backlightexport drm_panel_addexport drm_panel_removeexport devm_drm_panel_addexport drm_panel_prepareexport drm_panel_unprepareexport drm_panel_enableexport drm_panel_disableexport drm_panel_get_modesexport drm_panel_getexport drm_panel_putexport __devm_drm_panel_allocexport of_drm_find_panelexport of_drm_get_panel_orientationexport drm_is_panel_followerexport drm_panel_add_followerexport drm_panel_remove_followerexport devm_drm_panel_add_followerexport drm_panel_of_backlight
Annotated Snippet
if (panel->dev->of_node == np) {
mutex_unlock(&panel_lock);
return panel;
}
}
mutex_unlock(&panel_lock);
return ERR_PTR(-EPROBE_DEFER);
}
EXPORT_SYMBOL(of_drm_find_panel);
/**
* of_drm_get_panel_orientation - look up the orientation of the panel through
* the "rotation" binding from a device tree node
* @np: device tree node of the panel
* @orientation: orientation enum to be filled in
*
* Looks up the rotation of a panel in the device tree. The orientation of the
* panel is expressed as a property name "rotation" in the device tree. The
* rotation in the device tree is counter clockwise.
*
* Return: 0 when a valid rotation value (0, 90, 180, or 270) is read or the
* rotation property doesn't exist. Return a negative error code on failure.
*/
int of_drm_get_panel_orientation(const struct device_node *np,
enum drm_panel_orientation *orientation)
{
int rotation, ret;
ret = of_property_read_u32(np, "rotation", &rotation);
if (ret == -EINVAL) {
/* Don't return an error if there's no rotation property. */
*orientation = DRM_MODE_PANEL_ORIENTATION_UNKNOWN;
return 0;
}
if (ret < 0)
return ret;
if (rotation == 0)
*orientation = DRM_MODE_PANEL_ORIENTATION_NORMAL;
else if (rotation == 90)
*orientation = DRM_MODE_PANEL_ORIENTATION_RIGHT_UP;
else if (rotation == 180)
*orientation = DRM_MODE_PANEL_ORIENTATION_BOTTOM_UP;
else if (rotation == 270)
*orientation = DRM_MODE_PANEL_ORIENTATION_LEFT_UP;
else
return -EINVAL;
return 0;
}
EXPORT_SYMBOL(of_drm_get_panel_orientation);
#endif
/* Find panel by fwnode. This should be identical to of_drm_find_panel(). */
static struct drm_panel *find_panel_by_fwnode(const struct fwnode_handle *fwnode)
{
struct drm_panel *panel;
if (!fwnode_device_is_available(fwnode))
return ERR_PTR(-ENODEV);
mutex_lock(&panel_lock);
list_for_each_entry(panel, &panel_list, list) {
if (dev_fwnode(panel->dev) == fwnode) {
mutex_unlock(&panel_lock);
return panel;
}
}
mutex_unlock(&panel_lock);
return ERR_PTR(-EPROBE_DEFER);
}
/* Find panel by follower device */
static struct drm_panel *find_panel_by_dev(struct device *follower_dev)
{
struct fwnode_handle *fwnode;
struct drm_panel *panel;
fwnode = fwnode_find_reference(dev_fwnode(follower_dev), "panel", 0);
if (IS_ERR(fwnode))
return ERR_PTR(-ENODEV);
panel = find_panel_by_fwnode(fwnode);
fwnode_handle_put(fwnode);
Annotation
- Immediate include surface: `linux/backlight.h`, `linux/err.h`, `linux/export.h`, `linux/module.h`, `linux/of.h`, `drm/drm_crtc.h`, `drm/drm_panel.h`, `drm/drm_print.h`.
- Detected declarations: `function drm_panel_bridge_add`, `function devm_drm_panel_alloc`, `function drm_panel_remove`, `function drm_panel_add_release`, `function devm_drm_panel_alloc`, `function drm_panel_disable`, `function list_for_each_entry`, `function panel`, `function shutdown`, `function list_for_each_entry`.
- Atlas domain: Driver Families / drivers/gpu.
- Implementation status: integration 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.