1. 28 7月, 2021 1 次提交
  2. 25 3月, 2021 1 次提交
  3. 10 3月, 2021 1 次提交
  4. 29 1月, 2021 1 次提交
  5. 27 1月, 2021 1 次提交
  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. 26 11月, 2020 1 次提交
    • K
      ASoC: soc-component: add mark for snd_soc_component_compr_open/free() · f94ba9ac
      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 2) snd_soc_component_compr_open/free(),
      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/87lfey5iwk.wl-kuninori.morimoto.gx@renesas.comSigned-off-by: NMark Brown <broonie@kernel.org>
      f94ba9ac
  8. 19 11月, 2020 12 次提交
  9. 27 10月, 2020 1 次提交
    • K
      ASoC: soc-component: add mark for snd_soc_pcm_component_hw_params/free() · 3a36a64a
      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 2) snd_soc_pcm_component_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 is 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/87k0wdgqav.wl-kuninori.morimoto.gx@renesas.comSigned-off-by: NMark Brown <broonie@kernel.org>
      3a36a64a
  10. 29 9月, 2020 2 次提交
    • K
      ASoC: soc-component: add mark for snd_soc_pcm_component_pm_runtime_get/put() · 939a5cfb
      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 5) pm_runtime_put/get().
      
      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 get() was
      succeeded. If rollback needed, it will check rollback flag and marked
      substream pointer.
      
      One note here is that it cares *current* get() 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/87h7ribwnb.wl-kuninori.morimoto.gx@renesas.comSigned-off-by: NMark Brown <broonie@kernel.org>
      939a5cfb
    • K
      ASoC: soc-component: add mark for soc_pcm_components_open/close() · 51aff91a
      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 3) snd_soc_component_module_get/put()
      4) snd_soc_component_open/close().
      
      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 open() was
      succeeded. If rollback needed, it will check rollback flag and marked
      substream pointer.
      
      One note here is that it cares *current* open() 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/87imbybwno.wl-kuninori.morimoto.gx@renesas.comSigned-off-by: NMark Brown <broonie@kernel.org>
      51aff91a
  11. 11 8月, 2020 1 次提交
    • T
      ASoC: Make soc_component_read() returning an error code again · efc913c8
      Takashi Iwai 提交于
      Along with the recent unification of snd_soc_component_read*()
      functions, the behavior of snd_soc_component_read() was changed
      slightly; namely it returns the register read value directly, and even
      if an error happens, it returns zero (but it prints an error
      message).  That said, the caller side can't know whether it's an error
      or not any longer.
      
      Ideally this shouldn't matter much, but in practice this seems causing
      a regression, as John reported.  And, grepping the tree revealed that
      there are still plenty of callers that do check the error code, so
      we'll need to deal with them in anyway.
      
      As a quick band-aid over the regression, this patch changes the return
      value of snd_soc_component_read() again to the negative error code.
      It can't work, obviously, for 32bit register values, but it should be
      enough for the known regressions, so far.
      
      Fixes: cf6e26c7 ("ASoC: soc-component: merge snd_soc_component_read() and snd_soc_component_read32()")
      Reported-by: NJohn Stultz <john.stultz@linaro.org>
      Signed-off-by: NTakashi Iwai <tiwai@suse.de>
      Link: https://lore.kernel.org/r/20200810134631.19742-1-tiwai@suse.deSigned-off-by: NMark Brown <broonie@kernel.org>
      efc913c8
  12. 01 8月, 2020 1 次提交
  13. 24 7月, 2020 2 次提交
  14. 17 7月, 2020 1 次提交
  15. 22 6月, 2020 2 次提交
    • K
      ASoC: soc-component: use io_mutex correctly · e8712315
      Kuninori Morimoto 提交于
      component has io_mutex, but it had been used at
      snd_soc_component_update_bits_legacy() only which does read and write.
      
      	static int snd_soc_component_update_bits_legacy(...)
      	{
      		...
      =>		mutex_lock(&component->io_mutex);
      		...
      		old = snd_soc_component_read(...);
      		...
      		ret = snd_soc_component_write(...);
      		...
      =>		mutex_unlock(&component->io_mutex);
      		...
      	}
      
      It is pointless if it is not used with both read and write functions.
      This patch uses io_mutex correctly with read/write.
      Here, xxx_no_lock() is local functions.
      
      	static int snd_soc_component_read(...)
      	{
      		...
      =>		mutex_lock(&component->io_mutex);
      		val = soc_component_read_no_lock(...);
      =>		mutex_unlock(&component->io_mutex);
      		...
      	}
      
      	static int snd_soc_component_write(...)
      	{
      		...
      =>		mutex_lock(&component->io_mutex);
      		ret = soc_component_write_no_lock(...);
      =>		mutex_unlock(&component->io_mutex);
      		...
      	}
      
      	static int snd_soc_component_update_bits_legacy(...)
      	{
      		...
      =>		mutex_lock(&component->io_mutex);
      		...
      		old = soc_component_read_no_lock(...);
      		...
      		ret = soc_component_write_no_lock(...);
      		...
      =>		mutex_unlock(&component->io_mutex);
      		...
      	}
      Signed-off-by: NKuninori Morimoto <kuninori.morimoto.gx@renesas.com>
      Link: https://lore.kernel.org/r/87r1uf4mfa.wl-kuninori.morimoto.gx@renesas.comSigned-off-by: NMark Brown <broonie@kernel.org>
      e8712315
    • K
      ASoC: soc-component: merge snd_soc_component_read() and snd_soc_component_read32() · cf6e26c7
      Kuninori Morimoto 提交于
      We had read/write function for Codec, Platform, etc,
      but these has been merged into snd_soc_component_read/write().
      
      Internally, it is using regmap or driver function.
      In read case, each styles are like below
      
      regmap
      	ret = regmap_read(..., reg, &val);
      
      driver function
      	val = xxx->read(..., reg);
      
      Because of this kind of different style, to keep same read style,
      when we merged each read function into snd_soc_component_read(),
      we created snd_soc_component_read32(), like below.
      commit 738b49ef ("ASoC: add snd_soc_component_read32")
      
      (1)	val = snd_soc_component_read32(component, reg);
      
      (2)	ret = snd_soc_component_read(component, reg, &val);
      
      Many drivers are using snd_soc_component_read32(), and
      some drivers are using snd_soc_component_read() today.
      
      In generally, we don't check read function successes,
      because, we will have many other issues at initial timing
      if read function didn't work.
      
      Now we can use soc_component_err() when error case.
      This means, it is easy to notice if error occurred.
      
      This patch aggressively merge snd_soc_component_read() and _read32(),
      and makes snd_soc_component_read/write() as generally style.
      
      This patch do
      	1) merge snd_soc_component_read() and snd_soc_component_read32()
      	2) it uses soc_component_err() when error case (easy to notice)
      	3) keeps read32 for now by #define
      	4) update snd_soc_component_read() for all drivers
      
      Because _read() user drivers are not too many, this patch changes
      all user drivers.
      Signed-off-by: NKuninori Morimoto <kuninori.morimoto.gx@renesas.com>
      Reviewed-by: NKai Vehmanen <kai.vehmanen@linux.intel.com>
      Link: https://lore.kernel.org/r/87sgev4mfl.wl-kuninori.morimoto.gx@renesas.comSigned-off-by: NMark Brown <broonie@kernel.org>
      cf6e26c7
  16. 16 6月, 2020 10 次提交
  17. 29 2月, 2020 1 次提交