zephyr/drivers/display
Gerard Marull-Paretas a5fd0d184a init: remove the need for a dummy device pointer in SYS_INIT functions
The init infrastructure, found in `init.h`, is currently used by:

- `SYS_INIT`: to call functions before `main`
- `DEVICE_*`: to initialize devices

They are all sorted according to an initialization level + a priority.
`SYS_INIT` calls are really orthogonal to devices, however, the required
function signature requires a `const struct device *dev` as a first
argument. The only reason for that is because the same init machinery is
used by devices, so we have something like:

```c
struct init_entry {
	int (*init)(const struct device *dev);
	/* only set by DEVICE_*, otherwise NULL */
	const struct device *dev;
}
```

As a result, we end up with such weird/ugly pattern:

```c
static int my_init(const struct device *dev)
{
	/* always NULL! add ARG_UNUSED to avoid compiler warning */
	ARG_UNUSED(dev);
	...
}
```

This is really a result of poor internals isolation. This patch proposes
a to make init entries more flexible so that they can accept sytem
initialization calls like this:

```c
static int my_init(void)
{
	...
}
```

This is achieved using a union:

```c
union init_function {
	/* for SYS_INIT, used when init_entry.dev == NULL */
	int (*sys)(void);
	/* for DEVICE*, used when init_entry.dev != NULL */
	int (*dev)(const struct device *dev);
};

struct init_entry {
	/* stores init function (either for SYS_INIT or DEVICE*)
	union init_function init_fn;
	/* stores device pointer for DEVICE*, NULL for SYS_INIT. Allows
	 * to know which union entry to call.
	 */
	const struct device *dev;
}
```

This solution **does not increase ROM usage**, and allows to offer clean
public APIs for both SYS_INIT and DEVICE*. Note that however, init
machinery keeps a coupling with devices.

**NOTE**: This is a breaking change! All `SYS_INIT` functions will need
to be converted to the new signature. See the script offered in the
following commit.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>

init: convert SYS_INIT functions to the new signature

Conversion scripted using scripts/utils/migrate_sys_init.py.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>

manifest: update projects for SYS_INIT changes

Update modules with updated SYS_INIT calls:

- hal_ti
- lvgl
- sof
- TraceRecorderSource

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>

tests: devicetree: devices: adjust test

Adjust test according to the recently introduced SYS_INIT
infrastructure.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>

tests: kernel: threads: adjust SYS_INIT call

