Skip to content

Commit 0efa792

Browse files
passgatsuperna9999
authored andcommitted
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 <dario.binacchi@amarulasolutions.com> Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org> Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org> Link: https://patch.msgid.link/20260318073346.18041-3-dario.binacchi@amarulasolutions.com
1 parent 3bdd847 commit 0efa792

6 files changed

Lines changed: 193 additions & 109 deletions

File tree

MAINTAINERS

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8028,7 +8028,7 @@ F: drivers/gpu/drm/panel/panel-ilitek-ili9805.c
80288028
DRM DRIVER FOR ILITEK ILI9806E PANELS
80298029
M: Michael Walle <mwalle@kernel.org>
80308030
S: Maintained
8031-
F: drivers/gpu/drm/panel/panel-ilitek-ili9806e-dsi.c
8031+
F: drivers/gpu/drm/panel/panel-ilitek-ili9806e-*
80328032

80338033
DRM DRIVER FOR JADARD JD9365DA-H3 MIPI-DSI LCD PANELS
80348034
M: Jagan Teki <jagan@edgeble.ai>

drivers/gpu/drm/panel/Kconfig

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -268,11 +268,15 @@ config DRM_PANEL_ILITEK_ILI9805
268268
Say Y if you want to enable support for panels based on the
269269
Ilitek ILI9805 controller.
270270

271+
config DRM_PANEL_ILITEK_ILI9806E_CORE
272+
tristate
273+
271274
config DRM_PANEL_ILITEK_ILI9806E_DSI
272275
tristate "Ilitek ILI9806E-based DSI panels"
273276
depends on OF
274277
depends on DRM_MIPI_DSI
275278
depends on BACKLIGHT_CLASS_DEVICE
279+
select DRM_PANEL_ILITEK_ILI9806E_CORE
276280
help
277281
Say Y if you want to enable support for panels based on the
278282
Ilitek ILI9806E controller using DSI.

