]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
ASoC: Intel: avs: Remove unused gateway configuration code
authorCezary Rojewski <cezary.rojewski@intel.com>
Mon, 3 Feb 2025 14:10:49 +0000 (15:10 +0100)
committerMark Brown <broonie@kernel.org>
Mon, 3 Feb 2025 14:05:00 +0000 (14:05 +0000)
Switch to new copier module constructor and remove code that becomes
unused because of that.

Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
Link: https://patch.msgid.link/20250203141051.2361323-10-cezary.rojewski@intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/intel/avs/path.c
sound/soc/intel/avs/topology.h

index 698a3d54224451fa30ea7265c2ab1c2da14cab14..cfa19e4820d2f589888a29f3917050d761c90a25 100644 (file)
@@ -231,7 +231,7 @@ static int avs_fill_gtw_config(struct avs_dev *adev, struct avs_copier_gtw_cfg *
        return 0;
 }
 
-static __maybe_unused int avs_copier_create2(struct avs_dev *adev, struct avs_path_module *mod)
+static int avs_copier_create(struct avs_dev *adev, struct avs_path_module *mod)
 {
        struct avs_tplg_module *t = mod->template;
        struct avs_tplg_modcfg_ext *te;
@@ -265,153 +265,6 @@ static __maybe_unused int avs_copier_create2(struct avs_dev *adev, struct avs_pa
        return ret;
 }
 
-__maybe_unused
-static bool avs_dma_type_is_host(u32 dma_type)
-{
-       return dma_type == AVS_DMA_HDA_HOST_OUTPUT ||
-              dma_type == AVS_DMA_HDA_HOST_INPUT;
-}
-
-__maybe_unused
-static bool avs_dma_type_is_link(u32 dma_type)
-{
-       return !avs_dma_type_is_host(dma_type);
-}
-
-__maybe_unused
-static bool avs_dma_type_is_output(u32 dma_type)
-{
-       return dma_type == AVS_DMA_HDA_HOST_OUTPUT ||
-              dma_type == AVS_DMA_HDA_LINK_OUTPUT ||
-              dma_type == AVS_DMA_I2S_LINK_OUTPUT;
-}
-
-__maybe_unused
-static bool avs_dma_type_is_input(u32 dma_type)
-{
-       return !avs_dma_type_is_output(dma_type);
-}
-
-static int avs_copier_create(struct avs_dev *adev, struct avs_path_module *mod)
-{
-       struct avs_tplg_module *t = mod->template;
-       struct avs_copier_cfg *cfg;
-       struct acpi_nhlt_format_config *ep_blob;
-       struct acpi_nhlt_endpoint *ep;
-       union avs_connector_node_id node_id = {0};
-       size_t cfg_size, data_size;
-       void *data = NULL;
-       u32 dma_type;
-       int ret;
-
-       data_size = sizeof(cfg->gtw_cfg.config);
-       dma_type = t->cfg_ext->copier.dma_type;
-       node_id.dma_type = dma_type;
-
-       switch (dma_type) {
-               struct avs_audio_format *fmt;
-               int direction;
-
-       case AVS_DMA_I2S_LINK_OUTPUT:
-       case AVS_DMA_I2S_LINK_INPUT:
-               if (avs_dma_type_is_input(dma_type))
-                       direction = SNDRV_PCM_STREAM_CAPTURE;
-               else
-                       direction = SNDRV_PCM_STREAM_PLAYBACK;
-
-               if (t->cfg_ext->copier.blob_fmt)
-                       fmt = t->cfg_ext->copier.blob_fmt;
-               else if (direction == SNDRV_PCM_STREAM_CAPTURE)
-                       fmt = t->in_fmt;
-               else
-                       fmt = t->cfg_ext->copier.out_fmt;
-
-               ep = acpi_nhlt_find_endpoint(ACPI_NHLT_LINKTYPE_SSP,
-                                            ACPI_NHLT_DEVICETYPE_CODEC, direction,
-                                            t->cfg_ext->copier.vindex.i2s.instance);
-               ep_blob = acpi_nhlt_endpoint_find_fmtcfg(ep, fmt->num_channels, fmt->sampling_freq,
-                                                        fmt->valid_bit_depth, fmt->bit_depth);
-               if (!ep_blob) {
-                       dev_err(adev->dev, "no I2S ep_blob found\n");
-                       return -ENOENT;
-               }
-
-               data = ep_blob->config.capabilities;
-               data_size = ep_blob->config.capabilities_size;
-               /* I2S gateway's vindex is statically assigned in topology */
-               node_id.vindex = t->cfg_ext->copier.vindex.val;
-
-               break;
-
-       case AVS_DMA_DMIC_LINK_INPUT:
-               direction = SNDRV_PCM_STREAM_CAPTURE;
-
-               if (t->cfg_ext->copier.blob_fmt)
-                       fmt = t->cfg_ext->copier.blob_fmt;
-               else
-                       fmt = t->in_fmt;
-
-               ep = acpi_nhlt_find_endpoint(ACPI_NHLT_LINKTYPE_PDM, -1, direction, 0);
-               ep_blob = acpi_nhlt_endpoint_find_fmtcfg(ep, fmt->num_channels, fmt->sampling_freq,
-                                                        fmt->valid_bit_depth, fmt->bit_depth);
-               if (!ep_blob) {
-                       dev_err(adev->dev, "no DMIC ep_blob found\n");
-                       return -ENOENT;
-               }
-
-               data = ep_blob->config.capabilities;
-               data_size = ep_blob->config.capabilities_size;
-               /* DMIC gateway's vindex is statically assigned in topology */
-               node_id.vindex = t->cfg_ext->copier.vindex.val;
-
-               break;
-
-       case AVS_DMA_HDA_HOST_OUTPUT:
-       case AVS_DMA_HDA_HOST_INPUT:
-               /* HOST gateway's vindex is dynamically assigned with DMA id */
-               node_id.vindex = mod->owner->owner->dma_id;
-               break;
-
-       case AVS_DMA_HDA_LINK_OUTPUT:
-       case AVS_DMA_HDA_LINK_INPUT:
-               node_id.vindex = t->cfg_ext->copier.vindex.val |
-                                mod->owner->owner->dma_id;
-               break;
-
-       case INVALID_OBJECT_ID:
-       default:
-               node_id = INVALID_NODE_ID;
-               break;
-       }
-
-       cfg_size = offsetof(struct avs_copier_cfg, gtw_cfg.config) + data_size;
-       if (cfg_size > AVS_MAILBOX_SIZE)
-               return -EINVAL;
-
-       cfg = adev->modcfg_buf;
-       memset(cfg, 0, cfg_size);
-       cfg->base.cpc = t->cfg_base->cpc;
-       cfg->base.ibs = t->cfg_base->ibs;
-       cfg->base.obs = t->cfg_base->obs;
-       cfg->base.is_pages = t->cfg_base->is_pages;
-       cfg->base.audio_fmt = *t->in_fmt;
-       cfg->out_fmt = *t->cfg_ext->copier.out_fmt;
-       cfg->feature_mask = t->cfg_ext->copier.feature_mask;
-       cfg->gtw_cfg.node_id = node_id;
-       cfg->gtw_cfg.dma_buffer_size = t->cfg_ext->copier.dma_buffer_size;
-       /* config_length in DWORDs */
-       cfg->gtw_cfg.config_length = DIV_ROUND_UP(data_size, 4);
-       if (data)
-               memcpy(&cfg->gtw_cfg.config.blob, data, data_size);
-
-       mod->gtw_attrs = cfg->gtw_cfg.config.attrs;
-
-       ret = avs_dsp_init_module(adev, mod->module_id, mod->owner->instance_id,
-                                 t->core_id, t->domain, cfg, cfg_size,
-                                 &mod->instance_id);
-       return ret;
-}
-
 static struct avs_control_data *avs_get_module_control(struct avs_path_module *mod)
 {
        struct avs_tplg_module *t = mod->template;
index 7892e3797f63c1e570376fe9063d7d8ad1fe8c21..dcfc568081a3c74d05c59ca9e56a03c4f4f19a6d 100644 (file)
@@ -74,8 +74,6 @@ struct avs_tplg_modcfg_ext {
                        union avs_virtual_index vindex;
                        u32 dma_type;
                        u32 dma_buffer_size;
-                       u32 config_length;
-                       /* config_data part of priv data */
                } copier;
                struct {
                        u32 out_channel_config;