• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ snd_pcm_hw_constraint_integer函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: omap_pcm_open

static int omap_pcm_open(struct snd_pcm_substream *substream)
{
	struct snd_pcm_runtime *runtime = substream->runtime;
	struct omap_runtime_data *prtd;
	int ret;

	snd_soc_set_runtime_hwparams(substream, &omap_pcm_hardware);

	/* Ensure that buffer size is a multiple of period size */
	ret = snd_pcm_hw_constraint_integer(runtime,
					    SNDRV_PCM_HW_PARAM_PERIODS);
	if (ret < 0)
		goto out;

	prtd = kzalloc(sizeof(*prtd), GFP_KERNEL);
	if (prtd == NULL) {
		ret = -ENOMEM;
		goto out;
	}
	spin_lock_init(&prtd->lock);
	runtime->private_data = prtd;

out:
	return ret;
}
开发者ID:Kra1o5,项目名称:android_kernel_huawei_u8815-gb,代码行数:25,代码来源:omap-pcm.c


示例2: snd_ca0106_pcm_open_playback_channel

/* open_playback callback */
static int snd_ca0106_pcm_open_playback_channel(snd_pcm_substream_t *substream, int channel_id)
{
	ca0106_t *chip = snd_pcm_substream_chip(substream);
        ca0106_channel_t *channel = &(chip->playback_channels[channel_id]);
	ca0106_pcm_t *epcm;
	snd_pcm_runtime_t *runtime = substream->runtime;
	int err;

	epcm = kzalloc(sizeof(*epcm), GFP_KERNEL);

	if (epcm == NULL)
		return -ENOMEM;
	epcm->emu = chip;
	epcm->substream = substream;
        epcm->channel_id=channel_id;
  
	runtime->private_data = epcm;
	runtime->private_free = snd_ca0106_pcm_free_substream;
  
	runtime->hw = snd_ca0106_playback_hw;

        channel->emu = chip;
        channel->number = channel_id;

        channel->use=1;
        //printk("open:channel_id=%d, chip=%p, channel=%p\n",channel_id, chip, channel);
        //channel->interrupt = snd_ca0106_pcm_channel_interrupt;
        channel->epcm=epcm;
	if ((err = snd_pcm_hw_constraint_integer(runtime, SNDRV_PCM_HW_PARAM_PERIODS)) < 0)
                return err;
	if ((err = snd_pcm_hw_constraint_step(runtime, 0, SNDRV_PCM_HW_PARAM_PERIOD_BYTES, 64)) < 0)
                return err;
	return 0;
}
开发者ID:gnensis,项目名称:linux-2.6.15,代码行数:35,代码来源:ca0106_main.c


示例3: mxs_pcm_open

static int mxs_pcm_open(struct snd_pcm_substream *substream)
{
	struct snd_pcm_runtime *runtime = substream->runtime;
	struct mxs_runtime_data *prtd;
	int ret;

	/* Ensure that buffer size is a multiple of the period size */
	ret = snd_pcm_hw_constraint_integer(runtime,
					SNDRV_PCM_HW_PARAM_PERIODS);
	if (ret < 0)
		return ret;

	snd_soc_set_runtime_hwparams(substream, &mxs_pcm_hardware);

	prtd = kzalloc(sizeof(struct mxs_runtime_data), GFP_KERNEL);
	if (prtd == NULL)
		return -ENOMEM;

	runtime->private_data = prtd;

	ret = mxs_pcm_dma_request(substream);
	if (ret) {
		printk(KERN_ERR "mxs_pcm: Failed to request channels\n");
		kfree(prtd);
		return ret;
	}
	return 0;
}
开发者ID:fread-ink,项目名称:fread-kernel-k4,代码行数:28,代码来源:mxs-pcm.c


示例4: snd_dmaengine_pcm_open

int snd_dmaengine_pcm_open(struct snd_pcm_substream *substream,
	dma_filter_fn filter_fn, void *filter_data)
{
	struct dmaengine_pcm_runtime_data *prtd;
	int ret;

	ret = snd_pcm_hw_constraint_integer(substream->runtime,
					    SNDRV_PCM_HW_PARAM_PERIODS);
	if (ret < 0)
		return ret;

	prtd = kzalloc(sizeof(*prtd), GFP_KERNEL);
	if (!prtd)
		return -ENOMEM;

	ret = dmaengine_pcm_request_channel(prtd, filter_fn, filter_data);
	if (ret < 0) {
		kfree(prtd);
		return ret;
	}

	substream->runtime->private_data = prtd;

	return 0;
}
开发者ID:MiniBlu,项目名称:cm11_kernel_htc_msm8974a3ul,代码行数:25,代码来源:soc-dmaengine-pcm.c


示例5: lola_pcm_open

static int lola_pcm_open(struct snd_pcm_substream *substream)
{
    struct lola *chip = snd_pcm_substream_chip(substream);
    struct lola_pcm *pcm = lola_get_pcm(substream);
    struct lola_stream *str = lola_get_stream(substream);
    struct snd_pcm_runtime *runtime = substream->runtime;

    mutex_lock(&chip->open_mutex);
    if (str->opened) {
        mutex_unlock(&chip->open_mutex);
        return -EBUSY;
    }
    str->substream = substream;
    str->master = NULL;
    str->opened = 1;
    runtime->hw = lola_pcm_hw;
    runtime->hw.channels_max = pcm->num_streams - str->index;
    if (chip->sample_rate) {
        /* sample rate is locked */
        runtime->hw.rate_min = chip->sample_rate;
        runtime->hw.rate_max = chip->sample_rate;
    } else {
        runtime->hw.rate_min = chip->sample_rate_min;
        runtime->hw.rate_max = chip->sample_rate_max;
    }
    chip->ref_count_rate++;
    snd_pcm_hw_constraint_integer(runtime, SNDRV_PCM_HW_PARAM_PERIODS);
    /* period size = multiple of chip->granularity (8, 16 or 32 frames)*/
    snd_pcm_hw_constraint_step(runtime, 0, SNDRV_PCM_HW_PARAM_BUFFER_SIZE,
                               chip->granularity);
    snd_pcm_hw_constraint_step(runtime, 0, SNDRV_PCM_HW_PARAM_PERIOD_SIZE,
                               chip->granularity);
    mutex_unlock(&chip->open_mutex);
    return 0;
}
开发者ID:yejerry,项目名称:linux,代码行数:35,代码来源:lola_pcm.c


示例6: bf5xx_pcm_open

static int bf5xx_pcm_open(struct snd_pcm_substream *substream)
{
    struct snd_soc_pcm_runtime *rtd = substream->private_data;
    struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
    struct sport_device *sport_handle = snd_soc_dai_get_drvdata(cpu_dai);
    struct snd_pcm_runtime *runtime = substream->runtime;
    struct snd_dma_buffer *buf = &substream->dma_buffer;
    int ret;

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

    snd_soc_set_runtime_hwparams(substream, &bf5xx_pcm_hardware);

    ret = snd_pcm_hw_constraint_integer(runtime,
                                        SNDRV_PCM_HW_PARAM_PERIODS);
    if (ret < 0)
        goto out;

    if (sport_handle != NULL) {
        if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
            sport_handle->tx_buf = buf->area;
        else
            sport_handle->rx_buf = buf->area;

        runtime->private_data = sport_handle;
    } else {
        pr_err("sport_handle is NULL\n");
        return -1;
    }
    return 0;

out:
    return ret;
}
开发者ID:YaFilthy,项目名称:android_kernel_lge_voltdos,代码行数:34,代码来源:bf5xx-i2s-pcm.c


示例7: ctp_comms_dai_link_startup

