@@ -1886,13 +1886,51 @@ static int dpcm_fe_dai_hw_free(struct snd_pcm_substream *substream)
18861886 return 0 ;
18871887}
18881888
1889+ static int dpcm_be_dai_hw_params_init (struct snd_soc_pcm_runtime * fe , int stream )
1890+ {
1891+ struct snd_pcm_hw_params * params = & fe -> dpcm [stream ].hw_params ;
1892+ int k ;
1893+
1894+ for (k = SNDRV_PCM_HW_PARAM_FIRST_MASK ;
1895+ k <= SNDRV_PCM_HW_PARAM_LAST_MASK ; k ++ )
1896+ snd_mask_any (hw_param_mask (params , k ));
1897+
1898+ for (k = SNDRV_PCM_HW_PARAM_FIRST_INTERVAL ;
1899+ k <= SNDRV_PCM_HW_PARAM_LAST_INTERVAL ; k ++ )
1900+ snd_interval_any (hw_param_interval (params , k ));
1901+
1902+ if (fe -> dai_link -> dpcm_merged_format ) {
1903+ memcpy (hw_param_interval (& fe -> dpcm [stream ].hw_params ,
1904+ SNDRV_PCM_HW_PARAM_FORMAT ),
1905+ hw_param_interval (params , SNDRV_PCM_HW_PARAM_FORMAT ),
1906+ sizeof (struct snd_interval ));
1907+ }
1908+ if (fe -> dai_link -> dpcm_merged_chan ) {
1909+ memcpy (hw_param_interval (& fe -> dpcm [stream ].hw_params ,
1910+ SNDRV_PCM_HW_PARAM_CHANNELS ),
1911+ hw_param_interval (params , SNDRV_PCM_HW_PARAM_CHANNELS ),
1912+ sizeof (struct snd_interval ));
1913+ }
1914+ if (fe -> dai_link -> dpcm_merged_rate ) {
1915+ memcpy (hw_param_interval (& fe -> dpcm [stream ].hw_params ,
1916+ SNDRV_PCM_HW_PARAM_RATE ),
1917+ hw_param_interval (params , SNDRV_PCM_HW_PARAM_RATE ),
1918+ sizeof (struct snd_interval ));
1919+ }
1920+
1921+ return 0 ;
1922+ }
1923+
18891924int dpcm_be_dai_hw_params (struct snd_soc_pcm_runtime * fe , int stream )
18901925{
18911926 struct snd_soc_pcm_runtime * be ;
18921927 struct snd_pcm_substream * be_substream ;
18931928 struct snd_soc_dpcm * dpcm ;
18941929 int ret ;
18951930
1931+ /* initialize the BE HW params */
1932+ dpcm_be_dai_hw_params_init (fe , stream );
1933+
18961934 for_each_dpcm_be (fe , stream , dpcm ) {
18971935 be = dpcm -> be ;
18981936 be_substream = snd_soc_dpcm_get_substream (be , stream );
@@ -1976,54 +2014,15 @@ int dpcm_be_dai_hw_params(struct snd_soc_pcm_runtime *fe, int stream)
19762014 return ret ;
19772015}
19782016
1979- static int dpcm_be_dai_hw_params_init (struct snd_soc_pcm_runtime * fe , int stream )
1980- {
1981- struct snd_pcm_hw_params * params = & fe -> dpcm [stream ].hw_params ;
1982- int k ;
1983-
1984- for (k = SNDRV_PCM_HW_PARAM_FIRST_MASK ;
1985- k <= SNDRV_PCM_HW_PARAM_LAST_MASK ; k ++ )
1986- snd_mask_any (hw_param_mask (params , k ));
1987-
1988- for (k = SNDRV_PCM_HW_PARAM_FIRST_INTERVAL ;
1989- k <= SNDRV_PCM_HW_PARAM_LAST_INTERVAL ; k ++ )
1990- snd_interval_any (hw_param_interval (params , k ));
1991-
1992- return 0 ;
1993- }
1994-
19952017static int dpcm_fe_dai_hw_params (struct snd_pcm_substream * substream ,
19962018 struct snd_pcm_hw_params * params )
19972019{
19982020 struct snd_soc_pcm_runtime * fe = asoc_substream_to_rtd (substream );
19992021 int ret , stream = substream -> stream ;
2000- struct snd_interval * t , * dpcm_t ;
20012022
20022023 mutex_lock_nested (& fe -> card -> mutex , SND_SOC_CARD_CLASS_RUNTIME );
20032024 dpcm_set_fe_update_state (fe , stream , SND_SOC_DPCM_UPDATE_FE );
20042025
2005- /* initialize the BE HW params */
2006- dpcm_be_dai_hw_params_init (fe , stream );
2007-
2008- if (fe -> dai_link -> dpcm_merged_format ) {
2009- memcpy (hw_param_interval (& fe -> dpcm [stream ].hw_params ,
2010- SNDRV_PCM_HW_PARAM_FORMAT ),
2011- hw_param_interval (params , SNDRV_PCM_HW_PARAM_FORMAT ),
2012- sizeof (struct snd_interval ));
2013- }
2014- if (fe -> dai_link -> dpcm_merged_chan ) {
2015- memcpy (hw_param_interval (& fe -> dpcm [stream ].hw_params ,
2016- SNDRV_PCM_HW_PARAM_CHANNELS ),
2017- hw_param_interval (params , SNDRV_PCM_HW_PARAM_CHANNELS ),
2018- sizeof (struct snd_interval ));
2019- }
2020- if (fe -> dai_link -> dpcm_merged_rate ) {
2021- memcpy (hw_param_interval (& fe -> dpcm [stream ].hw_params ,
2022- SNDRV_PCM_HW_PARAM_RATE ),
2023- hw_param_interval (params , SNDRV_PCM_HW_PARAM_RATE ),
2024- sizeof (struct snd_interval ));
2025- }
2026-
20272026 ret = dpcm_be_dai_hw_params (fe , stream );
20282027 if (ret < 0 )
20292028 goto out ;
0 commit comments