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

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

File Facts

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

	struct regulator *vcc_supply;
	struct regulator *iovcc_supply;

	struct gpio_desc *reset_gpio;

	bool dig_cont_adj;
	bool inversion;
	u32 gamma;
};

static const u8 gamma_setting[][25] = {
	{ /* sentinel */ },
	{
		R61307_GAMMA_SET_A,
		0x00, 0x06, 0x0a, 0x0f,
		0x14, 0x1f, 0x1f, 0x17,
		0x12, 0x0c, 0x09, 0x06,
		0x00, 0x06, 0x0a, 0x0f,
		0x14, 0x1f, 0x1f, 0x17,
		0x12, 0x0c, 0x09, 0x06
	},
	{
		R61307_GAMMA_SET_A,
		0x00, 0x05, 0x0b, 0x0f,
		0x11, 0x1d, 0x20, 0x18,
		0x18, 0x09, 0x07, 0x06,
		0x00, 0x05, 0x0b, 0x0f,
		0x11, 0x1d, 0x20, 0x18,
		0x18, 0x09, 0x07, 0x06
	},
	{
		R61307_GAMMA_SET_A,
		0x0b, 0x0d, 0x10, 0x14,
		0x13, 0x1d, 0x20, 0x18,
		0x12, 0x09, 0x07, 0x06,
		0x0a, 0x0c, 0x10, 0x14,
		0x13, 0x1d, 0x20, 0x18,
		0x12, 0x09, 0x07, 0x06
	},
};

static inline struct renesas_r61307 *to_renesas_r61307(struct drm_panel *panel)
{
	return container_of(panel, struct renesas_r61307, panel);
}

static void renesas_r61307_reset(struct renesas_r61307 *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_r61307_prepare(struct drm_panel *panel)
{
	struct renesas_r61307 *priv = to_renesas_r61307(panel);
	struct device *dev = &priv->dsi->dev;
	int ret;

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

	usleep_range(2000, 3000);

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

	usleep_range(2000, 3000);

	renesas_r61307_reset(priv);

	return 0;
}

static int renesas_r61307_enable(struct drm_panel *panel)
{
	struct renesas_r61307 *priv = to_renesas_r61307(panel);
	struct mipi_dsi_multi_context ctx = { .dsi = priv->dsi };

Annotation

Implementation Notes