ASoC: intel: sof_rt5682: add remove function to disable jack

When removing sof module the rt5682 jack handler will oops
if jack detection is not disabled. So add remove function,
which disables the jack detection.

Signed-off-by: Jaska Uimonen <jaska.uimonen@intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20190927201408.925-5-pierre-louis.bossart@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
Jaska Uimonen 2019-09-27 15:14:08 -05:00 committed by Mark Brown
parent a315e76fc5
commit 6ba5041c23
No known key found for this signature in database
GPG Key ID: 24D68B725D5487D0
1 changed files with 16 additions and 0 deletions

View File

@ -648,8 +648,24 @@ static int sof_audio_probe(struct platform_device *pdev)
&sof_audio_card_rt5682); &sof_audio_card_rt5682);
} }
static int sof_rt5682_remove(struct platform_device *pdev)
{
struct snd_soc_card *card = platform_get_drvdata(pdev);
struct snd_soc_component *component = NULL;
for_each_card_components(card, component) {
if (!strcmp(component->name, rt5682_component[0].name)) {
snd_soc_component_set_jack(component, NULL, NULL);
break;
}
}
return 0;
}
static struct platform_driver sof_audio = { static struct platform_driver sof_audio = {
.probe = sof_audio_probe, .probe = sof_audio_probe,
.remove = sof_rt5682_remove,
.driver = { .driver = {
.name = "sof_rt5682", .name = "sof_rt5682",
.pm = &snd_soc_pm_ops, .pm = &snd_soc_pm_ops,