diff --git a/sound/soc/msm/qdsp6v2/msm-compress-q6-v2.c b/sound/soc/msm/qdsp6v2/msm-compress-q6-v2.c index d037f8696cac..0acf6e8ffe49 100644 --- a/sound/soc/msm/qdsp6v2/msm-compress-q6-v2.c +++ b/sound/soc/msm/qdsp6v2/msm-compress-q6-v2.c @@ -3433,21 +3433,18 @@ static int msm_compr_playback_app_type_cfg_put(struct snd_kcontrol *kcontrol, u64 fe_id = kcontrol->private_value; int session_type = SESSION_TYPE_RX; int be_id = ucontrol->value.integer.value[3]; + struct msm_pcm_stream_app_type_cfg cfg_data = {0, 0, 48000}; int ret = 0; - int app_type; - int acdb_dev_id; - int sample_rate = 48000; - app_type = ucontrol->value.integer.value[0]; - acdb_dev_id = ucontrol->value.integer.value[1]; + cfg_data.app_type = ucontrol->value.integer.value[0]; + cfg_data.acdb_dev_id = ucontrol->value.integer.value[1]; if (ucontrol->value.integer.value[2] != 0) - sample_rate = ucontrol->value.integer.value[2]; + cfg_data.sample_rate = ucontrol->value.integer.value[2]; pr_debug("%s: fe_id- %llu session_type- %d be_id- %d app_type- %d acdb_dev_id- %d sample_rate- %d\n", __func__, fe_id, session_type, be_id, - app_type, acdb_dev_id, sample_rate); + cfg_data.app_type, cfg_data.acdb_dev_id, cfg_data.sample_rate); ret = msm_pcm_routing_reg_stream_app_type_cfg(fe_id, session_type, - be_id, app_type, - acdb_dev_id, sample_rate); + be_id, &cfg_data); if (ret < 0) pr_err("%s: msm_pcm_routing_reg_stream_app_type_cfg failed returned %d\n", __func__, ret); @@ -3460,28 +3457,25 @@ static int msm_compr_playback_app_type_cfg_get(struct snd_kcontrol *kcontrol, { u64 fe_id = kcontrol->private_value; int session_type = SESSION_TYPE_RX; - int be_id = ucontrol->value.integer.value[3]; + int be_id = 0; + struct msm_pcm_stream_app_type_cfg cfg_data = {0}; int ret = 0; - int app_type; - int acdb_dev_id; - int sample_rate; ret = msm_pcm_routing_get_stream_app_type_cfg(fe_id, session_type, - be_id, &app_type, - &acdb_dev_id, - &sample_rate); + &be_id, &cfg_data); if (ret < 0) { pr_err("%s: msm_pcm_routing_get_stream_app_type_cfg failed returned %d\n", __func__, ret); goto done; } - ucontrol->value.integer.value[0] = app_type; - ucontrol->value.integer.value[1] = acdb_dev_id; - ucontrol->value.integer.value[2] = sample_rate; + ucontrol->value.integer.value[0] = cfg_data.app_type; + ucontrol->value.integer.value[1] = cfg_data.acdb_dev_id; + ucontrol->value.integer.value[2] = cfg_data.sample_rate; + ucontrol->value.integer.value[3] = be_id; pr_debug("%s: fedai_id %llu, session_type %d, be_id %d, app_type %d, acdb_dev_id %d, sample_rate %d\n", __func__, fe_id, session_type, be_id, - app_type, acdb_dev_id, sample_rate); + cfg_data.app_type, cfg_data.acdb_dev_id, cfg_data.sample_rate); done: return ret; } @@ -3492,21 +3486,18 @@ static int msm_compr_capture_app_type_cfg_put(struct snd_kcontrol *kcontrol, u64 fe_id = kcontrol->private_value; int session_type = SESSION_TYPE_TX; int be_id = ucontrol->value.integer.value[3]; + struct msm_pcm_stream_app_type_cfg cfg_data = {0, 0, 48000}; int ret = 0; - int app_type; - int acdb_dev_id; - int sample_rate = 48000; - app_type = ucontrol->value.integer.value[0]; - acdb_dev_id = ucontrol->value.integer.value[1]; + cfg_data.app_type = ucontrol->value.integer.value[0]; + cfg_data.acdb_dev_id = ucontrol->value.integer.value[1]; if (ucontrol->value.integer.value[2] != 0) - sample_rate = ucontrol->value.integer.value[2]; + cfg_data.sample_rate = ucontrol->value.integer.value[2]; pr_debug("%s: fe_id- %llu session_type- %d be_id- %d app_type- %d acdb_dev_id- %d sample_rate- %d\n", __func__, fe_id, session_type, be_id, - app_type, acdb_dev_id, sample_rate); + cfg_data.app_type, cfg_data.acdb_dev_id, cfg_data.sample_rate); ret = msm_pcm_routing_reg_stream_app_type_cfg(fe_id, session_type, - be_id, app_type, - acdb_dev_id, sample_rate); + be_id, &cfg_data); if (ret < 0) pr_err("%s: msm_pcm_routing_reg_stream_app_type_cfg failed returned %d\n", __func__, ret); @@ -3519,28 +3510,25 @@ static int msm_compr_capture_app_type_cfg_get(struct snd_kcontrol *kcontrol, { u64 fe_id = kcontrol->private_value; int session_type = SESSION_TYPE_TX; - int be_id = ucontrol->value.integer.value[3]; + int be_id = 0; + struct msm_pcm_stream_app_type_cfg cfg_data = {0}; int ret = 0; - int app_type; - int acdb_dev_id; - int sample_rate; ret = msm_pcm_routing_get_stream_app_type_cfg(fe_id, session_type, - be_id, &app_type, - &acdb_dev_id, - &sample_rate); + &be_id, &cfg_data); if (ret < 0) { pr_err("%s: msm_pcm_routing_get_stream_app_type_cfg failed returned %d\n", __func__, ret); goto done; } - ucontrol->value.integer.value[0] = app_type; - ucontrol->value.integer.value[1] = acdb_dev_id; - ucontrol->value.integer.value[2] = sample_rate; + ucontrol->value.integer.value[0] = cfg_data.app_type; + ucontrol->value.integer.value[1] = cfg_data.acdb_dev_id; + ucontrol->value.integer.value[2] = cfg_data.sample_rate; + ucontrol->value.integer.value[3] = be_id; pr_debug("%s: fedai_id %llu, session_type %d, be_id %d, app_type %d, acdb_dev_id %d, sample_rate %d\n", __func__, fe_id, session_type, be_id, - app_type, acdb_dev_id, sample_rate); + cfg_data.app_type, cfg_data.acdb_dev_id, cfg_data.sample_rate); done: return ret; } diff --git a/sound/soc/msm/qdsp6v2/msm-lsm-client.c b/sound/soc/msm/qdsp6v2/msm-lsm-client.c index 1003dc8ddc5a..3e72aa130c18 100644 --- a/sound/soc/msm/qdsp6v2/msm-lsm-client.c +++ b/sound/soc/msm/qdsp6v2/msm-lsm-client.c @@ -2246,21 +2246,18 @@ static int msm_lsm_app_type_cfg_ctl_put(struct snd_kcontrol *kcontrol, u64 fe_id = kcontrol->private_value; int session_type = SESSION_TYPE_TX; int be_id = ucontrol->value.integer.value[3]; + struct msm_pcm_stream_app_type_cfg cfg_data = {0}; int ret = 0; - int app_type; - int acdb_dev_id; - int sample_rate; - app_type = ucontrol->value.integer.value[0]; - acdb_dev_id = ucontrol->value.integer.value[1]; - sample_rate = ucontrol->value.integer.value[2]; + cfg_data.app_type = ucontrol->value.integer.value[0]; + cfg_data.acdb_dev_id = ucontrol->value.integer.value[1]; + cfg_data.sample_rate = ucontrol->value.integer.value[2]; pr_debug("%s: fe_id- %llu session_type- %d be_id- %d app_type- %d acdb_dev_id- %d sample_rate- %d\n", __func__, fe_id, session_type, be_id, - app_type, acdb_dev_id, sample_rate); + cfg_data.app_type, cfg_data.acdb_dev_id, cfg_data.sample_rate); ret = msm_pcm_routing_reg_stream_app_type_cfg(fe_id, session_type, - be_id, app_type, - acdb_dev_id, sample_rate); + be_id, &cfg_data); if (ret < 0) pr_err("%s: msm_pcm_routing_reg_stream_app_type_cfg failed returned %d\n", __func__, ret); @@ -2273,28 +2270,25 @@ static int msm_lsm_app_type_cfg_ctl_get(struct snd_kcontrol *kcontrol, { u64 fe_id = kcontrol->private_value; int session_type = SESSION_TYPE_TX; - int be_id = ucontrol->value.integer.value[3]; + int be_id = 0; + struct msm_pcm_stream_app_type_cfg cfg_data = {0}; int ret = 0; - int app_type; - int acdb_dev_id; - int sample_rate; ret = msm_pcm_routing_get_stream_app_type_cfg(fe_id, session_type, - be_id, &app_type, - &acdb_dev_id, - &sample_rate); + &be_id, &cfg_data); if (ret < 0) { pr_err("%s: msm_pcm_routing_get_stream_app_type_cfg failed returned %d\n", __func__, ret); goto done; } - ucontrol->value.integer.value[0] = app_type; - ucontrol->value.integer.value[1] = acdb_dev_id; - ucontrol->value.integer.value[2] = sample_rate; + ucontrol->value.integer.value[0] = cfg_data.app_type; + ucontrol->value.integer.value[1] = cfg_data.acdb_dev_id; + ucontrol->value.integer.value[2] = cfg_data.sample_rate; + ucontrol->value.integer.value[3] = be_id; pr_debug("%s: fedai_id %llu, session_type %d, be_id %d, app_type %d, acdb_dev_id %d, sample_rate %d\n", __func__, fe_id, session_type, be_id, - app_type, acdb_dev_id, sample_rate); + cfg_data.app_type, cfg_data.acdb_dev_id, cfg_data.sample_rate); done: return ret; } diff --git a/sound/soc/msm/qdsp6v2/msm-pcm-loopback-v2.c b/sound/soc/msm/qdsp6v2/msm-pcm-loopback-v2.c index b8610b59ca63..44f59c49b670 100644 --- a/sound/soc/msm/qdsp6v2/msm-pcm-loopback-v2.c +++ b/sound/soc/msm/qdsp6v2/msm-pcm-loopback-v2.c @@ -558,21 +558,18 @@ static int msm_pcm_playback_app_type_cfg_ctl_put(struct snd_kcontrol *kcontrol, u64 fe_id = kcontrol->private_value; int session_type = SESSION_TYPE_RX; int be_id = ucontrol->value.integer.value[3]; + struct msm_pcm_stream_app_type_cfg cfg_data = {0, 0, 48000}; int ret = 0; - int app_type; - int acdb_dev_id; - int sample_rate = 48000; - app_type = ucontrol->value.integer.value[0]; - acdb_dev_id = ucontrol->value.integer.value[1]; + cfg_data.app_type = ucontrol->value.integer.value[0]; + cfg_data.acdb_dev_id = ucontrol->value.integer.value[1]; if (ucontrol->value.integer.value[2] != 0) - sample_rate = ucontrol->value.integer.value[2]; + cfg_data.sample_rate = ucontrol->value.integer.value[2]; pr_debug("%s: fe_id- %llu session_type- %d be_id- %d app_type- %d acdb_dev_id- %d sample_rate- %d\n", __func__, fe_id, session_type, be_id, - app_type, acdb_dev_id, sample_rate); + cfg_data.app_type, cfg_data.acdb_dev_id, cfg_data.sample_rate); ret = msm_pcm_routing_reg_stream_app_type_cfg(fe_id, session_type, - be_id, app_type, - acdb_dev_id, sample_rate); + be_id, &cfg_data); if (ret < 0) pr_err("%s: msm_pcm_routing_reg_stream_app_type_cfg failed returned %d\n", __func__, ret); @@ -585,28 +582,25 @@ static int msm_pcm_playback_app_type_cfg_ctl_get(struct snd_kcontrol *kcontrol, { u64 fe_id = kcontrol->private_value; int session_type = SESSION_TYPE_RX; - int be_id = ucontrol->value.integer.value[3]; + int be_id = 0; + struct msm_pcm_stream_app_type_cfg cfg_data = {0}; int ret = 0; - int app_type; - int acdb_dev_id; - int sample_rate; ret = msm_pcm_routing_get_stream_app_type_cfg(fe_id, session_type, - be_id, &app_type, - &acdb_dev_id, - &sample_rate); + &be_id, &cfg_data); if (ret < 0) { pr_err("%s: msm_pcm_routing_get_stream_app_type_cfg failed returned %d\n", __func__, ret); goto done; } - ucontrol->value.integer.value[0] = app_type; - ucontrol->value.integer.value[1] = acdb_dev_id; - ucontrol->value.integer.value[2] = sample_rate; + ucontrol->value.integer.value[0] = cfg_data.app_type; + ucontrol->value.integer.value[1] = cfg_data.acdb_dev_id; + ucontrol->value.integer.value[2] = cfg_data.sample_rate; + ucontrol->value.integer.value[3] = be_id; pr_debug("%s: fedai_id %llu, session_type %d, be_id %d, app_type %d, acdb_dev_id %d, sample_rate %d\n", __func__, fe_id, session_type, be_id, - app_type, acdb_dev_id, sample_rate); + cfg_data.app_type, cfg_data.acdb_dev_id, cfg_data.sample_rate); done: return ret; } @@ -617,21 +611,18 @@ static int msm_pcm_capture_app_type_cfg_ctl_put(struct snd_kcontrol *kcontrol, u64 fe_id = kcontrol->private_value; int session_type = SESSION_TYPE_TX; int be_id = ucontrol->value.integer.value[3]; + struct msm_pcm_stream_app_type_cfg cfg_data = {0, 0, 48000}; int ret = 0; - int app_type; - int acdb_dev_id; - int sample_rate = 48000; - app_type = ucontrol->value.integer.value[0]; - acdb_dev_id = ucontrol->value.integer.value[1]; + cfg_data.app_type = ucontrol->value.integer.value[0]; + cfg_data.acdb_dev_id = ucontrol->value.integer.value[1]; if (ucontrol->value.integer.value[2] != 0) - sample_rate = ucontrol->value.integer.value[2]; + cfg_data.sample_rate = ucontrol->value.integer.value[2]; pr_debug("%s: fe_id- %llu session_type- %d be_id- %d app_type- %d acdb_dev_id- %d sample_rate- %d\n", __func__, fe_id, session_type, be_id, - app_type, acdb_dev_id, sample_rate); + cfg_data.app_type, cfg_data.acdb_dev_id, cfg_data.sample_rate); ret = msm_pcm_routing_reg_stream_app_type_cfg(fe_id, session_type, - be_id, app_type, - acdb_dev_id, sample_rate); + be_id, &cfg_data); if (ret < 0) pr_err("%s: msm_pcm_routing_reg_stream_app_type_cfg failed returned %d\n", __func__, ret); @@ -644,28 +635,25 @@ static int msm_pcm_capture_app_type_cfg_ctl_get(struct snd_kcontrol *kcontrol, { u64 fe_id = kcontrol->private_value; int session_type = SESSION_TYPE_TX; - int be_id = ucontrol->value.integer.value[3]; + int be_id = 0; + struct msm_pcm_stream_app_type_cfg cfg_data = {0}; int ret = 0; - int app_type; - int acdb_dev_id; - int sample_rate; ret = msm_pcm_routing_get_stream_app_type_cfg(fe_id, session_type, - be_id, &app_type, - &acdb_dev_id, - &sample_rate); + &be_id, &cfg_data); if (ret < 0) { pr_err("%s: msm_pcm_routing_get_stream_app_type_cfg failed returned %d\n", __func__, ret); goto done; } - ucontrol->value.integer.value[0] = app_type; - ucontrol->value.integer.value[1] = acdb_dev_id; - ucontrol->value.integer.value[2] = sample_rate; + ucontrol->value.integer.value[0] = cfg_data.app_type; + ucontrol->value.integer.value[1] = cfg_data.acdb_dev_id; + ucontrol->value.integer.value[2] = cfg_data.sample_rate; + ucontrol->value.integer.value[3] = be_id; pr_debug("%s: fedai_id %llu, session_type %d, be_id %d, app_type %d, acdb_dev_id %d, sample_rate %d\n", __func__, fe_id, session_type, be_id, - app_type, acdb_dev_id, sample_rate); + cfg_data.app_type, cfg_data.acdb_dev_id, cfg_data.sample_rate); done: return ret; } diff --git a/sound/soc/msm/qdsp6v2/msm-pcm-q6-noirq.c b/sound/soc/msm/qdsp6v2/msm-pcm-q6-noirq.c index c0ca9b24f544..6b026bafa276 100644 --- a/sound/soc/msm/qdsp6v2/msm-pcm-q6-noirq.c +++ b/sound/soc/msm/qdsp6v2/msm-pcm-q6-noirq.c @@ -842,26 +842,21 @@ static int msm_pcm_playback_app_type_cfg_ctl_put(struct snd_kcontrol *kcontrol, u64 fe_id = kcontrol->private_value; int session_type = SESSION_TYPE_RX; int be_id = ucontrol->value.integer.value[3]; + struct msm_pcm_stream_app_type_cfg cfg_data = {0, 0, 48000}; int ret = 0; - int app_type; - int acdb_dev_id; - int sample_rate = 48000; - app_type = ucontrol->value.integer.value[0]; - acdb_dev_id = ucontrol->value.integer.value[1]; + cfg_data.app_type = ucontrol->value.integer.value[0]; + cfg_data.acdb_dev_id = ucontrol->value.integer.value[1]; if (ucontrol->value.integer.value[2] != 0) - sample_rate = ucontrol->value.integer.value[2]; - - ret = msm_pcm_routing_reg_stream_app_type_cfg(fe_id, session_type, - be_id, app_type, - acdb_dev_id, sample_rate); - if (ret < 0) - pr_err("%s: msm_pcm_playback_app_type_cfg_ctl_put failed, err %d\n", - __func__, ret); - + cfg_data.sample_rate = ucontrol->value.integer.value[2]; pr_debug("%s: fe_id- %llu session_type- %d be_id- %d app_type- %d acdb_dev_id- %d sample_rate- %d\n", __func__, fe_id, session_type, be_id, - app_type, acdb_dev_id, sample_rate); + cfg_data.app_type, cfg_data.acdb_dev_id, cfg_data.sample_rate); + ret = msm_pcm_routing_reg_stream_app_type_cfg(fe_id, session_type, + be_id, &cfg_data); + if (ret < 0) + pr_err("%s: msm_pcm_routing_reg_stream_app_type_cfg failed returned %d\n", + __func__, ret); return ret; } @@ -870,29 +865,25 @@ static int msm_pcm_playback_app_type_cfg_ctl_get(struct snd_kcontrol *kcontrol, { u64 fe_id = kcontrol->private_value; int session_type = SESSION_TYPE_RX; - int be_id = ucontrol->value.integer.value[3]; + int be_id = 0; + struct msm_pcm_stream_app_type_cfg cfg_data = {0}; int ret = 0; - int app_type; - int acdb_dev_id; - int sample_rate; ret = msm_pcm_routing_get_stream_app_type_cfg(fe_id, session_type, - be_id, &app_type, - &acdb_dev_id, - &sample_rate); + &be_id, &cfg_data); if (ret < 0) { - pr_err("%s: msm_pcm_playback_app_type_cfg_ctl_get failed, err: %d\n", - __func__, ret); + pr_err("%s: msm_pcm_routing_get_stream_app_type_cfg failed returned %d\n", + __func__, ret); goto done; } - ucontrol->value.integer.value[0] = app_type; - ucontrol->value.integer.value[1] = acdb_dev_id; - ucontrol->value.integer.value[2] = sample_rate; - + ucontrol->value.integer.value[0] = cfg_data.app_type; + ucontrol->value.integer.value[1] = cfg_data.acdb_dev_id; + ucontrol->value.integer.value[2] = cfg_data.sample_rate; + ucontrol->value.integer.value[3] = be_id; pr_debug("%s: fedai_id %llu, session_type %d, be_id %d, app_type %d, acdb_dev_id %d, sample_rate %d\n", __func__, fe_id, session_type, be_id, - app_type, acdb_dev_id, sample_rate); + cfg_data.app_type, cfg_data.acdb_dev_id, cfg_data.sample_rate); done: return ret; } @@ -903,26 +894,21 @@ static int msm_pcm_capture_app_type_cfg_ctl_put(struct snd_kcontrol *kcontrol, u64 fe_id = kcontrol->private_value; int session_type = SESSION_TYPE_TX; int be_id = ucontrol->value.integer.value[3]; + struct msm_pcm_stream_app_type_cfg cfg_data = {0, 0, 48000}; int ret = 0; - int app_type; - int acdb_dev_id; - int sample_rate = 48000; - app_type = ucontrol->value.integer.value[0]; - acdb_dev_id = ucontrol->value.integer.value[1]; + cfg_data.app_type = ucontrol->value.integer.value[0]; + cfg_data.acdb_dev_id = ucontrol->value.integer.value[1]; if (ucontrol->value.integer.value[2] != 0) - sample_rate = ucontrol->value.integer.value[2]; - - ret = msm_pcm_routing_reg_stream_app_type_cfg(fe_id, session_type, - be_id, app_type, - acdb_dev_id, sample_rate); - if (ret < 0) - pr_err("%s: msm_pcm_capture_app_type_cfg_ctl_put failed, err: %d\n", - __func__, ret); - + cfg_data.sample_rate = ucontrol->value.integer.value[2]; pr_debug("%s: fe_id- %llu session_type- %d be_id- %d app_type- %d acdb_dev_id- %d sample_rate- %d\n", __func__, fe_id, session_type, be_id, - app_type, acdb_dev_id, sample_rate); + cfg_data.app_type, cfg_data.acdb_dev_id, cfg_data.sample_rate); + ret = msm_pcm_routing_reg_stream_app_type_cfg(fe_id, session_type, + be_id, &cfg_data); + if (ret < 0) + pr_err("%s: msm_pcm_routing_reg_stream_app_type_cfg failed returned %d\n", + __func__, ret); return ret; } @@ -932,28 +918,25 @@ static int msm_pcm_capture_app_type_cfg_ctl_get(struct snd_kcontrol *kcontrol, { u64 fe_id = kcontrol->private_value; int session_type = SESSION_TYPE_TX; - int be_id = ucontrol->value.integer.value[3]; + int be_id = 0; + struct msm_pcm_stream_app_type_cfg cfg_data = {0}; int ret = 0; - int app_type; - int acdb_dev_id; - int sample_rate; ret = msm_pcm_routing_get_stream_app_type_cfg(fe_id, session_type, - be_id, &app_type, - &acdb_dev_id, - &sample_rate); + &be_id, &cfg_data); if (ret < 0) { - pr_err("%s: msm_pcm_capture_app_type_cfg_ctl_get failed, err: %d\n", - __func__, ret); + pr_err("%s: msm_pcm_routing_get_stream_app_type_cfg failed returned %d\n", + __func__, ret); goto done; } - ucontrol->value.integer.value[0] = app_type; - ucontrol->value.integer.value[1] = acdb_dev_id; - ucontrol->value.integer.value[2] = sample_rate; + ucontrol->value.integer.value[0] = cfg_data.app_type; + ucontrol->value.integer.value[1] = cfg_data.acdb_dev_id; + ucontrol->value.integer.value[2] = cfg_data.sample_rate; + ucontrol->value.integer.value[3] = be_id; pr_debug("%s: fedai_id %llu, session_type %d, be_id %d, app_type %d, acdb_dev_id %d, sample_rate %d\n", __func__, fe_id, session_type, be_id, - app_type, acdb_dev_id, sample_rate); + cfg_data.app_type, cfg_data.acdb_dev_id, cfg_data.sample_rate); done: return ret; } diff --git a/sound/soc/msm/qdsp6v2/msm-pcm-q6-v2.c b/sound/soc/msm/qdsp6v2/msm-pcm-q6-v2.c index 3be6567aefab..46a3324d2d6b 100644 --- a/sound/soc/msm/qdsp6v2/msm-pcm-q6-v2.c +++ b/sound/soc/msm/qdsp6v2/msm-pcm-q6-v2.c @@ -1556,21 +1556,18 @@ static int msm_pcm_playback_app_type_cfg_ctl_put(struct snd_kcontrol *kcontrol, u64 fe_id = kcontrol->private_value; int session_type = SESSION_TYPE_RX; int be_id = ucontrol->value.integer.value[3]; + struct msm_pcm_stream_app_type_cfg cfg_data = {0, 0, 48000}; int ret = 0; - int app_type; - int acdb_dev_id; - int sample_rate = 48000; - app_type = ucontrol->value.integer.value[0]; - acdb_dev_id = ucontrol->value.integer.value[1]; + cfg_data.app_type = ucontrol->value.integer.value[0]; + cfg_data.acdb_dev_id = ucontrol->value.integer.value[1]; if (ucontrol->value.integer.value[2] != 0) - sample_rate = ucontrol->value.integer.value[2]; + cfg_data.sample_rate = ucontrol->value.integer.value[2]; pr_debug("%s: fe_id- %llu session_type- %d be_id- %d app_type- %d acdb_dev_id- %d sample_rate- %d\n", __func__, fe_id, session_type, be_id, - app_type, acdb_dev_id, sample_rate); + cfg_data.app_type, cfg_data.acdb_dev_id, cfg_data.sample_rate); ret = msm_pcm_routing_reg_stream_app_type_cfg(fe_id, session_type, - be_id, app_type, - acdb_dev_id, sample_rate); + be_id, &cfg_data); if (ret < 0) pr_err("%s: msm_pcm_routing_reg_stream_app_type_cfg failed returned %d\n", __func__, ret); @@ -1583,28 +1580,25 @@ static int msm_pcm_playback_app_type_cfg_ctl_get(struct snd_kcontrol *kcontrol, { u64 fe_id = kcontrol->private_value; int session_type = SESSION_TYPE_RX; - int be_id = ucontrol->value.integer.value[3]; + int be_id = 0; + struct msm_pcm_stream_app_type_cfg cfg_data = {0}; int ret = 0; - int app_type; - int acdb_dev_id; - int sample_rate; ret = msm_pcm_routing_get_stream_app_type_cfg(fe_id, session_type, - be_id, &app_type, - &acdb_dev_id, - &sample_rate); + &be_id, &cfg_data); if (ret < 0) { pr_err("%s: msm_pcm_routing_get_stream_app_type_cfg failed returned %d\n", __func__, ret); goto done; } - ucontrol->value.integer.value[0] = app_type; - ucontrol->value.integer.value[1] = acdb_dev_id; - ucontrol->value.integer.value[2] = sample_rate; + ucontrol->value.integer.value[0] = cfg_data.app_type; + ucontrol->value.integer.value[1] = cfg_data.acdb_dev_id; + ucontrol->value.integer.value[2] = cfg_data.sample_rate; + ucontrol->value.integer.value[3] = be_id; pr_debug("%s: fedai_id %llu, session_type %d, be_id %d, app_type %d, acdb_dev_id %d, sample_rate %d\n", __func__, fe_id, session_type, be_id, - app_type, acdb_dev_id, sample_rate); + cfg_data.app_type, cfg_data.acdb_dev_id, cfg_data.sample_rate); done: return ret; } @@ -1615,21 +1609,18 @@ static int msm_pcm_capture_app_type_cfg_ctl_put(struct snd_kcontrol *kcontrol, u64 fe_id = kcontrol->private_value; int session_type = SESSION_TYPE_TX; int be_id = ucontrol->value.integer.value[3]; + struct msm_pcm_stream_app_type_cfg cfg_data = {0, 0, 48000}; int ret = 0; - int app_type; - int acdb_dev_id; - int sample_rate = 48000; - app_type = ucontrol->value.integer.value[0]; - acdb_dev_id = ucontrol->value.integer.value[1]; + cfg_data.app_type = ucontrol->value.integer.value[0]; + cfg_data.acdb_dev_id = ucontrol->value.integer.value[1]; if (ucontrol->value.integer.value[2] != 0) - sample_rate = ucontrol->value.integer.value[2]; + cfg_data.sample_rate = ucontrol->value.integer.value[2]; pr_debug("%s: fe_id- %llu session_type- %d be_id- %d app_type- %d acdb_dev_id- %d sample_rate- %d\n", __func__, fe_id, session_type, be_id, - app_type, acdb_dev_id, sample_rate); + cfg_data.app_type, cfg_data.acdb_dev_id, cfg_data.sample_rate); ret = msm_pcm_routing_reg_stream_app_type_cfg(fe_id, session_type, - be_id, app_type, - acdb_dev_id, sample_rate); + be_id, &cfg_data); if (ret < 0) pr_err("%s: msm_pcm_routing_reg_stream_app_type_cfg failed returned %d\n", __func__, ret); @@ -1642,28 +1633,25 @@ static int msm_pcm_capture_app_type_cfg_ctl_get(struct snd_kcontrol *kcontrol, { u64 fe_id = kcontrol->private_value; int session_type = SESSION_TYPE_TX; - int be_id = ucontrol->value.integer.value[3]; + int be_id = 0; + struct msm_pcm_stream_app_type_cfg cfg_data = {0}; int ret = 0; - int app_type; - int acdb_dev_id; - int sample_rate; ret = msm_pcm_routing_get_stream_app_type_cfg(fe_id, session_type, - be_id, &app_type, - &acdb_dev_id, - &sample_rate); + &be_id, &cfg_data); if (ret < 0) { pr_err("%s: msm_pcm_routing_get_stream_app_type_cfg failed returned %d\n", __func__, ret); goto done; } - ucontrol->value.integer.value[0] = app_type; - ucontrol->value.integer.value[1] = acdb_dev_id; - ucontrol->value.integer.value[2] = sample_rate; + ucontrol->value.integer.value[0] = cfg_data.app_type; + ucontrol->value.integer.value[1] = cfg_data.acdb_dev_id; + ucontrol->value.integer.value[2] = cfg_data.sample_rate; + ucontrol->value.integer.value[3] = be_id; pr_debug("%s: fedai_id %llu, session_type %d, be_id %d, app_type %d, acdb_dev_id %d, sample_rate %d\n", __func__, fe_id, session_type, be_id, - app_type, acdb_dev_id, sample_rate); + cfg_data.app_type, cfg_data.acdb_dev_id, cfg_data.sample_rate); done: return ret; } diff --git a/sound/soc/msm/qdsp6v2/msm-pcm-routing-v2.c b/sound/soc/msm/qdsp6v2/msm-pcm-routing-v2.c index 8744eb166261..f41c6107aac8 100644 --- a/sound/soc/msm/qdsp6v2/msm-pcm-routing-v2.c +++ b/sound/soc/msm/qdsp6v2/msm-pcm-routing-v2.c @@ -675,6 +675,8 @@ static struct msm_pcm_routing_app_type_data lsm_app_type_cfg[MAX_APP_TYPES]; static struct msm_pcm_stream_app_type_cfg fe_dai_app_type_cfg[MSM_FRONTEND_DAI_MAX][2][MSM_BACKEND_DAI_MAX]; +static int last_be_id_configured[MSM_FRONTEND_DAI_MAX][MAX_SESSION_TYPES]; + /* The caller of this should aqcuire routing lock */ void msm_pcm_routing_get_bedai_info(int be_idx, struct msm_pcm_routing_bdai_data *be_dai) @@ -741,15 +743,22 @@ static bool is_mm_lsm_fe_id(int fe_id) return rc; } -int msm_pcm_routing_reg_stream_app_type_cfg(int fedai_id, int session_type, - int be_id, int app_type, - int acdb_dev_id, int sample_rate) +int msm_pcm_routing_reg_stream_app_type_cfg( + int fedai_id, int session_type, int be_id, + struct msm_pcm_stream_app_type_cfg *cfg_data) { int ret = 0; + if (cfg_data == NULL) { + pr_err("%s: Received NULL pointer for cfg_data\n", __func__); + ret = -EINVAL; + goto done; + } + pr_debug("%s: fedai_id %d, session_type %d, be_id %d, app_type %d, acdb_dev_id %d, sample_rate %d\n", __func__, fedai_id, session_type, be_id, - app_type, acdb_dev_id, sample_rate); + cfg_data->app_type, cfg_data->acdb_dev_id, + cfg_data->sample_rate); if (!is_mm_lsm_fe_id(fedai_id)) { pr_err("%s: Invalid machine driver ID %d\n", @@ -771,15 +780,18 @@ int msm_pcm_routing_reg_stream_app_type_cfg(int fedai_id, int session_type, goto done; } - fe_dai_app_type_cfg[fedai_id][session_type][be_id].app_type = app_type; - fe_dai_app_type_cfg[fedai_id][session_type][be_id].acdb_dev_id = - acdb_dev_id; - fe_dai_app_type_cfg[fedai_id][session_type][be_id].sample_rate = - sample_rate; + fe_dai_app_type_cfg[fedai_id][session_type][be_id] = *cfg_data; + + /* + * Store the BE ID of the configuration information set as the latest so + * the get mixer control knows what to return. + */ + last_be_id_configured[fedai_id][session_type] = be_id; done: return ret; } +EXPORT_SYMBOL(msm_pcm_routing_reg_stream_app_type_cfg); /** * msm_pcm_routing_get_stream_app_type_cfg @@ -791,55 +803,48 @@ done: * fedai_id - Passed value, front end ID for which app type config is wanted * session_type - Passed value, session type for which app type config * is wanted - * be_id - Passed value, back end device id for which app type config is wanted - * app_type - Returned value, app type used by app type config - * acdb_dev_id - Returned value, ACDB device ID used by app type config - * sample_rate - Returned value, sample rate used by app type config + * be_id - Returned value, back end device id the app type config data is for + * cfg_data - Returned value, configuration data used by app type config */ -int msm_pcm_routing_get_stream_app_type_cfg(int fedai_id, int session_type, - int be_id, int *app_type, - int *acdb_dev_id, int *sample_rate) +int msm_pcm_routing_get_stream_app_type_cfg( + int fedai_id, int session_type, int *bedai_id, + struct msm_pcm_stream_app_type_cfg *cfg_data) { + int be_id; int ret = 0; - if (app_type == NULL) { - pr_err("%s: NULL pointer sent for app_type\n", __func__); + if (bedai_id == NULL) { + pr_err("%s: Received NULL pointer for backend ID\n", __func__); ret = -EINVAL; goto done; - } else if (acdb_dev_id == NULL) { - pr_err("%s: NULL pointer sent for acdb_dev_id\n", __func__); - ret = -EINVAL; - goto done; - } else if (sample_rate == NULL) { - pr_err("%s: NULL pointer sent for sample rate\n", __func__); + } else if (cfg_data == NULL) { + pr_err("%s: NULL pointer sent for cfg_data\n", __func__); ret = -EINVAL; goto done; } else if (!is_mm_lsm_fe_id(fedai_id)) { - pr_err("%s: Invalid FE ID %d\n", - __func__, fedai_id); + pr_err("%s: Invalid FE ID %d\n", __func__, fedai_id); ret = -EINVAL; goto done; } else if (session_type != SESSION_TYPE_RX && session_type != SESSION_TYPE_TX) { - pr_err("%s: Invalid session type %d\n", - __func__, session_type); + pr_err("%s: Invalid session type %d\n", __func__, session_type); ret = -EINVAL; goto done; - } else if (be_id < 0 || be_id >= MSM_BACKEND_DAI_MAX) { - pr_err("%s: Received out of bounds be_id %d\n", - __func__, be_id); - return -EINVAL; } - *app_type = fe_dai_app_type_cfg[fedai_id][session_type][be_id].app_type; - *acdb_dev_id = - fe_dai_app_type_cfg[fedai_id][session_type][be_id].acdb_dev_id; - *sample_rate = - fe_dai_app_type_cfg[fedai_id][session_type][be_id].sample_rate; + be_id = last_be_id_configured[fedai_id][session_type]; + if (be_id < 0 || be_id >= MSM_BACKEND_DAI_MAX) { + pr_err("%s: Invalid BE ID %d\n", __func__, be_id); + ret = -EINVAL; + goto done; + } + *bedai_id = be_id; + *cfg_data = fe_dai_app_type_cfg[fedai_id][session_type][be_id]; pr_debug("%s: fedai_id %d, session_type %d, be_id %d, app_type %d, acdb_dev_id %d, sample_rate %d\n", - __func__, fedai_id, session_type, be_id, - *app_type, *acdb_dev_id, *sample_rate); + __func__, fedai_id, session_type, *bedai_id, + cfg_data->app_type, cfg_data->acdb_dev_id, + cfg_data->sample_rate); done: return ret; } @@ -14958,6 +14963,7 @@ static int __init msm_soc_routing_platform_init(void) (routing_cb)msm_pcm_get_dev_acdb_id_by_port_id); memset(&be_dai_name_table, 0, sizeof(be_dai_name_table)); + memset(&last_be_id_configured, 0, sizeof(last_be_id_configured)); return platform_driver_register(&msm_routing_pcm_driver); } diff --git a/sound/soc/msm/qdsp6v2/msm-pcm-routing-v2.h b/sound/soc/msm/qdsp6v2/msm-pcm-routing-v2.h index 234d57ca1c40..19e726001d25 100644 --- a/sound/soc/msm/qdsp6v2/msm-pcm-routing-v2.h +++ b/sound/soc/msm/qdsp6v2/msm-pcm-routing-v2.h @@ -385,6 +385,7 @@ enum { #define INVALID_SESSION -1 #define SESSION_TYPE_RX 0 #define SESSION_TYPE_TX 1 +#define MAX_SESSION_TYPES 2 #define INT_RX_VOL_MAX_STEPS 0x2000 #define INT_RX_VOL_GAIN 0x2000 @@ -476,10 +477,10 @@ void msm_pcm_routing_get_fedai_info(int fe_idx, int sess_type, void msm_pcm_routing_acquire_lock(void); void msm_pcm_routing_release_lock(void); -int msm_pcm_routing_reg_stream_app_type_cfg(int fedai_id, int session_type, - int be_id, int app_type, - int acdb_dev_id, int sample_rate); -int msm_pcm_routing_get_stream_app_type_cfg(int fedai_id, int session_type, - int be_id, int *app_type, - int *acdb_dev_id, int *sample_rate); +int msm_pcm_routing_reg_stream_app_type_cfg( + int fedai_id, int session_type, int be_id, + struct msm_pcm_stream_app_type_cfg *cfg_data); +int msm_pcm_routing_get_stream_app_type_cfg( + int fedai_id, int session_type, int *be_id, + struct msm_pcm_stream_app_type_cfg *cfg_data); #endif /*_MSM_PCM_H*/