leds-ti-lmu-common.h 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. // TI LMU Common Core
  3. // Copyright (C) 2018 Texas Instruments Incorporated - https://www.ti.com/
  4. #ifndef _TI_LMU_COMMON_H_
  5. #define _TI_LMU_COMMON_H_
  6. #include <linux/delay.h>
  7. #include <linux/device.h>
  8. #include <linux/init.h>
  9. #include <linux/leds.h>
  10. #include <linux/module.h>
  11. #include <linux/regmap.h>
  12. #include <linux/slab.h>
  13. #include <uapi/linux/uleds.h>
  14. #define LMU_11BIT_LSB_MASK (BIT(0) | BIT(1) | BIT(2))
  15. #define LMU_11BIT_MSB_SHIFT 3
  16. #define MAX_BRIGHTNESS_8BIT 255
  17. #define MAX_BRIGHTNESS_11BIT 2047
  18. struct ti_lmu_bank {
  19. struct regmap *regmap;
  20. int max_brightness;
  21. u8 lsb_brightness_reg;
  22. u8 msb_brightness_reg;
  23. u8 runtime_ramp_reg;
  24. u32 ramp_up_usec;
  25. u32 ramp_down_usec;
  26. };
  27. int ti_lmu_common_set_brightness(struct ti_lmu_bank *lmu_bank, int brightness);
  28. int ti_lmu_common_set_ramp(struct ti_lmu_bank *lmu_bank);
  29. int ti_lmu_common_get_ramp_params(struct device *dev,
  30. struct fwnode_handle *child,
  31. struct ti_lmu_bank *lmu_data);
  32. int ti_lmu_common_get_brt_res(struct device *dev, struct fwnode_handle *child,
  33. struct ti_lmu_bank *lmu_data);
  34. #endif /* _TI_LMU_COMMON_H_ */