drivers/gpu/drm/panel/panel-ilitek-ili9806e-core.c

Source file repositories/reference/linux-study-clean/drivers/gpu/drm/panel/panel-ilitek-ili9806e-core.c

File Facts

System
Linux kernel
Corpus path
drivers/gpu/drm/panel/panel-ilitek-ili9806e-core.c
Extension
.c
Size
3297 bytes
Lines
135
Domain
Driver Families
Bucket
drivers/gpu
Inferred role
Driver Families: exported/initcall integration point
Status
integration 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 ili9806e {
	void *transport;
	struct drm_panel panel;

	unsigned int num_supplies;
	struct regulator_bulk_data supplies[2];
	struct gpio_desc *reset_gpio;
};

void *ili9806e_get_transport(struct drm_panel *panel)
{
	struct ili9806e *ctx = container_of(panel, struct ili9806e, panel);

	return ctx->transport;
}
EXPORT_SYMBOL_GPL(ili9806e_get_transport);

int ili9806e_power_on(struct device *dev)
{
	struct ili9806e *ctx = dev_get_drvdata(dev);
	int ret;

	gpiod_set_value(ctx->reset_gpio, 1);

	ret = regulator_bulk_enable(ctx->num_supplies, ctx->supplies);
	if (ret) {
		dev_err(dev, "regulator bulk enable failed: %d\n", ret);
		return ret;
	}

	usleep_range(10000, 20000);
	gpiod_set_value(ctx->reset_gpio, 0);
	usleep_range(10000, 20000);

	return 0;
}
EXPORT_SYMBOL_GPL(ili9806e_power_on);

int ili9806e_power_off(struct device *dev)
{
	struct ili9806e *ctx = dev_get_drvdata(dev);
	int ret;

	gpiod_set_value(ctx->reset_gpio, 1);

	ret = regulator_bulk_disable(ctx->num_supplies, ctx->supplies);
	if (ret)
		dev_err(dev, "regulator bulk disable failed: %d\n", ret);

	return ret;
}
EXPORT_SYMBOL_GPL(ili9806e_power_off);

int ili9806e_probe(struct device *dev, void *transport,
		  const struct drm_panel_funcs *funcs,
		  int connector_type)
{
	struct ili9806e *ctx;
	bool set_prepare_prev_first = false;
	int ret;

	ctx = devm_drm_panel_alloc(dev, __typeof(*ctx), panel,
				  funcs, connector_type);

	if (IS_ERR(ctx))
		return PTR_ERR(ctx);

	dev_set_drvdata(dev, ctx);
	ctx->transport = transport;

	ctx->supplies[ctx->num_supplies++].supply = "vdd";
	if (of_device_is_compatible(dev->of_node,
				    "densitron,dmt028vghmcmi-1d") ||
	    of_device_is_compatible(dev->of_node,
				    "ortustech,com35h3p70ulc")) {
		ctx->supplies[ctx->num_supplies++].supply = "vccio";
		set_prepare_prev_first = true;
	}

	ret = devm_regulator_bulk_get(dev, ctx->num_supplies, ctx->supplies);
	if (ret)
		return dev_err_probe(dev, ret, "failed to get regulators\n");

	ctx->reset_gpio = devm_gpiod_get(dev, "reset", GPIOD_OUT_LOW);
	if (IS_ERR(ctx->reset_gpio))
		return dev_err_probe(dev, PTR_ERR(ctx->reset_gpio),
				     "Failed to get reset-gpios\n");

	ret = drm_panel_of_backlight(&ctx->panel);
	if (ret)

Annotation

Implementation Notes