Port Nokia 800 Tough (nokia-coconut), fix microSD detection, and stage upcoming a1120 (cocojamboo) build

- Migrate nokia-tough to canonical nokia-coconut while keeping CLI aliases, add layered bootloader/lk2nd/nokia-coconut.patch, bootfs/bootimg validators, and offline scripts/inspect-stock-msm8905-dump.py

- Complete nokia-coconut Stage 2 hardware bring-up: wire 6-column 22-key keypad (gpio0, gpio3, gpio7, gpio99, gpio6, gpio1), gpio98 KEY_POWER, and pon@800:resin KEY_DOWN (0x6c); split leds-msm8905-torch into GPIO_13 white:torch (dedicated top-edge flashlight) and GPIO_32 camera:flash (rear camera flash for camera.so and bananarchy-photo)

- Restore sdhci@7864000 non-removable across all six DTS/DTB targets, remove unwired gpio38 cd-gpios/sdc2-cd-* states, and harden sxmo_sdcard.sh under flock

- Register upcoming build a1120 (cocojamboo) in scripts/version.sh, scripts/check-rebuild.sh, CHANGELOG.md, AGENTS.md, README.md, and MANUAL.md with verified hashes across nokia-argon, nokia-beatles, and nokia-coconut
This commit is contained in:
Luxferre committed 2026-11-15 18:00:10 +02:00
1 parent fc5c4282f5
commit ab53423e33
60 files changed
+2669 -453

No files matched your search