drivers/gpu/drm/panel/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ obj-$(CONFIG_DRM_PANEL_HYDIS_HV101HD1) += panel-hydis-hv101hd1.o
2727
obj-$(CONFIG_DRM_PANEL_ILITEK_IL9322) += panel-ilitek-ili9322.o
2828
obj-$(CONFIG_DRM_PANEL_ILITEK_ILI9341) += panel-ilitek-ili9341.o
2929
obj-$(CONFIG_DRM_PANEL_ILITEK_ILI9805) += panel-ilitek-ili9805.o
30+
obj-$(CONFIG_DRM_PANEL_ILITEK_ILI9806E_CORE) += panel-ilitek-ili9806e-core.o
3031
obj-$(CONFIG_DRM_PANEL_ILITEK_ILI9806E_DSI) += panel-ilitek-ili9806e-dsi.o
3132
obj-$(CONFIG_DRM_PANEL_ILITEK_ILI9881C) += panel-ilitek-ili9881c.o
3233
obj-$(CONFIG_DRM_PANEL_ILITEK_ILI9882T) += panel-ilitek-ili9882t.o
Lines changed: 129 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,129 @@
1+
// SPDX-License-Identifier: GPL-2.0
2+
/*
3+
* Ilitek ILI9806E core driver.
4+
*
5+
* Copyright (c) 2026 Amarula Solutions, Dario Binacchi <dario.binacchi@amarulasolutions.com>
6+
*/
7+
8+
#include <drm/drm_panel.h>
9+
10+
#include <linux/delay.h>
11+
#include <linux/export.h>
12+
#include <linux/gpio/consumer.h>
13+
#include <linux/module.h>
14+
#include <linux/property.h>
15+
#include <linux/regulator/consumer.h>
16+
17+
#include "panel-ilitek-ili9806e-core.h"
18+
19+
struct ili9806e {
20+
void *transport;
21+
struct drm_panel panel;
22+
23+
struct regulator_bulk_data supplies[2];
24+
struct gpio_desc *reset_gpio;
25+
};
26+
27+
static const char * const regulator_names[] = {
28+
"vdd",
29+
"vccio",
30+
};
31+
32+
void *ili9806e_get_transport(struct drm_panel *panel)
33+
{
34+
struct ili9806e *ctx = container_of(panel, struct ili9806e, panel);
35+
36+
return ctx->transport;
37+
}
38+
EXPORT_SYMBOL_GPL(ili9806e_get_transport);
39+
40+
int ili9806e_power_on(struct device *dev)
41+
{
42+
struct ili9806e *ctx = dev_get_drvdata(dev);
43+
int ret;
44+
45+
gpiod_set_value(ctx->reset_gpio, 1);
46+
47+
ret = regulator_bulk_enable(ARRAY_SIZE(ctx->supplies), ctx->supplies);
48+
if (ret) {
49+
dev_err(dev, "regulator bulk enable failed: %d\n", ret);
50+
return ret;
51+
}
52+
53+
usleep_range(10000, 20000);
54+
gpiod_set_value(ctx->reset_gpio, 0);
55+
usleep_range(10000, 20000);
56+
57+
return 0;
58+
}
59+
EXPORT_SYMBOL_GPL(ili9806e_power_on);
60+
61+
int ili9806e_power_off(struct device *dev)
62+
{
63+
struct ili9806e *ctx = dev_get_drvdata(dev);
64+
int ret;
65+
66+
gpiod_set_value(ctx->reset_gpio, 1);
67+
68+
ret = regulator_bulk_disable(ARRAY_SIZE(ctx->supplies), ctx->supplies);
69+
if (ret)
70+
dev_err(dev, "regulator bulk disable failed: %d\n", ret);
71+
72+
return ret;
73+
}
74+
EXPORT_SYMBOL_GPL(ili9806e_power_off);
75+
76+
int ili9806e_probe(struct device *dev, void *transport,
77+
const struct drm_panel_funcs *funcs,
78+
int connector_type)
79+
{
80+
struct ili9806e *ctx;
81+
int i, ret;
82+
83+
ctx = devm_kzalloc(dev, sizeof(struct ili9806e), GFP_KERNEL);
84+
if (!ctx)
85+
return -ENOMEM;
86+
87+
dev_set_drvdata(dev, ctx);
88+
ctx->transport = transport;
89+
90+
for (i = 0; i < ARRAY_SIZE(ctx->supplies); i++)
91+
ctx->supplies[i].supply = regulator_names[i];
92+
93+
ret = devm_regulator_bulk_get(dev, ARRAY_SIZE(ctx->supplies),
94+
ctx->supplies);
95+
if (ret)
96+
return dev_err_probe(dev, ret, "failed to get regulators\n");
97+
98+
ctx->reset_gpio = devm_gpiod_get(dev, "reset", GPIOD_OUT_LOW);
99+
if (IS_ERR(ctx->reset_gpio))
100+
return dev_err_probe(dev, PTR_ERR(ctx->reset_gpio),
101+
"Failed to get reset-gpios\n");
102+
103+
drm_panel_init(&ctx->panel, dev, funcs, connector_type);
104+
105+
ret = drm_panel_of_backlight(&ctx->panel);
106+
if (ret)
107+
return dev_err_probe(dev, ret, "Failed to get backlight\n");
108+
109+
ctx->panel.prepare_prev_first = true;
110+
drm_panel_add(&ctx->panel);
111+
112+
return 0;
113+
114+
}
115+
EXPORT_SYMBOL_GPL(ili9806e_probe);
116+
117+
void ili9806e_remove(struct device *dev)
118+
{
119+
struct ili9806e *ctx = dev_get_drvdata(dev);
120+
121+
drm_panel_remove(&ctx->panel);
122+
}
123+
EXPORT_SYMBOL_GPL(ili9806e_remove);
124+
125+
MODULE_AUTHOR("Dario Binacchi <dario.binacchi@amarulasolutions.com>");
126+
MODULE_AUTHOR("Gunnar Dibbern <gunnar.dibbern@lht.dlh.de>");
127+
MODULE_AUTHOR("Michael Walle <mwalle@kernel.org>");
128+
MODULE_DESCRIPTION("Ilitek ILI9806E Controller Driver");
129+
MODULE_LICENSE("GPL");
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
/* SPDX-License-Identifier: GPL-2.0 */
2+
3+
#ifndef _PANEL_ILITEK_ILI9806E_CORE_H
4+
#define _PANEL_ILITEK_ILI9806E_CORE_H
5+
6+
void *ili9806e_get_transport(struct drm_panel *panel);
7+
int ili9806e_power_off(struct device *dev);
8+
int ili9806e_power_on(struct device *dev);
9+
10+
int ili9806e_probe(struct device *dev, void *transport,
11+
const struct drm_panel_funcs *funcs,
12+
int connector_type);
13+
void ili9806e_remove(struct device *dev);
14+
15+
#endif /* _PANEL_ILITEK_ILI9806E_CORE_H */

0 commit comments

Comments
 (0)