drivers: led: lp5569: add charge pump configuration
The lp5569 controller contains an internal charge pump which can be useful for driving LEDs with a forward voltage greater than the lp5569 supply. Taking advantage of the charge pump can alleviate the need for an external boost converter. Add a dts property, charge-pump-mode, to the ti,lp5569 binding with which the cp_mode bits of the MISC register will be configured. Following the datasheet, the possible configurations are: 0x00 -> disabled (default) 0x01 -> 1x mode 0x10 -> 1.5x mode 0x11 -> auto mode Signed-off-by: Emil Juhl <emdj@bang-olufsen.dk>
This commit is contained in:
parent
635e41e70f
commit
47f9040bfa
3 changed files with 22 additions and 1 deletions
|
@ -137,6 +137,8 @@ Drivers and Sensors
|
||||||
|
|
||||||
* LED
|
* LED
|
||||||
|
|
||||||
|
* lp5569: added ``charge-pump-mode`` property to configure the charge pump of the lp5569.
|
||||||
|
|
||||||
* LED Strip
|
* LED Strip
|
||||||
|
|
||||||
* LoRa
|
* LoRa
|
||||||
|
|
|
@ -30,12 +30,14 @@ LOG_MODULE_REGISTER(lp5569, CONFIG_LED_LOG_LEVEL);
|
||||||
|
|
||||||
#define LP5569_MISC 0x2F
|
#define LP5569_MISC 0x2F
|
||||||
#define LP5569_POWERSAVE_EN BIT(5)
|
#define LP5569_POWERSAVE_EN BIT(5)
|
||||||
|
#define LP5569_CP_MODE_SHIFT 3
|
||||||
|
|
||||||
/* PWM base Register for controlling the duty-cycle */
|
/* PWM base Register for controlling the duty-cycle */
|
||||||
#define LP5569_LED0_PWM 0x16
|
#define LP5569_LED0_PWM 0x16
|
||||||
|
|
||||||
struct lp5569_config {
|
struct lp5569_config {
|
||||||
struct i2c_dt_spec bus;
|
struct i2c_dt_spec bus;
|
||||||
|
const uint8_t cp_mode;
|
||||||
};
|
};
|
||||||
|
|
||||||
static int lp5569_led_set_brightness(const struct device *dev, uint32_t led,
|
static int lp5569_led_set_brightness(const struct device *dev, uint32_t led,
|
||||||
|
@ -91,7 +93,8 @@ static int lp5569_enable(const struct device *dev)
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = i2c_reg_write_byte_dt(&config->bus, LP5569_MISC,
|
ret = i2c_reg_write_byte_dt(&config->bus, LP5569_MISC,
|
||||||
LP5569_POWERSAVE_EN);
|
LP5569_POWERSAVE_EN |
|
||||||
|
(config->cp_mode << LP5569_CP_MODE_SHIFT));
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
LOG_ERR("LED reg update failed");
|
LOG_ERR("LED reg update failed");
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -156,6 +159,7 @@ static const struct led_driver_api lp5569_led_api = {
|
||||||
#define LP5569_DEFINE(id) \
|
#define LP5569_DEFINE(id) \
|
||||||
static const struct lp5569_config lp5569_config_##id = { \
|
static const struct lp5569_config lp5569_config_##id = { \
|
||||||
.bus = I2C_DT_SPEC_INST_GET(id), \
|
.bus = I2C_DT_SPEC_INST_GET(id), \
|
||||||
|
.cp_mode = DT_ENUM_IDX(DT_DRV_INST(id), charge_pump_mode), \
|
||||||
}; \
|
}; \
|
||||||
\
|
\
|
||||||
PM_DEVICE_DT_INST_DEFINE(id, lp5569_pm_action); \
|
PM_DEVICE_DT_INST_DEFINE(id, lp5569_pm_action); \
|
||||||
|
|
|
@ -3,3 +3,18 @@ description: TI LP5569 LED
|
||||||
compatible: "ti,lp5569"
|
compatible: "ti,lp5569"
|
||||||
|
|
||||||
include: i2c-device.yaml
|
include: i2c-device.yaml
|
||||||
|
|
||||||
|
properties:
|
||||||
|
charge-pump-mode:
|
||||||
|
type: string
|
||||||
|
default: "disabled"
|
||||||
|
enum:
|
||||||
|
- "disabled"
|
||||||
|
- "1x"
|
||||||
|
- "1x5"
|
||||||
|
- "auto"
|
||||||
|
description: |
|
||||||
|
If provided, configures the internal charge-pump mode in the MISC
|
||||||
|
register. This can be useful to supply a higher voltage to the LEDs, than
|
||||||
|
what the lp5569 is being supplied.
|
||||||
|
The default corresponds to the reset value of the register.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue