ASoC: mid-x86: Use the soc-jack apis for jack type detection
PATCH 1/1 ASoC: mid-x86: Use the soc-jack apis for jack type detection
From: Vinod Koul <[email protected]>
This patch modifies the mfld_machine to use the new jack apis for adding the voltage zones for jack type detection. It also modifed TI sn95031 codec driver to use these new apis
Signed-off-by Vinod Koul <[email protected]>
Signed-off-by Harsha Priya <[email protected]>
--- sound/soc/codecs/sn95031.c | 4 +--- sound/soc/mid-x86/mfld_machine.c | 12 ++++++++++++ 2 files changed, 13 insertions(+), 3 deletions(-)
sound/soc/codecs/sn95031.c +1 -3
@@ -782,9 +782,7 @@ static int sn95031_get_headset_state(struct snd_soc_jack *mfld_jack) {int micbias =sn95031_get_mic_bias (mfld_jack->codec); -/* Defaulting to HEADSET for now. -* will change after adding soc-jack detection apis */ -int jack_type =SND_JACK_HEADSET ; +int jack_type =snd_soc_jack_get_type (mfld_jack, micbias);pr_debug ("jack type detected = %d\n" , jack_type);if (jack_type ==SND_JACK_HEADSET )
sound/soc/mid-x86/mfld_machine.c +12 -0
@@ -74,6 +74,12 @@ static struct snd_soc_jack_pin mfld_jack_pins[] = { }, }; +/* jack detection voltage zones */ +static struct snd_soc_jack_zone mfld_zones[] = { + {MFLD_MV_START ,MFLD_MV_AM_HS ,SND_JACK_HEADPHONE }, + {MFLD_MV_AM_HS ,MFLD_MV_HS ,SND_JACK_HEADSET }, +}; +/* sound card controls */ static const char *headset_switch_text[] = {"Earpiece" ,"Headset" };
@@ -264,6 +270,12 @@ static int mfld_init(struct snd_soc_pcm_runtime *runtime)pr_err ("adding jack pins failed\n" );return ret_val; } + ret_val =snd_soc_jack_add_zones (&mfld_jack, +ARRAY_SIZE (mfld_zones), mfld_zones); +if (ret_val) { +pr_err ("adding jack zones failed\n" ); +return ret_val; + }/* we want to check if anything is inserted at boot, * so send a fake event to codec and it will read adc
Signature · 1 line
1.7.2.3
Quoted 9 lines · Vinod
From: Vinod Koul <[email protected]>
This patch modifies the
mfld_machineto use the new jack apis for adding the voltage zones for jack type detection. It also modifed TI sn95031 codec driver to use these new apisSigned-off-by Vinod Koul <[email protected]>Signed-off-by Harsha Priya <[email protected]>---
Acked-by Liam Girdwood <[email protected]>
Signature · 3 lines
Freelance Developer, SlimLogic Ltd ASoC and Voltage Regulator Maintainer. http://www.slimlogic.co.uk
Mark Brown
AppliedQuoted 5 lines · Vinod
From: Vinod Koul <[email protected]>
This patch modifies the
mfld_machineto use the new jack apis for adding the voltage zones for jack type detection. It also modifed TI sn95031 codec driver to use these new apis
Applied, thanks.