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

Commit 2b822911 authored by Jitendra Naruka's avatar Jitendra Naruka Committed by Alexy Joseph
Browse files

ASoC: msm: Integrate Eagle framework to support HeadphoneX 1.1



Add support to integrate the Eagle framework for DTS Headphone:X
audio post processing feature v1.1. Include DTS_EAGLE config for
8994 target to build the feature. It uses hwdep node to receive
required processing parameters from userspace.

Change-Id: I07cea22aa0324b0042353174a7c96e2b98a37b4b
Signed-off-by: default avatarJitendra Naruka <jitendra.naruka@dts.com>
[alexyj@codeaurora.org: fix inclusion of header file
 msm-dts-eagle.h in msm-dts-srs-tm-config.c, resolving
 trivial merge conflicts]
Signed-off-by: default avatarAlexy Joseph <alexyj@codeaurora.org>
parent 5e12b0d2
Loading
Loading
Loading
Loading
+13 −2
Original line number Diff line number Diff line
@@ -2493,8 +2493,7 @@ struct afe_lpass_core_shared_clk_config_command {
#define VPM_TX_DM_FLUENCE_COPP_TOPOLOGY			0x00010F72
#define VPM_TX_QMIC_FLUENCE_COPP_TOPOLOGY		0x00010F75
#define VPM_TX_DM_RFECNS_COPP_TOPOLOGY			0x00010F86
#define ADM_CMD_COPP_OPEN_TOPOLOGY_ID_DTS_HPX_0		0x00010347
#define ADM_CMD_COPP_OPEN_TOPOLOGY_ID_DTS_HPX_1		0x00010348
#define ADM_CMD_COPP_OPEN_TOPOLOGY_ID_DTS_HPX		0x11000002

/* Memory map regions command payload used by the
 * #ASM_CMD_SHARED_MEM_MAP_REGIONS ,#ADM_CMD_SHARED_MEM_MAP_REGIONS
@@ -7113,6 +7112,18 @@ struct asm_dts_eagle_param_get {
	struct asm_stream_cmd_get_pp_params_v2 param;
} __packed;

struct param_outband {
	size_t       size;
	void        *kvaddr;
	phys_addr_t  paddr;
};

/* size of header needed for passing data out of band */
#define CMD_OB_HDR_SZ  12

/* size of header needed for getting data */
#define CMD_GET_HDR_SZ 16

/* LSM Specific */
#define VW_FEAT_DIM					(39)

+143 −0
Original line number Diff line number Diff line
@@ -13,90 +13,131 @@
#ifndef __MSM_DTS_EAGLE_H__
#define __MSM_DTS_EAGLE_H__

struct snd_soc_pcm_runtime;
struct msm_pcm_routing_bdai_data;
struct snd_pcm;
struct audio_client;

struct param_outband {
	size_t       size;
	void        *kvaddr;
	phys_addr_t  paddr;
#include <linux/compat.h>
#include <sound/soc.h>
#include <sound/devdep_params.h>
#include <sound/q6asm-v2.h>

#ifdef CONFIG_COMPAT
enum {
	DTS_EAGLE_IOCTL_GET_CACHE_SIZE32 = _IOR(0xF2, 0, __s32),
	DTS_EAGLE_IOCTL_SET_CACHE_SIZE32 = _IOW(0xF2, 1, __s32),
	DTS_EAGLE_IOCTL_GET_PARAM32 = _IOR(0xF2, 2, compat_uptr_t),
	DTS_EAGLE_IOCTL_SET_PARAM32 = _IOW(0xF2, 3, compat_uptr_t),
	DTS_EAGLE_IOCTL_SET_CACHE_BLOCK32 =
				_IOW(0xF2, 4, compat_uptr_t),
	DTS_EAGLE_IOCTL_SET_ACTIVE_DEVICE32 =
				_IOW(0xF2, 5, compat_uptr_t),
	DTS_EAGLE_IOCTL_GET_LICENSE32 =
				_IOR(0xF2, 6, compat_uptr_t),
	DTS_EAGLE_IOCTL_SET_LICENSE32 =
				 _IOW(0xF2, 7, compat_uptr_t),
	DTS_EAGLE_IOCTL_SEND_LICENSE32 = _IOW(0xF2, 8, __s32),
	DTS_EAGLE_IOCTL_SET_VOLUME_COMMANDS32 = _IOW(0xF2, 9,
						     compat_uptr_t),
};
#endif

#ifdef CONFIG_DTS_EAGLE
void msm_dts_ion_memmap(struct param_outband *po);

int msm_dts_eagle_handler_pre(struct audio_client *ac, long *arg);

int msm_dts_eagle_set_volume(struct audio_client *ac, int lgain, int rgain);

void msm_dts_ion_memmap(struct param_outband *po_);
int msm_dts_eagle_enable_asm(struct audio_client *ac, u32 enable, int module);
int msm_dts_eagle_enable_adm(int port_id, int copp_idx, u32 enable);
void msm_dts_eagle_add_controls(struct snd_soc_platform *platform);
int msm_dts_eagle_set_stream_gain(struct audio_client *ac,
				  int lgain, int rgain);
int msm_dts_eagle_handle_asm(struct dts_eagle_param_desc *depd, char *buf,
			     bool for_pre, bool get, struct audio_client *ac,
			     struct param_outband *po);
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_init_post(int port_id, int copp_id, int topology);

int msm_dts_eagle_deinit_post(int port_id, int topology);

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);
int msm_dts_eagle_deinit_post(int port_id, int topology);
int msm_dts_eagle_init_master_module(struct audio_client *ac);
int msm_dts_eagle_deinit_master_module(struct audio_client *ac);
int msm_dts_eagle_pcm_new(struct snd_soc_pcm_runtime *runtime);

void msm_dts_eagle_pcm_free(struct snd_pcm *pcm);
int msm_dts_eagle_compat_ioctl(unsigned int cmd, unsigned long arg);
#else
static inline void msm_dts_ion_memmap(struct param_outband *po)
static inline void msm_dts_ion_memmap(struct param_outband *po_)
{
	pr_debug("%s\n", __func__);
}

static inline int msm_dts_eagle_handler_pre(struct audio_client *ac, long *arg)
static inline int msm_dts_eagle_enable_asm(struct audio_client *ac,
					   u32 enable, int module)
{
	pr_debug("%s\n", __func__);
	return -EFAULT;
	return 0;
}

static inline int msm_dts_eagle_set_volume(struct audio_client *ac,
					   int lgain, int rgain) {
static inline int msm_dts_eagle_enable_adm(int port_id, int copp_idx,
					   u32 enable)
{
	return 0;
}
static inline void msm_dts_eagle_add_controls(struct snd_soc_platform *platform)
{
}
static inline int msm_dts_eagle_set_stream_gain(struct audio_client *ac,
						int lgain, int rgain)
{
	pr_debug("%s\n", __func__);
	return 0;
}

static inline int msm_dts_eagle_handle_asm(struct dts_eagle_param_desc *depd,
					   char *buf, bool for_pre, bool get,
					   struct audio_client *ac,
					   struct param_outband *po)
{
	return 0;
}
static inline int msm_dts_eagle_handle_adm(struct dts_eagle_param_desc *depd,
					   char *buf, bool for_pre, bool get)
{
	return 0;
}
static inline int msm_dts_eagle_ioctl(unsigned int cmd, unsigned long arg)
{
	return -EPERM;
}

static inline int msm_dts_eagle_init_post(int port_id, int coppid, int topology)
static inline int msm_dts_eagle_init_pre(struct audio_client *ac)
{
	return 0;
}
static inline int msm_dts_eagle_deinit_pre(struct audio_client *ac)
{
	return 0;
}
static inline int msm_dts_eagle_init_post(int port_id, int coppid)
{
	return 0;
}

static inline int msm_dts_eagle_deinit_post(int port_id, int topology)
{
	return 0;
}

static inline int msm_dts_eagle_init_pre(struct audio_client *ac)
static inline int msm_dts_eagle_init_master_module(struct audio_client *ac)
{
	return 0;
}

static inline int msm_dts_eagle_deinit_pre(struct audio_client *ac)
static inline int msm_dts_eagle_deinit_master_module(struct audio_client *ac)
{
	return 0;
}

static inline int msm_dts_eagle_pcm_new(struct snd_soc_pcm_runtime *runtime)
{
	pr_debug("%s\n", __func__);
	return 0;
}

static inline void msm_dts_eagle_pcm_free(struct snd_pcm *pcm)
{
	pr_debug("%s\n", __func__);
}
static inline int msm_dts_eagle_compat_ioctl(unsigned int cmd,
					unsigned long arg)
{
	return 0;
}
#endif

#endif
+5 −3
Original line number Diff line number Diff line
@@ -400,10 +400,12 @@ int q6asm_set_volume(struct audio_client *ac, int volume);
/* Send Volume Command */
int q6asm_set_volume_v2(struct audio_client *ac, int volume, int instance);

/* DTS Eagle Params */
int q6asm_dts_eagle_set(struct audio_client *ac, int param_id, int size,
			void *data);
int q6asm_dts_eagle_get(struct audio_client *ac, int param_id,
			int size, void *data);
			void *data, struct param_outband *po, int m_id);
int q6asm_dts_eagle_get(struct audio_client *ac, int param_id, int size,
			void *data, struct param_outband *po, int m_id);

/* Set SoftPause Params */
int q6asm_set_softpause(struct audio_client *ac,
			struct asm_softpause_params *param);
+0 −20
Original line number Diff line number Diff line
@@ -133,26 +133,6 @@
#define EQ_BAND_BOOST	5
#define EQ_BAND_CUT	6

#define DTS_EAGLE_MODULE		0x00005000
#define EAGLE_DRIVER_ID 0xF2
#define DTS_EAGLE_IOCTL_GET_CACHE_SIZE _IOR(EAGLE_DRIVER_ID, 0, int)
#define DTS_EAGLE_IOCTL_SET_CACHE_SIZE _IOW(EAGLE_DRIVER_ID, 1, int)
#define DTS_EAGLE_IOCTL_GET_PARAM _IOR(EAGLE_DRIVER_ID, 2, void*)
#define DTS_EAGLE_IOCTL_SET_PARAM _IOW(EAGLE_DRIVER_ID, 3, void*)
#define DTS_EAGLE_IOCTL_SET_CACHE_BLOCK _IOW(EAGLE_DRIVER_ID, 4, void*)
#define DTS_EAGLE_IOCTL_SET_ACTIVE_DEVICE _IOW(EAGLE_DRIVER_ID, 5, void*)
#define DTS_EAGLE_IOCTL_GET_LICENSE _IOR(EAGLE_DRIVER_ID, 6, void*)
#define DTS_EAGLE_IOCTL_SET_LICENSE _IOW(EAGLE_DRIVER_ID, 7, void*)
#define DTS_EAGLE_IOCTL_SEND_LICENSE _IOW(EAGLE_DRIVER_ID, 8, int)
#define DTS_EAGLE_IOCTL_SET_VOLUME_COMMANDS _IOW(EAGLE_DRIVER_ID, 9, void*)

struct dts_eagle_param_desc {
	__u32 id;
	__s32 size;
	__s32 offset;
	__u32 device;
} __packed;

#define SOFT_VOLUME_MODULE		0x00006000
#define SOFT_VOLUME_ENABLE		0x00006001
#define SOFT_VOLUME_GAIN_2CH		0x00006002
+28 −0
Original line number Diff line number Diff line
@@ -38,4 +38,32 @@ struct dolby_param_license {
		_IOWR('U', 0x14, struct dolby_param_license)
#define SNDRV_DEVDEP_DAP_IOCTL_GET_VISUALIZER\
		_IOR('U', 0x15, struct dolby_param_data)

#define DTS_EAGLE_MODULE			0x00005000
#define DTS_EAGLE_MODULE_ENABLE			0x00005001
#define EAGLE_DRIVER_ID				0xF2
#define DTS_EAGLE_IOCTL_GET_CACHE_SIZE		_IOR(EAGLE_DRIVER_ID, 0, int)
#define DTS_EAGLE_IOCTL_SET_CACHE_SIZE		_IOW(EAGLE_DRIVER_ID, 1, int)
#define DTS_EAGLE_IOCTL_GET_PARAM		_IOR(EAGLE_DRIVER_ID, 2, void*)
#define DTS_EAGLE_IOCTL_SET_PARAM		_IOW(EAGLE_DRIVER_ID, 3, void*)
#define DTS_EAGLE_IOCTL_SET_CACHE_BLOCK		_IOW(EAGLE_DRIVER_ID, 4, void*)
#define DTS_EAGLE_IOCTL_SET_ACTIVE_DEVICE	_IOW(EAGLE_DRIVER_ID, 5, void*)
#define DTS_EAGLE_IOCTL_GET_LICENSE		_IOR(EAGLE_DRIVER_ID, 6, void*)
#define DTS_EAGLE_IOCTL_SET_LICENSE		_IOW(EAGLE_DRIVER_ID, 7, void*)
#define DTS_EAGLE_IOCTL_SEND_LICENSE		_IOW(EAGLE_DRIVER_ID, 8, int)
#define DTS_EAGLE_IOCTL_SET_VOLUME_COMMANDS	_IOW(EAGLE_DRIVER_ID, 9, void*)
#define DTS_EAGLE_FLAG_IOCTL_PRE		(1<<30)
#define DTS_EAGLE_FLAG_IOCTL_JUSTSETCACHE	(1<<31)
#define DTS_EAGLE_FLAG_IOCTL_GETFROMCORE       DTS_EAGLE_FLAG_IOCTL_JUSTSETCACHE
#define DTS_EAGLE_FLAG_IOCTL_MASK		(~(DTS_EAGLE_FLAG_IOCTL_PRE | \
					     DTS_EAGLE_FLAG_IOCTL_JUSTSETCACHE))
#define DTS_EAGLE_FLAG_ALSA_GET			(1<<31)

struct dts_eagle_param_desc {
	uint32_t id;
	int32_t size;
	int32_t offset;
	uint32_t device;
} __packed;

#endif
Loading