drivers: led: lp5569: run clang-format
Run clang-format on drivers/led/lp5569.c to align formatting in the file. No functional changes intended. Signed-off-by: Emil Dahl Juhl <emdj@bang-olufsen.dk>
This commit is contained in:
parent
f53a401758
commit
bc5477ab10
1 changed files with 25 additions and 34 deletions
|
@ -23,18 +23,18 @@
|
|||
#include <zephyr/logging/log.h>
|
||||
LOG_MODULE_REGISTER(lp5569, CONFIG_LED_LOG_LEVEL);
|
||||
|
||||
#define LP5569_NUM_LEDS 9
|
||||
#define LP5569_NUM_LEDS 9
|
||||
|
||||
/* General Registers */
|
||||
#define LP5569_CONFIG 0x00
|
||||
#define LP5569_CHIP_EN BIT(6)
|
||||
#define LP5569_CONFIG 0x00
|
||||
#define LP5569_CHIP_EN BIT(6)
|
||||
|
||||
#define LP5569_MISC 0x2F
|
||||
#define LP5569_POWERSAVE_EN BIT(5)
|
||||
#define LP5569_CP_MODE_SHIFT 3
|
||||
#define LP5569_MISC 0x2F
|
||||
#define LP5569_POWERSAVE_EN BIT(5)
|
||||
#define LP5569_CP_MODE_SHIFT 3
|
||||
|
||||
/* PWM base Register for controlling the duty-cycle */
|
||||
#define LP5569_LED0_PWM 0x16
|
||||
#define LP5569_LED0_PWM 0x16
|
||||
|
||||
struct lp5569_config {
|
||||
struct i2c_dt_spec bus;
|
||||
|
@ -42,8 +42,7 @@ struct lp5569_config {
|
|||
const uint8_t cp_mode;
|
||||
};
|
||||
|
||||
static int lp5569_led_set_brightness(const struct device *dev, uint32_t led,
|
||||
uint8_t brightness)
|
||||
static int lp5569_led_set_brightness(const struct device *dev, uint32_t led, uint8_t brightness)
|
||||
{
|
||||
const struct lp5569_config *config = dev->config;
|
||||
uint8_t val;
|
||||
|
@ -94,11 +93,9 @@ static int lp5569_enable(const struct device *dev)
|
|||
return -ENODEV;
|
||||
}
|
||||
|
||||
ret = gpio_pin_configure_dt(&config->enable_gpio,
|
||||
GPIO_OUTPUT_ACTIVE);
|
||||
ret = gpio_pin_configure_dt(&config->enable_gpio, GPIO_OUTPUT_ACTIVE);
|
||||
if (ret < 0) {
|
||||
LOG_ERR("Failed to configure enable_gpio, err: %d",
|
||||
ret);
|
||||
LOG_ERR("Failed to configure enable_gpio, err: %d", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -106,8 +103,7 @@ static int lp5569_enable(const struct device *dev)
|
|||
k_msleep(3);
|
||||
}
|
||||
|
||||
ret = i2c_reg_write_byte_dt(&config->bus, LP5569_CONFIG,
|
||||
LP5569_CHIP_EN);
|
||||
ret = i2c_reg_write_byte_dt(&config->bus, LP5569_CONFIG, LP5569_CHIP_EN);
|
||||
if (ret < 0) {
|
||||
LOG_ERR("Enable LP5569 failed");
|
||||
return ret;
|
||||
|
@ -115,7 +111,7 @@ static int lp5569_enable(const struct device *dev)
|
|||
|
||||
ret = i2c_reg_write_byte_dt(&config->bus, LP5569_MISC,
|
||||
LP5569_POWERSAVE_EN |
|
||||
(config->cp_mode << LP5569_CP_MODE_SHIFT));
|
||||
(config->cp_mode << LP5569_CP_MODE_SHIFT));
|
||||
if (ret < 0) {
|
||||
LOG_ERR("LED reg update failed");
|
||||
return ret;
|
||||
|
@ -139,8 +135,7 @@ static int lp5569_init(const struct device *dev)
|
|||
}
|
||||
|
||||
#ifdef CONFIG_PM_DEVICE
|
||||
static int lp5569_pm_action(const struct device *dev,
|
||||
enum pm_device_action action)
|
||||
static int lp5569_pm_action(const struct device *dev, enum pm_device_action action)
|
||||
{
|
||||
const struct lp5569_config *config = dev->config;
|
||||
int ret;
|
||||
|
@ -156,8 +151,7 @@ static int lp5569_pm_action(const struct device *dev,
|
|||
break;
|
||||
case PM_DEVICE_ACTION_TURN_OFF:
|
||||
case PM_DEVICE_ACTION_SUSPEND:
|
||||
ret = i2c_reg_update_byte_dt(&config->bus, LP5569_CONFIG,
|
||||
LP5569_CHIP_EN, 0);
|
||||
ret = i2c_reg_update_byte_dt(&config->bus, LP5569_CONFIG, LP5569_CHIP_EN, 0);
|
||||
if (ret < 0) {
|
||||
LOG_ERR("Disable LP5569 failed");
|
||||
return ret;
|
||||
|
@ -177,20 +171,17 @@ static const struct led_driver_api lp5569_led_api = {
|
|||
.off = lp5569_led_off,
|
||||
};
|
||||
|
||||
#define LP5569_DEFINE(id) \
|
||||
static const struct lp5569_config lp5569_config_##id = { \
|
||||
.bus = I2C_DT_SPEC_INST_GET(id), \
|
||||
.enable_gpio = GPIO_DT_SPEC_INST_GET_OR(id, enable_gpios, {0}), \
|
||||
.cp_mode = DT_ENUM_IDX(DT_DRV_INST(id), charge_pump_mode), \
|
||||
}; \
|
||||
\
|
||||
PM_DEVICE_DT_INST_DEFINE(id, lp5569_pm_action); \
|
||||
\
|
||||
DEVICE_DT_INST_DEFINE(id, &lp5569_init, \
|
||||
PM_DEVICE_DT_INST_GET(id), \
|
||||
NULL, \
|
||||
&lp5569_config_##id, POST_KERNEL, \
|
||||
CONFIG_LED_INIT_PRIORITY, \
|
||||
#define LP5569_DEFINE(id) \
|
||||
static const struct lp5569_config lp5569_config_##id = { \
|
||||
.bus = I2C_DT_SPEC_INST_GET(id), \
|
||||
.enable_gpio = GPIO_DT_SPEC_INST_GET_OR(id, enable_gpios, {0}), \
|
||||
.cp_mode = DT_ENUM_IDX(DT_DRV_INST(id), charge_pump_mode), \
|
||||
}; \
|
||||
\
|
||||
PM_DEVICE_DT_INST_DEFINE(id, lp5569_pm_action); \
|
||||
\
|
||||
DEVICE_DT_INST_DEFINE(id, &lp5569_init, PM_DEVICE_DT_INST_GET(id), NULL, \
|
||||
&lp5569_config_##id, POST_KERNEL, CONFIG_LED_INIT_PRIORITY, \
|
||||
&lp5569_led_api);
|
||||
|
||||
DT_INST_FOREACH_STATUS_OKAY(LP5569_DEFINE)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue