1. 17 Apr, 2023 3 commits
    • Kuninori Morimoto's avatar
      ASoC: add snd_soc_card_mutex_lock/unlock() · 0f3b8184
      Kuninori Morimoto authored
      ASoC need to use card->mutex with _INIT or _RUNTIME,
      but there is no helper function for it.
      
      This patch adds its helper function and use it.
      
      Because people might misunderstand that _init() is mutex initialization,
      this patch renames _INIT to _ROOT and adds new
      snd_soc_card_mutex_lock_root() for it.
      Signed-off-by: default avatarKuninori Morimoto <kuninori.morimoto.gx@renesas.com>
      Link: https://lore.kernel.org/r/87a5zlx3tw.wl-kuninori.morimoto.gx@renesas.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
      0f3b8184
    • Kuninori Morimoto's avatar
      ASoC: expand snd_soc_dpcm_mutex_lock/unlock() · 38e42f6d
      Kuninori Morimoto authored
      soc-pcm.c has snd_soc_dpcm_mutex_lock/unlock(),
      but other files can't use it because it is static function.
      
      It requests snd_soc_pcm_runtime as parameter (A), but sometimes we
      want to use it by snd_soc_card (B).
      
      (A)	static inline void snd_soc_dpcm_mutex_lock(struct snd_soc_pcm_runtime *rtd)
      	{
      		mutex_lock_nested(&rtd->card->pcm_mutex, rtd->card->pcm_subclass);
      	}			   ^^^^^^^^^
      
      (B)	mutex_lock_nested(&card->pcm_mutex, card->pcm_subclass);
      			   ^^^^
      
      We want to use it with both "rtd" and "card" for dapm lock/unlock.
      To enable it, this patch uses _Generic macro.
      
      This patch makes snd_soc_dpcm_mutex_{un}lock() global function, and use it on
      each files.
      Signed-off-by: default avatarKuninori Morimoto <kuninori.morimoto.gx@renesas.com>
      Link: https://lore.kernel.org/r/87bkk1x3ud.wl-kuninori.morimoto.gx@renesas.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
      38e42f6d
    • Kuninori Morimoto's avatar
      ASoC: expand snd_soc_dapm_mutex_lock/unlock() · 4a778bdc
      Kuninori Morimoto authored
      soc.h has snd_soc_dapm_mutex_lock/unlock() definition and
      many drivers are using it, but soc-dapm.c is not.
      
      1st reason is snd_soc_dapm_mutex_lock/unlock() requests
      snd_soc_dapm_context pointer as parameter (A), but sometimes soc-dapm.c
      needs to use snd_soc_card (B).
      
      (A)	static inline void snd_soc_dapm_mutex_lock(struct snd_soc_dapm_context *dapm)
      	{
      		mutex_lock_nested(&dapm->card->dapm_mutex, SND_SOC_DAPM_CLASS_RUNTIME);
      	}			   ^^^^^^^^^^
      
      (B)	mutex_lock_nested(&card->dapm_mutex, SND_SOC_DAPM_CLASS_RUNTIME);
      			   ^^^^
      
      2nd reason is it want to use SND_SOC_DAPM_CLASS_INIT for mutex_lock_nested(),
      but helper is using _RUNTIME (A).
      
      The conclusion is we want to use "dapm vs card" and "_RUNTIME vs _INIT"
      for dapm lock/unlock. To enable this selfish request, this patch uses
      _Generic macro. We can use snd_soc_dapm_mutex_lock/unlock() for both
      dapm and card case.
      
      	snd_soc_dapm_mutex_lock(dapm);	snd_soc_dapm_mutex_unlock(dapm);
      	snd_soc_dapm_mutex_lock(card);	snd_soc_dapm_mutex_unlock(card);
      
      Current soc-dapm.c is using both mutex_lock() and mutex_lock_nested().
      This patch handles mutex_lock() as mutex_lock_nested(..., 0),
      in other words, handles below as same.
      
      	mutex_lock(&card->dapm_mutex);
      	mutex_lock_nested(&card->dapm_mutex, SND_SOC_DAPM_CLASS_INIT);
      
      Because people might misunderstand that _init() is mutex initialization,
      this patch renames _INIT to _ROOT and adds new
      snd_soc_dapm_mutex_lock_root() for it.
      
      This patch also moves snd_soc_dapm_subclass definition from soc-dapm.h
      to soc.h to keep related code together.
      
      Because very complex soc.h vs soc-dapm.h relationship,
      it is difficult/impossible to define these helper into soc-dapm.h.
      Signed-off-by: default avatarKuninori Morimoto <kuninori.morimoto.gx@renesas.com>
      Link: https://lore.kernel.org/r/87cz4hx3v0.wl-kuninori.morimoto.gx@renesas.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
      4a778bdc
  2. 14 Apr, 2023 2 commits
  3. 13 Apr, 2023 2 commits
  4. 12 Apr, 2023 13 commits
  5. 11 Apr, 2023 10 commits
  6. 07 Apr, 2023 2 commits
  7. 06 Apr, 2023 8 commits