From: Dario Binacchi Date: Wed, 18 Mar 2026 07:32:51 +0000 (+0100) Subject: drm/panel: ilitek-ili9806e: split core and DSI logic X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=0efa7924243e461a643a44904653f200bfd40ee0;p=thirdparty%2Fkernel%2Flinux.git drm/panel: ilitek-ili9806e: split core and DSI logic Split the driver to support multiple transport buses. The core logic (power, GPIO, backlight) is moved to a dedicated core module, while DSI-specific code is restricted to the DSI module. Introduce DRM_PANEL_ILITEK_ILI9806E_CORE as a hidden Kconfig symbol selected by the bus-specific configuration. Signed-off-by: Dario Binacchi Reviewed-by: Neil Armstrong Signed-off-by: Neil Armstrong Link: https://patch.msgid.link/20260318073346.18041-3-dario.binacchi@amarulasolutions.com --- diff --git a/MAINTAINERS b/MAINTAINERS index 7aa8dc54c47c5..409cee852b979 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -8028,7 +8028,7 @@ F: drivers/gpu/drm/panel/panel-ilitek-ili9805.c DRM DRIVER FOR ILITEK ILI9806E PANELS M: Michael Walle S: Maintained -F: drivers/gpu/drm/panel/panel-ilitek-ili9806e-dsi.c +F: drivers/gpu/drm/panel/panel-ilitek-ili9806e-* DRM DRIVER FOR JADARD JD9365DA-H3 MIPI-DSI LCD PANELS M: Jagan Teki diff --git a/drivers/gpu/drm/panel/Kconfig b/drivers/gpu/drm/panel/Kconfig index a1aa17d98f8a6..b756dc1c2ee09 100644 --- a/drivers/gpu/drm/panel/Kconfig +++ b/drivers/gpu/drm/panel/Kconfig @@ -268,11 +268,15 @@ config DRM_PANEL_ILITEK_ILI9805 Say Y if you want to enable support for panels based on the Ilitek ILI9805 controller. +config DRM_PANEL_ILITEK_ILI9806E_CORE + tristate + config DRM_PANEL_ILITEK_ILI9806E_DSI tristate "Ilitek ILI9806E-based DSI panels" depends on OF depends on DRM_MIPI_DSI depends on BACKLIGHT_CLASS_DEVICE + select DRM_PANEL_ILITEK_ILI9806E_CORE help Say Y if you want to enable support for panels based on the Ilitek ILI9806E controller using DSI. diff --git a/drivers/gpu/drm/panel/Makefile b/drivers/gpu/drm/panel/Makefile index 5b4eff2597448..74dcfc8a40fc5 100644 --- a/drivers/gpu/drm/panel/Makefile +++ b/drivers/gpu/drm/panel/Makefile @@ -27,6 +27,7 @@ obj-$(CONFIG_DRM_PANEL_HYDIS_HV101HD1) += panel-hydis-hv101hd1.o obj-$(CONFIG_DRM_PANEL_ILITEK_IL9322) += panel-ilitek-ili9322.o obj-$(CONFIG_DRM_PANEL_ILITEK_ILI9341) += panel-ilitek-ili9341.o obj-$(CONFIG_DRM_PANEL_ILITEK_ILI9805) += panel-ilitek-ili9805.o +obj-$(CONFIG_DRM_PANEL_ILITEK_ILI9806E_CORE) += panel-ilitek-ili9806e-core.o obj-$(CONFIG_DRM_PANEL_ILITEK_ILI9806E_DSI) += panel-ilitek-ili9806e-dsi.o obj-$(CONFIG_DRM_PANEL_ILITEK_ILI9881C) += panel-ilitek-ili9881c.o obj-$(CONFIG_DRM_PANEL_ILITEK_ILI9882T) += panel-ilitek-ili9882t.o diff --git a/drivers/gpu/drm/panel/panel-ilitek-ili9806e-core.c b/drivers/gpu/drm/panel/panel-ilitek-ili9806e-core.c new file mode 100644 index 0000000000000..c088685d9d853 --- /dev/null +++ b/drivers/gpu/drm/panel/panel-ilitek-ili9806e-core.c @@ -0,0 +1,129 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Ilitek ILI9806E core driver. + * + * Copyright (c) 2026 Amarula Solutions, Dario Binacchi + */ + +#include + +#include +#include +#include +#include +#include +#include + +#include "panel-ilitek-ili9806e-core.h" + +struct ili9806e { + void *transport; + struct drm_panel panel; + + struct regulator_bulk_data supplies[2]; + struct gpio_desc *reset_gpio; +}; + +static const char * const regulator_names[] = { + "vdd", + "vccio", +}; + +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(ARRAY_SIZE(ctx->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(ARRAY_SIZE(ctx->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; + int i, ret; + + ctx = devm_kzalloc(dev, sizeof(struct ili9806e), GFP_KERNEL); + if (!ctx) + return -ENOMEM; + + dev_set_drvdata(dev, ctx); + ctx->transport = transport; + + for (i = 0; i < ARRAY_SIZE(ctx->supplies); i++) + ctx->supplies[i].supply = regulator_names[i]; + + ret = devm_regulator_bulk_get(dev, ARRAY_SIZE(ctx->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"); + + drm_panel_init(&ctx->panel, dev, funcs, connector_type); + + ret = drm_panel_of_backlight(&ctx->panel); + if (ret) + return dev_err_probe(dev, ret, "Failed to get backlight\n"); + + ctx->panel.prepare_prev_first = true; + drm_panel_add(&ctx->panel); + + return 0; + +} +EXPORT_SYMBOL_GPL(ili9806e_probe); + +void ili9806e_remove(struct device *dev) +{ + struct ili9806e *ctx = dev_get_drvdata(dev); + + drm_panel_remove(&ctx->panel); +} +EXPORT_SYMBOL_GPL(ili9806e_remove); + +MODULE_AUTHOR("Dario Binacchi "); +MODULE_AUTHOR("Gunnar Dibbern "); +MODULE_AUTHOR("Michael Walle "); +MODULE_DESCRIPTION("Ilitek ILI9806E Controller Driver"); +MODULE_LICENSE("GPL"); diff --git a/drivers/gpu/drm/panel/panel-ilitek-ili9806e-core.h b/drivers/gpu/drm/panel/panel-ilitek-ili9806e-core.h new file mode 100644 index 0000000000000..dddece62cf428 --- /dev/null +++ b/drivers/gpu/drm/panel/panel-ilitek-ili9806e-core.h @@ -0,0 +1,15 @@ +/* SPDX-License-Identifier: GPL-2.0 */ + +#ifndef _PANEL_ILITEK_ILI9806E_CORE_H +#define _PANEL_ILITEK_ILI9806E_CORE_H + +void *ili9806e_get_transport(struct drm_panel *panel); +int ili9806e_power_off(struct device *dev); +int ili9806e_power_on(struct device *dev); + +int ili9806e_probe(struct device *dev, void *transport, + const struct drm_panel_funcs *funcs, + int connector_type); +void ili9806e_remove(struct device *dev); + +#endif /* _PANEL_ILITEK_ILI9806E_CORE_H */ diff --git a/drivers/gpu/drm/panel/panel-ilitek-ili9806e-dsi.c b/drivers/gpu/drm/panel/panel-ilitek-ili9806e-dsi.c index c337c4f1a1c72..ecdbed8d4a3ac 100644 --- a/drivers/gpu/drm/panel/panel-ilitek-ili9806e-dsi.c +++ b/drivers/gpu/drm/panel/panel-ilitek-ili9806e-dsi.c @@ -1,15 +1,12 @@ // SPDX-License-Identifier: GPL-2.0 -#include #include #include #include -#include #include #include #include #include -#include #include #include @@ -18,7 +15,9 @@ #include