/* Program a command to set a fixed brightness to the given engine.  */
static int lp5562_program_set_brightness(const struct device *dev, enum lp5562_led_sources engine, uint8_t command_index, uint8_t brightness)
/* Program a command to set a fixed brightness to the given engine.  */
static int lp5562_program_set_brightness(const struct device *dev, enum lp5562_led_sources engine, uint8_t command_index, uint8_t brightness)
{
	struct lp5562_data *data = dev->data;
	struct led_data *dev_data = &data->dev_data;
	uint8_t val;
	if ((brightness < dev_data->min_brightness) ||
			(brightness > dev_data->max_brightness)) {
		return -EINVAL;
	}
	val = (brightness * 0xFF) / dev_data->max_brightness;
	return lp5562_program_command(dev, engine, command_index,
			LP5562_PROG_COMMAND_SET_PWM, val);
}