Merge remote-tracking branches 'asoc/topic/omap' and 'asoc/topic/rcar' into asoc-next
This commit is contained in:
commit
440a528558
13 changed files with 265 additions and 36 deletions
|
@ -20,6 +20,7 @@ Required properties:
|
||||||
SSI subnode properties:
|
SSI subnode properties:
|
||||||
- interrupts : Should contain SSI interrupt for PIO transfer
|
- interrupts : Should contain SSI interrupt for PIO transfer
|
||||||
- shared-pin : if shared clock pin
|
- shared-pin : if shared clock pin
|
||||||
|
- pio-transfer : use PIO transfer mode
|
||||||
|
|
||||||
SRC subnode properties:
|
SRC subnode properties:
|
||||||
no properties at this point
|
no properties at this point
|
||||||
|
|
|
@ -33,10 +33,10 @@
|
||||||
#include <sound/initval.h>
|
#include <sound/initval.h>
|
||||||
#include <sound/soc.h>
|
#include <sound/soc.h>
|
||||||
#include <sound/dmaengine_pcm.h>
|
#include <sound/dmaengine_pcm.h>
|
||||||
|
#include <sound/omap-pcm.h>
|
||||||
|
|
||||||
#include "davinci-pcm.h"
|
#include "davinci-pcm.h"
|
||||||
#include "davinci-mcasp.h"
|
#include "davinci-mcasp.h"
|
||||||
#include "../omap/omap-pcm.h"
|
|
||||||
|
|
||||||
#define MCASP_MAX_AFIFO_DEPTH 64
|
#define MCASP_MAX_AFIFO_DEPTH 64
|
||||||
|
|
||||||
|
|
|
@ -40,9 +40,9 @@
|
||||||
#include <sound/initval.h>
|
#include <sound/initval.h>
|
||||||
#include <sound/soc.h>
|
#include <sound/soc.h>
|
||||||
#include <sound/dmaengine_pcm.h>
|
#include <sound/dmaengine_pcm.h>
|
||||||
|
#include <sound/omap-pcm.h>
|
||||||
|
|
||||||
#include "omap-dmic.h"
|
#include "omap-dmic.h"
|
||||||
#include "omap-pcm.h"
|
|
||||||
|
|
||||||
struct omap_dmic {
|
struct omap_dmic {
|
||||||
struct device *dev;
|
struct device *dev;
|
||||||
|
|
|
@ -34,9 +34,9 @@
|
||||||
#include <sound/asoundef.h>
|
#include <sound/asoundef.h>
|
||||||
#include <sound/dmaengine_pcm.h>
|
#include <sound/dmaengine_pcm.h>
|
||||||
#include <video/omapdss.h>
|
#include <video/omapdss.h>
|
||||||
|
#include <sound/omap-pcm.h>
|
||||||
|
|
||||||
#include "omap-hdmi.h"
|
#include "omap-hdmi.h"
|
||||||
#include "omap-pcm.h"
|
|
||||||
|
|
||||||
#define DRV_NAME "omap-hdmi-audio-dai"
|
#define DRV_NAME "omap-hdmi-audio-dai"
|
||||||
|
|
||||||
|
|
|
@ -34,11 +34,11 @@
|
||||||
#include <sound/initval.h>
|
#include <sound/initval.h>
|
||||||
#include <sound/soc.h>
|
#include <sound/soc.h>
|
||||||
#include <sound/dmaengine_pcm.h>
|
#include <sound/dmaengine_pcm.h>
|
||||||
|
#include <sound/omap-pcm.h>
|
||||||
|
|
||||||
#include <linux/platform_data/asoc-ti-mcbsp.h>
|
#include <linux/platform_data/asoc-ti-mcbsp.h>
|
||||||
#include "mcbsp.h"
|
#include "mcbsp.h"
|
||||||
#include "omap-mcbsp.h"
|
#include "omap-mcbsp.h"
|
||||||
#include "omap-pcm.h"
|
|
||||||
|
|
||||||
#define OMAP_MCBSP_RATES (SNDRV_PCM_RATE_8000_96000)
|
#define OMAP_MCBSP_RATES (SNDRV_PCM_RATE_8000_96000)
|
||||||
|
|
||||||
|
|
|
@ -40,9 +40,9 @@
|
||||||
#include <sound/pcm_params.h>
|
#include <sound/pcm_params.h>
|
||||||
#include <sound/soc.h>
|
#include <sound/soc.h>
|
||||||
#include <sound/dmaengine_pcm.h>
|
#include <sound/dmaengine_pcm.h>
|
||||||
|
#include <sound/omap-pcm.h>
|
||||||
|
|
||||||
#include "omap-mcpdm.h"
|
#include "omap-mcpdm.h"
|
||||||
#include "omap-pcm.h"
|
|
||||||
|
|
||||||
struct mcpdm_link_config {
|
struct mcpdm_link_config {
|
||||||
u32 link_mask; /* channel mask for the direction */
|
u32 link_mask; /* channel mask for the direction */
|
||||||
|
|
|
@ -255,11 +255,81 @@ int rsnd_dma_available(struct rsnd_dma *dma)
|
||||||
return !!dma->chan;
|
return !!dma->chan;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#define DMA_NAME_SIZE 16
|
||||||
|
#define MOD_MAX 4 /* MEM/SSI/SRC/DVC */
|
||||||
|
static int _rsnd_dma_of_name(char *dma_name, struct rsnd_mod *mod)
|
||||||
|
{
|
||||||
|
if (mod)
|
||||||
|
return snprintf(dma_name, DMA_NAME_SIZE / 2, "%s%d",
|
||||||
|
rsnd_mod_name(mod), rsnd_mod_id(mod));
|
||||||
|
else
|
||||||
|
return snprintf(dma_name, DMA_NAME_SIZE / 2, "mem");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
static void rsnd_dma_of_name(struct rsnd_dma *dma,
|
||||||
|
int is_play, char *dma_name)
|
||||||
|
{
|
||||||
|
struct rsnd_mod *this = rsnd_dma_to_mod(dma);
|
||||||
|
struct rsnd_dai_stream *io = rsnd_mod_to_io(this);
|
||||||
|
struct rsnd_mod *ssi = rsnd_io_to_mod_ssi(io);
|
||||||
|
struct rsnd_mod *src = rsnd_io_to_mod_src(io);
|
||||||
|
struct rsnd_mod *dvc = rsnd_io_to_mod_dvc(io);
|
||||||
|
struct rsnd_mod *mod[MOD_MAX];
|
||||||
|
struct rsnd_mod *src_mod, *dst_mod;
|
||||||
|
int i, index;
|
||||||
|
|
||||||
|
|
||||||
|
for (i = 0; i < MOD_MAX; i++)
|
||||||
|
mod[i] = NULL;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* in play case...
|
||||||
|
*
|
||||||
|
* src -> dst
|
||||||
|
*
|
||||||
|
* mem -> SSI
|
||||||
|
* mem -> SRC -> SSI
|
||||||
|
* mem -> SRC -> DVC -> SSI
|
||||||
|
*/
|
||||||
|
mod[0] = NULL; /* for "mem" */
|
||||||
|
index = 1;
|
||||||
|
for (i = 1; i < MOD_MAX; i++) {
|
||||||
|
if (!src) {
|
||||||
|
mod[i] = ssi;
|
||||||
|
break;
|
||||||
|
} else if (!dvc) {
|
||||||
|
mod[i] = src;
|
||||||
|
src = NULL;
|
||||||
|
} else {
|
||||||
|
mod[i] = dvc;
|
||||||
|
dvc = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (mod[i] == this)
|
||||||
|
index = i;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (is_play) {
|
||||||
|
src_mod = mod[index - 1];
|
||||||
|
dst_mod = mod[index];
|
||||||
|
} else {
|
||||||
|
src_mod = mod[index];
|
||||||
|
dst_mod = mod[index + 1];
|
||||||
|
}
|
||||||
|
|
||||||
|
index = 0;
|
||||||
|
index = _rsnd_dma_of_name(dma_name + index, src_mod);
|
||||||
|
*(dma_name + index++) = '_';
|
||||||
|
index = _rsnd_dma_of_name(dma_name + index, dst_mod);
|
||||||
|
}
|
||||||
|
|
||||||
int rsnd_dma_init(struct rsnd_priv *priv, struct rsnd_dma *dma,
|
int rsnd_dma_init(struct rsnd_priv *priv, struct rsnd_dma *dma,
|
||||||
int is_play, int id)
|
int is_play, int id)
|
||||||
{
|
{
|
||||||
struct device *dev = rsnd_priv_to_dev(priv);
|
struct device *dev = rsnd_priv_to_dev(priv);
|
||||||
struct dma_slave_config cfg;
|
struct dma_slave_config cfg;
|
||||||
|
char dma_name[DMA_NAME_SIZE];
|
||||||
dma_cap_mask_t mask;
|
dma_cap_mask_t mask;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
|
@ -271,18 +341,23 @@ int rsnd_dma_init(struct rsnd_priv *priv, struct rsnd_dma *dma,
|
||||||
dma_cap_zero(mask);
|
dma_cap_zero(mask);
|
||||||
dma_cap_set(DMA_SLAVE, mask);
|
dma_cap_set(DMA_SLAVE, mask);
|
||||||
|
|
||||||
|
if (dev->of_node)
|
||||||
|
rsnd_dma_of_name(dma, is_play, dma_name);
|
||||||
|
else
|
||||||
|
snprintf(dma_name, DMA_NAME_SIZE,
|
||||||
|
is_play ? "tx" : "rx");
|
||||||
|
|
||||||
|
dev_dbg(dev, "dma name : %s\n", dma_name);
|
||||||
|
|
||||||
dma->chan = dma_request_slave_channel_compat(mask, shdma_chan_filter,
|
dma->chan = dma_request_slave_channel_compat(mask, shdma_chan_filter,
|
||||||
(void *)id, dev,
|
(void *)id, dev,
|
||||||
is_play ? "tx" : "rx");
|
dma_name);
|
||||||
if (!dma->chan) {
|
if (!dma->chan) {
|
||||||
dev_err(dev, "can't get dma channel\n");
|
dev_err(dev, "can't get dma channel\n");
|
||||||
return -EIO;
|
return -EIO;
|
||||||
}
|
}
|
||||||
|
|
||||||
cfg.slave_id = id;
|
rsnd_gen_dma_addr(priv, dma, &cfg, is_play, id);
|
||||||
cfg.dst_addr = 0; /* use default addr when playback */
|
|
||||||
cfg.src_addr = 0; /* use default addr when capture */
|
|
||||||
cfg.direction = is_play ? DMA_MEM_TO_DEV : DMA_DEV_TO_MEM;
|
|
||||||
|
|
||||||
ret = dmaengine_slave_config(dma->chan, &cfg);
|
ret = dmaengine_slave_config(dma->chan, &cfg);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
|
@ -956,7 +1031,7 @@ static int rsnd_probe(struct platform_device *pdev)
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
}
|
}
|
||||||
|
|
||||||
priv->dev = dev;
|
priv->pdev = pdev;
|
||||||
priv->info = info;
|
priv->info = info;
|
||||||
spin_lock_init(&priv->lock);
|
spin_lock_init(&priv->lock);
|
||||||
|
|
||||||
|
|
|
@ -13,6 +13,9 @@
|
||||||
#define RSND_DVC_NAME_SIZE 16
|
#define RSND_DVC_NAME_SIZE 16
|
||||||
#define RSND_DVC_VOLUME_MAX 100
|
#define RSND_DVC_VOLUME_MAX 100
|
||||||
#define RSND_DVC_VOLUME_NUM 2
|
#define RSND_DVC_VOLUME_NUM 2
|
||||||
|
|
||||||
|
#define DVC_NAME "dvc"
|
||||||
|
|
||||||
struct rsnd_dvc {
|
struct rsnd_dvc {
|
||||||
struct rsnd_dvc_platform_info *info; /* rcar_snd.h */
|
struct rsnd_dvc_platform_info *info; /* rcar_snd.h */
|
||||||
struct rsnd_mod mod;
|
struct rsnd_mod mod;
|
||||||
|
@ -43,6 +46,17 @@ static void rsnd_dvc_volume_update(struct rsnd_mod *mod)
|
||||||
rsnd_mod_write(mod, DVC_VOL1R, vol[1]);
|
rsnd_mod_write(mod, DVC_VOL1R, vol[1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int rsnd_dvc_probe_gen2(struct rsnd_mod *mod,
|
||||||
|
struct rsnd_dai *rdai)
|
||||||
|
{
|
||||||
|
struct rsnd_priv *priv = rsnd_mod_to_priv(mod);
|
||||||
|
struct device *dev = rsnd_priv_to_dev(priv);
|
||||||
|
|
||||||
|
dev_dbg(dev, "%s (Gen2) is probed\n", rsnd_mod_name(mod));
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
static int rsnd_dvc_init(struct rsnd_mod *dvc_mod,
|
static int rsnd_dvc_init(struct rsnd_mod *dvc_mod,
|
||||||
struct rsnd_dai *rdai)
|
struct rsnd_dai *rdai)
|
||||||
{
|
{
|
||||||
|
@ -208,7 +222,8 @@ static int rsnd_dvc_pcm_new(struct rsnd_mod *mod,
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct rsnd_mod_ops rsnd_dvc_ops = {
|
static struct rsnd_mod_ops rsnd_dvc_ops = {
|
||||||
.name = "dvc (gen2)",
|
.name = DVC_NAME,
|
||||||
|
.probe = rsnd_dvc_probe_gen2,
|
||||||
.init = rsnd_dvc_init,
|
.init = rsnd_dvc_init,
|
||||||
.quit = rsnd_dvc_quit,
|
.quit = rsnd_dvc_quit,
|
||||||
.start = rsnd_dvc_start,
|
.start = rsnd_dvc_start,
|
||||||
|
@ -255,7 +270,8 @@ int rsnd_dvc_probe(struct platform_device *pdev,
|
||||||
priv->dvc = dvc;
|
priv->dvc = dvc;
|
||||||
|
|
||||||
for_each_rsnd_dvc(dvc, priv, i) {
|
for_each_rsnd_dvc(dvc, priv, i) {
|
||||||
snprintf(name, RSND_DVC_NAME_SIZE, "dvc.%d", i);
|
snprintf(name, RSND_DVC_NAME_SIZE, "%s.%d",
|
||||||
|
DVC_NAME, i);
|
||||||
|
|
||||||
clk = devm_clk_get(dev, name);
|
clk = devm_clk_get(dev, name);
|
||||||
if (IS_ERR(clk))
|
if (IS_ERR(clk))
|
||||||
|
|
|
@ -155,6 +155,101 @@ static int rsnd_gen_regmap_init(struct rsnd_priv *priv,
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* DMA read/write register offset
|
||||||
|
*
|
||||||
|
* RSND_xxx_I_N for Audio DMAC input
|
||||||
|
* RSND_xxx_O_N for Audio DMAC output
|
||||||
|
* RSND_xxx_I_P for Audio DMAC peri peri input
|
||||||
|
* RSND_xxx_O_P for Audio DMAC peri peri output
|
||||||
|
*
|
||||||
|
* ex) R-Car H2 case
|
||||||
|
* mod / DMAC in / DMAC out / DMAC PP in / DMAC pp out
|
||||||
|
* SSI : 0xec541000 / 0xec241008 / 0xec24100c / 0xec400000 / 0xec400000
|
||||||
|
* SCU : 0xec500000 / 0xec000000 / 0xec004000 / 0xec300000 / 0xec304000
|
||||||
|
* CMD : 0xec500000 / 0xec008000 0xec308000
|
||||||
|
*/
|
||||||
|
#define RDMA_SSI_I_N(addr, i) (addr ##_reg - 0x00300000 + (0x40 * i) + 0x8)
|
||||||
|
#define RDMA_SSI_O_N(addr, i) (addr ##_reg - 0x00300000 + (0x40 * i) + 0xc)
|
||||||
|
|
||||||
|
#define RDMA_SSI_I_P(addr, i) (addr ##_reg - 0x00141000 + (0x1000 * i))
|
||||||
|
#define RDMA_SSI_O_P(addr, i) (addr ##_reg - 0x00141000 + (0x1000 * i))
|
||||||
|
|
||||||
|
#define RDMA_SRC_I_N(addr, i) (addr ##_reg - 0x00500000 + (0x400 * i))
|
||||||
|
#define RDMA_SRC_O_N(addr, i) (addr ##_reg - 0x004fc000 + (0x400 * i))
|
||||||
|
|
||||||
|
#define RDMA_SRC_I_P(addr, i) (addr ##_reg - 0x00200000 + (0x400 * i))
|
||||||
|
#define RDMA_SRC_O_P(addr, i) (addr ##_reg - 0x001fc000 + (0x400 * i))
|
||||||
|
|
||||||
|
#define RDMA_CMD_O_N(addr, i) (addr ##_reg - 0x004f8000 + (0x400 * i))
|
||||||
|
#define RDMA_CMD_O_P(addr, i) (addr ##_reg - 0x001f8000 + (0x400 * i))
|
||||||
|
|
||||||
|
void rsnd_gen_dma_addr(struct rsnd_priv *priv,
|
||||||
|
struct rsnd_dma *dma,
|
||||||
|
struct dma_slave_config *cfg,
|
||||||
|
int is_play, int slave_id)
|
||||||
|
{
|
||||||
|
struct platform_device *pdev = rsnd_priv_to_pdev(priv);
|
||||||
|
struct device *dev = rsnd_priv_to_dev(priv);
|
||||||
|
struct rsnd_mod *mod = rsnd_dma_to_mod(dma);
|
||||||
|
struct rsnd_dai_stream *io = rsnd_mod_to_io(mod);
|
||||||
|
dma_addr_t ssi_reg = platform_get_resource(pdev,
|
||||||
|
IORESOURCE_MEM, RSND_GEN2_SSI)->start;
|
||||||
|
dma_addr_t src_reg = platform_get_resource(pdev,
|
||||||
|
IORESOURCE_MEM, RSND_GEN2_SCU)->start;
|
||||||
|
int is_ssi = !!(rsnd_io_to_mod_ssi(io) == mod);
|
||||||
|
int use_src = !!rsnd_io_to_mod_src(io);
|
||||||
|
int use_dvc = !!rsnd_io_to_mod_dvc(io);
|
||||||
|
int id = rsnd_mod_id(mod);
|
||||||
|
struct dma_addr {
|
||||||
|
dma_addr_t src_addr;
|
||||||
|
dma_addr_t dst_addr;
|
||||||
|
} dma_addrs[2][2][3] = {
|
||||||
|
{ /* SRC */
|
||||||
|
/* Capture */
|
||||||
|
{{ 0, 0 },
|
||||||
|
{ RDMA_SRC_O_N(src, id), 0 },
|
||||||
|
{ RDMA_CMD_O_N(src, id), 0 }},
|
||||||
|
/* Playback */
|
||||||
|
{{ 0, 0, },
|
||||||
|
{ 0, RDMA_SRC_I_N(src, id) },
|
||||||
|
{ 0, RDMA_SRC_I_N(src, id) }}
|
||||||
|
}, { /* SSI */
|
||||||
|
/* Capture */
|
||||||
|
{{ RDMA_SSI_O_N(ssi, id), 0 },
|
||||||
|
{ RDMA_SSI_O_P(ssi, id), RDMA_SRC_I_P(src, id) },
|
||||||
|
{ RDMA_SSI_O_P(ssi, id), RDMA_SRC_I_P(src, id) }},
|
||||||
|
/* Playback */
|
||||||
|
{{ 0, RDMA_SSI_I_N(ssi, id) },
|
||||||
|
{ RDMA_SRC_O_P(src, id), RDMA_SSI_I_P(ssi, id) },
|
||||||
|
{ RDMA_CMD_O_P(src, id), RDMA_SSI_I_P(ssi, id) }}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
cfg->slave_id = slave_id;
|
||||||
|
cfg->src_addr = 0;
|
||||||
|
cfg->dst_addr = 0;
|
||||||
|
cfg->direction = is_play ? DMA_MEM_TO_DEV : DMA_DEV_TO_MEM;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* gen1 uses default DMA addr
|
||||||
|
*/
|
||||||
|
if (rsnd_is_gen1(priv))
|
||||||
|
return;
|
||||||
|
|
||||||
|
/* it shouldn't happen */
|
||||||
|
if (use_dvc & !use_src) {
|
||||||
|
dev_err(dev, "DVC is selected without SRC\n");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
cfg->src_addr = dma_addrs[is_ssi][is_play][use_src + use_dvc].src_addr;
|
||||||
|
cfg->dst_addr = dma_addrs[is_ssi][is_play][use_src + use_dvc].dst_addr;
|
||||||
|
|
||||||
|
dev_dbg(dev, "dma%d addr - src : %x / dst : %x\n",
|
||||||
|
id, cfg->src_addr, cfg->dst_addr);
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Gen2
|
* Gen2
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -281,6 +281,11 @@ int rsnd_gen_probe(struct platform_device *pdev,
|
||||||
void __iomem *rsnd_gen_reg_get(struct rsnd_priv *priv,
|
void __iomem *rsnd_gen_reg_get(struct rsnd_priv *priv,
|
||||||
struct rsnd_mod *mod,
|
struct rsnd_mod *mod,
|
||||||
enum rsnd_reg reg);
|
enum rsnd_reg reg);
|
||||||
|
void rsnd_gen_dma_addr(struct rsnd_priv *priv,
|
||||||
|
struct rsnd_dma *dma,
|
||||||
|
struct dma_slave_config *cfg,
|
||||||
|
int is_play, int slave_id);
|
||||||
|
|
||||||
#define rsnd_is_gen1(s) (((s)->info->flags & RSND_GEN_MASK) == RSND_GEN1)
|
#define rsnd_is_gen1(s) (((s)->info->flags & RSND_GEN_MASK) == RSND_GEN1)
|
||||||
#define rsnd_is_gen2(s) (((s)->info->flags & RSND_GEN_MASK) == RSND_GEN2)
|
#define rsnd_is_gen2(s) (((s)->info->flags & RSND_GEN_MASK) == RSND_GEN2)
|
||||||
|
|
||||||
|
@ -317,7 +322,7 @@ struct rsnd_of_data {
|
||||||
|
|
||||||
struct rsnd_priv {
|
struct rsnd_priv {
|
||||||
|
|
||||||
struct device *dev;
|
struct platform_device *pdev;
|
||||||
struct rcar_snd_info *info;
|
struct rcar_snd_info *info;
|
||||||
spinlock_t lock;
|
spinlock_t lock;
|
||||||
|
|
||||||
|
@ -357,7 +362,8 @@ struct rsnd_priv {
|
||||||
int rdai_nr;
|
int rdai_nr;
|
||||||
};
|
};
|
||||||
|
|
||||||
#define rsnd_priv_to_dev(priv) ((priv)->dev)
|
#define rsnd_priv_to_pdev(priv) ((priv)->pdev)
|
||||||
|
#define rsnd_priv_to_dev(priv) (&(rsnd_priv_to_pdev(priv)->dev))
|
||||||
#define rsnd_priv_to_info(priv) ((priv)->info)
|
#define rsnd_priv_to_info(priv) ((priv)->info)
|
||||||
#define rsnd_lock(priv, flags) spin_lock_irqsave(&priv->lock, flags)
|
#define rsnd_lock(priv, flags) spin_lock_irqsave(&priv->lock, flags)
|
||||||
#define rsnd_unlock(priv, flags) spin_unlock_irqrestore(&priv->lock, flags)
|
#define rsnd_unlock(priv, flags) spin_unlock_irqrestore(&priv->lock, flags)
|
||||||
|
|
|
@ -10,6 +10,8 @@
|
||||||
*/
|
*/
|
||||||
#include "rsnd.h"
|
#include "rsnd.h"
|
||||||
|
|
||||||
|
#define SRC_NAME "src"
|
||||||
|
|
||||||
struct rsnd_src {
|
struct rsnd_src {
|
||||||
struct rsnd_src_platform_info *info; /* rcar_snd.h */
|
struct rsnd_src_platform_info *info; /* rcar_snd.h */
|
||||||
struct rsnd_mod mod;
|
struct rsnd_mod mod;
|
||||||
|
@ -268,10 +270,6 @@ static int rsnd_src_stop(struct rsnd_mod *mod,
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct rsnd_mod_ops rsnd_src_non_ops = {
|
|
||||||
.name = "src (non)",
|
|
||||||
};
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Gen1 functions
|
* Gen1 functions
|
||||||
*/
|
*/
|
||||||
|
@ -393,6 +391,17 @@ static int rsnd_src_set_convert_rate_gen1(struct rsnd_mod *mod,
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int rsnd_src_probe_gen1(struct rsnd_mod *mod,
|
||||||
|
struct rsnd_dai *rdai)
|
||||||
|
{
|
||||||
|
struct rsnd_priv *priv = rsnd_mod_to_priv(mod);
|
||||||
|
struct device *dev = rsnd_priv_to_dev(priv);
|
||||||
|
|
||||||
|
dev_dbg(dev, "%s (Gen1) is probed\n", rsnd_mod_name(mod));
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
static int rsnd_src_init_gen1(struct rsnd_mod *mod,
|
static int rsnd_src_init_gen1(struct rsnd_mod *mod,
|
||||||
struct rsnd_dai *rdai)
|
struct rsnd_dai *rdai)
|
||||||
{
|
{
|
||||||
|
@ -438,7 +447,8 @@ static int rsnd_src_stop_gen1(struct rsnd_mod *mod,
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct rsnd_mod_ops rsnd_src_gen1_ops = {
|
static struct rsnd_mod_ops rsnd_src_gen1_ops = {
|
||||||
.name = "sru (gen1)",
|
.name = SRC_NAME,
|
||||||
|
.probe = rsnd_src_probe_gen1,
|
||||||
.init = rsnd_src_init_gen1,
|
.init = rsnd_src_init_gen1,
|
||||||
.quit = rsnd_src_quit,
|
.quit = rsnd_src_quit,
|
||||||
.start = rsnd_src_start_gen1,
|
.start = rsnd_src_start_gen1,
|
||||||
|
@ -502,6 +512,8 @@ static int rsnd_src_probe_gen2(struct rsnd_mod *mod,
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
dev_err(dev, "SRC DMA failed\n");
|
dev_err(dev, "SRC DMA failed\n");
|
||||||
|
|
||||||
|
dev_dbg(dev, "%s (Gen2) is probed\n", rsnd_mod_name(mod));
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -562,7 +574,7 @@ static int rsnd_src_stop_gen2(struct rsnd_mod *mod,
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct rsnd_mod_ops rsnd_src_gen2_ops = {
|
static struct rsnd_mod_ops rsnd_src_gen2_ops = {
|
||||||
.name = "src (gen2)",
|
.name = SRC_NAME,
|
||||||
.probe = rsnd_src_probe_gen2,
|
.probe = rsnd_src_probe_gen2,
|
||||||
.remove = rsnd_src_remove_gen2,
|
.remove = rsnd_src_remove_gen2,
|
||||||
.init = rsnd_src_init_gen2,
|
.init = rsnd_src_init_gen2,
|
||||||
|
@ -598,18 +610,21 @@ static void rsnd_of_parse_src(struct platform_device *pdev,
|
||||||
|
|
||||||
nr = of_get_child_count(src_node);
|
nr = of_get_child_count(src_node);
|
||||||
if (!nr)
|
if (!nr)
|
||||||
return;
|
goto rsnd_of_parse_src_end;
|
||||||
|
|
||||||
src_info = devm_kzalloc(dev,
|
src_info = devm_kzalloc(dev,
|
||||||
sizeof(struct rsnd_src_platform_info) * nr,
|
sizeof(struct rsnd_src_platform_info) * nr,
|
||||||
GFP_KERNEL);
|
GFP_KERNEL);
|
||||||
if (!src_info) {
|
if (!src_info) {
|
||||||
dev_err(dev, "src info allocation error\n");
|
dev_err(dev, "src info allocation error\n");
|
||||||
return;
|
goto rsnd_of_parse_src_end;
|
||||||
}
|
}
|
||||||
|
|
||||||
info->src_info = src_info;
|
info->src_info = src_info;
|
||||||
info->src_info_nr = nr;
|
info->src_info_nr = nr;
|
||||||
|
|
||||||
|
rsnd_of_parse_src_end:
|
||||||
|
of_node_put(src_node);
|
||||||
}
|
}
|
||||||
|
|
||||||
int rsnd_src_probe(struct platform_device *pdev,
|
int rsnd_src_probe(struct platform_device *pdev,
|
||||||
|
@ -624,6 +639,16 @@ int rsnd_src_probe(struct platform_device *pdev,
|
||||||
char name[RSND_SRC_NAME_SIZE];
|
char name[RSND_SRC_NAME_SIZE];
|
||||||
int i, nr;
|
int i, nr;
|
||||||
|
|
||||||
|
ops = NULL;
|
||||||
|
if (rsnd_is_gen1(priv))
|
||||||
|
ops = &rsnd_src_gen1_ops;
|
||||||
|
if (rsnd_is_gen2(priv))
|
||||||
|
ops = &rsnd_src_gen2_ops;
|
||||||
|
if (!ops) {
|
||||||
|
dev_err(dev, "unknown Generation\n");
|
||||||
|
return -EIO;
|
||||||
|
}
|
||||||
|
|
||||||
rsnd_of_parse_src(pdev, of_data, priv);
|
rsnd_of_parse_src(pdev, of_data, priv);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -643,7 +668,8 @@ int rsnd_src_probe(struct platform_device *pdev,
|
||||||
priv->src = src;
|
priv->src = src;
|
||||||
|
|
||||||
for_each_rsnd_src(src, priv, i) {
|
for_each_rsnd_src(src, priv, i) {
|
||||||
snprintf(name, RSND_SRC_NAME_SIZE, "src.%d", i);
|
snprintf(name, RSND_SRC_NAME_SIZE, "%s.%d",
|
||||||
|
SRC_NAME, i);
|
||||||
|
|
||||||
clk = devm_clk_get(dev, name);
|
clk = devm_clk_get(dev, name);
|
||||||
if (IS_ERR(clk))
|
if (IS_ERR(clk))
|
||||||
|
@ -652,12 +678,6 @@ int rsnd_src_probe(struct platform_device *pdev,
|
||||||
src->info = &info->src_info[i];
|
src->info = &info->src_info[i];
|
||||||
src->clk = clk;
|
src->clk = clk;
|
||||||
|
|
||||||
ops = &rsnd_src_non_ops;
|
|
||||||
if (rsnd_is_gen1(priv))
|
|
||||||
ops = &rsnd_src_gen1_ops;
|
|
||||||
if (rsnd_is_gen2(priv))
|
|
||||||
ops = &rsnd_src_gen2_ops;
|
|
||||||
|
|
||||||
rsnd_mod_init(priv, &src->mod, ops, RSND_MOD_SRC, i);
|
rsnd_mod_init(priv, &src->mod, ops, RSND_MOD_SRC, i);
|
||||||
|
|
||||||
dev_dbg(dev, "SRC%d probed\n", i);
|
dev_dbg(dev, "SRC%d probed\n", i);
|
||||||
|
|
|
@ -57,6 +57,8 @@
|
||||||
*/
|
*/
|
||||||
#define CONT (1 << 8) /* WS Continue Function */
|
#define CONT (1 << 8) /* WS Continue Function */
|
||||||
|
|
||||||
|
#define SSI_NAME "ssi"
|
||||||
|
|
||||||
struct rsnd_ssi {
|
struct rsnd_ssi {
|
||||||
struct clk *clk;
|
struct clk *clk;
|
||||||
struct rsnd_ssi_platform_info *info; /* rcar_snd.h */
|
struct rsnd_ssi_platform_info *info; /* rcar_snd.h */
|
||||||
|
@ -373,6 +375,8 @@ static int rsnd_ssi_pio_probe(struct rsnd_mod *mod,
|
||||||
if (ret)
|
if (ret)
|
||||||
dev_err(dev, "SSI request interrupt failed\n");
|
dev_err(dev, "SSI request interrupt failed\n");
|
||||||
|
|
||||||
|
dev_dbg(dev, "%s (PIO) is probed\n", rsnd_mod_name(mod));
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -405,7 +409,7 @@ static int rsnd_ssi_pio_stop(struct rsnd_mod *mod,
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct rsnd_mod_ops rsnd_ssi_pio_ops = {
|
static struct rsnd_mod_ops rsnd_ssi_pio_ops = {
|
||||||
.name = "ssi (pio)",
|
.name = SSI_NAME,
|
||||||
.probe = rsnd_ssi_pio_probe,
|
.probe = rsnd_ssi_pio_probe,
|
||||||
.init = rsnd_ssi_init,
|
.init = rsnd_ssi_init,
|
||||||
.quit = rsnd_ssi_quit,
|
.quit = rsnd_ssi_quit,
|
||||||
|
@ -430,6 +434,8 @@ static int rsnd_ssi_dma_probe(struct rsnd_mod *mod,
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
dev_err(dev, "SSI DMA failed\n");
|
dev_err(dev, "SSI DMA failed\n");
|
||||||
|
|
||||||
|
dev_dbg(dev, "%s (DMA) is probed\n", rsnd_mod_name(mod));
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -480,7 +486,7 @@ static int rsnd_ssi_dma_stop(struct rsnd_mod *mod,
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct rsnd_mod_ops rsnd_ssi_dma_ops = {
|
static struct rsnd_mod_ops rsnd_ssi_dma_ops = {
|
||||||
.name = "ssi (dma)",
|
.name = SSI_NAME,
|
||||||
.probe = rsnd_ssi_dma_probe,
|
.probe = rsnd_ssi_dma_probe,
|
||||||
.remove = rsnd_ssi_dma_remove,
|
.remove = rsnd_ssi_dma_remove,
|
||||||
.init = rsnd_ssi_init,
|
.init = rsnd_ssi_init,
|
||||||
|
@ -493,7 +499,7 @@ static struct rsnd_mod_ops rsnd_ssi_dma_ops = {
|
||||||
* Non SSI
|
* Non SSI
|
||||||
*/
|
*/
|
||||||
static struct rsnd_mod_ops rsnd_ssi_non_ops = {
|
static struct rsnd_mod_ops rsnd_ssi_non_ops = {
|
||||||
.name = "ssi (non)",
|
.name = SSI_NAME,
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -554,14 +560,14 @@ static void rsnd_of_parse_ssi(struct platform_device *pdev,
|
||||||
|
|
||||||
nr = of_get_child_count(node);
|
nr = of_get_child_count(node);
|
||||||
if (!nr)
|
if (!nr)
|
||||||
return;
|
goto rsnd_of_parse_ssi_end;
|
||||||
|
|
||||||
ssi_info = devm_kzalloc(dev,
|
ssi_info = devm_kzalloc(dev,
|
||||||
sizeof(struct rsnd_ssi_platform_info) * nr,
|
sizeof(struct rsnd_ssi_platform_info) * nr,
|
||||||
GFP_KERNEL);
|
GFP_KERNEL);
|
||||||
if (!ssi_info) {
|
if (!ssi_info) {
|
||||||
dev_err(dev, "ssi info allocation error\n");
|
dev_err(dev, "ssi info allocation error\n");
|
||||||
return;
|
goto rsnd_of_parse_ssi_end;
|
||||||
}
|
}
|
||||||
|
|
||||||
info->ssi_info = ssi_info;
|
info->ssi_info = ssi_info;
|
||||||
|
@ -583,7 +589,16 @@ static void rsnd_of_parse_ssi(struct platform_device *pdev,
|
||||||
* irq
|
* irq
|
||||||
*/
|
*/
|
||||||
ssi_info->pio_irq = irq_of_parse_and_map(np, 0);
|
ssi_info->pio_irq = irq_of_parse_and_map(np, 0);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* DMA
|
||||||
|
*/
|
||||||
|
ssi_info->dma_id = of_get_property(np, "pio-transfer", NULL) ?
|
||||||
|
0 : 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
rsnd_of_parse_ssi_end:
|
||||||
|
of_node_put(node);
|
||||||
}
|
}
|
||||||
|
|
||||||
int rsnd_ssi_probe(struct platform_device *pdev,
|
int rsnd_ssi_probe(struct platform_device *pdev,
|
||||||
|
@ -617,7 +632,8 @@ int rsnd_ssi_probe(struct platform_device *pdev,
|
||||||
for_each_rsnd_ssi(ssi, priv, i) {
|
for_each_rsnd_ssi(ssi, priv, i) {
|
||||||
pinfo = &info->ssi_info[i];
|
pinfo = &info->ssi_info[i];
|
||||||
|
|
||||||
snprintf(name, RSND_SSI_NAME_SIZE, "ssi.%d", i);
|
snprintf(name, RSND_SSI_NAME_SIZE, "%s.%d",
|
||||||
|
SSI_NAME, i);
|
||||||
|
|
||||||
clk = devm_clk_get(dev, name);
|
clk = devm_clk_get(dev, name);
|
||||||
if (IS_ERR(clk))
|
if (IS_ERR(clk))
|
||||||
|
|
Loading…
Add table
Reference in a new issue