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

Commit 41922568 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: enable listen LAB feature"

parents d3e1fc74 d22ed8c0
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -6950,9 +6950,13 @@ struct asm_dts_eagle_param_get {
#define LSM_SESSION_CMD_DEREGISTER_SOUND_MODEL		(0x00012A85)
#define LSM_SESSION_CMD_START				(0x00012A86)
#define LSM_SESSION_CMD_STOP				(0x00012A87)
#define LSM_SESSION_CMD_EOB				(0x00012A89)
#define LSM_SESSION_CMD_READ				(0x00012A8A)

#define LSM_SESSION_EVENT_DETECTION_STATUS		(0x00012B00)
#define LSM_SESSION_EVENT_DETECTION_STATUS_V2		(0x00012B01)
#define LSM_DATA_EVENT_READ_DONE			(0x00012B02)
#define LSM_DATA_EVENT_STATUS				(0x00012B03)

#define LSM_MODULE_ID_VOICE_WAKEUP			(0x00012C00)
#define LSM_PARAM_ID_ENDPOINT_DETECT_THRESHOLD		(0x00012C01)
@@ -6963,6 +6967,9 @@ struct asm_dts_eagle_param_get {
#define LSM_PARAM_ID_USER_DETECT_SENSITIVITY		(0x00012C06)
#define LSM_PARAM_ID_FEATURE_COMPENSATION_DATA		(0x00012C07)
#define LSM_PARAM_ID_MIN_CONFIDENCE_LEVELS		(0x00012C07)
#define LSM_MODULE_ID_LAB				(0x00012C08)
#define LSM_PARAM_ID_LAB_ENABLE				(0x00012C09)
#define LSM_PARAM_ID_LAB_CONFIG				(0x00012C0A)

/* HW MAD specific */
#define AFE_MODULE_HW_MAD				(0x00010230)
+1 −1
Original line number Diff line number Diff line
@@ -53,7 +53,7 @@ struct wcd_cpe_lab_hw_params {
};

struct wcd_cpe_lsm_lab {
	bool lab_enable;
	u32 lab_enable;
	void *slim_handle;
	void *core_handle;
	atomic_t in_count;
+76 −0
Original line number Diff line number Diff line
@@ -45,6 +45,22 @@ struct snd_lsm_event_status_v2 {
	uint8_t  confidence_value[0];
};

struct lsm_lab_buffer {
	dma_addr_t phys;
	void *data;
	size_t size;
	struct ion_handle *handle;
	struct ion_client *client;
	uint32_t mem_map_handle;
};

struct lsm_lab_hw_params {
	u16 sample_rate;
	u16 sample_size;
	u32 buf_sz;
	u32 period_count;
};

struct lsm_client {
	enum lsm_snd_model_in_use snd_model_ver_inuse;
	int		session;
@@ -66,6 +82,10 @@ struct lsm_client {
	dma_addr_t	lsm_cal_phy_addr;
	uint32_t	lsm_cal_size;
	uint16_t	app_id;
	bool		lab_enable;
	bool		lab_started;
	struct lsm_lab_buffer *lab_buffer;
	struct lsm_lab_hw_params hw_params;
};

struct lsm_stream_cmd_open_tx {
@@ -168,6 +188,58 @@ struct lsm_cmd_reg_snd_model {
	uint32_t	mem_map_handle;
} __packed;

struct lsm_lab_enable {
	struct lsm_param_payload_common common;
	uint16_t enable;
	uint16_t reserved;
} __packed;

struct lsm_params_lab_enable {
	struct apr_hdr  hdr;
	uint32_t	data_payload_size;
	uint32_t	data_payload_addr_lsw;
	uint32_t	data_payload_addr_msw;
	uint32_t	mem_map_handle;
	struct lsm_lab_enable lab_enable;
} __packed;

struct lsm_lab_config {
	struct lsm_param_payload_common common;
	uint32_t minor_version;
	uint32_t wake_up_latency_ms;
} __packed;


struct lsm_params_lab_config {
	struct apr_hdr  hdr;
	uint32_t	data_payload_size;
	uint32_t	data_payload_addr_lsw;
	uint32_t	data_payload_addr_msw;
	uint32_t	mem_map_handle;
	struct lsm_lab_config lab_config;
} __packed;

struct lsm_cmd_read {
	struct apr_hdr hdr;
	uint32_t buf_addr_lsw;
	uint32_t buf_addr_msw;
	uint32_t mem_map_handle;
	uint32_t buf_size;
} __packed;

struct lsm_cmd_read_done {
	struct apr_hdr hdr;
	uint32_t status;
	uint32_t buf_addr_lsw;
	uint32_t buf_addr_msw;
	uint32_t mem_map_handle;
	uint32_t total_size;
	uint32_t offset;
	uint32_t timestamp_lsw;
	uint32_t timestamp_msw;
	uint32_t flags;
} __packed;

struct lsm_client *q6lsm_client_alloc(lsm_app_cb cb, void *priv);
void q6lsm_client_free(struct lsm_client *client);
int q6lsm_open(struct lsm_client *client, uint16_t app_id);
@@ -184,4 +256,8 @@ int q6lsm_set_kw_sensitivity_level(struct lsm_client *client,
				u16 minkeyword, u16 minuser);
void set_lsm_port(int);
int get_lsm_port(void);
int q6lsm_lab_control(struct lsm_client *client, u32 enable);
int q6lsm_stop_lab(struct lsm_client *client);
int q6lsm_read(struct lsm_client *client, struct lsm_cmd_read *read);
int q6lsm_lab_buffer_alloc(struct lsm_client *client, bool alloc);
#endif /* __Q6LSM_H__ */
+1 −1
Original line number Diff line number Diff line
@@ -60,7 +60,7 @@ struct snd_lsm_event_status {
#define SNDRV_LSM_SET_SESSION_DATA _IOW('U', 0x06, struct snd_lsm_session_data)
#define SNDRV_LSM_REG_SND_MODEL_V2 _IOW('U', 0x07,\
					struct snd_lsm_sound_model_v2)
#define SNDRV_LSM_LAB_CONTROL	_IOW('U', 0x08, bool)
#define SNDRV_LSM_LAB_CONTROL	_IOW('U', 0x08, uint32_t)
#define SNDRV_LSM_STOP_LAB	_IO('U', 0x09)

#endif
+7 −7
Original line number Diff line number Diff line
@@ -544,7 +544,7 @@ static int msm_cpe_lsm_ioctl(struct snd_pcm_substream *substream,

	switch (cmd) {
	case SNDRV_LSM_STOP_LAB:
		if (lab_sess->lab_enable == true &&
		if (lab_sess->lab_enable &&
			lab_sess->thread_status != MSM_LSM_LAB_THREAD_STOP) {
			rc = 1;
			atomic_inc(&lab_sess->abort_read);
@@ -563,14 +563,14 @@ static int msm_cpe_lsm_ioctl(struct snd_pcm_substream *substream,
	break;
	case SNDRV_LSM_LAB_CONTROL:
		if (copy_from_user(&lab_sess->lab_enable, (void *)arg,
				   sizeof(bool))) {
				   sizeof(u32))) {
			dev_err(rtd->dev,
				"%s: copy from user failed, size %zd\n",
				__func__,
				sizeof(int));
				sizeof(u32));
			return -EFAULT;
		}
		if (lab_sess->lab_enable == true) {
		if (lab_sess->lab_enable) {
			rc = lsm_ops->lsm_lab_control(cpe->core_handle,
					session,
					lab_sess->hw_params.buf_sz,
@@ -692,7 +692,7 @@ static int msm_cpe_lsm_ioctl(struct snd_pcm_substream *substream,
		break;

	case SNDRV_LSM_DEREG_SND_MODEL:
		if (lab_sess->lab_enable == true) {
		if (lab_sess->lab_enable) {
			rc = lsm_ops->lsm_lab_control(cpe->core_handle,
					session, lab_sess->hw_params.buf_sz,
					lab_sess->hw_params.period_count,
@@ -779,7 +779,7 @@ static int msm_cpe_lsm_ioctl(struct snd_pcm_substream *substream,
					kfree(event_status);
					return -EFAULT;
				}
				if (lab_sess->lab_enable == true &&
				if (lab_sess->lab_enable &&
					event_status->status ==
					LSM_VOICE_WAKEUP_STATUS_DETECTED) {
					atomic_set(&lab_sess->abort_read, 0);
@@ -819,7 +819,7 @@ static int msm_cpe_lsm_ioctl(struct snd_pcm_substream *substream,
		break;

	case SNDRV_LSM_STOP:
		if ((lab_sess->lab_enable == true &&
		if ((lab_sess->lab_enable &&
		     lab_sess->thread_status ==
		     MSM_LSM_LAB_THREAD_RUNNING)) {
			pr_err("%s:session could not be stopped,disable lab\n"
Loading