当前位置: 首页>>代码示例>>C++>>正文


C++ snd_soc_dai_set_dma_data函数代码示例

本文整理汇总了C++中snd_soc_dai_set_dma_data函数的典型用法代码示例。如果您正苦于以下问题:C++ snd_soc_dai_set_dma_data函数的具体用法?C++ snd_soc_dai_set_dma_data怎么用?C++ snd_soc_dai_set_dma_data使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了snd_soc_dai_set_dma_data函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: s3c2412_i2s_hw_params

static int s3c2412_i2s_hw_params(struct snd_pcm_substream *substream,
                                 struct snd_pcm_hw_params *params,
                                 struct snd_soc_dai *cpu_dai)
{
    struct s3c_i2sv2_info *i2s = snd_soc_dai_get_drvdata(cpu_dai);
    struct s3c_dma_params *dma_data;
    u32 iismod;

    pr_debug("Entered %s\n", __func__);

    if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
        dma_data = i2s->dma_playback;
    else
        dma_data = i2s->dma_capture;

    snd_soc_dai_set_dma_data(cpu_dai, substream, dma_data);

    iismod = readl(i2s->regs + S3C2412_IISMOD);
    pr_debug("%s: r: IISMOD: %x\n", __func__, iismod);

    switch (params_format(params)) {
    case SNDRV_PCM_FORMAT_S8:
        iismod |= S3C2412_IISMOD_8BIT;
        break;
    case SNDRV_PCM_FORMAT_S16_LE:
        iismod &= ~S3C2412_IISMOD_8BIT;
        break;
    }

    writel(iismod, i2s->regs + S3C2412_IISMOD);
    pr_debug("%s: w: IISMOD: %x\n", __func__, iismod);

    return 0;
}
开发者ID:CSCLOG,项目名称:beaglebone,代码行数:34,代码来源:s3c2412-i2s.c

示例2: au1xpsc_i2s_startup

static int au1xpsc_i2s_startup(struct snd_pcm_substream *substream,
			       struct snd_soc_dai *dai)
{
	struct au1xpsc_audio_data *pscdata = snd_soc_dai_get_drvdata(dai);
	snd_soc_dai_set_dma_data(dai, substream, &pscdata->dmaids[0]);
	return 0;
}
开发者ID:AdrianHuang,项目名称:linux-3.8.13,代码行数:7,代码来源:psc-i2s.c

示例3: omap_hdmi_dai_hw_params

static int omap_hdmi_dai_hw_params(struct snd_pcm_substream *substream,
				    struct snd_pcm_hw_params *params,
				    struct snd_soc_dai *dai)
{
	int err = 0;

	switch (params_format(params)) {
	case SNDRV_PCM_FORMAT_S16_LE:
		omap_hdmi_dai_dma_params.packet_size = 16;
		break;
	case SNDRV_PCM_FORMAT_S24_LE:
		omap_hdmi_dai_dma_params.packet_size = 32;
		break;
	default:
		err = -EINVAL;
	}

	omap_hdmi_dai_dma_params.data_type = OMAP_DMA_DATA_TYPE_S32;

	snd_soc_dai_set_dma_data(dai, substream,
				 &omap_hdmi_dai_dma_params);

	err = hdmi_lib_start_acr_wa();
	if (err)
		pr_warning("Failed to start ACR workaround[%d]]\n", err);

	return err;
}
开发者ID:LeaderRider,项目名称:kernel3NookTablet,代码行数:28,代码来源:omap-hdmi.c

示例4: hdmi_dai_startup

static int hdmi_dai_startup(struct snd_pcm_substream *substream,
			    struct snd_soc_dai *dai)
{
	struct hdmi_audio_data *ad = card_drvdata_substream(substream);
	int ret;
	/*
	 * Make sure that the period bytes are multiple of the DMA packet size.
	 * Largest packet size we use is 32 32-bit words = 128 bytes
	 */
	ret = snd_pcm_hw_constraint_step(substream->runtime, 0,
					 SNDRV_PCM_HW_PARAM_PERIOD_BYTES, 128);
	if (ret < 0) {
		dev_err(dai->dev, "could not apply constraint\n");
		return ret;
	}

