drivers/gpu/drm/panel/panel-ronbo-rb070d30.c

Source file repositories/reference/linux-study-clean/drivers/gpu/drm/panel/panel-ronbo-rb070d30.c

File Facts

System
Linux kernel
Corpus path
drivers/gpu/drm/panel/panel-ronbo-rb070d30.c
Extension
.c
Size
6102 bytes
Lines
238
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.

Dependency Surface

Detected Declarations

Annotated Snippet

struct rb070d30_panel {
	struct drm_panel panel;
	struct mipi_dsi_device *dsi;
	struct regulator *supply;

	struct {
		struct gpio_desc *power;
		struct gpio_desc *reset;
		struct gpio_desc *updn;
		struct gpio_desc *shlr;
	} gpios;
};

static inline struct rb070d30_panel *panel_to_rb070d30_panel(struct drm_panel *panel)
{
	return container_of(panel, struct rb070d30_panel, panel);
}

static int rb070d30_panel_prepare(struct drm_panel *panel)
{
	struct rb070d30_panel *ctx = panel_to_rb070d30_panel(panel);
	int ret;

	ret = regulator_enable(ctx->supply);
	if (ret < 0) {
		dev_err(&ctx->dsi->dev, "Failed to enable supply: %d\n", ret);
		return ret;
	}

	msleep(20);
	gpiod_set_value_cansleep(ctx->gpios.power, 1);
	msleep(20);
	gpiod_set_value_cansleep(ctx->gpios.reset, 1);
	msleep(20);
	return 0;
}

static int rb070d30_panel_unprepare(struct drm_panel *panel)
{
	struct rb070d30_panel *ctx = panel_to_rb070d30_panel(panel);

	gpiod_set_value_cansleep(ctx->gpios.reset, 0);
	gpiod_set_value_cansleep(ctx->gpios.power, 0);
	regulator_disable(ctx->supply);

	return 0;
}

static int rb070d30_panel_enable(struct drm_panel *panel)
{
	struct rb070d30_panel *ctx = panel_to_rb070d30_panel(panel);

	return mipi_dsi_dcs_exit_sleep_mode(ctx->dsi);
}

static int rb070d30_panel_disable(struct drm_panel *panel)
{
	struct rb070d30_panel *ctx = panel_to_rb070d30_panel(panel);

	return mipi_dsi_dcs_enter_sleep_mode(ctx->dsi);
}

/* Default timings */
static const struct drm_display_mode default_mode = {
	.clock		= 51206,
	.hdisplay	= 1024,
	.hsync_start	= 1024 + 160,
	.hsync_end	= 1024 + 160 + 80,
	.htotal		= 1024 + 160 + 80 + 80,
	.vdisplay	= 600,
	.vsync_start	= 600 + 12,
	.vsync_end	= 600 + 12 + 10,
	.vtotal		= 600 + 12 + 10 + 13,

	.width_mm	= 154,
	.height_mm	= 85,
};

static int rb070d30_panel_get_modes(struct drm_panel *panel,
				    struct drm_connector *connector)
{
	struct rb070d30_panel *ctx = panel_to_rb070d30_panel(panel);
	struct drm_display_mode *mode;
	static const u32 bus_format = MEDIA_BUS_FMT_RGB888_1X24;

	mode = drm_mode_duplicate(connector->dev, &default_mode);
	if (!mode) {
		dev_err(&ctx->dsi->dev, "Failed to add mode " DRM_MODE_FMT "\n",
			DRM_MODE_ARG(&default_mode));
		return -EINVAL;

Annotation

Implementation Notes