drivers/gpu/drm/panel/panel-renesas-r69328.c

Source file repositories/reference/linux-study-clean/drivers/gpu/drm/panel/panel-renesas-r69328.c

File Facts

System
Linux kernel
Corpus path
drivers/gpu/drm/panel/panel-renesas-r69328.c
Extension
.c
Size
7115 bytes
Lines
256
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 renesas_r69328 {
	struct drm_panel panel;
	struct mipi_dsi_device *dsi;

	struct regulator *vdd_supply;
	struct regulator *vddio_supply;
	struct gpio_desc *reset_gpio;
};

static inline struct renesas_r69328 *to_renesas_r69328(struct drm_panel *panel)
{
	return container_of(panel, struct renesas_r69328, panel);
}

static void renesas_r69328_reset(struct renesas_r69328 *priv)
{
	gpiod_set_value_cansleep(priv->reset_gpio, 1);
	usleep_range(10000, 11000);
	gpiod_set_value_cansleep(priv->reset_gpio, 0);
	usleep_range(2000, 3000);
}

static int renesas_r69328_prepare(struct drm_panel *panel)
{
	struct renesas_r69328 *priv = to_renesas_r69328(panel);
	struct device *dev = &priv->dsi->dev;
	int ret;

	ret = regulator_enable(priv->vdd_supply);
	if (ret) {
		dev_err(dev, "failed to enable vdd power supply\n");
		return ret;
	}

	usleep_range(10000, 11000);

	ret = regulator_enable(priv->vddio_supply);
	if (ret < 0) {
		dev_err(dev, "failed to enable vddio power supply\n");
		return ret;
	}

	usleep_range(10000, 11000);

	renesas_r69328_reset(priv);

	return 0;
}

static int renesas_r69328_enable(struct drm_panel *panel)
{
	struct renesas_r69328 *priv = to_renesas_r69328(panel);
	struct mipi_dsi_multi_context ctx = { .dsi = priv->dsi };

	/* Set address mode */
	mipi_dsi_dcs_write_seq_multi(&ctx, MIPI_DCS_SET_ADDRESS_MODE, 0x00);
	mipi_dsi_dcs_set_pixel_format_multi(&ctx, MIPI_DCS_PIXEL_FMT_24BIT << 4);
	mipi_dsi_dcs_exit_sleep_mode_multi(&ctx);

	mipi_dsi_msleep(&ctx, 100);

	/* MACP Off */
	mipi_dsi_generic_write_seq_multi(&ctx, R69328_MACP, R69328_MACP_OFF);

	mipi_dsi_generic_write_seq_multi(&ctx, R69328_POWER_SET, 0x14, 0x1d,
					 0x21, 0x67, 0x11, 0x9a);

	mipi_dsi_generic_write_seq_multi(&ctx, R69328_GAMMA_SET_A, 0x00, 0x1a,
					 0x20, 0x28, 0x25, 0x24, 0x26, 0x15, 0x13,
					 0x11, 0x18, 0x1e, 0x1c, 0x00, 0x00, 0x1a,
					 0x20, 0x28, 0x25, 0x24, 0x26, 0x15, 0x13,
					 0x11, 0x18, 0x1e, 0x1c, 0x00);

	mipi_dsi_generic_write_seq_multi(&ctx, R69328_GAMMA_SET_B, 0x00, 0x1a,
					 0x20, 0x28, 0x25, 0x24, 0x26, 0x15, 0x13,
					 0x11, 0x18, 0x1e, 0x1c, 0x00, 0x00, 0x1a,
					 0x20, 0x28, 0x25, 0x24, 0x26, 0x15, 0x13,
					 0x11, 0x18, 0x1e, 0x1c, 0x00);

	mipi_dsi_generic_write_seq_multi(&ctx, R69328_GAMMA_SET_C, 0x00, 0x1a,
					 0x20, 0x28, 0x25, 0x24, 0x26, 0x15, 0x13,
					 0x11, 0x18, 0x1e, 0x1c, 0x00, 0x00, 0x1a,
					 0x20, 0x28, 0x25, 0x24, 0x26, 0x15, 0x13,
					 0x11, 0x18, 0x1e, 0x1c, 0x00);

	/* MACP On */
	mipi_dsi_generic_write_seq_multi(&ctx, R69328_MACP, R69328_MACP_ON);

	mipi_dsi_dcs_set_display_on_multi(&ctx);
	mipi_dsi_msleep(&ctx, 50);

Annotation

Implementation Notes