File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -105,6 +105,7 @@ struct macaudio_snd_data {
105105
106106 const struct macaudio_platform_cfg * cfg ;
107107 bool has_speakers ;
108+ bool has_sense ;
108109 bool has_safety ;
109110 unsigned int max_channels ;
110111
@@ -569,6 +570,8 @@ static int macaudio_parse_of(struct macaudio_snd_data *ma)
569570 continue ;
570571 }
571572 ma -> has_speakers = 1 ;
573+ if (ma -> cfg -> amp != AMP_SSM3515 && ma -> cfg -> safe_vol != 0 )
574+ ma -> has_sense = 1 ;
572575 }
573576
574577 cpu = of_get_child_by_name (np , "cpu" );
@@ -670,6 +673,18 @@ static int macaudio_parse_of(struct macaudio_snd_data *ma)
670673 for (i = 0 ; i < ARRAY_SIZE (macaudio_fe_links ); i ++ )
671674 card -> dai_link [i ].platforms -> of_node = platform ;
672675
676+ /* Skip the speaker sense PCM link if this amp has no sense (or no speakers) */
677+ if (!ma -> has_sense ) {
678+ for (i = 0 ; i < ARRAY_SIZE (macaudio_fe_links ); i ++ ) {
679+ if (ma -> link_props [i ].is_sense ) {
680+ memmove (& card -> dai_link [i ], & card -> dai_link [i + 1 ],
681+ (num_links - i - 1 ) * sizeof (struct snd_soc_dai_link ));
682+ num_links -- ;
683+ break ;
684+ }
685+ }
686+ }
687+
673688 card -> num_links = num_links ;
674689
675690 return 0 ;
You can’t perform that action at this time.
0 commit comments