static int mtk_fm_i2s_awb_pcm_open(struct snd_pcm_substream *substream)
{
    struct snd_pcm_runtime *runtime = substream->runtime;
    int ret = 0;
    printk("mtk_fm_i2s_awb_pcm_open\n");
    FM_I2S_AWB_Control_context = Get_Mem_ControlT(Soc_Aud_Digital_Block_MEM_AWB);
    runtime->hw = mtk_mgrrx_awb_hardware;
    memcpy((void *)(&(runtime->hw)), (void *)&mtk_mgrrx_awb_hardware , sizeof(struct snd_pcm_hardware));

    ret = snd_pcm_hw_constraint_list(runtime, 0, SNDRV_PCM_HW_PARAM_RATE,
                                     &fm_i2s_awb_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");
    }

    printk("mtk_fm_i2s_awb_pcm_open runtime rate = %d channels = %d \n", runtime->rate, runtime->channels);

    if (substream->stream == SNDRV_PCM_STREAM_CAPTURE)
    {
        printk("SNDRV_PCM_STREAM_CAPTURE \n");
    }
    else
    {
        return -1;
    }
    // here open audio clocks
    AudDrv_Clk_On();
    AudDrv_I2S_Clk_On();
    AudDrv_Emi_Clk_On();

    if (ret < 0)
    {
        printk("mtk_fm_i2s_awb_pcm_close\n");
        mtk_fm_i2s_awb_pcm_close(substream);
        return ret;
    }
    printk("mtk_fm_i2s_awb_pcm_open return\n");
    return 0;
}
Пример #2
0
static int mtk_pcm_fm_i2s_open(struct snd_pcm_substream *substream)
{

    struct snd_pcm_runtime *runtime = substream->runtime;
    int ret = 0;
    AudDrv_Clk_On();
    AudDrv_I2S_Clk_On();

    printk("mtk_pcm_fm_i2s_open\n");
    runtime->hw = mtk_fm_i2s_hardware;
    memcpy((void *)(&(runtime->hw)), (void *)&mtk_fm_i2s_hardware , sizeof(struct snd_pcm_hardware));

    ret = snd_pcm_hw_constraint_list(runtime, 0, SNDRV_PCM_HW_PARAM_RATE,
                                     &fm_i2s_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");
    }
    printk("mtk_pcm_fm_i2s_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_fm_i2s_playback_constraints\n");
    }
    else
    {

    }

    if (ret < 0)
    {
        printk("mtk_pcm_fm_i2s_close\n");
        mtk_pcm_fm_i2s_close(substream);
        return ret;
    }

    SetFMEnableFlag(true);
    printk("mtk_pcm_fm_i2s_open return\n");
    return 0;
}