@@ -456,21 +456,13 @@ static const struct snd_kcontrol_new sof_controls[] = {
456456
457457};
458458
459- static const struct snd_kcontrol_new speaker_controls [] = {
460- SOC_DAPM_PIN_SWITCH ("Spk" ),
461- };
462-
463459static const struct snd_soc_dapm_widget sof_widgets [] = {
464460 SND_SOC_DAPM_HP ("Headphone Jack" , NULL ),
465461 SND_SOC_DAPM_MIC ("Headset Mic" , NULL ),
466462 SND_SOC_DAPM_SPK ("Left Spk" , NULL ),
467463 SND_SOC_DAPM_SPK ("Right Spk" , NULL ),
468464};
469465
470- static const struct snd_soc_dapm_widget speaker_widgets [] = {
471- SND_SOC_DAPM_SPK ("Spk" , NULL ),
472- };
473-
474466static const struct snd_soc_dapm_widget dmic_widgets [] = {
475467 SND_SOC_DAPM_MIC ("SoC DMIC" , NULL ),
476468};
@@ -484,11 +476,6 @@ static const struct snd_soc_dapm_route sof_map[] = {
484476 { "IN1P" , NULL , "Headset Mic" },
485477};
486478
487- static const struct snd_soc_dapm_route speaker_map [] = {
488- /* speaker */
489- { "Spk" , NULL , "Speaker" },
490- };
491-
492479static const struct snd_soc_dapm_route speaker_map_lr [] = {
493480 { "Left Spk" , NULL , "Left SPO" },
494481 { "Right Spk" , NULL , "Right SPO" },
@@ -505,34 +492,6 @@ static int speaker_codec_init_lr(struct snd_soc_pcm_runtime *rtd)
505492 ARRAY_SIZE (speaker_map_lr ));
506493}
507494
508- static int speaker_codec_init (struct snd_soc_pcm_runtime * rtd )
509- {
510- struct snd_soc_card * card = rtd -> card ;
511- int ret ;
512-
513- ret = snd_soc_dapm_new_controls (& card -> dapm , speaker_widgets ,
514- ARRAY_SIZE (speaker_widgets ));
515- if (ret ) {
516- dev_err (rtd -> dev , "unable to add dapm controls, ret %d\n" , ret );
517- /* Don't need to add routes if widget addition failed */
518- return ret ;
519- }
520-
521- ret = snd_soc_add_card_controls (card , speaker_controls ,
522- ARRAY_SIZE (speaker_controls ));
523- if (ret ) {
524- dev_err (rtd -> dev , "unable to add card controls, ret %d\n" , ret );
525- return ret ;
526- }
527-
528- ret = snd_soc_dapm_add_routes (& card -> dapm , speaker_map ,
529- ARRAY_SIZE (speaker_map ));
530-
531- if (ret )
532- dev_err (rtd -> dev , "Speaker map addition failed: %d\n" , ret );
533- return ret ;
534- }
535-
536495static int dmic_init (struct snd_soc_pcm_runtime * rtd )
537496{
538497 struct snd_soc_card * card = rtd -> card ;
@@ -594,13 +553,6 @@ static struct snd_soc_dai_link_component dmic_component[] = {
594553 }
595554};
596555
597- static struct snd_soc_dai_link_component max98360a_component [] = {
598- {
599- .name = "MX98360A:00" ,
600- .dai_name = "HiFi" ,
601- }
602- };
603-
604556static struct snd_soc_dai_link_component rt1015_components [] = {
605557 {
606558 .name = "i2c-10EC1015:00" ,
@@ -775,9 +727,7 @@ static struct snd_soc_dai_link *sof_card_dai_links_create(struct device *dev,
775727 links [id ].dpcm_capture = 1 ;
776728 } else if (sof_rt5682_quirk &
777729 SOF_MAX98360A_SPEAKER_AMP_PRESENT ) {
778- links [id ].codecs = max98360a_component ;
779- links [id ].num_codecs = ARRAY_SIZE (max98360a_component );
780- links [id ].init = speaker_codec_init ;
730+ max_98360a_dai_link (& links [id ]);
781731 } else if (sof_rt5682_quirk &
782732 SOF_RT1011_SPEAKER_AMP_PRESENT ) {
783733 sof_rt1011_dai_link (& links [id ]);
0 commit comments