Skip to content

Commit 811fb83

Browse files
committed
!fixup ASoC: SOF: ops: Add new platform-specific ops for compress
add compr_hw_free callback and implementation. Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
1 parent 0d51efc commit 811fb83

5 files changed

Lines changed: 31 additions & 5 deletions

File tree

sound/soc/sof/intel/hda-common-ops.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ const struct snd_sof_dsp_ops sof_hda_common_ops = {
5959

6060
.compr_open = hda_dsp_compr_open,
6161
.compr_hw_params = hda_dsp_compr_hw_params,
62+
.compr_hw_free = hda_dsp_stream_compr_hw_free,
6263
.compr_close = hda_dsp_compr_close,
6364
.compr_trigger = hda_dsp_compr_trigger,
6465
.compr_pointer = hda_dsp_compr_pointer,

sound/soc/sof/intel/hda-stream.c

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -743,13 +743,12 @@ int hda_dsp_stream_hw_params(struct snd_sof_dev *sdev,
743743
return ret;
744744
}
745745

746-
int hda_dsp_stream_hw_free(struct snd_sof_dev *sdev,
747-
struct snd_pcm_substream *substream)
746+
static int _hda_dsp_stream_hw_free(struct snd_sof_dev *sdev,
747+
struct hdac_stream *hstream)
748748
{
749-
struct hdac_stream *hstream = substream->runtime->private_data;
750749
struct hdac_ext_stream *hext_stream = container_of(hstream,
751-
struct hdac_ext_stream,
752-
hstream);
750+
struct hdac_ext_stream,
751+
hstream);
753752
int ret;
754753

755754
ret = hda_dsp_stream_reset(sdev, hstream);
@@ -774,8 +773,21 @@ int hda_dsp_stream_hw_free(struct snd_sof_dev *sdev,
774773

775774
return 0;
776775
}
776+
777+
int hda_dsp_stream_hw_free(struct snd_sof_dev *sdev,
778+
struct snd_pcm_substream *substream)
779+
{
780+
return _hda_dsp_stream_hw_free(sdev, substream->runtime->private_data);
781+
}
777782
EXPORT_SYMBOL_NS(hda_dsp_stream_hw_free, "SND_SOC_SOF_INTEL_HDA_COMMON");
778783

784+
int hda_dsp_stream_compr_hw_free(struct snd_sof_dev *sdev,
785+
struct snd_compr_stream *cstream)
786+
{
787+
return _hda_dsp_stream_hw_free(sdev, cstream->runtime->private_data);
788+
}
789+
EXPORT_SYMBOL_NS(hda_dsp_stream_compr_hw_free, "SND_SOC_SOF_INTEL_HDA_COMMON");
790+
779791
bool hda_dsp_check_stream_irq(struct snd_sof_dev *sdev)
780792
{
781793
struct hdac_bus *bus = sof_to_bus(sdev);

sound/soc/sof/intel/hda.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -666,6 +666,8 @@ int hda_dsp_compr_hw_params(struct snd_sof_dev *sdev,
666666
struct snd_compr_stream *cstream,
667667
struct snd_compr_params *params,
668668
struct snd_sof_platform_stream_params *platform_params);
669+
int hda_dsp_stream_compr_hw_free(struct snd_sof_dev *sdev,
670+
struct snd_compr_stream *cstream);
669671
int hda_dsp_compr_trigger(struct snd_sof_dev *sdev,
670672
struct snd_compr_stream *cstream, int cmd);
671673
int hda_dsp_compr_pointer(struct snd_sof_dev *sdev, struct snd_compr_stream *cstream,

sound/soc/sof/ops.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -481,6 +481,16 @@ snd_sof_compr_platform_hw_params(struct snd_sof_dev *sdev,
481481
return 0;
482482
}
483483

484+
static inline int
485+
snd_sof_compr_platform_hw_free(struct snd_sof_dev *sdev,
486+
struct snd_compr_stream *cstream)
487+
{
488+
if (sof_ops(sdev) && sof_ops(sdev)->compr_hw_free)
489+
return sof_ops(sdev)->compr_hw_free(sdev, cstream);
490+
491+
return 0;
492+
}
493+
484494
static inline int
485495
snd_sof_compr_platform_trigger(struct snd_sof_dev *sdev,
486496
struct snd_compr_stream *cstream, int cmd)

sound/soc/sof/sof-priv.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -263,6 +263,7 @@ struct snd_sof_dsp_ops {
263263
int (*compr_hw_params)(struct snd_sof_dev *sdev, struct snd_compr_stream *cstream,
264264
struct snd_compr_params *params,
265265
struct snd_sof_platform_stream_params *platform_params);
266+
int (*compr_hw_free)(struct snd_sof_dev *sdev, struct snd_compr_stream *cstream);
266267
int (*compr_trigger)(struct snd_sof_dev *sdev, struct snd_compr_stream *cstream,
267268
int cmd);
268269
int (*compr_pointer)(struct snd_sof_dev *sdev, struct snd_compr_stream *cstream,

0 commit comments

Comments
 (0)