2019-07-26 12:49:48 +08:00
|
|
|
// SPDX-License-Identifier: GPL-2.0
|
|
|
|
//
|
|
|
|
// soc-component.c
|
|
|
|
//
|
2020-06-04 16:08:03 +08:00
|
|
|
// Copyright 2009-2011 Wolfson Microelectronics PLC.
|
2019-07-26 12:49:48 +08:00
|
|
|
// Copyright (C) 2019 Renesas Electronics Corp.
|
2020-06-04 16:08:03 +08:00
|
|
|
//
|
|
|
|
// Mark Brown <broonie@opensource.wolfsonmicro.com>
|
2019-07-26 12:49:48 +08:00
|
|
|
// Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
|
|
|
|
//
|
2019-07-26 12:49:54 +08:00
|
|
|
#include <linux/module.h>
|
ASoC: soc-component: add mark for snd_soc_pcm_component_pm_runtime_get/put()
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: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87h7ribwnb.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-09-28 08:01:17 +08:00
|
|
|
#include <linux/pm_runtime.h>
|
2019-07-26 12:49:48 +08:00
|
|
|
#include <sound/soc.h>
|
|
|
|
|
2020-06-04 16:06:41 +08:00
|
|
|
#define soc_component_ret(dai, ret) _soc_component_ret(dai, __func__, ret)
|
|
|
|
static inline int _soc_component_ret(struct snd_soc_component *component,
|
|
|
|
const char *func, int ret)
|
|
|
|
{
|
|
|
|
/* Positive/Zero values are not errors */
|
|
|
|
if (ret >= 0)
|
|
|
|
return ret;
|
|
|
|
|
|
|
|
/* Negative values might be errors */
|
|
|
|
switch (ret) {
|
|
|
|
case -EPROBE_DEFER:
|
|
|
|
case -ENOTSUPP:
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
dev_err(component->dev,
|
|
|
|
"ASoC: error at %s on %s: %d\n",
|
|
|
|
func, component->name, ret);
|
|
|
|
}
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
ASoC: soc-component: add mark for soc_pcm_components_open/close()
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: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87imbybwno.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-09-28 08:01:04 +08:00
|
|
|
/*
|
|
|
|
* We might want to check substream by using list.
|
|
|
|
* In such case, we can update these macros.
|
|
|
|
*/
|
|
|
|
#define soc_component_mark_push(component, substream, tgt) ((component)->mark_##tgt = substream)
|
|
|
|
#define soc_component_mark_pop(component, substream, tgt) ((component)->mark_##tgt = NULL)
|
|
|
|
#define soc_component_mark_match(component, substream, tgt) ((component)->mark_##tgt == substream)
|
|
|
|
|
2020-06-04 16:07:54 +08:00
|
|
|
void snd_soc_component_set_aux(struct snd_soc_component *component,
|
|
|
|
struct snd_soc_aux_dev *aux)
|
|
|
|
{
|
|
|
|
component->init = (aux) ? aux->init : NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
int snd_soc_component_init(struct snd_soc_component *component)
|
|
|
|
{
|
|
|
|
int ret = 0;
|
|
|
|
|
|
|
|
if (component->init)
|
|
|
|
ret = component->init(component);
|
|
|
|
|
|
|
|
return soc_component_ret(component, ret);
|
|
|
|
}
|
|
|
|
|
2019-07-26 12:49:48 +08:00
|
|
|
/**
|
|
|
|
* snd_soc_component_set_sysclk - configure COMPONENT system or master clock.
|
|
|
|
* @component: COMPONENT
|
|
|
|
* @clk_id: DAI specific clock ID
|
|
|
|
* @source: Source for the clock
|
|
|
|
* @freq: new clock frequency in Hz
|
|
|
|
* @dir: new clock direction - input/output.
|
|
|
|
*
|
|
|
|
* Configures the CODEC master (MCLK) or system (SYSCLK) clocking.
|
|
|
|
*/
|
|
|
|
int snd_soc_component_set_sysclk(struct snd_soc_component *component,
|
|
|
|
int clk_id, int source, unsigned int freq,
|
|
|
|
int dir)
|
|
|
|
{
|
2020-06-04 16:06:41 +08:00
|
|
|
int ret = -ENOTSUPP;
|
|
|
|
|
2019-07-26 12:49:48 +08:00
|
|
|
if (component->driver->set_sysclk)
|
2020-06-04 16:06:41 +08:00
|
|
|
ret = component->driver->set_sysclk(component, clk_id, source,
|
2019-07-26 12:49:48 +08:00
|
|
|
freq, dir);
|
|
|
|
|
2020-06-04 16:06:41 +08:00
|
|
|
return soc_component_ret(component, ret);
|
2019-07-26 12:49:48 +08:00
|
|
|
}
|
|
|
|
EXPORT_SYMBOL_GPL(snd_soc_component_set_sysclk);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* snd_soc_component_set_pll - configure component PLL.
|
|
|
|
* @component: COMPONENT
|
|
|
|
* @pll_id: DAI specific PLL ID
|
|
|
|
* @source: DAI specific source for the PLL
|
|
|
|
* @freq_in: PLL input clock frequency in Hz
|
|
|
|
* @freq_out: requested PLL output clock frequency in Hz
|
|
|
|
*
|
|
|
|
* Configures and enables PLL to generate output clock based on input clock.
|
|
|
|
*/
|
|
|
|
int snd_soc_component_set_pll(struct snd_soc_component *component, int pll_id,
|
|
|
|
int source, unsigned int freq_in,
|
|
|
|
unsigned int freq_out)
|
|
|
|
{
|
2020-06-04 16:06:41 +08:00
|
|
|
int ret = -EINVAL;
|
|
|
|
|
2019-07-26 12:49:48 +08:00
|
|
|
if (component->driver->set_pll)
|
2020-06-04 16:06:41 +08:00
|
|
|
ret = component->driver->set_pll(component, pll_id, source,
|
2019-07-26 12:49:48 +08:00
|
|
|
freq_in, freq_out);
|
|
|
|
|
2020-06-04 16:06:41 +08:00
|
|
|
return soc_component_ret(component, ret);
|
2019-07-26 12:49:48 +08:00
|
|
|
}
|
|
|
|
EXPORT_SYMBOL_GPL(snd_soc_component_set_pll);
|
|
|
|
|
2019-07-26 12:51:35 +08:00
|
|
|
void snd_soc_component_seq_notifier(struct snd_soc_component *component,
|
|
|
|
enum snd_soc_dapm_type type, int subseq)
|
|
|
|
{
|
|
|
|
if (component->driver->seq_notifier)
|
|
|
|
component->driver->seq_notifier(component, type, subseq);
|
|
|
|
}
|
|
|
|
|
2019-07-26 12:51:39 +08:00
|
|
|
int snd_soc_component_stream_event(struct snd_soc_component *component,
|
|
|
|
int event)
|
|
|
|
{
|
2020-06-04 16:06:41 +08:00
|
|
|
int ret = 0;
|
|
|
|
|
2019-07-26 12:51:39 +08:00
|
|
|
if (component->driver->stream_event)
|
2020-06-04 16:06:41 +08:00
|
|
|
ret = component->driver->stream_event(component, event);
|
2019-07-26 12:51:39 +08:00
|
|
|
|
2020-06-04 16:06:41 +08:00
|
|
|
return soc_component_ret(component, ret);
|
2019-07-26 12:51:39 +08:00
|
|
|
}
|
|
|
|
|
2019-07-26 12:51:43 +08:00
|
|
|
int snd_soc_component_set_bias_level(struct snd_soc_component *component,
|
|
|
|
enum snd_soc_bias_level level)
|
|
|
|
{
|
2020-06-04 16:06:41 +08:00
|
|
|
int ret = 0;
|
|
|
|
|
2019-07-26 12:51:43 +08:00
|
|
|
if (component->driver->set_bias_level)
|
2020-06-04 16:06:41 +08:00
|
|
|
ret = component->driver->set_bias_level(component, level);
|
2019-07-26 12:51:43 +08:00
|
|
|
|
2020-06-04 16:06:41 +08:00
|
|
|
return soc_component_ret(component, ret);
|
2019-07-26 12:51:43 +08:00
|
|
|
}
|
|
|
|
|
2020-06-04 16:06:11 +08:00
|
|
|
static int soc_component_pin(struct snd_soc_component *component,
|
|
|
|
const char *pin,
|
|
|
|
int (*pin_func)(struct snd_soc_dapm_context *dapm,
|
|
|
|
const char *pin))
|
2019-07-26 12:49:48 +08:00
|
|
|
{
|
|
|
|
struct snd_soc_dapm_context *dapm =
|
|
|
|
snd_soc_component_get_dapm(component);
|
|
|
|
char *full_name;
|
|
|
|
int ret;
|
|
|
|
|
2020-06-04 16:06:41 +08:00
|
|
|
if (!component->name_prefix) {
|
|
|
|
ret = pin_func(dapm, pin);
|
|
|
|
goto end;
|
|
|
|
}
|
2019-07-26 12:49:48 +08:00
|
|
|
|
|
|
|
full_name = kasprintf(GFP_KERNEL, "%s %s", component->name_prefix, pin);
|
2020-06-04 16:06:41 +08:00
|
|
|
if (!full_name) {
|
|
|
|
ret = -ENOMEM;
|
|
|
|
goto end;
|
|
|
|
}
|
2019-07-26 12:49:48 +08:00
|
|
|
|
2020-06-04 16:06:11 +08:00
|
|
|
ret = pin_func(dapm, full_name);
|
2019-07-26 12:49:48 +08:00
|
|
|
kfree(full_name);
|
2020-06-04 16:06:41 +08:00
|
|
|
end:
|
|
|
|
return soc_component_ret(component, ret);
|
2019-07-26 12:49:48 +08:00
|
|
|
}
|
2020-06-04 16:06:11 +08:00
|
|
|
|
|
|
|
int snd_soc_component_enable_pin(struct snd_soc_component *component,
|
|
|
|
const char *pin)
|
|
|
|
{
|
|
|
|
return soc_component_pin(component, pin, snd_soc_dapm_enable_pin);
|
|
|
|
}
|
2019-07-26 12:49:48 +08:00
|
|
|
EXPORT_SYMBOL_GPL(snd_soc_component_enable_pin);
|
|
|
|
|
|
|
|
int snd_soc_component_enable_pin_unlocked(struct snd_soc_component *component,
|
|
|
|
const char *pin)
|
|
|
|
{
|
2020-06-04 16:06:11 +08:00
|
|
|
return soc_component_pin(component, pin, snd_soc_dapm_enable_pin_unlocked);
|
2019-07-26 12:49:48 +08:00
|
|
|
}
|
|
|
|
EXPORT_SYMBOL_GPL(snd_soc_component_enable_pin_unlocked);
|
|
|
|
|
|
|
|
int snd_soc_component_disable_pin(struct snd_soc_component *component,
|
|
|
|
const char *pin)
|
|
|
|
{
|
2020-06-04 16:06:11 +08:00
|
|
|
return soc_component_pin(component, pin, snd_soc_dapm_disable_pin);
|
2019-07-26 12:49:48 +08:00
|
|
|
}
|
|
|
|
EXPORT_SYMBOL_GPL(snd_soc_component_disable_pin);
|
|
|
|
|
|
|
|
int snd_soc_component_disable_pin_unlocked(struct snd_soc_component *component,
|
|
|
|
const char *pin)
|
|
|
|
{
|
2020-06-04 16:06:11 +08:00
|
|
|
return soc_component_pin(component, pin, snd_soc_dapm_disable_pin_unlocked);
|
2019-07-26 12:49:48 +08:00
|
|
|
}
|
|
|
|
EXPORT_SYMBOL_GPL(snd_soc_component_disable_pin_unlocked);
|
|
|
|
|
|
|
|
int snd_soc_component_nc_pin(struct snd_soc_component *component,
|
|
|
|
const char *pin)
|
|
|
|
{
|
2020-06-04 16:06:11 +08:00
|
|
|
return soc_component_pin(component, pin, snd_soc_dapm_nc_pin);
|
2019-07-26 12:49:48 +08:00
|
|
|
}
|
|
|
|
EXPORT_SYMBOL_GPL(snd_soc_component_nc_pin);
|
|
|
|
|
|
|
|
int snd_soc_component_nc_pin_unlocked(struct snd_soc_component *component,
|
|
|
|
const char *pin)
|
|
|
|
{
|
2020-06-04 16:06:11 +08:00
|
|
|
return soc_component_pin(component, pin, snd_soc_dapm_nc_pin_unlocked);
|
2019-07-26 12:49:48 +08:00
|
|
|
}
|
|
|
|
EXPORT_SYMBOL_GPL(snd_soc_component_nc_pin_unlocked);
|
|
|
|
|
|
|
|
int snd_soc_component_get_pin_status(struct snd_soc_component *component,
|
|
|
|
const char *pin)
|
|
|
|
{
|
2020-06-04 16:06:11 +08:00
|
|
|
return soc_component_pin(component, pin, snd_soc_dapm_get_pin_status);
|
2019-07-26 12:49:48 +08:00
|
|
|
}
|
|
|
|
EXPORT_SYMBOL_GPL(snd_soc_component_get_pin_status);
|
|
|
|
|
|
|
|
int snd_soc_component_force_enable_pin(struct snd_soc_component *component,
|
|
|
|
const char *pin)
|
|
|
|
{
|
2020-06-04 16:06:11 +08:00
|
|
|
return soc_component_pin(component, pin, snd_soc_dapm_force_enable_pin);
|
2019-07-26 12:49:48 +08:00
|
|
|
}
|
|
|
|
EXPORT_SYMBOL_GPL(snd_soc_component_force_enable_pin);
|
|
|
|
|
|
|
|
int snd_soc_component_force_enable_pin_unlocked(
|
|
|
|
struct snd_soc_component *component,
|
|
|
|
const char *pin)
|
|
|
|
{
|
2020-06-04 16:06:11 +08:00
|
|
|
return soc_component_pin(component, pin, snd_soc_dapm_force_enable_pin_unlocked);
|
2019-07-26 12:49:48 +08:00
|
|
|
}
|
|
|
|
EXPORT_SYMBOL_GPL(snd_soc_component_force_enable_pin_unlocked);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* snd_soc_component_set_jack - configure component jack.
|
|
|
|
* @component: COMPONENTs
|
|
|
|
* @jack: structure to use for the jack
|
|
|
|
* @data: can be used if codec driver need extra data for configuring jack
|
|
|
|
*
|
|
|
|
* Configures and enables jack detection function.
|
|
|
|
*/
|
|
|
|
int snd_soc_component_set_jack(struct snd_soc_component *component,
|
|
|
|
struct snd_soc_jack *jack, void *data)
|
|
|
|
{
|
2020-06-04 16:06:41 +08:00
|
|
|
int ret = -ENOTSUPP;
|
|
|
|
|
2019-07-26 12:49:48 +08:00
|
|
|
if (component->driver->set_jack)
|
2020-06-04 16:06:41 +08:00
|
|
|
ret = component->driver->set_jack(component, jack, data);
|
2019-07-26 12:49:48 +08:00
|
|
|
|
2020-06-04 16:06:41 +08:00
|
|
|
return soc_component_ret(component, ret);
|
2019-07-26 12:49:48 +08:00
|
|
|
}
|
|
|
|
EXPORT_SYMBOL_GPL(snd_soc_component_set_jack);
|
2019-07-26 12:49:54 +08:00
|
|
|
|
|
|
|
int snd_soc_component_module_get(struct snd_soc_component *component,
|
ASoC: soc-component: add mark for soc_pcm_components_open/close()
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: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87imbybwno.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-09-28 08:01:04 +08:00
|
|
|
struct snd_pcm_substream *substream,
|
2019-07-26 12:49:54 +08:00
|
|
|
int upon_open)
|
|
|
|
{
|
2020-06-04 16:06:41 +08:00
|
|
|
int ret = 0;
|
|
|
|
|
2019-07-26 12:49:54 +08:00
|
|
|
if (component->driver->module_get_upon_open == !!upon_open &&
|
|
|
|
!try_module_get(component->dev->driver->owner))
|
2020-06-04 16:06:41 +08:00
|
|
|
ret = -ENODEV;
|
2019-07-26 12:49:54 +08:00
|
|
|
|
ASoC: soc-component: add mark for soc_pcm_components_open/close()
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: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87imbybwno.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-09-28 08:01:04 +08:00
|
|
|
/* mark substream if succeeded */
|
|
|
|
if (ret == 0)
|
|
|
|
soc_component_mark_push(component, substream, module);
|
|
|
|
|
2020-06-04 16:06:41 +08:00
|
|
|
return soc_component_ret(component, ret);
|
2019-07-26 12:49:54 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
void snd_soc_component_module_put(struct snd_soc_component *component,
|
ASoC: soc-component: add mark for soc_pcm_components_open/close()
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: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87imbybwno.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-09-28 08:01:04 +08:00
|
|
|
struct snd_pcm_substream *substream,
|
|
|
|
int upon_open, int rollback)
|
2019-07-26 12:49:54 +08:00
|
|
|
{
|
ASoC: soc-component: add mark for soc_pcm_components_open/close()
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: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87imbybwno.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-09-28 08:01:04 +08:00
|
|
|
if (rollback && !soc_component_mark_match(component, substream, module))
|
|
|
|
return;
|
|
|
|
|
2019-07-26 12:49:54 +08:00
|
|
|
if (component->driver->module_get_upon_open == !!upon_open)
|
|
|
|
module_put(component->dev->driver->owner);
|
ASoC: soc-component: add mark for soc_pcm_components_open/close()
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: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87imbybwno.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-09-28 08:01:04 +08:00
|
|
|
|
|
|
|
/* remove marked substream */
|
|
|
|
soc_component_mark_pop(component, substream, module);
|
2019-07-26 12:49:54 +08:00
|
|
|
}
|
2019-07-26 12:50:01 +08:00
|
|
|
|
|
|
|
int snd_soc_component_open(struct snd_soc_component *component,
|
|
|
|
struct snd_pcm_substream *substream)
|
|
|
|
{
|
2020-06-04 16:06:41 +08:00
|
|
|
int ret = 0;
|
|
|
|
|
ASoC: soc-core: merge snd_pcm_ops member to component driver
Current snd_soc_component_driver has snd_pcm_ops, and each driver can
have callback via it (1).
But, it is mainly created for ALSA, thus, it doesn't have "component"
as parameter for ALSA SoC (1)(2).
Thus, each callback can't know it is called for which component.
Thus, each callback currently is getting "component" by using
snd_soc_rtdcom_lookup() with driver name (3).
--- ALSA SoC ---
...
if (component->driver->ops &&
component->driver->ops->open)
(1) return component->driver->ops->open(substream);
...
--- driver ---
(2) static int xxx_open(struct snd_pcm_substream *substream)
{
struct snd_soc_pcm_runtime *rtd = substream->private_data;
(3) struct snd_soc_component *component = snd_soc_rtdcom_lookup(..);
...
}
It works today, but, will not work in the future if we support multi
CPU/Codec/Platform, because 1 rtd might have multiple components which
have same driver name.
To solve this issue, each callback needs to be called with component.
We already have many component driver callback.
This patch copies each snd_pcm_ops member under component driver,
and having "component" as parameter.
--- ALSA SoC ---
...
if (component->driver->open)
=> return component->driver->open(component, substream);
...
--- driver ---
=> static int xxx_open(struct snd_soc_component *component,
struct snd_pcm_substream *substream)
{
...
}
*Note*
Only Intel skl-pcm has .get_time_info implementation, but ALSA SoC
framework doesn't call it so far.
To keep its implementation, this patch keeps .get_time_info,
but it is still not called.
Intel guy need to support it in the future.
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87tv8raf3r.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2019-10-02 13:30:48 +08:00
|
|
|
if (component->driver->open)
|
2020-06-04 16:06:41 +08:00
|
|
|
ret = component->driver->open(component, substream);
|
|
|
|
|
ASoC: soc-component: add mark for soc_pcm_components_open/close()
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: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87imbybwno.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-09-28 08:01:04 +08:00
|
|
|
/* mark substream if succeeded */
|
|
|
|
if (ret == 0)
|
|
|
|
soc_component_mark_push(component, substream, open);
|
|
|
|
|
2020-06-04 16:06:41 +08:00
|
|
|
return soc_component_ret(component, ret);
|
2019-07-26 12:50:01 +08:00
|
|
|
}
|
2019-07-26 12:50:07 +08:00
|
|
|
|
|
|
|
int snd_soc_component_close(struct snd_soc_component *component,
|
ASoC: soc-component: add mark for soc_pcm_components_open/close()
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: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87imbybwno.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-09-28 08:01:04 +08:00
|
|
|
struct snd_pcm_substream *substream,
|
|
|
|
int rollback)
|
2019-07-26 12:50:07 +08:00
|
|
|
{
|
2020-06-04 16:06:41 +08:00
|
|
|
int ret = 0;
|
|
|
|
|
ASoC: soc-component: add mark for soc_pcm_components_open/close()
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: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87imbybwno.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-09-28 08:01:04 +08:00
|
|
|
if (rollback && !soc_component_mark_match(component, substream, open))
|
|
|
|
return 0;
|
|
|
|
|
ASoC: soc-core: merge snd_pcm_ops member to component driver
Current snd_soc_component_driver has snd_pcm_ops, and each driver can
have callback via it (1).
But, it is mainly created for ALSA, thus, it doesn't have "component"
as parameter for ALSA SoC (1)(2).
Thus, each callback can't know it is called for which component.
Thus, each callback currently is getting "component" by using
snd_soc_rtdcom_lookup() with driver name (3).
--- ALSA SoC ---
...
if (component->driver->ops &&
component->driver->ops->open)
(1) return component->driver->ops->open(substream);
...
--- driver ---
(2) static int xxx_open(struct snd_pcm_substream *substream)
{
struct snd_soc_pcm_runtime *rtd = substream->private_data;
(3) struct snd_soc_component *component = snd_soc_rtdcom_lookup(..);
...
}
It works today, but, will not work in the future if we support multi
CPU/Codec/Platform, because 1 rtd might have multiple components which
have same driver name.
To solve this issue, each callback needs to be called with component.
We already have many component driver callback.
This patch copies each snd_pcm_ops member under component driver,
and having "component" as parameter.
--- ALSA SoC ---
...
if (component->driver->open)
=> return component->driver->open(component, substream);
...
--- driver ---
=> static int xxx_open(struct snd_soc_component *component,
struct snd_pcm_substream *substream)
{
...
}
*Note*
Only Intel skl-pcm has .get_time_info implementation, but ALSA SoC
framework doesn't call it so far.
To keep its implementation, this patch keeps .get_time_info,
but it is still not called.
Intel guy need to support it in the future.
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87tv8raf3r.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2019-10-02 13:30:48 +08:00
|
|
|
if (component->driver->close)
|
2020-06-04 16:06:41 +08:00
|
|
|
ret = component->driver->close(component, substream);
|
|
|
|
|
ASoC: soc-component: add mark for soc_pcm_components_open/close()
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: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87imbybwno.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-09-28 08:01:04 +08:00
|
|
|
/* remove marked substream */
|
|
|
|
soc_component_mark_pop(component, substream, open);
|
|
|
|
|
2020-06-04 16:06:41 +08:00
|
|
|
return soc_component_ret(component, ret);
|
2019-07-26 12:50:07 +08:00
|
|
|
}
|
2019-07-26 12:50:13 +08:00
|
|
|
|
2019-07-26 12:50:34 +08:00
|
|
|
void snd_soc_component_suspend(struct snd_soc_component *component)
|
|
|
|
{
|
|
|
|
if (component->driver->suspend)
|
|
|
|
component->driver->suspend(component);
|
|
|
|
component->suspended = 1;
|
|
|
|
}
|
2019-07-26 12:51:08 +08:00
|
|
|
|
|
|
|
void snd_soc_component_resume(struct snd_soc_component *component)
|
|
|
|
{
|
|
|
|
if (component->driver->resume)
|
|
|
|
component->driver->resume(component);
|
|
|
|
component->suspended = 0;
|
|
|
|
}
|
2019-07-26 12:51:13 +08:00
|
|
|
|
|
|
|
int snd_soc_component_is_suspended(struct snd_soc_component *component)
|
|
|
|
{
|
|
|
|
return component->suspended;
|
|
|
|
}
|
2019-07-26 12:51:17 +08:00
|
|
|
|
|
|
|
int snd_soc_component_probe(struct snd_soc_component *component)
|
|
|
|
{
|
2020-06-04 16:06:41 +08:00
|
|
|
int ret = 0;
|
|
|
|
|
2019-07-26 12:51:17 +08:00
|
|
|
if (component->driver->probe)
|
2020-06-04 16:06:41 +08:00
|
|
|
ret = component->driver->probe(component);
|
2019-07-26 12:51:17 +08:00
|
|
|
|
2020-06-04 16:06:41 +08:00
|
|
|
return soc_component_ret(component, ret);
|
2019-07-26 12:51:17 +08:00
|
|
|
}
|
2019-07-26 12:51:22 +08:00
|
|
|
|
|
|
|
void snd_soc_component_remove(struct snd_soc_component *component)
|
|
|
|
{
|
|
|
|
if (component->driver->remove)
|
|
|
|
component->driver->remove(component);
|
|
|
|
}
|
2019-07-26 12:51:26 +08:00
|
|
|
|
|
|
|
int snd_soc_component_of_xlate_dai_id(struct snd_soc_component *component,
|
|
|
|
struct device_node *ep)
|
|
|
|
{
|
2020-06-04 16:06:41 +08:00
|
|
|
int ret = -ENOTSUPP;
|
|
|
|
|
2019-07-26 12:51:26 +08:00
|
|
|
if (component->driver->of_xlate_dai_id)
|
2020-06-04 16:06:41 +08:00
|
|
|
ret = component->driver->of_xlate_dai_id(component, ep);
|
2019-07-26 12:51:26 +08:00
|
|
|
|
2020-06-04 16:06:41 +08:00
|
|
|
return soc_component_ret(component, ret);
|
2019-07-26 12:51:26 +08:00
|
|
|
}
|
2019-07-26 12:51:31 +08:00
|
|
|
|
|
|
|
int snd_soc_component_of_xlate_dai_name(struct snd_soc_component *component,
|
|
|
|
struct of_phandle_args *args,
|
|
|
|
const char **dai_name)
|
|
|
|
{
|
|
|
|
if (component->driver->of_xlate_dai_name)
|
2020-07-23 22:20:20 +08:00
|
|
|
return component->driver->of_xlate_dai_name(component,
|
|
|
|
args, dai_name);
|
|
|
|
/*
|
|
|
|
* Don't use soc_component_ret here because we may not want to report
|
|
|
|
* the error just yet. If a device has more than one component, the
|
|
|
|
* first may not match and we don't want spam the log with this.
|
|
|
|
*/
|
|
|
|
return -ENOTSUPP;
|
2019-07-26 12:51:31 +08:00
|
|
|
}
|
2019-07-26 12:51:47 +08:00
|
|
|
|
2020-06-04 16:06:22 +08:00
|
|
|
void snd_soc_component_setup_regmap(struct snd_soc_component *component)
|
|
|
|
{
|
|
|
|
int val_bytes = regmap_get_val_bytes(component->regmap);
|
|
|
|
|
|
|
|
/* Errors are legitimate for non-integer byte multiples */
|
|
|
|
if (val_bytes > 0)
|
|
|
|
component->val_bytes = val_bytes;
|
|
|
|
}
|
|
|
|
|
|
|
|
#ifdef CONFIG_REGMAP
|
|
|
|
|
|
|
|
/**
|
|
|
|
* snd_soc_component_init_regmap() - Initialize regmap instance for the
|
|
|
|
* component
|
|
|
|
* @component: The component for which to initialize the regmap instance
|
|
|
|
* @regmap: The regmap instance that should be used by the component
|
|
|
|
*
|
|
|
|
* This function allows deferred assignment of the regmap instance that is
|
|
|
|
* associated with the component. Only use this if the regmap instance is not
|
|
|
|
* yet ready when the component is registered. The function must also be called
|
|
|
|
* before the first IO attempt of the component.
|
|
|
|
*/
|
|
|
|
void snd_soc_component_init_regmap(struct snd_soc_component *component,
|
|
|
|
struct regmap *regmap)
|
|
|
|
{
|
|
|
|
component->regmap = regmap;
|
|
|
|
snd_soc_component_setup_regmap(component);
|
|
|
|
}
|
|
|
|
EXPORT_SYMBOL_GPL(snd_soc_component_init_regmap);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* snd_soc_component_exit_regmap() - De-initialize regmap instance for the
|
|
|
|
* component
|
|
|
|
* @component: The component for which to de-initialize the regmap instance
|
|
|
|
*
|
|
|
|
* Calls regmap_exit() on the regmap instance associated to the component and
|
|
|
|
* removes the regmap instance from the component.
|
|
|
|
*
|
|
|
|
* This function should only be used if snd_soc_component_init_regmap() was used
|
|
|
|
* to initialize the regmap instance.
|
|
|
|
*/
|
|
|
|
void snd_soc_component_exit_regmap(struct snd_soc_component *component)
|
|
|
|
{
|
|
|
|
regmap_exit(component->regmap);
|
|
|
|
component->regmap = NULL;
|
|
|
|
}
|
|
|
|
EXPORT_SYMBOL_GPL(snd_soc_component_exit_regmap);
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
2020-06-16 13:19:52 +08:00
|
|
|
static unsigned int soc_component_read_no_lock(
|
|
|
|
struct snd_soc_component *component,
|
|
|
|
unsigned int reg)
|
2020-06-04 16:08:03 +08:00
|
|
|
{
|
|
|
|
int ret;
|
ASoC: soc-component: merge snd_soc_component_read() and snd_soc_component_read32()
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 738b49efe6c6 ("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: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Link: https://lore.kernel.org/r/87sgev4mfl.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-06-16 13:19:41 +08:00
|
|
|
unsigned int val = 0;
|
2020-06-04 16:08:03 +08:00
|
|
|
|
|
|
|
if (component->regmap)
|
ASoC: soc-component: merge snd_soc_component_read() and snd_soc_component_read32()
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 738b49efe6c6 ("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: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Link: https://lore.kernel.org/r/87sgev4mfl.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-06-16 13:19:41 +08:00
|
|
|
ret = regmap_read(component->regmap, reg, &val);
|
2020-06-04 16:08:03 +08:00
|
|
|
else if (component->driver->read) {
|
|
|
|
ret = 0;
|
ASoC: soc-component: merge snd_soc_component_read() and snd_soc_component_read32()
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 738b49efe6c6 ("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: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Link: https://lore.kernel.org/r/87sgev4mfl.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-06-16 13:19:41 +08:00
|
|
|
val = component->driver->read(component, reg);
|
2020-06-04 16:08:03 +08:00
|
|
|
}
|
|
|
|
else
|
|
|
|
ret = -EIO;
|
|
|
|
|
|
|
|
if (ret < 0)
|
ASoC: Make soc_component_read() returning an error code again
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: cf6e26c71bfd ("ASoC: soc-component: merge snd_soc_component_read() and snd_soc_component_read32()")
Reported-by: John Stultz <john.stultz@linaro.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Link: https://lore.kernel.org/r/20200810134631.19742-1-tiwai@suse.de
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-08-10 21:46:31 +08:00
|
|
|
return soc_component_ret(component, ret);
|
2020-06-04 16:08:03 +08:00
|
|
|
|
|
|
|
return val;
|
|
|
|
}
|
2020-06-16 13:19:52 +08:00
|
|
|
|
|
|
|
/**
|
|
|
|
* snd_soc_component_read() - Read register value
|
|
|
|
* @component: Component to read from
|
|
|
|
* @reg: Register to read
|
|
|
|
*
|
|
|
|
* Return: read value
|
|
|
|
*/
|
|
|
|
unsigned int snd_soc_component_read(struct snd_soc_component *component,
|
|
|
|
unsigned int reg)
|
|
|
|
{
|
|
|
|
unsigned int val;
|
|
|
|
|
|
|
|
mutex_lock(&component->io_mutex);
|
|
|
|
val = soc_component_read_no_lock(component, reg);
|
|
|
|
mutex_unlock(&component->io_mutex);
|
|
|
|
|
|
|
|
return val;
|
|
|
|
}
|
ASoC: soc-component: merge snd_soc_component_read() and snd_soc_component_read32()
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 738b49efe6c6 ("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: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Link: https://lore.kernel.org/r/87sgev4mfl.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-06-16 13:19:41 +08:00
|
|
|
EXPORT_SYMBOL_GPL(snd_soc_component_read);
|
2020-06-04 16:08:03 +08:00
|
|
|
|
2020-06-16 13:19:52 +08:00
|
|
|
static int soc_component_write_no_lock(
|
|
|
|
struct snd_soc_component *component,
|
|
|
|
unsigned int reg, unsigned int val)
|
|
|
|
{
|
|
|
|
int ret = -EIO;
|
|
|
|
|
|
|
|
if (component->regmap)
|
|
|
|
ret = regmap_write(component->regmap, reg, val);
|
|
|
|
else if (component->driver->write)
|
|
|
|
ret = component->driver->write(component, reg, val);
|
|
|
|
|
|
|
|
return soc_component_ret(component, ret);
|
|
|
|
}
|
|
|
|
|
2020-06-04 16:08:03 +08:00
|
|
|
/**
|
|
|
|
* snd_soc_component_write() - Write register value
|
|
|
|
* @component: Component to write to
|
|
|
|
* @reg: Register to write
|
|
|
|
* @val: Value to write to the register
|
|
|
|
*
|
|
|
|
* Return: 0 on success, a negative error code otherwise.
|
|
|
|
*/
|
|
|
|
int snd_soc_component_write(struct snd_soc_component *component,
|
|
|
|
unsigned int reg, unsigned int val)
|
|
|
|
{
|
2020-06-16 13:19:52 +08:00
|
|
|
int ret;
|
2020-06-04 16:08:03 +08:00
|
|
|
|
2020-06-16 13:19:52 +08:00
|
|
|
mutex_lock(&component->io_mutex);
|
|
|
|
ret = soc_component_write_no_lock(component, reg, val);
|
|
|
|
mutex_unlock(&component->io_mutex);
|
2020-06-04 16:08:03 +08:00
|
|
|
|
2020-06-16 13:19:52 +08:00
|
|
|
return ret;
|
2020-06-04 16:08:03 +08:00
|
|
|
}
|
|
|
|
EXPORT_SYMBOL_GPL(snd_soc_component_write);
|
|
|
|
|
|
|
|
static int snd_soc_component_update_bits_legacy(
|
|
|
|
struct snd_soc_component *component, unsigned int reg,
|
|
|
|
unsigned int mask, unsigned int val, bool *change)
|
|
|
|
{
|
|
|
|
unsigned int old, new;
|
ASoC: soc-component: merge snd_soc_component_read() and snd_soc_component_read32()
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 738b49efe6c6 ("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: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Link: https://lore.kernel.org/r/87sgev4mfl.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-06-16 13:19:41 +08:00
|
|
|
int ret = 0;
|
2020-06-04 16:08:03 +08:00
|
|
|
|
|
|
|
mutex_lock(&component->io_mutex);
|
|
|
|
|
2020-06-16 13:19:52 +08:00
|
|
|
old = soc_component_read_no_lock(component, reg);
|
2020-06-04 16:08:03 +08:00
|
|
|
|
|
|
|
new = (old & ~mask) | (val & mask);
|
|
|
|
*change = old != new;
|
|
|
|
if (*change)
|
2020-06-16 13:19:52 +08:00
|
|
|
ret = soc_component_write_no_lock(component, reg, new);
|
ASoC: soc-component: merge snd_soc_component_read() and snd_soc_component_read32()
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 738b49efe6c6 ("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: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Link: https://lore.kernel.org/r/87sgev4mfl.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-06-16 13:19:41 +08:00
|
|
|
|
2020-06-04 16:08:03 +08:00
|
|
|
mutex_unlock(&component->io_mutex);
|
|
|
|
|
|
|
|
return soc_component_ret(component, ret);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* snd_soc_component_update_bits() - Perform read/modify/write cycle
|
|
|
|
* @component: Component to update
|
|
|
|
* @reg: Register to update
|
|
|
|
* @mask: Mask that specifies which bits to update
|
|
|
|
* @val: New value for the bits specified by mask
|
|
|
|
*
|
|
|
|
* Return: 1 if the operation was successful and the value of the register
|
|
|
|
* changed, 0 if the operation was successful, but the value did not change.
|
|
|
|
* Returns a negative error code otherwise.
|
|
|
|
*/
|
|
|
|
int snd_soc_component_update_bits(struct snd_soc_component *component,
|
|
|
|
unsigned int reg, unsigned int mask, unsigned int val)
|
|
|
|
{
|
|
|
|
bool change;
|
|
|
|
int ret;
|
|
|
|
|
|
|
|
if (component->regmap)
|
|
|
|
ret = regmap_update_bits_check(component->regmap, reg, mask,
|
|
|
|
val, &change);
|
|
|
|
else
|
|
|
|
ret = snd_soc_component_update_bits_legacy(component, reg,
|
|
|
|
mask, val, &change);
|
|
|
|
|
|
|
|
if (ret < 0)
|
|
|
|
return soc_component_ret(component, ret);
|
|
|
|
return change;
|
|
|
|
}
|
|
|
|
EXPORT_SYMBOL_GPL(snd_soc_component_update_bits);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* snd_soc_component_update_bits_async() - Perform asynchronous
|
|
|
|
* read/modify/write cycle
|
|
|
|
* @component: Component to update
|
|
|
|
* @reg: Register to update
|
|
|
|
* @mask: Mask that specifies which bits to update
|
|
|
|
* @val: New value for the bits specified by mask
|
|
|
|
*
|
|
|
|
* This function is similar to snd_soc_component_update_bits(), but the update
|
|
|
|
* operation is scheduled asynchronously. This means it may not be completed
|
|
|
|
* when the function returns. To make sure that all scheduled updates have been
|
|
|
|
* completed snd_soc_component_async_complete() must be called.
|
|
|
|
*
|
|
|
|
* Return: 1 if the operation was successful and the value of the register
|
|
|
|
* changed, 0 if the operation was successful, but the value did not change.
|
|
|
|
* Returns a negative error code otherwise.
|
|
|
|
*/
|
|
|
|
int snd_soc_component_update_bits_async(struct snd_soc_component *component,
|
|
|
|
unsigned int reg, unsigned int mask, unsigned int val)
|
|
|
|
{
|
|
|
|
bool change;
|
|
|
|
int ret;
|
|
|
|
|
|
|
|
if (component->regmap)
|
|
|
|
ret = regmap_update_bits_check_async(component->regmap, reg,
|
|
|
|
mask, val, &change);
|
|
|
|
else
|
|
|
|
ret = snd_soc_component_update_bits_legacy(component, reg,
|
|
|
|
mask, val, &change);
|
|
|
|
|
|
|
|
if (ret < 0)
|
|
|
|
return soc_component_ret(component, ret);
|
|
|
|
return change;
|
|
|
|
}
|
|
|
|
EXPORT_SYMBOL_GPL(snd_soc_component_update_bits_async);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* snd_soc_component_async_complete() - Ensure asynchronous I/O has completed
|
|
|
|
* @component: Component for which to wait
|
|
|
|
*
|
|
|
|
* This function blocks until all asynchronous I/O which has previously been
|
|
|
|
* scheduled using snd_soc_component_update_bits_async() has completed.
|
|
|
|
*/
|
|
|
|
void snd_soc_component_async_complete(struct snd_soc_component *component)
|
|
|
|
{
|
|
|
|
if (component->regmap)
|
|
|
|
regmap_async_complete(component->regmap);
|
|
|
|
}
|
|
|
|
EXPORT_SYMBOL_GPL(snd_soc_component_async_complete);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* snd_soc_component_test_bits - Test register for change
|
|
|
|
* @component: component
|
|
|
|
* @reg: Register to test
|
|
|
|
* @mask: Mask that specifies which bits to test
|
|
|
|
* @value: Value to test against
|
|
|
|
*
|
|
|
|
* Tests a register with a new value and checks if the new value is
|
|
|
|
* different from the old value.
|
|
|
|
*
|
|
|
|
* Return: 1 for change, otherwise 0.
|
|
|
|
*/
|
|
|
|
int snd_soc_component_test_bits(struct snd_soc_component *component,
|
|
|
|
unsigned int reg, unsigned int mask, unsigned int value)
|
|
|
|
{
|
|
|
|
unsigned int old, new;
|
|
|
|
|
ASoC: soc-component: merge snd_soc_component_read() and snd_soc_component_read32()
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 738b49efe6c6 ("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: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Link: https://lore.kernel.org/r/87sgev4mfl.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-06-16 13:19:41 +08:00
|
|
|
old = snd_soc_component_read(component, reg);
|
2020-06-04 16:08:03 +08:00
|
|
|
new = (old & ~mask) | value;
|
|
|
|
return old != new;
|
|
|
|
}
|
|
|
|
EXPORT_SYMBOL_GPL(snd_soc_component_test_bits);
|
|
|
|
|
2019-07-26 12:51:47 +08:00
|
|
|
int snd_soc_pcm_component_pointer(struct snd_pcm_substream *substream)
|
|
|
|
{
|
2020-07-20 09:17:39 +08:00
|
|
|
struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream);
|
2019-07-26 12:51:47 +08:00
|
|
|
struct snd_soc_component *component;
|
ASoC: soc-core: remove snd_soc_rtdcom_list
Current ALSA SoC is using struct snd_soc_rtdcom_list to
connecting component to rtd by using list_head.
struct snd_soc_rtdcom_list {
struct snd_soc_component *component;
struct list_head list; /* rtd::component_list */
};
struct snd_soc_pcm_runtime {
...
struct list_head component_list; /* list of connected components */
...
};
The CPU/Codec/Platform component which will be connected to rtd (a)
is indicated via dai_link at snd_soc_add_pcm_runtime()
int snd_soc_add_pcm_runtime(...)
{
...
/* Find CPU from registered CPUs */
rtd->cpu_dai = snd_soc_find_dai(dai_link->cpus);
...
(a) snd_soc_rtdcom_add(rtd, rtd->cpu_dai->component);
...
/* Find CODEC from registered CODECs */
(b) for_each_link_codecs(dai_link, i, codec) {
rtd->codec_dais[i] = snd_soc_find_dai(codec);
...
(a) snd_soc_rtdcom_add(rtd, rtd->codec_dais[i]->component);
}
...
/* Find PLATFORM from registered PLATFORMs */
(b) for_each_link_platforms(dai_link, i, platform) {
for_each_component(component) {
...
(a) snd_soc_rtdcom_add(rtd, component);
}
}
}
It shows, it is possible to know how many components will be
connected to rtd by using
dai_link->num_cpus
dai_link->num_codecs
dai_link->num_platforms
If so, we can use component pointer array instead of list_head,
in such case, code can be more simple.
This patch removes struct snd_soc_rtdcom_list that is only
of temporary value, and convert to pointer array.
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Reviewed-By: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Link: https://lore.kernel.org/r/87a76wt4wm.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-01-10 10:35:21 +08:00
|
|
|
int i;
|
2019-07-26 12:51:47 +08:00
|
|
|
|
ASoC: soc-core: add for_each_rtd_components() and replace
ALSA SoC has for_each_rtdcom() which is link list for
rtd-component which is called as rtdcom. The relationship image is like below
rtdcom rtdcom rtdcom
component component component
rtd->component_list -> list -> list -> list ...
Here, the pointer get via normal link list is rtdcom,
Thus, current for_each loop is like below, and need to get
component via rtdcom->component
for_each_rtdcom(rtd, rtdcom) {
component = rtdcom->component;
...
}
but usually, user want to get pointer from for_each_xxx is component
directly, like below.
for_each_rtd_component(rtd, rtdcom, component) {
...
}
This patch expands list_for_each_entry manually, and enable to get
component directly from for_each macro.
Because of it, the macro becoming difficult to read,
but macro itself becoming useful.
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/878spm64m4.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2019-10-15 11:59:31 +08:00
|
|
|
/* FIXME: use 1st pointer */
|
ASoC: soc-core: remove snd_soc_rtdcom_list
Current ALSA SoC is using struct snd_soc_rtdcom_list to
connecting component to rtd by using list_head.
struct snd_soc_rtdcom_list {
struct snd_soc_component *component;
struct list_head list; /* rtd::component_list */
};
struct snd_soc_pcm_runtime {
...
struct list_head component_list; /* list of connected components */
...
};
The CPU/Codec/Platform component which will be connected to rtd (a)
is indicated via dai_link at snd_soc_add_pcm_runtime()
int snd_soc_add_pcm_runtime(...)
{
...
/* Find CPU from registered CPUs */
rtd->cpu_dai = snd_soc_find_dai(dai_link->cpus);
...
(a) snd_soc_rtdcom_add(rtd, rtd->cpu_dai->component);
...
/* Find CODEC from registered CODECs */
(b) for_each_link_codecs(dai_link, i, codec) {
rtd->codec_dais[i] = snd_soc_find_dai(codec);
...
(a) snd_soc_rtdcom_add(rtd, rtd->codec_dais[i]->component);
}
...
/* Find PLATFORM from registered PLATFORMs */
(b) for_each_link_platforms(dai_link, i, platform) {
for_each_component(component) {
...
(a) snd_soc_rtdcom_add(rtd, component);
}
}
}
It shows, it is possible to know how many components will be
connected to rtd by using
dai_link->num_cpus
dai_link->num_codecs
dai_link->num_platforms
If so, we can use component pointer array instead of list_head,
in such case, code can be more simple.
This patch removes struct snd_soc_rtdcom_list that is only
of temporary value, and convert to pointer array.
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Reviewed-By: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Link: https://lore.kernel.org/r/87a76wt4wm.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-01-10 10:35:21 +08:00
|
|
|
for_each_rtd_components(rtd, i, component)
|
ASoC: soc-core: merge snd_pcm_ops member to component driver
Current snd_soc_component_driver has snd_pcm_ops, and each driver can
have callback via it (1).
But, it is mainly created for ALSA, thus, it doesn't have "component"
as parameter for ALSA SoC (1)(2).
Thus, each callback can't know it is called for which component.
Thus, each callback currently is getting "component" by using
snd_soc_rtdcom_lookup() with driver name (3).
--- ALSA SoC ---
...
if (component->driver->ops &&
component->driver->ops->open)
(1) return component->driver->ops->open(substream);
...
--- driver ---
(2) static int xxx_open(struct snd_pcm_substream *substream)
{
struct snd_soc_pcm_runtime *rtd = substream->private_data;
(3) struct snd_soc_component *component = snd_soc_rtdcom_lookup(..);
...
}
It works today, but, will not work in the future if we support multi
CPU/Codec/Platform, because 1 rtd might have multiple components which
have same driver name.
To solve this issue, each callback needs to be called with component.
We already have many component driver callback.
This patch copies each snd_pcm_ops member under component driver,
and having "component" as parameter.
--- ALSA SoC ---
...
if (component->driver->open)
=> return component->driver->open(component, substream);
...
--- driver ---
=> static int xxx_open(struct snd_soc_component *component,
struct snd_pcm_substream *substream)
{
...
}
*Note*
Only Intel skl-pcm has .get_time_info implementation, but ALSA SoC
framework doesn't call it so far.
To keep its implementation, this patch keeps .get_time_info,
but it is still not called.
Intel guy need to support it in the future.
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87tv8raf3r.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2019-10-02 13:30:48 +08:00
|
|
|
if (component->driver->pointer)
|
|
|
|
return component->driver->pointer(component, substream);
|
2019-07-26 12:51:47 +08:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
2019-07-26 12:51:51 +08:00
|
|
|
|
|
|
|
int snd_soc_pcm_component_ioctl(struct snd_pcm_substream *substream,
|
|
|
|
unsigned int cmd, void *arg)
|
|
|
|
{
|
2020-07-20 09:17:39 +08:00
|
|
|
struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream);
|
2019-07-26 12:51:51 +08:00
|
|
|
struct snd_soc_component *component;
|
ASoC: soc-core: remove snd_soc_rtdcom_list
Current ALSA SoC is using struct snd_soc_rtdcom_list to
connecting component to rtd by using list_head.
struct snd_soc_rtdcom_list {
struct snd_soc_component *component;
struct list_head list; /* rtd::component_list */
};
struct snd_soc_pcm_runtime {
...
struct list_head component_list; /* list of connected components */
...
};
The CPU/Codec/Platform component which will be connected to rtd (a)
is indicated via dai_link at snd_soc_add_pcm_runtime()
int snd_soc_add_pcm_runtime(...)
{
...
/* Find CPU from registered CPUs */
rtd->cpu_dai = snd_soc_find_dai(dai_link->cpus);
...
(a) snd_soc_rtdcom_add(rtd, rtd->cpu_dai->component);
...
/* Find CODEC from registered CODECs */
(b) for_each_link_codecs(dai_link, i, codec) {
rtd->codec_dais[i] = snd_soc_find_dai(codec);
...
(a) snd_soc_rtdcom_add(rtd, rtd->codec_dais[i]->component);
}
...
/* Find PLATFORM from registered PLATFORMs */
(b) for_each_link_platforms(dai_link, i, platform) {
for_each_component(component) {
...
(a) snd_soc_rtdcom_add(rtd, component);
}
}
}
It shows, it is possible to know how many components will be
connected to rtd by using
dai_link->num_cpus
dai_link->num_codecs
dai_link->num_platforms
If so, we can use component pointer array instead of list_head,
in such case, code can be more simple.
This patch removes struct snd_soc_rtdcom_list that is only
of temporary value, and convert to pointer array.
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Reviewed-By: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Link: https://lore.kernel.org/r/87a76wt4wm.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-01-10 10:35:21 +08:00
|
|
|
int i;
|
2019-07-26 12:51:51 +08:00
|
|
|
|
ASoC: soc-core: add for_each_rtd_components() and replace
ALSA SoC has for_each_rtdcom() which is link list for
rtd-component which is called as rtdcom. The relationship image is like below
rtdcom rtdcom rtdcom
component component component
rtd->component_list -> list -> list -> list ...
Here, the pointer get via normal link list is rtdcom,
Thus, current for_each loop is like below, and need to get
component via rtdcom->component
for_each_rtdcom(rtd, rtdcom) {
component = rtdcom->component;
...
}
but usually, user want to get pointer from for_each_xxx is component
directly, like below.
for_each_rtd_component(rtd, rtdcom, component) {
...
}
This patch expands list_for_each_entry manually, and enable to get
component directly from for_each macro.
Because of it, the macro becoming difficult to read,
but macro itself becoming useful.
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/878spm64m4.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2019-10-15 11:59:31 +08:00
|
|
|
/* FIXME: use 1st ioctl */
|
ASoC: soc-core: remove snd_soc_rtdcom_list
Current ALSA SoC is using struct snd_soc_rtdcom_list to
connecting component to rtd by using list_head.
struct snd_soc_rtdcom_list {
struct snd_soc_component *component;
struct list_head list; /* rtd::component_list */
};
struct snd_soc_pcm_runtime {
...
struct list_head component_list; /* list of connected components */
...
};
The CPU/Codec/Platform component which will be connected to rtd (a)
is indicated via dai_link at snd_soc_add_pcm_runtime()
int snd_soc_add_pcm_runtime(...)
{
...
/* Find CPU from registered CPUs */
rtd->cpu_dai = snd_soc_find_dai(dai_link->cpus);
...
(a) snd_soc_rtdcom_add(rtd, rtd->cpu_dai->component);
...
/* Find CODEC from registered CODECs */
(b) for_each_link_codecs(dai_link, i, codec) {
rtd->codec_dais[i] = snd_soc_find_dai(codec);
...
(a) snd_soc_rtdcom_add(rtd, rtd->codec_dais[i]->component);
}
...
/* Find PLATFORM from registered PLATFORMs */
(b) for_each_link_platforms(dai_link, i, platform) {
for_each_component(component) {
...
(a) snd_soc_rtdcom_add(rtd, component);
}
}
}
It shows, it is possible to know how many components will be
connected to rtd by using
dai_link->num_cpus
dai_link->num_codecs
dai_link->num_platforms
If so, we can use component pointer array instead of list_head,
in such case, code can be more simple.
This patch removes struct snd_soc_rtdcom_list that is only
of temporary value, and convert to pointer array.
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Reviewed-By: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Link: https://lore.kernel.org/r/87a76wt4wm.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-01-10 10:35:21 +08:00
|
|
|
for_each_rtd_components(rtd, i, component)
|
ASoC: soc-core: merge snd_pcm_ops member to component driver
Current snd_soc_component_driver has snd_pcm_ops, and each driver can
have callback via it (1).
But, it is mainly created for ALSA, thus, it doesn't have "component"
as parameter for ALSA SoC (1)(2).
Thus, each callback can't know it is called for which component.
Thus, each callback currently is getting "component" by using
snd_soc_rtdcom_lookup() with driver name (3).
--- ALSA SoC ---
...
if (component->driver->ops &&
component->driver->ops->open)
(1) return component->driver->ops->open(substream);
...
--- driver ---
(2) static int xxx_open(struct snd_pcm_substream *substream)
{
struct snd_soc_pcm_runtime *rtd = substream->private_data;
(3) struct snd_soc_component *component = snd_soc_rtdcom_lookup(..);
...
}
It works today, but, will not work in the future if we support multi
CPU/Codec/Platform, because 1 rtd might have multiple components which
have same driver name.
To solve this issue, each callback needs to be called with component.
We already have many component driver callback.
This patch copies each snd_pcm_ops member under component driver,
and having "component" as parameter.
--- ALSA SoC ---
...
if (component->driver->open)
=> return component->driver->open(component, substream);
...
--- driver ---
=> static int xxx_open(struct snd_soc_component *component,
struct snd_pcm_substream *substream)
{
...
}
*Note*
Only Intel skl-pcm has .get_time_info implementation, but ALSA SoC
framework doesn't call it so far.
To keep its implementation, this patch keeps .get_time_info,
but it is still not called.
Intel guy need to support it in the future.
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87tv8raf3r.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2019-10-02 13:30:48 +08:00
|
|
|
if (component->driver->ioctl)
|
2020-06-04 16:06:41 +08:00
|
|
|
return soc_component_ret(
|
|
|
|
component,
|
|
|
|
component->driver->ioctl(component,
|
|
|
|
substream, cmd, arg));
|
2019-07-26 12:51:51 +08:00
|
|
|
|
|
|
|
return snd_pcm_lib_ioctl(substream, cmd, arg);
|
|
|
|
}
|
2019-07-26 12:51:56 +08:00
|
|
|
|
2019-11-22 03:07:09 +08:00
|
|
|
int snd_soc_pcm_component_sync_stop(struct snd_pcm_substream *substream)
|
|
|
|
{
|
2020-07-20 09:17:39 +08:00
|
|
|
struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream);
|
2019-11-22 03:07:09 +08:00
|
|
|
struct snd_soc_component *component;
|
ASoC: soc-core: remove snd_soc_rtdcom_list
Current ALSA SoC is using struct snd_soc_rtdcom_list to
connecting component to rtd by using list_head.
struct snd_soc_rtdcom_list {
struct snd_soc_component *component;
struct list_head list; /* rtd::component_list */
};
struct snd_soc_pcm_runtime {
...
struct list_head component_list; /* list of connected components */
...
};
The CPU/Codec/Platform component which will be connected to rtd (a)
is indicated via dai_link at snd_soc_add_pcm_runtime()
int snd_soc_add_pcm_runtime(...)
{
...
/* Find CPU from registered CPUs */
rtd->cpu_dai = snd_soc_find_dai(dai_link->cpus);
...
(a) snd_soc_rtdcom_add(rtd, rtd->cpu_dai->component);
...
/* Find CODEC from registered CODECs */
(b) for_each_link_codecs(dai_link, i, codec) {
rtd->codec_dais[i] = snd_soc_find_dai(codec);
...
(a) snd_soc_rtdcom_add(rtd, rtd->codec_dais[i]->component);
}
...
/* Find PLATFORM from registered PLATFORMs */
(b) for_each_link_platforms(dai_link, i, platform) {
for_each_component(component) {
...
(a) snd_soc_rtdcom_add(rtd, component);
}
}
}
It shows, it is possible to know how many components will be
connected to rtd by using
dai_link->num_cpus
dai_link->num_codecs
dai_link->num_platforms
If so, we can use component pointer array instead of list_head,
in such case, code can be more simple.
This patch removes struct snd_soc_rtdcom_list that is only
of temporary value, and convert to pointer array.
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Reviewed-By: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Link: https://lore.kernel.org/r/87a76wt4wm.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-01-10 10:35:21 +08:00
|
|
|
int i, ret;
|
2019-11-22 03:07:09 +08:00
|
|
|
|
ASoC: soc-core: remove snd_soc_rtdcom_list
Current ALSA SoC is using struct snd_soc_rtdcom_list to
connecting component to rtd by using list_head.
struct snd_soc_rtdcom_list {
struct snd_soc_component *component;
struct list_head list; /* rtd::component_list */
};
struct snd_soc_pcm_runtime {
...
struct list_head component_list; /* list of connected components */
...
};
The CPU/Codec/Platform component which will be connected to rtd (a)
is indicated via dai_link at snd_soc_add_pcm_runtime()
int snd_soc_add_pcm_runtime(...)
{
...
/* Find CPU from registered CPUs */
rtd->cpu_dai = snd_soc_find_dai(dai_link->cpus);
...
(a) snd_soc_rtdcom_add(rtd, rtd->cpu_dai->component);
...
/* Find CODEC from registered CODECs */
(b) for_each_link_codecs(dai_link, i, codec) {
rtd->codec_dais[i] = snd_soc_find_dai(codec);
...
(a) snd_soc_rtdcom_add(rtd, rtd->codec_dais[i]->component);
}
...
/* Find PLATFORM from registered PLATFORMs */
(b) for_each_link_platforms(dai_link, i, platform) {
for_each_component(component) {
...
(a) snd_soc_rtdcom_add(rtd, component);
}
}
}
It shows, it is possible to know how many components will be
connected to rtd by using
dai_link->num_cpus
dai_link->num_codecs
dai_link->num_platforms
If so, we can use component pointer array instead of list_head,
in such case, code can be more simple.
This patch removes struct snd_soc_rtdcom_list that is only
of temporary value, and convert to pointer array.
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Reviewed-By: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Link: https://lore.kernel.org/r/87a76wt4wm.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-01-10 10:35:21 +08:00
|
|
|
for_each_rtd_components(rtd, i, component) {
|
2020-02-28 09:48:35 +08:00
|
|
|
if (component->driver->sync_stop) {
|
2019-11-22 03:07:09 +08:00
|
|
|
ret = component->driver->sync_stop(component,
|
|
|
|
substream);
|
|
|
|
if (ret < 0)
|
2020-07-16 13:07:08 +08:00
|
|
|
return soc_component_ret(component, ret);
|
2019-11-22 03:07:09 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2019-07-26 12:51:56 +08:00
|
|
|
int snd_soc_pcm_component_copy_user(struct snd_pcm_substream *substream,
|
|
|
|
int channel, unsigned long pos,
|
|
|
|
void __user *buf, unsigned long bytes)
|
|
|
|
{
|
2020-07-20 09:17:39 +08:00
|
|
|
struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream);
|
2019-07-26 12:51:56 +08:00
|
|
|
struct snd_soc_component *component;
|
ASoC: soc-core: remove snd_soc_rtdcom_list
Current ALSA SoC is using struct snd_soc_rtdcom_list to
connecting component to rtd by using list_head.
struct snd_soc_rtdcom_list {
struct snd_soc_component *component;
struct list_head list; /* rtd::component_list */
};
struct snd_soc_pcm_runtime {
...
struct list_head component_list; /* list of connected components */
...
};
The CPU/Codec/Platform component which will be connected to rtd (a)
is indicated via dai_link at snd_soc_add_pcm_runtime()
int snd_soc_add_pcm_runtime(...)
{
...
/* Find CPU from registered CPUs */
rtd->cpu_dai = snd_soc_find_dai(dai_link->cpus);
...
(a) snd_soc_rtdcom_add(rtd, rtd->cpu_dai->component);
...
/* Find CODEC from registered CODECs */
(b) for_each_link_codecs(dai_link, i, codec) {
rtd->codec_dais[i] = snd_soc_find_dai(codec);
...
(a) snd_soc_rtdcom_add(rtd, rtd->codec_dais[i]->component);
}
...
/* Find PLATFORM from registered PLATFORMs */
(b) for_each_link_platforms(dai_link, i, platform) {
for_each_component(component) {
...
(a) snd_soc_rtdcom_add(rtd, component);
}
}
}
It shows, it is possible to know how many components will be
connected to rtd by using
dai_link->num_cpus
dai_link->num_codecs
dai_link->num_platforms
If so, we can use component pointer array instead of list_head,
in such case, code can be more simple.
This patch removes struct snd_soc_rtdcom_list that is only
of temporary value, and convert to pointer array.
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Reviewed-By: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Link: https://lore.kernel.org/r/87a76wt4wm.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-01-10 10:35:21 +08:00
|
|
|
int i;
|
2019-07-26 12:51:56 +08:00
|
|
|
|
ASoC: soc-core: add for_each_rtd_components() and replace
ALSA SoC has for_each_rtdcom() which is link list for
rtd-component which is called as rtdcom. The relationship image is like below
rtdcom rtdcom rtdcom
component component component
rtd->component_list -> list -> list -> list ...
Here, the pointer get via normal link list is rtdcom,
Thus, current for_each loop is like below, and need to get
component via rtdcom->component
for_each_rtdcom(rtd, rtdcom) {
component = rtdcom->component;
...
}
but usually, user want to get pointer from for_each_xxx is component
directly, like below.
for_each_rtd_component(rtd, rtdcom, component) {
...
}
This patch expands list_for_each_entry manually, and enable to get
component directly from for_each macro.
Because of it, the macro becoming difficult to read,
but macro itself becoming useful.
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/878spm64m4.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2019-10-15 11:59:31 +08:00
|
|
|
/* FIXME. it returns 1st copy now */
|
ASoC: soc-core: remove snd_soc_rtdcom_list
Current ALSA SoC is using struct snd_soc_rtdcom_list to
connecting component to rtd by using list_head.
struct snd_soc_rtdcom_list {
struct snd_soc_component *component;
struct list_head list; /* rtd::component_list */
};
struct snd_soc_pcm_runtime {
...
struct list_head component_list; /* list of connected components */
...
};
The CPU/Codec/Platform component which will be connected to rtd (a)
is indicated via dai_link at snd_soc_add_pcm_runtime()
int snd_soc_add_pcm_runtime(...)
{
...
/* Find CPU from registered CPUs */
rtd->cpu_dai = snd_soc_find_dai(dai_link->cpus);
...
(a) snd_soc_rtdcom_add(rtd, rtd->cpu_dai->component);
...
/* Find CODEC from registered CODECs */
(b) for_each_link_codecs(dai_link, i, codec) {
rtd->codec_dais[i] = snd_soc_find_dai(codec);
...
(a) snd_soc_rtdcom_add(rtd, rtd->codec_dais[i]->component);
}
...
/* Find PLATFORM from registered PLATFORMs */
(b) for_each_link_platforms(dai_link, i, platform) {
for_each_component(component) {
...
(a) snd_soc_rtdcom_add(rtd, component);
}
}
}
It shows, it is possible to know how many components will be
connected to rtd by using
dai_link->num_cpus
dai_link->num_codecs
dai_link->num_platforms
If so, we can use component pointer array instead of list_head,
in such case, code can be more simple.
This patch removes struct snd_soc_rtdcom_list that is only
of temporary value, and convert to pointer array.
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Reviewed-By: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Link: https://lore.kernel.org/r/87a76wt4wm.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-01-10 10:35:21 +08:00
|
|
|
for_each_rtd_components(rtd, i, component)
|
ASoC: soc-core: merge snd_pcm_ops member to component driver
Current snd_soc_component_driver has snd_pcm_ops, and each driver can
have callback via it (1).
But, it is mainly created for ALSA, thus, it doesn't have "component"
as parameter for ALSA SoC (1)(2).
Thus, each callback can't know it is called for which component.
Thus, each callback currently is getting "component" by using
snd_soc_rtdcom_lookup() with driver name (3).
--- ALSA SoC ---
...
if (component->driver->ops &&
component->driver->ops->open)
(1) return component->driver->ops->open(substream);
...
--- driver ---
(2) static int xxx_open(struct snd_pcm_substream *substream)
{
struct snd_soc_pcm_runtime *rtd = substream->private_data;
(3) struct snd_soc_component *component = snd_soc_rtdcom_lookup(..);
...
}
It works today, but, will not work in the future if we support multi
CPU/Codec/Platform, because 1 rtd might have multiple components which
have same driver name.
To solve this issue, each callback needs to be called with component.
We already have many component driver callback.
This patch copies each snd_pcm_ops member under component driver,
and having "component" as parameter.
--- ALSA SoC ---
...
if (component->driver->open)
=> return component->driver->open(component, substream);
...
--- driver ---
=> static int xxx_open(struct snd_soc_component *component,
struct snd_pcm_substream *substream)
{
...
}
*Note*
Only Intel skl-pcm has .get_time_info implementation, but ALSA SoC
framework doesn't call it so far.
To keep its implementation, this patch keeps .get_time_info,
but it is still not called.
Intel guy need to support it in the future.
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87tv8raf3r.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2019-10-02 13:30:48 +08:00
|
|
|
if (component->driver->copy_user)
|
2020-06-04 16:06:41 +08:00
|
|
|
return soc_component_ret(
|
|
|
|
component,
|
|
|
|
component->driver->copy_user(
|
|
|
|
component, substream, channel,
|
|
|
|
pos, buf, bytes));
|
2019-07-26 12:51:56 +08:00
|
|
|
|
|
|
|
return -EINVAL;
|
|
|
|
}
|
2019-07-26 12:52:00 +08:00
|
|
|
|
|
|
|
struct page *snd_soc_pcm_component_page(struct snd_pcm_substream *substream,
|
|
|
|
unsigned long offset)
|
|
|
|
{
|
2020-07-20 09:17:39 +08:00
|
|
|
struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream);
|
2019-07-26 12:52:00 +08:00
|
|
|
struct snd_soc_component *component;
|
|
|
|
struct page *page;
|
ASoC: soc-core: remove snd_soc_rtdcom_list
Current ALSA SoC is using struct snd_soc_rtdcom_list to
connecting component to rtd by using list_head.
struct snd_soc_rtdcom_list {
struct snd_soc_component *component;
struct list_head list; /* rtd::component_list */
};
struct snd_soc_pcm_runtime {
...
struct list_head component_list; /* list of connected components */
...
};
The CPU/Codec/Platform component which will be connected to rtd (a)
is indicated via dai_link at snd_soc_add_pcm_runtime()
int snd_soc_add_pcm_runtime(...)
{
...
/* Find CPU from registered CPUs */
rtd->cpu_dai = snd_soc_find_dai(dai_link->cpus);
...
(a) snd_soc_rtdcom_add(rtd, rtd->cpu_dai->component);
...
/* Find CODEC from registered CODECs */
(b) for_each_link_codecs(dai_link, i, codec) {
rtd->codec_dais[i] = snd_soc_find_dai(codec);
...
(a) snd_soc_rtdcom_add(rtd, rtd->codec_dais[i]->component);
}
...
/* Find PLATFORM from registered PLATFORMs */
(b) for_each_link_platforms(dai_link, i, platform) {
for_each_component(component) {
...
(a) snd_soc_rtdcom_add(rtd, component);
}
}
}
It shows, it is possible to know how many components will be
connected to rtd by using
dai_link->num_cpus
dai_link->num_codecs
dai_link->num_platforms
If so, we can use component pointer array instead of list_head,
in such case, code can be more simple.
This patch removes struct snd_soc_rtdcom_list that is only
of temporary value, and convert to pointer array.
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Reviewed-By: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Link: https://lore.kernel.org/r/87a76wt4wm.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-01-10 10:35:21 +08:00
|
|
|
int i;
|
2019-07-26 12:52:00 +08:00
|
|
|
|
ASoC: soc-core: add for_each_rtd_components() and replace
ALSA SoC has for_each_rtdcom() which is link list for
rtd-component which is called as rtdcom. The relationship image is like below
rtdcom rtdcom rtdcom
component component component
rtd->component_list -> list -> list -> list ...
Here, the pointer get via normal link list is rtdcom,
Thus, current for_each loop is like below, and need to get
component via rtdcom->component
for_each_rtdcom(rtd, rtdcom) {
component = rtdcom->component;
...
}
but usually, user want to get pointer from for_each_xxx is component
directly, like below.
for_each_rtd_component(rtd, rtdcom, component) {
...
}
This patch expands list_for_each_entry manually, and enable to get
component directly from for_each macro.
Because of it, the macro becoming difficult to read,
but macro itself becoming useful.
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/878spm64m4.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2019-10-15 11:59:31 +08:00
|
|
|
/* FIXME. it returns 1st page now */
|
ASoC: soc-core: remove snd_soc_rtdcom_list
Current ALSA SoC is using struct snd_soc_rtdcom_list to
connecting component to rtd by using list_head.
struct snd_soc_rtdcom_list {
struct snd_soc_component *component;
struct list_head list; /* rtd::component_list */
};
struct snd_soc_pcm_runtime {
...
struct list_head component_list; /* list of connected components */
...
};
The CPU/Codec/Platform component which will be connected to rtd (a)
is indicated via dai_link at snd_soc_add_pcm_runtime()
int snd_soc_add_pcm_runtime(...)
{
...
/* Find CPU from registered CPUs */
rtd->cpu_dai = snd_soc_find_dai(dai_link->cpus);
...
(a) snd_soc_rtdcom_add(rtd, rtd->cpu_dai->component);
...
/* Find CODEC from registered CODECs */
(b) for_each_link_codecs(dai_link, i, codec) {
rtd->codec_dais[i] = snd_soc_find_dai(codec);
...
(a) snd_soc_rtdcom_add(rtd, rtd->codec_dais[i]->component);
}
...
/* Find PLATFORM from registered PLATFORMs */
(b) for_each_link_platforms(dai_link, i, platform) {
for_each_component(component) {
...
(a) snd_soc_rtdcom_add(rtd, component);
}
}
}
It shows, it is possible to know how many components will be
connected to rtd by using
dai_link->num_cpus
dai_link->num_codecs
dai_link->num_platforms
If so, we can use component pointer array instead of list_head,
in such case, code can be more simple.
This patch removes struct snd_soc_rtdcom_list that is only
of temporary value, and convert to pointer array.
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Reviewed-By: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Link: https://lore.kernel.org/r/87a76wt4wm.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-01-10 10:35:21 +08:00
|
|
|
for_each_rtd_components(rtd, i, component) {
|
ASoC: soc-core: merge snd_pcm_ops member to component driver
Current snd_soc_component_driver has snd_pcm_ops, and each driver can
have callback via it (1).
But, it is mainly created for ALSA, thus, it doesn't have "component"
as parameter for ALSA SoC (1)(2).
Thus, each callback can't know it is called for which component.
Thus, each callback currently is getting "component" by using
snd_soc_rtdcom_lookup() with driver name (3).
--- ALSA SoC ---
...
if (component->driver->ops &&
component->driver->ops->open)
(1) return component->driver->ops->open(substream);
...
--- driver ---
(2) static int xxx_open(struct snd_pcm_substream *substream)
{
struct snd_soc_pcm_runtime *rtd = substream->private_data;
(3) struct snd_soc_component *component = snd_soc_rtdcom_lookup(..);
...
}
It works today, but, will not work in the future if we support multi
CPU/Codec/Platform, because 1 rtd might have multiple components which
have same driver name.
To solve this issue, each callback needs to be called with component.
We already have many component driver callback.
This patch copies each snd_pcm_ops member under component driver,
and having "component" as parameter.
--- ALSA SoC ---
...
if (component->driver->open)
=> return component->driver->open(component, substream);
...
--- driver ---
=> static int xxx_open(struct snd_soc_component *component,
struct snd_pcm_substream *substream)
{
...
}
*Note*
Only Intel skl-pcm has .get_time_info implementation, but ALSA SoC
framework doesn't call it so far.
To keep its implementation, this patch keeps .get_time_info,
but it is still not called.
Intel guy need to support it in the future.
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87tv8raf3r.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2019-10-02 13:30:48 +08:00
|
|
|
if (component->driver->page) {
|
|
|
|
page = component->driver->page(component,
|
|
|
|
substream, offset);
|
|
|
|
if (page)
|
|
|
|
return page;
|
|
|
|
}
|
2019-07-26 12:52:00 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
2019-07-26 12:52:04 +08:00
|
|
|
|
|
|
|
int snd_soc_pcm_component_mmap(struct snd_pcm_substream *substream,
|
|
|
|
struct vm_area_struct *vma)
|
|
|
|
{
|
2020-07-20 09:17:39 +08:00
|
|
|
struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream);
|
2019-07-26 12:52:04 +08:00
|
|
|
struct snd_soc_component *component;
|
ASoC: soc-core: remove snd_soc_rtdcom_list
Current ALSA SoC is using struct snd_soc_rtdcom_list to
connecting component to rtd by using list_head.
struct snd_soc_rtdcom_list {
struct snd_soc_component *component;
struct list_head list; /* rtd::component_list */
};
struct snd_soc_pcm_runtime {
...
struct list_head component_list; /* list of connected components */
...
};
The CPU/Codec/Platform component which will be connected to rtd (a)
is indicated via dai_link at snd_soc_add_pcm_runtime()
int snd_soc_add_pcm_runtime(...)
{
...
/* Find CPU from registered CPUs */
rtd->cpu_dai = snd_soc_find_dai(dai_link->cpus);
...
(a) snd_soc_rtdcom_add(rtd, rtd->cpu_dai->component);
...
/* Find CODEC from registered CODECs */
(b) for_each_link_codecs(dai_link, i, codec) {
rtd->codec_dais[i] = snd_soc_find_dai(codec);
...
(a) snd_soc_rtdcom_add(rtd, rtd->codec_dais[i]->component);
}
...
/* Find PLATFORM from registered PLATFORMs */
(b) for_each_link_platforms(dai_link, i, platform) {
for_each_component(component) {
...
(a) snd_soc_rtdcom_add(rtd, component);
}
}
}
It shows, it is possible to know how many components will be
connected to rtd by using
dai_link->num_cpus
dai_link->num_codecs
dai_link->num_platforms
If so, we can use component pointer array instead of list_head,
in such case, code can be more simple.
This patch removes struct snd_soc_rtdcom_list that is only
of temporary value, and convert to pointer array.
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Reviewed-By: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Link: https://lore.kernel.org/r/87a76wt4wm.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-01-10 10:35:21 +08:00
|
|
|
int i;
|
2019-07-26 12:52:04 +08:00
|
|
|
|
ASoC: soc-core: add for_each_rtd_components() and replace
ALSA SoC has for_each_rtdcom() which is link list for
rtd-component which is called as rtdcom. The relationship image is like below
rtdcom rtdcom rtdcom
component component component
rtd->component_list -> list -> list -> list ...
Here, the pointer get via normal link list is rtdcom,
Thus, current for_each loop is like below, and need to get
component via rtdcom->component
for_each_rtdcom(rtd, rtdcom) {
component = rtdcom->component;
...
}
but usually, user want to get pointer from for_each_xxx is component
directly, like below.
for_each_rtd_component(rtd, rtdcom, component) {
...
}
This patch expands list_for_each_entry manually, and enable to get
component directly from for_each macro.
Because of it, the macro becoming difficult to read,
but macro itself becoming useful.
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/878spm64m4.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2019-10-15 11:59:31 +08:00
|
|
|
/* FIXME. it returns 1st mmap now */
|
ASoC: soc-core: remove snd_soc_rtdcom_list
Current ALSA SoC is using struct snd_soc_rtdcom_list to
connecting component to rtd by using list_head.
struct snd_soc_rtdcom_list {
struct snd_soc_component *component;
struct list_head list; /* rtd::component_list */
};
struct snd_soc_pcm_runtime {
...
struct list_head component_list; /* list of connected components */
...
};
The CPU/Codec/Platform component which will be connected to rtd (a)
is indicated via dai_link at snd_soc_add_pcm_runtime()
int snd_soc_add_pcm_runtime(...)
{
...
/* Find CPU from registered CPUs */
rtd->cpu_dai = snd_soc_find_dai(dai_link->cpus);
...
(a) snd_soc_rtdcom_add(rtd, rtd->cpu_dai->component);
...
/* Find CODEC from registered CODECs */
(b) for_each_link_codecs(dai_link, i, codec) {
rtd->codec_dais[i] = snd_soc_find_dai(codec);
...
(a) snd_soc_rtdcom_add(rtd, rtd->codec_dais[i]->component);
}
...
/* Find PLATFORM from registered PLATFORMs */
(b) for_each_link_platforms(dai_link, i, platform) {
for_each_component(component) {
...
(a) snd_soc_rtdcom_add(rtd, component);
}
}
}
It shows, it is possible to know how many components will be
connected to rtd by using
dai_link->num_cpus
dai_link->num_codecs
dai_link->num_platforms
If so, we can use component pointer array instead of list_head,
in such case, code can be more simple.
This patch removes struct snd_soc_rtdcom_list that is only
of temporary value, and convert to pointer array.
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Reviewed-By: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Link: https://lore.kernel.org/r/87a76wt4wm.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-01-10 10:35:21 +08:00
|
|
|
for_each_rtd_components(rtd, i, component)
|
ASoC: soc-core: merge snd_pcm_ops member to component driver
Current snd_soc_component_driver has snd_pcm_ops, and each driver can
have callback via it (1).
But, it is mainly created for ALSA, thus, it doesn't have "component"
as parameter for ALSA SoC (1)(2).
Thus, each callback can't know it is called for which component.
Thus, each callback currently is getting "component" by using
snd_soc_rtdcom_lookup() with driver name (3).
--- ALSA SoC ---
...
if (component->driver->ops &&
component->driver->ops->open)
(1) return component->driver->ops->open(substream);
...
--- driver ---
(2) static int xxx_open(struct snd_pcm_substream *substream)
{
struct snd_soc_pcm_runtime *rtd = substream->private_data;
(3) struct snd_soc_component *component = snd_soc_rtdcom_lookup(..);
...
}
It works today, but, will not work in the future if we support multi
CPU/Codec/Platform, because 1 rtd might have multiple components which
have same driver name.
To solve this issue, each callback needs to be called with component.
We already have many component driver callback.
This patch copies each snd_pcm_ops member under component driver,
and having "component" as parameter.
--- ALSA SoC ---
...
if (component->driver->open)
=> return component->driver->open(component, substream);
...
--- driver ---
=> static int xxx_open(struct snd_soc_component *component,
struct snd_pcm_substream *substream)
{
...
}
*Note*
Only Intel skl-pcm has .get_time_info implementation, but ALSA SoC
framework doesn't call it so far.
To keep its implementation, this patch keeps .get_time_info,
but it is still not called.
Intel guy need to support it in the future.
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87tv8raf3r.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2019-10-02 13:30:48 +08:00
|
|
|
if (component->driver->mmap)
|
2020-07-16 13:07:08 +08:00
|
|
|
return soc_component_ret(
|
2020-06-04 16:06:41 +08:00
|
|
|
component,
|
|
|
|
component->driver->mmap(component,
|
|
|
|
substream, vma));
|
2019-07-26 12:52:04 +08:00
|
|
|
|
|
|
|
return -EINVAL;
|
|
|
|
}
|
2019-07-26 12:52:08 +08:00
|
|
|
|
2019-11-18 09:50:32 +08:00
|
|
|
int snd_soc_pcm_component_new(struct snd_soc_pcm_runtime *rtd)
|
2019-07-26 12:52:08 +08:00
|
|
|
{
|
|
|
|
struct snd_soc_component *component;
|
|
|
|
int ret;
|
ASoC: soc-core: remove snd_soc_rtdcom_list
Current ALSA SoC is using struct snd_soc_rtdcom_list to
connecting component to rtd by using list_head.
struct snd_soc_rtdcom_list {
struct snd_soc_component *component;
struct list_head list; /* rtd::component_list */
};
struct snd_soc_pcm_runtime {
...
struct list_head component_list; /* list of connected components */
...
};
The CPU/Codec/Platform component which will be connected to rtd (a)
is indicated via dai_link at snd_soc_add_pcm_runtime()
int snd_soc_add_pcm_runtime(...)
{
...
/* Find CPU from registered CPUs */
rtd->cpu_dai = snd_soc_find_dai(dai_link->cpus);
...
(a) snd_soc_rtdcom_add(rtd, rtd->cpu_dai->component);
...
/* Find CODEC from registered CODECs */
(b) for_each_link_codecs(dai_link, i, codec) {
rtd->codec_dais[i] = snd_soc_find_dai(codec);
...
(a) snd_soc_rtdcom_add(rtd, rtd->codec_dais[i]->component);
}
...
/* Find PLATFORM from registered PLATFORMs */
(b) for_each_link_platforms(dai_link, i, platform) {
for_each_component(component) {
...
(a) snd_soc_rtdcom_add(rtd, component);
}
}
}
It shows, it is possible to know how many components will be
connected to rtd by using
dai_link->num_cpus
dai_link->num_codecs
dai_link->num_platforms
If so, we can use component pointer array instead of list_head,
in such case, code can be more simple.
This patch removes struct snd_soc_rtdcom_list that is only
of temporary value, and convert to pointer array.
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Reviewed-By: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Link: https://lore.kernel.org/r/87a76wt4wm.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-01-10 10:35:21 +08:00
|
|
|
int i;
|
2019-07-26 12:52:08 +08:00
|
|
|
|
ASoC: soc-core: remove snd_soc_rtdcom_list
Current ALSA SoC is using struct snd_soc_rtdcom_list to
connecting component to rtd by using list_head.
struct snd_soc_rtdcom_list {
struct snd_soc_component *component;
struct list_head list; /* rtd::component_list */
};
struct snd_soc_pcm_runtime {
...
struct list_head component_list; /* list of connected components */
...
};
The CPU/Codec/Platform component which will be connected to rtd (a)
is indicated via dai_link at snd_soc_add_pcm_runtime()
int snd_soc_add_pcm_runtime(...)
{
...
/* Find CPU from registered CPUs */
rtd->cpu_dai = snd_soc_find_dai(dai_link->cpus);
...
(a) snd_soc_rtdcom_add(rtd, rtd->cpu_dai->component);
...
/* Find CODEC from registered CODECs */
(b) for_each_link_codecs(dai_link, i, codec) {
rtd->codec_dais[i] = snd_soc_find_dai(codec);
...
(a) snd_soc_rtdcom_add(rtd, rtd->codec_dais[i]->component);
}
...
/* Find PLATFORM from registered PLATFORMs */
(b) for_each_link_platforms(dai_link, i, platform) {
for_each_component(component) {
...
(a) snd_soc_rtdcom_add(rtd, component);
}
}
}
It shows, it is possible to know how many components will be
connected to rtd by using
dai_link->num_cpus
dai_link->num_codecs
dai_link->num_platforms
If so, we can use component pointer array instead of list_head,
in such case, code can be more simple.
This patch removes struct snd_soc_rtdcom_list that is only
of temporary value, and convert to pointer array.
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Reviewed-By: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Link: https://lore.kernel.org/r/87a76wt4wm.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-01-10 10:35:21 +08:00
|
|
|
for_each_rtd_components(rtd, i, component) {
|
2019-10-02 13:30:59 +08:00
|
|
|
if (component->driver->pcm_construct) {
|
|
|
|
ret = component->driver->pcm_construct(component, rtd);
|
|
|
|
if (ret < 0)
|
2020-07-16 13:07:08 +08:00
|
|
|
return soc_component_ret(component, ret);
|
2019-10-02 13:30:59 +08:00
|
|
|
}
|
2019-07-26 12:52:08 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
2019-07-26 12:52:12 +08:00
|
|
|
|
2019-11-18 09:50:32 +08:00
|
|
|
void snd_soc_pcm_component_free(struct snd_soc_pcm_runtime *rtd)
|
2019-07-26 12:52:12 +08:00
|
|
|
{
|
|
|
|
struct snd_soc_component *component;
|
ASoC: soc-core: remove snd_soc_rtdcom_list
Current ALSA SoC is using struct snd_soc_rtdcom_list to
connecting component to rtd by using list_head.
struct snd_soc_rtdcom_list {
struct snd_soc_component *component;
struct list_head list; /* rtd::component_list */
};
struct snd_soc_pcm_runtime {
...
struct list_head component_list; /* list of connected components */
...
};
The CPU/Codec/Platform component which will be connected to rtd (a)
is indicated via dai_link at snd_soc_add_pcm_runtime()
int snd_soc_add_pcm_runtime(...)
{
...
/* Find CPU from registered CPUs */
rtd->cpu_dai = snd_soc_find_dai(dai_link->cpus);
...
(a) snd_soc_rtdcom_add(rtd, rtd->cpu_dai->component);
...
/* Find CODEC from registered CODECs */
(b) for_each_link_codecs(dai_link, i, codec) {
rtd->codec_dais[i] = snd_soc_find_dai(codec);
...
(a) snd_soc_rtdcom_add(rtd, rtd->codec_dais[i]->component);
}
...
/* Find PLATFORM from registered PLATFORMs */
(b) for_each_link_platforms(dai_link, i, platform) {
for_each_component(component) {
...
(a) snd_soc_rtdcom_add(rtd, component);
}
}
}
It shows, it is possible to know how many components will be
connected to rtd by using
dai_link->num_cpus
dai_link->num_codecs
dai_link->num_platforms
If so, we can use component pointer array instead of list_head,
in such case, code can be more simple.
This patch removes struct snd_soc_rtdcom_list that is only
of temporary value, and convert to pointer array.
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Reviewed-By: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Link: https://lore.kernel.org/r/87a76wt4wm.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-01-10 10:35:21 +08:00
|
|
|
int i;
|
2019-07-26 12:52:12 +08:00
|
|
|
|
2020-01-07 15:09:56 +08:00
|
|
|
if (!rtd->pcm)
|
|
|
|
return;
|
|
|
|
|
ASoC: soc-core: remove snd_soc_rtdcom_list
Current ALSA SoC is using struct snd_soc_rtdcom_list to
connecting component to rtd by using list_head.
struct snd_soc_rtdcom_list {
struct snd_soc_component *component;
struct list_head list; /* rtd::component_list */
};
struct snd_soc_pcm_runtime {
...
struct list_head component_list; /* list of connected components */
...
};
The CPU/Codec/Platform component which will be connected to rtd (a)
is indicated via dai_link at snd_soc_add_pcm_runtime()
int snd_soc_add_pcm_runtime(...)
{
...
/* Find CPU from registered CPUs */
rtd->cpu_dai = snd_soc_find_dai(dai_link->cpus);
...
(a) snd_soc_rtdcom_add(rtd, rtd->cpu_dai->component);
...
/* Find CODEC from registered CODECs */
(b) for_each_link_codecs(dai_link, i, codec) {
rtd->codec_dais[i] = snd_soc_find_dai(codec);
...
(a) snd_soc_rtdcom_add(rtd, rtd->codec_dais[i]->component);
}
...
/* Find PLATFORM from registered PLATFORMs */
(b) for_each_link_platforms(dai_link, i, platform) {
for_each_component(component) {
...
(a) snd_soc_rtdcom_add(rtd, component);
}
}
}
It shows, it is possible to know how many components will be
connected to rtd by using
dai_link->num_cpus
dai_link->num_codecs
dai_link->num_platforms
If so, we can use component pointer array instead of list_head,
in such case, code can be more simple.
This patch removes struct snd_soc_rtdcom_list that is only
of temporary value, and convert to pointer array.
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Reviewed-By: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Link: https://lore.kernel.org/r/87a76wt4wm.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-01-10 10:35:21 +08:00
|
|
|
for_each_rtd_components(rtd, i, component)
|
2019-10-02 13:30:59 +08:00
|
|
|
if (component->driver->pcm_destruct)
|
2019-11-18 09:50:32 +08:00
|
|
|
component->driver->pcm_destruct(component, rtd->pcm);
|
2019-07-26 12:52:12 +08:00
|
|
|
}
|
2020-06-04 16:06:58 +08:00
|
|
|
|
|
|
|
int snd_soc_pcm_component_prepare(struct snd_pcm_substream *substream)
|
|
|
|
{
|
2020-07-20 09:17:39 +08:00
|
|
|
struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream);
|
2020-06-04 16:06:58 +08:00
|
|
|
struct snd_soc_component *component;
|
|
|
|
int i, ret;
|
|
|
|
|
|
|
|
for_each_rtd_components(rtd, i, component) {
|
|
|
|
if (component->driver->prepare) {
|
|
|
|
ret = component->driver->prepare(component, substream);
|
|
|
|
if (ret < 0)
|
|
|
|
return soc_component_ret(component, ret);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
2020-06-04 16:07:11 +08:00
|
|
|
|
|
|
|
int snd_soc_pcm_component_hw_params(struct snd_pcm_substream *substream,
|
ASoC: soc-component: add mark for snd_soc_pcm_component_hw_params/free()
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: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87k0wdgqav.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-09-29 12:31:41 +08:00
|
|
|
struct snd_pcm_hw_params *params)
|
2020-06-04 16:07:11 +08:00
|
|
|
{
|
2020-07-20 09:17:39 +08:00
|
|
|
struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream);
|
2020-06-04 16:07:11 +08:00
|
|
|
struct snd_soc_component *component;
|
|
|
|
int i, ret;
|
|
|
|
|
|
|
|
for_each_rtd_components(rtd, i, component) {
|
|
|
|
if (component->driver->hw_params) {
|
|
|
|
ret = component->driver->hw_params(component,
|
|
|
|
substream, params);
|
ASoC: soc-component: add mark for snd_soc_pcm_component_hw_params/free()
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: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87k0wdgqav.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-09-29 12:31:41 +08:00
|
|
|
if (ret < 0)
|
2020-06-04 16:07:11 +08:00
|
|
|
return soc_component_ret(component, ret);
|
|
|
|
}
|
ASoC: soc-component: add mark for snd_soc_pcm_component_hw_params/free()
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: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87k0wdgqav.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-09-29 12:31:41 +08:00
|
|
|
/* mark substream if succeeded */
|
|
|
|
soc_component_mark_push(component, substream, hw_params);
|
2020-06-04 16:07:11 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
2020-06-04 16:07:24 +08:00
|
|
|
|
|
|
|
void snd_soc_pcm_component_hw_free(struct snd_pcm_substream *substream,
|
ASoC: soc-component: add mark for snd_soc_pcm_component_hw_params/free()
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: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87k0wdgqav.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-09-29 12:31:41 +08:00
|
|
|
int rollback)
|
2020-06-04 16:07:24 +08:00
|
|
|
{
|
2020-07-20 09:17:39 +08:00
|
|
|
struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream);
|
2020-06-04 16:07:24 +08:00
|
|
|
struct snd_soc_component *component;
|
|
|
|
int i, ret;
|
|
|
|
|
|
|
|
for_each_rtd_components(rtd, i, component) {
|
ASoC: soc-component: add mark for snd_soc_pcm_component_hw_params/free()
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: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87k0wdgqav.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-09-29 12:31:41 +08:00
|
|
|
if (rollback && !soc_component_mark_match(component, substream, hw_params))
|
|
|
|
continue;
|
2020-06-04 16:07:24 +08:00
|
|
|
|
|
|
|
if (component->driver->hw_free) {
|
|
|
|
ret = component->driver->hw_free(component, substream);
|
|
|
|
if (ret < 0)
|
|
|
|
soc_component_ret(component, ret);
|
|
|
|
}
|
ASoC: soc-component: add mark for snd_soc_pcm_component_hw_params/free()
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: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87k0wdgqav.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-09-29 12:31:41 +08:00
|
|
|
|
|
|
|
/* remove marked substream */
|
|
|
|
soc_component_mark_pop(component, substream, hw_params);
|
2020-06-04 16:07:24 +08:00
|
|
|
}
|
|
|
|
}
|
2020-06-04 16:07:40 +08:00
|
|
|
|
|
|
|
int snd_soc_pcm_component_trigger(struct snd_pcm_substream *substream,
|
|
|
|
int cmd)
|
|
|
|
{
|
2020-07-20 09:17:39 +08:00
|
|
|
struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream);
|
2020-06-04 16:07:40 +08:00
|
|
|
struct snd_soc_component *component;
|
|
|
|
int i, ret;
|
|
|
|
|
|
|
|
for_each_rtd_components(rtd, i, component) {
|
|
|
|
if (component->driver->trigger) {
|
|
|
|
ret = component->driver->trigger(component, substream, cmd);
|
|
|
|
if (ret < 0)
|
|
|
|
return soc_component_ret(component, ret);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
ASoC: soc-component: add mark for snd_soc_pcm_component_pm_runtime_get/put()
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: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87h7ribwnb.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
2020-09-28 08:01:17 +08:00
|
|
|
|
|
|
|
int snd_soc_pcm_component_pm_runtime_get(struct snd_soc_pcm_runtime *rtd,
|
|
|
|
void *stream)
|
|
|
|
{
|
|
|
|
struct snd_soc_component *component;
|
|
|
|
int i, ret;
|
|
|
|
|
|
|
|
for_each_rtd_components(rtd, i, component) {
|
|
|
|
ret = pm_runtime_get_sync(component->dev);
|
|
|
|
if (ret < 0 && ret != -EACCES) {
|
|
|
|
pm_runtime_put_noidle(component->dev);
|
|
|
|
return soc_component_ret(component, ret);
|
|
|
|
}
|
|
|
|
/* mark stream if succeeded */
|
|
|
|
soc_component_mark_push(component, stream, pm);
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
void snd_soc_pcm_component_pm_runtime_put(struct snd_soc_pcm_runtime *rtd,
|
|
|
|
void *stream, int rollback)
|
|
|
|
{
|
|
|
|
struct snd_soc_component *component;
|
|
|
|
int i;
|
|
|
|
|
|
|
|
for_each_rtd_components(rtd, i, component) {
|
|
|
|
if (rollback && !soc_component_mark_match(component, stream, pm))
|
|
|
|
continue;
|
|
|
|
|
|
|
|
pm_runtime_mark_last_busy(component->dev);
|
|
|
|
pm_runtime_put_autosuspend(component->dev);
|
|
|
|
|
|
|
|
/* remove marked stream */
|
|
|
|
soc_component_mark_pop(component, stream, pm);
|
|
|
|
}
|
|
|
|
}
|