summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWalter Yang <yandongy@codeaurora.org>2016-07-18 19:07:55 -0700
committerGerrit - the friendly Code Review server <code-review@localhost>2016-08-17 22:18:41 -0700
commit669c51e0d9c2b40683d977fc685336087a0eb953 (patch)
treee162bb4b5926525a1e0c72ad2e36acae9bbe2913
parent008f057bbab6dd6629b7e1a3b8c67b650a6b9ef1 (diff)
ASoC: msm: add pinctrl support for wcd934x hifi hph switches
Add pinctrl support in machine driver to control hph_en0/hph_en1 gpios owned by wcd934x. Change-Id: I99a7746259c563379d060c10bbd602d3e6a65746 Signed-off-by: Walter Yang <yandongy@codeaurora.org>
-rw-r--r--sound/soc/msm/msmcobalt.c29
1 files changed, 19 insertions, 10 deletions
diff --git a/sound/soc/msm/msmcobalt.c b/sound/soc/msm/msmcobalt.c
index 4d2347aabb25..cdf64efa9ad4 100644
--- a/sound/soc/msm/msmcobalt.c
+++ b/sound/soc/msm/msmcobalt.c
@@ -107,6 +107,8 @@ struct msm_asoc_mach_data {
int hph_en0_gpio;
int us_euro_gpio; /* used by gpio driver API */
struct device_node *us_euro_gpio_p; /* used by pinctrl API */
+ struct device_node *hph_en1_gpio_p; /* used by pinctrl API */
+ struct device_node *hph_en0_gpio_p; /* used by pinctrl API */
struct snd_info_entry *codec_root;
};
@@ -3968,17 +3970,24 @@ static int msm_asoc_machine_probe(struct platform_device *pdev)
pdata->hph_en1_gpio = of_get_named_gpio(pdev->dev.of_node,
"qcom,hph-en1-gpio", 0);
- if (pdata->hph_en1_gpio < 0) {
- dev_dbg(&pdev->dev, "%s: %s property not found %d\n",
- __func__, "qcom,hph-en1-gpio", pdata->hph_en1_gpio);
+ if (!gpio_is_valid(pdata->hph_en1_gpio))
+ pdata->hph_en1_gpio_p = of_parse_phandle(pdev->dev.of_node,
+ "qcom,hph-en1-gpio", 0);
+ if (!gpio_is_valid(pdata->hph_en1_gpio) && (!pdata->hph_en1_gpio_p)) {
+ dev_dbg(&pdev->dev, "property %s not detected in node %s",
+ "qcom,hph-en1-gpio", pdev->dev.of_node->full_name);
}
pdata->hph_en0_gpio = of_get_named_gpio(pdev->dev.of_node,
"qcom,hph-en0-gpio", 0);
- if (pdata->hph_en0_gpio < 0) {
- dev_dbg(&pdev->dev, "%s: %s property not found %d\n",
- __func__, "qcom,hph-en0-gpio", pdata->hph_en0_gpio);
+ if (!gpio_is_valid(pdata->hph_en0_gpio))
+ pdata->hph_en0_gpio_p = of_parse_phandle(pdev->dev.of_node,
+ "qcom,hph-en0-gpio", 0);
+ if (!gpio_is_valid(pdata->hph_en0_gpio) && (!pdata->hph_en0_gpio_p)) {
+ dev_dbg(&pdev->dev, "property %s not detected in node %s",
+ "qcom,hph-en0-gpio", pdev->dev.of_node->full_name);
}
+
ret = msm_prepare_hifi(card);
if (ret)
dev_dbg(&pdev->dev, "msm_prepare_hifi failed (%d)\n",
@@ -4020,11 +4029,11 @@ static int msm_asoc_machine_probe(struct platform_device *pdev)
*/
pdata->us_euro_gpio = of_get_named_gpio(pdev->dev.of_node,
"qcom,us-euro-gpios", 0);
- if (pdata->us_euro_gpio < 0)
+ if (!gpio_is_valid(pdata->us_euro_gpio))
pdata->us_euro_gpio_p = of_parse_phandle(pdev->dev.of_node,
"qcom,us-euro-gpios", 0);
- if ((pdata->us_euro_gpio < 0) && (!pdata->us_euro_gpio_p)) {
- dev_info(&pdev->dev, "property %s not detected in node %s",
+ if (!gpio_is_valid(pdata->us_euro_gpio) && (!pdata->us_euro_gpio_p)) {
+ dev_dbg(&pdev->dev, "property %s not detected in node %s",
"qcom,us-euro-gpios", pdev->dev.of_node->full_name);
} else {
dev_dbg(&pdev->dev, "%s detected",
@@ -4034,7 +4043,7 @@ static int msm_asoc_machine_probe(struct platform_device *pdev)
ret = msm_prepare_us_euro(card);
if (ret)
- dev_info(&pdev->dev, "msm_prepare_us_euro failed (%d)\n",
+ dev_dbg(&pdev->dev, "msm_prepare_us_euro failed (%d)\n",
ret);
return 0;
err: