Add DSP topology management for SKL
Subsystems (3)
cover Add DSP topology management for SKL
The SKL driver does not code DSP topology in driver. With this series the soc topology framework is used to parse the topology information to create widgets, controls and route map for the FW topology.
It adds routines for SKL DSP module configuration, add building blocks to instanatiate modules and pipes. It uses SKL IPC library added earlier to send IPC for initialize the module, bind/unbind modules, create pipeline and manage them.
Last patch in this series removes the unused dais.
Hardik T Shah (1):
ASoC: Intel: Skylake: Add helpers for SRC and converter modules
Jeeja KP (12):
ASoC: Intel: Skylake: Add helpers for DSP module configuration
ASoC: Intel: Skylake: Add DSP module init and binding routines
ASoC: Intel: Skylake: Add pipe management helpers
ASoC: Intel: Skylake: Add pipe and modules handlers
ASoC: Intel: Skylake: Add module configuration helpers
ASoC: Intel: Skylake: add DSP platform widget event handlers
ASoC: Intel: Skylake: Add FE and BE hw_params handling
ASoC: Intel: Skylake: Add topology core init and handlers
ASoC: Intel: Skylake: Initialize and load DSP controls
ASoC: Intel: Skylake: Add DSP support and enable it
ASoC: Intel: Skylake: Initialize NHLT table
ASoC: Intel: Skylake: Remove CPU dai that is not used
sound/soc/intel/skylake/Makefile | 3 +- sound/soc/intel/skylake/skl-messages.c | 751 +++++++++++++++ sound/soc/intel/skylake/skl-pcm.c | 173 ++-- sound/soc/intel/skylake/skl-topology.c | 1264 ++++++++++++++++++++++++++ sound/soc/intel/skylake/skl-topology.h | 307 +++++++ sound/soc/intel/skylake/skl-tplg-interface.h | 166 ++++ sound/soc/intel/skylake/skl.c | 29 +- sound/soc/intel/skylake/skl.h | 11 + 8 files changed, 2636 insertions(+), 68 deletions(-) create mode 100644 sound/soc/intel/skylake/skl-topology.c create mode 100644 sound/soc/intel/skylake/skl-topology.h create mode 100644 sound/soc/intel/skylake/skl-tplg-interface.h
Signature · 1 line
2.4.3
PATCH 1/13 ASoC: Intel: Skylake: Add helpers for DSP module configuration
From: Jeeja KP <[email protected]>
This adds helper functions to calculate parameters required for base module format and copier module. A generic module is modelled by base module. Copier module is responsible for getting/sending data to FE (host DMAs) and BE (link HDA DMA, SSP, PDM)
This also ads module pin management helpers which help in finding pins to use or freeing them up
--- sound/soc/intel/skylake/skl-messages.c | 386 +++++++++++++++++++++++++++ sound/soc/intel/skylake/skl-topology.h | 251 +++++++++++++++++ sound/soc/intel/skylake/skl-tplg-interface.h | 88 ++++++ 3 files changed, 725 insertions(+) create mode 100644 sound/soc/intel/skylake/skl-topology.h create mode 100644 sound/soc/intel/skylake/skl-tplg-interface.h
sound/soc/intel/skylake/skl-messages.c +386 -0
@@ -26,6 +26,8 @@#include "skl.h" #include "../common/sst-dsp.h" #include "../common/sst-dsp-priv.h" +#include "skl-topology.h" +#include "skl-tplg-interface.h" static int skl_alloc_dma_buf (struct device *dev,struct snd_dma_buffer *dmab,size_t size)
@@ -131,3 +133,387 @@ int skl_resume_dsp(struct skl *skl)return skl_dsp_wake (ctx->dsp); } + +enum skl_bitdepth skl_get_bit_depth (int params) +{ +switch (params) { +case 8 : +return SKL_DEPTH_8BIT ; + +case 16 : +return SKL_DEPTH_16BIT ; + +case 24 : +return SKL_DEPTH_24BIT ; + +case 32 : +return SKL_DEPTH_32BIT ; + +default : +return SKL_DEPTH_INVALID ; + + } +} + +static u32 skl_create_channel_map (enum skl_ch_cfg ch_cfg) +{ +u32 config; + +switch (ch_cfg) { +case SKL_CH_CFG_MONO : + config = (0xFFFFFFF0 |SKL_CHANNEL_LEFT ); +break ; + +case SKL_CH_CFG_STEREO : + config = (0xFFFFFF00 |SKL_CHANNEL_LEFT + | (SKL_CHANNEL_RIGHT <<4 )); +break ; + +case SKL_CH_CFG_2_1 : + config = (0xFFFFF000 |SKL_CHANNEL_LEFT + | (SKL_CHANNEL_RIGHT <<4 ) + | (SKL_CHANNEL_LFE <<8 )); +break ; + +case SKL_CH_CFG_3_0 : + config = (0xFFFFF000 |SKL_CHANNEL_LEFT + | (SKL_CHANNEL_CENTER <<4 ) + | (SKL_CHANNEL_RIGHT <<8 )); +break ; + +case SKL_CH_CFG_3_1 : + config = (0xFFFF0000 |SKL_CHANNEL_LEFT + | (SKL_CHANNEL_CENTER <<4 ) + | (SKL_CHANNEL_RIGHT <<8 ) + | (SKL_CHANNEL_LFE <<12 )); +break ; + +case SKL_CH_CFG_QUATRO : + config = (0xFFFF0000 |SKL_CHANNEL_LEFT + | (SKL_CHANNEL_RIGHT <<4 ) + | (SKL_CHANNEL_LEFT_SURROUND <<8 ) + | (SKL_CHANNEL_RIGHT_SURROUND <<12 )); +break ; + +case SKL_CH_CFG_4_0 : + config = (0xFFFF0000 |SKL_CHANNEL_LEFT + | (SKL_CHANNEL_CENTER <<4 ) + | (SKL_CHANNEL_RIGHT <<8 ) + | (SKL_CHANNEL_CENTER_SURROUND <<12 )); +break ; + +case SKL_CH_CFG_5_0 : + config = (0xFFF00000 |SKL_CHANNEL_LEFT + | (SKL_CHANNEL_CENTER <<4 ) + | (SKL_CHANNEL_RIGHT <<8 ) + | (SKL_CHANNEL_LEFT_SURROUND <<12 ) + | (SKL_CHANNEL_RIGHT_SURROUND <<16 )); +break ; + +case SKL_CH_CFG_5_1 : + config = (0xFF000000 |SKL_CHANNEL_CENTER + | (SKL_CHANNEL_LEFT <<4 ) + | (SKL_CHANNEL_RIGHT <<8 ) + | (SKL_CHANNEL_LEFT_SURROUND <<12 ) + | (SKL_CHANNEL_RIGHT_SURROUND <<16 ) + | (SKL_CHANNEL_LFE <<20 )); +break ; + +case SKL_CH_CFG_DUAL_MONO : + config = (0xFFFFFF00 |SKL_CHANNEL_LEFT + | (SKL_CHANNEL_LEFT <<4 )); +break ; + +case SKL_CH_CFG_I2S_DUAL_STEREO_0 : + config = (0xFFFFFF00 |SKL_CHANNEL_LEFT + | (SKL_CHANNEL_RIGHT <<4 )); +break ; + +case SKL_CH_CFG_I2S_DUAL_STEREO_1 : + config = (0xFFFF00FF | (SKL_CHANNEL_LEFT <<8 ) + | (SKL_CHANNEL_RIGHT <<12 )); +break ; + +default : + config =0xFFFFFFFF ; +break ; + + } + +return config; +} + +/* +* Each module in DSP expects a base module configuration, which consists of +* PCM format information, which we calculate in driver and resource values +* which are read from widget information passed through topology binary +* This is send when we create a module with INIT_INSTANCE IPC msg +*/ +static void skl_set_base_module_format (struct skl_sst *ctx, +struct skl_module_cfg *mconfig, +struct skl_base_cfg *base_cfg) +{ +struct skl_module_fmt *format = &mconfig->in_fmt; + + base_cfg->audio_fmt.number_of_channels = (u8 )format->channels; + + base_cfg->audio_fmt.s_freq = format->s_freq; + base_cfg->audio_fmt.bit_depth = format->bit_depth; + base_cfg->audio_fmt.valid_bit_depth = format->valid_bit_depth; + base_cfg->audio_fmt.ch_cfg = format->ch_cfg; + +dev_dbg (ctx->dev,"bit_depth=%x valid_bd=%x ch_config=%x\n" , + format->bit_depth, format->valid_bit_depth, + format->ch_cfg); + + base_cfg->audio_fmt.channel_map =skl_create_channel_map ( + base_cfg->audio_fmt.ch_cfg); + + base_cfg->audio_fmt.interleaving =SKL_INTERLEAVING_PER_CHANNEL ; + + base_cfg->cps = mconfig->mcps; + base_cfg->ibs = mconfig->ibs; + base_cfg->obs = mconfig->obs; +} + +/* +* Copies copier capabilities into copier module and updates copier module +* config size. +*/ +static void skl_copy_copier_caps (struct skl_module_cfg *mconfig, +struct skl_cpr_cfg *cpr_mconfig) +{ +if (mconfig->formats_config.caps_size ==0 ) +return ; + +memcpy (cpr_mconfig->gtw_cfg.config_data, + mconfig->formats_config.caps, + mconfig->formats_config.caps_size); + + cpr_mconfig->gtw_cfg.config_length = + (mconfig->formats_config.caps_size) /4 ; +} + +/* +* Calculate the gatewat settings required for copier module, type of +* gateway and index of gateway to use +*/ +static void skl_setup_cpr_gateway_cfg (struct skl_sst *ctx, +struct skl_module_cfg *mconfig, +struct skl_cpr_cfg *cpr_mconfig) +{ +union skl_connector_node_id node_id = {0 }; +struct skl_pipe_params *params = mconfig->pipe->p_params; + +switch (mconfig->dev_type) { +case SKL_DEVICE_BT : + node_id.node.dma_type = + (SKL_CONN_SOURCE == mconfig->hw_conn_type) ? +SKL_DMA_I2S_LINK_OUTPUT_CLASS : +SKL_DMA_I2S_LINK_INPUT_CLASS ; + node_id.node.vindex = params->host_dma_id + + (mconfig->vbus_id <<3 ); +break ; + +case SKL_DEVICE_I2S : + node_id.node.dma_type = + (SKL_CONN_SOURCE == mconfig->hw_conn_type) ? +SKL_DMA_I2S_LINK_OUTPUT_CLASS : +SKL_DMA_I2S_LINK_INPUT_CLASS ; + node_id.node.vindex = params->host_dma_id + + (mconfig->time_slot <<1 ) + + (mconfig->vbus_id <<3 ); +break ; + +case SKL_DEVICE_DMIC : + node_id.node.dma_type =SKL_DMA_DMIC_LINK_INPUT_CLASS ; + node_id.node.vindex = mconfig->vbus_id + + (mconfig->time_slot); +break ; + +case SKL_DEVICE_HDALINK : + node_id.node.dma_type = + (SKL_CONN_SOURCE == mconfig->hw_conn_type) ? +SKL_DMA_HDA_LINK_OUTPUT_CLASS : +SKL_DMA_HDA_LINK_INPUT_CLASS ; + node_id.node.vindex = params->link_dma_id; +break ; + +default : + node_id.node.dma_type = + (SKL_CONN_SOURCE == mconfig->hw_conn_type) ? +SKL_DMA_HDA_HOST_OUTPUT_CLASS : +SKL_DMA_HDA_HOST_INPUT_CLASS ; + node_id.node.vindex = params->host_dma_id; +break ; + } + + cpr_mconfig->gtw_cfg.node_id = node_id.val; + +if (SKL_CONN_SOURCE == mconfig->hw_conn_type) + cpr_mconfig->gtw_cfg.dma_buffer_size =2 * mconfig->obs; +else + cpr_mconfig->gtw_cfg.dma_buffer_size =2 * mconfig->ibs; + + cpr_mconfig->cpr_feature_mask =0 ; + cpr_mconfig->gtw_cfg.config_length =0 ; + +skl_copy_copier_caps (mconfig, cpr_mconfig); +} + +static void skl_setup_out_format (struct skl_sst *ctx, +struct skl_module_cfg *mconfig, +struct skl_audio_data_format *out_fmt) +{ +struct skl_module_fmt *format = &mconfig->out_fmt; + + out_fmt->number_of_channels = (u8 )format->channels; + out_fmt->s_freq = format->s_freq; + out_fmt->bit_depth = format->bit_depth; + out_fmt->valid_bit_depth = format->valid_bit_depth; + out_fmt->ch_cfg = format->ch_cfg; + + out_fmt->channel_map =skl_create_channel_map (out_fmt->ch_cfg); + out_fmt->interleaving =SKL_INTERLEAVING_PER_CHANNEL ; + +dev_dbg (ctx->dev,"copier out format chan=%d fre=%d bitdepth=%d\n" , + out_fmt->number_of_channels, format->s_freq, format->bit_depth); +} + +/* +* 'copier' is DSP internal module which copies data from Host DMA (HDA host +* dma) or link (hda link, SSP, PDM) +* Here we calculate the copier module parameters, like PCM format, output +* format, gateway settings +* copier_module_config is sent as input buffer with INIT_INSTANCE IPC msg +*/ +static void skl_set_copier_format (struct skl_sst *ctx, +struct skl_module_cfg *mconfig, +struct skl_cpr_cfg *cpr_mconfig) +{ +struct skl_audio_data_format *out_fmt = &cpr_mconfig->out_fmt; +struct skl_base_cfg *base_cfg = (struct skl_base_cfg *)cpr_mconfig; + +skl_set_base_module_format (ctx, mconfig, base_cfg); + +skl_setup_out_format (ctx, mconfig, out_fmt); +skl_setup_cpr_gateway_cfg (ctx, mconfig, cpr_mconfig); +} + +static u16 skl_get_module_param_size (struct skl_sst *ctx, +struct skl_module_cfg *mconfig) +{ +u16 param_size; + +switch (mconfig->m_type) { +case SKL_MODULE_TYPE_COPIER : + param_size =sizeof (struct skl_cpr_cfg ); + param_size += mconfig->formats_config.caps_size; +return param_size; + +default : +/* +* return only base cfg when no specific module type is +* specified +*/ +return sizeof (struct skl_base_cfg ); + } + +return 0 ; +} + +/* +* DSP firmware supports various modules like copier etc. These modules +* required various parameters to be calculated and sent for the module +* initialization to DSP. By default a generic module needs only base module +* format configuration +*/ +static int skl_set_module_format (struct skl_sst *ctx, +struct skl_module_cfg *module_config, +u16 *module_config_size, +void **param_data) +{ +u16 param_size; + + param_size =skl_get_module_param_size (ctx, module_config); + + *param_data =kzalloc (param_size,GFP_KERNEL ); +if (NULL == *param_data) +return -ENOMEM ; + + *module_config_size = param_size; + +switch (module_config->m_type) { +case SKL_MODULE_TYPE_COPIER : +skl_set_copier_format (ctx, module_config, *param_data); +break ; + +default : +skl_set_base_module_format (ctx, module_config, *param_data); +break ; + + } + +dev_dbg (ctx->dev,"Module type=%d config size: %d bytes\n" , + module_config->id.module_id, param_size); +print_hex_dump (KERN_DEBUG ,"Module params:" ,DUMP_PREFIX_OFFSET ,8 ,4 , + *param_data, param_size, false); +return 0 ; +} + +static int skl_get_queue_index (struct skl_module_pin *mpin, +struct skl_module_inst_id id,int max) +{ +int i; + +for (i =0 ; i < max; i++) { +if (mpin[i].id.module_id == id.module_id && + mpin[i].id.instance_id == id.instance_id) +return i; + } + +return -EINVAL ; +} + +/* +* Allocates queue for each module. +* if dynamic, the pin_index is allocated 0 to max_pin. +* In static, the pin_index is fixed based on module_id and instance id +*/ +static int skl_alloc_queue (struct skl_module_pin *mpin, +struct skl_module_inst_id id,int max) +{ +int i; + +/* +* if pin in dynamic, find first free pin +* otherwise find match module and instance id pin as topology will +* ensure a unique pin is assigned to this so no need to +* allocate/free +*/ +for (i =0 ; i < max; i++) { +if (mpin[i].is_dynamic) { +if (!mpin[i].in_use) { + mpin[i].in_use = true; + mpin[i].id.module_id = id.module_id; + mpin[i].id.instance_id = id.instance_id; +return i; + } + }else { +if (mpin[i].id.module_id == id.module_id && + mpin[i].id.instance_id == id.instance_id) +return i; + } + } + +return -EINVAL ; +} + +static void skl_free_queue (struct skl_module_pin *mpin,int q_index) +{ +if (mpin[q_index].is_dynamic) { + mpin[q_index].in_use = false; + mpin[q_index].id.module_id =0 ; + mpin[q_index].id.instance_id =0 ; + } +}
sound/soc/intel/skylake/skl-topology.h new file +251 -0
251 lines not on this page · raw message
sound/soc/intel/skylake/skl-tplg-interface.h new file +88 -0
88 lines not on this page · raw message
Signature · 1 line
2.4.3
PATCH 2/13 ASoC: Intel: Skylake: Add helpers for SRC and converter modules
In reply to Subhransu S. PrustyFrom: Hardik T Shah <[email protected]>
SRC and converter modules are required to do frequency and channel conversion in DSP. Both take base module configuration and additional SRC and converter parameters. The helpers here are added to calculate the values for these modules
--- sound/soc/intel/skylake/skl-messages.c | 64 +++++++++++++++++++++++++++++++--- sound/soc/intel/skylake/skl-topology.h | 16 +++++++++ 2 files changed, 76 insertions(+), 4 deletions(-)
sound/soc/intel/skylake/skl-messages.c +60 -4
@@ -381,6 +381,47 @@ static void skl_setup_out_format(struct skl_sst *ctx, }/* +* DSP needs SRC module for frequency conversion, SRC takes base module +* configuration and the target frequency as extra parameter passed as src +* config +*/ +static void skl_set_src_format (struct skl_sst *ctx, +struct skl_module_cfg *mconfig, +struct skl_src_module_cfg *src_mconfig) +{ +struct skl_module_fmt *fmt = &mconfig->out_fmt; + +skl_set_base_module_format (ctx, mconfig, + (struct skl_base_cfg *)src_mconfig); + + src_mconfig->src_cfg = fmt->s_freq; +} + +/* +* DSP needs updown module to do channel conversion. updown module take base +* module configuration and channel configuration +* It also take coefficients and now we have defaults applied here +*/ +static void skl_set_updown_mixer_format (struct skl_sst *ctx, +struct skl_module_cfg *mconfig, +struct skl_up_down_mixer_cfg *mixer_mconfig) +{ +struct skl_module_fmt *fmt = &mconfig->out_fmt; +int i =0 ; + +skl_set_base_module_format (ctx, mconfig, + (struct skl_base_cfg *)mixer_mconfig); + mixer_mconfig->out_ch_cfg = fmt->ch_cfg; + +/* Select F/W default coefficient */ + mixer_mconfig->coeff_sel =0x0 ; + +/* User coeff, don't care since we are selecting F/W defaults */ +for (i =0 ; i <UP_DOWN_MIXER_MAX_COEFF ; i++) + mixer_mconfig->coeff[i] =0xDEADBEEF ; +} + +/* * 'copier' is DSP internal module which copies data from Host DMA (HDA host * dma) or link (hda link, SSP, PDM) * Here we calculate the copier module parameters, like PCM format, output
@@ -411,6 +452,12 @@ static u16 skl_get_module_param_size(struct skl_sst *ctx, param_size += mconfig->formats_config.caps_size;return param_size; +case SKL_MODULE_TYPE_SRCINT : +return sizeof (struct skl_src_module_cfg ); + +case SKL_MODULE_TYPE_UPDWMIX : +return sizeof (struct skl_up_down_mixer_cfg ); +default :/* * return only base cfg when no specific module type is
@@ -423,11 +470,12 @@ static u16 skl_get_module_param_size(struct skl_sst *ctx, }/* -* DSP firmware supports various modules like copier etc. These modules -* required various parameters to be calculated and sent for the module -* initialization to DSP. By default a generic module needs only base module -* format configuration +* DSP firmware supports various modules like copier, SRC, updown etc. +* These modules required various parameters to be calculated and sent for +* the module initialization to DSP. By default a generic module needs only +* base module format configuration */ + static int skl_set_module_format(struct skl_sst *ctx, struct skl_module_cfg *module_config, u16 *module_config_size,
@@ -448,6 +496,14 @@ static int skl_set_module_format(struct skl_sst *ctx,skl_set_copier_format (ctx, module_config, *param_data);break ; +case SKL_MODULE_TYPE_SRCINT : +skl_set_src_format (ctx, module_config, *param_data); +break ; + +case SKL_MODULE_TYPE_UPDWMIX : +skl_set_updown_mixer_format (ctx, module_config, *param_data); +break ; +default :skl_set_base_module_format (ctx, module_config, *param_data);break ;
sound/soc/intel/skylake/skl-topology.h +16 -0
@@ -123,6 +123,21 @@ struct skl_cpr_cfg {struct skl_cpr_gtw_cfg gtw_cfg; } __packed; + +struct skl_src_module_cfg { +struct skl_base_cfg base_cfg; +enum skl_s_freq src_cfg; +} __packed; + +struct skl_up_down_mixer_cfg { +struct skl_base_cfg base_cfg; +enum skl_ch_cfg out_ch_cfg; +/* This should be set to 1 if user coefficients are required */ +u32 coeff_sel; +/* Pass the user coeff in this array */ +s32 coeff[UP_DOWN_MIXER_MAX_COEFF ]; +} __packed; +enum skl_dma_type {SKL_DMA_HDA_HOST_OUTPUT_CLASS =0 ,SKL_DMA_HDA_HOST_INPUT_CLASS =1 ,
@@ -247,5 +262,6 @@ struct skl_module_cfg {struct skl_pipe *pipe; struct skl_specific_cfg formats_config; }; +enum skl_bitdepth skl_get_bit_depth (int params);#endif
Signature · 1 line
2.4.3
PATCH 3/13 ASoC: Intel: Skylake: Add DSP module init and binding routines
In reply to Subhransu S. PrustyFrom: Jeeja KP <[email protected]>
A module needs to be instantiated and then connected with other modules. On cleanup we need to disconnect the module.
This is achieved by helpers module init, bind and unbind which are added here
--- sound/soc/intel/skylake/skl-messages.c | 183 +++++++++++++++++++++++++++++++++ sound/soc/intel/skylake/skl-topology.h | 9 ++ 2 files changed, 192 insertions(+)
sound/soc/intel/skylake/skl-messages.c +183 -0
@@ -573,3 +573,186 @@ static void skl_free_queue(struct skl_module_pin *mpin, int q_index) mpin[q_index].id.instance_id =0 ; } } + +/* +* A module needs to be instanataited in DSP. A mdoule is present in a +* collection of module referred as a PIPE. +* We first calculate the module format, based on module type and then +* invoke the DSP by sending IPC INIT_INSTANCE using ipc helper +*/ +int skl_init_module (struct skl_sst *ctx, +struct skl_module_cfg *mconfig,char *param) +{ +u16 module_config_size =0 ; +void *param_data =NULL ; +int ret; +struct skl_ipc_init_instance_msg msg; + +dev_dbg (ctx->dev,"%s: module_id = %d instance=%d\n" , __func__, + mconfig->id.module_id, mconfig->id.instance_id); + +if (mconfig->pipe->state !=SKL_PIPE_CREATED ) { +dev_err (ctx->dev,"Pipe not created state= %d pipe_id= %d\n" , + mconfig->pipe->state, mconfig->pipe->ppl_id); +return -EIO ; + } + + ret =skl_set_module_format (ctx, mconfig, + &module_config_size, ¶m_data); +if (ret <0 ) { +dev_err (ctx->dev,"Failed to set module format ret=%d\n" , ret); +return ret; + } + + msg.module_id = mconfig->id.module_id; + msg.instance_id = mconfig->id.instance_id; + msg.ppl_instance_id = mconfig->pipe->ppl_id; + msg.param_data_size = module_config_size; + msg.core_id = mconfig->core_id; + + ret =skl_ipc_init_instance (&ctx->ipc, &msg, param_data); +if (ret <0 ) { +dev_err (ctx->dev,"Failed to init instance ret=%d\n" , ret); +kfree (param_data); +return ret; + } + mconfig->m_state =SKL_MODULE_INIT_DONE ; + +return ret; +} + +static void skl_dump_bind_info (struct skl_sst *ctx,struct skl_module_cfg + *src_module,struct skl_module_cfg *dst_module) +{ +dev_dbg (ctx->dev,"%s: src module_id = %d src_instance=%d\n" , + __func__, src_module->id.module_id, src_module->id.instance_id); +dev_dbg (ctx->dev,"%s: dst_module=%d dst_instacne=%d\n" , __func__, + dst_module->id.module_id, dst_module->id.instance_id); + +dev_dbg (ctx->dev,"src_module state = %d dst module state = %d\n" , + src_module->m_state, dst_module->m_state); +} + +/* +* On module freeup, we need to unbind the module with modules +* it is already bind. +* Find the pin allocated and unbind then using bind_unbind IPC +*/ +int skl_unbind_modules (struct skl_sst *ctx, +struct skl_module_cfg *src_mcfg, +struct skl_module_cfg *dst_mcfg) +{ +int ret; +struct skl_ipc_bind_unbind_msg msg; +struct skl_module_inst_id src_id = src_mcfg->id; +struct skl_module_inst_id dst_id = dst_mcfg->id; +int in_max = dst_mcfg->max_in_queue; +int out_max = src_mcfg->max_out_queue; +int src_index, dst_index; + +skl_dump_bind_info (ctx, src_mcfg, dst_mcfg); + +if (src_mcfg->m_state !=SKL_MODULE_BIND_DONE ) +return 0 ; + +/* +* if intra module unbind, check if both modules are BIND, +* then send unbind +*/ +if ((src_mcfg->pipe->ppl_id != dst_mcfg->pipe->ppl_id) && + dst_mcfg->m_state !=SKL_MODULE_BIND_DONE ) +return 0 ; +else if (src_mcfg->m_state <SKL_MODULE_INIT_DONE && + dst_mcfg->m_state <SKL_MODULE_INIT_DONE ) +return 0 ; + +/* get src queue index */ + src_index =skl_get_queue_index (src_mcfg->m_out_pin, dst_id, out_max); +if (src_index <0 ) +return -EINVAL ; + + msg.src_queue = src_mcfg->m_out_pin[src_index].pin_index; + +/* get dst queue index */ + dst_index =skl_get_queue_index (dst_mcfg->m_in_pin, src_id, in_max); +if (dst_index <0 ) +return -EINVAL ; + + msg.dst_queue = dst_mcfg->m_in_pin[dst_index].pin_index; + + msg.module_id = src_mcfg->id.module_id; + msg.instance_id = src_mcfg->id.instance_id; + msg.dst_module_id = dst_mcfg->id.module_id; + msg.dst_instance_id = dst_mcfg->id.instance_id; + msg.bind = false; + + ret =skl_ipc_bind_unbind (&ctx->ipc, &msg); +if (!ret) { + src_mcfg->m_state =SKL_MODULE_UNINIT ; +/* free queue only if unbind is success */ +skl_free_queue (src_mcfg->m_out_pin, src_index); +skl_free_queue (dst_mcfg->m_in_pin, dst_index); + } + +return ret; +} + +/* +* Once a module is instantiated it need to be 'bind' with other modules in +* the pipeline. For binding we need to find the module pins which are bind +* together +* This function finds the pins and then sends bund_unbind IPC message to +* DSP using IPC helper +*/ +int skl_bind_modules (struct skl_sst *ctx, +struct skl_module_cfg *src_mcfg, +struct skl_module_cfg *dst_mcfg) +{ +int ret; +struct skl_ipc_bind_unbind_msg msg; +struct skl_module_inst_id src_id = src_mcfg->id; +struct skl_module_inst_id dst_id = dst_mcfg->id; +int in_max = dst_mcfg->max_in_queue; +int out_max = src_mcfg->max_out_queue; +int src_index, dst_index; + +skl_dump_bind_info (ctx, src_mcfg, dst_mcfg); + +if (src_mcfg->m_state <SKL_MODULE_INIT_DONE && + dst_mcfg->m_state <SKL_MODULE_INIT_DONE ) +return 0 ; + + src_index =skl_alloc_queue (src_mcfg->m_out_pin, dst_id, out_max); +if (src_index <0 ) +return -EINVAL ; + + msg.src_queue = src_mcfg->m_out_pin[src_index].pin_index; + dst_index =skl_alloc_queue (dst_mcfg->m_in_pin, src_id, in_max); +if (dst_index <0 ) { +skl_free_queue (src_mcfg->m_out_pin, src_index); +return -EINVAL ; + } + + msg.dst_queue = dst_mcfg->m_in_pin[dst_index].pin_index; + +dev_dbg (ctx->dev,"src queue = %d dst queue =%d\n" , + msg.src_queue, msg.dst_queue); + + msg.module_id = src_mcfg->id.module_id; + msg.instance_id = src_mcfg->id.instance_id; + msg.dst_module_id = dst_mcfg->id.module_id; + msg.dst_instance_id = dst_mcfg->id.instance_id; + msg.bind = true; + + ret =skl_ipc_bind_unbind (&ctx->ipc, &msg); + +if (!ret) { + src_mcfg->m_state =SKL_MODULE_BIND_DONE ; + }else { +/* error case , if IPC fails, clear the queue index */ +skl_free_queue (src_mcfg->m_out_pin, src_index); +skl_free_queue (dst_mcfg->m_in_pin, dst_index); + } + +return ret; +}
sound/soc/intel/skylake/skl-topology.h +9 -0
@@ -263,5 +263,14 @@ struct skl_module_cfg { struct skl_specific_cfg formats_config; }; +int skl_init_module (struct skl_sst *ctx,struct skl_module_cfg *module_config, +char *param); + +int skl_bind_modules (struct skl_sst *ctx,struct skl_module_cfg + *src_module,struct skl_module_cfg *dst_module); + +int skl_unbind_modules (struct skl_sst *ctx,struct skl_module_cfg + *src_module,struct skl_module_cfg *dst_module); +enum skl_bitdepth skl_get_bit_depth (int params);#endif
Signature · 1 line
2.4.3
PATCH 4/13 ASoC: Intel: Skylake: Add pipe management helpers
In reply to Subhransu S. PrustyFrom: Jeeja KP <[email protected]>
To manage DSP we need to create processing pipeline and on cleanup destroy them. So we add create and destroy routines for pipelines.
The pipelines need to to be executed so we add pipeline run and stop routines All these send required IPCs to DSP using IPC routines added earlier.
--- sound/soc/intel/skylake/skl-messages.c | 126 +++++++++++++++++++++++++++++++++ sound/soc/intel/skylake/skl-topology.h | 10 +++ 2 files changed, 136 insertions(+)
sound/soc/intel/skylake/skl-messages.c +126 -0
@@ -756,3 +756,129 @@ int skl_bind_modules(struct skl_sst *ctx,return ret; } + +static int skl_set_pipe_state (struct skl_sst *ctx,struct skl_pipe *pipe, +enum skl_ipc_pipeline_state state) +{ +dev_dbg (ctx->dev,"%s: pipe_satate = %d\n" , __func__, state); + +return skl_ipc_set_pipeline_state (&ctx->ipc, pipe->ppl_id, state); +} + +/* +* A pipeline is a collection of modules. Before a module in instantiated a +* pipeline needs to be created for it. +* This function creates pipeline, by sending create pipeline IPC messages +* to FW +*/ +int skl_create_pipeline (struct skl_sst *ctx,struct skl_pipe *pipe) +{ +int ret; + +dev_dbg (ctx->dev,"%s: pipe_id = %d\n" , __func__, pipe->ppl_id); + + ret =skl_ipc_create_pipeline (&ctx->ipc, pipe->memory_pages, + pipe->pipe_priority, pipe->ppl_id); +if (ret <0 ) { +dev_err (ctx->dev,"Failed to create pipeline\n" ); +return ret; + } + + pipe->state =SKL_PIPE_CREATED ; + +return 0 ; +} + +/* +* A pipeline needs to be deleted on cleanup. If a pipeline is running, then +* pause the pipeline first and then delete it +* The pipe delete is done by sending delete pipeline IPC. DSP will stop the +* DMA engines and releases resources +*/ +int skl_delete_pipe (struct skl_sst *ctx,struct skl_pipe *pipe) +{ +int ret; + +dev_dbg (ctx->dev,"%s: pipe = %d\n" , __func__, pipe->ppl_id); + +/* If pipe is not started, do not try to stop the pipe in FW. */ +if (pipe->state >SKL_PIPE_STARTED ) { + ret =skl_set_pipe_state (ctx, pipe,PPL_PAUSED ); +if (ret <0 ) { +dev_err (ctx->dev,"Failed to stop pipeline\n" ); +return ret; + } + + pipe->state =SKL_PIPE_PAUSED ; + }else { +/* If pipe was not created in FW, do not try to delete it */ +if (pipe->state <SKL_PIPE_CREATED ) +return 0 ; + + ret =skl_ipc_delete_pipeline (&ctx->ipc, pipe->ppl_id); +if (ret <0 ) +dev_err (ctx->dev,"Failed to delete pipeline\n" ); + } + +return ret; +} + +/* +* A pipeline is also a scheduling entity in DSP which can be run, stopped +* For processing data the pipe need to be run by sending IPC set pipe state +* to DSP +*/ +int skl_run_pipe (struct skl_sst *ctx,struct skl_pipe *pipe) +{ +int ret; + +dev_dbg (ctx->dev,"%s: pipe = %d\n" , __func__, pipe->ppl_id); + +/* If pipe was not created in FW, do not try to pause or delete */ +if (pipe->state <SKL_PIPE_CREATED ) +return 0 ; + +/* Pipe has to be paused before it is started */ + ret =skl_set_pipe_state (ctx, pipe,PPL_PAUSED ); +if (ret <0 ) { +dev_err (ctx->dev,"Failed to pause pipe\n" ); +return ret; + } + + pipe->state =SKL_PIPE_PAUSED ; + + ret =skl_set_pipe_state (ctx, pipe,PPL_RUNNING ); +if (ret <0 ) { +dev_err (ctx->dev,"Failed to start pipe\n" ); +return ret; + } + + pipe->state =SKL_PIPE_STARTED ; + +return 0 ; +} + +/* +* Stop the pipeline by sending set pipe state IPC +* DSP doesnt implement stop so we always send pause message +*/ +int skl_stop_pipe (struct skl_sst *ctx,struct skl_pipe *pipe) +{ +int ret; + +dev_dbg (ctx->dev,"In %s pipe=%d\n" , __func__, pipe->ppl_id); + +/* If pipe was not created in FW, do not try to pause or delete */ +if (pipe->state <SKL_PIPE_PAUSED ) +return 0 ; + + ret =skl_set_pipe_state (ctx, pipe,PPL_PAUSED ); +if (ret <0 ) { +dev_dbg (ctx->dev,"Failed to stop pipe\n" ); +return ret; + } + + pipe->state =SKL_PIPE_CREATED ; + +return 0 ; +}
sound/soc/intel/skylake/skl-topology.h +10 -0
@@ -263,6 +263,16 @@ struct skl_module_cfg {struct skl_specific_cfg formats_config; }; +int skl_create_pipeline (struct skl_sst *ctx,struct skl_pipe *pipe); + +int skl_run_pipe (struct skl_sst *ctx,struct skl_pipe *pipe); + +int skl_pause_pipe (struct skl_sst *ctx,struct skl_pipe *pipe); + +int skl_delete_pipe (struct skl_sst *ctx,struct skl_pipe *pipe); + +int skl_stop_pipe (struct skl_sst *ctx,struct skl_pipe *pipe); +int skl_init_module (struct skl_sst *ctx,struct skl_module_cfg *module_config,char *param);
Signature · 1 line
2.4.3
PATCH 5/13 ASoC: Intel: Skylake: Add pipe and modules handlers
In reply to Subhransu S. PrustyFrom: Jeeja KP <[email protected]>
SKL driver needs to instantiate pipelines and modules in the DSP. Here we start adding building block for handling these. We add resource checks (memory/mcps) for pipelines, find the modules in a pipeline, init modules in a pipe and lastly bind/unbind modules in a pipe
These will be used by pipe event handlers in subsequent patches
--- sound/soc/intel/skylake/Makefile | 3 +- sound/soc/intel/skylake/skl-topology.c | 219 +++++++++++++++++++++++++++++++++ sound/soc/intel/skylake/skl-topology.h | 10 ++ sound/soc/intel/skylake/skl.h | 11 ++ 4 files changed, 242 insertions(+), 1 deletion(-) create mode 100644 sound/soc/intel/skylake/skl-topology.c
sound/soc/intel/skylake/Makefile +2 -1
@@ -1,4 +1,5 @@ -snd-soc-skl-objs := skl.o skl-pcm.o skl-nhlt.o skl-messages.o +snd-soc-skl-objs := skl.o skl-pcm.o skl-nhlt.o skl-messages.o \ +skl-topology.o obj-$(CONFIG_SND_SOC_INTEL_SKYLAKE) += snd-soc-skl.o
sound/soc/intel/skylake/skl-topology.c new file +219 -0
219 lines not on this page · raw message
sound/soc/intel/skylake/skl-topology.h +10 -0
@@ -263,6 +263,16 @@ struct skl_module_cfg {struct skl_specific_cfg formats_config; }; +struct skl_pipeline { +struct skl_pipe *pipe; +struct list_head node; +}; + +struct skl_dapm_path_list { +struct snd_soc_dapm_path *dapm_path; +struct list_head node; +}; +int skl_create_pipeline (struct skl_sst *ctx,struct skl_pipe *pipe);int skl_run_pipe (struct skl_sst *ctx,struct skl_pipe *pipe);
sound/soc/intel/skylake/skl.h +11 -0
@@ -48,6 +48,13 @@#define AZX_REG_VS_SDXEFIFOS_XBASE 0x1094#define AZX_REG_VS_SDXEFIFOS_XINTERVAL 0x20 +struct skl_dsp_resource { +u32 max_mcps; +u32 max_mem; +u32 mcps; +u32 mem; +}; +struct skl {struct hdac_ext_bus ebus;struct pci_dev *pci;
@@ -57,6 +64,10 @@ struct skl {void __iomem *nhlt;/* nhlt ptr */ struct skl_sst *skl_sst;/* sst skl ctx */ + +struct skl_dsp_resource resource; +struct list_head ppl_list; +struct list_head dapm_path_list; };#define skl_to_ebus (s) (&(s)->ebus)
Signature · 1 line
2.4.3
PATCH 6/13 ASoC: Intel: Skylake: Add module configuration helpers
In reply to Subhransu S. PrustyFrom: Jeeja KP <[email protected]>
A module's parameter needs to be updated if there is a src or updown mixer or a converter in the pipeline. The helper function here updates the module parameter based on FE/BE hw_params if fixup/conversion is required.
--- sound/soc/intel/skylake/skl-topology.c | 124 +++++++++++++++++++++++++++++++++ 1 file changed, 124 insertions(+)
sound/soc/intel/skylake/skl-topology.c +124 -0
@@ -27,6 +27,10 @@#include "skl.h" #include "skl-tplg-interface.h" +#define SKL_CH_FIXUP_MASK (1 << 0) +#define SKL_RATE_FIXUP_MASK (1 << 1) +#define SKL_FMT_FIXUP_MASK (1 << 2) +/* * SKL DSP driver modelling uses only few DAPM widgets so for rest we will * ignore. This helpers checks if the SKL driver handles this widget type
@@ -112,6 +116,124 @@ static bool skl_tplg_is_pipe_mcps_available(struct skl *skl,return true; } +static void skl_dump_mconfig (struct skl_sst *ctx, +struct skl_module_cfg *mcfg) +{ +dev_dbg (ctx->dev,"Dumping config\n" ); +dev_dbg (ctx->dev,"Input Format:\n" ); +dev_dbg (ctx->dev,"channels = %d\n" , mcfg->in_fmt.channels); +dev_dbg (ctx->dev,"s_freq = %d\n" , mcfg->in_fmt.s_freq); +dev_dbg (ctx->dev,"ch_cfg = %d\n" , mcfg->in_fmt.ch_cfg); +dev_dbg (ctx->dev,"valid bit depth = %d\n" , mcfg->in_fmt.valid_bit_depth); +dev_dbg (ctx->dev,"Output Format:\n" ); +dev_dbg (ctx->dev,"channels = %d\n" , mcfg->out_fmt.channels); +dev_dbg (ctx->dev,"s_freq = %d\n" , mcfg->out_fmt.s_freq); +dev_dbg (ctx->dev,"valid bit depth = %d\n" , mcfg->out_fmt.valid_bit_depth); +dev_dbg (ctx->dev,"ch_cfg = %d\n" , mcfg->out_fmt.ch_cfg); +} + +static void skl_tplg_update_params (struct skl_module_fmt *fmt, +struct skl_pipe_params *params,int fixup) +{ +if (fixup &SKL_RATE_FIXUP_MASK ) + fmt->s_freq = params->s_freq; +if (fixup &SKL_CH_FIXUP_MASK ) + fmt->channels = params->ch; +if (fixup &SKL_FMT_FIXUP_MASK ) + fmt->valid_bit_depth = params->s_fmt; +} + +/* +* A pipeline may have modules which impact the pcm parameters, like SRC, +* channel converter, format converter. +* We need to calculate the output params by applying the 'fixup' +* Topology will tell driver which type of fixup is to be applied by +* supplying the fixup mask, so based on that we calculate the output +* +* Now In FE the pcm hw_params is source/target format. Same is applicable +* for BE with its hw_params invoked. +* here based on FE, BE pipeline and direction we calculate the input and +* outfix and then apply that for a module +*/ +static void skl_tplg_update_params_fixup (struct skl_module_cfg *m_cfg, +struct skl_pipe_params *params,bool is_fe) {int in_fixup, + out_fixup;struct skl_module_fmt *in_fmt, *out_fmt; + + in_fmt = &m_cfg->in_fmt; + out_fmt = &m_cfg->out_fmt; + +if (params->stream ==SNDRV_PCM_STREAM_PLAYBACK ) { +if (is_fe) { + in_fixup = m_cfg->params_fixup; + out_fixup = (~m_cfg->converter) & m_cfg->params_fixup; + }else { + out_fixup = m_cfg->params_fixup; + in_fixup = (~m_cfg->converter) & m_cfg->params_fixup; + } + }else { +if (is_fe) { + out_fixup = m_cfg->params_fixup; + in_fixup = (~m_cfg->converter) & m_cfg->params_fixup; + }else { + in_fixup = m_cfg->params_fixup; + out_fixup = (~m_cfg->converter) & m_cfg->params_fixup; + } + } + +skl_tplg_update_params (in_fmt, params, in_fixup); +skl_tplg_update_params (out_fmt, params, out_fixup); +} + +/* +* A module needs input and output buffers, which are dependent upon pcm +* params, so once we have calculate params, we need buffer calculation as +* well. +*/ +static void skl_tplg_update_buffer_size (struct skl_sst *ctx, +struct skl_module_cfg *mcfg) +{ +int multiplier =1 ; + +if (mcfg->m_type ==SKL_MODULE_TYPE_SRCINT ) + multiplier =5 ; + + mcfg->ibs = (mcfg->in_fmt.s_freq /1000 ) * + (mcfg->in_fmt.channels) * + (mcfg->in_fmt.bit_depth >>3 ) * + multiplier; + + mcfg->obs = (mcfg->out_fmt.s_freq /1000 ) * + (mcfg->out_fmt.channels) * + (mcfg->out_fmt.bit_depth >>3 ) * + multiplier; +} + +static void skl_tplg_update_module_params (struct snd_soc_dapm_widget *w, +struct skl_sst *ctx) +{ +struct skl_module_cfg *m_cfg = w->priv; +struct skl_pipe_params *params = m_cfg->pipe->p_params; +int p_conn_type = m_cfg->pipe->conn_type; +bool is_fe; + +if (!m_cfg->params_fixup) +return ; + +dev_dbg (ctx->dev,"Mconfig for widget=%s BEFORE updation\n" , w->name); +skl_dump_mconfig (ctx, m_cfg); + +if (p_conn_type ==SKL_PIPE_CONN_TYPE_FE ) + is_fe = true; +else + is_fe = false; + +skl_tplg_update_params_fixup (m_cfg, params, is_fe); +skl_tplg_update_buffer_size (ctx, m_cfg); + +dev_dbg (ctx->dev,"Mconfig for widget=%s AFTER updation\n" , w->name); +skl_dump_mconfig (ctx, m_cfg); +} +/* * A pipe can have multiple modules each of the will be a DAPM widget as * well. While managing a pipeline we need to get the list of all the
@@ -174,6 +296,8 @@ static int skl_tplg_init_pipe_modules(struct skl *skl, struct skl_pipe *pipe)if (!skl_tplg_is_pipe_mcps_available (skl, mconfig))return -ENOMEM ; +/* apply fix/conversion to module params based on FE/BE params*/ +skl_tplg_update_module_params (w, ctx); ret =skl_init_module (ctx, mconfig,NULL );if (ret <0 )return ret;
Signature · 1 line
2.4.3
PATCH 7/13 ASoC: Intel: Skylake: add DSP platform widget event handlers
In reply to Subhransu S. PrustyFrom: Jeeja KP <[email protected]>
This adds widget event handlers for PRE/POST PMU and PRE/POST PMD event for mixer and pga modules. The SKL topology uses PGA and mixer modules to model a topology and manage that with DSP.
These event handlers invoke pipeline creation, destroy, module creation, module bind, unbind and pipeline bind unbind
Event handler sequencing is implement to target the DSP FW sequence expectations to enable path from source to sink pipe for Playback/Capture.
--- sound/soc/intel/skylake/skl-topology.c | 411 +++++++++++++++++++++++++++++++++ 1 file changed, 411 insertions(+)
sound/soc/intel/skylake/skl-topology.c +411 -0
@@ -341,3 +341,414 @@ static int skl_tplg_bind_unbind_pipe_modules(struct skl_sst *ctx, }return 0 ; } + +/* +* in the Pre-PMU event of mixer we need to do following: +* - check the resources +* - Create the pipeline +* - Initialize the modules in pipeline +* - finally bind all modules together +*/ +static int skl_tplg_mixer_dapm_pre_pmu_event (struct snd_soc_dapm_widget *w, +struct skl *skl) +{ +int ret; +struct skl_module_cfg *mconfig = w->priv; +struct skl_pipe *s_pipe = mconfig->pipe; +struct skl_sst *ctx = skl->skl_sst; + +dev_dbg (ctx->dev,"%s: widget =%s\n" , __func__, w->name); + +/* check resource available */ +if (!skl_tplg_is_pipe_mcps_available (skl, mconfig)) +return -EBUSY ; + +if (!skl_tplg_is_pipe_mem_available (skl, mconfig)) +return -ENOMEM ; + +/* +* Create list of modules for pipe +* list contains modules from source to sink +*/ + ret =skl_create_pipeline (ctx, mconfig->pipe); +if (ret <0 ) +return ret; + +if (list_empty (&s_pipe->w_list)) { + ret =skl_tplg_get_pipe_widget (ctx->dev, w, s_pipe); +if (ret <0 ) +return ret; + } + +/* Init all pipe modules from source to sink */ + ret =skl_tplg_init_pipe_modules (skl, s_pipe); +if (ret <0 ) +return ret; + +/* Bind modules from source to sink */ +return skl_tplg_bind_unbind_pipe_modules (ctx, s_pipe, true); +} +/* +* in the Pre-PMU event of PGA we need to do following: +* - Bind to sink pipeline +* - Start sink pipeline, if not running +* - Then run current pipe +*/ +static int skl_tplg_pga_dapm_pre_pmu_event (struct snd_soc_dapm_widget *w, +struct skl *skl) +{ +struct snd_soc_dapm_path *p; +struct skl_dapm_path_list *path_list; +struct snd_soc_dapm_widget *source, *sink; +struct skl_module_cfg *src_mconfig, *sink_mconfig; +struct skl_sst *ctx = skl->skl_sst; +int ret =0 ; + +dev_dbg (ctx->dev,"%s: widget =%s\n" , __func__, w->name); + + source = w; + +/* If its not SKL DSP type dont handle */ +if (source->priv ==NULL && (!is_skl_dsp_widget_type (w))) +return 0 ; + + src_mconfig = source->priv; + +/* +* find which sink it is connected to, bind with the sink, +* if sink is not started, start sink pipe first, then start +* this pipe +*/ +list_for_each_entry (p, &w->sinks, list_source) { +if (!p->connect) +continue ; + +dev_dbg (ctx->dev,"%s: src widget=%s\n" , __func__, w->name); +dev_dbg (ctx->dev,"%s: sink widget=%s\n" , __func__, p->sink->name); + +if ((p->sink->priv !=NULL ) &&is_skl_dsp_widget_type (p->sink)) { + + sink = p->sink; + src_mconfig = source->priv; + sink_mconfig = sink->priv; + +/* Bind source to sink, mixin is always source */ + ret =skl_tplg_bind_unbind_pipes (src_mconfig, + sink_mconfig, ctx, true); +if (ret) +return ret; + +/* Start sinks pipe first */ +if (sink_mconfig->pipe->state !=SKL_PIPE_STARTED ) { + ret =skl_run_pipe (ctx, sink_mconfig->pipe); +if (ret) +return ret; + } + + path_list =kzalloc (sizeof (struct skl_dapm_path_list ), +GFP_KERNEL ); +if (NULL == path_list) +return -ENOMEM ; + +/* Add connected path to one global list */ + path_list->dapm_path = p; +list_add_tail (&path_list->node, &skl->dapm_path_list); +break ; + } + } + +/* Start source pipe last after starting all sinks */ + ret =skl_run_pipe (ctx, src_mconfig->pipe); +if (ret) +return ret; + +return 0 ; +} + +/* +* in the Post-PMU event of mixer we need to do following: +* - Check if this pipe is running +* - if not, then +* - bind this pipeline to its source pipeline +* - start this pipeline +*/ +static int skl_tplg_mixer_dapm_post_pmu_event (struct snd_soc_dapm_widget *w, +struct skl *skl) +{ +int ret =0 ; +struct snd_soc_dapm_path *p; +struct snd_soc_dapm_widget *source, *sink; +struct skl_module_cfg *src_mconfig, *sink_mconfig; +struct skl_sst *ctx = skl->skl_sst; +int src_pipe_started =0 ; + +dev_dbg (ctx->dev,"%s: widget = %s\n" , __func__, w->name); + + sink = w; + +/* If this is not a SKL DSP widget, nothing to be done */ +if (sink->priv ==NULL && (!is_skl_dsp_widget_type (w))) +return 0 ; + + sink_mconfig = sink->priv; + +/* +* If source pipe is already started, that means source is driving +* one more sink before this sink got connected, Since source is +* started, bind this sink to source and start this pipe. +*/ +list_for_each_entry (p, &w->sources, list_sink) { +if (!p->connect) +continue ; +dev_dbg (ctx->dev,"sink widget=%s\n" , w->name); +dev_dbg (ctx->dev,"src widget=%s\n" , p->source->name); + +if ((p->source->priv !=NULL ) &&is_skl_dsp_widget_type (p->source)) { + source = p->source; + src_mconfig = source->priv; + sink_mconfig = sink->priv; + src_pipe_started =1 ; + +/* +* check pipe state, then no need to bind or start the +* pipe +*/ +if (src_mconfig->pipe->state !=SKL_PIPE_STARTED ) + src_pipe_started =0 ; + } + } +if (src_pipe_started) { + ret =skl_tplg_bind_unbind_pipes (src_mconfig, sink_mconfig, + ctx, true); +if (ret) +return ret; + +return skl_run_pipe (ctx, sink_mconfig->pipe); + } + +return ret; +} + +/* +* in the Pre-PMD event of mixer we need to do following: +* - Stop the pipe +* - find the source connections +* - unbind with source pipelines if still connected +*/ +static int skl_tplg_mixer_dapm_pre_pmd_event (struct snd_soc_dapm_widget *w, +struct skl *skl) +{ +struct snd_soc_dapm_widget *source, *sink; +struct skl_module_cfg *src_mconfig, *sink_mconfig; +int ret =0 , path_found =0 ; +struct skl_dapm_path_list *path_list, *tmp_list; +struct skl_sst *ctx = skl->skl_sst; + +dev_dbg (ctx->dev,"%s: widget = %s\n" , __func__, w->name); + + sink = w; +if (sink->priv ==NULL && (!is_skl_dsp_widget_type (w))) +return 0 ; + + sink_mconfig = sink->priv; +/* Stop the pipe */ + ret =skl_stop_pipe (ctx, sink_mconfig->pipe); +if (ret) +return ret; + +list_for_each_entry_safe (path_list, tmp_list, &skl->dapm_path_list, node) { +if (path_list->dapm_path->sink == sink) { +dev_dbg (ctx->dev,"Path found = %s\n" , path_list->dapm_path->name); + source = path_list->dapm_path->source; + src_mconfig = source->priv; + path_found =1 ; + +list_del (&path_list->node); +kfree (path_list); +break ; + } + } + +/* +* If path_found == 1, that means pmd for source pipe has +* not occurred, source is connected to some other sink. +* so its responsibility of sink to unbind itself from source. +*/ +if (path_found) + ret =skl_tplg_bind_unbind_pipes (src_mconfig, sink_mconfig, + ctx, false); + +return ret; +} + +/* +* in the Post-PMD event of mixer we need to do following: +* - Free the mcps used +* - Free the mem used +* - Unbind the modules within the pipeline +* - Delete the pipeline (modules are not required to be explicitly +* deleted, pipeline delete is enough here +*/ +static int skl_tplg_mixer_dapm_post_pmd_event (struct snd_soc_dapm_widget *w, +struct skl *skl) +{ +struct skl_module_cfg *mconfig = w->priv; +int ret =0 ; +struct skl_sst *ctx = skl->skl_sst; +struct skl_pipe *s_pipe = mconfig->pipe; + +dev_dbg (ctx->dev,"%s: widget = %s\n" , __func__, w->name); + + skl->resource.mcps -= mconfig->mcps; + + ret =skl_tplg_bind_unbind_pipe_modules (ctx, s_pipe, false); +if (ret <0 ) +return ret; + + ret =skl_delete_pipe (ctx, mconfig->pipe); + skl->resource.mem -= mconfig->pipe->memory_pages; + +return ret; +} + +/* +* in the Post-PMD event of PGA we need to do following: +* - Free the mcps used +* - Stop the pipeline +* - In source pipe is connected, unbind with source pipelines +*/ +static int skl_tplg_pga_dapm_post_pmd_event (struct snd_soc_dapm_widget *w, +struct skl *skl) +{ +struct snd_soc_dapm_widget *source, *sink; +struct skl_module_cfg *src_mconfig, *sink_mconfig; +int ret =0 , path_found =0 ; +struct skl_dapm_path_list *path_list, *tmp_path_list; +struct skl_sst *ctx = skl->skl_sst; + +dev_dbg (ctx->dev,"%s: widget = %s\n" , __func__, w->name); + + source = w; +if (source->priv ==NULL && (!is_skl_dsp_widget_type (w))) +return 0 ; + + src_mconfig = source->priv; + + skl->resource.mcps -= src_mconfig->mcps; +/* Stop the pipe since this is a mixin module */ + ret =skl_stop_pipe (ctx, src_mconfig->pipe); +if (ret) +return ret; + +list_for_each_entry_safe (path_list, tmp_path_list, &skl->dapm_path_list, node) { +if (path_list->dapm_path->source == source) { +dev_dbg (ctx->dev,"Path found = %s\n" , path_list->dapm_path->name); + sink = path_list->dapm_path->sink; + sink_mconfig = sink->priv; + path_found =1 ; + +list_del (&path_list->node); +kfree (path_list); +break ; + } + } + +/* +* This is a connecter and if path is found that means +* unbind between source and sink has not happened yet +*/ +if (path_found) + ret =skl_tplg_bind_unbind_pipes (src_mconfig, sink_mconfig, + ctx, false); + +return ret; +} + +static struct skl *get_skl_ctx (struct device *dev) +{ +struct hdac_ext_bus *ebus =dev_get_drvdata (dev); + +return ebus_to_skl (ebus); +} + +/* In modelling, we assume ther will be one mixer in a pipeline. +* If mixer is not required then it is treated as static mixer aka vmixer +* with a hard path to source module +* So we dont need to check if source is started or not as hard path puts +* dependency on each other +*/ +static int skl_tplg_vmixer_event (struct snd_soc_dapm_widget *w, +struct snd_kcontrol *k,int event) +{ +struct snd_soc_dapm_context *dapm = w->dapm; +struct skl *skl =get_skl_ctx (dapm->dev); + +dev_dbg (dapm->dev,"%s:widget=%s event=%d\n" , __func__, w->name, event); + +switch (event) { +case SND_SOC_DAPM_PRE_PMU : +return skl_tplg_mixer_dapm_pre_pmu_event (w, skl); + +case SND_SOC_DAPM_POST_PMD : +return skl_tplg_mixer_dapm_post_pmd_event (w, skl); + } + +return 0 ; +} + +/* +* In modelling, we assume ther will be one mixer in a pipeline. If a second +* one is required that is created as another pipe entity. +* The mixer is resposible for pipe management and represent a pipeline +* instance +*/ +static int skl_tplg_mixer_event (struct snd_soc_dapm_widget *w, +struct snd_kcontrol *k,int event) +{ +struct snd_soc_dapm_context *dapm = w->dapm; +struct skl *skl =get_skl_ctx (dapm->dev); + +dev_dbg (dapm->dev,"%s:widget=%s event=%d\n" , __func__, w->name, event); + +switch (event) { +case SND_SOC_DAPM_PRE_PMU : +return skl_tplg_mixer_dapm_pre_pmu_event (w, skl); + +case SND_SOC_DAPM_POST_PMU : +return skl_tplg_mixer_dapm_post_pmu_event (w, skl); + +case SND_SOC_DAPM_PRE_PMD : +return skl_tplg_mixer_dapm_pre_pmd_event (w, skl); + +case SND_SOC_DAPM_POST_PMD : +return skl_tplg_mixer_dapm_post_pmd_event (w, skl); + } + +return 0 ; +} + +/* +* In modelling, we assumed rest of the modules in pipeline are PGA. But we +* are interested in last PGA (leaf PGA) in a pipeline to disconnect with +* the sink when it is running (two FE to one BE or one FE to two BE) +* scenarios +*/ +static int skl_tplg_pga_event (struct snd_soc_dapm_widget *w, +struct snd_kcontrol *k,int event) + +{ +struct snd_soc_dapm_context *dapm = w->dapm; +struct skl *skl =get_skl_ctx (dapm->dev); + +dev_dbg (dapm->dev,"%s:widget=%s event=%d\n" , __func__, w->name, event); + +switch (event) { +case SND_SOC_DAPM_PRE_PMU : +return skl_tplg_pga_dapm_pre_pmu_event (w, skl); + +case SND_SOC_DAPM_POST_PMD : +return skl_tplg_pga_dapm_post_pmd_event (w, skl); + } + +return 0 ; +}
Signature · 1 line
2.4.3
PATCH 8/13 ASoC: Intel: Skylake: Add FE and BE hw_params handling
In reply to Subhransu S. PrustyFrom: Jeeja KP <[email protected]>
For FE and BE, the PCM parameters come from FE and BE hw_params values passed. For a FE we convert the FE params to DSP expected module format and pass to DSP. For a BE we need to find the gateway settings (i2s/PDM) to be applied. These are queried from NHLT table and applied.
Further for BE based on direction the settings are applied as either source or destination parameters.
These helpers here allow the format to be calculated and queried as per firmware format.
--- sound/soc/intel/skylake/skl-topology.c | 274 +++++++++++++++++++++++++++++++++ sound/soc/intel/skylake/skl-topology.h | 11 ++ 2 files changed, 285 insertions(+)
sound/soc/intel/skylake/skl-topology.c +274 -0
@@ -752,3 +752,277 @@ static int skl_tplg_pga_event(struct snd_soc_dapm_widget *w,return 0 ; } + +/* +* The FE params are passed by hw_params of the DAI. +* On hw_params, the params are stored in Gateway module of the FE and we +* need to calculate the format in DSP module configuration, that conversion +* is done here +*/ +static void skl_tplg_update_pipe_params (struct device *dev, +struct skl_module_cfg *mconfig, +struct skl_pipe_params *params) +{ +struct skl_pipe *pipe = mconfig->pipe; +struct skl_module_fmt *format =NULL ; + +memcpy (pipe->p_params, params,sizeof (*params)); + +if (params->stream ==SNDRV_PCM_STREAM_PLAYBACK ) + format = &mconfig->in_fmt; +else + format = &mconfig->out_fmt; + +/* set the hw_params */ + format->s_freq = params->s_freq; + format->channels = params->ch; + format->valid_bit_depth =skl_get_bit_depth (params->s_fmt); + +/* +* 16 bit is 16 bit container whereas 24 bit is in 32 bit container so +* update bit depth accordingly +*/ +if (format->valid_bit_depth ==SKL_DEPTH_16BIT ) + format->bit_depth = format->valid_bit_depth; +else if (format->valid_bit_depth ==SKL_DEPTH_24BIT ) + format->bit_depth =SKL_DEPTH_32BIT ; + +if (params->stream ==SNDRV_PCM_STREAM_PLAYBACK ) { + mconfig->ibs = (format->s_freq /1000 ) * + (format->channels) * + (format->bit_depth >>3 ); + }else { + mconfig->obs = (format->s_freq /1000 ) * + (format->channels) * + (format->bit_depth >>3 ); + } +} + +/* +* Query the module config for the FE DAI +* This is used to find the hw_params set for that DAI and apply to FE +* pipeline +*/ +static struct skl_module_cfg * +skl_tplg_fe_get_cpr_module (struct snd_soc_dai *dai,int stream) +{ +struct snd_soc_dapm_widget *w; +struct snd_soc_dapm_path *p =NULL ; + +dev_dbg (dai->dev,"%s: enter, dai-name=%s\n" , __func__, dai->name); + +if (stream ==SNDRV_PCM_STREAM_PLAYBACK ) { + w = dai->playback_widget; +dev_dbg (dai->dev,"Stream name=%s\n" , w->name); +list_for_each_entry (p, &w->sinks, list_source) { +if (p->connect && p->sink->power && +is_skl_dsp_widget_type (p->sink)) +continue ; + +if (p->sink->priv) { +dev_dbg (dai->dev,"set params for %s\n" , p->sink->name); +return p->sink->priv; + } + } + }else { + w = dai->capture_widget; +dev_dbg (dai->dev,"Stream name=%s\n" , w->name); +list_for_each_entry (p, &w->sources, list_sink) { +if (p->connect && p->source->power && +is_skl_dsp_widget_type (p->source)) +continue ; + +if (p->source->priv) { +dev_dbg (dai->dev,"set params for %s\n" , p->source->name); +return p->source->priv; + } + } + } +return NULL ; +} + +int skl_tplg_fe_update_params (struct snd_soc_dai *dai, +struct skl_pipe_params *params) +{ +struct skl_module_cfg *m_cfg; + + m_cfg =skl_tplg_fe_get_cpr_module (dai, params->stream); + +if (m_cfg) +skl_tplg_update_pipe_params (dai->dev, m_cfg, params); + +return 0 ; +} + +static u8 skl_tplg_be_link_type (int dev_type) +{ +int ret; + +switch (dev_type) { +case SKL_DEVICE_BT : + ret =NHLT_LINK_SSP ; +break ; + +case SKL_DEVICE_DMIC : + ret =NHLT_LINK_DMIC ; +break ; + +case SKL_DEVICE_I2S : + ret =NHLT_LINK_SSP ; +break ; + +case SKL_DEVICE_HDALINK : + ret =NHLT_LINK_HDA ; +break ; + +default : + ret =NHLT_LINK_INVALID ; +break ; + } + +return ret; +} + +/* +* Fill the BE gateway parameters +* The BE gateway expects a blob of parameters which are kept in the ACPI +* NHLT blob, so query the blob for interface type (i2s/pdm) and instance. +* The port cna have multiple settings so pick based on the PCM +* parameters +*/ +static int skl_tplg_be_fill_pipe_params (struct snd_soc_dai *dai, +struct skl_module_cfg *mconfig,struct skl_pipe_params *params) +{ +struct skl_pipe *pipe = mconfig->pipe; +struct nhlt_specific_cfg *cfg; +struct skl *skl =get_skl_ctx (dai->dev); +int link_type =skl_tplg_be_link_type (mconfig->dev_type); + +memcpy (pipe->p_params, params,sizeof (*params)); + +/* update the blob based on virtual bus_id*/ + cfg = (struct nhlt_specific_cfg *)skl_get_ep_blob (skl, + mconfig->vbus_id, link_type, params->s_fmt, + params->ch, params->s_freq, params->stream); + +if (cfg) { + mconfig->formats_config.caps_size = cfg->size; +memcpy (mconfig->formats_config.caps, &cfg->caps, cfg->size); + }else { +dev_dbg (dai->dev,"Blob is NULL" ); +return -EINVAL ; + } + +return 0 ; +} + +static int skl_tplg_be_set_params (struct snd_soc_dai *dai, +struct snd_soc_dapm_widget *w, +struct skl_pipe_params *params) +{ +if (!w->power) { +dev_dbg (dai->dev,"set params for widget=%s\n" , w->name); +return skl_tplg_be_fill_pipe_params (dai, w->priv, params); + } + +return -EINVAL ; +} + +static int skl_tplg_be_set_src_pipe_params (struct snd_soc_dai *dai, +struct snd_soc_dapm_widget *w, +struct skl_pipe_params *params) +{ +struct snd_soc_dapm_path *p; +int ret =0 ; + +dev_dbg (dai->dev,"In %swidget name=%s\n" , __func__, w->name); + +list_for_each_entry (p, &w->sources, list_sink) { +if (p->connect &&is_skl_dsp_widget_type (p->source) && + p->source->priv) { + ret =skl_tplg_be_set_params (dai, p->source, params); + +if (ret <0 ) +return ret; + }else { + ret =skl_tplg_be_set_src_pipe_params (dai, p->source, + params); + } + } + +return ret; +} + +static int skl_tplg_be_set_sink_pipe_params (struct snd_soc_dai *dai, +struct snd_soc_dapm_widget *w,struct skl_pipe_params *params) +{ +struct snd_soc_dapm_path *p =NULL ; +int ret =0 ; + +dev_dbg (dai->dev,"widget name=%s\n" , w->name); + +list_for_each_entry (p, &w->sinks, list_source) { +if (p->connect &&is_skl_dsp_widget_type (p->sink) && + p->sink->priv) { + ret =skl_tplg_be_set_params (dai, p->sink, params); + +if (ret <0 ) +return ret; + }else { + ret =skl_tplg_be_set_sink_pipe_params (dai, p->sink, + params); + } + } + +return ret; +} + +/* +* BE hw_params can be a source parameters (capture) or sink parameters +* (playback). Based on sink and source we need to either find the source +* list or the sink list and set the pipeline parameters +*/ +int skl_tplg_be_update_params (struct snd_soc_dai *dai, +struct skl_pipe_params *params) +{ +struct snd_soc_dapm_widget *w; + +dev_dbg (dai->dev,"In %s dai-name=%s\n" , __func__, dai->name); + +if (params->stream ==SNDRV_PCM_STREAM_PLAYBACK ) { + w = dai->playback_widget; + +dev_dbg (dai->dev,"Stream name=%s\n" , w->name); +return skl_tplg_be_set_src_pipe_params (dai, w, params); + } + +if (params->stream ==SNDRV_PCM_STREAM_CAPTURE ) { + w = dai->capture_widget; + +dev_dbg (dai->dev,"Stream name=%s\n" , w->name); +return skl_tplg_be_set_sink_pipe_params (dai, w, params); + } + +return 0 ; +} + +/* Run/Stop the FE pipeline */ +int skl_tplg_set_fe_pipeline_state (struct snd_soc_dai *dai,bool start, +int stream) +{ +struct skl *skl =get_skl_ctx (dai->dev); +struct skl_sst *ctx = skl->skl_sst; +struct skl_module_cfg *mconfig =NULL ; + +dev_dbg (dai->dev,"%s: enter, dai-name=%s dir=%d\n" , __func__, dai->name, stream); + + mconfig =skl_tplg_fe_get_cpr_module (dai, stream); +if (mconfig !=NULL ) { +if (start) +return skl_run_pipe (ctx, mconfig->pipe); +else +return skl_stop_pipe (ctx, mconfig->pipe); + } + +return 0 ; +}
sound/soc/intel/skylake/skl-topology.h +11 -0
@@ -273,6 +273,17 @@ struct skl_dapm_path_list {struct list_head node; }; +int skl_tplg_fe_update_params (struct snd_soc_dai *dai, +struct skl_pipe_params *params); +int skl_tplg_be_update_params (struct snd_soc_dai *dai, +struct skl_pipe_params *params); +void skl_tplg_set_be_dmic_config (struct snd_soc_dai *dai, +struct skl_pipe_params *params,int stream); +int skl_tplg_init (struct snd_soc_platform *platform, +struct hdac_ext_bus *ebus); +int skl_tplg_set_fe_pipeline_state (struct snd_soc_dai *dai, +bool start,int stream); +int skl_create_pipeline (struct skl_sst *ctx,struct skl_pipe *pipe);int skl_run_pipe (struct skl_sst *ctx,struct skl_pipe *pipe);
Signature · 1 line
2.4.3
PATCH 9/13 ASoC: Intel: Skylake: Add topology core init and handlers
In reply to Subhransu S. PrustyFrom: Jeeja KP <[email protected]>
The SKL driver does not code DSP topology in driver. It uses the newly added ASoC topology core to parse the topology information (controls, widgets and map) from topology binary. We add init routine to invoke topology load and callback for topology creation.
--- sound/soc/intel/skylake/skl-topology.c | 236 +++++++++++++++++++++++++++ sound/soc/intel/skylake/skl-tplg-interface.h | 78 +++++++++ 2 files changed, 314 insertions(+)
sound/soc/intel/skylake/skl-topology.c +236 -0
@@ -1026,3 +1026,239 @@ int skl_tplg_set_fe_pipeline_state(struct snd_soc_dai *dai, bool start,return 0 ; } + +const struct snd_soc_tplg_widget_events skl_tplg_widget_ops[] = { + {SKL_MIXER_EVENT , skl_tplg_mixer_event}, + {SKL_VMIXER_EVENT , skl_tplg_vmixer_event}, + {SKL_PGA_EVENT , skl_tplg_pga_event}, +}; + +/* +* The topology binary passes the pin info for a module so initialize the pin +* info passed into module instance +*/ +static void skl_fill_module_pin_info (struct device *dev, +struct skl_module_pin *m_pin, +int max_pin) +{ +int i; + +for (i =0 ; i < max_pin; i++) { + m_pin[i].id.module_id =0 ; + m_pin[i].id.instance_id =0 ; + m_pin[i].in_use = false; + m_pin[i].is_dynamic = true; + m_pin[i].pin_index = i; + } +} + +/* +* Add pipeline from topology binary into driver pipeline list +* +* If already added we return that instance +* Otherwise we create a new instance and add into driver list +*/ +static struct skl_pipe *skl_tplg_add_pipe (struct device *dev, +struct skl *skl, +struct skl_dfw_pipe *dfw_pipe) +{ +struct skl_pipeline *ppl; +struct skl_pipe *pipe; +struct skl_pipe_params *params; + +list_for_each_entry (ppl, &skl->ppl_list, node) { +if (ppl->pipe->ppl_id == dfw_pipe->pipe_id) +return ppl->pipe; + } + + ppl =devm_kzalloc (dev,sizeof (*ppl),GFP_KERNEL ); +if (!ppl) +return NULL ; + + pipe =devm_kzalloc (dev,sizeof (*pipe),GFP_KERNEL ); +if (!pipe) +return NULL ; + + params =devm_kzalloc (dev,sizeof (*params),GFP_KERNEL ); +if (!params) +return NULL ; + + pipe->ppl_id = dfw_pipe->pipe_id; + pipe->memory_pages = dfw_pipe->memory_pages; + pipe->pipe_priority = dfw_pipe->pipe_priority; + pipe->conn_type = dfw_pipe->conn_type; + pipe->state =SKL_PIPE_INVALID ; + pipe->p_params = params; +INIT_LIST_HEAD (&pipe->w_list); + + ppl->pipe = pipe; +list_add (&ppl->node, &skl->ppl_list); + +return ppl->pipe; +} + +static void skl_tplg_dump_widget_info (struct device *dev, +struct skl_dfw_module *dfw_cfg, +struct snd_soc_tplg_dapm_widget *w) +{ +dev_dbg (dev,"widget Info for widget=%s\n" , w->name); +dev_dbg (dev,"In%s pvt_data_len=%d\n" , __func__, w->priv.size); +dev_dbg (dev,"copying widget private data\n" ); + +dev_dbg (dev,"module id = %d\n" , dfw_cfg->module_id); +dev_dbg (dev,"module instance = %d\n" , dfw_cfg->instance_id); +dev_dbg (dev,"mcps = %d\n" , dfw_cfg->max_mcps); +dev_dbg (dev,"ibs = %d\n" , dfw_cfg->ibs); +dev_dbg (dev,"obs = %d\n" , dfw_cfg->obs); +dev_dbg (dev,"core_id=%d\n" , dfw_cfg->core_id); +} + +/* +* Topology core widget load callback +* +* This is used to save the private data for each widget which gives +* information to the driver about module and pipeline parameters which DSP +* FW expects like ids, resource values, formats etc +*/ +static int skl_tplg_widget_load (struct snd_soc_component *cmpnt, +struct snd_soc_dapm_widget *w, +struct snd_soc_tplg_dapm_widget *tplg_w) +{ +int ret; +struct hdac_ext_bus *ebus =snd_soc_component_get_drvdata (cmpnt); +struct skl *skl =ebus_to_skl (ebus); +struct hdac_bus *bus =ebus_to_hbus (ebus); +struct skl_module_cfg *mconfig; +struct skl_pipe *pipe; +struct skl_dfw_module *dfw_config = (struct skl_dfw_module *) tplg_w->priv.data; + +skl_tplg_dump_widget_info (bus->dev, dfw_config, tplg_w); + +if (!tplg_w->priv.size) + goto bind_event; + + mconfig =devm_kzalloc (bus->dev,sizeof (*mconfig),GFP_KERNEL ); + +if (!mconfig) +return -ENOMEM ; + + w->priv = mconfig; + mconfig->id.module_id = dfw_config->module_id; + mconfig->id.instance_id = dfw_config->instance_id; + mconfig->mcps = dfw_config->max_mcps; + mconfig->ibs = dfw_config->ibs; + mconfig->obs = dfw_config->obs; + mconfig->core_id = dfw_config->core_id; + mconfig->max_in_queue = dfw_config->max_in_queue; + mconfig->max_out_queue = dfw_config->max_out_queue; + mconfig->is_loadable = dfw_config->is_loadable; + mconfig->in_fmt.channels = dfw_config->in_fmt.channels; + mconfig->in_fmt.s_freq = dfw_config->in_fmt.freq; + mconfig->in_fmt.bit_depth = dfw_config->in_fmt.bit_depth; + mconfig->in_fmt.valid_bit_depth = dfw_config->in_fmt.valid_bit_depth; + mconfig->in_fmt.ch_cfg = dfw_config->in_fmt.ch_cfg; + mconfig->out_fmt.channels = dfw_config->out_fmt.channels; + mconfig->out_fmt.s_freq = dfw_config->out_fmt.freq; + mconfig->out_fmt.bit_depth = dfw_config->out_fmt.bit_depth; + mconfig->out_fmt.valid_bit_depth = dfw_config->out_fmt.valid_bit_depth; + mconfig->out_fmt.ch_cfg = dfw_config->out_fmt.ch_cfg; + mconfig->params_fixup = dfw_config->params_fixup; + mconfig->converter = dfw_config->converter; + mconfig->m_type = dfw_config->module_type; + mconfig->vbus_id = dfw_config->vbus_id; + + pipe =skl_tplg_add_pipe (bus->dev, skl, &dfw_config->pipe); +if (pipe) + mconfig->pipe = pipe; + + mconfig->dev_type = dfw_config->dev_type; + mconfig->hw_conn_type = dfw_config->hw_conn_type; + mconfig->time_slot = dfw_config->time_slot; + mconfig->formats_config.caps_size = dfw_config->caps.caps_size; + + mconfig->m_in_pin =devm_kzalloc (bus->dev, (mconfig->max_in_queue) * +sizeof (*mconfig->m_in_pin), +GFP_KERNEL ); +if (!mconfig->m_in_pin) +return -ENOMEM ; + + mconfig->m_out_pin =devm_kzalloc (bus->dev, (mconfig->max_in_queue) * +sizeof (*mconfig->m_out_pin), +GFP_KERNEL ); +if (!mconfig->m_out_pin) +return -ENOMEM ; + +skl_fill_module_pin_info (bus->dev, mconfig->m_in_pin, + mconfig->max_in_queue); +skl_fill_module_pin_info (bus->dev, mconfig->m_out_pin, + mconfig->max_out_queue); + +if (mconfig->formats_config.caps_size ==0 ) + goto bind_event; + + mconfig->formats_config.caps = (u32 *)devm_kzalloc (bus->dev, + mconfig->formats_config.caps_size,GFP_KERNEL ); + +if (mconfig->formats_config.caps ==NULL ) +return -ENOMEM ; + +memcpy (mconfig->formats_config.caps, dfw_config->caps.caps, + dfw_config->caps.caps_size); + +bind_event: +if (tplg_w->event_type ==0 ) { +dev_info (bus->dev,"ASoC: No event handler required\n" ); +return 0 ; + } + + ret =snd_soc_tplg_widget_bind_event (w, skl_tplg_widget_ops, +ARRAY_SIZE (skl_tplg_widget_ops), tplg_w->event_type); + +if (ret) { +dev_err (bus->dev,"%s: No matching event handlers found for %d\n" , + __func__, tplg_w->event_type); +return -EINVAL ; + } + +return 0 ; +} + +static struct snd_soc_tplg_ops skl_tplg_ops = { + .widget_load = skl_tplg_widget_load, +}; + +/* This will be read from topology manifest, currently defined here */ +#define SKL_MAX_MCPS 30000000 +#define SKL_FW_MAX_MEM 1000000 + +/* +* SKL topology init routine +*/ +int skl_tplg_init (struct snd_soc_platform *platform,struct hdac_ext_bus *ebus) +{ +int ret; +const struct firmware *fw; +struct hdac_bus *bus =ebus_to_hbus (ebus); +struct skl *skl =ebus_to_skl (ebus); + +dev_dbg (bus->dev,"In%s req firmware topology bin\n" , __func__); + ret =request_firmware (&fw,"dfw_sst.bin" , bus->dev); +if (fw ==NULL ) { +dev_err (bus->dev,"config firmware request failed with %d\n" , ret); +return ret; + } + +dev_dbg (bus->dev,"In%s soc fw load_platform\n" , __func__); +/* Index is for each config load */ + ret =snd_soc_tplg_component_load (&platform->component, &skl_tplg_ops, fw,0 ); + +if (ret <0 ) { +dev_err (bus->dev,"tplg component load failed%d\n" , ret); +return -EINVAL ; + } + + skl->resource.max_mcps =SKL_MAX_MCPS ; + skl->resource.max_mem =SKL_FW_MAX_MEM ; + +return 0 ; +}
sound/soc/intel/skylake/skl-tplg-interface.h +78 -0
88 lines not on this page · raw message
Signature · 1 line
2.4.3
PATCH 10/13 ASoC: Intel: Skylake: Initialize and load DSP controls
In reply to Subhransu S. PrustyFrom: Jeeja KP <[email protected]>
Initialize and creates DSP controls if processing pipe capability is supported by HW. Updates the dma_id, hw_params to module param to be used when DSP module has to be configured.
--- sound/soc/intel/skylake/skl-pcm.c | 140 ++++++++++++++++++++++++++++++-------- 1 file changed, 113 insertions(+), 27 deletions(-)
sound/soc/intel/skylake/skl-pcm.c +113 -27
@@ -24,6 +24,7 @@#include <sound/pcm_params.h> #include <sound/soc.h> #include "skl.h" +#include "skl-topology.h" #define HDA_MONO 1#define HDA_STEREO 2
@@ -214,6 +215,7 @@ static int skl_pcm_hw_params(struct snd_pcm_substream *substream,struct hdac_ext_bus *ebus =dev_get_drvdata (dai->dev);struct hdac_ext_stream *stream =get_hdac_ext_stream (substream);struct snd_pcm_runtime *runtime = substream->runtime; +struct skl_pipe_params p_params = {0 };int ret, dma_id;dev_dbg (dai->dev,"%s: %s\n" , __func__, dai->name);
@@ -228,6 +230,13 @@ static int skl_pcm_hw_params(struct snd_pcm_substream *substream, dma_id =hdac_stream (stream)->stream_tag -1 ;dev_dbg (dai->dev,"dma_id=%d\n" , dma_id); + p_params.s_fmt =snd_pcm_format_width (params_format (params)); + p_params.ch =params_channels (params); + p_params.s_freq =params_rate (params); + p_params.host_dma_id = dma_id; + p_params.stream = substream->stream; +skl_tplg_fe_update_params (dai, &p_params); +return 0 ; }
@@ -268,6 +277,46 @@ static int skl_pcm_hw_free(struct snd_pcm_substream *substream,return skl_substream_free_pages (ebus_to_hbus (ebus), substream); } +static int skl_be_hw_params (struct snd_pcm_substream *substream, +struct snd_pcm_hw_params *params, +struct snd_soc_dai *dai) +{ +struct skl_pipe_params p_params = {0 }; + +dev_dbg (dai->dev,"%s: %s\n" , __func__, dai->name); + + p_params.s_fmt =snd_pcm_format_width (params_format (params)); + p_params.ch =params_channels (params); + p_params.s_freq =params_rate (params); + p_params.stream = substream->stream; +skl_tplg_be_update_params (dai, &p_params); + +return 0 ; +} + +static int skl_pcm_trigger (struct snd_pcm_substream *substream,int cmd, +struct snd_soc_dai *dai) +{ +dev_dbg (dai->dev,"In %s cmd=%d\n" , __func__, cmd); + +switch (cmd) { +case SNDRV_PCM_TRIGGER_PAUSE_RELEASE : +case SNDRV_PCM_TRIGGER_RESUME : +return skl_tplg_set_fe_pipeline_state (dai, true, + substream->stream); + +case SNDRV_PCM_TRIGGER_PAUSE_PUSH : +case SNDRV_PCM_TRIGGER_SUSPEND : +return skl_tplg_set_fe_pipeline_state (dai, false, + substream->stream); + +default : +return 0 ; + } + +return 0 ; +} +static int skl_link_hw_params (struct snd_pcm_substream *substream,struct snd_pcm_hw_params *params,struct snd_soc_dai *dai)
@@ -277,9 +326,10 @@ static int skl_link_hw_params(struct snd_pcm_substream *substream,struct snd_soc_pcm_runtime *rtd =snd_pcm_substream_chip (substream);struct skl_dma_params *dma_params;struct snd_soc_dai *codec_dai = rtd->codec_dai; -int dma_id; +struct skl_pipe_params p_params = {0 }; + +dev_dbg (dai->dev,"%s: %s\n" , __func__, dai->name); -pr_debug ("%s\n" , __func__); link_dev =snd_hdac_ext_stream_assign (ebus, substream,HDAC_EXT_STREAM_TYPE_LINK );if (!link_dev)
@@ -293,7 +343,14 @@ static int skl_link_hw_params(struct snd_pcm_substream *substream,if (dma_params) dma_params->stream_tag =hdac_stream (link_dev)->stream_tag;snd_soc_dai_set_dma_data (codec_dai, substream, (void *)dma_params); - dma_id =hdac_stream (link_dev)->stream_tag -1 ; + + p_params.s_fmt =snd_pcm_format_width (params_format (params)); + p_params.ch =params_channels (params); + p_params.s_freq =params_rate (params); + p_params.stream = substream->stream; + p_params.link_dma_id =hdac_stream (link_dev)->stream_tag -1 ; + +skl_tplg_be_update_params (dai, &p_params);return 0 ; }
@@ -308,8 +365,6 @@ static int skl_link_pcm_prepare(struct snd_pcm_substream *substream,unsigned int format_val =0 ;struct skl_dma_params *dma_params;struct snd_soc_dai *codec_dai = rtd->codec_dai; -struct snd_pcm_hw_params *params; -struct snd_interval *channels, *rate;struct hdac_ext_link *link;dev_dbg (dai->dev,"%s: %s\n" , __func__, dai->name);
@@ -317,18 +372,6 @@ static int skl_link_pcm_prepare(struct snd_pcm_substream *substream,dev_dbg (dai->dev,"already stream is prepared - returning\n" );return 0 ; } - params =devm_kzalloc (dai->dev,sizeof (*params),GFP_KERNEL ); -if (params ==NULL ) -return -ENOMEM ; - - channels =hw_param_interval (params,SNDRV_PCM_HW_PARAM_CHANNELS ); - channels->min = channels->max = substream->runtime->channels; - rate =hw_param_interval (params,SNDRV_PCM_HW_PARAM_RATE ); - rate->min = rate->max = substream->runtime->rate; -snd_mask_set (¶ms->masks[SNDRV_PCM_HW_PARAM_FORMAT - -SNDRV_PCM_HW_PARAM_FIRST_MASK ], - substream->runtime->format); - dma_params = (struct skl_dma_params *)snd_soc_dai_get_dma_data (codec_dai, substream);
@@ -399,13 +442,13 @@ static int skl_link_hw_free(struct snd_pcm_substream *substream,return 0 ; } -static int skl_hda_be_startup (struct snd_pcm_substream *substream, +static int skl_be_startup (struct snd_pcm_substream *substream,struct snd_soc_dai *dai) {return pm_runtime_get_sync (dai->dev); } -static void skl_hda_be_shutdown (struct snd_pcm_substream *substream, +static void skl_be_shutdown (struct snd_pcm_substream *substream,struct snd_soc_dai *dai) {pm_runtime_mark_last_busy (dai->dev);
@@ -418,20 +461,28 @@ static struct snd_soc_dai_ops skl_pcm_dai_ops = { .prepare = skl_pcm_prepare, .hw_params = skl_pcm_hw_params, .hw_free = skl_pcm_hw_free, + .trigger = skl_pcm_trigger, };static struct snd_soc_dai_ops skl_dmic_dai_ops = { - .startup = skl_hda_be_startup, - .shutdown = skl_hda_be_shutdown, + .startup = skl_be_startup, + .hw_params = skl_be_hw_params, + .shutdown = skl_be_shutdown, +}; + +static struct snd_soc_dai_ops skl_be_ssp_dai_ops = { + .startup = skl_be_startup, + .hw_params = skl_be_hw_params, + .shutdown = skl_be_shutdown, };static struct snd_soc_dai_ops skl_link_dai_ops = { - .startup = skl_hda_be_startup, + .startup = skl_be_startup, .prepare = skl_link_pcm_prepare, .hw_params = skl_link_hw_params, .hw_free = skl_link_hw_free, .trigger = skl_link_pcm_trigger, - .shutdown = skl_hda_be_shutdown, + .shutdown = skl_be_shutdown, };static struct snd_soc_dai_driver skl_platform_dai[] = {
@@ -488,6 +539,24 @@ static struct snd_soc_dai_driver skl_platform_dai[] = { },/* BE CPU Dais */ { + .name = "SSP0 Pin", + .ops = &skl_be_ssp_dai_ops, + .playback = { + .stream_name = "ssp0 Tx", + .channels_min = HDA_STEREO, + .channels_max = HDA_STEREO, + .rates = SNDRV_PCM_RATE_48000, + .formats = SNDRV_PCM_FMTBIT_S16_LE, + }, + .capture = { + .stream_name = "ssp0 Rx", + .channels_min = HDA_STEREO, + .channels_max = HDA_STEREO, + .rates = SNDRV_PCM_RATE_48000, + .formats = SNDRV_PCM_FMTBIT_S16_LE, + }, +}, +{ .name = "iDisp Pin", .ops = &skl_link_dai_ops, .playback = {
@@ -577,7 +646,7 @@ static int skl_platform_open(struct snd_pcm_substream *substream)return 0 ; } -static int skl_pcm_trigger (struct snd_pcm_substream *substream, +static int skl_coupled_trigger (struct snd_pcm_substream *substream,int cmd) {struct hdac_ext_bus *ebus =get_bus_ctx (substream);
@@ -651,7 +720,7 @@ static int skl_pcm_trigger(struct snd_pcm_substream *substream,return 0 ; } -static int skl_dsp_trigger (struct snd_pcm_substream *substream, +static int skl_decoupled_trigger (struct snd_pcm_substream *substream,int cmd) {struct hdac_ext_bus *ebus =get_bus_ctx (substream);
@@ -708,9 +777,9 @@ static int skl_platform_pcm_trigger(struct snd_pcm_substream *substream,struct hdac_ext_bus *ebus =get_bus_ctx (substream);if (ebus->ppcap) -return skl_dsp_trigger (substream, cmd); +return skl_decoupled_trigger (substream, cmd);else -return skl_pcm_trigger (substream, cmd); +return skl_coupled_trigger (substream, cmd); }/* calculate runtime delay from LPIB */
@@ -877,7 +946,19 @@ static int skl_pcm_new(struct snd_soc_pcm_runtime *rtd)return retval; } +static int skl_platform_soc_probe (struct snd_soc_platform *platform) +{ +struct hdac_ext_bus *ebus =dev_get_drvdata (platform->dev); +struct hdac_bus *bus =ebus_to_hbus (ebus); + +dev_dbg (bus->dev,"Enter:%s\n" , __func__); + +if (ebus->ppcap) +return skl_tplg_init (platform, ebus); +return 0 ; +}static struct snd_soc_platform_driver skl_platform_drv = { + .probe = skl_platform_soc_probe, .ops = &skl_platform_ops, .pcm_new = skl_pcm_new, .pcm_free = skl_pcm_free,
@@ -890,6 +971,11 @@ static const struct snd_soc_component_driver skl_component = {int skl_platform_register (struct device *dev) {int ret; +struct hdac_ext_bus *ebus =dev_get_drvdata (dev); +struct skl *skl =ebus_to_skl (ebus); + +INIT_LIST_HEAD (&skl->ppl_list); +INIT_LIST_HEAD (&skl->dapm_path_list); ret =snd_soc_register_platform (dev, &skl_platform_drv);if (ret) {
Signature · 1 line
2.4.3
PATCH 11/13 ASoC: Intel: Skylake: Add DSP support and enable it
In reply to Subhransu S. PrustyFrom: Jeeja KP <[email protected]>
If processing pipe capability is supported, add DSP support. Adds initialization/free/suspend/resume DSP functionality.
--- sound/soc/intel/skylake/skl.c | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-)
sound/soc/intel/skylake/skl.c +17 -7
@@ -166,11 +166,16 @@ static int skl_runtime_suspend(struct device *dev)struct pci_dev *pci =to_pci_dev (dev);struct hdac_ext_bus *ebus =pci_get_drvdata (pci);struct hdac_bus *bus =ebus_to_hbus (ebus); +struct skl *skl =ebus_to_skl (ebus); +int ret;dev_dbg (bus->dev,"in %s\n" , __func__);/* enable controller wake up event */ snd_hdac_chip_updatew (bus,WAKEEN ,0 ,STATESTS_INT_MASK ); + ret =skl_suspend_dsp (skl); +if (ret <0 ) +return ret;snd_hdac_bus_stop_chip (bus);snd_hdac_bus_enter_link_reset (bus);
@@ -183,7 +188,7 @@ static int skl_runtime_resume(struct device *dev)struct pci_dev *pci =to_pci_dev (dev);struct hdac_ext_bus *ebus =pci_get_drvdata (pci);struct hdac_bus *bus =ebus_to_hbus (ebus); -struct skl *hda =ebus_to_skl (ebus); +struct skl *skl =ebus_to_skl (ebus);int status;dev_dbg (bus->dev,"in %s\n" , __func__);
@@ -191,12 +196,12 @@ static int skl_runtime_resume(struct device *dev)/* Read STATESTS before controller reset */ status =snd_hdac_chip_readw (bus,STATESTS ); -skl_init_pci (hda); +skl_init_pci (skl);snd_hdac_bus_init_chip (bus, true);/* disable controller Wake Up event */ snd_hdac_chip_updatew (bus,WAKEEN ,STATESTS_INT_MASK ,0 ); - return 0; + return skl_resume_dsp(skl); }#endif /* CONFIG_PM */
@@ -457,17 +462,19 @@ static int skl_probe(struct pci_dev *pci,/* check if dsp is there */ if (ebus->ppcap) { -/* TODO register with dsp IPC */ -dev_dbg (bus->dev,"Register dsp\n" ); + err =skl_init_dsp (skl); +if (err <0 ) { +dev_dbg (bus->dev,"error failed to register dsp\n" ); + goto out_free; + } } -if (ebus->mlcap)snd_hdac_ext_bus_get_ml_capabilities (ebus);/* create device for soc dmic */ err =skl_dmic_device_register (skl);if (err <0 ) - goto out_free; + goto out_dsp_free;/* register platform dai and controls */ err =skl_platform_register (bus->dev);
@@ -491,6 +498,8 @@ out_unregister:skl_platform_unregister (bus->dev); out_dmic_free:skl_dmic_device_unregister (skl); +out_dsp_free: +skl_free_dsp (skl); out_free: skl->init_failed =1 ;skl_free (ebus);
@@ -507,6 +516,7 @@ static void skl_remove(struct pci_dev *pci)pm_runtime_get_noresume (&pci->dev);pci_dev_put (pci);skl_platform_unregister (&pci->dev); +skl_free_dsp (skl);skl_dmic_device_unregister (skl);skl_free (ebus);dev_set_drvdata (&pci->dev,NULL );
Signature · 1 line
2.4.3
Mark Brown
maintainerApplied "ASoC: Intel: Skylake: Add DSP support and enable it" to the asoc tree
The patch
ASoC: Intel: Skylake: Add DSP support and enable it
has been applied to the asoc tree at
git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git
All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying to this mail.
Thanks,
Mark
Quoted 1 line
From
2a29b200c6f17827ee712e719ad29366f79205eeMon Sep 17 00:00:00 2001
From: Jeeja KP <[email protected]>
Date: Wed, 7 Oct 2015 11:31:58 +0100
Subject: [PATCH] ASoC: Intel: Skylake: Add DSP support and enable it
If processing pipe capability is supported, add DSP support. Adds initialization/free/suspend/resume DSP functionality.
--- sound/soc/intel/skylake/skl.c | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-)
sound/soc/intel/skylake/skl.c +17 -7
@@ -166,11 +166,16 @@ static int skl_runtime_suspend(struct device *dev)struct pci_dev *pci =to_pci_dev (dev);struct hdac_ext_bus *ebus =pci_get_drvdata (pci);struct hdac_bus *bus =ebus_to_hbus (ebus); +struct skl *skl =ebus_to_skl (ebus); +int ret;dev_dbg (bus->dev,"in %s\n" , __func__);/* enable controller wake up event */ snd_hdac_chip_updatew (bus,WAKEEN ,0 ,STATESTS_INT_MASK ); + ret =skl_suspend_dsp (skl); +if (ret <0 ) +return ret;snd_hdac_bus_stop_chip (bus);snd_hdac_bus_enter_link_reset (bus);
@@ -183,7 +188,7 @@ static int skl_runtime_resume(struct device *dev)struct pci_dev *pci =to_pci_dev (dev);struct hdac_ext_bus *ebus =pci_get_drvdata (pci);struct hdac_bus *bus =ebus_to_hbus (ebus); -struct skl *hda =ebus_to_skl (ebus); +struct skl *skl =ebus_to_skl (ebus);int status;dev_dbg (bus->dev,"in %s\n" , __func__);
@@ -191,12 +196,12 @@ static int skl_runtime_resume(struct device *dev)/* Read STATESTS before controller reset */ status =snd_hdac_chip_readw (bus,STATESTS ); -skl_init_pci (hda); +skl_init_pci (skl);snd_hdac_bus_init_chip (bus, true);/* disable controller Wake Up event */ snd_hdac_chip_updatew (bus,WAKEEN ,STATESTS_INT_MASK ,0 ); - return 0; + return skl_resume_dsp(skl); }#endif /* CONFIG_PM */
@@ -457,17 +462,19 @@ static int skl_probe(struct pci_dev *pci,/* check if dsp is there */ if (ebus->ppcap) { -/* TODO register with dsp IPC */ -dev_dbg (bus->dev,"Register dsp\n" ); + err =skl_init_dsp (skl); +if (err <0 ) { +dev_dbg (bus->dev,"error failed to register dsp\n" ); + goto out_free; + } } -if (ebus->mlcap)snd_hdac_ext_bus_get_ml_capabilities (ebus);/* create device for soc dmic */ err =skl_dmic_device_register (skl);if (err <0 ) - goto out_free; + goto out_dsp_free;/* register platform dai and controls */ err =skl_platform_register (bus->dev);
@@ -491,6 +498,8 @@ out_unregister:skl_platform_unregister (bus->dev); out_dmic_free:skl_dmic_device_unregister (skl); +out_dsp_free: +skl_free_dsp (skl); out_free: skl->init_failed =1 ;skl_free (ebus);
@@ -507,6 +516,7 @@ static void skl_remove(struct pci_dev *pci)pm_runtime_get_noresume (&pci->dev);pci_dev_put (pci);skl_platform_unregister (&pci->dev); +skl_free_dsp (skl);skl_dmic_device_unregister (skl);skl_free (ebus);dev_set_drvdata (&pci->dev,NULL );
Signature · 1 line
2.5.0
PATCH 12/13 ASoC: Intel: Skylake: Initialize NHLT table
In reply to Subhransu S. PrustyFrom: Jeeja KP <[email protected]>
Load and Initialize Non HDA Link Table in Skylake driver to get platform configuration.
--- sound/soc/intel/skylake/skl.c | 5 +++++ 1 file changed, 5 insertions(+)
sound/soc/intel/skylake/skl.c +5 -0
@@ -458,6 +458,11 @@ static int skl_probe(struct pci_dev *pci,if (err <0 ) goto out_free; + skl->nhlt =skl_nhlt_init (bus->dev); + +if (skl->nhlt ==NULL ) + goto out_free; +pci_set_drvdata (skl->pci, ebus);/* check if dsp is there */
Signature · 1 line
2.4.3
Mark Brown
maintainerApplied "ASoC: Intel: Skylake: Initialize NHLT table" to the asoc tree
The patch
ASoC: Intel: Skylake: Initialize NHLT table
has been applied to the asoc tree at
git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git
All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying to this mail.
Thanks,
Mark
Quoted 1 line
From
87b2bdf02278e5623cc66e5189792fde01f829a3Mon Sep 17 00:00:00 2001
From: Jeeja KP <[email protected]>
Date: Wed, 7 Oct 2015 11:31:59 +0100
Subject: [PATCH] ASoC: Intel: Skylake: Initialize NHLT table
Load and Initialize Non HDA Link Table in Skylake driver to get platform configuration.
--- sound/soc/intel/skylake/skl.c | 5 +++++ 1 file changed, 5 insertions(+)
sound/soc/intel/skylake/skl.c +5 -0
@@ -458,6 +458,11 @@ static int skl_probe(struct pci_dev *pci,if (err <0 ) goto out_free; + skl->nhlt =skl_nhlt_init (bus->dev); + +if (skl->nhlt ==NULL ) + goto out_free; +pci_set_drvdata (skl->pci, ebus);/* check if dsp is there */
Signature · 1 line
2.5.0
PATCH 13/13 ASoC: Intel: Skylake: Remove CPU dai that is not used
In reply to Subhransu S. PrustyFrom: Jeeja KP <[email protected]>
For each endpoint instance, need to create CPU dai, Removed unused CPU dai DMIC23/HDA-SPK/HDA-AMIC dais.
--- sound/soc/intel/skylake/skl-pcm.c | 33 --------------------------------- 1 file changed, 33 deletions(-)
sound/soc/intel/skylake/skl-pcm.c +0 -33
@@ -579,17 +579,6 @@ static struct snd_soc_dai_driver skl_platform_dai[] = { }, }, { - .name = "DMIC23 Pin", - .ops = &skl_dmic_dai_ops, - .capture = { - .stream_name = "DMIC23 Rx", - .channels_min = HDA_STEREO, - .channels_max = HDA_STEREO, - .rates = SNDRV_PCM_RATE_48000 | SNDRV_PCM_RATE_16000, - .formats = SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S24_LE, - }, -}, -{ .name = "HD-Codec Pin", .ops = &skl_link_dai_ops, .playback = {
@@ -607,28 +596,6 @@ static struct snd_soc_dai_driver skl_platform_dai[] = { .formats = SNDRV_PCM_FMTBIT_S16_LE, }, }, -{ - .name = "HD-Codec-SPK Pin", - .ops = &skl_link_dai_ops, - .playback = { - .stream_name = "HD-Codec-SPK Tx", - .channels_min = HDA_STEREO, - .channels_max = HDA_STEREO, - .rates = SNDRV_PCM_RATE_48000, - .formats = SNDRV_PCM_FMTBIT_S16_LE, - }, -}, -{ - .name = "HD-Codec-AMIC Pin", - .ops = &skl_link_dai_ops, - .capture = { - .stream_name = "HD-Codec-AMIC Rx", - .channels_min = HDA_STEREO, - .channels_max = HDA_STEREO, - .rates = SNDRV_PCM_RATE_48000, - .formats = SNDRV_PCM_FMTBIT_S16_LE, - }, -}, };static int skl_platform_open (struct snd_pcm_substream *substream)
Signature · 1 line
2.4.3
Mark Brown
maintainerApplied "ASoC: Intel: Skylake: Remove unused CPU dais" to the asoc tree
The patch
ASoC: Intel: Skylake: Remove unused CPU dais
has been applied to the asoc tree at
git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git
All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying to this mail.
Thanks,
Mark
Quoted 1 line
From
5b97c0f18a1781f50db96baa020f913886d1972aMon Sep 17 00:00:00 2001
From: Jeeja KP <[email protected]>
Date: Mon, 17 Aug 2015 22:56:44 +0530
Subject: [PATCH] ASoC: Intel: Skylake: Remove unused CPU dais
We need to create CPU DAI for each endpoint instance. For this we should have one DMIC DAI, one HDA DAI and SSP DAI. Thus, DMIC23, HDA-SPK/AMIC was not required so this patch removes them
--- sound/soc/intel/skylake/skl-pcm.c | 33 --------------------------------- 1 file changed, 33 deletions(-)
sound/soc/intel/skylake/skl-pcm.c +0 -33
@@ -510,17 +510,6 @@ static struct snd_soc_dai_driver skl_platform_dai[] = { }, }, { - .name = "DMIC23 Pin", - .ops = &skl_dmic_dai_ops, - .capture = { - .stream_name = "DMIC23 Rx", - .channels_min = HDA_STEREO, - .channels_max = HDA_STEREO, - .rates = SNDRV_PCM_RATE_48000 | SNDRV_PCM_RATE_16000, - .formats = SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S24_LE, - }, -}, -{ .name = "HD-Codec Pin", .ops = &skl_link_dai_ops, .playback = {
@@ -538,28 +527,6 @@ static struct snd_soc_dai_driver skl_platform_dai[] = { .formats = SNDRV_PCM_FMTBIT_S16_LE, }, }, -{ - .name = "HD-Codec-SPK Pin", - .ops = &skl_link_dai_ops, - .playback = { - .stream_name = "HD-Codec-SPK Tx", - .channels_min = HDA_STEREO, - .channels_max = HDA_STEREO, - .rates = SNDRV_PCM_RATE_48000, - .formats = SNDRV_PCM_FMTBIT_S16_LE, - }, -}, -{ - .name = "HD-Codec-AMIC Pin", - .ops = &skl_link_dai_ops, - .capture = { - .stream_name = "HD-Codec-AMIC Rx", - .channels_min = HDA_STEREO, - .channels_max = HDA_STEREO, - .rates = SNDRV_PCM_RATE_48000, - .formats = SNDRV_PCM_FMTBIT_S16_LE, - }, -}, };static int skl_platform_open (struct snd_pcm_substream *substream)
Signature · 1 line
2.5.0
I resent some older patches as well with this series. Please ignore. Will resend the series.
Sorry for the spam.
Quoted 44 lines · Subhransu S. Prusty
The SKL driver does not code DSP topology in driver. With this series the soc topology framework is used to parse the topology information to create widgets, controls and route map for the FW topology.
It adds routines for SKL DSP module configuration, add building blocks to instanatiate modules and pipes. It uses SKL IPC library added earlier to send IPC for initialize the module, bind/unbind modules, create pipeline and manage them.
Last patch in this series removes the unused dais.
Hardik T Shah (1):
ASoC: Intel: Skylake: Add helpers for SRC and converter modulesJeeja KP (12):
ASoC: Intel: Skylake: Add helpers for DSP module configuration
ASoC: Intel: Skylake: Add DSP module init and binding routines
ASoC: Intel: Skylake: Add pipe management helpers
ASoC: Intel: Skylake: Add pipe and modules handlers
ASoC: Intel: Skylake: Add module configuration helpers
ASoC: Intel: Skylake: add DSP platform widget event handlers
ASoC: Intel: Skylake: Add FE and BEhw_paramshandling
ASoC: Intel: Skylake: Add topology core init and handlers
ASoC: Intel: Skylake: Initialize and load DSP controls
ASoC: Intel: Skylake: Add DSP support and enable it
ASoC: Intel: Skylake: Initialize NHLT table
ASoC: Intel: Skylake: Remove CPU dai that is not usedsound/soc/intel/skylake/Makefile | 3 +- sound/soc/intel/skylake/skl-messages.c | 751 +++++++++++++++ sound/soc/intel/skylake/skl-pcm.c | 173 ++-- sound/soc/intel/skylake/skl-topology.c | 1264 ++++++++++++++++++++++++++ sound/soc/intel/skylake/skl-topology.h | 307 +++++++ sound/soc/intel/skylake/skl-tplg-interface.h | 166 ++++ sound/soc/intel/skylake/skl.c | 29 +- sound/soc/intel/skylake/skl.h | 11 + 8 files changed, 2636 insertions(+), 68 deletions(-) create mode 100644 sound/soc/intel/skylake/skl-topology.c create mode 100644 sound/soc/intel/skylake/skl-topology.h create mode 100644 sound/soc/intel/skylake/skl-tplg-interface.hSignature · 1 line
2.4.3
I resent some older patches as well with this series. Please ignore. Will resend the series.
Sorry for the spam.
Quoted 44 lines · Subhransu S. Prusty
The SKL driver does not code DSP topology in driver. With this series the soc topology framework is used to parse the topology information to create widgets, controls and route map for the FW topology.
It adds routines for SKL DSP module configuration, add building blocks to instanatiate modules and pipes. It uses SKL IPC library added earlier to send IPC for initialize the module, bind/unbind modules, create pipeline and manage them.
Last patch in this series removes the unused dais.
Hardik T Shah (1):
ASoC: Intel: Skylake: Add helpers for SRC and converter modulesJeeja KP (12):
ASoC: Intel: Skylake: Add helpers for DSP module configuration
ASoC: Intel: Skylake: Add DSP module init and binding routines
ASoC: Intel: Skylake: Add pipe management helpers
ASoC: Intel: Skylake: Add pipe and modules handlers
ASoC: Intel: Skylake: Add module configuration helpers
ASoC: Intel: Skylake: add DSP platform widget event handlers
ASoC: Intel: Skylake: Add FE and BEhw_paramshandling
ASoC: Intel: Skylake: Add topology core init and handlers
ASoC: Intel: Skylake: Initialize and load DSP controls
ASoC: Intel: Skylake: Add DSP support and enable it
ASoC: Intel: Skylake: Initialize NHLT table
ASoC: Intel: Skylake: Remove CPU dai that is not usedsound/soc/intel/skylake/Makefile | 3 +- sound/soc/intel/skylake/skl-messages.c | 751 +++++++++++++++ sound/soc/intel/skylake/skl-pcm.c | 173 ++-- sound/soc/intel/skylake/skl-topology.c | 1264 ++++++++++++++++++++++++++ sound/soc/intel/skylake/skl-topology.h | 307 +++++++ sound/soc/intel/skylake/skl-tplg-interface.h | 166 ++++ sound/soc/intel/skylake/skl.c | 29 +- sound/soc/intel/skylake/skl.h | 11 + 8 files changed, 2636 insertions(+), 68 deletions(-) create mode 100644 sound/soc/intel/skylake/skl-topology.c create mode 100644 sound/soc/intel/skylake/skl-topology.h create mode 100644 sound/soc/intel/skylake/skl-tplg-interface.hSignature · 1 line
2.4.3
Signature · 4 lines
_______________________________________________ Alsa-devel mailing list [email protected] http://mailman.alsa-project.org/mailman/listinfo/alsa-devel