Release 4.7 sound/soc/soc-utils.c
/*
* soc-util.c -- ALSA SoC Audio Layer utility functions
*
* Copyright 2009 Wolfson Microelectronics PLC.
*
* Author: Mark Brown <broonie@opensource.wolfsonmicro.com>
* Liam Girdwood <lrg@slimlogic.co.uk>
*
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at your
* option) any later version.
*/
#include <linux/platform_device.h>
#include <linux/export.h>
#include <sound/core.h>
#include <sound/pcm.h>
#include <sound/pcm_params.h>
#include <sound/soc.h>
int snd_soc_calc_frame_size(int sample_size, int channels, int tdm_slots)
{
return sample_size * channels * tdm_slots;
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
mark brown | mark brown | 21 | 100.00% | 1 | 100.00% |
| Total | 21 | 100.00% | 1 | 100.00% |
EXPORT_SYMBOL_GPL(snd_soc_calc_frame_size);
int snd_soc_params_to_frame_size(struct snd_pcm_hw_params *params)
{
int sample_size;
sample_size = snd_pcm_format_width(params_format(params));
if (sample_size < 0)
return sample_size;
return snd_soc_calc_frame_size(sample_size, params_channels(params),
1);
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
mark brown | mark brown | 45 | 100.00% | 2 | 100.00% |
| Total | 45 | 100.00% | 2 | 100.00% |
EXPORT_SYMBOL_GPL(snd_soc_params_to_frame_size);
int snd_soc_calc_bclk(int fs, int sample_size, int channels, int tdm_slots)
{
return fs * snd_soc_calc_frame_size(sample_size, channels, tdm_slots);
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
mark brown | mark brown | 29 | 100.00% | 1 | 100.00% |
| Total | 29 | 100.00% | 1 | 100.00% |
EXPORT_SYMBOL_GPL(snd_soc_calc_bclk);
int snd_soc_params_to_bclk(struct snd_pcm_hw_params *params)
{
int ret;
ret = snd_soc_params_to_frame_size(params);
if (ret > 0)
return ret * params_rate(params);
else
return ret;
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
mark brown | mark brown | 38 | 100.00% | 1 | 100.00% |
| Total | 38 | 100.00% | 1 | 100.00% |
EXPORT_SYMBOL_GPL(snd_soc_params_to_bclk);
static const struct snd_pcm_hardware dummy_dma_hardware = {
/* Random values to keep userspace happy when checking constraints */
.info = SNDRV_PCM_INFO_INTERLEAVED |
SNDRV_PCM_INFO_BLOCK_TRANSFER,
.buffer_bytes_max = 128*1024,
.period_bytes_min = PAGE_SIZE,
.period_bytes_max = PAGE_SIZE*2,
.periods_min = 2,
.periods_max = 128,
};
static int dummy_dma_open(struct snd_pcm_substream *substream)
{
struct snd_soc_pcm_runtime *rtd = substream->private_data;
/* BE's dont need dummy params */
if (!rtd->dai_link->no_pcm)
snd_soc_set_runtime_hwparams(substream, &dummy_dma_hardware);
return 0;
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
mark brown | mark brown | 22 | 53.66% | 1 | 50.00% |
liam girdwood | liam girdwood | 19 | 46.34% | 1 | 50.00% |
| Total | 41 | 100.00% | 2 | 100.00% |
static struct snd_pcm_ops dummy_dma_ops = {
.open = dummy_dma_open,
.ioctl = snd_pcm_lib_ioctl,
};
static struct snd_soc_platform_driver dummy_platform = {
.ops = &dummy_dma_ops,
};
static struct snd_soc_codec_driver dummy_codec;
#define STUB_RATES SNDRV_PCM_RATE_8000_192000
#define STUB_FORMATS (SNDRV_PCM_FMTBIT_S8 | \
SNDRV_PCM_FMTBIT_U8 | \
SNDRV_PCM_FMTBIT_S16_LE | \
SNDRV_PCM_FMTBIT_U16_LE | \
SNDRV_PCM_FMTBIT_S24_LE | \
SNDRV_PCM_FMTBIT_U24_LE | \
SNDRV_PCM_FMTBIT_S32_LE | \
SNDRV_PCM_FMTBIT_U32_LE | \
SNDRV_PCM_FMTBIT_IEC958_SUBFRAME_LE)
/*
* The dummy CODEC is only meant to be used in situations where there is no
* actual hardware.
*
* If there is actual hardware even if it does not have a control bus
* the hardware will still have constraints like supported samplerates, etc.
* which should be modelled. And the data flow graph also should be modelled
* using DAPM.
*/
static struct snd_soc_dai_driver dummy_dai = {
.name = "snd-soc-dummy-dai",
.playback = {
.stream_name = "Playback",
.channels_min = 1,
.channels_max = 384,
.rates = STUB_RATES,
.formats = STUB_FORMATS,
},
.capture = {
.stream_name = "Capture",
.channels_min = 1,
.channels_max = 384,
.rates = STUB_RATES,
.formats = STUB_FORMATS,
},
};
int snd_soc_dai_is_dummy(struct snd_soc_dai *dai)
{
if (dai->driver == &dummy_dai)
return 1;
return 0;
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
liam girdwood | liam girdwood | 25 | 100.00% | 1 | 100.00% |
| Total | 25 | 100.00% | 1 | 100.00% |
static int snd_soc_dummy_probe(struct platform_device *pdev)
{
int ret;
ret = snd_soc_register_codec(&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;
}
return ret;
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
liam girdwood | liam girdwood | 53 | 69.74% | 1 | 50.00% |
mark brown | mark brown | 23 | 30.26% | 1 | 50.00% |
| Total | 76 | 100.00% | 2 | 100.00% |
static int snd_soc_dummy_remove(struct platform_device *pdev)
{
snd_soc_unregister_platform(&pdev->dev);
snd_soc_unregister_codec(&pdev->dev);
return 0;
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
mark brown | mark brown | 22 | 73.33% | 1 | 50.00% |
liam girdwood | liam girdwood | 8 | 26.67% | 1 | 50.00% |
| Total | 30 | 100.00% | 2 | 100.00% |
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;
int __init snd_soc_util_init(void)
{
int ret;
soc_dummy_dev =
platform_device_register_simple("snd-soc-dummy", -1, NULL, 0);
if (IS_ERR(soc_dummy_dev))
return PTR_ERR(soc_dummy_dev);
ret = platform_driver_register(&soc_dummy_driver);
if (ret != 0)
platform_device_unregister(soc_dummy_dev);
return ret;
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
mark brown | mark brown | 52 | 86.67% | 1 | 50.00% |
uwe kleine-koenig | uwe kleine-koenig | 8 | 13.33% | 1 | 50.00% |
| Total | 60 | 100.00% | 2 | 100.00% |
void __exit snd_soc_util_exit(void)
{
platform_device_unregister(soc_dummy_dev);
platform_driver_unregister(&soc_dummy_driver);
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
mark brown | mark brown | 19 | 100.00% | 1 | 100.00% |
| Total | 19 | 100.00% | 1 | 100.00% |
Overall Contributors
| Person | Tokens | Prop | Commits | CommitProp |
mark brown | mark brown | 415 | 67.26% | 5 | 41.67% |
liam girdwood | liam girdwood | 122 | 19.77% | 3 | 25.00% |
stas sergeev | stas sergeev | 68 | 11.02% | 1 | 8.33% |
uwe kleine-koenig | uwe kleine-koenig | 8 | 1.30% | 1 | 8.33% |
paul gortmaker | paul gortmaker | 3 | 0.49% | 1 | 8.33% |
anatol pomozov | anatol pomozov | 1 | 0.16% | 1 | 8.33% |
| Total | 617 | 100.00% | 12 | 100.00% |
Information contained on this website is for historical information purposes only and does not indicate or represent copyright ownership.