mirror of
git://git.yoctoproject.org/linux-yocto.git
synced 2025-10-23 07:23:12 +02:00
ASoC: soc-dai.h: merge DAI call back functions into ops
[ Upstream commit 3e8bcec078
]
snd_soc_dai_driver has .ops for call back functions (A), but it also
has other call back functions (B). It is duplicated and confusable.
struct snd_soc_dai_driver {
...
^ int (*probe)(...);
| int (*remove)(...);
(B) int (*compress_new)(...);
| int (*pcm_new)(...);
v ...
(A) const struct snd_soc_dai_ops *ops;
...
}
This patch merges (B) into (A).
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87v8dpb0w6.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Stable-dep-of: 0e270f32975f ("ASoC: fsl_sai: replace regmap_write with regmap_update_bits")
Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
4f60001afa
commit
780ce4759f
|
@ -266,6 +266,15 @@ int snd_soc_dai_compr_get_metadata(struct snd_soc_dai *dai,
|
||||||
struct snd_compr_metadata *metadata);
|
struct snd_compr_metadata *metadata);
|
||||||
|
|
||||||
struct snd_soc_dai_ops {
|
struct snd_soc_dai_ops {
|
||||||
|
/* DAI driver callbacks */
|
||||||
|
int (*probe)(struct snd_soc_dai *dai);
|
||||||
|
int (*remove)(struct snd_soc_dai *dai);
|
||||||
|
/* compress dai */
|
||||||
|
int (*compress_new)(struct snd_soc_pcm_runtime *rtd, int num);
|
||||||
|
/* Optional Callback used at pcm creation*/
|
||||||
|
int (*pcm_new)(struct snd_soc_pcm_runtime *rtd,
|
||||||
|
struct snd_soc_dai *dai);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* DAI clocking configuration, all optional.
|
* DAI clocking configuration, all optional.
|
||||||
* Called by soc_card drivers, normally in their hw_params.
|
* Called by soc_card drivers, normally in their hw_params.
|
||||||
|
@ -347,6 +356,10 @@ struct snd_soc_dai_ops {
|
||||||
u64 *auto_selectable_formats;
|
u64 *auto_selectable_formats;
|
||||||
int num_auto_selectable_formats;
|
int num_auto_selectable_formats;
|
||||||
|
|
||||||
|
/* probe ordering - for components with runtime dependencies */
|
||||||
|
int probe_order;
|
||||||
|
int remove_order;
|
||||||
|
|
||||||
/* bit field */
|
/* bit field */
|
||||||
unsigned int no_capture_mute:1;
|
unsigned int no_capture_mute:1;
|
||||||
};
|
};
|
||||||
|
|
|
@ -114,7 +114,7 @@ static bool soc_component_is_pcm(struct snd_soc_dai_link_component *dlc)
|
||||||
struct snd_soc_dai *dai = snd_soc_find_dai_with_mutex(dlc);
|
struct snd_soc_dai *dai = snd_soc_find_dai_with_mutex(dlc);
|
||||||
|
|
||||||
if (dai && (dai->component->driver->pcm_construct ||
|
if (dai && (dai->component->driver->pcm_construct ||
|
||||||
dai->driver->pcm_new))
|
(dai->driver->ops && dai->driver->ops->pcm_new)))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -2454,6 +2454,7 @@ struct snd_soc_dai *snd_soc_register_dai(struct snd_soc_component *component,
|
||||||
{
|
{
|
||||||
struct device *dev = component->dev;
|
struct device *dev = component->dev;
|
||||||
struct snd_soc_dai *dai;
|
struct snd_soc_dai *dai;
|
||||||
|
struct snd_soc_dai_ops *ops; /* REMOVE ME */
|
||||||
|
|
||||||
dev_dbg(dev, "ASoC: dynamically register DAI %s\n", dev_name(dev));
|
dev_dbg(dev, "ASoC: dynamically register DAI %s\n", dev_name(dev));
|
||||||
|
|
||||||
|
@ -2484,6 +2485,30 @@ struct snd_soc_dai *snd_soc_register_dai(struct snd_soc_component *component,
|
||||||
if (!dai->name)
|
if (!dai->name)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
|
/* REMOVE ME */
|
||||||
|
if (dai_drv->probe ||
|
||||||
|
dai_drv->remove ||
|
||||||
|
dai_drv->compress_new ||
|
||||||
|
dai_drv->pcm_new ||
|
||||||
|
dai_drv->probe_order ||
|
||||||
|
dai_drv->remove_order) {
|
||||||
|
|
||||||
|
ops = devm_kzalloc(dev, sizeof(struct snd_soc_dai_ops), GFP_KERNEL);
|
||||||
|
if (!ops)
|
||||||
|
return NULL;
|
||||||
|
if (dai_drv->ops)
|
||||||
|
memcpy(ops, dai_drv->ops, sizeof(struct snd_soc_dai_ops));
|
||||||
|
|
||||||
|
ops->probe = dai_drv->probe;
|
||||||
|
ops->remove = dai_drv->remove;
|
||||||
|
ops->compress_new = dai_drv->compress_new;
|
||||||
|
ops->pcm_new = dai_drv->pcm_new;
|
||||||
|
ops->probe_order = dai_drv->probe_order;
|
||||||
|
ops->remove_order = dai_drv->remove_order;
|
||||||
|
|
||||||
|
dai_drv->ops = ops;
|
||||||
|
}
|
||||||
|
|
||||||
dai->component = component;
|
dai->component = component;
|
||||||
dai->dev = dev;
|
dai->dev = dev;
|
||||||
dai->driver = dai_drv;
|
dai->driver = dai_drv;
|
||||||
|
|
|
@ -473,8 +473,9 @@ int snd_soc_dai_compress_new(struct snd_soc_dai *dai,
|
||||||
struct snd_soc_pcm_runtime *rtd, int num)
|
struct snd_soc_pcm_runtime *rtd, int num)
|
||||||
{
|
{
|
||||||
int ret = -ENOTSUPP;
|
int ret = -ENOTSUPP;
|
||||||
if (dai->driver->compress_new)
|
if (dai->driver->ops &&
|
||||||
ret = dai->driver->compress_new(rtd, num);
|
dai->driver->ops->compress_new)
|
||||||
|
ret = dai->driver->ops->compress_new(rtd, num);
|
||||||
return soc_dai_ret(dai, ret);
|
return soc_dai_ret(dai, ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -558,19 +559,20 @@ int snd_soc_pcm_dai_probe(struct snd_soc_pcm_runtime *rtd, int order)
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for_each_rtd_dais(rtd, i, dai) {
|
for_each_rtd_dais(rtd, i, dai) {
|
||||||
if (dai->driver->probe_order != order)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
if (dai->probed)
|
if (dai->probed)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (dai->driver->probe) {
|
if (dai->driver->ops) {
|
||||||
int ret = dai->driver->probe(dai);
|
if (dai->driver->ops->probe_order != order)
|
||||||
|
continue;
|
||||||
|
|
||||||
if (ret < 0)
|
if (dai->driver->ops->probe) {
|
||||||
return soc_dai_ret(dai, ret);
|
int ret = dai->driver->ops->probe(dai);
|
||||||
|
|
||||||
|
if (ret < 0)
|
||||||
|
return soc_dai_ret(dai, ret);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
dai->probed = 1;
|
dai->probed = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -583,16 +585,19 @@ int snd_soc_pcm_dai_remove(struct snd_soc_pcm_runtime *rtd, int order)
|
||||||
int i, r, ret = 0;
|
int i, r, ret = 0;
|
||||||
|
|
||||||
for_each_rtd_dais(rtd, i, dai) {
|
for_each_rtd_dais(rtd, i, dai) {
|
||||||
if (dai->driver->remove_order != order)
|
if (!dai->probed)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (dai->probed &&
|
if (dai->driver->ops) {
|
||||||
dai->driver->remove) {
|
if (dai->driver->ops->remove_order != order)
|
||||||
r = dai->driver->remove(dai);
|
continue;
|
||||||
if (r < 0)
|
|
||||||
ret = r; /* use last error */
|
|
||||||
}
|
|
||||||
|
|
||||||
|
if (dai->driver->ops->remove) {
|
||||||
|
r = dai->driver->ops->remove(dai);
|
||||||
|
if (r < 0)
|
||||||
|
ret = r; /* use last error */
|
||||||
|
}
|
||||||
|
}
|
||||||
dai->probed = 0;
|
dai->probed = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -605,8 +610,9 @@ int snd_soc_pcm_dai_new(struct snd_soc_pcm_runtime *rtd)
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for_each_rtd_dais(rtd, i, dai) {
|
for_each_rtd_dais(rtd, i, dai) {
|
||||||
if (dai->driver->pcm_new) {
|
if (dai->driver->ops &&
|
||||||
int ret = dai->driver->pcm_new(rtd, dai);
|
dai->driver->ops->pcm_new) {
|
||||||
|
int ret = dai->driver->ops->pcm_new(rtd, dai);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
return soc_dai_ret(dai, ret);
|
return soc_dai_ret(dai, ret);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user