Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit cf1e19ab authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "ASoC: msm: Add support to enable DTS HPX and SA+ exclusively"

parents aff5a5a1 e6f5c00a
Loading
Loading
Loading
Loading
+18 −12
Original line number Diff line number Diff line
@@ -23,15 +23,6 @@
#define MAX_PP_PARAMS_SZ		128
#define WAIT_TIMEDOUT_DURATION_SECS	1

struct msm_nt_eff_all_config {
	struct bass_boost_params bass_boost;
	struct virtualizer_params virtualizer;
	struct reverb_params reverb;
	struct eq_params equalizer;
	struct soft_volume_params saplus_vol;
	struct soft_volume_params topo_switch_vol;
};

struct q6audio_effects {
	wait_queue_head_t		read_wait;
	wait_queue_head_t		write_wait;
@@ -402,15 +393,30 @@ static long audio_effects_set_pp_param(struct q6audio_effects *effects,
			      (long *)&values[1], SOFT_VOLUME_INSTANCE_2);
		break;
	case DTS_EAGLE_MODULE_ENABLE:
		pr_debug("%s: DTS_EAGLE_MODULE_BYPASS\n", __func__);
		pr_debug("%s: DTS_EAGLE_MODULE_ENABLE\n", __func__);
		if (msm_audio_effects_is_effmodule_supp_in_top(
			effects_module, effects->ac->topology)) {
			/*
			 * HPX->OFF: first disable HPX and then
			 * enable SA+
			 * HPX->ON: first disable SA+ and then
			 * enable HPX
			 */
			bool hpx_state = (bool)values[1];
			if (hpx_state)
				msm_audio_effects_enable_extn(effects->ac,
					&(effects->audio_effects),
					false);
			msm_dts_eagle_enable_asm(effects->ac,
				(bool)values[1],
				hpx_state,
				AUDPROC_MODULE_ID_DTS_HPX_PREMIX);
			msm_dts_eagle_enable_asm(effects->ac,
				(bool)values[1],
				hpx_state,
				AUDPROC_MODULE_ID_DTS_HPX_POSTMIX);
			if (!hpx_state)
				msm_audio_effects_enable_extn(effects->ac,
					&(effects->audio_effects),
					true);
		}
		break;
	default:
+4 −0
Original line number Diff line number Diff line
@@ -19,6 +19,10 @@
bool msm_audio_effects_is_effmodule_supp_in_top(int effect_module,
						int topology);

int msm_audio_effects_enable_extn(struct audio_client *ac,
			     struct msm_nt_eff_all_config *effects,
			     bool flag);

int msm_audio_effects_reverb_handler(struct audio_client *ac,
				     struct reverb_params *reverb,
				     long *values);
+5 −0
Original line number Diff line number Diff line
@@ -51,6 +51,7 @@ int msm_dts_eagle_handle_asm(struct dts_eagle_param_desc *depd, char *buf,
int msm_dts_eagle_handle_adm(struct dts_eagle_param_desc *depd, char *buf,
			     bool for_pre, bool get);
int msm_dts_eagle_ioctl(unsigned int cmd, unsigned long arg);
int msm_dts_eagle_is_hpx_on(void);
int msm_dts_eagle_init_pre(struct audio_client *ac);
int msm_dts_eagle_deinit_pre(struct audio_client *ac);
int msm_dts_eagle_init_post(int port_id, int copp_id);
@@ -100,6 +101,10 @@ static inline int msm_dts_eagle_ioctl(unsigned int cmd, unsigned long arg)
{
	return -EPERM;
}
static inline int msm_dts_eagle_is_hpx_on(void)
{
	return 0;
}
static inline int msm_dts_eagle_init_pre(struct audio_client *ac)
{
	return 0;
+9 −0
Original line number Diff line number Diff line
@@ -309,4 +309,13 @@ struct soft_volume_params {
	uint32_t right_gain;
};

struct msm_nt_eff_all_config {
	struct bass_boost_params bass_boost;
	struct virtualizer_params virtualizer;
	struct reverb_params reverb;
	struct eq_params equalizer;
	struct soft_volume_params saplus_vol;
	struct soft_volume_params topo_switch_vol;
};

#endif /*_MSM_AUDIO_EFFECTS_H*/
+60 −4
Original line number Diff line number Diff line
@@ -15,8 +15,11 @@
#include <sound/q6asm-v2.h>
#include <sound/compress_params.h>
#include <sound/msm-audio-effects-q6-v2.h>
#include <sound/msm-dts-eagle.h>
#include <sound/devdep_params.h>

#define MAX_ENABLE_CMD_SIZE 32

bool msm_audio_effects_is_effmodule_supp_in_top(int effect_module,
						int topology)
{
@@ -56,6 +59,51 @@ bool msm_audio_effects_is_effmodule_supp_in_top(int effect_module,
	}
}

int msm_audio_effects_enable_extn(struct audio_client *ac,
				struct msm_nt_eff_all_config *effects,
				bool flag)
{
	uint32_t updt_params[MAX_ENABLE_CMD_SIZE] = {0};
	uint32_t params_length;
	int rc = 0;

	pr_debug("%s\n", __func__);
	if (!ac) {
		pr_err("%s: cannot set audio effects\n", __func__);
		return -EINVAL;
	}
	params_length = 0;
	updt_params[0] = AUDPROC_MODULE_ID_VIRTUALIZER;
	updt_params[1] = AUDPROC_PARAM_ID_ENABLE;
	updt_params[2] = VIRTUALIZER_ENABLE_PARAM_SZ;
	updt_params[3] = flag;
	params_length += COMMAND_PAYLOAD_SZ + VIRTUALIZER_ENABLE_PARAM_SZ;
	if (effects->virtualizer.enable_flag)
		q6asm_send_audio_effects_params(ac, (char *)&updt_params[0],
					params_length);
	memset(updt_params, 0, MAX_ENABLE_CMD_SIZE);
	params_length = 0;
	updt_params[0] = AUDPROC_MODULE_ID_BASS_BOOST;
	updt_params[1] = AUDPROC_PARAM_ID_ENABLE;
	updt_params[2] = BASS_BOOST_ENABLE_PARAM_SZ;
	updt_params[3] = flag;
	params_length += COMMAND_PAYLOAD_SZ + BASS_BOOST_ENABLE_PARAM_SZ;
	if (effects->bass_boost.enable_flag)
		q6asm_send_audio_effects_params(ac, (char *)&updt_params[0],
					params_length);
	memset(updt_params, 0, MAX_ENABLE_CMD_SIZE);
	params_length = 0;
	updt_params[0] = AUDPROC_MODULE_ID_POPLESS_EQUALIZER;
	updt_params[1] = AUDPROC_PARAM_ID_ENABLE;
	updt_params[2] = EQ_ENABLE_PARAM_SZ;
	updt_params[3] = flag;
	params_length += COMMAND_PAYLOAD_SZ + EQ_ENABLE_PARAM_SZ;
	if (effects->equalizer.enable_flag)
		q6asm_send_audio_effects_params(ac, (char *)&updt_params[0],
					params_length);
	return rc;
}

int msm_audio_effects_virtualizer_handler(struct audio_client *ac,
				struct virtualizer_params *virtualizer,
				long *values)
@@ -169,9 +217,11 @@ int msm_audio_effects_virtualizer_handler(struct audio_client *ac,
			break;
		}
	}
	if (params_length)
	if (params_length && !msm_dts_eagle_is_hpx_on())
		q6asm_send_audio_effects_params(ac, params,
						params_length);
	else
		pr_debug("%s: did not send pp params\n", __func__);
invalid_config:
	kfree(params);
	return rc;
@@ -495,9 +545,11 @@ int msm_audio_effects_reverb_handler(struct audio_client *ac,
			break;
		}
	}
	if (params_length)
	if (params_length && !msm_dts_eagle_is_hpx_on())
		q6asm_send_audio_effects_params(ac, params,
						params_length);
	else
		pr_debug("%s: did not send pp params\n", __func__);
invalid_config:
	kfree(params);
	return rc;
@@ -597,9 +649,11 @@ int msm_audio_effects_bass_boost_handler(struct audio_client *ac,
			break;
		}
	}
	if (params_length)
	if (params_length && !msm_dts_eagle_is_hpx_on())
		q6asm_send_audio_effects_params(ac, params,
						params_length);
	else
		pr_debug("%s: did not send pp params\n", __func__);
invalid_config:
	kfree(params);
	return rc;
@@ -778,9 +832,11 @@ int msm_audio_effects_popless_eq_handler(struct audio_client *ac,
			break;
		}
	}
	if (params_length)
	if (params_length && !msm_dts_eagle_is_hpx_on())
		q6asm_send_audio_effects_params(ac, params,
						params_length);
	else
		pr_debug("%s: did not send pp params\n", __func__);
invalid_config:
	kfree(params);
	return rc;
Loading