Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ASoC: Intel: catpt: Dma-transfer fix and couple

Merge series from Cezary Rojewski <cezary.rojewski@intel.com>:

Set is made of one fix for dma-transfer so that result of
dmaengine_submit() is tested before moving on, and few cleanups:

- two non-impactful, where catpt_component_open() layout gets improved
slightly as well as relocation of couple of locals found in
PCM-functions so that they look more cohesive
- no need to expose catpt-driver board-matching information globally.
Most fields are not by it and it's the sole user of haswell_machines
table. By having them locally it is clear what is actually being used

Cezary Rojewski (5):
ASoC: Intel: catpt: Test dmaengine_submit() result before moving on
ASoC: Intel: catpt: Reduce size of catpt_component_open()
ASoC: Intel: catpt: Streamline locals declaration for PCM-functions
ASoC: Intel: catpt: Drop SND_SOC_ACPI_INTEL_MATCH dependency
ASoC: Intel: Drop legacy HSW/BDW board-match information

include/sound/soc-acpi-intel-match.h | 1 -
sound/soc/intel/Kconfig | 2 +-
sound/soc/intel/catpt/device.c | 33 +++++++++++++++--
sound/soc/intel/catpt/dsp.c | 14 ++++++-
sound/soc/intel/catpt/pcm.c | 37 +++++++++----------
.../common/soc-acpi-intel-hsw-bdw-match.c | 16 --------
6 files changed, 61 insertions(+), 42 deletions(-)

--
2.25.1

