Merge branch 'topic/component-platform' of https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound into asoc-intel
This commit is contained in:
commit
a1f362d806
|
@ -161,4 +161,6 @@ int snd_dmaengine_pcm_prepare_slave_config(struct snd_pcm_substream *substream,
|
|||
struct snd_pcm_hw_params *params,
|
||||
struct dma_slave_config *slave_config);
|
||||
|
||||
#define SND_DMAENGINE_PCM_DRV_NAME "snd_dmaengine_pcm"
|
||||
|
||||
#endif
|
||||
|
|
|
@ -23,6 +23,8 @@
|
|||
#include <drm/amd_asic_type.h>
|
||||
#include "acp.h"
|
||||
|
||||
#define DRV_NAME "acp_audio_dma"
|
||||
|
||||
#define PLAYBACK_MIN_NUM_PERIODS 2
|
||||
#define PLAYBACK_MAX_NUM_PERIODS 2
|
||||
#define PLAYBACK_MAX_PERIOD_SIZE 16384
|
||||
|
@ -702,8 +704,8 @@ static int acp_dma_open(struct snd_pcm_substream *substream)
|
|||
int ret = 0;
|
||||
struct snd_pcm_runtime *runtime = substream->runtime;
|
||||
struct snd_soc_pcm_runtime *prtd = substream->private_data;
|
||||
struct audio_drv_data *intr_data = dev_get_drvdata(prtd->platform->dev);
|
||||
|
||||
struct snd_soc_component *component = snd_soc_rtdcom_lookup(prtd, DRV_NAME);
|
||||
struct audio_drv_data *intr_data = dev_get_drvdata(component->dev);
|
||||
struct audio_substream_data *adata =
|
||||
kzalloc(sizeof(struct audio_substream_data), GFP_KERNEL);
|
||||
if (adata == NULL)
|
||||
|
@ -730,7 +732,7 @@ static int acp_dma_open(struct snd_pcm_substream *substream)
|
|||
ret = snd_pcm_hw_constraint_integer(runtime,
|
||||
SNDRV_PCM_HW_PARAM_PERIODS);
|
||||
if (ret < 0) {
|
||||
dev_err(prtd->platform->dev, "set integer constraint failed\n");
|
||||
dev_err(component->dev, "set integer constraint failed\n");
|
||||
kfree(adata);
|
||||
return ret;
|
||||
}
|
||||
|
@ -778,7 +780,8 @@ static int acp_dma_hw_params(struct snd_pcm_substream *substream,
|
|||
struct snd_pcm_runtime *runtime;
|
||||
struct audio_substream_data *rtd;
|
||||
struct snd_soc_pcm_runtime *prtd = substream->private_data;
|
||||
struct audio_drv_data *adata = dev_get_drvdata(prtd->platform->dev);
|
||||
struct snd_soc_component *component = snd_soc_rtdcom_lookup(prtd, DRV_NAME);
|
||||
struct audio_drv_data *adata = dev_get_drvdata(component->dev);
|
||||
|
||||
runtime = substream->runtime;
|
||||
rtd = runtime->private_data;
|
||||
|
@ -907,6 +910,7 @@ static int acp_dma_trigger(struct snd_pcm_substream *substream, int cmd)
|
|||
struct snd_pcm_runtime *runtime = substream->runtime;
|
||||
struct snd_soc_pcm_runtime *prtd = substream->private_data;
|
||||
struct audio_substream_data *rtd = runtime->private_data;
|
||||
struct snd_soc_component *component = snd_soc_rtdcom_lookup(prtd, DRV_NAME);
|
||||
|
||||
if (!rtd)
|
||||
return -EINVAL;
|
||||
|
@ -924,7 +928,7 @@ static int acp_dma_trigger(struct snd_pcm_substream *substream, int cmd)
|
|||
while (acp_reg_read(rtd->acp_mmio, mmACP_DMA_CH_STS) &
|
||||
BIT(SYSRAM_TO_ACP_CH_NUM)) {
|
||||
if (!loops--) {
|
||||
dev_err(prtd->platform->dev,
|
||||
dev_err(component->dev,
|
||||
"acp dma start timeout\n");
|
||||
return -ETIMEDOUT;
|
||||
}
|
||||
|
@ -970,7 +974,8 @@ static int acp_dma_trigger(struct snd_pcm_substream *substream, int cmd)
|
|||
static int acp_dma_new(struct snd_soc_pcm_runtime *rtd)
|
||||
{
|
||||
int ret;
|
||||
struct audio_drv_data *adata = dev_get_drvdata(rtd->platform->dev);
|
||||
struct snd_soc_component *component = snd_soc_rtdcom_lookup(rtd, DRV_NAME);
|
||||
struct audio_drv_data *adata = dev_get_drvdata(component->dev);
|
||||
|
||||
switch (adata->asic_type) {
|
||||
case CHIP_STONEY:
|
||||
|
@ -987,7 +992,7 @@ static int acp_dma_new(struct snd_soc_pcm_runtime *rtd)
|
|||
break;
|
||||
}
|
||||
if (ret < 0)
|
||||
dev_err(rtd->platform->dev,
|
||||
dev_err(component->dev,
|
||||
"buffer preallocation failer error:%d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
@ -998,7 +1003,8 @@ static int acp_dma_close(struct snd_pcm_substream *substream)
|
|||
struct snd_pcm_runtime *runtime = substream->runtime;
|
||||
struct audio_substream_data *rtd = runtime->private_data;
|
||||
struct snd_soc_pcm_runtime *prtd = substream->private_data;
|
||||
struct audio_drv_data *adata = dev_get_drvdata(prtd->platform->dev);
|
||||
struct snd_soc_component *component = snd_soc_rtdcom_lookup(prtd, DRV_NAME);
|
||||
struct audio_drv_data *adata = dev_get_drvdata(component->dev);
|
||||
|
||||
kfree(rtd);
|
||||
|
||||
|
@ -1044,7 +1050,8 @@ static const struct snd_pcm_ops acp_dma_ops = {
|
|||
.prepare = acp_dma_prepare,
|
||||
};
|
||||
|
||||
static struct snd_soc_platform_driver acp_asoc_platform = {
|
||||
static struct snd_soc_component_driver acp_asoc_platform = {
|
||||
.name = DRV_NAME,
|
||||
.ops = &acp_dma_ops,
|
||||
.pcm_new = acp_dma_new,
|
||||
};
|
||||
|
@ -1102,7 +1109,8 @@ static int acp_audio_probe(struct platform_device *pdev)
|
|||
return status;
|
||||
}
|
||||
|
||||
status = snd_soc_register_platform(&pdev->dev, &acp_asoc_platform);
|
||||
status = devm_snd_soc_register_component(&pdev->dev,
|
||||
&acp_asoc_platform, NULL, 0);
|
||||
if (status != 0) {
|
||||
dev_err(&pdev->dev, "Fail to register ALSA platform device\n");
|
||||
return status;
|
||||
|
@ -1123,7 +1131,6 @@ static int acp_audio_remove(struct platform_device *pdev)
|
|||
status = acp_deinit(adata->acp_mmio);
|
||||
if (status)
|
||||
dev_err(&pdev->dev, "ACP Deinit failed status:%d\n", status);
|
||||
snd_soc_unregister_platform(&pdev->dev);
|
||||
pm_runtime_disable(&pdev->dev);
|
||||
|
||||
return 0;
|
||||
|
|
|
@ -32,6 +32,7 @@ struct atmel_classd {
|
|||
struct regmap *regmap;
|
||||
struct clk *pclk;
|
||||
struct clk *gclk;
|
||||
struct device *dev;
|
||||
int irq;
|
||||
const struct atmel_classd_pdata *pdata;
|
||||
};
|
||||
|
@ -165,7 +166,7 @@ atmel_classd_platform_configure_dma(struct snd_pcm_substream *substream,
|
|||
struct atmel_classd *dd = snd_soc_card_get_drvdata(rtd->card);
|
||||
|
||||
if (params_physical_width(params) != 16) {
|
||||
dev_err(rtd->platform->dev,
|
||||
dev_err(dd->dev,
|
||||
"only supports 16-bit audio data\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
@ -587,6 +588,7 @@ static int atmel_classd_probe(struct platform_device *pdev)
|
|||
}
|
||||
|
||||
dd->phy_base = res->start;
|
||||
dd->dev = dev;
|
||||
|
||||
dd->regmap = devm_regmap_init_mmio(dev, io_base,
|
||||
&atmel_classd_regmap_config);
|
||||
|
|
|
@ -393,7 +393,7 @@ static const struct snd_pcm_ops atmel_pcm_ops = {
|
|||
.mmap = atmel_pcm_mmap,
|
||||
};
|
||||
|
||||
static struct snd_soc_platform_driver atmel_soc_platform = {
|
||||
static struct snd_soc_component_driver atmel_soc_platform = {
|
||||
.ops = &atmel_pcm_ops,
|
||||
.pcm_new = atmel_pcm_new,
|
||||
.pcm_free = atmel_pcm_free,
|
||||
|
@ -401,13 +401,13 @@ static struct snd_soc_platform_driver atmel_soc_platform = {
|
|||
|
||||
int atmel_pcm_pdc_platform_register(struct device *dev)
|
||||
{
|
||||
return snd_soc_register_platform(dev, &atmel_soc_platform);
|
||||
return devm_snd_soc_register_component(dev, &atmel_soc_platform,
|
||||
NULL, 0);
|
||||
}
|
||||
EXPORT_SYMBOL(atmel_pcm_pdc_platform_register);
|
||||
|
||||
void atmel_pcm_pdc_platform_unregister(struct device *dev)
|
||||
{
|
||||
snd_soc_unregister_platform(dev);
|
||||
}
|
||||
EXPORT_SYMBOL(atmel_pcm_pdc_platform_unregister);
|
||||
|
||||
|
|
|
@ -32,6 +32,7 @@ struct atmel_pdmic {
|
|||
struct regmap *regmap;
|
||||
struct clk *pclk;
|
||||
struct clk *gclk;
|
||||
struct device *dev;
|
||||
int irq;
|
||||
struct snd_pcm_substream *substream;
|
||||
const struct atmel_pdmic_pdata *pdata;
|
||||
|
@ -206,7 +207,7 @@ atmel_pdmic_platform_configure_dma(struct snd_pcm_substream *substream,
|
|||
ret = snd_hwparams_to_dma_slave_config(substream, params,
|
||||
slave_config);
|
||||
if (ret) {
|
||||
dev_err(rtd->platform->dev,
|
||||
dev_err(dd->dev,
|
||||
"hw params to dma slave configure failed\n");
|
||||
return ret;
|
||||
}
|
||||
|
@ -596,6 +597,7 @@ static int atmel_pdmic_probe(struct platform_device *pdev)
|
|||
return -ENOMEM;
|
||||
|
||||
dd->pdata = pdata;
|
||||
dd->dev = dev;
|
||||
|
||||
dd->irq = platform_get_irq(pdev, 0);
|
||||
if (dd->irq < 0) {
|
||||
|
|
|
@ -32,6 +32,8 @@
|
|||
|
||||
/*#define PCM_DEBUG*/
|
||||
|
||||
#define DRV_NAME "dbdma2"
|
||||
|
||||
#define MSG(x...) printk(KERN_INFO "au1xpsc_pcm: " x)
|
||||
#ifdef PCM_DEBUG
|
||||
#define DBG MSG
|
||||
|
@ -187,8 +189,8 @@ out:
|
|||
static inline struct au1xpsc_audio_dmadata *to_dmadata(struct snd_pcm_substream *ss)
|
||||
{
|
||||
struct snd_soc_pcm_runtime *rtd = ss->private_data;
|
||||
struct au1xpsc_audio_dmadata *pcd =
|
||||
snd_soc_platform_get_drvdata(rtd->platform);
|
||||
struct snd_soc_component *component = snd_soc_rtdcom_lookup(rtd, DRV_NAME);
|
||||
struct au1xpsc_audio_dmadata *pcd = snd_soc_component_get_drvdata(component);
|
||||
return &pcd[ss->stream];
|
||||
}
|
||||
|
||||
|
@ -327,7 +329,8 @@ static int au1xpsc_pcm_new(struct snd_soc_pcm_runtime *rtd)
|
|||
}
|
||||
|
||||
/* au1xpsc audio platform */
|
||||
static struct snd_soc_platform_driver au1xpsc_soc_platform = {
|
||||
static struct snd_soc_component_driver au1xpsc_soc_component = {
|
||||
.name = DRV_NAME,
|
||||
.ops = &au1xpsc_pcm_ops,
|
||||
.pcm_new = au1xpsc_pcm_new,
|
||||
};
|
||||
|
@ -344,8 +347,8 @@ static int au1xpsc_pcm_drvprobe(struct platform_device *pdev)
|
|||
|
||||
platform_set_drvdata(pdev, dmadata);
|
||||
|
||||
return devm_snd_soc_register_platform(&pdev->dev,
|
||||
&au1xpsc_soc_platform);
|
||||
return devm_snd_soc_register_component(&pdev->dev,
|
||||
&au1xpsc_soc_component, NULL, 0);
|
||||
}
|
||||
|
||||
static struct platform_driver au1xpsc_pcm_driver = {
|
||||
|
|
|
@ -21,6 +21,8 @@
|
|||
|
||||
#include "psc.h"
|
||||
|
||||
#define DRV_NAME "au1x_dma"
|
||||
|
||||
struct pcm_period {
|
||||
u32 start;
|
||||
u32 relative_end; /* relative to start of buffer */
|
||||
|
@ -174,7 +176,8 @@ static const struct snd_pcm_hardware alchemy_pcm_hardware = {
|
|||
static inline struct alchemy_pcm_ctx *ss_to_ctx(struct snd_pcm_substream *ss)
|
||||
{
|
||||
struct snd_soc_pcm_runtime *rtd = ss->private_data;
|
||||
return snd_soc_platform_get_drvdata(rtd->platform);
|
||||
struct snd_soc_component *component = snd_soc_rtdcom_lookup(rtd, DRV_NAME);
|
||||
return snd_soc_component_get_drvdata(component);
|
||||
}
|
||||
|
||||
static inline struct audio_stream *ss_to_as(struct snd_pcm_substream *ss)
|
||||
|
@ -297,7 +300,8 @@ static int alchemy_pcm_new(struct snd_soc_pcm_runtime *rtd)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static struct snd_soc_platform_driver alchemy_pcm_soc_platform = {
|
||||
static struct snd_soc_component_driver alchemy_pcm_soc_component = {
|
||||
.name = DRV_NAME,
|
||||
.ops = &alchemy_pcm_ops,
|
||||
.pcm_new = alchemy_pcm_new,
|
||||
};
|
||||
|
@ -312,8 +316,8 @@ static int alchemy_pcm_drvprobe(struct platform_device *pdev)
|
|||
|
||||
platform_set_drvdata(pdev, ctx);
|
||||
|
||||
return devm_snd_soc_register_platform(&pdev->dev,
|
||||
&alchemy_pcm_soc_platform);
|
||||
return devm_snd_soc_register_component(&pdev->dev,
|
||||
&alchemy_pcm_soc_component, NULL, 0);
|
||||
}
|
||||
|
||||
static struct platform_driver alchemy_pcmdma_driver = {
|
||||
|
|
|
@ -820,7 +820,7 @@ static int cygnus_dma_new(struct snd_soc_pcm_runtime *rtd)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static struct snd_soc_platform_driver cygnus_soc_platform = {
|
||||
static struct snd_soc_component_driver cygnus_soc_platform = {
|
||||
.ops = &cygnus_pcm_ops,
|
||||
.pcm_new = cygnus_dma_new,
|
||||
.pcm_free = cygnus_dma_free_dma_buffers,
|
||||
|
@ -840,7 +840,8 @@ int cygnus_soc_platform_register(struct device *dev,
|
|||
return rc;
|
||||
}
|
||||
|
||||
rc = snd_soc_register_platform(dev, &cygnus_soc_platform);
|
||||
rc = devm_snd_soc_register_component(dev, &cygnus_soc_platform,
|
||||
NULL, 0);
|
||||
if (rc) {
|
||||
dev_err(dev, "%s failed\n", __func__);
|
||||
return rc;
|
||||
|
@ -851,8 +852,6 @@ int cygnus_soc_platform_register(struct device *dev,
|
|||
|
||||
int cygnus_soc_platform_unregister(struct device *dev)
|
||||
{
|
||||
snd_soc_unregister_platform(dev);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -453,7 +453,7 @@ static int bf5xx_pcm_ac97_new(struct snd_soc_pcm_runtime *rtd)
|
|||
return ret;
|
||||
}
|
||||
|
||||
static struct snd_soc_platform_driver bf5xx_ac97_soc_platform = {
|
||||
static struct snd_soc_component_driver bf5xx_ac97_soc_component = {
|
||||
.ops = &bf5xx_pcm_ac97_ops,
|
||||
.pcm_new = bf5xx_pcm_ac97_new,
|
||||
.pcm_free = bf5xx_pcm_free_dma_buffers,
|
||||
|
@ -461,8 +461,8 @@ static struct snd_soc_platform_driver bf5xx_ac97_soc_platform = {
|
|||
|
||||
static int bf5xx_soc_platform_probe(struct platform_device *pdev)
|
||||
{
|
||||
return devm_snd_soc_register_platform(&pdev->dev,
|
||||
&bf5xx_ac97_soc_platform);
|
||||
return devm_snd_soc_register_component(&pdev->dev,
|
||||
&bf5xx_ac97_soc_component, NULL, 0);
|
||||
}
|
||||
|
||||
static struct platform_driver bf5xx_pcm_driver = {
|
||||
|
|
|
@ -347,15 +347,15 @@ static int bf5xx_pcm_i2s_new(struct snd_soc_pcm_runtime *rtd)
|
|||
SNDRV_DMA_TYPE_DEV, card->dev, size, size);
|
||||
}
|
||||
|
||||
static struct snd_soc_platform_driver bf5xx_i2s_soc_platform = {
|
||||
static struct snd_soc_component_driver bf5xx_i2s_soc_component = {
|
||||
.ops = &bf5xx_pcm_i2s_ops,
|
||||
.pcm_new = bf5xx_pcm_i2s_new,
|
||||
};
|
||||
|
||||
static int bfin_i2s_soc_platform_probe(struct platform_device *pdev)
|
||||
{
|
||||
return devm_snd_soc_register_platform(&pdev->dev,
|
||||
&bf5xx_i2s_soc_platform);
|
||||
return devm_snd_soc_register_component(&pdev->dev,
|
||||
&bf5xx_i2s_soc_component, NULL, 0);
|
||||
}
|
||||
|
||||
static struct platform_driver bfin_i2s_pcm_driver = {
|
||||
|
|
|
@ -33,6 +33,8 @@
|
|||
#include "wm_adsp.h"
|
||||
#include "cs47l24.h"
|
||||
|
||||
#define DRV_NAME "cs47l24-codec"
|
||||
|
||||
struct cs47l24_priv {
|
||||
struct arizona_priv core;
|
||||
struct arizona_fll fll[2];
|
||||
|
@ -1069,7 +1071,8 @@ static struct snd_soc_dai_driver cs47l24_dai[] = {
|
|||
static int cs47l24_open(struct snd_compr_stream *stream)
|
||||
{
|
||||
struct snd_soc_pcm_runtime *rtd = stream->private_data;
|
||||
struct cs47l24_priv *priv = snd_soc_platform_get_drvdata(rtd->platform);
|
||||
struct snd_soc_component *component = snd_soc_rtdcom_lookup(rtd, DRV_NAME);
|
||||
struct cs47l24_priv *priv = snd_soc_component_get_drvdata(component);
|
||||
struct arizona *arizona = priv->core.arizona;
|
||||
int n_adsp;
|
||||
|
||||
|
@ -1177,6 +1180,16 @@ static unsigned int cs47l24_digital_vu[] = {
|
|||
ARIZONA_DAC_DIGITAL_VOLUME_4L,
|
||||
};
|
||||
|
||||
static struct snd_compr_ops cs47l24_compr_ops = {
|
||||
.open = cs47l24_open,
|
||||
.free = wm_adsp_compr_free,
|
||||
.set_params = wm_adsp_compr_set_params,
|
||||
.get_caps = wm_adsp_compr_get_caps,
|
||||
.trigger = wm_adsp_compr_trigger,
|
||||
.pointer = wm_adsp_compr_pointer,
|
||||
.copy = wm_adsp_compr_copy,
|
||||
};
|
||||
|
||||
static const struct snd_soc_codec_driver soc_codec_dev_cs47l24 = {
|
||||
.probe = cs47l24_codec_probe,
|
||||
.remove = cs47l24_codec_remove,
|
||||
|
@ -1187,6 +1200,8 @@ static const struct snd_soc_codec_driver soc_codec_dev_cs47l24 = {
|
|||
.set_pll = cs47l24_set_fll,
|
||||
|
||||
.component_driver = {
|
||||
.name = DRV_NAME,
|
||||
.compr_ops = &cs47l24_compr_ops,
|
||||
.controls = cs47l24_snd_controls,
|
||||
.num_controls = ARRAY_SIZE(cs47l24_snd_controls),
|
||||
.dapm_widgets = cs47l24_dapm_widgets,
|
||||
|
@ -1196,20 +1211,6 @@ static const struct snd_soc_codec_driver soc_codec_dev_cs47l24 = {
|
|||
},
|
||||
};
|
||||
|
||||
static const struct snd_compr_ops cs47l24_compr_ops = {
|
||||
.open = cs47l24_open,
|
||||
.free = wm_adsp_compr_free,
|
||||
.set_params = wm_adsp_compr_set_params,
|
||||
.get_caps = wm_adsp_compr_get_caps,
|
||||
.trigger = wm_adsp_compr_trigger,
|
||||
.pointer = wm_adsp_compr_pointer,
|
||||
.copy = wm_adsp_compr_copy,
|
||||
};
|
||||
|
||||
static const struct snd_soc_platform_driver cs47l24_compr_platform = {
|
||||
.compr_ops = &cs47l24_compr_ops,
|
||||
};
|
||||
|
||||
static int cs47l24_probe(struct platform_device *pdev)
|
||||
{
|
||||
struct arizona *arizona = dev_get_drvdata(pdev->dev.parent);
|
||||
|
@ -1298,23 +1299,15 @@ static int cs47l24_probe(struct platform_device *pdev)
|
|||
if (ret < 0)
|
||||
goto err_dsp_irq;
|
||||
|
||||
ret = snd_soc_register_platform(&pdev->dev, &cs47l24_compr_platform);
|
||||
if (ret < 0) {
|
||||
dev_err(&pdev->dev, "Failed to register platform: %d\n", ret);
|
||||
goto err_spk_irqs;
|
||||
}
|
||||
|
||||
ret = snd_soc_register_codec(&pdev->dev, &soc_codec_dev_cs47l24,
|
||||
cs47l24_dai, ARRAY_SIZE(cs47l24_dai));
|
||||
if (ret < 0) {
|
||||
dev_err(&pdev->dev, "Failed to register codec: %d\n", ret);
|
||||
goto err_platform;
|
||||
goto err_spk_irqs;
|
||||
}
|
||||
|
||||
return ret;
|
||||
|
||||
err_platform:
|
||||
snd_soc_unregister_platform(&pdev->dev);
|
||||
err_spk_irqs:
|
||||
arizona_free_spk_irqs(arizona);
|
||||
err_dsp_irq:
|
||||
|
@ -1328,7 +1321,6 @@ static int cs47l24_remove(struct platform_device *pdev)
|
|||
struct cs47l24_priv *cs47l24 = platform_get_drvdata(pdev);
|
||||
struct arizona *arizona = cs47l24->core.arizona;
|
||||
|
||||
snd_soc_unregister_platform(&pdev->dev);
|
||||
snd_soc_unregister_codec(&pdev->dev);
|
||||
pm_runtime_disable(&pdev->dev);
|
||||
|
||||
|
|
|
@ -35,6 +35,8 @@
|
|||
|
||||
#include "rt5514-spi.h"
|
||||
|
||||
#define DRV_NAME "rt5514-spi"
|
||||
|
||||
static struct spi_device *rt5514_spi;
|
||||
|
||||
struct rt5514_dsp {
|
||||
|
@ -211,8 +213,9 @@ static int rt5514_spi_hw_params(struct snd_pcm_substream *substream,
|
|||
struct snd_pcm_hw_params *hw_params)
|
||||
{
|
||||
struct snd_soc_pcm_runtime *rtd = substream->private_data;
|
||||
struct snd_soc_component *component = snd_soc_rtdcom_lookup(rtd, DRV_NAME);
|
||||
struct rt5514_dsp *rt5514_dsp =
|
||||
snd_soc_platform_get_drvdata(rtd->platform);
|
||||
snd_soc_component_get_drvdata(component);
|
||||
int ret;
|
||||
u8 buf[8];
|
||||
|
||||
|
@ -235,8 +238,9 @@ static int rt5514_spi_hw_params(struct snd_pcm_substream *substream,
|
|||
static int rt5514_spi_hw_free(struct snd_pcm_substream *substream)
|
||||
{
|
||||
struct snd_soc_pcm_runtime *rtd = substream->private_data;
|
||||
struct snd_soc_component *component = snd_soc_rtdcom_lookup(rtd, DRV_NAME);
|
||||
struct rt5514_dsp *rt5514_dsp =
|
||||
snd_soc_platform_get_drvdata(rtd->platform);
|
||||
snd_soc_component_get_drvdata(component);
|
||||
|
||||
mutex_lock(&rt5514_dsp->dma_lock);
|
||||
rt5514_dsp->substream = NULL;
|
||||
|
@ -252,8 +256,9 @@ static snd_pcm_uframes_t rt5514_spi_pcm_pointer(
|
|||
{
|
||||
struct snd_pcm_runtime *runtime = substream->runtime;
|
||||
struct snd_soc_pcm_runtime *rtd = substream->private_data;
|
||||
struct snd_soc_component *component = snd_soc_rtdcom_lookup(rtd, DRV_NAME);
|
||||
struct rt5514_dsp *rt5514_dsp =
|
||||
snd_soc_platform_get_drvdata(rtd->platform);
|
||||
snd_soc_component_get_drvdata(component);
|
||||
|
||||
return bytes_to_frames(runtime, rt5514_dsp->dma_offset);
|
||||
}
|
||||
|
@ -267,18 +272,18 @@ static const struct snd_pcm_ops rt5514_spi_pcm_ops = {
|
|||
.page = snd_pcm_lib_get_vmalloc_page,
|
||||
};
|
||||
|
||||
static int rt5514_spi_pcm_probe(struct snd_soc_platform *platform)
|
||||
static int rt5514_spi_pcm_probe(struct snd_soc_component *component)
|
||||
{
|
||||
struct rt5514_dsp *rt5514_dsp;
|
||||
int ret;
|
||||
|
||||
rt5514_dsp = devm_kzalloc(platform->dev, sizeof(*rt5514_dsp),
|
||||
rt5514_dsp = devm_kzalloc(component->dev, sizeof(*rt5514_dsp),
|
||||
GFP_KERNEL);
|
||||
|
||||
rt5514_dsp->dev = &rt5514_spi->dev;
|
||||
mutex_init(&rt5514_dsp->dma_lock);
|
||||
INIT_DELAYED_WORK(&rt5514_dsp->copy_work, rt5514_spi_copy_work);
|
||||
snd_soc_platform_set_drvdata(platform, rt5514_dsp);
|
||||
snd_soc_component_set_drvdata(component, rt5514_dsp);
|
||||
|
||||
if (rt5514_spi->irq) {
|
||||
ret = devm_request_threaded_irq(&rt5514_spi->dev,
|
||||
|
@ -296,15 +301,12 @@ static int rt5514_spi_pcm_probe(struct snd_soc_platform *platform)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static const struct snd_soc_platform_driver rt5514_spi_platform = {
|
||||
static const struct snd_soc_component_driver rt5514_spi_component = {
|
||||
.name = DRV_NAME,
|
||||
.probe = rt5514_spi_pcm_probe,
|
||||
.ops = &rt5514_spi_pcm_ops,
|
||||
};
|
||||
|
||||
static const struct snd_soc_component_driver rt5514_spi_dai_component = {
|
||||
.name = "rt5514-spi-dai",
|
||||
};
|
||||
|
||||
/**
|
||||
* rt5514_spi_burst_read - Read data from SPI by rt5514 address.
|
||||
* @addr: Start address.
|
||||
|
@ -445,14 +447,8 @@ static int rt5514_spi_probe(struct spi_device *spi)
|
|||
|
||||
rt5514_spi = spi;
|
||||
|
||||
ret = devm_snd_soc_register_platform(&spi->dev, &rt5514_spi_platform);
|
||||
if (ret < 0) {
|
||||
dev_err(&spi->dev, "Failed to register platform.\n");
|
||||
return ret;
|
||||
}
|
||||
|
||||
ret = devm_snd_soc_register_component(&spi->dev,
|
||||
&rt5514_spi_dai_component,
|
||||
&rt5514_spi_component,
|
||||
&rt5514_spi_dai, 1);
|
||||
if (ret < 0) {
|
||||
dev_err(&spi->dev, "Failed to register component.\n");
|
||||
|
|
|
@ -34,6 +34,8 @@
|
|||
#include "wm5102.h"
|
||||
#include "wm_adsp.h"
|
||||
|
||||
#define DRV_NAME "wm5102-codec"
|
||||
|
||||
struct wm5102_priv {
|
||||
struct arizona_priv core;
|
||||
struct arizona_fll fll[2];
|
||||
|
@ -1910,7 +1912,8 @@ static struct snd_soc_dai_driver wm5102_dai[] = {
|
|||
static int wm5102_open(struct snd_compr_stream *stream)
|
||||
{
|
||||
struct snd_soc_pcm_runtime *rtd = stream->private_data;
|
||||
struct wm5102_priv *priv = snd_soc_platform_get_drvdata(rtd->platform);
|
||||
struct snd_soc_component *component = snd_soc_rtdcom_lookup(rtd, DRV_NAME);
|
||||
struct wm5102_priv *priv = snd_soc_component_get_drvdata(component);
|
||||
|
||||
return wm_adsp_compr_open(&priv->core.adsp[0], stream);
|
||||
}
|
||||
|
@ -1992,6 +1995,16 @@ static unsigned int wm5102_digital_vu[] = {
|
|||
ARIZONA_DAC_DIGITAL_VOLUME_5R,
|
||||
};
|
||||
|
||||
static struct snd_compr_ops wm5102_compr_ops = {
|
||||
.open = wm5102_open,
|
||||
.free = wm_adsp_compr_free,
|
||||
.set_params = wm_adsp_compr_set_params,
|
||||
.get_caps = wm_adsp_compr_get_caps,
|
||||
.trigger = wm_adsp_compr_trigger,
|
||||
.pointer = wm_adsp_compr_pointer,
|
||||
.copy = wm_adsp_compr_copy,
|
||||
};
|
||||
|
||||
static const struct snd_soc_codec_driver soc_codec_dev_wm5102 = {
|
||||
.probe = wm5102_codec_probe,
|
||||
.remove = wm5102_codec_remove,
|
||||
|
@ -2002,6 +2015,8 @@ static const struct snd_soc_codec_driver soc_codec_dev_wm5102 = {
|
|||
.set_pll = wm5102_set_fll,
|
||||
|
||||
.component_driver = {
|
||||
.name = DRV_NAME,
|
||||
.compr_ops = &wm5102_compr_ops,
|
||||
.controls = wm5102_snd_controls,
|
||||
.num_controls = ARRAY_SIZE(wm5102_snd_controls),
|
||||
.dapm_widgets = wm5102_dapm_widgets,
|
||||
|
@ -2011,20 +2026,6 @@ static const struct snd_soc_codec_driver soc_codec_dev_wm5102 = {
|
|||
},
|
||||
};
|
||||
|
||||
static const struct snd_compr_ops wm5102_compr_ops = {
|
||||
.open = wm5102_open,
|
||||
.free = wm_adsp_compr_free,
|
||||
.set_params = wm_adsp_compr_set_params,
|
||||
.get_caps = wm_adsp_compr_get_caps,
|
||||
.trigger = wm_adsp_compr_trigger,
|
||||
.pointer = wm_adsp_compr_pointer,
|
||||
.copy = wm_adsp_compr_copy,
|
||||
};
|
||||
|
||||
static const struct snd_soc_platform_driver wm5102_compr_platform = {
|
||||
.compr_ops = &wm5102_compr_ops,
|
||||
};
|
||||
|
||||
static int wm5102_probe(struct platform_device *pdev)
|
||||
{
|
||||
struct arizona *arizona = dev_get_drvdata(pdev->dev.parent);
|
||||
|
@ -2109,23 +2110,15 @@ static int wm5102_probe(struct platform_device *pdev)
|
|||
if (ret < 0)
|
||||
goto err_dsp_irq;
|
||||
|
||||
ret = snd_soc_register_platform(&pdev->dev, &wm5102_compr_platform);
|
||||
if (ret < 0) {
|
||||
dev_err(&pdev->dev, "Failed to register platform: %d\n", ret);
|
||||
goto err_spk_irqs;
|
||||
}
|
||||
|
||||
ret = snd_soc_register_codec(&pdev->dev, &soc_codec_dev_wm5102,
|
||||
wm5102_dai, ARRAY_SIZE(wm5102_dai));
|
||||
if (ret < 0) {
|
||||
dev_err(&pdev->dev, "Failed to register codec: %d\n", ret);
|
||||
goto err_platform;
|
||||
goto err_spk_irqs;
|
||||
}
|
||||
|
||||
return ret;
|
||||
|
||||
err_platform:
|
||||
snd_soc_unregister_platform(&pdev->dev);
|
||||
err_spk_irqs:
|
||||
arizona_free_spk_irqs(arizona);
|
||||
err_dsp_irq:
|
||||
|
@ -2139,7 +2132,6 @@ static int wm5102_remove(struct platform_device *pdev)
|
|||
struct wm5102_priv *wm5102 = platform_get_drvdata(pdev);
|
||||
struct arizona *arizona = wm5102->core.arizona;
|
||||
|
||||
snd_soc_unregister_platform(&pdev->dev);
|
||||
snd_soc_unregister_codec(&pdev->dev);
|
||||
pm_runtime_disable(&pdev->dev);
|
||||
|
||||
|
|
|
@ -35,6 +35,8 @@
|
|||
|
||||
#define WM5110_NUM_ADSP 4
|
||||
|
||||
#define DRV_NAME "wm5110-codec"
|
||||
|
||||
struct wm5110_priv {
|
||||
struct arizona_priv core;
|
||||
struct arizona_fll fll[2];
|
||||
|
@ -2229,7 +2231,8 @@ static struct snd_soc_dai_driver wm5110_dai[] = {
|
|||
static int wm5110_open(struct snd_compr_stream *stream)
|
||||
{
|
||||
struct snd_soc_pcm_runtime *rtd = stream->private_data;
|
||||
struct wm5110_priv *priv = snd_soc_platform_get_drvdata(rtd->platform);
|
||||
struct snd_soc_component *component = snd_soc_rtdcom_lookup(rtd, DRV_NAME);
|
||||
struct wm5110_priv *priv = snd_soc_component_get_drvdata(component);
|
||||
struct arizona *arizona = priv->core.arizona;
|
||||
int n_adsp;
|
||||
|
||||
|
@ -2346,6 +2349,16 @@ static unsigned int wm5110_digital_vu[] = {
|
|||
ARIZONA_DAC_DIGITAL_VOLUME_6R,
|
||||
};
|
||||
|
||||
static struct snd_compr_ops wm5110_compr_ops = {
|
||||
.open = wm5110_open,
|
||||
.free = wm_adsp_compr_free,
|
||||
.set_params = wm_adsp_compr_set_params,
|
||||
.get_caps = wm_adsp_compr_get_caps,
|
||||
.trigger = wm_adsp_compr_trigger,
|
||||
.pointer = wm_adsp_compr_pointer,
|
||||
.copy = wm_adsp_compr_copy,
|
||||
};
|
||||
|
||||
static const struct snd_soc_codec_driver soc_codec_dev_wm5110 = {
|
||||
.probe = wm5110_codec_probe,
|
||||
.remove = wm5110_codec_remove,
|
||||
|
@ -2356,6 +2369,8 @@ static const struct snd_soc_codec_driver soc_codec_dev_wm5110 = {
|
|||
.set_pll = wm5110_set_fll,
|
||||
|
||||
.component_driver = {
|
||||
.name = DRV_NAME,
|
||||
.compr_ops = &wm5110_compr_ops,
|
||||
.controls = wm5110_snd_controls,
|
||||
.num_controls = ARRAY_SIZE(wm5110_snd_controls),
|
||||
.dapm_widgets = wm5110_dapm_widgets,
|
||||
|
@ -2365,20 +2380,6 @@ static const struct snd_soc_codec_driver soc_codec_dev_wm5110 = {
|
|||
},
|
||||
};
|
||||
|
||||
static const struct snd_compr_ops wm5110_compr_ops = {
|
||||
.open = wm5110_open,
|
||||
.free = wm_adsp_compr_free,
|
||||
.set_params = wm_adsp_compr_set_params,
|
||||
.get_caps = wm_adsp_compr_get_caps,
|
||||
.trigger = wm_adsp_compr_trigger,
|
||||
.pointer = wm_adsp_compr_pointer,
|
||||
.copy = wm_adsp_compr_copy,
|
||||
};
|
||||
|
||||
static const struct snd_soc_platform_driver wm5110_compr_platform = {
|
||||
.compr_ops = &wm5110_compr_ops,
|
||||
};
|
||||
|
||||
static int wm5110_probe(struct platform_device *pdev)
|
||||
{
|
||||
struct arizona *arizona = dev_get_drvdata(pdev->dev.parent);
|
||||
|
@ -2464,23 +2465,15 @@ static int wm5110_probe(struct platform_device *pdev)
|
|||
if (ret < 0)
|
||||
goto err_dsp_irq;
|
||||
|
||||
ret = snd_soc_register_platform(&pdev->dev, &wm5110_compr_platform);
|
||||
if (ret < 0) {
|
||||
dev_err(&pdev->dev, "Failed to register platform: %d\n", ret);
|
||||
goto err_spk_irqs;
|
||||
}
|
||||
|
||||
ret = snd_soc_register_codec(&pdev->dev, &soc_codec_dev_wm5110,
|
||||
wm5110_dai, ARRAY_SIZE(wm5110_dai));
|
||||
if (ret < 0) {
|
||||
dev_err(&pdev->dev, "Failed to register codec: %d\n", ret);
|
||||
goto err_platform;
|
||||
goto err_spk_irqs;
|
||||
}
|
||||
|
||||
return ret;
|
||||
|
||||
err_platform:
|
||||
snd_soc_unregister_platform(&pdev->dev);
|
||||
err_spk_irqs:
|
||||
arizona_free_spk_irqs(arizona);
|
||||
err_dsp_irq:
|
||||
|
@ -2495,7 +2488,6 @@ static int wm5110_remove(struct platform_device *pdev)
|
|||
struct arizona *arizona = wm5110->core.arizona;
|
||||
int i;
|
||||
|
||||
snd_soc_unregister_platform(&pdev->dev);
|
||||
snd_soc_unregister_codec(&pdev->dev);
|
||||
pm_runtime_disable(&pdev->dev);
|
||||
|
||||
|
|
|
@ -34,6 +34,7 @@
|
|||
#include "edma-pcm.h"
|
||||
#include "davinci-i2s.h"
|
||||
|
||||
#define DRV_NAME "davinci-i2s"
|
||||
|
||||
/*
|
||||
* NOTE: terminology here is confusing.
|
||||
|
@ -190,7 +191,7 @@ static void davinci_mcbsp_start(struct davinci_mcbsp_dev *dev,
|
|||
struct snd_pcm_substream *substream)
|
||||
{
|
||||
struct snd_soc_pcm_runtime *rtd = substream->private_data;
|
||||
struct snd_soc_platform *platform = rtd->platform;
|
||||
struct snd_soc_component *component = snd_soc_rtdcom_lookup(rtd, DRV_NAME);
|
||||
int playback = (substream->stream == SNDRV_PCM_STREAM_PLAYBACK);
|
||||
u32 spcr;
|
||||
u32 mask = playback ? DAVINCI_MCBSP_SPCR_XRST : DAVINCI_MCBSP_SPCR_RRST;
|
||||
|
@ -211,8 +212,8 @@ static void davinci_mcbsp_start(struct davinci_mcbsp_dev *dev,
|
|||
if (playback) {
|
||||
/* Stop the DMA to avoid data loss */
|
||||
/* while the transmitter is out of reset to handle XSYNCERR */
|
||||
if (platform->driver->ops->trigger) {
|
||||
int ret = platform->driver->ops->trigger(substream,
|
||||
if (component->driver->ops->trigger) {
|
||||
int ret = component->driver->ops->trigger(substream,
|
||||
SNDRV_PCM_TRIGGER_STOP);
|
||||
if (ret < 0)
|
||||
printk(KERN_DEBUG "Playback DMA stop failed\n");
|
||||
|
@ -233,8 +234,8 @@ static void davinci_mcbsp_start(struct davinci_mcbsp_dev *dev,
|
|||
toggle_clock(dev, playback);
|
||||
|
||||
/* Restart the DMA */
|
||||
if (platform->driver->ops->trigger) {
|
||||
int ret = platform->driver->ops->trigger(substream,
|
||||
if (component->driver->ops->trigger) {
|
||||
int ret = component->driver->ops->trigger(substream,
|
||||
SNDRV_PCM_TRIGGER_START);
|
||||
if (ret < 0)
|
||||
printk(KERN_DEBUG "Playback DMA start failed\n");
|
||||
|
@ -651,7 +652,7 @@ static struct snd_soc_dai_driver davinci_i2s_dai = {
|
|||
};
|
||||
|
||||
static const struct snd_soc_component_driver davinci_i2s_component = {
|
||||
.name = "davinci-i2s",
|
||||
.name = DRV_NAME,
|
||||
};
|
||||
|
||||
static int davinci_i2s_probe(struct platform_device *pdev)
|
||||
|
|
|
@ -269,7 +269,7 @@ static const struct snd_pcm_ops dw_pcm_ops = {
|
|||
.pointer = dw_pcm_pointer,
|
||||
};
|
||||
|
||||
static const struct snd_soc_platform_driver dw_pcm_platform = {
|
||||
static const struct snd_soc_component_driver dw_pcm_component = {
|
||||
.pcm_new = dw_pcm_new,
|
||||
.pcm_free = dw_pcm_free,
|
||||
.ops = &dw_pcm_ops,
|
||||
|
@ -277,5 +277,6 @@ static const struct snd_soc_platform_driver dw_pcm_platform = {
|
|||
|
||||
int dw_pcm_register(struct platform_device *pdev)
|
||||
{
|
||||
return devm_snd_soc_register_platform(&pdev->dev, &dw_pcm_platform);
|
||||
return devm_snd_soc_register_component(&pdev->dev, &dw_pcm_component,
|
||||
NULL, 0);
|
||||
}
|
||||
|
|
|
@ -582,10 +582,6 @@ static struct snd_soc_dai_driver fsl_asrc_dai = {
|
|||
.ops = &fsl_asrc_dai_ops,
|
||||
};
|
||||
|
||||
static const struct snd_soc_component_driver fsl_asrc_component = {
|
||||
.name = "fsl-asrc-dai",
|
||||
};
|
||||
|
||||
static bool fsl_asrc_readable_reg(struct device *dev, unsigned int reg)
|
||||
{
|
||||
switch (reg) {
|
||||
|
@ -927,12 +923,6 @@ static int fsl_asrc_probe(struct platform_device *pdev)
|
|||
return ret;
|
||||
}
|
||||
|
||||
ret = devm_snd_soc_register_platform(&pdev->dev, &fsl_asrc_platform);
|
||||
if (ret) {
|
||||
dev_err(&pdev->dev, "failed to register ASoC platform\n");
|
||||
return ret;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -462,6 +462,7 @@ struct fsl_asrc {
|
|||
u32 regcache_cfg;
|
||||
};
|
||||
|
||||
extern struct snd_soc_platform_driver fsl_asrc_platform;
|
||||
#define DRV_NAME "fsl-asrc-dai"
|
||||
extern struct snd_soc_component_driver fsl_asrc_component;
|
||||
struct dma_chan *fsl_asrc_get_dma_channel(struct fsl_asrc_pair *pair, bool dir);
|
||||
#endif /* _FSL_ASRC_H */
|
||||
|
|
|
@ -64,7 +64,8 @@ static int fsl_asrc_dma_prepare_and_submit(struct snd_pcm_substream *substream)
|
|||
struct snd_soc_pcm_runtime *rtd = substream->private_data;
|
||||
struct snd_pcm_runtime *runtime = substream->runtime;
|
||||
struct fsl_asrc_pair *pair = runtime->private_data;
|
||||
struct device *dev = rtd->platform->dev;
|
||||
struct snd_soc_component *component = snd_soc_rtdcom_lookup(rtd, DRV_NAME);
|
||||
struct device *dev = component->dev;
|
||||
unsigned long flags = DMA_CTRL_ACK;
|
||||
|
||||
/* Prepare and submit Front-End DMA channel */
|
||||
|
@ -137,12 +138,13 @@ static int fsl_asrc_dma_hw_params(struct snd_pcm_substream *substream,
|
|||
bool tx = substream->stream == SNDRV_PCM_STREAM_PLAYBACK;
|
||||
struct snd_dmaengine_dai_dma_data *dma_params_fe = NULL;
|
||||
struct snd_dmaengine_dai_dma_data *dma_params_be = NULL;
|
||||
struct snd_soc_component *component = snd_soc_rtdcom_lookup(rtd, DRV_NAME);
|
||||
struct snd_pcm_runtime *runtime = substream->runtime;
|
||||
struct fsl_asrc_pair *pair = runtime->private_data;
|
||||
struct fsl_asrc *asrc_priv = pair->asrc_priv;
|
||||
struct dma_slave_config config_fe, config_be;
|
||||
enum asrc_pair_index index = pair->index;
|
||||
struct device *dev = rtd->platform->dev;
|
||||
struct device *dev = component->dev;
|
||||
int stream = substream->stream;
|
||||
struct imx_dma_data *tmp_data;
|
||||
struct snd_soc_dpcm *dpcm;
|
||||
|
@ -274,7 +276,8 @@ static int fsl_asrc_dma_startup(struct snd_pcm_substream *substream)
|
|||
{
|
||||
struct snd_soc_pcm_runtime *rtd = substream->private_data;
|
||||
struct snd_pcm_runtime *runtime = substream->runtime;
|
||||
struct device *dev = rtd->platform->dev;
|
||||
struct snd_soc_component *component = snd_soc_rtdcom_lookup(rtd, DRV_NAME);
|
||||
struct device *dev = component->dev;
|
||||
struct fsl_asrc *asrc_priv = dev_get_drvdata(dev);
|
||||
struct fsl_asrc_pair *pair;
|
||||
|
||||
|
@ -381,9 +384,10 @@ static void fsl_asrc_dma_pcm_free(struct snd_pcm *pcm)
|
|||
}
|
||||
}
|
||||
|
||||
struct snd_soc_platform_driver fsl_asrc_platform = {
|
||||
struct snd_soc_component_driver fsl_asrc_component = {
|
||||
.name = DRV_NAME,
|
||||
.ops = &fsl_asrc_dma_pcm_ops,
|
||||
.pcm_new = fsl_asrc_dma_pcm_new,
|
||||
.pcm_free = fsl_asrc_dma_pcm_free,
|
||||
};
|
||||
EXPORT_SYMBOL_GPL(fsl_asrc_platform);
|
||||
EXPORT_SYMBOL_GPL(fsl_asrc_component);
|
||||
|
|
|
@ -37,6 +37,8 @@
|
|||
#include "fsl_dma.h"
|
||||
#include "fsl_ssi.h" /* For the offset of stx0 and srx0 */
|
||||
|
||||
#define DRV_NAME "fsl_dma"
|
||||
|
||||
/*
|
||||
* The formats that the DMA controller supports, which is anything
|
||||
* that is 8, 16, or 32 bits.
|
||||
|
@ -56,7 +58,7 @@
|
|||
SNDRV_PCM_FMTBIT_U32_LE | \
|
||||
SNDRV_PCM_FMTBIT_U32_BE)
|
||||
struct dma_object {
|
||||
struct snd_soc_platform_driver dai;
|
||||
struct snd_soc_component_driver dai;
|
||||
dma_addr_t ssi_stx_phys;
|
||||
dma_addr_t ssi_srx_phys;
|
||||
unsigned int ssi_fifo_depth;
|
||||
|
@ -203,7 +205,8 @@ static irqreturn_t fsl_dma_isr(int irq, void *dev_id)
|
|||
struct fsl_dma_private *dma_private = dev_id;
|
||||
struct snd_pcm_substream *substream = dma_private->substream;
|
||||
struct snd_soc_pcm_runtime *rtd = substream->private_data;
|
||||
struct device *dev = rtd->platform->dev;
|
||||
struct snd_soc_component *component = snd_soc_rtdcom_lookup(rtd, DRV_NAME);
|
||||
struct device *dev = component->dev;
|
||||
struct ccsr_dma_channel __iomem *dma_channel = dma_private->dma_channel;
|
||||
irqreturn_t ret = IRQ_NONE;
|
||||
u32 sr, sr2 = 0;
|
||||
|
@ -385,9 +388,10 @@ static int fsl_dma_open(struct snd_pcm_substream *substream)
|
|||
{
|
||||
struct snd_pcm_runtime *runtime = substream->runtime;
|
||||
struct snd_soc_pcm_runtime *rtd = substream->private_data;
|
||||
struct device *dev = rtd->platform->dev;
|
||||
struct snd_soc_component *component = snd_soc_rtdcom_lookup(rtd, DRV_NAME);
|
||||
struct device *dev = component->dev;
|
||||
struct dma_object *dma =
|
||||
container_of(rtd->platform->driver, struct dma_object, dai);
|
||||
container_of(component->driver, struct dma_object, dai);
|
||||
struct fsl_dma_private *dma_private;
|
||||
struct ccsr_dma_channel __iomem *dma_channel;
|
||||
dma_addr_t ld_buf_phys;
|
||||
|
@ -539,7 +543,8 @@ static int fsl_dma_hw_params(struct snd_pcm_substream *substream,
|
|||
struct snd_pcm_runtime *runtime = substream->runtime;
|
||||
struct fsl_dma_private *dma_private = runtime->private_data;
|
||||
struct snd_soc_pcm_runtime *rtd = substream->private_data;
|
||||
struct device *dev = rtd->platform->dev;
|
||||
struct snd_soc_component *component = snd_soc_rtdcom_lookup(rtd, DRV_NAME);
|
||||
struct device *dev = component->dev;
|
||||
|
||||
/* Number of bits per sample */
|
||||
unsigned int sample_bits =
|
||||
|
@ -702,7 +707,8 @@ static snd_pcm_uframes_t fsl_dma_pointer(struct snd_pcm_substream *substream)
|
|||
struct snd_pcm_runtime *runtime = substream->runtime;
|
||||
struct fsl_dma_private *dma_private = runtime->private_data;
|
||||
struct snd_soc_pcm_runtime *rtd = substream->private_data;
|
||||
struct device *dev = rtd->platform->dev;
|
||||
struct snd_soc_component *component = snd_soc_rtdcom_lookup(rtd, DRV_NAME);
|
||||
struct device *dev = component->dev;
|
||||
struct ccsr_dma_channel __iomem *dma_channel = dma_private->dma_channel;
|
||||
dma_addr_t position;
|
||||
snd_pcm_uframes_t frames;
|
||||
|
@ -799,9 +805,10 @@ static int fsl_dma_close(struct snd_pcm_substream *substream)
|
|||
struct snd_pcm_runtime *runtime = substream->runtime;
|
||||
struct fsl_dma_private *dma_private = runtime->private_data;
|
||||
struct snd_soc_pcm_runtime *rtd = substream->private_data;
|
||||
struct device *dev = rtd->platform->dev;
|
||||
struct snd_soc_component *component = snd_soc_rtdcom_lookup(rtd, DRV_NAME);
|
||||
struct device *dev = component->dev;
|
||||
struct dma_object *dma =
|
||||
container_of(rtd->platform->driver, struct dma_object, dai);
|
||||
container_of(component->driver, struct dma_object, dai);
|
||||
|
||||
if (dma_private) {
|
||||
if (dma_private->irq)
|
||||
|
@ -908,6 +915,7 @@ static int fsl_soc_dma_probe(struct platform_device *pdev)
|
|||
return -ENOMEM;
|
||||
}
|
||||
|
||||
dma->dai.name = DRV_NAME;
|
||||
dma->dai.ops = &fsl_dma_ops;
|
||||
dma->dai.pcm_new = fsl_dma_new;
|
||||
dma->dai.pcm_free = fsl_dma_free_dma_buffers;
|
||||
|
@ -925,7 +933,7 @@ static int fsl_soc_dma_probe(struct platform_device *pdev)
|
|||
|
||||
of_node_put(ssi_np);
|
||||
|
||||
ret = snd_soc_register_platform(&pdev->dev, &dma->dai);
|
||||
ret = devm_snd_soc_register_component(&pdev->dev, &dma->dai, NULL, 0);
|
||||
if (ret) {
|
||||
dev_err(&pdev->dev, "could not register platform\n");
|
||||
kfree(dma);
|
||||
|
@ -944,7 +952,6 @@ static int fsl_soc_dma_remove(struct platform_device *pdev)
|
|||
{
|
||||
struct dma_object *dma = dev_get_drvdata(&pdev->dev);
|
||||
|
||||
snd_soc_unregister_platform(&pdev->dev);
|
||||
iounmap(dma->channel);
|
||||
irq_dispose_mapping(dma->irq);
|
||||
kfree(dma);
|
||||
|
|
|
@ -341,7 +341,7 @@ static void imx_pcm_fiq_free(struct snd_pcm *pcm)
|
|||
imx_pcm_free(pcm);
|
||||
}
|
||||
|
||||
static const struct snd_soc_platform_driver imx_soc_platform_fiq = {
|
||||
static const struct snd_soc_component_driver imx_soc_component_fiq = {
|
||||
.ops = &imx_pcm_ops,
|
||||
.pcm_new = imx_pcm_fiq_new,
|
||||
.pcm_free = imx_pcm_fiq_free,
|
||||
|
@ -368,7 +368,8 @@ int imx_pcm_fiq_init(struct platform_device *pdev,
|
|||
params->dma_params_tx->maxburst = 4;
|
||||
params->dma_params_rx->maxburst = 6;
|
||||
|
||||
ret = snd_soc_register_platform(&pdev->dev, &imx_soc_platform_fiq);
|
||||
ret = devm_snd_soc_register_component(&pdev->dev, &imx_soc_component_fiq,
|
||||
NULL, 0);
|
||||
if (ret)
|
||||
goto failed_register;
|
||||
|
||||
|
@ -384,7 +385,6 @@ EXPORT_SYMBOL_GPL(imx_pcm_fiq_init);
|
|||
|
||||
void imx_pcm_fiq_exit(struct platform_device *pdev)
|
||||
{
|
||||
snd_soc_unregister_platform(&pdev->dev);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(imx_pcm_fiq_exit);
|
||||
|
||||
|
|
|
@ -22,6 +22,8 @@
|
|||
|
||||
#include "mpc5200_dma.h"
|
||||
|
||||
#define DRV_NAME "mpc5200_dma"
|
||||
|
||||
/*
|
||||
* Interrupt handlers
|
||||
*/
|
||||
|
@ -300,12 +302,13 @@ static const struct snd_pcm_ops psc_dma_ops = {
|
|||
static int psc_dma_new(struct snd_soc_pcm_runtime *rtd)
|
||||
{
|
||||
struct snd_card *card = rtd->card->snd_card;
|
||||
struct snd_soc_component *component = snd_soc_rtdcom_lookup(rtd, DRV_NAME);
|
||||
struct snd_soc_dai *dai = rtd->cpu_dai;
|
||||
struct snd_pcm *pcm = rtd->pcm;
|
||||
size_t size = psc_dma_hardware.buffer_bytes_max;
|
||||
int rc;
|
||||
|
||||
dev_dbg(rtd->platform->dev, "psc_dma_new(card=%p, dai=%p, pcm=%p)\n",
|
||||
dev_dbg(component->dev, "psc_dma_new(card=%p, dai=%p, pcm=%p)\n",
|
||||
card, dai, pcm);
|
||||
|
||||
rc = dma_coerce_mask_and_coherent(card->dev, DMA_BIT_MASK(32));
|
||||
|
@ -341,10 +344,11 @@ static int psc_dma_new(struct snd_soc_pcm_runtime *rtd)
|
|||
static void psc_dma_free(struct snd_pcm *pcm)
|
||||
{
|
||||
struct snd_soc_pcm_runtime *rtd = pcm->private_data;
|
||||
struct snd_soc_component *component = snd_soc_rtdcom_lookup(rtd, DRV_NAME);
|
||||
struct snd_pcm_substream *substream;
|
||||
int stream;
|
||||
|
||||
dev_dbg(rtd->platform->dev, "psc_dma_free(pcm=%p)\n", pcm);
|
||||
dev_dbg(component->dev, "psc_dma_free(pcm=%p)\n", pcm);
|
||||
|
||||
for (stream = 0; stream < 2; stream++) {
|
||||
substream = pcm->streams[stream].substream;
|
||||
|
@ -356,7 +360,8 @@ static void psc_dma_free(struct snd_pcm *pcm)
|
|||
}
|
||||
}
|
||||
|
||||
static const struct snd_soc_platform_driver mpc5200_audio_dma_platform = {
|
||||
static const struct snd_soc_component_driver mpc5200_audio_dma_component = {
|
||||
.name = DRV_NAME,
|
||||
.ops = &psc_dma_ops,
|
||||
.pcm_new = &psc_dma_new,
|
||||
.pcm_free = &psc_dma_free,
|
||||
|
@ -468,7 +473,8 @@ int mpc5200_audio_dma_create(struct platform_device *op)
|
|||
dev_set_drvdata(&op->dev, psc_dma);
|
||||
|
||||
/* Tell the ASoC OF helpers about it */
|
||||
return snd_soc_register_platform(&op->dev, &mpc5200_audio_dma_platform);
|
||||
return devm_snd_soc_register_component(&op->dev,
|
||||
&mpc5200_audio_dma_component, NULL, 0);
|
||||
out_irq:
|
||||
free_irq(psc_dma->irq, psc_dma);
|
||||
free_irq(psc_dma->capture.irq, &psc_dma->capture);
|
||||
|
@ -487,8 +493,6 @@ int mpc5200_audio_dma_destroy(struct platform_device *op)
|
|||
|
||||
dev_dbg(&op->dev, "mpc5200_audio_dma_destroy()\n");
|
||||
|
||||
snd_soc_unregister_platform(&op->dev);
|
||||
|
||||
bcom_gen_bd_rx_release(psc_dma->capture.bcom_task);
|
||||
bcom_gen_bd_tx_release(psc_dma->playback.bcom_task);
|
||||
|
||||
|
|
|
@ -1414,11 +1414,11 @@ static int sst_fill_module_list(struct snd_kcontrol *kctl,
|
|||
* name. First part of control name contains the pipe name (widget name).
|
||||
*/
|
||||
static int sst_fill_widget_module_info(struct snd_soc_dapm_widget *w,
|
||||
struct snd_soc_platform *platform)
|
||||
struct snd_soc_component *component)
|
||||
{
|
||||
struct snd_kcontrol *kctl;
|
||||
int index, ret = 0;
|
||||
struct snd_card *card = platform->component.card->snd_card;
|
||||
struct snd_card *card = component->card->snd_card;
|
||||
char *idx;
|
||||
|
||||
down_read(&card->controls_rwsem);
|
||||
|
@ -1468,13 +1468,13 @@ static int sst_fill_widget_module_info(struct snd_soc_dapm_widget *w,
|
|||
/**
|
||||
* sst_fill_linked_widgets - fill the parent pointer for the linked widget
|
||||
*/
|
||||
static void sst_fill_linked_widgets(struct snd_soc_platform *platform,
|
||||
static void sst_fill_linked_widgets(struct snd_soc_component *component,
|
||||
struct sst_ids *ids)
|
||||
{
|
||||
struct snd_soc_dapm_widget *w;
|
||||
unsigned int len = strlen(ids->parent_wname);
|
||||
|
||||
list_for_each_entry(w, &platform->component.card->widgets, list) {
|
||||
list_for_each_entry(w, &component->card->widgets, list) {
|
||||
if (!strncmp(ids->parent_wname, w->name, len)) {
|
||||
ids->parent_w = w;
|
||||
break;
|
||||
|
@ -1485,41 +1485,41 @@ static void sst_fill_linked_widgets(struct snd_soc_platform *platform,
|
|||
/**
|
||||
* sst_map_modules_to_pipe - fill algo/gains list for all pipes
|
||||
*/
|
||||
static int sst_map_modules_to_pipe(struct snd_soc_platform *platform)
|
||||
static int sst_map_modules_to_pipe(struct snd_soc_component *component)
|
||||
{
|
||||
struct snd_soc_dapm_widget *w;
|
||||
int ret = 0;
|
||||
|
||||
list_for_each_entry(w, &platform->component.card->widgets, list) {
|
||||
list_for_each_entry(w, &component->card->widgets, list) {
|
||||
if (is_sst_dapm_widget(w) && (w->priv)) {
|
||||
struct sst_ids *ids = w->priv;
|
||||
|
||||
dev_dbg(platform->dev, "widget type=%d name=%s\n",
|
||||
dev_dbg(component->dev, "widget type=%d name=%s\n",
|
||||
w->id, w->name);
|
||||
INIT_LIST_HEAD(&ids->algo_list);
|
||||
INIT_LIST_HEAD(&ids->gain_list);
|
||||
ret = sst_fill_widget_module_info(w, platform);
|
||||
ret = sst_fill_widget_module_info(w, component);
|
||||
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
/* fill linked widgets */
|
||||
if (ids->parent_wname != NULL)
|
||||
sst_fill_linked_widgets(platform, ids);
|
||||
sst_fill_linked_widgets(component, ids);
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int sst_dsp_init_v2_dpcm(struct snd_soc_platform *platform)
|
||||
int sst_dsp_init_v2_dpcm(struct snd_soc_component *component)
|
||||
{
|
||||
int i, ret = 0;
|
||||
struct snd_soc_dapm_context *dapm =
|
||||
snd_soc_component_get_dapm(&platform->component);
|
||||
struct sst_data *drv = snd_soc_platform_get_drvdata(platform);
|
||||
snd_soc_component_get_dapm(component);
|
||||
struct sst_data *drv = snd_soc_component_get_drvdata(component);
|
||||
unsigned int gains = ARRAY_SIZE(sst_gain_controls)/3;
|
||||
|
||||
drv->byte_stream = devm_kzalloc(platform->dev,
|
||||
drv->byte_stream = devm_kzalloc(component->dev,
|
||||
SST_MAX_BIN_BYTES, GFP_KERNEL);
|
||||
if (!drv->byte_stream)
|
||||
return -ENOMEM;
|
||||
|
@ -1537,26 +1537,26 @@ int sst_dsp_init_v2_dpcm(struct snd_soc_platform *platform)
|
|||
sst_gains[i].ramp_duration = SST_GAIN_RAMP_DURATION_DEFAULT;
|
||||
}
|
||||
|
||||
ret = snd_soc_add_platform_controls(platform, sst_gain_controls,
|
||||
ret = snd_soc_add_component_controls(component, sst_gain_controls,
|
||||
ARRAY_SIZE(sst_gain_controls));
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
/* Initialize algo control params */
|
||||
ret = sst_algo_control_init(platform->dev);
|
||||
ret = sst_algo_control_init(component->dev);
|
||||
if (ret)
|
||||
return ret;
|
||||
ret = snd_soc_add_platform_controls(platform, sst_algo_controls,
|
||||
ret = snd_soc_add_component_controls(component, sst_algo_controls,
|
||||
ARRAY_SIZE(sst_algo_controls));
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
ret = snd_soc_add_platform_controls(platform, sst_slot_controls,
|
||||
ret = snd_soc_add_component_controls(component, sst_slot_controls,
|
||||
ARRAY_SIZE(sst_slot_controls));
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
ret = sst_map_modules_to_pipe(platform);
|
||||
ret = sst_map_modules_to_pipe(component);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
|
|
@ -107,8 +107,8 @@ static int sst_platform_compr_set_params(struct snd_compr_stream *cstream,
|
|||
struct snd_sst_params str_params;
|
||||
struct sst_compress_cb cb;
|
||||
struct snd_soc_pcm_runtime *rtd = cstream->private_data;
|
||||
struct snd_soc_platform *platform = rtd->platform;
|
||||
struct sst_data *ctx = snd_soc_platform_get_drvdata(platform);
|
||||
struct snd_soc_component *component = snd_soc_rtdcom_lookup(rtd, DRV_NAME);
|
||||
struct sst_data *ctx = snd_soc_component_get_drvdata(component);
|
||||
|
||||
stream = cstream->runtime->private_data;
|
||||
/* construct fw structure for this*/
|
||||
|
|
|
@ -697,26 +697,22 @@ static int sst_pcm_new(struct snd_soc_pcm_runtime *rtd)
|
|||
return retval;
|
||||
}
|
||||
|
||||
static int sst_soc_probe(struct snd_soc_platform *platform)
|
||||
static int sst_soc_probe(struct snd_soc_component *component)
|
||||
{
|
||||
struct sst_data *drv = dev_get_drvdata(platform->dev);
|
||||
struct sst_data *drv = dev_get_drvdata(component->dev);
|
||||
|
||||
drv->soc_card = platform->component.card;
|
||||
return sst_dsp_init_v2_dpcm(platform);
|
||||
drv->soc_card = component->card;
|
||||
return sst_dsp_init_v2_dpcm(component);
|
||||
}
|
||||
|
||||
static const struct snd_soc_platform_driver sst_soc_platform_drv = {
|
||||
static const struct snd_soc_component_driver sst_soc_platform_drv = {
|
||||
.name = DRV_NAME,
|
||||
.probe = sst_soc_probe,
|
||||
.ops = &sst_platform_ops,
|
||||
.compr_ops = &sst_platform_compr_ops,
|
||||
.pcm_new = sst_pcm_new,
|
||||
};
|
||||
|
||||
static const struct snd_soc_component_driver sst_component = {
|
||||
.name = "sst",
|
||||
};
|
||||
|
||||
|
||||
static int sst_platform_probe(struct platform_device *pdev)
|
||||
{
|
||||
struct sst_data *drv;
|
||||
|
@ -740,26 +736,16 @@ static int sst_platform_probe(struct platform_device *pdev)
|
|||
mutex_init(&drv->lock);
|
||||
dev_set_drvdata(&pdev->dev, drv);
|
||||
|
||||
ret = snd_soc_register_platform(&pdev->dev, &sst_soc_platform_drv);
|
||||
if (ret) {
|
||||
dev_err(&pdev->dev, "registering soc platform failed\n");
|
||||
return ret;
|
||||
}
|
||||
|
||||
ret = snd_soc_register_component(&pdev->dev, &sst_component,
|
||||
ret = devm_snd_soc_register_component(&pdev->dev, &sst_soc_platform_drv,
|
||||
sst_platform_dai, ARRAY_SIZE(sst_platform_dai));
|
||||
if (ret) {
|
||||
if (ret)
|
||||
dev_err(&pdev->dev, "registering cpu dais failed\n");
|
||||
snd_soc_unregister_platform(&pdev->dev);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int sst_platform_remove(struct platform_device *pdev)
|
||||
{
|
||||
|
||||
snd_soc_unregister_component(&pdev->dev);
|
||||
snd_soc_unregister_platform(&pdev->dev);
|
||||
dev_dbg(&pdev->dev, "sst_platform_remove success\n");
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -27,6 +27,8 @@
|
|||
extern struct sst_device *sst;
|
||||
extern const struct snd_compr_ops sst_platform_compr_ops;
|
||||
|
||||
#define DRV_NAME "sst"
|
||||
|
||||
#define SST_MONO 1
|
||||
#define SST_STEREO 2
|
||||
#define SST_MAX_CAP 5
|
||||
|
@ -155,7 +157,7 @@ struct sst_device {
|
|||
|
||||
struct sst_data;
|
||||
|
||||
int sst_dsp_init_v2_dpcm(struct snd_soc_platform *platform);
|
||||
int sst_dsp_init_v2_dpcm(struct snd_soc_component *component);
|
||||
int sst_send_pipe_gains(struct snd_soc_dai *dai, int stream, int mute);
|
||||
int send_ssp_cmd(struct snd_soc_dai *dai, const char *id, bool enable);
|
||||
int sst_handle_vb_timer(struct snd_soc_dai *dai, bool enable);
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
#include "../common/sst-dsp-priv.h"
|
||||
#include "../common/sst-dsp.h"
|
||||
|
||||
#define DRV_NAME "byt-dai"
|
||||
#define BYT_PCM_COUNT 2
|
||||
|
||||
static const struct snd_pcm_hardware sst_byt_pcm_hardware = {
|
||||
|
@ -69,8 +70,8 @@ static int sst_byt_pcm_hw_params(struct snd_pcm_substream *substream,
|
|||
struct snd_pcm_hw_params *params)
|
||||
{
|
||||
struct snd_soc_pcm_runtime *rtd = substream->private_data;
|
||||
struct sst_byt_priv_data *pdata =
|
||||
snd_soc_platform_get_drvdata(rtd->platform);
|
||||
struct snd_soc_component *component = snd_soc_rtdcom_lookup(rtd, DRV_NAME);
|
||||
struct sst_byt_priv_data *pdata = snd_soc_component_get_drvdata(component);
|
||||
struct sst_byt_pcm_data *pcm_data = &pdata->pcm[substream->stream];
|
||||
struct sst_byt *byt = pdata->byt;
|
||||
u32 rate, bits;
|
||||
|
@ -141,8 +142,8 @@ static int sst_byt_pcm_hw_free(struct snd_pcm_substream *substream)
|
|||
static int sst_byt_pcm_restore_stream_context(struct snd_pcm_substream *substream)
|
||||
{
|
||||
struct snd_soc_pcm_runtime *rtd = substream->private_data;
|
||||
struct sst_byt_priv_data *pdata =
|
||||
snd_soc_platform_get_drvdata(rtd->platform);
|
||||
struct snd_soc_component *component = snd_soc_rtdcom_lookup(rtd, DRV_NAME);
|
||||
struct sst_byt_priv_data *pdata = snd_soc_component_get_drvdata(component);
|
||||
struct sst_byt_pcm_data *pcm_data = &pdata->pcm[substream->stream];
|
||||
struct sst_byt *byt = pdata->byt;
|
||||
int ret;
|
||||
|
@ -174,8 +175,8 @@ static void sst_byt_pcm_work(struct work_struct *work)
|
|||
static int sst_byt_pcm_trigger(struct snd_pcm_substream *substream, int cmd)
|
||||
{
|
||||
struct snd_soc_pcm_runtime *rtd = substream->private_data;
|
||||
struct sst_byt_priv_data *pdata =
|
||||
snd_soc_platform_get_drvdata(rtd->platform);
|
||||
struct snd_soc_component *component = snd_soc_rtdcom_lookup(rtd, DRV_NAME);
|
||||
struct sst_byt_priv_data *pdata = snd_soc_component_get_drvdata(component);
|
||||
struct sst_byt_pcm_data *pcm_data = &pdata->pcm[substream->stream];
|
||||
struct sst_byt *byt = pdata->byt;
|
||||
|
||||
|
@ -216,8 +217,8 @@ static u32 byt_notify_pointer(struct sst_byt_stream *stream, void *data)
|
|||
struct snd_pcm_substream *substream = pcm_data->substream;
|
||||
struct snd_pcm_runtime *runtime = substream->runtime;
|
||||
struct snd_soc_pcm_runtime *rtd = substream->private_data;
|
||||
struct sst_byt_priv_data *pdata =
|
||||
snd_soc_platform_get_drvdata(rtd->platform);
|
||||
struct snd_soc_component *component = snd_soc_rtdcom_lookup(rtd, DRV_NAME);
|
||||
struct sst_byt_priv_data *pdata = snd_soc_component_get_drvdata(component);
|
||||
struct sst_byt *byt = pdata->byt;
|
||||
u32 pos, hw_pos;
|
||||
|
||||
|
@ -238,8 +239,8 @@ static snd_pcm_uframes_t sst_byt_pcm_pointer(struct snd_pcm_substream *substream
|
|||
{
|
||||
struct snd_soc_pcm_runtime *rtd = substream->private_data;
|
||||
struct snd_pcm_runtime *runtime = substream->runtime;
|
||||
struct sst_byt_priv_data *pdata =
|
||||
snd_soc_platform_get_drvdata(rtd->platform);
|
||||
struct snd_soc_component *component = snd_soc_rtdcom_lookup(rtd, DRV_NAME);
|
||||
struct sst_byt_priv_data *pdata = snd_soc_component_get_drvdata(component);
|
||||
struct sst_byt_pcm_data *pcm_data = &pdata->pcm[substream->stream];
|
||||
|
||||
dev_dbg(rtd->dev, "PCM: DMA pointer %u bytes\n", pcm_data->hw_ptr);
|
||||
|
@ -250,8 +251,8 @@ static snd_pcm_uframes_t sst_byt_pcm_pointer(struct snd_pcm_substream *substream
|
|||
static int sst_byt_pcm_open(struct snd_pcm_substream *substream)
|
||||
{
|
||||
struct snd_soc_pcm_runtime *rtd = substream->private_data;
|
||||
struct sst_byt_priv_data *pdata =
|
||||
snd_soc_platform_get_drvdata(rtd->platform);
|
||||
struct snd_soc_component *component = snd_soc_rtdcom_lookup(rtd, DRV_NAME);
|
||||
struct sst_byt_priv_data *pdata = snd_soc_component_get_drvdata(component);
|
||||
struct sst_byt_pcm_data *pcm_data = &pdata->pcm[substream->stream];
|
||||
struct sst_byt *byt = pdata->byt;
|
||||
|
||||
|
@ -278,8 +279,8 @@ static int sst_byt_pcm_open(struct snd_pcm_substream *substream)
|
|||
static int sst_byt_pcm_close(struct snd_pcm_substream *substream)
|
||||
{
|
||||
struct snd_soc_pcm_runtime *rtd = substream->private_data;
|
||||
struct sst_byt_priv_data *pdata =
|
||||
snd_soc_platform_get_drvdata(rtd->platform);
|
||||
struct snd_soc_component *component = snd_soc_rtdcom_lookup(rtd, DRV_NAME);
|
||||
struct sst_byt_priv_data *pdata = snd_soc_component_get_drvdata(component);
|
||||
struct sst_byt_pcm_data *pcm_data = &pdata->pcm[substream->stream];
|
||||
struct sst_byt *byt = pdata->byt;
|
||||
int ret;
|
||||
|
@ -324,8 +325,8 @@ static int sst_byt_pcm_new(struct snd_soc_pcm_runtime *rtd)
|
|||
{
|
||||
struct snd_pcm *pcm = rtd->pcm;
|
||||
size_t size;
|
||||
struct snd_soc_platform *platform = rtd->platform;
|
||||
struct sst_pdata *pdata = dev_get_platdata(platform->dev);
|
||||
struct snd_soc_component *component = snd_soc_rtdcom_lookup(rtd, DRV_NAME);
|
||||
struct sst_pdata *pdata = dev_get_platdata(component->dev);
|
||||
int ret = 0;
|
||||
|
||||
if (pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream ||
|
||||
|
@ -366,21 +367,21 @@ static struct snd_soc_dai_driver byt_dais[] = {
|
|||
},
|
||||
};
|
||||
|
||||
static int sst_byt_pcm_probe(struct snd_soc_platform *platform)
|
||||
static int sst_byt_pcm_probe(struct snd_soc_component *component)
|
||||
{
|
||||
struct sst_pdata *plat_data = dev_get_platdata(platform->dev);
|
||||
struct sst_pdata *plat_data = dev_get_platdata(component->dev);
|
||||
struct sst_byt_priv_data *priv_data;
|
||||
int i;
|
||||
|
||||
if (!plat_data)
|
||||
return -ENODEV;
|
||||
|
||||
priv_data = devm_kzalloc(platform->dev, sizeof(*priv_data),
|
||||
priv_data = devm_kzalloc(component->dev, sizeof(*priv_data),
|
||||
GFP_KERNEL);
|
||||
if (!priv_data)
|
||||
return -ENOMEM;
|
||||
priv_data->byt = plat_data->dsp;
|
||||
snd_soc_platform_set_drvdata(platform, priv_data);
|
||||
snd_soc_component_set_drvdata(component, priv_data);
|
||||
|
||||
for (i = 0; i < BYT_PCM_COUNT; i++) {
|
||||
mutex_init(&priv_data->pcm[i].mutex);
|
||||
|
@ -390,22 +391,13 @@ static int sst_byt_pcm_probe(struct snd_soc_platform *platform)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int sst_byt_pcm_remove(struct snd_soc_platform *platform)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const struct snd_soc_platform_driver byt_soc_platform = {
|
||||
static const struct snd_soc_component_driver byt_dai_component = {
|
||||
.name = DRV_NAME,
|
||||
.probe = sst_byt_pcm_probe,
|
||||
.remove = sst_byt_pcm_remove,
|
||||
.ops = &sst_byt_pcm_ops,
|
||||
.pcm_new = sst_byt_pcm_new,
|
||||
};
|
||||
|
||||
static const struct snd_soc_component_driver byt_dai_component = {
|
||||
.name = "byt-dai",
|
||||
};
|
||||
|
||||
#ifdef CONFIG_PM
|
||||
static int sst_byt_pcm_dev_suspend_late(struct device *dev)
|
||||
{
|
||||
|
@ -461,19 +453,13 @@ static int sst_byt_pcm_dev_probe(struct platform_device *pdev)
|
|||
if (ret < 0)
|
||||
return -ENODEV;
|
||||
|
||||
ret = snd_soc_register_platform(&pdev->dev, &byt_soc_platform);
|
||||
ret = devm_snd_soc_register_component(&pdev->dev, &byt_dai_component,
|
||||
byt_dais, ARRAY_SIZE(byt_dais));
|
||||
if (ret < 0)
|
||||
goto err_plat;
|
||||
|
||||
ret = snd_soc_register_component(&pdev->dev, &byt_dai_component,
|
||||
byt_dais, ARRAY_SIZE(byt_dais));
|
||||
if (ret < 0)
|
||||
goto err_comp;
|
||||
|
||||
return 0;
|
||||
|
||||
err_comp:
|
||||
snd_soc_unregister_platform(&pdev->dev);
|
||||
err_plat:
|
||||
sst_byt_dsp_free(&pdev->dev, sst_pdata);
|
||||
return ret;
|
||||
|
@ -483,8 +469,6 @@ static int sst_byt_pcm_dev_remove(struct platform_device *pdev)
|
|||
{
|
||||
struct sst_pdata *sst_pdata = dev_get_platdata(&pdev->dev);
|
||||
|
||||
snd_soc_unregister_platform(&pdev->dev);
|
||||
snd_soc_unregister_component(&pdev->dev);
|
||||
sst_byt_dsp_free(&pdev->dev, sst_pdata);
|
||||
|
||||
return 0;
|
||||
|
|
|
@ -183,7 +183,8 @@ static const struct snd_soc_ops bdw_rt5677_ops = {
|
|||
|
||||
static int bdw_rt5677_rtd_init(struct snd_soc_pcm_runtime *rtd)
|
||||
{
|
||||
struct sst_pdata *pdata = dev_get_platdata(rtd->platform->dev);
|
||||
struct snd_soc_component *component = snd_soc_rtdcom_lookup(rtd, DRV_NAME);
|
||||
struct sst_pdata *pdata = dev_get_platdata(component->dev);
|
||||
struct sst_hsw *broadwell = pdata->dsp;
|
||||
int ret;
|
||||
|
||||
|
|
|
@ -132,7 +132,8 @@ static const struct snd_soc_ops broadwell_rt286_ops = {
|
|||
|
||||
static int broadwell_rtd_init(struct snd_soc_pcm_runtime *rtd)
|
||||
{
|
||||
struct sst_pdata *pdata = dev_get_platdata(rtd->platform->dev);
|
||||
struct snd_soc_component *component = snd_soc_rtdcom_lookup(rtd, DRV_NAME);
|
||||
struct sst_pdata *pdata = dev_get_platdata(component->dev);
|
||||
struct sst_hsw *broadwell = pdata->dsp;
|
||||
int ret;
|
||||
|
||||
|
|
|
@ -87,7 +87,8 @@ static const struct snd_soc_ops haswell_rt5640_ops = {
|
|||
|
||||
static int haswell_rtd_init(struct snd_soc_pcm_runtime *rtd)
|
||||
{
|
||||
struct sst_pdata *pdata = dev_get_platdata(rtd->platform->dev);
|
||||
struct snd_soc_component *component = snd_soc_rtdcom_lookup(rtd, DRV_NAME);
|
||||
struct sst_pdata *pdata = dev_get_platdata(component->dev);
|
||||
struct sst_hsw *haswell = pdata->dsp;
|
||||
int ret;
|
||||
|
||||
|
|
|
@ -22,6 +22,8 @@
|
|||
#include <linux/platform_device.h>
|
||||
#include <sound/asound.h>
|
||||
|
||||
#define DRV_NAME "haswell-dai"
|
||||
|
||||
#define SST_HSW_NO_CHANNELS 4
|
||||
#define SST_HSW_MAX_DX_REGIONS 14
|
||||
#define SST_HSW_DX_CONTEXT_SIZE (640 * 1024)
|
||||
|
|
|
@ -181,11 +181,11 @@ static inline unsigned int hsw_ipc_to_mixer(u32 value)
|
|||
static int hsw_stream_volume_put(struct snd_kcontrol *kcontrol,
|
||||
struct snd_ctl_elem_value *ucontrol)
|
||||
{
|
||||
struct snd_soc_platform *platform = snd_soc_kcontrol_platform(kcontrol);
|
||||
struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
|
||||
struct soc_mixer_control *mc =
|
||||
(struct soc_mixer_control *)kcontrol->private_value;
|
||||
struct hsw_priv_data *pdata =
|
||||
snd_soc_platform_get_drvdata(platform);
|
||||
snd_soc_component_get_drvdata(component);
|
||||
struct hsw_pcm_data *pcm_data;
|
||||
struct sst_hsw *hsw = pdata->hsw;
|
||||
u32 volume;
|
||||
|
@ -230,11 +230,11 @@ static int hsw_stream_volume_put(struct snd_kcontrol *kcontrol,
|
|||
static int hsw_stream_volume_get(struct snd_kcontrol *kcontrol,
|
||||
struct snd_ctl_elem_value *ucontrol)
|
||||
{
|
||||
struct snd_soc_platform *platform = snd_soc_kcontrol_platform(kcontrol);
|
||||
struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
|
||||
struct soc_mixer_control *mc =
|
||||
(struct soc_mixer_control *)kcontrol->private_value;
|
||||
struct hsw_priv_data *pdata =
|
||||
snd_soc_platform_get_drvdata(platform);
|
||||
snd_soc_component_get_drvdata(component);
|
||||
struct hsw_pcm_data *pcm_data;
|
||||
struct sst_hsw *hsw = pdata->hsw;
|
||||
u32 volume;
|
||||
|
@ -273,8 +273,8 @@ static int hsw_stream_volume_get(struct snd_kcontrol *kcontrol,
|
|||
static int hsw_volume_put(struct snd_kcontrol *kcontrol,
|
||||
struct snd_ctl_elem_value *ucontrol)
|
||||
{
|
||||
struct snd_soc_platform *platform = snd_soc_kcontrol_platform(kcontrol);
|
||||
struct hsw_priv_data *pdata = snd_soc_platform_get_drvdata(platform);
|
||||
struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
|
||||
struct hsw_priv_data *pdata = snd_soc_component_get_drvdata(component);
|
||||
struct sst_hsw *hsw = pdata->hsw;
|
||||
u32 volume;
|
||||
|
||||
|
@ -302,8 +302,8 @@ static int hsw_volume_put(struct snd_kcontrol *kcontrol,
|
|||
static int hsw_volume_get(struct snd_kcontrol *kcontrol,
|
||||
struct snd_ctl_elem_value *ucontrol)
|
||||
{
|
||||
struct snd_soc_platform *platform = snd_soc_kcontrol_platform(kcontrol);
|
||||
struct hsw_priv_data *pdata = snd_soc_platform_get_drvdata(platform);
|
||||
struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
|
||||
struct hsw_priv_data *pdata = snd_soc_component_get_drvdata(component);
|
||||
struct sst_hsw *hsw = pdata->hsw;
|
||||
unsigned int volume = 0;
|
||||
|
||||
|
@ -322,8 +322,8 @@ static int hsw_volume_get(struct snd_kcontrol *kcontrol,
|
|||
static int hsw_waves_switch_get(struct snd_kcontrol *kcontrol,
|
||||
struct snd_ctl_elem_value *ucontrol)
|
||||
{
|
||||
struct snd_soc_platform *platform = snd_soc_kcontrol_platform(kcontrol);
|
||||
struct hsw_priv_data *pdata = snd_soc_platform_get_drvdata(platform);
|
||||
struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
|
||||
struct hsw_priv_data *pdata = snd_soc_component_get_drvdata(component);
|
||||
struct sst_hsw *hsw = pdata->hsw;
|
||||
enum sst_hsw_module_id id = SST_HSW_MODULE_WAVES;
|
||||
|
||||
|
@ -336,8 +336,8 @@ static int hsw_waves_switch_get(struct snd_kcontrol *kcontrol,
|
|||
static int hsw_waves_switch_put(struct snd_kcontrol *kcontrol,
|
||||
struct snd_ctl_elem_value *ucontrol)
|
||||
{
|
||||
struct snd_soc_platform *platform = snd_soc_kcontrol_platform(kcontrol);
|
||||
struct hsw_priv_data *pdata = snd_soc_platform_get_drvdata(platform);
|
||||
struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
|
||||
struct hsw_priv_data *pdata = snd_soc_component_get_drvdata(component);
|
||||
struct sst_hsw *hsw = pdata->hsw;
|
||||
int ret = 0;
|
||||
enum sst_hsw_module_id id = SST_HSW_MODULE_WAVES;
|
||||
|
@ -370,8 +370,8 @@ static int hsw_waves_switch_put(struct snd_kcontrol *kcontrol,
|
|||
static int hsw_waves_param_get(struct snd_kcontrol *kcontrol,
|
||||
struct snd_ctl_elem_value *ucontrol)
|
||||
{
|
||||
struct snd_soc_platform *platform = snd_soc_kcontrol_platform(kcontrol);
|
||||
struct hsw_priv_data *pdata = snd_soc_platform_get_drvdata(platform);
|
||||
struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
|
||||
struct hsw_priv_data *pdata = snd_soc_component_get_drvdata(component);
|
||||
struct sst_hsw *hsw = pdata->hsw;
|
||||
|
||||
/* return a matching line from param buffer */
|
||||
|
@ -381,8 +381,8 @@ static int hsw_waves_param_get(struct snd_kcontrol *kcontrol,
|
|||
static int hsw_waves_param_put(struct snd_kcontrol *kcontrol,
|
||||
struct snd_ctl_elem_value *ucontrol)
|
||||
{
|
||||
struct snd_soc_platform *platform = snd_soc_kcontrol_platform(kcontrol);
|
||||
struct hsw_priv_data *pdata = snd_soc_platform_get_drvdata(platform);
|
||||
struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
|
||||
struct hsw_priv_data *pdata = snd_soc_component_get_drvdata(component);
|
||||
struct sst_hsw *hsw = pdata->hsw;
|
||||
int ret;
|
||||
enum sst_hsw_module_id id = SST_HSW_MODULE_WAVES;
|
||||
|
@ -472,8 +472,8 @@ static int hsw_pcm_hw_params(struct snd_pcm_substream *substream,
|
|||
{
|
||||
struct snd_soc_pcm_runtime *rtd = substream->private_data;
|
||||
struct snd_pcm_runtime *runtime = substream->runtime;
|
||||
struct hsw_priv_data *pdata =
|
||||
snd_soc_platform_get_drvdata(rtd->platform);
|
||||
struct snd_soc_component *component = snd_soc_rtdcom_lookup(rtd, DRV_NAME);
|
||||
struct hsw_priv_data *pdata = snd_soc_component_get_drvdata(component);
|
||||
struct hsw_pcm_data *pcm_data;
|
||||
struct sst_hsw *hsw = pdata->hsw;
|
||||
struct sst_module *module_data;
|
||||
|
@ -674,8 +674,8 @@ static int hsw_pcm_hw_free(struct snd_pcm_substream *substream)
|
|||
static int hsw_pcm_trigger(struct snd_pcm_substream *substream, int cmd)
|
||||
{
|
||||
struct snd_soc_pcm_runtime *rtd = substream->private_data;
|
||||
struct hsw_priv_data *pdata =
|
||||
snd_soc_platform_get_drvdata(rtd->platform);
|
||||
struct snd_soc_component *component = snd_soc_rtdcom_lookup(rtd, DRV_NAME);
|
||||
struct hsw_priv_data *pdata = snd_soc_component_get_drvdata(component);
|
||||
struct hsw_pcm_data *pcm_data;
|
||||
struct sst_hsw_stream *sst_stream;
|
||||
struct sst_hsw *hsw = pdata->hsw;
|
||||
|
@ -718,8 +718,8 @@ static u32 hsw_notify_pointer(struct sst_hsw_stream *stream, void *data)
|
|||
struct snd_pcm_substream *substream = pcm_data->substream;
|
||||
struct snd_pcm_runtime *runtime = substream->runtime;
|
||||
struct snd_soc_pcm_runtime *rtd = substream->private_data;
|
||||
struct hsw_priv_data *pdata =
|
||||
snd_soc_platform_get_drvdata(rtd->platform);
|
||||
struct snd_soc_component *component = snd_soc_rtdcom_lookup(rtd, DRV_NAME);
|
||||
struct hsw_priv_data *pdata = snd_soc_component_get_drvdata(component);
|
||||
struct sst_hsw *hsw = pdata->hsw;
|
||||
u32 pos;
|
||||
snd_pcm_uframes_t position = bytes_to_frames(runtime,
|
||||
|
@ -783,8 +783,8 @@ static snd_pcm_uframes_t hsw_pcm_pointer(struct snd_pcm_substream *substream)
|
|||
{
|
||||
struct snd_soc_pcm_runtime *rtd = substream->private_data;
|
||||
struct snd_pcm_runtime *runtime = substream->runtime;
|
||||
struct hsw_priv_data *pdata =
|
||||
snd_soc_platform_get_drvdata(rtd->platform);
|
||||
struct snd_soc_component *component = snd_soc_rtdcom_lookup(rtd, DRV_NAME);
|
||||
struct hsw_priv_data *pdata = snd_soc_component_get_drvdata(component);
|
||||
struct hsw_pcm_data *pcm_data;
|
||||
struct sst_hsw *hsw = pdata->hsw;
|
||||
snd_pcm_uframes_t offset;
|
||||
|
@ -807,8 +807,8 @@ static snd_pcm_uframes_t hsw_pcm_pointer(struct snd_pcm_substream *substream)
|
|||
static int hsw_pcm_open(struct snd_pcm_substream *substream)
|
||||
{
|
||||
struct snd_soc_pcm_runtime *rtd = substream->private_data;
|
||||
struct hsw_priv_data *pdata =
|
||||
snd_soc_platform_get_drvdata(rtd->platform);
|
||||
struct snd_soc_component *component = snd_soc_rtdcom_lookup(rtd, DRV_NAME);
|
||||
struct hsw_priv_data *pdata = snd_soc_component_get_drvdata(component);
|
||||
struct hsw_pcm_data *pcm_data;
|
||||
struct sst_hsw *hsw = pdata->hsw;
|
||||
int dai;
|
||||
|
@ -840,8 +840,8 @@ static int hsw_pcm_open(struct snd_pcm_substream *substream)
|
|||
static int hsw_pcm_close(struct snd_pcm_substream *substream)
|
||||
{
|
||||
struct snd_soc_pcm_runtime *rtd = substream->private_data;
|
||||
struct hsw_priv_data *pdata =
|
||||
snd_soc_platform_get_drvdata(rtd->platform);
|
||||
struct snd_soc_component *component = snd_soc_rtdcom_lookup(rtd, DRV_NAME);
|
||||
struct hsw_priv_data *pdata = snd_soc_component_get_drvdata(component);
|
||||
struct hsw_pcm_data *pcm_data;
|
||||
struct sst_hsw *hsw = pdata->hsw;
|
||||
int ret, dai;
|
||||
|
@ -942,9 +942,9 @@ static void hsw_pcm_free_modules(struct hsw_priv_data *pdata)
|
|||
static int hsw_pcm_new(struct snd_soc_pcm_runtime *rtd)
|
||||
{
|
||||
struct snd_pcm *pcm = rtd->pcm;
|
||||
struct snd_soc_platform *platform = rtd->platform;
|
||||
struct sst_pdata *pdata = dev_get_platdata(platform->dev);
|
||||
struct hsw_priv_data *priv_data = dev_get_drvdata(platform->dev);
|
||||
struct snd_soc_component *component = snd_soc_rtdcom_lookup(rtd, DRV_NAME);
|
||||
struct sst_pdata *pdata = dev_get_platdata(component->dev);
|
||||
struct hsw_priv_data *priv_data = dev_get_drvdata(component->dev);
|
||||
struct device *dev = pdata->dma_dev;
|
||||
int ret = 0;
|
||||
|
||||
|
@ -1052,23 +1052,23 @@ static const struct snd_soc_dapm_route graph[] = {
|
|||
{"Analog Capture", NULL, "SSP0 CODEC IN"},
|
||||
};
|
||||
|
||||
static int hsw_pcm_probe(struct snd_soc_platform *platform)
|
||||
static int hsw_pcm_probe(struct snd_soc_component *component)
|
||||
{
|
||||
struct hsw_priv_data *priv_data = snd_soc_platform_get_drvdata(platform);
|
||||
struct sst_pdata *pdata = dev_get_platdata(platform->dev);
|
||||
struct hsw_priv_data *priv_data = snd_soc_component_get_drvdata(component);
|
||||
struct sst_pdata *pdata = dev_get_platdata(component->dev);
|
||||
struct device *dma_dev, *dev;
|
||||
int i, ret = 0;
|
||||
|
||||
if (!pdata)
|
||||
return -ENODEV;
|
||||
|
||||
dev = platform->dev;
|
||||
dev = component->dev;
|
||||
dma_dev = pdata->dma_dev;
|
||||
|
||||
priv_data->hsw = pdata->dsp;
|
||||
priv_data->dev = platform->dev;
|
||||
priv_data->dev = dev;
|
||||
priv_data->pm_state = HSW_PM_STATE_D0;
|
||||
priv_data->soc_card = platform->component.card;
|
||||
priv_data->soc_card = component->card;
|
||||
|
||||
/* allocate DSP buffer page tables */
|
||||
for (i = 0; i < ARRAY_SIZE(hsw_dais); i++) {
|
||||
|
@ -1098,11 +1098,10 @@ static int hsw_pcm_probe(struct snd_soc_platform *platform)
|
|||
goto err;
|
||||
|
||||
/* enable runtime PM with auto suspend */
|
||||
pm_runtime_set_autosuspend_delay(platform->dev,
|
||||
SST_RUNTIME_SUSPEND_DELAY);
|
||||
pm_runtime_use_autosuspend(platform->dev);
|
||||
pm_runtime_enable(platform->dev);
|
||||
pm_runtime_idle(platform->dev);
|
||||
pm_runtime_set_autosuspend_delay(dev, SST_RUNTIME_SUSPEND_DELAY);
|
||||
pm_runtime_use_autosuspend(dev);
|
||||
pm_runtime_enable(dev);
|
||||
pm_runtime_idle(dev);
|
||||
|
||||
return 0;
|
||||
|
||||
|
@ -1116,13 +1115,13 @@ err:
|
|||
return ret;
|
||||
}
|
||||
|
||||
static int hsw_pcm_remove(struct snd_soc_platform *platform)
|
||||
static void hsw_pcm_remove(struct snd_soc_component *component)
|
||||
{
|
||||
struct hsw_priv_data *priv_data =
|
||||
snd_soc_platform_get_drvdata(platform);
|
||||
snd_soc_component_get_drvdata(component);
|
||||
int i;
|
||||
|
||||
pm_runtime_disable(platform->dev);
|
||||
pm_runtime_disable(component->dev);
|
||||
hsw_pcm_free_modules(priv_data);
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(hsw_dais); i++) {
|
||||
|
@ -1131,24 +1130,19 @@ static int hsw_pcm_remove(struct snd_soc_platform *platform)
|
|||
if (hsw_dais[i].capture.channels_min)
|
||||
snd_dma_free_pages(&priv_data->dmab[i][1]);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const struct snd_soc_platform_driver hsw_soc_platform = {
|
||||
static const struct snd_soc_component_driver hsw_dai_component = {
|
||||
.name = DRV_NAME,
|
||||
.probe = hsw_pcm_probe,
|
||||
.remove = hsw_pcm_remove,
|
||||
.ops = &hsw_pcm_ops,
|
||||
.pcm_new = hsw_pcm_new,
|
||||
};
|
||||
|
||||
static const struct snd_soc_component_driver hsw_dai_component = {
|
||||
.name = "haswell-dai",
|
||||
.controls = hsw_volume_controls,
|
||||
.num_controls = ARRAY_SIZE(hsw_volume_controls),
|
||||
.dapm_widgets = widgets,
|
||||
.controls = hsw_volume_controls,
|
||||
.num_controls = ARRAY_SIZE(hsw_volume_controls),
|
||||
.dapm_widgets = widgets,
|
||||
.num_dapm_widgets = ARRAY_SIZE(widgets),
|
||||
.dapm_routes = graph,
|
||||
.dapm_routes = graph,
|
||||
.num_dapm_routes = ARRAY_SIZE(graph),
|
||||
};
|
||||
|
||||
|
@ -1172,19 +1166,13 @@ static int hsw_pcm_dev_probe(struct platform_device *pdev)
|
|||
priv_data->hsw = sst_pdata->dsp;
|
||||
platform_set_drvdata(pdev, priv_data);
|
||||
|
||||
ret = snd_soc_register_platform(&pdev->dev, &hsw_soc_platform);
|
||||
ret = devm_snd_soc_register_component(&pdev->dev, &hsw_dai_component,
|
||||
hsw_dais, ARRAY_SIZE(hsw_dais));
|
||||
if (ret < 0)
|
||||
goto err_plat;
|
||||
|
||||
ret = snd_soc_register_component(&pdev->dev, &hsw_dai_component,
|
||||
hsw_dais, ARRAY_SIZE(hsw_dais));
|
||||
if (ret < 0)
|
||||
goto err_comp;
|
||||
|
||||
return 0;
|
||||
|
||||
err_comp:
|
||||
snd_soc_unregister_platform(&pdev->dev);
|
||||
err_plat:
|
||||
sst_hsw_dsp_free(&pdev->dev, sst_pdata);
|
||||
return 0;
|
||||
|
@ -1194,8 +1182,6 @@ static int hsw_pcm_dev_remove(struct platform_device *pdev)
|
|||
{
|
||||
struct sst_pdata *sst_pdata = dev_get_platdata(&pdev->dev);
|
||||
|
||||
snd_soc_unregister_platform(&pdev->dev);
|
||||
snd_soc_unregister_component(&pdev->dev);
|
||||
sst_hsw_dsp_free(&pdev->dev, sst_pdata);
|
||||
|
||||
return 0;
|
||||
|
|
|
@ -231,7 +231,7 @@ struct skl_debug *skl_debugfs_init(struct skl *skl)
|
|||
|
||||
/* create the debugfs dir with platform component's debugfs as parent */
|
||||
d->fs = debugfs_create_dir("dsp",
|
||||
skl->platform->component.debugfs_root);
|
||||
skl->component->debugfs_root);
|
||||
if (IS_ERR(d->fs) || !d->fs) {
|
||||
dev_err(&skl->pci->dev, "debugfs root creation failed\n");
|
||||
return NULL;
|
||||
|
|
|
@ -1326,23 +1326,23 @@ static int skl_populate_modules(struct skl *skl)
|
|||
return ret;
|
||||
}
|
||||
|
||||
static int skl_platform_soc_probe(struct snd_soc_platform *platform)
|
||||
static int skl_platform_soc_probe(struct snd_soc_component *component)
|
||||
{
|
||||
struct hdac_ext_bus *ebus = dev_get_drvdata(platform->dev);
|
||||
struct hdac_ext_bus *ebus = dev_get_drvdata(component->dev);
|
||||
struct skl *skl = ebus_to_skl(ebus);
|
||||
const struct skl_dsp_ops *ops;
|
||||
int ret;
|
||||
|
||||
pm_runtime_get_sync(platform->dev);
|
||||
pm_runtime_get_sync(component->dev);
|
||||
if ((ebus_to_hbus(ebus))->ppcap) {
|
||||
skl->platform = platform;
|
||||
skl->component = component;
|
||||
|
||||
/* init debugfs */
|
||||
skl->debugfs = skl_debugfs_init(skl);
|
||||
|
||||
ret = skl_tplg_init(platform, ebus);
|
||||
ret = skl_tplg_init(component, ebus);
|
||||
if (ret < 0) {
|
||||
dev_err(platform->dev, "Failed to init topology!\n");
|
||||
dev_err(component->dev, "Failed to init topology!\n");
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -1352,17 +1352,17 @@ static int skl_platform_soc_probe(struct snd_soc_platform *platform)
|
|||
return -EIO;
|
||||
|
||||
if (skl->skl_sst->is_first_boot == false) {
|
||||
dev_err(platform->dev, "DSP reports first boot done!!!\n");
|
||||
dev_err(component->dev, "DSP reports first boot done!!!\n");
|
||||
return -EIO;
|
||||
}
|
||||
|
||||
/* disable dynamic clock gating during fw and lib download */
|
||||
skl->skl_sst->enable_miscbdcge(platform->dev, false);
|
||||
skl->skl_sst->enable_miscbdcge(component->dev, false);
|
||||
|
||||
ret = ops->init_fw(platform->dev, skl->skl_sst);
|
||||
skl->skl_sst->enable_miscbdcge(platform->dev, true);
|
||||
ret = ops->init_fw(component->dev, skl->skl_sst);
|
||||
skl->skl_sst->enable_miscbdcge(component->dev, true);
|
||||
if (ret < 0) {
|
||||
dev_err(platform->dev, "Failed to boot first fw: %d\n", ret);
|
||||
dev_err(component->dev, "Failed to boot first fw: %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
skl_populate_modules(skl);
|
||||
|
@ -1375,22 +1375,20 @@ static int skl_platform_soc_probe(struct snd_soc_platform *platform)
|
|||
skl->cfg.astate_cfg);
|
||||
}
|
||||
}
|
||||
pm_runtime_mark_last_busy(platform->dev);
|
||||
pm_runtime_put_autosuspend(platform->dev);
|
||||
pm_runtime_mark_last_busy(component->dev);
|
||||
pm_runtime_put_autosuspend(component->dev);
|
||||
|
||||
return 0;
|
||||
}
|
||||
static const struct snd_soc_platform_driver skl_platform_drv = {
|
||||
|
||||
static const struct snd_soc_component_driver skl_component = {
|
||||
.name = "pcm",
|
||||
.probe = skl_platform_soc_probe,
|
||||
.ops = &skl_platform_ops,
|
||||
.pcm_new = skl_pcm_new,
|
||||
.pcm_free = skl_pcm_free,
|
||||
};
|
||||
|
||||
static const struct snd_soc_component_driver skl_component = {
|
||||
.name = "pcm",
|
||||
};
|
||||
|
||||
int skl_platform_register(struct device *dev)
|
||||
{
|
||||
int ret;
|
||||
|
@ -1402,12 +1400,6 @@ int skl_platform_register(struct device *dev)
|
|||
INIT_LIST_HEAD(&skl->ppl_list);
|
||||
INIT_LIST_HEAD(&skl->bind_list);
|
||||
|
||||
ret = snd_soc_register_platform(dev, &skl_platform_drv);
|
||||
if (ret) {
|
||||
dev_err(dev, "soc platform registration failed %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
skl->dais = kmemdup(skl_platform_dai, sizeof(skl_platform_dai),
|
||||
GFP_KERNEL);
|
||||
if (!skl->dais) {
|
||||
|
@ -1429,18 +1421,12 @@ int skl_platform_register(struct device *dev)
|
|||
num_dais += ARRAY_SIZE(skl_fe_dai);
|
||||
}
|
||||
|
||||
ret = snd_soc_register_component(dev, &skl_component,
|
||||
ret = devm_snd_soc_register_component(dev, &skl_component,
|
||||
skl->dais, num_dais);
|
||||
if (ret) {
|
||||
if (ret)
|
||||
dev_err(dev, "soc component registration failed %d\n", ret);
|
||||
goto err;
|
||||
}
|
||||
|
||||
return 0;
|
||||
err:
|
||||
snd_soc_unregister_platform(dev);
|
||||
return ret;
|
||||
|
||||
}
|
||||
|
||||
int skl_platform_unregister(struct device *dev)
|
||||
|
@ -1456,8 +1442,6 @@ int skl_platform_unregister(struct device *dev)
|
|||
}
|
||||
}
|
||||
|
||||
snd_soc_unregister_component(dev);
|
||||
snd_soc_unregister_platform(dev);
|
||||
kfree(skl->dais);
|
||||
|
||||
return 0;
|
||||
|
|
|
@ -2795,15 +2795,15 @@ static int skl_tplg_get_pvt_data(struct snd_soc_tplg_dapm_widget *tplg_w,
|
|||
return 0;
|
||||
}
|
||||
|
||||
static void skl_clear_pin_config(struct snd_soc_platform *platform,
|
||||
static void skl_clear_pin_config(struct snd_soc_component *component,
|
||||
struct snd_soc_dapm_widget *w)
|
||||
{
|
||||
int i;
|
||||
struct skl_module_cfg *mconfig;
|
||||
struct skl_pipe *pipe;
|
||||
|
||||
if (!strncmp(w->dapm->component->name, platform->component.name,
|
||||
strlen(platform->component.name))) {
|
||||
if (!strncmp(w->dapm->component->name, component->name,
|
||||
strlen(component->name))) {
|
||||
mconfig = w->priv;
|
||||
pipe = mconfig->pipe;
|
||||
for (i = 0; i < mconfig->module->max_input_pins; i++) {
|
||||
|
@ -2822,14 +2822,14 @@ static void skl_clear_pin_config(struct snd_soc_platform *platform,
|
|||
void skl_cleanup_resources(struct skl *skl)
|
||||
{
|
||||
struct skl_sst *ctx = skl->skl_sst;
|
||||
struct snd_soc_platform *soc_platform = skl->platform;
|
||||
struct snd_soc_component *soc_component = skl->component;
|
||||
struct snd_soc_dapm_widget *w;
|
||||
struct snd_soc_card *card;
|
||||
|
||||
if (soc_platform == NULL)
|
||||
if (soc_component == NULL)
|
||||
return;
|
||||
|
||||
card = soc_platform->component.card;
|
||||
card = soc_component->card;
|
||||
if (!card || !card->instantiated)
|
||||
return;
|
||||
|
||||
|
@ -2838,7 +2838,7 @@ void skl_cleanup_resources(struct skl *skl)
|
|||
|
||||
list_for_each_entry(w, &card->widgets, list) {
|
||||
if (is_skl_dsp_widget_type(w, ctx->dev) && w->priv != NULL)
|
||||
skl_clear_pin_config(soc_platform, w);
|
||||
skl_clear_pin_config(soc_component, w);
|
||||
}
|
||||
|
||||
skl_clear_module_cnt(ctx->dsp);
|
||||
|
@ -3485,19 +3485,19 @@ static struct snd_soc_tplg_ops skl_tplg_ops = {
|
|||
* widgets in a pipelines, so this helper - skl_tplg_create_pipe_widget_list()
|
||||
* helps to get the SKL type widgets in that pipeline
|
||||
*/
|
||||
static int skl_tplg_create_pipe_widget_list(struct snd_soc_platform *platform)
|
||||
static int skl_tplg_create_pipe_widget_list(struct snd_soc_component *component)
|
||||
{
|
||||
struct snd_soc_dapm_widget *w;
|
||||
struct skl_module_cfg *mcfg = NULL;
|
||||
struct skl_pipe_module *p_module = NULL;
|
||||
struct skl_pipe *pipe;
|
||||
|
||||
list_for_each_entry(w, &platform->component.card->widgets, list) {
|
||||
if (is_skl_dsp_widget_type(w, platform->dev) && w->priv) {
|
||||
list_for_each_entry(w, &component->card->widgets, list) {
|
||||
if (is_skl_dsp_widget_type(w, component->dev) && w->priv) {
|
||||
mcfg = w->priv;
|
||||
pipe = mcfg->pipe;
|
||||
|
||||
p_module = devm_kzalloc(platform->dev,
|
||||
p_module = devm_kzalloc(component->dev,
|
||||
sizeof(*p_module), GFP_KERNEL);
|
||||
if (!p_module)
|
||||
return -ENOMEM;
|
||||
|
@ -3540,7 +3540,7 @@ static void skl_tplg_set_pipe_type(struct skl *skl, struct skl_pipe *pipe)
|
|||
/*
|
||||
* SKL topology init routine
|
||||
*/
|
||||
int skl_tplg_init(struct snd_soc_platform *platform, struct hdac_ext_bus *ebus)
|
||||
int skl_tplg_init(struct snd_soc_component *component, struct hdac_ext_bus *ebus)
|
||||
{
|
||||
int ret;
|
||||
const struct firmware *fw;
|
||||
|
@ -3564,7 +3564,7 @@ int skl_tplg_init(struct snd_soc_platform *platform, struct hdac_ext_bus *ebus)
|
|||
* The complete tplg for SKL is loaded as index 0, we don't use
|
||||
* any other index
|
||||
*/
|
||||
ret = snd_soc_tplg_component_load(&platform->component,
|
||||
ret = snd_soc_tplg_component_load(component,
|
||||
&skl_tplg_ops, fw, 0);
|
||||
if (ret < 0) {
|
||||
dev_err(bus->dev, "tplg component load failed%d\n", ret);
|
||||
|
@ -3576,7 +3576,7 @@ int skl_tplg_init(struct snd_soc_platform *platform, struct hdac_ext_bus *ebus)
|
|||
skl->resource.max_mem = SKL_FW_MAX_MEM;
|
||||
|
||||
skl->tplg = fw;
|
||||
ret = skl_tplg_create_pipe_widget_list(platform);
|
||||
ret = skl_tplg_create_pipe_widget_list(component);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
|
|
|
@ -469,7 +469,7 @@ int skl_dsp_set_dma_control(struct skl_sst *ctx, u32 *caps,
|
|||
u32 caps_size, u32 node_id);
|
||||
void skl_tplg_set_be_dmic_config(struct snd_soc_dai *dai,
|
||||
struct skl_pipe_params *params, int stream);
|
||||
int skl_tplg_init(struct snd_soc_platform *platform,
|
||||
int skl_tplg_init(struct snd_soc_component *component,
|
||||
struct hdac_ext_bus *ebus);
|
||||
struct skl_module_cfg *skl_tplg_fe_get_cpr_module(
|
||||
struct snd_soc_dai *dai, int stream);
|
||||
|
|
|
@ -74,7 +74,7 @@ struct skl {
|
|||
struct platform_device *dmic_dev;
|
||||
struct platform_device *i2s_dev;
|
||||
struct platform_device *clk_dev;
|
||||
struct snd_soc_platform *platform;
|
||||
struct snd_soc_component *component;
|
||||
struct snd_soc_dai_driver *dais;
|
||||
|
||||
struct nhlt_acpi_table *nhlt; /* nhlt ptr */
|
||||
|
|
|
@ -318,7 +318,8 @@ static void kirkwood_dma_free_dma_buffers(struct snd_pcm *pcm)
|
|||
}
|
||||
}
|
||||
|
||||
const struct snd_soc_platform_driver kirkwood_soc_platform = {
|
||||
const struct snd_soc_component_driver kirkwood_soc_component = {
|
||||
.name = DRV_NAME,
|
||||
.ops = &kirkwood_dma_ops,
|
||||
.pcm_new = kirkwood_dma_new,
|
||||
.pcm_free = kirkwood_dma_free_dma_buffers,
|
||||
|
|
|
@ -26,8 +26,6 @@
|
|||
|
||||
#include "kirkwood.h"
|
||||
|
||||
#define DRV_NAME "mvebu-audio"
|
||||
|
||||
#define KIRKWOOD_I2S_FORMATS \
|
||||
(SNDRV_PCM_FMTBIT_S16_LE | \
|
||||
SNDRV_PCM_FMTBIT_S24_LE | \
|
||||
|
@ -524,10 +522,6 @@ static struct snd_soc_dai_driver kirkwood_i2s_dai_extclk[2] = {
|
|||
},
|
||||
};
|
||||
|
||||
static const struct snd_soc_component_driver kirkwood_i2s_component = {
|
||||
.name = DRV_NAME,
|
||||
};
|
||||
|
||||
static int kirkwood_i2s_dev_probe(struct platform_device *pdev)
|
||||
{
|
||||
struct kirkwood_asoc_platform_data *data = pdev->dev.platform_data;
|
||||
|
@ -601,24 +595,17 @@ static int kirkwood_i2s_dev_probe(struct platform_device *pdev)
|
|||
priv->ctl_rec |= KIRKWOOD_RECCTL_BURST_128;
|
||||
}
|
||||
|
||||
err = snd_soc_register_component(&pdev->dev, &kirkwood_i2s_component,
|
||||
err = devm_snd_soc_register_component(&pdev->dev, &kirkwood_soc_component,
|
||||
soc_dai, 2);
|
||||
if (err) {
|
||||
dev_err(&pdev->dev, "snd_soc_register_component failed\n");
|
||||
goto err_component;
|
||||
}
|
||||
|
||||
err = snd_soc_register_platform(&pdev->dev, &kirkwood_soc_platform);
|
||||
if (err) {
|
||||
dev_err(&pdev->dev, "snd_soc_register_platform failed\n");
|
||||
goto err_platform;
|
||||
}
|
||||
|
||||
kirkwood_i2s_init(priv);
|
||||
|
||||
return 0;
|
||||
err_platform:
|
||||
snd_soc_unregister_component(&pdev->dev);
|
||||
|
||||
err_component:
|
||||
if (!IS_ERR(priv->extclk))
|
||||
clk_disable_unprepare(priv->extclk);
|
||||
|
@ -631,9 +618,6 @@ static int kirkwood_i2s_dev_remove(struct platform_device *pdev)
|
|||
{
|
||||
struct kirkwood_dma_data *priv = dev_get_drvdata(&pdev->dev);
|
||||
|
||||
snd_soc_unregister_platform(&pdev->dev);
|
||||
snd_soc_unregister_component(&pdev->dev);
|
||||
|
||||
if (!IS_ERR(priv->extclk))
|
||||
clk_disable_unprepare(priv->extclk);
|
||||
clk_disable_unprepare(priv->clk);
|
||||
|
|
|
@ -12,6 +12,8 @@
|
|||
#ifndef _KIRKWOOD_AUDIO_H
|
||||
#define _KIRKWOOD_AUDIO_H
|
||||
|
||||
#define DRV_NAME "mvebu-audio"
|
||||
|
||||
#define KIRKWOOD_RECORD_WIN 0
|
||||
#define KIRKWOOD_PLAYBACK_WIN 1
|
||||
#define KIRKWOOD_MAX_AUDIO_WIN 2
|
||||
|
@ -143,6 +145,6 @@ struct kirkwood_dma_data {
|
|||
int burst;
|
||||
};
|
||||
|
||||
extern const struct snd_soc_platform_driver kirkwood_soc_platform;
|
||||
extern const struct snd_soc_component_driver kirkwood_soc_component;
|
||||
|
||||
#endif
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
#include <linux/pm_runtime.h>
|
||||
#include <linux/regmap.h>
|
||||
#include <sound/soc.h>
|
||||
#include "mtk-afe-platform-driver.h"
|
||||
#include "mtk-afe-fe-dai.h"
|
||||
#include "mtk-base-afe.h"
|
||||
|
||||
|
@ -43,7 +44,8 @@ int mtk_afe_fe_startup(struct snd_pcm_substream *substream,
|
|||
struct snd_soc_dai *dai)
|
||||
{
|
||||
struct snd_soc_pcm_runtime *rtd = substream->private_data;
|
||||
struct mtk_base_afe *afe = snd_soc_platform_get_drvdata(rtd->platform);
|
||||
struct snd_soc_component *component = snd_soc_rtdcom_lookup(rtd, AFE_PCM_NAME);
|
||||
struct mtk_base_afe *afe = snd_soc_component_get_drvdata(component);
|
||||
struct snd_pcm_runtime *runtime = substream->runtime;
|
||||
int memif_num = rtd->cpu_dai->id;
|
||||
struct mtk_base_afe_memif *memif = &afe->memif[memif_num];
|
||||
|
@ -105,7 +107,8 @@ void mtk_afe_fe_shutdown(struct snd_pcm_substream *substream,
|
|||
struct snd_soc_dai *dai)
|
||||
{
|
||||
struct snd_soc_pcm_runtime *rtd = substream->private_data;
|
||||
struct mtk_base_afe *afe = snd_soc_platform_get_drvdata(rtd->platform);
|
||||
struct snd_soc_component *component = snd_soc_rtdcom_lookup(rtd, AFE_PCM_NAME);
|
||||
struct mtk_base_afe *afe = snd_soc_component_get_drvdata(component);
|
||||
struct mtk_base_afe_memif *memif = &afe->memif[rtd->cpu_dai->id];
|
||||
int irq_id;
|
||||
|
||||
|
@ -128,7 +131,8 @@ int mtk_afe_fe_hw_params(struct snd_pcm_substream *substream,
|
|||
struct snd_soc_dai *dai)
|
||||
{
|
||||
struct snd_soc_pcm_runtime *rtd = substream->private_data;
|
||||
struct mtk_base_afe *afe = snd_soc_platform_get_drvdata(rtd->platform);
|
||||
struct snd_soc_component *component = snd_soc_rtdcom_lookup(rtd, AFE_PCM_NAME);
|
||||
struct mtk_base_afe *afe = snd_soc_component_get_drvdata(component);
|
||||
struct mtk_base_afe_memif *memif = &afe->memif[rtd->cpu_dai->id];
|
||||
int msb_at_bit33 = 0;
|
||||
int ret, fs = 0;
|
||||
|
@ -192,7 +196,8 @@ int mtk_afe_fe_trigger(struct snd_pcm_substream *substream, int cmd,
|
|||
{
|
||||
struct snd_soc_pcm_runtime *rtd = substream->private_data;
|
||||
struct snd_pcm_runtime * const runtime = substream->runtime;
|
||||
struct mtk_base_afe *afe = snd_soc_platform_get_drvdata(rtd->platform);
|
||||
struct snd_soc_component *component = snd_soc_rtdcom_lookup(rtd, AFE_PCM_NAME);
|
||||
struct mtk_base_afe *afe = snd_soc_component_get_drvdata(component);
|
||||
struct mtk_base_afe_memif *memif = &afe->memif[rtd->cpu_dai->id];
|
||||
struct mtk_base_afe_irq *irqs = &afe->irqs[memif->irq_usage];
|
||||
const struct mtk_base_irq_data *irq_data = irqs->irq_data;
|
||||
|
@ -255,7 +260,8 @@ int mtk_afe_fe_prepare(struct snd_pcm_substream *substream,
|
|||
struct snd_soc_dai *dai)
|
||||
{
|
||||
struct snd_soc_pcm_runtime *rtd = substream->private_data;
|
||||
struct mtk_base_afe *afe = snd_soc_platform_get_drvdata(rtd->platform);
|
||||
struct snd_soc_component *component = snd_soc_rtdcom_lookup(rtd, AFE_PCM_NAME);
|
||||
struct mtk_base_afe *afe = snd_soc_component_get_drvdata(component);
|
||||
struct mtk_base_afe_memif *memif = &afe->memif[rtd->cpu_dai->id];
|
||||
int hd_audio = 0;
|
||||
|
||||
|
|
|
@ -25,7 +25,8 @@ static snd_pcm_uframes_t mtk_afe_pcm_pointer
|
|||
(struct snd_pcm_substream *substream)
|
||||
{
|
||||
struct snd_soc_pcm_runtime *rtd = substream->private_data;
|
||||
struct mtk_base_afe *afe = snd_soc_platform_get_drvdata(rtd->platform);
|
||||
struct snd_soc_component *component = snd_soc_rtdcom_lookup(rtd, AFE_PCM_NAME);
|
||||
struct mtk_base_afe *afe = snd_soc_component_get_drvdata(component);
|
||||
struct mtk_base_afe_memif *memif = &afe->memif[rtd->cpu_dai->id];
|
||||
const struct mtk_base_memif_data *memif_data = memif->data;
|
||||
struct regmap *regmap = afe->regmap;
|
||||
|
@ -65,7 +66,8 @@ static int mtk_afe_pcm_new(struct snd_soc_pcm_runtime *rtd)
|
|||
size_t size;
|
||||
struct snd_card *card = rtd->card->snd_card;
|
||||
struct snd_pcm *pcm = rtd->pcm;
|
||||
struct mtk_base_afe *afe = snd_soc_platform_get_drvdata(rtd->platform);
|
||||
struct snd_soc_component *component = snd_soc_rtdcom_lookup(rtd, AFE_PCM_NAME);
|
||||
struct mtk_base_afe *afe = snd_soc_component_get_drvdata(component);
|
||||
|
||||
size = afe->mtk_afe_hardware->buffer_bytes_max;
|
||||
return snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV,
|
||||
|
@ -77,7 +79,8 @@ static void mtk_afe_pcm_free(struct snd_pcm *pcm)
|
|||
snd_pcm_lib_preallocate_free_for_all(pcm);
|
||||
}
|
||||
|
||||
const struct snd_soc_platform_driver mtk_afe_pcm_platform = {
|
||||
const struct snd_soc_component_driver mtk_afe_pcm_platform = {
|
||||
.name = AFE_PCM_NAME,
|
||||
.ops = &mtk_afe_pcm_ops,
|
||||
.pcm_new = mtk_afe_pcm_new,
|
||||
.pcm_free = mtk_afe_pcm_free,
|
||||
|
|
|
@ -17,7 +17,8 @@
|
|||
#ifndef _MTK_AFE_PLATFORM_DRIVER_H_
|
||||
#define _MTK_AFE_PLATFORM_DRIVER_H_
|
||||
|
||||
extern const struct snd_soc_platform_driver mtk_afe_pcm_platform;
|
||||
#define AFE_PCM_NAME "mtk-afe-pcm"
|
||||
extern const struct snd_soc_component_driver mtk_afe_pcm_platform;
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
@ -93,7 +93,8 @@ static int mt2701_afe_i2s_startup(struct snd_pcm_substream *substream,
|
|||
struct snd_soc_dai *dai)
|
||||
{
|
||||
struct snd_soc_pcm_runtime *rtd = substream->private_data;
|
||||
struct mtk_base_afe *afe = snd_soc_platform_get_drvdata(rtd->platform);
|
||||
struct snd_soc_component *component = snd_soc_rtdcom_lookup(rtd, AFE_PCM_NAME);
|
||||
struct mtk_base_afe *afe = snd_soc_component_get_drvdata(component);
|
||||
int i2s_num = mt2701_dai_num_to_i2s(afe, dai->id);
|
||||
|
||||
if (i2s_num < 0)
|
||||
|
@ -108,7 +109,8 @@ static int mt2701_afe_i2s_path_shutdown(struct snd_pcm_substream *substream,
|
|||
int dir_invert)
|
||||
{
|
||||
struct snd_soc_pcm_runtime *rtd = substream->private_data;
|
||||
struct mtk_base_afe *afe = snd_soc_platform_get_drvdata(rtd->platform);
|
||||
struct snd_soc_component *component = snd_soc_rtdcom_lookup(rtd, AFE_PCM_NAME);
|
||||
struct mtk_base_afe *afe = snd_soc_component_get_drvdata(component);
|
||||
struct mt2701_afe_private *afe_priv = afe->platform_priv;
|
||||
struct mt2701_i2s_path *i2s_path = &afe_priv->i2s_path[i2s_num];
|
||||
const struct mt2701_i2s_data *i2s_data;
|
||||
|
@ -144,7 +146,8 @@ static void mt2701_afe_i2s_shutdown(struct snd_pcm_substream *substream,
|
|||
struct snd_soc_dai *dai)
|
||||
{
|
||||
struct snd_soc_pcm_runtime *rtd = substream->private_data;
|
||||
struct mtk_base_afe *afe = snd_soc_platform_get_drvdata(rtd->platform);
|
||||
struct snd_soc_component *component = snd_soc_rtdcom_lookup(rtd, AFE_PCM_NAME);
|
||||
struct mtk_base_afe *afe = snd_soc_component_get_drvdata(component);
|
||||
struct mt2701_afe_private *afe_priv = afe->platform_priv;
|
||||
int i2s_num = mt2701_dai_num_to_i2s(afe, dai->id);
|
||||
struct mt2701_i2s_path *i2s_path;
|
||||
|
@ -176,7 +179,8 @@ static int mt2701_i2s_path_prepare_enable(struct snd_pcm_substream *substream,
|
|||
int dir_invert)
|
||||
{
|
||||
struct snd_soc_pcm_runtime *rtd = substream->private_data;
|
||||
struct mtk_base_afe *afe = snd_soc_platform_get_drvdata(rtd->platform);
|
||||
struct snd_soc_component *component = snd_soc_rtdcom_lookup(rtd, AFE_PCM_NAME);
|
||||
struct mtk_base_afe *afe = snd_soc_component_get_drvdata(component);
|
||||
struct mt2701_afe_private *afe_priv = afe->platform_priv;
|
||||
struct mt2701_i2s_path *i2s_path = &afe_priv->i2s_path[i2s_num];
|
||||
const struct mt2701_i2s_data *i2s_data;
|
||||
|
@ -247,7 +251,8 @@ static int mt2701_afe_i2s_prepare(struct snd_pcm_substream *substream,
|
|||
{
|
||||
int clk_domain;
|
||||
struct snd_soc_pcm_runtime *rtd = substream->private_data;
|
||||
struct mtk_base_afe *afe = snd_soc_platform_get_drvdata(rtd->platform);
|
||||
struct snd_soc_component *component = snd_soc_rtdcom_lookup(rtd, AFE_PCM_NAME);
|
||||
struct mtk_base_afe *afe = snd_soc_component_get_drvdata(component);
|
||||
struct mt2701_afe_private *afe_priv = afe->platform_priv;
|
||||
int i2s_num = mt2701_dai_num_to_i2s(afe, dai->id);
|
||||
struct mt2701_i2s_path *i2s_path;
|
||||
|
@ -312,7 +317,8 @@ static int mt2701_btmrg_startup(struct snd_pcm_substream *substream,
|
|||
struct snd_soc_dai *dai)
|
||||
{
|
||||
struct snd_soc_pcm_runtime *rtd = substream->private_data;
|
||||
struct mtk_base_afe *afe = snd_soc_platform_get_drvdata(rtd->platform);
|
||||
struct snd_soc_component *component = snd_soc_rtdcom_lookup(rtd, AFE_PCM_NAME);
|
||||
struct mtk_base_afe *afe = snd_soc_component_get_drvdata(component);
|
||||
struct mt2701_afe_private *afe_priv = afe->platform_priv;
|
||||
int ret;
|
||||
|
||||
|
@ -329,7 +335,8 @@ static int mt2701_btmrg_hw_params(struct snd_pcm_substream *substream,
|
|||
struct snd_soc_dai *dai)
|
||||
{
|
||||
struct snd_soc_pcm_runtime *rtd = substream->private_data;
|
||||
struct mtk_base_afe *afe = snd_soc_platform_get_drvdata(rtd->platform);
|
||||
struct snd_soc_component *component = snd_soc_rtdcom_lookup(rtd, AFE_PCM_NAME);
|
||||
struct mtk_base_afe *afe = snd_soc_component_get_drvdata(component);
|
||||
int stream_fs;
|
||||
u32 val, msk;
|
||||
|
||||
|
@ -372,7 +379,8 @@ static void mt2701_btmrg_shutdown(struct snd_pcm_substream *substream,
|
|||
struct snd_soc_dai *dai)
|
||||
{
|
||||
struct snd_soc_pcm_runtime *rtd = substream->private_data;
|
||||
struct mtk_base_afe *afe = snd_soc_platform_get_drvdata(rtd->platform);
|
||||
struct snd_soc_component *component = snd_soc_rtdcom_lookup(rtd, AFE_PCM_NAME);
|
||||
struct mtk_base_afe *afe = snd_soc_component_get_drvdata(component);
|
||||
struct mt2701_afe_private *afe_priv = afe->platform_priv;
|
||||
|
||||
/* if the other direction stream is not occupied */
|
||||
|
@ -392,7 +400,8 @@ static int mt2701_simple_fe_startup(struct snd_pcm_substream *substream,
|
|||
struct snd_soc_dai *dai)
|
||||
{
|
||||
struct snd_soc_pcm_runtime *rtd = substream->private_data;
|
||||
struct mtk_base_afe *afe = snd_soc_platform_get_drvdata(rtd->platform);
|
||||
struct snd_soc_component *component = snd_soc_rtdcom_lookup(rtd, AFE_PCM_NAME);
|
||||
struct mtk_base_afe *afe = snd_soc_component_get_drvdata(component);
|
||||
int stream_dir = substream->stream;
|
||||
int memif_num = rtd->cpu_dai->id;
|
||||
struct mtk_base_afe_memif *memif_tmp;
|
||||
|
@ -414,7 +423,8 @@ static int mt2701_simple_fe_hw_params(struct snd_pcm_substream *substream,
|
|||
struct snd_soc_dai *dai)
|
||||
{
|
||||
struct snd_soc_pcm_runtime *rtd = substream->private_data;
|
||||
struct mtk_base_afe *afe = snd_soc_platform_get_drvdata(rtd->platform);
|
||||
struct snd_soc_component *component = snd_soc_rtdcom_lookup(rtd, AFE_PCM_NAME);
|
||||
struct mtk_base_afe *afe = snd_soc_component_get_drvdata(component);
|
||||
int stream_dir = substream->stream;
|
||||
|
||||
/* single DL use PAIR_INTERLEAVE */
|
||||
|
@ -431,7 +441,8 @@ static int mt2701_dlm_fe_startup(struct snd_pcm_substream *substream,
|
|||
struct snd_soc_dai *dai)
|
||||
{
|
||||
struct snd_soc_pcm_runtime *rtd = substream->private_data;
|
||||
struct mtk_base_afe *afe = snd_soc_platform_get_drvdata(rtd->platform);
|
||||
struct snd_soc_component *component = snd_soc_rtdcom_lookup(rtd, AFE_PCM_NAME);
|
||||
struct mtk_base_afe *afe = snd_soc_component_get_drvdata(component);
|
||||
struct mtk_base_afe_memif *memif_tmp;
|
||||
const struct mtk_base_memif_data *memif_data;
|
||||
int i;
|
||||
|
@ -458,7 +469,8 @@ static void mt2701_dlm_fe_shutdown(struct snd_pcm_substream *substream,
|
|||
struct snd_soc_dai *dai)
|
||||
{
|
||||
struct snd_soc_pcm_runtime *rtd = substream->private_data;
|
||||
struct mtk_base_afe *afe = snd_soc_platform_get_drvdata(rtd->platform);
|
||||
struct snd_soc_component *component = snd_soc_rtdcom_lookup(rtd, AFE_PCM_NAME);
|
||||
struct mtk_base_afe *afe = snd_soc_component_get_drvdata(component);
|
||||
const struct mtk_base_memif_data *memif_data;
|
||||
int i;
|
||||
|
||||
|
@ -477,7 +489,8 @@ static int mt2701_dlm_fe_hw_params(struct snd_pcm_substream *substream,
|
|||
struct snd_soc_dai *dai)
|
||||
{
|
||||
struct snd_soc_pcm_runtime *rtd = substream->private_data;
|
||||
struct mtk_base_afe *afe = snd_soc_platform_get_drvdata(rtd->platform);
|
||||
struct snd_soc_component *component = snd_soc_rtdcom_lookup(rtd, AFE_PCM_NAME);
|
||||
struct mtk_base_afe *afe = snd_soc_component_get_drvdata(component);
|
||||
int channels = params_channels(params);
|
||||
|
||||
regmap_update_bits(afe->regmap,
|
||||
|
@ -500,7 +513,8 @@ static int mt2701_dlm_fe_trigger(struct snd_pcm_substream *substream,
|
|||
int cmd, struct snd_soc_dai *dai)
|
||||
{
|
||||
struct snd_soc_pcm_runtime *rtd = substream->private_data;
|
||||
struct mtk_base_afe *afe = snd_soc_platform_get_drvdata(rtd->platform);
|
||||
struct snd_soc_component *component = snd_soc_rtdcom_lookup(rtd, AFE_PCM_NAME);
|
||||
struct mtk_base_afe *afe = snd_soc_component_get_drvdata(component);
|
||||
struct mtk_base_afe_memif *memif_tmp = &afe->memif[MT2701_MEMIF_DL1];
|
||||
|
||||
switch (cmd) {
|
||||
|
@ -1517,7 +1531,8 @@ static int mt2701_afe_pcm_dev_probe(struct platform_device *pdev)
|
|||
}
|
||||
pm_runtime_get_sync(dev);
|
||||
|
||||
ret = snd_soc_register_platform(dev, &mtk_afe_pcm_platform);
|
||||
ret = devm_snd_soc_register_component(&pdev->dev, &mtk_afe_pcm_platform,
|
||||
NULL, 0);
|
||||
if (ret) {
|
||||
dev_warn(dev, "err_platform\n");
|
||||
goto err_platform;
|
||||
|
@ -1526,13 +1541,11 @@ static int mt2701_afe_pcm_dev_probe(struct platform_device *pdev)
|
|||
ret = mt2701_afe_add_component(afe);
|
||||
if (ret) {
|
||||
dev_warn(dev, "err_dai_component\n");
|
||||
goto err_dai_component;
|
||||
goto err_platform;
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
err_dai_component:
|
||||
snd_soc_unregister_platform(dev);
|
||||
err_platform:
|
||||
pm_runtime_put_sync(dev);
|
||||
err_pm_disable:
|
||||
|
@ -1549,7 +1562,6 @@ static int mt2701_afe_pcm_dev_remove(struct platform_device *pdev)
|
|||
mt2701_afe_runtime_suspend(&pdev->dev);
|
||||
|
||||
snd_soc_unregister_component(&pdev->dev);
|
||||
snd_soc_unregister_platform(&pdev->dev);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -304,7 +304,8 @@ static int mt8173_afe_i2s_startup(struct snd_pcm_substream *substream,
|
|||
struct snd_soc_dai *dai)
|
||||
{
|
||||
struct snd_soc_pcm_runtime *rtd = substream->private_data;
|
||||
struct mtk_base_afe *afe = snd_soc_platform_get_drvdata(rtd->platform);
|
||||
struct snd_soc_component *component = snd_soc_rtdcom_lookup(rtd, AFE_PCM_NAME);
|
||||
struct mtk_base_afe *afe = snd_soc_component_get_drvdata(component);
|
||||
|
||||
if (dai->active)
|
||||
return 0;
|
||||
|
@ -318,7 +319,8 @@ static void mt8173_afe_i2s_shutdown(struct snd_pcm_substream *substream,
|
|||
struct snd_soc_dai *dai)
|
||||
{
|
||||
struct snd_soc_pcm_runtime *rtd = substream->private_data;
|
||||
struct mtk_base_afe *afe = snd_soc_platform_get_drvdata(rtd->platform);
|
||||
struct snd_soc_component *component = snd_soc_rtdcom_lookup(rtd, AFE_PCM_NAME);
|
||||
struct mtk_base_afe *afe = snd_soc_component_get_drvdata(component);
|
||||
|
||||
if (dai->active)
|
||||
return;
|
||||
|
@ -334,7 +336,8 @@ static int mt8173_afe_i2s_prepare(struct snd_pcm_substream *substream,
|
|||
{
|
||||
struct snd_soc_pcm_runtime *rtd = substream->private_data;
|
||||
struct snd_pcm_runtime * const runtime = substream->runtime;
|
||||
struct mtk_base_afe *afe = snd_soc_platform_get_drvdata(rtd->platform);
|
||||
struct snd_soc_component *component = snd_soc_rtdcom_lookup(rtd, AFE_PCM_NAME);
|
||||
struct mtk_base_afe *afe = snd_soc_component_get_drvdata(component);
|
||||
struct mt8173_afe_private *afe_priv = afe->platform_priv;
|
||||
int ret;
|
||||
|
||||
|
@ -356,7 +359,8 @@ static int mt8173_afe_hdmi_startup(struct snd_pcm_substream *substream,
|
|||
struct snd_soc_dai *dai)
|
||||
{
|
||||
struct snd_soc_pcm_runtime *rtd = substream->private_data;
|
||||
struct mtk_base_afe *afe = snd_soc_platform_get_drvdata(rtd->platform);
|
||||
struct snd_soc_component *component = snd_soc_rtdcom_lookup(rtd, AFE_PCM_NAME);
|
||||
struct mtk_base_afe *afe = snd_soc_component_get_drvdata(component);
|
||||
struct mt8173_afe_private *afe_priv = afe->platform_priv;
|
||||
|
||||
if (dai->active)
|
||||
|
@ -371,7 +375,8 @@ static void mt8173_afe_hdmi_shutdown(struct snd_pcm_substream *substream,
|
|||
struct snd_soc_dai *dai)
|
||||
{
|
||||
struct snd_soc_pcm_runtime *rtd = substream->private_data;
|
||||
struct mtk_base_afe *afe = snd_soc_platform_get_drvdata(rtd->platform);
|
||||
struct snd_soc_component *component = snd_soc_rtdcom_lookup(rtd, AFE_PCM_NAME);
|
||||
struct mtk_base_afe *afe = snd_soc_component_get_drvdata(component);
|
||||
struct mt8173_afe_private *afe_priv = afe->platform_priv;
|
||||
|
||||
if (dai->active)
|
||||
|
@ -386,7 +391,8 @@ static int mt8173_afe_hdmi_prepare(struct snd_pcm_substream *substream,
|
|||
{
|
||||
struct snd_soc_pcm_runtime *rtd = substream->private_data;
|
||||
struct snd_pcm_runtime * const runtime = substream->runtime;
|
||||
struct mtk_base_afe *afe = snd_soc_platform_get_drvdata(rtd->platform);
|
||||
struct snd_soc_component *component = snd_soc_rtdcom_lookup(rtd, AFE_PCM_NAME);
|
||||
struct mtk_base_afe *afe = snd_soc_component_get_drvdata(component);
|
||||
struct mt8173_afe_private *afe_priv = afe->platform_priv;
|
||||
|
||||
unsigned int val;
|
||||
|
@ -449,7 +455,8 @@ static int mt8173_afe_hdmi_trigger(struct snd_pcm_substream *substream, int cmd,
|
|||
struct snd_soc_dai *dai)
|
||||
{
|
||||
struct snd_soc_pcm_runtime *rtd = substream->private_data;
|
||||
struct mtk_base_afe *afe = snd_soc_platform_get_drvdata(rtd->platform);
|
||||
struct snd_soc_component *component = snd_soc_rtdcom_lookup(rtd, AFE_PCM_NAME);
|
||||
struct mtk_base_afe *afe = snd_soc_component_get_drvdata(component);
|
||||
|
||||
dev_info(afe->dev, "%s cmd=%d %s\n", __func__, cmd, dai->name);
|
||||
|
||||
|
@ -498,7 +505,8 @@ static int mt8173_memif_fs(struct snd_pcm_substream *substream,
|
|||
unsigned int rate)
|
||||
{
|
||||
struct snd_soc_pcm_runtime *rtd = substream->private_data;
|
||||
struct mtk_base_afe *afe = snd_soc_platform_get_drvdata(rtd->platform);
|
||||
struct snd_soc_component *component = snd_soc_rtdcom_lookup(rtd, AFE_PCM_NAME);
|
||||
struct mtk_base_afe *afe = snd_soc_component_get_drvdata(component);
|
||||
struct mtk_base_afe_memif *memif = &afe->memif[rtd->cpu_dai->id];
|
||||
int fs;
|
||||
|
||||
|
@ -1172,31 +1180,29 @@ static int mt8173_afe_pcm_dev_probe(struct platform_device *pdev)
|
|||
afe->runtime_resume = mt8173_afe_runtime_resume;
|
||||
afe->runtime_suspend = mt8173_afe_runtime_suspend;
|
||||
|
||||
ret = snd_soc_register_platform(&pdev->dev, &mtk_afe_pcm_platform);
|
||||
ret = devm_snd_soc_register_component(&pdev->dev,
|
||||
&mtk_afe_pcm_platform,
|
||||
NULL, 0);
|
||||
if (ret)
|
||||
goto err_pm_disable;
|
||||
|
||||
ret = snd_soc_register_component(&pdev->dev,
|
||||
ret = devm_snd_soc_register_component(&pdev->dev,
|
||||
&mt8173_afe_pcm_dai_component,
|
||||
mt8173_afe_pcm_dais,
|
||||
ARRAY_SIZE(mt8173_afe_pcm_dais));
|
||||
if (ret)
|
||||
goto err_platform;
|
||||
goto err_pm_disable;
|
||||
|
||||
ret = snd_soc_register_component(&pdev->dev,
|
||||
ret = devm_snd_soc_register_component(&pdev->dev,
|
||||
&mt8173_afe_hdmi_dai_component,
|
||||
mt8173_afe_hdmi_dais,
|
||||
ARRAY_SIZE(mt8173_afe_hdmi_dais));
|
||||
if (ret)
|
||||
goto err_comp;
|
||||
goto err_pm_disable;
|
||||
|
||||
dev_info(&pdev->dev, "MT8173 AFE driver initialized.\n");
|
||||
return 0;
|
||||
|
||||
err_comp:
|
||||
snd_soc_unregister_component(&pdev->dev);
|
||||
err_platform:
|
||||
snd_soc_unregister_platform(&pdev->dev);
|
||||
err_pm_disable:
|
||||
pm_runtime_disable(&pdev->dev);
|
||||
return ret;
|
||||
|
@ -1207,8 +1213,6 @@ static int mt8173_afe_pcm_dev_remove(struct platform_device *pdev)
|
|||
pm_runtime_disable(&pdev->dev);
|
||||
if (!pm_runtime_status_suspended(&pdev->dev))
|
||||
mt8173_afe_runtime_suspend(&pdev->dev);
|
||||
snd_soc_unregister_component(&pdev->dev);
|
||||
snd_soc_unregister_platform(&pdev->dev);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -299,14 +299,15 @@ static int nuc900_dma_new(struct snd_soc_pcm_runtime *rtd)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static const struct snd_soc_platform_driver nuc900_soc_platform = {
|
||||
static const struct snd_soc_component_driver nuc900_soc_component = {
|
||||
.ops = &nuc900_dma_ops,
|
||||
.pcm_new = nuc900_dma_new,
|
||||
};
|
||||
|
||||
static int nuc900_soc_platform_probe(struct platform_device *pdev)
|
||||
{
|
||||
return devm_snd_soc_register_platform(&pdev->dev, &nuc900_soc_platform);
|
||||
return devm_snd_soc_register_component(&pdev->dev, &nuc900_soc_component,
|
||||
NULL, 0);
|
||||
}
|
||||
|
||||
static struct platform_driver nuc900_pcm_driver = {
|
||||
|
|
|
@ -243,7 +243,7 @@ out:
|
|||
return ret;
|
||||
}
|
||||
|
||||
static const struct snd_soc_platform_driver omap_soc_platform = {
|
||||
static const struct snd_soc_component_driver omap_soc_component = {
|
||||
.ops = &omap_pcm_ops,
|
||||
.pcm_new = omap_pcm_new,
|
||||
.pcm_free = omap_pcm_free_dma_buffers,
|
||||
|
@ -252,7 +252,8 @@ static const struct snd_soc_platform_driver omap_soc_platform = {
|
|||
int omap_pcm_platform_register(struct device *dev)
|
||||
{
|
||||
omap_pcm_limit_supported_formats();
|
||||
return devm_snd_soc_register_platform(dev, &omap_soc_platform);
|
||||
return devm_snd_soc_register_component(dev, &omap_soc_component,
|
||||
NULL, 0);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(omap_pcm_platform_register);
|
||||
|
||||
|
|
|
@ -25,6 +25,8 @@
|
|||
#include <sound/soc.h>
|
||||
#include <sound/dmaengine_pcm.h>
|
||||
|
||||
#define DRV_NAME "mmp-pcm"
|
||||
|
||||
struct mmp_dma_data {
|
||||
int ssp_id;
|
||||
struct resource *dma_res;
|
||||
|
@ -100,7 +102,8 @@ static bool filter(struct dma_chan *chan, void *param)
|
|||
static int mmp_pcm_open(struct snd_pcm_substream *substream)
|
||||
{
|
||||
struct snd_soc_pcm_runtime *rtd = substream->private_data;
|
||||
struct platform_device *pdev = to_platform_device(rtd->platform->dev);
|
||||
struct snd_soc_component *component = snd_soc_rtdcom_lookup(rtd, DRV_NAME);
|
||||
struct platform_device *pdev = to_platform_device(component->dev);
|
||||
struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
|
||||
struct mmp_dma_data dma_data;
|
||||
struct resource *r;
|
||||
|
@ -211,7 +214,8 @@ err:
|
|||
return ret;
|
||||
}
|
||||
|
||||
static const struct snd_soc_platform_driver mmp_soc_platform = {
|
||||
static const struct snd_soc_component_driver mmp_soc_component = {
|
||||
.name = DRV_NAME,
|
||||
.ops = &mmp_pcm_ops,
|
||||
.pcm_new = mmp_pcm_new,
|
||||
.pcm_free = mmp_pcm_free_dma_buffers,
|
||||
|
@ -231,7 +235,8 @@ static int mmp_pcm_probe(struct platform_device *pdev)
|
|||
mmp_pcm_hardware[SNDRV_PCM_STREAM_CAPTURE].period_bytes_max =
|
||||
pdata->period_max_capture;
|
||||
}
|
||||
return devm_snd_soc_register_platform(&pdev->dev, &mmp_soc_platform);
|
||||
return devm_snd_soc_register_component(&pdev->dev, &mmp_soc_component,
|
||||
NULL, 0);
|
||||
}
|
||||
|
||||
static struct platform_driver mmp_pcm_driver = {
|
||||
|
|
|
@ -84,7 +84,7 @@ static int pxa2xx_soc_pcm_new(struct snd_soc_pcm_runtime *rtd)
|
|||
return ret;
|
||||
}
|
||||
|
||||
static const struct snd_soc_platform_driver pxa2xx_soc_platform = {
|
||||
static const struct snd_soc_component_driver pxa2xx_soc_platform = {
|
||||
.ops = &pxa2xx_pcm_ops,
|
||||
.pcm_new = pxa2xx_soc_pcm_new,
|
||||
.pcm_free = pxa2xx_pcm_free_dma_buffers,
|
||||
|
@ -92,7 +92,8 @@ static const struct snd_soc_platform_driver pxa2xx_soc_platform = {
|
|||
|
||||
static int pxa2xx_soc_platform_probe(struct platform_device *pdev)
|
||||
{
|
||||
return devm_snd_soc_register_platform(&pdev->dev, &pxa2xx_soc_platform);
|
||||
return devm_snd_soc_register_component(&pdev->dev, &pxa2xx_soc_platform,
|
||||
NULL, 0);
|
||||
}
|
||||
|
||||
#ifdef CONFIG_OF
|
||||
|
|
|
@ -24,6 +24,8 @@
|
|||
#include "lpass-lpaif-reg.h"
|
||||
#include "lpass.h"
|
||||
|
||||
#define DRV_NAME "lpass-platform"
|
||||
|
||||
struct lpass_pcm_data {
|
||||
int dma_ch;
|
||||
int i2s_port;
|
||||
|
@ -61,8 +63,8 @@ static int lpass_platform_pcmops_open(struct snd_pcm_substream *substream)
|
|||
struct snd_pcm_runtime *runtime = substream->runtime;
|
||||
struct snd_soc_pcm_runtime *soc_runtime = substream->private_data;
|
||||
struct snd_soc_dai *cpu_dai = soc_runtime->cpu_dai;
|
||||
struct lpass_data *drvdata =
|
||||
snd_soc_platform_get_drvdata(soc_runtime->platform);
|
||||
struct snd_soc_component *component = snd_soc_rtdcom_lookup(soc_runtime, DRV_NAME);
|
||||
struct lpass_data *drvdata = snd_soc_component_get_drvdata(component);
|
||||
struct lpass_variant *v = drvdata->variant;
|
||||
int ret, dma_ch, dir = substream->stream;
|
||||
struct lpass_pcm_data *data;
|
||||
|
@ -115,8 +117,8 @@ static int lpass_platform_pcmops_close(struct snd_pcm_substream *substream)
|
|||
{
|
||||
struct snd_pcm_runtime *runtime = substream->runtime;
|
||||
struct snd_soc_pcm_runtime *soc_runtime = substream->private_data;
|
||||
struct lpass_data *drvdata =
|
||||
snd_soc_platform_get_drvdata(soc_runtime->platform);
|
||||
struct snd_soc_component *component = snd_soc_rtdcom_lookup(soc_runtime, DRV_NAME);
|
||||
struct lpass_data *drvdata = snd_soc_component_get_drvdata(component);
|
||||
struct lpass_variant *v = drvdata->variant;
|
||||
struct lpass_pcm_data *data;
|
||||
|
||||
|
@ -132,8 +134,8 @@ static int lpass_platform_pcmops_hw_params(struct snd_pcm_substream *substream,
|
|||
struct snd_pcm_hw_params *params)
|
||||
{
|
||||
struct snd_soc_pcm_runtime *soc_runtime = substream->private_data;
|
||||
struct lpass_data *drvdata =
|
||||
snd_soc_platform_get_drvdata(soc_runtime->platform);
|
||||
struct snd_soc_component *component = snd_soc_rtdcom_lookup(soc_runtime, DRV_NAME);
|
||||
struct lpass_data *drvdata = snd_soc_component_get_drvdata(component);
|
||||
struct snd_pcm_runtime *rt = substream->runtime;
|
||||
struct lpass_pcm_data *pcm_data = rt->private_data;
|
||||
struct lpass_variant *v = drvdata->variant;
|
||||
|
@ -225,8 +227,8 @@ static int lpass_platform_pcmops_hw_params(struct snd_pcm_substream *substream,
|
|||
static int lpass_platform_pcmops_hw_free(struct snd_pcm_substream *substream)
|
||||
{
|
||||
struct snd_soc_pcm_runtime *soc_runtime = substream->private_data;
|
||||
struct lpass_data *drvdata =
|
||||
snd_soc_platform_get_drvdata(soc_runtime->platform);
|
||||
struct snd_soc_component *component = snd_soc_rtdcom_lookup(soc_runtime, DRV_NAME);
|
||||
struct lpass_data *drvdata = snd_soc_component_get_drvdata(component);
|
||||
struct snd_pcm_runtime *rt = substream->runtime;
|
||||
struct lpass_pcm_data *pcm_data = rt->private_data;
|
||||
struct lpass_variant *v = drvdata->variant;
|
||||
|
@ -246,8 +248,8 @@ static int lpass_platform_pcmops_prepare(struct snd_pcm_substream *substream)
|
|||
{
|
||||
struct snd_pcm_runtime *runtime = substream->runtime;
|
||||
struct snd_soc_pcm_runtime *soc_runtime = substream->private_data;
|
||||
struct lpass_data *drvdata =
|
||||
snd_soc_platform_get_drvdata(soc_runtime->platform);
|
||||
struct snd_soc_component *component = snd_soc_rtdcom_lookup(soc_runtime, DRV_NAME);
|
||||
struct lpass_data *drvdata = snd_soc_component_get_drvdata(component);
|
||||
struct snd_pcm_runtime *rt = substream->runtime;
|
||||
struct lpass_pcm_data *pcm_data = rt->private_data;
|
||||
struct lpass_variant *v = drvdata->variant;
|
||||
|
@ -298,8 +300,8 @@ static int lpass_platform_pcmops_trigger(struct snd_pcm_substream *substream,
|
|||
int cmd)
|
||||
{
|
||||
struct snd_soc_pcm_runtime *soc_runtime = substream->private_data;
|
||||
struct lpass_data *drvdata =
|
||||
snd_soc_platform_get_drvdata(soc_runtime->platform);
|
||||
struct snd_soc_component *component = snd_soc_rtdcom_lookup(soc_runtime, DRV_NAME);
|
||||
struct lpass_data *drvdata = snd_soc_component_get_drvdata(component);
|
||||
struct snd_pcm_runtime *rt = substream->runtime;
|
||||
struct lpass_pcm_data *pcm_data = rt->private_data;
|
||||
struct lpass_variant *v = drvdata->variant;
|
||||
|
@ -372,8 +374,8 @@ static snd_pcm_uframes_t lpass_platform_pcmops_pointer(
|
|||
struct snd_pcm_substream *substream)
|
||||
{
|
||||
struct snd_soc_pcm_runtime *soc_runtime = substream->private_data;
|
||||
struct lpass_data *drvdata =
|
||||
snd_soc_platform_get_drvdata(soc_runtime->platform);
|
||||
struct snd_soc_component *component = snd_soc_rtdcom_lookup(soc_runtime, DRV_NAME);
|
||||
struct lpass_data *drvdata = snd_soc_component_get_drvdata(component);
|
||||
struct snd_pcm_runtime *rt = substream->runtime;
|
||||
struct lpass_pcm_data *pcm_data = rt->private_data;
|
||||
struct lpass_variant *v = drvdata->variant;
|
||||
|
@ -509,13 +511,14 @@ static int lpass_platform_pcm_new(struct snd_soc_pcm_runtime *soc_runtime)
|
|||
{
|
||||
struct snd_pcm *pcm = soc_runtime->pcm;
|
||||
struct snd_pcm_substream *psubstream, *csubstream;
|
||||
struct snd_soc_component *component = snd_soc_rtdcom_lookup(soc_runtime, DRV_NAME);
|
||||
int ret = -EINVAL;
|
||||
size_t size = lpass_platform_pcm_hardware.buffer_bytes_max;
|
||||
|
||||
psubstream = pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream;
|
||||
if (psubstream) {
|
||||
ret = snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV,
|
||||
soc_runtime->platform->dev,
|
||||
component->dev,
|
||||
size, &psubstream->dma_buffer);
|
||||
if (ret) {
|
||||
dev_err(soc_runtime->dev, "Cannot allocate buffer(s)\n");
|
||||
|
@ -526,7 +529,7 @@ static int lpass_platform_pcm_new(struct snd_soc_pcm_runtime *soc_runtime)
|
|||
csubstream = pcm->streams[SNDRV_PCM_STREAM_CAPTURE].substream;
|
||||
if (csubstream) {
|
||||
ret = snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV,
|
||||
soc_runtime->platform->dev,
|
||||
component->dev,
|
||||
size, &csubstream->dma_buffer);
|
||||
if (ret) {
|
||||
dev_err(soc_runtime->dev, "Cannot allocate buffer(s)\n");
|
||||
|
@ -555,7 +558,8 @@ static void lpass_platform_pcm_free(struct snd_pcm *pcm)
|
|||
}
|
||||
}
|
||||
|
||||
static const struct snd_soc_platform_driver lpass_platform_driver = {
|
||||
static const struct snd_soc_component_driver lpass_component_driver = {
|
||||
.name = DRV_NAME,
|
||||
.pcm_new = lpass_platform_pcm_new,
|
||||
.pcm_free = lpass_platform_pcm_free,
|
||||
.ops = &lpass_platform_pcm_ops,
|
||||
|
@ -591,8 +595,8 @@ int asoc_qcom_lpass_platform_register(struct platform_device *pdev)
|
|||
}
|
||||
|
||||
|
||||
return devm_snd_soc_register_platform(&pdev->dev,
|
||||
&lpass_platform_driver);
|
||||
return devm_snd_soc_register_component(&pdev->dev,
|
||||
&lpass_component_driver, NULL, 0);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(asoc_qcom_lpass_platform_register);
|
||||
|
||||
|
|
|
@ -399,7 +399,7 @@ void idma_reg_addr_init(void __iomem *regs, dma_addr_t addr)
|
|||
}
|
||||
EXPORT_SYMBOL_GPL(idma_reg_addr_init);
|
||||
|
||||
static const struct snd_soc_platform_driver asoc_idma_platform = {
|
||||
static const struct snd_soc_component_driver asoc_idma_platform = {
|
||||
.ops = &idma_ops,
|
||||
.pcm_new = idma_new,
|
||||
.pcm_free = idma_free,
|
||||
|
@ -411,7 +411,8 @@ static int asoc_idma_platform_probe(struct platform_device *pdev)
|
|||
if (idma_irq < 0)
|
||||
return idma_irq;
|
||||
|
||||
return devm_snd_soc_register_platform(&pdev->dev, &asoc_idma_platform);
|
||||
return devm_snd_soc_register_component(&pdev->dev, &asoc_idma_platform,
|
||||
NULL, 0);
|
||||
}
|
||||
|
||||
static struct platform_driver asoc_idma_driver = {
|
||||
|
|
|
@ -320,14 +320,15 @@ static int camelot_pcm_new(struct snd_soc_pcm_runtime *rtd)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static const struct snd_soc_platform_driver sh7760_soc_platform = {
|
||||
static const struct snd_soc_component_driver sh7760_soc_component = {
|
||||
.ops = &camelot_pcm_ops,
|
||||
.pcm_new = camelot_pcm_new,
|
||||
};
|
||||
|
||||
static int sh7760_soc_platform_probe(struct platform_device *pdev)
|
||||
{
|
||||
return devm_snd_soc_register_platform(&pdev->dev, &sh7760_soc_platform);
|
||||
return devm_snd_soc_register_component(&pdev->dev, &sh7760_soc_component,
|
||||
NULL, 0);
|
||||
}
|
||||
|
||||
static struct platform_driver sh7760_pcm_driver = {
|
||||
|
|
|
@ -1764,7 +1764,7 @@ static const struct snd_pcm_ops fsi_pcm_ops = {
|
|||
};
|
||||
|
||||
/*
|
||||
* snd_soc_platform
|
||||
* snd_soc_component
|
||||
*/
|
||||
|
||||
#define PREALLOC_BUFFER (32 * 1024)
|
||||
|
@ -1818,13 +1818,10 @@ static struct snd_soc_dai_driver fsi_soc_dai[] = {
|
|||
},
|
||||
};
|
||||
|
||||
static const struct snd_soc_platform_driver fsi_soc_platform = {
|
||||
.ops = &fsi_pcm_ops,
|
||||
.pcm_new = fsi_pcm_new,
|
||||
};
|
||||
|
||||
static const struct snd_soc_component_driver fsi_soc_component = {
|
||||
.name = "fsi",
|
||||
.ops = &fsi_pcm_ops,
|
||||
.pcm_new = fsi_pcm_new,
|
||||
};
|
||||
|
||||
/*
|
||||
|
@ -2007,23 +2004,15 @@ static int fsi_probe(struct platform_device *pdev)
|
|||
goto exit_fsib;
|
||||
}
|
||||
|
||||
ret = snd_soc_register_platform(&pdev->dev, &fsi_soc_platform);
|
||||
if (ret < 0) {
|
||||
dev_err(&pdev->dev, "cannot snd soc register\n");
|
||||
goto exit_fsib;
|
||||
}
|
||||
|
||||
ret = snd_soc_register_component(&pdev->dev, &fsi_soc_component,
|
||||
ret = devm_snd_soc_register_component(&pdev->dev, &fsi_soc_component,
|
||||
fsi_soc_dai, ARRAY_SIZE(fsi_soc_dai));
|
||||
if (ret < 0) {
|
||||
dev_err(&pdev->dev, "cannot snd component register\n");
|
||||
goto exit_snd_soc;
|
||||
goto exit_fsib;
|
||||
}
|
||||
|
||||
return ret;
|
||||
|
||||
exit_snd_soc:
|
||||
snd_soc_unregister_platform(&pdev->dev);
|
||||
exit_fsib:
|
||||
pm_runtime_disable(&pdev->dev);
|
||||
fsi_stream_remove(&master->fsib);
|
||||
|
@ -2041,9 +2030,6 @@ static int fsi_remove(struct platform_device *pdev)
|
|||
|
||||
pm_runtime_disable(&pdev->dev);
|
||||
|
||||
snd_soc_unregister_component(&pdev->dev);
|
||||
snd_soc_unregister_platform(&pdev->dev);
|
||||
|
||||
fsi_stream_remove(&master->fsia);
|
||||
fsi_stream_remove(&master->fsib);
|
||||
|
||||
|
|
|
@ -1337,7 +1337,7 @@ int rsnd_kctrl_new(struct rsnd_mod *mod,
|
|||
}
|
||||
|
||||
/*
|
||||
* snd_soc_platform
|
||||
* snd_soc_component
|
||||
*/
|
||||
|
||||
#define PREALLOC_BUFFER (32 * 1024)
|
||||
|
@ -1364,12 +1364,9 @@ static int rsnd_pcm_new(struct snd_soc_pcm_runtime *rtd)
|
|||
PREALLOC_BUFFER, PREALLOC_BUFFER_MAX);
|
||||
}
|
||||
|
||||
static const struct snd_soc_platform_driver rsnd_soc_platform = {
|
||||
static const struct snd_soc_component_driver rsnd_soc_component = {
|
||||
.ops = &rsnd_pcm_ops,
|
||||
.pcm_new = rsnd_pcm_new,
|
||||
};
|
||||
|
||||
static const struct snd_soc_component_driver rsnd_soc_component = {
|
||||
.name = "rsnd",
|
||||
};
|
||||
|
||||
|
@ -1478,17 +1475,11 @@ static int rsnd_probe(struct platform_device *pdev)
|
|||
/*
|
||||
* asoc register
|
||||
*/
|
||||
ret = snd_soc_register_platform(dev, &rsnd_soc_platform);
|
||||
if (ret < 0) {
|
||||
dev_err(dev, "cannot snd soc register\n");
|
||||
return ret;
|
||||
}
|
||||
|
||||
ret = snd_soc_register_component(dev, &rsnd_soc_component,
|
||||
ret = devm_snd_soc_register_component(dev, &rsnd_soc_component,
|
||||
priv->daidrv, rsnd_rdai_nr(priv));
|
||||
if (ret < 0) {
|
||||
dev_err(dev, "cannot snd dai register\n");
|
||||
goto exit_snd_soc;
|
||||
goto exit_snd_probe;
|
||||
}
|
||||
|
||||
pm_runtime_enable(dev);
|
||||
|
@ -1496,8 +1487,6 @@ static int rsnd_probe(struct platform_device *pdev)
|
|||
dev_info(dev, "probed\n");
|
||||
return ret;
|
||||
|
||||
exit_snd_soc:
|
||||
snd_soc_unregister_platform(dev);
|
||||
exit_snd_probe:
|
||||
for_each_rsnd_dai(rdai, priv, i) {
|
||||
rsnd_dai_call(remove, &rdai->playback, priv);
|
||||
|
@ -1535,9 +1524,6 @@ static int rsnd_remove(struct platform_device *pdev)
|
|||
for (i = 0; i < ARRAY_SIZE(remove_func); i++)
|
||||
remove_func[i](priv);
|
||||
|
||||
snd_soc_unregister_component(&pdev->dev);
|
||||
snd_soc_unregister_platform(&pdev->dev);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
|
@ -183,7 +183,7 @@ static inline u32 siu_read32(u32 __iomem *addr)
|
|||
#define SIU_BRGBSEL (0x108 / sizeof(u32))
|
||||
#define SIU_BRRB (0x10c / sizeof(u32))
|
||||
|
||||
extern struct snd_soc_platform_driver siu_platform;
|
||||
extern struct snd_soc_component_driver siu_component;
|
||||
extern struct siu_info *siu_i2s_data;
|
||||
|
||||
int siu_init_port(int port, struct siu_port **port_info, struct snd_card *card);
|
||||
|
|
|
@ -727,10 +727,6 @@ static struct snd_soc_dai_driver siu_i2s_dai = {
|
|||
.ops = &siu_dai_ops,
|
||||
};
|
||||
|
||||
static const struct snd_soc_component_driver siu_i2s_component = {
|
||||
.name = "siu-i2s",
|
||||
};
|
||||
|
||||
static int siu_probe(struct platform_device *pdev)
|
||||
{
|
||||
const struct firmware *fw_entry;
|
||||
|
@ -786,15 +782,11 @@ static int siu_probe(struct platform_device *pdev)
|
|||
dev_set_drvdata(&pdev->dev, info);
|
||||
|
||||
/* register using ARRAY version so we can keep dai name */
|
||||
ret = devm_snd_soc_register_component(&pdev->dev, &siu_i2s_component,
|
||||
ret = devm_snd_soc_register_component(&pdev->dev, &siu_component,
|
||||
&siu_i2s_dai, 1);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
ret = devm_snd_soc_register_platform(&pdev->dev, &siu_platform);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
pm_runtime_enable(&pdev->dev);
|
||||
|
||||
return 0;
|
||||
|
|
|
@ -35,6 +35,7 @@
|
|||
|
||||
#include "siu.h"
|
||||
|
||||
#define DRV_NAME "siu-i2s"
|
||||
#define GET_MAX_PERIODS(buf_bytes, period_bytes) \
|
||||
((buf_bytes) / (period_bytes))
|
||||
#define PERIOD_OFFSET(buf_addr, period_num, period_bytes) \
|
||||
|
@ -340,7 +341,8 @@ static int siu_pcm_open(struct snd_pcm_substream *ss)
|
|||
{
|
||||
/* Playback / Capture */
|
||||
struct snd_soc_pcm_runtime *rtd = ss->private_data;
|
||||
struct siu_platform *pdata = rtd->platform->dev->platform_data;
|
||||
struct snd_soc_component *component = snd_soc_rtdcom_lookup(rtd, DRV_NAME);
|
||||
struct siu_platform *pdata = component->dev->platform_data;
|
||||
struct siu_info *info = siu_i2s_data;
|
||||
struct siu_port *port_info = siu_port_info(ss);
|
||||
struct siu_stream *siu_stream;
|
||||
|
@ -604,9 +606,10 @@ static const struct snd_pcm_ops siu_pcm_ops = {
|
|||
.pointer = siu_pcm_pointer_dma,
|
||||
};
|
||||
|
||||
struct snd_soc_platform_driver siu_platform = {
|
||||
struct snd_soc_component_driver siu_component = {
|
||||
.name = DRV_NAME,
|
||||
.ops = &siu_pcm_ops,
|
||||
.pcm_new = siu_pcm_new,
|
||||
.pcm_free = siu_pcm_free,
|
||||
};
|
||||
EXPORT_SYMBOL_GPL(siu_platform);
|
||||
EXPORT_SYMBOL_GPL(siu_component);
|
||||
|
|
|
@ -1162,11 +1162,6 @@ static int soc_bind_dai_link(struct snd_soc_card *card,
|
|||
|
||||
rtd->platform = platform;
|
||||
}
|
||||
if (!rtd->platform) {
|
||||
dev_err(card->dev, "ASoC: platform %s not registered\n",
|
||||
dai_link->platform_name);
|
||||
goto _err_defer;
|
||||
}
|
||||
|
||||
soc_add_pcm_runtime(card, rtd);
|
||||
return 0;
|
||||
|
|
|
@ -33,13 +33,13 @@
|
|||
struct dmaengine_pcm {
|
||||
struct dma_chan *chan[SNDRV_PCM_STREAM_LAST + 1];
|
||||
const struct snd_dmaengine_pcm_config *config;
|
||||
struct snd_soc_platform platform;
|
||||
struct snd_soc_component component;
|
||||
unsigned int flags;
|
||||
};
|
||||
|
||||
static struct dmaengine_pcm *soc_platform_to_pcm(struct snd_soc_platform *p)
|
||||
static struct dmaengine_pcm *soc_component_to_pcm(struct snd_soc_component *p)
|
||||
{
|
||||
return container_of(p, struct dmaengine_pcm, platform);
|
||||
return container_of(p, struct dmaengine_pcm, component);
|
||||
}
|
||||
|
||||
static struct device *dmaengine_dma_dev(struct dmaengine_pcm *pcm,
|
||||
|
@ -88,7 +88,9 @@ static int dmaengine_pcm_hw_params(struct snd_pcm_substream *substream,
|
|||
struct snd_pcm_hw_params *params)
|
||||
{
|
||||
struct snd_soc_pcm_runtime *rtd = substream->private_data;
|
||||
struct dmaengine_pcm *pcm = soc_platform_to_pcm(rtd->platform);
|
||||
struct snd_soc_component *component =
|
||||
snd_soc_rtdcom_lookup(rtd, SND_DMAENGINE_PCM_DRV_NAME);
|
||||
struct dmaengine_pcm *pcm = soc_component_to_pcm(component);
|
||||
struct dma_chan *chan = snd_dmaengine_pcm_get_chan(substream);
|
||||
int (*prepare_slave_config)(struct snd_pcm_substream *substream,
|
||||
struct snd_pcm_hw_params *params,
|
||||
|
@ -119,7 +121,9 @@ static int dmaengine_pcm_hw_params(struct snd_pcm_substream *substream,
|
|||
static int dmaengine_pcm_set_runtime_hwparams(struct snd_pcm_substream *substream)
|
||||
{
|
||||
struct snd_soc_pcm_runtime *rtd = substream->private_data;
|
||||
struct dmaengine_pcm *pcm = soc_platform_to_pcm(rtd->platform);
|
||||
struct snd_soc_component *component =
|
||||
snd_soc_rtdcom_lookup(rtd, SND_DMAENGINE_PCM_DRV_NAME);
|
||||
struct dmaengine_pcm *pcm = soc_component_to_pcm(component);
|
||||
struct device *dma_dev = dmaengine_dma_dev(pcm, substream);
|
||||
struct dma_chan *chan = pcm->chan[substream->stream];
|
||||
struct snd_dmaengine_dai_dma_data *dma_data;
|
||||
|
@ -206,7 +210,9 @@ static int dmaengine_pcm_set_runtime_hwparams(struct snd_pcm_substream *substrea
|
|||
static int dmaengine_pcm_open(struct snd_pcm_substream *substream)
|
||||
{
|
||||
struct snd_soc_pcm_runtime *rtd = substream->private_data;
|
||||
struct dmaengine_pcm *pcm = soc_platform_to_pcm(rtd->platform);
|
||||
struct snd_soc_component *component =
|
||||
snd_soc_rtdcom_lookup(rtd, SND_DMAENGINE_PCM_DRV_NAME);
|
||||
struct dmaengine_pcm *pcm = soc_component_to_pcm(component);
|
||||
struct dma_chan *chan = pcm->chan[substream->stream];
|
||||
int ret;
|
||||
|
||||
|
@ -221,7 +227,9 @@ static struct dma_chan *dmaengine_pcm_compat_request_channel(
|
|||
struct snd_soc_pcm_runtime *rtd,
|
||||
struct snd_pcm_substream *substream)
|
||||
{
|
||||
struct dmaengine_pcm *pcm = soc_platform_to_pcm(rtd->platform);
|
||||
struct snd_soc_component *component =
|
||||
snd_soc_rtdcom_lookup(rtd, SND_DMAENGINE_PCM_DRV_NAME);
|
||||
struct dmaengine_pcm *pcm = soc_component_to_pcm(component);
|
||||
struct snd_dmaengine_dai_dma_data *dma_data;
|
||||
dma_filter_fn fn = NULL;
|
||||
|
||||
|
@ -260,9 +268,11 @@ static bool dmaengine_pcm_can_report_residue(struct device *dev,
|
|||
|
||||
static int dmaengine_pcm_new(struct snd_soc_pcm_runtime *rtd)
|
||||
{
|
||||
struct dmaengine_pcm *pcm = soc_platform_to_pcm(rtd->platform);
|
||||
struct snd_soc_component *component =
|
||||
snd_soc_rtdcom_lookup(rtd, SND_DMAENGINE_PCM_DRV_NAME);
|
||||
struct dmaengine_pcm *pcm = soc_component_to_pcm(component);
|
||||
const struct snd_dmaengine_pcm_config *config = pcm->config;
|
||||
struct device *dev = rtd->platform->dev;
|
||||
struct device *dev = component->dev;
|
||||
struct snd_dmaengine_dai_dma_data *dma_data;
|
||||
struct snd_pcm_substream *substream;
|
||||
size_t prealloc_buffer_size;
|
||||
|
@ -296,7 +306,7 @@ static int dmaengine_pcm_new(struct snd_soc_pcm_runtime *rtd)
|
|||
}
|
||||
|
||||
if (!pcm->chan[i]) {
|
||||
dev_err(rtd->platform->dev,
|
||||
dev_err(component->dev,
|
||||
"Missing dma channel for stream: %d\n", i);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
@ -320,7 +330,9 @@ static snd_pcm_uframes_t dmaengine_pcm_pointer(
|
|||
struct snd_pcm_substream *substream)
|
||||
{
|
||||
struct snd_soc_pcm_runtime *rtd = substream->private_data;
|
||||
struct dmaengine_pcm *pcm = soc_platform_to_pcm(rtd->platform);
|
||||
struct snd_soc_component *component =
|
||||
snd_soc_rtdcom_lookup(rtd, SND_DMAENGINE_PCM_DRV_NAME);
|
||||
struct dmaengine_pcm *pcm = soc_component_to_pcm(component);
|
||||
|
||||
if (pcm->flags & SND_DMAENGINE_PCM_FLAG_NO_RESIDUE)
|
||||
return snd_dmaengine_pcm_pointer_no_residue(substream);
|
||||
|
@ -338,10 +350,9 @@ static const struct snd_pcm_ops dmaengine_pcm_ops = {
|
|||
.pointer = dmaengine_pcm_pointer,
|
||||
};
|
||||
|
||||
static const struct snd_soc_platform_driver dmaengine_pcm_platform = {
|
||||
.component_driver = {
|
||||
.probe_order = SND_SOC_COMP_ORDER_LATE,
|
||||
},
|
||||
static const struct snd_soc_component_driver dmaengine_pcm_component = {
|
||||
.name = SND_DMAENGINE_PCM_DRV_NAME,
|
||||
.probe_order = SND_SOC_COMP_ORDER_LATE,
|
||||
.ops = &dmaengine_pcm_ops,
|
||||
.pcm_new = dmaengine_pcm_new,
|
||||
};
|
||||
|
@ -438,8 +449,8 @@ int snd_dmaengine_pcm_register(struct device *dev,
|
|||
if (ret)
|
||||
goto err_free_dma;
|
||||
|
||||
ret = snd_soc_add_platform(dev, &pcm->platform,
|
||||
&dmaengine_pcm_platform);
|
||||
ret = snd_soc_add_component(dev, &pcm->component,
|
||||
&dmaengine_pcm_component, NULL, 0);
|
||||
if (ret)
|
||||
goto err_free_dma;
|
||||
|
||||
|
@ -461,16 +472,16 @@ EXPORT_SYMBOL_GPL(snd_dmaengine_pcm_register);
|
|||
*/
|
||||
void snd_dmaengine_pcm_unregister(struct device *dev)
|
||||
{
|
||||
struct snd_soc_platform *platform;
|
||||
struct snd_soc_component *component;
|
||||
struct dmaengine_pcm *pcm;
|
||||
|
||||
platform = snd_soc_lookup_platform(dev);
|
||||
if (!platform)
|
||||
component = snd_soc_lookup_component(dev, SND_DMAENGINE_PCM_DRV_NAME);
|
||||
if (!component)
|
||||
return;
|
||||
|
||||
pcm = soc_platform_to_pcm(platform);
|
||||
pcm = soc_component_to_pcm(component);
|
||||
|
||||
snd_soc_remove_platform(platform);
|
||||
snd_soc_unregister_component(dev);
|
||||
dmaengine_pcm_release_chan(pcm);
|
||||
kfree(pcm);
|
||||
}
|
||||
|
|
|
@ -284,11 +284,16 @@ static const struct snd_pcm_ops dummy_dma_ops = {
|
|||
.ioctl = snd_pcm_lib_ioctl,
|
||||
};
|
||||
|
||||
static const struct snd_soc_platform_driver dummy_platform = {
|
||||
static const struct snd_soc_component_driver dummy_platform = {
|
||||
.ops = &dummy_dma_ops,
|
||||
};
|
||||
|
||||
static const struct snd_soc_codec_driver dummy_codec;
|
||||
static const struct snd_soc_component_driver dummy_codec = {
|
||||
.idle_bias_on = 1,
|
||||
.use_pmdown_time = 1,
|
||||
.endianness = 1,
|
||||
.non_legacy_dai_naming = 1,
|
||||
};
|
||||
|
||||
#define STUB_RATES SNDRV_PCM_RATE_8000_192000
|
||||
#define STUB_FORMATS (SNDRV_PCM_FMTBIT_S8 | \
|
||||
|
@ -338,33 +343,22 @@ static int snd_soc_dummy_probe(struct platform_device *pdev)
|
|||
{
|
||||
int ret;
|
||||
|
||||
ret = snd_soc_register_codec(&pdev->dev, &dummy_codec, &dummy_dai, 1);
|
||||
ret = devm_snd_soc_register_component(&pdev->dev,
|
||||
&dummy_codec, &dummy_dai, 1);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
ret = snd_soc_register_platform(&pdev->dev, &dummy_platform);
|
||||
if (ret < 0) {
|
||||
snd_soc_unregister_codec(&pdev->dev);
|
||||
return ret;
|
||||
}
|
||||
ret = devm_snd_soc_register_component(&pdev->dev, &dummy_platform,
|
||||
NULL, 0);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int snd_soc_dummy_remove(struct platform_device *pdev)
|
||||
{
|
||||
snd_soc_unregister_platform(&pdev->dev);
|
||||
snd_soc_unregister_codec(&pdev->dev);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct platform_driver soc_dummy_driver = {
|
||||
.driver = {
|
||||
.name = "snd-soc-dummy",
|
||||
},
|
||||
.probe = snd_soc_dummy_probe,
|
||||
.remove = snd_soc_dummy_remove,
|
||||
};
|
||||
|
||||
static struct platform_device *soc_dummy_dev;
|
||||
|
|
|
@ -281,7 +281,7 @@ static void stm32_adfsdm_pcm_free(struct snd_pcm *pcm)
|
|||
}
|
||||
}
|
||||
|
||||
static struct snd_soc_platform_driver stm32_adfsdm_soc_platform = {
|
||||
static struct snd_soc_component_driver stm32_adfsdm_soc_platform = {
|
||||
.ops = &stm32_adfsdm_pcm_ops,
|
||||
.pcm_new = stm32_adfsdm_pcm_new,
|
||||
.pcm_free = stm32_adfsdm_pcm_free,
|
||||
|
@ -322,8 +322,9 @@ static int stm32_adfsdm_probe(struct platform_device *pdev)
|
|||
if (IS_ERR(priv->iio_cb))
|
||||
return PTR_ERR(priv->iio_cb);
|
||||
|
||||
ret = devm_snd_soc_register_platform(&pdev->dev,
|
||||
&stm32_adfsdm_soc_platform);
|
||||
ret = devm_snd_soc_register_component(&pdev->dev,
|
||||
&stm32_adfsdm_soc_platform,
|
||||
NULL, 0);
|
||||
if (ret < 0)
|
||||
dev_err(&pdev->dev, "%s: Failed to register PCM platform\n",
|
||||
__func__);
|
||||
|
|
|
@ -23,6 +23,8 @@
|
|||
#include <sound/soc.h>
|
||||
#include "txx9aclc.h"
|
||||
|
||||
#define DRV_NAME "txx9aclc"
|
||||
|
||||
static struct txx9aclc_soc_device {
|
||||
struct txx9aclc_dmadata dmadata[2];
|
||||
} txx9aclc_soc_device;
|
||||
|
@ -53,6 +55,7 @@ static int txx9aclc_pcm_hw_params(struct snd_pcm_substream *substream,
|
|||
{
|
||||
struct snd_soc_pcm_runtime *rtd = snd_pcm_substream_chip(substream);
|
||||
struct snd_pcm_runtime *runtime = substream->runtime;
|
||||
struct snd_soc_component *component = snd_soc_rtdcom_lookup(rtd, DRV_NAME);
|
||||
struct txx9aclc_dmadata *dmadata = runtime->private_data;
|
||||
int ret;
|
||||
|
||||
|
@ -60,13 +63,13 @@ static int txx9aclc_pcm_hw_params(struct snd_pcm_substream *substream,
|
|||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
dev_dbg(rtd->platform->dev,
|
||||
dev_dbg(component->dev,
|
||||
"runtime->dma_area = %#lx dma_addr = %#lx dma_bytes = %zd "
|
||||
"runtime->min_align %ld\n",
|
||||
(unsigned long)runtime->dma_area,
|
||||
(unsigned long)runtime->dma_addr, runtime->dma_bytes,
|
||||
runtime->min_align);
|
||||
dev_dbg(rtd->platform->dev,
|
||||
dev_dbg(component->dev,
|
||||
"periods %d period_bytes %d stream %d\n",
|
||||
params_periods(params), params_period_bytes(params),
|
||||
substream->stream);
|
||||
|
@ -287,7 +290,8 @@ static int txx9aclc_pcm_new(struct snd_soc_pcm_runtime *rtd)
|
|||
struct snd_card *card = rtd->card->snd_card;
|
||||
struct snd_soc_dai *dai = rtd->cpu_dai;
|
||||
struct snd_pcm *pcm = rtd->pcm;
|
||||
struct platform_device *pdev = to_platform_device(rtd->platform->dev);
|
||||
struct snd_soc_component *component = snd_soc_rtdcom_lookup(rtd, DRV_NAME);
|
||||
struct platform_device *pdev = to_platform_device(component->dev);
|
||||
struct txx9aclc_soc_device *dev;
|
||||
struct resource *r;
|
||||
int i;
|
||||
|
@ -371,15 +375,15 @@ static int txx9aclc_dma_init(struct txx9aclc_soc_device *dev,
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int txx9aclc_pcm_probe(struct snd_soc_platform *platform)
|
||||
static int txx9aclc_pcm_probe(struct snd_soc_component *component)
|
||||
{
|
||||
snd_soc_platform_set_drvdata(platform, &txx9aclc_soc_device);
|
||||
snd_soc_component_set_drvdata(component, &txx9aclc_soc_device);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int txx9aclc_pcm_remove(struct snd_soc_platform *platform)
|
||||
static void txx9aclc_pcm_remove(struct snd_soc_component *component)
|
||||
{
|
||||
struct txx9aclc_soc_device *dev = snd_soc_platform_get_drvdata(platform);
|
||||
struct txx9aclc_soc_device *dev = snd_soc_component_get_drvdata(component);
|
||||
struct txx9aclc_plat_drvdata *drvdata = txx9aclc_drvdata;
|
||||
void __iomem *base = drvdata->base;
|
||||
int i;
|
||||
|
@ -400,10 +404,10 @@ static int txx9aclc_pcm_remove(struct snd_soc_platform *platform)
|
|||
}
|
||||
dev->dmadata[i].dma_chan = NULL;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const struct snd_soc_platform_driver txx9aclc_soc_platform = {
|
||||
static const struct snd_soc_component_driver txx9aclc_soc_component = {
|
||||
.name = DRV_NAME,
|
||||
.probe = txx9aclc_pcm_probe,
|
||||
.remove = txx9aclc_pcm_remove,
|
||||
.ops = &txx9aclc_pcm_ops,
|
||||
|
@ -412,8 +416,8 @@ static const struct snd_soc_platform_driver txx9aclc_soc_platform = {
|
|||
|
||||
static int txx9aclc_soc_platform_probe(struct platform_device *pdev)
|
||||
{
|
||||
return devm_snd_soc_register_platform(&pdev->dev,
|
||||
&txx9aclc_soc_platform);
|
||||
return devm_snd_soc_register_component(&pdev->dev,
|
||||
&txx9aclc_soc_component, NULL, 0);
|
||||
}
|
||||
|
||||
static struct platform_driver txx9aclc_pcm_driver = {
|
||||
|
|
|
@ -483,13 +483,10 @@ static const struct snd_pcm_ops xtfpga_pcm_ops = {
|
|||
.pointer = xtfpga_pcm_pointer,
|
||||
};
|
||||
|
||||
static const struct snd_soc_platform_driver xtfpga_soc_platform = {
|
||||
.pcm_new = xtfpga_pcm_new,
|
||||
.ops = &xtfpga_pcm_ops,
|
||||
};
|
||||
|
||||
static const struct snd_soc_component_driver xtfpga_i2s_component = {
|
||||
.name = DRV_NAME,
|
||||
.pcm_new = xtfpga_pcm_new,
|
||||
.ops = &xtfpga_pcm_ops,
|
||||
};
|
||||
|
||||
static const struct snd_soc_dai_ops xtfpga_i2s_dai_ops = {
|
||||
|
@ -591,18 +588,13 @@ static int xtfpga_i2s_probe(struct platform_device *pdev)
|
|||
goto err;
|
||||
}
|
||||
|
||||
err = snd_soc_register_platform(&pdev->dev, &xtfpga_soc_platform);
|
||||
if (err < 0) {
|
||||
dev_err(&pdev->dev, "couldn't register platform\n");
|
||||
goto err;
|
||||
}
|
||||
err = devm_snd_soc_register_component(&pdev->dev,
|
||||
&xtfpga_i2s_component,
|
||||
xtfpga_i2s_dai,
|
||||
ARRAY_SIZE(xtfpga_i2s_dai));
|
||||
if (err < 0) {
|
||||
dev_err(&pdev->dev, "couldn't register component\n");
|
||||
goto err_unregister_platform;
|
||||
goto err;
|
||||
}
|
||||
|
||||
pm_runtime_enable(&pdev->dev);
|
||||
|
@ -615,8 +607,6 @@ static int xtfpga_i2s_probe(struct platform_device *pdev)
|
|||
|
||||
err_pm_disable:
|
||||
pm_runtime_disable(&pdev->dev);
|
||||
err_unregister_platform:
|
||||
snd_soc_unregister_platform(&pdev->dev);
|
||||
err:
|
||||
dev_err(&pdev->dev, "%s: err = %d\n", __func__, err);
|
||||
return err;
|
||||
|
@ -626,7 +616,6 @@ static int xtfpga_i2s_remove(struct platform_device *pdev)
|
|||
{
|
||||
struct xtfpga_i2s *i2s = dev_get_drvdata(&pdev->dev);
|
||||
|
||||
snd_soc_unregister_platform(&pdev->dev);
|
||||
if (i2s->regmap && !IS_ERR(i2s->regmap)) {
|
||||
regmap_write(i2s->regmap, XTFPGA_I2S_CONFIG, 0);
|
||||
regmap_write(i2s->regmap, XTFPGA_I2S_INT_MASK, 0);
|
||||
|
|
Loading…
Reference in New Issue