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

Commit b2dba212 authored by Ashish Jain's avatar Ashish Jain Committed by Surendar karka
Browse files

ASoC: msm: qdsp6v2: add support for latest version of media format command



Add support for ASM_MEDIA_FMT_MULTI_CHANNEL_PCM_V4
command. This command adds support to playback/record 32 bit data
in 32 bit word and also provides a way to inform DSP about the
endianness of the data.

CRs-Fixed: 2129947
Change-Id: I3b013bedde8ccfa97a02e255e237df0cf2de13b8
Signed-off-by: default avatarAshish Jain <ashishj@codeaurora.org>
parent 77afcc9b
Loading
Loading
Loading
Loading
+135 −0
Original line number Diff line number Diff line
@@ -3391,6 +3391,8 @@ struct asm_softvolume_params {

#define ASM_MEDIA_FMT_MULTI_CHANNEL_PCM_V3 0x00010DDC

#define ASM_MEDIA_FMT_MULTI_CHANNEL_PCM_V4 0x0001320C

#define ASM_MEDIA_FMT_EVRCB_FS 0x00010BEF

#define ASM_MEDIA_FMT_EVRCWB_FS 0x00010BF0
@@ -3493,6 +3495,56 @@ struct asm_multi_channel_pcm_fmt_blk_v3 {
 */
} __packed;

struct asm_multi_channel_pcm_fmt_blk_v4 {
	uint16_t                num_channels;
/*
 * Number of channels
 * Supported values: 1 to 8
 */

	uint16_t                bits_per_sample;
/*
 * Number of bits per sample per channel
 * Supported values: 16, 24, 32
 */

	uint32_t                sample_rate;
/*
 * Number of samples per second
 * Supported values: 2000 to 48000, 96000,192000 Hz
 */

	uint16_t                is_signed;
/* Flag that indicates that PCM samples are signed (1) */

	uint16_t                sample_word_size;
/*
 * Size in bits of the word that holds a sample of a channel.
 * Supported values: 12,24,32
 */

	uint8_t                 channel_mapping[8];
/*
 * Each element, i, in the array describes channel i inside the buffer where
 * 0 <= i < num_channels. Unused channels are set to 0.
 */
	uint16_t                endianness;
/*
 * Flag to indicate the endianness of the pcm sample
 * Supported values: 0 - Little endian (all other formats)
 *                   1 - Big endian (AIFF)
 */
	uint16_t                mode;
/*
 * Mode to provide additional info about the pcm input data.
 * Supported values: 0 - Default QFs (Q15 for 16b, Q23 for packed 24b,
 *                       Q31 for unpacked 24b or 32b)
 *                  15 - for 16 bit
 *                  23 - for 24b packed or 8.24 format
 *                  31 - for 24b unpacked or 32bit
 */
} __packed;

/*
 * Payload of the multichannel PCM configuration parameters in
 * the ASM_MEDIA_FMT_MULTI_CHANNEL_PCM_V3 media format.
@@ -3503,6 +3555,16 @@ struct asm_multi_channel_pcm_fmt_blk_param_v3 {
	struct asm_multi_channel_pcm_fmt_blk_v3 param;
} __packed;

/*
 * Payload of the multichannel PCM configuration parameters in
 * the ASM_MEDIA_FMT_MULTI_CHANNEL_PCM_V4 media format.
 */
struct asm_multi_channel_pcm_fmt_blk_param_v4 {
	struct apr_hdr hdr;
	struct asm_data_cmd_media_fmt_update_v2 fmt_blk;
	struct asm_multi_channel_pcm_fmt_blk_v4 param;
} __packed;

struct asm_stream_cmd_set_encdec_param {
	u32                  param_id;
	/* ID of the parameter. */
@@ -3538,6 +3600,79 @@ struct asm_dec_ddp_endp_param_v2 {
	int endp_param_value;
} __packed;

/*
 * Payload of the multichannel PCM encoder configuration parameters in
 * the ASM_MEDIA_FMT_MULTI_CHANNEL_PCM_V4 media format.
 */

struct asm_multi_channel_pcm_enc_cfg_v4 {
	struct apr_hdr hdr;
	struct asm_stream_cmd_set_encdec_param encdec;
	struct asm_enc_cfg_blk_param_v2 encblk;
	uint16_t num_channels;
	/*
	 * Number of PCM channels.
	 * @values
	 * - 0 -- Native mode
	 * - 1 -- 8 channels
	 * Native mode indicates that encoding must be performed with the number
	 * of channels at the input.
	 */
	uint16_t  bits_per_sample;
	/*
	 * Number of bits per sample per channel.
	 * @values 16, 24
	 */
	uint32_t  sample_rate;
	/*
	 * Number of samples per second.
	 * @values 0, 8000 to 48000 Hz
	 * A value of 0 indicates the native sampling rate. Encoding is
	 * performed at the input sampling rate.
	 */
	uint16_t  is_signed;
	/*
	 * Flag that indicates the PCM samples are signed (1). Currently, only
	 * signed PCM samples are supported.
	 */
	uint16_t    sample_word_size;
	/*
	 * The size in bits of the word that holds a sample of a channel.
	 * @values 16, 24, 32
	 * 16-bit samples are always placed in 16-bit words:
	 * sample_word_size = 1.
	 * 24-bit samples can be placed in 32-bit words or in consecutive
	 * 24-bit words.
	 * - If sample_word_size = 32, 24-bit samples are placed in the
	 * most significant 24 bits of a 32-bit word.
	 * - If sample_word_size = 24, 24-bit samples are placed in
	 * 24-bit words. @tablebulletend
	 */
	uint8_t   channel_mapping[8];
	/*
	 * Channel mapping array expected at the encoder output.
	 *  Channel[i] mapping describes channel i inside the buffer, where
	 *  0 @le i < num_channels. All valid used channels must be present at
	 *  the beginning of the array.
	 * If Native mode is set for the channels, this field is ignored.
	 * @values See Section @xref{dox:PcmChannelDefs}
	 */
	uint16_t                endianness;
	/*
	 * Flag to indicate the endianness of the pcm sample
	 * Supported values: 0 - Little endian (all other formats)
	 *                   1 - Big endian (AIFF)
	 */
	uint16_t                mode;
	/*
	 * Mode to provide additional info about the pcm input data.
	 * Supported values: 0 - Default QFs (Q15 for 16b, Q23 for packed 24b,
	 *                       Q31 for unpacked 24b or 32b)
	 *                  15 - for 16 bit
	 *                  23 - for 24b packed or 8.24 format
	 *                  31 - for 24b unpacked or 32bit
	 */
} __packed;

/*
 * Payload of the multichannel PCM encoder configuration parameters in
+59 −0
Original line number Diff line number Diff line
@@ -103,6 +103,24 @@
#define ASM_SHIFT_GAPLESS_MODE_FLAG	31
#define ASM_SHIFT_LAST_BUFFER_FLAG	30

#define ASM_LITTLE_ENDIAN 0
#define ASM_BIG_ENDIAN 1

/* PCM_MEDIA_FORMAT_Version */
enum {
	PCM_MEDIA_FORMAT_V2 = 0,
	PCM_MEDIA_FORMAT_V3,
	PCM_MEDIA_FORMAT_V4,
};

/* PCM format modes in DSP */
enum {
	DEFAULT_QF = 0,
	Q15 = 15,
	Q23 = 23,
	Q31 = 31,
};

/* payload structure bytes */
#define READDONE_IDX_STATUS 0
#define READDONE_IDX_BUFADD_LSW 1
@@ -270,6 +288,9 @@ int q6asm_open_shared_io(struct audio_client *ac,
int q6asm_open_write_v3(struct audio_client *ac, uint32_t format,
			uint16_t bits_per_sample);

int q6asm_open_write_v4(struct audio_client *ac, uint32_t format,
			uint16_t bits_per_sample);

int q6asm_stream_open_write_v2(struct audio_client *ac, uint32_t format,
			       uint16_t bits_per_sample, int32_t stream_id,
			       bool is_gapless_mode);
@@ -278,6 +299,10 @@ int q6asm_stream_open_write_v3(struct audio_client *ac, uint32_t format,
			       uint16_t bits_per_sample, int32_t stream_id,
			       bool is_gapless_mode);

int q6asm_stream_open_write_v4(struct audio_client *ac, uint32_t format,
			       uint16_t bits_per_sample, int32_t stream_id,
			       bool is_gapless_mode);

int q6asm_open_write_compressed(struct audio_client *ac, uint32_t format,
				uint32_t passthrough_flag);

@@ -386,6 +411,13 @@ int q6asm_enc_cfg_blk_pcm_v3(struct audio_client *ac,
			     bool use_back_flavor, u8 *channel_map,
			     uint16_t sample_word_size);

int q6asm_enc_cfg_blk_pcm_v4(struct audio_client *ac,
			     uint32_t rate, uint32_t channels,
			     uint16_t bits_per_sample, bool use_default_chmap,
			     bool use_back_flavor, u8 *channel_map,
			     uint16_t sample_word_size, uint16_t endianness,
			     uint16_t mode);

int q6asm_enc_cfg_blk_pcm_format_support(struct audio_client *ac,
			uint32_t rate, uint32_t channels,
			uint16_t bits_per_sample);
@@ -395,6 +427,13 @@ int q6asm_enc_cfg_blk_pcm_format_support_v3(struct audio_client *ac,
					    uint16_t bits_per_sample,
					    uint16_t sample_word_size);

int q6asm_enc_cfg_blk_pcm_format_support_v4(struct audio_client *ac,
					    uint32_t rate, uint32_t channels,
					    uint16_t bits_per_sample,
					    uint16_t sample_word_size,
					    uint16_t endianness,
					    uint16_t mode);

int q6asm_set_encdec_chan_map(struct audio_client *ac,
		uint32_t num_channels);

@@ -444,6 +483,17 @@ int q6asm_media_format_block_pcm_format_support_v3(struct audio_client *ac,
						   char *channel_map,
						   uint16_t sample_word_size);

int q6asm_media_format_block_pcm_format_support_v4(struct audio_client *ac,
						   uint32_t rate,
						   uint32_t channels,
						   uint16_t bits_per_sample,
						   int stream_id,
						   bool use_default_chmap,
						   char *channel_map,
						   uint16_t sample_word_size,
						   uint16_t endianness,
						   uint16_t mode);

int q6asm_media_format_block_multi_ch_pcm(struct audio_client *ac,
			uint32_t rate, uint32_t channels,
			bool use_default_chmap, char *channel_map);
@@ -461,6 +511,15 @@ int q6asm_media_format_block_multi_ch_pcm_v3(struct audio_client *ac,
					     uint16_t bits_per_sample,
					     uint16_t sample_word_size);

int q6asm_media_format_block_multi_ch_pcm_v4(struct audio_client *ac,
					     uint32_t rate, uint32_t channels,
					     bool use_default_chmap,
					     char *channel_map,
					     uint16_t bits_per_sample,
					     uint16_t sample_word_size,
					     uint16_t endianness,
					     uint16_t mode);

int q6asm_media_format_block_aac(struct audio_client *ac,
			struct asm_aac_cfg *cfg);

+442 −20

File changed.

Preview size limit exceeded, changes collapsed.