Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 371921
b: refs/heads/master
c: 09ae3aa
h: refs/heads/master
i:
  371919: c3d0332
v: v3
  • Loading branch information
Lars-Peter Clausen authored and Mark Brown committed Apr 3, 2013
1 parent 90d49c5 commit 417775b
Show file tree
Hide file tree
Showing 17 changed files with 55 additions and 140 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 2735e6cd2b8d7cbf4c096b3cb19d637efb7a3ffc
refs/heads/master: 09ae3aaf3cd28422d76b7b78d9491b17330b276a
1 change: 0 additions & 1 deletion trunk/sound/soc/omap/am3517evm.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
#include <linux/platform_data/asoc-ti-mcbsp.h>

#include "omap-mcbsp.h"
#include "omap-pcm.h"

#include "../codecs/tlv320aic23.h"

Expand Down
1 change: 0 additions & 1 deletion trunk/sound/soc/omap/ams-delta.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@
#include <linux/platform_data/asoc-ti-mcbsp.h>

#include "omap-mcbsp.h"
#include "omap-pcm.h"
#include "../codecs/cx20442.h"


Expand Down
14 changes: 8 additions & 6 deletions trunk/sound/soc/omap/mcbsp.c
Original file line number Diff line number Diff line change
Expand Up @@ -1018,19 +1018,21 @@ int omap_mcbsp_init(struct platform_device *pdev)
return -ENODEV;
}
/* RX DMA request number, and port address configuration */
mcbsp->dma_data[1].name = "Audio Capture";
mcbsp->dma_data[1].dma_req = res->start;
mcbsp->dma_data[1].port_addr = omap_mcbsp_dma_reg_params(mcbsp, 1);
mcbsp->dma_req[1] = res->start;
mcbsp->dma_data[1].filter_data = &mcbsp->dma_req[1];
mcbsp->dma_data[1].addr = omap_mcbsp_dma_reg_params(mcbsp, 1);
mcbsp->dma_data[1].maxburst = 4;

res = platform_get_resource_byname(pdev, IORESOURCE_DMA, "tx");
if (!res) {
dev_err(&pdev->dev, "invalid tx DMA channel\n");
return -ENODEV;
}
/* TX DMA request number, and port address configuration */
mcbsp->dma_data[0].name = "Audio Playback";
mcbsp->dma_data[0].dma_req = res->start;
mcbsp->dma_data[0].port_addr = omap_mcbsp_dma_reg_params(mcbsp, 0);
mcbsp->dma_req[0] = res->start;
mcbsp->dma_data[0].filter_data = &mcbsp->dma_req[0];
mcbsp->dma_data[0].addr = omap_mcbsp_dma_reg_params(mcbsp, 0);
mcbsp->dma_data[0].maxburst = 4;