+3
View File
@@ -39,6 +39,9 @@ constexpr int kVfW = 240;
constexpr int kVfH = 180;
const char* getTorchBrightnessPath() {
if (::access("/sys/class/leds/camera:flash/brightness", R_OK) == 0) {
return "/sys/class/leds/camera:flash/brightness";
}
if (::access("/sys/class/leds/white:torch/brightness", R_OK) == 0) {
return "/sys/class/leds/white:torch/brightness";
}
+135 -12
View File
@@ -23,6 +23,15 @@
#include <linux/spinlock.h>
#include <linux/string.h>
#define MSM8905_TLMM_GPIO13_PHYS 0x0100d000UL
#define MSM8905_TLMM_GPIO13_SIZE 0x1000UL
#define GPIO13_CFG_REG 0x0000U
#define GPIO13_IO_REG 0x0004U
#define GPIO13_CFG_OUT_HIGH 0x02c0U /* OE | 8mA | no pull | func=0 (gpio) */
#define GPIO13_CFG_OUT_LOW 0x0201U /* OE | 2mA | pull-down | func=0 (gpio) */
#define GPIO13_IO_HIGH 0x0002U /* BIT(1) = GPIO_OUT high */
#define GPIO13_IO_LOW 0x0000U
#define MSM8905_TLMM_GPIO32_PHYS 0x01020000UL
#define MSM8905_TLMM_GPIO32_SIZE 0x1000UL
#define GPIO32_CFG_REG 0x0000U
@@ -69,14 +78,61 @@ static char next_reboot_mode[32];
module_param_string(next_reboot_mode, next_reboot_mode, sizeof(next_reboot_mode), 0644);
MODULE_PARM_DESC(next_reboot_mode, "Next reboot target mode (loader, bootloader, fastboot, edl)");
static void __iomem *tlmm_gpio13_base;
static void __iomem *tlmm_gpio32_base;
static void __iomem *gcc_camss_base;
static struct regmap *pon_regmap;
static struct sys_off_handler *pon_poweroff_handler;
static struct sys_off_handler *pon_restart_handler;
static DEFINE_SPINLOCK(torch_lock);
static bool is_coconut_dual_led;
static enum led_brightness top_torch_brightness = LED_OFF;
static enum led_brightness current_brightness = LED_OFF;
static void msm8905_top_torch_hw_enable(enum led_brightness value)
{
unsigned long flags;
if (!tlmm_gpio13_base)
return;
spin_lock_irqsave(&torch_lock, flags);
writel_relaxed(GPIO13_IO_HIGH, tlmm_gpio13_base + GPIO13_IO_REG);
writel_relaxed(GPIO13_CFG_OUT_HIGH, tlmm_gpio13_base + GPIO13_CFG_REG);
wmb();
top_torch_brightness = value;
spin_unlock_irqrestore(&torch_lock, flags);
}
static void msm8905_top_torch_hw_disable(void)
{
unsigned long flags;
if (!tlmm_gpio13_base)
return;
spin_lock_irqsave(&torch_lock, flags);
writel_relaxed(GPIO13_IO_LOW, tlmm_gpio13_base + GPIO13_IO_REG);
writel_relaxed(GPIO13_CFG_OUT_LOW, tlmm_gpio13_base + GPIO13_CFG_REG);
wmb();
top_torch_brightness = LED_OFF;
spin_unlock_irqrestore(&torch_lock, flags);
}
static void msm8905_top_torch_brightness_set(struct led_classdev *led_cdev,
enum led_brightness value)
{
if (value == LED_OFF)
msm8905_top_torch_hw_disable();
else
msm8905_top_torch_hw_enable(value);
}
static enum led_brightness msm8905_top_torch_brightness_get(struct led_classdev *led_cdev)
{
return top_torch_brightness;
}
static void msm8905_torch_hw_enable(enum led_brightness value)
{
unsigned long flags;
@@ -129,6 +185,12 @@ static void msm8905_torch_hw_disable(void)
spin_unlock_irqrestore(&torch_lock, flags);
}
static void msm8905_all_leds_hw_disable(void)
{
msm8905_top_torch_hw_disable();
msm8905_torch_hw_disable();
}
static void msm8905_torch_brightness_set(struct led_classdev *led_cdev,
enum led_brightness value)
{
@@ -151,6 +213,23 @@ static struct led_classdev msm8905_torch_led = {
.flags = LED_CORE_SUSPENDRESUME,
};
static struct led_classdev msm8905_top_torch_led = {
.name = "white:torch",
.max_brightness = LED_FULL,
.brightness_set = msm8905_top_torch_brightness_set,
.brightness_get = msm8905_top_torch_brightness_get,
.flags = LED_CORE_SUSPENDRESUME,
};
/* Use camera:flash (not white:flash) so sxmo_flashtoggle.sh stays on white:torch. */
static struct led_classdev msm8905_cam_flash_led = {
.name = "camera:flash",
.max_brightness = LED_FULL,
.brightness_set = msm8905_torch_brightness_set,
.brightness_get = msm8905_torch_brightness_get,
.flags = LED_CORE_SUSPENDRESUME,
};
static void msm8905_pon_config_reset(unsigned int rst_type)
{
unsigned int rev2 = 0;
@@ -257,7 +336,7 @@ static unsigned int msm8905_pon_prepare_restart_mode(const char *cmd)
static int msm8905_pon_sys_poweroff(struct sys_off_data *data)
{
msm8905_torch_hw_disable();
msm8905_all_leds_hw_disable();
if (pon_regmap)
regmap_write(pon_regmap, QPNP_PON_SOFT_RB_SPARE, 0x00U);
msm8905_pon_config_reset(PON_POWER_OFF_SHUTDOWN);
@@ -268,7 +347,7 @@ static int msm8905_pon_sys_restart(struct sys_off_data *data)
{
unsigned int rst_type;
msm8905_torch_hw_disable();
msm8905_all_leds_hw_disable();
rst_type = msm8905_pon_prepare_restart_mode(data ? data->cmd : NULL);
msm8905_pon_config_reset(rst_type);
return NOTIFY_DONE;
@@ -279,7 +358,7 @@ static int msm8905_pon_reboot_notify(struct notifier_block *nb,
{
unsigned int rst_type;
msm8905_torch_hw_disable();
msm8905_all_leds_hw_disable();
if (action == SYS_POWER_OFF || action == SYS_HALT)
rst_type = PON_POWER_OFF_SHUTDOWN;
@@ -356,11 +435,41 @@ static int __init msm8905_torch_init(void)
msm8905_torch_hw_disable();
ret = led_classdev_register(NULL, &msm8905_torch_led);
if (ret) {
iounmap(gcc_camss_base);
iounmap(tlmm_gpio32_base);
return ret;
is_coconut_dual_led = of_machine_is_compatible("nokia,coconut");
if (is_coconut_dual_led) {
tlmm_gpio13_base = ioremap(MSM8905_TLMM_GPIO13_PHYS, MSM8905_TLMM_GPIO13_SIZE);
if (!tlmm_gpio13_base) {
iounmap(gcc_camss_base);
iounmap(tlmm_gpio32_base);
return -ENOMEM;
}
msm8905_top_torch_hw_disable();
ret = led_classdev_register(NULL, &msm8905_top_torch_led);
if (ret) {
iounmap(tlmm_gpio13_base);
tlmm_gpio13_base = NULL;
iounmap(gcc_camss_base);
iounmap(tlmm_gpio32_base);
return ret;
}
ret = led_classdev_register(NULL, &msm8905_cam_flash_led);
if (ret) {
led_classdev_unregister(&msm8905_top_torch_led);
iounmap(tlmm_gpio13_base);
tlmm_gpio13_base = NULL;
iounmap(gcc_camss_base);
iounmap(tlmm_gpio32_base);
return ret;
}
} else {
ret = led_classdev_register(NULL, &msm8905_torch_led);
if (ret) {
iounmap(gcc_camss_base);
iounmap(tlmm_gpio32_base);
return ret;
}
}
msm8905_pon_lookup_regmap();
@@ -375,8 +484,13 @@ static int __init msm8905_torch_init(void)
msm8905_pon_sys_restart,
NULL);
pr_info("leds-msm8905-torch: registered white:torch on GPIO_32 (cci_timer1 150kHz PWM), pon_regmap=%s\n",
pon_regmap ? "ready" : "none");
if (is_coconut_dual_led) {
pr_info("leds-msm8905-torch: registered white:torch on GPIO_13 and camera:flash on GPIO_32 (cci_timer1 150kHz PWM), pon_regmap=%s\n",
pon_regmap ? "ready" : "none");
} else {
pr_info("leds-msm8905-torch: registered white:torch on GPIO_32 (cci_timer1 150kHz PWM), pon_regmap=%s\n",
pon_regmap ? "ready" : "none");
}
return 0;
}
@@ -387,8 +501,17 @@ static void __exit msm8905_torch_exit(void)
if (!IS_ERR_OR_NULL(pon_poweroff_handler))
unregister_sys_off_handler(pon_poweroff_handler);
unregister_reboot_notifier(&msm8905_pon_reboot_nb);
led_classdev_unregister(&msm8905_torch_led);
msm8905_torch_hw_disable();
if (is_coconut_dual_led) {
led_classdev_unregister(&msm8905_cam_flash_led);
led_classdev_unregister(&msm8905_top_torch_led);
} else {
led_classdev_unregister(&msm8905_torch_led);
}
msm8905_all_leds_hw_disable();
if (tlmm_gpio13_base) {
iounmap(tlmm_gpio13_base);
tlmm_gpio13_base = NULL;
}
iounmap(gcc_camss_base);
iounmap(tlmm_gpio32_base);
}