static int ctp_comms_dai_link_startup(struct snd_pcm_substream *substream)
{
	struct snd_pcm_runtime *str_runtime;

	str_runtime = substream->runtime;

	WARN(!substream->pcm, "CTP Comms Machine: ERROR NULL substream->pcm\n");

	if (!substream->pcm)
		return -EINVAL;

	/* set the runtime hw parameter with local snd_pcm_hardware struct */
	switch (substream->pcm->device) {
	case CTP_RHB_COMMS_BT_SCO_DEV:
		str_runtime->hw = BT_sco_hw_param;
		break;

	case CTP_RHB_COMMS_MSIC_VOIP_DEV:
		str_runtime->hw = VOIP_alsa_hw_param;
		break;

	case CTP_RHB_COMMS_IFX_MODEM_DEV:
		str_runtime->hw = IFX_modem_alsa_hw_param;
		break;
	default:
		pr_err("CTP Comms Machine: bad PCM Device = %d\n",
						substream->pcm->device);
	}
	return snd_pcm_hw_constraint_integer(str_runtime,
						SNDRV_PCM_HW_PARAM_PERIODS);
}
开发者ID:BitOBSessiOn,项目名称:android_kernel_asus_P01M,代码行数:31,代码来源:ctp_rhb_cs42l73.c


示例8: msm_afe_open

