1. 08 Feb, 2021 13 commits
  2. 05 Feb, 2021 15 commits
  3. 04 Feb, 2021 8 commits
  4. 03 Feb, 2021 4 commits
    • Mark Brown's avatar
      Merge series "ASoC: soc-pcm: cleanup soc_new_pcm() and bugfix" from Kuninori... · 1c4273a5
      Mark Brown authored
      Merge series "ASoC: soc-pcm: cleanup soc_new_pcm() and bugfix" from Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>:
      
      Hi Mark
      
      These are soc-pcm cleanup patchset.
      
      	1) - 3) : cleanup soc_new_pcm() function
      	4)      : cleanup dpcm_runtime_merge_xxx() function
      	5)      : bugfix of snd_pcm_limit_hw_rates() order
      
      Kuninori Morimoto (5):
        1) ASoC: soc-pcm: tidyup pcm setting
        2) ASoC: soc-pcm: add soc_get_playback_capture() and simplify soc_new_pcm()
        3) ASoC: soc-pcm: add soc_create_pcm() and simplify soc_new_pcm()
        4) ASoC: soc-pcm: use snd_pcm_hardware at dpcm_runtime_merge_xxx()
        5) ASoC: soc-pcm: fixup snd_pcm_limit_hw_rates() timing
      
       sound/soc/soc-pcm.c | 124 +++++++++++++++++++++++++++-----------------
       1 file changed, 75 insertions(+), 49 deletions(-)
      
      --
      2.25.1
      1c4273a5
    • Kuninori Morimoto's avatar
      ASoC: soc-pcm: fixup snd_pcm_limit_hw_rates() timing · dd5abc78
      Kuninori Morimoto authored
      soc-pcm has snd_pcm_limit_hw_rates() which determine rate_min/rate_max.
      It updates runtime->hw.rate_min/max (A) based on hw->rates (B).
      
      	int snd_pcm_limit_hw_rates(...)
      	{
      		int i;
      		for (...) {
      (B)			if (runtime->hw.rates & (1 << i)) {
      (A)				runtime->hw.rate_min = ...
      				break;
      			}
      		}
      		for (...) {
      (B)			if (runtime->hw.rates & (1 << i)) {
      (A)				runtime->hw.rate_max = ...
      				break;
      			}
      		}
      		return 0;
      	}
      
      This means, setup order is
      
      	1) set hw->rates
      	2) call snd_pcm_limit_hw_rates()
      	3) update hw->rate_min/max
      
      soc_pcm_init_runtime_hw() is calling it in good order
      
      	static void soc_pcm_init_runtime_hw(xxx)
      	{
      		...
      1)		hw->rates = snd_pcm_rate_mask_intersect(...);
      
      2)		snd_pcm_limit_hw_rates(...);
      
      3)		hw->rate_min = max(...);
      		hw->rate_min = max(...);
      		hw->rate_max = min_not_zero(...);
      		hw->rate_max = min_not_zero(...);
      	}
      
      But, dpcm_fe_dai_startup() is not.
      
      	static int dpcm_fe_dai_startup(xxx)
      	{
      		...
      1) 3)		dpcm_set_fe_runtime(...);
      2)		snd_pcm_limit_hw_rates(...);
      		...
      	}
      
      More detail of dpcm_set_fe_runtime() is
      
      	static void dpcm_set_fe_runtime()
      	{
      		...
      		for_each_rtd_cpu_dais(rtd, i, cpu_dai) {
      			...
      
      3) 1)			dpcm_init_runtime_hw(...);
      		}
      		...
      3) 1)		dpcm_runtime_merge_rate(...);
      	}
      
      This patch fixup these into
      
      	static void dpcm_set_fe_runtime()
      	{
      		...
      		for_each_rtd_cpu_dais(rtd, i, cpu_dai) {
      			...
      
      1) 2) 3)		dpcm_init_runtime_hw(...);
      		}
      		...
      1) 2) 3)	dpcm_runtime_merge_rate(...);
      	}
      
      	static int dpcm_fe_dai_startup(xxx)
      	{
      		...
      		dpcm_set_fe_runtime(...);
      -		snd_pcm_limit_hw_rates(...);
      		...
      	}
      
      Link: https://lore.kernel.org/r/87k15l7ewd.wl-kuninori.morimoto.gx@renesas.comSigned-off-by: default avatarKuninori Morimoto <kuninori.morimoto.gx@renesas.com>
      Link: https://lore.kernel.org/r/8735ytaig8.wl-kuninori.morimoto.gx@renesas.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
      dd5abc78
    • Kuninori Morimoto's avatar
      ASoC: soc-pcm: use snd_pcm_hardware at dpcm_runtime_merge_xxx() · 4b260f42
      Kuninori Morimoto authored
      soc-pcm has dpcm_runtime_merge_xxx() functions,
      but uses parameters are very verbose.
      
      	dpcm_runtime_merge_format(...,	&runtime->hw.formats);
      	dpcm_runtime_merge_chan(...,	&runtime->hw.channels_min,
      					&runtime->hw.channels_max);
      	dpcm_runtime_merge_rate(...,	&runtime->hw.rates,
      					&runtime->hw.rate_min,
      					&runtime->hw.rate_max);
      
      We want to replace it into
      
      	dpcm_runtime_merge_format(...,	runtime);
      	dpcm_runtime_merge_chan(...,	runtime);
      	dpcm_runtime_merge_rate(...,	runtime);
      
      This patch do it.
      Signed-off-by: default avatarKuninori Morimoto <kuninori.morimoto.gx@renesas.com>
      Link: https://lore.kernel.org/r/874kj9aigd.wl-kuninori.morimoto.gx@renesas.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
      4b260f42
    • Kuninori Morimoto's avatar
      ASoC: soc-pcm: add soc_create_pcm() and simplify soc_new_pcm() · 2b39123b
      Kuninori Morimoto authored
      soc_new_pcm() implementation is very long / verbose / complex,
      thus, it is very difficult to read.
      If we read it carefully, we can notice that it is consisted by
      
      	int soc_new_pcm(...)
      	{
      		(1) judging playback/caputre part
      		(2) creating the PCM part
      		(3) setup pcm/rtd part
      	}
      
      This patch adds new soc_create_pcm() for (2) part
      and offload it from snd_pcm_new().
      Signed-off-by: default avatarKuninori Morimoto <kuninori.morimoto.gx@renesas.com>
      Link: https://lore.kernel.org/r/875z3paigi.wl-kuninori.morimoto.gx@renesas.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
      2b39123b