/* Current implementation assumes hw_param is called once * This may not be the case but what to do when ADM and AFE * port are already opened and parameter changes */ static int msm_dai_q6_hdmi_hw_params(struct snd_pcm_substream *substream, struct snd_pcm_hw_params *params, struct snd_soc_dai *dai) { struct msm_dai_q6_hdmi_dai_data *dai_data = dev_get_drvdata(dai->dev); u32 channel_allocation = 0; u32 level_shift = 0; /* 0dB */ bool down_mix = FALSE; dai_data->channels = params_channels(params); dai_data->rate = params_rate(params); #ifdef CONFIG_LGE_COMPRESSED_PATH // if (compressed_open_flag) { dai_data->rate = params->rate_num; dai_data->port_config.hdmi_multi_ch.data_type = 1; //non_linear case } else { dai_data->port_config.hdmi_multi_ch.data_type = 0; } #endif dai_data->port_config.hdmi_multi_ch.reserved = 0; switch (dai_data->channels) { case 2: channel_allocation = 0; hdmi_msm_audio_info_setup(1, MSM_HDMI_AUDIO_CHANNEL_2, channel_allocation, level_shift, down_mix); dai_data->port_config.hdmi_multi_ch.channel_allocation = channel_allocation; break; case 6: channel_allocation = 0x0B; hdmi_msm_audio_info_setup(1, MSM_HDMI_AUDIO_CHANNEL_6, channel_allocation, level_shift, down_mix); dai_data->port_config.hdmi_multi_ch.channel_allocation = channel_allocation; break; default: dev_err(dai->dev, "invalid Channels = %u\n", dai_data->channels); return -EINVAL; } dev_dbg(dai->dev, "%s() num_ch = %u rate =%u" " channel_allocation = %u data type = %d\n", __func__, dai_data->channels, dai_data->rate, dai_data->port_config.hdmi_multi_ch.channel_allocation, dai_data->port_config.hdmi_multi_ch.data_type); return 0; }
/* Current implementation assumes hw_param is called once * This may not be the case but what to do when ADM and AFE * port are already opened and parameter changes */ static int msm_dai_q6_hdmi_hw_params(struct snd_pcm_substream *substream, struct snd_pcm_hw_params *params, struct snd_soc_dai *dai) { struct msm_dai_q6_hdmi_dai_data *dai_data = dev_get_drvdata(dai->dev); u32 channel_allocation = 0; #ifdef CONFIG_FB_MSM_HDMI_COMMON /*yjw*/ u32 level_shift = 0; /* 0dB */ bool down_mix = FALSE; #endif dai_data->channels = params_channels(params); dai_data->rate = params_rate(params); dai_data->port_config.hdmi_multi_ch.data_type = 0; dai_data->port_config.hdmi_multi_ch.reserved = 0; switch (dai_data->channels) { case 2: channel_allocation = 0; #ifdef CONFIG_FB_MSM_HDMI_COMMON /*yjw*/ hdmi_msm_audio_info_setup(1, MSM_HDMI_AUDIO_CHANNEL_2, channel_allocation, level_shift, down_mix); #endif dai_data->port_config.hdmi_multi_ch.channel_allocation = channel_allocation; break; case 6: channel_allocation = 0x0B; #ifdef CONFIG_FB_MSM_HDMI_COMMON /*yjw*/ hdmi_msm_audio_info_setup(1, MSM_HDMI_AUDIO_CHANNEL_6, channel_allocation, level_shift, down_mix); #endif dai_data->port_config.hdmi_multi_ch.channel_allocation = channel_allocation; break; default: dev_err(dai->dev, "invalid Channels = %u\n", dai_data->channels); return -EINVAL; } dev_dbg(dai->dev, "%s() num_ch = %u rate =%u" " channel_allocation = %u\n", __func__, dai_data->channels, dai_data->rate, dai_data->port_config.hdmi_multi_ch.channel_allocation); return 0; }
static int msm_dai_q6_hdmi_hw_params(struct snd_pcm_substream *substream, struct snd_pcm_hw_params *params, struct snd_soc_dai *dai) { struct msm_dai_q6_hdmi_dai_data *dai_data = dev_get_drvdata(dai->dev); u32 channel_allocation = 0; u32 level_shift = 0; bool down_mix = FALSE; int sample_rate = 48000; dai_data->channels = params_channels(params); dai_data->rate = params_rate(params); dai_data->port_config.hdmi_multi_ch.reserved = 0; switch (dai_data->rate) { case 48000: sample_rate = HDMI_SAMPLE_RATE_48KHZ; break; case 44100: sample_rate = HDMI_SAMPLE_RATE_44_1KHZ; break; case 32000: sample_rate = HDMI_SAMPLE_RATE_32KHZ; break; } hdmi_msm_audio_sample_rate_reset(sample_rate); switch (dai_data->channels) { case 2: channel_allocation = 0; hdmi_msm_audio_info_setup(1, MSM_HDMI_AUDIO_CHANNEL_2, channel_allocation, level_shift, down_mix); dai_data->port_config.hdmi_multi_ch.channel_allocation = channel_allocation; break; case 6: channel_allocation = 0x0B; hdmi_msm_audio_info_setup(1, MSM_HDMI_AUDIO_CHANNEL_6, channel_allocation, level_shift, down_mix); dai_data->port_config.hdmi_multi_ch.channel_allocation = channel_allocation; break; case 8: channel_allocation = 0x1F; hdmi_msm_audio_info_setup(1, MSM_HDMI_AUDIO_CHANNEL_8, channel_allocation, level_shift, down_mix); dai_data->port_config.hdmi_multi_ch.channel_allocation = channel_allocation; break; default: dev_err(dai->dev, "invalid Channels = %u\n", dai_data->channels); return -EINVAL; } dev_dbg(dai->dev, "%s() num_ch = %u rate =%u" " channel_allocation = %u data type = %d\n", __func__, dai_data->channels, dai_data->rate, dai_data->port_config.hdmi_multi_ch.channel_allocation, dai_data->port_config.hdmi_multi_ch.data_type); return 0; }