diff options
author | Hans de Goede <hdegoede@redhat.com> | 2018-03-04 15:36:01 +0100 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2018-03-07 14:18:09 +0000 |
commit | aed859a2c7ac8c44ba9b3a6f82b5f08da8a0a975 (patch) | |
tree | 3d3531a417137ff8a47a73a9efc10132fb7d08fc /sound | |
parent | c2f26938d2a456dcf429385617e58cfd510a64a8 (diff) |
ASoC: Intel: bytcr_rt5651: Only create jack if we have a jack-detect source
Only create the jack if we have a valid jack-detect source and properly
check the snd_soc_component_set_jack() return value.
Tested-by: Carlo Caione <carlo@endlessm.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'sound')
-rw-r--r-- | sound/soc/intel/boards/bytcr_rt5651.c | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/sound/soc/intel/boards/bytcr_rt5651.c b/sound/soc/intel/boards/bytcr_rt5651.c index a874bba3aec0..56f1f076d92c 100644 --- a/sound/soc/intel/boards/bytcr_rt5651.c +++ b/sound/soc/intel/boards/bytcr_rt5651.c @@ -404,17 +404,21 @@ static int byt_rt5651_init(struct snd_soc_pcm_runtime *runtime) dev_err(card->dev, "unable to set MCLK rate\n"); } - ret = snd_soc_card_jack_new(runtime->card, "Headset", + if (BYT_RT5651_JDSRC(byt_rt5651_quirk)) { + ret = snd_soc_card_jack_new(runtime->card, "Headset", SND_JACK_HEADSET, &priv->jack, bytcr_jack_pins, ARRAY_SIZE(bytcr_jack_pins)); - if (ret) { - dev_err(runtime->dev, "Headset jack creation failed %d\n", ret); - return ret; - } + if (ret) { + dev_err(runtime->dev, "jack creation failed %d\n", ret); + return ret; + } - snd_soc_component_set_jack(codec, &priv->jack, NULL); + ret = snd_soc_component_set_jack(codec, &priv->jack, NULL); + if (ret) + return ret; + } - return ret; + return 0; } static const struct snd_soc_pcm_stream byt_rt5651_dai_params = { |