backlight: add lm3697 hbm current mode configuration

Support lm3697 hbm current mode configuration.
Default is 20mA, if any project support hbm,
add current-mode with current level in dtsi.

Change-Id: I5f4afec88b669104ca872048186e23f8ff8194a8
Signed-off-by: tanhua1 <tanhua1@lenovo.com>
Reviewed-on: https://gerrit.mot.com/2007975
SME-Granted: SME Approvals Granted
SLTApproved: Slta Waiver
Tested-by: Jira Key
Reviewed-by: Xiangpo Zhao <zhaoxp3@motorola.com>
Submit-Approved: Jira Key
This commit is contained in:
tanhua1 2021-07-09 16:55:33 +08:00 • committed by Hua Tan
commit b720cdf2d7
2 changed files with 15 additions and 3 deletions

View file

@ -196,6 +196,10 @@ struct ti_lmu_bl {
/* Only valid in PWM mode */
unsigned int pwm_period;
/* current mode */
unsigned int led_current_mode;
struct pwm_device *pwm;
};

View file

@ -293,7 +293,7 @@ static int ti_lmu_backlight_update_brightness_register(struct ti_lmu_bl *lmu_bl,
brightness);
if (ret)
return ret;
pr_debug("[bkl][after]11bit %s brightness = %d\n", __func__, brightness);
pr_info("[bkl][after]11bit %s brightness = %d\n", __func__, brightness);
val = (brightness >> LMU_BACKLIGHT_11BIT_MSB_SHIFT) & 0xFF;
} else {
val = brightness & 0xFF;
@ -405,6 +405,12 @@ static void ti_lmu_backlight_of_get_light_properties(struct device_node *np,
of_property_read_u32(np, "ramp-up-msec", &lmu_bl->ramp_up_msec);
of_property_read_u32(np, "ramp-down-msec", &lmu_bl->ramp_down_msec);
if(of_property_read_u32(np, "current-mode", &lmu_bl->led_current_mode)) {
lmu_bl->led_current_mode = HBM_MODE_DEFAULT;
pr_info("[bkl] %s led_current_mode default %d\n", __func__,
lmu_bl->led_current_mode);
}
}
static void ti_lmu_backlight_of_get_brightness_mode(struct device_node *np,
@ -782,10 +788,12 @@ ti_lmu_backlight_register(struct device *dev, struct ti_lmu *lmu,
goto err_init;
}
dump_i2c_reg(chip);
bl_chip = chip;
ti_hbm_set(chip->lmu_bl->led_current_mode);
dump_i2c_reg(chip);
ret = device_create_file(dev, &dev_attr_i2c_reg_dump);
if (ret < 0) {
dev_err(dev, "failed to create dev_attr_i2c_reg_dump\n");