mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-08-27 11:19:37 +00:00
Merge remote-tracking branches 'asoc/topic/fsl_esai', 'asoc/topic/fsl_ssi', 'asoc/topic/fsl_utils', 'asoc/topic/generic-dmaengine' and 'asoc/topic/gtm601' into asoc-next
This commit is contained in:
commit
165879a90b
8 changed files with 495 additions and 402 deletions
|
@ -118,6 +118,8 @@ void snd_dmaengine_pcm_set_config_from_dai_data(
|
|||
* PCM substream. Will be called from the PCM drivers hwparams callback.
|
||||
* @compat_request_channel: Callback to request a DMA channel for platforms
|
||||
* which do not use devicetree.
|
||||
* @process: Callback used to apply processing on samples transferred from/to
|
||||
* user space.
|
||||
* @compat_filter_fn: Will be used as the filter function when requesting a
|
||||
* channel for platforms which do not use devicetree. The filter parameter
|
||||
* will be the DAI's DMA data.
|
||||
|
@ -140,6 +142,9 @@ struct snd_dmaengine_pcm_config {
|
|||
struct dma_chan *(*compat_request_channel)(
|
||||
struct snd_soc_pcm_runtime *rtd,
|
||||
struct snd_pcm_substream *substream);
|
||||
int (*process)(struct snd_pcm_substream *substream,
|
||||
int channel, unsigned long hwoff,
|
||||
void *buf, unsigned long bytes);
|
||||
dma_filter_fn compat_filter_fn;
|
||||
struct device *dma_dev;
|
||||
const char *chan_names[SNDRV_PCM_STREAM_LAST + 1];
|
||||
|
|
|
@ -242,6 +242,7 @@ typedef int __bitwise snd_pcm_format_t;
|
|||
#define SNDRV_PCM_FORMAT_DSD_U16_BE ((__force snd_pcm_format_t) 51) /* DSD, 2-byte samples DSD (x16), big endian */
|
||||
#define SNDRV_PCM_FORMAT_DSD_U32_BE ((__force snd_pcm_format_t) 52) /* DSD, 4-byte samples DSD (x32), big endian */
|
||||
#define SNDRV_PCM_FORMAT_LAST SNDRV_PCM_FORMAT_DSD_U32_BE
|
||||
#define SNDRV_PCM_FORMAT_FIRST SNDRV_PCM_FORMAT_S8
|
||||
|
||||
#ifdef SNDRV_LITTLE_ENDIAN
|
||||
#define SNDRV_PCM_FORMAT_S16 SNDRV_PCM_FORMAT_S16_LE
|
||||
|
|
|
@ -19,7 +19,6 @@
|
|||
#include <linux/device.h>
|
||||
#include <sound/core.h>
|
||||
#include <sound/pcm.h>
|
||||
#include <sound/ac97_codec.h>
|
||||
#include <sound/initval.h>
|
||||
#include <sound/soc.h>
|
||||
|
||||
|
@ -51,25 +50,21 @@ static struct snd_soc_dai_driver gtm601_dai = {
|
|||
},
|
||||
};
|
||||
|
||||
static const struct snd_soc_codec_driver soc_codec_dev_gtm601 = {
|
||||
.component_driver = {
|
||||
.dapm_widgets = gtm601_dapm_widgets,
|
||||
.num_dapm_widgets = ARRAY_SIZE(gtm601_dapm_widgets),
|
||||
.dapm_routes = gtm601_dapm_routes,
|
||||
.num_dapm_routes = ARRAY_SIZE(gtm601_dapm_routes),
|
||||
},
|
||||
static const struct snd_soc_component_driver soc_component_dev_gtm601 = {
|
||||
.dapm_widgets = gtm601_dapm_widgets,
|
||||
.num_dapm_widgets = ARRAY_SIZE(gtm601_dapm_widgets),
|
||||
.dapm_routes = gtm601_dapm_routes,
|
||||
.num_dapm_routes = ARRAY_SIZE(gtm601_dapm_routes),
|
||||
.idle_bias_on = 1,
|
||||
.use_pmdown_time = 1,
|
||||
.endianness = 1,
|
||||
.non_legacy_dai_naming = 1,
|
||||
};
|
||||
|
||||
static int gtm601_platform_probe(struct platform_device *pdev)
|
||||
{
|
||||
return snd_soc_register_codec(&pdev->dev,
|
||||
&soc_codec_dev_gtm601, >m601_dai, 1);
|
||||
}
|
||||
|
||||
static int gtm601_platform_remove(struct platform_device *pdev)
|
||||
{
|
||||
snd_soc_unregister_codec(&pdev->dev);
|
||||
return 0;
|
||||
return devm_snd_soc_register_component(&pdev->dev,
|
||||
&soc_component_dev_gtm601, >m601_dai, 1);
|
||||
}
|
||||
|
||||
#if defined(CONFIG_OF)
|
||||
|
@ -86,7 +81,6 @@ static struct platform_driver gtm601_codec_driver = {
|
|||
.of_match_table = of_match_ptr(gtm601_codec_of_match),
|
||||
},
|
||||
.probe = gtm601_platform_probe,
|
||||
.remove = gtm601_platform_remove,
|
||||
};
|
||||
|
||||
module_platform_driver(gtm601_codec_driver);
|
||||
|
|
|
@ -788,7 +788,7 @@ static int fsl_esai_probe(struct platform_device *pdev)
|
|||
struct device_node *np = pdev->dev.of_node;
|
||||
struct fsl_esai *esai_priv;
|
||||
struct resource *res;
|
||||
const uint32_t *iprop;
|
||||
const __be32 *iprop;
|
||||
void __iomem *regs;
|
||||
int irq, ret;
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -12,9 +12,6 @@
|
|||
#ifndef _MPC8610_I2S_H
|
||||
#define _MPC8610_I2S_H
|
||||
|
||||
#define RX 0
|
||||
#define TX 1
|
||||
|
||||
/* -- SSI Register Map -- */
|
||||
|
||||
/* SSI Transmit Data Register 0 */
|
||||
|
|
|
@ -36,7 +36,7 @@ int fsl_asoc_get_dma_channel(struct device_node *ssi_np,
|
|||
{
|
||||
struct resource res;
|
||||
struct device_node *dma_channel_np, *dma_np;
|
||||
const u32 *iprop;
|
||||
const __be32 *iprop;
|
||||
int ret;
|
||||
|
||||
dma_channel_np = of_parse_phandle(ssi_np, name, 0);
|
||||
|
|
|
@ -132,7 +132,8 @@ static int dmaengine_pcm_set_runtime_hwparams(struct snd_pcm_substream *substrea
|
|||
u32 addr_widths = BIT(DMA_SLAVE_BUSWIDTH_1_BYTE) |
|
||||
BIT(DMA_SLAVE_BUSWIDTH_2_BYTES) |
|
||||
BIT(DMA_SLAVE_BUSWIDTH_4_BYTES);
|
||||
int i, ret;
|
||||
snd_pcm_format_t i;
|
||||
int ret;
|
||||
|
||||
if (pcm->config && pcm->config->pcm_hardware)
|
||||
return snd_soc_set_runtime_hwparams(substream,
|
||||
|
@ -182,7 +183,7 @@ static int dmaengine_pcm_set_runtime_hwparams(struct snd_pcm_substream *substrea
|
|||
* default assumption is that it supports 1, 2 and 4 bytes
|
||||
* widths.
|
||||
*/
|
||||
for (i = 0; i <= SNDRV_PCM_FORMAT_LAST; i++) {
|
||||
for (i = SNDRV_PCM_FORMAT_FIRST; i <= SNDRV_PCM_FORMAT_LAST; i++) {
|
||||
int bits = snd_pcm_format_physical_width(i);
|
||||
|
||||
/*
|
||||
|
@ -340,6 +341,41 @@ static snd_pcm_uframes_t dmaengine_pcm_pointer(
|
|||
return snd_dmaengine_pcm_pointer(substream);
|
||||
}
|
||||
|
||||
static int dmaengine_copy_user(struct snd_pcm_substream *substream,
|
||||
int channel, unsigned long hwoff,
|
||||
void *buf, unsigned long bytes)
|
||||
{
|
||||
struct snd_soc_pcm_runtime *rtd = substream->private_data;
|
||||
struct snd_soc_component *component =
|
||||
snd_soc_rtdcom_lookup(rtd, SND_DMAENGINE_PCM_DRV_NAME);
|
||||
struct snd_pcm_runtime *runtime = substream->runtime;
|
||||
struct dmaengine_pcm *pcm = soc_component_to_pcm(component);
|
||||
int (*process)(struct snd_pcm_substream *substream,
|
||||
int channel, unsigned long hwoff,
|
||||
void *buf, unsigned long bytes) = pcm->config->process;
|
||||
bool is_playback = substream->stream == SNDRV_PCM_STREAM_PLAYBACK;
|
||||
void *dma_ptr = runtime->dma_area + hwoff +
|
||||
channel * (runtime->dma_bytes / runtime->channels);
|
||||
int ret;
|
||||
|
||||
if (is_playback)
|
||||
if (copy_from_user(dma_ptr, (void __user *)buf, bytes))
|
||||
return -EFAULT;
|
||||
|
||||
if (process) {
|
||||
ret = process(substream, channel, hwoff,
|
||||
(void __user *)buf, bytes);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
}
|
||||
|
||||
if (!is_playback)
|
||||
if (copy_to_user((void __user *)buf, dma_ptr, bytes))
|
||||
return -EFAULT;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const struct snd_pcm_ops dmaengine_pcm_ops = {
|
||||
.open = dmaengine_pcm_open,
|
||||
.close = snd_dmaengine_pcm_close,
|
||||
|
@ -350,6 +386,17 @@ static const struct snd_pcm_ops dmaengine_pcm_ops = {
|
|||
.pointer = dmaengine_pcm_pointer,
|
||||
};
|
||||
|
||||
static const struct snd_pcm_ops dmaengine_pcm_process_ops = {
|
||||
.open = dmaengine_pcm_open,
|
||||
.close = snd_dmaengine_pcm_close,
|
||||
.ioctl = snd_pcm_lib_ioctl,
|
||||
.hw_params = dmaengine_pcm_hw_params,
|
||||
.hw_free = snd_pcm_lib_free_pages,
|
||||
.trigger = snd_dmaengine_pcm_trigger,
|
||||
.pointer = dmaengine_pcm_pointer,
|
||||
.copy_user = dmaengine_copy_user,
|
||||
};
|
||||
|
||||
static const struct snd_soc_component_driver dmaengine_pcm_component = {
|
||||
.name = SND_DMAENGINE_PCM_DRV_NAME,
|
||||
.probe_order = SND_SOC_COMP_ORDER_LATE,
|
||||
|
@ -357,6 +404,13 @@ static const struct snd_soc_component_driver dmaengine_pcm_component = {
|
|||
.pcm_new = dmaengine_pcm_new,
|
||||
};
|
||||
|
||||
static const struct snd_soc_component_driver dmaengine_pcm_component_process = {
|
||||
.name = SND_DMAENGINE_PCM_DRV_NAME,
|
||||
.probe_order = SND_SOC_COMP_ORDER_LATE,
|
||||
.ops = &dmaengine_pcm_process_ops,
|
||||
.pcm_new = dmaengine_pcm_new,
|
||||
};
|
||||
|
||||
static const char * const dmaengine_pcm_dma_channel_names[] = {
|
||||
[SNDRV_PCM_STREAM_PLAYBACK] = "tx",
|
||||
[SNDRV_PCM_STREAM_CAPTURE] = "rx",
|
||||
|
@ -442,6 +496,9 @@ int snd_dmaengine_pcm_register(struct device *dev,
|
|||
if (!pcm)
|
||||
return -ENOMEM;
|
||||
|
||||
#ifdef CONFIG_DEBUG_FS
|
||||
pcm->component.debugfs_prefix = "dma";
|
||||
#endif
|
||||
pcm->config = config;
|
||||
pcm->flags = flags;
|
||||
|
||||
|
@ -449,8 +506,13 @@ int snd_dmaengine_pcm_register(struct device *dev,
|
|||
if (ret)
|
||||
goto err_free_dma;
|
||||
|
||||
ret = snd_soc_add_component(dev, &pcm->component,
|
||||
&dmaengine_pcm_component, NULL, 0);
|
||||
if (config && config->process)
|
||||
ret = snd_soc_add_component(dev, &pcm->component,
|
||||
&dmaengine_pcm_component_process,
|
||||
NULL, 0);
|
||||
else
|
||||
ret = snd_soc_add_component(dev, &pcm->component,
|
||||
&dmaengine_pcm_component, NULL, 0);
|
||||
if (ret)
|
||||
goto err_free_dma;
|
||||
|
||||
|
|
Loading…
Reference in a new issue