| .. | .. |
|---|
| 1 | | -/* |
|---|
| 2 | | - * sound/soc/samsung/idma.c |
|---|
| 3 | | - * |
|---|
| 4 | | - * Copyright (c) 2011 Samsung Electronics Co., Ltd. |
|---|
| 5 | | - * http://www.samsung.com |
|---|
| 6 | | - * |
|---|
| 7 | | - * I2S0's Internal DMA driver |
|---|
| 8 | | - * |
|---|
| 9 | | - * This program is free software; you can redistribute it and/or modify it |
|---|
| 10 | | - * under the terms of the GNU General Public License as published by the |
|---|
| 11 | | - * Free Software Foundation; either version 2 of the License, or (at your |
|---|
| 12 | | - * option) any later version. |
|---|
| 13 | | - */ |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0+ |
|---|
| 2 | +// |
|---|
| 3 | +// idma.c - I2S0 internal DMA driver |
|---|
| 4 | +// |
|---|
| 5 | +// Copyright (c) 2011 Samsung Electronics Co., Ltd. |
|---|
| 6 | +// http://www.samsung.com |
|---|
| 7 | + |
|---|
| 14 | 8 | #include <linux/interrupt.h> |
|---|
| 15 | 9 | #include <linux/platform_device.h> |
|---|
| 16 | 10 | #include <linux/dma-mapping.h> |
|---|
| .. | .. |
|---|
| 143 | 137 | snd_pcm_period_elapsed(substream); |
|---|
| 144 | 138 | } |
|---|
| 145 | 139 | |
|---|
| 146 | | -static int idma_hw_params(struct snd_pcm_substream *substream, |
|---|
| 147 | | - struct snd_pcm_hw_params *params) |
|---|
| 140 | +static int idma_hw_params(struct snd_soc_component *component, |
|---|
| 141 | + struct snd_pcm_substream *substream, |
|---|
| 142 | + struct snd_pcm_hw_params *params) |
|---|
| 148 | 143 | { |
|---|
| 149 | 144 | struct snd_pcm_runtime *runtime = substream->runtime; |
|---|
| 150 | 145 | struct idma_ctrl *prtd = substream->runtime->private_data; |
|---|
| .. | .. |
|---|
| 169 | 164 | return 0; |
|---|
| 170 | 165 | } |
|---|
| 171 | 166 | |
|---|
| 172 | | -static int idma_hw_free(struct snd_pcm_substream *substream) |
|---|
| 167 | +static int idma_hw_free(struct snd_soc_component *component, |
|---|
| 168 | + struct snd_pcm_substream *substream) |
|---|
| 173 | 169 | { |
|---|
| 174 | 170 | snd_pcm_set_runtime_buffer(substream, NULL); |
|---|
| 175 | 171 | |
|---|
| 176 | 172 | return 0; |
|---|
| 177 | 173 | } |
|---|
| 178 | 174 | |
|---|
| 179 | | -static int idma_prepare(struct snd_pcm_substream *substream) |
|---|
| 175 | +static int idma_prepare(struct snd_soc_component *component, |
|---|
| 176 | + struct snd_pcm_substream *substream) |
|---|
| 180 | 177 | { |
|---|
| 181 | 178 | struct idma_ctrl *prtd = substream->runtime->private_data; |
|---|
| 182 | 179 | |
|---|
| .. | .. |
|---|
| 189 | 186 | return 0; |
|---|
| 190 | 187 | } |
|---|
| 191 | 188 | |
|---|
| 192 | | -static int idma_trigger(struct snd_pcm_substream *substream, int cmd) |
|---|
| 189 | +static int idma_trigger(struct snd_soc_component *component, |
|---|
| 190 | + struct snd_pcm_substream *substream, int cmd) |
|---|
| 193 | 191 | { |
|---|
| 194 | 192 | struct idma_ctrl *prtd = substream->runtime->private_data; |
|---|
| 195 | 193 | int ret = 0; |
|---|
| .. | .. |
|---|
| 222 | 220 | } |
|---|
| 223 | 221 | |
|---|
| 224 | 222 | static snd_pcm_uframes_t |
|---|
| 225 | | - idma_pointer(struct snd_pcm_substream *substream) |
|---|
| 223 | +idma_pointer(struct snd_soc_component *component, |
|---|
| 224 | + struct snd_pcm_substream *substream) |
|---|
| 226 | 225 | { |
|---|
| 227 | 226 | struct snd_pcm_runtime *runtime = substream->runtime; |
|---|
| 228 | 227 | struct idma_ctrl *prtd = runtime->private_data; |
|---|
| .. | .. |
|---|
| 239 | 238 | return bytes_to_frames(substream->runtime, res); |
|---|
| 240 | 239 | } |
|---|
| 241 | 240 | |
|---|
| 242 | | -static int idma_mmap(struct snd_pcm_substream *substream, |
|---|
| 241 | +static int idma_mmap(struct snd_soc_component *component, |
|---|
| 242 | + struct snd_pcm_substream *substream, |
|---|
| 243 | 243 | struct vm_area_struct *vma) |
|---|
| 244 | 244 | { |
|---|
| 245 | 245 | struct snd_pcm_runtime *runtime = substream->runtime; |
|---|
| .. | .. |
|---|
| 284 | 284 | return IRQ_HANDLED; |
|---|
| 285 | 285 | } |
|---|
| 286 | 286 | |
|---|
| 287 | | -static int idma_open(struct snd_pcm_substream *substream) |
|---|
| 287 | +static int idma_open(struct snd_soc_component *component, |
|---|
| 288 | + struct snd_pcm_substream *substream) |
|---|
| 288 | 289 | { |
|---|
| 289 | 290 | struct snd_pcm_runtime *runtime = substream->runtime; |
|---|
| 290 | 291 | struct idma_ctrl *prtd; |
|---|
| .. | .. |
|---|
| 310 | 311 | return 0; |
|---|
| 311 | 312 | } |
|---|
| 312 | 313 | |
|---|
| 313 | | -static int idma_close(struct snd_pcm_substream *substream) |
|---|
| 314 | +static int idma_close(struct snd_soc_component *component, |
|---|
| 315 | + struct snd_pcm_substream *substream) |
|---|
| 314 | 316 | { |
|---|
| 315 | 317 | struct snd_pcm_runtime *runtime = substream->runtime; |
|---|
| 316 | 318 | struct idma_ctrl *prtd = runtime->private_data; |
|---|
| .. | .. |
|---|
| 325 | 327 | return 0; |
|---|
| 326 | 328 | } |
|---|
| 327 | 329 | |
|---|
| 328 | | -static const struct snd_pcm_ops idma_ops = { |
|---|
| 329 | | - .open = idma_open, |
|---|
| 330 | | - .close = idma_close, |
|---|
| 331 | | - .ioctl = snd_pcm_lib_ioctl, |
|---|
| 332 | | - .trigger = idma_trigger, |
|---|
| 333 | | - .pointer = idma_pointer, |
|---|
| 334 | | - .mmap = idma_mmap, |
|---|
| 335 | | - .hw_params = idma_hw_params, |
|---|
| 336 | | - .hw_free = idma_hw_free, |
|---|
| 337 | | - .prepare = idma_prepare, |
|---|
| 338 | | -}; |
|---|
| 339 | | - |
|---|
| 340 | | -static void idma_free(struct snd_pcm *pcm) |
|---|
| 330 | +static void idma_free(struct snd_soc_component *component, |
|---|
| 331 | + struct snd_pcm *pcm) |
|---|
| 341 | 332 | { |
|---|
| 342 | 333 | struct snd_pcm_substream *substream; |
|---|
| 343 | 334 | struct snd_dma_buffer *buf; |
|---|
| .. | .. |
|---|
| 375 | 366 | return 0; |
|---|
| 376 | 367 | } |
|---|
| 377 | 368 | |
|---|
| 378 | | -static int idma_new(struct snd_soc_pcm_runtime *rtd) |
|---|
| 369 | +static int idma_new(struct snd_soc_component *component, |
|---|
| 370 | + struct snd_soc_pcm_runtime *rtd) |
|---|
| 379 | 371 | { |
|---|
| 380 | 372 | struct snd_card *card = rtd->card->snd_card; |
|---|
| 381 | 373 | struct snd_pcm *pcm = rtd->pcm; |
|---|
| .. | .. |
|---|
| 402 | 394 | EXPORT_SYMBOL_GPL(idma_reg_addr_init); |
|---|
| 403 | 395 | |
|---|
| 404 | 396 | static const struct snd_soc_component_driver asoc_idma_platform = { |
|---|
| 405 | | - .ops = &idma_ops, |
|---|
| 406 | | - .pcm_new = idma_new, |
|---|
| 407 | | - .pcm_free = idma_free, |
|---|
| 397 | + .open = idma_open, |
|---|
| 398 | + .close = idma_close, |
|---|
| 399 | + .trigger = idma_trigger, |
|---|
| 400 | + .pointer = idma_pointer, |
|---|
| 401 | + .mmap = idma_mmap, |
|---|
| 402 | + .hw_params = idma_hw_params, |
|---|
| 403 | + .hw_free = idma_hw_free, |
|---|
| 404 | + .prepare = idma_prepare, |
|---|
| 405 | + .pcm_construct = idma_new, |
|---|
| 406 | + .pcm_destruct = idma_free, |
|---|
| 408 | 407 | }; |
|---|
| 409 | 408 | |
|---|
| 410 | 409 | static int asoc_idma_platform_probe(struct platform_device *pdev) |
|---|