| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * SoC audio for EDB93xx |
|---|
| 3 | 4 | * |
|---|
| 4 | 5 | * Copyright (c) 2010 Alexander Sverdlin <subaparts@yandex.ru> |
|---|
| 5 | | - * |
|---|
| 6 | | - * This program is free software; you can redistribute it and/or |
|---|
| 7 | | - * modify it under the terms of the GNU General Public License |
|---|
| 8 | | - * as published by the Free Software Foundation; either version 2 |
|---|
| 9 | | - * of the License, or (at your option) any later version. |
|---|
| 10 | | - * |
|---|
| 11 | | - * This program is distributed in the hope that it will be useful, |
|---|
| 12 | | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| 13 | | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|---|
| 14 | | - * GNU General Public License for more details. |
|---|
| 15 | 6 | * |
|---|
| 16 | 7 | * This driver support CS4271 codec being master or slave, working |
|---|
| 17 | 8 | * in control port mode, connected either via SPI or I2C. |
|---|
| .. | .. |
|---|
| 22 | 13 | #include <linux/platform_device.h> |
|---|
| 23 | 14 | #include <linux/gpio.h> |
|---|
| 24 | 15 | #include <linux/module.h> |
|---|
| 16 | +#include <linux/soc/cirrus/ep93xx.h> |
|---|
| 25 | 17 | #include <sound/core.h> |
|---|
| 26 | 18 | #include <sound/pcm.h> |
|---|
| 27 | 19 | #include <sound/soc.h> |
|---|
| 28 | 20 | #include <asm/mach-types.h> |
|---|
| 29 | | -#include <mach/hardware.h> |
|---|
| 30 | 21 | |
|---|
| 31 | 22 | static int edb93xx_hw_params(struct snd_pcm_substream *substream, |
|---|
| 32 | 23 | struct snd_pcm_hw_params *params) |
|---|
| 33 | 24 | { |
|---|
| 34 | | - struct snd_soc_pcm_runtime *rtd = substream->private_data; |
|---|
| 35 | | - struct snd_soc_dai *codec_dai = rtd->codec_dai; |
|---|
| 36 | | - struct snd_soc_dai *cpu_dai = rtd->cpu_dai; |
|---|
| 25 | + struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream); |
|---|
| 26 | + struct snd_soc_dai *codec_dai = asoc_rtd_to_codec(rtd, 0); |
|---|
| 27 | + struct snd_soc_dai *cpu_dai = asoc_rtd_to_cpu(rtd, 0); |
|---|
| 37 | 28 | int err; |
|---|
| 38 | 29 | unsigned int mclk_rate; |
|---|
| 39 | 30 | unsigned int rate = params_rate(params); |
|---|
| .. | .. |
|---|
| 60 | 51 | .hw_params = edb93xx_hw_params, |
|---|
| 61 | 52 | }; |
|---|
| 62 | 53 | |
|---|
| 54 | +SND_SOC_DAILINK_DEFS(hifi, |
|---|
| 55 | + DAILINK_COMP_ARRAY(COMP_CPU("ep93xx-i2s")), |
|---|
| 56 | + DAILINK_COMP_ARRAY(COMP_CODEC("spi0.0", "cs4271-hifi")), |
|---|
| 57 | + DAILINK_COMP_ARRAY(COMP_PLATFORM("ep93xx-i2s"))); |
|---|
| 58 | + |
|---|
| 63 | 59 | static struct snd_soc_dai_link edb93xx_dai = { |
|---|
| 64 | 60 | .name = "CS4271", |
|---|
| 65 | 61 | .stream_name = "CS4271 HiFi", |
|---|
| 66 | | - .platform_name = "ep93xx-i2s", |
|---|
| 67 | | - .cpu_dai_name = "ep93xx-i2s", |
|---|
| 68 | | - .codec_name = "spi0.0", |
|---|
| 69 | | - .codec_dai_name = "cs4271-hifi", |
|---|
| 70 | 62 | .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF | |
|---|
| 71 | 63 | SND_SOC_DAIFMT_CBS_CFS, |
|---|
| 72 | 64 | .ops = &edb93xx_ops, |
|---|
| 65 | + SND_SOC_DAILINK_REG(hifi), |
|---|
| 73 | 66 | }; |
|---|
| 74 | 67 | |
|---|
| 75 | 68 | static struct snd_soc_card snd_soc_edb93xx = { |
|---|