	snd_soc_dai_set_dma_data(dai, substream, &ad->dma_data);

	mutex_lock(&ad->current_stream_lock);
	ad->current_stream = substream;
	mutex_unlock(&ad->current_stream_lock);

	ret = ad->ops->audio_startup(ad->dssdev, hdmi_dai_abort);

	if (ret) {
		mutex_lock(&ad->current_stream_lock);
		ad->current_stream = NULL;
		mutex_unlock(&ad->current_stream_lock);
	}

	return ret;
}
开发者ID:Abioy,项目名称:kasan,代码行数:32,代码来源:omap-hdmi-audio.c

示例5: mxs_spdif_startup

static int mxs_spdif_startup(struct snd_pcm_substream *substream,
				  struct snd_soc_dai *dai)
{
	struct snd_soc_pcm_runtime *rtd = substream->private_data;
	struct snd_soc_dai *cpu_dai = rtd->dai->cpu_dai;
	int playback = substream->stream == SNDRV_PCM_STREAM_PLAYBACK ? 1 : 0;
	int irq;
	int ret;

	if (playback) {
		irq = IRQ_SPDIF_ERROR;
		snd_soc_dai_set_dma_data(cpu_dai, substream, &mxs_spdif);
	}

	ret = request_irq(irq, mxs_err_irq, 0, "Mxs SPDIF Error",
			  substream);
	if (ret) {
		printk(KERN_ERR "%s: Unable to request SPDIF error irq %d\n",
		       __func__, IRQ_SPDIF_ERROR);
		return ret;
	}

	/* Enable error interrupt */
	if (playback) {
		__raw_writel(BM_SPDIF_CTRL_FIFO_OVERFLOW_IRQ,
				REGS_SPDIF_BASE + HW_SPDIF_CTRL_CLR);
		__raw_writel(BM_SPDIF_CTRL_FIFO_UNDERFLOW_IRQ,
				REGS_SPDIF_BASE + HW_SPDIF_CTRL_CLR);
		__raw_writel(BM_SPDIF_CTRL_FIFO_ERROR_IRQ_EN,
				REGS_SPDIF_BASE + HW_SPDIF_CTRL_SET);
	}

	return 0;
}
开发者ID:YCsuperlife,项目名称:imx53_kernel,代码行数:34,代码来源:mxs-spdif-dai.c

示例6: skl_link_hw_params

static int skl_link_hw_params(struct snd_pcm_substream *substream,
				struct snd_pcm_hw_params *params,
				struct snd_soc_dai *dai)
{
	struct hdac_ext_bus *ebus = dev_get_drvdata(dai->dev);
	struct hdac_ext_stream *link_dev;
	struct snd_soc_pcm_runtime *rtd = snd_pcm_substream_chip(substream);
	struct hdac_ext_dma_params *dma_params;
	struct snd_soc_dai *codec_dai = rtd->codec_dai;
	struct skl_pipe_params p_params = {0};

	link_dev = snd_hdac_ext_stream_assign(ebus, substream,
					HDAC_EXT_STREAM_TYPE_LINK);
	if (!link_dev)
		return -EBUSY;

	snd_soc_dai_set_dma_data(dai, substream, (void *)link_dev);

	/* set the stream tag in the codec dai dma params  */
	dma_params = snd_soc_dai_get_dma_data(codec_dai, substream);
	if (dma_params)
		dma_params->stream_tag =  hdac_stream(link_dev)->stream_tag;

	p_params.s_fmt = snd_pcm_format_width(params_format(params));
	p_params.ch = params_channels(params);
	p_params.s_freq = params_rate(params);
	p_params.stream = substream->stream;
	p_params.link_dma_id = hdac_stream(link_dev)->stream_tag - 1;

	return skl_tplg_be_update_params(dai, &p_params);
}
开发者ID:AK101111,项目名称:linux,代码行数:31,代码来源:skl-pcm.c

示例7: skl_pcm_close

