drivers/gpu/drm/panel/panel-sharp-ls037v7dw01.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/panel/panel-sharp-ls037v7dw01.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/panel/panel-sharp-ls037v7dw01.c- Extension
.c- Size
- 5944 bytes
- Lines
- 220
- 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.hlinux/gpio/consumer.hlinux/module.hlinux/of.hlinux/platform_device.hlinux/regulator/consumer.hdrm/drm_connector.hdrm/drm_modes.hdrm/drm_panel.h
Detected Declarations
struct ls037v7dw01_panelfunction ls037v7dw01_disablefunction ls037v7dw01_unpreparefunction ls037v7dw01_preparefunction ls037v7dw01_enablefunction ls037v7dw01_get_modesfunction ls037v7dw01_probefunction ls037v7dw01_remove
Annotated Snippet
struct ls037v7dw01_panel {
struct drm_panel panel;
struct platform_device *pdev;
struct regulator *vdd;
struct gpio_desc *resb_gpio; /* low = reset active min 20 us */
struct gpio_desc *ini_gpio; /* high = power on */
struct gpio_desc *mo_gpio; /* low = 480x640, high = 240x320 */
struct gpio_desc *lr_gpio; /* high = conventional horizontal scanning */
struct gpio_desc *ud_gpio; /* high = conventional vertical scanning */
};
#define to_ls037v7dw01_device(p) \
container_of(p, struct ls037v7dw01_panel, panel)
static int ls037v7dw01_disable(struct drm_panel *panel)
{
struct ls037v7dw01_panel *lcd = to_ls037v7dw01_device(panel);
gpiod_set_value_cansleep(lcd->ini_gpio, 0);
gpiod_set_value_cansleep(lcd->resb_gpio, 0);
/* Wait at least 5 vsyncs after disabling the LCD. */
msleep(100);
return 0;
}
static int ls037v7dw01_unprepare(struct drm_panel *panel)
{
struct ls037v7dw01_panel *lcd = to_ls037v7dw01_device(panel);
regulator_disable(lcd->vdd);
return 0;
}
static int ls037v7dw01_prepare(struct drm_panel *panel)
{
struct ls037v7dw01_panel *lcd = to_ls037v7dw01_device(panel);
int ret;
ret = regulator_enable(lcd->vdd);
if (ret < 0)
dev_err(&lcd->pdev->dev, "%s: failed to enable regulator\n",
__func__);
return ret;
}
static int ls037v7dw01_enable(struct drm_panel *panel)
{
struct ls037v7dw01_panel *lcd = to_ls037v7dw01_device(panel);
/* Wait couple of vsyncs before enabling the LCD. */
msleep(50);
gpiod_set_value_cansleep(lcd->resb_gpio, 1);
gpiod_set_value_cansleep(lcd->ini_gpio, 1);
return 0;
}
static const struct drm_display_mode ls037v7dw01_mode = {
.clock = 19200,
.hdisplay = 480,
.hsync_start = 480 + 1,
.hsync_end = 480 + 1 + 2,
.htotal = 480 + 1 + 2 + 28,
.vdisplay = 640,
.vsync_start = 640 + 1,
.vsync_end = 640 + 1 + 1,
.vtotal = 640 + 1 + 1 + 1,
.type = DRM_MODE_TYPE_DRIVER | DRM_MODE_TYPE_PREFERRED,
.flags = DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC,
.width_mm = 56,
.height_mm = 75,
};
static int ls037v7dw01_get_modes(struct drm_panel *panel,
struct drm_connector *connector)
{
struct drm_display_mode *mode;
mode = drm_mode_duplicate(connector->dev, &ls037v7dw01_mode);
if (!mode)
return -ENOMEM;
drm_mode_set_name(mode);
drm_mode_probed_add(connector, mode);
Annotation
- Immediate include surface: `linux/delay.h`, `linux/gpio/consumer.h`, `linux/module.h`, `linux/of.h`, `linux/platform_device.h`, `linux/regulator/consumer.h`, `drm/drm_connector.h`, `drm/drm_modes.h`.
- Detected declarations: `struct ls037v7dw01_panel`, `function ls037v7dw01_disable`, `function ls037v7dw01_unprepare`, `function ls037v7dw01_prepare`, `function ls037v7dw01_enable`, `function ls037v7dw01_get_modes`, `function ls037v7dw01_probe`, `function ls037v7dw01_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.