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

Commit 1d499148 authored by qctecmdr's avatar qctecmdr Committed by Gerrit - the friendly Code Review server
Browse files

Merge "ASoC: Add support to send voice UI port id to afe"

parents 6a7576ab 98afffc2
Loading
Loading
Loading
Loading

asoc/msm-pcm-routing-v2.c

100755 → 100644
+6 −0
Original line number Diff line number Diff line
@@ -3243,6 +3243,7 @@ static int msm_routing_lsm_port_put(struct snd_kcontrol *kcontrol,
	struct soc_enum *e = (struct soc_enum *)kcontrol->private_value;
	int mux = ucontrol->value.enumerated.item[0];
	int lsm_port = AFE_PORT_ID_SLIMBUS_MULTI_CHAN_5_TX;
	int lsm_port_idx = 0;
	u8 fe_idx = 0;
	if (mux >= e->items) {
@@ -3252,6 +3253,7 @@ static int msm_routing_lsm_port_put(struct snd_kcontrol *kcontrol,
	pr_debug("%s: LSM enable %ld\n", __func__,
			ucontrol->value.integer.value[0]);
	lsm_port_idx = ucontrol->value.integer.value[0];
	switch (ucontrol->value.integer.value[0]) {
	case 1:
		lsm_port = AFE_PORT_ID_SLIMBUS_MULTI_CHAN_0_TX;
@@ -3308,6 +3310,10 @@ static int msm_routing_lsm_port_put(struct snd_kcontrol *kcontrol,
	set_lsm_port(lsm_port);
	msm_routing_get_lsm_fe_idx(kcontrol, &fe_idx);
	lsm_port_index[fe_idx] = ucontrol->value.integer.value[0];
        /* Set the default AFE LSM Port to 0xffff */
	if(lsm_port_idx <= 0 || lsm_port_idx >= ARRAY_SIZE(lsm_port_text))
		lsm_port = 0xffff;
	afe_set_lsm_afe_port_id(fe_idx, lsm_port);
	return 0;
}
+34 −3
Original line number Diff line number Diff line
@@ -28,6 +28,7 @@
#define AFE_NOWAIT_TOKEN	2048

#define SP_V4_NUM_MAX_SPKRS SP_V2_NUM_MAX_SPKRS
#define MAX_LSM_SESSIONS 8

struct afe_avcs_payload_port_mapping {
	u16 port_id;
@@ -262,6 +263,7 @@ struct afe_ctl {
	uint32_t num_spkrs;
	uint32_t cps_ch_mask;
	struct afe_cps_hw_intf_cfg *cps_config;
	int lsm_afe_ports[MAX_LSM_SESSIONS];
};

struct afe_clkinfo_per_port {
@@ -349,6 +351,7 @@ static bool proxy_afe_started = false;
		(sizeof(struct apr_hdr) + sizeof(u16) + (sizeof(struct y)))

static bool is_afe_proxy_port(int port_id);
static bool q6afe_is_afe_lsm_port(int port_id);

static void q6afe_unload_avcs_modules(u16 port_id, int index)
{
@@ -3211,7 +3214,7 @@ static int afe_send_port_topology_id(u16 port_id)
	}

	ret = afe_get_cal_topology_id(port_id, &topology_id, AFE_TOPOLOGY_CAL);
	if (ret < 0) {
	if (ret < 0 && q6afe_is_afe_lsm_port(port_id)) {
		pr_debug("%s: Check for LSM topology\n", __func__);
		ret = afe_get_cal_topology_id(port_id, &topology_id,
					      AFE_LSM_TOPOLOGY_CAL);
@@ -3664,7 +3667,7 @@ void afe_send_cal(u16 port_id)
	if (afe_get_port_type(port_id) == MSM_AFE_PORT_TYPE_TX) {
		afe_send_cal_spkr_prot_tx(port_id);
		ret = send_afe_cal_type(AFE_COMMON_TX_CAL, port_id);
		if (ret < 0)
		if (ret < 0 && q6afe_is_afe_lsm_port(port_id))
			send_afe_cal_type(AFE_LSM_TX_CAL, port_id);
	} else if (afe_get_port_type(port_id) == MSM_AFE_PORT_TYPE_RX) {
		send_afe_cal_type(AFE_COMMON_RX_CAL, port_id);
@@ -11382,7 +11385,8 @@ int __init afe_init(void)
	wl.ws = wakeup_source_register(NULL, "spkr-prot");
	if (!wl.ws)
		return -ENOMEM;

	for (i = 0; i < MAX_LSM_SESSIONS; i++)
		this_afe.lsm_afe_ports[i] = 0xffff;
	ret = afe_init_cal_data();
	if (ret)
		pr_err("%s: could not init cal data! %d\n", __func__, ret);
@@ -11619,3 +11623,30 @@ void afe_set_cps_config(int src_port,
	this_afe.cps_config = cps_config;
}
EXPORT_SYMBOL(afe_set_cps_config);

static bool q6afe_is_afe_lsm_port(int port_id)
{
	int i = 0;

	for (i = 0; i < MAX_LSM_SESSIONS; i++) {
		if (port_id == this_afe.lsm_afe_ports[i])
			return true;
	}
	return false;
}

/**
 * afe_set_lsm_afe_port_id -
 *            Update LSM AFE port
 * idx: LSM port index
 * lsm_port: LSM port id
*/
void afe_set_lsm_afe_port_id(int idx, int lsm_port)
{
	if (idx < 0 || idx >= MAX_LSM_SESSIONS) {
		pr_err("%s: %d Invalid lsm port index\n", __func__, idx);
		return;
	}
	this_afe.lsm_afe_ports[idx] = lsm_port;
}
EXPORT_SYMBOL(afe_set_lsm_afe_port_id);
+1 −0
Original line number Diff line number Diff line
@@ -535,6 +535,7 @@ int afe_get_doa_tracking_mon(u16 port_id,
int afe_set_pll_clk_drift(u16 port_id, int32_t set_clk_drift,
			  uint32_t clk_reset);
int afe_set_clk_id(u16 port_id, uint32_t clk_id);
void afe_set_lsm_afe_port_id(int idx, int lsm_port);

enum {
	AFE_LPASS_CORE_HW_BLOCK_ID_NONE,