ASoC: dmaengine_pcm: Allow passing component name via config
Merge series from Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>: At the moment we cannot instantiate two dmaengine_pcms with the same parent device, as the components will be named the same, leading to conflicts. Add 'name' field to the snd_dmaengine_pcm_config, and use that (if defined) as the component name instead of deriving the component name from the device.
This commit is contained in:
@ -118,6 +118,7 @@ int snd_dmaengine_pcm_refine_runtime_hwparams(
|
|||||||
* which do not use devicetree.
|
* which do not use devicetree.
|
||||||
* @process: Callback used to apply processing on samples transferred from/to
|
* @process: Callback used to apply processing on samples transferred from/to
|
||||||
* user space.
|
* user space.
|
||||||
|
* @name: Component name. If null, dev_name will be used.
|
||||||
* @compat_filter_fn: Will be used as the filter function when requesting a
|
* @compat_filter_fn: Will be used as the filter function when requesting a
|
||||||
* channel for platforms which do not use devicetree. The filter parameter
|
* channel for platforms which do not use devicetree. The filter parameter
|
||||||
* will be the DAI's DMA data.
|
* will be the DAI's DMA data.
|
||||||
@ -143,6 +144,7 @@ struct snd_dmaengine_pcm_config {
|
|||||||
int (*process)(struct snd_pcm_substream *substream,
|
int (*process)(struct snd_pcm_substream *substream,
|
||||||
int channel, unsigned long hwoff,
|
int channel, unsigned long hwoff,
|
||||||
unsigned long bytes);
|
unsigned long bytes);
|
||||||
|
const char *name;
|
||||||
dma_filter_fn compat_filter_fn;
|
dma_filter_fn compat_filter_fn;
|
||||||
struct device *dma_dev;
|
struct device *dma_dev;
|
||||||
const char *chan_names[SNDRV_PCM_STREAM_LAST + 1];
|
const char *chan_names[SNDRV_PCM_STREAM_LAST + 1];
|
||||||
|
@ -2796,11 +2796,13 @@ int snd_soc_component_initialize(struct snd_soc_component *component,
|
|||||||
INIT_LIST_HEAD(&component->list);
|
INIT_LIST_HEAD(&component->list);
|
||||||
mutex_init(&component->io_mutex);
|
mutex_init(&component->io_mutex);
|
||||||
|
|
||||||
|
if (!component->name) {
|
||||||
component->name = fmt_single_name(dev, &component->id);
|
component->name = fmt_single_name(dev, &component->id);
|
||||||
if (!component->name) {
|
if (!component->name) {
|
||||||
dev_err(dev, "ASoC: Failed to allocate name\n");
|
dev_err(dev, "ASoC: Failed to allocate name\n");
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
component->dev = dev;
|
component->dev = dev;
|
||||||
component->driver = driver;
|
component->driver = driver;
|
||||||
|
@ -441,6 +441,9 @@ int snd_dmaengine_pcm_register(struct device *dev,
|
|||||||
pcm->config = config;
|
pcm->config = config;
|
||||||
pcm->flags = flags;
|
pcm->flags = flags;
|
||||||
|
|
||||||
|
if (config->name)
|
||||||
|
pcm->component.name = config->name;
|
||||||
|
|
||||||
ret = dmaengine_pcm_request_chan_of(pcm, dev, config);
|
ret = dmaengine_pcm_request_chan_of(pcm, dev, config);
|
||||||
if (ret)
|
if (ret)
|
||||||
goto err_free_dma;
|
goto err_free_dma;
|
||||||
|
Reference in New Issue
Block a user