asoc: wcd938x: Add vdd-buck as on demand supply

On lagoon, vdd-buck need to be dynamic supply.
Add required support to handle buck as dynamic supply.

Change-Id: If6c27fffe0d0c44f178e61a6eae6ef63775c8988
Signed-off-by: Laxminath Kasam <lkasam@codeaurora.org>
This commit is contained in:
Laxminath Kasam
2020-03-12 17:40:47 +05:30
committed by Gerrit - the friendly Code Review server
parent 93afa626ed
commit 1ecf8184d2
3 changed files with 144 additions and 0 deletions

View File

@@ -119,6 +119,47 @@ static int msm_cdc_check_supply_param(struct device *dev,
return 0;
}
/*
* msm_cdc_is_ondemand_supply:
* return if ondemand supply true or not
*
* @dev: pointer to codec device
* @supplies: pointer to regulator bulk data
* @cdc_vreg: pointer to platform regulator data
* @num_supplies: number of supplies
* @supply_name: supply name to be checked
*
* Return true/false
*/
bool msm_cdc_is_ondemand_supply(struct device *dev,
struct regulator_bulk_data *supplies,
struct cdc_regulator *cdc_vreg,
int num_supplies,
char *supply_name)
{
bool rc = false;
int ret, i;
if ((!supply_name) || (!supplies)) {
pr_err("%s: either dev or supplies or cdc_vreg is NULL\n",
__func__);
return rc;
}
/* input parameter validation */
ret = msm_cdc_check_supply_param(dev, cdc_vreg, num_supplies);
if (ret)
return rc;
for (i = 0; i < num_supplies; i++) {
if (cdc_vreg[i].ondemand &&
!strcmp(cdc_vreg[i].name, supply_name))
return true;
}
return rc;
}
EXPORT_SYMBOL(msm_cdc_is_ondemand_supply);
/*
* msm_cdc_disable_ondemand_supply:
* Disable codec ondemand supply