static void skl_pcm_close(struct snd_pcm_substream *substream,
		struct snd_soc_dai *dai)
{
	struct hdac_ext_stream *stream = get_hdac_ext_stream(substream);
	struct hdac_ext_bus *ebus = dev_get_drvdata(dai->dev);
	struct skl_dma_params *dma_params = NULL;
	struct skl *skl = ebus_to_skl(ebus);

	dev_dbg(dai->dev, "%s: %s\n", __func__, dai->name);

	snd_hdac_ext_stream_release(stream, skl_get_host_stream_type(ebus));

	dma_params = snd_soc_dai_get_dma_data(dai, substream);
	/*
	 * now we should set this to NULL as we are freeing by the
	 * dma_params
	 */
	snd_soc_dai_set_dma_data(dai, substream, NULL);
	skl_set_suspend_active(substream, dai, false);

	/*
	 * check if close is for "Reference Pin" and set back the
	 * CGCTL.MISCBDCGE if disabled by driver
	 */
	if (!strncmp(dai->name, "Reference Pin", 13) &&
			skl->skl_sst->miscbdcg_disabled) {
		skl->skl_sst->enable_miscbdcge(dai->dev, true);
		skl->skl_sst->miscbdcg_disabled = false;
	}

	kfree(dma_params);
}
开发者ID:AK101111,项目名称:linux,代码行数:32,代码来源:skl-pcm.c

示例8: tcc_i2s_hw_params

static int tcc_i2s_hw_params(struct snd_pcm_substream *substream,
                                 struct snd_pcm_hw_params *params, struct snd_soc_dai *dai)
{
    struct snd_soc_pcm_runtime *rtd = substream->private_data;
    struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
    struct tcc_pcm_dma_params *dma_data;

    if (substream->pcm->device == __I2S_DEV_NUM__) {
        if(substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
            dma_data = &tcc_i2s_pcm_stereo_out;
        }
        else if(substream->stream == SNDRV_PCM_STREAM_CAPTURE) {
            dma_data = &tcc_i2s_pcm_stereo_in;
        }
        snd_soc_dai_set_dma_data(cpu_dai, substream, dma_data);

        // Set DAI clock
        tcc_i2s_set_clock(params_rate(params));
    }

alsa_dbg("=====================\n");
alsa_dbg("= rate        : %d\n", params_rate(params));
alsa_dbg("= channels    : %d\n", params_channels(params));
alsa_dbg("= period_size : %d\n", params_period_size(params));

    return 0;
}
开发者ID:AmesianX,项目名称:telechips-linux,代码行数:27,代码来源:tcc-i2s.c

示例9: alchemy_ac97c_startup

static int alchemy_ac97c_startup(struct snd_pcm_substream *substream,
				 struct snd_soc_dai *dai)
{
	struct au1xpsc_audio_data *ctx = snd_soc_dai_get_drvdata(dai);
	snd_soc_dai_set_dma_data(dai, substream, &ctx->dmaids[0]);
	return 0;
}
开发者ID:MiniBlu,项目名称:cm11_kernel_htc_msm8974a3ul,代码行数:7,代码来源:ac97c.c

示例10: sunxi_hdmiaudio_hw_params

static int sunxi_hdmiaudio_hw_params(struct snd_pcm_substream *substream,
                                     struct snd_pcm_hw_params *params,
                                     struct snd_soc_dai *dai)
{
    struct snd_soc_pcm_runtime *rtd 	= NULL;
    struct sunxi_dma_params *dma_data 	= NULL;
    u32 reg_val = 0;

    switch (params_format(params))
    {
    case SNDRV_PCM_FORMAT_S16_LE:
        sample_resolution = 16;
        break;
    case SNDRV_PCM_FORMAT_S20_3LE:
        sample_resolution = 24;
        break;
    case SNDRV_PCM_FORMAT_S24_LE:
        sample_resolution = 24;
        break;
    case SNDRV_PCM_FORMAT_S32_LE:
        sample_resolution = 24;
        break;
    default:
        return -EINVAL;
    }

    if (!substream) {
        printk("error:%s,line:%d\n", __func__, __LINE__);
        return -EAGAIN;
    }

