Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions Documentation/dt-bindings.md
Original file line number Diff line number Diff line change
Expand Up @@ -278,3 +278,26 @@ lk1st on boot, you can use this driver.
lk2nd doesn't implement a fully-fledged led subsystem. The only purpose for
this driver is for debugging and the LED behavior consistancy between lk1st
and lk2nd.

### Fixed Regulator

lk2nd supports the `regulator-fixed` node. This node follows upstream binding except
that most properties are not supported. Currently only `gpios` are supported in lk2nd.

```
reg_bl {
compatible = "regulator-gpio";
gpios = <&tlmm 9 GPIO_ACTIVE_HIGH>;
};
```

This driver is mainly for lk1st since no previous boot-loader is capable to
turn on those regulator that is requied by the panel and backlight.
If your device panel and backlight requied some regulator to be turned on,
you can use this driver.

lk2nd doesn't implement a fully-fledged regulator subsystem. The only purpose for
this driver is for turning on those regulator that is requied by the panel and backlight
and the regulator behavior consistancy between lk1st and lk2nd.


10 changes: 10 additions & 0 deletions lk2nd/device/dts/msm8909/apq8009-1gb-qrd-skue.dts
Original file line number Diff line number Diff line change
Expand Up @@ -48,5 +48,15 @@
compatible = "lenovo,boe-nt35523b";
};
};

reg_bl {
compatible = "regulator-fixed";
gpios = <&tlmm 9 GPIO_ACTIVE_HIGH>;
};

reg_lcd_3v3 {
compatible = "regulator-fixed";
gpios = <&tlmm 24 GPIO_ACTIVE_HIGH>;
};
};
};
10 changes: 10 additions & 0 deletions lk2nd/device/dts/msm8909/msm8909-1gb-qrd-skue.dts
Original file line number Diff line number Diff line change
Expand Up @@ -48,5 +48,15 @@
compatible = "lenovo,boe-nt35523b";
};
};

reg_bl {
compatible = "regulator-fixed";
gpios = <&tlmm 9 GPIO_ACTIVE_HIGH>;
};

reg_lcd_3v3 {
compatible = "regulator-fixed";
gpios = <&tlmm 24 GPIO_ACTIVE_HIGH>;
};
};
};
32 changes: 32 additions & 0 deletions lk2nd/device/regulator-fixed.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
// SPDX-License-Identifier: BSD-3-Clause
/* Copyright (c) 2025 exkc <[email protected]> */

#include <debug.h>
#include <libfdt.h>

#include <lk2nd/hw/gpio.h>

#include "device.h"

static int lk2nd_regulator_init(const void *dtb, int node)
{
int ret;

struct gpiol_desc desc;
dprintf(SPEW, " Initializing regulator-fixed for %s",
fdt_get_name(dtb, node, NULL));
ret = gpiol_get(dtb, node, NULL, &desc, GPIOL_FLAGS_OUT_ASSERTED);

if (ret) {
dprintf(CRITICAL, "regulator-gpio: Failed to get gpio for %s: %d\n",
fdt_get_name(dtb, node, NULL), ret);
}

dprintf(SPEW, " | label | gpio | active_low |\n");
dprintf(SPEW, " | %5s | 0x%02x 0x%04x | %d |\n",
fdt_get_name(dtb, node, NULL), desc.dev, desc.pin, desc.active_low);

return 0;
}

LK2ND_DEVICE_INIT("regulator-fixed", lk2nd_regulator_init);
1 change: 1 addition & 0 deletions lk2nd/device/rules.mk
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ OBJS += \
$(LOCAL_DIR)/panel.o \
$(LOCAL_DIR)/keys.o \
$(LOCAL_DIR)/leds.o \
$(LOCAL_DIR)/regulator-fixed.o \

ifneq ($(LK2ND_COMPATIBLE),)
DEFINES += LK2ND_COMPATIBLE="$(LK2ND_COMPATIBLE)"
Expand Down
Loading