Migrate devices, create drivers, other improvements & fixes (#574)
Migrated devices to kernel drivers: - guition-jc3248w535c - m5stack-core2 - m5stack-cores3 - m5stack-papers3 New drivers: - axp192-module - axp2101-module Fixes: - Fix SD card LDO for P4 devices - Updated PowerOff app to work with kernel displays - Fix for `lvgl_try_lock()` timing - Fix for touch events with slow updating displays Improvements: - `GuiService` now keeps trying to lock to prevent silent failures caused by drivers. - `GuiService` now uses lvgl-module calls for locking/unlocking - display driver now has capability `DISPLAY_CAPABILITY_SLOW_REFRESH`
This commit is contained in:
committed by
GitHub
parent
5f54f7ca3d
commit
f9453d8956
@@ -0,0 +1,14 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
#pragma once
|
||||
|
||||
#include <tactility/module.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
extern struct Module axp2101_module;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
@@ -0,0 +1,15 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
#pragma once
|
||||
|
||||
#include <tactility/bindings/bindings.h>
|
||||
#include <drivers/axp2101.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
DEFINE_DEVICETREE(axp2101, struct Axp2101Config)
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
@@ -0,0 +1,15 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
#pragma once
|
||||
|
||||
#include <tactility/bindings/bindings.h>
|
||||
#include <drivers/axp2101_backlight.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
DEFINE_DEVICETREE(axp2101_backlight, struct Axp2101BacklightConfig)
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
@@ -0,0 +1,96 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
#pragma once
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include <tactility/error.h>
|
||||
|
||||
struct Device;
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
struct Axp2101Config {
|
||||
/** Address on bus */
|
||||
uint8_t address;
|
||||
};
|
||||
|
||||
/** Switchable/adjustable DCDC (buck) converters of the AXP2101. */
|
||||
enum Axp2101Dcdc {
|
||||
AXP2101_DCDC1,
|
||||
AXP2101_DCDC2,
|
||||
AXP2101_DCDC3,
|
||||
AXP2101_DCDC4,
|
||||
AXP2101_DCDC5,
|
||||
};
|
||||
|
||||
/** Switchable/adjustable LDO regulators of the AXP2101. */
|
||||
enum Axp2101Ldo {
|
||||
AXP2101_ALDO1,
|
||||
AXP2101_ALDO2,
|
||||
AXP2101_ALDO3,
|
||||
AXP2101_ALDO4,
|
||||
AXP2101_BLDO1,
|
||||
AXP2101_BLDO2,
|
||||
AXP2101_CPUSLDO,
|
||||
AXP2101_DLDO1,
|
||||
AXP2101_DLDO2,
|
||||
};
|
||||
|
||||
/** Checks whether a DCDC converter is currently enabled. */
|
||||
error_t axp2101_is_dcdc_enabled(struct Device* device, enum Axp2101Dcdc dcdc, bool* enabled);
|
||||
|
||||
/** Enables or disables a DCDC converter. */
|
||||
error_t axp2101_set_dcdc_enabled(struct Device* device, enum Axp2101Dcdc dcdc, bool enabled);
|
||||
|
||||
/**
|
||||
* @brief Sets the output voltage of a DCDC converter.
|
||||
* @retval ERROR_INVALID_ARGUMENT when millivolts is outside the converter's supported range/step
|
||||
* (DCDC1: 1500-3400mV/100mV; DCDC2: 500-1200mV/10mV or 1220-1540mV/20mV;
|
||||
* DCDC3: 500-1200mV/10mV, 1220-1540mV/20mV or 1600-3400mV/100mV;
|
||||
* DCDC4: 500-1200mV/10mV or 1220-1840mV/20mV; DCDC5: 1200mV, or 1400-3700mV/100mV)
|
||||
*/
|
||||
error_t axp2101_set_dcdc_voltage(struct Device* device, enum Axp2101Dcdc dcdc, uint16_t millivolts);
|
||||
|
||||
/** Checks whether an LDO regulator is currently enabled. */
|
||||
error_t axp2101_is_ldo_enabled(struct Device* device, enum Axp2101Ldo ldo, bool* enabled);
|
||||
|
||||
/** Enables or disables an LDO regulator. */
|
||||
error_t axp2101_set_ldo_enabled(struct Device* device, enum Axp2101Ldo ldo, bool enabled);
|
||||
|
||||
/**
|
||||
* @brief Sets the output voltage of an LDO regulator.
|
||||
* @retval ERROR_INVALID_ARGUMENT when millivolts is outside the regulator's supported range/step
|
||||
* (ALDO1-4/BLDO1-2: 500-3500mV/100mV; CPUSLDO: 500-1400mV/50mV; DLDO1-2: 500-3400mV/100mV)
|
||||
*/
|
||||
error_t axp2101_set_ldo_voltage(struct Device* device, enum Axp2101Ldo ldo, uint16_t millivolts);
|
||||
|
||||
/** Battery voltage in millivolts (0 when no battery is connected). */
|
||||
error_t axp2101_get_battery_voltage(struct Device* device, uint16_t* millivolts);
|
||||
|
||||
/** Whether a battery is currently detected. */
|
||||
error_t axp2101_is_battery_connected(struct Device* device, bool* connected);
|
||||
|
||||
/** Whether VBUS (USB power) is currently present and usable. */
|
||||
error_t axp2101_is_vbus_present(struct Device* device, bool* present);
|
||||
|
||||
/** VBUS voltage in millivolts (0 when VBUS is not present). */
|
||||
error_t axp2101_get_vbus_voltage(struct Device* device, uint16_t* millivolts);
|
||||
|
||||
/** Whether the battery is currently charging. */
|
||||
error_t axp2101_is_charging(struct Device* device, bool* charging);
|
||||
|
||||
/** Whether the charger is allowed to charge the battery. */
|
||||
error_t axp2101_is_charge_enabled(struct Device* device, bool* enabled);
|
||||
|
||||
/** Enables or disables battery charging. */
|
||||
error_t axp2101_set_charge_enabled(struct Device* device, bool enabled);
|
||||
|
||||
/** Powers off the system (does not return on success). */
|
||||
error_t axp2101_power_off(struct Device* device);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
@@ -0,0 +1,29 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
#pragma once
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include <drivers/axp2101.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Devicetree configuration for a backlight driven by a switchable/adjustable AXP2101 LDO.
|
||||
*/
|
||||
struct Axp2101BacklightConfig {
|
||||
/** The AXP2101 LDO powering the backlight */
|
||||
enum Axp2101Ldo ldo;
|
||||
/** LDO voltage at brightness level 0. Brightness level 0 always disables the LDO outright,
|
||||
* rather than actually driving it to this voltage - see set_brightness() in BacklightApi. */
|
||||
uint16_t min_millivolt;
|
||||
/** LDO voltage at the maximum brightness level (255) */
|
||||
uint16_t max_millivolt;
|
||||
/** Default brightness level, applied by set_brightness_default() */
|
||||
uint8_t brightness_default;
|
||||
};
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
Reference in New Issue
Block a user