    reg_val = readl(sunxi_i2s1.regs + SUNXI_I2S1FAT0);
    sunxi_i2s1.samp_res = sample_resolution;
    reg_val &= ~SUNXI_I2S1FAT0_SR_RVD;
    if(sunxi_i2s1.samp_res == 16)
        reg_val |= SUNXI_I2S1FAT0_SR_16BIT;
    else if(sunxi_i2s1.samp_res == 20)
        reg_val |= SUNXI_I2S1FAT0_SR_20BIT;
    else
        reg_val |= SUNXI_I2S1FAT0_SR_24BIT;
    writel(reg_val, sunxi_i2s1.regs + SUNXI_I2S1FAT0);

    rtd = substream->private_data;
    if (sample_resolution == 24) {
        reg_val = readl(sunxi_i2s1.regs + SUNXI_I2S1FCTL);
        reg_val &= ~(0x1<<2);
        writel(reg_val, sunxi_i2s1.regs + SUNXI_I2S1FCTL);
    }

    if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
        dma_data = &sunxi_hdmiaudio_pcm_stereo_out;
    } else {
        printk("error:hdmiaudio can't support capture:%s,line:%d\n", __func__, __LINE__);
    }

    snd_soc_dai_set_dma_data(rtd->cpu_dai, substream, dma_data);

    return 0;
}
开发者ID:alex-deng,项目名称:a33_linux,代码行数:59,代码来源:sunxi-hdmiaudio.c

示例11: davinci_i2s_startup

static int davinci_i2s_startup(struct snd_pcm_substream *substream,
			       struct snd_soc_dai *dai)
{
	struct davinci_mcbsp_dev *dev = snd_soc_dai_get_drvdata(dai);

	snd_soc_dai_set_dma_data(dai, substream, dev->dma_params);
	return 0;
}
开发者ID:MiniBlu,项目名称:cm11_kernel_htc_msm8974a3ul,代码行数:8,代码来源:davinci-i2s.c

示例12: kirkwood_i2s_startup

static int kirkwood_i2s_startup(struct snd_pcm_substream *substream,
                                struct snd_soc_dai *dai)
{
    struct kirkwood_dma_data *priv = snd_soc_dai_get_drvdata(dai);

    snd_soc_dai_set_dma_data(dai, substream, priv);
    return 0;
}
开发者ID:Scorpio92,项目名称:mstar6a918,代码行数:8,代码来源:kirkwood-i2s.c

示例13: mmp_sspa_hw_params

/*
 * Set the SSPA audio DMA parameters and sample size.
 * Can be called multiple times by oss emulation.
 */
static int mmp_sspa_hw_params(struct snd_pcm_substream *substream,
			       struct snd_pcm_hw_params *params,
			       struct snd_soc_dai *dai)
{
	struct snd_soc_pcm_runtime *rtd = substream->private_data;
	struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
	struct sspa_priv *sspa_priv = snd_soc_dai_get_drvdata(dai);
	struct ssp_device *sspa = sspa_priv->sspa;
	struct snd_dmaengine_dai_dma_data *dma_params;
	u32 sspa_ctrl;

	if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
		sspa_ctrl = mmp_sspa_read_reg(sspa, SSPA_TXCTL);
	else
		sspa_ctrl = mmp_sspa_read_reg(sspa, SSPA_RXCTL);

	sspa_ctrl &= ~SSPA_CTL_XFRLEN1_MASK;
	sspa_ctrl |= SSPA_CTL_XFRLEN1(params_channels(params) - 1);
	sspa_ctrl &= ~SSPA_CTL_XWDLEN1_MASK;
	sspa_ctrl |= SSPA_CTL_XWDLEN1(SSPA_CTL_32_BITS);
	sspa_ctrl &= ~SSPA_CTL_XSSZ1_MASK;

	switch (params_format(params)) {
	case SNDRV_PCM_FORMAT_S8:
		sspa_ctrl |= SSPA_CTL_XSSZ1(SSPA_CTL_8_BITS);
		break;
	case SNDRV_PCM_FORMAT_S16_LE:
		sspa_ctrl |= SSPA_CTL_XSSZ1(SSPA_CTL_16_BITS);
		break;
	case SNDRV_PCM_FORMAT_S20_3LE:
		sspa_ctrl |= SSPA_CTL_XSSZ1(SSPA_CTL_20_BITS);
		break;
	case SNDRV_PCM_FORMAT_S24_3LE:
		sspa_ctrl |= SSPA_CTL_XSSZ1(SSPA_CTL_24_BITS);
		break;
	case SNDRV_PCM_FORMAT_S32_LE:
		sspa_ctrl |= SSPA_CTL_XSSZ1(SSPA_CTL_32_BITS);
		break;
	default:
		return -EINVAL;
	}

