diff --git a/asoc/msm-compress-q6-v2.c b/asoc/msm-compress-q6-v2.c index db75b180bdf8..589f6b98a684 100644 --- a/asoc/msm-compress-q6-v2.c +++ b/asoc/msm-compress-q6-v2.c @@ -1388,7 +1388,7 @@ static int msm_compr_send_media_format_block(struct snd_compr_stream *cstream, dsd_cfg.dsd_data_rate = prtd->sample_rate; dsd_cfg.num_version = 0; dsd_cfg.is_bitwise_big_endian = 1; - dsd_cfg.dsd_channel_block_size = 1; + dsd_cfg.dsd_channel_block_size = 4; ret = q6asm_media_format_block_dsd(prtd->audio_client, &dsd_cfg, stream_id); if (ret < 0) diff --git a/asoc/msm-dai-q6-v2.c b/asoc/msm-dai-q6-v2.c index 7e1b1bae152e..ccc6238585b8 100644 --- a/asoc/msm-dai-q6-v2.c +++ b/asoc/msm-dai-q6-v2.c @@ -331,7 +331,8 @@ static const char *const mi2s_format[] = { "NA6", "NA7", "NA8", - "DSD_DOP_W_MARKER" + "DSD_DOP_W_MARKER", + "NATIVE_DSD_DATA" }; static const char *const mi2s_vi_feed_mono[] = { @@ -340,7 +341,7 @@ static const char *const mi2s_vi_feed_mono[] = { }; static const struct soc_enum mi2s_config_enum[] = { - SOC_ENUM_SINGLE_EXT(10, mi2s_format), + SOC_ENUM_SINGLE_EXT(ARRAY_SIZE(mi2s_format), mi2s_format), SOC_ENUM_SINGLE_EXT(2, mi2s_vi_feed_mono), }; @@ -5895,6 +5896,7 @@ static int msm_dai_q6_mi2s_set_fmt(struct snd_soc_dai *dai, unsigned int fmt) switch (fmt & SND_SOC_DAIFMT_MASTER_MASK) { case SND_SOC_DAIFMT_CBS_CFS: + case SND_SOC_DAIFMT_CBM_CFS: mi2s_dai_data->rx_dai.mi2s_dai_data.port_config.i2s.ws_src = 1; mi2s_dai_data->tx_dai.mi2s_dai_data.port_config.i2s.ws_src = 1; break; diff --git a/asoc/msm-pcm-routing-v2.c b/asoc/msm-pcm-routing-v2.c index 6867f32edb70..139d4047608c 100644 --- a/asoc/msm-pcm-routing-v2.c +++ b/asoc/msm-pcm-routing-v2.c @@ -1739,7 +1739,7 @@ int msm_pcm_routing_reg_phy_compr_stream(int fe_id, int perf_mode, adm_open(port_id, path_type, sample_rate, channels, topology, perf_mode, bit_width, app_type, acdb_dev_id, - session_type); + session_type, passthr_mode); if ((copp_idx < 0) || (copp_idx >= MAX_COPPS_PER_PORT)) { pr_err("%s:adm open failed coppid:%d\n", @@ -2091,7 +2091,7 @@ int msm_pcm_routing_reg_phy_stream(int fedai_id, int perf_mode, sample_rate, channels, topology, perf_mode, bits_per_sample, app_type, acdb_dev_id, - session_type); + session_type, passthr_mode); if ((copp_idx < 0) || (copp_idx >= MAX_COPPS_PER_PORT)) { pr_err("%s: adm open failed copp_idx:%d\n", @@ -2372,7 +2372,7 @@ static void msm_pcm_routing_process_audio(u16 reg, u16 val, int set) sample_rate, channels, topology, fdai->perf_mode, bits_per_sample, app_type, acdb_dev_id, - session_type); + session_type, passthr_mode); if ((copp_idx < 0) || (copp_idx >= MAX_COPPS_PER_PORT)) { pr_err("%s: adm open failed\n", __func__); @@ -30147,7 +30147,7 @@ static int msm_pcm_routing_prepare(struct snd_pcm_substream *substream) sample_rate, channels, topology, fdai->perf_mode, bits_per_sample, app_type, acdb_dev_id, - session_type); + session_type, fdai->passthr_mode); if ((copp_idx < 0) || (copp_idx >= MAX_COPPS_PER_PORT)) { pr_err("%s: adm open failed\n", __func__); diff --git a/dsp/q6adm.c b/dsp/q6adm.c index ab667fb7478b..ca2371bb005f 100644 --- a/dsp/q6adm.c +++ b/dsp/q6adm.c @@ -2991,7 +2991,7 @@ exit: */ int adm_open(int port_id, int path, int rate, int channel_mode, int topology, int perf_mode, uint16_t bit_width, int app_type, int acdb_id, - int session_type) + int session_type, uint32_t passthr_mode) { struct adm_cmd_device_open_v5 open; struct adm_cmd_device_open_v6 open_v6; @@ -3205,7 +3205,9 @@ int adm_open(int port_id, int path, int rate, int channel_mode, int topology, } open_v8.topology_id = topology; - open_v8.reserved = 0; + open_v8.compressed_data_type = 0; + if (passthr_mode == COMPRESSED_PASSTHROUGH_DSD) + open_v8.compressed_data_type = 1; /* variable endpoint payload */ ep1_payload.dev_num_channel = channel_mode & 0x00FF; diff --git a/dsp/q6asm.c b/dsp/q6asm.c index aa0b4cb3ec05..5e9b826ff7b1 100644 --- a/dsp/q6asm.c +++ b/dsp/q6asm.c @@ -3097,6 +3097,10 @@ int q6asm_open_read_compressed(struct audio_client *ac, uint32_t format, open.mode_flags = 0x1; open.frames_per_buf = 1; pr_debug("%s: Flag 1 IEC61937 output\n", __func__); + } else if (format == FORMAT_DSD) { + open.mode_flags = ASM_DSD_FORMAT_FLAG; + open.frames_per_buf = 1; + pr_debug("%s: Flag 2 DSD output\n", __func__); } else { open.mode_flags = 0; open.frames_per_buf = 1; diff --git a/include/dsp/apr_audio-v2.h b/include/dsp/apr_audio-v2.h index c8ee7313bfd3..27be181b635b 100644 --- a/include/dsp/apr_audio-v2.h +++ b/include/dsp/apr_audio-v2.h @@ -598,7 +598,7 @@ struct adm_cmd_device_open_v8 { * In all other use cases this should be set to 0xffff */ - u16 reserved; + u16 compressed_data_type; } __packed; /* @@ -2557,6 +2557,7 @@ struct afe_port_data_cmd_rt_proxy_port_read_v2 { #define AFE_GENERIC_COMPRESSED 0x8 #define AFE_LINEAR_PCM_DATA_PACKED_16BIT 0X6 #define AFE_DSD_DOP_W_MARKER_DATA 0x9 +#define AFE_DSD_DATA 0xA /* This param id is used to configure I2S interface */ #define AFE_PARAM_ID_I2S_CONFIG 0x0001020D @@ -8957,6 +8958,13 @@ struct asm_data_cmd_remove_silence { /* Shift value for the IEC 61937 to 61937 pass-through capture. */ #define ASM_SHIFT_IEC_61937_PASS_THROUGH_FLAG 0 +/* Bitmask for the DSD pass-through capture. */ +#define ASM_BIT_MASK_COMPRESSED_FORMAT_FLAG (0x00000003UL) + +/* Shift value for the DSD pass-through capture. */ +#define ASM_SHIFT_DSD_COMPRESSED_FORMAT_FLAG 0 + +#define ASM_DSD_FORMAT_FLAG 2 struct asm_stream_cmd_open_read_compressed { struct apr_hdr hdr; u32 mode_flags; @@ -8968,6 +8976,12 @@ struct asm_stream_cmd_open_read_compressed { * - Use #ASM_BIT_MASK_IEC_61937_PASS_THROUGH_FLAG to set the bitmask * and #ASM_SHIFT_IEC_61937_PASS_THROUGH_FLAG to set the shift value * for this bit. + * Supported values for bit 1: (DSD native pass-through mode) + * 0 -- non DSD operation + * 1 -- Pass-through transfer of the DSD format stream + * To set this bit, use #ASM_BIT_MASK_DSD_PASS_THROUGH_FLAG and + * use #ASM_SHIFT_DSD_PASS_THROUGH_FLAG to set the shift value for + * this bit * Supported values for bit 4: * - 0 -- Return data buffer contains all encoded frames only; it does * not contain frame metadata. @@ -8984,6 +8998,9 @@ struct asm_stream_cmd_open_read_compressed { * Supported values: should be greater than 0 for IEC to RAW compressed * unpack mode. * Value is don't care for IEC 61937 pass-through mode. + * @values + * - >0 -- For IEC 61937-to-RAW Compressed Unpack mode + * - 1 -- For IEC 61937 or DSD Pass-through mode */ } __packed; diff --git a/include/dsp/q6adm-v2.h b/include/dsp/q6adm-v2.h index efc1d382387a..644855d0bb83 100644 --- a/include/dsp/q6adm-v2.h +++ b/include/dsp/q6adm-v2.h @@ -119,7 +119,8 @@ int adm_pack_and_set_one_pp_param(int port_id, int copp_idx, int adm_open(int port, int path, int rate, int mode, int topology, int perf_mode, uint16_t bits_per_sample, - int app_type, int acdbdev_id, int session_type); + int app_type, int acdbdev_id, int session_type, + uint32_t pass_thr); int adm_map_rtac_block(struct rtac_cal_block_data *cal_block);