Adjust to the new signature: int (*init_fn)(void);

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2023-04-12 14:28:07 +00:00
..
CMakeLists.txt drivers: display: introduce otm8009a 2023-04-06 11:51:06 +02:00
display_dummy.c include: add missing errno.h include 2022-10-11 18:05:17 +02:00
display_ili9xxx.c drivers: tests: replace usage of spi_is_ready with spi_is_ready_dt 2022-12-07 09:40:23 -06:00
display_ili9xxx.h drivers: migrate includes to <zephyr/...> 2022-05-06 19:58:21 +02:00
display_ili9340.c drivers: migrate includes to <zephyr/...> 2022-05-06 19:58:21 +02:00
display_ili9340.h drivers: migrate includes to <zephyr/...> 2022-05-06 19:58:21 +02:00
display_ili9341.c drivers: migrate includes to <zephyr/...> 2022-05-06 19:58:21 +02:00
display_ili9341.h drivers: display: ili9341: add 4th parameter in DISCTRL command 2023-01-27 19:24:13 +09:00
display_ili9488.c drivers: migrate includes to <zephyr/...> 2022-05-06 19:58:21 +02:00
display_ili9488.h drivers: migrate includes to <zephyr/...> 2022-05-06 19:58:21 +02:00
display_intel_multibootfb.c include: add missing errno.h include 2022-10-11 18:05:17 +02:00
display_max7219.c drivers: tests: replace usage of spi_is_ready with spi_is_ready_dt 2022-12-07 09:40:23 -06:00
display_mcux_dcnano_lcdif.c drivers: display: introduce driver for NXP DCNANO LCDIF peripheral 2023-03-04 09:19:26 +01:00
display_mcux_elcdif.c include: add missing zephyr/irq.h include 2022-10-17 22:57:39 +09:00
display_nrf_led_matrix.c include: add missing zephyr/irq.h include 2022-10-17 22:57:39 +09:00
display_otm8009a.c drivers: display: introduce otm8009a 2023-04-06 11:51:06 +02:00
display_otm8009a.h drivers: display: introduce otm8009a 2023-04-06 11:51:06 +02:00
display_rm68200.c drivers: display: rm68200: add missing kernel.h include 2022-10-24 12:44:57 +02:00
display_sdl.c drivers: migrate includes to <zephyr/...> 2022-05-06 19:58:21 +02:00
display_st7735r.c drivers: tests: replace usage of spi_is_ready with spi_is_ready_dt 2022-12-07 09:40:23 -06:00
display_st7735r.h includes: prefer <zephyr/kernel.h> over <zephyr/zephyr.h> 2022-09-05 16:31:47 +02:00
display_st7789v.c drivers: tests: replace usage of spi_is_ready with spi_is_ready_dt 2022-12-07 09:40:23 -06:00
display_st7789v.h includes: prefer <zephyr/kernel.h> over <zephyr/zephyr.h> 2022-09-05 16:31:47 +02:00
display_stm32_ltdc.c drivers: display: ltdc: add window property 2023-04-06 11:51:06 +02:00
Kconfig drivers: display: introduce otm8009a 2023-04-06 11:51:06 +02:00
Kconfig.dummy drivers: display: remove unused Kconfig options 2021-12-10 12:47:30 +01:00
Kconfig.ili9xxx drivers: display: Update Kconfig 2022-08-09 12:27:44 +02:00
Kconfig.intel_multibootfb drivers: display: intel_multibootfb: convert to DT 2022-09-02 14:16:08 +02:00
Kconfig.ls0xx drivers: display: Remove unnecessary Kconfig settings 2022-08-09 12:27:44 +02:00
Kconfig.max7219 drivers: display: Update Kconfig 2022-08-09 12:27:44 +02:00
Kconfig.mcux_dcnano_lcdif drivers: display: introduce driver for NXP DCNANO LCDIF peripheral 2023-03-04 09:19:26 +01:00
Kconfig.mcux_elcdif drivers: display: Update Kconfig 2022-08-09 12:27:44 +02:00
Kconfig.microbit drivers: mb_display: rework bbc:microbit display support 2021-12-21 17:06:03 +01:00
Kconfig.nrf_led_matrix drivers: display: Update Kconfig 2022-08-09 12:27:44 +02:00
Kconfig.otm8009a drivers: display: introduce otm8009a 2023-04-06 11:51:06 +02:00
Kconfig.rm68200 drivers: display: Update Kconfig 2022-08-09 12:27:44 +02:00
Kconfig.sdl drivers: display: Update Kconfig 2022-08-09 12:27:44 +02:00
Kconfig.ssd16xx drivers: display: Update Kconfig 2022-08-09 12:27:44 +02:00
Kconfig.ssd1306 drivers: display: Update Kconfig 2022-08-09 12:27:44 +02:00
Kconfig.st7735r drivers: display: Update Kconfig 2022-08-09 12:27:44 +02:00
Kconfig.st7789v drivers: display: Update Kconfig 2022-08-09 12:27:44 +02:00
Kconfig.stm32_ltdc drivers: display: Update Kconfig 2022-08-09 12:27:44 +02:00
Kconfig.uc81xx drivers: display: Update Kconfig 2022-08-09 12:27:44 +02:00
ls0xx.c drivers: tests: replace usage of spi_is_ready with spi_is_ready_dt 2022-12-07 09:40:23 -06:00
mb_display.c init: remove the need for a dummy device pointer in SYS_INIT functions 2023-04-12 14:28:07 +00:00
mb_font.c drivers: migrate includes to <zephyr/...> 2022-05-06 19:58:21 +02:00
mb_font.h
ssd16xx.c drivers: tests: replace usage of spi_is_ready with spi_is_ready_dt 2022-12-07 09:40:23 -06:00
ssd16xx_regs.h drivers: ssd16xx: Make SSD1673 registers optional 2022-08-16 11:32:26 +02:00
ssd1306.c drivers: display ssd1306: Remove referencing to cfb.h 2023-02-20 16:29:25 +01:00
ssd1306_regs.h everywhere: fix typos 2022-03-14 20:22:24 -04:00
uc81xx.c drivers: tests: replace usage of spi_is_ready with spi_is_ready_dt 2022-12-07 09:40:23 -06:00
uc81xx_regs.h drivers: uc81xx: Add support for overriding LUTs 2022-09-02 11:21:08 +02:00