Commit 165879a9 authored by Mark Brown's avatar Mark Brown

Merge remote-tracking branches 'asoc/topic/fsl_esai', 'asoc/topic/fsl_ssi',...

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
...@@ -118,6 +118,8 @@ void snd_dmaengine_pcm_set_config_from_dai_data( ...@@ -118,6 +118,8 @@ void snd_dmaengine_pcm_set_config_from_dai_data(
* PCM substream. Will be called from the PCM drivers hwparams callback. * PCM substream. Will be called from the PCM drivers hwparams callback.
* @compat_request_channel: Callback to request a DMA channel for platforms * @compat_request_channel: Callback to request a DMA channel for platforms
* which do not use devicetree. * 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 * @compat_filter_fn: Will be used as the filter function when requesting a
* channel for platforms which do not use devicetree. The filter parameter * channel for platforms which do not use devicetree. The filter parameter
* will be the DAI's DMA data. * will be the DAI's DMA data.
...@@ -140,6 +142,9 @@ struct snd_dmaengine_pcm_config { ...@@ -140,6 +142,9 @@ struct snd_dmaengine_pcm_config {
struct dma_chan *(*compat_request_channel)( struct dma_chan *(*compat_request_channel)(
struct snd_soc_pcm_runtime *rtd, struct snd_soc_pcm_runtime *rtd,
struct snd_pcm_substream *substream); 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; dma_filter_fn compat_filter_fn;
struct device *dma_dev; struct device *dma_dev;
const char *chan_names[SNDRV_PCM_STREAM_LAST + 1]; const char *chan_names[SNDRV_PCM_STREAM_LAST + 1];
......
...@@ -242,6 +242,7 @@ typedef int __bitwise snd_pcm_format_t; ...@@ -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_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_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_LAST SNDRV_PCM_FORMAT_DSD_U32_BE
#define SNDRV_PCM_FORMAT_FIRST SNDRV_PCM_FORMAT_S8
#ifdef SNDRV_LITTLE_ENDIAN #ifdef SNDRV_LITTLE_ENDIAN
#define SNDRV_PCM_FORMAT_S16 SNDRV_PCM_FORMAT_S16_LE #define SNDRV_PCM_FORMAT_S16 SNDRV_PCM_FORMAT_S16_LE
......
...@@ -19,7 +19,6 @@ ...@@ -19,7 +19,6 @@
#include <linux/device.h> #include <linux/device.h>
#include <sound/core.h> #include <sound/core.h>
#include <sound/pcm.h> #include <sound/pcm.h>
#include <sound/ac97_codec.h>
#include <sound/initval.h> #include <sound/initval.h>
#include <sound/soc.h> #include <sound/soc.h>
...@@ -51,25 +50,21 @@ static struct snd_soc_dai_driver gtm601_dai = { ...@@ -51,25 +50,21 @@ static struct snd_soc_dai_driver gtm601_dai = {
}, },
}; };
static const struct snd_soc_codec_driver soc_codec_dev_gtm601 = { static const struct snd_soc_component_driver soc_component_dev_gtm601 = {
.component_driver = { .dapm_widgets = gtm601_dapm_widgets,
.dapm_widgets = gtm601_dapm_widgets, .num_dapm_widgets = ARRAY_SIZE(gtm601_dapm_widgets),
.num_dapm_widgets = ARRAY_SIZE(gtm601_dapm_widgets), .dapm_routes = gtm601_dapm_routes,
.dapm_routes = gtm601_dapm_routes, .num_dapm_routes = ARRAY_SIZE(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) static int gtm601_platform_probe(struct platform_device *pdev)
{ {
return snd_soc_register_codec(&pdev->dev, return devm_snd_soc_register_component(&pdev->dev,
&soc_codec_dev_gtm601, &gtm601_dai, 1); &soc_component_dev_gtm601, &gtm601_dai, 1);
}
static int gtm601_platform_remove(struct platform_device *pdev)
{
snd_soc_unregister_codec(&pdev->dev);
return 0;
} }
#if defined(CONFIG_OF) #if defined(CONFIG_OF)
...@@ -86,7 +81,6 @@ static struct platform_driver gtm601_codec_driver = { ...@@ -86,7 +81,6 @@ static struct platform_driver gtm601_codec_driver = {
.of_match_table = of_match_ptr(gtm601_codec_of_match), .of_match_table = of_match_ptr(gtm601_codec_of_match),
}, },
.probe = gtm601_platform_probe, .probe = gtm601_platform_probe,
.remove = gtm601_platform_remove,
}; };
module_platform_driver(gtm601_codec_driver); module_platform_driver(gtm601_codec_driver);
......
...@@ -788,7 +788,7 @@ static int fsl_esai_probe(struct platform_device *pdev) ...@@ -788,7 +788,7 @@ static int fsl_esai_probe(struct platform_device *pdev)
struct device_node *np = pdev->dev.of_node; struct device_node *np = pdev->dev.of_node;
struct fsl_esai *esai_priv; struct fsl_esai *esai_priv;
struct resource *res; struct resource *res;
const uint32_t *iprop; const __be32 *iprop;
void __iomem *regs; void __iomem *regs;
int irq, ret; int irq, ret;
......
This diff is collapsed.
...@@ -12,9 +12,6 @@ ...@@ -12,9 +12,6 @@
#ifndef _MPC8610_I2S_H #ifndef _MPC8610_I2S_H
#define _MPC8610_I2S_H #define _MPC8610_I2S_H
#define RX 0
#define TX 1
/* -- SSI Register Map -- */ /* -- SSI Register Map -- */
/* SSI Transmit Data Register 0 */ /* SSI Transmit Data Register 0 */
......
...@@ -36,7 +36,7 @@ int fsl_asoc_get_dma_channel(struct device_node *ssi_np, ...@@ -36,7 +36,7 @@ int fsl_asoc_get_dma_channel(struct device_node *ssi_np,
{ {
struct resource res; struct resource res;
struct device_node *dma_channel_np, *dma_np; struct device_node *dma_channel_np, *dma_np;
const u32 *iprop; const __be32 *iprop;
int ret; int ret;
dma_channel_np = of_parse_phandle(ssi_np, name, 0); 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 ...@@ -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) | u32 addr_widths = BIT(DMA_SLAVE_BUSWIDTH_1_BYTE) |
BIT(DMA_SLAVE_BUSWIDTH_2_BYTES) | BIT(DMA_SLAVE_BUSWIDTH_2_BYTES) |
BIT(DMA_SLAVE_BUSWIDTH_4_BYTES); BIT(DMA_SLAVE_BUSWIDTH_4_BYTES);
int i, ret; snd_pcm_format_t i;
int ret;
if (pcm->config && pcm->config->pcm_hardware) if (pcm->config && pcm->config->pcm_hardware)
return snd_soc_set_runtime_hwparams(substream, return snd_soc_set_runtime_hwparams(substream,
...@@ -182,7 +183,7 @@ static int dmaengine_pcm_set_runtime_hwparams(struct snd_pcm_substream *substrea ...@@ -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 * default assumption is that it supports 1, 2 and 4 bytes
* widths. * 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); int bits = snd_pcm_format_physical_width(i);
/* /*
...@@ -340,6 +341,41 @@ static snd_pcm_uframes_t dmaengine_pcm_pointer( ...@@ -340,6 +341,41 @@ static snd_pcm_uframes_t dmaengine_pcm_pointer(
return snd_dmaengine_pcm_pointer(substream); 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 = { static const struct snd_pcm_ops dmaengine_pcm_ops = {
.open = dmaengine_pcm_open, .open = dmaengine_pcm_open,
.close = snd_dmaengine_pcm_close, .close = snd_dmaengine_pcm_close,
...@@ -350,6 +386,17 @@ static const struct snd_pcm_ops dmaengine_pcm_ops = { ...@@ -350,6 +386,17 @@ static const struct snd_pcm_ops dmaengine_pcm_ops = {
.pointer = dmaengine_pcm_pointer, .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 = { static const struct snd_soc_component_driver dmaengine_pcm_component = {
.name = SND_DMAENGINE_PCM_DRV_NAME, .name = SND_DMAENGINE_PCM_DRV_NAME,
.probe_order = SND_SOC_COMP_ORDER_LATE, .probe_order = SND_SOC_COMP_ORDER_LATE,
...@@ -357,6 +404,13 @@ static const struct snd_soc_component_driver dmaengine_pcm_component = { ...@@ -357,6 +404,13 @@ static const struct snd_soc_component_driver dmaengine_pcm_component = {
.pcm_new = dmaengine_pcm_new, .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[] = { static const char * const dmaengine_pcm_dma_channel_names[] = {
[SNDRV_PCM_STREAM_PLAYBACK] = "tx", [SNDRV_PCM_STREAM_PLAYBACK] = "tx",
[SNDRV_PCM_STREAM_CAPTURE] = "rx", [SNDRV_PCM_STREAM_CAPTURE] = "rx",
...@@ -442,6 +496,9 @@ int snd_dmaengine_pcm_register(struct device *dev, ...@@ -442,6 +496,9 @@ int snd_dmaengine_pcm_register(struct device *dev,
if (!pcm) if (!pcm)
return -ENOMEM; return -ENOMEM;
#ifdef CONFIG_DEBUG_FS
pcm->component.debugfs_prefix = "dma";
#endif
pcm->config = config; pcm->config = config;
pcm->flags = flags; pcm->flags = flags;
...@@ -449,8 +506,13 @@ int snd_dmaengine_pcm_register(struct device *dev, ...@@ -449,8 +506,13 @@ int snd_dmaengine_pcm_register(struct device *dev,
if (ret) if (ret)
goto err_free_dma; goto err_free_dma;
ret = snd_soc_add_component(dev, &pcm->component, if (config && config->process)
&dmaengine_pcm_component, NULL, 0); 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) if (ret)
goto err_free_dma; goto err_free_dma;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment