| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * Copyright (C) ST-Ericsson SA 2012 |
|---|
| 3 | 4 | * |
|---|
| .. | .. |
|---|
| 6 | 7 | * for ST-Ericsson. |
|---|
| 7 | 8 | * |
|---|
| 8 | 9 | * License terms: |
|---|
| 9 | | - * |
|---|
| 10 | | - * This program is free software; you can redistribute it and/or modify |
|---|
| 11 | | - * it under the terms of the GNU General Public License version 2 as published |
|---|
| 12 | | - * by the Free Software Foundation. |
|---|
| 13 | 10 | */ |
|---|
| 14 | 11 | |
|---|
| 15 | 12 | #include <linux/module.h> |
|---|
| .. | .. |
|---|
| 193 | 190 | |
|---|
| 194 | 191 | static int mop500_ab8500_startup(struct snd_pcm_substream *substream) |
|---|
| 195 | 192 | { |
|---|
| 196 | | - struct snd_soc_pcm_runtime *rtd = substream->private_data; |
|---|
| 193 | + struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream); |
|---|
| 197 | 194 | |
|---|
| 198 | 195 | /* Set audio-clock source */ |
|---|
| 199 | 196 | return mop500_ab8500_set_mclk(rtd->card->dev, |
|---|
| .. | .. |
|---|
| 202 | 199 | |
|---|
| 203 | 200 | static void mop500_ab8500_shutdown(struct snd_pcm_substream *substream) |
|---|
| 204 | 201 | { |
|---|
| 205 | | - struct snd_soc_pcm_runtime *rtd = substream->private_data; |
|---|
| 202 | + struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream); |
|---|
| 206 | 203 | struct device *dev = rtd->card->dev; |
|---|
| 207 | 204 | |
|---|
| 208 | 205 | dev_dbg(dev, "%s: Enter\n", __func__); |
|---|
| .. | .. |
|---|
| 217 | 214 | static int mop500_ab8500_hw_params(struct snd_pcm_substream *substream, |
|---|
| 218 | 215 | struct snd_pcm_hw_params *params) |
|---|
| 219 | 216 | { |
|---|
| 220 | | - struct snd_soc_pcm_runtime *rtd = substream->private_data; |
|---|
| 221 | | - struct snd_soc_dai *codec_dai = rtd->codec_dai; |
|---|
| 222 | | - struct snd_soc_dai *cpu_dai = rtd->cpu_dai; |
|---|
| 217 | + struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream); |
|---|
| 218 | + struct snd_soc_dai *codec_dai = asoc_rtd_to_codec(rtd, 0); |
|---|
| 219 | + struct snd_soc_dai *cpu_dai = asoc_rtd_to_cpu(rtd, 0); |
|---|
| 223 | 220 | struct device *dev = rtd->card->dev; |
|---|
| 224 | 221 | unsigned int fmt; |
|---|
| 225 | 222 | int channels, ret = 0, driver_mode, slots; |
|---|
| .. | .. |
|---|
| 341 | 338 | |
|---|
| 342 | 339 | static int mop500_ab8500_hw_free(struct snd_pcm_substream *substream) |
|---|
| 343 | 340 | { |
|---|
| 344 | | - struct snd_soc_pcm_runtime *rtd = substream->private_data; |
|---|
| 345 | | - struct snd_soc_dai *cpu_dai = rtd->cpu_dai; |
|---|
| 341 | + struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream); |
|---|
| 342 | + struct snd_soc_dai *cpu_dai = asoc_rtd_to_cpu(rtd, 0); |
|---|
| 346 | 343 | |
|---|
| 347 | 344 | mutex_lock(&mop500_ab8500_params_lock); |
|---|
| 348 | 345 | __clear_bit(cpu_dai->id, &mop500_ab8500_usage); |
|---|