drivers/gpu/drm/panel/panel-sharp-lq101r1sx01.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/panel/panel-sharp-lq101r1sx01.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/panel/panel-sharp-lq101r1sx01.c- Extension
.c- Size
- 8810 bytes
- Lines
- 381
- 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/regulator/consumer.hvideo/mipi_display.hdrm/drm_crtc.hdrm/drm_device.hdrm/drm_mipi_dsi.hdrm/drm_panel.h
Detected Declarations
struct sharp_panelfunction sharp_wait_framesfunction sharp_panel_writefunction sharp_panel_readfunction sharp_panel_unpreparefunction sharp_setup_symmetrical_splitfunction sharp_panel_preparefunction sharp_panel_get_modesfunction sharp_panel_addfunction sharp_panel_delfunction sharp_panel_probefunction sharp_panel_remove
Annotated Snippet
struct sharp_panel {
struct drm_panel base;
/* the datasheet refers to them as DSI-LINK1 and DSI-LINK2 */
struct mipi_dsi_device *link1;
struct mipi_dsi_device *link2;
struct regulator *supply;
const struct drm_display_mode *mode;
};
static inline struct sharp_panel *to_sharp_panel(struct drm_panel *panel)
{
return container_of(panel, struct sharp_panel, base);
}
static void sharp_wait_frames(struct sharp_panel *sharp, unsigned int frames)
{
unsigned int refresh = drm_mode_vrefresh(sharp->mode);
if (WARN_ON(frames > refresh))
return;
msleep(1000 / (refresh / frames));
}
static int sharp_panel_write(struct sharp_panel *sharp, u16 offset, u8 value)
{
u8 payload[3] = { offset >> 8, offset & 0xff, value };
struct mipi_dsi_device *dsi = sharp->link1;
ssize_t err;
err = mipi_dsi_generic_write(dsi, payload, sizeof(payload));
if (err < 0) {
dev_err(&dsi->dev, "failed to write %02x to %04x: %zd\n",
value, offset, err);
return err;
}
err = mipi_dsi_dcs_nop(dsi);
if (err < 0) {
dev_err(&dsi->dev, "failed to send DCS nop: %zd\n", err);
return err;
}
usleep_range(10, 20);
return 0;
}
static __maybe_unused int sharp_panel_read(struct sharp_panel *sharp,
u16 offset, u8 *value)
{
ssize_t err;
cpu_to_be16s(&offset);
err = mipi_dsi_generic_read(sharp->link1, &offset, sizeof(offset),
value, sizeof(*value));
if (err < 0)
dev_err(&sharp->link1->dev, "failed to read from %04x: %zd\n",
offset, err);
return err;
}
static int sharp_panel_unprepare(struct drm_panel *panel)
{
struct sharp_panel *sharp = to_sharp_panel(panel);
int err;
sharp_wait_frames(sharp, 4);
err = mipi_dsi_dcs_set_display_off(sharp->link1);
if (err < 0)
dev_err(panel->dev, "failed to set display off: %d\n", err);
err = mipi_dsi_dcs_enter_sleep_mode(sharp->link1);
if (err < 0)
dev_err(panel->dev, "failed to enter sleep mode: %d\n", err);
msleep(120);
regulator_disable(sharp->supply);
return 0;
}
static int sharp_setup_symmetrical_split(struct mipi_dsi_device *left,
struct mipi_dsi_device *right,
Annotation
- Immediate include surface: `linux/delay.h`, `linux/gpio/consumer.h`, `linux/module.h`, `linux/of.h`, `linux/regulator/consumer.h`, `video/mipi_display.h`, `drm/drm_crtc.h`, `drm/drm_device.h`.
- Detected declarations: `struct sharp_panel`, `function sharp_wait_frames`, `function sharp_panel_write`, `function sharp_panel_read`, `function sharp_panel_unprepare`, `function sharp_setup_symmetrical_split`, `function sharp_panel_prepare`, `function sharp_panel_get_modes`, `function sharp_panel_add`, `function sharp_panel_del`.
- 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.