ASoC: Trivial bits and cleanups
Subsystems (5)
cover 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(-)
Signature · 1 line
1.8.0
PATCH 1/5 ASoC: Remove card's DAI list
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.
--- include/sound/soc-dai.h | 1 - include/sound/soc.h | 2 -- sound/soc/soc-core.c | 5 ----- 3 files changed, 8 deletions(-)
include/sound/soc-dai.h +0 -1
@@ -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,
include/sound/soc.h +0 -2
@@ -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);
sound/soc/soc-core.c +0 -5
@@ -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 */
Signature · 1 line
1.8.0
Re: [PATCH 1/5] ASoC: Remove card's DAI list
Quoted 3 lines · Lars-Peter Clausen
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.
PATCH 2/5 ASoC: Remove unused 'list' field form card
In reply to Lars-Peter ClausenThe 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.
--- include/sound/soc.h | 1 - sound/soc/soc-core.c | 1 - 2 files changed, 2 deletions(-)
include/sound/soc.h +0 -1
@@ -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;
sound/soc/soc-core.c +0 -1
@@ -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);
Signature · 1 line
1.8.0
Re: [PATCH 2/5] ASoC: Remove unused 'list' field form card
Quoted 3 lines · Lars-Peter Clausen
The global card list was removed in commit
b19e6e7b7("ASoC: core: Use driver core probe deferral"). The 'list' field of thesnd_soc_cardstruct has been unused since then. This patch removes the field.
Applied, thanks.
PATCH 3/5 ASoC: Remove unused num_dai field from CODEC
In reply to Lars-Peter ClausenCommit d191bd8de8 ("ASoC: snd_soc_codec includes snd_soc_component") removed the last user of the num_dai field. Also remove the field itself.
--- include/sound/soc.h | 1 - sound/soc/soc-core.c | 1 - 2 files changed, 2 deletions(-)
include/sound/soc.h +0 -1
@@ -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 */
sound/soc/soc-core.c +0 -1
@@ -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);
Signature · 1 line
1.8.0
Re: [PATCH 3/5] ASoC: Remove unused num_dai field from CODEC
Quoted 2 lines · Lars-Peter Clausen
Commit
d191bd8de8("ASoC:snd_soc_codecincludessnd_soc_component") removed the last user of thenum_daifield. Also remove the field itself.
Applied, thanks.
PATCH 4/5 ASoC: atmel-pcm-pdc: Remove broken suspend/resume code
In reply to Lars-Peter ClausenSuspend/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.
---
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(-)
sound/soc/atmel/atmel-pcm-pdc.c +0 -63
@@ -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)
Signature · 1 line
1.8.0
Re: [PATCH 4/5] ASoC: atmel-pcm-pdc: Remove broken suspend/resume code
Quoted 3 lines · Lars-Peter Clausen
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 commit10cab262("ASoC: Change
Applied, thanks.
PATCH 5/5 ASoC: Remove runtime field from DAI
In reply to Lars-Peter ClausenThis 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.
--- include/sound/soc-dai.h | 1 - sound/soc/soc-compress.c | 1 - sound/soc/soc-pcm.c | 1 - 3 files changed, 3 deletions(-)
include/sound/soc-dai.h +0 -1
@@ -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;
sound/soc/soc-compress.c +0 -1
@@ -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)) {
sound/soc/soc-pcm.c +0 -1
@@ -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)) {
Signature · 1 line
1.8.0
Re: [PATCH 5/5] ASoC: Remove runtime field from DAI
Quoted 4 lines · Lars-Peter Clausen
This was initially removed in commit
6423c1875("ASoC: Remove runtime field from DAI"), but was, presumably by accident, brought back in commitf0fba2ad1("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.