mirror of
https://github.com/team-infusion-developers/android_kernel_samsung_msm8976.git
synced 2024-09-21 11:53:01 +00:00
leds: leds-qpnp: Add flash_wa regulator support in flash led driver
Add flash_wa regulator support in flash led driver. The regulator raise the SMBB over temperature threshold before flash enabled, and restore to default setting after flash disable. CRs-Fixed: 697457 Change-Id: I3f376be749704b2c34c3ee99b4c155d28ad2b6b5 Signed-off-by: Chunmei Cai <ccai@codeaurora.org>
This commit is contained in:
parent
6b8f1a9f41
commit
f0a54ff948
|
@ -51,6 +51,7 @@ Optional properties for flash:
|
|||
- qcom,no-smbb-support: Specify if smbb boost is not required and there is a single regulator for both flash and torch.
|
||||
- flash-boost-supply: SMBB regulator for LED flash mode
|
||||
- torch-boost-supply: SMBB regulator for LED torch mode
|
||||
- flash-wa-supply: SMBB regulator for flash workarounds.
|
||||
|
||||
RGB Led is a tri-colored led, Red, Blue & Green.
|
||||
|
||||
|
|
|
@ -443,6 +443,7 @@ struct mpp_config_data {
|
|||
single regulator for both flash and torch
|
||||
* @flash_boost_reg - boost regulator for flash
|
||||
* @torch_boost_reg - boost regulator for torch
|
||||
* @flash_wa_reg - flash regulator for wa
|
||||
*/
|
||||
struct flash_config_data {
|
||||
u8 current_prgm;
|
||||
|
@ -465,6 +466,7 @@ struct flash_config_data {
|
|||
bool no_smbb_support;
|
||||
struct regulator *flash_boost_reg;
|
||||
struct regulator *torch_boost_reg;
|
||||
struct regulator *flash_wa_reg;
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -1117,6 +1119,15 @@ static int qpnp_flash_regulator_operate(struct qpnp_led_data *led, bool on)
|
|||
if (!regulator_on && !led->flash_cfg->flash_on) {
|
||||
for (i = 0; i < led->num_leds; i++) {
|
||||
if (led_array[i].flash_cfg->flash_reg_get) {
|
||||
rc = regulator_enable(
|
||||
led_array[i].flash_cfg->flash_wa_reg);
|
||||
if (rc) {
|
||||
dev_err(&led->spmi_dev->dev,
|
||||
"Flash_wa regulator enable failed(%d)\n",
|
||||
rc);
|
||||
return rc;
|
||||
}
|
||||
|
||||
rc = regulator_enable(
|
||||
led_array[i].flash_cfg->\
|
||||
flash_boost_reg);
|
||||
|
@ -1156,6 +1167,14 @@ regulator_turn_off:
|
|||
rc);
|
||||
return rc;
|
||||
}
|
||||
rc = regulator_disable(
|
||||
led_array[i].flash_cfg->flash_wa_reg);
|
||||
if (rc) {
|
||||
dev_err(&led->spmi_dev->dev,
|
||||
"Flash_wa regulator disable failed(%d)\n",
|
||||
rc);
|
||||
return rc;
|
||||
}
|
||||
led->flash_cfg->flash_on = false;
|
||||
}
|
||||
break;
|
||||
|
@ -3075,6 +3094,21 @@ static int qpnp_get_config_flash(struct qpnp_led_data *led,
|
|||
led->flash_cfg->no_smbb_support =
|
||||
of_property_read_bool(node, "qcom,no-smbb-support");
|
||||
|
||||
if (of_find_property(of_get_parent(node), "flash-wa-supply",
|
||||
NULL) && (!*reg_set)) {
|
||||
led->flash_cfg->flash_wa_reg =
|
||||
devm_regulator_get(&led->spmi_dev->dev,
|
||||
"flash-wa");
|
||||
if (IS_ERR_OR_NULL(led->flash_cfg->flash_wa_reg)) {
|
||||
rc = PTR_ERR(led->flash_cfg->flash_wa_reg);
|
||||
if (rc != EPROBE_DEFER) {
|
||||
dev_err(&led->spmi_dev->dev,
|
||||
"Falsh wa regulator get failed(%d)\n",
|
||||
rc);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (led->id == QPNP_ID_FLASH1_LED0) {
|
||||
led->flash_cfg->enable_module = FLASH_ENABLE_LED_0;
|
||||
led->flash_cfg->current_addr = FLASH_LED_0_CURR(led->base);
|
||||
|
|
Loading…
Reference in a new issue