static int msm_afe_open(struct snd_pcm_substream *substream)
{
	struct snd_pcm_runtime *runtime = substream->runtime;
	struct pcm_afe_info *prtd = NULL;
	int ret = 0;

	prtd = kzalloc(sizeof(struct pcm_afe_info), GFP_KERNEL);
	if (prtd == NULL) {
		pr_err("Failed to allocate memory for msm_audio\n");
		return -ENOMEM;
	} else
		pr_debug("prtd %x\n", (unsigned int)prtd);

	mutex_init(&prtd->lock);
	spin_lock_init(&prtd->dsp_lock);
	prtd->dsp_cnt = 0;

	mutex_lock(&prtd->lock);

	runtime->hw = msm_afe_hardware;
	prtd->substream = substream;
	runtime->private_data = prtd;
	prtd->audio_client = q6asm_audio_client_alloc(
				(app_cb)q6asm_event_handler, prtd);
	if (!prtd->audio_client) {
		pr_debug("%s: Could not allocate memory\n", __func__);
		/*                                   
                                                                      
                                          
                                  
                                 
          
   */
		mutex_unlock(&prtd->lock);
		kfree(prtd);
		/*              */
		return -ENOMEM;
	}
	hrtimer_init(&prtd->hrt, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
	if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
		prtd->hrt.function = afe_hrtimer_callback;
	else if (substream->stream == SNDRV_PCM_STREAM_CAPTURE)
		prtd->hrt.function = afe_hrtimer_rec_callback;

	mutex_unlock(&prtd->lock);

	ret = snd_pcm_hw_constraint_list(runtime, 0,
				SNDRV_PCM_HW_PARAM_RATE,
				&constraints_sample_rates);
	if (ret < 0)
		pr_err("snd_pcm_hw_constraint_list failed\n");
	/* Ensure that buffer size is a multiple of period size */
	ret = snd_pcm_hw_constraint_integer(runtime,
					    SNDRV_PCM_HW_PARAM_PERIODS);
	if (ret < 0)
		pr_err("snd_pcm_hw_constraint_integer failed\n");

	return 0;
}
开发者ID:Rondeau7,项目名称:android_kernel_lge_msm8960,代码行数:59,代码来源:msm-pcm-afe.c


示例9: mtk_pcm_i2s0_open

static int mtk_pcm_i2s0_open(struct snd_pcm_substream *substream)
{
    int ret = 0;
    struct snd_pcm_runtime *runtime = substream->runtime;
    AfeControlSramLock();
    if (GetSramState() == SRAM_STATE_FREE)
    {
        mtk_i2s0_hardware.buffer_bytes_max = GetPLaybackSramFullSize();
        mPlaybackSramState = SRAM_STATE_PLAYBACKFULL;
        SetSramState(mPlaybackSramState);
    }
    else
    {
        mtk_i2s0_hardware.buffer_bytes_max = GetPLaybackSramPartial();
        mPlaybackSramState = SRAM_STATE_PLAYBACKPARTIAL;
        SetSramState(mPlaybackSramState);
    }
    AfeControlSramUnLock();
    runtime->hw = mtk_i2s0_hardware;

    printk("mtk_pcm_i2s0_open\n");

    AudDrv_Clk_On();
    memcpy((void *)(&(runtime->hw)), (void *)&mtk_i2s0_hardware , sizeof(struct snd_pcm_hardware));
    pI2s0MemControl = Get_Mem_ControlT(Soc_Aud_Digital_Block_MEM_DL1);


    ret = snd_pcm_hw_constraint_list(runtime, 0, SNDRV_PCM_HW_PARAM_RATE,
                                     &constraints_sample_rates);
    ret = snd_pcm_hw_constraint_integer(runtime, SNDRV_PCM_HW_PARAM_PERIODS);

    if (ret < 0)
    {
        printk("snd_pcm_hw_constraint_integer failed\n");
    }

    //print for hw pcm information
    printk("mtk_pcm_i2s0_open runtime rate = %d channels = %d substream->pcm->device = %d\n",
           runtime->rate, runtime->channels, substream->pcm->device);

    if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
    {
        printk("SNDRV_PCM_STREAM_PLAYBACK mtkalsa_i2s0_playback_constraints\n");
    }
    else
    {

    }

    if (ret < 0)
    {
        printk("mtk_pcm_i2s0_close\n");
        mtk_pcm_i2s0_close(substream);
        return ret;
    }
    printk("mtk_pcm_i2s0_open return\n");
    AudDrv_Clk_Off();
    return 0;
}
开发者ID:AudioGod,项目名称:MediaTek-HelioX10-Kernel,代码行数:59,代码来源:mt_soc_pcm_dl1_i2s0.c


示例10: snd_dmaengine_pcm_open

/**
 * snd_dmaengine_pcm_open - Open a dmaengine based PCM substream
 * @substream: PCM substream
 * @chan: DMA channel to use for data transfers
 *
 * Returns 0 on success, a negative error code otherwise.
 *
 * The function should usually be called from the pcm open callback. Note that
 * this function will use private_data field of the substream's runtime. So it
 * is not availabe to your pcm driver implementation.
 */
int snd_dmaengine_pcm_open(struct snd_pcm_substream *substream,
	struct dma_chan *chan)
{
	struct dmaengine_pcm_runtime_data *prtd;
	int ret;

	if (!chan)
		return -ENXIO;

	ret = snd_pcm_hw_constraint_integer(substream->runtime,
					    SNDRV_PCM_HW_PARAM_PERIODS);
	if (ret < 0)
		return ret;

	prtd = kzalloc(sizeof(*prtd), GFP_KERNEL);
	if (!prtd)
		return -ENOMEM;

	prtd->dma_chan = chan;

	substream->runtime->private_data = prtd;

#ifdef CONFIG_SND_PXA_SSP_DUMP
	INIT_WORK(&prtd->playback_dump_work, playback_dump_handler);
	INIT_WORK(&prtd->capture_dump_work, capture_dump_handler);

	if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
		if (!ssp_playback_wq)
			ssp_playback_wq =
				create_singlethread_workqueue("ssp_playback");

		pr_debug("[pxa-ssp]: Create playback dump file\n");
		prtd->playback_fp = filp_open(DUMP_FILE1, O_RDWR | O_CREAT
			| O_LARGEFILE, S_IRWXU | S_IRWXG | S_IRWXO);
		if (IS_ERR(prtd->playback_fp)) {
			pr_info("playback dump file create error %d\n",
				(int)prtd->playback_fp);
			prtd->playback_fp = 0;
		}
		prtd->playback_runtime = substream->runtime;
	} else {
		if (!ssp_capture_wq)
			ssp_capture_wq =
				create_singlethread_workqueue("ssp_capture");

		pr_debug("[pxa-ssp]: Create capture dump file\n");
		prtd->capture_fp = filp_open(DUMP_FILE2, O_RDWR | O_CREAT
			| O_LARGEFILE, S_IRWXU | S_IRWXG | S_IRWXO);
		if (IS_ERR(prtd->capture_fp)) {
			pr_info("capture dump file create error %d\n",
				(int)prtd->capture_fp);
			prtd->capture_fp = 0;
		}
		prtd->capture_runtime = substream->runtime;
	}
#endif

	return 0;
}
开发者ID:GalaxyTab4,项目名称:maxicm_kernel_samsung_degaswifi,代码行数:70,代码来源:soc-dmaengine-pcm.c


