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

Commit 9a0665c8 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: qdsp6v2: Vote for BMS power state during voice call"

parents 1c09fddf 7800cab9
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -64,6 +64,8 @@ Required properties:
 - compatible : "qcom,msm-pcm-voice"
 - qcom,destroy-cvd : Flag indicating whether to destroy cvd at
                      the end of call for low memory targets
 - qcom,vote-bms : Flag indicating whether to vote for BMS during
                   the call start and stop

* msm-voice-host-pcm

@@ -322,6 +324,11 @@ Example:
		qcom,destroy-cvd;
	};

	qcom,msm-pcm-voice {
		compatible = "qcom,msm-pcm-voice";
		qcom,vote-bms;
	};

        qcom,msm-voice-host-pcm {
                compatible = "qcom,msm-voice-host-pcm";
        };
+6 −1
Original line number Diff line number Diff line
@@ -587,7 +587,9 @@ static int msm_pcm_probe(struct platform_device *pdev)
{
	int rc;
	bool destroy_cvd = false;
	bool vote_bms = false;
	const char *is_destroy_cvd = "qcom,destroy-cvd";
	const char *is_vote_bms = "qcom,vote-bms";

	if (!is_voc_initialized()) {
		pr_debug("%s: voice module not initialized yet, deferring probe()\n",
@@ -616,7 +618,10 @@ static int msm_pcm_probe(struct platform_device *pdev)
						is_destroy_cvd);
	voc_set_destroy_cvd_flag(destroy_cvd);

	pr_debug("%s: dev name %s\n", __func__, dev_name(&pdev->dev));
	vote_bms = of_property_read_bool(pdev->dev.of_node,
					 is_vote_bms);
	voc_set_vote_bms_flag(vote_bms);

	rc = snd_soc_register_platform(&pdev->dev,
				       &msm_soc_platform);

+40 −0
Original line number Diff line number Diff line
@@ -89,6 +89,7 @@ static int voice_alloc_oob_mem_table(void);
static int voice_alloc_and_map_oob_mem(struct voice_data *v);
static int voc_disable_cvp(uint32_t session_id);
static int voc_enable_cvp(uint32_t session_id);
static void voice_vote_powerstate_to_bms(struct voice_data *v, bool state);

static struct voice_data *voice_get_session_by_idx(int idx);

@@ -1395,6 +1396,30 @@ static int voice_send_dtmf_rx_detection_cmd(struct voice_data *v,
	return ret;
}

static void voice_vote_powerstate_to_bms(struct voice_data *v, bool state)
{

	if (!v->psy)
		v->psy = power_supply_get_by_name("bms");
	if (v->psy && !(is_voip_session(v->session_id) ||
			is_vowlan_session(v->session_id))) {
		if (state) {
			power_supply_set_hi_power_state(v->psy,
				VMBMS_VOICE_CALL_BIT);
			pr_debug("%s : Vote High power to BMS\n",
				__func__);
		} else {
			power_supply_set_low_power_state(v->psy,
				VMBMS_VOICE_CALL_BIT);
			pr_debug("%s: Vote low power to BMS\n",
				__func__);
		}
	} else {
		pr_debug("%s: No OP", __func__);
	}

}

void voc_disable_dtmf_det_on_active_sessions(void)
{
	struct voice_data *v = NULL;
@@ -1439,6 +1464,12 @@ void voc_set_destroy_cvd_flag(bool is_destroy_cvd)
	common.is_destroy_cvd = is_destroy_cvd;
}

void voc_set_vote_bms_flag(bool is_vote_bms)
{
	pr_debug("%s: flag value: %d\n", __func__, is_vote_bms);
	common.is_vote_bms = is_vote_bms;
}

int voc_alloc_cal_shared_memory(void)
{
	int rc = 0;
@@ -1852,6 +1883,11 @@ static int voice_send_start_voice_cmd(struct voice_data *v)
	if (!ret) {
		pr_err("%s: wait_event timeout\n", __func__);
		goto fail;
	} else {
		if (common.is_vote_bms) {
			/* vote high power to BMS during call start */
			voice_vote_powerstate_to_bms(v, true);
		}
	}
	return 0;
fail:
@@ -5018,6 +5054,10 @@ int voc_end_voice_call(uint32_t session_id)

		voice_destroy_mvm_cvs_session(v);
		v->voc_state = VOC_RELEASE;
		if (common.is_vote_bms) {
			/* vote low power to BMS during call stop */
			voice_vote_powerstate_to_bms(v, false);
		}
	} else {
		pr_err("%s: Error: End voice called in state %d\n",
			__func__, v->voc_state);
+6 −0
Original line number Diff line number Diff line
@@ -16,6 +16,8 @@
#include <linux/qdsp6v2/rtac.h>
#include <linux/msm_ion.h>
#include <sound/voice_params.h>
#include <linux/power_supply.h>
#include <uapi/linux/vm_bms.h>

#define MAX_VOC_PKT_SIZE 642
#define SESSION_NAME_LEN 20
@@ -1442,6 +1444,8 @@ struct voice_data {
	struct incall_music_info music_info;

	struct voice_rec_route_state rec_route_state;

	struct power_supply *psy;
};

struct cal_mem {
@@ -1494,6 +1498,7 @@ struct common_data {

	bool srvcc_rec_flag;
	bool is_destroy_cvd;
	bool is_vote_bms;
};

struct voice_session_itr {
@@ -1621,6 +1626,7 @@ int voc_update_amr_vocoder_rate(uint32_t session_id);
int voc_disable_device(uint32_t session_id);
int voc_enable_device(uint32_t session_id);
void voc_set_destroy_cvd_flag(bool is_destroy_cvd);
void voc_set_vote_bms_flag(bool is_vote_bms);
int voc_disable_topology(uint32_t session_id, uint32_t disable);

uint32_t voice_get_topology(uint32_t topology_idx);