+30 -21
+12 -2
sound/soc/intel/catpt/dsp.c
··· 65 65 { 66 66 struct dma_async_tx_descriptor *desc; 67 67 enum dma_status status; 68 + int ret; 68 69 69 70 desc = dmaengine_prep_dma_memcpy(chan, dst_addr, src_addr, size, 70 71 DMA_CTRL_ACK); ··· 78 77 catpt_updatel_shim(cdev, HMDC, 79 78 CATPT_HMDC_HDDA(CATPT_DMA_DEVID, chan->chan_id), 80 79 CATPT_HMDC_HDDA(CATPT_DMA_DEVID, chan->chan_id)); 81 - dmaengine_submit(desc); 80 + 81 + ret = dma_submit_error(dmaengine_submit(desc)); 82 + if (ret) { 83 + dev_err(cdev->dev, "submit tx failed: %d\n", ret); 84 + goto clear_hdda; 85 + } 86 + 82 87 status = dma_wait_for_async_tx(desc); 88 + ret = (status == DMA_COMPLETE) ? 0 : -EPROTO; 89 + 90 + clear_hdda: 83 91 /* regardless of status, disable access to HOST memory in demand mode */ 84 92 catpt_updatel_shim(cdev, HMDC, 85 93 CATPT_HMDC_HDDA(CATPT_DMA_DEVID, chan->chan_id), 0); 86 94 87 - return (status == DMA_COMPLETE) ? 0 : -EPROTO; 95 + return ret; 88 96 } 89 97 90 98 int catpt_dma_memcpy_todsp(struct catpt_dev *cdev, struct dma_chan *chan,
+18 -19
sound/soc/intel/catpt/pcm.c
··· 259 259 static int catpt_dai_startup(struct snd_pcm_substream *substream, 260 260 struct snd_soc_dai *dai) 261 261 { 262 - struct catpt_dev *cdev = dev_get_drvdata(dai->dev); 263 262 struct catpt_stream_template *template; 264 263 struct catpt_stream_runtime *stream; 264 + struct catpt_dev *cdev = dev_get_drvdata(dai->dev); 265 265 struct resource *res; 266 266 int ret; 267 267 ··· 306 306 static void catpt_dai_shutdown(struct snd_pcm_substream *substream, 307 307 struct snd_soc_dai *dai) 308 308 { 309 - struct catpt_dev *cdev = dev_get_drvdata(dai->dev); 310 309 struct catpt_stream_runtime *stream; 310 + struct catpt_dev *cdev = dev_get_drvdata(dai->dev); 311 311 312 312 stream = snd_soc_dai_get_dma_data(dai, substream); 313 313 ··· 329 329 static int catpt_dai_apply_usettings(struct snd_soc_dai *dai, 330 330 struct catpt_stream_runtime *stream) 331 331 { 332 - struct catpt_dev *cdev = dev_get_drvdata(dai->dev); 333 332 struct snd_soc_component *component = dai->component; 334 333 struct snd_kcontrol *pos; 334 + struct catpt_dev *cdev = dev_get_drvdata(dai->dev); 335 335 const char *name; 336 336 int ret; 337 337 u32 id = stream->info.stream_hw_id; ··· 374 374 struct snd_pcm_hw_params *params, 375 375 struct snd_soc_dai *dai) 376 376 { 377 - struct catpt_dev *cdev = dev_get_drvdata(dai->dev); 377 + struct snd_pcm_runtime *rtm = substream->runtime; 378 + struct snd_dma_buffer *dmab; 378 379 struct catpt_stream_runtime *stream; 379 380 struct catpt_audio_format afmt; 380 381 struct catpt_ring_info rinfo; 381 - struct snd_pcm_runtime *rtm = substream->runtime; 382 - struct snd_dma_buffer *dmab; 382 + struct catpt_dev *cdev = dev_get_drvdata(dai->dev); 383 383 int ret; 384 384 385 385 stream = snd_soc_dai_get_dma_data(dai, substream); ··· 427 427 static int catpt_dai_hw_free(struct snd_pcm_substream *substream, 428 428 struct snd_soc_dai *dai) 429 429 { 430 - struct catpt_dev *cdev = dev_get_drvdata(dai->dev); 431 430 struct catpt_stream_runtime *stream; 431 + struct catpt_dev *cdev = dev_get_drvdata(dai->dev); 432 432 433 433 stream = snd_soc_dai_get_dma_data(dai, substream); 434 434 if (!stream->allocated) ··· 444 444 static int catpt_dai_prepare(struct snd_pcm_substream *substream, 445 445 struct snd_soc_dai *dai) 446 446 { 447 - struct catpt_dev *cdev = dev_get_drvdata(dai->dev); 448 447 struct catpt_stream_runtime *stream; 448 + struct catpt_dev *cdev = dev_get_drvdata(dai->dev); 449 449 int ret; 450 450 451 451 stream = snd_soc_dai_get_dma_data(dai, substream); ··· 467 467 static int catpt_dai_trigger(struct snd_pcm_substream *substream, int cmd, 468 468 struct snd_soc_dai *dai) 469 469 { 470 - struct catpt_dev *cdev = dev_get_drvdata(dai->dev); 471 - struct catpt_stream_runtime *stream; 472 470 struct snd_pcm_runtime *runtime = substream->runtime; 471 + struct catpt_stream_runtime *stream; 472 + struct catpt_dev *cdev = dev_get_drvdata(dai->dev); 473 473 snd_pcm_uframes_t pos; 474 474 int ret; 475 475 ··· 595 595 { 596 596 struct snd_soc_pcm_runtime *rtm = substream->private_data; 597 597 598 - if (rtm->dai_link->no_pcm) 599 - return 0; 600 - snd_soc_set_runtime_hwparams(substream, &catpt_pcm_hardware); 598 + if (!rtm->dai_link->no_pcm) 599 + snd_soc_set_runtime_hwparams(substream, &catpt_pcm_hardware); 601 600 return 0; 602 601 } 603 602 ··· 604 605 catpt_component_pointer(struct snd_soc_component *component, 605 606 struct snd_pcm_substream *substream) 606 607 { 607 - struct catpt_dev *cdev = dev_get_drvdata(component->dev); 608 - struct catpt_stream_runtime *stream; 609 608 struct snd_soc_pcm_runtime *rtm = substream->private_data; 610 609 struct snd_soc_dai *cpu_dai = asoc_rtd_to_cpu(rtm, 0); 610 + struct catpt_stream_runtime *stream; 611 + struct catpt_dev *cdev = dev_get_drvdata(component->dev); 611 612 u32 pos; 612 613 613 614 if (rtm->dai_link->no_pcm) ··· 632 633 struct snd_soc_dai *dai) 633 634 { 634 635 struct snd_soc_dai *codec_dai = asoc_rtd_to_codec(rtm, 0); 635 - struct catpt_dev *cdev = dev_get_drvdata(dai->dev); 636 636 struct catpt_ssp_device_format devfmt; 637 + struct catpt_dev *cdev = dev_get_drvdata(dai->dev); 637 638 int ret; 638 639 639 640 devfmt.iface = dai->driver->id; ··· 893 894 { 894 895 struct snd_soc_component *component = 895 896 snd_soc_kcontrol_component(kcontrol); 896 - struct catpt_dev *cdev = dev_get_drvdata(component->dev); 897 897 struct catpt_stream_runtime *stream; 898 + struct catpt_dev *cdev = dev_get_drvdata(component->dev); 898 899 long *ctlvol = (long *)kcontrol->private_value; 899 900 u32 dspvol; 900 901 int i; ··· 925 926 { 926 927 struct snd_soc_component *component = 927 928 snd_soc_kcontrol_component(kcontrol); 928 - struct catpt_dev *cdev = dev_get_drvdata(component->dev); 929 929 struct catpt_stream_runtime *stream; 930 + struct catpt_dev *cdev = dev_get_drvdata(component->dev); 930 931 long *ctlvol = (long *)kcontrol->private_value; 931 932 int ret, i; 932 933 ··· 1001 1002 { 1002 1003 struct snd_soc_component *component = 1003 1004 snd_soc_kcontrol_component(kcontrol); 1004 - struct catpt_dev *cdev = dev_get_drvdata(component->dev); 1005 1005 struct catpt_stream_runtime *stream; 1006 + struct catpt_dev *cdev = dev_get_drvdata(component->dev); 1006 1007 bool mute; 1007 1008 int ret; 1008 1009