示例11: tegra_pcm_open

static int tegra_pcm_open(struct snd_pcm_substream *substream)
{
	struct snd_pcm_runtime *runtime = substream->runtime;
	struct tegra_runtime_data *prtd;
	struct snd_soc_pcm_runtime *rtd = substream->private_data;
	struct tegra_pcm_dma_params * dmap;
	int ret = 0;

	prtd = kzalloc(sizeof(struct tegra_runtime_data), GFP_KERNEL);
	if (prtd == NULL)
		return -ENOMEM;

	runtime->private_data = prtd;
	prtd->substream = substream;

	spin_lock_init(&prtd->lock);

	dmap = snd_soc_dai_get_dma_data(rtd->cpu_dai, substream);

	if (dmap) {
		prtd->dma_req[0].dev = prtd;
		prtd->dma_req[1].dev = prtd;

		prtd->dma_chan = tegra_dma_allocate_channel(
					TEGRA_DMA_MODE_CONTINUOUS_SINGLE,
					"pcm");
		if (prtd->dma_chan == NULL) {
			ret = -ENOMEM;
			goto err;
		}
	}

	/* Set HW params now that initialization is complete */
	snd_soc_set_runtime_hwparams(substream, &tegra_pcm_hardware);

	/* Ensure period size is multiple of 8 */
	ret = snd_pcm_hw_constraint_step(runtime, 0,
		SNDRV_PCM_HW_PARAM_PERIOD_BYTES, 0x8);
	if (ret < 0)
		goto err;

	/* Ensure that buffer size is a multiple of period size */
	ret = snd_pcm_hw_constraint_integer(runtime,
						SNDRV_PCM_HW_PARAM_PERIODS);
	if (ret < 0)
		goto err;

	return 0;

err:
	if (prtd->dma_chan) {
		tegra_dma_free_channel(prtd->dma_chan);
	}

	kfree(prtd);

	return ret;
}
开发者ID:Astinj,项目名称:bricked-grouper-3.x,代码行数:58,代码来源:tegra_pcm.c


示例12: msm_compr_open

static int msm_compr_open(struct snd_pcm_substream *substream)
{
	struct snd_pcm_runtime *runtime = substream->runtime;
	struct snd_soc_pcm_runtime *soc_prtd = substream->private_data;
	struct compr_audio *compr;
	struct msm_audio *prtd;
	int ret = 0;

	/* Capture path */
	if (substream->stream == SNDRV_PCM_STREAM_CAPTURE)
		return -EINVAL;

	pr_debug("%s\n", __func__);
	compr = kzalloc(sizeof(struct compr_audio), GFP_KERNEL);
	if (compr == NULL) {
		pr_err("Failed to allocate memory for msm_audio\n");
		return -ENOMEM;
	}
	prtd = &compr->prtd;
	prtd->substream = substream;
	prtd->audio_client = q6asm_audio_client_alloc(
				(app_cb)compr_event_handler, compr);
	if (!prtd->audio_client) {
		pr_info("%s: Could not allocate memory\n", __func__);
		kfree(prtd);
		return -ENOMEM;
	}
	prtd->audio_client->perf_mode = false;
	runtime->hw = msm_compr_hardware_playback;

	pr_info("%s: session ID %d\n", __func__, prtd->audio_client->session);

	prtd->session_id = prtd->audio_client->session;
	msm_pcm_routing_reg_phy_stream(soc_prtd->dai_link->be_id,
			prtd->audio_client->perf_mode,
			prtd->session_id, substream->stream);

	prtd->cmd_ack = 1;

	ret = snd_pcm_hw_constraint_list(runtime, 0,
			SNDRV_PCM_HW_PARAM_RATE,
			&constraints_sample_rates);
	if (ret < 0)
		pr_info("snd_pcm_hw_constraint_list failed\n");
	/* Ensure that buffer size is a multiple of period size */
	ret = snd_pcm_hw_constraint_integer(runtime,
			    SNDRV_PCM_HW_PARAM_PERIODS);
	if (ret < 0)
		pr_info("snd_pcm_hw_constraint_integer failed\n");

	prtd->dsp_cnt = 0;
	atomic_set(&prtd->pending_buffer, 1);
	compr->codec = FORMAT_MP3;
	populate_codec_list(compr, runtime);
	runtime->private_data = compr;

	return 0;
}
开发者ID:SonsOfAndroid,项目名称:android_kernel_samsung_d2_SOA,代码行数:58,代码来源:msm-compr-q6.c


