asoc: codecs: Tanggu reset pin and supplies

Enable power supplies and reset of Tanggu

CRs-Fixed: 2281591
Change-Id: I7d693263f328b51d2f333bddac5e15e98a5f9f51
Signed-off-by: Tanya Dixit <tdixit@codeaurora.org>
This commit is contained in:
Tanya Dixit 2018-08-09 14:29:51 +05:30
parent e1d192895c
commit 6256c5b989
2 changed files with 34 additions and 2 deletions
asoc/codecs/wcd937x

View file

@ -71,6 +71,7 @@ struct wcd937x_priv {
tx_port_mapping[MAX_PORT][MAX_CH_PER_PORT];
struct codec_port_info
rx_port_mapping[MAX_PORT][MAX_CH_PER_PORT];
struct regulator_bulk_data *supplies;
};
struct wcd937x_micbias_setting {
@ -85,6 +86,9 @@ struct wcd937x_pdata {
struct device_node *rx_slave;
struct device_node *tx_slave;
struct wcd937x_micbias_setting micbias;
struct cdc_regulator *regulator;
int num_supplies;
};
enum {

View file

@ -29,6 +29,7 @@
#include "wcd937x-registers.h"
#include "../msm-cdc-pinctrl.h"
#include <dt-bindings/sound/audio-codec-port-types.h>
#include "../msm-cdc-supply.h"
#define WCD9370_VARIANT 0
#define WCD9375_VARIANT 5
@ -1734,15 +1735,24 @@ struct wcd937x_pdata *wcd937x_populate_dt_data(struct device *dev)
return NULL;
pdata->rst_np = of_parse_phandle(dev->of_node,
"qcom,wcd937x-reset-node", 0);
"qcom,wcd-rst-gpio-node", 0);
if (!pdata->rst_np) {
dev_err(dev, "%s: Looking up %s property in node %s failed\n",
__func__, "qcom,wcd937x-reset-node",
__func__, "qcom,wcd-rst-gpio-node",
dev->of_node->full_name);
return NULL;
}
/* Parse power supplies */
msm_cdc_get_power_supplies(dev, &pdata->regulator,
&pdata->num_supplies);
if (!pdata->regulator || (pdata->num_supplies <= 0)) {
dev_err(dev, "%s: no power supplies defined for codec\n",
__func__);
return NULL;
}
pdata->rx_slave = of_parse_phandle(dev->of_node, "qcom,rx-slave", 0);
pdata->tx_slave = of_parse_phandle(dev->of_node, "qcom,tx-slave", 0);
@ -1775,6 +1785,24 @@ static int wcd937x_bind(struct device *dev)
* as per HW requirement.
*/
usleep_range(5000, 5010);
ret = msm_cdc_init_supplies(dev, &wcd937x->supplies,
pdata->regulator, pdata->num_supplies);
if (!wcd937x->supplies) {
dev_err(dev, "%s: Cannot init wcd supplies\n",
__func__);
return ret;
}
ret = msm_cdc_enable_static_supplies(dev, wcd937x->supplies,
pdata->regulator,
pdata->num_supplies);
if (ret) {
dev_err(dev, "%s: wcd static supply enable failed!\n",
__func__);
return ret;
}
ret = component_bind_all(dev, wcd937x);
if (ret) {
dev_err(dev, "%s: Slave bind failed, ret = %d\n",