leds-qti-flash.h 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. /* SPDX-License-Identifier: GPL-2.0-only */
  2. /*
  3. * Copyright (c) 2020, The Linux Foundation. All rights reserved.
  4. */
  5. #ifndef __LEDS_QTI_FLASH_H
  6. #define __LEDS_QTI_FLASH_H
  7. #include <linux/leds.h>
  8. #define ENABLE_REGULATOR BIT(0)
  9. #define DISABLE_REGULATOR BIT(1)
  10. #define QUERY_MAX_AVAIL_CURRENT BIT(2)
  11. /**
  12. * struct flash_led_param: QTI flash LED parameter data
  13. * @on_time_ms : Time to wait before strobing the switch
  14. * @off_time_ms : Time to wait to turn off LED after strobing switch
  15. */
  16. struct flash_led_param {
  17. u64 on_time_ms;
  18. u64 off_time_ms;
  19. };
  20. #if IS_ENABLED(CONFIG_LEDS_QTI_FLASH)
  21. int qti_flash_led_prepare(struct led_trigger *trig,
  22. int options, int *max_current);
  23. int qti_flash_led_set_param(struct led_trigger *trig,
  24. struct flash_led_param param);
  25. #if IS_ENABLED(CONFIG_SENSORS_STK6D2X) || IS_ENABLED(CONFIG_SENSORS_TSL2511)
  26. int qti_flash_led_set_strobe_sel(struct led_trigger *trig,
  27. int strobe_sel);
  28. #endif
  29. #else
  30. static inline int qti_flash_led_prepare(struct led_trigger *trig,
  31. int options, int *max_current)
  32. {
  33. return -EINVAL;
  34. }
  35. static inline int qti_flash_led_set_param(struct led_trigger *trig,
  36. struct flash_led_param param);
  37. {
  38. return -EINVAL;
  39. }
  40. #if IS_ENABLED(CONFIG_SENSORS_STK6D2X)
  41. static inline int qti_flash_led_set_strobe_sel(struct led_trigger *trig,
  42. int strobe_sel);
  43. {
  44. return -EINVAL;
  45. }
  46. #endif
  47. #endif
  48. #endif