diff options
| author | Linus Torvalds <torvalds@linux-foundation.org> | 2015-01-02 15:57:20 -0500 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2015-01-02 15:57:20 -0500 |
| commit | 6a4bfa7c3fe202dc831003ca9dd7e837bc1288ca (patch) | |
| tree | 5babd97fb9f3dce1c0b01e3b67f73e9f8e587a10 | |
| parent | d7e19bd882c23109853ac67f414024c816edc8b9 (diff) | |
| parent | 62f64a880af2e82d1b41cb02cb43b88d30413993 (diff) | |
Merge tag 'sound-3.19-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound
Pull sound fixes from Takashi Iwai:
"Nothing too exciting as a new year's start here: most of fixes are for
ASoC, a boot crash fix on OMAP for deferred probe, a few driver
specific fixes (Intel, dwc, rockchip, rt5677), in addition to typo
fixes in kerneldoc comments for PCM"
* tag 'sound-3.19-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound:
ALSA: pcm: Fix kerneldoc for params_*() functions
ASoC: rockchip: i2s: fix maxburst of dma data to 4
ASoC: rockchip: i2s: fix error defination of transmit data level
ASoC: Intel: correct the fixed free block allocation
ASoC: rt5677: fixed rt5677_dsp_vad_put rt5677_dsp_vad_get panic
ASoC: Intel: Fix BYTCR machine driver MODULE_ALIAS
ASoC: Intel: Fix BYTCR firmware name
ASoC: dwc: Iterate over all channels
ASoC: dwc: Ensure FIFOs are flushed to prevent channel swap
ASoC: Intel: Add I2C dependency to two new machines
ASoC: dapm: Remove snd_soc_of_parse_audio_routing() due to deferred probe
| -rw-r--r-- | include/sound/pcm.h | 10 | ||||
| -rw-r--r-- | sound/soc/codecs/rt5677.c | 9 | ||||
| -rw-r--r-- | sound/soc/dwc/designware_i2s.c | 49 | ||||
| -rw-r--r-- | sound/soc/intel/Kconfig | 4 | ||||
| -rw-r--r-- | sound/soc/intel/bytcr_dpcm_rt5640.c | 2 | ||||
| -rw-r--r-- | sound/soc/intel/sst-firmware.c | 6 | ||||
| -rw-r--r-- | sound/soc/intel/sst/sst_acpi.c | 2 | ||||
| -rw-r--r-- | sound/soc/rockchip/rockchip_i2s.c | 4 | ||||
| -rw-r--r-- | sound/soc/rockchip/rockchip_i2s.h | 2 | ||||
| -rw-r--r-- | sound/soc/soc-core.c | 14 |
10 files changed, 57 insertions, 45 deletions
diff --git a/include/sound/pcm.h b/include/sound/pcm.h index 1e7f74acc2ec..b429b73e875e 100644 --- a/include/sound/pcm.h +++ b/include/sound/pcm.h | |||
| @@ -857,7 +857,7 @@ static inline unsigned int params_channels(const struct snd_pcm_hw_params *p) | |||
| 857 | } | 857 | } |
| 858 | 858 | ||
| 859 | /** | 859 | /** |
| 860 | * params_channels - Get the sample rate from the hw params | 860 | * params_rate - Get the sample rate from the hw params |
| 861 | * @p: hw params | 861 | * @p: hw params |
| 862 | */ | 862 | */ |
| 863 | static inline unsigned int params_rate(const struct snd_pcm_hw_params *p) | 863 | static inline unsigned int params_rate(const struct snd_pcm_hw_params *p) |
| @@ -866,7 +866,7 @@ static inline unsigned int params_rate(const struct snd_pcm_hw_params *p) | |||
| 866 | } | 866 | } |
| 867 | 867 | ||
| 868 | /** | 868 | /** |
| 869 | * params_channels - Get the period size (in frames) from the hw params | 869 | * params_period_size - Get the period size (in frames) from the hw params |
| 870 | * @p: hw params | 870 | * @p: hw params |
| 871 | */ | 871 | */ |
| 872 | static inline unsigned int params_period_size(const struct snd_pcm_hw_params *p) | 872 | static inline unsigned int params_period_size(const struct snd_pcm_hw_params *p) |
| @@ -875,7 +875,7 @@ static inline unsigned int params_period_size(const struct snd_pcm_hw_params *p) | |||
| 875 | } | 875 | } |
| 876 | 876 | ||
| 877 | /** | 877 | /** |
| 878 | * params_channels - Get the number of periods from the hw params | 878 | * params_periods - Get the number of periods from the hw params |
| 879 | * @p: hw params | 879 | * @p: hw params |
| 880 | */ | 880 | */ |
| 881 | static inline unsigned int params_periods(const struct snd_pcm_hw_params *p) | 881 | static inline unsigned int params_periods(const struct snd_pcm_hw_params *p) |
| @@ -884,7 +884,7 @@ static inline unsigned int params_periods(const struct snd_pcm_hw_params *p) | |||
| 884 | } | 884 | } |
| 885 | 885 | ||
| 886 | /** | 886 | /** |
| 887 | * params_channels - Get the buffer size (in frames) from the hw params | 887 | * params_buffer_size - Get the buffer size (in frames) from the hw params |
| 888 | * @p: hw params | 888 | * @p: hw params |
| 889 | */ | 889 | */ |
| 890 | static inline unsigned int params_buffer_size(const struct snd_pcm_hw_params *p) | 890 | static inline unsigned int params_buffer_size(const struct snd_pcm_hw_params *p) |
| @@ -893,7 +893,7 @@ static inline unsigned int params_buffer_size(const struct snd_pcm_hw_params *p) | |||
| 893 | } | 893 | } |
| 894 | 894 | ||
| 895 | /** | 895 | /** |
| 896 | * params_channels - Get the buffer size (in bytes) from the hw params | 896 | * params_buffer_bytes - Get the buffer size (in bytes) from the hw params |
| 897 | * @p: hw params | 897 | * @p: hw params |
| 898 | */ | 898 | */ |
| 899 | static inline unsigned int params_buffer_bytes(const struct snd_pcm_hw_params *p) | 899 | static inline unsigned int params_buffer_bytes(const struct snd_pcm_hw_params *p) |
diff --git a/sound/soc/codecs/rt5677.c b/sound/soc/codecs/rt5677.c index 81fe1464d268..c0fbe1881439 100644 --- a/sound/soc/codecs/rt5677.c +++ b/sound/soc/codecs/rt5677.c | |||
| @@ -784,8 +784,8 @@ static unsigned int bst_tlv[] = { | |||
| 784 | static int rt5677_dsp_vad_get(struct snd_kcontrol *kcontrol, | 784 | static int rt5677_dsp_vad_get(struct snd_kcontrol *kcontrol, |
| 785 | struct snd_ctl_elem_value *ucontrol) | 785 | struct snd_ctl_elem_value *ucontrol) |
| 786 | { | 786 | { |
| 787 | struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); | 787 | struct snd_soc_component *component = snd_kcontrol_chip(kcontrol); |
| 788 | struct rt5677_priv *rt5677 = snd_soc_codec_get_drvdata(codec); | 788 | struct rt5677_priv *rt5677 = snd_soc_component_get_drvdata(component); |
| 789 | 789 | ||
| 790 | ucontrol->value.integer.value[0] = rt5677->dsp_vad_en; | 790 | ucontrol->value.integer.value[0] = rt5677->dsp_vad_en; |
| 791 | 791 | ||
| @@ -795,8 +795,9 @@ static int rt5677_dsp_vad_get(struct snd_kcontrol *kcontrol, | |||
| 795 | static int rt5677_dsp_vad_put(struct snd_kcontrol *kcontrol, | 795 | static int rt5677_dsp_vad_put(struct snd_kcontrol *kcontrol, |
| 796 | struct snd_ctl_elem_value *ucontrol) | 796 | struct snd_ctl_elem_value *ucontrol) |
| 797 | { | 797 | { |
| 798 | struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); | 798 | struct snd_soc_component *component = snd_kcontrol_chip(kcontrol); |
| 799 | struct rt5677_priv *rt5677 = snd_soc_codec_get_drvdata(codec); | 799 | struct rt5677_priv *rt5677 = snd_soc_component_get_drvdata(component); |
| 800 | struct snd_soc_codec *codec = snd_soc_component_to_codec(component); | ||
| 800 | 801 | ||
| 801 | rt5677->dsp_vad_en = !!ucontrol->value.integer.value[0]; | 802 | rt5677->dsp_vad_en = !!ucontrol->value.integer.value[0]; |
| 802 | 803 | ||
diff --git a/sound/soc/dwc/designware_i2s.c b/sound/soc/dwc/designware_i2s.c index b93168d4f648..8d18bbda661b 100644 --- a/sound/soc/dwc/designware_i2s.c +++ b/sound/soc/dwc/designware_i2s.c | |||
| @@ -209,16 +209,9 @@ static int dw_i2s_hw_params(struct snd_pcm_substream *substream, | |||
| 209 | 209 | ||
| 210 | switch (config->chan_nr) { | 210 | switch (config->chan_nr) { |
| 211 | case EIGHT_CHANNEL_SUPPORT: | 211 | case EIGHT_CHANNEL_SUPPORT: |
| 212 | ch_reg = 3; | ||
| 213 | break; | ||
| 214 | case SIX_CHANNEL_SUPPORT: | 212 | case SIX_CHANNEL_SUPPORT: |
| 215 | ch_reg = 2; | ||
| 216 | break; | ||
| 217 | case FOUR_CHANNEL_SUPPORT: | 213 | case FOUR_CHANNEL_SUPPORT: |
| 218 | ch_reg = 1; | ||
| 219 | break; | ||
| 220 | case TWO_CHANNEL_SUPPORT: | 214 | case TWO_CHANNEL_SUPPORT: |
| 221 | ch_reg = 0; | ||
| 222 | break; | 215 | break; |
| 223 | default: | 216 | default: |
| 224 | dev_err(dev->dev, "channel not supported\n"); | 217 | dev_err(dev->dev, "channel not supported\n"); |
| @@ -227,18 +220,22 @@ static int dw_i2s_hw_params(struct snd_pcm_substream *substream, | |||
| 227 | 220 | ||
| 228 | i2s_disable_channels(dev, substream->stream); | 221 | i2s_disable_channels(dev, substream->stream); |
| 229 | 222 | ||
| 230 | if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { | 223 | for (ch_reg = 0; ch_reg < (config->chan_nr / 2); ch_reg++) { |
| 231 | i2s_write_reg(dev->i2s_base, TCR(ch_reg), xfer_resolution); | 224 | if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { |
| 232 | i2s_write_reg(dev->i2s_base, TFCR(ch_reg), 0x02); | 225 | i2s_write_reg(dev->i2s_base, TCR(ch_reg), |
| 233 | irq = i2s_read_reg(dev->i2s_base, IMR(ch_reg)); | 226 | xfer_resolution); |
| 234 | i2s_write_reg(dev->i2s_base, IMR(ch_reg), irq & ~0x30); | 227 | i2s_write_reg(dev->i2s_base, TFCR(ch_reg), 0x02); |
| 235 | i2s_write_reg(dev->i2s_base, TER(ch_reg), 1); | 228 | irq = i2s_read_reg(dev->i2s_base, IMR(ch_reg)); |
| 236 | } else { | 229 | i2s_write_reg(dev->i2s_base, IMR(ch_reg), irq & ~0x30); |
| 237 | i2s_write_reg(dev->i2s_base, RCR(ch_reg), xfer_resolution); | 230 | i2s_write_reg(dev->i2s_base, TER(ch_reg), 1); |
| 238 | i2s_write_reg(dev->i2s_base, RFCR(ch_reg), 0x07); | 231 | } else { |
| 239 | irq = i2s_read_reg(dev->i2s_base, IMR(ch_reg)); | 232 | i2s_write_reg(dev->i2s_base, RCR(ch_reg), |
| 240 | i2s_write_reg(dev->i2s_base, IMR(ch_reg), irq & ~0x03); | 233 | xfer_resolution); |
| 241 | i2s_write_reg(dev->i2s_base, RER(ch_reg), 1); | 234 | i2s_write_reg(dev->i2s_base, RFCR(ch_reg), 0x07); |
| 235 | irq = i2s_read_reg(dev->i2s_base, IMR(ch_reg)); | ||
| 236 | i2s_write_reg(dev->i2s_base, IMR(ch_reg), irq & ~0x03); | ||
| 237 | i2s_write_reg(dev->i2s_base, RER(ch_reg), 1); | ||
| 238 | } | ||
| 242 | } | 239 | } |
| 243 | 240 | ||
| 244 | i2s_write_reg(dev->i2s_base, CCR, ccr); | 241 | i2s_write_reg(dev->i2s_base, CCR, ccr); |
| @@ -263,6 +260,19 @@ static void dw_i2s_shutdown(struct snd_pcm_substream *substream, | |||
| 263 | snd_soc_dai_set_dma_data(dai, substream, NULL); | 260 | snd_soc_dai_set_dma_data(dai, substream, NULL); |
| 264 | } | 261 | } |
| 265 | 262 | ||
| 263 | static int dw_i2s_prepare(struct snd_pcm_substream *substream, | ||
| 264 | struct snd_soc_dai *dai) | ||
| 265 | { | ||
| 266 | struct dw_i2s_dev *dev = snd_soc_dai_get_drvdata(dai); | ||
| 267 | |||
| 268 | if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) | ||
| 269 | i2s_write_reg(dev->i2s_base, TXFFR, 1); | ||
| 270 | else | ||
| 271 | i2s_write_reg(dev->i2s_base, RXFFR, 1); | ||
| 272 | |||
| 273 | return 0; | ||
| 274 | } | ||
| 275 | |||
| 266 | static int dw_i2s_trigger(struct snd_pcm_substream *substream, | 276 | static int dw_i2s_trigger(struct snd_pcm_substream *substream, |
| 267 | int cmd, struct snd_soc_dai *dai) | 277 | int cmd, struct snd_soc_dai *dai) |
| 268 | { | 278 | { |
| @@ -294,6 +304,7 @@ static struct snd_soc_dai_ops dw_i2s_dai_ops = { | |||
| 294 | .startup = dw_i2s_startup, | 304 | .startup = dw_i2s_startup, |
| 295 | .shutdown = dw_i2s_shutdown, | 305 | .shutdown = dw_i2s_shutdown, |
| 296 | .hw_params = dw_i2s_hw_params, | 306 | .hw_params = dw_i2s_hw_params, |
| 307 | .prepare = dw_i2s_prepare, | ||
| 297 | .trigger = dw_i2s_trigger, | 308 | .trigger = dw_i2s_trigger, |
| 298 | }; | 309 | }; |
| 299 | 310 | ||
diff --git a/sound/soc/intel/Kconfig b/sound/soc/intel/Kconfig index e989ecf046c9..f86de1211b96 100644 --- a/sound/soc/intel/Kconfig +++ b/sound/soc/intel/Kconfig | |||
| @@ -89,7 +89,7 @@ config SND_SOC_INTEL_BROADWELL_MACH | |||
| 89 | 89 | ||
| 90 | config SND_SOC_INTEL_BYTCR_RT5640_MACH | 90 | config SND_SOC_INTEL_BYTCR_RT5640_MACH |
| 91 | tristate "ASoC Audio DSP Support for MID BYT Platform" | 91 | tristate "ASoC Audio DSP Support for MID BYT Platform" |
| 92 | depends on X86 | 92 | depends on X86 && I2C |
| 93 | select SND_SOC_RT5640 | 93 | select SND_SOC_RT5640 |
| 94 | select SND_SST_MFLD_PLATFORM | 94 | select SND_SST_MFLD_PLATFORM |
| 95 | select SND_SST_IPC_ACPI | 95 | select SND_SST_IPC_ACPI |
| @@ -101,7 +101,7 @@ config SND_SOC_INTEL_BYTCR_RT5640_MACH | |||
| 101 | 101 | ||
| 102 | config SND_SOC_INTEL_CHT_BSW_RT5672_MACH | 102 | config SND_SOC_INTEL_CHT_BSW_RT5672_MACH |
| 103 | tristate "ASoC Audio driver for Intel Cherrytrail & Braswell with RT5672 codec" | 103 | tristate "ASoC Audio driver for Intel Cherrytrail & Braswell with RT5672 codec" |
| 104 | depends on X86_INTEL_LPSS | 104 | depends on X86_INTEL_LPSS && I2C |
| 105 | select SND_SOC_RT5670 | 105 | select SND_SOC_RT5670 |
| 106 | select SND_SST_MFLD_PLATFORM | 106 | select SND_SST_MFLD_PLATFORM |
| 107 | select SND_SST_IPC_ACPI | 107 | select SND_SST_IPC_ACPI |
diff --git a/sound/soc/intel/bytcr_dpcm_rt5640.c b/sound/soc/intel/bytcr_dpcm_rt5640.c index f5d0fc1ab10c..eef0c56ec32e 100644 --- a/sound/soc/intel/bytcr_dpcm_rt5640.c +++ b/sound/soc/intel/bytcr_dpcm_rt5640.c | |||
| @@ -227,4 +227,4 @@ module_platform_driver(snd_byt_mc_driver); | |||
| 227 | MODULE_DESCRIPTION("ASoC Intel(R) Baytrail CR Machine driver"); | 227 | MODULE_DESCRIPTION("ASoC Intel(R) Baytrail CR Machine driver"); |
| 228 | MODULE_AUTHOR("Subhransu S. Prusty <subhransu.s.prusty@intel.com>"); | 228 | MODULE_AUTHOR("Subhransu S. Prusty <subhransu.s.prusty@intel.com>"); |
| 229 | MODULE_LICENSE("GPL v2"); | 229 | MODULE_LICENSE("GPL v2"); |
| 230 | MODULE_ALIAS("platform:bytrt5640-audio"); | 230 | MODULE_ALIAS("platform:bytt100_rt5640"); |
diff --git a/sound/soc/intel/sst-firmware.c b/sound/soc/intel/sst-firmware.c index 4a5bde9c686b..ef2e8b5766a1 100644 --- a/sound/soc/intel/sst-firmware.c +++ b/sound/soc/intel/sst-firmware.c | |||
| @@ -763,8 +763,12 @@ static int block_alloc_fixed(struct sst_dsp *dsp, struct sst_block_allocator *ba | |||
| 763 | /* does block span more than 1 section */ | 763 | /* does block span more than 1 section */ |
| 764 | if (ba->offset >= block->offset && ba->offset < block_end) { | 764 | if (ba->offset >= block->offset && ba->offset < block_end) { |
| 765 | 765 | ||
| 766 | /* add block */ | ||
| 767 | list_move(&block->list, &dsp->used_block_list); | ||
| 768 | list_add(&block->module_list, block_list); | ||
| 766 | /* align ba to block boundary */ | 769 | /* align ba to block boundary */ |
| 767 | ba->offset = block->offset; | 770 | ba->size -= block_end - ba->offset; |
| 771 | ba->offset = block_end; | ||
| 768 | 772 | ||
| 769 | err = block_alloc_contiguous(dsp, ba, block_list); | 773 | err = block_alloc_contiguous(dsp, ba, block_list); |
| 770 | if (err < 0) | 774 | if (err < 0) |
diff --git a/sound/soc/intel/sst/sst_acpi.c b/sound/soc/intel/sst/sst_acpi.c index 3abc29e8a928..2ac72eb5e75d 100644 --- a/sound/soc/intel/sst/sst_acpi.c +++ b/sound/soc/intel/sst/sst_acpi.c | |||
| @@ -343,7 +343,7 @@ int sst_acpi_remove(struct platform_device *pdev) | |||
| 343 | } | 343 | } |
| 344 | 344 | ||
| 345 | static struct sst_machines sst_acpi_bytcr[] = { | 345 | static struct sst_machines sst_acpi_bytcr[] = { |
| 346 | {"10EC5640", "T100", "bytt100_rt5640", NULL, "fw_sst_0f28.bin", | 346 | {"10EC5640", "T100", "bytt100_rt5640", NULL, "intel/fw_sst_0f28.bin", |
| 347 | &byt_rvp_platform_data }, | 347 | &byt_rvp_platform_data }, |
| 348 | {}, | 348 | {}, |
| 349 | }; | 349 | }; |
diff --git a/sound/soc/rockchip/rockchip_i2s.c b/sound/soc/rockchip/rockchip_i2s.c index 26ec5117b35c..13d8507333b8 100644 --- a/sound/soc/rockchip/rockchip_i2s.c +++ b/sound/soc/rockchip/rockchip_i2s.c | |||
| @@ -454,11 +454,11 @@ static int rockchip_i2s_probe(struct platform_device *pdev) | |||
| 454 | 454 | ||
| 455 | i2s->playback_dma_data.addr = res->start + I2S_TXDR; | 455 | i2s->playback_dma_data.addr = res->start + I2S_TXDR; |
| 456 | i2s->playback_dma_data.addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES; | 456 | i2s->playback_dma_data.addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES; |
| 457 | i2s->playback_dma_data.maxburst = 16; | 457 | i2s->playback_dma_data.maxburst = 4; |
| 458 | 458 | ||
| 459 | i2s->capture_dma_data.addr = res->start + I2S_RXDR; | 459 | i2s->capture_dma_data.addr = res->start + I2S_RXDR; |
| 460 | i2s->capture_dma_data.addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES; | 460 | i2s->capture_dma_data.addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES; |
| 461 | i2s->capture_dma_data.maxburst = 16; | 461 | i2s->capture_dma_data.maxburst = 4; |
| 462 | 462 | ||
| 463 | i2s->dev = &pdev->dev; | 463 | i2s->dev = &pdev->dev; |
| 464 | dev_set_drvdata(&pdev->dev, i2s); | 464 | dev_set_drvdata(&pdev->dev, i2s); |
diff --git a/sound/soc/rockchip/rockchip_i2s.h b/sound/soc/rockchip/rockchip_i2s.h index 89a5d8bc6ee7..93f456f518a9 100644 --- a/sound/soc/rockchip/rockchip_i2s.h +++ b/sound/soc/rockchip/rockchip_i2s.h | |||
| @@ -127,7 +127,7 @@ | |||
| 127 | #define I2S_DMACR_TDE_DISABLE (0 << I2S_DMACR_TDE_SHIFT) | 127 | #define I2S_DMACR_TDE_DISABLE (0 << I2S_DMACR_TDE_SHIFT) |
| 128 | #define I2S_DMACR_TDE_ENABLE (1 << I2S_DMACR_TDE_SHIFT) | 128 | #define I2S_DMACR_TDE_ENABLE (1 << I2S_DMACR_TDE_SHIFT) |
| 129 | #define I2S_DMACR_TDL_SHIFT 0 | 129 | #define I2S_DMACR_TDL_SHIFT 0 |
| 130 | #define I2S_DMACR_TDL(x) ((x - 1) << I2S_DMACR_TDL_SHIFT) | 130 | #define I2S_DMACR_TDL(x) ((x) << I2S_DMACR_TDL_SHIFT) |
| 131 | #define I2S_DMACR_TDL_MASK (0x1f << I2S_DMACR_TDL_SHIFT) | 131 | #define I2S_DMACR_TDL_MASK (0x1f << I2S_DMACR_TDL_SHIFT) |
| 132 | 132 | ||
| 133 | /* | 133 | /* |
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c index 985052b3fbed..2c62620abca6 100644 --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c | |||
| @@ -3230,7 +3230,7 @@ int snd_soc_of_parse_audio_routing(struct snd_soc_card *card, | |||
| 3230 | const char *propname) | 3230 | const char *propname) |
| 3231 | { | 3231 | { |
| 3232 | struct device_node *np = card->dev->of_node; | 3232 | struct device_node *np = card->dev->of_node; |
| 3233 | int num_routes, old_routes; | 3233 | int num_routes; |
| 3234 | struct snd_soc_dapm_route *routes; | 3234 | struct snd_soc_dapm_route *routes; |
| 3235 | int i, ret; | 3235 | int i, ret; |
| 3236 | 3236 | ||
| @@ -3248,9 +3248,7 @@ int snd_soc_of_parse_audio_routing(struct snd_soc_card *card, | |||
| 3248 | return -EINVAL; | 3248 | return -EINVAL; |
| 3249 | } | 3249 | } |
| 3250 | 3250 | ||
| 3251 | old_routes = card->num_dapm_routes; | 3251 | routes = devm_kzalloc(card->dev, num_routes * sizeof(*routes), |
| 3252 | routes = devm_kzalloc(card->dev, | ||
| 3253 | (old_routes + num_routes) * sizeof(*routes), | ||
| 3254 | GFP_KERNEL); | 3252 | GFP_KERNEL); |
| 3255 | if (!routes) { | 3253 | if (!routes) { |
| 3256 | dev_err(card->dev, | 3254 | dev_err(card->dev, |
| @@ -3258,11 +3256,9 @@ int snd_soc_of_parse_audio_routing(struct snd_soc_card *card, | |||
| 3258 | return -EINVAL; | 3256 | return -EINVAL; |
| 3259 | } | 3257 | } |
| 3260 | 3258 | ||
| 3261 | memcpy(routes, card->dapm_routes, old_routes * sizeof(*routes)); | ||
| 3262 | |||
| 3263 | for (i = 0; i < num_routes; i++) { | 3259 | for (i = 0; i < num_routes; i++) { |
| 3264 | ret = of_property_read_string_index(np, propname, | 3260 | ret = of_property_read_string_index(np, propname, |
| 3265 | 2 * i, &routes[old_routes + i].sink); | 3261 | 2 * i, &routes[i].sink); |
| 3266 | if (ret) { | 3262 | if (ret) { |
| 3267 | dev_err(card->dev, | 3263 | dev_err(card->dev, |
| 3268 | "ASoC: Property '%s' index %d could not be read: %d\n", | 3264 | "ASoC: Property '%s' index %d could not be read: %d\n", |
| @@ -3270,7 +3266,7 @@ int snd_soc_of_parse_audio_routing(struct snd_soc_card *card, | |||
| 3270 | return -EINVAL; | 3266 | return -EINVAL; |
| 3271 | } | 3267 | } |
| 3272 | ret = of_property_read_string_index(np, propname, | 3268 | ret = of_property_read_string_index(np, propname, |
| 3273 | (2 * i) + 1, &routes[old_routes + i].source); | 3269 | (2 * i) + 1, &routes[i].source); |
| 3274 | if (ret) { | 3270 | if (ret) { |
| 3275 | dev_err(card->dev, | 3271 | dev_err(card->dev, |
| 3276 | "ASoC: Property '%s' index %d could not be read: %d\n", | 3272 | "ASoC: Property '%s' index %d could not be read: %d\n", |
| @@ -3279,7 +3275,7 @@ int snd_soc_of_parse_audio_routing(struct snd_soc_card *card, | |||
| 3279 | } | 3275 | } |
| 3280 | } | 3276 | } |
| 3281 | 3277 | ||
| 3282 | card->num_dapm_routes += num_routes; | 3278 | card->num_dapm_routes = num_routes; |
| 3283 | card->dapm_routes = routes; | 3279 | card->dapm_routes = routes; |
| 3284 | 3280 | ||
| 3285 | return 0; | 3281 | return 0; |
