mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-12 15:49:17 -04:00
backlight: add aw99703 led boost configuration
support lm3697 led boost configuration 1. boost ovp 2. boost ocp 3. default brightness Change-Id: Ia6254adad216153fdcd1d7f1d40b9eb68d828acd Signed-off-by: tanhua1 <tanhua1@lenovo.com> Reviewed-on: https://gerrit.mot.com/2045770 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:
parent
910fe173b5
commit
50da0f843a
2 changed files with 34 additions and 9 deletions
|
|
@ -277,7 +277,7 @@ static int aw99703_backlight_init(struct aw99703_data *drvdata)
|
|||
aw99703_i2c_write_bit(drvdata->client,
|
||||
AW99703_REG_BSTCTR1,
|
||||
AW99703_BSTCTR1_OVPSEL_MASK,
|
||||
AW99703_BSTCTR1_OVPSEL_38V);
|
||||
drvdata->ovp_level);
|
||||
|
||||
/*switch frequency 1000kHz*/
|
||||
aw99703_i2c_write_bit(drvdata->client,
|
||||
|
|
@ -289,7 +289,7 @@ static int aw99703_backlight_init(struct aw99703_data *drvdata)
|
|||
aw99703_i2c_write_bit(drvdata->client,
|
||||
AW99703_REG_BSTCTR1,
|
||||
AW99703_BSTCTR1_OCPSEL_MASK,
|
||||
AW99703_BSTCTR1_OCPSEL_3P3A);
|
||||
drvdata->ocp_level);
|
||||
|
||||
/*BSTCRT2 IDCTSEL*/
|
||||
if (drvdata->bl_reconfig_enable && (AW99703_REG_BSTCTR2 == drvdata->bl_slow_reg)) {
|
||||
|
|
@ -511,13 +511,19 @@ aw99703_get_dt_data(struct device *dev, struct aw99703_data *drvdata)
|
|||
pr_info("%s using_lsb --<%d>\n", __func__, drvdata->using_lsb);
|
||||
|
||||
if (drvdata->using_lsb) {
|
||||
drvdata->default_brightness = 0x7ff;
|
||||
drvdata->max_brightness = 2047;
|
||||
} else {
|
||||
drvdata->default_brightness = 0xff;
|
||||
drvdata->max_brightness = 255;
|
||||
}
|
||||
|
||||
rc = of_property_read_u32(np, "aw99703,default-brightness", &drvdata->default_brightness);
|
||||
if (rc != 0) {
|
||||
drvdata->default_brightness = drvdata->max_brightness;
|
||||
pr_err("%s default-brightness not found, set to max %d\n", __func__, drvdata->default_brightness);
|
||||
}
|
||||
else
|
||||
pr_info("%s default-brightness=%d\n", __func__, drvdata->default_brightness);
|
||||
|
||||
rc = of_property_read_u32(np, "aw99703,bl-fscal-led", &temp);
|
||||
if (rc) {
|
||||
pr_err("Invalid backlight full-scale led current!\n");
|
||||
|
|
@ -577,6 +583,24 @@ aw99703_get_dt_data(struct device *dev, struct aw99703_data *drvdata)
|
|||
else
|
||||
pr_info("%s bl_map=%d\n", __func__, drvdata->bl_map);
|
||||
|
||||
rc = of_property_read_u32(np, "aw99703,ovp-level", &temp);
|
||||
if (rc) {
|
||||
drvdata->ovp_level = AW99703_BSTCTR1_OVPSEL_38V;
|
||||
pr_err("ovp-level not found, set default %x!\n", drvdata->ovp_level);
|
||||
} else {
|
||||
drvdata->ovp_level = temp<<2;
|
||||
pr_info("%s ovp_level %x\n", __func__, drvdata->ovp_level);
|
||||
}
|
||||
|
||||
rc = of_property_read_u32(np, "aw99703,ocp-level", &temp);
|
||||
if (rc) {
|
||||
drvdata->ocp_level = AW99703_BSTCTR1_OCPSEL_2P7A;
|
||||
pr_err("ocp-level not found, set default %x!\n", drvdata->ocp_level);
|
||||
} else {
|
||||
drvdata->ocp_level = temp;
|
||||
pr_info("%s ocp_level %x\n", __func__, drvdata->ocp_level);
|
||||
}
|
||||
|
||||
rc = of_property_read_u32(np, "aw99703,bl-slow-reg", &drvdata->bl_slow_reg);
|
||||
if (!rc) {
|
||||
const char *reconfg_panel;
|
||||
|
|
@ -721,7 +745,7 @@ static int aw99703_probe(struct i2c_client *client,
|
|||
aw99703_backlight_init(drvdata);
|
||||
aw99703_backlight_enable(drvdata);
|
||||
|
||||
aw99703_set_brightness(drvdata, MAX_BRIGHTNESS);
|
||||
aw99703_set_brightness(drvdata, drvdata->default_brightness);
|
||||
err = sysfs_create_group(&client->dev.kobj, &aw99703_attribute_group);
|
||||
if (err < 0) {
|
||||
dev_info(&client->dev, "%s error creating sysfs attr files\n",
|
||||
|
|
|
|||
|
|
@ -154,10 +154,10 @@ const unsigned char aw99703_reg_access[AW99703_REG_MAX] = {
|
|||
#define AW99703_BSTCTR1_OVPSEL_38V (3<<2)
|
||||
#define AW99703_BSTCTR1_OVPSEL_41P5V (4<<2)
|
||||
#define AW99703_BSTCTR1_OCPSEL_MASK (~(3<<0))
|
||||
#define AW99703_BSTCTR1_OCPSEL_0P7A (0<<0)
|
||||
#define AW99703_BSTCTR1_OCPSEL_1P6A (1<<0)
|
||||
#define AW99703_BSTCTR1_OCPSEL_2P46A (2<<0)
|
||||
#define AW99703_BSTCTR1_OCPSEL_3P3A (3<<0)
|
||||
#define AW99703_BSTCTR1_OCPSEL_0P9A (0<<0)
|
||||
#define AW99703_BSTCTR1_OCPSEL_1P8A (1<<0)
|
||||
#define AW99703_BSTCTR1_OCPSEL_2P7A (2<<0)
|
||||
#define AW99703_BSTCTR1_OCPSEL_3P4A (3<<0)
|
||||
|
||||
/*BSTCTR2:0x05*/
|
||||
#define AW99703_BSTCTR2_AFEN_MASK (~(1<<7))
|
||||
|
|
@ -242,6 +242,7 @@ struct aw99703_data {
|
|||
unsigned int i2c_trans_dim;
|
||||
unsigned int channel;
|
||||
unsigned int ovp_level;
|
||||
unsigned int ocp_level;
|
||||
unsigned int frequency;
|
||||
unsigned int default_brightness;
|
||||
unsigned int max_brightness;
|
||||
|
|
|
|||
Loading…
Reference in a new issue