mcbsp->fclk = clk_get(&pdev->dev, "fck");
if (IS_ERR(mcbsp->fclk)) {
Expand Down
7 changes: 4 additions & 3 deletions trunk/sound/soc/omap/mcbsp.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,14 @@
#ifndef __ASOC_MCBSP_H
#define __ASOC_MCBSP_H

#include "omap-pcm.h"

#ifdef CONFIG_ARCH_OMAP1
#define mcbsp_omap1() 1
#else
#define mcbsp_omap1() 0
#endif

#include <sound/dmaengine_pcm.h>

/* McBSP register numbers. Register address offset = num * reg_step */
enum {
/* Common registers */
Expand Down Expand Up @@ -312,7 +312,8 @@ struct omap_mcbsp {
struct omap_mcbsp_platform_data *pdata;
struct omap_mcbsp_st_data *st_data;
struct omap_mcbsp_reg_cfg cfg_regs;
struct omap_pcm_dma_data dma_data[2];
struct snd_dmaengine_dai_dma_data dma_data[2];
unsigned int dma_req[2];
int dma_op_mode;
u16 max_tx_thres;
u16 max_rx_thres;
Expand Down
1 change: 0 additions & 1 deletion trunk/sound/soc/omap/n810.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@
#include <linux/platform_data/asoc-ti-mcbsp.h>

#include "omap-mcbsp.h"
#include "omap-pcm.h"

#define N810_HEADSET_AMP_GPIO 10
#define N810_SPEAKER_AMP_GPIO 101
Expand Down
1 change: 0 additions & 1 deletion trunk/sound/soc/omap/omap-abe-twl6040.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@

#include "omap-dmic.h"
#include "omap-mcpdm.h"
#include "omap-pcm.h"
#include "../codecs/twl6040.h"

struct abe_twl6040 {
Expand Down
22 changes: 10 additions & 12 deletions trunk/sound/soc/omap/omap-dmic.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@
#include <sound/pcm_params.h>
#include <sound/initval.h>
#include <sound/soc.h>
#include <sound/dmaengine_pcm.h>

#include "omap-pcm.h"
#include "omap-dmic.h"

struct omap_dmic {
Expand All @@ -55,13 +55,9 @@ struct omap_dmic {
u32 ch_enabled;
bool active;
struct mutex mutex;
};

/*
* Stream DMA parameters
*/
static struct omap_pcm_dma_data omap_dmic_dai_dma_params = {
.name = "DMIC capture",
struct snd_dmaengine_dai_dma_data dma_data;
unsigned int dma_req;
};

static inline void omap_dmic_write(struct omap_dmic *dmic, u16 reg, u32 val)
Expand Down Expand Up @@ -118,7 +114,7 @@ static int omap_dmic_dai_startup(struct snd_pcm_substream *substream,

mutex_unlock(&dmic->mutex);

snd_soc_dai_set_dma_data(dai, substream, &omap_dmic_dai_dma_params);
snd_soc_dai_set_dma_data(dai, substream, &dmic->dma_data);
return ret;
}

Expand Down Expand Up @@ -203,7 +199,7 @@ static int omap_dmic_dai_hw_params(struct snd_pcm_substream *substream,
struct snd_soc_dai *dai)
{
struct omap_dmic *dmic = snd_soc_dai_get_drvdata(dai);
struct omap_pcm_dma_data *dma_data;
struct snd_dmaengine_dai_dma_data *dma_data;
int channels;

dmic->clk_div = omap_dmic_select_divider(dmic, params_rate(params));
Expand All @@ -230,7 +226,7 @@ static int omap_dmic_dai_hw_params(struct snd_pcm_substream *substream,

/* packet size is threshold * channels */
dma_data = snd_soc_dai_get_dma_data(dai, substream);
dma_data->packet_size = dmic->threshold * channels;
dma_data->maxburst = dmic->threshold * channels;

return 0;
}
Expand Down Expand Up @@ -476,15 +472,17 @@ static int asoc_dmic_probe(struct platform_device *pdev)
ret = -ENODEV;
goto err_put_clk;
}
omap_dmic_dai_dma_params.port_addr = res->start + OMAP_DMIC_DATA_REG;
dmic->dma_data.addr = res->start + OMAP_DMIC_DATA_REG;

res = platform_get_resource(pdev, IORESOURCE_DMA, 0);
if (!res) {
dev_err(dmic->dev, "invalid dma resource\n");
ret = -ENODEV;
goto err_put_clk;
}
omap_dmic_dai_dma_params.dma_req = res->start;

dmic->dma_req = res->start;
dmic->dma_data.filter_data = &dmic->dma_req;

res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "mpu");
if (!res) {
Expand Down
24 changes: 10 additions & 14 deletions trunk/sound/soc/omap/omap-hdmi.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,16 @@
#include <sound/soc.h>
#include <sound/asound.h>
#include <sound/asoundef.h>
#include <sound/dmaengine_pcm.h>
#include <video/omapdss.h>

#include "omap-pcm.h"
#include "omap-hdmi.h"

#define DRV_NAME "omap-hdmi-audio-dai"

struct hdmi_priv {
struct omap_pcm_dma_data dma_params;
struct snd_dmaengine_dai_dma_data dma_data;
unsigned int dma_req;
struct omap_dss_audio dss_audio;
struct snd_aes_iec958 iec;
struct snd_cea_861_aud_if cea;
Expand Down Expand Up @@ -68,7 +69,7 @@ static int omap_hdmi_dai_startup(struct snd_pcm_substream *substream,
return -ENODEV;
}

snd_soc_dai_set_dma_data(dai, substream, &priv->dma_params);
snd_soc_dai_set_dma_data(dai, substream, &priv->dma_data);

return 0;
}
Expand All @@ -88,25 +89,20 @@ static int omap_hdmi_dai_hw_params(struct snd_pcm_substream *substream,
struct hdmi_priv *priv = snd_soc_dai_get_drvdata(dai);
struct snd_aes_iec958 *iec = &priv->iec;
struct snd_cea_861_aud_if *cea = &priv->cea;
struct omap_pcm_dma_data *dma_data;
int err = 0;

dma_data = snd_soc_dai_get_dma_data(dai, substream);

switch (params_format(params)) {
case SNDRV_PCM_FORMAT_S16_LE:
dma_data->packet_size = 16;
priv->dma_data.maxburst = 16;
break;
case SNDRV_PCM_FORMAT_S24_LE:
dma_data->packet_size = 32;
priv->dma_data.maxburst = 32;
break;
default:
dev_err(dai->dev, "format not supported!\n");
return -EINVAL;
}

dma_data->data_type = 32;

/*
* fill the IEC-60958 channel status word
*/
Expand Down Expand Up @@ -283,17 +279,17 @@ static int omap_hdmi_probe(struct platform_device *pdev)
return -ENODEV;
}

hdmi_data->dma_params.port_addr = hdmi_rsrc->start
+ OMAP_HDMI_AUDIO_DMA_PORT;
hdmi_data->dma_data.addr = hdmi_rsrc->start + OMAP_HDMI_AUDIO_DMA_PORT;

hdmi_rsrc = platform_get_resource(pdev, IORESOURCE_DMA, 0);
if (!hdmi_rsrc) {
dev_err(&pdev->dev, "Cannot obtain IORESOURCE_DMA HDMI\n");
return -ENODEV;
}

hdmi_data->dma_params.dma_req = hdmi_rsrc->start;
hdmi_data->dma_params.name = "HDMI playback";
hdmi_data->dma_req = hdmi_rsrc->start;
hdmi_data->dma_data.filter_data = &hdmi_data->dma_req;
hdmi_data->dma_data.addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES;

/*
* TODO: We assume that there is only one DSS HDMI device. Future
Expand Down
6 changes: 3 additions & 3 deletions trunk/sound/soc/omap/omap-mcbsp.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,11 @@
#include <sound/pcm_params.h>
#include <sound/initval.h>
#include <sound/soc.h>
#include <sound/dmaengine_pcm.h>

#include <linux/platform_data/asoc-ti-mcbsp.h>
#include "mcbsp.h"
#include "omap-mcbsp.h"
#include "omap-pcm.h"

#define OMAP_MCBSP_RATES (SNDRV_PCM_RATE_8000_96000)

Expand Down Expand Up @@ -224,7 +224,7 @@ static int omap_mcbsp_dai_hw_params(struct snd_pcm_substream *substream,
{
struct omap_mcbsp *mcbsp = snd_soc_dai_get_drvdata(cpu_dai);
struct omap_mcbsp_reg_cfg *regs = &mcbsp->cfg_regs;
struct omap_pcm_dma_data *dma_data;
struct snd_dmaengine_dai_dma_data *dma_data;
int wlen, channels, wpf;
int pkt_size = 0;
unsigned int format, div, framesize, master;
Expand Down Expand Up @@ -276,7 +276,7 @@ static int omap_mcbsp_dai_hw_params(struct snd_pcm_substream *substream,
omap_mcbsp_set_threshold(substream, pkt_size);
}

dma_data->packet_size = pkt_size;
dma_data->maxburst = pkt_size;

if (mcbsp->configured) {
/* McBSP already configured by another stream */
Expand Down
31 changes: 14 additions & 17 deletions trunk/sound/soc/omap/omap-mcpdm.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@
#include <sound/pcm.h>
#include <sound/pcm_params.h>
#include <sound/soc.h>
#include <sound/dmaengine_pcm.h>

#include "omap-mcpdm.h"
#include "omap-pcm.h"

struct mcpdm_link_config {
u32 link_mask; /* channel mask for the direction */
Expand All @@ -64,19 +64,14 @@ struct omap_mcpdm {

/* McPDM needs to be restarted due to runtime reconfiguration */
bool restart;

struct snd_dmaengine_dai_dma_data dma_data[2];
unsigned int dma_req[2];
};

/*
* Stream DMA parameters
*/
static struct omap_pcm_dma_data omap_mcpdm_dai_dma_params[] = {
{
.name = "Audio playback",
},
{
.name = "Audio capture",
},
};

static inline void omap_mcpdm_write(struct omap_mcpdm *mcpdm, u16 reg, u32 val)
{
Expand Down Expand Up @@ -272,7 +267,7 @@ static int omap_mcpdm_dai_startup(struct snd_pcm_substream *substream,
mutex_unlock(&mcpdm->mutex);

snd_soc_dai_set_dma_data(dai, substream,
&omap_mcpdm_dai_dma_params[substream->stream]);
&mcpdm->dma_data[substream->stream]);

return 0;
}
Expand Down Expand Up @@ -302,7 +297,7 @@ static int omap_mcpdm_dai_hw_params(struct snd_pcm_substream *substream,
{
struct omap_mcpdm *mcpdm = snd_soc_dai_get_drvdata(dai);
int stream = substream->stream;
struct omap_pcm_dma_data *dma_data;
struct snd_dmaengine_dai_dma_data *dma_data;
u32 threshold;
int channels;
int link_mask = 0;
Expand Down Expand Up @@ -342,14 +337,14 @@ static int omap_mcpdm_dai_hw_params(struct snd_pcm_substream *substream,
if (!mcpdm->config[!stream].link_mask)
mcpdm->config[!stream].link_mask = 0x3;

dma_data->packet_size =
dma_data->maxburst =
(MCPDM_DN_THRES_MAX - threshold) * channels;
} else {
/* If playback is not running assume a stereo stream to come */
if (!mcpdm->config[!stream].link_mask)
mcpdm->config[!stream].link_mask = (0x3 << 3);

dma_data->packet_size = threshold * channels;
dma_data->maxburst = threshold * channels;
}

/* Check if we need to restart McPDM with this stream */
Expand Down Expand Up @@ -475,20 +470,22 @@ static int asoc_mcpdm_probe(struct platform_device *pdev)
if (res == NULL)
return -ENOMEM;

omap_mcpdm_dai_dma_params[0].port_addr = res->start + MCPDM_REG_DN_DATA;
omap_mcpdm_dai_dma_params[1].port_addr = res->start + MCPDM_REG_UP_DATA;
mcpdm->dma_data[0].addr = res->start + MCPDM_REG_DN_DATA;
mcpdm->dma_data[1].addr = res->start + MCPDM_REG_UP_DATA;

res = platform_get_resource_byname(pdev, IORESOURCE_DMA, "dn_link");
if (!res)
return -ENODEV;

omap_mcpdm_dai_dma_params[0].dma_req = res->start;
mcpdm->dma_req[0] = res->start;
mcpdm->dma_data[0].filter_data = &mcpdm->dma_req[0];

res = platform_get_resource_byname(pdev, IORESOURCE_DMA, "up_link");
if (!res)
return -ENODEV;

omap_mcpdm_dai_dma_params[1].dma_req = res->start;
mcpdm->dma_req[1] = res->start;
mcpdm->dma_data[1].filter_data = &mcpdm->dma_req[1];

res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "mpu");
if (res == NULL)
Expand Down
Loading

0 comments on commit 417775b

Please sign in to comment.