[alsa-devel] [PATCH 0/5] ASoC: Trivial bits and cleanups
Hi,
This series contains a few cleanup patches that came up while working on the componentization, but all also make sense on their own.
The biggest change is admittedly the removal of the suspend/resume code from the atmel-pcm-pdc driver and may not seem trivial at first. But this code has been fully broken for over 4 years, was always partially broken and was never really needed in the first place. And right now it is blocking other cleanups.
Everything else is just removal of unused fields and the consolidation of duplicated fields.
Depends on: asoc/topic/component
- Lars
Lars-Peter Clausen (5): ASoC: Remove card's DAI list ASoC: Remove unused 'list' field form card ASoC: Remove unused num_dai field from CODEC ASoC: atmel-pcm-pdc: Remove broken suspend/resume code ASoC: Remove runtime field from DAI
include/sound/soc-dai.h | 2 -- include/sound/soc.h | 4 --- sound/soc/atmel/atmel-pcm-pdc.c | 63 ----------------------------------------- sound/soc/soc-compress.c | 1 - sound/soc/soc-core.c | 7 ----- sound/soc/soc-pcm.c | 1 - 6 files changed, 78 deletions(-)
Commit f0fba2ad1 ("ASoC: multi-component - ASoC Multi-Component Support") added a per card list that keeps track of all the DAIs that have been registered with the card, but the list has never been used. This patch removes it again.
Signed-off-by: Lars-Peter Clausen lars@metafoo.de --- include/sound/soc-dai.h | 1 - include/sound/soc.h | 2 -- sound/soc/soc-core.c | 5 ----- 3 files changed, 8 deletions(-)
diff --git a/include/sound/soc-dai.h b/include/sound/soc-dai.h index fad7676..e2c3e45 100644 --- a/include/sound/soc-dai.h +++ b/include/sound/soc-dai.h @@ -277,7 +277,6 @@ struct snd_soc_dai { struct snd_soc_card *card;
struct list_head list; - struct list_head card_list; };
static inline void *snd_soc_dai_get_dma_data(const struct snd_soc_dai *dai, diff --git a/include/sound/soc.h b/include/sound/soc.h index c0b65fc..30c068f 100644 --- a/include/sound/soc.h +++ b/include/sound/soc.h @@ -1012,7 +1012,6 @@ struct snd_soc_card { /* lists of probed devices belonging to this card */ struct list_head codec_dev_list; struct list_head platform_dev_list; - struct list_head dai_dev_list;
struct list_head widgets; struct list_head paths; @@ -1194,7 +1193,6 @@ static inline void *snd_soc_pcm_get_drvdata(struct snd_soc_pcm_runtime *rtd)
static inline void snd_soc_initialize_card_lists(struct snd_soc_card *card) { - INIT_LIST_HEAD(&card->dai_dev_list); INIT_LIST_HEAD(&card->codec_dev_list); INIT_LIST_HEAD(&card->platform_dev_list); INIT_LIST_HEAD(&card->widgets); diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c index 4a381b3..24c1fc2 100644 --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c @@ -1017,7 +1017,6 @@ static void soc_remove_codec_dai(struct snd_soc_dai *codec_dai, int order) codec_dai->name, err); } codec_dai->probed = 0; - list_del(&codec_dai->card_list); } }
@@ -1049,7 +1048,6 @@ static void soc_remove_link_dais(struct snd_soc_card *card, int num, int order) cpu_dai->name, err); } cpu_dai->probed = 0; - list_del(&cpu_dai->card_list);
if (!cpu_dai->codec) { snd_soc_dapm_free(&cpu_dai->dapm); @@ -1405,7 +1403,6 @@ static int soc_probe_codec_dai(struct snd_soc_card *card,
/* mark codec_dai as probed and add to card dai list */ codec_dai->probed = 1; - list_add(&codec_dai->card_list, &card->dai_dev_list); }
return 0; @@ -1490,8 +1487,6 @@ static int soc_probe_link_dais(struct snd_soc_card *card, int num, int order) } } cpu_dai->probed = 1; - /* mark cpu_dai as probed and add to card dai list */ - list_add(&cpu_dai->card_list, &card->dai_dev_list); }
/* probe the CODEC DAI */
On Tue, May 06, 2014 at 09:39:37AM +0200, Lars-Peter Clausen wrote:
Commit f0fba2ad1 ("ASoC: multi-component - ASoC Multi-Component Support") added a per card list that keeps track of all the DAIs that have been registered with the card, but the list has never been used. This patch removes it again.
Applied, thanks.
The global card list was removed in commit b19e6e7b7 ("ASoC: core: Use driver core probe deferral"). The 'list' field of the snd_soc_card struct has been unused since then. This patch removes the field.
Signed-off-by: Lars-Peter Clausen lars@metafoo.de --- include/sound/soc.h | 1 - sound/soc/soc-core.c | 1 - 2 files changed, 2 deletions(-)
diff --git a/include/sound/soc.h b/include/sound/soc.h index 30c068f..5603020 100644 --- a/include/sound/soc.h +++ b/include/sound/soc.h @@ -949,7 +949,6 @@ struct snd_soc_card { struct snd_card *snd_card; struct module *owner;
- struct list_head list; struct mutex mutex; struct mutex dapm_mutex;
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c index 24c1fc2..cc62526 100644 --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c @@ -3733,7 +3733,6 @@ int snd_soc_register_card(struct snd_soc_card *card) for (i = 0; i < card->num_links; i++) card->rtd[i].dai_link = &card->dai_link[i];
- INIT_LIST_HEAD(&card->list); INIT_LIST_HEAD(&card->dapm_dirty); card->instantiated = 0; mutex_init(&card->mutex);
On Tue, May 06, 2014 at 09:39:38AM +0200, Lars-Peter Clausen wrote:
The global card list was removed in commit b19e6e7b7 ("ASoC: core: Use driver core probe deferral"). The 'list' field of the snd_soc_card struct has been unused since then. This patch removes the field.
Applied, thanks.
Commit d191bd8de8 ("ASoC: snd_soc_codec includes snd_soc_component") removed the last user of the num_dai field. Also remove the field itself.
Signed-off-by: Lars-Peter Clausen lars@metafoo.de --- include/sound/soc.h | 1 - sound/soc/soc-core.c | 1 - 2 files changed, 2 deletions(-)
diff --git a/include/sound/soc.h b/include/sound/soc.h index 5603020..f046dcf 100644 --- a/include/sound/soc.h +++ b/include/sound/soc.h @@ -692,7 +692,6 @@ struct snd_soc_codec { struct snd_soc_card *card; struct list_head list; struct list_head card_list; - int num_dai;
/* runtime */ struct snd_ac97 *ac97; /* for ad-hoc ac97 devices */ diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c index cc62526..f32b3f2 100644 --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c @@ -4265,7 +4265,6 @@ int snd_soc_register_codec(struct device *dev, codec->dapm.stream_event = codec_drv->stream_event; codec->dev = dev; codec->driver = codec_drv; - codec->num_dai = num_dai; codec->component.val_bytes = codec_drv->reg_word_size; mutex_init(&codec->mutex);
On Tue, May 06, 2014 at 09:39:39AM +0200, Lars-Peter Clausen wrote:
Commit d191bd8de8 ("ASoC: snd_soc_codec includes snd_soc_component") removed the last user of the num_dai field. Also remove the field itself.
Applied, thanks.
Suspend/resume support for the atmel-pcm-pdc driver was broken in commit f0fba2ad1 ("ASoC: multi-component - ASoC Multi-Component Support"). It essentially reverted the modifications done in commit 10cab262 ("ASoC: Change how suspend and resume obtain the PCM runtime"). The suspend and resume handlers at the beginning check if dai->runtime is not NULL, but dai->runtime is always NULL, hence the code never runs. Considering that nobody noticed any problems in the last 4 years since the code was broken and that the driver does not set SNDRV_PCM_INFO_RESUME, which means applications are expected to stop and restart the audio stream during suspend/resume, it is probably safe to assume that his code is not needed and can be removed.
Signed-off-by: Lars-Peter Clausen lars@metafoo.de --- Even before this was fully broken, the code was already partially broken since it did only save/restore the playback registers, but not the capture registers, so fixing this basically requires a rewrite. And since SNDRV_PCM_INFO_RESUME was never set it's not clear if even playback suspend/resume ever worked correctly. Given this I think it's better just remove the code rather than trying to fix and risking breaking things even more. --- sound/soc/atmel/atmel-pcm-pdc.c | 63 ----------------------------------------- 1 file changed, 63 deletions(-)
diff --git a/sound/soc/atmel/atmel-pcm-pdc.c b/sound/soc/atmel/atmel-pcm-pdc.c index 33ec592..a366b35 100644 --- a/sound/soc/atmel/atmel-pcm-pdc.c +++ b/sound/soc/atmel/atmel-pcm-pdc.c @@ -76,12 +76,6 @@ struct atmel_runtime_data { size_t period_size;
dma_addr_t period_ptr; /* physical address of next period */ - - /* PDC register save */ - u32 pdc_xpr_save; - u32 pdc_xcr_save; - u32 pdc_xnpr_save; - u32 pdc_xncr_save; };
/*--------------------------------------------------------------------------*\ @@ -320,67 +314,10 @@ static struct snd_pcm_ops atmel_pcm_ops = { .mmap = atmel_pcm_mmap, };
- -/*--------------------------------------------------------------------------*\ - * ASoC platform driver -*--------------------------------------------------------------------------*/ -#ifdef CONFIG_PM -static int atmel_pcm_suspend(struct snd_soc_dai *dai) -{ - struct snd_pcm_runtime *runtime = dai->runtime; - struct atmel_runtime_data *prtd; - struct atmel_pcm_dma_params *params; - - if (!runtime) - return 0; - - prtd = runtime->private_data; - params = prtd->params; - - /* disable the PDC and save the PDC registers */ - - ssc_writel(params->ssc->regs, PDC_PTCR, params->mask->pdc_disable); - - prtd->pdc_xpr_save = ssc_readx(params->ssc->regs, params->pdc->xpr); - prtd->pdc_xcr_save = ssc_readx(params->ssc->regs, params->pdc->xcr); - prtd->pdc_xnpr_save = ssc_readx(params->ssc->regs, params->pdc->xnpr); - prtd->pdc_xncr_save = ssc_readx(params->ssc->regs, params->pdc->xncr); - - return 0; -} - -static int atmel_pcm_resume(struct snd_soc_dai *dai) -{ - struct snd_pcm_runtime *runtime = dai->runtime; - struct atmel_runtime_data *prtd; - struct atmel_pcm_dma_params *params; - - if (!runtime) - return 0; - - prtd = runtime->private_data; - params = prtd->params; - - /* restore the PDC registers and enable the PDC */ - ssc_writex(params->ssc->regs, params->pdc->xpr, prtd->pdc_xpr_save); - ssc_writex(params->ssc->regs, params->pdc->xcr, prtd->pdc_xcr_save); - ssc_writex(params->ssc->regs, params->pdc->xnpr, prtd->pdc_xnpr_save); - ssc_writex(params->ssc->regs, params->pdc->xncr, prtd->pdc_xncr_save); - - ssc_writel(params->ssc->regs, PDC_PTCR, params->mask->pdc_enable); - return 0; -} -#else -#define atmel_pcm_suspend NULL -#define atmel_pcm_resume NULL -#endif - static struct snd_soc_platform_driver atmel_soc_platform = { .ops = &atmel_pcm_ops, .pcm_new = atmel_pcm_new, .pcm_free = atmel_pcm_free, - .suspend = atmel_pcm_suspend, - .resume = atmel_pcm_resume, };
int atmel_pcm_pdc_platform_register(struct device *dev)
On Tue, May 06, 2014 at 09:39:40AM +0200, Lars-Peter Clausen wrote:
Suspend/resume support for the atmel-pcm-pdc driver was broken in commit f0fba2ad1 ("ASoC: multi-component - ASoC Multi-Component Support"). It essentially reverted the modifications done in commit 10cab262 ("ASoC: Change
Applied, thanks.
This was initially removed in commit 6423c1875 ("ASoC: Remove runtime field from DAI"), but was, presumably by accident, brought back in commit f0fba2ad1 ("ASoC: multi-component - ASoC Multi-Component Support"). But has never been initialized to anything but NULL ever since. This commit removes it again.
Signed-off-by: Lars-Peter Clausen lars@metafoo.de --- include/sound/soc-dai.h | 1 - sound/soc/soc-compress.c | 1 - sound/soc/soc-pcm.c | 1 - 3 files changed, 3 deletions(-)
diff --git a/include/sound/soc-dai.h b/include/sound/soc-dai.h index e2c3e45..688f2ba 100644 --- a/include/sound/soc-dai.h +++ b/include/sound/soc-dai.h @@ -252,7 +252,6 @@ struct snd_soc_dai { unsigned int symmetric_rates:1; unsigned int symmetric_channels:1; unsigned int symmetric_samplebits:1; - struct snd_pcm_runtime *runtime; unsigned int active; unsigned char probed:1;
diff --git a/sound/soc/soc-compress.c b/sound/soc/soc-compress.c index 91083e6..5320e86 100644 --- a/sound/soc/soc-compress.c +++ b/sound/soc/soc-compress.c @@ -203,7 +203,6 @@ static int soc_compr_free(struct snd_compr_stream *cstream)
if (platform->driver->compr_ops && platform->driver->compr_ops->free) platform->driver->compr_ops->free(cstream); - cpu_dai->runtime = NULL;
if (cstream->direction == SND_COMPRESS_PLAYBACK) { if (snd_soc_runtime_ignore_pmdown_time(rtd)) { diff --git a/sound/soc/soc-pcm.c b/sound/soc/soc-pcm.c index 2cedf09..cc00252 100644 --- a/sound/soc/soc-pcm.c +++ b/sound/soc/soc-pcm.c @@ -555,7 +555,6 @@ static int soc_pcm_close(struct snd_pcm_substream *substream)
if (platform->driver->ops && platform->driver->ops->close) platform->driver->ops->close(substream); - cpu_dai->runtime = NULL;
if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { if (snd_soc_runtime_ignore_pmdown_time(rtd)) {
On Tue, May 06, 2014 at 09:39:41AM +0200, Lars-Peter Clausen wrote:
This was initially removed in commit 6423c1875 ("ASoC: Remove runtime field from DAI"), but was, presumably by accident, brought back in commit f0fba2ad1 ("ASoC: multi-component - ASoC Multi-Component Support"). But has never been initialized to anything but NULL ever since. This commit removes it again.
Applied, thanks.
participants (2)
-
Lars-Peter Clausen
-
Mark Brown