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

Commit 09f30ee1 authored by Krishna Kishor Jha's avatar Krishna Kishor Jha
Browse files

audio-kernel: Do SRC with MFC

1) Doing SRC with MFC when FE and BE SampleRates are different.
   MFC module is expected to add as fist module in COPP and output
   SR of MFC is configured same as app_type SR.
2) Adding MFC module V2 version details to system.

Change-Id: I7c03fa28ec32892645ead9baf59eb927ca3e4891
parent 50e0fe7b
Loading
Loading
Loading
Loading

asoc/msm-pcm-routing-auto.c

100644 → 100755
+20 −11
Original line number Diff line number Diff line
@@ -2475,14 +2475,20 @@ int msm_pcm_routing_reg_phy_stream(int fedai_id, int perf_mode,
			bits_per_sample = msm_routing_get_bit_width(
						msm_bedais[i].format);
			topology = msm_routing_get_adm_topology(fedai_id,
								session_type,
								i);
			app_type =
			fe_dai_app_type_cfg[fedai_id][session_type][i].app_type;
			if (app_type) {
				app_type_idx =
				msm_pcm_routing_get_app_type_idx(app_type);
				sample_rate =
				fe_dai_app_type_cfg[fedai_id][session_type][i]
					.sample_rate;
				if ((fe_dai_app_type_cfg[fedai_id][session_type][i].sample_rate != msm_bedais[i].sample_rate) &&
					(topology == AUDIO_COPP_MFC)) {
					pr_debug("%s: FE and BE SR is not equal", __func__);
					sample_rate = msm_bedais[i].sample_rate;
				} else
					sample_rate = fe_dai_app_type_cfg[fedai_id][session_type][i].sample_rate;
				bits_per_sample =
					(fe_dai_app_type_cfg[fedai_id][session_type][i].bit_width) ?
					fe_dai_app_type_cfg[fedai_id][session_type][i].bit_width :
@@ -2496,9 +2502,7 @@ int msm_pcm_routing_reg_phy_stream(int fedai_id, int perf_mode,
			acdb_dev_id =
			fe_dai_app_type_cfg[fedai_id][session_type][i]
				.acdb_dev_id;
			topology = msm_routing_get_adm_topology(fedai_id,
								session_type,
								i);
			be_bit_width = msm_routing_get_bit_width(
                                                msm_bedais[i].format);
			copp_perf_mode = get_copp_perf_mode(fedai_id, session_type, i);
@@ -2563,11 +2567,16 @@ int msm_pcm_routing_reg_phy_stream(int fedai_id, int perf_mode,
				&session_copp_map[fedai_id][session_type][i]);
			if (msm_is_resample_needed(
				sample_rate,
				msm_bedais[i].sample_rate))
				fe_dai_app_type_cfg[fedai_id][session_type][i].sample_rate,
				msm_bedais[i].sample_rate)) {
				if ((session_type == SESSION_TYPE_TX) && (topology == AUDIO_COPP_MFC)) {
					adm_copp_mfc_cfg(port_id, copp_idx,
						fe_dai_app_type_cfg[fedai_id][session_type][i].sample_rate);
				} else {
					adm_copp_mfc_cfg(port_id, copp_idx,
						msm_bedais[i].sample_rate);
				}
			}
			for (j = 0; j < MAX_COPPS_PER_PORT; j++) {
				unsigned long copp =
				    session_copp_map[fedai_id][session_type][i];

include/dsp/apr_audio-v2.h

100644 → 100755
+32 −0
Original line number Diff line number Diff line
@@ -846,6 +846,10 @@ struct audproc_softvolume_params {
 */
#define AUDPROC_PARAM_ID_MFC_OUTPUT_MEDIA_FORMAT            0x00010913

/* ID of the Output Media Format V2 parameters used by AUDPROC_MODULE_ID_MFC.
 */
#define AUDPROC_PARAM_ID_MFC_OUTPUT_MEDIA_FORMAT_V2         0x00010942

/* Param ID of Channel Mixer used by AUDPROC_MODULE_ID_MFC */
#define AUDPROC_CHMIXER_PARAM_ID_COEFF                      0x00010342

@@ -881,6 +885,33 @@ struct adm_cmd_set_pp_params_v5 {
	 */
} __packed;

/* Payload of the AUDPROC_PARAM_ID_MFC_OUTPUT_MEDIA_FORMAT_V2 parameter in the
 Media Format Converter Module. Following this will be the variable payload for channel_map.
 */
struct audproc_mfc_output_media_fmt_v2_t
{
	uint32_t sampling_rate;
	/**< @h2xmle_description  {Sampling rate in samples per second.}
	@h2xmle_range        {0..384000}  */

	uint16_t bits_per_sample;
	/**< @h2xmle_description  {Number of bits used to store each sample.}
	@h2xmle_rangeList   {"16 bits per sample (Q15 format)"= 16;"24 bits per sample (Q27 format)"=24;"32 bits per sample (Q31 format)"=32
	@h2xmle_default      {16}
	*/

	uint16_t num_channels;
	/**< @h2xmle_description  {Number of channels.}
	@h2xmle_default      {1}
	@h2xmle_range        {1..32}  */

	uint16_t channel_type[0];
	/**< @h2xmle_description  {Channel mapping array. Specify a channel mapping for each output channel.If the number of channels is not a multiple of four, zero padding must be added to the channel type array to align the packet to a multiple of 32 bits.}
	@h2xmle_variableArraySize {num_channels}
	@h2xmle_range        {1..63}
	@h2xmle_default      {1}*/
} __packed;

/* Maximum number of channels supported by MFC media fmt params */
#define AUDPROC_MFC_OUT_CHANNELS_MAX 8

@@ -5716,6 +5747,7 @@ struct afe_param_id_lpass_core_shared_clk_cfg {

#define NULL_POPP_TOPOLOGY				0x00010C68
#define NULL_COPP_TOPOLOGY				0x00010312
#define AUDIO_COPP_MFC					0x10000098
#define DEFAULT_COPP_TOPOLOGY				0x00010314
#define DEFAULT_POPP_TOPOLOGY				0x00010BE4
#define COMPRESSED_PASSTHROUGH_DEFAULT_TOPOLOGY         0x0001076B