示例13: lx_pcm_open

static int lx_pcm_open(struct snd_pcm_substream *substream)
{
	struct lx6464es *chip = snd_pcm_substream_chip(substream);
	struct snd_pcm_runtime *runtime = substream->runtime;
	int err = 0;
	int board_rate;

	dev_dbg(chip->card->dev, "->lx_pcm_open\n");
	mutex_lock(&chip->setup_mutex);

	/* copy the struct snd_pcm_hardware struct */
	runtime->hw = lx_caps;

#if 0
	/* buffer-size should better be multiple of period-size */
	err = snd_pcm_hw_constraint_integer(runtime,
					    SNDRV_PCM_HW_PARAM_PERIODS);
	if (err < 0) {
		dev_warn(chip->card->dev, "could not constrain periods\n");
		goto exit;
	}
#endif

	/* the clock rate cannot be changed */
	board_rate = chip->board_sample_rate;
	err = snd_pcm_hw_constraint_single(runtime, SNDRV_PCM_HW_PARAM_RATE,
					   board_rate);

	if (err < 0) {
		dev_warn(chip->card->dev, "could not constrain periods\n");
		goto exit;
	}

	/* constrain period size */
	err = snd_pcm_hw_constraint_minmax(runtime,
					   SNDRV_PCM_HW_PARAM_PERIOD_SIZE,
					   MICROBLAZE_IBL_MIN,
					   MICROBLAZE_IBL_MAX);
	if (err < 0) {
		dev_warn(chip->card->dev,
			   "could not constrain period size\n");
		goto exit;
	}

	snd_pcm_hw_constraint_step(runtime, 0,
				   SNDRV_PCM_HW_PARAM_BUFFER_SIZE, 32);

	snd_pcm_set_sync(substream);
	err = 0;

exit:
	runtime->private_data = chip;

	mutex_unlock(&chip->setup_mutex);
	dev_dbg(chip->card->dev, "<-lx_pcm_open, %d\n", err);
	return err;
}
开发者ID:AshishNamdev,项目名称:linux,代码行数:57,代码来源:lx6464es.c


示例14: mtk_capture_pcm_open

