diff options
author | Simmi Pateriya <simmip@codeaurora.org> | 2013-11-08 14:35:10 +0530 |
---|---|---|
committer | Simmi Pateriya <simmip@codeaurora.org> | 2014-01-24 12:25:04 +0530 |
commit | 2eae604f68f1551800c18ae5ea90bc9bcbfac07c (patch) | |
tree | 649aa342dddb01e15cddc0380605d8e3515f3b6b /sound/soc/msm/msm8226.c | |
parent | cfd122924db65844dcf0a5a468af27667a036aa5 (diff) |
ASoC: msm: Parse the jack type property
Parse the property from device tree to check
the jack type.
Change-Id: I9d91745ae1faa07501a49e31773e21a11bfe9bd4
Signed-off-by: Simmi Pateriya <simmip@codeaurora.org>
Diffstat (limited to 'sound/soc/msm/msm8226.c')
-rw-r--r-- | sound/soc/msm/msm8226.c | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/sound/soc/msm/msm8226.c b/sound/soc/msm/msm8226.c index fb34d2ec827a..44d40bb209a3 100644 --- a/sound/soc/msm/msm8226.c +++ b/sound/soc/msm/msm8226.c @@ -97,6 +97,7 @@ static struct wcd9xxx_mbhc_config mbhc_cfg = { .do_recalibration = true, .use_vddio_meas = true, .enable_anc_mic_detect = false, + .hw_jack_type = FOUR_POLE_JACK, }; struct msm_auxpcm_gpio { @@ -1974,6 +1975,7 @@ static int msm8226_asoc_machine_probe(struct platform_device *pdev) struct msm8226_asoc_mach_data *pdata; int ret; const char *auxpcm_pri_gpio_set = NULL; + const char *mbhc_audio_jack_type = NULL; if (!pdev->dev.of_node) { dev_err(&pdev->dev, "No platform supplied from device tree\n"); @@ -2038,6 +2040,35 @@ static int msm8226_asoc_machine_probe(struct platform_device *pdev) mbhc_cfg.gpio_level_insert = of_property_read_bool(pdev->dev.of_node, "qcom,headset-jack-type-NC"); + ret = of_property_read_string(pdev->dev.of_node, + "qcom,mbhc-audio-jack-type", &mbhc_audio_jack_type); + if (ret) { + dev_dbg(&pdev->dev, "Looking up %s property in node %s failed", + "qcom,mbhc-audio-jack-type", + pdev->dev.of_node->full_name); + mbhc_cfg.hw_jack_type = FOUR_POLE_JACK; + mbhc_cfg.enable_anc_mic_detect = false; + dev_dbg(&pdev->dev, "Jack type properties set to default"); + } else { + if (!strcmp(mbhc_audio_jack_type, "4-pole-jack")) { + mbhc_cfg.hw_jack_type = FOUR_POLE_JACK; + mbhc_cfg.enable_anc_mic_detect = false; + dev_dbg(&pdev->dev, "This hardware has 4 pole jack"); + } else if (!strcmp(mbhc_audio_jack_type, "5-pole-jack")) { + mbhc_cfg.hw_jack_type = FIVE_POLE_JACK; + mbhc_cfg.enable_anc_mic_detect = true; + dev_dbg(&pdev->dev, "This hardware has 5 pole jack"); + } else if (!strcmp(mbhc_audio_jack_type, "6-pole-jack")) { + mbhc_cfg.hw_jack_type = SIX_POLE_JACK; + mbhc_cfg.enable_anc_mic_detect = true; + dev_dbg(&pdev->dev, "This hardware has 6 pole jack"); + } else { + mbhc_cfg.hw_jack_type = FOUR_POLE_JACK; + mbhc_cfg.enable_anc_mic_detect = false; + dev_dbg(&pdev->dev, "Unknown value, hence setting to default"); + } + } + ret = snd_soc_register_card(card); if (ret) { dev_err(&pdev->dev, "snd_soc_register_card failed (%d)\n", |