0001
0002
0003
0004
0005 #ifndef _TI_LMU_COMMON_H_
0006 #define _TI_LMU_COMMON_H_
0007
0008 #include <linux/delay.h>
0009 #include <linux/device.h>
0010 #include <linux/init.h>
0011 #include <linux/leds.h>
0012 #include <linux/module.h>
0013 #include <linux/regmap.h>
0014 #include <linux/slab.h>
0015 #include <uapi/linux/uleds.h>
0016
0017 #define LMU_11BIT_LSB_MASK (BIT(0) | BIT(1) | BIT(2))
0018 #define LMU_11BIT_MSB_SHIFT 3
0019
0020 #define MAX_BRIGHTNESS_8BIT 255
0021 #define MAX_BRIGHTNESS_11BIT 2047
0022
0023 struct ti_lmu_bank {
0024 struct regmap *regmap;
0025
0026 int max_brightness;
0027
0028 u8 lsb_brightness_reg;
0029 u8 msb_brightness_reg;
0030
0031 u8 runtime_ramp_reg;
0032 u32 ramp_up_usec;
0033 u32 ramp_down_usec;
0034 };
0035
0036 int ti_lmu_common_set_brightness(struct ti_lmu_bank *lmu_bank, int brightness);
0037
0038 int ti_lmu_common_set_ramp(struct ti_lmu_bank *lmu_bank);
0039
0040 int ti_lmu_common_get_ramp_params(struct device *dev,
0041 struct fwnode_handle *child,
0042 struct ti_lmu_bank *lmu_data);
0043
0044 int ti_lmu_common_get_brt_res(struct device *dev, struct fwnode_handle *child,
0045 struct ti_lmu_bank *lmu_data);
0046
0047 #endif