static int mtk_capture_pcm_open(struct snd_pcm_substream *substream)
{
    struct snd_pcm_runtime *runtime = substream->runtime;
    int ret = 0;
    AudDrv_Clk_On();
    AudDrv_ADC_Clk_On();
    VUL_Control_context = Get_Mem_ControlT(Soc_Aud_Digital_Block_MEM_VUL);

    // can allocate sram_dbg
    AfeControlSramLock();
    if (GetSramState() ==  SRAM_STATE_FREE )
    {
        printk("mtk_capture_pcm_open use sram \n");
        mtk_capture_hardware.buffer_bytes_max = GetCaptureSramSize();
        SetSramState(SRAM_STATE_CAPTURE);
        mCaptureUseSram = true;
    }
    else
    {
        printk("mtk_capture_pcm_open use dram \n");
        mtk_capture_hardware.buffer_bytes_max = UL1_MAX_BUFFER_SIZE;
    }
    AfeControlSramUnLock();

    runtime->hw = mtk_capture_hardware;
    memcpy((void *)(&(runtime->hw)), (void *)&mtk_capture_hardware , sizeof(struct snd_pcm_hardware));

    ret = snd_pcm_hw_constraint_list(runtime, 0, SNDRV_PCM_HW_PARAM_RATE,
                                     &constraints_sample_rates);
    ret = snd_pcm_hw_constraint_integer(runtime, SNDRV_PCM_HW_PARAM_PERIODS);
    if (ret < 0)
    {
        printk("snd_pcm_hw_constraint_integer failed\n");
    }

    if (substream->stream == SNDRV_PCM_STREAM_CAPTURE)
    {

    }
    else
    {

    }

    if (ret < 0)
    {
        printk("mtk_capture_pcm_close\n");
        mtk_capture_pcm_close(substream);
        return ret;
    }
    if(mCaptureUseSram == false)
    {
        AudDrv_Emi_Clk_On();
    }
    printk("mtk_capture_pcm_open return\n");
    return 0;
}
开发者ID:AudioGod,项目名称:MediaTek-HelioX10-Kernel,代码行数:57,代码来源:mt_soc_pcm_capture.c


示例15: emu10k1_playback_constraints

static int emu10k1_playback_constraints(struct snd_pcm_runtime *runtime)
{
	int err;
	if ((err = snd_pcm_hw_constraint_integer(runtime, SNDRV_PCM_HW_PARAM_PERIODS)) < 0)
		return err;
	if ((err = snd_pcm_hw_constraint_minmax(runtime, SNDRV_PCM_HW_PARAM_BUFFER_BYTES, 256, UINT_MAX)) < 0)
		return err;
	return 0;
}
开发者ID:FatSunHYS,项目名称:OSCourseDesign,代码行数:9,代码来源:dummy.c


示例16: skl_set_pcm_constrains

static void skl_set_pcm_constrains(struct hdac_ext_bus *ebus,
				 struct snd_pcm_runtime *runtime)
{
	snd_pcm_hw_constraint_integer(runtime, SNDRV_PCM_HW_PARAM_PERIODS);

	/* avoid wrap-around with wall-clock */
	snd_pcm_hw_constraint_minmax(runtime, SNDRV_PCM_HW_PARAM_BUFFER_TIME,
				     20, 178000000);
}
开发者ID:AK101111,项目名称:linux,代码行数:9,代码来源:skl-pcm.c


示例17: tegra_pcm_open

static int tegra_pcm_open(struct snd_pcm_substream *substream)
{
	struct snd_pcm_runtime *runtime = substream->runtime;
	struct tegra_runtime_data *prtd;
	struct snd_soc_pcm_runtime *rtd = substream->private_data;
	struct tegra_pcm_dma_params * dmap;
	int ret = 0;

	prtd = kzalloc(sizeof(struct tegra_runtime_data), GFP_KERNEL);
	if (prtd == NULL)
		return -ENOMEM;

	runtime->private_data = prtd;
	prtd->substream = substream;

	spin_lock_init(&prtd->lock);

	if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
		dmap = snd_soc_dai_get_dma_data(rtd->cpu_dai, substream);
		setup_dma_tx_request(&prtd->dma_req[0], dmap);
		setup_dma_tx_request(&prtd->dma_req[1], dmap);
	} else {
		dmap = snd_soc_dai_get_dma_data(rtd->cpu_dai, substream);
		setup_dma_rx_request(&prtd->dma_req[0], dmap);
		setup_dma_rx_request(&prtd->dma_req[1], dmap);
	}

	prtd->dma_req[0].dev = prtd;
	prtd->dma_req[1].dev = prtd;

	prtd->dma_chan = tegra_dma_allocate_channel(TEGRA_DMA_MODE_ONESHOT);
	if (prtd->dma_chan == NULL) {
		ret = -ENOMEM;
		goto err;
	}

	/*                                                   */
	snd_soc_set_runtime_hwparams(substream, &tegra_pcm_hardware);

	/*                                                      */
	ret = snd_pcm_hw_constraint_integer(runtime,
						SNDRV_PCM_HW_PARAM_PERIODS);
	if (ret < 0)
		goto err;

	return 0;

