Lines Matching full:engine
104 /* Values for execution engine programs. */
215 * @brief Get the base address for programs of the given execution engine.
217 * @param engine Engine the base address is requested for.
221 * @retval -EINVAL If a source is given that is not a valid engine.
223 static int lp5562_get_engine_ram_base_addr(enum lp5562_led_sources engine, in lp5562_get_engine_ram_base_addr() argument
226 switch (engine) { in lp5562_get_engine_ram_base_addr()
246 * The engine with the highest index is placed on the lowest two bits in the
249 * @param engine Engine the shift is requested for.
253 * @retval -EINVAL If a source is given that is not a valid engine.
255 static int lp5562_get_engine_reg_shift(enum lp5562_led_sources engine, in lp5562_get_engine_reg_shift() argument
258 switch (engine) { in lp5562_get_engine_reg_shift()
277 * step_time for the execution engine programs.
365 * @brief Request whether an engine is currently running.
368 * @param engine Engine to check.
370 * @return Indication of the engine execution state.
372 * @retval true If the engine is currently running.
373 * @retval false If the engine is not running or an error occurred.
376 enum lp5562_led_sources engine) in lp5562_is_engine_executing() argument
382 ret = lp5562_get_engine_reg_shift(engine, &shift); in lp5562_is_engine_executing()
402 * @brief Get an available execution engine that is currently unused.
405 * @param engine Pointer to the engine ID.
411 enum lp5562_led_sources *engine) in lp5562_get_available_engine() argument
417 LOG_DBG("Available engine: %d", src); in lp5562_get_available_engine()
418 *engine = src; in lp5562_get_available_engine()
423 LOG_ERR("No unused engine available"); in lp5562_get_available_engine()
429 * @brief Set an register shifted for the given execution engine.
432 * @param engine Engine the value is shifted for.
440 enum lp5562_led_sources engine, in lp5562_set_engine_reg() argument
447 ret = lp5562_get_engine_reg_shift(engine, &shift); in lp5562_set_engine_reg()
461 * @brief Set the operational mode of the given engine.
464 * @param engine Engine the operational mode is changed for.
471 enum lp5562_led_sources engine, in lp5562_set_engine_op_mode() argument
474 return lp5562_set_engine_reg(dev, engine, LP5562_OP_MODE, mode); in lp5562_set_engine_op_mode()
478 * @brief Set the execution state of the given engine.
481 * @param engine Engine the execution state is changed for.
488 enum lp5562_led_sources engine, in lp5562_set_engine_exec_state() argument
493 ret = lp5562_set_engine_reg(dev, engine, LP5562_ENABLE, state); in lp5562_set_engine_exec_state()
505 * @brief Start the execution of the program of the given engine.
508 * @param engine Engine that is started.
514 enum lp5562_led_sources engine) in lp5562_start_program_exec() argument
516 if (lp5562_set_engine_op_mode(dev, engine, LP5562_OP_MODE_RUN)) { in lp5562_start_program_exec()
520 return lp5562_set_engine_exec_state(dev, engine, in lp5562_start_program_exec()
525 * @brief Stop the execution of the program of the given engine.
528 * @param engine Engine that is stopped.
534 enum lp5562_led_sources engine) in lp5562_stop_program_exec() argument
536 if (lp5562_set_engine_op_mode(dev, engine, LP5562_OP_MODE_DISABLED)) { in lp5562_stop_program_exec()
540 return lp5562_set_engine_exec_state(dev, engine, in lp5562_stop_program_exec()
545 * @brief Program a command to the memory of the given execution engine.
548 * @param engine Engine that is programmed.
555 * engine is passed.
559 enum lp5562_led_sources engine, in lp5562_program_command() argument
572 ret = lp5562_get_engine_ram_base_addr(engine, &prog_base_addr); in lp5562_program_command()
596 * @brief Program a command to set a fixed brightness to the given engine.
599 * @param engine Engine to be programmed.
608 enum lp5562_led_sources engine, in lp5562_program_set_brightness() argument
623 return lp5562_program_command(dev, engine, command_index, in lp5562_program_set_brightness()
634 * @param engine Engine to be programmed.
645 enum lp5562_led_sources engine, in lp5562_program_ramp() argument
663 return lp5562_program_command(dev, engine, command_index, in lp5562_program_ramp()
672 * @param engine Engine to be programmed.
681 enum lp5562_led_sources engine, in lp5562_program_wait() argument
689 return lp5562_program_ramp(dev, engine, command_index, in lp5562_program_wait()
699 * @param engine Engine to be programmed.
704 * engine is passed.
708 enum lp5562_led_sources engine, in lp5562_program_go_to_start() argument
711 return lp5562_program_command(dev, engine, command_index, 0x00, 0x00); in lp5562_program_go_to_start()
730 * @param engine Engine running the blinking program.
734 * @retval -EINVAL If the engine ID or brightness is out of range.
738 enum lp5562_led_sources engine, in lp5562_update_blinking_brightness() argument
743 ret = lp5562_stop_program_exec(dev, engine); in lp5562_update_blinking_brightness()
748 ret = lp5562_set_engine_op_mode(dev, engine, LP5562_OP_MODE_LOAD); in lp5562_update_blinking_brightness()
754 ret = lp5562_program_set_brightness(dev, engine, 0, brightness_on); in lp5562_update_blinking_brightness()
759 ret = lp5562_start_program_exec(dev, engine); in lp5562_update_blinking_brightness()
774 enum lp5562_led_sources engine; in lp5562_led_blink() local
779 * whether the "led" is in PWM mode or using an Engine. in lp5562_led_blink()
781 ret = lp5562_get_led_source(dev, led, &engine); in lp5562_led_blink()
786 /* Find and assign new engine only if the "led" is not using any. */ in lp5562_led_blink()
787 if (engine == LP5562_SOURCE_PWM) { in lp5562_led_blink()
788 ret = lp5562_get_available_engine(dev, &engine); in lp5562_led_blink()
793 ret = lp5562_set_led_source(dev, led, engine); in lp5562_led_blink()
800 ret = lp5562_set_engine_op_mode(dev, engine, LP5562_OP_MODE_LOAD); in lp5562_led_blink()
805 ret = lp5562_program_set_brightness(dev, engine, command_index, in lp5562_led_blink()
811 ret = lp5562_program_wait(dev, engine, ++command_index, delay_on); in lp5562_led_blink()
816 ret = lp5562_program_set_brightness(dev, engine, ++command_index, in lp5562_led_blink()
822 ret = lp5562_program_wait(dev, engine, ++command_index, delay_off); in lp5562_led_blink()
827 ret = lp5562_program_go_to_start(dev, engine, ++command_index); in lp5562_led_blink()
832 ret = lp5562_start_program_exec(dev, engine); in lp5562_led_blink()