Tab5 power expander driver and devicetree parsing improvements (#507)

* **New Features**
  * PI4IOE5V6408 I2C I/O expander driver with public GPIO APIs
  * CLI tool to list devicetree dependencies

* **Device Tree Updates**
  * M5Stack Tab5 configured with two I2C IO expanders; PI4IOE5V6408 binding added

* **Build / Tooling**
  * Devicetree code generation integrated into build; generated artifacts and dynamic dependency resolution exposed

* **Refactor**
  * Kernel/run APIs updated to accept a null‑terminated devicetree modules array; many module symbols renamed

* **Documentation**
  * Added README and Apache‑2.0 license for new driver module
This commit is contained in:
Ken Van Hoeylandt
2026-02-17 22:59:30 +01:00
committed by GitHub
parent f0f764baff
commit d2048e01b6
82 changed files with 749 additions and 253 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
description: I2C device
properties:
register:
reg:
required: true
description: device address on the bus
@@ -1,21 +1,20 @@
#pragma once
#include <tactility/dts.h>
#include <tactility/error.h>
#include <tactility/module.h>
#ifdef __cplusplus
extern "C" {
#endif
#include <tactility/device.h>
#include <tactility/error.h>
#include <tactility/module.h>
/**
* Initialize the kernel with platform and device modules, and a device tree.
* @param platform_module The platform module to start. This module should not be constructed yet.
* @param device_module The device module to start. This module should not be constructed yet. This parameter can be NULL.
* @param dts_devices The list of generated devices from the devicetree. The array must be terminated with DTS_DEVICE_TERMINATOR. This parameter can be NULL.
* Initialize the kernel with the provided modules from the device tree
* @param dts_modules List of modules from devicetree, null-terminated. Non-null parameter.
* @param dts_devices The list of generated devices from the devicetree. The array must be terminated with DTS_DEVICE_TERMINATOR. Non-null parameter.
* @return ERROR_NONE on success, otherwise an error code
*/
error_t kernel_init(struct Module* platform_module, struct Module* device_module, struct DtsDevice dts_devices[]);
error_t kernel_init(struct Module* dts_modules[], struct DtsDevice dts_devices[]);
#ifdef __cplusplus
}
@@ -3,6 +3,7 @@
#include "error.h"
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
#ifdef __cplusplus
+24 -28
View File
@@ -1,5 +1,6 @@
#include "tactility/dts.h"
#include <tactility/kernel_init.h>
#include <tactility/device.h>
#include <tactility/log.h>
#ifdef __cplusplus
@@ -8,7 +9,7 @@ extern "C" {
#define TAG "kernel"
extern const struct ModuleSymbol KERNEL_SYMBOLS[];
extern const ModuleSymbol KERNEL_SYMBOLS[];
static error_t start() {
extern Driver root_driver;
@@ -20,7 +21,7 @@ static error_t stop() {
return ERROR_NONE;
}
struct Module root_module = {
Module root_module = {
.name = "kernel",
.start = start,
.stop = stop,
@@ -28,7 +29,7 @@ struct Module root_module = {
.internal = nullptr
};
error_t kernel_init(struct Module* platform_module, struct Module* device_module, struct DtsDevice dts_devices[]) {
error_t kernel_init(Module* dts_modules[], DtsDevice dts_devices[]) {
LOG_I(TAG, "init");
if (module_construct_add_start(&root_module) != ERROR_NONE) {
@@ -36,36 +37,31 @@ error_t kernel_init(struct Module* platform_module, struct Module* device_module
return ERROR_RESOURCE;
}
if (module_construct_add_start(platform_module) != ERROR_NONE) {
LOG_E(TAG, "platform module init failed");
return ERROR_RESOURCE;
}
if (device_module != nullptr) {
if (module_construct_add_start(device_module) != ERROR_NONE) {
LOG_E(TAG, "device module init failed");
Module** dts_module = dts_modules;
while (*dts_module != nullptr) {
if (module_construct_add_start(*dts_module) != ERROR_NONE) {
LOG_E(TAG, "dts module init failed: %s", (*dts_module)->name);
return ERROR_RESOURCE;
}
dts_module++;
}
if (dts_devices) {
DtsDevice* dts_device = dts_devices;
while (dts_device->device != nullptr) {
if (dts_device->status == DTS_DEVICE_STATUS_OKAY) {
if (device_construct_add_start(dts_device->device, dts_device->compatible) != ERROR_NONE) {
LOG_E(TAG, "kernel_init failed to construct+add+start device: %s (%s)", dts_device->device->name, dts_device->compatible);
return ERROR_RESOURCE;
}
} else if (dts_device->status == DTS_DEVICE_STATUS_DISABLED) {
if (device_construct_add(dts_device->device, dts_device->compatible) != ERROR_NONE) {
LOG_E(TAG, "kernel_init failed to construct+add device: %s (%s)", dts_device->device->name, dts_device->compatible);
return ERROR_RESOURCE;
}
} else {
check(false, "DTS status not implemented");
DtsDevice* dts_device = dts_devices;
while (dts_device->device != nullptr) {
if (dts_device->status == DTS_DEVICE_STATUS_OKAY) {
if (device_construct_add_start(dts_device->device, dts_device->compatible) != ERROR_NONE) {
LOG_E(TAG, "kernel_init failed to construct+add+start device: %s (%s)", dts_device->device->name, dts_device->compatible);
return ERROR_RESOURCE;
}
dts_device++;
} else if (dts_device->status == DTS_DEVICE_STATUS_DISABLED) {
if (device_construct_add(dts_device->device, dts_device->compatible) != ERROR_NONE) {
LOG_E(TAG, "kernel_init failed to construct+add device: %s (%s)", dts_device->device->name, dts_device->compatible);
return ERROR_RESOURCE;
}
} else {
check(false, "DTS status not implemented");
}
dts_device++;
}
LOG_I(TAG, "init done");