Skip to content

Commit aa28bed

Browse files
author
Emil Dahl Juhl
committed
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 <[email protected]> (cherry picked from commit bc5477a)
1 parent 7449597 commit aa28bed

File tree

1 file changed

+25
-34
lines changed

1 file changed

+25
-34
lines changed

drivers/led/lp5569.c

Lines changed: 25 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -23,27 +23,26 @@
2323
#include <zephyr/logging/log.h>
2424
LOG_MODULE_REGISTER(lp5569, CONFIG_LED_LOG_LEVEL);
2525

26-
#define LP5569_NUM_LEDS 9
26+
#define LP5569_NUM_LEDS 9
2727

2828
/* General Registers */
29-
#define LP5569_CONFIG 0x00
30-
#define LP5569_CHIP_EN BIT(6)
29+
#define LP5569_CONFIG 0x00
30+
#define LP5569_CHIP_EN BIT(6)
3131

32-
#define LP5569_MISC 0x2F
33-
#define LP5569_POWERSAVE_EN BIT(5)
34-
#define LP5569_CP_MODE_SHIFT 3
32+
#define LP5569_MISC 0x2F
33+
#define LP5569_POWERSAVE_EN BIT(5)
34+
#define LP5569_CP_MODE_SHIFT 3
3535

3636
/* PWM base Register for controlling the duty-cycle */
37-
#define LP5569_LED0_PWM 0x16
37+
#define LP5569_LED0_PWM 0x16
3838

3939
struct lp5569_config {
4040
struct i2c_dt_spec bus;
4141
struct gpio_dt_spec enable_gpio;
4242
const uint8_t cp_mode;
4343
};
4444

45-
static int lp5569_led_set_brightness(const struct device *dev, uint32_t led,
46-
uint8_t brightness)
45+
static int lp5569_led_set_brightness(const struct device *dev, uint32_t led, uint8_t brightness)
4746
{
4847
const struct lp5569_config *config = dev->config;
4948
uint8_t val;
@@ -94,28 +93,25 @@ static int lp5569_enable(const struct device *dev)
9493
return -ENODEV;
9594
}
9695

97-
ret = gpio_pin_configure_dt(&config->enable_gpio,
98-
GPIO_OUTPUT_ACTIVE);
96+
ret = gpio_pin_configure_dt(&config->enable_gpio, GPIO_OUTPUT_ACTIVE);
9997
if (ret < 0) {
100-
LOG_ERR("Failed to configure enable_gpio, err: %d",
101-
ret);
98+
LOG_ERR("Failed to configure enable_gpio, err: %d", ret);
10299
return ret;
103100
}
104101

105102
/* datasheet 7.9: t_en max 3 ms for chip initialization */
106103
k_msleep(3);
107104
}
108105

109-
ret = i2c_reg_write_byte_dt(&config->bus, LP5569_CONFIG,
110-
LP5569_CHIP_EN);
106+
ret = i2c_reg_write_byte_dt(&config->bus, LP5569_CONFIG, LP5569_CHIP_EN);
111107
if (ret < 0) {
112108
LOG_ERR("Enable LP5569 failed");
113109
return ret;
114110
}
115111

116112
ret = i2c_reg_write_byte_dt(&config->bus, LP5569_MISC,
117113
LP5569_POWERSAVE_EN |
118-
(config->cp_mode << LP5569_CP_MODE_SHIFT));
114+
(config->cp_mode << LP5569_CP_MODE_SHIFT));
119115
if (ret < 0) {
120116
LOG_ERR("LED reg update failed");
121117
return ret;
@@ -139,8 +135,7 @@ static int lp5569_init(const struct device *dev)
139135
}
140136

141137
#ifdef CONFIG_PM_DEVICE
142-
static int lp5569_pm_action(const struct device *dev,
143-
enum pm_device_action action)
138+
static int lp5569_pm_action(const struct device *dev, enum pm_device_action action)
144139
{
145140
const struct lp5569_config *config = dev->config;
146141
int ret;
@@ -156,8 +151,7 @@ static int lp5569_pm_action(const struct device *dev,
156151
break;
157152
case PM_DEVICE_ACTION_TURN_OFF:
158153
case PM_DEVICE_ACTION_SUSPEND:
159-
ret = i2c_reg_update_byte_dt(&config->bus, LP5569_CONFIG,
160-
LP5569_CHIP_EN, 0);
154+
ret = i2c_reg_update_byte_dt(&config->bus, LP5569_CONFIG, LP5569_CHIP_EN, 0);
161155
if (ret < 0) {
162156
LOG_ERR("Disable LP5569 failed");
163157
return ret;
@@ -177,20 +171,17 @@ static const struct led_driver_api lp5569_led_api = {
177171
.off = lp5569_led_off,
178172
};
179173

180-
#define LP5569_DEFINE(id) \
181-
static const struct lp5569_config lp5569_config_##id = { \
182-
.bus = I2C_DT_SPEC_INST_GET(id), \
183-
.enable_gpio = GPIO_DT_SPEC_INST_GET_OR(id, enable_gpios, {0}), \
184-
.cp_mode = DT_ENUM_IDX(DT_DRV_INST(id), charge_pump_mode), \
185-
}; \
186-
\
187-
PM_DEVICE_DT_INST_DEFINE(id, lp5569_pm_action); \
188-
\
189-
DEVICE_DT_INST_DEFINE(id, &lp5569_init, \
190-
PM_DEVICE_DT_INST_GET(id), \
191-
NULL, \
192-
&lp5569_config_##id, POST_KERNEL, \
193-
CONFIG_LED_INIT_PRIORITY, \
174+
#define LP5569_DEFINE(id) \
175+
static const struct lp5569_config lp5569_config_##id = { \
176+
.bus = I2C_DT_SPEC_INST_GET(id), \
177+
.enable_gpio = GPIO_DT_SPEC_INST_GET_OR(id, enable_gpios, {0}), \
178+
.cp_mode = DT_ENUM_IDX(DT_DRV_INST(id), charge_pump_mode), \
179+
}; \
180+
\
181+
PM_DEVICE_DT_INST_DEFINE(id, lp5569_pm_action); \
182+
\
183+
DEVICE_DT_INST_DEFINE(id, &lp5569_init, PM_DEVICE_DT_INST_GET(id), NULL, \
184+
&lp5569_config_##id, POST_KERNEL, CONFIG_LED_INIT_PRIORITY, \
194185
&lp5569_led_api);
195186

196187
DT_INST_FOREACH_STATUS_OKAY(LP5569_DEFINE)

0 commit comments

Comments
 (0)