1. 16 7月, 2021 1 次提交
  2. 21 6月, 2021 4 次提交
  3. 25 3月, 2021 3 次提交
  4. 10 3月, 2021 1 次提交
  5. 21 1月, 2021 1 次提交
    • K
      ASoC: sync parameter naming : rate / sample_bits · f14654dd
      Kuninori Morimoto 提交于
      snd_pcm_runtime / snd_soc_dai / snd_soc_dai_driver / snd_soc_dai_link
      have related parameter which is similar but not same naming.
      
      	struct snd_pcm_runtime {
      		...
      (A)		unsigned int rate;
      		...
      (B)		unsigned int sample_bits;
      		...
      	};
      
      	struct snd_soc_dai {
      		...
      (A)		unsigned int rate;
      (B)		unsigned int sample_bits;
      		...
      	};
      
      	struct snd_soc_dai_driver {
      		...
      (A)		unsigned int symmetric_rates:1;
      (B)		unsigned int symmetric_samplebits:1;
      		...
      	};
      
      	struct snd_soc_dai_link {
      		...
      (A)		unsigned int symmetric_rates:1;
      (B)		unsigned int symmetric_samplebits:1;
      		...
      	};
      
      Because it is similar but not same naming rule,
      code can be verbose / can't share macro.
      
      This patch sync naming rule for framework.
      	- xxx_rates;
      	+ xxx_rate;
      
      	- xxx_samplebits;
      	+ xxx_sample_bits;
      
      old name will be removed if all drivers were switched
      to new naming rule.
      Signed-off-by: NKuninori Morimoto <kuninori.morimoto.gx@renesas.com>
      Link: https://lore.kernel.org/r/87wnweolj6.wl-kuninori.morimoto.gx@renesas.comSigned-off-by: NMark Brown <broonie@kernel.org>
      f14654dd
  6. 09 12月, 2020 1 次提交
    • K
      ASoC: soc-pcm: care trigger rollback · 6374f493
      Kuninori Morimoto 提交于
      soc_pcm_trigger() calls DAI/Component/Link trigger,
      but some of them might be failed.
      
      	static int soc_pcm_trigger(...)
      	{
      		...
      		switch (cmd) {
      		case SNDRV_PCM_TRIGGER_START:
      		case SNDRV_PCM_TRIGGER_RESUME:
      		case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
      			ret = snd_soc_link_trigger(substream, cmd);
      			if (ret < 0)
      				break;
      
      (*)			ret = snd_soc_pcm_component_trigger(substream, cmd);
      			if (ret < 0)
      				break;
      
      			ret = snd_soc_pcm_dai_trigger(substream, cmd);
      			break;
      		case SNDRV_PCM_TRIGGER_STOP:
      		case SNDRV_PCM_TRIGGER_SUSPEND:
      		case SNDRV_PCM_TRIGGER_PAUSE_PUSH:
      			ret = snd_soc_pcm_dai_trigger(substream, cmd);
      			if (ret < 0)
      				break;
      
      			ret = snd_soc_pcm_component_trigger(substream, cmd);
      			if (ret < 0)
      				break;
      
      			ret = snd_soc_link_trigger(substream, cmd);
      			break;
      		}
      		...
      	}
      
      For example, if soc_pcm_trigger() failed at (*) point,
      we need to rollback previous succeeded trigger.
      
      This patch adds trigger mark for DAI/Component/Link,
      and do STOP if START/RESUME/PAUSE_RELEASE were failed.
      
      Because it need to use new rollback parameter,
      we need to modify DAI/Component/Link trigger functions in the same time.
      Signed-off-by: NKuninori Morimoto <kuninori.morimoto.gx@renesas.com>
      Link: https://lore.kernel.org/r/87a6uycssd.wl-kuninori.morimoto.gx@renesas.comSigned-off-by: NMark Brown <broonie@kernel.org>
      6374f493
  7. 30 11月, 2020 1 次提交
  8. 26 11月, 2020 1 次提交
    • K
      ASoC: soc-component: add mark for snd_soc_link_compr_startup/shutdown() · cd7c7d10
      Kuninori Morimoto 提交于
      soc_compr_open() does rollback when failed (A),
      but, it is almost same as soc_compr_free().
      
      	static int soc_compr_open(xxx)
      	{
      		...
      		if (ret < 0)
      			goto xxx_err;
      		...
      		return 0;
      
       ^	machine_err:
       |		...
       |	out:
      (A)		...
       |	pm_err:
       |		...
       v		return ret;
      	}
      
      The difference is
      soc_compr_free()  is for all dai/component/substream,
      rollback          is for succeeded part only.
      
      This kind of duplicated code can be a hotbed of bugs,
      thus, we want to share soc_compr_free() and rollback.
      	1) snd_soc_dai_compr_startup/shutdown()
      	2) snd_soc_component_compr_open/free()
      =>	3) snd_soc_link_compr_startup/shutdown()
      
      This patch is for 3) snd_soc_link_compr_startup/shutdown()
      and adds new cstream mark.
      It will mark cstream when startup() was suceeded.
      If rollback happen *after* that, it will check rollback flag
      and marked cstream.
      
      It cares *previous* startup() only now,
      but we might want to check *whole* marked cstream in the future.
      This patch is using macro so that it can be easily adjust to it.
      Signed-off-by: NKuninori Morimoto <kuninori.morimoto.gx@renesas.com>
      Link: https://lore.kernel.org/r/87k0ui5iwf.wl-kuninori.morimoto.gx@renesas.comSigned-off-by: NMark Brown <broonie@kernel.org>
      cd7c7d10
  9. 11 11月, 2020 1 次提交
  10. 27 10月, 2020 3 次提交
    • K
      ASoC: soc-pcm: add soc_pcm_hw_clean() and call it from soc_pcm_hw_params/free() · 4662c596
      Kuninori Morimoto 提交于
      soc_pcm_hw_params() does rollback when failed (A),
      but, it is almost same as soc_pcm_hw_free().
      
      	static int soc_pcm_hw_params(xxx)
      	{
      		...
      		if (ret < 0)
      			goto xxx_err;
      		...
      		return ret;
      
       ^	component_err:
       |		...
       |	interface_err:
      (A)		...
       |	codec_err:
       |		...
       v		return ret;
      	}
      
      The difference is
      soc_pcm_hw_free() is for all dai/component/substream,
      rollback          is for succeeded part only.
      
      This kind of duplicated code can be a hotbed of bugs,
      thus, we want to share soc_pcm_hw_free() and rollback.
      
      Now, soc_pcm_hw_params/free() are handling
      	1) snd_soc_link_hw_params/free()
      	2) snd_soc_pcm_component_hw_params/free()
      	3) snd_soc_dai_hw_params/free()
      
      Now, 1) to 3) are handled.
      This patch adds new soc_pcm_hw_clean() and call it from
      soc_pcm_hw_params() as rollback, and from soc_pcm_hw_free() as
      normal close handler.
      
      Other difference is that soc_pcm_hw_free() handles digital mute
      if it was last user. Rollback also handles it by this patch.
      Signed-off-by: NKuninori Morimoto <kuninori.morimoto.gx@renesas.com>
      Link: https://lore.kernel.org/r/87h7rhgqab.wl-kuninori.morimoto.gx@renesas.comSigned-off-by: NMark Brown <broonie@kernel.org>
      4662c596
    • K
      ASoC: soc-link: add mark for snd_soc_link_hw_params/free() · 918ad772
      Kuninori Morimoto 提交于
      soc_pcm_hw_params() does rollback when failed (A),
      but, it is almost same as soc_pcm_hw_free().
      
      	static int soc_pcm_hw_params(xxx)
      	{
      		...
      		if (ret < 0)
      			goto xxx_err;
      		...
      		return ret;
      
       ^	component_err:
       |		...
       |	interface_err:
      (A)		...
       |	codec_err:
       |		...
       v		return ret;
      	}
      
      The difference is
      soc_pcm_hw_free() is for all dai/component/substream,
      rollback          is for succeeded part only.
      
      This kind of duplicated code can be a hotbed of bugs,
      thus, we want to share soc_pcm_hw_free() and rollback.
      
      Now, soc_pcm_hw_params/free() are handling
      =>	1) snd_soc_link_hw_params/free()
      	2) snd_soc_pcm_component_hw_params/free()
      	3) snd_soc_dai_hw_params/free()
      
      This patch is for 1) snd_soc_link_hw_params/free().
      
      The idea of having bit-flag or counter is not enough for this purpose.
      For example if one DAI is used for 2xPlaybacks for some reasons,
      and if 1st Playback was succeeded but 2nd Playback was failed,
      2nd Playback rollback doesn't need to call shutdown.
      But it has succeeded bit-flag or counter via 1st Playback,
      thus, 2nd Playback rollback will call unneeded shutdown.
      And 1st Playback's necessary shutdown will not be called,
      because bit-flag or counter was cleared by wrong 2nd Playback rollback.
      
      To avoid such case, this patch marks substream pointer when hw_params() was
      succeeded. If rollback needed, it will check rollback flag and marked
      substream pointer.
      
      One note here ist that it cares *previous* hw_params() only now,
      but we might want to check *whole* marked substream in the future.
      This patch is using macro named "push/pop", so that it can be easily
      update.
      Signed-off-by: NKuninori Morimoto <kuninori.morimoto.gx@renesas.com>
      Link: https://lore.kernel.org/r/87lfgtgqba.wl-kuninori.morimoto.gx@renesas.comSigned-off-by: NMark Brown <broonie@kernel.org>
      918ad772
    • K
      ASoC: soc.h: remove for_each_rtd_dais_rollback() · 5560d8c6
      Kuninori Morimoto 提交于
      commit 140a4532 ("ASoC: soc-pcm: add soc_pcm_clean() and call it
      from soc_pcm_open/close()") uses soc_pcm_clean() and then
      for_each_rtd_dais_rollback() is no longer used.
      This patch removes it.
      Signed-off-by: NKuninori Morimoto <kuninori.morimoto.gx@renesas.com>
      Link: https://lore.kernel.org/r/87o8lpgqbp.wl-kuninori.morimoto.gx@renesas.comSigned-off-by: NMark Brown <broonie@kernel.org>
      5560d8c6
  11. 29 9月, 2020 1 次提交
    • K
      ASoC: soc-link: add mark for snd_soc_link_startup/shutdown() · 6064ed73
      Kuninori Morimoto 提交于
      soc_pcm_open() does rollback when failed (A),
      but, it is almost same as soc_pcm_close().
      
      	static int soc_pcm_open(xxx)
      	{
      		...
      		if (ret < 0)
      			goto xxx_err;
      		...
      		return 0;
      
       ^	config_err:
       |		...
       |	rtd_startup_err:
      (A)		...
       |	component_err:
       |		...
       v		return ret;
      	}
      
      The difference is
      soc_pcm_close() is for all dai/component/substream,
      rollback        is for succeeded part only.
      
      This kind of duplicated code can be a hotbed of bugs,
      thus, we want to share soc_pcm_close() and rollback.
      
      Now, soc_pcm_open/close() are handling
      	1) snd_soc_dai_startup/shutdown()
      =>	2) snd_soc_link_startup/shutdown()
      	3) snd_soc_component_module_get/put()
      	4) snd_soc_component_open/close()
      	5) pm_runtime_put/get()
      
      This patch is for 2) snd_soc_link_startup/shutdown().
      
      The idea of having bit-flag or counter is not enough for this purpose.
      For example if one DAI is used for 2xPlaybacks for some reasons,
      and if 1st Playback was succeeded but 2nd Playback was failed,
      2nd Playback rollback doesn't need to call shutdown.
      But it has succeeded bit-flag or counter via 1st Playback,
      thus, 2nd Playback rollback will call unneeded shutdown.
      And 1st Playback's necessary shutdown will not be called,
      because bit-flag or counter was cleared by wrong 2nd Playback rollback.
      
      To avoid such case, this patch marks substream pointer when startup() was
      succeeded. If rollback needed, it will check rollback flag and marked
      substream pointer.
      
      One note here is that it cares *current* startup() only now.
      but we might want to check *whole* marked substream in the future.
      This patch is using macro named "push/pop", so that it can be easily
      update.
      Signed-off-by: NKuninori Morimoto <kuninori.morimoto.gx@renesas.com>
      Link: https://lore.kernel.org/r/87k0webwnv.wl-kuninori.morimoto.gx@renesas.comSigned-off-by: NMark Brown <broonie@kernel.org>
      6064ed73
  12. 07 9月, 2020 1 次提交
  13. 28 8月, 2020 1 次提交
    • K
      ASoC: soc-core: add snd_soc_find_dai_with_mutex() · 20d9fdee
      Kuninori Morimoto 提交于
      commit 25612477 ("ASoC: soc-dai: set dai_link dpcm_ flags with a helper")
      added snd_soc_dai_link_set_capabilities().
      But it is using snd_soc_find_dai() (A) which is required client_mutex (B).
      And client_mutex is soc-core.c local.
      
      	struct snd_soc_dai *snd_soc_find_dai(xxx)
      	{
      		...
      (B)		lockdep_assert_held(&client_mutex);
      		...
      	}
      
      	void snd_soc_dai_link_set_capabilities(xxx)
      	{
      		...
      		for_each_pcm_streams(direction) {
      			...
      			for_each_link_cpus(dai_link, i, cpu) {
      (A)				dai = snd_soc_find_dai(cpu);
      				...
      			}
      			...
      			for_each_link_codecs(dai_link, i, codec) {
      (A)				dai = snd_soc_find_dai(codec);
      				...
      			}
      		}
      		...
      	}
      
      Because of these background, we will get WARNING if .config has CONFIG_LOCKDEP.
      
      	WARNING: CPU: 2 PID: 53 at sound/soc/soc-core.c:814 snd_soc_find_dai+0xf8/0x100
      	CPU: 2 PID: 53 Comm: kworker/2:1 Not tainted 5.7.0-rc1+ #328
      	Hardware name: Renesas H3ULCB Kingfisher board based on r8a77951 (DT)
      	Workqueue: events deferred_probe_work_func
      	pstate: 60000005 (nZCv daif -PAN -UAO)
      	pc : snd_soc_find_dai+0xf8/0x100
      	lr : snd_soc_find_dai+0xf4/0x100
      	...
      	Call trace:
      	 snd_soc_find_dai+0xf8/0x100
      	 snd_soc_dai_link_set_capabilities+0xa0/0x16c
      	 graph_dai_link_of_dpcm+0x390/0x3c0
      	 graph_for_each_link+0x134/0x200
      	 graph_probe+0x144/0x230
      	 platform_drv_probe+0x5c/0xb0
      	 really_probe+0xe4/0x430
      	 driver_probe_device+0x60/0xf4
      
      snd_soc_find_dai() will be used from (X) CPU/Codec/Platform driver with
      mutex lock, and (Y) Card driver without mutex lock.
      This snd_soc_dai_link_set_capabilities() is for Card driver,
      this means called without mutex.
      This patch adds snd_soc_find_dai_with_mutex() to solve it.
      
      Fixes: 25612477 ("ASoC: soc-dai: set dai_link dpcm_ flags with a helper")
      Signed-off-by: NKuninori Morimoto <kuninori.morimoto.gx@renesas.com>
      Link: https://lore.kernel.org/r/87blixvuab.wl-kuninori.morimoto.gx@renesas.comSigned-off-by: NMark Brown <broonie@kernel.org>
      20d9fdee
  14. 27 8月, 2020 1 次提交
    • K
      ASoC: soc-core: add snd_soc_find_dai_with_mutex() · c1c277b2
      Kuninori Morimoto 提交于
      commit 25612477 ("ASoC: soc-dai: set dai_link dpcm_ flags with a helper")
      added snd_soc_dai_link_set_capabilities().
      But it is using snd_soc_find_dai() (A) which is required client_mutex (B).
      And client_mutex is soc-core.c local.
      
      	struct snd_soc_dai *snd_soc_find_dai(xxx)
      	{
      		...
      (B)		lockdep_assert_held(&client_mutex);
      		...
      	}
      
      	void snd_soc_dai_link_set_capabilities(xxx)
      	{
      		...
      		for_each_pcm_streams(direction) {
      			...
      			for_each_link_cpus(dai_link, i, cpu) {
      (A)				dai = snd_soc_find_dai(cpu);
      				...
      			}
      			...
      			for_each_link_codecs(dai_link, i, codec) {
      (A)				dai = snd_soc_find_dai(codec);
      				...
      			}
      		}
      		...
      	}
      
      Because of these background, we will get WARNING if .config has CONFIG_LOCKDEP.
      
      	WARNING: CPU: 2 PID: 53 at sound/soc/soc-core.c:814 snd_soc_find_dai+0xf8/0x100
      	CPU: 2 PID: 53 Comm: kworker/2:1 Not tainted 5.7.0-rc1+ #328
      	Hardware name: Renesas H3ULCB Kingfisher board based on r8a77951 (DT)
      	Workqueue: events deferred_probe_work_func
      	pstate: 60000005 (nZCv daif -PAN -UAO)
      	pc : snd_soc_find_dai+0xf8/0x100
      	lr : snd_soc_find_dai+0xf4/0x100
      	...
      	Call trace:
      	 snd_soc_find_dai+0xf8/0x100
      	 snd_soc_dai_link_set_capabilities+0xa0/0x16c
      	 graph_dai_link_of_dpcm+0x390/0x3c0
      	 graph_for_each_link+0x134/0x200
      	 graph_probe+0x144/0x230
      	 platform_drv_probe+0x5c/0xb0
      	 really_probe+0xe4/0x430
      	 driver_probe_device+0x60/0xf4
      
      snd_soc_find_dai() will be used from (X) CPU/Codec/Platform driver with
      mutex lock, and (Y) Card driver without mutex lock.
      This snd_soc_dai_link_set_capabilities() is for Card driver,
      this means called without mutex.
      This patch adds snd_soc_find_dai_with_mutex() to solve it.
      
      Fixes: 25612477 ("ASoC: soc-dai: set dai_link dpcm_ flags with a helper")
      Signed-off-by: NKuninori Morimoto <kuninori.morimoto.gx@renesas.com>
      Link: https://lore.kernel.org/r/87blixvuab.wl-kuninori.morimoto.gx@renesas.comSigned-off-by: NMark Brown <broonie@kernel.org>
      c1c277b2
  15. 18 8月, 2020 1 次提交
  16. 01 8月, 2020 3 次提交
  17. 24 7月, 2020 1 次提交
  18. 07 7月, 2020 1 次提交
    • M
      ASoC: core: Remove only the registered component in devm functions · 58f30150
      Maxime Ripard 提交于
      The ASoC devm_ functions that register a component
      (devm_snd_soc_register_component and devm_snd_dmaengine_pcm_register) will
      clean their component by running snd_soc_unregister_component.
      
      snd_soc_unregister_component will then remove all the components for the
      device that was used to register the component in the first place.
      
      However, some drivers register several components (such as a DAI and a
      dmaengine PCM) on the same device, and if the dmaengine PCM is registered
      first, then the DAI will be cleaned up first and
      snd_dmaengine_pcm_unregister will be called next.
      
      snd_dmaengine_pcm_unregister will then lookup the dmaengine PCM component
      on the device, and if there's one unregister that component and release its
      dmaengine channels. That doesn't happen in practice though since the first
      call to snd_soc_unregister_component removed all the components, so we
      never get the chance to release the dmaengine channels.
      
      In order to fix this, instead of removing all the components for a given
      device, we can simply remove the component that was registered in the first
      place. We should have the same number of component registration than we
      have components, so it should work just fine.
      Signed-off-by: NMaxime Ripard <maxime@cerno.tech>
      Link: https://lore.kernel.org/r/20200707074237.287171-1-maxime@cerno.techSigned-off-by: NMark Brown <broonie@kernel.org>
      58f30150
  19. 26 6月, 2020 1 次提交
  20. 23 6月, 2020 1 次提交
  21. 15 6月, 2020 1 次提交
  22. 12 6月, 2020 1 次提交
  23. 30 5月, 2020 8 次提交
  24. 27 5月, 2020 1 次提交