err:
	if (prtd->dma_chan) {
		tegra_dma_free_channel(prtd->dma_chan);
	}

	kfree(prtd);

	return ret;
}
开发者ID:romanbb,项目名称:android_kernel_lge_d851,代码行数:56,代码来源:tegra_pcm.c


示例18: mtk_voice_extint_pcm_open

static int mtk_voice_extint_pcm_open(struct snd_pcm_substream *substream)
{
    struct snd_pcm_runtime *runtime = substream->runtime;
    int err = 0;
    int ret = 0;
    AudDrv_Clk_On();
    AudDrv_ADC_Clk_On();

    printk("mtk_voice_extint_pcm_open\n");

    if (substream->stream == SNDRV_PCM_STREAM_CAPTURE)
    {
        printk("%s  with SNDRV_PCM_STREAM_CAPTURE \n",__func__);
        runtime->rate = 16000;
        if(Voice_ExtInt_Status != 0)
        {
            return 0;
        }
    }
    runtime->hw = mtk_pcm_hardware;
    memcpy((void *)(&(runtime->hw)), (void *)&mtk_pcm_hardware , sizeof(struct snd_pcm_hardware));

    ret = snd_pcm_hw_constraint_list(runtime, 0, SNDRV_PCM_HW_PARAM_RATE,
                                     &constraints_sample_rates);
    ret = snd_pcm_hw_constraint_integer(runtime, SNDRV_PCM_HW_PARAM_PERIODS);

    if (ret < 0)
    {
        printk("snd_pcm_hw_constraint_integer failed\n");
    }

    //print for hw pcm information
    printk("mtk_voice_extint_pcm_open runtime rate = %d channels = %d \n", runtime->rate, runtime->channels);

    runtime->hw.info |= SNDRV_PCM_INFO_INTERLEAVED;
    runtime->hw.info |= SNDRV_PCM_INFO_NONINTERLEAVED;

    if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
    {
        printk("SNDRV_PCM_STREAM_PLAYBACK mtkalsa_voice_extint_constraints\n");
        runtime->rate = 16000;
    }
    else
    {

    }

    if (err < 0)
    {
        printk("mtk_voice_extint_close\n");
        mtk_voice_extint_close(substream);
        return err;
    }
    printk("mtk_voice_extint_pcm_open return\n");
    return 0;
}
开发者ID:Scorpio92,项目名称:mediatek,代码行数:56,代码来源:mt_soc_pcm_voice_extint.c


示例19: dw_pcm_open

static int dw_pcm_open(struct snd_pcm_substream *substream)
{
    struct snd_pcm_runtime *runtime = substream->runtime;
    struct snd_soc_pcm_runtime *rtd = substream->private_data;
    struct dw_i2s_dev *dev = snd_soc_dai_get_drvdata(rtd->cpu_dai);

    snd_soc_set_runtime_hwparams(substream, &dw_pcm_hardware);
    snd_pcm_hw_constraint_integer(runtime, SNDRV_PCM_HW_PARAM_PERIODS);
    runtime->private_data = dev;

    return 0;
}
开发者ID:mhei,项目名称:linux,代码行数:12,代码来源:designware_pcm.c


示例20: rsnd_pcm_open

static int rsnd_pcm_open(struct snd_pcm_substream *substream)
{
	struct snd_pcm_runtime *runtime = substream->runtime;
	int ret = 0;

	snd_soc_set_runtime_hwparams(substream, &rsnd_pcm_hardware);

	ret = snd_pcm_hw_constraint_integer(runtime,
					    SNDRV_PCM_HW_PARAM_PERIODS);

	return ret;
}
开发者ID:Master-Traders,项目名称:linux,代码行数:12,代码来源:core.c



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ snd_pcm_hw_constraint_list函数代码示例发布时间:2022-05-30
下一篇:
C++ snd_pcm_frames_to_bytes函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap