drivers/gpu/drm/panel/panel-chipwealth-ch13726a.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/panel/panel-chipwealth-ch13726a.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/panel/panel-chipwealth-ch13726a.c- Extension
.c- Size
- 8389 bytes
- Lines
- 334
- 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/backlight.hlinux/delay.hlinux/gpio/consumer.hlinux/module.hlinux/of.hlinux/regulator/consumer.hdrm/drm_mipi_dsi.hdrm/drm_modes.hdrm/drm_panel.hvideo/mipi_display.h
Detected Declarations
struct ch13726a_panelstruct ch13726a_descfunction ch13726a_resetfunction ch13726a_onfunction ch13726a_disablefunction ch13726a_preparefunction ch13726a_unpreparefunction ch13726a_get_modesfunction ch13726a_get_orientationfunction ch13726a_bl_update_statusfunction ch13726a_create_backlightfunction ch13726a_probefunction ch13726a_remove
Annotated Snippet
struct ch13726a_panel {
struct drm_panel panel;
struct mipi_dsi_device *dsi;
struct regulator_bulk_data *supplies;
struct gpio_desc *reset_gpio;
struct ch13726a_desc *desc;
enum drm_panel_orientation orientation;
};
struct ch13726a_desc {
unsigned int width_mm;
unsigned int height_mm;
unsigned int bpc;
const struct drm_display_mode *modes;
unsigned int num_modes;
};
static inline struct ch13726a_panel *to_ch13726a_panel(struct drm_panel *panel)
{
return container_of(panel, struct ch13726a_panel, panel);
}
static void ch13726a_reset(struct ch13726a_panel *ctx)
{
gpiod_set_value_cansleep(ctx->reset_gpio, 0);
usleep_range(10000, 11000);
gpiod_set_value_cansleep(ctx->reset_gpio, 1);
usleep_range(10000, 11000);
gpiod_set_value_cansleep(ctx->reset_gpio, 0);
usleep_range(10000, 11000);
}
static int ch13726a_on(struct ch13726a_panel *ctx)
{
struct mipi_dsi_multi_context dsi_ctx = { .dsi = ctx->dsi };
ctx->dsi->mode_flags |= MIPI_DSI_MODE_LPM;
mipi_dsi_generic_write_seq_multi(&dsi_ctx, 0xf0, 0x50);
mipi_dsi_generic_write_seq_multi(&dsi_ctx, 0xb9, 0x00);
mipi_dsi_dcs_exit_sleep_mode_multi(&dsi_ctx);
mipi_dsi_dcs_set_display_on_multi(&dsi_ctx);
return dsi_ctx.accum_err;
}
static int ch13726a_disable(struct drm_panel *panel)
{
struct ch13726a_panel *ctx = to_ch13726a_panel(panel);
struct mipi_dsi_multi_context dsi_ctx = { .dsi = ctx->dsi };
ctx->dsi->mode_flags &= ~MIPI_DSI_MODE_LPM;
mipi_dsi_dcs_set_display_off_multi(&dsi_ctx);
mipi_dsi_msleep(&dsi_ctx, 50);
mipi_dsi_dcs_enter_sleep_mode_multi(&dsi_ctx);
return dsi_ctx.accum_err;
}
static int ch13726a_prepare(struct drm_panel *panel)
{
struct ch13726a_panel *ctx = to_ch13726a_panel(panel);
struct device *dev = &ctx->dsi->dev;
int ret;
ret = regulator_bulk_enable(ARRAY_SIZE(ch13726a_supplies), ctx->supplies);
if (ret < 0) {
dev_err(dev, "Failed to enable regulators: %d\n", ret);
return ret;
}
ch13726a_reset(ctx);
ret = ch13726a_on(ctx);
if (ret < 0) {
dev_err(dev, "Failed to initialize panel: %d\n", ret);
gpiod_set_value_cansleep(ctx->reset_gpio, 1);
regulator_bulk_disable(ARRAY_SIZE(ch13726a_supplies), ctx->supplies);
return ret;
}
msleep(28);
return 0;
}
Annotation
- Immediate include surface: `linux/backlight.h`, `linux/delay.h`, `linux/gpio/consumer.h`, `linux/module.h`, `linux/of.h`, `linux/regulator/consumer.h`, `drm/drm_mipi_dsi.h`, `drm/drm_modes.h`.
- Detected declarations: `struct ch13726a_panel`, `struct ch13726a_desc`, `function ch13726a_reset`, `function ch13726a_on`, `function ch13726a_disable`, `function ch13726a_prepare`, `function ch13726a_unprepare`, `function ch13726a_get_modes`, `function ch13726a_get_orientation`, `function ch13726a_bl_update_status`.
- 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.