	if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
		mmp_sspa_write_reg(sspa, SSPA_TXCTL, sspa_ctrl);
		mmp_sspa_write_reg(sspa, SSPA_TXFIFO_LL, 0x1);
	} else {
		mmp_sspa_write_reg(sspa, SSPA_RXCTL, sspa_ctrl);
		mmp_sspa_write_reg(sspa, SSPA_RXFIFO_UL, 0x0);
	}

	dma_params = &sspa_priv->dma_params[substream->stream];
	dma_params->addr = substream->stream == SNDRV_PCM_STREAM_PLAYBACK ?
				(sspa->phys_base + SSPA_TXD) :
				(sspa->phys_base + SSPA_RXD);
	snd_soc_dai_set_dma_data(cpu_dai, substream, dma_params);
	return 0;
}
开发者ID:3null,项目名称:linux,代码行数:61,代码来源:mmp-sspa.c

示例14: nxp_spdif_startup

/*
 * snd_soc_dai_ops
 */
static int  nxp_spdif_startup(struct snd_pcm_substream *substream,
				struct snd_soc_dai *dai)
{
	struct nxp_spdif_snd_param *par = snd_soc_dai_get_drvdata(dai);
	struct nxp_pcm_dma_param *dmap = &par->dma;

	snd_soc_dai_set_dma_data(dai, substream, dmap);
	return 0;
}
开发者ID:advx9600,项目名称:kernel-4.4-RuiEr,代码行数:12,代码来源:nxp-spdifrx.c

示例15: s3c_i2sv4_hw_params

static int s3c_i2sv4_hw_params(struct snd_pcm_substream *substream,
				 struct snd_pcm_hw_params *params,
				 struct snd_soc_dai *cpu_dai)
{
	struct s3c_i2sv2_info *i2s = to_info(cpu_dai);
	struct s3c_dma_params *dma_data;
	u32 iismod;
	u32 dma_tsfr_size = 0;

	dev_dbg(cpu_dai->dev, "Entered %s\n", __func__);

	/* TODO */
	switch (params_channels(params)) {
		case 1:
			dma_tsfr_size = 2;
			break;
		case 2:
			dma_tsfr_size = 4;
			break;
		case 4:
			break;
		case 6:
			break;
		default:
			break;
	}

	if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
		dma_data = i2s->dma_playback;
		i2s->dma_playback->dma_size = dma_tsfr_size;
	} else {
		dma_data = i2s->dma_capture;
		i2s->dma_capture->dma_size = dma_tsfr_size;
	}

	snd_soc_dai_set_dma_data(cpu_dai, substream, dma_data);

	iismod = readl(i2s->regs + S3C2412_IISMOD);
	dev_dbg(cpu_dai->dev, "%s: r: IISMOD: %x\n", __func__, iismod);

	iismod &= ~S3C64XX_IISMOD_BLC_MASK;
	switch (params_format(params)) {
	case SNDRV_PCM_FORMAT_S8:
		iismod |= S3C64XX_IISMOD_BLC_8BIT;
		break;
	case SNDRV_PCM_FORMAT_S16_LE:
		break;
	case SNDRV_PCM_FORMAT_S24_LE:
		iismod |= S3C64XX_IISMOD_BLC_24BIT;
		break;
	}

	writel(iismod, i2s->regs + S3C2412_IISMOD);
	dev_dbg(cpu_dai->dev, "%s: w: IISMOD: %x\n", __func__, iismod);

	return 0;
}
开发者ID:mogchen,项目名称:Homura-Note,代码行数:57,代码来源:s3c64xx-i2s-v4.c


注:本文中的snd_soc_dai_set_dma_data函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。