hc
2023-12-06 08f87f769b595151be1afeff53e144f543faa614
kernel/sound/soc/intel/atom/sst-mfld-platform-compress.c
....@@ -1,18 +1,10 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /*
23 * sst_mfld_platform.c - Intel MID Platform driver
34 *
45 * Copyright (C) 2010-2014 Intel Corp
56 * Author: Vinod Koul <vinod.koul@intel.com>
67 * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
7
- *
8
- * This program is free software; you can redistribute it and/or modify
9
- * it under the terms of the GNU General Public License as published by
10
- * the Free Software Foundation; version 2 of the License.
11
- *
12
- * This program is distributed in the hope that it will be useful, but
13
- * WITHOUT ANY WARRANTY; without even the implied warranty of
14
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15
- * General Public License for more details.
168 *
179 * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1810 */
....@@ -47,10 +39,10 @@
4739 snd_compr_drain_notify(cstream);
4840 }
4941
50
-static int sst_platform_compr_open(struct snd_compr_stream *cstream)
42
+static int sst_platform_compr_open(struct snd_soc_component *component,
43
+ struct snd_compr_stream *cstream)
5144 {
52
-
53
- int ret_val = 0;
45
+ int ret_val;
5446 struct snd_compr_runtime *runtime = cstream->runtime;
5547 struct sst_runtime_stream *stream;
5648
....@@ -80,7 +72,8 @@
8072 return ret_val;
8173 }
8274
83
-static int sst_platform_compr_free(struct snd_compr_stream *cstream)
75
+static int sst_platform_compr_free(struct snd_soc_component *component,
76
+ struct snd_compr_stream *cstream)
8477 {
8578 struct sst_runtime_stream *stream;
8679 int ret_val = 0, str_id;
....@@ -99,15 +92,14 @@
9992 return 0;
10093 }
10194
102
-static int sst_platform_compr_set_params(struct snd_compr_stream *cstream,
103
- struct snd_compr_params *params)
95
+static int sst_platform_compr_set_params(struct snd_soc_component *component,
96
+ struct snd_compr_stream *cstream,
97
+ struct snd_compr_params *params)
10498 {
10599 struct sst_runtime_stream *stream;
106100 int retval;
107101 struct snd_sst_params str_params;
108102 struct sst_compress_cb cb;
109
- struct snd_soc_pcm_runtime *rtd = cstream->private_data;
110
- struct snd_soc_component *component = snd_soc_rtdcom_lookup(rtd, DRV_NAME);
111103 struct sst_data *ctx = snd_soc_component_get_drvdata(component);
112104
113105 stream = cstream->runtime->private_data;
....@@ -174,7 +166,8 @@
174166 return 0;
175167 }
176168
177
-static int sst_platform_compr_trigger(struct snd_compr_stream *cstream, int cmd)
169
+static int sst_platform_compr_trigger(struct snd_soc_component *component,
170
+ struct snd_compr_stream *cstream, int cmd)
178171 {
179172 struct sst_runtime_stream *stream = cstream->runtime->private_data;
180173
....@@ -207,21 +200,23 @@
207200 return -EINVAL;
208201 }
209202
210
-static int sst_platform_compr_pointer(struct snd_compr_stream *cstream,
211
- struct snd_compr_tstamp *tstamp)
203
+static int sst_platform_compr_pointer(struct snd_soc_component *component,
204
+ struct snd_compr_stream *cstream,
205
+ struct snd_compr_tstamp *tstamp)
212206 {
213207 struct sst_runtime_stream *stream;
214208
215209 stream = cstream->runtime->private_data;
216210 stream->compr_ops->tstamp(sst->dev, stream->id, tstamp);
217
- div_u64_rem(tstamp->copied_total, (u32)cstream->runtime->buffer_size,
218
- &tstamp->byte_offset);
211
+ tstamp->byte_offset = tstamp->copied_total %
212
+ (u32)cstream->runtime->buffer_size;
219213 pr_debug("calc bytes offset/copied bytes as %d\n", tstamp->byte_offset);
220214 return 0;
221215 }
222216
223
-static int sst_platform_compr_ack(struct snd_compr_stream *cstream,
224
- size_t bytes)
217
+static int sst_platform_compr_ack(struct snd_soc_component *component,
218
+ struct snd_compr_stream *cstream,
219
+ size_t bytes)
225220 {
226221 struct sst_runtime_stream *stream;
227222
....@@ -232,8 +227,9 @@
232227 return 0;
233228 }
234229
235
-static int sst_platform_compr_get_caps(struct snd_compr_stream *cstream,
236
- struct snd_compr_caps *caps)
230
+static int sst_platform_compr_get_caps(struct snd_soc_component *component,
231
+ struct snd_compr_stream *cstream,
232
+ struct snd_compr_caps *caps)
237233 {
238234 struct sst_runtime_stream *stream =
239235 cstream->runtime->private_data;
....@@ -241,8 +237,9 @@
241237 return stream->compr_ops->get_caps(caps);
242238 }
243239
244
-static int sst_platform_compr_get_codec_caps(struct snd_compr_stream *cstream,
245
- struct snd_compr_codec_caps *codec)
240
+static int sst_platform_compr_get_codec_caps(struct snd_soc_component *component,
241
+ struct snd_compr_stream *cstream,
242
+ struct snd_compr_codec_caps *codec)
246243 {
247244 struct sst_runtime_stream *stream =
248245 cstream->runtime->private_data;
....@@ -250,8 +247,9 @@
250247 return stream->compr_ops->get_codec_caps(codec);
251248 }
252249
253
-static int sst_platform_compr_set_metadata(struct snd_compr_stream *cstream,
254
- struct snd_compr_metadata *metadata)
250
+static int sst_platform_compr_set_metadata(struct snd_soc_component *component,
251
+ struct snd_compr_stream *cstream,
252
+ struct snd_compr_metadata *metadata)
255253 {
256254 struct sst_runtime_stream *stream =
257255 cstream->runtime->private_data;
....@@ -259,7 +257,7 @@
259257 return stream->compr_ops->set_metadata(sst->dev, stream->id, metadata);
260258 }
261259
262
-const struct snd_compr_ops sst_platform_compr_ops = {
260
+const struct snd_compress_ops sst_platform_compress_ops = {
263261
264262 .open = sst_platform_compr_open,
265263 .free = sst_platform_compr_free,