Merge remote-tracking branches 'asoc/topic/88pm860x', 'asoc/topic/amd', 'asoc/topic/atmel', 'asoc/topic/codecs' and 'asoc/topic/compress' into asoc-next

This commit is contained in:
Mark Brown 2018-01-12 12:28:56 +00:00
No known key found for this signature in database
GPG Key ID: 24D68B725D5487D0
6 changed files with 58 additions and 22 deletions

View File

@ -7,10 +7,12 @@ Required properties:
Optional properties: Optional properties:
- dmicen-gpios: GPIO specifier for dmic to control start and stop - dmicen-gpios: GPIO specifier for dmic to control start and stop
- num-channels: Number of microphones on this DAI
Example node: Example node:
dmic_codec: dmic@0 { dmic_codec: dmic@0 {
compatible = "dmic-codec"; compatible = "dmic-codec";
dmicen-gpios = <&gpio4 3 GPIO_ACTIVE_HIGH>; dmicen-gpios = <&gpio4 3 GPIO_ACTIVE_HIGH>;
num-channels = <1>;
}; };

View File

@ -850,6 +850,9 @@ static snd_pcm_uframes_t acp_dma_pointer(struct snd_pcm_substream *substream)
struct snd_pcm_runtime *runtime = substream->runtime; struct snd_pcm_runtime *runtime = substream->runtime;
struct audio_substream_data *rtd = runtime->private_data; struct audio_substream_data *rtd = runtime->private_data;
if (!rtd)
return -EINVAL;
buffersize = frames_to_bytes(runtime, runtime->buffer_size); buffersize = frames_to_bytes(runtime, runtime->buffer_size);
bytescount = acp_get_byte_count(rtd->acp_mmio, substream->stream); bytescount = acp_get_byte_count(rtd->acp_mmio, substream->stream);
@ -875,6 +878,8 @@ static int acp_dma_prepare(struct snd_pcm_substream *substream)
struct snd_pcm_runtime *runtime = substream->runtime; struct snd_pcm_runtime *runtime = substream->runtime;
struct audio_substream_data *rtd = runtime->private_data; struct audio_substream_data *rtd = runtime->private_data;
if (!rtd)
return -EINVAL;
if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
config_acp_dma_channel(rtd->acp_mmio, SYSRAM_TO_ACP_CH_NUM, config_acp_dma_channel(rtd->acp_mmio, SYSRAM_TO_ACP_CH_NUM,
PLAYBACK_START_DMA_DESCR_CH12, PLAYBACK_START_DMA_DESCR_CH12,
@ -1091,7 +1096,11 @@ static int acp_audio_probe(struct platform_device *pdev)
dev_set_drvdata(&pdev->dev, audio_drv_data); dev_set_drvdata(&pdev->dev, audio_drv_data);
/* Initialize the ACP */ /* Initialize the ACP */
acp_init(audio_drv_data->acp_mmio, audio_drv_data->asic_type); status = acp_init(audio_drv_data->acp_mmio, audio_drv_data->asic_type);
if (status) {
dev_err(&pdev->dev, "ACP Init failed status:%d\n", status);
return status;
}
status = snd_soc_register_platform(&pdev->dev, &acp_asoc_platform); status = snd_soc_register_platform(&pdev->dev, &acp_asoc_platform);
if (status != 0) { if (status != 0) {
@ -1108,9 +1117,12 @@ static int acp_audio_probe(struct platform_device *pdev)
static int acp_audio_remove(struct platform_device *pdev) static int acp_audio_remove(struct platform_device *pdev)
{ {
int status;
struct audio_drv_data *adata = dev_get_drvdata(&pdev->dev); struct audio_drv_data *adata = dev_get_drvdata(&pdev->dev);
acp_deinit(adata->acp_mmio); 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); snd_soc_unregister_platform(&pdev->dev);
pm_runtime_disable(&pdev->dev); pm_runtime_disable(&pdev->dev);
@ -1120,9 +1132,14 @@ static int acp_audio_remove(struct platform_device *pdev)
static int acp_pcm_resume(struct device *dev) static int acp_pcm_resume(struct device *dev)
{ {
u16 bank; u16 bank;
int status;
struct audio_drv_data *adata = dev_get_drvdata(dev); struct audio_drv_data *adata = dev_get_drvdata(dev);
acp_init(adata->acp_mmio, adata->asic_type); status = acp_init(adata->acp_mmio, adata->asic_type);
if (status) {
dev_err(dev, "ACP Init failed status:%d\n", status);
return status;
}
if (adata->play_stream && adata->play_stream->runtime) { if (adata->play_stream && adata->play_stream->runtime) {
/* For Stoney, Memory gating is disabled,i.e SRAM Banks /* For Stoney, Memory gating is disabled,i.e SRAM Banks
@ -1154,18 +1171,26 @@ static int acp_pcm_resume(struct device *dev)
static int acp_pcm_runtime_suspend(struct device *dev) static int acp_pcm_runtime_suspend(struct device *dev)
{ {
int status;
struct audio_drv_data *adata = dev_get_drvdata(dev); struct audio_drv_data *adata = dev_get_drvdata(dev);
acp_deinit(adata->acp_mmio); status = acp_deinit(adata->acp_mmio);
if (status)
dev_err(dev, "ACP Deinit failed status:%d\n", status);
acp_reg_write(0, adata->acp_mmio, mmACP_EXTERNAL_INTR_ENB); acp_reg_write(0, adata->acp_mmio, mmACP_EXTERNAL_INTR_ENB);
return 0; return 0;
} }
static int acp_pcm_runtime_resume(struct device *dev) static int acp_pcm_runtime_resume(struct device *dev)
{ {
int status;
struct audio_drv_data *adata = dev_get_drvdata(dev); struct audio_drv_data *adata = dev_get_drvdata(dev);
acp_init(adata->acp_mmio, adata->asic_type); status = acp_init(adata->acp_mmio, adata->asic_type);
if (status) {
dev_err(dev, "ACP Init failed status:%d\n", status);
return status;
}
acp_reg_write(1, adata->acp_mmio, mmACP_EXTERNAL_INTR_ENB); acp_reg_write(1, adata->acp_mmio, mmACP_EXTERNAL_INTR_ENB);
return 0; return 0;
} }

View File

@ -308,15 +308,9 @@ static int atmel_classd_codec_resume(struct snd_soc_codec *codec)
return regcache_sync(dd->regmap); return regcache_sync(dd->regmap);
} }
static struct regmap *atmel_classd_codec_get_remap(struct device *dev)
{
return dev_get_regmap(dev, NULL);
}
static struct snd_soc_codec_driver soc_codec_dev_classd = { static struct snd_soc_codec_driver soc_codec_dev_classd = {
.probe = atmel_classd_codec_probe, .probe = atmel_classd_codec_probe,
.resume = atmel_classd_codec_resume, .resume = atmel_classd_codec_resume,
.get_regmap = atmel_classd_codec_get_remap,
.component_driver = { .component_driver = {
.controls = atmel_classd_snd_controls, .controls = atmel_classd_snd_controls,
.num_controls = ARRAY_SIZE(atmel_classd_snd_controls), .num_controls = ARRAY_SIZE(atmel_classd_snd_controls),

View File

@ -1319,6 +1319,7 @@ static int pm860x_probe(struct snd_soc_codec *codec)
int i, ret; int i, ret;
pm860x->codec = codec; pm860x->codec = codec;
snd_soc_codec_init_regmap(codec, pm860x->regmap);
for (i = 0; i < 4; i++) { for (i = 0; i < 4; i++) {
ret = request_threaded_irq(pm860x->irq[i], NULL, ret = request_threaded_irq(pm860x->irq[i], NULL,
@ -1348,18 +1349,10 @@ static int pm860x_remove(struct snd_soc_codec *codec)
return 0; return 0;
} }
static struct regmap *pm860x_get_regmap(struct device *dev)
{
struct pm860x_priv *pm860x = dev_get_drvdata(dev);
return pm860x->regmap;
}
static const struct snd_soc_codec_driver soc_codec_dev_pm860x = { static const struct snd_soc_codec_driver soc_codec_dev_pm860x = {
.probe = pm860x_probe, .probe = pm860x_probe,
.remove = pm860x_remove, .remove = pm860x_remove,
.set_bias_level = pm860x_set_bias_level, .set_bias_level = pm860x_set_bias_level,
.get_regmap = pm860x_get_regmap,
.component_driver = { .component_driver = {
.controls = pm860x_snd_controls, .controls = pm860x_snd_controls,

View File

@ -107,8 +107,30 @@ static const struct snd_soc_codec_driver soc_dmic = {
static int dmic_dev_probe(struct platform_device *pdev) static int dmic_dev_probe(struct platform_device *pdev)
{ {
int err;
u32 chans;
struct snd_soc_dai_driver *dai_drv = &dmic_dai;
if (pdev->dev.of_node) {
err = of_property_read_u32(pdev->dev.of_node, "num-channels", &chans);
if (err && (err != -ENOENT))
return err;
if (!err) {
if (chans < 1 || chans > 8)
return -EINVAL;
dai_drv = devm_kzalloc(&pdev->dev, sizeof(*dai_drv), GFP_KERNEL);
if (!dai_drv)
return -ENOMEM;
memcpy(dai_drv, &dmic_dai, sizeof(*dai_drv));
dai_drv->capture.channels_max = chans;
}
}
return snd_soc_register_codec(&pdev->dev, return snd_soc_register_codec(&pdev->dev,
&soc_dmic, &dmic_dai, 1); &soc_dmic, dai_drv, 1);
} }
static int dmic_dev_remove(struct platform_device *pdev) static int dmic_dev_remove(struct platform_device *pdev)

View File

@ -1096,7 +1096,6 @@ static struct snd_compr_ops soc_compr_dyn_ops = {
*/ */
int snd_soc_new_compress(struct snd_soc_pcm_runtime *rtd, int num) int snd_soc_new_compress(struct snd_soc_pcm_runtime *rtd, int num)
{ {
struct snd_soc_codec *codec = rtd->codec;
struct snd_soc_platform *platform = rtd->platform; struct snd_soc_platform *platform = rtd->platform;
struct snd_soc_component *component; struct snd_soc_component *component;
struct snd_soc_rtdcom_list *rtdcom; struct snd_soc_rtdcom_list *rtdcom;
@ -1199,8 +1198,9 @@ int snd_soc_new_compress(struct snd_soc_pcm_runtime *rtd, int num)
ret = snd_compress_new(rtd->card->snd_card, num, direction, ret = snd_compress_new(rtd->card->snd_card, num, direction,
new_name, compr); new_name, compr);
if (ret < 0) { if (ret < 0) {
component = rtd->codec_dai->component;
pr_err("compress asoc: can't create compress for codec %s\n", pr_err("compress asoc: can't create compress for codec %s\n",
codec->component.name); component->name);
goto compr_err; goto compr_err;
} }