asoc: Add support for Hifi resampler check with bitwidth and sample_rate

The check for bitwidht and sample rate along with hifi enable is to ensure not
to open speaker at 32bit in combo usecase of speaker and Hifi-headphone.

Change-Id: I4d1e5f357a74424c28d11d17a9fdfdd9309adec3
This commit is contained in:
Prasad Kumpatla 2019-09-24 14:51:22 +05:30 • committed by Gerrit - the friendly Code Review server
commit 6db89c7dc3

View file

@ -1423,7 +1423,7 @@ int msm_pcm_routing_reg_phy_compr_stream(int fe_id, int perf_mode,
int num_copps = 0;
struct route_payload payload;
u32 channels, sample_rate;
u16 bit_width = 16;
u16 bit_width = 16, be_bit_width;
bool is_lsm;
pr_debug("%s:fe_id[%d] perf_mode[%d] id[%d] stream_type[%d] passt[%d]",
@ -1525,7 +1525,12 @@ int msm_pcm_routing_reg_phy_compr_stream(int fe_id, int perf_mode,
topology = COMPRESSED_PASSTHROUGH_NONE_TOPOLOGY;
pr_debug("%s: Before adm open topology %d\n", __func__,
topology);
if (hifi_filter_enabled)
be_bit_width = msm_routing_get_bit_width(
msm_bedais[i].format);
if (hifi_filter_enabled && (msm_bedais[i].sample_rate
== 384000 || msm_bedais[i].sample_rate ==
352800) && be_bit_width == 32)
bit_width = msm_routing_get_bit_width(
SNDRV_PCM_FORMAT_S32_LE);
@ -1805,7 +1810,7 @@ int msm_pcm_routing_reg_phy_stream(int fedai_id, int perf_mode,
int i, j, session_type, path_type, port_type, topology, num_copps = 0;
struct route_payload payload;
u32 channels, sample_rate;
uint16_t bits_per_sample = 16;
uint16_t bits_per_sample = 16, be_bit_width;
uint32_t passthr_mode = LEGACY_PCM;
int ret = 0;
@ -1873,7 +1878,12 @@ int msm_pcm_routing_reg_phy_stream(int fedai_id, int perf_mode,
topology = msm_routing_get_adm_topology(fedai_id,
session_type,
i);
if (hifi_filter_enabled)
be_bit_width = msm_routing_get_bit_width(
msm_bedais[i].format);
if (hifi_filter_enabled && (msm_bedais[i].sample_rate ==
384000 ||msm_bedais[i].sample_rate == 352800)
&& be_bit_width == 32)
bits_per_sample = msm_routing_get_bit_width(
SNDRV_PCM_FORMAT_S32_LE);
copp_idx = adm_open(port_id, path_type,
@ -2039,7 +2049,7 @@ static void msm_pcm_routing_process_audio(u16 reg, u16 val, int set)
{
int session_type, path_type, topology;
u32 channels, sample_rate;
uint16_t bits_per_sample = 16;
uint16_t bits_per_sample = 16, be_bit_width;
struct msm_pcm_routing_fdai_data *fdai;
uint32_t passthr_mode;
bool is_lsm;
@ -2143,7 +2153,12 @@ static void msm_pcm_routing_process_audio(u16 reg, u16 val, int set)
reg);
acdb_dev_id =
fe_dai_app_type_cfg[val][session_type][reg].acdb_dev_id;
if (hifi_filter_enabled)
be_bit_width = msm_routing_get_bit_width(
msm_bedais[reg].format);
if (hifi_filter_enabled && (msm_bedais[reg].sample_rate
== 384000 ||msm_bedais[reg].sample_rate ==
352800) && be_bit_width == 32)
bits_per_sample = msm_routing_get_bit_width(
SNDRV_PCM_FORMAT_S32_LE);
copp_idx = adm_open(port_id, path_type,
@ -28379,7 +28394,7 @@ static int msm_pcm_routing_prepare(struct snd_pcm_substream *substream)
int session_type = INVALID_SESSION;
struct msm_pcm_routing_bdai_data *bedai;
u32 channels, sample_rate;
uint16_t bits_per_sample = 16, voc_path_type;
uint16_t bits_per_sample = 16, voc_path_type, be_bit_width;
struct msm_pcm_routing_fdai_data *fdai;
u32 session_id;
struct media_format_info voc_be_media_format;
@ -28487,7 +28502,12 @@ static int msm_pcm_routing_prepare(struct snd_pcm_substream *substream)
|| (fdai->passthr_mode == COMPRESSED_PASSTHROUGH_IEC61937))
topology = COMPRESSED_PASSTHROUGH_NONE_TOPOLOGY;
if (hifi_filter_enabled)
be_bit_width = msm_routing_get_bit_width(
bedai->format);
if (hifi_filter_enabled && (bedai->sample_rate == 384000
|| bedai->sample_rate == 352800) &&
be_bit_width == 32)
bits_per_sample = msm_routing_get_bit_width(
SNDRV_PCM_FORMAT_S32_LE);
copp_idx = adm_open(port_id, path_type,