backlight: support backlight current align configuration for exp mode

lm3697 exp mode backlight current with the different curve to
other chips, add backlight current align configuration for
the same current at the same hal level, to support the same
brightness at the same hal level

Change-Id: Ib6ac8dc3bb36389ba2c885c3e4b986ac9316bdc4
Signed-off-by: tanhua1 <tanhua1@lenovo.com>
Reviewed-on: https://gerrit.mot.com/2045773
SLTApproved: Slta Waiver
SME-Granted: SME Approvals Granted
Tested-by: Jira Key
Reviewed-by: Dezhen Hou <houdz1@motorola.com>
Reviewed-by: Shanshan Dai <daiss1@motorola.com>
Reviewed-by: Xiangpo Zhao <zhaoxp3@motorola.com>
Submit-Approved: Jira Key
This commit is contained in:
tanhua1 2021-08-19 13:31:15 +08:00 • committed by Hua Tan
commit c7fa6f5281
2 changed files with 25 additions and 3 deletions

View file

@ -208,6 +208,9 @@ struct ti_lmu_bl {
/* Map type */
unsigned int map_type;
/* Align boost current to AW chip */
unsigned int led_current_align;
struct pwm_device *pwm;
};
@ -236,6 +239,11 @@ enum backlight_map_type {
LINEAR_TYPE
};
enum backlight_exp_current_align {
ALIGN_NONE,
ALIGN_AW99703
};
extern struct ti_lmu_bl_cfg lmu_bl_cfg[LMU_MAX_ID];
extern int ti_lmu_backlight_device_init(void);
extern void ti_lmu_backlight_exit(void);

View file

@ -246,7 +246,7 @@ static int ti_lmu_backlight_update_brightness_register(struct ti_lmu_bl *lmu_bl,
int ret;
// int i = 0;
regmap_write(regmap, 0x13, 0x22);
regmap_write(regmap, 0x13, 0x11);
if (lmu_bl->mode == BL_PWM_BASED) {
switch (cfg->pwm_action) {
@ -287,6 +287,14 @@ static int ti_lmu_backlight_update_brightness_register(struct ti_lmu_bl *lmu_bl,
if (!reginfo->brightness_lsb)
return -EINVAL;
if(lmu_bl->map_type == EXPONENTIAL_TYPE && lmu_bl->led_current_align) {
if(brightness) {
pr_info("[bkl] %s brightness = %d, align = %d\n", __func__,
brightness, lmu_bl->led_current_align);
brightness = brightness*8383/10000+324;
}
}
reg = reginfo->brightness_lsb[lmu_bl->bank_id];
ret = regmap_update_bits(regmap, reg,
LMU_BACKLIGHT_11BIT_LSB_MASK,
@ -430,6 +438,12 @@ static void ti_lmu_backlight_of_get_light_properties(struct device_node *np,
pr_info("[bkl] %s map_type default %d\n", __func__,
lmu_bl->map_type);
}
if(of_property_read_u32(np, "current-align-type", &lmu_bl->led_current_align)) {
lmu_bl->led_current_align = ALIGN_NONE;
pr_info("[bkl] %s led_current_align default %d, no align, keep as lm3697 exp mode\n", __func__,
lmu_bl->led_current_align);
}
}
static void ti_lmu_backlight_of_get_brightness_mode(struct device_node *np,
@ -619,8 +633,8 @@ static int ti_lmu_backlight_init(struct ti_lmu_bl_chip *chip)
regmap_write(regmap, 0x18, 0x15);//21.8mA default
regmap_write(regmap, 0x1A, boost_ctl);
regmap_write(regmap, 0x1C, 0x0E);
regmap_write(regmap, 0x22, 0x07);
regmap_write(regmap, 0x23, 0xFF);
//regmap_write(regmap, 0x22, 0x07);
//regmap_write(regmap, 0x23, 0xFF);
regmap_write(regmap, 0x24, 0x02);
regmap_write(regmap, 0xB4, 0x03);