.. | .. |
---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
---|
1 | 2 | /* |
---|
2 | 3 | * sst_mfld_platform.c - Intel MID Platform driver |
---|
3 | 4 | * |
---|
4 | 5 | * Copyright (C) 2010-2014 Intel Corp |
---|
5 | 6 | * Author: Vinod Koul <vinod.koul@intel.com> |
---|
6 | 7 | * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
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. |
---|
16 | 8 | * |
---|
17 | 9 | * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
18 | 10 | */ |
---|
.. | .. |
---|
47 | 39 | snd_compr_drain_notify(cstream); |
---|
48 | 40 | } |
---|
49 | 41 | |
---|
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) |
---|
51 | 44 | { |
---|
52 | | - |
---|
53 | | - int ret_val = 0; |
---|
| 45 | + int ret_val; |
---|
54 | 46 | struct snd_compr_runtime *runtime = cstream->runtime; |
---|
55 | 47 | struct sst_runtime_stream *stream; |
---|
56 | 48 | |
---|
.. | .. |
---|
80 | 72 | return ret_val; |
---|
81 | 73 | } |
---|
82 | 74 | |
---|
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) |
---|
84 | 77 | { |
---|
85 | 78 | struct sst_runtime_stream *stream; |
---|
86 | 79 | int ret_val = 0, str_id; |
---|
.. | .. |
---|
99 | 92 | return 0; |
---|
100 | 93 | } |
---|
101 | 94 | |
---|
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) |
---|
104 | 98 | { |
---|
105 | 99 | struct sst_runtime_stream *stream; |
---|
106 | 100 | int retval; |
---|
107 | 101 | struct snd_sst_params str_params; |
---|
108 | 102 | 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); |
---|
111 | 103 | struct sst_data *ctx = snd_soc_component_get_drvdata(component); |
---|
112 | 104 | |
---|
113 | 105 | stream = cstream->runtime->private_data; |
---|
.. | .. |
---|
174 | 166 | return 0; |
---|
175 | 167 | } |
---|
176 | 168 | |
---|
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) |
---|
178 | 171 | { |
---|
179 | 172 | struct sst_runtime_stream *stream = cstream->runtime->private_data; |
---|
180 | 173 | |
---|
.. | .. |
---|
207 | 200 | return -EINVAL; |
---|
208 | 201 | } |
---|
209 | 202 | |
---|
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) |
---|
212 | 206 | { |
---|
213 | 207 | struct sst_runtime_stream *stream; |
---|
214 | 208 | |
---|
215 | 209 | stream = cstream->runtime->private_data; |
---|
216 | 210 | 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; |
---|
219 | 213 | pr_debug("calc bytes offset/copied bytes as %d\n", tstamp->byte_offset); |
---|
220 | 214 | return 0; |
---|
221 | 215 | } |
---|
222 | 216 | |
---|
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) |
---|
225 | 220 | { |
---|
226 | 221 | struct sst_runtime_stream *stream; |
---|
227 | 222 | |
---|
.. | .. |
---|
232 | 227 | return 0; |
---|
233 | 228 | } |
---|
234 | 229 | |
---|
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) |
---|
237 | 233 | { |
---|
238 | 234 | struct sst_runtime_stream *stream = |
---|
239 | 235 | cstream->runtime->private_data; |
---|
.. | .. |
---|
241 | 237 | return stream->compr_ops->get_caps(caps); |
---|
242 | 238 | } |
---|
243 | 239 | |
---|
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) |
---|
246 | 243 | { |
---|
247 | 244 | struct sst_runtime_stream *stream = |
---|
248 | 245 | cstream->runtime->private_data; |
---|
.. | .. |
---|
250 | 247 | return stream->compr_ops->get_codec_caps(codec); |
---|
251 | 248 | } |
---|
252 | 249 | |
---|
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) |
---|
255 | 253 | { |
---|
256 | 254 | struct sst_runtime_stream *stream = |
---|
257 | 255 | cstream->runtime->private_data; |
---|
.. | .. |
---|
259 | 257 | return stream->compr_ops->set_metadata(sst->dev, stream->id, metadata); |
---|
260 | 258 | } |
---|
261 | 259 | |
---|
262 | | -const struct snd_compr_ops sst_platform_compr_ops = { |
---|
| 260 | +const struct snd_compress_ops sst_platform_compress_ops = { |
---|
263 | 261 | |
---|
264 | 262 | .open = sst_platform_compr_open, |
---|
265 | 263 | .free = sst_platform_compr_free, |
---|