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

Commit 783bbd7d 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: support multi-ch and samplerate > 48K for NT wma"

parents 7a18c03a 95feb294
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -57,7 +57,7 @@ static long audio_ioctl_shared(struct file *file, unsigned int cmd,
					audio->pcm_cfg.sample_rate,
					audio->pcm_cfg.channel_count,
					16, /*bits per sample*/
					false, channel_mapping);
					false, false, channel_mapping);
			if (rc < 0) {
				pr_err("pcm output block config failed\n");
				break;
+13 −20
Original line number Diff line number Diff line
@@ -41,9 +41,13 @@ static long audio_ioctl_shared(struct file *file, unsigned int cmd,
						audio->ac->session);
		if (audio->feedback == NON_TUNNEL_MODE) {
			/* Configure PCM output block */
			rc = q6asm_enc_cfg_blk_pcm(audio->ac,
			rc = q6asm_enc_cfg_blk_pcm_v2(audio->ac,
					audio->pcm_cfg.sample_rate,
					audio->pcm_cfg.channel_count);
					audio->pcm_cfg.channel_count,
					16, /* bits per sample */
					true, /* use default channel map */
					true, /* use back channel map flavor */
					NULL);
			if (rc < 0) {
				pr_err("pcm output block config failed\n");
				break;
@@ -62,8 +66,7 @@ static long audio_ioctl_shared(struct file *file, unsigned int cmd,
			rc = -EINVAL;
			break;
		}
		if ((wmapro_config->numchannels == 1) ||
		(wmapro_config->numchannels == 2)) {
		if (wmapro_config->numchannels > 0) {
			wmapro_cfg.ch_cfg = wmapro_config->numchannels;
		} else {
			pr_err("%s:AUDIO_START failed: channels = %d\n",
@@ -71,10 +74,8 @@ static long audio_ioctl_shared(struct file *file, unsigned int cmd,
			rc = -EINVAL;
			break;
		}
		if ((wmapro_config->samplingrate <= 48000) ||
		(wmapro_config->samplingrate > 0)) {
			wmapro_cfg.sample_rate =
				wmapro_config->samplingrate;
		if (wmapro_config->samplingrate > 0) {
			wmapro_cfg.sample_rate = wmapro_config->samplingrate;
		} else {
			pr_err("%s:AUDIO_START failed: sample_rate = %d\n",
				__func__, wmapro_config->samplingrate);
@@ -103,15 +104,7 @@ static long audio_ioctl_shared(struct file *file, unsigned int cmd,
			rc = -EINVAL;
			break;
		}
		if ((wmapro_config->channelmask  == 4) ||
		(wmapro_config->channelmask == 3)) {
		wmapro_cfg.ch_mask = wmapro_config->channelmask;
		} else {
			pr_err("%s:AUDIO_START failed: channel_mask = %d\n",
				__func__, wmapro_config->channelmask);
			rc = -EINVAL;
			break;
		}
		wmapro_cfg.encode_opt = wmapro_config->encodeopt;
		wmapro_cfg.adv_encode_opt =
				wmapro_config->advancedencodeopt;
@@ -194,10 +187,10 @@ struct msm_audio_wmapro_config32 {
	u8  validbitspersample;
	u8  numchannels;
	u16 formattag;
	u16 samplingrate;
	u16 avgbytespersecond;
	u32 samplingrate;
	u32 avgbytespersecond;
	u16 asfpacketlength;
	u16 channelmask;
	u32 channelmask;
	u16 encodeopt;
	u16 advancedencodeopt;
	u32 advancedencodeopt2;
+2 −1
Original line number Diff line number Diff line
@@ -317,7 +317,8 @@ int q6asm_enc_cfg_blk_pcm(struct audio_client *ac,
int q6asm_enc_cfg_blk_pcm_v2(struct audio_client *ac,
			uint32_t rate, uint32_t channels,
			uint16_t bits_per_sample,
			bool use_default_chmap, u8 *channel_map);
			bool use_default_chmap, bool use_back_flavor,
			u8 *channel_map);

int q6asm_enc_cfg_blk_pcm_format_support(struct audio_client *ac,
			uint32_t rate, uint32_t channels,
+7 −7
Original line number Diff line number Diff line
@@ -11,10 +11,10 @@ struct msm_audio_wmapro_config {
	uint8_t         validbitspersample;
	uint8_t         numchannels;
	unsigned short  formattag;
	unsigned short  samplingrate;
	unsigned short  avgbytespersecond;
	uint32_t        samplingrate;
	uint32_t        avgbytespersecond;
	unsigned short  asfpacketlength;
	unsigned short 	channelmask;
	uint32_t        channelmask;
	unsigned short  encodeopt;
	unsigned short  advancedencodeopt;
	uint32_t        advancedencodeopt2;
+25 −16
Original line number Diff line number Diff line
@@ -84,7 +84,8 @@ static int q6asm_memory_map_regions(struct audio_client *ac, int dir,
static int q6asm_memory_unmap_regions(struct audio_client *ac, int dir);
static void q6asm_reset_buf_state(struct audio_client *ac);

static int q6asm_map_channels(u8 *channel_mapping, uint32_t channels);
static int q6asm_map_channels(u8 *channel_mapping, uint32_t channels,
				bool use_back_flavor);
void *q6asm_mmap_apr_reg(void);

static int q6asm_is_valid_session(struct apr_client_data *data, void *priv);
@@ -2893,7 +2894,7 @@ int q6asm_set_encdec_chan_map(struct audio_client *ac,
	channel_mapping = chan_map.channel_mapping;
	memset(channel_mapping, PCM_CHANNEL_NULL, MAX_CHAN_MAP_CHANNELS);

	if (q6asm_map_channels(channel_mapping, num_channels)) {
	if (q6asm_map_channels(channel_mapping, num_channels, false)) {
		pr_err("%s: map channels failed %d\n", __func__, num_channels);
		return -EINVAL;
	}
@@ -2928,7 +2929,7 @@ fail_cmd:

int q6asm_enc_cfg_blk_pcm_v2(struct audio_client *ac,
		uint32_t rate, uint32_t channels, uint16_t bits_per_sample,
		bool use_default_chmap, u8 *channel_map)
		bool use_default_chmap, bool use_back_flavor, u8 *channel_map)
{
	struct asm_multi_channel_pcm_enc_cfg_v2  enc_cfg;
	u8 *channel_mapping;
@@ -2966,7 +2967,8 @@ int q6asm_enc_cfg_blk_pcm_v2(struct audio_client *ac,
	if (use_default_chmap) {
		pr_debug("%s: setting default channel map for %d channels",
		__func__, channels);
		if (q6asm_map_channels(channel_mapping, channels)) {
		if (q6asm_map_channels(channel_mapping, channels,
					use_back_flavor)) {
			pr_err("%s: map channels failed %d\n",
			 __func__, channels);
			return -EINVAL;
@@ -3009,7 +3011,7 @@ static int __q6asm_enc_cfg_blk_pcm(struct audio_client *ac,
		uint32_t rate, uint32_t channels, uint16_t bits_per_sample)
{
	return q6asm_enc_cfg_blk_pcm_v2(ac, rate, channels,
					bits_per_sample, true, NULL);
					bits_per_sample, true, false, NULL);
}

int q6asm_enc_cfg_blk_pcm(struct audio_client *ac,
@@ -3055,7 +3057,7 @@ int q6asm_enc_cfg_blk_pcm_native(struct audio_client *ac,

	memset(channel_mapping, 0, PCM_FORMAT_MAX_NUM_CHANNEL);

	if (q6asm_map_channels(channel_mapping, channels)) {
	if (q6asm_map_channels(channel_mapping, channels, false)) {
		pr_err("%s: map channels failed %d\n", __func__, channels);
		return -EINVAL;
	}
@@ -3087,7 +3089,8 @@ fail_cmd:
	return rc;
}

static int q6asm_map_channels(u8 *channel_mapping, uint32_t channels)
static int q6asm_map_channels(u8 *channel_mapping, uint32_t channels,
		bool use_back_flavor)
{
	u8 *lchannel_mapping;
	lchannel_mapping = channel_mapping;
@@ -3104,21 +3107,27 @@ static int q6asm_map_channels(u8 *channel_mapping, uint32_t channels)
	} else if (channels == 4) {
		lchannel_mapping[0] = PCM_CHANNEL_FL;
		lchannel_mapping[1] = PCM_CHANNEL_FR;
		lchannel_mapping[2] = PCM_CHANNEL_LS;
		lchannel_mapping[3] = PCM_CHANNEL_RS;
		lchannel_mapping[2] = use_back_flavor ?
			PCM_CHANNEL_LB : PCM_CHANNEL_LS;
		lchannel_mapping[3] = use_back_flavor ?
			PCM_CHANNEL_RB : PCM_CHANNEL_RS;
	} else if (channels == 5) {
		lchannel_mapping[0] = PCM_CHANNEL_FL;
		lchannel_mapping[1] = PCM_CHANNEL_FR;
		lchannel_mapping[2] = PCM_CHANNEL_FC;
		lchannel_mapping[3] = PCM_CHANNEL_LS;
		lchannel_mapping[4] = PCM_CHANNEL_RS;
		lchannel_mapping[3] = use_back_flavor ?
			PCM_CHANNEL_LB : PCM_CHANNEL_LS;
		lchannel_mapping[4] = use_back_flavor ?
			PCM_CHANNEL_RB : PCM_CHANNEL_RS;
	} else if (channels == 6) {
		lchannel_mapping[0] = PCM_CHANNEL_FL;
		lchannel_mapping[1] = PCM_CHANNEL_FR;
		lchannel_mapping[2] = PCM_CHANNEL_FC;
		lchannel_mapping[3] = PCM_CHANNEL_LFE;
		lchannel_mapping[4] = PCM_CHANNEL_LS;
		lchannel_mapping[5] = PCM_CHANNEL_RS;
		lchannel_mapping[4] = use_back_flavor ?
			PCM_CHANNEL_LB : PCM_CHANNEL_LS;
		lchannel_mapping[5] = use_back_flavor ?
			PCM_CHANNEL_RB : PCM_CHANNEL_RS;
	} else if (channels == 8) {
		lchannel_mapping[0] = PCM_CHANNEL_FL;
		lchannel_mapping[1] = PCM_CHANNEL_FR;
@@ -3528,7 +3537,7 @@ static int __q6asm_media_format_block_pcm(struct audio_client *ac,
	memset(channel_mapping, 0, PCM_FORMAT_MAX_NUM_CHANNEL);

	if (use_default_chmap) {
		if (q6asm_map_channels(channel_mapping, channels)) {
		if (q6asm_map_channels(channel_mapping, channels, false)) {
			pr_err("%s: map channels failed %d\n",
				__func__, channels);
			return -EINVAL;
@@ -3624,7 +3633,7 @@ static int __q6asm_media_format_block_multi_ch_pcm(struct audio_client *ac,
	memset(channel_mapping, 0, PCM_FORMAT_MAX_NUM_CHANNEL);

	if (use_default_chmap) {
		if (q6asm_map_channels(channel_mapping, channels)) {
		if (q6asm_map_channels(channel_mapping, channels, false)) {
			pr_err("%s: map channels failed %d\n",
				__func__, channels);
			return -EINVAL;
@@ -4728,7 +4737,7 @@ int q6asm_set_multich_gain(struct audio_client *ac, uint32_t channels,
	multich_gain.data.reserved = 0;

	if (use_default) {
		rc = q6asm_map_channels(default_chmap, channels);
		rc = q6asm_map_channels(default_chmap, channels, false);
		if (rc < 0)
			goto done;
		for (i = 0; i < channels; i++) {