Skip to contentSkip to conversation

ASoC: Intel: Clenaup SST initialization

PATCH NAK Cezary Rojewski 4 participants 107 messages Aug 22, 2019 – Aug 27, 2019 Page 1 of 2

Subsystems (3)
lore
Share & tools
lore

Cezary Rojewski

author maintainer
#0 lore raw

cover ASoC: Intel: Clenaup SST initialization

This segment targets initialization procedures for all SST drivers. For legacy:
- it concentrates on updating ACPI loader so generic DSP framework is not fed any platform specific data. sst-acpi module ceases to exist and is replaced by hsw-acpi and byt-acpi

For cAVS (Skylake+):
- Repairs what is currently an initialization mess, given the order of invocation of engaged handlers and sheer amount of them.
- provides interface to offload hardware-specifics away from driver

Following is the order of Skylake initialization currently:
- skl_probe
-> schedule skl_probe_work
- skl_first_init
- skl_create

-> skl_init_dsp
--> skl/ bxt/ cnl_sst_dsp_init
---> skl_sst_ctx_init
----> skl_dsp_ctx_init
-----> sst_dsp_new
------> sst_ops::init (invoked but unimplemented!)

Listing all the types engaged together with the naming chosen for the above paints an even darker picture. Code is unreadable and hides initialization for diffenret members is various handlers. Moreover, due to existing ill relationship between skl_dev, sst_dsp and sst_generic_ipc, one must be extra careful when accessing so called "dsp/ thread_context" as they all don't get initialized immediately before object is yield for further processing. However, 100/100 series is nonsense and thus cleanups have been divided into chunks and prioritized.

Code seen here is part of new Skylake fundament, located at the very bottom of internal mainline. Said mainline is tested constantly on at least sigle platform from every cAVS bucket (description below). This week, BDW has been added to the CI family and was essential in validating legacy changes. Baytrail platform is still missing. Changes for BYT directly mirror HSW/ BDW but due to current lack of platform were untested.
Boards engaged in testing: rt286, rt298, rt274.

!!! IMPORTANT !!!

Some upstream FW binaries are not compatible with existing /skylake driver while changes found here (HARDWARE_CONFIG/ FIRMWARE_CONFIG) make use of firmware ability to offload hardware-specifics away from driver. These and more are core part of any cAVS design and are to be implemented and used by host. This too is missing on Linux upstream.

As explanined once, five main FW branches are available:
- kbl, 1.5 cAVS (supports SKL, KBL, KBL-R, ABL, more..)
- apl_auto, 1.5+ cAVS (supports APL, GLK)
- cnl, 1.8 cAVS (supports CNL, CFL, WHL, CML)
- icl, 2.0 cAVS (supports ICL, LKF)
- master, 2.5 cAVS (supports TGL, EHL and everything above)

SKL FW binary existing on upstream is a descendant of old spt branch, obsoleted for 4-5 years now. That FW is a stub, quickly replaced by kbl which is to be used on all 1.5 cAVS platforms.

The same story goes with bxtn binary, a descendant of apl branch, replaced by apl_auto 2-3 years ago. All vendors, entire validation and development is located on apl_auto.

Message: all FW binaries are to be updated as we cannot guarantee these are still functional. Given the fact that all vendors are fed with new binaries on regular basis from all main branches, it's highly probable some scenarios fail with existing FWs. In consequence, linux-firmware patch will be provided with fresh, updated binaries, soon. Once more, please note, we do not support, nor test platforms using obsolete FW binaries. That includes all platforms, not just SKL or APL.

Amadeusz Sławiński (1):
ASoC: Intel: Skylake: Put FW runtime params defs in one place

Cezary Rojewski (34):
ASoC: Intel: Skylake: Add FIRMWARE_CONFIG IPC request
ASoC: Intel: Skylake: Add HARDWARE_CONFIG IPC request
ASoC: Intel: Skylake: Unify firmware loading mechanism
ASoC: Intel: Skylake: Reload libraries on D0 entry for CNL
ASoC: Intel: Skylake: Unhardcode dsp cores number
ASoC: Intel: Skylake: Update interrupt disabling routine
ASoC: Intel: Skylake: Inline ipc free operations
ASoC: Intel: Skylake: Unify driver cleanup mechanism
ASoC: Intel: Relocate irq thread header to sst_ops
ASoC: Intel: Merge sst_dsp_device into sst_pdata
ASoC: Intel: Skylake: Reuse sst_dsp_free
ASoC: Intel: Skylake: Reuse sst_dsp_new
ASoC: Intel: Skylake: Remove skl_dsp_acquire_irq
ASoC: Intel: Skylake: Use dsp loading functions directly
ASoC: Intel: Skylake: Make dsp_ops::stream_tag obsolete
ASoC: Intel: Skylake: Remove skl_dsp_loader_ops
ASoC: Intel: Skylake: Remove window0 sst_addr fields
ASoC: Intel: Skylake: Remove redundant W0 and W1 macros
ASoC: Intel: Skylake: Remove redundant SRAM fields
ASoC: Intel: Expose ACPI loading members
ASoC: Intel: Haswell: Define separate ACPI loader
ASoC: Intel: Baytrail: Define separate ACPI loader
ASoC: Intel: Refactor probing of ACPI devices
ASoC: Intel: Skylake: Simplify skl_sst_ctx_init declaration
ASoC: Intel: Skylake: Simplify all sst_dsp_init declarations
ASoC: Intel: Skylake: Define platform descriptors
ASoC: Intel: Skylake: Update skl_ids table
ASoC: Intel: Skylake: Flip SST initialization order
ASoC: Intel: Reuse sst_pdata::fw_name field
ASoC: Intel: Reuse sst_pdata::fw field
ASoC: Intel: Skylake: Remove skl_dsp_ops
ASoC: Intel: Skylake: Privatize SST init handlers
ASoC: Intel: Skylake: Merge skl_sst_ctx_init into skl_init_dsp
ASoC: Intel: Remove obsolete firmware fields

 sound/soc/intel/Kconfig                       |  14 +-
 sound/soc/intel/baytrail/Makefile             |   2 +
 sound/soc/intel/baytrail/acpi.c               |  64 +++++
 sound/soc/intel/baytrail/sst-baytrail-dsp.c   |   2 +-
 sound/soc/intel/baytrail/sst-baytrail-ipc.c   |  13 +-
 sound/soc/intel/baytrail/sst-baytrail-ipc.h   |   2 +
 sound/soc/intel/common/Makefile               |   4 +-
 .../intel/common/soc-acpi-intel-bxt-match.c   |   2 -
 .../intel/common/soc-acpi-intel-byt-match.c   |   2 -
 .../intel/common/soc-acpi-intel-cnl-match.c   |   1 -
 .../intel/common/soc-acpi-intel-glk-match.c   |   3 -
 .../intel/common/soc-acpi-intel-hda-match.c   |   2 -
 .../common/soc-acpi-intel-hsw-bdw-match.c     |   4 -
 .../intel/common/soc-acpi-intel-icl-match.c   |   1 -
 .../intel/common/soc-acpi-intel-kbl-match.c   |  12 -
 .../intel/common/soc-acpi-intel-skl-match.c   |   3 -
 sound/soc/intel/common/sst-acpi.c             | 117 +--------
 sound/soc/intel/common/sst-dsp-priv.h         |   8 +-
 sound/soc/intel/common/sst-dsp.h              |  37 +--
 sound/soc/intel/common/sst-firmware.c         |  13 +-
 sound/soc/intel/haswell/Makefile              |   2 +
 sound/soc/intel/haswell/acpi.c                |  78 ++++++
 sound/soc/intel/haswell/sst-haswell-dsp.c     |   1 +
 sound/soc/intel/haswell/sst-haswell-ipc.c     |  13 +-
 sound/soc/intel/haswell/sst-haswell-ipc.h     |   2 +
 sound/soc/intel/skylake/bxt-sst.c             | 143 ++++-------
 sound/soc/intel/skylake/cnl-sst-dsp.c         |  13 +-
 sound/soc/intel/skylake/cnl-sst-dsp.h         |  15 +-
 sound/soc/intel/skylake/cnl-sst.c             | 142 ++++-------
 sound/soc/intel/skylake/skl-debug.c           |   2 +-
 sound/soc/intel/skylake/skl-messages.c        | 194 ++------------
 sound/soc/intel/skylake/skl-pcm.c             |  22 +-
 sound/soc/intel/skylake/skl-sst-cldma.c       |  10 +-
 sound/soc/intel/skylake/skl-sst-dsp.c         |  79 ++----
 sound/soc/intel/skylake/skl-sst-dsp.h         |  55 ++--
 sound/soc/intel/skylake/skl-sst-ipc.c         | 238 ++++++++++++++++--
 sound/soc/intel/skylake/skl-sst-ipc.h         | 124 ++++++++-
 sound/soc/intel/skylake/skl-sst-utils.c       |  28 +--
 sound/soc/intel/skylake/skl-sst.c             | 150 ++++++-----
 sound/soc/intel/skylake/skl.c                 |  65 +++--
 sound/soc/intel/skylake/skl.h                 |  26 +-
 41 files changed, 877 insertions(+), 831 deletions(-)
 create mode 100644 sound/soc/intel/baytrail/acpi.c
 create mode 100644 sound/soc/intel/haswell/acpi.c
Signature · 6 lines
2.17.1

_______________________________________________
Alsa-devel mailing list
[email protected]
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel
author maintainer
#1 lore raw

PATCH 1/35 ASoC: Intel: Skylake: Put FW runtime params defs in one place

From: Amadeusz Sławiński <[email protected]>

Change Runtime Parameters enum to have its own prefix and then reuse those defines in all places where we actually use those parameters.

---
 sound/soc/intel/skylake/skl-messages.c | 7 ++-----
 sound/soc/intel/skylake/skl-sst-ipc.h  | 5 +++++
 2 files changed, 7 insertions(+), 5 deletions(-)
sound/soc/intel/skylake/skl-messages.c +2 -5
index d43496c5f29e..b6cefb1f9b12 100644
@@ -34,13 +34,11 @@ static int skl_free_dma_buf(struct device *dev, struct snd_dma_buffer *dmab)
 	return 0;
 }
 
-#define SKL_ASTATE_PARAM_ID	4
-
 void skl_dsp_set_astate_cfg(struct skl_dev *skl, u32 cnt, void *data)
 {
 	struct skl_ipc_large_config_msg	msg = {0};
 
-	msg.large_param_id = SKL_ASTATE_PARAM_ID;
+	msg.large_param_id = SKL_BASEFW_ASTATE_TABLE;
 	msg.param_data_size = (cnt * sizeof(struct skl_astate_param) +
 				sizeof(cnt));
 
@@ -614,7 +612,6 @@ static void skl_setup_cpr_gateway_cfg(struct skl_dev *skl,
 	skl_copy_copier_caps(mconfig, cpr_mconfig);
 }
 
-#define DMA_CONTROL_ID 5
 #define DMA_I2S_BLOB_SIZE 21
 
 int skl_dsp_set_dma_control(struct skl_dev *skl, u32 *caps,
@@ -631,7 +628,7 @@ int skl_dsp_set_dma_control(struct skl_dev *skl, u32 *caps,
 	if (caps_size == 0)
 		return 0;
 
-	msg.large_param_id = DMA_CONTROL_ID;
+	msg.large_param_id = SKL_BASEFW_DMA_CONTROL;
 	msg.param_data_size = sizeof(struct skl_dma_control) + caps_size;
 
 	dma_ctrl = kzalloc(msg.param_data_size, GFP_KERNEL);
sound/soc/intel/skylake/skl-sst-ipc.h +5 -0
index 08ac31778325..0058d82bd5a4 100644
@@ -67,6 +67,11 @@ struct skl_lib_info {
 	const struct firmware *fw;
 };
 
+enum skl_basefw_runtime_param {
+	SKL_BASEFW_ASTATE_TABLE = 4,
+	SKL_BASEFW_DMA_CONTROL = 5,
+};
+
 struct skl_ipc_init_instance_msg {
 	u32 module_id;
 	u32 instance_id;
Signature · 6 lines
2.17.1

_______________________________________________
Alsa-devel mailing list
[email protected]
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel
author maintainer
#2 lore raw

PATCH 2/35 ASoC: Intel: Skylake: Add FIRMWARE_CONFIG IPC request

In reply to Cezary Rojewski

Implement interface for retrieving firmware configuration. Skylake driver will use this data instead of hardcoded values in updates to come.

Most params are currently unused. In time driver dependency on fw config will increase, and with it, more parsing will be unveiled.

---
 sound/soc/intel/skylake/skl-sst-ipc.c | 122 ++++++++++++++++++++++++++
 sound/soc/intel/skylake/skl-sst-ipc.h |  72 +++++++++++++++
 sound/soc/intel/skylake/skl.h         |   1 +
 3 files changed, 195 insertions(+)
sound/soc/intel/skylake/skl-sst-ipc.c +122 -0
index 667cdddc289f..e9e11ec4c97b 100644
@@ -11,6 +11,7 @@
 #include "skl.h"
 #include "skl-sst-dsp.h"
 #include "skl-sst-ipc.h"
+#include "skl-topology.h"
 #include "sound/hdaudio_ext.h"
 
 
@@ -1067,3 +1068,124 @@ int skl_ipc_set_d0ix(struct sst_generic_ipc *ipc, struct skl_ipc_d0ix_msg *msg)
 	return ret;
 }
 EXPORT_SYMBOL_GPL(skl_ipc_set_d0ix);
+
+int skl_ipc_fw_cfg_get(struct sst_generic_ipc *ipc, struct skl_fw_cfg *cfg)
+{
+	struct skl_ipc_large_config_msg msg = {0};
+	struct skl_tlv *tlv;
+	size_t bytes = 0, offset = 0;
+	u8 *payload = NULL;
+	int ret;
+
+	msg.module_id = 0;
+	msg.instance_id = 0;
+	msg.large_param_id = SKL_BASEFW_FIRMWARE_CONFIG;
+
+	ret = skl_ipc_get_large_config(ipc, &msg, (u32 **)&payload, &bytes);
+	if (ret)
+		goto exit;
+
+	while (offset < bytes) {
+		tlv = (struct skl_tlv *)(payload + offset);
+
+		switch (tlv->type) {
+		case SKL_FW_CFG_FW_VERSION:
+			memcpy(&cfg->fw_version, tlv->value,
+				sizeof(cfg->fw_version));
+			break;
+
+		case SKL_FW_CFG_MEMORY_RECLAIMED:
+			cfg->memory_reclaimed = *tlv->value;
+			break;
+
+		case SKL_FW_CFG_SLOW_CLOCK_FREQ_HZ:
+			cfg->slow_clock_freq_hz = *tlv->value;
+			break;
+
+		case SKL_FW_CFG_FAST_CLOCK_FREQ_HZ:
+			cfg->fast_clock_freq_hz = *tlv->value;
+			break;
+
+		case SKL_FW_CFG_ALH_SUPPORT_LEVEL:
+			cfg->alh_support = *tlv->value;
+			break;
+
+		case SKL_FW_CFG_IPC_DL_MAILBOX_BYTES:
+			cfg->ipc_dl_mailbox_bytes = *tlv->value;
+			break;
+
+		case SKL_FW_CFG_IPC_UL_MAILBOX_BYTES:
+			cfg->ipc_ul_mailbox_bytes = *tlv->value;
+			break;
+
+		case SKL_FW_CFG_TRACE_LOG_BYTES:
+			cfg->trace_log_bytes = *tlv->value;
+			break;
+
+		case SKL_FW_CFG_MAX_PPL_COUNT:
+			cfg->max_ppl_count = *tlv->value;
+			break;
+
+		case SKL_FW_CFG_MAX_ASTATE_COUNT:
+			cfg->max_astate_count = *tlv->value;
+			break;
+
+		case SKL_FW_CFG_MAX_MODULE_PIN_COUNT:
+			cfg->max_module_pin_count = *tlv->value;
+			break;
+
+		case SKL_FW_CFG_MODULES_COUNT:
+			cfg->modules_count = *tlv->value;
+			break;
+
+		case SKL_FW_CFG_MAX_MOD_INST_COUNT:
+			cfg->max_mod_inst_count = *tlv->value;
+			break;
+
+		case SKL_FW_CFG_MAX_LL_TASKS_PER_PRI_COUNT:
+			cfg->max_ll_tasks_per_pri_count = *tlv->value;
+			break;
+
+		case SKL_FW_CFG_LL_PRI_COUNT:
+			cfg->ll_pri_count = *tlv->value;
+			break;
+
+		case SKL_FW_CFG_MAX_DP_TASKS_COUNT:
+			cfg->max_dp_tasks_count = *tlv->value;
+			break;
+
+		case SKL_FW_CFG_MAX_LIBS_COUNT:
+			cfg->max_libs_count = *tlv->value;
+			break;
+
+		case SKL_FW_CFG_XTAL_FREQ_HZ:
+			cfg->xtal_freq_hz = *tlv->value;
+			break;
+
+		case SKL_FW_CFG_UAOL_SUPPORT:
+			cfg->uaol_support = *tlv->value;
+			break;
+
+		case SKL_FW_CFG_POWER_GATING_POLICY:
+			cfg->power_gating_policy = *tlv->value;
+			break;
+
+		case SKL_FW_CFG_DMA_BUFFER_CONFIG:
+		case SKL_FW_CFG_SCHEDULER_CONFIG:
+		case SKL_FW_CFG_CLOCKS_CONFIG:
+			break;
+
+		default:
+			dev_info(ipc->dev, "Unrecognized fw param: %d\n",
+				tlv->type);
+			break;
+		}
+
+		offset += sizeof(*tlv) + tlv->length;
+	}
+
+exit:
+	kfree(payload);
+	return ret;
+}
+EXPORT_SYMBOL_GPL(skl_ipc_fw_cfg_get);
sound/soc/intel/skylake/skl-sst-ipc.h +72 -0

88 lines not on this page · raw message

sound/soc/intel/skylake/skl.h +1 -0
index f8c714153610..0d1c820e11cd 100644
@@ -110,6 +110,7 @@ struct skl_dev {
 
 	/* Populate module information */
 	struct list_head uuid_list;
+	struct skl_fw_cfg fw_cfg;
 
 	/* Is firmware loaded */
 	bool fw_loaded;
Signature · 1 line
2.17.1
#3 lore raw

Re: [PATCH 02/35] ASoC: Intel: Skylake: Add FIRMWARE_CONFIG IPC request

Quoted 131 lines · Cezary Rojewski

Implement interface for retrieving firmware configuration. Skylake driver will use this data instead of hardcoded values in updates to come.

Most params are currently unused. In time driver dependency on fw config will increase, and with it, more parsing will be unveiled.

---
  sound/soc/intel/skylake/skl-sst-ipc.c | 122 ++++++++++++++++++++++++++
  sound/soc/intel/skylake/skl-sst-ipc.h |  72 +++++++++++++++
  sound/soc/intel/skylake/skl.h         |   1 +
  3 files changed, 195 insertions(+)
sound/soc/intel/skylake/skl-sst-ipc.c +102 -0
index 667cdddc289f..e9e11ec4c97b 100644
@@ -11,6 +11,7 @@
  #include "skl.h"
  #include "skl-sst-dsp.h"
  #include "skl-sst-ipc.h"
+#include "skl-topology.h"
  #include "sound/hdaudio_ext.h"
 
 
@@ -1067,3 +1068,124 @@ int skl_ipc_set_d0ix(struct sst_generic_ipc *ipc, struct skl_ipc_d0ix_msg *msg)
  	return ret;
  }
  EXPORT_SYMBOL_GPL(skl_ipc_set_d0ix);
+
+int skl_ipc_fw_cfg_get(struct sst_generic_ipc *ipc, struct skl_fw_cfg *cfg)
+{
+	struct skl_ipc_large_config_msg msg = {0};
+	struct skl_tlv *tlv;
+	size_t bytes = 0, offset = 0;
+	u8 *payload = NULL;
+	int ret;
+
+	msg.module_id = 0;
+	msg.instance_id = 0;
+	msg.large_param_id = SKL_BASEFW_FIRMWARE_CONFIG;
+
+	ret = skl_ipc_get_large_config(ipc, &msg, (u32 **)&payload, &bytes);
+	if (ret)
+		goto exit;
+
+	while (offset < bytes) {
+		tlv = (struct skl_tlv *)(payload + offset);
+
+		switch (tlv->type) {
+		case SKL_FW_CFG_FW_VERSION:
+			memcpy(&cfg->fw_version, tlv->value,
+				sizeof(cfg->fw_version));
+			break;
+
+		case SKL_FW_CFG_MEMORY_RECLAIMED:
+			cfg->memory_reclaimed = *tlv->value;
+			break;
+
+		case SKL_FW_CFG_SLOW_CLOCK_FREQ_HZ:
+			cfg->slow_clock_freq_hz = *tlv->value;
+			break;
+
+		case SKL_FW_CFG_FAST_CLOCK_FREQ_HZ:
+			cfg->fast_clock_freq_hz = *tlv->value;
+			break;
+
+		case SKL_FW_CFG_ALH_SUPPORT_LEVEL:
+			cfg->alh_support = *tlv->value;
+			break;
+
+		case SKL_FW_CFG_IPC_DL_MAILBOX_BYTES:
+			cfg->ipc_dl_mailbox_bytes = *tlv->value;
+			break;
+
+		case SKL_FW_CFG_IPC_UL_MAILBOX_BYTES:
+			cfg->ipc_ul_mailbox_bytes = *tlv->value;
+			break;
+
+		case SKL_FW_CFG_TRACE_LOG_BYTES:
+			cfg->trace_log_bytes = *tlv->value;
+			break;
+
+		case SKL_FW_CFG_MAX_PPL_COUNT:
+			cfg->max_ppl_count = *tlv->value;
+			break;
+
+		case SKL_FW_CFG_MAX_ASTATE_COUNT:
+			cfg->max_astate_count = *tlv->value;
+			break;
+
+		case SKL_FW_CFG_MAX_MODULE_PIN_COUNT:
+			cfg->max_module_pin_count = *tlv->value;
+			break;
+
+		case SKL_FW_CFG_MODULES_COUNT:
+			cfg->modules_count = *tlv->value;
+			break;
+
+		case SKL_FW_CFG_MAX_MOD_INST_COUNT:
+			cfg->max_mod_inst_count = *tlv->value;
+			break;
+
+		case SKL_FW_CFG_MAX_LL_TASKS_PER_PRI_COUNT:
+			cfg->max_ll_tasks_per_pri_count = *tlv->value;
+			break;
+
+		case SKL_FW_CFG_LL_PRI_COUNT:
+			cfg->ll_pri_count = *tlv->value;
+			break;
+
+		case SKL_FW_CFG_MAX_DP_TASKS_COUNT:
+			cfg->max_dp_tasks_count = *tlv->value;
+			break;
+
+		case SKL_FW_CFG_MAX_LIBS_COUNT:
+			cfg->max_libs_count = *tlv->value;
+			break;
+
+		case SKL_FW_CFG_XTAL_FREQ_HZ:
+			cfg->xtal_freq_hz = *tlv->value;
+			break;
+
+		case SKL_FW_CFG_UAOL_SUPPORT:
+			cfg->uaol_support = *tlv->value;
+			break;
+
+		case SKL_FW_CFG_POWER_GATING_POLICY:
+			cfg->power_gating_policy = *tlv->value;
+			break;

sound/soc/intel/skylake/skl-sst-ipc.c int skl_ipc_set_d0ix(struct sst_generic_ipc *ipc, struct skl_ipc_d0ix_msg *msg) · line 1181

Quoted 10 lines
sound/soc/intel/skylake/skl-sst-ipc.c +10 -0
+
+		case SKL_FW_CFG_DMA_BUFFER_CONFIG:
+		case SKL_FW_CFG_SCHEDULER_CONFIG:
+		case SKL_FW_CFG_CLOCKS_CONFIG:
+			break;
+
+		default:
+			dev_info(ipc->dev, "Unrecognized fw param: %d\n",
+				tlv->type);
+			break;

Isn't this an error?
If there are other possible values, why not list them and skip them, as done above?

Quoted 5 lines
sound/soc/intel/skylake/skl-sst-ipc.c +5 -0
+		}
+
+		offset += sizeof(*tlv) + tlv->length;
+	}
+

sound/soc/intel/skylake/skl-sst-ipc.c int skl_ipc_set_d0ix(struct sst_generic_ipc *ipc, struct skl_ipc_d0ix_msg *msg)

Quoted 10 lines
sound/soc/intel/skylake/skl-sst-ipc.c +9 -0
+exit:
+	kfree(payload);
+	return ret;
+}
+EXPORT_SYMBOL_GPL(skl_ipc_fw_cfg_get);
 
+enum skl_alh_support_level {
+	ALH_NO_SUPPORT = 0x00000,
+	ALH_CAVS_1_8_CNL = 0x10000,
+};

Support for ALH hasn't changed even past 1.8, and references to CNL are probably not needed.

author maintainer
#4 lore raw

Re: [PATCH 02/35] ASoC: Intel: Skylake: Add FIRMWARE_CONFIG IPC request

Quoted 139 lines · Pierre-Louis Bossart
Quoted 136 lines · Cezary Rojewski

Implement interface for retrieving firmware configuration. Skylake driver will use this data instead of hardcoded values in updates to come.

Most params are currently unused. In time driver dependency on fw config will increase, and with it, more parsing will be unveiled.

---
  sound/soc/intel/skylake/skl-sst-ipc.c | 122 ++++++++++++++++++++++++++ sound/soc/intel/skylake/skl-sst-ipc.h |  72 +++++++++++++++ sound/soc/intel/skylake/skl.h         |   1 +

  3 files changed, 195 insertions(+)
sound/soc/intel/skylake/skl-sst-ipc.c +1 -0
index 667cdddc289f..e9e11ec4c97b 100644
@@ -11,6 +11,7 @@
   #include "skl.h"
   #include "skl-sst-dsp.h"
   #include "skl-sst-ipc.h"
+#include "skl-topology.h"
   #include "sound/hdaudio_ext.h"
@@ -1067,3 +1068,124 @@ int skl_ipc_set_d0ix(struct sst_generic_ipc 
 *ipc, struct skl_ipc_d0ix_msg *msg)
       return ret;
   }

  EXPORT_SYMBOL_GPL(skl_ipc_set_d0ix);

sound/soc/intel/skylake/skl-sst-ipc.c +2 -0
+
+int skl_ipc_fw_cfg_get(struct sst_generic_ipc *ipc, struct skl_fw_cfg 

*cfg)

sound/soc/intel/skylake/skl-sst-ipc.c +104 -0
+{
+    struct skl_ipc_large_config_msg msg = {0};
+    struct skl_tlv *tlv;
+    size_t bytes = 0, offset = 0;
+    u8 *payload = NULL;
+    int ret;
+
+    msg.module_id = 0;
+    msg.instance_id = 0;
+    msg.large_param_id = SKL_BASEFW_FIRMWARE_CONFIG;
+
+    ret = skl_ipc_get_large_config(ipc, &msg, (u32 **)&payload, &bytes);
+    if (ret)
+        goto exit;
+
+    while (offset < bytes) {
+        tlv = (struct skl_tlv *)(payload + offset);
+
+        switch (tlv->type) {
+        case SKL_FW_CFG_FW_VERSION:
+            memcpy(&cfg->fw_version, tlv->value,
+                sizeof(cfg->fw_version));
+            break;
+
+        case SKL_FW_CFG_MEMORY_RECLAIMED:
+            cfg->memory_reclaimed = *tlv->value;
+            break;
+
+        case SKL_FW_CFG_SLOW_CLOCK_FREQ_HZ:
+            cfg->slow_clock_freq_hz = *tlv->value;
+            break;
+
+        case SKL_FW_CFG_FAST_CLOCK_FREQ_HZ:
+            cfg->fast_clock_freq_hz = *tlv->value;
+            break;
+
+        case SKL_FW_CFG_ALH_SUPPORT_LEVEL:
+            cfg->alh_support = *tlv->value;
+            break;
+
+        case SKL_FW_CFG_IPC_DL_MAILBOX_BYTES:
+            cfg->ipc_dl_mailbox_bytes = *tlv->value;
+            break;
+
+        case SKL_FW_CFG_IPC_UL_MAILBOX_BYTES:
+            cfg->ipc_ul_mailbox_bytes = *tlv->value;
+            break;
+
+        case SKL_FW_CFG_TRACE_LOG_BYTES:
+            cfg->trace_log_bytes = *tlv->value;
+            break;
+
+        case SKL_FW_CFG_MAX_PPL_COUNT:
+            cfg->max_ppl_count = *tlv->value;
+            break;
+
+        case SKL_FW_CFG_MAX_ASTATE_COUNT:
+            cfg->max_astate_count = *tlv->value;
+            break;
+
+        case SKL_FW_CFG_MAX_MODULE_PIN_COUNT:
+            cfg->max_module_pin_count = *tlv->value;
+            break;
+
+        case SKL_FW_CFG_MODULES_COUNT:
+            cfg->modules_count = *tlv->value;
+            break;
+
+        case SKL_FW_CFG_MAX_MOD_INST_COUNT:
+            cfg->max_mod_inst_count = *tlv->value;
+            break;
+
+        case SKL_FW_CFG_MAX_LL_TASKS_PER_PRI_COUNT:
+            cfg->max_ll_tasks_per_pri_count = *tlv->value;
+            break;
+
+        case SKL_FW_CFG_LL_PRI_COUNT:
+            cfg->ll_pri_count = *tlv->value;
+            break;
+
+        case SKL_FW_CFG_MAX_DP_TASKS_COUNT:
+            cfg->max_dp_tasks_count = *tlv->value;
+            break;
+
+        case SKL_FW_CFG_MAX_LIBS_COUNT:
+            cfg->max_libs_count = *tlv->value;
+            break;
+
+        case SKL_FW_CFG_XTAL_FREQ_HZ:
+            cfg->xtal_freq_hz = *tlv->value;
+            break;
+
+        case SKL_FW_CFG_UAOL_SUPPORT:
+            cfg->uaol_support = *tlv->value;
+            break;
+
+        case SKL_FW_CFG_POWER_GATING_POLICY:
+            cfg->power_gating_policy = *tlv->value;
+            break;
+
+        case SKL_FW_CFG_DMA_BUFFER_CONFIG:
+        case SKL_FW_CFG_SCHEDULER_CONFIG:
+        case SKL_FW_CFG_CLOCKS_CONFIG:
+            break;
Quoted 9 lines
Quoted 5 lines

+
+        default:
+            dev_info(ipc->dev, "Unrecognized fw param: %d\n", +                tlv->type);
+            break;

Isn't this an error?
If there are other possible values, why not list them and skip them, as done above?

Pretty sure I cannot share names for all capabilities as these are EMBARGOed. Moreover, both FW_CFG and HW_CFG and constantly being updated and thus new constants are appended. I find it best to "break" when encountering known and un-EMBARGOED constant and simply dump info value if the opposite is true.

New capabilities are always tied to newer platforms. If there will be a need for adding them, these won't be even present in SKL/KBL and such FWs. At the same time if given binary drop contains something new but not required to be handled by host in generic case, dumping error is counter-intuitive.

Quoted 11 lines
Quoted 10 lines

+        }

sound/soc/intel/skylake/skl-sst-ipc.c +9 -0
+
+        offset += sizeof(*tlv) + tlv->length;
+    }
+
+exit:
+    kfree(payload);
+    return ret;
+}
+EXPORT_SYMBOL_GPL(skl_ipc_fw_cfg_get);
Quoted 6 lines

sound/soc/intel/skylake/skl-sst-ipc.c

Quoted 4 lines
sound/soc/intel/skylake/skl-sst-ipc.c +4 -0
+enum skl_alh_support_level {
+    ALH_NO_SUPPORT = 0x00000,
+    ALH_CAVS_1_8_CNL = 0x10000,
+};

Support for ALH hasn't changed even past 1.8, and references to CNL are probably not needed.

These are FW types and are here to be left untouched. Ensures parsed values on host side match FW side.
_______________________________________________
Alsa-devel mailing list
[email protected]
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

#5 lore raw

Re: [PATCH 02/35] ASoC: Intel: Skylake: Add FIRMWARE_CONFIG IPC request

Quoted 151 lines · Cezary Rojewski
Quoted 140 lines · Pierre-Louis Bossart
Quoted 137 lines · Cezary Rojewski

Implement interface for retrieving firmware configuration. Skylake driver will use this data instead of hardcoded values in updates to come.

Most params are currently unused. In time driver dependency on fw config will increase, and with it, more parsing will be unveiled.

---
  sound/soc/intel/skylake/skl-sst-ipc.c | 122 ++++++++++++++++++++++++++ sound/soc/intel/skylake/skl-sst-ipc.h |  72 +++++++++++++++ sound/soc/intel/skylake/skl.h         |   1 +

  3 files changed, 195 insertions(+)
sound/soc/intel/skylake/skl-sst-ipc.c +1 -0
index 667cdddc289f..e9e11ec4c97b 100644
@@ -11,6 +11,7 @@
   #include "skl.h"
   #include "skl-sst-dsp.h"
   #include "skl-sst-ipc.h"
+#include "skl-topology.h"
   #include "sound/hdaudio_ext.h"
@@ -1067,3 +1068,124 @@ int skl_ipc_set_d0ix(struct sst_generic_ipc 
 *ipc, struct skl_ipc_d0ix_msg *msg)
       return ret;
   }

  EXPORT_SYMBOL_GPL(skl_ipc_set_d0ix);

sound/soc/intel/skylake/skl-sst-ipc.c +2 -0
+
+int skl_ipc_fw_cfg_get(struct sst_generic_ipc *ipc, struct 

skl_fw_cfg *cfg)

sound/soc/intel/skylake/skl-sst-ipc.c +12 -0
+{
+    struct skl_ipc_large_config_msg msg = {0};
+    struct skl_tlv *tlv;
+    size_t bytes = 0, offset = 0;
+    u8 *payload = NULL;
+    int ret;
+
+    msg.module_id = 0;
+    msg.instance_id = 0;
+    msg.large_param_id = SKL_BASEFW_FIRMWARE_CONFIG;
+
+    ret = skl_ipc_get_large_config(ipc, &msg, (u32 **)&payload, 

&bytes);
+    if (ret)
+        goto exit;

sound/soc/intel/skylake/skl-sst-ipc.c +90 -0
+
+    while (offset < bytes) {
+        tlv = (struct skl_tlv *)(payload + offset);
+
+        switch (tlv->type) {
+        case SKL_FW_CFG_FW_VERSION:
+            memcpy(&cfg->fw_version, tlv->value,
+                sizeof(cfg->fw_version));
+            break;
+
+        case SKL_FW_CFG_MEMORY_RECLAIMED:
+            cfg->memory_reclaimed = *tlv->value;
+            break;
+
+        case SKL_FW_CFG_SLOW_CLOCK_FREQ_HZ:
+            cfg->slow_clock_freq_hz = *tlv->value;
+            break;
+
+        case SKL_FW_CFG_FAST_CLOCK_FREQ_HZ:
+            cfg->fast_clock_freq_hz = *tlv->value;
+            break;
+
+        case SKL_FW_CFG_ALH_SUPPORT_LEVEL:
+            cfg->alh_support = *tlv->value;
+            break;
+
+        case SKL_FW_CFG_IPC_DL_MAILBOX_BYTES:
+            cfg->ipc_dl_mailbox_bytes = *tlv->value;
+            break;
+
+        case SKL_FW_CFG_IPC_UL_MAILBOX_BYTES:
+            cfg->ipc_ul_mailbox_bytes = *tlv->value;
+            break;
+
+        case SKL_FW_CFG_TRACE_LOG_BYTES:
+            cfg->trace_log_bytes = *tlv->value;
+            break;
+
+        case SKL_FW_CFG_MAX_PPL_COUNT:
+            cfg->max_ppl_count = *tlv->value;
+            break;
+
+        case SKL_FW_CFG_MAX_ASTATE_COUNT:
+            cfg->max_astate_count = *tlv->value;
+            break;
+
+        case SKL_FW_CFG_MAX_MODULE_PIN_COUNT:
+            cfg->max_module_pin_count = *tlv->value;
+            break;
+
+        case SKL_FW_CFG_MODULES_COUNT:
+            cfg->modules_count = *tlv->value;
+            break;
+
+        case SKL_FW_CFG_MAX_MOD_INST_COUNT:
+            cfg->max_mod_inst_count = *tlv->value;
+            break;
+
+        case SKL_FW_CFG_MAX_LL_TASKS_PER_PRI_COUNT:
+            cfg->max_ll_tasks_per_pri_count = *tlv->value;
+            break;
+
+        case SKL_FW_CFG_LL_PRI_COUNT:
+            cfg->ll_pri_count = *tlv->value;
+            break;
+
+        case SKL_FW_CFG_MAX_DP_TASKS_COUNT:
+            cfg->max_dp_tasks_count = *tlv->value;
+            break;
+
+        case SKL_FW_CFG_MAX_LIBS_COUNT:
+            cfg->max_libs_count = *tlv->value;
+            break;
+
+        case SKL_FW_CFG_XTAL_FREQ_HZ:
+            cfg->xtal_freq_hz = *tlv->value;
+            break;
+
+        case SKL_FW_CFG_UAOL_SUPPORT:
+            cfg->uaol_support = *tlv->value;
+            break;
+
+        case SKL_FW_CFG_POWER_GATING_POLICY:
+            cfg->power_gating_policy = *tlv->value;
+            break;
+
+        case SKL_FW_CFG_DMA_BUFFER_CONFIG:
+        case SKL_FW_CFG_SCHEDULER_CONFIG:
+        case SKL_FW_CFG_CLOCKS_CONFIG:
+            break;
Quoted 9 lines
Quoted 5 lines

+
+        default:
+            dev_info(ipc->dev, "Unrecognized fw param: %d\n", +                tlv->type);
+            break;

Isn't this an error?
If there are other possible values, why not list them and skip them, as done above?

Quoted 3 lines

Pretty sure I cannot share names for all capabilities as these are EMBARGOed. Moreover, both FW_CFG and HW_CFG and constantly being updated and thus new constants are appended. I find it best to "break" when encountering known and un-EMBARGOED constant and simply dump info value if the opposite is true.

New capabilities are always tied to newer platforms. If there will be a need for adding them, these won't be even present in SKL/KBL and such FWs. At the same time if given binary drop contains something new but not required to be handled by host in generic case, dumping error is counter-intuitive.

It goes back to the compatibility issue, if you have a new firmware reporting a capability that your driver cannot handle then it's an error. if you have a new firmware that reports a new capability that can be ignored then it's fine to just skip.

I am just concerned that you have no checks at all.

Quoted 12 lines
Quoted 12 lines
Quoted 11 lines

+        }

sound/soc/intel/skylake/skl-sst-ipc.c +9 -0
+
+        offset += sizeof(*tlv) + tlv->length;
+    }
+
+exit:
+    kfree(payload);
+    return ret;
+}
+EXPORT_SYMBOL_GPL(skl_ipc_fw_cfg_get);
Quoted 8 lines
Quoted 6 lines

sound/soc/intel/skylake/skl-sst-ipc.c

Quoted 4 lines
sound/soc/intel/skylake/skl-sst-ipc.c +4 -0
+enum skl_alh_support_level {
+    ALH_NO_SUPPORT = 0x00000,
+    ALH_CAVS_1_8_CNL = 0x10000,
+};

Support for ALH hasn't changed even past 1.8, and references to CNL are probably not needed.

These are FW types and are here to be left untouched. Ensures parsed values on host side match FW side.

Adding a comment would help then.
_______________________________________________
Alsa-devel mailing list
[email protected]
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

author maintainer
#6 lore raw

Re: [PATCH 02/35] ASoC: Intel: Skylake: Add FIRMWARE_CONFIG IPC request

Quoted 155 lines · Pierre-Louis Bossart
Quoted 152 lines · Cezary Rojewski
Quoted 150 lines · Pierre-Louis Bossart
Quoted 133 lines · Cezary Rojewski

Implement interface for retrieving firmware configuration. Skylake driver will use this data instead of hardcoded values in updates to come.

Most params are currently unused. In time driver dependency on fw config will increase, and with it, more parsing will be unveiled.

---
  sound/soc/intel/skylake/skl-sst-ipc.c | 122
++++++++++++++++++++++++++
  sound/soc/intel/skylake/skl-sst-ipc.h |  72 +++++++++++++++ sound/soc/intel/skylake/skl.h         |   1 +

  3 files changed, 195 insertions(+)
sound/soc/intel/skylake/skl-sst-ipc.c +1 -0
index 667cdddc289f..e9e11ec4c97b 100644
@@ -11,6 +11,7 @@
   #include "skl.h"
   #include "skl-sst-dsp.h"
   #include "skl-sst-ipc.h"
+#include "skl-topology.h"
   #include "sound/hdaudio_ext.h"
@@ -1067,3 +1068,124 @@ int skl_ipc_set_d0ix(struct sst_generic_ipc 
 *ipc, struct skl_ipc_d0ix_msg *msg)
       return ret;
   }

  EXPORT_SYMBOL_GPL(skl_ipc_set_d0ix);

sound/soc/intel/skylake/skl-sst-ipc.c +2 -0
+
+int skl_ipc_fw_cfg_get(struct sst_generic_ipc *ipc, struct 

skl_fw_cfg *cfg)

sound/soc/intel/skylake/skl-sst-ipc.c +12 -0
+{
+    struct skl_ipc_large_config_msg msg = {0};
+    struct skl_tlv *tlv;
+    size_t bytes = 0, offset = 0;
+    u8 *payload = NULL;
+    int ret;
+
+    msg.module_id = 0;
+    msg.instance_id = 0;
+    msg.large_param_id = SKL_BASEFW_FIRMWARE_CONFIG;
+
+    ret = skl_ipc_get_large_config(ipc, &msg, (u32 **)&payload, 

&bytes);
+    if (ret)
+        goto exit;

sound/soc/intel/skylake/skl-sst-ipc.c +85 -0
+
+    while (offset < bytes) {
+        tlv = (struct skl_tlv *)(payload + offset);
+
+        switch (tlv->type) {
+        case SKL_FW_CFG_FW_VERSION:
+            memcpy(&cfg->fw_version, tlv->value,
+                sizeof(cfg->fw_version));
+            break;
+
+        case SKL_FW_CFG_MEMORY_RECLAIMED:
+            cfg->memory_reclaimed = *tlv->value;
+            break;
+
+        case SKL_FW_CFG_SLOW_CLOCK_FREQ_HZ:
+            cfg->slow_clock_freq_hz = *tlv->value;
+            break;
+
+        case SKL_FW_CFG_FAST_CLOCK_FREQ_HZ:
+            cfg->fast_clock_freq_hz = *tlv->value;
+            break;
+
+        case SKL_FW_CFG_ALH_SUPPORT_LEVEL:
+            cfg->alh_support = *tlv->value;
+            break;
+
+        case SKL_FW_CFG_IPC_DL_MAILBOX_BYTES:
+            cfg->ipc_dl_mailbox_bytes = *tlv->value;
+            break;
+
+        case SKL_FW_CFG_IPC_UL_MAILBOX_BYTES:
+            cfg->ipc_ul_mailbox_bytes = *tlv->value;
+            break;
+
+        case SKL_FW_CFG_TRACE_LOG_BYTES:
+            cfg->trace_log_bytes = *tlv->value;
+            break;
+
+        case SKL_FW_CFG_MAX_PPL_COUNT:
+            cfg->max_ppl_count = *tlv->value;
+            break;
+
+        case SKL_FW_CFG_MAX_ASTATE_COUNT:
+            cfg->max_astate_count = *tlv->value;
+            break;
+
+        case SKL_FW_CFG_MAX_MODULE_PIN_COUNT:
+            cfg->max_module_pin_count = *tlv->value;
+            break;
+
+        case SKL_FW_CFG_MODULES_COUNT:
+            cfg->modules_count = *tlv->value;
+            break;
+
+        case SKL_FW_CFG_MAX_MOD_INST_COUNT:
+            cfg->max_mod_inst_count = *tlv->value;
+            break;
+
+        case SKL_FW_CFG_MAX_LL_TASKS_PER_PRI_COUNT:
+            cfg->max_ll_tasks_per_pri_count = *tlv->value;
+            break;
+
+        case SKL_FW_CFG_LL_PRI_COUNT:
+            cfg->ll_pri_count = *tlv->value;
+            break;
+
+        case SKL_FW_CFG_MAX_DP_TASKS_COUNT:
+            cfg->max_dp_tasks_count = *tlv->value;
+            break;
+
+        case SKL_FW_CFG_MAX_LIBS_COUNT:
+            cfg->max_libs_count = *tlv->value;
+            break;
+
+        case SKL_FW_CFG_XTAL_FREQ_HZ:
+            cfg->xtal_freq_hz = *tlv->value;
+            break;
+
+        case SKL_FW_CFG_UAOL_SUPPORT:
+            cfg->uaol_support = *tlv->value;
+            break;
+
+        case SKL_FW_CFG_POWER_GATING_POLICY:
+            cfg->power_gating_policy = *tlv->value;
+            break;

sound/soc/intel/skylake/skl-sst-ipc.c int skl_ipc_set_d0ix(struct sst_generic_ipc *ipc, struct skl_ipc_d0ix_msg *msg) · line 1181

Quoted 10 lines
sound/soc/intel/skylake/skl-sst-ipc.c +10 -0
+
+        case SKL_FW_CFG_DMA_BUFFER_CONFIG:
+        case SKL_FW_CFG_SCHEDULER_CONFIG:
+        case SKL_FW_CFG_CLOCKS_CONFIG:
+            break;
+
+        default:
+            dev_info(ipc->dev, "Unrecognized fw param: %d\n",
+                tlv->type);
+            break;

Isn't this an error?
If there are other possible values, why not list them and skip them, as done above?

Quoted 8 lines
Quoted 3 lines

Pretty sure I cannot share names for all capabilities as these are EMBARGOed. Moreover, both FW_CFG and HW_CFG and constantly being updated and thus new constants are appended. I find it best to "break" when encountering known and un-EMBARGOED constant and simply dump info value if the opposite is true.

New capabilities are always tied to newer platforms. If there will be a need for adding them, these won't be even present in SKL/KBL and such FWs. At the same time if given binary drop contains something new but not required to be handled by host in generic case, dumping error is counter-intuitive.

It goes back to the compatibility issue, if you have a new firmware reporting a capability that your driver cannot handle then it's an error. if you have a new firmware that reports a new capability that can be ignored then it's fine to just skip.

I am just concerned that you have no checks at all.

Still wondering why should host side be concerned about capability they are not going to use at all.

Let's assume FW binaries are being updated regularly. Doubtful developer will remember to append new switch-case every time new FW-cap pops up - requires checking internal FW headers.

In the long run, I do believe the "desynchronization" may happen. I'll recheck with our FW guys what they think about us collapsing at this point (cfg parsing). In general, cAVS specification is very permissive for "outbound" and restrictive against "inbound" data. Parsing goes into "outbound" basket.

Quoted 19 lines
Quoted 19 lines
Quoted 18 lines
Quoted 6 lines

+        }

sound/soc/intel/skylake/skl-sst-ipc.c +4 -0
+
+        offset += sizeof(*tlv) + tlv->length;
+    }
+

sound/soc/intel/skylake/skl-sst-ipc.c int skl_ipc_set_d0ix(struct sst_generic_ipc *ipc, struct skl_ipc_d0ix_msg *msg)

Quoted 10 lines
sound/soc/intel/skylake/skl-sst-ipc.c +9 -0
+exit:
+    kfree(payload);
+    return ret;
+}
+EXPORT_SYMBOL_GPL(skl_ipc_fw_cfg_get);
 
+enum skl_alh_support_level {
+    ALH_NO_SUPPORT = 0x00000,
+    ALH_CAVS_1_8_CNL = 0x10000,
+};

Support for ALH hasn't changed even past 1.8, and references to CNL are probably not needed.

Quoted 3 lines
Quoted 1 line

These are FW types and are here to be left untouched. Ensures parsed values on host side match FW side.

Adding a comment would help then.

Agreed, thanks.
_______________________________________________
Alsa-devel mailing list
[email protected]
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

author maintainer
#7 lore raw

PATCH 3/35 ASoC: Intel: Skylake: Add HARDWARE_CONFIG IPC request

In reply to Cezary Rojewski

Driver requests this property to discover underlying HW configuration. Internally hw config is split between core config followed by capabilities e.g.: i2s, gpdma.

Most params are currently unused. In time driver dependency on hw config will increase, and with it, more parsing will be unveiled.

---
 sound/soc/intel/skylake/skl-messages.c |  1 +
 sound/soc/intel/skylake/skl-sst-ipc.c  | 87 ++++++++++++++++++++++++++
 sound/soc/intel/skylake/skl-sst-ipc.h  | 46 ++++++++++++++
 sound/soc/intel/skylake/skl.h          |  1 +
 4 files changed, 135 insertions(+)
sound/soc/intel/skylake/skl-messages.c +1 -0
index b6cefb1f9b12..d28b4887de27 100644
@@ -320,6 +320,7 @@ int skl_free_dsp(struct skl_dev *skl)
 
 	skl->dsp_ops->cleanup(bus->dev, skl);
 
+	kfree(skl->hw_cfg.i2s_caps.ctrl_base_addr);
 	kfree(skl->cores.state);
 	kfree(skl->cores.usage_count);
 
sound/soc/intel/skylake/skl-sst-ipc.c +87 -0

90 lines not on this page · raw message

sound/soc/intel/skylake/skl-sst-ipc.h +46 -0

63 lines not on this page · raw message

sound/soc/intel/skylake/skl.h +1 -0
index 0d1c820e11cd..972de5ddf2b7 100644
@@ -111,6 +111,7 @@ struct skl_dev {
 	/* Populate module information */
 	struct list_head uuid_list;
 	struct skl_fw_cfg fw_cfg;
+	struct skl_hw_cfg hw_cfg;
 
 	/* Is firmware loaded */
 	bool fw_loaded;
Signature · 1 line
2.17.1
#8 lore raw

Re: [PATCH 03/35] ASoC: Intel: Skylake: Add HARDWARE_CONFIG IPC request

Quoted 21 lines
sound/soc/intel/skylake/skl-sst-ipc.c +20 -0
+	while (offset < bytes) {
+		tlv = (struct skl_tlv *)(payload + offset);
+
+		switch (tlv->type) {
+		case SKL_HW_CFG_CAVS_VER:
+			cfg->cavs_version = *tlv->value;
+			break;
+
+		case SKL_HW_CFG_DSP_CORES:
+			cfg->dsp_cores = *tlv->value;
+			break;
+
+		case SKL_HW_CFG_MEM_PAGE_BYTES:
+			cfg->mem_page_bytes = *tlv->value;
+			break;
+
+		case SKL_HW_CFG_TOTAL_PHYS_MEM_PAGES:
+			cfg->total_phys_mem_pages = *tlv->value;
+			break;
+

sound/soc/intel/skylake/skl-sst-ipc.c int skl_ipc_fw_cfg_get(struct sst_generic_ipc *ipc, struct skl_fw_cfg *cfg) · line 1238

Quoted 10 lines
sound/soc/intel/skylake/skl-sst-ipc.c +10 -0
+		case SKL_HW_CFG_I2S_CAPS:
+			cfg->i2s_caps.version = tlv->value[0];
+			size = tlv->value[1];
+			cfg->i2s_caps.ctrl_count = size;
+			if (!size)
+				break;
+
+			size *= sizeof(*cfg->i2s_caps.ctrl_base_addr);
+			cfg->i2s_caps.ctrl_base_addr =
+				kmemdup(&tlv->value[2], size, GFP_KERNEL);

shouldn't the size be that of the source buffer instead of the destination?

Quoted 20 lines
sound/soc/intel/skylake/skl-sst-ipc.c +20 -0
+			if (!cfg->i2s_caps.ctrl_base_addr) {
+				ret = -ENOMEM;
+				goto exit;
+			}
+			break;
+
+		case SKL_HW_CFG_GATEWAY_COUNT:
+			cfg->gateway_count = *tlv->value;
+			break;
+
+		case SKL_HW_CFG_HP_EBB_COUNT:
+			cfg->hp_ebb_count = *tlv->value;
+			break;
+
+		case SKL_HW_CFG_LP_EBB_COUNT:
+			cfg->lp_ebb_count = *tlv->value;
+			break;
+
+		case SKL_HW_CFG_EBB_SIZE_BYTES:
+			cfg->ebb_size_bytes = *tlv->value;

sound/soc/intel/skylake/skl-sst-ipc.c int skl_ipc_fw_cfg_get(struct sst_generic_ipc *ipc, struct skl_fw_cfg *cfg) · line 1268

Quoted 10 lines
sound/soc/intel/skylake/skl-sst-ipc.c +10 -0
+			break;
+
+		case SKL_HW_CFG_GPDMA_CAPS:
+		case SKL_HW_CFG_UAOL_CAPS:
+			break;
+
+		default:
+			dev_info(ipc->dev, "Unrecognized hw param: %d\n",
+				tlv->type);
+			break;

same feedback, it's usually better to list all values and skip them, and fail big if you see something unexpected.

Quoted 41 lines
sound/soc/intel/skylake/skl-sst-ipc.c +10 -0
+		}
+
+		offset += sizeof(*tlv) + tlv->length;
+	}
+
+exit:
+	kfree(payload);
+	return ret;
+}
+EXPORT_SYMBOL_GPL(skl_ipc_hw_cfg_get);
sound/soc/intel/skylake/skl-sst-ipc.h +16 -0
index ebc5852e15d0..eefa52f7f97a 100644
@@ -77,6 +77,7 @@ enum skl_basefw_runtime_param {
  	SKL_BASEFW_ASTATE_TABLE = 4,
  	SKL_BASEFW_DMA_CONTROL = 5,
  	SKL_BASEFW_FIRMWARE_CONFIG = 7,
+	SKL_BASEFW_HARDWARE_CONFIG = 8,
  };
 
  enum skl_fw_cfg_params {
@@ -141,6 +142,50 @@ struct skl_fw_cfg {
  	u32 power_gating_policy;
  };
 
+enum skl_hw_cfg_params {
+	SKL_HW_CFG_CAVS_VER,
+	SKL_HW_CFG_DSP_CORES,
+	SKL_HW_CFG_MEM_PAGE_BYTES,
+	SKL_HW_CFG_TOTAL_PHYS_MEM_PAGES,
+	SKL_HW_CFG_I2S_CAPS,
+	SKL_HW_CFG_GPDMA_CAPS,
+	SKL_HW_CFG_GATEWAY_COUNT,
+	SKL_HW_CFG_HP_EBB_COUNT,
+	SKL_HW_CFG_LP_EBB_COUNT,
+	SKL_HW_CFG_EBB_SIZE_BYTES,
+	SKL_HW_CFG_UAOL_CAPS
+};
+
+enum skl_cavs_version {

sound/soc/intel/skylake/skl-sst-ipc.h struct skl_fw_cfg { · line 169

Quoted 10 lines
sound/soc/intel/skylake/skl-sst-ipc.h +10 -0
+	SKL_CAVS_VER_1_5 = 0x10005,
+	SKL_CAVS_VER_1_8 = 0x10008,
+};
+
+enum skl_i2s_version {
+	SKL_I2S_VER_15_SKYLAKE   = 0x00000,
+	SKL_I2S_VER_15_BROXTON   = 0x10000,
+	SKL_I2S_VER_15_BROXTON_P = 0x20000,
+	SKL_I2S_VER_18_KBL_CNL   = 0x30000,
+};

The encoding is odd.
Do these values mean anything (e.g. tied to firmware definitions?)

author maintainer
#9 lore raw

Re: [PATCH 03/35] ASoC: Intel: Skylake: Add HARDWARE_CONFIG IPC request

Quoted 25 lines · Pierre-Louis Bossart
Quoted 25 lines

+    while (offset < bytes) {
+        tlv = (struct skl_tlv *)(payload + offset);

sound/soc/intel/skylake/skl-sst-ipc.c +22 -0
+
+        switch (tlv->type) {
+        case SKL_HW_CFG_CAVS_VER:
+            cfg->cavs_version = *tlv->value;
+            break;
+
+        case SKL_HW_CFG_DSP_CORES:
+            cfg->dsp_cores = *tlv->value;
+            break;
+
+        case SKL_HW_CFG_MEM_PAGE_BYTES:
+            cfg->mem_page_bytes = *tlv->value;
+            break;
+
+        case SKL_HW_CFG_TOTAL_PHYS_MEM_PAGES:
+            cfg->total_phys_mem_pages = *tlv->value;
+            break;
+
+        case SKL_HW_CFG_I2S_CAPS:
+            cfg->i2s_caps.version = tlv->value[0];
+            size = tlv->value[1];
+            cfg->i2s_caps.ctrl_count = size;
Quoted 9 lines
Quoted 6 lines

+            if (!size)
+                break;
+
+            size *= sizeof(*cfg->i2s_caps.ctrl_base_addr); +            cfg->i2s_caps.ctrl_base_addr =
+                kmemdup(&tlv->value[2], size, GFP_KERNEL);

shouldn't the size be that of the source buffer instead of the destination?

I2S_CAPS are represented by:

struct skl_i2s_caps {
	enum skl_i2s_version version;
	u32 ctrl_count;
	u32 *ctrl_base_addr;
};

As you can see, second DWORD coming from V (TL_V_) specifies number of elements in array ctrl_base_addr. So, what we do is set i2s_caps.version to DWORD[0], i2s_caps.ctrl_count to DWORD[1] and then multiply count by the size of element type and thus we know how much memory to copy.

Quoted 24 lines
Quoted 24 lines

+            if (!cfg->i2s_caps.ctrl_base_addr) {
+                ret = -ENOMEM;
+                goto exit;
+            }
+            break;

sound/soc/intel/skylake/skl-sst-ipc.c +19 -0
+
+        case SKL_HW_CFG_GATEWAY_COUNT:
+            cfg->gateway_count = *tlv->value;
+            break;
+
+        case SKL_HW_CFG_HP_EBB_COUNT:
+            cfg->hp_ebb_count = *tlv->value;
+            break;
+
+        case SKL_HW_CFG_LP_EBB_COUNT:
+            cfg->lp_ebb_count = *tlv->value;
+            break;
+
+        case SKL_HW_CFG_EBB_SIZE_BYTES:
+            cfg->ebb_size_bytes = *tlv->value;
+            break;
+
+        case SKL_HW_CFG_GPDMA_CAPS:
+        case SKL_HW_CFG_UAOL_CAPS:
Quoted 8 lines
Quoted 6 lines

+            break;
+
+        default:
+            dev_info(ipc->dev, "Unrecognized hw param: %d\n", +                tlv->type);
+            break;

same feedback, it's usually better to list all values and skip them, and fail big if you see something unexpected.

Same answer as for FIRMWARE_CONFIG.

Quoted 45 lines
Quoted 45 lines

+        }

sound/soc/intel/skylake/skl-sst-ipc.c +9 -0
+
+        offset += sizeof(*tlv) + tlv->length;
+    }
+
+exit:
+    kfree(payload);
+    return ret;
+}
+EXPORT_SYMBOL_GPL(skl_ipc_hw_cfg_get);
sound/soc/intel/skylake/skl-sst-ipc.h +21 -0
index ebc5852e15d0..eefa52f7f97a 100644
@@ -77,6 +77,7 @@ enum skl_basefw_runtime_param {
       SKL_BASEFW_ASTATE_TABLE = 4,
       SKL_BASEFW_DMA_CONTROL = 5,
       SKL_BASEFW_FIRMWARE_CONFIG = 7,
+    SKL_BASEFW_HARDWARE_CONFIG = 8,
   };
   enum skl_fw_cfg_params {
@@ -141,6 +142,50 @@ struct skl_fw_cfg {
       u32 power_gating_policy;
   };
+enum skl_hw_cfg_params {
+    SKL_HW_CFG_CAVS_VER,
+    SKL_HW_CFG_DSP_CORES,
+    SKL_HW_CFG_MEM_PAGE_BYTES,
+    SKL_HW_CFG_TOTAL_PHYS_MEM_PAGES,
+    SKL_HW_CFG_I2S_CAPS,
+    SKL_HW_CFG_GPDMA_CAPS,
+    SKL_HW_CFG_GATEWAY_COUNT,
+    SKL_HW_CFG_HP_EBB_COUNT,
+    SKL_HW_CFG_LP_EBB_COUNT,
+    SKL_HW_CFG_EBB_SIZE_BYTES,
+    SKL_HW_CFG_UAOL_CAPS
+};
+
+enum skl_cavs_version {
+    SKL_CAVS_VER_1_5 = 0x10005,
+    SKL_CAVS_VER_1_8 = 0x10008,
+};
+
+enum skl_i2s_version {
Quoted 8 lines

sound/soc/intel/skylake/skl-sst-ipc.h struct skl_fw_cfg { · line 169

Quoted 5 lines
sound/soc/intel/skylake/skl-sst-ipc.h +5 -0
+    SKL_I2S_VER_15_SKYLAKE   = 0x00000,
+    SKL_I2S_VER_15_BROXTON   = 0x10000,
+    SKL_I2S_VER_15_BROXTON_P = 0x20000,
+    SKL_I2S_VER_18_KBL_CNL   = 0x30000,
+};

The encoding is odd.
Do these values mean anything (e.g. tied to firmware definitions?)

Exactly. Right now I'm mirroring FW side. Don't blame me for encoding, I know it's weird : D
_______________________________________________
Alsa-devel mailing list
[email protected]
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

author maintainer
#10 lore raw

PATCH 4/35 ASoC: Intel: Skylake: Unify firmware loading mechanism

In reply to Cezary Rojewski

There are certain operations we want to do before and after firmware loading e.g.: disabling/ enabling power and clock gating. To make code coherent, provide skl_init_fw as a unified way for loading dsp firmware.

In consequence, this change provides CNL load library support during fw initialization which was previously missing.

skl_dsp_fw_ops already takes care of fw and library load customization. New post-load additions in form of fw and hw config assignments make this change even more welcome.

---
 sound/soc/intel/skylake/bxt-sst.c      | 27 -----------------
 sound/soc/intel/skylake/cnl-sst-dsp.h  |  1 -
 sound/soc/intel/skylake/cnl-sst.c      | 19 ------------
 sound/soc/intel/skylake/skl-messages.c |  8 -----
 sound/soc/intel/skylake/skl-pcm.c      | 22 ++------------
 sound/soc/intel/skylake/skl-sst-dsp.c  |  1 +
 sound/soc/intel/skylake/skl-sst-dsp.h  |  2 --
 sound/soc/intel/skylake/skl-sst.c      | 41 ++++++++++++++++++++++----
 sound/soc/intel/skylake/skl.h          |  2 +-
 9 files changed, 40 insertions(+), 83 deletions(-)
sound/soc/intel/skylake/bxt-sst.c +0 -27
index 92a82e6b5fe6..5bece3a6d741 100644
@@ -591,33 +591,6 @@ int bxt_sst_dsp_init(struct device *dev, void __iomem *mmio_base, int irq,
 }
 EXPORT_SYMBOL_GPL(bxt_sst_dsp_init);
 
-int bxt_sst_init_fw(struct device *dev, struct skl_dev *skl)
-{
-	int ret;
-	struct sst_dsp *sst = skl->dsp;
-
-	ret = sst->fw_ops.load_fw(sst);
-	if (ret < 0) {
-		dev_err(dev, "Load base fw failed: %x\n", ret);
-		return ret;
-	}
-
-	skl_dsp_init_core_state(sst);
-
-	if (skl->lib_count > 1) {
-		ret = sst->fw_ops.load_library(sst, skl->lib_info,
-						skl->lib_count);
-		if (ret < 0) {
-			dev_err(dev, "Load Library failed : %x\n", ret);
-			return ret;
-		}
-	}
-	skl->is_first_boot = false;
-
-	return 0;
-}
-EXPORT_SYMBOL_GPL(bxt_sst_init_fw);
-
 void bxt_sst_dsp_cleanup(struct device *dev, struct skl_dev *skl)
 {
 
sound/soc/intel/skylake/cnl-sst-dsp.h +0 -1
index 7bd4d2a8fdfa..50f4a53a607c 100644
@@ -97,7 +97,6 @@ void cnl_ipc_free(struct sst_generic_ipc *ipc);
 int cnl_sst_dsp_init(struct device *dev, void __iomem *mmio_base, int irq,
 		     const char *fw_name, struct skl_dsp_loader_ops dsp_ops,
 		     struct skl_dev **dsp);
-int cnl_sst_init_fw(struct device *dev, struct skl_dev *skl);
 void cnl_sst_dsp_cleanup(struct device *dev, struct skl_dev *skl);
 
 #endif /*__CNL_SST_DSP_H__*/
sound/soc/intel/skylake/cnl-sst.c +0 -19
index 4f64f097e9ae..8984653d925d 100644
@@ -453,25 +453,6 @@ int cnl_sst_dsp_init(struct device *dev, void __iomem *mmio_base, int irq,
 }
 EXPORT_SYMBOL_GPL(cnl_sst_dsp_init);
 
-int cnl_sst_init_fw(struct device *dev, struct skl_dev *skl)
-{
-	int ret;
-	struct sst_dsp *sst = skl->dsp;
-
-	ret = skl->dsp->fw_ops.load_fw(sst);
-	if (ret < 0) {
-		dev_err(dev, "load base fw failed: %d", ret);
-		return ret;
-	}
-
-	skl_dsp_init_core_state(sst);
-
-	skl->is_first_boot = false;
-
-	return 0;
-}
-EXPORT_SYMBOL_GPL(cnl_sst_init_fw);
-
 void cnl_sst_dsp_cleanup(struct device *dev, struct skl_dev *skl)
 {
 	if (skl->dsp->fw)
sound/soc/intel/skylake/skl-messages.c +0 -8
index d28b4887de27..cc949904717e 100644
@@ -173,7 +173,6 @@ static const struct skl_dsp_ops dsp_ops[] = {
 		.num_cores = 2,
 		.loader_ops = skl_get_loader_ops,
 		.init = skl_sst_dsp_init,
-		.init_fw = skl_sst_init_fw,
 		.cleanup = skl_sst_dsp_cleanup
 	},
 	{
@@ -181,7 +180,6 @@ static const struct skl_dsp_ops dsp_ops[] = {
 		.num_cores = 2,
 		.loader_ops = skl_get_loader_ops,
 		.init = skl_sst_dsp_init,
-		.init_fw = skl_sst_init_fw,
 		.cleanup = skl_sst_dsp_cleanup
 	},
 	{
@@ -189,7 +187,6 @@ static const struct skl_dsp_ops dsp_ops[] = {
 		.num_cores = 2,
 		.loader_ops = bxt_get_loader_ops,
 		.init = bxt_sst_dsp_init,
-		.init_fw = bxt_sst_init_fw,
 		.cleanup = bxt_sst_dsp_cleanup
 	},
 	{
@@ -197,7 +194,6 @@ static const struct skl_dsp_ops dsp_ops[] = {
 		.num_cores = 2,
 		.loader_ops = bxt_get_loader_ops,
 		.init = bxt_sst_dsp_init,
-		.init_fw = bxt_sst_init_fw,
 		.cleanup = bxt_sst_dsp_cleanup
 	},
 	{
@@ -205,7 +201,6 @@ static const struct skl_dsp_ops dsp_ops[] = {
 		.num_cores = 4,
 		.loader_ops = bxt_get_loader_ops,
 		.init = cnl_sst_dsp_init,
-		.init_fw = cnl_sst_init_fw,
 		.cleanup = cnl_sst_dsp_cleanup
 	},
 	{
@@ -213,7 +208,6 @@ static const struct skl_dsp_ops dsp_ops[] = {
 		.num_cores = 4,
 		.loader_ops = bxt_get_loader_ops,
 		.init = cnl_sst_dsp_init,
-		.init_fw = cnl_sst_init_fw,
 		.cleanup = cnl_sst_dsp_cleanup
 	},
 	{
@@ -221,7 +215,6 @@ static const struct skl_dsp_ops dsp_ops[] = {
 		.num_cores = 4,
 		.loader_ops = bxt_get_loader_ops,
 		.init = cnl_sst_dsp_init,
-		.init_fw = cnl_sst_init_fw,
 		.cleanup = cnl_sst_dsp_cleanup
 	},
 	{
@@ -229,7 +222,6 @@ static const struct skl_dsp_ops dsp_ops[] = {
 		.num_cores = 4,
 		.loader_ops = bxt_get_loader_ops,
 		.init = cnl_sst_dsp_init,
-		.init_fw = cnl_sst_init_fw,
 		.cleanup = cnl_sst_dsp_cleanup
 	},
 };
sound/soc/intel/skylake/skl-pcm.c +3 -19
index 7f287424af9b..1dbab3eac0e5 100644
@@ -1408,7 +1408,6 @@ static int skl_platform_soc_probe(struct snd_soc_component *component)
 {
 	struct hdac_bus *bus = dev_get_drvdata(component->dev);
 	struct skl_dev *skl = bus_to_skl(bus);
-	const struct skl_dsp_ops *ops;
 	int ret;
 
 	pm_runtime_get_sync(component->dev);
@@ -1424,25 +1423,10 @@ static int skl_platform_soc_probe(struct snd_soc_component *component)
 			return ret;
 		}
 
-		/* load the firmwares, since all is set */
-		ops = skl_get_dsp_ops(skl->pci->device);
-		if (!ops)
-			return -EIO;
-
-		/*
-		 * Disable dynamic clock and power gating during firmware
-		 * and library download
-		 */
-		skl->enable_miscbdcge(component->dev, false);
-		skl->clock_power_gating(component->dev, false);
-
-		ret = ops->init_fw(component->dev, skl);
-		skl->enable_miscbdcge(component->dev, true);
-		skl->clock_power_gating(component->dev, true);
-		if (ret < 0) {
-			dev_err(component->dev, "Failed to boot first fw: %d\n", ret);
+		ret = skl_sst_init_fw(skl);
+		if (ret < 0)
 			return ret;
-		}
+
 		skl_populate_modules(skl);
 		skl->update_d0i3c = skl_update_d0i3c;
 
sound/soc/intel/skylake/skl-sst-dsp.c +1 -0
index 225706d148d8..0eecf26986f9 100644
@@ -44,6 +44,7 @@ void skl_dsp_init_core_state(struct sst_dsp *ctx)
 		skl->cores.usage_count[i] = 0;
 	}
 }
+EXPORT_SYMBOL_GPL(skl_dsp_init_core_state);
 
 /* Get the mask for all enabled cores */
 unsigned int skl_dsp_get_enabled_cores(struct sst_dsp *ctx)
sound/soc/intel/skylake/skl-sst-dsp.h +0 -2
index cdfec0fca577..4da240582454 100644
@@ -226,8 +226,6 @@ int skl_sst_dsp_init(struct device *dev, void __iomem *mmio_base, int irq,
 int bxt_sst_dsp_init(struct device *dev, void __iomem *mmio_base, int irq,
 		const char *fw_name, struct skl_dsp_loader_ops dsp_ops,
 		struct skl_dev **dsp);
-int skl_sst_init_fw(struct device *dev, struct skl_dev *skl);
-int bxt_sst_init_fw(struct device *dev, struct skl_dev *skl);
 void skl_sst_dsp_cleanup(struct device *dev, struct skl_dev *skl);
 void bxt_sst_dsp_cleanup(struct device *dev, struct skl_dev *skl);
 
sound/soc/intel/skylake/skl-sst.c +35 -6

65 lines not on this page · raw message

sound/soc/intel/skylake/skl.h +1 -1
index 972de5ddf2b7..1f86543fe954 100644
@@ -161,7 +161,6 @@ struct skl_dsp_ops {
 			int irq, const char *fw_name,
 			struct skl_dsp_loader_ops loader_ops,
 			struct skl_dev **skl_sst);
-	int (*init_fw)(struct device *dev, struct skl_dev *skl);
 	void (*cleanup)(struct device *dev, struct skl_dev *skl);
 };
 
@@ -175,6 +174,7 @@ struct nhlt_specific_cfg *skl_get_ep_blob(struct skl_dev *skl, u32 instance,
 int skl_nhlt_update_topology_bin(struct skl_dev *skl);
 int skl_init_dsp(struct skl_dev *skl);
 int skl_free_dsp(struct skl_dev *skl);
+int skl_sst_init_fw(struct skl_dev *skl);
 int skl_suspend_late_dsp(struct skl_dev *skl);
 int skl_suspend_dsp(struct skl_dev *skl);
 int skl_resume_dsp(struct skl_dev *skl);
Signature · 1 line
2.17.1
#11 lore raw

Re: [PATCH 04/35] ASoC: Intel: Skylake: Unify firmware loading mechanism

Quoted 15 lines
sound/soc/intel/skylake/skl-sst.c +8 -2
-int skl_sst_init_fw(struct device *dev, struct skl_dev *skl)
+int skl_sst_init_fw(struct skl_dev *skl)
  {
-	int ret;
  	struct sst_dsp *sst = skl->dsp;
+	struct device *dev = skl->dev;
+	int (*lp_check)(struct sst_dsp *dsp, bool state);
+	int ret;
+
+	lp_check = skl->ipc.ops.check_dsp_lp_on;
+	skl->enable_miscbdcge(dev, false);
+	skl->clock_power_gating(dev, false);
 
  	ret = sst->fw_ops.load_fw(sst);

sound/soc/intel/skylake/skl-sst.c int skl_sst_dsp_init(struct device *dev, void __iomem *mmio_base, int irq, · line 578

Quoted 10 lines
sound/soc/intel/skylake/skl-sst.c +7 -1
  	if (ret < 0) {
  		dev_err(dev, "Load base fw failed : %d\n", ret);
-		return ret;
+		goto exit;
+	}
+
+	if (!skl->is_first_boot)
+		goto library_load;
+	/* Disable power check during cfg setup */
+	skl->ipc.ops.check_dsp_lp_on = NULL;

It's very odd to play with .ops callback dynamically. Usually ops are constant, and if you want to disable them you add a flag.

Quoted 37 lines
sound/soc/intel/skylake/skl-sst.c +20 -3
+
+	ret = skl_ipc_fw_cfg_get(&skl->ipc, &skl->fw_cfg);
+	if (ret < 0) {
+		dev_err(dev, "Failed to get fw cfg: %d\n", ret);
+		goto exit;
+	}
+
+	ret = skl_ipc_hw_cfg_get(&skl->ipc, &skl->hw_cfg);
+	if (ret < 0) {
+		dev_err(dev, "Failed to get hw cfg: %d\n", ret);
+		goto exit;
  	}
 
  	skl_dsp_init_core_state(sst);
 
+library_load:
  	if (skl->lib_count > 1) {
  		ret = sst->fw_ops.load_library(sst, skl->lib_info,
  						skl->lib_count);
  		if (ret < 0) {
-			dev_err(dev, "Load Library failed : %x\n", ret);
-			return ret;
+			dev_err(dev, "Load library failed : %x\n", ret);
+			goto exit;
  		}
  	}
+
  	skl->is_first_boot = false;
+exit:
+	skl->ipc.ops.check_dsp_lp_on = lp_check;
+	skl->enable_miscbdcge(dev, true);
+	skl->clock_power_gating(dev, true);
 
-	return 0;
+	return ret;
  }
  EXPORT_SYMBOL_GPL(skl_sst_init_fw);
author maintainer
#12 lore raw

Re: [PATCH 04/35] ASoC: Intel: Skylake: Unify firmware loading mechanism

Quoted 18 lines · Pierre-Louis Bossart
Quoted 18 lines
sound/soc/intel/skylake/skl-sst.c +1 -1
-int skl_sst_init_fw(struct device *dev, struct skl_dev *skl)
+int skl_sst_init_fw(struct skl_dev *skl)

  {
-    int ret;
      struct sst_dsp *sst = skl->dsp;
+    struct device *dev = skl->dev;
+    int (*lp_check)(struct sst_dsp *dsp, bool state); +    int ret;
+
+    lp_check = skl->ipc.ops.check_dsp_lp_on;
+    skl->enable_miscbdcge(dev, false);
+    skl->clock_power_gating(dev, false);
      ret = sst->fw_ops.load_fw(sst);
      if (ret < 0) {
          dev_err(dev, "Load base fw failed : %d\n", ret); -        return ret;
+        goto exit;

Quoted 9 lines
Quoted 6 lines

+    }
+
+    if (!skl->is_first_boot)
+        goto library_load;
+    /* Disable power check during cfg setup */
+    skl->ipc.ops.check_dsp_lp_on = NULL;

It's very odd to play with .ops callback dynamically. Usually ops are constant, and if you want to disable them you add a flag.

Yeye, keen eye! Can't do everything at once though :/
The power check is APL+ specific and should not be part of generic ipc framework at all (found in /sound/soc/intel/common/sst-ipc.c). Different fate awaits said check. For now, in this single case it seems best to simply disable the check and reapply it once setup is done.

Quoted 26 lines
Quoted 26 lines
sound/soc/intel/skylake/skl-sst.c +11 -0
+
+    ret = skl_ipc_fw_cfg_get(&skl->ipc, &skl->fw_cfg);
+    if (ret < 0) {
+        dev_err(dev, "Failed to get fw cfg: %d\n", ret);
+        goto exit;
+    }
+
+    ret = skl_ipc_hw_cfg_get(&skl->ipc, &skl->hw_cfg);
+    if (ret < 0) {
+        dev_err(dev, "Failed to get hw cfg: %d\n", ret);
+        goto exit;

      }
      skl_dsp_init_core_state(sst);
+library_load:
      if (skl->lib_count > 1) {
          ret = sst->fw_ops.load_library(sst, skl->lib_info, skl->lib_count);
          if (ret < 0) {
-            dev_err(dev, "Load Library failed : %x\n", ret); -            return ret;
+            dev_err(dev, "Load library failed : %x\n", ret); +            goto exit;
          }
      }
+
      skl->is_first_boot = false;

Quoted 8 lines
Quoted 8 lines

+exit:
+    skl->ipc.ops.check_dsp_lp_on = lp_check;
+    skl->enable_miscbdcge(dev, true);
+    skl->clock_power_gating(dev, true);
-    return 0;
+    return ret;
  }
  EXPORT_SYMBOL_GPL(skl_sst_init_fw);

_______________________________________________
Alsa-devel mailing list
[email protected]
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

#13 lore raw

Re: [PATCH 04/35] ASoC: Intel: Skylake: Unify firmware loading mechanism

Quoted 29 lines · Cezary Rojewski
Quoted 18 lines · Pierre-Louis Bossart
Quoted 18 lines
sound/soc/intel/skylake/skl-sst.c +1 -1
-int skl_sst_init_fw(struct device *dev, struct skl_dev *skl)
+int skl_sst_init_fw(struct skl_dev *skl)

  {
-    int ret;
      struct sst_dsp *sst = skl->dsp;
+    struct device *dev = skl->dev;
+    int (*lp_check)(struct sst_dsp *dsp, bool state); +    int ret;
+
+    lp_check = skl->ipc.ops.check_dsp_lp_on;
+    skl->enable_miscbdcge(dev, false);
+    skl->clock_power_gating(dev, false);
      ret = sst->fw_ops.load_fw(sst);
      if (ret < 0) {
          dev_err(dev, "Load base fw failed : %d\n", ret); -        return ret;
+        goto exit;

Quoted 9 lines
Quoted 6 lines

+    }
+
+    if (!skl->is_first_boot)
+        goto library_load;
+    /* Disable power check during cfg setup */
+    skl->ipc.ops.check_dsp_lp_on = NULL;

It's very odd to play with .ops callback dynamically. Usually ops are constant, and if you want to disable them you add a flag.

Quoted 2 lines

Yeye, keen eye! Can't do everything at once though :/
The power check is APL+ specific and should not be part of generic ipc framework at all (found in /sound/soc/intel/common/sst-ipc.c). Different fate awaits said check. For now, in this single case it seems best to simply disable the check and reapply it once setup is done.

What's the difference with having this callback do nothing for APL-?

Quoted 27 lines
Quoted 27 lines
Quoted 27 lines
sound/soc/intel/skylake/skl-sst.c +11 -0
+
+    ret = skl_ipc_fw_cfg_get(&skl->ipc, &skl->fw_cfg);
+    if (ret < 0) {
+        dev_err(dev, "Failed to get fw cfg: %d\n", ret);
+        goto exit;
+    }
+
+    ret = skl_ipc_hw_cfg_get(&skl->ipc, &skl->hw_cfg);
+    if (ret < 0) {
+        dev_err(dev, "Failed to get hw cfg: %d\n", ret);
+        goto exit;

      }
      skl_dsp_init_core_state(sst);
+library_load:
      if (skl->lib_count > 1) {
          ret = sst->fw_ops.load_library(sst, skl->lib_info, skl->lib_count);
          if (ret < 0) {
-            dev_err(dev, "Load Library failed : %x\n", ret); -            return ret;
+            dev_err(dev, "Load library failed : %x\n", ret); +            goto exit;
          }
      }
+
      skl->is_first_boot = false;

Quoted 8 lines
Quoted 8 lines
Quoted 8 lines

+exit:
+    skl->ipc.ops.check_dsp_lp_on = lp_check;
+    skl->enable_miscbdcge(dev, true);
+    skl->clock_power_gating(dev, true);
-    return 0;
+    return ret;
  }
  EXPORT_SYMBOL_GPL(skl_sst_init_fw);

_______________________________________________
Alsa-devel mailing list
[email protected]
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

author maintainer
#14 lore raw

Re: [PATCH 04/35] ASoC: Intel: Skylake: Unify firmware loading mechanism

Quoted 32 lines · Pierre-Louis Bossart
Quoted 29 lines · Cezary Rojewski
Quoted 27 lines · Pierre-Louis Bossart
Quoted 16 lines
sound/soc/intel/skylake/skl-sst.c +1 -1
-int skl_sst_init_fw(struct device *dev, struct skl_dev *skl)
+int skl_sst_init_fw(struct skl_dev *skl)

  {
-    int ret;
      struct sst_dsp *sst = skl->dsp;
+    struct device *dev = skl->dev;
+    int (*lp_check)(struct sst_dsp *dsp, bool state); +    int ret;
+
+    lp_check = skl->ipc.ops.check_dsp_lp_on;
+    skl->enable_miscbdcge(dev, false);
+    skl->clock_power_gating(dev, false);
      ret = sst->fw_ops.load_fw(sst);
      if (ret < 0) {
          dev_err(dev, "Load base fw failed : %d\n", ret);

Quoted 8 lines

-        return ret;
+        goto exit;
+    }
+
+    if (!skl->is_first_boot)
+        goto library_load;
+    /* Disable power check during cfg setup */
+    skl->ipc.ops.check_dsp_lp_on = NULL;

It's very odd to play with .ops callback dynamically. Usually ops are constant, and if you want to disable them you add a flag.

Quoted 5 lines
Quoted 2 lines

Yeye, keen eye! Can't do everything at once though :/
The power check is APL+ specific and should not be part of generic ipc framework at all (found in /sound/soc/intel/common/sst-ipc.c). Different fate awaits said check. For now, in this single case it seems best to simply disable the check and reapply it once setup is done.

What's the difference with having this callback do nothing for APL-?

The entire check_dsp_lp_on is actually D0ix thingy.
-- The power-management is being addressed in following segment. --

D0ix is a power-optimization feature and implemented in APL and onward. So for SKL/ KBL there is no check_dsp_lp_on. You can see the difference in /skylake/skl-sst.c: static const struct skl_dsp_fw_ops skl_fw_ops (lack of set_state_D0ix handlers)

Once dsp-host interaction can be described as idle (e.g. ongoing playback with no IPC traffic), host may enable FW to power gate some components and thus reduce power consumption.

D0ix is abbrev for D0i0 <-> D0i3 transitions. Once dsp enters D0i3 (power gated), no IPCs can be consumed apart from one and only SetD0ix - to wake dsp back to D0i0 state. In general you can think of D0i0 as D0. Again, since SKL/ KBL have no D0ix, there is no need to wake anything, no checks are required.
_______________________________________________
Alsa-devel mailing list
[email protected]
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

author maintainer
#15 lore raw

PATCH 5/35 ASoC: Intel: Skylake: Reload libraries on D0 entry for CNL

In reply to Cezary Rojewski

As libraries are lost in D3, they need to be reloaded on D0 entry. Cannonlake's library load process is equivalent to Broxton's, thus reuse the existing one.

---
 sound/soc/intel/skylake/bxt-sst.c     |  3 ++-
 sound/soc/intel/skylake/cnl-sst.c     | 11 +++++++++++
 sound/soc/intel/skylake/skl-sst-dsp.h |  2 ++
 3 files changed, 15 insertions(+), 1 deletion(-)
sound/soc/intel/skylake/bxt-sst.c +2 -1
index 5bece3a6d741..cc9507d4702b 100644
@@ -45,7 +45,7 @@ static unsigned int bxt_get_errorcode(struct sst_dsp *ctx)
 	 return sst_dsp_shim_read(ctx, BXT_ADSP_ERROR_CODE);
 }
 
-static int
+int
 bxt_load_library(struct sst_dsp *ctx, struct skl_lib_info *linfo, int lib_count)
 {
 	struct snd_dma_buffer dmab;
@@ -88,6 +88,7 @@ bxt_load_library(struct sst_dsp *ctx, struct skl_lib_info *linfo, int lib_count)
 	skl_release_library(linfo, lib_count);
 	return ret;
 }
+EXPORT_SYMBOL_GPL(bxt_load_library);
 
 /*
  * First boot sequence has some extra steps. Core 0 waits for power
sound/soc/intel/skylake/cnl-sst.c +11 -0
index 8984653d925d..a2b3bce631fc 100644
@@ -179,6 +179,16 @@ static int cnl_set_dsp_D0(struct sst_dsp *ctx, unsigned int core_id)
 			return ret;
 		}
 
+		if (cnl->lib_count > 1) {
+			ret = ctx->fw_ops.load_library(ctx, cnl->lib_info,
+						cnl->lib_count);
+			if (ret < 0) {
+				dev_err(ctx->dev,
+					"reload libs failed: %d\n", ret);
+				return ret;
+			}
+		}
+
 		cnl->cores.state[core_id] = SKL_DSP_RUNNING;
 		return ret;
 	}
@@ -273,6 +283,7 @@ static const struct skl_dsp_fw_ops cnl_fw_ops = {
 	.set_state_D3 = cnl_set_dsp_D3,
 	.load_fw = cnl_load_base_firmware,
 	.get_fw_errcode = cnl_get_errno,
+	.load_library = bxt_load_library,
 };
 
 static struct sst_ops cnl_ops = {
sound/soc/intel/skylake/skl-sst-dsp.h +2 -0
index 4da240582454..06979652985c 100644
@@ -228,6 +228,8 @@ int bxt_sst_dsp_init(struct device *dev, void __iomem *mmio_base, int irq,
 		struct skl_dev **dsp);
 void skl_sst_dsp_cleanup(struct device *dev, struct skl_dev *skl);
 void bxt_sst_dsp_cleanup(struct device *dev, struct skl_dev *skl);
+int bxt_load_library(struct sst_dsp *ctx, struct skl_lib_info *linfo,
+		int lib_count);
 
 int snd_skl_parse_uuids(struct sst_dsp *ctx, const struct firmware *fw,
 				unsigned int offset, int index);
Signature · 1 line
2.17.1
author maintainer
#16 lore raw

PATCH 6/35 ASoC: Intel: Skylake: Unhardcode dsp cores number

In reply to Cezary Rojewski

While on the quest for unhardcoding the driver, use skl hw_cfg property instead of hardcoded value to retrieve number of supported dsp cores.

---
 sound/soc/intel/skylake/skl-messages.c | 28 -------------------------
 sound/soc/intel/skylake/skl-sst-dsp.c  | 29 +++++++++++++++++++-------
 sound/soc/intel/skylake/skl-sst-dsp.h  |  2 +-
 sound/soc/intel/skylake/skl-sst.c      |  4 +++-
 sound/soc/intel/skylake/skl.h          |  1 -
 5 files changed, 26 insertions(+), 38 deletions(-)
sound/soc/intel/skylake/skl-messages.c +0 -28
index cc949904717e..e4ac1ae777e0 100644
@@ -170,56 +170,48 @@ static struct skl_dsp_loader_ops bxt_get_loader_ops(void)
 static const struct skl_dsp_ops dsp_ops[] = {
 	{
 		.id = 0x9d70,
-		.num_cores = 2,
 		.loader_ops = skl_get_loader_ops,
 		.init = skl_sst_dsp_init,
 		.cleanup = skl_sst_dsp_cleanup
 	},
 	{
 		.id = 0x9d71,
-		.num_cores = 2,
 		.loader_ops = skl_get_loader_ops,
 		.init = skl_sst_dsp_init,
 		.cleanup = skl_sst_dsp_cleanup
 	},
 	{
 		.id = 0x5a98,
-		.num_cores = 2,
 		.loader_ops = bxt_get_loader_ops,
 		.init = bxt_sst_dsp_init,
 		.cleanup = bxt_sst_dsp_cleanup
 	},
 	{
 		.id = 0x3198,
-		.num_cores = 2,
 		.loader_ops = bxt_get_loader_ops,
 		.init = bxt_sst_dsp_init,
 		.cleanup = bxt_sst_dsp_cleanup
 	},
 	{
 		.id = 0x9dc8,
-		.num_cores = 4,
 		.loader_ops = bxt_get_loader_ops,
 		.init = cnl_sst_dsp_init,
 		.cleanup = cnl_sst_dsp_cleanup
 	},
 	{
 		.id = 0xa348,
-		.num_cores = 4,
 		.loader_ops = bxt_get_loader_ops,
 		.init = cnl_sst_dsp_init,
 		.cleanup = cnl_sst_dsp_cleanup
 	},
 	{
 		.id = 0x02c8,
-		.num_cores = 4,
 		.loader_ops = bxt_get_loader_ops,
 		.init = cnl_sst_dsp_init,
 		.cleanup = cnl_sst_dsp_cleanup
 	},
 	{
 		.id = 0x06c8,
-		.num_cores = 4,
 		.loader_ops = bxt_get_loader_ops,
 		.init = cnl_sst_dsp_init,
 		.cleanup = cnl_sst_dsp_cleanup
@@ -245,7 +237,6 @@ int skl_init_dsp(struct skl_dev *skl)
 	struct skl_dsp_loader_ops loader_ops;
 	int irq = bus->irq;
 	const struct skl_dsp_ops *ops;
-	struct skl_dsp_cores *cores;
 	int ret;
 
 	/* enable ppcap interrupt */
@@ -274,29 +265,10 @@ int skl_init_dsp(struct skl_dev *skl)
 		goto unmap_mmio;
 
 	skl->dsp_ops = ops;
-	cores = &skl->cores;
-	cores->count = ops->num_cores;
-
-	cores->state = kcalloc(cores->count, sizeof(*cores->state), GFP_KERNEL);
-	if (!cores->state) {
-		ret = -ENOMEM;
-		goto unmap_mmio;
-	}
-
-	cores->usage_count = kcalloc(cores->count, sizeof(*cores->usage_count),
-				     GFP_KERNEL);
-	if (!cores->usage_count) {
-		ret = -ENOMEM;
-		goto free_core_state;
-	}
-
 	dev_dbg(bus->dev, "dsp registration status=%d\n", ret);
 
 	return 0;
 
-free_core_state:
-	kfree(cores->state);
-
 unmap_mmio:
 	iounmap(mmio_base);
 
sound/soc/intel/skylake/skl-sst-dsp.c +22 -7
index 0eecf26986f9..15acbe80711e 100644
@@ -8,7 +8,7 @@
  * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  */
 #include <sound/pcm.h>
-
+#include <linux/slab.h>
 #include "../common/sst-dsp.h"
 #include "../common/sst-ipc.h"
 #include "../common/sst-dsp-priv.h"
@@ -31,18 +31,33 @@ void skl_dsp_set_state_locked(struct sst_dsp *ctx, int state)
  * successful first boot. Hence core 0 will be running and other cores
  * will be reset
  */
-void skl_dsp_init_core_state(struct sst_dsp *ctx)
+int skl_dsp_init_core_state(struct sst_dsp *ctx)
 {
 	struct skl_dev *skl = ctx->thread_context;
+	struct skl_dsp_cores *cores = &skl->cores;
 	int i;
 
-	skl->cores.state[SKL_DSP_CORE0_ID] = SKL_DSP_RUNNING;
-	skl->cores.usage_count[SKL_DSP_CORE0_ID] = 1;
+	cores->count = skl->hw_cfg.dsp_cores;
+	cores->state = kcalloc(cores->count,
+			sizeof(*cores->state), GFP_KERNEL);
+	if (!cores->state)
+		return -ENOMEM;
+
+	cores->usage_count = kcalloc(cores->count,
+			sizeof(*cores->usage_count), GFP_KERNEL);
+	if (!cores->usage_count) {
+		kfree(cores->state);
+		return -ENOMEM;
+	}
+
+	cores->state[SKL_DSP_CORE0_ID] = SKL_DSP_RUNNING;
+	cores->usage_count[SKL_DSP_CORE0_ID] = 1;
 
-	for (i = SKL_DSP_CORE0_ID + 1; i < skl->cores.count; i++) {
-		skl->cores.state[i] = SKL_DSP_RESET;
-		skl->cores.usage_count[i] = 0;
+	for (i = SKL_DSP_CORE0_ID + 1; i < cores->count; i++) {
+		cores->state[i] = SKL_DSP_RESET;
+		cores->usage_count[i] = 0;
 	}
+	return 0;
 }
 EXPORT_SYMBOL_GPL(skl_dsp_init_core_state);
 
sound/soc/intel/skylake/skl-sst-dsp.h +1 -1
index 06979652985c..2129627e6255 100644
@@ -202,7 +202,7 @@ int skl_dsp_acquire_irq(struct sst_dsp *sst);
 bool is_skl_dsp_running(struct sst_dsp *ctx);
 
 unsigned int skl_dsp_get_enabled_cores(struct sst_dsp *ctx);
-void skl_dsp_init_core_state(struct sst_dsp *ctx);
+int skl_dsp_init_core_state(struct sst_dsp *ctx);
 int skl_dsp_enable_core(struct sst_dsp *ctx, unsigned int core_mask);
 int skl_dsp_disable_core(struct sst_dsp *ctx, unsigned int core_mask);
 int skl_dsp_core_power_up(struct sst_dsp *ctx, unsigned int core_mask);
sound/soc/intel/skylake/skl-sst.c +3 -1
index 8a8ecb9a4fc6..163590682e1a 100644
@@ -589,7 +589,9 @@ int skl_sst_init_fw(struct skl_dev *skl)
 		goto exit;
 	}
 
-	skl_dsp_init_core_state(sst);
+	ret = skl_dsp_init_core_state(sst);
+	if (ret < 0)
+		goto exit;
 
 library_load:
 	if (skl->lib_count > 1) {
sound/soc/intel/skylake/skl.h +0 -1
index 1f86543fe954..71e69f52b7ab 100644
@@ -155,7 +155,6 @@ struct skl_machine_pdata {
 
 struct skl_dsp_ops {
 	int id;
-	unsigned int num_cores;
 	struct skl_dsp_loader_ops (*loader_ops)(void);
 	int (*init)(struct device *dev, void __iomem *mmio_base,
 			int irq, const char *fw_name,
Signature · 1 line
2.17.1
author maintainer
#17 lore raw

PATCH 7/35 ASoC: Intel: Skylake: Update interrupt disabling routine

In reply to Cezary Rojewski

CNL disable interrupt routine correctly makes use of locked _update_bits whereas SKL lagged behind and still invokes unlocked variants. Update SKL equivalent to match its CNL brother.

---
 sound/soc/intel/skylake/skl-sst-ipc.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
sound/soc/intel/skylake/skl-sst-ipc.c +2 -2
index 91b5440c643d..4875a518dd54 100644
@@ -582,11 +582,11 @@ void skl_ipc_op_int_enable(struct sst_dsp *ctx)
 void skl_ipc_op_int_disable(struct sst_dsp *ctx)
 {
 	/* disable IPC DONE interrupt */
-	sst_dsp_shim_update_bits_unlocked(ctx, SKL_ADSP_REG_HIPCCTL,
+	sst_dsp_shim_update_bits(ctx, SKL_ADSP_REG_HIPCCTL,
 					SKL_ADSP_REG_HIPCCTL_DONE, 0);
 
 	/* Disable IPC BUSY interrupt */
-	sst_dsp_shim_update_bits_unlocked(ctx, SKL_ADSP_REG_HIPCCTL,
+	sst_dsp_shim_update_bits(ctx, SKL_ADSP_REG_HIPCCTL,
 					SKL_ADSP_REG_HIPCCTL_BUSY, 0);
 
 }
Signature · 1 line
2.17.1
author maintainer
#18 lore raw

PATCH 8/35 ASoC: Intel: Skylake: Inline ipc free operations

In reply to Cezary Rojewski

skl_ipc_free and its equivalents are simple wrappers. Let's inline them, making room for cleanup mechanism unification.

---
 sound/soc/intel/skylake/bxt-sst.c     |  1 -
 sound/soc/intel/skylake/cnl-sst-dsp.c | 12 +++++-------
 sound/soc/intel/skylake/cnl-sst-dsp.h |  1 -
 sound/soc/intel/skylake/cnl-sst.c     |  1 -
 sound/soc/intel/skylake/skl-sst-dsp.c |  5 ++++-
 sound/soc/intel/skylake/skl-sst-ipc.c | 13 -------------
 sound/soc/intel/skylake/skl-sst-ipc.h |  1 -
 sound/soc/intel/skylake/skl-sst.c     |  1 -
 8 files changed, 9 insertions(+), 26 deletions(-)
sound/soc/intel/skylake/bxt-sst.c +0 -1
index cc9507d4702b..68f400cfb390 100644
@@ -599,7 +599,6 @@ void bxt_sst_dsp_cleanup(struct device *dev, struct skl_dev *skl)
 	if (skl->dsp->fw)
 		release_firmware(skl->dsp->fw);
 	skl_freeup_uuid_list(skl);
-	skl_ipc_free(&skl->ipc);
 	skl->dsp->ops->free(skl->dsp);
 }
 EXPORT_SYMBOL_GPL(bxt_sst_dsp_cleanup);
sound/soc/intel/skylake/cnl-sst-dsp.c +5 -7
index 3ef1b194add1..189c1c7086e3 100644
@@ -14,9 +14,9 @@
  */
 #include <linux/device.h>
 #include "../common/sst-dsp.h"
-#include "../common/sst-ipc.h"
 #include "../common/sst-dsp-priv.h"
 #include "cnl-sst-dsp.h"
+#include "skl.h"
 
 /* various timeout values */
 #define CNL_DSP_PU_TO		50
@@ -209,10 +209,13 @@ irqreturn_t cnl_dsp_sst_interrupt(int irq, void *dev_id)
 
 void cnl_dsp_free(struct sst_dsp *dsp)
 {
+	struct skl_dev *skl = dsp->thread_context;
+
+	cnl_ipc_op_int_disable(dsp);
+	sst_ipc_fini(&skl->ipc);
 	cnl_ipc_int_disable(dsp);
 
 	free_irq(dsp->irq, dsp);
-	cnl_ipc_op_int_disable(dsp);
 	cnl_dsp_disable_core(dsp, SKL_DSP_CORE0_MASK);
 }
 EXPORT_SYMBOL_GPL(cnl_dsp_free);
@@ -259,8 +262,3 @@ bool cnl_ipc_int_status(struct sst_dsp *ctx)
 							CNL_ADSPIS_IPC;
 }
 
-void cnl_ipc_free(struct sst_generic_ipc *ipc)
-{
-	cnl_ipc_op_int_disable(ipc->dsp);
-	sst_ipc_fini(ipc);
-}
sound/soc/intel/skylake/cnl-sst-dsp.h +0 -1
index 50f4a53a607c..b1417639bc1c 100644
@@ -92,7 +92,6 @@ void cnl_ipc_int_disable(struct sst_dsp *ctx);
 void cnl_ipc_op_int_enable(struct sst_dsp *ctx);
 void cnl_ipc_op_int_disable(struct sst_dsp *ctx);
 bool cnl_ipc_int_status(struct sst_dsp *ctx);
-void cnl_ipc_free(struct sst_generic_ipc *ipc);
 
 int cnl_sst_dsp_init(struct device *dev, void __iomem *mmio_base, int irq,
 		     const char *fw_name, struct skl_dsp_loader_ops dsp_ops,
sound/soc/intel/skylake/cnl-sst.c +0 -1
index a2b3bce631fc..76b23ea7802e 100644
@@ -470,7 +470,6 @@ void cnl_sst_dsp_cleanup(struct device *dev, struct skl_dev *skl)
 		release_firmware(skl->dsp->fw);
 
 	skl_freeup_uuid_list(skl);
-	cnl_ipc_free(&skl->ipc);
 
 	skl->dsp->ops->free(skl->dsp);
 }
sound/soc/intel/skylake/skl-sst-dsp.c +4 -1
index 15acbe80711e..e0807db225f4 100644
@@ -463,10 +463,13 @@ int skl_dsp_acquire_irq(struct sst_dsp *sst)
 
 void skl_dsp_free(struct sst_dsp *dsp)
 {
+	struct skl_dev *skl = dsp->thread_context;
+
+	skl_ipc_op_int_disable(dsp);
+	sst_ipc_fini(&skl->ipc);
 	skl_ipc_int_disable(dsp);
 
 	free_irq(dsp->irq, dsp);
-	skl_ipc_op_int_disable(dsp);
 	skl_dsp_disable_core(dsp, SKL_DSP_CORE0_MASK);
 }
 EXPORT_SYMBOL_GPL(skl_dsp_free);
sound/soc/intel/skylake/skl-sst-ipc.c +0 -13
index 4875a518dd54..2700f882103d 100644
@@ -620,19 +620,6 @@ int skl_ipc_init(struct device *dev, struct skl_dev *skl)
 	return 0;
 }
 
-void skl_ipc_free(struct sst_generic_ipc *ipc)
-{
-	/* Disable IPC DONE interrupt */
-	sst_dsp_shim_update_bits(ipc->dsp, SKL_ADSP_REG_HIPCCTL,
-		SKL_ADSP_REG_HIPCCTL_DONE, 0);
-
-	/* Disable IPC BUSY interrupt */
-	sst_dsp_shim_update_bits(ipc->dsp, SKL_ADSP_REG_HIPCCTL,
-		SKL_ADSP_REG_HIPCCTL_BUSY, 0);
-
-	sst_ipc_fini(ipc);
-}
-
 int skl_ipc_create_pipeline(struct sst_generic_ipc *ipc,
 		u16 ppl_mem_size, u8 ppl_type, u8 instance_id, u8 lp_mode)
 {
sound/soc/intel/skylake/skl-sst-ipc.h +0 -1
index eefa52f7f97a..fb150e656379 100644
@@ -275,7 +275,6 @@ void skl_ipc_op_int_disable(struct sst_dsp *ctx);
 void skl_ipc_int_disable(struct sst_dsp *dsp);
 
 bool skl_ipc_int_status(struct sst_dsp *dsp);
-void skl_ipc_free(struct sst_generic_ipc *ipc);
 int skl_ipc_init(struct device *dev, struct skl_dev *skl);
 void skl_clear_module_cnt(struct sst_dsp *ctx);
 
sound/soc/intel/skylake/skl-sst.c +0 -1
index 163590682e1a..72ab579ddd27 100644
@@ -620,7 +620,6 @@ void skl_sst_dsp_cleanup(struct device *dev, struct skl_dev *skl)
 		release_firmware(skl->dsp->fw);
 	skl_clear_module_table(skl->dsp);
 	skl_freeup_uuid_list(skl);
-	skl_ipc_free(&skl->ipc);
 	skl->dsp->ops->free(skl->dsp);
 	if (skl->boot_complete) {
 		skl->dsp->cl_dev.ops.cl_cleanup_controller(skl->dsp);
Signature · 1 line
2.17.1
author maintainer
#19 lore raw

PATCH 9/35 ASoC: Intel: Skylake: Unify driver cleanup mechanism

In reply to Cezary Rojewski

Driver cleanup process is similar for all platforms and sst_ops::free provides enough customization already. Unify them. Also remove redundant disable interrupt calls from new cleanup method. This is yet another checkpoint in quest for simplification or, perhaps a removal of skl_dsp_ops.

---
 sound/soc/intel/skylake/bxt-sst.c      | 11 -----------
 sound/soc/intel/skylake/cnl-sst-dsp.h  |  1 -
 sound/soc/intel/skylake/cnl-sst.c      | 11 -----------
 sound/soc/intel/skylake/skl-messages.c | 10 +---------
 sound/soc/intel/skylake/skl-sst-dsp.h  |  2 --
 sound/soc/intel/skylake/skl-sst.c      | 20 ++++++++++++--------
 sound/soc/intel/skylake/skl.h          |  2 +-
 7 files changed, 14 insertions(+), 43 deletions(-)
sound/soc/intel/skylake/bxt-sst.c +0 -11
index 68f400cfb390..4e5fb7684415 100644
@@ -592,16 +592,5 @@ int bxt_sst_dsp_init(struct device *dev, void __iomem *mmio_base, int irq,
 }
 EXPORT_SYMBOL_GPL(bxt_sst_dsp_init);
 
-void bxt_sst_dsp_cleanup(struct device *dev, struct skl_dev *skl)
-{
-
-	skl_release_library(skl->lib_info, skl->lib_count);
-	if (skl->dsp->fw)
-		release_firmware(skl->dsp->fw);
-	skl_freeup_uuid_list(skl);
-	skl->dsp->ops->free(skl->dsp);
-}
-EXPORT_SYMBOL_GPL(bxt_sst_dsp_cleanup);
-
 MODULE_LICENSE("GPL v2");
 MODULE_DESCRIPTION("Intel Broxton IPC driver");
sound/soc/intel/skylake/cnl-sst-dsp.h +0 -1
index b1417639bc1c..f3d320b05eb5 100644
@@ -96,6 +96,5 @@ bool cnl_ipc_int_status(struct sst_dsp *ctx);
 int cnl_sst_dsp_init(struct device *dev, void __iomem *mmio_base, int irq,
 		     const char *fw_name, struct skl_dsp_loader_ops dsp_ops,
 		     struct skl_dev **dsp);
-void cnl_sst_dsp_cleanup(struct device *dev, struct skl_dev *skl);
 
 #endif /*__CNL_SST_DSP_H__*/
sound/soc/intel/skylake/cnl-sst.c +0 -11
index 76b23ea7802e..5143200579aa 100644
@@ -464,16 +464,5 @@ int cnl_sst_dsp_init(struct device *dev, void __iomem *mmio_base, int irq,
 }
 EXPORT_SYMBOL_GPL(cnl_sst_dsp_init);
 
-void cnl_sst_dsp_cleanup(struct device *dev, struct skl_dev *skl)
-{
-	if (skl->dsp->fw)
-		release_firmware(skl->dsp->fw);
-
-	skl_freeup_uuid_list(skl);
-
-	skl->dsp->ops->free(skl->dsp);
-}
-EXPORT_SYMBOL_GPL(cnl_sst_dsp_cleanup);
-
 MODULE_LICENSE("GPL v2");
 MODULE_DESCRIPTION("Intel Cannonlake IPC driver");
sound/soc/intel/skylake/skl-messages.c +1 -9
index e4ac1ae777e0..8fd682872d0c 100644
@@ -172,49 +172,41 @@ static const struct skl_dsp_ops dsp_ops[] = {
 		.id = 0x9d70,
 		.loader_ops = skl_get_loader_ops,
 		.init = skl_sst_dsp_init,
-		.cleanup = skl_sst_dsp_cleanup
 	},
 	{
 		.id = 0x9d71,
 		.loader_ops = skl_get_loader_ops,
 		.init = skl_sst_dsp_init,
-		.cleanup = skl_sst_dsp_cleanup
 	},
 	{
 		.id = 0x5a98,
 		.loader_ops = bxt_get_loader_ops,
 		.init = bxt_sst_dsp_init,
-		.cleanup = bxt_sst_dsp_cleanup
 	},
 	{
 		.id = 0x3198,
 		.loader_ops = bxt_get_loader_ops,
 		.init = bxt_sst_dsp_init,
-		.cleanup = bxt_sst_dsp_cleanup
 	},
 	{
 		.id = 0x9dc8,
 		.loader_ops = bxt_get_loader_ops,
 		.init = cnl_sst_dsp_init,
-		.cleanup = cnl_sst_dsp_cleanup
 	},
 	{
 		.id = 0xa348,
 		.loader_ops = bxt_get_loader_ops,
 		.init = cnl_sst_dsp_init,
-		.cleanup = cnl_sst_dsp_cleanup
 	},
 	{
 		.id = 0x02c8,
 		.loader_ops = bxt_get_loader_ops,
 		.init = cnl_sst_dsp_init,
-		.cleanup = cnl_sst_dsp_cleanup
 	},
 	{
 		.id = 0x06c8,
 		.loader_ops = bxt_get_loader_ops,
 		.init = cnl_sst_dsp_init,
-		.cleanup = cnl_sst_dsp_cleanup
 	},
 };
 
@@ -282,7 +274,7 @@ int skl_free_dsp(struct skl_dev *skl)
 	/* disable  ppcap interrupt */
 	snd_hdac_ext_bus_ppcap_int_enable(bus, false);
 
-	skl->dsp_ops->cleanup(bus->dev, skl);
+	skl_sst_dsp_cleanup(skl);
 
 	kfree(skl->hw_cfg.i2s_caps.ctrl_base_addr);
 	kfree(skl->cores.state);
sound/soc/intel/skylake/skl-sst-dsp.h +0 -2
index 2129627e6255..21d376692503 100644
@@ -226,8 +226,6 @@ int skl_sst_dsp_init(struct device *dev, void __iomem *mmio_base, int irq,
 int bxt_sst_dsp_init(struct device *dev, void __iomem *mmio_base, int irq,
 		const char *fw_name, struct skl_dsp_loader_ops dsp_ops,
 		struct skl_dev **dsp);
-void skl_sst_dsp_cleanup(struct device *dev, struct skl_dev *skl);
-void bxt_sst_dsp_cleanup(struct device *dev, struct skl_dev *skl);
 int bxt_load_library(struct sst_dsp *ctx, struct skl_lib_info *linfo,
 		int lib_count);
 
sound/soc/intel/skylake/skl-sst.c +12 -8
index 72ab579ddd27..a7a285ea24e1 100644
@@ -613,17 +613,21 @@ int skl_sst_init_fw(struct skl_dev *skl)
 }
 EXPORT_SYMBOL_GPL(skl_sst_init_fw);
 
-void skl_sst_dsp_cleanup(struct device *dev, struct skl_dev *skl)
+void skl_sst_dsp_cleanup(struct skl_dev *skl)
 {
+	struct sst_dsp *dsp = skl->dsp;
+
+	skl_release_library(skl->lib_info, skl->lib_count);
+	if (dsp->fw)
+		release_firmware(dsp->fw);
+	skl_clear_module_table(dsp);
 
-	if (skl->dsp->fw)
-		release_firmware(skl->dsp->fw);
-	skl_clear_module_table(skl->dsp);
 	skl_freeup_uuid_list(skl);
-	skl->dsp->ops->free(skl->dsp);
-	if (skl->boot_complete) {
-		skl->dsp->cl_dev.ops.cl_cleanup_controller(skl->dsp);
-		skl_cldma_int_disable(skl->dsp);
+	dsp->ops->free(dsp);
+
+	if (skl->boot_complete && dsp->cl_dev.bufsize) {
+		dsp->cl_dev.ops.cl_cleanup_controller(dsp);
+		skl_cldma_int_disable(dsp);
 	}
 }
 EXPORT_SYMBOL_GPL(skl_sst_dsp_cleanup);
sound/soc/intel/skylake/skl.h +1 -1
index 71e69f52b7ab..62e2f2d450e4 100644
@@ -160,7 +160,6 @@ struct skl_dsp_ops {
 			int irq, const char *fw_name,
 			struct skl_dsp_loader_ops loader_ops,
 			struct skl_dev **skl_sst);
-	void (*cleanup)(struct device *dev, struct skl_dev *skl);
 };
 
 int skl_platform_unregister(struct device *dev);
@@ -174,6 +173,7 @@ int skl_nhlt_update_topology_bin(struct skl_dev *skl);
 int skl_init_dsp(struct skl_dev *skl);
 int skl_free_dsp(struct skl_dev *skl);
 int skl_sst_init_fw(struct skl_dev *skl);
+void skl_sst_dsp_cleanup(struct skl_dev *skl);
 int skl_suspend_late_dsp(struct skl_dev *skl);
 int skl_suspend_dsp(struct skl_dev *skl);
 int skl_resume_dsp(struct skl_dev *skl);
Signature · 1 line
2.17.1
author maintainer
#20 lore raw

PATCH 10/35 ASoC: Intel: Relocate irq thread header to sst_ops

In reply to Cezary Rojewski

thread_fn is the only DSP core op which is located outside of sst_ops. Add it to the rest. Change enables further cleanups by following patches, mainly removal of sst_dsp_device struct.

---
 sound/soc/intel/baytrail/sst-baytrail-dsp.c |  1 +
 sound/soc/intel/baytrail/sst-baytrail-ipc.c |  3 +--
 sound/soc/intel/baytrail/sst-baytrail-ipc.h |  2 ++
 sound/soc/intel/common/sst-dsp-priv.h       |  1 +
 sound/soc/intel/common/sst-dsp.h            |  1 -
 sound/soc/intel/common/sst-firmware.c       |  2 +-
 sound/soc/intel/haswell/sst-haswell-dsp.c   |  1 +
 sound/soc/intel/haswell/sst-haswell-ipc.c   |  3 +--
 sound/soc/intel/haswell/sst-haswell-ipc.h   |  2 ++
 sound/soc/intel/skylake/bxt-sst.c           |  2 +-
 sound/soc/intel/skylake/cnl-sst.c           | 28 ++++++++++-----------
 sound/soc/intel/skylake/skl-sst-dsp.c       |  3 +--
 sound/soc/intel/skylake/skl-sst.c           |  1 -
 13 files changed, 26 insertions(+), 24 deletions(-)
sound/soc/intel/baytrail/sst-baytrail-dsp.c +1 -0
index 4116ba66a4c2..4869e18116eb 100644
@@ -352,6 +352,7 @@ struct sst_ops sst_byt_ops = {
 	.ram_read = sst_memcpy_fromio_32,
 	.ram_write = sst_memcpy_toio_32,
 	.irq_handler = sst_byt_irq,
+	.thread_fn = sst_byt_irq_thread,
 	.init = sst_byt_init,
 	.free = sst_byt_free,
 	.parse_fw = sst_byt_parse_fw_image,
sound/soc/intel/baytrail/sst-baytrail-ipc.c +1 -2
index 74274bd38f7a..23d65ad38e19 100644
@@ -293,7 +293,7 @@ static int sst_byt_process_notification(struct sst_byt *byt,
 	return 1;
 }
 
-static irqreturn_t sst_byt_irq_thread(int irq, void *context)
+irqreturn_t sst_byt_irq_thread(int irq, void *context)
 {
 	struct sst_dsp *sst = (struct sst_dsp *) context;
 	struct sst_byt *byt = sst_dsp_get_thread_context(sst);
@@ -557,7 +557,6 @@ struct sst_dsp *sst_byt_get_dsp(struct sst_byt *byt)
 }
 
 static struct sst_dsp_device byt_dev = {
-	.thread = sst_byt_irq_thread,
 	.ops = &sst_byt_ops,
 };
 
sound/soc/intel/baytrail/sst-baytrail-ipc.h +2 -0
index 755098509327..9aba6b83ee5f 100644
@@ -7,6 +7,7 @@
 #ifndef __SST_BYT_IPC_H
 #define __SST_BYT_IPC_H
 
+#include <linux/irqreturn.h>
 #include <linux/types.h>
 
 struct sst_byt;
@@ -61,5 +62,6 @@ struct sst_dsp *sst_byt_get_dsp(struct sst_byt *byt);
 int sst_byt_dsp_suspend_late(struct device *dev, struct sst_pdata *pdata);
 int sst_byt_dsp_boot(struct device *dev, struct sst_pdata *pdata);
 int sst_byt_dsp_wait_for_ready(struct device *dev, struct sst_pdata *pdata);
+irqreturn_t sst_byt_irq_thread(int irq, void *context);
 
 #endif
sound/soc/intel/common/sst-dsp-priv.h +1 -0
index 3d8765ce3e0d..7ec477108948 100644
@@ -49,6 +49,7 @@ struct sst_ops {
 
 	/* IRQ handlers */
 	irqreturn_t (*irq_handler)(int irq, void *context);
+	irqreturn_t (*thread_fn)(int irq, void *context);
 
 	/* SST init and free */
 	int (*init)(struct sst_dsp *sst, struct sst_pdata *pdata);
sound/soc/intel/common/sst-dsp.h +0 -1
index 604a80c5859b..05fa1ca72f46 100644
@@ -175,7 +175,6 @@ struct sst_dsp;
 struct sst_dsp_device {
 	/* Mandatory fields */
 	struct sst_ops *ops;
-	irqreturn_t (*thread)(int irq, void *context);
 	void *thread_context;
 };
 
sound/soc/intel/common/sst-firmware.c +1 -1
index d27947aeb079..c18236ca77f4 100644
@@ -1237,7 +1237,7 @@ struct sst_dsp *sst_dsp_new(struct device *dev,
 
 	/* Register the ISR */
 	err = request_threaded_irq(sst->irq, sst->ops->irq_handler,
-		sst_dev->thread, IRQF_SHARED, "AudioDSP", sst);
+		sst->ops->thread_fn, IRQF_SHARED, "AudioDSP", sst);
 	if (err)
 		goto irq_err;
 
sound/soc/intel/haswell/sst-haswell-dsp.c +1 -0
index 88c3f63bded9..c099dec7d61f 100644
@@ -699,6 +699,7 @@ struct sst_ops haswell_ops = {
 	.ram_read = sst_memcpy_fromio_32,
 	.ram_write = sst_memcpy_toio_32,
 	.irq_handler = hsw_irq,
+	.thread_fn = hsw_irq_thread,
 	.init = hsw_init,
 	.free = hsw_free,
 	.parse_fw = hsw_parse_fw_image,
sound/soc/intel/haswell/sst-haswell-ipc.c +1 -2
index 5c73b11375e3..e25358d19aae 100644
@@ -757,7 +757,7 @@ static int hsw_process_notification(struct sst_hsw *hsw)
 	return handled;
 }
 
-static irqreturn_t hsw_irq_thread(int irq, void *context)
+irqreturn_t hsw_irq_thread(int irq, void *context)
 {
 	struct sst_dsp *sst = (struct sst_dsp *) context;
 	struct sst_hsw *hsw = sst_dsp_get_thread_context(sst);
@@ -2046,7 +2046,6 @@ int sst_hsw_module_set_param(struct sst_hsw *hsw,
 }
 
 static struct sst_dsp_device hsw_dev = {
-	.thread = hsw_irq_thread,
 	.ops = &haswell_ops,
 };
 
sound/soc/intel/haswell/sst-haswell-ipc.h +2 -0
index fdc70c77e688..d4a936a75f7d 100644
@@ -8,6 +8,7 @@
 #ifndef __SST_HASWELL_IPC_H
 #define __SST_HASWELL_IPC_H
 
+#include <linux/irqreturn.h>
 #include <linux/types.h>
 #include <linux/kernel.h>
 #include <linux/platform_device.h>
@@ -396,6 +397,7 @@ struct sst_hsw_ipc_fw_version;
 struct sst_hsw *sst_hsw_new(struct device *dev, const u8 *fw, size_t fw_length,
 	u32 fw_offset);
 void sst_hsw_free(struct sst_hsw *hsw);
+irqreturn_t hsw_irq_thread(int irq, void *context);
 int sst_hsw_fw_get_version(struct sst_hsw *hsw,
 	struct sst_hsw_ipc_fw_version *version);
 u32 create_channel_map(enum sst_hsw_channel_config config);
sound/soc/intel/skylake/bxt-sst.c +1 -1
index 4e5fb7684415..8faffec4e943 100644
@@ -535,6 +535,7 @@ static const struct skl_dsp_fw_ops bxt_fw_ops = {
 
 static struct sst_ops skl_ops = {
 	.irq_handler = skl_dsp_sst_interrupt,
+	.thread_fn = skl_dsp_irq_thread_handler,
 	.write = sst_shim32_write,
 	.read = sst_shim32_read,
 	.ram_read = sst_memcpy_fromio_32,
@@ -543,7 +544,6 @@ static struct sst_ops skl_ops = {
 };
 
 static struct sst_dsp_device skl_dev = {
-	.thread = skl_dsp_irq_thread_handler,
 	.ops = &skl_ops,
 };
 
sound/soc/intel/skylake/cnl-sst.c +14 -14
index 5143200579aa..02d8e72d2d5a 100644
@@ -286,15 +286,6 @@ static const struct skl_dsp_fw_ops cnl_fw_ops = {
 	.load_library = bxt_load_library,
 };
 
-static struct sst_ops cnl_ops = {
-	.irq_handler = cnl_dsp_sst_interrupt,
-	.write = sst_shim32_write,
-	.read = sst_shim32_read,
-	.ram_read = sst_memcpy_fromio_32,
-	.ram_write = sst_memcpy_toio_32,
-	.free = cnl_dsp_free,
-};
-
 #define CNL_IPC_GLB_NOTIFY_RSP_SHIFT	29
 #define CNL_IPC_GLB_NOTIFY_RSP_MASK	0x1
 #define CNL_IPC_GLB_NOTIFY_RSP_TYPE(x)	(((x) >> CNL_IPC_GLB_NOTIFY_RSP_SHIFT) \
@@ -370,11 +361,6 @@ static irqreturn_t cnl_dsp_irq_thread_handler(int irq, void *context)
 	return IRQ_HANDLED;
 }
 
-static struct sst_dsp_device cnl_dev = {
-	.thread = cnl_dsp_irq_thread_handler,
-	.ops = &cnl_ops,
-};
-
 static void cnl_ipc_tx_msg(struct sst_generic_ipc *ipc, struct ipc_message *msg)
 {
 	struct skl_ipc_header *header = (struct skl_ipc_header *)(&msg->tx.header);
@@ -423,6 +409,20 @@ static int cnl_ipc_init(struct device *dev, struct skl_dev *cnl)
 	return 0;
 }
 
+static struct sst_ops cnl_ops = {
+	.irq_handler = cnl_dsp_sst_interrupt,
+	.thread_fn = cnl_dsp_irq_thread_handler,
+	.write = sst_shim32_write,
+	.read = sst_shim32_read,
+	.ram_read = sst_memcpy_fromio_32,
+	.ram_write = sst_memcpy_toio_32,
+	.free = cnl_dsp_free,
+};
+
+static struct sst_dsp_device cnl_dev = {
+	.ops = &cnl_ops,
+};
+
 int cnl_sst_dsp_init(struct device *dev, void __iomem *mmio_base, int irq,
 		     const char *fw_name, struct skl_dsp_loader_ops dsp_ops,
 		     struct skl_dev **dsp)
sound/soc/intel/skylake/skl-sst-dsp.c +1 -2
index e0807db225f4..8d98089e3177 100644
@@ -448,12 +448,11 @@ struct sst_dsp *skl_dsp_ctx_init(struct device *dev,
 
 int skl_dsp_acquire_irq(struct sst_dsp *sst)
 {
-	struct sst_dsp_device *sst_dev = sst->sst_dev;
 	int ret;
 
 	/* Register the ISR */
 	ret = request_threaded_irq(sst->irq, sst->ops->irq_handler,
-		sst_dev->thread, IRQF_SHARED, "AudioDSP", sst);
+		sst->ops->thread_fn, IRQF_SHARED, "AudioDSP", sst);
 	if (ret)
 		dev_err(sst->dev, "unable to grab threaded IRQ %d, disabling device\n",
 			       sst->irq);
sound/soc/intel/skylake/skl-sst.c +0 -1
index a7a285ea24e1..9fd3cf30e87c 100644
@@ -513,7 +513,6 @@ static struct sst_ops skl_ops = {
 };
 
 static struct sst_dsp_device skl_dev = {
-	.thread = skl_dsp_irq_thread_handler,
 	.ops = &skl_ops,
 };
 
Signature · 1 line
2.17.1
author maintainer
#21 lore raw

PATCH 11/35 ASoC: Intel: Merge sst_dsp_device into sst_pdata

In reply to Cezary Rojewski

With all core ops united, sst_dsp_device is a stub struct. Merge it with sst_pdata and thus making it dsp-platform info struct. As sst_pdata is targeted to become a sole initialization struct for DSP drivers, update its definition to contain fw_name and machine board list too.

---
 sound/soc/intel/baytrail/sst-baytrail-ipc.c | 10 +++-------
 sound/soc/intel/common/sst-dsp-priv.h       |  1 -
 sound/soc/intel/common/sst-dsp.h            | 17 ++++-------------
 sound/soc/intel/common/sst-firmware.c       |  8 +++-----
 sound/soc/intel/haswell/sst-haswell-ipc.c   | 10 +++-------
 sound/soc/intel/skylake/bxt-sst.c           |  2 +-
 sound/soc/intel/skylake/cnl-sst-dsp.h       |  2 +-
 sound/soc/intel/skylake/cnl-sst.c           |  2 +-
 sound/soc/intel/skylake/skl-sst-dsp.c       |  8 ++++----
 sound/soc/intel/skylake/skl-sst-dsp.h       |  6 +++---
 sound/soc/intel/skylake/skl-sst-utils.c     |  6 +++---
 sound/soc/intel/skylake/skl-sst.c           |  2 +-
 12 files changed, 27 insertions(+), 47 deletions(-)
sound/soc/intel/baytrail/sst-baytrail-ipc.c +3 -7
index 23d65ad38e19..efa78e33caf2 100644
@@ -556,10 +556,6 @@ struct sst_dsp *sst_byt_get_dsp(struct sst_byt *byt)
 	return byt->dsp;
 }
 
-static struct sst_dsp_device byt_dev = {
-	.ops = &sst_byt_ops,
-};
-
 int sst_byt_dsp_suspend_late(struct device *dev, struct sst_pdata *pdata)
 {
 	struct sst_byt *byt = pdata->dsp;
@@ -701,10 +697,11 @@ int sst_byt_dsp_init(struct device *dev, struct sst_pdata *pdata)
 
 	INIT_LIST_HEAD(&byt->stream_list);
 	init_waitqueue_head(&byt->boot_wait);
-	byt_dev.thread_context = byt;
+	pdata->dsp = byt;
+	pdata->ops = &sst_byt_ops;
 
 	/* init SST shim */
-	byt->dsp = sst_dsp_new(dev, &byt_dev, pdata);
+	byt->dsp = sst_dsp_new(dev, pdata);
 	if (byt->dsp == NULL) {
 		err = -ENODEV;
 		goto dsp_new_err;
@@ -741,7 +738,6 @@ int sst_byt_dsp_init(struct device *dev, struct sst_pdata *pdata)
 	dev_info(byt->dev, "Build date: %s %s\n",
 		 init.build_info.date, init.build_info.time);
 
-	pdata->dsp = byt;
 	byt->fw = byt_sst_fw;
 
 	return 0;
sound/soc/intel/common/sst-dsp-priv.h +0 -1
index 7ec477108948..8a7009937d59 100644
@@ -259,7 +259,6 @@ struct sst_dsp {
 	/* Shared for all platforms */
 
 	/* runtime */
-	struct sst_dsp_device *sst_dev;
 	spinlock_t spinlock;	/* IPC locking */
 	struct mutex mutex;	/* DSP FW lock */
 	struct device *dev;
sound/soc/intel/common/sst-dsp.h +4 -13
index 05fa1ca72f46..63c29bb45cf1 100644
@@ -167,17 +167,6 @@
 
 struct sst_dsp;
 
-/*
- * SST Device.
- *
- * This structure is populated by the SST core driver.
- */
-struct sst_dsp_device {
-	/* Mandatory fields */
-	struct sst_ops *ops;
-	void *thread_context;
-};
-
 /*
  * SST Platform Data.
  */
@@ -203,13 +192,15 @@ struct sst_pdata {
 
 	/* DSP */
 	u32 id;
+	const char *fw_name;
+	struct sst_ops *ops;
+	struct snd_soc_acpi_mach *boards;
 	void *dsp;
 };
 
 #if IS_ENABLED(CONFIG_DW_DMAC_CORE)
 /* Initialization */
-struct sst_dsp *sst_dsp_new(struct device *dev,
-	struct sst_dsp_device *sst_dev, struct sst_pdata *pdata);
+struct sst_dsp *sst_dsp_new(struct device *dev, struct sst_pdata *pdata);
 void sst_dsp_free(struct sst_dsp *sst);
 #endif
 
sound/soc/intel/common/sst-firmware.c +3 -5
index c18236ca77f4..6b6af11c32c3 100644
@@ -1200,8 +1200,7 @@ u32 sst_dsp_get_offset(struct sst_dsp *dsp, u32 offset,
 }
 EXPORT_SYMBOL_GPL(sst_dsp_get_offset);
 
-struct sst_dsp *sst_dsp_new(struct device *dev,
-	struct sst_dsp_device *sst_dev, struct sst_pdata *pdata)
+struct sst_dsp *sst_dsp_new(struct device *dev, struct sst_pdata *pdata)
 {
 	struct sst_dsp *sst;
 	int err;
@@ -1216,11 +1215,10 @@ struct sst_dsp *sst_dsp_new(struct device *dev,
 	mutex_init(&sst->mutex);
 	sst->dev = dev;
 	sst->dma_dev = pdata->dma_dev;
-	sst->thread_context = sst_dev->thread_context;
-	sst->sst_dev = sst_dev;
+	sst->thread_context = pdata->dsp;
 	sst->id = pdata->id;
 	sst->irq = pdata->irq;
-	sst->ops = sst_dev->ops;
+	sst->ops = pdata->ops;
 	sst->pdata = pdata;
 	INIT_LIST_HEAD(&sst->used_block_list);
 	INIT_LIST_HEAD(&sst->free_block_list);
sound/soc/intel/haswell/sst-haswell-ipc.c +3 -7
index e25358d19aae..61c4d674940e 100644
@@ -2045,10 +2045,6 @@ int sst_hsw_module_set_param(struct sst_hsw *hsw,
 	return ret;
 }
 
-static struct sst_dsp_device hsw_dev = {
-	.ops = &haswell_ops,
-};
-
 static void hsw_tx_msg(struct sst_generic_ipc *ipc, struct ipc_message *msg)
 {
 	/* send the message */
@@ -2126,10 +2122,11 @@ int sst_hsw_dsp_init(struct device *dev, struct sst_pdata *pdata)
 
 	INIT_LIST_HEAD(&hsw->stream_list);
 	init_waitqueue_head(&hsw->boot_wait);
-	hsw_dev.thread_context = hsw;
+	pdata->dsp = hsw;
+	pdata->ops = &haswell_ops;
 
 	/* init SST shim */
-	hsw->dsp = sst_dsp_new(dev, &hsw_dev, pdata);
+	hsw->dsp = sst_dsp_new(dev, pdata);
 	if (hsw->dsp == NULL) {
 		ret = -ENODEV;
 		goto dsp_new_err;
@@ -2189,7 +2186,6 @@ int sst_hsw_dsp_init(struct device *dev, struct sst_pdata *pdata)
 		goto boot_err;
 	}
 
-	pdata->dsp = hsw;
 	return 0;
 
 boot_err:
sound/soc/intel/skylake/bxt-sst.c +1 -1
index 8faffec4e943..e3614acff34d 100644
@@ -543,7 +543,7 @@ static struct sst_ops skl_ops = {
 	.free = skl_dsp_free,
 };
 
-static struct sst_dsp_device skl_dev = {
+static struct sst_pdata skl_dev = {
 	.ops = &skl_ops,
 };
 
sound/soc/intel/skylake/cnl-sst-dsp.h +1 -1
index f3d320b05eb5..30b586acc858 100644
@@ -9,7 +9,7 @@
 #define __CNL_SST_DSP_H__
 
 struct sst_dsp;
-struct sst_dsp_device;
+struct sst_pdata;
 struct sst_generic_ipc;
 
 /* Intel HD Audio General DSP Registers */
sound/soc/intel/skylake/cnl-sst.c +1 -1
index 02d8e72d2d5a..84dc6b82831d 100644
@@ -419,7 +419,7 @@ static struct sst_ops cnl_ops = {
 	.free = cnl_dsp_free,
 };
 
-static struct sst_dsp_device cnl_dev = {
+static struct sst_pdata cnl_dev = {
 	.ops = &cnl_ops,
 };
 
sound/soc/intel/skylake/skl-sst-dsp.c +4 -4
index 8d98089e3177..348e69226e46 100644
@@ -419,7 +419,7 @@ int skl_dsp_sleep(struct sst_dsp *ctx)
 EXPORT_SYMBOL_GPL(skl_dsp_sleep);
 
 struct sst_dsp *skl_dsp_ctx_init(struct device *dev,
-		struct sst_dsp_device *sst_dev, int irq)
+		struct sst_pdata *pdata, int irq)
 {
 	int ret;
 	struct sst_dsp *sst;
@@ -431,10 +431,10 @@ struct sst_dsp *skl_dsp_ctx_init(struct device *dev,
 	spin_lock_init(&sst->spinlock);
 	mutex_init(&sst->mutex);
 	sst->dev = dev;
-	sst->sst_dev = sst_dev;
+	sst->pdata = pdata;
 	sst->irq = irq;
-	sst->ops = sst_dev->ops;
-	sst->thread_context = sst_dev->thread_context;
+	sst->ops = pdata->ops;
+	sst->thread_context = pdata->dsp;
 
 	/* Initialise SST Audio DSP */
 	if (sst->ops->init) {
sound/soc/intel/skylake/skl-sst-dsp.h +3 -3
index 21d376692503..ba37433e4efa 100644
@@ -15,7 +15,7 @@
 #include "skl-sst-cldma.h"
 
 struct sst_dsp;
-struct sst_dsp_device;
+struct sst_pdata;
 struct skl_lib_info;
 struct skl_dev;
 
@@ -197,7 +197,7 @@ int skl_cldma_wait_interruptible(struct sst_dsp *ctx);
 
 void skl_dsp_set_state_locked(struct sst_dsp *ctx, int state);
 struct sst_dsp *skl_dsp_ctx_init(struct device *dev,
-		struct sst_dsp_device *sst_dev, int irq);
+		struct sst_pdata *pdata, int irq);
 int skl_dsp_acquire_irq(struct sst_dsp *sst);
 bool is_skl_dsp_running(struct sst_dsp *ctx);
 
@@ -243,7 +243,7 @@ void skl_dsp_set_astate_cfg(struct skl_dev *skl, u32 cnt, void *data);
 
 int skl_sst_ctx_init(struct device *dev, int irq, const char *fw_name,
 		struct skl_dsp_loader_ops dsp_ops, struct skl_dev **dsp,
-		struct sst_dsp_device *skl_dev);
+		struct sst_pdata *pdata);
 int skl_prepare_lib_load(struct skl_dev *skl, struct skl_lib_info *linfo,
 			struct firmware *stripped_fw,
 			unsigned int hdr_offset, int index);
sound/soc/intel/skylake/skl-sst-utils.c +3 -3
index d43cbf4a71ef..9061a9b17ea0 100644
@@ -355,15 +355,15 @@ int skl_dsp_strip_extended_manifest(struct firmware *fw)
 
 int skl_sst_ctx_init(struct device *dev, int irq, const char *fw_name,
 	struct skl_dsp_loader_ops dsp_ops, struct skl_dev **dsp,
-	struct sst_dsp_device *skl_dev)
+	struct sst_pdata *pdata)
 {
 	struct skl_dev *skl = *dsp;
 	struct sst_dsp *sst;
 
 	skl->dev = dev;
-	skl_dev->thread_context = skl;
+	pdata->dsp = skl;
 	INIT_LIST_HEAD(&skl->uuid_list);
-	skl->dsp = skl_dsp_ctx_init(dev, skl_dev, irq);
+	skl->dsp = skl_dsp_ctx_init(dev, pdata, irq);
 	if (!skl->dsp) {
 		dev_err(skl->dev, "%s: no device\n", __func__);
 		return -ENODEV;
sound/soc/intel/skylake/skl-sst.c +1 -1
index 9fd3cf30e87c..72ee3d8a1d7d 100644
@@ -512,7 +512,7 @@ static struct sst_ops skl_ops = {
 	.free = skl_dsp_free,
 };
 
-static struct sst_dsp_device skl_dev = {
+static struct sst_pdata skl_dev = {
 	.ops = &skl_ops,
 };
 
Signature · 1 line
2.17.1
#22 lore raw

Re: [PATCH 11/35] ASoC: Intel: Merge sst_dsp_device into sst_pdata

sound/soc/intel/common/sst-dsp.h struct sst_pdata { · line 199

Quoted 10 lines
sound/soc/intel/common/sst-dsp.h +3 -0
@@ -203,13 +192,15 @@ struct sst_pdata {
 
  	/* DSP */
  	u32 id;
+	const char *fw_name;
+	struct sst_ops *ops;
+	struct snd_soc_acpi_mach *boards;
  	void *dsp;
  };

You already have the fw_name inside of struct snd_soc_acpi_mach:

/* Descriptor for SST ASoC machine driver */

struct snd_soc_acpi_mach {
	const u8 id[ACPI_ID_LEN];
	const char *drv_name;
	const char *fw_filename;
	const char *board;
	struct snd_soc_acpi_mach * (*machine_quirk)(void *arg);
	const void *quirk_data;
	void *pdata;
	struct snd_soc_acpi_mach_params mach_params;
	const char *sof_fw_filename;
	const char *sof_tplg_filename;
};
author maintainer
#23 lore raw

Re: [PATCH 11/35] ASoC: Intel: Merge sst_dsp_device into sst_pdata

Quoted 11 lines · Pierre-Louis Bossart

sound/soc/intel/common/sst-dsp.h struct sst_pdata { · line 198

Quoted 9 lines
sound/soc/intel/common/sst-dsp.h +3 -0
@@ -203,13 +192,15 @@ struct sst_pdata {
       /* DSP */
       u32 id;
+    const char *fw_name;
+    struct sst_ops *ops;
+    struct snd_soc_acpi_mach *boards;
       void *dsp;
   };

You already have the fw_name inside of struct snd_soc_acpi_mach:

I'll come back to that later.
See PATCH 27/35 and ULL example.

Quoted 14 lines

/* Descriptor for SST ASoC machine driver */ struct snd_soc_acpi_mach {
    const u8 id[ACPI_ID_LEN];
    const char *drv_name;
    const char *fw_filename;
    const char *board;
    struct snd_soc_acpi_mach * (*machine_quirk)(void *arg); const void *quirk_data;
    void *pdata;
    struct snd_soc_acpi_mach_params mach_params; const char *sof_fw_filename;
    const char *sof_tplg_filename;
};

_______________________________________________
Alsa-devel mailing list
[email protected]
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

author maintainer
#24 lore raw

PATCH 12/35 ASoC: Intel: Skylake: Reuse sst_dsp_free

In reply to Cezary Rojewski

Skylake is sst_dsp descendant. Rather than bypassing framework's flow, embrace it. sst_dsp_free invokes sst specific handler internally so nothing is missed.

---
 sound/soc/intel/skylake/cnl-sst-dsp.c | 1 -
 sound/soc/intel/skylake/skl-sst-dsp.c | 1 -
 sound/soc/intel/skylake/skl-sst.c     | 2 +-
 3 files changed, 1 insertion(+), 3 deletions(-)
sound/soc/intel/skylake/cnl-sst-dsp.c +0 -1
index 189c1c7086e3..48b465939ef8 100644
@@ -215,7 +215,6 @@ void cnl_dsp_free(struct sst_dsp *dsp)
 	sst_ipc_fini(&skl->ipc);
 	cnl_ipc_int_disable(dsp);
 
-	free_irq(dsp->irq, dsp);
 	cnl_dsp_disable_core(dsp, SKL_DSP_CORE0_MASK);
 }
 EXPORT_SYMBOL_GPL(cnl_dsp_free);
sound/soc/intel/skylake/skl-sst-dsp.c +0 -1
index 348e69226e46..1c4ecbcd7db7 100644
@@ -468,7 +468,6 @@ void skl_dsp_free(struct sst_dsp *dsp)
 	sst_ipc_fini(&skl->ipc);
 	skl_ipc_int_disable(dsp);
 
-	free_irq(dsp->irq, dsp);
 	skl_dsp_disable_core(dsp, SKL_DSP_CORE0_MASK);
 }
 EXPORT_SYMBOL_GPL(skl_dsp_free);
sound/soc/intel/skylake/skl-sst.c +1 -1
index 72ee3d8a1d7d..e55523826346 100644
@@ -622,7 +622,7 @@ void skl_sst_dsp_cleanup(struct skl_dev *skl)
 	skl_clear_module_table(dsp);
 
 	skl_freeup_uuid_list(skl);
-	dsp->ops->free(dsp);
+	sst_dsp_free(dsp);
 
 	if (skl->boot_complete && dsp->cl_dev.bufsize) {
 		dsp->cl_dev.ops.cl_cleanup_controller(dsp);
Signature · 1 line
2.17.1
#25 lore raw

Re: [PATCH 12/35] ASoC: Intel: Skylake: Reuse sst_dsp_free

Quoted 3 lines · Cezary Rojewski

Skylake is sst_dsp descendant. Rather than bypassing framework's flow, embrace it. sst_dsp_free invokes sst specific handler internally so nothing is missed.

for clarity you should also add the free_irq is also handled internally in sst_dsp_free(), otherwise this looks like a mistake to the reviewer that's not even half-way through the series...

Quoted 46 lines
---
  sound/soc/intel/skylake/cnl-sst-dsp.c | 1 -
  sound/soc/intel/skylake/skl-sst-dsp.c | 1 -
  sound/soc/intel/skylake/skl-sst.c     | 2 +-
  3 files changed, 1 insertion(+), 3 deletions(-)
sound/soc/intel/skylake/cnl-sst-dsp.c +0 -1
index 189c1c7086e3..48b465939ef8 100644
@@ -215,7 +215,6 @@ void cnl_dsp_free(struct sst_dsp *dsp)
  	sst_ipc_fini(&skl->ipc);
  	cnl_ipc_int_disable(dsp);
 
-	free_irq(dsp->irq, dsp);
  	cnl_dsp_disable_core(dsp, SKL_DSP_CORE0_MASK);
  }
  EXPORT_SYMBOL_GPL(cnl_dsp_free);
sound/soc/intel/skylake/skl-sst-dsp.c +0 -1
index 348e69226e46..1c4ecbcd7db7 100644
@@ -468,7 +468,6 @@ void skl_dsp_free(struct sst_dsp *dsp)
  	sst_ipc_fini(&skl->ipc);
  	skl_ipc_int_disable(dsp);
 
-	free_irq(dsp->irq, dsp);
  	skl_dsp_disable_core(dsp, SKL_DSP_CORE0_MASK);
  }
  EXPORT_SYMBOL_GPL(skl_dsp_free);
sound/soc/intel/skylake/skl-sst.c +1 -1
index 72ee3d8a1d7d..e55523826346 100644
@@ -622,7 +622,7 @@ void skl_sst_dsp_cleanup(struct skl_dev *skl)
  	skl_clear_module_table(dsp);
 
  	skl_freeup_uuid_list(skl);
-	dsp->ops->free(dsp);
+	sst_dsp_free(dsp);
 
  	if (skl->boot_complete && dsp->cl_dev.bufsize) {
  		dsp->cl_dev.ops.cl_cleanup_controller(dsp);
author maintainer
#26 lore raw

Re: [PATCH 12/35] ASoC: Intel: Skylake: Reuse sst_dsp_free

Quoted 9 lines · Pierre-Louis Bossart
Quoted 3 lines · Cezary Rojewski

Skylake is sst_dsp descendant. Rather than bypassing framework's flow, embrace it. sst_dsp_free invokes sst specific handler internally so nothing is missed.

for clarity you should also add the free_irq is also handled internally in sst_dsp_free(), otherwise this looks like a mistake to the reviewer that's not even half-way through the series...

Noted, thanks. Indeed this is done to reuse sst_dsp_free while preventing double free_irq from occurring.

Quoted 34 lines
Quoted 34 lines

---
  sound/soc/intel/skylake/cnl-sst-dsp.c | 1 -
  sound/soc/intel/skylake/skl-sst-dsp.c | 1 -
  sound/soc/intel/skylake/skl-sst.c     | 2 +-

  3 files changed, 1 insertion(+), 3 deletions(-)
sound/soc/intel/skylake/cnl-sst-dsp.c +0 -1
index 189c1c7086e3..48b465939ef8 100644
@@ -215,7 +215,6 @@ void cnl_dsp_free(struct sst_dsp *dsp)
       sst_ipc_fini(&skl->ipc);
       cnl_ipc_int_disable(dsp);
-    free_irq(dsp->irq, dsp);
       cnl_dsp_disable_core(dsp, SKL_DSP_CORE0_MASK);
   }
   EXPORT_SYMBOL_GPL(cnl_dsp_free);
sound/soc/intel/skylake/skl-sst-dsp.c +0 -1
index 348e69226e46..1c4ecbcd7db7 100644
@@ -468,7 +468,6 @@ void skl_dsp_free(struct sst_dsp *dsp)
       sst_ipc_fini(&skl->ipc);
       skl_ipc_int_disable(dsp);
-    free_irq(dsp->irq, dsp);
       skl_dsp_disable_core(dsp, SKL_DSP_CORE0_MASK);
   }
   EXPORT_SYMBOL_GPL(skl_dsp_free);
sound/soc/intel/skylake/skl-sst.c +0 -0
index 72ee3d8a1d7d..e55523826346 100644
Quoted 8 lines

sound/soc/intel/skylake/skl-sst.c void skl_sst_dsp_cleanup(struct skl_dev *skl) · line 627

Quoted 8 lines
sound/soc/intel/skylake/skl-sst.c +1 -1
@@ -622,7 +622,7 @@ void skl_sst_dsp_cleanup(struct skl_dev *skl)
       skl_clear_module_table(dsp);
       skl_freeup_uuid_list(skl);
-    dsp->ops->free(dsp);
+    sst_dsp_free(dsp);
       if (skl->boot_complete && dsp->cl_dev.bufsize) {
           dsp->cl_dev.ops.cl_cleanup_controller(dsp);
 

_______________________________________________
Alsa-devel mailing list
[email protected]
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

author maintainer
#27 lore raw

PATCH 13/35 ASoC: Intel: Skylake: Reuse sst_dsp_new

In reply to Cezary Rojewski

skl_dsp_ctx_init is dumplication of sst_dsp_new and usage of such bypasses natural DSP framework's flow. Remove it and reuse sst_dsp_new constructor which invokes sst specific init internally so nothing is missed.

Skylake does not even define any sst_ops::init so portion of existing skl_dsp_ctx_init can be regarded as DEADCODE.

---
 sound/soc/intel/skylake/bxt-sst.c       |  2 +-
 sound/soc/intel/skylake/cnl-sst.c       |  2 +-
 sound/soc/intel/skylake/skl-sst-dsp.c   | 28 -------------------------
 sound/soc/intel/skylake/skl-sst-dsp.h   |  2 --
 sound/soc/intel/skylake/skl-sst-utils.c |  6 +++++-
 sound/soc/intel/skylake/skl-sst.c       |  2 +-
 6 files changed, 8 insertions(+), 34 deletions(-)
sound/soc/intel/skylake/bxt-sst.c +1 -1
index e3614acff34d..a8a2783f9b37 100644
@@ -588,7 +588,7 @@ int bxt_sst_dsp_init(struct device *dev, void __iomem *mmio_base, int irq,
 	INIT_DELAYED_WORK(&skl->d0i3.work, bxt_set_dsp_D0i3);
 	skl->d0i3.state = SKL_DSP_D0I3_NONE;
 
-	return skl_dsp_acquire_irq(sst);
+	return 0;
 }
 EXPORT_SYMBOL_GPL(bxt_sst_dsp_init);
 
sound/soc/intel/skylake/cnl-sst.c +1 -1
index 84dc6b82831d..0b0337f6ebff 100644
@@ -460,7 +460,7 @@ int cnl_sst_dsp_init(struct device *dev, void __iomem *mmio_base, int irq,
 	cnl->boot_complete = false;
 	init_waitqueue_head(&cnl->boot_wait);
 
-	return skl_dsp_acquire_irq(sst);
+	return 0;
 }
 EXPORT_SYMBOL_GPL(cnl_sst_dsp_init);
 
sound/soc/intel/skylake/skl-sst-dsp.c +0 -28
index 1c4ecbcd7db7..9d8eb1af4798 100644
@@ -418,34 +418,6 @@ int skl_dsp_sleep(struct sst_dsp *ctx)
 }
 EXPORT_SYMBOL_GPL(skl_dsp_sleep);
 
-struct sst_dsp *skl_dsp_ctx_init(struct device *dev,
-		struct sst_pdata *pdata, int irq)
-{
-	int ret;
-	struct sst_dsp *sst;
-
-	sst = devm_kzalloc(dev, sizeof(*sst), GFP_KERNEL);
-	if (sst == NULL)
-		return NULL;
-
-	spin_lock_init(&sst->spinlock);
-	mutex_init(&sst->mutex);
-	sst->dev = dev;
-	sst->pdata = pdata;
-	sst->irq = irq;
-	sst->ops = pdata->ops;
-	sst->thread_context = pdata->dsp;
-
-	/* Initialise SST Audio DSP */
-	if (sst->ops->init) {
-		ret = sst->ops->init(sst, NULL);
-		if (ret < 0)
-			return NULL;
-	}
-
-	return sst;
-}
-
 int skl_dsp_acquire_irq(struct sst_dsp *sst)
 {
 	int ret;
sound/soc/intel/skylake/skl-sst-dsp.h +0 -2
index ba37433e4efa..1d579d59de60 100644
@@ -196,8 +196,6 @@ int skl_cldma_prepare(struct sst_dsp *ctx);
 int skl_cldma_wait_interruptible(struct sst_dsp *ctx);
 
 void skl_dsp_set_state_locked(struct sst_dsp *ctx, int state);
-struct sst_dsp *skl_dsp_ctx_init(struct device *dev,
-		struct sst_pdata *pdata, int irq);
 int skl_dsp_acquire_irq(struct sst_dsp *sst);
 bool is_skl_dsp_running(struct sst_dsp *ctx);
 
sound/soc/intel/skylake/skl-sst-utils.c +5 -1
index 9061a9b17ea0..8e03a10855c4 100644
@@ -6,6 +6,7 @@
  */
 
 #include <linux/device.h>
+#include <linux/pci.h>
 #include <linux/slab.h>
 #include <linux/uuid.h>
 #include "../common/sst-dsp.h"
@@ -360,10 +361,13 @@ int skl_sst_ctx_init(struct device *dev, int irq, const char *fw_name,
 	struct skl_dev *skl = *dsp;
 	struct sst_dsp *sst;
 
+	pdata->id = skl->pci->device;
+	pdata->irq = irq;
+	pdata->resindex_dma_base = -1;
 	skl->dev = dev;
 	pdata->dsp = skl;
 	INIT_LIST_HEAD(&skl->uuid_list);
-	skl->dsp = skl_dsp_ctx_init(dev, pdata, irq);
+	skl->dsp = sst_dsp_new(dev, pdata);
 	if (!skl->dsp) {
 		dev_err(skl->dev, "%s: no device\n", __func__);
 		return -ENODEV;
sound/soc/intel/skylake/skl-sst.c +1 -1
index e55523826346..6bb003add9e2 100644
@@ -550,7 +550,7 @@ int skl_sst_dsp_init(struct device *dev, void __iomem *mmio_base, int irq,
 
 	sst->fw_ops = skl_fw_ops;
 
-	return skl_dsp_acquire_irq(sst);
+	return 0;
 }
 EXPORT_SYMBOL_GPL(skl_sst_dsp_init);
 
Signature · 1 line
2.17.1
#28 lore raw

Re: [PATCH 13/35] ASoC: Intel: Skylake: Reuse sst_dsp_new

Quoted 1 line · Cezary Rojewski

skl_dsp_ctx_init is dumplication of sst_dsp_new and usage of such

typo: duplication.

Quoted 6 lines

bypasses natural DSP framework's flow. Remove it and reuse sst_dsp_new constructor which invokes sst specific init internally so nothing is missed.

Skylake does not even define any sst_ops::init so portion of existing skl_dsp_ctx_init can be regarded as DEADCODE.

this is also hard to review, you have lines like

Review

Quoted 2 lines
(quoted diff) +1 -1
-	return skl_dsp_acquire_irq(sst);
+	return 0;

that seem like a different change than what is described here.

Quoted 130 lines
---
  sound/soc/intel/skylake/bxt-sst.c       |  2 +-
  sound/soc/intel/skylake/cnl-sst.c       |  2 +-
  sound/soc/intel/skylake/skl-sst-dsp.c   | 28 -------------------------
  sound/soc/intel/skylake/skl-sst-dsp.h   |  2 --
  sound/soc/intel/skylake/skl-sst-utils.c |  6 +++++-
  sound/soc/intel/skylake/skl-sst.c       |  2 +-
  6 files changed, 8 insertions(+), 34 deletions(-)
sound/soc/intel/skylake/bxt-sst.c +1 -1
index e3614acff34d..a8a2783f9b37 100644
@@ -588,7 +588,7 @@ int bxt_sst_dsp_init(struct device *dev, void __iomem *mmio_base, int irq,
  	INIT_DELAYED_WORK(&skl->d0i3.work, bxt_set_dsp_D0i3);
  	skl->d0i3.state = SKL_DSP_D0I3_NONE;
 
-	return skl_dsp_acquire_irq(sst);
+	return 0;
  }
  EXPORT_SYMBOL_GPL(bxt_sst_dsp_init);
 
sound/soc/intel/skylake/cnl-sst.c +1 -1
index 84dc6b82831d..0b0337f6ebff 100644
@@ -460,7 +460,7 @@ int cnl_sst_dsp_init(struct device *dev, void __iomem *mmio_base, int irq,
  	cnl->boot_complete = false;
  	init_waitqueue_head(&cnl->boot_wait);
 
-	return skl_dsp_acquire_irq(sst);
+	return 0;
  }
  EXPORT_SYMBOL_GPL(cnl_sst_dsp_init);
 
sound/soc/intel/skylake/skl-sst-dsp.c +0 -28
index 1c4ecbcd7db7..9d8eb1af4798 100644
@@ -418,34 +418,6 @@ int skl_dsp_sleep(struct sst_dsp *ctx)
  }
  EXPORT_SYMBOL_GPL(skl_dsp_sleep);
 
-struct sst_dsp *skl_dsp_ctx_init(struct device *dev,
-		struct sst_pdata *pdata, int irq)
-{
-	int ret;
-	struct sst_dsp *sst;
-
-	sst = devm_kzalloc(dev, sizeof(*sst), GFP_KERNEL);
-	if (sst == NULL)
-		return NULL;
-
-	spin_lock_init(&sst->spinlock);
-	mutex_init(&sst->mutex);
-	sst->dev = dev;
-	sst->pdata = pdata;
-	sst->irq = irq;
-	sst->ops = pdata->ops;
-	sst->thread_context = pdata->dsp;
-
-	/* Initialise SST Audio DSP */
-	if (sst->ops->init) {
-		ret = sst->ops->init(sst, NULL);
-		if (ret < 0)
-			return NULL;
-	}
-
-	return sst;
-}
-
  int skl_dsp_acquire_irq(struct sst_dsp *sst)
  {
  	int ret;
sound/soc/intel/skylake/skl-sst-dsp.h +0 -2
index ba37433e4efa..1d579d59de60 100644
@@ -196,8 +196,6 @@ int skl_cldma_prepare(struct sst_dsp *ctx);
  int skl_cldma_wait_interruptible(struct sst_dsp *ctx);
 
  void skl_dsp_set_state_locked(struct sst_dsp *ctx, int state);
-struct sst_dsp *skl_dsp_ctx_init(struct device *dev,
-		struct sst_pdata *pdata, int irq);
  int skl_dsp_acquire_irq(struct sst_dsp *sst);
  bool is_skl_dsp_running(struct sst_dsp *ctx);
 
sound/soc/intel/skylake/skl-sst-utils.c +5 -1
index 9061a9b17ea0..8e03a10855c4 100644
@@ -6,6 +6,7 @@
   */
 
  #include <linux/device.h>
+#include <linux/pci.h>
  #include <linux/slab.h>
  #include <linux/uuid.h>
  #include "../common/sst-dsp.h"
@@ -360,10 +361,13 @@ int skl_sst_ctx_init(struct device *dev, int irq, const char *fw_name,
  	struct skl_dev *skl = *dsp;
  	struct sst_dsp *sst;
 
+	pdata->id = skl->pci->device;
+	pdata->irq = irq;
+	pdata->resindex_dma_base = -1;
  	skl->dev = dev;
  	pdata->dsp = skl;
  	INIT_LIST_HEAD(&skl->uuid_list);
-	skl->dsp = skl_dsp_ctx_init(dev, pdata, irq);
+	skl->dsp = sst_dsp_new(dev, pdata);
  	if (!skl->dsp) {
  		dev_err(skl->dev, "%s: no device\n", __func__);
  		return -ENODEV;
sound/soc/intel/skylake/skl-sst.c +1 -1
index e55523826346..6bb003add9e2 100644
@@ -550,7 +550,7 @@ int skl_sst_dsp_init(struct device *dev, void __iomem *mmio_base, int irq,
 
  	sst->fw_ops = skl_fw_ops;
 
-	return skl_dsp_acquire_irq(sst);
+	return 0;
  }
  EXPORT_SYMBOL_GPL(skl_sst_dsp_init);
 
author maintainer
#29 lore raw

Re: [PATCH 13/35] ASoC: Intel: Skylake: Reuse sst_dsp_new

Quoted 7 lines · Pierre-Louis Bossart
Quoted 1 line · Cezary Rojewski

skl_dsp_ctx_init is dumplication of sst_dsp_new and usage of such

typo: duplication.

Ack.

Quoted 7 lines
Quoted 6 lines

bypasses natural DSP framework's flow. Remove it and reuse sst_dsp_new constructor which invokes sst specific init internally so nothing is missed.

Skylake does not even define any sst_ops::init so portion of existing skl_dsp_ctx_init can be regarded as DEADCODE.

Quoted 7 lines

this is also hard to review, you have lines like

Quoted 2 lines

-    return skl_dsp_acquire_irq(sst);
+    return 0;

that seem like a different change than what is described here.

Noted, thank you. Same as in sst_dsp_new case, the framework does that for us so nothing is missed and thus we remove the _acquire_irq. The whole patchset shows how much /skylake quality can be improved with _little_ effort granted framework provided in /common is made use of properly.

Quoted 114 lines
Quoted 114 lines

---
  sound/soc/intel/skylake/bxt-sst.c       |  2 +- sound/soc/intel/skylake/cnl-sst.c       |  2 +- sound/soc/intel/skylake/skl-sst-dsp.c   | 28 ------------------------- sound/soc/intel/skylake/skl-sst-dsp.h   |  2 -- sound/soc/intel/skylake/skl-sst-utils.c |  6 +++++- sound/soc/intel/skylake/skl-sst.c       |  2 +-

  6 files changed, 8 insertions(+), 34 deletions(-)
sound/soc/intel/skylake/bxt-sst.c +1 -1
index e3614acff34d..a8a2783f9b37 100644
@@ -588,7 +588,7 @@ int bxt_sst_dsp_init(struct device *dev, void 
 __iomem *mmio_base, int irq,
       INIT_DELAYED_WORK(&skl->d0i3.work, bxt_set_dsp_D0i3);
       skl->d0i3.state = SKL_DSP_D0I3_NONE;
-    return skl_dsp_acquire_irq(sst);
+    return 0;
   }
   EXPORT_SYMBOL_GPL(bxt_sst_dsp_init);
sound/soc/intel/skylake/cnl-sst.c +1 -1
index 84dc6b82831d..0b0337f6ebff 100644
@@ -460,7 +460,7 @@ int cnl_sst_dsp_init(struct device *dev, void 
 __iomem *mmio_base, int irq,
       cnl->boot_complete = false;
       init_waitqueue_head(&cnl->boot_wait);
-    return skl_dsp_acquire_irq(sst);
+    return 0;
   }
   EXPORT_SYMBOL_GPL(cnl_sst_dsp_init);
sound/soc/intel/skylake/skl-sst-dsp.c +0 -28
index 1c4ecbcd7db7..9d8eb1af4798 100644
@@ -418,34 +418,6 @@ int skl_dsp_sleep(struct sst_dsp *ctx)
   }
   EXPORT_SYMBOL_GPL(skl_dsp_sleep);
-struct sst_dsp *skl_dsp_ctx_init(struct device *dev,
-        struct sst_pdata *pdata, int irq)
-{
-    int ret;
-    struct sst_dsp *sst;
-
-    sst = devm_kzalloc(dev, sizeof(*sst), GFP_KERNEL);
-    if (sst == NULL)
-        return NULL;
-
-    spin_lock_init(&sst->spinlock);
-    mutex_init(&sst->mutex);
-    sst->dev = dev;
-    sst->pdata = pdata;
-    sst->irq = irq;
-    sst->ops = pdata->ops;
-    sst->thread_context = pdata->dsp;
-
-    /* Initialise SST Audio DSP */
-    if (sst->ops->init) {
-        ret = sst->ops->init(sst, NULL);
-        if (ret < 0)
-            return NULL;
-    }
-
-    return sst;
-}
-
   int skl_dsp_acquire_irq(struct sst_dsp *sst)
   {
       int ret;
sound/soc/intel/skylake/skl-sst-dsp.h +0 -2
index ba37433e4efa..1d579d59de60 100644
@@ -196,8 +196,6 @@ int skl_cldma_prepare(struct sst_dsp *ctx);
   int skl_cldma_wait_interruptible(struct sst_dsp *ctx);
   void skl_dsp_set_state_locked(struct sst_dsp *ctx, int state);
-struct sst_dsp *skl_dsp_ctx_init(struct device *dev,
-        struct sst_pdata *pdata, int irq);
   int skl_dsp_acquire_irq(struct sst_dsp *sst);
   bool is_skl_dsp_running(struct sst_dsp *ctx);
sound/soc/intel/skylake/skl-sst-utils.c +5 -1
index 9061a9b17ea0..8e03a10855c4 100644
@@ -6,6 +6,7 @@
    */
   #include <linux/device.h>
+#include <linux/pci.h>
   #include <linux/slab.h>
   #include <linux/uuid.h>
   #include "../common/sst-dsp.h"
@@ -360,10 +361,13 @@ int skl_sst_ctx_init(struct device *dev, int 
 irq, const char *fw_name,
       struct skl_dev *skl = *dsp;
       struct sst_dsp *sst;
+    pdata->id = skl->pci->device;
+    pdata->irq = irq;
+    pdata->resindex_dma_base = -1;
       skl->dev = dev;
       pdata->dsp = skl;
       INIT_LIST_HEAD(&skl->uuid_list);
-    skl->dsp = skl_dsp_ctx_init(dev, pdata, irq);
+    skl->dsp = sst_dsp_new(dev, pdata);
       if (!skl->dsp) {
           dev_err(skl->dev, "%s: no device\n", __func__);
           return -ENODEV;
sound/soc/intel/skylake/skl-sst.c +0 -0
index e55523826346..6bb003add9e2 100644
Quoted 8 lines

sound/soc/intel/skylake/skl-sst.c int skl_sst_dsp_init(struct device *dev, void · line 555

Quoted 8 lines
sound/soc/intel/skylake/skl-sst.c +1 -1
@@ -550,7 +550,7 @@ int skl_sst_dsp_init(struct device *dev, void 
 __iomem *mmio_base, int irq,
       sst->fw_ops = skl_fw_ops;
-    return skl_dsp_acquire_irq(sst);
+    return 0;
   }
   EXPORT_SYMBOL_GPL(skl_sst_dsp_init);
 

_______________________________________________
Alsa-devel mailing list
[email protected]
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

author maintainer
#30 lore raw

PATCH 14/35 ASoC: Intel: Skylake: Remove skl_dsp_acquire_irq

In reply to Cezary Rojewski

With Skylake following the unified sst_dsp init and free flow, there is no need for custom _acquire_irq function. Framework takes care of this with constructor for us. Remove redundant handler.

---
 sound/soc/intel/skylake/skl-sst-dsp.c | 14 --------------
 sound/soc/intel/skylake/skl-sst-dsp.h |  1 -
 2 files changed, 15 deletions(-)
sound/soc/intel/skylake/skl-sst-dsp.c +0 -14
index 9d8eb1af4798..773b4b562a07 100644
@@ -418,20 +418,6 @@ int skl_dsp_sleep(struct sst_dsp *ctx)
 }
 EXPORT_SYMBOL_GPL(skl_dsp_sleep);
 
-int skl_dsp_acquire_irq(struct sst_dsp *sst)
-{
-	int ret;
-
-	/* Register the ISR */
-	ret = request_threaded_irq(sst->irq, sst->ops->irq_handler,
-		sst->ops->thread_fn, IRQF_SHARED, "AudioDSP", sst);
-	if (ret)
-		dev_err(sst->dev, "unable to grab threaded IRQ %d, disabling device\n",
-			       sst->irq);
-
-	return ret;
-}
-
 void skl_dsp_free(struct sst_dsp *dsp)
 {
 	struct skl_dev *skl = dsp->thread_context;
sound/soc/intel/skylake/skl-sst-dsp.h +0 -1
index 1d579d59de60..45d99b6b448e 100644
@@ -196,7 +196,6 @@ int skl_cldma_prepare(struct sst_dsp *ctx);
 int skl_cldma_wait_interruptible(struct sst_dsp *ctx);
 
 void skl_dsp_set_state_locked(struct sst_dsp *ctx, int state);
-int skl_dsp_acquire_irq(struct sst_dsp *sst);
 bool is_skl_dsp_running(struct sst_dsp *ctx);
 
 unsigned int skl_dsp_get_enabled_cores(struct sst_dsp *ctx);
Signature · 1 line
2.17.1
author maintainer
#31 lore raw

PATCH 15/35 ASoC: Intel: Skylake: Use dsp loading functions directly

In reply to Cezary Rojewski

None of skl_dsp_loader_ops are actually extended as any parameter that could be "extended" is already part of given function's parameter list. Rather than obfustace non-derived calls with ops and dereferences, make use of said operation directly. Takes part in remal of skl_dsp_loader_ops structure.

---
 sound/soc/intel/skylake/bxt-sst.c       | 18 +++++++++---------
 sound/soc/intel/skylake/cnl-sst.c       | 10 +++++-----
 sound/soc/intel/skylake/skl-messages.c  | 10 +++++-----
 sound/soc/intel/skylake/skl-sst-cldma.c | 10 +++++-----
 sound/soc/intel/skylake/skl-sst-dsp.h   |  9 +++++++++
 5 files changed, 33 insertions(+), 24 deletions(-)
sound/soc/intel/skylake/bxt-sst.c +9 -9
index a8a2783f9b37..1ca4fba0f35f 100644
@@ -60,7 +60,7 @@ bxt_load_library(struct sst_dsp *ctx, struct skl_lib_info *linfo, int lib_count)
 		if (ret < 0)
 			goto load_library_failed;
 
-		stream_tag = ctx->dsp_ops.prepare(ctx->dev, 0x40,
+		stream_tag = skl_dsp_prepare(ctx->dev, 0x40,
 					stripped_fw.size, &dmab);
 		if (stream_tag <= 0) {
 			dev_err(ctx->dev, "Lib prepare DMA err: %x\n",
@@ -72,14 +72,14 @@ bxt_load_library(struct sst_dsp *ctx, struct skl_lib_info *linfo, int lib_count)
 		dma_id = stream_tag - 1;
 		memcpy(dmab.area, stripped_fw.data, stripped_fw.size);
 
-		ctx->dsp_ops.trigger(ctx->dev, true, stream_tag);
+		skl_dsp_trigger(ctx->dev, true, stream_tag);
 		ret = skl_sst_ipc_load_library(&skl->ipc, dma_id, i, true);
 		if (ret < 0)
 			dev_err(ctx->dev, "IPC Load Lib for %s fail: %d\n",
 					linfo[i].name, ret);
 
-		ctx->dsp_ops.trigger(ctx->dev, false, stream_tag);
-		ctx->dsp_ops.cleanup(ctx->dev, &dmab, stream_tag);
+		skl_dsp_trigger(ctx->dev, false, stream_tag);
+		skl_dsp_cleanup(ctx->dev, &dmab, stream_tag);
 	}
 
 	return ret;
@@ -100,7 +100,7 @@ static int sst_bxt_prepare_fw(struct sst_dsp *ctx,
 {
 	int stream_tag, ret;
 
-	stream_tag = ctx->dsp_ops.prepare(ctx->dev, 0x40, fwsize, &ctx->dmab);
+	stream_tag = skl_dsp_prepare(ctx->dev, 0x40, fwsize, &ctx->dmab);
 	if (stream_tag <= 0) {
 		dev_err(ctx->dev, "Failed to prepare DMA FW loading err: %x\n",
 				stream_tag);
@@ -162,7 +162,7 @@ static int sst_bxt_prepare_fw(struct sst_dsp *ctx,
 	return ret;
 
 base_fw_load_failed:
-	ctx->dsp_ops.cleanup(ctx->dev, &ctx->dmab, stream_tag);
+	skl_dsp_cleanup(ctx->dev, &ctx->dmab, stream_tag);
 	skl_dsp_core_power_down(ctx, SKL_DSP_CORE_MASK(1));
 	skl_dsp_disable_core(ctx, SKL_DSP_CORE0_MASK);
 	return ret;
@@ -172,12 +172,12 @@ static int sst_transfer_fw_host_dma(struct sst_dsp *ctx)
 {
 	int ret;
 
-	ctx->dsp_ops.trigger(ctx->dev, true, ctx->dsp_ops.stream_tag);
+	skl_dsp_trigger(ctx->dev, true, ctx->dsp_ops.stream_tag);
 	ret = sst_dsp_register_poll(ctx, BXT_ADSP_FW_STATUS, SKL_FW_STS_MASK,
 			BXT_ROM_INIT, BXT_BASEFW_TIMEOUT, "Firmware boot");
 
-	ctx->dsp_ops.trigger(ctx->dev, false, ctx->dsp_ops.stream_tag);
-	ctx->dsp_ops.cleanup(ctx->dev, &ctx->dmab, ctx->dsp_ops.stream_tag);
+	skl_dsp_trigger(ctx->dev, false, ctx->dsp_ops.stream_tag);
+	skl_dsp_cleanup(ctx->dev, &ctx->dmab, ctx->dsp_ops.stream_tag);
 
 	return ret;
 }
sound/soc/intel/skylake/cnl-sst.c +5 -5
index 0b0337f6ebff..5ad34e9f51eb 100644
@@ -48,7 +48,7 @@ static int cnl_prepare_fw(struct sst_dsp *ctx, const void *fwdata, u32 fwsize)
 
 	int ret, stream_tag;
 
-	stream_tag = ctx->dsp_ops.prepare(ctx->dev, 0x40, fwsize, &ctx->dmab);
+	stream_tag = skl_dsp_prepare(ctx->dev, 0x40, fwsize, &ctx->dmab);
 	if (stream_tag <= 0) {
 		dev_err(ctx->dev, "dma prepare failed: 0%#x\n", stream_tag);
 		return stream_tag;
@@ -84,7 +84,7 @@ static int cnl_prepare_fw(struct sst_dsp *ctx, const void *fwdata, u32 fwsize)
 	return 0;
 
 base_fw_load_failed:
-	ctx->dsp_ops.cleanup(ctx->dev, &ctx->dmab, stream_tag);
+	skl_dsp_cleanup(ctx->dev, &ctx->dmab, stream_tag);
 	cnl_dsp_disable_core(ctx, SKL_DSP_CORE0_MASK);
 
 	return ret;
@@ -94,13 +94,13 @@ static int sst_transfer_fw_host_dma(struct sst_dsp *ctx)
 {
 	int ret;
 
-	ctx->dsp_ops.trigger(ctx->dev, true, ctx->dsp_ops.stream_tag);
+	skl_dsp_trigger(ctx->dev, true, ctx->dsp_ops.stream_tag);
 	ret = sst_dsp_register_poll(ctx, CNL_ADSP_FW_STATUS, CNL_FW_STS_MASK,
 				    CNL_FW_INIT, CNL_BASEFW_TIMEOUT,
 				    "firmware boot");
 
-	ctx->dsp_ops.trigger(ctx->dev, false, ctx->dsp_ops.stream_tag);
-	ctx->dsp_ops.cleanup(ctx->dev, &ctx->dmab, ctx->dsp_ops.stream_tag);
+	skl_dsp_trigger(ctx->dev, false, ctx->dsp_ops.stream_tag);
+	skl_dsp_cleanup(ctx->dev, &ctx->dmab, ctx->dsp_ops.stream_tag);
 
 	return ret;
 }
sound/soc/intel/skylake/skl-messages.c +5 -5
index 8fd682872d0c..20ab980fe8a1 100644
@@ -22,13 +22,13 @@
 #include "../common/sst-dsp-priv.h"
 #include "skl-topology.h"
 
-static int skl_alloc_dma_buf(struct device *dev,
+int skl_alloc_dma_buf(struct device *dev,
 		struct snd_dma_buffer *dmab, size_t size)
 {
 	return snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV, dev, size, dmab);
 }
 
-static int skl_free_dma_buf(struct device *dev, struct snd_dma_buffer *dmab)
+int skl_free_dma_buf(struct device *dev, struct snd_dma_buffer *dmab)
 {
 	snd_dma_free_pages(dmab);
 	return 0;
@@ -66,7 +66,7 @@ static int skl_dsp_setup_spib(struct device *dev, unsigned int size,
 	return 0;
 }
 
-static int skl_dsp_prepare(struct device *dev, unsigned int format,
+int skl_dsp_prepare(struct device *dev, unsigned int format,
 			unsigned int size, struct snd_dma_buffer *dmab)
 {
 	struct hdac_bus *bus = dev_get_drvdata(dev);
@@ -98,7 +98,7 @@ static int skl_dsp_prepare(struct device *dev, unsigned int format,
 	return stream->stream_tag;
 }
 
-static int skl_dsp_trigger(struct device *dev, bool start, int stream_tag)
+int skl_dsp_trigger(struct device *dev, bool start, int stream_tag)
 {
 	struct hdac_bus *bus = dev_get_drvdata(dev);
 	struct hdac_stream *stream;
@@ -116,7 +116,7 @@ static int skl_dsp_trigger(struct device *dev, bool start, int stream_tag)
 	return 0;
 }
 
-static int skl_dsp_cleanup(struct device *dev,
+int skl_dsp_cleanup(struct device *dev,
 		struct snd_dma_buffer *dmab, int stream_tag)
 {
 	struct hdac_bus *bus = dev_get_drvdata(dev);
sound/soc/intel/skylake/skl-sst-cldma.c +5 -5
index 5a2c35f58fda..ca2e18666582 100644
@@ -152,8 +152,8 @@ static void skl_cldma_cleanup(struct sst_dsp  *ctx)
 	skl_cldma_cleanup_spb(ctx);
 	skl_cldma_stream_clear(ctx);
 
-	ctx->dsp_ops.free_dma_buf(ctx->dev, &ctx->cl_dev.dmab_data);
-	ctx->dsp_ops.free_dma_buf(ctx->dev, &ctx->cl_dev.dmab_bdl);
+	skl_free_dma_buf(ctx->dev, &ctx->cl_dev.dmab_data);
+	skl_free_dma_buf(ctx->dev, &ctx->cl_dev.dmab_bdl);
 }
 
 int skl_cldma_wait_interruptible(struct sst_dsp *ctx)
@@ -337,18 +337,18 @@ int skl_cldma_prepare(struct sst_dsp *ctx)
 	ctx->cl_dev.ops.cl_stop_dma = skl_cldma_stop;
 
 	/* Allocate buffer*/
-	ret = ctx->dsp_ops.alloc_dma_buf(ctx->dev,
+	ret = skl_alloc_dma_buf(ctx->dev,
 			&ctx->cl_dev.dmab_data, ctx->cl_dev.bufsize);
 	if (ret < 0) {
 		dev_err(ctx->dev, "Alloc buffer for base fw failed: %x\n", ret);
 		return ret;
 	}
 	/* Setup Code loader BDL */
-	ret = ctx->dsp_ops.alloc_dma_buf(ctx->dev,
+	ret = skl_alloc_dma_buf(ctx->dev,
 			&ctx->cl_dev.dmab_bdl, PAGE_SIZE);
 	if (ret < 0) {
 		dev_err(ctx->dev, "Alloc buffer for blde failed: %x\n", ret);
-		ctx->dsp_ops.free_dma_buf(ctx->dev, &ctx->cl_dev.dmab_data);
+		skl_free_dma_buf(ctx->dev, &ctx->cl_dev.dmab_data);
 		return ret;
 	}
 	bdl = (__le32 *)ctx->cl_dev.dmab_bdl.area;
sound/soc/intel/skylake/skl-sst-dsp.h +9 -0
index 45d99b6b448e..97e16a602331 100644
@@ -190,6 +190,15 @@ struct skl_module_table {
 	struct list_head list;
 };
 
+int skl_alloc_dma_buf(struct device *dev,
+		struct snd_dma_buffer *dmab, size_t size);
+int skl_free_dma_buf(struct device *dev, struct snd_dma_buffer *dmab);
+int skl_dsp_prepare(struct device *dev, unsigned int format,
+		unsigned int size, struct snd_dma_buffer *dmab);
+int skl_dsp_trigger(struct device *dev, bool start, int stream_tag);
+int skl_dsp_cleanup(struct device *dev, struct snd_dma_buffer *dmab,
+		int stream_tag);
+
 void skl_cldma_process_intr(struct sst_dsp *ctx);
 void skl_cldma_int_disable(struct sst_dsp *ctx);
 int skl_cldma_prepare(struct sst_dsp *ctx);
Signature · 1 line
2.17.1
#32 lore raw

Re: [PATCH 15/35] ASoC: Intel: Skylake: Use dsp loading functions directly

Quoted 3 lines · Cezary Rojewski

None of skl_dsp_loader_ops are actually extended as any parameter that could be "extended" is already part of given function's parameter list. Rather than obfustace non-derived calls with ops and dereferences, make

A typo on obfuscate could be intentional?

Quoted 1 line

use of said operation directly. Takes part in remal of

removal?

Quoted 16 lines

skl_dsp_loader_ops structure.

---
  sound/soc/intel/skylake/bxt-sst.c       | 18 +++++++++---------
  sound/soc/intel/skylake/cnl-sst.c       | 10 +++++-----
  sound/soc/intel/skylake/skl-messages.c  | 10 +++++-----
  sound/soc/intel/skylake/skl-sst-cldma.c | 10 +++++-----
  sound/soc/intel/skylake/skl-sst-dsp.h   |  9 +++++++++
  5 files changed, 33 insertions(+), 24 deletions(-)
sound/soc/intel/skylake/bxt-sst.c +0 -0
index a8a2783f9b37..1ca4fba0f35f 100644

sound/soc/intel/skylake/bxt-sst.c bxt_load_library(struct sst_dsp *ctx, struct skl_lib_info *linfo, int lib_count) · line 64

Quoted 6 lines
sound/soc/intel/skylake/bxt-sst.c +1 -1
@@ -60,7 +60,7 @@ bxt_load_library(struct sst_dsp *ctx, struct skl_lib_info *linfo, int lib_count)
  		if (ret < 0)
  			goto load_library_failed;
 
-		stream_tag = ctx->dsp_ops.prepare(ctx->dev, 0x40,
+		stream_tag = skl_dsp_prepare(ctx->dev, 0x40,
  					stripped_fw.size, &dmab);

fits on one line now?

sound/soc/intel/skylake/bxt-sst.c bxt_load_library(struct sst_dsp *ctx, struct skl_lib_info *linfo, int lib_count) · line 79

Quoted 12 lines
sound/soc/intel/skylake/bxt-sst.c +1 -1
  		if (stream_tag <= 0) {
  			dev_err(ctx->dev, "Lib prepare DMA err: %x\n",
@@ -72,14 +72,14 @@ bxt_load_library(struct sst_dsp *ctx, struct skl_lib_info *linfo, int lib_count)
  		dma_id = stream_tag - 1;
  		memcpy(dmab.area, stripped_fw.data, stripped_fw.size);
 
-		ctx->dsp_ops.trigger(ctx->dev, true, stream_tag);
+		skl_dsp_trigger(ctx->dev, true, stream_tag);
  		ret = skl_sst_ipc_load_library(&skl->ipc, dma_id, i, true);
  		if (ret < 0)
  			dev_err(ctx->dev, "IPC Load Lib for %s fail: %d\n",
  					linfo[i].name, ret);

indent?

Quoted 18 lines
sound/soc/intel/skylake/bxt-sst.c +3 -3
-		ctx->dsp_ops.trigger(ctx->dev, false, stream_tag);
-		ctx->dsp_ops.cleanup(ctx->dev, &dmab, stream_tag);
+		skl_dsp_trigger(ctx->dev, false, stream_tag);
+		skl_dsp_cleanup(ctx->dev, &dmab, stream_tag);
  	}
 
  	return ret;
@@ -100,7 +100,7 @@ static int sst_bxt_prepare_fw(struct sst_dsp *ctx,
  {
  	int stream_tag, ret;
 
-	stream_tag = ctx->dsp_ops.prepare(ctx->dev, 0x40, fwsize, &ctx->dmab);
+	stream_tag = skl_dsp_prepare(ctx->dev, 0x40, fwsize, &ctx->dmab);
  	if (stream_tag <= 0) {
  		dev_err(ctx->dev, "Failed to prepare DMA FW loading err: %x\n",
  				stream_tag);

sound/soc/intel/skylake/bxt-sst.c static int sst_bxt_prepare_fw(struct sst_dsp *ctx, · line 167

Quoted 7 lines
sound/soc/intel/skylake/bxt-sst.c +1 -1
@@ -162,7 +162,7 @@ static int sst_bxt_prepare_fw(struct sst_dsp *ctx,
  	return ret;
 
  base_fw_load_failed:
-	ctx->dsp_ops.cleanup(ctx->dev, &ctx->dmab, stream_tag);
+	skl_dsp_cleanup(ctx->dev, &ctx->dmab, stream_tag);
  	skl_dsp_core_power_down(ctx, SKL_DSP_CORE_MASK(1));
  	skl_dsp_disable_core(ctx, SKL_DSP_CORE0_MASK);

those macros look confusing. COREx_MASK or CORE_MASK(x), choose one.

author maintainer
#33 lore raw

Re: [PATCH 15/35] ASoC: Intel: Skylake: Use dsp loading functions directly

Quoted 7 lines · Pierre-Louis Bossart
Quoted 3 lines · Cezary Rojewski

None of skl_dsp_loader_ops are actually extended as any parameter that could be "extended" is already part of given function's parameter list. Rather than obfustace non-derived calls with ops and dereferences, make

Quoted 6 lines

A typo on obfuscate could be intentional?

Quoted 1 line

use of said operation directly. Takes part in remal of

removal?

Ack on both.

Quoted 11 lines
Quoted 11 lines

skl_dsp_loader_ops structure.

---
  sound/soc/intel/skylake/bxt-sst.c       | 18 +++++++++--------- sound/soc/intel/skylake/cnl-sst.c       | 10 +++++----- sound/soc/intel/skylake/skl-messages.c  | 10 +++++----- sound/soc/intel/skylake/skl-sst-cldma.c | 10 +++++----- sound/soc/intel/skylake/skl-sst-dsp.h   |  9 +++++++++

  5 files changed, 33 insertions(+), 24 deletions(-)
Quoted 14 lines

sound/soc/intel/skylake/bxt-sst.c bxt_load_library(struct sst_dsp *ctx, struct · line 64

Quoted 11 lines
sound/soc/intel/skylake/bxt-sst.c +1 -1
index a8a2783f9b37..1ca4fba0f35f 100644
@@ -60,7 +60,7 @@ bxt_load_library(struct sst_dsp *ctx, struct 
 skl_lib_info *linfo, int lib_count)
           if (ret < 0)
               goto load_library_failed;
-        stream_tag = ctx->dsp_ops.prepare(ctx->dev, 0x40,
+        stream_tag = skl_dsp_prepare(ctx->dev, 0x40,
                       stripped_fw.size, &dmab);

fits on one line now?

Will check, thanks.

Quoted 6 lines
Quoted 6 lines
sound/soc/intel/skylake/bxt-sst.c +0 -0
           if (stream_tag <= 0) {
               dev_err(ctx->dev, "Lib prepare DMA err: %x\n",
@@ -72,14 +72,14 @@ bxt_load_library(struct sst_dsp *ctx, struct 
 skl_lib_info *linfo, int lib_count)
           dma_id = stream_tag - 1;
           memcpy(dmab.area, stripped_fw.data, stripped_fw.size);
Quoted 9 lines

sound/soc/intel/skylake/bxt-sst.c bxt_load_library(struct sst_dsp *ctx, struct skl_lib_info *linfo, int lib_count) · line 79

Quoted 6 lines
sound/soc/intel/skylake/bxt-sst.c +1 -1
-        ctx->dsp_ops.trigger(ctx->dev, true, stream_tag);
+        skl_dsp_trigger(ctx->dev, true, stream_tag);
           ret = skl_sst_ipc_load_library(&skl->ipc, dma_id, i, true);
           if (ret < 0)
               dev_err(ctx->dev, "IPC Load Lib for %s fail: %d\n",
                       linfo[i].name, ret);

indent?

Hmm looks like this has been here before but indeed can be corrected.

Quoted 16 lines
Quoted 16 lines
sound/soc/intel/skylake/bxt-sst.c +3 -3
-        ctx->dsp_ops.trigger(ctx->dev, false, stream_tag);
-        ctx->dsp_ops.cleanup(ctx->dev, &dmab, stream_tag);
+        skl_dsp_trigger(ctx->dev, false, stream_tag);
+        skl_dsp_cleanup(ctx->dev, &dmab, stream_tag);
       }
       return ret;
@@ -100,7 +100,7 @@ static int sst_bxt_prepare_fw(struct sst_dsp *ctx,
   {
       int stream_tag, ret;
-    stream_tag = ctx->dsp_ops.prepare(ctx->dev, 0x40, fwsize, 
 &ctx->dmab);
+    stream_tag = skl_dsp_prepare(ctx->dev, 0x40, fwsize, &ctx->dmab);
       if (stream_tag <= 0) {
           dev_err(ctx->dev, "Failed to prepare DMA FW loading err: %x\n",
                   stream_tag);
@@ -162,7 +162,7 @@ static int sst_bxt_prepare_fw(struct sst_dsp *ctx,
Quoted 9 lines
Quoted 6 lines
sound/soc/intel/skylake/bxt-sst.c +0 -0
       return ret;

  base_fw_load_failed:
-    ctx->dsp_ops.cleanup(ctx->dev, &ctx->dmab, stream_tag); +    skl_dsp_cleanup(ctx->dev, &ctx->dmab, stream_tag); skl_dsp_core_power_down(ctx, SKL_DSP_CORE_MASK(1)); skl_dsp_disable_core(ctx, SKL_DSP_CORE0_MASK);

those macros look confusing. COREx_MASK or CORE_MASK(x), choose one.

Huh, haven't touched any _CORE_MASK? Seeing that you are curious, let me do a little sneak peak: many macros are no longer with us and soon no longer on upstream! That includes some files too : D
_______________________________________________
Alsa-devel mailing list
[email protected]
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

author maintainer
#34 lore raw

PATCH 16/35 ASoC: Intel: Skylake: Make dsp_ops::stream_tag obsolete

In reply to Cezary Rojewski

stream_tag field is the last obstacle in removing skl_dsp_loader_ops structure. It is required only during fw load procedure and never lives outside of that process - prepare_fw functions take place directly before actual FW file transfer and once that's done, these are redundant. Update _prepare_fw routines to return stream_tag on success and use said return immediately in _transfer_fw_host_dma.

---
 sound/soc/intel/skylake/bxt-sst.c | 14 ++++++--------
 sound/soc/intel/skylake/cnl-sst.c | 13 ++++++-------
 2 files changed, 12 insertions(+), 15 deletions(-)
sound/soc/intel/skylake/bxt-sst.c +6 -8
index 1ca4fba0f35f..45da02f74f4d 100644
@@ -107,7 +107,6 @@ static int sst_bxt_prepare_fw(struct sst_dsp *ctx,
 		return stream_tag;
 	}
 
-	ctx->dsp_ops.stream_tag = stream_tag;
 	memcpy(ctx->dmab.area, fwdata, fwsize);
 
 	/* Step 1: Power up core 0 and core1 */
@@ -159,7 +158,7 @@ static int sst_bxt_prepare_fw(struct sst_dsp *ctx,
 		goto base_fw_load_failed;
 	}
 
-	return ret;
+	return stream_tag;
 
 base_fw_load_failed:
 	skl_dsp_cleanup(ctx->dev, &ctx->dmab, stream_tag);
@@ -168,16 +167,16 @@ static int sst_bxt_prepare_fw(struct sst_dsp *ctx,
 	return ret;
 }
 
-static int sst_transfer_fw_host_dma(struct sst_dsp *ctx)
+static int sst_transfer_fw_host_dma(struct sst_dsp *ctx, int stream_tag)
 {
 	int ret;
 
-	skl_dsp_trigger(ctx->dev, true, ctx->dsp_ops.stream_tag);
+	skl_dsp_trigger(ctx->dev, true, stream_tag);
 	ret = sst_dsp_register_poll(ctx, BXT_ADSP_FW_STATUS, SKL_FW_STS_MASK,
 			BXT_ROM_INIT, BXT_BASEFW_TIMEOUT, "Firmware boot");
 
-	skl_dsp_trigger(ctx->dev, false, ctx->dsp_ops.stream_tag);
-	skl_dsp_cleanup(ctx->dev, &ctx->dmab, ctx->dsp_ops.stream_tag);
+	skl_dsp_trigger(ctx->dev, false, stream_tag);
+	skl_dsp_cleanup(ctx->dev, &ctx->dmab, stream_tag);
 
 	return ret;
 }
@@ -207,7 +206,6 @@ static int bxt_load_base_firmware(struct sst_dsp *ctx)
 	stripped_fw.size = ctx->fw->size;
 	skl_dsp_strip_extended_manifest(&stripped_fw);
 
-
 	for (i = 0; i < BXT_FW_ROM_INIT_RETRY; i++) {
 		ret = sst_bxt_prepare_fw(ctx, stripped_fw.data, stripped_fw.size);
 		if (ret == 0)
@@ -223,7 +221,7 @@ static int bxt_load_base_firmware(struct sst_dsp *ctx)
 		goto sst_load_base_firmware_failed;
 	}
 
-	ret = sst_transfer_fw_host_dma(ctx);
+	ret = sst_transfer_fw_host_dma(ctx, ret);
 	if (ret < 0) {
 		dev_err(ctx->dev, "Transfer firmware failed %d\n", ret);
 		dev_info(ctx->dev, "Error code=0x%x: FW status=0x%x\n",
sound/soc/intel/skylake/cnl-sst.c +6 -7
index 5ad34e9f51eb..4d9a4d5886f4 100644
@@ -54,7 +54,6 @@ static int cnl_prepare_fw(struct sst_dsp *ctx, const void *fwdata, u32 fwsize)
 		return stream_tag;
 	}
 
-	ctx->dsp_ops.stream_tag = stream_tag;
 	memcpy(ctx->dmab.area, fwdata, fwsize);
 
 	/* purge FW request */
@@ -81,7 +80,7 @@ static int cnl_prepare_fw(struct sst_dsp *ctx, const void *fwdata, u32 fwsize)
 		goto base_fw_load_failed;
 	}
 
-	return 0;
+	return stream_tag;
 
 base_fw_load_failed:
 	skl_dsp_cleanup(ctx->dev, &ctx->dmab, stream_tag);
@@ -90,17 +89,17 @@ static int cnl_prepare_fw(struct sst_dsp *ctx, const void *fwdata, u32 fwsize)
 	return ret;
 }
 
-static int sst_transfer_fw_host_dma(struct sst_dsp *ctx)
+static int sst_transfer_fw_host_dma(struct sst_dsp *ctx, int stream_tag)
 {
 	int ret;
 
-	skl_dsp_trigger(ctx->dev, true, ctx->dsp_ops.stream_tag);
+	skl_dsp_trigger(ctx->dev, true, stream_tag);
 	ret = sst_dsp_register_poll(ctx, CNL_ADSP_FW_STATUS, CNL_FW_STS_MASK,
 				    CNL_FW_INIT, CNL_BASEFW_TIMEOUT,
 				    "firmware boot");
 
-	skl_dsp_trigger(ctx->dev, false, ctx->dsp_ops.stream_tag);
-	skl_dsp_cleanup(ctx->dev, &ctx->dmab, ctx->dsp_ops.stream_tag);
+	skl_dsp_trigger(ctx->dev, false, stream_tag);
+	skl_dsp_cleanup(ctx->dev, &ctx->dmab, stream_tag);
 
 	return ret;
 }
@@ -137,7 +136,7 @@ static int cnl_load_base_firmware(struct sst_dsp *ctx)
 		goto cnl_load_base_firmware_failed;
 	}
 
-	ret = sst_transfer_fw_host_dma(ctx);
+	ret = sst_transfer_fw_host_dma(ctx, ret);
 	if (ret < 0) {
 		dev_err(ctx->dev, "transfer firmware failed: %d\n", ret);
 		cnl_dsp_disable_core(ctx, SKL_DSP_CORE0_MASK);
Signature · 1 line
2.17.1
author maintainer
#35 lore raw

PATCH 17/35 ASoC: Intel: Skylake: Remove skl_dsp_loader_ops

In reply to Cezary Rojewski

With all fields deprecated, yet another struct can be removed. Let's do so and don't forget about any functions or fields tied to its existence.

---
 sound/soc/intel/common/sst-dsp-priv.h   |  1 -
 sound/soc/intel/skylake/bxt-sst.c       |  5 ++--
 sound/soc/intel/skylake/cnl-sst-dsp.h   |  3 +-
 sound/soc/intel/skylake/cnl-sst.c       |  5 ++--
 sound/soc/intel/skylake/skl-messages.c  | 40 +------------------------
 sound/soc/intel/skylake/skl-sst-dsp.h   | 24 ++-------------
 sound/soc/intel/skylake/skl-sst-utils.c |  3 +-
 sound/soc/intel/skylake/skl-sst.c       |  5 ++--
 sound/soc/intel/skylake/skl.h           |  2 --
 9 files changed, 12 insertions(+), 76 deletions(-)
sound/soc/intel/common/sst-dsp-priv.h +0 -1
index 8a7009937d59..0fe9bebcfb38 100644
@@ -306,7 +306,6 @@ struct sst_dsp {
 	const char *fw_name;
 
 	/* To allocate CL dma buffers */
-	struct skl_dsp_loader_ops dsp_ops;
 	struct skl_dsp_fw_ops fw_ops;
 	int sst_state;
 	struct skl_cl_dev cl_dev;
sound/soc/intel/skylake/bxt-sst.c +2 -3
index 45da02f74f4d..c7961050c2ee 100644
@@ -546,14 +546,13 @@ static struct sst_pdata skl_dev = {
 };
 
 int bxt_sst_dsp_init(struct device *dev, void __iomem *mmio_base, int irq,
-			const char *fw_name, struct skl_dsp_loader_ops dsp_ops,
-			struct skl_dev **dsp)
+			const char *fw_name, struct skl_dev **dsp)
 {
 	struct skl_dev *skl;
 	struct sst_dsp *sst;
 	int ret;
 
-	ret = skl_sst_ctx_init(dev, irq, fw_name, dsp_ops, dsp, &skl_dev);
+	ret = skl_sst_ctx_init(dev, irq, fw_name, dsp, &skl_dev);
 	if (ret < 0) {
 		dev_err(dev, "%s: no device\n", __func__);
 		return ret;
sound/soc/intel/skylake/cnl-sst-dsp.h +1 -2
index 30b586acc858..70da4f312f53 100644
@@ -94,7 +94,6 @@ void cnl_ipc_op_int_disable(struct sst_dsp *ctx);
 bool cnl_ipc_int_status(struct sst_dsp *ctx);
 
 int cnl_sst_dsp_init(struct device *dev, void __iomem *mmio_base, int irq,
-		     const char *fw_name, struct skl_dsp_loader_ops dsp_ops,
-		     struct skl_dev **dsp);
+		     const char *fw_name, struct skl_dev **dsp);
 
 #endif /*__CNL_SST_DSP_H__*/
sound/soc/intel/skylake/cnl-sst.c +2 -3
index 4d9a4d5886f4..2f10076cc906 100644
@@ -423,14 +423,13 @@ static struct sst_pdata cnl_dev = {
 };
 
 int cnl_sst_dsp_init(struct device *dev, void __iomem *mmio_base, int irq,
-		     const char *fw_name, struct skl_dsp_loader_ops dsp_ops,
-		     struct skl_dev **dsp)
+		     const char *fw_name, struct skl_dev **dsp)
 {
 	struct skl_dev *cnl;
 	struct sst_dsp *sst;
 	int ret;
 
-	ret = skl_sst_ctx_init(dev, irq, fw_name, dsp_ops, dsp, &cnl_dev);
+	ret = skl_sst_ctx_init(dev, irq, fw_name, dsp, &cnl_dev);
 	if (ret < 0) {
 		dev_err(dev, "%s: no device\n", __func__);
 		return ret;
sound/soc/intel/skylake/skl-messages.c +1 -39
index 20ab980fe8a1..6fbceec67b53 100644
@@ -140,72 +140,37 @@ int skl_dsp_cleanup(struct device *dev,
 	return 0;
 }
 
-static struct skl_dsp_loader_ops skl_get_loader_ops(void)
-{
-	struct skl_dsp_loader_ops loader_ops;
-
-	memset(&loader_ops, 0, sizeof(struct skl_dsp_loader_ops));
-
-	loader_ops.alloc_dma_buf = skl_alloc_dma_buf;
-	loader_ops.free_dma_buf = skl_free_dma_buf;
-
-	return loader_ops;
-};
-
-static struct skl_dsp_loader_ops bxt_get_loader_ops(void)
-{
-	struct skl_dsp_loader_ops loader_ops;
-
-	memset(&loader_ops, 0, sizeof(loader_ops));
-
-	loader_ops.alloc_dma_buf = skl_alloc_dma_buf;
-	loader_ops.free_dma_buf = skl_free_dma_buf;
-	loader_ops.prepare = skl_dsp_prepare;
-	loader_ops.trigger = skl_dsp_trigger;
-	loader_ops.cleanup = skl_dsp_cleanup;
-
-	return loader_ops;
-};
-
 static const struct skl_dsp_ops dsp_ops[] = {
 	{
 		.id = 0x9d70,
-		.loader_ops = skl_get_loader_ops,
 		.init = skl_sst_dsp_init,
 	},
 	{
 		.id = 0x9d71,
-		.loader_ops = skl_get_loader_ops,
 		.init = skl_sst_dsp_init,
 	},
 	{
 		.id = 0x5a98,
-		.loader_ops = bxt_get_loader_ops,
 		.init = bxt_sst_dsp_init,
 	},
 	{
 		.id = 0x3198,
-		.loader_ops = bxt_get_loader_ops,
 		.init = bxt_sst_dsp_init,
 	},
 	{
 		.id = 0x9dc8,
-		.loader_ops = bxt_get_loader_ops,
 		.init = cnl_sst_dsp_init,
 	},
 	{
 		.id = 0xa348,
-		.loader_ops = bxt_get_loader_ops,
 		.init = cnl_sst_dsp_init,
 	},
 	{
 		.id = 0x02c8,
-		.loader_ops = bxt_get_loader_ops,
 		.init = cnl_sst_dsp_init,
 	},
 	{
 		.id = 0x06c8,
-		.loader_ops = bxt_get_loader_ops,
 		.init = cnl_sst_dsp_init,
 	},
 };
@@ -226,7 +191,6 @@ int skl_init_dsp(struct skl_dev *skl)
 {
 	void __iomem *mmio_base;
 	struct hdac_bus *bus = skl_to_bus(skl);
-	struct skl_dsp_loader_ops loader_ops;
 	int irq = bus->irq;
 	const struct skl_dsp_ops *ops;
 	int ret;
@@ -248,10 +212,8 @@ int skl_init_dsp(struct skl_dev *skl)
 		goto unmap_mmio;
 	}
 
-	loader_ops = ops->loader_ops();
 	ret = ops->init(bus->dev, mmio_base, irq,
-				skl->fw_name, loader_ops,
-				&skl);
+				skl->fw_name, &skl);
 
 	if (ret < 0)
 		goto unmap_mmio;
sound/soc/intel/skylake/skl-sst-dsp.h +3 -21
index 97e16a602331..9f2dae92c1c9 100644
@@ -150,22 +150,6 @@ struct skl_dsp_fw_ops {
 
 };
 
-struct skl_dsp_loader_ops {
-	int stream_tag;
-
-	int (*alloc_dma_buf)(struct device *dev,
-		struct snd_dma_buffer *dmab, size_t size);
-	int (*free_dma_buf)(struct device *dev,
-		struct snd_dma_buffer *dmab);
-	int (*prepare)(struct device *dev, unsigned int format,
-				unsigned int byte_size,
-				struct snd_dma_buffer *bufp);
-	int (*trigger)(struct device *dev, bool start, int stream_tag);
-
-	int (*cleanup)(struct device *dev, struct snd_dma_buffer *dmab,
-				 int stream_tag);
-};
-
 #define MAX_INSTANCE_BUFF 2
 
 struct uuid_module {
@@ -227,11 +211,9 @@ int skl_dsp_put_core(struct sst_dsp *ctx, unsigned int core_id);
 
 int skl_dsp_boot(struct sst_dsp *ctx);
 int skl_sst_dsp_init(struct device *dev, void __iomem *mmio_base, int irq,
-		const char *fw_name, struct skl_dsp_loader_ops dsp_ops,
-		struct skl_dev **dsp);
+		const char *fw_name, struct skl_dev **dsp);
 int bxt_sst_dsp_init(struct device *dev, void __iomem *mmio_base, int irq,
-		const char *fw_name, struct skl_dsp_loader_ops dsp_ops,
-		struct skl_dev **dsp);
+		const char *fw_name, struct skl_dev **dsp);
 int bxt_load_library(struct sst_dsp *ctx, struct skl_lib_info *linfo,
 		int lib_count);
 
@@ -248,7 +230,7 @@ int skl_dsp_strip_extended_manifest(struct firmware *fw);
 void skl_dsp_set_astate_cfg(struct skl_dev *skl, u32 cnt, void *data);
 
 int skl_sst_ctx_init(struct device *dev, int irq, const char *fw_name,
-		struct skl_dsp_loader_ops dsp_ops, struct skl_dev **dsp,
+		struct skl_dev **dsp,
 		struct sst_pdata *pdata);
 int skl_prepare_lib_load(struct skl_dev *skl, struct skl_lib_info *linfo,
 			struct firmware *stripped_fw,
sound/soc/intel/skylake/skl-sst-utils.c +1 -2
index 8e03a10855c4..bbe67e298efe 100644
@@ -355,7 +355,7 @@ int skl_dsp_strip_extended_manifest(struct firmware *fw)
 }
 
 int skl_sst_ctx_init(struct device *dev, int irq, const char *fw_name,
-	struct skl_dsp_loader_ops dsp_ops, struct skl_dev **dsp,
+	struct skl_dev **dsp,
 	struct sst_pdata *pdata)
 {
 	struct skl_dev *skl = *dsp;
@@ -375,7 +375,6 @@ int skl_sst_ctx_init(struct device *dev, int irq, const char *fw_name,
 
 	sst = skl->dsp;
 	sst->fw_name = fw_name;
-	sst->dsp_ops = dsp_ops;
 	init_waitqueue_head(&skl->mod_load_wait);
 	INIT_LIST_HEAD(&sst->module_list);
 
sound/soc/intel/skylake/skl-sst.c +2 -3
index 6bb003add9e2..e9a7b2509b35 100644
@@ -517,14 +517,13 @@ static struct sst_pdata skl_dev = {
 };
 
 int skl_sst_dsp_init(struct device *dev, void __iomem *mmio_base, int irq,
-		const char *fw_name, struct skl_dsp_loader_ops dsp_ops,
-		struct skl_dev **dsp)
+		const char *fw_name, struct skl_dev **dsp)
 {
 	struct skl_dev *skl;
 	struct sst_dsp *sst;
 	int ret;
 
-	ret = skl_sst_ctx_init(dev, irq, fw_name, dsp_ops, dsp, &skl_dev);
+	ret = skl_sst_ctx_init(dev, irq, fw_name, dsp, &skl_dev);
 	if (ret < 0) {
 		dev_err(dev, "%s: no device\n", __func__);
 		return ret;
sound/soc/intel/skylake/skl.h +0 -2
index 62e2f2d450e4..beeef67cb55f 100644
@@ -155,10 +155,8 @@ struct skl_machine_pdata {
 
 struct skl_dsp_ops {
 	int id;
-	struct skl_dsp_loader_ops (*loader_ops)(void);
 	int (*init)(struct device *dev, void __iomem *mmio_base,
 			int irq, const char *fw_name,
-			struct skl_dsp_loader_ops loader_ops,
 			struct skl_dev **skl_sst);
 };
 
Signature · 1 line
2.17.1
#36 lore raw

Re: [PATCH 17/35] ASoC: Intel: Skylake: Remove skl_dsp_loader_ops

Quoted 2 lines · Cezary Rojewski

With all fields deprecated, yet another struct can be removed. Let's do so and don't forget about any functions or fields tied to its existence.

SKL/KBL and all others have different firmware loading mechanisms, so now how is the difference handled?

Quoted 286 lines
---
  sound/soc/intel/common/sst-dsp-priv.h   |  1 -
  sound/soc/intel/skylake/bxt-sst.c       |  5 ++--
  sound/soc/intel/skylake/cnl-sst-dsp.h   |  3 +-
  sound/soc/intel/skylake/cnl-sst.c       |  5 ++--
  sound/soc/intel/skylake/skl-messages.c  | 40 +------------------------
  sound/soc/intel/skylake/skl-sst-dsp.h   | 24 ++-------------
  sound/soc/intel/skylake/skl-sst-utils.c |  3 +-
  sound/soc/intel/skylake/skl-sst.c       |  5 ++--
  sound/soc/intel/skylake/skl.h           |  2 --
  9 files changed, 12 insertions(+), 76 deletions(-)
sound/soc/intel/common/sst-dsp-priv.h +0 -1
index 8a7009937d59..0fe9bebcfb38 100644
@@ -306,7 +306,6 @@ struct sst_dsp {
  	const char *fw_name;
 
  	/* To allocate CL dma buffers */
-	struct skl_dsp_loader_ops dsp_ops;
  	struct skl_dsp_fw_ops fw_ops;
  	int sst_state;
  	struct skl_cl_dev cl_dev;
sound/soc/intel/skylake/bxt-sst.c +2 -3
index 45da02f74f4d..c7961050c2ee 100644
@@ -546,14 +546,13 @@ static struct sst_pdata skl_dev = {
  };
 
  int bxt_sst_dsp_init(struct device *dev, void __iomem *mmio_base, int irq,
-			const char *fw_name, struct skl_dsp_loader_ops dsp_ops,
-			struct skl_dev **dsp)
+			const char *fw_name, struct skl_dev **dsp)
  {
  	struct skl_dev *skl;
  	struct sst_dsp *sst;
  	int ret;
 
-	ret = skl_sst_ctx_init(dev, irq, fw_name, dsp_ops, dsp, &skl_dev);
+	ret = skl_sst_ctx_init(dev, irq, fw_name, dsp, &skl_dev);
  	if (ret < 0) {
  		dev_err(dev, "%s: no device\n", __func__);
  		return ret;
sound/soc/intel/skylake/cnl-sst-dsp.h +1 -2
index 30b586acc858..70da4f312f53 100644
@@ -94,7 +94,6 @@ void cnl_ipc_op_int_disable(struct sst_dsp *ctx);
  bool cnl_ipc_int_status(struct sst_dsp *ctx);
 
  int cnl_sst_dsp_init(struct device *dev, void __iomem *mmio_base, int irq,
-		     const char *fw_name, struct skl_dsp_loader_ops dsp_ops,
-		     struct skl_dev **dsp);
+		     const char *fw_name, struct skl_dev **dsp);
 
  #endif /*__CNL_SST_DSP_H__*/
sound/soc/intel/skylake/cnl-sst.c +2 -3
index 4d9a4d5886f4..2f10076cc906 100644
@@ -423,14 +423,13 @@ static struct sst_pdata cnl_dev = {
  };
 
  int cnl_sst_dsp_init(struct device *dev, void __iomem *mmio_base, int irq,
-		     const char *fw_name, struct skl_dsp_loader_ops dsp_ops,
-		     struct skl_dev **dsp)
+		     const char *fw_name, struct skl_dev **dsp)
  {
  	struct skl_dev *cnl;
  	struct sst_dsp *sst;
  	int ret;
 
-	ret = skl_sst_ctx_init(dev, irq, fw_name, dsp_ops, dsp, &cnl_dev);
+	ret = skl_sst_ctx_init(dev, irq, fw_name, dsp, &cnl_dev);
  	if (ret < 0) {
  		dev_err(dev, "%s: no device\n", __func__);
  		return ret;
sound/soc/intel/skylake/skl-messages.c +1 -39
index 20ab980fe8a1..6fbceec67b53 100644
@@ -140,72 +140,37 @@ int skl_dsp_cleanup(struct device *dev,
  	return 0;
  }
 
-static struct skl_dsp_loader_ops skl_get_loader_ops(void)
-{
-	struct skl_dsp_loader_ops loader_ops;
-
-	memset(&loader_ops, 0, sizeof(struct skl_dsp_loader_ops));
-
-	loader_ops.alloc_dma_buf = skl_alloc_dma_buf;
-	loader_ops.free_dma_buf = skl_free_dma_buf;
-
-	return loader_ops;
-};
-
-static struct skl_dsp_loader_ops bxt_get_loader_ops(void)
-{
-	struct skl_dsp_loader_ops loader_ops;
-
-	memset(&loader_ops, 0, sizeof(loader_ops));
-
-	loader_ops.alloc_dma_buf = skl_alloc_dma_buf;
-	loader_ops.free_dma_buf = skl_free_dma_buf;
-	loader_ops.prepare = skl_dsp_prepare;
-	loader_ops.trigger = skl_dsp_trigger;
-	loader_ops.cleanup = skl_dsp_cleanup;
-
-	return loader_ops;
-};
-
  static const struct skl_dsp_ops dsp_ops[] = {
  	{
  		.id = 0x9d70,
-		.loader_ops = skl_get_loader_ops,
  		.init = skl_sst_dsp_init,
  	},
  	{
  		.id = 0x9d71,
-		.loader_ops = skl_get_loader_ops,
  		.init = skl_sst_dsp_init,
  	},
  	{
  		.id = 0x5a98,
-		.loader_ops = bxt_get_loader_ops,
  		.init = bxt_sst_dsp_init,
  	},
  	{
  		.id = 0x3198,
-		.loader_ops = bxt_get_loader_ops,
  		.init = bxt_sst_dsp_init,
  	},
  	{
  		.id = 0x9dc8,
-		.loader_ops = bxt_get_loader_ops,
  		.init = cnl_sst_dsp_init,
  	},
  	{
  		.id = 0xa348,
-		.loader_ops = bxt_get_loader_ops,
  		.init = cnl_sst_dsp_init,
  	},
  	{
  		.id = 0x02c8,
-		.loader_ops = bxt_get_loader_ops,
  		.init = cnl_sst_dsp_init,
  	},
  	{
  		.id = 0x06c8,
-		.loader_ops = bxt_get_loader_ops,
  		.init = cnl_sst_dsp_init,
  	},
  };
@@ -226,7 +191,6 @@ int skl_init_dsp(struct skl_dev *skl)
  {
  	void __iomem *mmio_base;
  	struct hdac_bus *bus = skl_to_bus(skl);
-	struct skl_dsp_loader_ops loader_ops;
  	int irq = bus->irq;
  	const struct skl_dsp_ops *ops;
  	int ret;
@@ -248,10 +212,8 @@ int skl_init_dsp(struct skl_dev *skl)
  		goto unmap_mmio;
  	}
 
-	loader_ops = ops->loader_ops();
  	ret = ops->init(bus->dev, mmio_base, irq,
-				skl->fw_name, loader_ops,
-				&skl);
+				skl->fw_name, &skl);
 
  	if (ret < 0)
  		goto unmap_mmio;
sound/soc/intel/skylake/skl-sst-dsp.h +3 -21
index 97e16a602331..9f2dae92c1c9 100644
@@ -150,22 +150,6 @@ struct skl_dsp_fw_ops {
 
  };
 
-struct skl_dsp_loader_ops {
-	int stream_tag;
-
-	int (*alloc_dma_buf)(struct device *dev,
-		struct snd_dma_buffer *dmab, size_t size);
-	int (*free_dma_buf)(struct device *dev,
-		struct snd_dma_buffer *dmab);
-	int (*prepare)(struct device *dev, unsigned int format,
-				unsigned int byte_size,
-				struct snd_dma_buffer *bufp);
-	int (*trigger)(struct device *dev, bool start, int stream_tag);
-
-	int (*cleanup)(struct device *dev, struct snd_dma_buffer *dmab,
-				 int stream_tag);
-};
-
  #define MAX_INSTANCE_BUFF 2
 
  struct uuid_module {
@@ -227,11 +211,9 @@ int skl_dsp_put_core(struct sst_dsp *ctx, unsigned int core_id);
 
  int skl_dsp_boot(struct sst_dsp *ctx);
  int skl_sst_dsp_init(struct device *dev, void __iomem *mmio_base, int irq,
-		const char *fw_name, struct skl_dsp_loader_ops dsp_ops,
-		struct skl_dev **dsp);
+		const char *fw_name, struct skl_dev **dsp);
  int bxt_sst_dsp_init(struct device *dev, void __iomem *mmio_base, int irq,
-		const char *fw_name, struct skl_dsp_loader_ops dsp_ops,
-		struct skl_dev **dsp);
+		const char *fw_name, struct skl_dev **dsp);
  int bxt_load_library(struct sst_dsp *ctx, struct skl_lib_info *linfo,
  		int lib_count);
 
@@ -248,7 +230,7 @@ int skl_dsp_strip_extended_manifest(struct firmware *fw);
  void skl_dsp_set_astate_cfg(struct skl_dev *skl, u32 cnt, void *data);
 
  int skl_sst_ctx_init(struct device *dev, int irq, const char *fw_name,
-		struct skl_dsp_loader_ops dsp_ops, struct skl_dev **dsp,
+		struct skl_dev **dsp,
  		struct sst_pdata *pdata);
  int skl_prepare_lib_load(struct skl_dev *skl, struct skl_lib_info *linfo,
  			struct firmware *stripped_fw,
sound/soc/intel/skylake/skl-sst-utils.c +1 -2
index 8e03a10855c4..bbe67e298efe 100644
@@ -355,7 +355,7 @@ int skl_dsp_strip_extended_manifest(struct firmware *fw)
  }
 
  int skl_sst_ctx_init(struct device *dev, int irq, const char *fw_name,
-	struct skl_dsp_loader_ops dsp_ops, struct skl_dev **dsp,
+	struct skl_dev **dsp,
  	struct sst_pdata *pdata)
  {
  	struct skl_dev *skl = *dsp;
@@ -375,7 +375,6 @@ int skl_sst_ctx_init(struct device *dev, int irq, const char *fw_name,
 
  	sst = skl->dsp;
  	sst->fw_name = fw_name;
-	sst->dsp_ops = dsp_ops;
  	init_waitqueue_head(&skl->mod_load_wait);
  	INIT_LIST_HEAD(&sst->module_list);
 
sound/soc/intel/skylake/skl-sst.c +2 -3
index 6bb003add9e2..e9a7b2509b35 100644
@@ -517,14 +517,13 @@ static struct sst_pdata skl_dev = {
  };
 
  int skl_sst_dsp_init(struct device *dev, void __iomem *mmio_base, int irq,
-		const char *fw_name, struct skl_dsp_loader_ops dsp_ops,
-		struct skl_dev **dsp)
+		const char *fw_name, struct skl_dev **dsp)
  {
  	struct skl_dev *skl;
  	struct sst_dsp *sst;
  	int ret;
 
-	ret = skl_sst_ctx_init(dev, irq, fw_name, dsp_ops, dsp, &skl_dev);
+	ret = skl_sst_ctx_init(dev, irq, fw_name, dsp, &skl_dev);
  	if (ret < 0) {
  		dev_err(dev, "%s: no device\n", __func__);
  		return ret;
sound/soc/intel/skylake/skl.h +0 -2
index 62e2f2d450e4..beeef67cb55f 100644
@@ -155,10 +155,8 @@ struct skl_machine_pdata {
 
  struct skl_dsp_ops {
  	int id;
-	struct skl_dsp_loader_ops (*loader_ops)(void);
  	int (*init)(struct device *dev, void __iomem *mmio_base,
  			int irq, const char *fw_name,
-			struct skl_dsp_loader_ops loader_ops,
  			struct skl_dev **skl_sst);
  };
 
author maintainer
#37 lore raw

Re: [PATCH 17/35] ASoC: Intel: Skylake: Remove skl_dsp_loader_ops

Quoted 8 lines · Pierre-Louis Bossart
Quoted 2 lines · Cezary Rojewski

With all fields deprecated, yet another struct can be removed. Let's do so and don't forget about any functions or fields tied to its existence.

SKL/KBL and all others have different firmware loading mechanisms, so now how is the difference handled?

skl_dsp_fw_ops::load_fw / load_library and friends.
skl-sst.c holds control over CL_DMA (which is implemented in separated _cldma files within /skylake) loading mechanism while struct that is being removed here - skl_dsp_loader_ops - has been used for APL/ CNL only. The SKL equivalent is a stub -> alloc_dma_buf / free_dma_buf which are shared across all platforms.

It's quite obvious that with proper design one does not need 12 functions and that many types to handle just the loading process. Removal of these has also learning value - anyone coming to help us with /skylake quickly hits the unreadability wall. Clearer the code, lower the learning curve.

Quoted 259 lines
Quoted 259 lines

---
  sound/soc/intel/common/sst-dsp-priv.h   |  1 - sound/soc/intel/skylake/bxt-sst.c       |  5 ++-- sound/soc/intel/skylake/cnl-sst-dsp.h   |  3 +- sound/soc/intel/skylake/cnl-sst.c       |  5 ++-- sound/soc/intel/skylake/skl-messages.c  | 40 +------------------------ sound/soc/intel/skylake/skl-sst-dsp.h   | 24 ++------------- sound/soc/intel/skylake/skl-sst-utils.c |  3 +- sound/soc/intel/skylake/skl-sst.c       |  5 ++-- sound/soc/intel/skylake/skl.h           |  2 --

  9 files changed, 12 insertions(+), 76 deletions(-)
sound/soc/intel/common/sst-dsp-priv.h +0 -1
index 8a7009937d59..0fe9bebcfb38 100644
@@ -306,7 +306,6 @@ struct sst_dsp {
       const char *fw_name;
       /* To allocate CL dma buffers */
-    struct skl_dsp_loader_ops dsp_ops;
       struct skl_dsp_fw_ops fw_ops;
       int sst_state;
       struct skl_cl_dev cl_dev;
sound/soc/intel/skylake/bxt-sst.c +2 -3
index 45da02f74f4d..c7961050c2ee 100644
@@ -546,14 +546,13 @@ static struct sst_pdata skl_dev = {
   };
   int bxt_sst_dsp_init(struct device *dev, void __iomem *mmio_base, int irq,
-            const char *fw_name, struct skl_dsp_loader_ops dsp_ops,
-            struct skl_dev **dsp)
+            const char *fw_name, struct skl_dev **dsp)
   {
       struct skl_dev *skl;
       struct sst_dsp *sst;
       int ret;
-    ret = skl_sst_ctx_init(dev, irq, fw_name, dsp_ops, dsp, &skl_dev);
+    ret = skl_sst_ctx_init(dev, irq, fw_name, dsp, &skl_dev);
       if (ret < 0) {
           dev_err(dev, "%s: no device\n", __func__);
           return ret;
sound/soc/intel/skylake/cnl-sst-dsp.h +1 -2
index 30b586acc858..70da4f312f53 100644
@@ -94,7 +94,6 @@ void cnl_ipc_op_int_disable(struct sst_dsp *ctx);
   bool cnl_ipc_int_status(struct sst_dsp *ctx);
   int cnl_sst_dsp_init(struct device *dev, void __iomem *mmio_base, int irq,
-             const char *fw_name, struct skl_dsp_loader_ops dsp_ops,
-             struct skl_dev **dsp);
+             const char *fw_name, struct skl_dev **dsp);
   #endif /*__CNL_SST_DSP_H__*/
sound/soc/intel/skylake/cnl-sst.c +2 -3
index 4d9a4d5886f4..2f10076cc906 100644
@@ -423,14 +423,13 @@ static struct sst_pdata cnl_dev = {
   };
   int cnl_sst_dsp_init(struct device *dev, void __iomem *mmio_base, int irq,
-             const char *fw_name, struct skl_dsp_loader_ops dsp_ops,
-             struct skl_dev **dsp)
+             const char *fw_name, struct skl_dev **dsp)
   {
       struct skl_dev *cnl;
       struct sst_dsp *sst;
       int ret;
-    ret = skl_sst_ctx_init(dev, irq, fw_name, dsp_ops, dsp, &cnl_dev);
+    ret = skl_sst_ctx_init(dev, irq, fw_name, dsp, &cnl_dev);
       if (ret < 0) {
           dev_err(dev, "%s: no device\n", __func__);
           return ret;
sound/soc/intel/skylake/skl-messages.c +1 -39
index 20ab980fe8a1..6fbceec67b53 100644
@@ -140,72 +140,37 @@ int skl_dsp_cleanup(struct device *dev,
       return 0;
   }
-static struct skl_dsp_loader_ops skl_get_loader_ops(void)
-{
-    struct skl_dsp_loader_ops loader_ops;
-
-    memset(&loader_ops, 0, sizeof(struct skl_dsp_loader_ops));
-
-    loader_ops.alloc_dma_buf = skl_alloc_dma_buf;
-    loader_ops.free_dma_buf = skl_free_dma_buf;
-
-    return loader_ops;
-};
-
-static struct skl_dsp_loader_ops bxt_get_loader_ops(void)
-{
-    struct skl_dsp_loader_ops loader_ops;
-
-    memset(&loader_ops, 0, sizeof(loader_ops));
-
-    loader_ops.alloc_dma_buf = skl_alloc_dma_buf;
-    loader_ops.free_dma_buf = skl_free_dma_buf;
-    loader_ops.prepare = skl_dsp_prepare;
-    loader_ops.trigger = skl_dsp_trigger;
-    loader_ops.cleanup = skl_dsp_cleanup;
-
-    return loader_ops;
-};
-
   static const struct skl_dsp_ops dsp_ops[] = {
       {
           .id = 0x9d70,
-        .loader_ops = skl_get_loader_ops,
           .init = skl_sst_dsp_init,
       },
       {
           .id = 0x9d71,
-        .loader_ops = skl_get_loader_ops,
           .init = skl_sst_dsp_init,
       },
       {
           .id = 0x5a98,
-        .loader_ops = bxt_get_loader_ops,
           .init = bxt_sst_dsp_init,
       },
       {
           .id = 0x3198,
-        .loader_ops = bxt_get_loader_ops,
           .init = bxt_sst_dsp_init,
       },
       {
           .id = 0x9dc8,
-        .loader_ops = bxt_get_loader_ops,
           .init = cnl_sst_dsp_init,
       },
       {
           .id = 0xa348,
-        .loader_ops = bxt_get_loader_ops,
           .init = cnl_sst_dsp_init,
       },
       {
           .id = 0x02c8,
-        .loader_ops = bxt_get_loader_ops,
           .init = cnl_sst_dsp_init,
       },
       {
           .id = 0x06c8,
-        .loader_ops = bxt_get_loader_ops,
           .init = cnl_sst_dsp_init,
       },
   };
@@ -226,7 +191,6 @@ int skl_init_dsp(struct skl_dev *skl)
   {
       void __iomem *mmio_base;
       struct hdac_bus *bus = skl_to_bus(skl);
-    struct skl_dsp_loader_ops loader_ops;
       int irq = bus->irq;
       const struct skl_dsp_ops *ops;
       int ret;
@@ -248,10 +212,8 @@ int skl_init_dsp(struct skl_dev *skl)
           goto unmap_mmio;
       }
-    loader_ops = ops->loader_ops();
       ret = ops->init(bus->dev, mmio_base, irq,
-                skl->fw_name, loader_ops,
-                &skl);
+                skl->fw_name, &skl);
       if (ret < 0)
           goto unmap_mmio;
sound/soc/intel/skylake/skl-sst-dsp.h +3 -21
index 97e16a602331..9f2dae92c1c9 100644
@@ -150,22 +150,6 @@ struct skl_dsp_fw_ops {
   };
-struct skl_dsp_loader_ops {
-    int stream_tag;
-
-    int (*alloc_dma_buf)(struct device *dev,
-        struct snd_dma_buffer *dmab, size_t size);
-    int (*free_dma_buf)(struct device *dev,
-        struct snd_dma_buffer *dmab);
-    int (*prepare)(struct device *dev, unsigned int format,
-                unsigned int byte_size,
-                struct snd_dma_buffer *bufp);
-    int (*trigger)(struct device *dev, bool start, int stream_tag);
-
-    int (*cleanup)(struct device *dev, struct snd_dma_buffer *dmab,
-                 int stream_tag);
-};
-
   #define MAX_INSTANCE_BUFF 2
   struct uuid_module {
@@ -227,11 +211,9 @@ int skl_dsp_put_core(struct sst_dsp *ctx, 
 unsigned int core_id);
   int skl_dsp_boot(struct sst_dsp *ctx);
   int skl_sst_dsp_init(struct device *dev, void __iomem *mmio_base, int irq,
-        const char *fw_name, struct skl_dsp_loader_ops dsp_ops,
-        struct skl_dev **dsp);
+        const char *fw_name, struct skl_dev **dsp);
   int bxt_sst_dsp_init(struct device *dev, void __iomem *mmio_base, int irq,
-        const char *fw_name, struct skl_dsp_loader_ops dsp_ops,
-        struct skl_dev **dsp);
+        const char *fw_name, struct skl_dev **dsp);
   int bxt_load_library(struct sst_dsp *ctx, struct skl_lib_info *linfo,
           int lib_count);
@@ -248,7 +230,7 @@ int skl_dsp_strip_extended_manifest(struct 
 firmware *fw);
   void skl_dsp_set_astate_cfg(struct skl_dev *skl, u32 cnt, void *data);
   int skl_sst_ctx_init(struct device *dev, int irq, const char *fw_name,
-        struct skl_dsp_loader_ops dsp_ops, struct skl_dev **dsp,
+        struct skl_dev **dsp,
           struct sst_pdata *pdata);
   int skl_prepare_lib_load(struct skl_dev *skl, struct skl_lib_info *linfo,
               struct firmware *stripped_fw,
sound/soc/intel/skylake/skl-sst-utils.c +1 -2
index 8e03a10855c4..bbe67e298efe 100644
@@ -355,7 +355,7 @@ int skl_dsp_strip_extended_manifest(struct 
 firmware *fw)
   }
   int skl_sst_ctx_init(struct device *dev, int irq, const char *fw_name,
-    struct skl_dsp_loader_ops dsp_ops, struct skl_dev **dsp,
+    struct skl_dev **dsp,
       struct sst_pdata *pdata)
   {
       struct skl_dev *skl = *dsp;
@@ -375,7 +375,6 @@ int skl_sst_ctx_init(struct device *dev, int irq, 
 const char *fw_name,
       sst = skl->dsp;
       sst->fw_name = fw_name;
-    sst->dsp_ops = dsp_ops;
       init_waitqueue_head(&skl->mod_load_wait);
       INIT_LIST_HEAD(&sst->module_list);
sound/soc/intel/skylake/skl-sst.c +2 -3
index 6bb003add9e2..e9a7b2509b35 100644
@@ -517,14 +517,13 @@ static struct sst_pdata skl_dev = {
   };
   int skl_sst_dsp_init(struct device *dev, void __iomem *mmio_base, int irq,
-        const char *fw_name, struct skl_dsp_loader_ops dsp_ops,
-        struct skl_dev **dsp)
+        const char *fw_name, struct skl_dev **dsp)
   {
       struct skl_dev *skl;
       struct sst_dsp *sst;
       int ret;
-    ret = skl_sst_ctx_init(dev, irq, fw_name, dsp_ops, dsp, &skl_dev);
+    ret = skl_sst_ctx_init(dev, irq, fw_name, dsp, &skl_dev);
       if (ret < 0) {
           dev_err(dev, "%s: no device\n", __func__);
           return ret;
sound/soc/intel/skylake/skl.h +0 -0
index 62e2f2d450e4..beeef67cb55f 100644
@@ -155,10 +155,8 @@ struct skl_machine_pdata {
   struct skl_dsp_ops {
Quoted 8 lines

sound/soc/intel/skylake/skl.h struct skl_machine_pdata { · line 162

Quoted 8 lines
sound/soc/intel/skylake/skl.h +0 -2
       int id;
-    struct skl_dsp_loader_ops (*loader_ops)(void);
       int (*init)(struct device *dev, void __iomem *mmio_base,
               int irq, const char *fw_name,
-            struct skl_dsp_loader_ops loader_ops,
               struct skl_dev **skl_sst);
   };
 

_______________________________________________
Alsa-devel mailing list
[email protected]
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

author maintainer
#38 lore raw

PATCH 18/35 ASoC: Intel: Skylake: Remove window0 sst_addr fields

In reply to Cezary Rojewski

w0_stat_sz and w0_up_sz are Skylake-specific fields and should not be part of common sst framework. The latter is also completely unused. Remove both while declaring global FW register-area size, shared for all SKL+ platforms.

---
 sound/soc/intel/common/sst-dsp-priv.h | 2 --
 sound/soc/intel/skylake/bxt-sst.c     | 2 --
 sound/soc/intel/skylake/cnl-sst.c     | 2 --
 sound/soc/intel/skylake/skl-debug.c   | 2 +-
 sound/soc/intel/skylake/skl-sst-dsp.h | 1 +
 sound/soc/intel/skylake/skl-sst.c     | 2 --
 6 files changed, 2 insertions(+), 9 deletions(-)
sound/soc/intel/common/sst-dsp-priv.h +0 -2
index 0fe9bebcfb38..53dcd87bab44 100644
@@ -71,8 +71,6 @@ struct sst_addr {
 	u32 dsp_dram_offset;
 	u32 sram0_base;
 	u32 sram1_base;
-	u32 w0_stat_sz;
-	u32 w0_up_sz;
 	void __iomem *lpe;
 	void __iomem *shim;
 	void __iomem *pci_cfg;
sound/soc/intel/skylake/bxt-sst.c +0 -2
index c7961050c2ee..641d5cf4aeb1 100644
@@ -565,8 +565,6 @@ int bxt_sst_dsp_init(struct device *dev, void __iomem *mmio_base, int irq,
 	sst->addr.shim = mmio_base;
 	sst->addr.sram0_base = BXT_ADSP_SRAM0_BASE;
 	sst->addr.sram1_base = BXT_ADSP_SRAM1_BASE;
-	sst->addr.w0_stat_sz = SKL_ADSP_W0_STAT_SZ;
-	sst->addr.w0_up_sz = SKL_ADSP_W0_UP_SZ;
 
 	sst_dsp_mailbox_init(sst, (BXT_ADSP_SRAM0_BASE + SKL_ADSP_W0_STAT_SZ),
 			SKL_ADSP_W0_UP_SZ, BXT_ADSP_SRAM1_BASE, SKL_ADSP_W1_SZ);
sound/soc/intel/skylake/cnl-sst.c +0 -2
index 2f10076cc906..64971966af38 100644
@@ -442,8 +442,6 @@ int cnl_sst_dsp_init(struct device *dev, void __iomem *mmio_base, int irq,
 	sst->addr.shim = mmio_base;
 	sst->addr.sram0_base = CNL_ADSP_SRAM0_BASE;
 	sst->addr.sram1_base = CNL_ADSP_SRAM1_BASE;
-	sst->addr.w0_stat_sz = CNL_ADSP_W0_STAT_SZ;
-	sst->addr.w0_up_sz = CNL_ADSP_W0_UP_SZ;
 
 	sst_dsp_mailbox_init(sst, (CNL_ADSP_SRAM0_BASE + CNL_ADSP_W0_STAT_SZ),
 			     CNL_ADSP_W0_UP_SZ, CNL_ADSP_SRAM1_BASE,
sound/soc/intel/skylake/skl-debug.c +1 -1
index 212370bf704c..6781eac13232 100644
@@ -173,7 +173,7 @@ static ssize_t fw_softreg_read(struct file *file, char __user *user_buf,
 {
 	struct skl_debug *d = file->private_data;
 	struct sst_dsp *sst = d->skl->dsp;
-	size_t w0_stat_sz = sst->addr.w0_stat_sz;
+	size_t w0_stat_sz = SKL_FW_REGS_SIZE;
 	void __iomem *in_base = sst->mailbox.in_base;
 	void __iomem *fw_reg_addr;
 	unsigned int offset;
sound/soc/intel/skylake/skl-sst-dsp.h +1 -0
index 9f2dae92c1c9..5a0cb7f3d57e 100644
@@ -63,6 +63,7 @@ struct skl_dev;
 
 #define SKL_ADSP_W1_SZ			0x1000
 
+#define SKL_FW_REGS_SIZE		PAGE_SIZE
 #define SKL_FW_STS_MASK			0xf
 
 #define SKL_FW_INIT			0x1
sound/soc/intel/skylake/skl-sst.c +0 -2
index e9a7b2509b35..7e63c91cea54 100644
@@ -535,8 +535,6 @@ int skl_sst_dsp_init(struct device *dev, void __iomem *mmio_base, int irq,
 	sst->addr.shim = mmio_base;
 	sst->addr.sram0_base = SKL_ADSP_SRAM0_BASE;
 	sst->addr.sram1_base = SKL_ADSP_SRAM1_BASE;
-	sst->addr.w0_stat_sz = SKL_ADSP_W0_STAT_SZ;
-	sst->addr.w0_up_sz = SKL_ADSP_W0_UP_SZ;
 
 	sst_dsp_mailbox_init(sst, (SKL_ADSP_SRAM0_BASE + SKL_ADSP_W0_STAT_SZ),
 			SKL_ADSP_W0_UP_SZ, SKL_ADSP_SRAM1_BASE, SKL_ADSP_W1_SZ);
Signature · 1 line
2.17.1
#39 lore raw

Re: [PATCH 18/35] ASoC: Intel: Skylake: Remove window0 sst_addr fields

Quoted 33 lines · Cezary Rojewski

w0_stat_sz and w0_up_sz are Skylake-specific fields and should not be part of common sst framework. The latter is also completely unused. Remove both while declaring global FW register-area size, shared for all SKL+ platforms.

---
  sound/soc/intel/common/sst-dsp-priv.h | 2 --
  sound/soc/intel/skylake/bxt-sst.c     | 2 --
  sound/soc/intel/skylake/cnl-sst.c     | 2 --
  sound/soc/intel/skylake/skl-debug.c   | 2 +-
  sound/soc/intel/skylake/skl-sst-dsp.h | 1 +
  sound/soc/intel/skylake/skl-sst.c     | 2 --
  6 files changed, 2 insertions(+), 9 deletions(-)
sound/soc/intel/common/sst-dsp-priv.h +0 -2
index 0fe9bebcfb38..53dcd87bab44 100644
@@ -71,8 +71,6 @@ struct sst_addr {
  	u32 dsp_dram_offset;
  	u32 sram0_base;
  	u32 sram1_base;
-	u32 w0_stat_sz;
-	u32 w0_up_sz;
  	void __iomem *lpe;
  	void __iomem *shim;
  	void __iomem *pci_cfg;
sound/soc/intel/skylake/bxt-sst.c +0 -0
index c7961050c2ee..641d5cf4aeb1 100644

sound/soc/intel/skylake/bxt-sst.c int bxt_sst_dsp_init(struct device *dev, void __iomem *mmio_base, int irq, · line 570

Quoted 8 lines
sound/soc/intel/skylake/bxt-sst.c +0 -2
@@ -565,8 +565,6 @@ int bxt_sst_dsp_init(struct device *dev, void __iomem *mmio_base, int irq,
  	sst->addr.shim = mmio_base;
  	sst->addr.sram0_base = BXT_ADSP_SRAM0_BASE;
  	sst->addr.sram1_base = BXT_ADSP_SRAM1_BASE;
-	sst->addr.w0_stat_sz = SKL_ADSP_W0_STAT_SZ;
-	sst->addr.w0_up_sz = SKL_ADSP_W0_UP_SZ;
 
  	sst_dsp_mailbox_init(sst, (BXT_ADSP_SRAM0_BASE + SKL_ADSP_W0_STAT_SZ),
  			SKL_ADSP_W0_UP_SZ, BXT_ADSP_SRAM1_BASE, SKL_ADSP_W1_SZ);

You are still using a SKL specific macro here...

sound/soc/intel/skylake/cnl-sst.c int cnl_sst_dsp_init(struct device *dev, void __iomem *mmio_base, int irq, · line 447

Quoted 13 lines
sound/soc/intel/skylake/cnl-sst.c +0 -2
index 2f10076cc906..64971966af38 100644
@@ -442,8 +442,6 @@ int cnl_sst_dsp_init(struct device *dev, void __iomem *mmio_base, int irq,
  	sst->addr.shim = mmio_base;
  	sst->addr.sram0_base = CNL_ADSP_SRAM0_BASE;
  	sst->addr.sram1_base = CNL_ADSP_SRAM1_BASE;
-	sst->addr.w0_stat_sz = CNL_ADSP_W0_STAT_SZ;
-	sst->addr.w0_up_sz = CNL_ADSP_W0_UP_SZ;
 
  	sst_dsp_mailbox_init(sst, (CNL_ADSP_SRAM0_BASE + CNL_ADSP_W0_STAT_SZ),
  			     CNL_ADSP_W0_UP_SZ, CNL_ADSP_SRAM1_BASE,

...and here...

sound/soc/intel/skylake/skl-debug.c static ssize_t fw_softreg_read(struct file *file, char __user *user_buf, · line 176

Quoted 10 lines
sound/soc/intel/skylake/skl-debug.c +1 -1
index 212370bf704c..6781eac13232 100644
@@ -173,7 +173,7 @@ static ssize_t fw_softreg_read(struct file *file, char __user *user_buf,
  {
  	struct skl_debug *d = file->private_data;
  	struct sst_dsp *sst = d->skl->dsp;
-	size_t w0_stat_sz = sst->addr.w0_stat_sz;
+	size_t w0_stat_sz = SKL_FW_REGS_SIZE;

but here it's a different macro?

Quoted 29 lines
sound/soc/intel/skylake/skl-debug.c +0 -0
  	void __iomem *in_base = sst->mailbox.in_base;
  	void __iomem *fw_reg_addr;
  	unsigned int offset;
sound/soc/intel/skylake/skl-sst-dsp.h +1 -0
index 9f2dae92c1c9..5a0cb7f3d57e 100644
@@ -63,6 +63,7 @@ struct skl_dev;
 
  #define SKL_ADSP_W1_SZ			0x1000
 
+#define SKL_FW_REGS_SIZE		PAGE_SIZE
  #define SKL_FW_STS_MASK			0xf
 
  #define SKL_FW_INIT			0x1
sound/soc/intel/skylake/skl-sst.c +0 -2
index e9a7b2509b35..7e63c91cea54 100644
@@ -535,8 +535,6 @@ int skl_sst_dsp_init(struct device *dev, void __iomem *mmio_base, int irq,
  	sst->addr.shim = mmio_base;
  	sst->addr.sram0_base = SKL_ADSP_SRAM0_BASE;
  	sst->addr.sram1_base = SKL_ADSP_SRAM1_BASE;
-	sst->addr.w0_stat_sz = SKL_ADSP_W0_STAT_SZ;
-	sst->addr.w0_up_sz = SKL_ADSP_W0_UP_SZ;
 
  	sst_dsp_mailbox_init(sst, (SKL_ADSP_SRAM0_BASE + SKL_ADSP_W0_STAT_SZ),
  			SKL_ADSP_W0_UP_SZ, SKL_ADSP_SRAM1_BASE, SKL_ADSP_W1_SZ);
author maintainer
#40 lore raw

Re: [PATCH 18/35] ASoC: Intel: Skylake: Remove window0 sst_addr fields

Quoted 38 lines · Pierre-Louis Bossart
Quoted 35 lines · Cezary Rojewski

w0_stat_sz and w0_up_sz are Skylake-specific fields and should not be part of common sst framework. The latter is also completely unused. Remove both while declaring global FW register-area size, shared for all SKL+ platforms.

---
  sound/soc/intel/common/sst-dsp-priv.h | 2 --
  sound/soc/intel/skylake/bxt-sst.c     | 2 --
  sound/soc/intel/skylake/cnl-sst.c     | 2 --
  sound/soc/intel/skylake/skl-debug.c   | 2 +-
  sound/soc/intel/skylake/skl-sst-dsp.h | 1 +
  sound/soc/intel/skylake/skl-sst.c     | 2 --

  6 files changed, 2 insertions(+), 9 deletions(-)
sound/soc/intel/common/sst-dsp-priv.h +0 -2
index 0fe9bebcfb38..53dcd87bab44 100644
@@ -71,8 +71,6 @@ struct sst_addr {
       u32 dsp_dram_offset;
       u32 sram0_base;
       u32 sram1_base;
-    u32 w0_stat_sz;
-    u32 w0_up_sz;
       void __iomem *lpe;
       void __iomem *shim;
       void __iomem *pci_cfg;
sound/soc/intel/skylake/bxt-sst.c +0 -0
index c7961050c2ee..641d5cf4aeb1 100644
@@ -565,8 +565,6 @@ int bxt_sst_dsp_init(struct device *dev, void 
 __iomem *mmio_base, int irq,
       sst->addr.shim = mmio_base;
Quoted 9 lines

sound/soc/intel/skylake/bxt-sst.c int bxt_sst_dsp_init(struct device *dev, void __iomem *mmio_base, int irq, · line 570

Quoted 6 lines
sound/soc/intel/skylake/bxt-sst.c +0 -2
       sst->addr.sram0_base = BXT_ADSP_SRAM0_BASE;
       sst->addr.sram1_base = BXT_ADSP_SRAM1_BASE;
-    sst->addr.w0_stat_sz = SKL_ADSP_W0_STAT_SZ;
-    sst->addr.w0_up_sz = SKL_ADSP_W0_UP_SZ;
       sst_dsp_mailbox_init(sst, (BXT_ADSP_SRAM0_BASE + SKL_ADSP_W0_STAT_SZ),
               SKL_ADSP_W0_UP_SZ, BXT_ADSP_SRAM1_BASE, SKL_ADSP_W1_SZ);

You are still using a SKL specific macro here...

The following patch takes case of that. This one has only one goal: removal of two redundant fields from sst_dsp::addr (struct sst_addr).

Quoted 16 lines

sound/soc/intel/skylake/cnl-sst.c int cnl_sst_dsp_init(struct device *dev, void · line 447

Quoted 13 lines
sound/soc/intel/skylake/cnl-sst.c +0 -2
index 2f10076cc906..64971966af38 100644
@@ -442,8 +442,6 @@ int cnl_sst_dsp_init(struct device *dev, void 
 __iomem *mmio_base, int irq,
       sst->addr.shim = mmio_base;
       sst->addr.sram0_base = CNL_ADSP_SRAM0_BASE;
       sst->addr.sram1_base = CNL_ADSP_SRAM1_BASE;
-    sst->addr.w0_stat_sz = CNL_ADSP_W0_STAT_SZ;
-    sst->addr.w0_up_sz = CNL_ADSP_W0_UP_SZ;
       sst_dsp_mailbox_init(sst, (CNL_ADSP_SRAM0_BASE + CNL_ADSP_W0_STAT_SZ),
                    CNL_ADSP_W0_UP_SZ, CNL_ADSP_SRAM1_BASE,

...and here...

Quoted 14 lines

sound/soc/intel/skylake/skl-debug.c static ssize_t fw_softreg_read(struct file *file, · line 177

Quoted 11 lines
sound/soc/intel/skylake/skl-debug.c +1 -1
index 212370bf704c..6781eac13232 100644
@@ -173,7 +173,7 @@ static ssize_t fw_softreg_read(struct file *file, 
 char __user *user_buf,
   {
       struct skl_debug *d = file->private_data;
       struct sst_dsp *sst = d->skl->dsp;
-    size_t w0_stat_sz = sst->addr.w0_stat_sz;
+    size_t w0_stat_sz = SKL_FW_REGS_SIZE;

but here it's a different macro?

The following is true:
[FW_REGS][INBOX] | [OUTBOX] | [TRACES] | [PERF_COUNTERS]
- SRAM0 - - SRAM1 - - SRAM2 - - SRAM3 -

INBOX_SIZE == OUTBOX_SIZE == PAGE_SIZE
FW_REGS_SIZE == PAGE_SIZE

w0_stat == FW_REGS
w0_up == INBOX

So we come up with very simple and readable macros - two of them:
- FW_REGS_SIZE
- ADSP_MAILBOX_SIZE

and these will suffice.

Quoted 18 lines
Quoted 18 lines
sound/soc/intel/skylake/skl-debug.c +0 -0
       void __iomem *in_base = sst->mailbox.in_base;
       void __iomem *fw_reg_addr;

      unsigned int offset;

sound/soc/intel/skylake/skl-sst-dsp.h +1 -0
index 9f2dae92c1c9..5a0cb7f3d57e 100644
@@ -63,6 +63,7 @@ struct skl_dev;
   #define SKL_ADSP_W1_SZ            0x1000
+#define SKL_FW_REGS_SIZE        PAGE_SIZE
   #define SKL_FW_STS_MASK            0xf
   #define SKL_FW_INIT            0x1
sound/soc/intel/skylake/skl-sst.c +0 -0
index e9a7b2509b35..7e63c91cea54 100644
@@ -535,8 +535,6 @@ int skl_sst_dsp_init(struct device *dev, void 
 __iomem *mmio_base, int irq,
Quoted 8 lines

sound/soc/intel/skylake/skl-sst.c int skl_sst_dsp_init(struct device *dev, void __iomem *mmio_base, int irq, · line 540

Quoted 8 lines
sound/soc/intel/skylake/skl-sst.c +0 -2
       sst->addr.shim = mmio_base;
       sst->addr.sram0_base = SKL_ADSP_SRAM0_BASE;
       sst->addr.sram1_base = SKL_ADSP_SRAM1_BASE;
-    sst->addr.w0_stat_sz = SKL_ADSP_W0_STAT_SZ;
-    sst->addr.w0_up_sz = SKL_ADSP_W0_UP_SZ;
       sst_dsp_mailbox_init(sst, (SKL_ADSP_SRAM0_BASE + SKL_ADSP_W0_STAT_SZ),
               SKL_ADSP_W0_UP_SZ, SKL_ADSP_SRAM1_BASE, SKL_ADSP_W1_SZ);

_______________________________________________
Alsa-devel mailing list
[email protected]
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

author maintainer
#41 lore raw

PATCH 19/35 ASoC: Intel: Skylake: Remove redundant W0 and W1 macros

In reply to Cezary Rojewski

The existing upling, downling and FW register size macros are duplicates. Remove these and replace by global mailbox size macro - FW register-area size is represented by SKL_FW_REGS_SIZE added in precedding change.

---
 sound/soc/intel/skylake/bxt-sst.c     |  5 +++--
 sound/soc/intel/skylake/cnl-sst-dsp.h |  6 ------
 sound/soc/intel/skylake/cnl-sst.c     | 10 +++++-----
 sound/soc/intel/skylake/skl-sst-dsp.h |  7 +------
 sound/soc/intel/skylake/skl-sst-ipc.c | 12 ++++++------
 sound/soc/intel/skylake/skl-sst.c     |  5 +++--
 6 files changed, 18 insertions(+), 27 deletions(-)
sound/soc/intel/skylake/bxt-sst.c +3 -2
index 641d5cf4aeb1..fdd94711c3b4 100644
@@ -566,8 +566,9 @@ int bxt_sst_dsp_init(struct device *dev, void __iomem *mmio_base, int irq,
 	sst->addr.sram0_base = BXT_ADSP_SRAM0_BASE;
 	sst->addr.sram1_base = BXT_ADSP_SRAM1_BASE;
 
-	sst_dsp_mailbox_init(sst, (BXT_ADSP_SRAM0_BASE + SKL_ADSP_W0_STAT_SZ),
-			SKL_ADSP_W0_UP_SZ, BXT_ADSP_SRAM1_BASE, SKL_ADSP_W1_SZ);
+	sst_dsp_mailbox_init(sst,
+		(BXT_ADSP_SRAM0_BASE + SKL_FW_REGS_SIZE), SKL_MAILBOX_SIZE,
+		BXT_ADSP_SRAM1_BASE, SKL_MAILBOX_SIZE);
 
 	ret = skl_ipc_init(dev, skl);
 	if (ret) {
sound/soc/intel/skylake/cnl-sst-dsp.h +0 -6
index 70da4f312f53..a465cc42b7e8 100644
@@ -52,12 +52,6 @@ struct sst_generic_ipc;
 
 #define CNL_ADSP_MMIO_LEN		0x10000
 
-#define CNL_ADSP_W0_STAT_SZ		0x1000
-
-#define CNL_ADSP_W0_UP_SZ		0x1000
-
-#define CNL_ADSP_W1_SZ			0x1000
-
 #define CNL_FW_STS_MASK			0xf
 
 #define CNL_ADSPIC_IPC			0x1
sound/soc/intel/skylake/cnl-sst.c +5 -5
index 64971966af38..d3da23e0ef05 100644
@@ -390,8 +390,8 @@ static int cnl_ipc_init(struct device *dev, struct skl_dev *cnl)
 	ipc->dsp = cnl->dsp;
 	ipc->dev = dev;
 
-	ipc->tx_data_max_size = CNL_ADSP_W1_SZ;
-	ipc->rx_data_max_size = CNL_ADSP_W0_UP_SZ;
+	ipc->tx_data_max_size = SKL_MAILBOX_SIZE;
+	ipc->rx_data_max_size = SKL_MAILBOX_SIZE;
 
 	err = sst_ipc_init(ipc);
 	if (err)
@@ -443,9 +443,9 @@ int cnl_sst_dsp_init(struct device *dev, void __iomem *mmio_base, int irq,
 	sst->addr.sram0_base = CNL_ADSP_SRAM0_BASE;
 	sst->addr.sram1_base = CNL_ADSP_SRAM1_BASE;
 
-	sst_dsp_mailbox_init(sst, (CNL_ADSP_SRAM0_BASE + CNL_ADSP_W0_STAT_SZ),
-			     CNL_ADSP_W0_UP_SZ, CNL_ADSP_SRAM1_BASE,
-			     CNL_ADSP_W1_SZ);
+	sst_dsp_mailbox_init(sst,
+		(CNL_ADSP_SRAM0_BASE + SKL_FW_REGS_SIZE), SKL_MAILBOX_SIZE,
+		CNL_ADSP_SRAM1_BASE, SKL_MAILBOX_SIZE);
 
 	ret = cnl_ipc_init(dev, cnl);
 	if (ret) {
sound/soc/intel/skylake/skl-sst-dsp.h +1 -6
index 5a0cb7f3d57e..3c92b1d849e4 100644
@@ -57,12 +57,7 @@ struct skl_dev;
 
 #define SKL_ADSP_MMIO_LEN		0x10000
 
-#define SKL_ADSP_W0_STAT_SZ		0x1000
-
-#define SKL_ADSP_W0_UP_SZ		0x1000
-
-#define SKL_ADSP_W1_SZ			0x1000
-
+#define SKL_MAILBOX_SIZE		PAGE_SIZE
 #define SKL_FW_REGS_SIZE		PAGE_SIZE
 #define SKL_FW_STS_MASK			0xf
 
sound/soc/intel/skylake/skl-sst-ipc.c +6 -6
index 2700f882103d..72d7284d2fff 100644
@@ -606,8 +606,8 @@ int skl_ipc_init(struct device *dev, struct skl_dev *skl)
 	ipc->dsp = skl->dsp;
 	ipc->dev = dev;
 
-	ipc->tx_data_max_size = SKL_ADSP_W1_SZ;
-	ipc->rx_data_max_size = SKL_ADSP_W0_UP_SZ;
+	ipc->tx_data_max_size = SKL_MAILBOX_SIZE;
+	ipc->rx_data_max_size = SKL_MAILBOX_SIZE;
 
 	err = sst_ipc_init(ipc);
 	if (err)
@@ -922,8 +922,8 @@ int skl_ipc_set_large_config(struct sst_generic_ipc *ipc,
 	sz_remaining = msg->param_data_size;
 	data_offset = 0;
 	while (sz_remaining != 0) {
-		tx_size = sz_remaining > SKL_ADSP_W1_SZ
-				? SKL_ADSP_W1_SZ : sz_remaining;
+		tx_size = sz_remaining > SKL_MAILBOX_SIZE
+				? SKL_MAILBOX_SIZE : sz_remaining;
 		if (tx_size == sz_remaining)
 			header.extension |= IPC_FINAL_BLOCK(1);
 
@@ -965,7 +965,7 @@ int skl_ipc_get_large_config(struct sst_generic_ipc *ipc,
 	unsigned int *buf;
 	int ret;
 
-	reply.data = kzalloc(SKL_ADSP_W1_SZ, GFP_KERNEL);
+	reply.data = kzalloc(SKL_MAILBOX_SIZE, GFP_KERNEL);
 	if (!reply.data)
 		return -ENOMEM;
 
@@ -983,7 +983,7 @@ int skl_ipc_get_large_config(struct sst_generic_ipc *ipc,
 	request.header = *(u64 *)&header;
 	request.data = *payload;
 	request.size = *bytes;
-	reply.size = SKL_ADSP_W1_SZ;
+	reply.size = SKL_MAILBOX_SIZE;
 
 	ret = sst_ipc_tx_message_wait(ipc, request, &reply);
 	if (ret < 0)
sound/soc/intel/skylake/skl-sst.c +3 -2
index 7e63c91cea54..191931578fd2 100644
@@ -536,8 +536,9 @@ int skl_sst_dsp_init(struct device *dev, void __iomem *mmio_base, int irq,
 	sst->addr.sram0_base = SKL_ADSP_SRAM0_BASE;
 	sst->addr.sram1_base = SKL_ADSP_SRAM1_BASE;
 
-	sst_dsp_mailbox_init(sst, (SKL_ADSP_SRAM0_BASE + SKL_ADSP_W0_STAT_SZ),
-			SKL_ADSP_W0_UP_SZ, SKL_ADSP_SRAM1_BASE, SKL_ADSP_W1_SZ);
+	sst_dsp_mailbox_init(sst,
+		(SKL_ADSP_SRAM0_BASE + SKL_FW_REGS_SIZE), SKL_MAILBOX_SIZE,
+		SKL_ADSP_SRAM1_BASE, SKL_MAILBOX_SIZE);
 
 	ret = skl_ipc_init(dev, skl);
 	if (ret) {
Signature · 1 line
2.17.1
#42 lore raw

Re: [PATCH 19/35] ASoC: Intel: Skylake: Remove redundant W0 and W1 macros

Quoted 1 line · Cezary Rojewski

The existing upling, downling and FW register size macros are

uplink and downlink?

Quoted 3 lines

duplicates. Remove these and replace by global mailbox size macro - FW register-area size is represented by SKL_FW_REGS_SIZE added in precedding change.

preceding

use checkpatch.pl --codespell to check for typos.

Quoted 151 lines
---
  sound/soc/intel/skylake/bxt-sst.c     |  5 +++--
  sound/soc/intel/skylake/cnl-sst-dsp.h |  6 ------
  sound/soc/intel/skylake/cnl-sst.c     | 10 +++++-----
  sound/soc/intel/skylake/skl-sst-dsp.h |  7 +------
  sound/soc/intel/skylake/skl-sst-ipc.c | 12 ++++++------
  sound/soc/intel/skylake/skl-sst.c     |  5 +++--
  6 files changed, 18 insertions(+), 27 deletions(-)
sound/soc/intel/skylake/bxt-sst.c +3 -2
index 641d5cf4aeb1..fdd94711c3b4 100644
@@ -566,8 +566,9 @@ int bxt_sst_dsp_init(struct device *dev, void __iomem *mmio_base, int irq,
  	sst->addr.sram0_base = BXT_ADSP_SRAM0_BASE;
  	sst->addr.sram1_base = BXT_ADSP_SRAM1_BASE;
 
-	sst_dsp_mailbox_init(sst, (BXT_ADSP_SRAM0_BASE + SKL_ADSP_W0_STAT_SZ),
-			SKL_ADSP_W0_UP_SZ, BXT_ADSP_SRAM1_BASE, SKL_ADSP_W1_SZ);
+	sst_dsp_mailbox_init(sst,
+		(BXT_ADSP_SRAM0_BASE + SKL_FW_REGS_SIZE), SKL_MAILBOX_SIZE,
+		BXT_ADSP_SRAM1_BASE, SKL_MAILBOX_SIZE);
 
  	ret = skl_ipc_init(dev, skl);
  	if (ret) {
sound/soc/intel/skylake/cnl-sst-dsp.h +0 -6
index 70da4f312f53..a465cc42b7e8 100644
@@ -52,12 +52,6 @@ struct sst_generic_ipc;
 
  #define CNL_ADSP_MMIO_LEN		0x10000
 
-#define CNL_ADSP_W0_STAT_SZ		0x1000
-
-#define CNL_ADSP_W0_UP_SZ		0x1000
-
-#define CNL_ADSP_W1_SZ			0x1000
-
  #define CNL_FW_STS_MASK			0xf
 
  #define CNL_ADSPIC_IPC			0x1
sound/soc/intel/skylake/cnl-sst.c +5 -5
index 64971966af38..d3da23e0ef05 100644
@@ -390,8 +390,8 @@ static int cnl_ipc_init(struct device *dev, struct skl_dev *cnl)
  	ipc->dsp = cnl->dsp;
  	ipc->dev = dev;
 
-	ipc->tx_data_max_size = CNL_ADSP_W1_SZ;
-	ipc->rx_data_max_size = CNL_ADSP_W0_UP_SZ;
+	ipc->tx_data_max_size = SKL_MAILBOX_SIZE;
+	ipc->rx_data_max_size = SKL_MAILBOX_SIZE;
 
  	err = sst_ipc_init(ipc);
  	if (err)
@@ -443,9 +443,9 @@ int cnl_sst_dsp_init(struct device *dev, void __iomem *mmio_base, int irq,
  	sst->addr.sram0_base = CNL_ADSP_SRAM0_BASE;
  	sst->addr.sram1_base = CNL_ADSP_SRAM1_BASE;
 
-	sst_dsp_mailbox_init(sst, (CNL_ADSP_SRAM0_BASE + CNL_ADSP_W0_STAT_SZ),
-			     CNL_ADSP_W0_UP_SZ, CNL_ADSP_SRAM1_BASE,
-			     CNL_ADSP_W1_SZ);
+	sst_dsp_mailbox_init(sst,
+		(CNL_ADSP_SRAM0_BASE + SKL_FW_REGS_SIZE), SKL_MAILBOX_SIZE,
+		CNL_ADSP_SRAM1_BASE, SKL_MAILBOX_SIZE);
 
  	ret = cnl_ipc_init(dev, cnl);
  	if (ret) {
sound/soc/intel/skylake/skl-sst-dsp.h +1 -6
index 5a0cb7f3d57e..3c92b1d849e4 100644
@@ -57,12 +57,7 @@ struct skl_dev;
 
  #define SKL_ADSP_MMIO_LEN		0x10000
 
-#define SKL_ADSP_W0_STAT_SZ		0x1000
-
-#define SKL_ADSP_W0_UP_SZ		0x1000
-
-#define SKL_ADSP_W1_SZ			0x1000
-
+#define SKL_MAILBOX_SIZE		PAGE_SIZE
  #define SKL_FW_REGS_SIZE		PAGE_SIZE
  #define SKL_FW_STS_MASK			0xf
 
sound/soc/intel/skylake/skl-sst-ipc.c +6 -6
index 2700f882103d..72d7284d2fff 100644
@@ -606,8 +606,8 @@ int skl_ipc_init(struct device *dev, struct skl_dev *skl)
  	ipc->dsp = skl->dsp;
  	ipc->dev = dev;
 
-	ipc->tx_data_max_size = SKL_ADSP_W1_SZ;
-	ipc->rx_data_max_size = SKL_ADSP_W0_UP_SZ;
+	ipc->tx_data_max_size = SKL_MAILBOX_SIZE;
+	ipc->rx_data_max_size = SKL_MAILBOX_SIZE;
 
  	err = sst_ipc_init(ipc);
  	if (err)
@@ -922,8 +922,8 @@ int skl_ipc_set_large_config(struct sst_generic_ipc *ipc,
  	sz_remaining = msg->param_data_size;
  	data_offset = 0;
  	while (sz_remaining != 0) {
-		tx_size = sz_remaining > SKL_ADSP_W1_SZ
-				? SKL_ADSP_W1_SZ : sz_remaining;
+		tx_size = sz_remaining > SKL_MAILBOX_SIZE
+				? SKL_MAILBOX_SIZE : sz_remaining;
  		if (tx_size == sz_remaining)
  			header.extension |= IPC_FINAL_BLOCK(1);
 
@@ -965,7 +965,7 @@ int skl_ipc_get_large_config(struct sst_generic_ipc *ipc,
  	unsigned int *buf;
  	int ret;
 
-	reply.data = kzalloc(SKL_ADSP_W1_SZ, GFP_KERNEL);
+	reply.data = kzalloc(SKL_MAILBOX_SIZE, GFP_KERNEL);
  	if (!reply.data)
  		return -ENOMEM;
 
@@ -983,7 +983,7 @@ int skl_ipc_get_large_config(struct sst_generic_ipc *ipc,
  	request.header = *(u64 *)&header;
  	request.data = *payload;
  	request.size = *bytes;
-	reply.size = SKL_ADSP_W1_SZ;
+	reply.size = SKL_MAILBOX_SIZE;
 
  	ret = sst_ipc_tx_message_wait(ipc, request, &reply);
  	if (ret < 0)
sound/soc/intel/skylake/skl-sst.c +3 -2
index 7e63c91cea54..191931578fd2 100644
@@ -536,8 +536,9 @@ int skl_sst_dsp_init(struct device *dev, void __iomem *mmio_base, int irq,
  	sst->addr.sram0_base = SKL_ADSP_SRAM0_BASE;
  	sst->addr.sram1_base = SKL_ADSP_SRAM1_BASE;
 
-	sst_dsp_mailbox_init(sst, (SKL_ADSP_SRAM0_BASE + SKL_ADSP_W0_STAT_SZ),
-			SKL_ADSP_W0_UP_SZ, SKL_ADSP_SRAM1_BASE, SKL_ADSP_W1_SZ);
+	sst_dsp_mailbox_init(sst,
+		(SKL_ADSP_SRAM0_BASE + SKL_FW_REGS_SIZE), SKL_MAILBOX_SIZE,
+		SKL_ADSP_SRAM1_BASE, SKL_MAILBOX_SIZE);
 
  	ret = skl_ipc_init(dev, skl);
  	if (ret) {
author maintainer
#43 lore raw

Re: [PATCH 19/35] ASoC: Intel: Skylake: Remove redundant W0 and W1 macros

Quoted 7 lines · Pierre-Louis Bossart
Quoted 1 line · Cezary Rojewski

The existing upling, downling and FW register size macros are

uplink and downlink?

Quoted 8 lines
Quoted 3 lines

duplicates. Remove these and replace by global mailbox size macro - FW register-area size is represented by SKL_FW_REGS_SIZE added in precedding change.

preceding

use checkpatch.pl --codespell to check for typos.

Ack on both. Sorry for the seer amount of typos in commit messages in this series. Thanks for catching them up, Pierre.

Quoted 134 lines
Quoted 134 lines

---
  sound/soc/intel/skylake/bxt-sst.c     |  5 +++-- sound/soc/intel/skylake/cnl-sst-dsp.h |  6 ------ sound/soc/intel/skylake/cnl-sst.c     | 10 +++++----- sound/soc/intel/skylake/skl-sst-dsp.h |  7 +------ sound/soc/intel/skylake/skl-sst-ipc.c | 12 ++++++------ sound/soc/intel/skylake/skl-sst.c     |  5 +++--

  6 files changed, 18 insertions(+), 27 deletions(-)
sound/soc/intel/skylake/bxt-sst.c +3 -2
index 641d5cf4aeb1..fdd94711c3b4 100644
@@ -566,8 +566,9 @@ int bxt_sst_dsp_init(struct device *dev, void 
 __iomem *mmio_base, int irq,
       sst->addr.sram0_base = BXT_ADSP_SRAM0_BASE;
       sst->addr.sram1_base = BXT_ADSP_SRAM1_BASE;
-    sst_dsp_mailbox_init(sst, (BXT_ADSP_SRAM0_BASE + 
 SKL_ADSP_W0_STAT_SZ),
-            SKL_ADSP_W0_UP_SZ, BXT_ADSP_SRAM1_BASE, SKL_ADSP_W1_SZ);
+    sst_dsp_mailbox_init(sst,
+        (BXT_ADSP_SRAM0_BASE + SKL_FW_REGS_SIZE), SKL_MAILBOX_SIZE,
+        BXT_ADSP_SRAM1_BASE, SKL_MAILBOX_SIZE);
       ret = skl_ipc_init(dev, skl);
       if (ret) {
sound/soc/intel/skylake/cnl-sst-dsp.h +0 -6
index 70da4f312f53..a465cc42b7e8 100644
@@ -52,12 +52,6 @@ struct sst_generic_ipc;
   #define CNL_ADSP_MMIO_LEN        0x10000
-#define CNL_ADSP_W0_STAT_SZ        0x1000
-
-#define CNL_ADSP_W0_UP_SZ        0x1000
-
-#define CNL_ADSP_W1_SZ            0x1000
-
   #define CNL_FW_STS_MASK            0xf
   #define CNL_ADSPIC_IPC            0x1
sound/soc/intel/skylake/cnl-sst.c +5 -5
index 64971966af38..d3da23e0ef05 100644
@@ -390,8 +390,8 @@ static int cnl_ipc_init(struct device *dev, struct 
 skl_dev *cnl)
       ipc->dsp = cnl->dsp;
       ipc->dev = dev;
-    ipc->tx_data_max_size = CNL_ADSP_W1_SZ;
-    ipc->rx_data_max_size = CNL_ADSP_W0_UP_SZ;
+    ipc->tx_data_max_size = SKL_MAILBOX_SIZE;
+    ipc->rx_data_max_size = SKL_MAILBOX_SIZE;
       err = sst_ipc_init(ipc);
       if (err)
@@ -443,9 +443,9 @@ int cnl_sst_dsp_init(struct device *dev, void 
 __iomem *mmio_base, int irq,
       sst->addr.sram0_base = CNL_ADSP_SRAM0_BASE;
       sst->addr.sram1_base = CNL_ADSP_SRAM1_BASE;
-    sst_dsp_mailbox_init(sst, (CNL_ADSP_SRAM0_BASE + 
 CNL_ADSP_W0_STAT_SZ),
-                 CNL_ADSP_W0_UP_SZ, CNL_ADSP_SRAM1_BASE,
-                 CNL_ADSP_W1_SZ);
+    sst_dsp_mailbox_init(sst,
+        (CNL_ADSP_SRAM0_BASE + SKL_FW_REGS_SIZE), SKL_MAILBOX_SIZE,
+        CNL_ADSP_SRAM1_BASE, SKL_MAILBOX_SIZE);
       ret = cnl_ipc_init(dev, cnl);
       if (ret) {
sound/soc/intel/skylake/skl-sst-dsp.h +1 -6
index 5a0cb7f3d57e..3c92b1d849e4 100644
@@ -57,12 +57,7 @@ struct skl_dev;
   #define SKL_ADSP_MMIO_LEN        0x10000
-#define SKL_ADSP_W0_STAT_SZ        0x1000
-
-#define SKL_ADSP_W0_UP_SZ        0x1000
-
-#define SKL_ADSP_W1_SZ            0x1000
-
+#define SKL_MAILBOX_SIZE        PAGE_SIZE
   #define SKL_FW_REGS_SIZE        PAGE_SIZE
   #define SKL_FW_STS_MASK            0xf
sound/soc/intel/skylake/skl-sst-ipc.c +6 -6
index 2700f882103d..72d7284d2fff 100644
@@ -606,8 +606,8 @@ int skl_ipc_init(struct device *dev, struct 
 skl_dev *skl)
       ipc->dsp = skl->dsp;
       ipc->dev = dev;
-    ipc->tx_data_max_size = SKL_ADSP_W1_SZ;
-    ipc->rx_data_max_size = SKL_ADSP_W0_UP_SZ;
+    ipc->tx_data_max_size = SKL_MAILBOX_SIZE;
+    ipc->rx_data_max_size = SKL_MAILBOX_SIZE;
       err = sst_ipc_init(ipc);
       if (err)
@@ -922,8 +922,8 @@ int skl_ipc_set_large_config(struct 
 sst_generic_ipc *ipc,
       sz_remaining = msg->param_data_size;
       data_offset = 0;
       while (sz_remaining != 0) {
-        tx_size = sz_remaining > SKL_ADSP_W1_SZ
-                ? SKL_ADSP_W1_SZ : sz_remaining;
+        tx_size = sz_remaining > SKL_MAILBOX_SIZE
+                ? SKL_MAILBOX_SIZE : sz_remaining;
           if (tx_size == sz_remaining)
               header.extension |= IPC_FINAL_BLOCK(1);
@@ -965,7 +965,7 @@ int skl_ipc_get_large_config(struct 
 sst_generic_ipc *ipc,
       unsigned int *buf;
       int ret;
-    reply.data = kzalloc(SKL_ADSP_W1_SZ, GFP_KERNEL);
+    reply.data = kzalloc(SKL_MAILBOX_SIZE, GFP_KERNEL);
       if (!reply.data)
           return -ENOMEM;
@@ -983,7 +983,7 @@ int skl_ipc_get_large_config(struct 
 sst_generic_ipc *ipc,
       request.header = *(u64 *)&header;
       request.data = *payload;
       request.size = *bytes;
-    reply.size = SKL_ADSP_W1_SZ;
+    reply.size = SKL_MAILBOX_SIZE;
       ret = sst_ipc_tx_message_wait(ipc, request, &reply);
       if (ret < 0)
sound/soc/intel/skylake/skl-sst.c +0 -1
index 7e63c91cea54..191931578fd2 100644
@@ -536,8 +536,9 @@ int skl_sst_dsp_init(struct device *dev, void 
 __iomem *mmio_base, int irq,
       sst->addr.sram0_base = SKL_ADSP_SRAM0_BASE;
       sst->addr.sram1_base = SKL_ADSP_SRAM1_BASE;
-    sst_dsp_mailbox_init(sst, (SKL_ADSP_SRAM0_BASE + 
Quoted 8 lines

sound/soc/intel/skylake/skl-sst.c int skl_sst_dsp_init(struct device *dev, void __iomem *mmio_base, int irq, · line 544

Quoted 8 lines
sound/soc/intel/skylake/skl-sst.c +3 -1
 SKL_ADSP_W0_STAT_SZ),
-            SKL_ADSP_W0_UP_SZ, SKL_ADSP_SRAM1_BASE, SKL_ADSP_W1_SZ);
+    sst_dsp_mailbox_init(sst,
+        (SKL_ADSP_SRAM0_BASE + SKL_FW_REGS_SIZE), SKL_MAILBOX_SIZE,
+        SKL_ADSP_SRAM1_BASE, SKL_MAILBOX_SIZE);
       ret = skl_ipc_init(dev, skl);
       if (ret) {

_______________________________________________
Alsa-devel mailing list
[email protected]
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

author maintainer
#44 lore raw

Re: [PATCH 19/35] ASoC: Intel: Skylake: Remove redundant W0 and W1 macros

Quoted 12 lines · Cezary Rojewski
Quoted 11 lines · Pierre-Louis Bossart
Quoted 1 line · Cezary Rojewski

The existing upling, downling and FW register size macros are

uplink and downlink?

Quoted 3 lines

duplicates. Remove these and replace by global mailbox size macro - FW register-area size is represented by SKL_FW_REGS_SIZE added in precedding change.

Quoted 7 lines
Quoted 4 lines

preceding

use checkpatch.pl --codespell to check for typos.

Ack on both. Sorry for the seer amount of typos in commit messages in this series. Thanks for catching them up, Pierre.

s/seer/sheer
This is escalating quickly..

Quoted 138 lines
Quoted 138 lines
Quoted 138 lines

---
  sound/soc/intel/skylake/bxt-sst.c     |  5 +++-- sound/soc/intel/skylake/cnl-sst-dsp.h |  6 ------ sound/soc/intel/skylake/cnl-sst.c     | 10 +++++----- sound/soc/intel/skylake/skl-sst-dsp.h |  7 +------ sound/soc/intel/skylake/skl-sst-ipc.c | 12 ++++++------ sound/soc/intel/skylake/skl-sst.c     |  5 +++--

  6 files changed, 18 insertions(+), 27 deletions(-)
sound/soc/intel/skylake/bxt-sst.c +3 -2
index 641d5cf4aeb1..fdd94711c3b4 100644
@@ -566,8 +566,9 @@ int bxt_sst_dsp_init(struct device *dev, void 
 __iomem *mmio_base, int irq,
       sst->addr.sram0_base = BXT_ADSP_SRAM0_BASE;
       sst->addr.sram1_base = BXT_ADSP_SRAM1_BASE;
-    sst_dsp_mailbox_init(sst, (BXT_ADSP_SRAM0_BASE + 
 SKL_ADSP_W0_STAT_SZ),
-            SKL_ADSP_W0_UP_SZ, BXT_ADSP_SRAM1_BASE, SKL_ADSP_W1_SZ);
+    sst_dsp_mailbox_init(sst,
+        (BXT_ADSP_SRAM0_BASE + SKL_FW_REGS_SIZE), SKL_MAILBOX_SIZE,
+        BXT_ADSP_SRAM1_BASE, SKL_MAILBOX_SIZE);
       ret = skl_ipc_init(dev, skl);
       if (ret) {
sound/soc/intel/skylake/cnl-sst-dsp.h +0 -6
index 70da4f312f53..a465cc42b7e8 100644
@@ -52,12 +52,6 @@ struct sst_generic_ipc;
   #define CNL_ADSP_MMIO_LEN        0x10000
-#define CNL_ADSP_W0_STAT_SZ        0x1000
-
-#define CNL_ADSP_W0_UP_SZ        0x1000
-
-#define CNL_ADSP_W1_SZ            0x1000
-
   #define CNL_FW_STS_MASK            0xf
   #define CNL_ADSPIC_IPC            0x1
sound/soc/intel/skylake/cnl-sst.c +5 -5
index 64971966af38..d3da23e0ef05 100644
@@ -390,8 +390,8 @@ static int cnl_ipc_init(struct device *dev, 
 struct skl_dev *cnl)
       ipc->dsp = cnl->dsp;
       ipc->dev = dev;
-    ipc->tx_data_max_size = CNL_ADSP_W1_SZ;
-    ipc->rx_data_max_size = CNL_ADSP_W0_UP_SZ;
+    ipc->tx_data_max_size = SKL_MAILBOX_SIZE;
+    ipc->rx_data_max_size = SKL_MAILBOX_SIZE;
       err = sst_ipc_init(ipc);
       if (err)
@@ -443,9 +443,9 @@ int cnl_sst_dsp_init(struct device *dev, void 
 __iomem *mmio_base, int irq,
       sst->addr.sram0_base = CNL_ADSP_SRAM0_BASE;
       sst->addr.sram1_base = CNL_ADSP_SRAM1_BASE;
-    sst_dsp_mailbox_init(sst, (CNL_ADSP_SRAM0_BASE + 
 CNL_ADSP_W0_STAT_SZ),
-                 CNL_ADSP_W0_UP_SZ, CNL_ADSP_SRAM1_BASE,
-                 CNL_ADSP_W1_SZ);
+    sst_dsp_mailbox_init(sst,
+        (CNL_ADSP_SRAM0_BASE + SKL_FW_REGS_SIZE), SKL_MAILBOX_SIZE,
+        CNL_ADSP_SRAM1_BASE, SKL_MAILBOX_SIZE);
       ret = cnl_ipc_init(dev, cnl);
       if (ret) {
sound/soc/intel/skylake/skl-sst-dsp.h +1 -6
index 5a0cb7f3d57e..3c92b1d849e4 100644
@@ -57,12 +57,7 @@ struct skl_dev;
   #define SKL_ADSP_MMIO_LEN        0x10000
-#define SKL_ADSP_W0_STAT_SZ        0x1000
-
-#define SKL_ADSP_W0_UP_SZ        0x1000
-
-#define SKL_ADSP_W1_SZ            0x1000
-
+#define SKL_MAILBOX_SIZE        PAGE_SIZE
   #define SKL_FW_REGS_SIZE        PAGE_SIZE
   #define SKL_FW_STS_MASK            0xf
sound/soc/intel/skylake/skl-sst-ipc.c +6 -6
index 2700f882103d..72d7284d2fff 100644
@@ -606,8 +606,8 @@ int skl_ipc_init(struct device *dev, struct 
 skl_dev *skl)
       ipc->dsp = skl->dsp;
       ipc->dev = dev;
-    ipc->tx_data_max_size = SKL_ADSP_W1_SZ;
-    ipc->rx_data_max_size = SKL_ADSP_W0_UP_SZ;
+    ipc->tx_data_max_size = SKL_MAILBOX_SIZE;
+    ipc->rx_data_max_size = SKL_MAILBOX_SIZE;
       err = sst_ipc_init(ipc);
       if (err)
@@ -922,8 +922,8 @@ int skl_ipc_set_large_config(struct 
 sst_generic_ipc *ipc,
       sz_remaining = msg->param_data_size;
       data_offset = 0;
       while (sz_remaining != 0) {
-        tx_size = sz_remaining > SKL_ADSP_W1_SZ
-                ? SKL_ADSP_W1_SZ : sz_remaining;
+        tx_size = sz_remaining > SKL_MAILBOX_SIZE
+                ? SKL_MAILBOX_SIZE : sz_remaining;
           if (tx_size == sz_remaining)
               header.extension |= IPC_FINAL_BLOCK(1);
@@ -965,7 +965,7 @@ int skl_ipc_get_large_config(struct 
 sst_generic_ipc *ipc,
       unsigned int *buf;
       int ret;
-    reply.data = kzalloc(SKL_ADSP_W1_SZ, GFP_KERNEL);
+    reply.data = kzalloc(SKL_MAILBOX_SIZE, GFP_KERNEL);
       if (!reply.data)
           return -ENOMEM;
@@ -983,7 +983,7 @@ int skl_ipc_get_large_config(struct 
 sst_generic_ipc *ipc,
       request.header = *(u64 *)&header;
       request.data = *payload;
       request.size = *bytes;
-    reply.size = SKL_ADSP_W1_SZ;
+    reply.size = SKL_MAILBOX_SIZE;
       ret = sst_ipc_tx_message_wait(ipc, request, &reply);
       if (ret < 0)
sound/soc/intel/skylake/skl-sst.c +2 -2
index 7e63c91cea54..191931578fd2 100644
@@ -536,8 +536,9 @@ int skl_sst_dsp_init(struct device *dev, void 
 __iomem *mmio_base, int irq,
       sst->addr.sram0_base = SKL_ADSP_SRAM0_BASE;
       sst->addr.sram1_base = SKL_ADSP_SRAM1_BASE;
-    sst_dsp_mailbox_init(sst, (SKL_ADSP_SRAM0_BASE + 
 SKL_ADSP_W0_STAT_SZ),
-            SKL_ADSP_W0_UP_SZ, SKL_ADSP_SRAM1_BASE, SKL_ADSP_W1_SZ);
+    sst_dsp_mailbox_init(sst,
+        (SKL_ADSP_SRAM0_BASE + SKL_FW_REGS_SIZE), SKL_MAILBOX_SIZE,
Quoted 8 lines
Quoted 4 lines

sound/soc/intel/skylake/skl-sst.c int skl_sst_dsp_init(struct device *dev, void __iomem *mmio_base, int irq, · line 544

Quoted 4 lines
sound/soc/intel/skylake/skl-sst.c +1 -0
+        SKL_ADSP_SRAM1_BASE, SKL_MAILBOX_SIZE);
       ret = skl_ipc_init(dev, skl);
       if (ret) {

_______________________________________________
Alsa-devel mailing list
[email protected]
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

_______________________________________________
Alsa-devel mailing list
[email protected]
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

author maintainer
#45 lore raw

PATCH 20/35 ASoC: Intel: Skylake: Remove redundant SRAM fields

In reply to Cezary Rojewski

sram0_base and sram1_base are Skylake-specific fields and should not be part of common sst framework. Moreover, these are completely unused, so remove them.

---
 sound/soc/intel/common/sst-dsp-priv.h | 2 --
 sound/soc/intel/skylake/bxt-sst.c     | 2 --
 sound/soc/intel/skylake/cnl-sst.c     | 2 --
 sound/soc/intel/skylake/skl-sst.c     | 2 --
 4 files changed, 8 deletions(-)
sound/soc/intel/common/sst-dsp-priv.h +0 -2
index 53dcd87bab44..a4628a89d47d 100644
@@ -69,8 +69,6 @@ struct sst_addr {
 	u32 dram_offset;
 	u32 dsp_iram_offset;
 	u32 dsp_dram_offset;
-	u32 sram0_base;
-	u32 sram1_base;
 	void __iomem *lpe;
 	void __iomem *shim;
 	void __iomem *pci_cfg;
sound/soc/intel/skylake/bxt-sst.c +0 -2
index fdd94711c3b4..5b46215fbc0f 100644
@@ -563,8 +563,6 @@ int bxt_sst_dsp_init(struct device *dev, void __iomem *mmio_base, int irq,
 	sst->fw_ops = bxt_fw_ops;
 	sst->addr.lpe = mmio_base;
 	sst->addr.shim = mmio_base;
-	sst->addr.sram0_base = BXT_ADSP_SRAM0_BASE;
-	sst->addr.sram1_base = BXT_ADSP_SRAM1_BASE;
 
 	sst_dsp_mailbox_init(sst,
 		(BXT_ADSP_SRAM0_BASE + SKL_FW_REGS_SIZE), SKL_MAILBOX_SIZE,
sound/soc/intel/skylake/cnl-sst.c +0 -2
index d3da23e0ef05..47b991c03742 100644
@@ -440,8 +440,6 @@ int cnl_sst_dsp_init(struct device *dev, void __iomem *mmio_base, int irq,
 	sst->fw_ops = cnl_fw_ops;
 	sst->addr.lpe = mmio_base;
 	sst->addr.shim = mmio_base;
-	sst->addr.sram0_base = CNL_ADSP_SRAM0_BASE;
-	sst->addr.sram1_base = CNL_ADSP_SRAM1_BASE;
 
 	sst_dsp_mailbox_init(sst,
 		(CNL_ADSP_SRAM0_BASE + SKL_FW_REGS_SIZE), SKL_MAILBOX_SIZE,
sound/soc/intel/skylake/skl-sst.c +0 -2
index 191931578fd2..c823936ffd34 100644
@@ -533,8 +533,6 @@ int skl_sst_dsp_init(struct device *dev, void __iomem *mmio_base, int irq,
 	sst = skl->dsp;
 	sst->addr.lpe = mmio_base;
 	sst->addr.shim = mmio_base;
-	sst->addr.sram0_base = SKL_ADSP_SRAM0_BASE;
-	sst->addr.sram1_base = SKL_ADSP_SRAM1_BASE;
 
 	sst_dsp_mailbox_init(sst,
 		(SKL_ADSP_SRAM0_BASE + SKL_FW_REGS_SIZE), SKL_MAILBOX_SIZE,
Signature · 1 line
2.17.1
author maintainer
#46 lore raw

PATCH 21/35 ASoC: Intel: Expose ACPI loading members

In reply to Cezary Rojewski

No framework should know upfront about specifics of its inheriting members. sst-acpi contains Baytrail and Haswell specific data. In order to prevent circular dependency, it's compiled into separate module.

Let's do it right and obey inheritance rule. As a first step, elevate sst-acpi members so they could be shared by Haswell and Baytrail-specific handlers - this is to prevent code duplication.

---
 sound/soc/intel/common/sst-acpi.c | 23 ++++-------------------
 sound/soc/intel/common/sst-dsp.h  | 21 +++++++++++++++++++++
 2 files changed, 25 insertions(+), 19 deletions(-)
sound/soc/intel/common/sst-acpi.c +4 -19
index 0e8e0a7a11df..42f9b02f2ea3 100644
@@ -19,23 +19,6 @@
 #define SST_WPT_DSP_DMA_ADDR_OFFSET	0x0FE000
 #define SST_LPT_DSP_DMA_SIZE		(1024 - 1)
 
-/* Descriptor for setting up SST platform data */
-struct sst_acpi_desc {
-	const char *drv_name;
-	struct snd_soc_acpi_mach *machines;
-	/* Platform resource indexes. Must set to -1 if not used */
-	int resindex_lpe_base;
-	int resindex_pcicfg_base;
-	int resindex_fw_base;
-	int irqindex_host_ipc;
-	int resindex_dma_base;
-	/* Unique number identifying the SST core on platform */
-	int sst_id;
-	/* DMA only valid when resindex_dma_base != -1*/
-	int dma_engine;
-	int dma_size;
-};
-
 struct sst_acpi_priv {
 	struct platform_device *pdev_mach;
 	struct platform_device *pdev_pcm;
@@ -71,7 +54,7 @@ static void sst_acpi_fw_cb(const struct firmware *fw, void *context)
 	return;
 }
 
-static int sst_acpi_probe(struct platform_device *pdev)
+int sst_acpi_probe(struct platform_device *pdev)
 {
 	const struct acpi_device_id *id;
 	struct device *dev = &pdev->dev;
@@ -157,8 +140,9 @@ static int sst_acpi_probe(struct platform_device *pdev)
 
 	return ret;
 }
+EXPORT_SYMBOL_GPL(sst_acpi_probe);
 
-static int sst_acpi_remove(struct platform_device *pdev)
+int sst_acpi_remove(struct platform_device *pdev)
 {
 	struct sst_acpi_priv *sst_acpi = platform_get_drvdata(pdev);
 	struct sst_pdata *sst_pdata = &sst_acpi->sst_pdata;
@@ -170,6 +154,7 @@ static int sst_acpi_remove(struct platform_device *pdev)
 
 	return 0;
 }
+EXPORT_SYMBOL_GPL(sst_acpi_remove);
 
 static struct sst_acpi_desc sst_acpi_haswell_desc = {
 	.drv_name = "haswell-pcm-audio",
sound/soc/intel/common/sst-dsp.h +21 -0
index 63c29bb45cf1..a2ac7998fbdb 100644
@@ -166,6 +166,27 @@
 #define SST_PMCS_PS_MASK	0x3
 
 struct sst_dsp;
+struct platform_device;
+
+/* Descriptor for setting up SST platform data */
+struct sst_acpi_desc {
+	const char *drv_name;
+	struct snd_soc_acpi_mach *machines;
+	/* Platform resource indexes. Must set to -1 if not used */
+	int resindex_lpe_base;
+	int resindex_pcicfg_base;
+	int resindex_fw_base;
+	int irqindex_host_ipc;
+	int resindex_dma_base;
+	/* Unique number identifying the SST core on platform */
+	int sst_id;
+	/* DMA only valid when resindex_dma_base != -1*/
+	int dma_engine;
+	int dma_size;
+};
+
+int sst_acpi_probe(struct platform_device *pdev);
+int sst_acpi_remove(struct platform_device *pdev);
 
 /*
  * SST Platform Data.
Signature · 1 line
2.17.1
#47 lore raw

Re: [PATCH 21/35] ASoC: Intel: Expose ACPI loading members

sound/soc/intel/common/sst-dsp.h line 169

Quoted 10 lines
sound/soc/intel/common/sst-dsp.h +1 -0
index 63c29bb45cf1..a2ac7998fbdb 100644
@@ -166,6 +166,27 @@
  #define SST_PMCS_PS_MASK	0x3
 
  struct sst_dsp;
+struct platform_device;

that should be handled with an include, not redefining a type here.

Quoted 24 lines
sound/soc/intel/common/sst-dsp.h +20 -0
+
+/* Descriptor for setting up SST platform data */
+struct sst_acpi_desc {
+	const char *drv_name;
+	struct snd_soc_acpi_mach *machines;
+	/* Platform resource indexes. Must set to -1 if not used */
+	int resindex_lpe_base;
+	int resindex_pcicfg_base;
+	int resindex_fw_base;
+	int irqindex_host_ipc;
+	int resindex_dma_base;
+	/* Unique number identifying the SST core on platform */
+	int sst_id;
+	/* DMA only valid when resindex_dma_base != -1*/
+	int dma_engine;
+	int dma_size;
+};
+
+int sst_acpi_probe(struct platform_device *pdev);
+int sst_acpi_remove(struct platform_device *pdev);
 
  /*
   * SST Platform Data.
author maintainer
#48 lore raw

Re: [PATCH 21/35] ASoC: Intel: Expose ACPI loading members

Quoted 12 lines · Pierre-Louis Bossart

sound/soc/intel/common/sst-dsp.h line 168

Quoted 9 lines
sound/soc/intel/common/sst-dsp.h +1 -0
index 63c29bb45cf1..a2ac7998fbdb 100644
@@ -166,6 +166,27 @@
   #define SST_PMCS_PS_MASK    0x3
   struct sst_dsp;
+struct platform_device;

that should be handled with an include, not redefining a type here.

Ack.

Quoted 15 lines
Quoted 15 lines
sound/soc/intel/common/sst-dsp.h +15 -0
+
+/* Descriptor for setting up SST platform data */
+struct sst_acpi_desc {
+    const char *drv_name;
+    struct snd_soc_acpi_mach *machines;
+    /* Platform resource indexes. Must set to -1 if not used */
+    int resindex_lpe_base;
+    int resindex_pcicfg_base;
+    int resindex_fw_base;
+    int irqindex_host_ipc;
+    int resindex_dma_base;
+    /* Unique number identifying the SST core on platform */
+    int sst_id;
+    /* DMA only valid when resindex_dma_base != -1*/
+    int dma_engine;
Quoted 8 lines

sound/soc/intel/common/sst-dsp.h

Quoted 8 lines
sound/soc/intel/common/sst-dsp.h +5 -0
+    int dma_size;
+};
+
+int sst_acpi_probe(struct platform_device *pdev);
+int sst_acpi_remove(struct platform_device *pdev);
   /*
    * SST Platform Data.
 

_______________________________________________
Alsa-devel mailing list
[email protected]
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

author maintainer
#49 lore raw

PATCH 22/35 ASoC: Intel: Haswell: Define separate ACPI loader

In reply to Cezary Rojewski

With common acpi code exposed, separate Haswell specific code from other legacy platforms. To reduce diff delta, it's still loaded with separate module called: hsw-acpi. This may be address later, once heavy hitters are gone.

---
 sound/soc/intel/Kconfig           |  6 ++-
 sound/soc/intel/common/sst-acpi.c | 32 ----------------
 sound/soc/intel/haswell/Makefile  |  2 +
 sound/soc/intel/haswell/acpi.c    | 63 +++++++++++++++++++++++++++++++
 4 files changed, 70 insertions(+), 33 deletions(-)
 create mode 100644 sound/soc/intel/haswell/acpi.c
sound/soc/intel/Kconfig +5 -1
index a3ec17fd63cd..9191773d203c 100644
@@ -31,6 +31,10 @@ config SND_SST_IPC_ACPI
 	# This option controls the ACPI-based IPC for HiFi2 platforms
 	# (Baytrail, Cherrytrail)
 
+config SND_SOC_INTEL_HASWELL_ACPI
+	tristate
+	# This option controls the ACPI-based on HSW/BDW platforms
+
 config SND_SOC_INTEL_SST_ACPI
 	tristate
 	# This option controls ACPI-based probing on
@@ -52,7 +56,7 @@ config SND_SOC_INTEL_HASWELL
 	depends on SND_DMA_SGBUF
 	depends on DMADEVICES && ACPI
 	select SND_SOC_INTEL_SST
-	select SND_SOC_INTEL_SST_ACPI
+	select SND_SOC_INTEL_HASWELL_ACPI
 	select SND_SOC_INTEL_SST_FIRMWARE
 	select SND_SOC_ACPI_INTEL_MATCH
 	help
sound/soc/intel/common/sst-acpi.c +0 -32
index 42f9b02f2ea3..7d2f04ff0479 100644
@@ -15,10 +15,6 @@
 #include <sound/soc-acpi.h>
 #include <sound/soc-acpi-intel-match.h>
 
-#define SST_LPT_DSP_DMA_ADDR_OFFSET	0x0F0000
-#define SST_WPT_DSP_DMA_ADDR_OFFSET	0x0FE000
-#define SST_LPT_DSP_DMA_SIZE		(1024 - 1)
-
 struct sst_acpi_priv {
 	struct platform_device *pdev_mach;
 	struct platform_device *pdev_pcm;
@@ -156,32 +152,6 @@ int sst_acpi_remove(struct platform_device *pdev)
 }
 EXPORT_SYMBOL_GPL(sst_acpi_remove);
 
-static struct sst_acpi_desc sst_acpi_haswell_desc = {
-	.drv_name = "haswell-pcm-audio",
-	.machines = snd_soc_acpi_intel_haswell_machines,
-	.resindex_lpe_base = 0,
-	.resindex_pcicfg_base = 1,
-	.resindex_fw_base = -1,
-	.irqindex_host_ipc = 0,
-	.sst_id = SST_DEV_ID_LYNX_POINT,
-	.dma_engine = SST_DMA_TYPE_DW,
-	.resindex_dma_base = SST_LPT_DSP_DMA_ADDR_OFFSET,
-	.dma_size = SST_LPT_DSP_DMA_SIZE,
-};
-
-static struct sst_acpi_desc sst_acpi_broadwell_desc = {
-	.drv_name = "haswell-pcm-audio",
-	.machines = snd_soc_acpi_intel_broadwell_machines,
-	.resindex_lpe_base = 0,
-	.resindex_pcicfg_base = 1,
-	.resindex_fw_base = -1,
-	.irqindex_host_ipc = 0,
-	.sst_id = SST_DEV_ID_WILDCAT_POINT,
-	.dma_engine = SST_DMA_TYPE_DW,
-	.resindex_dma_base = SST_WPT_DSP_DMA_ADDR_OFFSET,
-	.dma_size = SST_LPT_DSP_DMA_SIZE,
-};
-
 #if !IS_ENABLED(CONFIG_SND_SST_IPC_ACPI)
 static struct sst_acpi_desc sst_acpi_baytrail_desc = {
 	.drv_name = "baytrail-pcm-audio",
@@ -196,8 +166,6 @@ static struct sst_acpi_desc sst_acpi_baytrail_desc = {
 #endif
 
 static const struct acpi_device_id sst_acpi_match[] = {
-	{ "INT33C8", (unsigned long)&sst_acpi_haswell_desc },
-	{ "INT3438", (unsigned long)&sst_acpi_broadwell_desc },
 #if !IS_ENABLED(CONFIG_SND_SST_IPC_ACPI)
 	{ "80860F28", (unsigned long)&sst_acpi_baytrail_desc },
 #endif
sound/soc/intel/haswell/Makefile +2 -0
index ad2341aea8ae..0af852d0577b 100644
@@ -1,5 +1,7 @@
 # SPDX-License-Identifier: GPL-2.0-only
 snd-soc-sst-haswell-pcm-objs := \
 	        sst-haswell-ipc.o sst-haswell-pcm.o sst-haswell-dsp.o
+snd-soc-hsw-acpi-objs := acpi.o
 
 obj-$(CONFIG_SND_SOC_INTEL_HASWELL) += snd-soc-sst-haswell-pcm.o
+obj-$(CONFIG_SND_SOC_INTEL_HASWELL_ACPI) += snd-soc-hsw-acpi.o
sound/soc/intel/haswell/acpi.c new file +63 -0

63 lines not on this page · raw message

Signature · 1 line
2.17.1
#50 lore raw

Re: [PATCH 22/35] ASoC: Intel: Haswell: Define separate ACPI loader

Quoted 19 lines · Cezary Rojewski

With common acpi code exposed, separate Haswell specific code from other legacy platforms. To reduce diff delta, it's still loaded with separate module called: hsw-acpi. This may be address later, once heavy hitters are gone.

---
  sound/soc/intel/Kconfig           |  6 ++-
  sound/soc/intel/common/sst-acpi.c | 32 ----------------
  sound/soc/intel/haswell/Makefile  |  2 +
  sound/soc/intel/haswell/acpi.c    | 63 +++++++++++++++++++++++++++++++
  4 files changed, 70 insertions(+), 33 deletions(-)

create mode 100644 sound/soc/intel/haswell/acpi.c

sound/soc/intel/Kconfig +0 -0
index a3ec17fd63cd..9191773d203c 100644

sound/soc/intel/Kconfig config SND_SST_IPC_ACPI · line 36

Quoted 6 lines
sound/soc/intel/Kconfig +3 -0
@@ -31,6 +31,10 @@ config SND_SST_IPC_ACPI
  	# This option controls the ACPI-based IPC for HiFi2 platforms
  	# (Baytrail, Cherrytrail)
 
+config SND_SOC_INTEL_HASWELL_ACPI
+	tristate
+	# This option controls the ACPI-based on HSW/BDW platforms

missing noun.
ACPI-based probe?

Quoted 152 lines
sound/soc/intel/Kconfig +2 -1
+
  config SND_SOC_INTEL_SST_ACPI
  	tristate
  	# This option controls ACPI-based probing on
@@ -52,7 +56,7 @@ config SND_SOC_INTEL_HASWELL
  	depends on SND_DMA_SGBUF
  	depends on DMADEVICES && ACPI
  	select SND_SOC_INTEL_SST
-	select SND_SOC_INTEL_SST_ACPI
+	select SND_SOC_INTEL_HASWELL_ACPI
  	select SND_SOC_INTEL_SST_FIRMWARE
  	select SND_SOC_ACPI_INTEL_MATCH
  	help
sound/soc/intel/common/sst-acpi.c +0 -32
index 42f9b02f2ea3..7d2f04ff0479 100644
@@ -15,10 +15,6 @@
  #include <sound/soc-acpi.h>
  #include <sound/soc-acpi-intel-match.h>
 
-#define SST_LPT_DSP_DMA_ADDR_OFFSET	0x0F0000
-#define SST_WPT_DSP_DMA_ADDR_OFFSET	0x0FE000
-#define SST_LPT_DSP_DMA_SIZE		(1024 - 1)
-
  struct sst_acpi_priv {
  	struct platform_device *pdev_mach;
  	struct platform_device *pdev_pcm;
@@ -156,32 +152,6 @@ int sst_acpi_remove(struct platform_device *pdev)
  }
  EXPORT_SYMBOL_GPL(sst_acpi_remove);
 
-static struct sst_acpi_desc sst_acpi_haswell_desc = {
-	.drv_name = "haswell-pcm-audio",
-	.machines = snd_soc_acpi_intel_haswell_machines,
-	.resindex_lpe_base = 0,
-	.resindex_pcicfg_base = 1,
-	.resindex_fw_base = -1,
-	.irqindex_host_ipc = 0,
-	.sst_id = SST_DEV_ID_LYNX_POINT,
-	.dma_engine = SST_DMA_TYPE_DW,
-	.resindex_dma_base = SST_LPT_DSP_DMA_ADDR_OFFSET,
-	.dma_size = SST_LPT_DSP_DMA_SIZE,
-};
-
-static struct sst_acpi_desc sst_acpi_broadwell_desc = {
-	.drv_name = "haswell-pcm-audio",
-	.machines = snd_soc_acpi_intel_broadwell_machines,
-	.resindex_lpe_base = 0,
-	.resindex_pcicfg_base = 1,
-	.resindex_fw_base = -1,
-	.irqindex_host_ipc = 0,
-	.sst_id = SST_DEV_ID_WILDCAT_POINT,
-	.dma_engine = SST_DMA_TYPE_DW,
-	.resindex_dma_base = SST_WPT_DSP_DMA_ADDR_OFFSET,
-	.dma_size = SST_LPT_DSP_DMA_SIZE,
-};
-
  #if !IS_ENABLED(CONFIG_SND_SST_IPC_ACPI)
  static struct sst_acpi_desc sst_acpi_baytrail_desc = {
  	.drv_name = "baytrail-pcm-audio",
@@ -196,8 +166,6 @@ static struct sst_acpi_desc sst_acpi_baytrail_desc = {
  #endif
 
  static const struct acpi_device_id sst_acpi_match[] = {
-	{ "INT33C8", (unsigned long)&sst_acpi_haswell_desc },
-	{ "INT3438", (unsigned long)&sst_acpi_broadwell_desc },
  #if !IS_ENABLED(CONFIG_SND_SST_IPC_ACPI)
  	{ "80860F28", (unsigned long)&sst_acpi_baytrail_desc },
  #endif
sound/soc/intel/haswell/Makefile +2 -0
index ad2341aea8ae..0af852d0577b 100644
@@ -1,5 +1,7 @@
  # SPDX-License-Identifier: GPL-2.0-only
  snd-soc-sst-haswell-pcm-objs := \
  	        sst-haswell-ipc.o sst-haswell-pcm.o sst-haswell-dsp.o
+snd-soc-hsw-acpi-objs := acpi.o
 
  obj-$(CONFIG_SND_SOC_INTEL_HASWELL) += snd-soc-sst-haswell-pcm.o
+obj-$(CONFIG_SND_SOC_INTEL_HASWELL_ACPI) += snd-soc-hsw-acpi.o
sound/soc/intel/haswell/acpi.c new file +63 -0
new file mode 100644
index 000000000000..7bd8b03851c4
@@ -0,0 +1,63 @@
+// SPDX-License-Identifier: GPL-2.0-only
+/*
+ * Intel HSW loader on ACPI systems
+ *
+ * Copyright (C) 2019, Intel Corporation. All rights reserved.
+ */
+
+#include <linux/acpi.h>
+#include <linux/platform_device.h>
+#include <sound/soc-acpi.h>
+#include <sound/soc-acpi-intel-match.h>
+#include "../common/sst-dsp.h"
+
+#define SST_LPT_DSP_DMA_ADDR_OFFSET	0x0F0000
+#define SST_WPT_DSP_DMA_ADDR_OFFSET	0x0FE000
+#define SST_LPT_DSP_DMA_SIZE		(1024 - 1)
+
+static struct sst_acpi_desc hsw_acpi_desc = {
+	.drv_name = "haswell-pcm-audio",
+	.machines = snd_soc_acpi_intel_haswell_machines,
+	.resindex_lpe_base = 0,
+	.resindex_pcicfg_base = 1,
+	.resindex_fw_base = -1,
+	.irqindex_host_ipc = 0,
+	.sst_id = SST_DEV_ID_LYNX_POINT,
+	.dma_engine = SST_DMA_TYPE_DW,
+	.resindex_dma_base = SST_LPT_DSP_DMA_ADDR_OFFSET,
+	.dma_size = SST_LPT_DSP_DMA_SIZE,
+};
+
+static struct sst_acpi_desc bdw_acpi_desc = {
+	.drv_name = "haswell-pcm-audio",
+	.machines = snd_soc_acpi_intel_broadwell_machines,
+	.resindex_lpe_base = 0,
+	.resindex_pcicfg_base = 1,
+	.resindex_fw_base = -1,
+	.irqindex_host_ipc = 0,
+	.sst_id = SST_DEV_ID_WILDCAT_POINT,
+	.dma_engine = SST_DMA_TYPE_DW,
+	.resindex_dma_base = SST_WPT_DSP_DMA_ADDR_OFFSET,
+	.dma_size = SST_LPT_DSP_DMA_SIZE,
+};
+
+static const struct acpi_device_id hsw_acpi_ids[] = {
+	{ "INT33C8", (unsigned long)&hsw_acpi_desc },
+	{ "INT3438", (unsigned long)&bdw_acpi_desc },
+	{ }
+};
+MODULE_DEVICE_TABLE(acpi, hsw_acpi_ids);
+
+static struct platform_driver hsw_acpi_driver = {
+	.probe = sst_acpi_probe,
+	.remove = sst_acpi_remove,
+	.driver = {
+		.name = "hsw-acpi",
+		.acpi_match_table = ACPI_PTR(hsw_acpi_ids),
+	},
+};
+module_platform_driver(hsw_acpi_driver);
+
+MODULE_AUTHOR("Cezary Rojewski <[email protected]>");
+MODULE_DESCRIPTION("Intel HSW loader on ACPI systems");
+MODULE_LICENSE("GPL v2");
author maintainer
#51 lore raw

Re: [PATCH 22/35] ASoC: Intel: Haswell: Define separate ACPI loader

Quoted 17 lines · Pierre-Louis Bossart
Quoted 14 lines · Cezary Rojewski

With common acpi code exposed, separate Haswell specific code from other legacy platforms. To reduce diff delta, it's still loaded with separate module called: hsw-acpi. This may be address later, once heavy hitters are gone.

---
  sound/soc/intel/Kconfig           |  6 ++- sound/soc/intel/common/sst-acpi.c | 32 ---------------- sound/soc/intel/haswell/Makefile  |  2 + sound/soc/intel/haswell/acpi.c    | 63 +++++++++++++++++++++++++++++++

  4 files changed, 70 insertions(+), 33 deletions(-)

  create mode 100644 sound/soc/intel/haswell/acpi.c

Quoted 14 lines

sound/soc/intel/Kconfig config SND_SST_IPC_ACPI · line 35

Quoted 10 lines
sound/soc/intel/Kconfig +3 -0
index a3ec17fd63cd..9191773d203c 100644
@@ -31,6 +31,10 @@ config SND_SST_IPC_ACPI
       # This option controls the ACPI-based IPC for HiFi2 platforms
       # (Baytrail, Cherrytrail)
+config SND_SOC_INTEL_HASWELL_ACPI
+    tristate
+    # This option controls the ACPI-based on HSW/BDW platforms

missing noun.
ACPI-based probe?

Thanks for spotting this out, indeed it's missing.

Quoted 141 lines
Quoted 141 lines
sound/soc/intel/Kconfig +1 -0
+

  config SND_SOC_INTEL_SST_ACPI
      tristate
      # This option controls ACPI-based probing on

sound/soc/intel/Kconfig +0 -0
@@ -52,7 +56,7 @@ config SND_SOC_INTEL_HASWELL

      depends on SND_DMA_SGBUF
      depends on DMADEVICES && ACPI
      select SND_SOC_INTEL_SST
-    select SND_SOC_INTEL_SST_ACPI
+    select SND_SOC_INTEL_HASWELL_ACPI
      select SND_SOC_INTEL_SST_FIRMWARE
      select SND_SOC_ACPI_INTEL_MATCH
      help

sound/soc/intel/common/sst-acpi.c +0 -32
index 42f9b02f2ea3..7d2f04ff0479 100644
@@ -15,10 +15,6 @@
   #include <sound/soc-acpi.h>
   #include <sound/soc-acpi-intel-match.h>
-#define SST_LPT_DSP_DMA_ADDR_OFFSET    0x0F0000
-#define SST_WPT_DSP_DMA_ADDR_OFFSET    0x0FE000
-#define SST_LPT_DSP_DMA_SIZE        (1024 - 1)
-
   struct sst_acpi_priv {
       struct platform_device *pdev_mach;
       struct platform_device *pdev_pcm;
@@ -156,32 +152,6 @@ int sst_acpi_remove(struct platform_device *pdev)
   }
   EXPORT_SYMBOL_GPL(sst_acpi_remove);
-static struct sst_acpi_desc sst_acpi_haswell_desc = {
-    .drv_name = "haswell-pcm-audio",
-    .machines = snd_soc_acpi_intel_haswell_machines,
-    .resindex_lpe_base = 0,
-    .resindex_pcicfg_base = 1,
-    .resindex_fw_base = -1,
-    .irqindex_host_ipc = 0,
-    .sst_id = SST_DEV_ID_LYNX_POINT,
-    .dma_engine = SST_DMA_TYPE_DW,
-    .resindex_dma_base = SST_LPT_DSP_DMA_ADDR_OFFSET,
-    .dma_size = SST_LPT_DSP_DMA_SIZE,
-};
-
-static struct sst_acpi_desc sst_acpi_broadwell_desc = {
-    .drv_name = "haswell-pcm-audio",
-    .machines = snd_soc_acpi_intel_broadwell_machines,
-    .resindex_lpe_base = 0,
-    .resindex_pcicfg_base = 1,
-    .resindex_fw_base = -1,
-    .irqindex_host_ipc = 0,
-    .sst_id = SST_DEV_ID_WILDCAT_POINT,
-    .dma_engine = SST_DMA_TYPE_DW,
-    .resindex_dma_base = SST_WPT_DSP_DMA_ADDR_OFFSET,
-    .dma_size = SST_LPT_DSP_DMA_SIZE,
-};
-
   #if !IS_ENABLED(CONFIG_SND_SST_IPC_ACPI)
   static struct sst_acpi_desc sst_acpi_baytrail_desc = {
       .drv_name = "baytrail-pcm-audio",
@@ -196,8 +166,6 @@ static struct sst_acpi_desc sst_acpi_baytrail_desc 
 = {
   #endif
   static const struct acpi_device_id sst_acpi_match[] = {
-    { "INT33C8", (unsigned long)&sst_acpi_haswell_desc },
-    { "INT3438", (unsigned long)&sst_acpi_broadwell_desc },
   #if !IS_ENABLED(CONFIG_SND_SST_IPC_ACPI)
       { "80860F28", (unsigned long)&sst_acpi_baytrail_desc },
   #endif
sound/soc/intel/haswell/Makefile +0 -0
index ad2341aea8ae..0af852d0577b 100644
@@ -1,5 +1,7 @@
   # SPDX-License-Identifier: GPL-2.0-only
   snd-soc-sst-haswell-pcm-objs := \

              sst-haswell-ipc.o sst-haswell-pcm.o sst-haswell-dsp.o +snd-soc-hsw-acpi-objs := acpi.o obj-$(CONFIG_SND_SOC_INTEL_HASWELL) += snd-soc-sst-haswell-pcm.o

sound/soc/intel/haswell/Makefile +1 -0
+obj-$(CONFIG_SND_SOC_INTEL_HASWELL_ACPI) += snd-soc-hsw-acpi.o
sound/soc/intel/haswell/acpi.c new file +56 -0
new file mode 100644
index 000000000000..7bd8b03851c4
@@ -0,0 +1,63 @@
+// SPDX-License-Identifier: GPL-2.0-only
+/*
+ * Intel HSW loader on ACPI systems
+ *
+ * Copyright (C) 2019, Intel Corporation. All rights reserved.
+ */
+
+#include <linux/acpi.h>
+#include <linux/platform_device.h>
+#include <sound/soc-acpi.h>
+#include <sound/soc-acpi-intel-match.h>
+#include "../common/sst-dsp.h"
+
+#define SST_LPT_DSP_DMA_ADDR_OFFSET    0x0F0000
+#define SST_WPT_DSP_DMA_ADDR_OFFSET    0x0FE000
+#define SST_LPT_DSP_DMA_SIZE        (1024 - 1)
+
+static struct sst_acpi_desc hsw_acpi_desc = {
+    .drv_name = "haswell-pcm-audio",
+    .machines = snd_soc_acpi_intel_haswell_machines,
+    .resindex_lpe_base = 0,
+    .resindex_pcicfg_base = 1,
+    .resindex_fw_base = -1,
+    .irqindex_host_ipc = 0,
+    .sst_id = SST_DEV_ID_LYNX_POINT,
+    .dma_engine = SST_DMA_TYPE_DW,
+    .resindex_dma_base = SST_LPT_DSP_DMA_ADDR_OFFSET,
+    .dma_size = SST_LPT_DSP_DMA_SIZE,
+};
+
+static struct sst_acpi_desc bdw_acpi_desc = {
+    .drv_name = "haswell-pcm-audio",
+    .machines = snd_soc_acpi_intel_broadwell_machines,
+    .resindex_lpe_base = 0,
+    .resindex_pcicfg_base = 1,
+    .resindex_fw_base = -1,
+    .irqindex_host_ipc = 0,
+    .sst_id = SST_DEV_ID_WILDCAT_POINT,
+    .dma_engine = SST_DMA_TYPE_DW,
+    .resindex_dma_base = SST_WPT_DSP_DMA_ADDR_OFFSET,
+    .dma_size = SST_LPT_DSP_DMA_SIZE,
+};
+
+static const struct acpi_device_id hsw_acpi_ids[] = {
+    { "INT33C8", (unsigned long)&hsw_acpi_desc },
+    { "INT3438", (unsigned long)&bdw_acpi_desc },
+    { }
+};
+MODULE_DEVICE_TABLE(acpi, hsw_acpi_ids);
+
+static struct platform_driver hsw_acpi_driver = {
+    .probe = sst_acpi_probe,
+    .remove = sst_acpi_remove,
+    .driver = {
+        .name = "hsw-acpi",
+        .acpi_match_table = ACPI_PTR(hsw_acpi_ids),
Quoted 8 lines

sound/soc/intel/haswell/acpi.c line 63

Quoted 8 lines
sound/soc/intel/haswell/acpi.c new file +7 -0
+    },
+};
+module_platform_driver(hsw_acpi_driver);
+
+MODULE_AUTHOR("Cezary Rojewski <[email protected]>");
+MODULE_DESCRIPTION("Intel HSW loader on ACPI systems");
+MODULE_LICENSE("GPL v2");

_______________________________________________
Alsa-devel mailing list
[email protected]
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

author maintainer
#52 lore raw

PATCH 23/35 ASoC: Intel: Baytrail: Define separate ACPI loader

In reply to Cezary Rojewski

With common acpi code exposed, separate Baytrail specific code from other legacy platforms. To reduce diff delta, it's still loaded with separate module called: byt-acpi. This may be address later, once heavy hitters are gone. Since this is the second of two, separation carries removal of common sst-acpi module with it.

---
 sound/soc/intel/Kconfig                     |  8 ++--
 sound/soc/intel/baytrail/Makefile           |  2 +
 sound/soc/intel/baytrail/acpi.c             | 43 +++++++++++++++++++++
 sound/soc/intel/baytrail/sst-baytrail-dsp.c |  1 -
 sound/soc/intel/common/Makefile             |  4 +-
 sound/soc/intel/common/sst-acpi.c           | 36 -----------------
 6 files changed, 49 insertions(+), 45 deletions(-)
 create mode 100644 sound/soc/intel/baytrail/acpi.c
sound/soc/intel/Kconfig +3 -5
index 9191773d203c..baab845ea0ef 100644
@@ -35,11 +35,9 @@ config SND_SOC_INTEL_HASWELL_ACPI
 	tristate
 	# This option controls the ACPI-based on HSW/BDW platforms
 
-config SND_SOC_INTEL_SST_ACPI
+config SND_SOC_INTEL_BAYTRAIL_ACPI
 	tristate
-	# This option controls ACPI-based probing on
-	# Haswell/Broadwell/Baytrail legacy and will be set
-	# when these platforms are enabled
+	# This option controls the ACPI-based on BYT platforms
 
 config SND_SOC_INTEL_SST
 	tristate
@@ -68,7 +66,7 @@ config SND_SOC_INTEL_BAYTRAIL
 	tristate "Baytrail (legacy) Platforms"
 	depends on DMADEVICES && ACPI && SND_SST_ATOM_HIFI2_PLATFORM=n
 	select SND_SOC_INTEL_SST
-	select SND_SOC_INTEL_SST_ACPI
+	select SND_SOC_INTEL_BAYTRAIL_ACPI
 	select SND_SOC_INTEL_SST_FIRMWARE
 	select SND_SOC_ACPI_INTEL_MATCH
 	help
sound/soc/intel/baytrail/Makefile +2 -0
index 4d0806aac6bd..b59d4893b46b 100644
@@ -1,5 +1,7 @@
 # SPDX-License-Identifier: GPL-2.0-only
 snd-soc-sst-baytrail-pcm-objs := \
 	        sst-baytrail-ipc.o sst-baytrail-pcm.o sst-baytrail-dsp.o
+snd-soc-byt-acpi-objs := acpi.o
 
 obj-$(CONFIG_SND_SOC_INTEL_BAYTRAIL) += snd-soc-sst-baytrail-pcm.o
+obj-$(CONFIG_SND_SOC_INTEL_BAYTRAIL_ACPI) += snd-soc-byt-acpi.o
sound/soc/intel/baytrail/acpi.c new file +43 -0

43 lines not on this page · raw message

sound/soc/intel/baytrail/sst-baytrail-dsp.c +0 -1
index 4869e18116eb..81bc05d62d5d 100644
@@ -13,7 +13,6 @@
 #include <linux/dma-mapping.h>
 #include <linux/platform_device.h>
 #include <linux/firmware.h>
-
 #include "../common/sst-dsp.h"
 #include "../common/sst-dsp-priv.h"
 #include "sst-baytrail-ipc.h"
sound/soc/intel/common/Makefile +1 -3
index 56c81e20b5bf..65e0e66ab64f 100644
@@ -1,6 +1,5 @@
 # SPDX-License-Identifier: GPL-2.0
-snd-soc-sst-dsp-objs := sst-dsp.o
-snd-soc-sst-acpi-objs := sst-acpi.o
+snd-soc-sst-dsp-objs := sst-dsp.o sst-acpi.o
 snd-soc-sst-ipc-objs := sst-ipc.o
 snd-soc-sst-firmware-objs := sst-firmware.o
 snd-soc-acpi-intel-match-objs := soc-acpi-intel-byt-match.o soc-acpi-intel-cht-match.o \
@@ -11,6 +10,5 @@ snd-soc-acpi-intel-match-objs := soc-acpi-intel-byt-match.o soc-acpi-intel-cht-m
 	soc-acpi-intel-hda-match.o
 
 obj-$(CONFIG_SND_SOC_INTEL_SST) += snd-soc-sst-dsp.o snd-soc-sst-ipc.o
-obj-$(CONFIG_SND_SOC_INTEL_SST_ACPI) += snd-soc-sst-acpi.o
 obj-$(CONFIG_SND_SOC_INTEL_SST_FIRMWARE) += snd-soc-sst-firmware.o
 obj-$(CONFIG_SND_SOC_ACPI_INTEL_MATCH) += snd-soc-acpi-intel-match.o
sound/soc/intel/common/sst-acpi.c +0 -36
index 7d2f04ff0479..8e75126106ea 100644
@@ -13,7 +13,6 @@
 
 #include "sst-dsp.h"
 #include <sound/soc-acpi.h>
-#include <sound/soc-acpi-intel-match.h>
 
 struct sst_acpi_priv {
 	struct platform_device *pdev_mach;
@@ -151,38 +150,3 @@ int sst_acpi_remove(struct platform_device *pdev)
 	return 0;
 }
 EXPORT_SYMBOL_GPL(sst_acpi_remove);
-
-#if !IS_ENABLED(CONFIG_SND_SST_IPC_ACPI)
-static struct sst_acpi_desc sst_acpi_baytrail_desc = {
-	.drv_name = "baytrail-pcm-audio",
-	.machines = snd_soc_acpi_intel_baytrail_legacy_machines,
-	.resindex_lpe_base = 0,
-	.resindex_pcicfg_base = 1,
-	.resindex_fw_base = 2,
-	.irqindex_host_ipc = 5,
-	.sst_id = SST_DEV_ID_BYT,
-	.resindex_dma_base = -1,
-};
-#endif
-
-static const struct acpi_device_id sst_acpi_match[] = {
-#if !IS_ENABLED(CONFIG_SND_SST_IPC_ACPI)
-	{ "80860F28", (unsigned long)&sst_acpi_baytrail_desc },
-#endif
-	{ }
-};
-MODULE_DEVICE_TABLE(acpi, sst_acpi_match);
-
-static struct platform_driver sst_acpi_driver = {
-	.probe = sst_acpi_probe,
-	.remove = sst_acpi_remove,
-	.driver = {
-		.name = "sst-acpi",
-		.acpi_match_table = ACPI_PTR(sst_acpi_match),
-	},
-};
-module_platform_driver(sst_acpi_driver);
-
-MODULE_AUTHOR("Jarkko Nikula <[email protected]>");
-MODULE_DESCRIPTION("Intel SST loader on ACPI systems");
-MODULE_LICENSE("GPL v2");
Signature · 1 line
2.17.1
#53 lore raw

Re: [PATCH 23/35] ASoC: Intel: Baytrail: Define separate ACPI loader

Quoted 22 lines · Cezary Rojewski

With common acpi code exposed, separate Baytrail specific code from other legacy platforms. To reduce diff delta, it's still loaded with separate module called: byt-acpi. This may be address later, once heavy hitters are gone. Since this is the second of two, separation carries removal of common sst-acpi module with it.

---
  sound/soc/intel/Kconfig                     |  8 ++--
  sound/soc/intel/baytrail/Makefile           |  2 +
  sound/soc/intel/baytrail/acpi.c             | 43 +++++++++++++++++++++
  sound/soc/intel/baytrail/sst-baytrail-dsp.c |  1 -
  sound/soc/intel/common/Makefile             |  4 +-
  sound/soc/intel/common/sst-acpi.c           | 36 -----------------
  6 files changed, 49 insertions(+), 45 deletions(-)

create mode 100644 sound/soc/intel/baytrail/acpi.c

sound/soc/intel/Kconfig +0 -0
index 9191773d203c..baab845ea0ef 100644

sound/soc/intel/Kconfig config SND_SOC_INTEL_HASWELL_ACPI · line 40

Quoted 10 lines
sound/soc/intel/Kconfig +2 -4
@@ -35,11 +35,9 @@ config SND_SOC_INTEL_HASWELL_ACPI
  	tristate
  	# This option controls the ACPI-based on HSW/BDW platforms
 
-config SND_SOC_INTEL_SST_ACPI
+config SND_SOC_INTEL_BAYTRAIL_ACPI
  	tristate
-	# This option controls ACPI-based probing on
-	# Haswell/Broadwell/Baytrail legacy and will be set
-	# when these platforms are enabled
+	# This option controls the ACPI-based on BYT platforms

ACPI-based probe?

Quoted 156 lines
sound/soc/intel/Kconfig +1 -1
  config SND_SOC_INTEL_SST
  	tristate
@@ -68,7 +66,7 @@ config SND_SOC_INTEL_BAYTRAIL
  	tristate "Baytrail (legacy) Platforms"
  	depends on DMADEVICES && ACPI && SND_SST_ATOM_HIFI2_PLATFORM=n
  	select SND_SOC_INTEL_SST
-	select SND_SOC_INTEL_SST_ACPI
+	select SND_SOC_INTEL_BAYTRAIL_ACPI
  	select SND_SOC_INTEL_SST_FIRMWARE
  	select SND_SOC_ACPI_INTEL_MATCH
  	help
sound/soc/intel/baytrail/Makefile +2 -0
index 4d0806aac6bd..b59d4893b46b 100644
@@ -1,5 +1,7 @@
  # SPDX-License-Identifier: GPL-2.0-only
  snd-soc-sst-baytrail-pcm-objs := \
  	        sst-baytrail-ipc.o sst-baytrail-pcm.o sst-baytrail-dsp.o
+snd-soc-byt-acpi-objs := acpi.o
 
  obj-$(CONFIG_SND_SOC_INTEL_BAYTRAIL) += snd-soc-sst-baytrail-pcm.o
+obj-$(CONFIG_SND_SOC_INTEL_BAYTRAIL_ACPI) += snd-soc-byt-acpi.o
sound/soc/intel/baytrail/acpi.c new file +43 -0
new file mode 100644
index 000000000000..57d10a6e3be2
@@ -0,0 +1,43 @@
+// SPDX-License-Identifier: GPL-2.0-only
+/*
+ * Intel BYT loader on ACPI systems
+ *
+ * Copyright (C) 2019, Intel Corporation. All rights reserved.
+ */
+
+#include <linux/acpi.h>
+#include <linux/platform_device.h>
+#include <sound/soc-acpi.h>
+#include <sound/soc-acpi-intel-match.h>
+#include "../common/sst-dsp.h"
+
+static struct sst_acpi_desc byt_acpi_desc = {
+	.drv_name = "baytrail-pcm-audio",
+	.machines = snd_soc_acpi_intel_baytrail_legacy_machines,
+	.resindex_lpe_base = 0,
+	.resindex_pcicfg_base = 1,
+	.resindex_fw_base = 2,
+	.irqindex_host_ipc = 5,
+	.sst_id = SST_DEV_ID_BYT,
+	.resindex_dma_base = -1,
+};
+
+static const struct acpi_device_id byt_acpi_ids[] = {
+	{ "80860F28", (unsigned long)&byt_acpi_desc },
+	{ }
+};
+MODULE_DEVICE_TABLE(acpi, byt_acpi_ids);
+
+static struct platform_driver byt_acpi_driver = {
+	.probe = sst_acpi_probe,
+	.remove = sst_acpi_remove,
+	.driver = {
+		.name = "byt-acpi",
+		.acpi_match_table = ACPI_PTR(byt_acpi_ids),
+	},
+};
+module_platform_driver(byt_acpi_driver);
+
+MODULE_AUTHOR("Cezary Rojewski <[email protected]>");
+MODULE_DESCRIPTION("Intel BYT loader on ACPI systems");
+MODULE_LICENSE("GPL v2");
sound/soc/intel/baytrail/sst-baytrail-dsp.c +0 -1
index 4869e18116eb..81bc05d62d5d 100644
@@ -13,7 +13,6 @@
  #include <linux/dma-mapping.h>
  #include <linux/platform_device.h>
  #include <linux/firmware.h>
-
  #include "../common/sst-dsp.h"
  #include "../common/sst-dsp-priv.h"
  #include "sst-baytrail-ipc.h"
sound/soc/intel/common/Makefile +1 -3
index 56c81e20b5bf..65e0e66ab64f 100644
@@ -1,6 +1,5 @@
  # SPDX-License-Identifier: GPL-2.0
-snd-soc-sst-dsp-objs := sst-dsp.o
-snd-soc-sst-acpi-objs := sst-acpi.o
+snd-soc-sst-dsp-objs := sst-dsp.o sst-acpi.o
  snd-soc-sst-ipc-objs := sst-ipc.o
  snd-soc-sst-firmware-objs := sst-firmware.o
  snd-soc-acpi-intel-match-objs := soc-acpi-intel-byt-match.o soc-acpi-intel-cht-match.o \
@@ -11,6 +10,5 @@ snd-soc-acpi-intel-match-objs := soc-acpi-intel-byt-match.o soc-acpi-intel-cht-m
  	soc-acpi-intel-hda-match.o
 
  obj-$(CONFIG_SND_SOC_INTEL_SST) += snd-soc-sst-dsp.o snd-soc-sst-ipc.o
-obj-$(CONFIG_SND_SOC_INTEL_SST_ACPI) += snd-soc-sst-acpi.o
  obj-$(CONFIG_SND_SOC_INTEL_SST_FIRMWARE) += snd-soc-sst-firmware.o
  obj-$(CONFIG_SND_SOC_ACPI_INTEL_MATCH) += snd-soc-acpi-intel-match.o
sound/soc/intel/common/sst-acpi.c +0 -36
index 7d2f04ff0479..8e75126106ea 100644
@@ -13,7 +13,6 @@
 
  #include "sst-dsp.h"
  #include <sound/soc-acpi.h>
-#include <sound/soc-acpi-intel-match.h>
 
  struct sst_acpi_priv {
  	struct platform_device *pdev_mach;
@@ -151,38 +150,3 @@ int sst_acpi_remove(struct platform_device *pdev)
  	return 0;
  }
  EXPORT_SYMBOL_GPL(sst_acpi_remove);
-
-#if !IS_ENABLED(CONFIG_SND_SST_IPC_ACPI)
-static struct sst_acpi_desc sst_acpi_baytrail_desc = {
-	.drv_name = "baytrail-pcm-audio",
-	.machines = snd_soc_acpi_intel_baytrail_legacy_machines,
-	.resindex_lpe_base = 0,
-	.resindex_pcicfg_base = 1,
-	.resindex_fw_base = 2,
-	.irqindex_host_ipc = 5,
-	.sst_id = SST_DEV_ID_BYT,
-	.resindex_dma_base = -1,
-};
-#endif
-
-static const struct acpi_device_id sst_acpi_match[] = {
-#if !IS_ENABLED(CONFIG_SND_SST_IPC_ACPI)
-	{ "80860F28", (unsigned long)&sst_acpi_baytrail_desc },
-#endif
-	{ }
-};
-MODULE_DEVICE_TABLE(acpi, sst_acpi_match);
-
-static struct platform_driver sst_acpi_driver = {
-	.probe = sst_acpi_probe,
-	.remove = sst_acpi_remove,
-	.driver = {
-		.name = "sst-acpi",
-		.acpi_match_table = ACPI_PTR(sst_acpi_match),
-	},
-};
-module_platform_driver(sst_acpi_driver);
-
-MODULE_AUTHOR("Jarkko Nikula <[email protected]>");
-MODULE_DESCRIPTION("Intel SST loader on ACPI systems");
-MODULE_LICENSE("GPL v2");
author maintainer
#54 lore raw

PATCH 24/35 ASoC: Intel: Refactor probing of ACPI devices

In reply to Cezary Rojewski

Baytrail and Haswell ACPI loading is now separated and no longer clutters common code. Let's improve the loading procedure and remove some superfluous members.

This change removes sst_pdata::resindex_dma_base as it is a duplication of dma_base. dma_base field has had it's type changed to allow for -1 (not used) value.

ACPI descriptor: sst_acpi_desc loses machines field and sst_id - now accessed via sst_pdata::boards and sst_pdata::id respectively. Cleanup consists mainly of legacy platform-specific probe routines being provided for each descendant. Prevents code duplications, especially for HSW/ BDW case while not losing any readability.

---
 sound/soc/intel/baytrail/acpi.c         | 43 +++++++++++-----
 sound/soc/intel/common/sst-acpi.c       | 21 +++-----
 sound/soc/intel/common/sst-dsp.h        |  8 +--
 sound/soc/intel/common/sst-firmware.c   |  2 +-
 sound/soc/intel/haswell/acpi.c          | 65 +++++++++++++++----------
 sound/soc/intel/skylake/skl-sst-utils.c |  2 +-
 6 files changed, 82 insertions(+), 59 deletions(-)
sound/soc/intel/baytrail/acpi.c +32 -11
index 57d10a6e3be2..bf2560a8f3e2 100644
@@ -11,25 +11,46 @@
 #include <sound/soc-acpi-intel-match.h>
 #include "../common/sst-dsp.h"
 
-static struct sst_acpi_desc byt_acpi_desc = {
-	.drv_name = "baytrail-pcm-audio",
-	.machines = snd_soc_acpi_intel_baytrail_legacy_machines,
-	.resindex_lpe_base = 0,
-	.resindex_pcicfg_base = 1,
-	.resindex_fw_base = 2,
-	.irqindex_host_ipc = 5,
-	.sst_id = SST_DEV_ID_BYT,
-	.resindex_dma_base = -1,
+static struct sst_pdata byt_desc = {
+	.id = SST_DEV_ID_BYT,
+	.fw_name = "intel/fw_sst_0f28.bin-48kHz_i2s_master",
+	.boards = snd_soc_acpi_intel_baytrail_legacy_machines,
+	.dma_base = -1,
 };
 
 static const struct acpi_device_id byt_acpi_ids[] = {
-	{ "80860F28", (unsigned long)&byt_acpi_desc },
+	{ "80860F28", (unsigned long)&byt_desc },
 	{ }
 };
 MODULE_DEVICE_TABLE(acpi, byt_acpi_ids);
 
+static int byt_acpi_probe(struct platform_device *pdev)
+{
+	struct device *dev = &pdev->dev;
+	struct sst_acpi_desc *acpi_desc;
+	const struct acpi_device_id *id;
+
+	id = acpi_match_device(dev->driver->acpi_match_table, dev);
+	if (!id)
+		return -ENODEV;
+
+	acpi_desc = devm_kzalloc(dev, sizeof(*acpi_desc), GFP_KERNEL);
+	if (!acpi_desc)
+		return -ENOMEM;
+
+	acpi_desc->drv_name = "baytrail-pcm-audio";
+	acpi_desc->pdata = (struct sst_pdata *)id->driver_data;
+	acpi_desc->resindex_lpe_base = 0;
+	acpi_desc->resindex_pcicfg_base = 1;
+	acpi_desc->resindex_fw_base = 2;
+	acpi_desc->irqindex_host_ipc = 5;
+	platform_set_drvdata(pdev, acpi_desc);
+
+	return sst_acpi_probe(pdev);
+}
+
 static struct platform_driver byt_acpi_driver = {
-	.probe = sst_acpi_probe,
+	.probe = byt_acpi_probe,
 	.remove = sst_acpi_remove,
 	.driver = {
 		.name = "byt-acpi",
sound/soc/intel/common/sst-acpi.c +6 -15
index 8e75126106ea..53ac23f05966 100644
@@ -17,7 +17,6 @@
 struct sst_acpi_priv {
 	struct platform_device *pdev_mach;
 	struct platform_device *pdev_pcm;
-	struct sst_pdata sst_pdata;
 	struct sst_acpi_desc *desc;
 	struct snd_soc_acpi_mach *mach;
 };
@@ -27,8 +26,8 @@ static void sst_acpi_fw_cb(const struct firmware *fw, void *context)
 	struct platform_device *pdev = context;
 	struct device *dev = &pdev->dev;
 	struct sst_acpi_priv *sst_acpi = platform_get_drvdata(pdev);
-	struct sst_pdata *sst_pdata = &sst_acpi->sst_pdata;
 	struct sst_acpi_desc *desc = sst_acpi->desc;
+	struct sst_pdata *sst_pdata = desc->pdata;
 	struct snd_soc_acpi_mach *mach = sst_acpi->mach;
 
 	sst_pdata->fw = fw;
@@ -51,7 +50,6 @@ static void sst_acpi_fw_cb(const struct firmware *fw, void *context)
 
 int sst_acpi_probe(struct platform_device *pdev)
 {
-	const struct acpi_device_id *id;
 	struct device *dev = &pdev->dev;
 	struct sst_acpi_priv *sst_acpi;
 	struct sst_pdata *sst_pdata;
@@ -64,27 +62,20 @@ int sst_acpi_probe(struct platform_device *pdev)
 	if (sst_acpi == NULL)
 		return -ENOMEM;
 
-	id = acpi_match_device(dev->driver->acpi_match_table, dev);
-	if (!id)
-		return -ENODEV;
-
-	desc = (struct sst_acpi_desc *)id->driver_data;
-	mach = snd_soc_acpi_find_machine(desc->machines);
+	desc = platform_get_drvdata(pdev);
+	sst_pdata = desc->pdata;
+	mach = snd_soc_acpi_find_machine(sst_pdata->boards);
 	if (mach == NULL) {
 		dev_err(dev, "No matching ASoC machine driver found\n");
 		return -ENODEV;
 	}
 
-	sst_pdata = &sst_acpi->sst_pdata;
-	sst_pdata->id = desc->sst_id;
 	sst_pdata->dma_dev = dev;
 	sst_acpi->desc = desc;
 	sst_acpi->mach = mach;
 
-	sst_pdata->resindex_dma_base = desc->resindex_dma_base;
-	if (desc->resindex_dma_base >= 0) {
+	if (sst_pdata->dma_base >= 0) {
 		sst_pdata->dma_engine = desc->dma_engine;
-		sst_pdata->dma_base = desc->resindex_dma_base;
 		sst_pdata->dma_size = desc->dma_size;
 	}
 
@@ -140,7 +131,7 @@ EXPORT_SYMBOL_GPL(sst_acpi_probe);
 int sst_acpi_remove(struct platform_device *pdev)
 {
 	struct sst_acpi_priv *sst_acpi = platform_get_drvdata(pdev);
-	struct sst_pdata *sst_pdata = &sst_acpi->sst_pdata;
+	struct sst_pdata *sst_pdata = sst_acpi->desc->pdata;
 
 	platform_device_unregister(sst_acpi->pdev_mach);
 	if (!IS_ERR_OR_NULL(sst_acpi->pdev_pcm))
sound/soc/intel/common/sst-dsp.h +2 -6
index a2ac7998fbdb..87d39b0e79c0 100644
@@ -171,16 +171,13 @@ struct platform_device;
 /* Descriptor for setting up SST platform data */
 struct sst_acpi_desc {
 	const char *drv_name;
-	struct snd_soc_acpi_mach *machines;
+	struct sst_pdata *pdata;
 	/* Platform resource indexes. Must set to -1 if not used */
 	int resindex_lpe_base;
 	int resindex_pcicfg_base;
 	int resindex_fw_base;
 	int irqindex_host_ipc;
 	int resindex_dma_base;
-	/* Unique number identifying the SST core on platform */
-	int sst_id;
-	/* DMA only valid when resindex_dma_base != -1*/
 	int dma_engine;
 	int dma_size;
 };
@@ -205,8 +202,7 @@ struct sst_pdata {
 	const struct firmware *fw;
 
 	/* DMA */
-	int resindex_dma_base; /* other fields invalid if equals to -1 */
-	u32 dma_base;
+	int dma_base; /* other fields invalid if equals to -1 */
 	u32 dma_size;
 	int dma_engine;
 	struct device *dma_dev;
sound/soc/intel/common/sst-firmware.c +1 -1
index 6b6af11c32c3..61d3e6e46b98 100644
@@ -268,7 +268,7 @@ static int sst_dma_new(struct sst_dsp *sst)
 	struct resource mem;
 	int ret = 0;
 
-	if (sst->pdata->resindex_dma_base == -1)
+	if (sst->pdata->dma_base == -1)
 		/* DMA is not used, return and squelsh error messages */
 		return 0;
 
sound/soc/intel/haswell/acpi.c +40 -25

81 lines not on this page · raw message

sound/soc/intel/skylake/skl-sst-utils.c +1 -1
index bbe67e298efe..ac0a0e4c2d68 100644
@@ -363,7 +363,7 @@ int skl_sst_ctx_init(struct device *dev, int irq, const char *fw_name,
 
 	pdata->id = skl->pci->device;
 	pdata->irq = irq;
-	pdata->resindex_dma_base = -1;
+	pdata->dma_base = -1;
 	skl->dev = dev;
 	pdata->dsp = skl;
 	INIT_LIST_HEAD(&skl->uuid_list);
Signature · 1 line
2.17.1
#55 lore raw

Re: [PATCH 24/35] ASoC: Intel: Refactor probing of ACPI devices

Quoted 35 lines · Cezary Rojewski

Baytrail and Haswell ACPI loading is now separated and no longer clutters common code. Let's improve the loading procedure and remove some superfluous members.

This change removes sst_pdata::resindex_dma_base as it is a duplication of dma_base. dma_base field has had it's type changed to allow for -1 (not used) value.

ACPI descriptor: sst_acpi_desc loses machines field and sst_id - now accessed via sst_pdata::boards and sst_pdata::id respectively. Cleanup consists mainly of legacy platform-specific probe routines being provided for each descendant. Prevents code duplications, especially for HSW/ BDW case while not losing any readability.

---
  sound/soc/intel/baytrail/acpi.c         | 43 +++++++++++-----
  sound/soc/intel/common/sst-acpi.c       | 21 +++-----
  sound/soc/intel/common/sst-dsp.h        |  8 +--
  sound/soc/intel/common/sst-firmware.c   |  2 +-
  sound/soc/intel/haswell/acpi.c          | 65 +++++++++++++++----------
  sound/soc/intel/skylake/skl-sst-utils.c |  2 +-
  6 files changed, 82 insertions(+), 59 deletions(-)
sound/soc/intel/baytrail/acpi.c +0 -3
index 57d10a6e3be2..bf2560a8f3e2 100644
@@ -11,25 +11,46 @@
  #include <sound/soc-acpi-intel-match.h>
  #include "../common/sst-dsp.h"
 
-static struct sst_acpi_desc byt_acpi_desc = {
-	.drv_name = "baytrail-pcm-audio",
-	.machines = snd_soc_acpi_intel_baytrail_legacy_machines,

sound/soc/intel/baytrail/acpi.c line 17

Quoted 10 lines
sound/soc/intel/baytrail/acpi.c +4 -6
-	.resindex_lpe_base = 0,
-	.resindex_pcicfg_base = 1,
-	.resindex_fw_base = 2,
-	.irqindex_host_ipc = 5,
-	.sst_id = SST_DEV_ID_BYT,
-	.resindex_dma_base = -1,
+static struct sst_pdata byt_desc = {
+	.id = SST_DEV_ID_BYT,
+	.fw_name = "intel/fw_sst_0f28.bin-48kHz_i2s_master",
+	.boards = snd_soc_acpi_intel_baytrail_legacy_machines,

So instead of simplifying you are duplicating the fw_name here.

struct snd_soc_acpi_mach snd_soc_acpi_intel_baytrail_legacy_machines[] = {
	{
		.id = "10EC5640",
		.drv_name = "byt-rt5640",
		.fw_filename = "intel/fw_sst_0f28.bin-48kHz_i2s_master",
	},
	{
		.id = "193C9890",
		.drv_name = "byt-max98090",
		.fw_filename = "intel/fw_sst_0f28.bin-48kHz_i2s_master",
	},
	{}
};

What is the value of all this?

Quoted 20 lines
sound/soc/intel/baytrail/acpi.c +12 -1
+	.dma_base = -1,
  };
 
  static const struct acpi_device_id byt_acpi_ids[] = {
-	{ "80860F28", (unsigned long)&byt_acpi_desc },
+	{ "80860F28", (unsigned long)&byt_desc },
  	{ }
  };
  MODULE_DEVICE_TABLE(acpi, byt_acpi_ids);
 
+static int byt_acpi_probe(struct platform_device *pdev)
+{
+	struct device *dev = &pdev->dev;
+	struct sst_acpi_desc *acpi_desc;
+	const struct acpi_device_id *id;
+
+	id = acpi_match_device(dev->driver->acpi_match_table, dev);
+	if (!id)
+		return -ENODEV;
+

sound/soc/intel/baytrail/acpi.c line 46

Quoted 10 lines
sound/soc/intel/baytrail/acpi.c +10 -0
+	acpi_desc = devm_kzalloc(dev, sizeof(*acpi_desc), GFP_KERNEL);
+	if (!acpi_desc)
+		return -ENOMEM;
+
+	acpi_desc->drv_name = "baytrail-pcm-audio";
+	acpi_desc->pdata = (struct sst_pdata *)id->driver_data;
+	acpi_desc->resindex_lpe_base = 0;
+	acpi_desc->resindex_pcicfg_base = 1;
+	acpi_desc->resindex_fw_base = 2;
+	acpi_desc->irqindex_host_ipc = 5;

so we had a nice table and now it's inlined in the code. Yuk.

I really don't see the point of these 'simplifications'

And what do they have to do with Skylake anyways, it's PCI enumerated so why should we change this?

Quoted 227 lines
sound/soc/intel/baytrail/acpi.c +6 -1
+	platform_set_drvdata(pdev, acpi_desc);
+
+	return sst_acpi_probe(pdev);
+}
+
  static struct platform_driver byt_acpi_driver = {
-	.probe = sst_acpi_probe,
+	.probe = byt_acpi_probe,
  	.remove = sst_acpi_remove,
  	.driver = {
  		.name = "byt-acpi",
sound/soc/intel/common/sst-acpi.c +6 -15
index 8e75126106ea..53ac23f05966 100644
@@ -17,7 +17,6 @@
  struct sst_acpi_priv {
  	struct platform_device *pdev_mach;
  	struct platform_device *pdev_pcm;
-	struct sst_pdata sst_pdata;
  	struct sst_acpi_desc *desc;
  	struct snd_soc_acpi_mach *mach;
  };
@@ -27,8 +26,8 @@ static void sst_acpi_fw_cb(const struct firmware *fw, void *context)
  	struct platform_device *pdev = context;
  	struct device *dev = &pdev->dev;
  	struct sst_acpi_priv *sst_acpi = platform_get_drvdata(pdev);
-	struct sst_pdata *sst_pdata = &sst_acpi->sst_pdata;
  	struct sst_acpi_desc *desc = sst_acpi->desc;
+	struct sst_pdata *sst_pdata = desc->pdata;
  	struct snd_soc_acpi_mach *mach = sst_acpi->mach;
 
  	sst_pdata->fw = fw;
@@ -51,7 +50,6 @@ static void sst_acpi_fw_cb(const struct firmware *fw, void *context)
 
  int sst_acpi_probe(struct platform_device *pdev)
  {
-	const struct acpi_device_id *id;
  	struct device *dev = &pdev->dev;
  	struct sst_acpi_priv *sst_acpi;
  	struct sst_pdata *sst_pdata;
@@ -64,27 +62,20 @@ int sst_acpi_probe(struct platform_device *pdev)
  	if (sst_acpi == NULL)
  		return -ENOMEM;
 
-	id = acpi_match_device(dev->driver->acpi_match_table, dev);
-	if (!id)
-		return -ENODEV;
-
-	desc = (struct sst_acpi_desc *)id->driver_data;
-	mach = snd_soc_acpi_find_machine(desc->machines);
+	desc = platform_get_drvdata(pdev);
+	sst_pdata = desc->pdata;
+	mach = snd_soc_acpi_find_machine(sst_pdata->boards);
  	if (mach == NULL) {
  		dev_err(dev, "No matching ASoC machine driver found\n");
  		return -ENODEV;
  	}
 
-	sst_pdata = &sst_acpi->sst_pdata;
-	sst_pdata->id = desc->sst_id;
  	sst_pdata->dma_dev = dev;
  	sst_acpi->desc = desc;
  	sst_acpi->mach = mach;
 
-	sst_pdata->resindex_dma_base = desc->resindex_dma_base;
-	if (desc->resindex_dma_base >= 0) {
+	if (sst_pdata->dma_base >= 0) {
  		sst_pdata->dma_engine = desc->dma_engine;
-		sst_pdata->dma_base = desc->resindex_dma_base;
  		sst_pdata->dma_size = desc->dma_size;
  	}
 
@@ -140,7 +131,7 @@ EXPORT_SYMBOL_GPL(sst_acpi_probe);
  int sst_acpi_remove(struct platform_device *pdev)
  {
  	struct sst_acpi_priv *sst_acpi = platform_get_drvdata(pdev);
-	struct sst_pdata *sst_pdata = &sst_acpi->sst_pdata;
+	struct sst_pdata *sst_pdata = sst_acpi->desc->pdata;
 
  	platform_device_unregister(sst_acpi->pdev_mach);
  	if (!IS_ERR_OR_NULL(sst_acpi->pdev_pcm))
sound/soc/intel/common/sst-dsp.h +2 -6
index a2ac7998fbdb..87d39b0e79c0 100644
@@ -171,16 +171,13 @@ struct platform_device;
  /* Descriptor for setting up SST platform data */
  struct sst_acpi_desc {
  	const char *drv_name;
-	struct snd_soc_acpi_mach *machines;
+	struct sst_pdata *pdata;
  	/* Platform resource indexes. Must set to -1 if not used */
  	int resindex_lpe_base;
  	int resindex_pcicfg_base;
  	int resindex_fw_base;
  	int irqindex_host_ipc;
  	int resindex_dma_base;
-	/* Unique number identifying the SST core on platform */
-	int sst_id;
-	/* DMA only valid when resindex_dma_base != -1*/
  	int dma_engine;
  	int dma_size;
  };
@@ -205,8 +202,7 @@ struct sst_pdata {
  	const struct firmware *fw;
 
  	/* DMA */
-	int resindex_dma_base; /* other fields invalid if equals to -1 */
-	u32 dma_base;
+	int dma_base; /* other fields invalid if equals to -1 */
  	u32 dma_size;
  	int dma_engine;
  	struct device *dma_dev;
sound/soc/intel/common/sst-firmware.c +1 -1
index 6b6af11c32c3..61d3e6e46b98 100644
@@ -268,7 +268,7 @@ static int sst_dma_new(struct sst_dsp *sst)
  	struct resource mem;
  	int ret = 0;
 
-	if (sst->pdata->resindex_dma_base == -1)
+	if (sst->pdata->dma_base == -1)
  		/* DMA is not used, return and squelsh error messages */
  		return 0;
 
sound/soc/intel/haswell/acpi.c +40 -25
index 7bd8b03851c4..3c49ec257e56 100644
@@ -15,41 +15,56 @@
  #define SST_WPT_DSP_DMA_ADDR_OFFSET	0x0FE000
  #define SST_LPT_DSP_DMA_SIZE		(1024 - 1)
 
-static struct sst_acpi_desc hsw_acpi_desc = {
-	.drv_name = "haswell-pcm-audio",
-	.machines = snd_soc_acpi_intel_haswell_machines,
-	.resindex_lpe_base = 0,
-	.resindex_pcicfg_base = 1,
-	.resindex_fw_base = -1,
-	.irqindex_host_ipc = 0,
-	.sst_id = SST_DEV_ID_LYNX_POINT,
-	.dma_engine = SST_DMA_TYPE_DW,
-	.resindex_dma_base = SST_LPT_DSP_DMA_ADDR_OFFSET,
-	.dma_size = SST_LPT_DSP_DMA_SIZE,
+static struct sst_pdata hsw_desc = {
+	.id = SST_DEV_ID_LYNX_POINT,
+	.fw_name = "intel/IntcSST1.bin",
+	.boards = snd_soc_acpi_intel_haswell_machines,
+	.dma_base = SST_LPT_DSP_DMA_ADDR_OFFSET,
  };
 
-static struct sst_acpi_desc bdw_acpi_desc = {
-	.drv_name = "haswell-pcm-audio",
-	.machines = snd_soc_acpi_intel_broadwell_machines,
-	.resindex_lpe_base = 0,
-	.resindex_pcicfg_base = 1,
-	.resindex_fw_base = -1,
-	.irqindex_host_ipc = 0,
-	.sst_id = SST_DEV_ID_WILDCAT_POINT,
-	.dma_engine = SST_DMA_TYPE_DW,
-	.resindex_dma_base = SST_WPT_DSP_DMA_ADDR_OFFSET,
-	.dma_size = SST_LPT_DSP_DMA_SIZE,
+static struct sst_pdata bdw_desc = {
+	.id = SST_DEV_ID_WILDCAT_POINT,
+	.fw_name = "intel/IntcSST2.bin",
+	.boards = snd_soc_acpi_intel_broadwell_machines,
+	.dma_base = SST_WPT_DSP_DMA_ADDR_OFFSET,
  };
 
  static const struct acpi_device_id hsw_acpi_ids[] = {
-	{ "INT33C8", (unsigned long)&hsw_acpi_desc },
-	{ "INT3438", (unsigned long)&bdw_acpi_desc },
+	{ "INT33C8", (unsigned long)&hsw_desc },
+	{ "INT3438", (unsigned long)&bdw_desc },
  	{ }
  };
  MODULE_DEVICE_TABLE(acpi, hsw_acpi_ids);
 
+static int hsw_acpi_probe(struct platform_device *pdev)
+{
+	struct device *dev = &pdev->dev;
+	struct sst_acpi_desc *acpi_desc;
+	const struct acpi_device_id *id;
+
+	id = acpi_match_device(dev->driver->acpi_match_table, dev);
+	if (!id)
+		return -ENODEV;
+
+	acpi_desc = devm_kzalloc(dev, sizeof(*acpi_desc), GFP_KERNEL);
+	if (!acpi_desc)
+		return -ENOMEM;
+
+	acpi_desc->drv_name = "haswell-pcm-audio";
+	acpi_desc->pdata = (struct sst_pdata *)id->driver_data;
+	acpi_desc->resindex_lpe_base = 0;
+	acpi_desc->resindex_pcicfg_base = 1;
+	acpi_desc->resindex_fw_base = -1;
+	acpi_desc->irqindex_host_ipc = 0;
+	acpi_desc->dma_engine = SST_DMA_TYPE_DW;
+	acpi_desc->dma_size = SST_LPT_DSP_DMA_SIZE;
+	platform_set_drvdata(pdev, acpi_desc);
+
+	return sst_acpi_probe(pdev);
+}
+
  static struct platform_driver hsw_acpi_driver = {
-	.probe = sst_acpi_probe,
+	.probe = hsw_acpi_probe,
  	.remove = sst_acpi_remove,
  	.driver = {
  		.name = "hsw-acpi",
sound/soc/intel/skylake/skl-sst-utils.c +1 -1
index bbe67e298efe..ac0a0e4c2d68 100644
@@ -363,7 +363,7 @@ int skl_sst_ctx_init(struct device *dev, int irq, const char *fw_name,
 
  	pdata->id = skl->pci->device;
  	pdata->irq = irq;
-	pdata->resindex_dma_base = -1;
+	pdata->dma_base = -1;
  	skl->dev = dev;
  	pdata->dsp = skl;
  	INIT_LIST_HEAD(&skl->uuid_list);
author maintainer
#56 lore raw

Re: [PATCH 24/35] ASoC: Intel: Refactor probing of ACPI devices

Quoted 64 lines · Pierre-Louis Bossart
Quoted 34 lines · Cezary Rojewski

Baytrail and Haswell ACPI loading is now separated and no longer clutters common code. Let's improve the loading procedure and remove some superfluous members.

This change removes sst_pdata::resindex_dma_base as it is a duplication of dma_base. dma_base field has had it's type changed to allow for -1 (not used) value.

ACPI descriptor: sst_acpi_desc loses machines field and sst_id - now accessed via sst_pdata::boards and sst_pdata::id respectively. Cleanup consists mainly of legacy platform-specific probe routines being provided for each descendant. Prevents code duplications, especially for HSW/ BDW case while not losing any readability.

---
  sound/soc/intel/baytrail/acpi.c         | 43 +++++++++++----- sound/soc/intel/common/sst-acpi.c       | 21 +++----- sound/soc/intel/common/sst-dsp.h        |  8 +-- sound/soc/intel/common/sst-firmware.c   |  2 +- sound/soc/intel/haswell/acpi.c          | 65 +++++++++++++++---------- sound/soc/intel/skylake/skl-sst-utils.c |  2 +-

  6 files changed, 82 insertions(+), 59 deletions(-)
sound/soc/intel/baytrail/acpi.c +0 -3
index 57d10a6e3be2..bf2560a8f3e2 100644
@@ -11,25 +11,46 @@
   #include <sound/soc-acpi-intel-match.h>
   #include "../common/sst-dsp.h"
-static struct sst_acpi_desc byt_acpi_desc = {
-    .drv_name = "baytrail-pcm-audio",
-    .machines = snd_soc_acpi_intel_baytrail_legacy_machines,

sound/soc/intel/baytrail/acpi.c line 16

Quoted 10 lines
sound/soc/intel/baytrail/acpi.c +4 -6
-    .resindex_lpe_base = 0,
-    .resindex_pcicfg_base = 1,
-    .resindex_fw_base = 2,
-    .irqindex_host_ipc = 5,
-    .sst_id = SST_DEV_ID_BYT,
-    .resindex_dma_base = -1,
+static struct sst_pdata byt_desc = {
+    .id = SST_DEV_ID_BYT,
+    .fw_name = "intel/fw_sst_0f28.bin-48kHz_i2s_master",
+    .boards = snd_soc_acpi_intel_baytrail_legacy_machines,

So instead of simplifying you are duplicating the fw_name here.

struct snd_soc_acpi_mach snd_soc_acpi_intel_baytrail_legacy_machines[] = {
    {
        .id = "10EC5640",
        .drv_name = "byt-rt5640",
        .fw_filename = "intel/fw_sst_0f28.bin-48kHz_i2s_master", },
    {
        .id = "193C9890",
        .drv_name = "byt-max98090",
        .fw_filename = "intel/fw_sst_0f28.bin-48kHz_i2s_master", },
    {}
};

Quoted 2 lines

What is the value of all this?

As basefw file name is never tied to specific board, snd_soc_acpi_mach::fw_filename existence ain't a good thing. It's misleading and can catch inexperienced developer off guard.

Quoted 31 lines
Quoted 18 lines
sound/soc/intel/baytrail/acpi.c +12 -1
+    .dma_base = -1,
   };
   static const struct acpi_device_id byt_acpi_ids[] = {
-    { "80860F28", (unsigned long)&byt_acpi_desc },
+    { "80860F28", (unsigned long)&byt_desc },
       { }
   };
   MODULE_DEVICE_TABLE(acpi, byt_acpi_ids);
+static int byt_acpi_probe(struct platform_device *pdev)
+{
+    struct device *dev = &pdev->dev;
+    struct sst_acpi_desc *acpi_desc;
+    const struct acpi_device_id *id;
+
+    id = acpi_match_device(dev->driver->acpi_match_table, dev);
+    if (!id)
+        return -ENODEV;
+

sound/soc/intel/baytrail/acpi.c line 46

Quoted 10 lines
sound/soc/intel/baytrail/acpi.c +10 -0
+    acpi_desc = devm_kzalloc(dev, sizeof(*acpi_desc), GFP_KERNEL);
+    if (!acpi_desc)
+        return -ENOMEM;
+
+    acpi_desc->drv_name = "baytrail-pcm-audio";
+    acpi_desc->pdata = (struct sst_pdata *)id->driver_data;
+    acpi_desc->resindex_lpe_base = 0;
+    acpi_desc->resindex_pcicfg_base = 1;
+    acpi_desc->resindex_fw_base = 2;
+    acpi_desc->irqindex_host_ipc = 5;

so we had a nice table and now it's inlined in the code. Yuk.

Quoted 5 lines

I really don't see the point of these 'simplifications'

And what do they have to do with Skylake anyways, it's PCI enumerated so why should we change this?

Goal is to elevate single struct - here sst_pdata - to be the unified platform descriptor. sst_acpi_desc "extends" sst_pdata. Baytrail _probe method mirrors Haswell to make both look cohesive. Some code duplication removal is also present.

Value? Since when we abandoned the quality principle?
Some fields in these structs are redundant and have been removed. Haswell/ Baytrail -specific code has been separated from sst framework to make it unaware of its descendants data. I call framework which knows its children secrets upfront a bad design.

Code does not even change much, it's simply cleaned up.

Quoted 207 lines
Quoted 207 lines
sound/soc/intel/baytrail/acpi.c +6 -1
+    platform_set_drvdata(pdev, acpi_desc);
+
+    return sst_acpi_probe(pdev);
+}
+
   static struct platform_driver byt_acpi_driver = {
-    .probe = sst_acpi_probe,
+    .probe = byt_acpi_probe,
       .remove = sst_acpi_remove,
       .driver = {
           .name = "byt-acpi",
sound/soc/intel/common/sst-acpi.c +6 -15
index 8e75126106ea..53ac23f05966 100644
@@ -17,7 +17,6 @@
   struct sst_acpi_priv {
       struct platform_device *pdev_mach;
       struct platform_device *pdev_pcm;
-    struct sst_pdata sst_pdata;
       struct sst_acpi_desc *desc;
       struct snd_soc_acpi_mach *mach;
   };
@@ -27,8 +26,8 @@ static void sst_acpi_fw_cb(const struct firmware 
 *fw, void *context)
       struct platform_device *pdev = context;
       struct device *dev = &pdev->dev;
       struct sst_acpi_priv *sst_acpi = platform_get_drvdata(pdev);
-    struct sst_pdata *sst_pdata = &sst_acpi->sst_pdata;
       struct sst_acpi_desc *desc = sst_acpi->desc;
+    struct sst_pdata *sst_pdata = desc->pdata;
       struct snd_soc_acpi_mach *mach = sst_acpi->mach;
       sst_pdata->fw = fw;
@@ -51,7 +50,6 @@ static void sst_acpi_fw_cb(const struct firmware 
 *fw, void *context)
   int sst_acpi_probe(struct platform_device *pdev)
   {
-    const struct acpi_device_id *id;
       struct device *dev = &pdev->dev;
       struct sst_acpi_priv *sst_acpi;
       struct sst_pdata *sst_pdata;
@@ -64,27 +62,20 @@ int sst_acpi_probe(struct platform_device *pdev)
       if (sst_acpi == NULL)
           return -ENOMEM;
-    id = acpi_match_device(dev->driver->acpi_match_table, dev);
-    if (!id)
-        return -ENODEV;
-
-    desc = (struct sst_acpi_desc *)id->driver_data;
-    mach = snd_soc_acpi_find_machine(desc->machines);
+    desc = platform_get_drvdata(pdev);
+    sst_pdata = desc->pdata;
+    mach = snd_soc_acpi_find_machine(sst_pdata->boards);
       if (mach == NULL) {
           dev_err(dev, "No matching ASoC machine driver found\n");
           return -ENODEV;
       }
-    sst_pdata = &sst_acpi->sst_pdata;
-    sst_pdata->id = desc->sst_id;
       sst_pdata->dma_dev = dev;
       sst_acpi->desc = desc;
       sst_acpi->mach = mach;
-    sst_pdata->resindex_dma_base = desc->resindex_dma_base;
-    if (desc->resindex_dma_base >= 0) {
+    if (sst_pdata->dma_base >= 0) {
           sst_pdata->dma_engine = desc->dma_engine;
-        sst_pdata->dma_base = desc->resindex_dma_base;
           sst_pdata->dma_size = desc->dma_size;
       }
@@ -140,7 +131,7 @@ EXPORT_SYMBOL_GPL(sst_acpi_probe);
   int sst_acpi_remove(struct platform_device *pdev)
   {
       struct sst_acpi_priv *sst_acpi = platform_get_drvdata(pdev);
-    struct sst_pdata *sst_pdata = &sst_acpi->sst_pdata;
+    struct sst_pdata *sst_pdata = sst_acpi->desc->pdata;
       platform_device_unregister(sst_acpi->pdev_mach);
       if (!IS_ERR_OR_NULL(sst_acpi->pdev_pcm))
sound/soc/intel/common/sst-dsp.h +2 -6
index a2ac7998fbdb..87d39b0e79c0 100644
@@ -171,16 +171,13 @@ struct platform_device;
   /* Descriptor for setting up SST platform data */
   struct sst_acpi_desc {
       const char *drv_name;
-    struct snd_soc_acpi_mach *machines;
+    struct sst_pdata *pdata;
       /* Platform resource indexes. Must set to -1 if not used */
       int resindex_lpe_base;
       int resindex_pcicfg_base;
       int resindex_fw_base;
       int irqindex_host_ipc;
       int resindex_dma_base;
-    /* Unique number identifying the SST core on platform */
-    int sst_id;
-    /* DMA only valid when resindex_dma_base != -1*/
       int dma_engine;
       int dma_size;
   };
@@ -205,8 +202,7 @@ struct sst_pdata {
       const struct firmware *fw;
       /* DMA */
-    int resindex_dma_base; /* other fields invalid if equals to -1 */
-    u32 dma_base;
+    int dma_base; /* other fields invalid if equals to -1 */
       u32 dma_size;
       int dma_engine;
       struct device *dma_dev;
sound/soc/intel/common/sst-firmware.c +1 -1
index 6b6af11c32c3..61d3e6e46b98 100644
@@ -268,7 +268,7 @@ static int sst_dma_new(struct sst_dsp *sst)
       struct resource mem;
       int ret = 0;
-    if (sst->pdata->resindex_dma_base == -1)
+    if (sst->pdata->dma_base == -1)
           /* DMA is not used, return and squelsh error messages */
           return 0;
sound/soc/intel/haswell/acpi.c +40 -25
index 7bd8b03851c4..3c49ec257e56 100644
@@ -15,41 +15,56 @@
   #define SST_WPT_DSP_DMA_ADDR_OFFSET    0x0FE000
   #define SST_LPT_DSP_DMA_SIZE        (1024 - 1)
-static struct sst_acpi_desc hsw_acpi_desc = {
-    .drv_name = "haswell-pcm-audio",
-    .machines = snd_soc_acpi_intel_haswell_machines,
-    .resindex_lpe_base = 0,
-    .resindex_pcicfg_base = 1,
-    .resindex_fw_base = -1,
-    .irqindex_host_ipc = 0,
-    .sst_id = SST_DEV_ID_LYNX_POINT,
-    .dma_engine = SST_DMA_TYPE_DW,
-    .resindex_dma_base = SST_LPT_DSP_DMA_ADDR_OFFSET,
-    .dma_size = SST_LPT_DSP_DMA_SIZE,
+static struct sst_pdata hsw_desc = {
+    .id = SST_DEV_ID_LYNX_POINT,
+    .fw_name = "intel/IntcSST1.bin",
+    .boards = snd_soc_acpi_intel_haswell_machines,
+    .dma_base = SST_LPT_DSP_DMA_ADDR_OFFSET,
   };
-static struct sst_acpi_desc bdw_acpi_desc = {
-    .drv_name = "haswell-pcm-audio",
-    .machines = snd_soc_acpi_intel_broadwell_machines,
-    .resindex_lpe_base = 0,
-    .resindex_pcicfg_base = 1,
-    .resindex_fw_base = -1,
-    .irqindex_host_ipc = 0,
-    .sst_id = SST_DEV_ID_WILDCAT_POINT,
-    .dma_engine = SST_DMA_TYPE_DW,
-    .resindex_dma_base = SST_WPT_DSP_DMA_ADDR_OFFSET,
-    .dma_size = SST_LPT_DSP_DMA_SIZE,
+static struct sst_pdata bdw_desc = {
+    .id = SST_DEV_ID_WILDCAT_POINT,
+    .fw_name = "intel/IntcSST2.bin",
+    .boards = snd_soc_acpi_intel_broadwell_machines,
+    .dma_base = SST_WPT_DSP_DMA_ADDR_OFFSET,
   };
   static const struct acpi_device_id hsw_acpi_ids[] = {
-    { "INT33C8", (unsigned long)&hsw_acpi_desc },
-    { "INT3438", (unsigned long)&bdw_acpi_desc },
+    { "INT33C8", (unsigned long)&hsw_desc },
+    { "INT3438", (unsigned long)&bdw_desc },
       { }
   };
   MODULE_DEVICE_TABLE(acpi, hsw_acpi_ids);
+static int hsw_acpi_probe(struct platform_device *pdev)
+{
+    struct device *dev = &pdev->dev;
+    struct sst_acpi_desc *acpi_desc;
+    const struct acpi_device_id *id;
+
+    id = acpi_match_device(dev->driver->acpi_match_table, dev);
+    if (!id)
+        return -ENODEV;
+
+    acpi_desc = devm_kzalloc(dev, sizeof(*acpi_desc), GFP_KERNEL);
+    if (!acpi_desc)
+        return -ENOMEM;
+
+    acpi_desc->drv_name = "haswell-pcm-audio";
+    acpi_desc->pdata = (struct sst_pdata *)id->driver_data;
+    acpi_desc->resindex_lpe_base = 0;
+    acpi_desc->resindex_pcicfg_base = 1;
+    acpi_desc->resindex_fw_base = -1;
+    acpi_desc->irqindex_host_ipc = 0;
+    acpi_desc->dma_engine = SST_DMA_TYPE_DW;
+    acpi_desc->dma_size = SST_LPT_DSP_DMA_SIZE;
+    platform_set_drvdata(pdev, acpi_desc);
+
+    return sst_acpi_probe(pdev);
+}
+
   static struct platform_driver hsw_acpi_driver = {
-    .probe = sst_acpi_probe,
+    .probe = hsw_acpi_probe,
       .remove = sst_acpi_remove,
       .driver = {
           .name = "hsw-acpi",
sound/soc/intel/skylake/skl-sst-utils.c +0 -0
index bbe67e298efe..ac0a0e4c2d68 100644
@@ -363,7 +363,7 @@ int skl_sst_ctx_init(struct device *dev, int irq, 
 const char *fw_name,
Quoted 8 lines

sound/soc/intel/skylake/skl-sst-utils.c int skl_sst_ctx_init(struct device *dev, int irq, const char *fw_name, · line 369

Quoted 8 lines
sound/soc/intel/skylake/skl-sst-utils.c +1 -1
       pdata->id = skl->pci->device;
       pdata->irq = irq;
-    pdata->resindex_dma_base = -1;
+    pdata->dma_base = -1;
       skl->dev = dev;
       pdata->dsp = skl;
       INIT_LIST_HEAD(&skl->uuid_list);

_______________________________________________
Alsa-devel mailing list
[email protected]
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

author maintainer
#57 lore raw

PATCH 25/35 ASoC: Intel: Skylake: Simplify skl_sst_ctx_init declaration

In reply to Cezary Rojewski

'irq' and 'dsp' are redundant parameters of skl_sst_ctx_init. Simplify its declaration and update each invokes. This yet another step In quest for simplification of Skylake initialization process.

---
 sound/soc/intel/skylake/bxt-sst.c       |  4 ++--
 sound/soc/intel/skylake/cnl-sst.c       |  4 ++--
 sound/soc/intel/skylake/skl-sst-dsp.h   |  3 +--
 sound/soc/intel/skylake/skl-sst-utils.c | 18 +++++++-----------
 sound/soc/intel/skylake/skl-sst.c       |  4 ++--
 sound/soc/intel/skylake/skl.c           |  1 +
 6 files changed, 15 insertions(+), 19 deletions(-)
sound/soc/intel/skylake/bxt-sst.c +2 -2
index 5b46215fbc0f..e72cd63eb113 100644
@@ -552,13 +552,13 @@ int bxt_sst_dsp_init(struct device *dev, void __iomem *mmio_base, int irq,
 	struct sst_dsp *sst;
 	int ret;
 
-	ret = skl_sst_ctx_init(dev, irq, fw_name, dsp, &skl_dev);
+	skl = *dsp;
+	ret = skl_sst_ctx_init(skl, fw_name, &skl_dev);
 	if (ret < 0) {
 		dev_err(dev, "%s: no device\n", __func__);
 		return ret;
 	}
 
-	skl = *dsp;
 	sst = skl->dsp;
 	sst->fw_ops = bxt_fw_ops;
 	sst->addr.lpe = mmio_base;
sound/soc/intel/skylake/cnl-sst.c +2 -2
index 47b991c03742..93b98281083c 100644
@@ -429,13 +429,13 @@ int cnl_sst_dsp_init(struct device *dev, void __iomem *mmio_base, int irq,
 	struct sst_dsp *sst;
 	int ret;
 
-	ret = skl_sst_ctx_init(dev, irq, fw_name, dsp, &cnl_dev);
+	cnl = *dsp;
+	ret = skl_sst_ctx_init(cnl, fw_name, &cnl_dev);
 	if (ret < 0) {
 		dev_err(dev, "%s: no device\n", __func__);
 		return ret;
 	}
 
-	cnl = *dsp;
 	sst = cnl->dsp;
 	sst->fw_ops = cnl_fw_ops;
 	sst->addr.lpe = mmio_base;
sound/soc/intel/skylake/skl-sst-dsp.h +1 -2
index 3c92b1d849e4..e14d76ed0100 100644
@@ -225,8 +225,7 @@ int skl_dsp_strip_extended_manifest(struct firmware *fw);
 
 void skl_dsp_set_astate_cfg(struct skl_dev *skl, u32 cnt, void *data);
 
-int skl_sst_ctx_init(struct device *dev, int irq, const char *fw_name,
-		struct skl_dev **dsp,
+int skl_sst_ctx_init(struct skl_dev *skl, const char *fw_name,
 		struct sst_pdata *pdata);
 int skl_prepare_lib_load(struct skl_dev *skl, struct skl_lib_info *linfo,
 			struct firmware *stripped_fw,
sound/soc/intel/skylake/skl-sst-utils.c +7 -11
index ac0a0e4c2d68..a4ad213d34e0 100644
@@ -354,30 +354,26 @@ int skl_dsp_strip_extended_manifest(struct firmware *fw)
 	return 0;
 }
 
-int skl_sst_ctx_init(struct device *dev, int irq, const char *fw_name,
-	struct skl_dev **dsp,
+int skl_sst_ctx_init(struct skl_dev *skl, const char *fw_name,
 	struct sst_pdata *pdata)
 {
-	struct skl_dev *skl = *dsp;
 	struct sst_dsp *sst;
+	struct device *dev = skl->dev;
 
 	pdata->id = skl->pci->device;
-	pdata->irq = irq;
+	pdata->irq = skl->pci->irq;
 	pdata->dma_base = -1;
-	skl->dev = dev;
 	pdata->dsp = skl;
 	INIT_LIST_HEAD(&skl->uuid_list);
-	skl->dsp = sst_dsp_new(dev, pdata);
-	if (!skl->dsp) {
-		dev_err(skl->dev, "%s: no device\n", __func__);
+	sst = sst_dsp_new(dev, pdata);
+	if (!sst) {
+		dev_err(dev, "%s: no device\n", __func__);
 		return -ENODEV;
 	}
 
-	sst = skl->dsp;
+	skl->dsp = sst;
 	sst->fw_name = fw_name;
 	init_waitqueue_head(&skl->mod_load_wait);
-	INIT_LIST_HEAD(&sst->module_list);
-
 	skl->is_first_boot = true;
 
 	return 0;
sound/soc/intel/skylake/skl-sst.c +2 -2
index c823936ffd34..f8aecd2ca8bb 100644
@@ -523,13 +523,13 @@ int skl_sst_dsp_init(struct device *dev, void __iomem *mmio_base, int irq,
 	struct sst_dsp *sst;
 	int ret;
 
-	ret = skl_sst_ctx_init(dev, irq, fw_name, dsp, &skl_dev);
+	skl = *dsp;
+	ret = skl_sst_ctx_init(skl, fw_name, &skl_dev);
 	if (ret < 0) {
 		dev_err(dev, "%s: no device\n", __func__);
 		return ret;
 	}
 
-	skl = *dsp;
 	sst = skl->dsp;
 	sst->addr.lpe = mmio_base;
 	sst->addr.shim = mmio_base;
sound/soc/intel/skylake/skl.c +1 -0
index 141dbbf975ac..54e1f957121d 100644
@@ -890,6 +890,7 @@ static int skl_create(struct pci_dev *pci,
 	snd_hdac_ext_bus_init(bus, &pci->dev, &bus_core_ops, ext_ops);
 	bus->use_posbuf = 1;
 	skl->pci = pci;
+	skl->dev = &pci->dev;
 	INIT_WORK(&skl->probe_work, skl_probe_work);
 	bus->bdl_pos_adj = 0;
 
Signature · 1 line
2.17.1
author maintainer
#58 lore raw

PATCH 26/35 ASoC: Intel: Skylake: Simplify all sst_dsp_init declarations

In reply to Cezary Rojewski

SST initializers for Skylake, Apollolake and Cannonlake descendants have many redundant parameters within their declaration. Simplify them. Currently, this involves duplication the PCI ioremap code. This will be addresses on a later note, but is needed to keep SSTs sane during initialization overhaul.

---
 sound/soc/intel/skylake/bxt-sst.c      | 19 +++++++++----------
 sound/soc/intel/skylake/cnl-sst-dsp.h  |  3 +--
 sound/soc/intel/skylake/cnl-sst.c      | 19 +++++++++----------
 sound/soc/intel/skylake/skl-messages.c | 26 ++++----------------------
 sound/soc/intel/skylake/skl-sst-dsp.h  |  6 ++----
 sound/soc/intel/skylake/skl-sst.c      | 22 ++++++++++------------
 sound/soc/intel/skylake/skl.h          |  5 ++---
 7 files changed, 37 insertions(+), 63 deletions(-)
sound/soc/intel/skylake/bxt-sst.c +9 -10
index e72cd63eb113..a547fb84eee9 100644
@@ -545,30 +545,29 @@ static struct sst_pdata skl_dev = {
 	.ops = &skl_ops,
 };
 
-int bxt_sst_dsp_init(struct device *dev, void __iomem *mmio_base, int irq,
-			const char *fw_name, struct skl_dev **dsp)
+int bxt_sst_dsp_init(struct skl_dev *skl, const char *fw_name)
 {
-	struct skl_dev *skl;
 	struct sst_dsp *sst;
+	void __iomem *mmio;
 	int ret;
 
-	skl = *dsp;
 	ret = skl_sst_ctx_init(skl, fw_name, &skl_dev);
-	if (ret < 0) {
-		dev_err(dev, "%s: no device\n", __func__);
+	if (ret)
 		return ret;
-	}
 
 	sst = skl->dsp;
 	sst->fw_ops = bxt_fw_ops;
-	sst->addr.lpe = mmio_base;
-	sst->addr.shim = mmio_base;
+	mmio = pci_ioremap_bar(skl->pci, 4);
+	if (!mmio)
+		return -ENXIO;
+	sst->addr.lpe = mmio;
+	sst->addr.shim = mmio;
 
 	sst_dsp_mailbox_init(sst,
 		(BXT_ADSP_SRAM0_BASE + SKL_FW_REGS_SIZE), SKL_MAILBOX_SIZE,
 		BXT_ADSP_SRAM1_BASE, SKL_MAILBOX_SIZE);
 
-	ret = skl_ipc_init(dev, skl);
+	ret = skl_ipc_init(skl->dev, skl);
 	if (ret) {
 		skl_dsp_free(sst);
 		return ret;
sound/soc/intel/skylake/cnl-sst-dsp.h +1 -2
index a465cc42b7e8..02e070fae2ce 100644
@@ -87,7 +87,6 @@ void cnl_ipc_op_int_enable(struct sst_dsp *ctx);
 void cnl_ipc_op_int_disable(struct sst_dsp *ctx);
 bool cnl_ipc_int_status(struct sst_dsp *ctx);
 
-int cnl_sst_dsp_init(struct device *dev, void __iomem *mmio_base, int irq,
-		     const char *fw_name, struct skl_dev **dsp);
+int cnl_sst_dsp_init(struct skl_dev *skl, const char *fw_name);
 
 #endif /*__CNL_SST_DSP_H__*/
sound/soc/intel/skylake/cnl-sst.c +9 -10
index 93b98281083c..5be0a8eb154d 100644
@@ -422,30 +422,29 @@ static struct sst_pdata cnl_dev = {
 	.ops = &cnl_ops,
 };
 
-int cnl_sst_dsp_init(struct device *dev, void __iomem *mmio_base, int irq,
-		     const char *fw_name, struct skl_dev **dsp)
+int cnl_sst_dsp_init(struct skl_dev *cnl, const char *fw_name)
 {
-	struct skl_dev *cnl;
 	struct sst_dsp *sst;
+	void __iomem *mmio;
 	int ret;
 
-	cnl = *dsp;
 	ret = skl_sst_ctx_init(cnl, fw_name, &cnl_dev);
-	if (ret < 0) {
-		dev_err(dev, "%s: no device\n", __func__);
+	if (ret < 0)
 		return ret;
-	}
 
 	sst = cnl->dsp;
 	sst->fw_ops = cnl_fw_ops;
-	sst->addr.lpe = mmio_base;
-	sst->addr.shim = mmio_base;
+	mmio = pci_ioremap_bar(cnl->pci, 4);
+	if (!mmio)
+		return -ENXIO;
+	sst->addr.lpe = mmio;
+	sst->addr.shim = mmio;
 
 	sst_dsp_mailbox_init(sst,
 		(CNL_ADSP_SRAM0_BASE + SKL_FW_REGS_SIZE), SKL_MAILBOX_SIZE,
 		CNL_ADSP_SRAM1_BASE, SKL_MAILBOX_SIZE);
 
-	ret = cnl_ipc_init(dev, cnl);
+	ret = cnl_ipc_init(cnl->dev, cnl);
 	if (ret) {
 		skl_dsp_free(sst);
 		return ret;
sound/soc/intel/skylake/skl-messages.c +4 -22
index 6fbceec67b53..8c352255ff45 100644
@@ -189,9 +189,7 @@ const struct skl_dsp_ops *skl_get_dsp_ops(int pci_id)
 
 int skl_init_dsp(struct skl_dev *skl)
 {
-	void __iomem *mmio_base;
 	struct hdac_bus *bus = skl_to_bus(skl);
-	int irq = bus->irq;
 	const struct skl_dsp_ops *ops;
 	int ret;
 
@@ -199,34 +197,18 @@ int skl_init_dsp(struct skl_dev *skl)
 	snd_hdac_ext_bus_ppcap_enable(bus, true);
 	snd_hdac_ext_bus_ppcap_int_enable(bus, true);
 
-	/* read the BAR of the ADSP MMIO */
-	mmio_base = pci_ioremap_bar(skl->pci, 4);
-	if (mmio_base == NULL) {
-		dev_err(bus->dev, "ioremap error\n");
-		return -ENXIO;
-	}
-
 	ops = skl_get_dsp_ops(skl->pci->device);
-	if (!ops) {
-		ret = -EIO;
-		goto unmap_mmio;
-	}
-
-	ret = ops->init(bus->dev, mmio_base, irq,
-				skl->fw_name, &skl);
+	if (!ops)
+		return -EIO;
 
+	ret = ops->init(skl, skl->fw_name);
 	if (ret < 0)
-		goto unmap_mmio;
+		return ret;
 
 	skl->dsp_ops = ops;
 	dev_dbg(bus->dev, "dsp registration status=%d\n", ret);
 
 	return 0;
-
-unmap_mmio:
-	iounmap(mmio_base);
-
-	return ret;
 }
 
 int skl_free_dsp(struct skl_dev *skl)
sound/soc/intel/skylake/skl-sst-dsp.h +2 -4
index e14d76ed0100..b647e60d7a6d 100644
@@ -206,10 +206,8 @@ int skl_dsp_get_core(struct sst_dsp *ctx, unsigned int core_id);
 int skl_dsp_put_core(struct sst_dsp *ctx, unsigned int core_id);
 
 int skl_dsp_boot(struct sst_dsp *ctx);
-int skl_sst_dsp_init(struct device *dev, void __iomem *mmio_base, int irq,
-		const char *fw_name, struct skl_dev **dsp);
-int bxt_sst_dsp_init(struct device *dev, void __iomem *mmio_base, int irq,
-		const char *fw_name, struct skl_dev **dsp);
+int skl_sst_dsp_init(struct skl_dev *skl, const char *fw_name);
+int bxt_sst_dsp_init(struct skl_dev *skl, const char *fw_name);
 int bxt_load_library(struct sst_dsp *ctx, struct skl_lib_info *linfo,
 		int lib_count);
 
sound/soc/intel/skylake/skl-sst.c +10 -12
index f8aecd2ca8bb..8ae7fe73534e 100644
@@ -516,36 +516,34 @@ static struct sst_pdata skl_dev = {
 	.ops = &skl_ops,
 };
 
-int skl_sst_dsp_init(struct device *dev, void __iomem *mmio_base, int irq,
-		const char *fw_name, struct skl_dev **dsp)
+int skl_sst_dsp_init(struct skl_dev *skl, const char *fw_name)
 {
-	struct skl_dev *skl;
 	struct sst_dsp *sst;
+	void __iomem *mmio;
 	int ret;
 
-	skl = *dsp;
 	ret = skl_sst_ctx_init(skl, fw_name, &skl_dev);
-	if (ret < 0) {
-		dev_err(dev, "%s: no device\n", __func__);
+	if (ret < 0)
 		return ret;
-	}
 
 	sst = skl->dsp;
-	sst->addr.lpe = mmio_base;
-	sst->addr.shim = mmio_base;
+	sst->fw_ops = skl_fw_ops;
+	mmio = pci_ioremap_bar(skl->pci, 4);
+	if (!mmio)
+		return -ENXIO;
+	sst->addr.lpe = mmio;
+	sst->addr.shim = mmio;
 
 	sst_dsp_mailbox_init(sst,
 		(SKL_ADSP_SRAM0_BASE + SKL_FW_REGS_SIZE), SKL_MAILBOX_SIZE,
 		SKL_ADSP_SRAM1_BASE, SKL_MAILBOX_SIZE);
 
-	ret = skl_ipc_init(dev, skl);
+	ret = skl_ipc_init(skl->dev, skl);
 	if (ret) {
 		skl_dsp_free(sst);
 		return ret;
 	}
 
-	sst->fw_ops = skl_fw_ops;
-
 	return 0;
 }
 EXPORT_SYMBOL_GPL(skl_sst_dsp_init);
sound/soc/intel/skylake/skl.h +2 -3
index beeef67cb55f..9f5aa53df9f8 100644
@@ -12,6 +12,7 @@
 #ifndef __SOUND_SOC_SKL_H
 #define __SOUND_SOC_SKL_H
 
+#include <linux/pci.h>
 #include <sound/hda_register.h>
 #include <sound/hdaudio_ext.h>
 #include <sound/hda_codec.h>
@@ -155,9 +156,7 @@ struct skl_machine_pdata {
 
 struct skl_dsp_ops {
 	int id;
-	int (*init)(struct device *dev, void __iomem *mmio_base,
-			int irq, const char *fw_name,
-			struct skl_dev **skl_sst);
+	int (*init)(struct skl_dev *skl, const char *fw_name);
 };
 
 int skl_platform_unregister(struct device *dev);
Signature · 1 line
2.17.1
author maintainer
#59 lore raw

PATCH 27/35 ASoC: Intel: Skylake: Define platform descriptors

In reply to Cezary Rojewski

Make use of sst_pdata and declare platform descriptors for all existing cAVS platforms. Each carries information about base_fw filename, platform specific operations and boards supported.

---
 sound/soc/intel/skylake/bxt-sst.c |  4 ++--
 sound/soc/intel/skylake/cnl-sst.c |  4 ++--
 sound/soc/intel/skylake/skl-sst.c |  4 ++--
 sound/soc/intel/skylake/skl.c     | 38 ++++++++++++++++++++++++++++++-
 sound/soc/intel/skylake/skl.h     |  3 +++
 5 files changed, 46 insertions(+), 7 deletions(-)
sound/soc/intel/skylake/bxt-sst.c +2 -2
index a547fb84eee9..06da822790a5 100644
@@ -531,7 +531,7 @@ static const struct skl_dsp_fw_ops bxt_fw_ops = {
 	.load_library = bxt_load_library,
 };
 
-static struct sst_ops skl_ops = {
+struct sst_ops apl_sst_ops = {
 	.irq_handler = skl_dsp_sst_interrupt,
 	.thread_fn = skl_dsp_irq_thread_handler,
 	.write = sst_shim32_write,
@@ -542,7 +542,7 @@ static struct sst_ops skl_ops = {
 };
 
 static struct sst_pdata skl_dev = {
-	.ops = &skl_ops,
+	.ops = &apl_sst_ops,
 };
 
 int bxt_sst_dsp_init(struct skl_dev *skl, const char *fw_name)
sound/soc/intel/skylake/cnl-sst.c +2 -2
index 5be0a8eb154d..c4dbf6655097 100644
@@ -408,7 +408,7 @@ static int cnl_ipc_init(struct device *dev, struct skl_dev *cnl)
 	return 0;
 }
 
-static struct sst_ops cnl_ops = {
+struct sst_ops cnl_sst_ops = {
 	.irq_handler = cnl_dsp_sst_interrupt,
 	.thread_fn = cnl_dsp_irq_thread_handler,
 	.write = sst_shim32_write,
@@ -419,7 +419,7 @@ static struct sst_ops cnl_ops = {
 };
 
 static struct sst_pdata cnl_dev = {
-	.ops = &cnl_ops,
+	.ops = &cnl_sst_ops,
 };
 
 int cnl_sst_dsp_init(struct skl_dev *cnl, const char *fw_name)
sound/soc/intel/skylake/skl-sst.c +2 -2
index 8ae7fe73534e..122c07290440 100644
@@ -503,7 +503,7 @@ static const struct skl_dsp_fw_ops skl_fw_ops = {
 	.unload_mod = skl_unload_module,
 };
 
-static struct sst_ops skl_ops = {
+struct sst_ops skl_sst_ops = {
 	.irq_handler = skl_dsp_sst_interrupt,
 	.write = sst_shim32_write,
 	.read = sst_shim32_read,
@@ -513,7 +513,7 @@ static struct sst_ops skl_ops = {
 };
 
 static struct sst_pdata skl_dev = {
-	.ops = &skl_ops,
+	.ops = &skl_sst_ops,
 };
 
 int skl_sst_dsp_init(struct skl_dev *skl, const char *fw_name)
sound/soc/intel/skylake/skl.c +37 -1
index 54e1f957121d..d6d099aba834 100644
@@ -27,6 +27,7 @@
 #include <sound/hda_i915.h>
 #include <sound/hda_codec.h>
 #include <sound/intel-nhlt.h>
+#include "../common/sst-dsp.h"
 #include "skl.h"
 #include "skl-sst-dsp.h"
 #include "skl-sst-ipc.h"
@@ -1063,7 +1064,6 @@ static int skl_probe(struct pci_dev *pci,
 
 	pci_set_drvdata(skl->pci, bus);
 
-
 	err = skl_find_machine(skl, (void *)pci_id->driver_data);
 	if (err < 0) {
 		dev_err(bus->dev, "skl_find_machine failed with err: %d\n", err);
@@ -1153,6 +1153,42 @@ static void skl_remove(struct pci_dev *pci)
 	dev_set_drvdata(&pci->dev, NULL);
 }
 
+static struct sst_pdata skl_desc = {
+	.fw_name = "intel/dsp_fw_release.bin",
+	.ops = &skl_sst_ops,
+	.boards = snd_soc_acpi_intel_skl_machines,
+};
+
+static struct sst_pdata kbl_desc = {
+	.fw_name = "intel/dsp_fw_kbl.bin",
+	.ops = &skl_sst_ops,
+	.boards = snd_soc_acpi_intel_kbl_machines,
+};
+
+static struct sst_pdata apl_desc = {
+	.fw_name = "intel/dsp_fw_bxtn.bin",
+	.ops = &apl_sst_ops,
+	.boards = snd_soc_acpi_intel_bxt_machines,
+};
+
+static struct sst_pdata glk_desc = {
+	.fw_name = "intel/dsp_fw_glk.bin",
+	.ops = &apl_sst_ops,
+	.boards = snd_soc_acpi_intel_glk_machines,
+};
+
+static struct sst_pdata cnl_desc = {
+	.fw_name = "intel/dsp_fw_cnl.bin",
+	.ops = &cnl_sst_ops,
+	.boards = snd_soc_acpi_intel_cnl_machines,
+};
+
+static struct sst_pdata icl_desc = {
+	.fw_name = "intel/dsp_fw_icl.bin",
+	.ops = &cnl_sst_ops,
+	.boards = snd_soc_acpi_intel_icl_machines,
+};
+
 /* PCI IDs */
 static const struct pci_device_id skl_ids[] = {
 #if IS_ENABLED(CONFIG_SND_SOC_INTEL_SKL)
sound/soc/intel/skylake/skl.h +3 -0
index 9f5aa53df9f8..2f2b5a141abf 100644
@@ -42,6 +42,9 @@
 #define AZX_REG_VS_EM2_L1SEN		BIT(13)
 
 struct skl_debug;
+extern struct sst_ops skl_sst_ops;
+extern struct sst_ops apl_sst_ops;
+extern struct sst_ops cnl_sst_ops;
 
 struct skl_astate_param {
 	u32 kcps;
Signature · 1 line
2.17.1
#60 lore raw

Re: [PATCH 27/35] ASoC: Intel: Skylake: Define platform descriptors

Quoted 3 lines · Cezary Rojewski

Make use of sst_pdata and declare platform descriptors for all existing cAVS platforms. Each carries information about base_fw filename, platform specific operations and boards supported.

if you use a constant base_fw name that cannot be made board-specific for specific usages, you will restrict the ability to deal with quirks and custom cases.

real-life example: not so long ago there were two SST firmwares for 'regular' solutions and ultra-low-latency ones, so by having a single name for all APL-based platforms you will generate issues that don't exist today, or you will force users to patch something in the core.

Quoted 154 lines
---
  sound/soc/intel/skylake/bxt-sst.c |  4 ++--
  sound/soc/intel/skylake/cnl-sst.c |  4 ++--
  sound/soc/intel/skylake/skl-sst.c |  4 ++--
  sound/soc/intel/skylake/skl.c     | 38 ++++++++++++++++++++++++++++++-
  sound/soc/intel/skylake/skl.h     |  3 +++
  5 files changed, 46 insertions(+), 7 deletions(-)
sound/soc/intel/skylake/bxt-sst.c +2 -2
index a547fb84eee9..06da822790a5 100644
@@ -531,7 +531,7 @@ static const struct skl_dsp_fw_ops bxt_fw_ops = {
  	.load_library = bxt_load_library,
  };
 
-static struct sst_ops skl_ops = {
+struct sst_ops apl_sst_ops = {
  	.irq_handler = skl_dsp_sst_interrupt,
  	.thread_fn = skl_dsp_irq_thread_handler,
  	.write = sst_shim32_write,
@@ -542,7 +542,7 @@ static struct sst_ops skl_ops = {
  };
 
  static struct sst_pdata skl_dev = {
-	.ops = &skl_ops,
+	.ops = &apl_sst_ops,
  };
 
  int bxt_sst_dsp_init(struct skl_dev *skl, const char *fw_name)
sound/soc/intel/skylake/cnl-sst.c +2 -2
index 5be0a8eb154d..c4dbf6655097 100644
@@ -408,7 +408,7 @@ static int cnl_ipc_init(struct device *dev, struct skl_dev *cnl)
  	return 0;
  }
 
-static struct sst_ops cnl_ops = {
+struct sst_ops cnl_sst_ops = {
  	.irq_handler = cnl_dsp_sst_interrupt,
  	.thread_fn = cnl_dsp_irq_thread_handler,
  	.write = sst_shim32_write,
@@ -419,7 +419,7 @@ static struct sst_ops cnl_ops = {
  };
 
  static struct sst_pdata cnl_dev = {
-	.ops = &cnl_ops,
+	.ops = &cnl_sst_ops,
  };
 
  int cnl_sst_dsp_init(struct skl_dev *cnl, const char *fw_name)
sound/soc/intel/skylake/skl-sst.c +2 -2
index 8ae7fe73534e..122c07290440 100644
@@ -503,7 +503,7 @@ static const struct skl_dsp_fw_ops skl_fw_ops = {
  	.unload_mod = skl_unload_module,
  };
 
-static struct sst_ops skl_ops = {
+struct sst_ops skl_sst_ops = {
  	.irq_handler = skl_dsp_sst_interrupt,
  	.write = sst_shim32_write,
  	.read = sst_shim32_read,
@@ -513,7 +513,7 @@ static struct sst_ops skl_ops = {
  };
 
  static struct sst_pdata skl_dev = {
-	.ops = &skl_ops,
+	.ops = &skl_sst_ops,
  };
 
  int skl_sst_dsp_init(struct skl_dev *skl, const char *fw_name)
sound/soc/intel/skylake/skl.c +37 -1
index 54e1f957121d..d6d099aba834 100644
@@ -27,6 +27,7 @@
  #include <sound/hda_i915.h>
  #include <sound/hda_codec.h>
  #include <sound/intel-nhlt.h>
+#include "../common/sst-dsp.h"
  #include "skl.h"
  #include "skl-sst-dsp.h"
  #include "skl-sst-ipc.h"
@@ -1063,7 +1064,6 @@ static int skl_probe(struct pci_dev *pci,
 
  	pci_set_drvdata(skl->pci, bus);
 
-
  	err = skl_find_machine(skl, (void *)pci_id->driver_data);
  	if (err < 0) {
  		dev_err(bus->dev, "skl_find_machine failed with err: %d\n", err);
@@ -1153,6 +1153,42 @@ static void skl_remove(struct pci_dev *pci)
  	dev_set_drvdata(&pci->dev, NULL);
  }
 
+static struct sst_pdata skl_desc = {
+	.fw_name = "intel/dsp_fw_release.bin",
+	.ops = &skl_sst_ops,
+	.boards = snd_soc_acpi_intel_skl_machines,
+};
+
+static struct sst_pdata kbl_desc = {
+	.fw_name = "intel/dsp_fw_kbl.bin",
+	.ops = &skl_sst_ops,
+	.boards = snd_soc_acpi_intel_kbl_machines,
+};
+
+static struct sst_pdata apl_desc = {
+	.fw_name = "intel/dsp_fw_bxtn.bin",
+	.ops = &apl_sst_ops,
+	.boards = snd_soc_acpi_intel_bxt_machines,
+};
+
+static struct sst_pdata glk_desc = {
+	.fw_name = "intel/dsp_fw_glk.bin",
+	.ops = &apl_sst_ops,
+	.boards = snd_soc_acpi_intel_glk_machines,
+};
+
+static struct sst_pdata cnl_desc = {
+	.fw_name = "intel/dsp_fw_cnl.bin",
+	.ops = &cnl_sst_ops,
+	.boards = snd_soc_acpi_intel_cnl_machines,
+};
+
+static struct sst_pdata icl_desc = {
+	.fw_name = "intel/dsp_fw_icl.bin",
+	.ops = &cnl_sst_ops,
+	.boards = snd_soc_acpi_intel_icl_machines,
+};
+
  /* PCI IDs */
  static const struct pci_device_id skl_ids[] = {
  #if IS_ENABLED(CONFIG_SND_SOC_INTEL_SKL)
sound/soc/intel/skylake/skl.h +3 -0
index 9f5aa53df9f8..2f2b5a141abf 100644
@@ -42,6 +42,9 @@
  #define AZX_REG_VS_EM2_L1SEN		BIT(13)
 
  struct skl_debug;
+extern struct sst_ops skl_sst_ops;
+extern struct sst_ops apl_sst_ops;
+extern struct sst_ops cnl_sst_ops;
 
  struct skl_astate_param {
  	u32 kcps;
author maintainer
#61 lore raw

Re: [PATCH 27/35] ASoC: Intel: Skylake: Define platform descriptors

Quoted 11 lines · Pierre-Louis Bossart
Quoted 3 lines · Cezary Rojewski

Make use of sst_pdata and declare platform descriptors for all existing cAVS platforms. Each carries information about base_fw filename, platform specific operations and boards supported.

if you use a constant base_fw name that cannot be made board-specific for specific usages, you will restrict the ability to deal with quirks and custom cases.

real-life example: not so long ago there were two SST firmwares for 'regular' solutions and ultra-low-latency ones, so by having a single name for all APL-based platforms you will generate issues that don't exist today, or you will force users to patch something in the core.

I did not bring up ULL case for a reason. Guess Pandora box is to be opened.. so be it.

ULL stands for Ultra Low Latency and it can be described by the following:
- exists only for APL based platforms (more like single platform/ model though)
- in consequence, binary isn't present on any other FW branch and any other platform apart from APL
- its existence is tied to hardware.. eh.. let's call it a "limitation"
- number of actual vendors is too Ultra Low..
- has limited functionality and validation
- is not the recommended FW for end users in any case
- binary is not going to be upstreamed
- reference board is not going to be upstreamed
- generic (so called main FW) and ULL share the board ACPI ID and thus require kernel .config to be modified -or- blacklist.conf with be updated
- shares topology filename with generic (main) FW so user still has to modify his /lib/firmware. Topology names are currently NHLT-based, built from NHLT header data and platform id which are BIOS/ ABL and platform specific respectively (...)

TLDR:
There is total of 0 people sitting in front of their monitors who are consciously going to make use of ULL firmware. Any user that is going to, will have to play with their kconfig, blacklist and replace existing topology file.

This is normally done by titanic build-bot which, among billion other things, ensures /lib/firmware looks like it should given the configuration.

-

So, one could have provided a nice choice-box within menuconfig to ensure only one board can be chosen.
When one does it, one realizes both generic and ULL firmwares are not actually tied to any specific board and with more boards (usecases) and more kconfigs code gets bloated.

Moving further, guarding apl_desc with #if-else depending on some global generic-vs-ULL configuration which would adjust said descriptors with proper FW filename actually seems like a better solution..

..and then kBOOM comes in and actual design pattern!
Board should have been stated tplg_filename, not the fw_filename. Said topology file contains manifest which tells host what libraries to load. And thus, we clear the mist and see that one single field (which is currently missing in snd_soc_acpi_mach) and some clever topology manifest make it all happen: platform-board conflicts cease to exist.

Czarek

Quoted 133 lines
Quoted 133 lines

---

  sound/soc/intel/skylake/bxt-sst.c |  4 ++--
  sound/soc/intel/skylake/cnl-sst.c |  4 ++--
  sound/soc/intel/skylake/skl-sst.c |  4 ++--
  sound/soc/intel/skylake/skl.c     | 38 ++++++++++++++++++++++++++++++-
  sound/soc/intel/skylake/skl.h     |  3 +++
  5 files changed, 46 insertions(+), 7 deletions(-)
sound/soc/intel/skylake/bxt-sst.c +2 -2
index a547fb84eee9..06da822790a5 100644
@@ -531,7 +531,7 @@ static const struct skl_dsp_fw_ops bxt_fw_ops = {
       .load_library = bxt_load_library,
   };
-static struct sst_ops skl_ops = {
+struct sst_ops apl_sst_ops = {
       .irq_handler = skl_dsp_sst_interrupt,
       .thread_fn = skl_dsp_irq_thread_handler,
       .write = sst_shim32_write,
@@ -542,7 +542,7 @@ static struct sst_ops skl_ops = {
   };
   static struct sst_pdata skl_dev = {
-    .ops = &skl_ops,
+    .ops = &apl_sst_ops,
   };
   int bxt_sst_dsp_init(struct skl_dev *skl, const char *fw_name)
sound/soc/intel/skylake/cnl-sst.c +2 -2
index 5be0a8eb154d..c4dbf6655097 100644
@@ -408,7 +408,7 @@ static int cnl_ipc_init(struct device *dev, struct 
 skl_dev *cnl)
       return 0;
   }
-static struct sst_ops cnl_ops = {
+struct sst_ops cnl_sst_ops = {
       .irq_handler = cnl_dsp_sst_interrupt,
       .thread_fn = cnl_dsp_irq_thread_handler,
       .write = sst_shim32_write,
@@ -419,7 +419,7 @@ static struct sst_ops cnl_ops = {
   };
   static struct sst_pdata cnl_dev = {
-    .ops = &cnl_ops,
+    .ops = &cnl_sst_ops,
   };
   int cnl_sst_dsp_init(struct skl_dev *cnl, const char *fw_name)
sound/soc/intel/skylake/skl-sst.c +2 -2
index 8ae7fe73534e..122c07290440 100644
@@ -503,7 +503,7 @@ static const struct skl_dsp_fw_ops skl_fw_ops = {
       .unload_mod = skl_unload_module,
   };
-static struct sst_ops skl_ops = {
+struct sst_ops skl_sst_ops = {
       .irq_handler = skl_dsp_sst_interrupt,
       .write = sst_shim32_write,
       .read = sst_shim32_read,
@@ -513,7 +513,7 @@ static struct sst_ops skl_ops = {
   };
   static struct sst_pdata skl_dev = {
-    .ops = &skl_ops,
+    .ops = &skl_sst_ops,
   };
   int skl_sst_dsp_init(struct skl_dev *skl, const char *fw_name)
sound/soc/intel/skylake/skl.c +37 -1
index 54e1f957121d..d6d099aba834 100644
@@ -27,6 +27,7 @@
   #include <sound/hda_i915.h>
   #include <sound/hda_codec.h>
   #include <sound/intel-nhlt.h>
+#include "../common/sst-dsp.h"
   #include "skl.h"
   #include "skl-sst-dsp.h"
   #include "skl-sst-ipc.h"
@@ -1063,7 +1064,6 @@ static int skl_probe(struct pci_dev *pci,
       pci_set_drvdata(skl->pci, bus);
-
       err = skl_find_machine(skl, (void *)pci_id->driver_data);
       if (err < 0) {
           dev_err(bus->dev, "skl_find_machine failed with err: %d\n", err);
@@ -1153,6 +1153,42 @@ static void skl_remove(struct pci_dev *pci)
       dev_set_drvdata(&pci->dev, NULL);
   }
+static struct sst_pdata skl_desc = {
+    .fw_name = "intel/dsp_fw_release.bin",
+    .ops = &skl_sst_ops,
+    .boards = snd_soc_acpi_intel_skl_machines,
+};
+
+static struct sst_pdata kbl_desc = {
+    .fw_name = "intel/dsp_fw_kbl.bin",
+    .ops = &skl_sst_ops,
+    .boards = snd_soc_acpi_intel_kbl_machines,
+};
+
+static struct sst_pdata apl_desc = {
+    .fw_name = "intel/dsp_fw_bxtn.bin",
+    .ops = &apl_sst_ops,
+    .boards = snd_soc_acpi_intel_bxt_machines,
+};
+
+static struct sst_pdata glk_desc = {
+    .fw_name = "intel/dsp_fw_glk.bin",
+    .ops = &apl_sst_ops,
+    .boards = snd_soc_acpi_intel_glk_machines,
+};
+
+static struct sst_pdata cnl_desc = {
+    .fw_name = "intel/dsp_fw_cnl.bin",
+    .ops = &cnl_sst_ops,
+    .boards = snd_soc_acpi_intel_cnl_machines,
+};
+
+static struct sst_pdata icl_desc = {
+    .fw_name = "intel/dsp_fw_icl.bin",
+    .ops = &cnl_sst_ops,
+    .boards = snd_soc_acpi_intel_icl_machines,
+};
+
   /* PCI IDs */
   static const struct pci_device_id skl_ids[] = {
   #if IS_ENABLED(CONFIG_SND_SOC_INTEL_SKL)
sound/soc/intel/skylake/skl.h +0 -0
index 9f5aa53df9f8..2f2b5a141abf 100644
@@ -42,6 +42,9 @@
Quoted 8 lines

sound/soc/intel/skylake/skl.h

Quoted 8 lines
sound/soc/intel/skylake/skl.h +3 -0
   #define AZX_REG_VS_EM2_L1SEN        BIT(13)
   struct skl_debug;
+extern struct sst_ops skl_sst_ops;
+extern struct sst_ops apl_sst_ops;
+extern struct sst_ops cnl_sst_ops;
   struct skl_astate_param {
       u32 kcps;
 

_______________________________________________
Alsa-devel mailing list
[email protected]
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

#62 lore raw

Re: [PATCH 27/35] ASoC: Intel: Skylake: Define platform descriptors

Quoted 15 lines · Cezary Rojewski
Quoted 11 lines · Pierre-Louis Bossart
Quoted 3 lines · Cezary Rojewski

Make use of sst_pdata and declare platform descriptors for all existing cAVS platforms. Each carries information about base_fw filename, platform specific operations and boards supported.

if you use a constant base_fw name that cannot be made board-specific for specific usages, you will restrict the ability to deal with quirks and custom cases.

real-life example: not so long ago there were two SST firmwares for 'regular' solutions and ultra-low-latency ones, so by having a single name for all APL-based platforms you will generate issues that don't exist today, or you will force users to patch something in the core.

I did not bring up ULL case for a reason. Guess Pandora box is to be opened.. so be it.

Quoted 16 lines

ULL stands for Ultra Low Latency and it can be described by the following:
- exists only for APL based platforms (more like single platform/ model
though)
- in consequence, binary isn't present on any other FW branch and any
other platform apart from APL
- its existence is tied to hardware.. eh.. let's call it a "limitation"
- number of actual vendors is too Ultra Low..
- has limited functionality and validation
- is not the recommended FW for end users in any case
- binary is not going to be upstreamed
- reference board is not going to be upstreamed
- generic (so called main FW) and ULL share the board ACPI ID and thus
require kernel .config to be modified -or- blacklist.conf with be updated
- shares topology filename with generic (main) FW so user still has to
modify his /lib/firmware. Topology names are currently NHLT-based, built from NHLT header data and platform id which are BIOS/ ABL and platform specific respectively (...)

I would describe your answer as 'whatabout-ism'. Yes there are plenty of ways to screw-up, none of them is a justification for assuming that a single filename will work for everyone.

There are also plenty of good reasons to use a different fw and topology file name. Taking this capability away essentially corners users into non-upstreamed custom versions.

Quoted 3 lines

TLDR:
There is total of 0 people sitting in front of their monitors who are consciously going to make use of ULL firmware. Any user that is going to, will have to play with their kconfig, blacklist and replace existing topology file.

that's where you are making too many assumptions, if quirks and dynamic detection capabilities are provided then it's possible to have a single kernel build that will deal with multiple configurations.

Quoted 11 lines

This is normally done by titanic build-bot which, among billion other things, ensures /lib/firmware looks like it should given the configuration.

-

So, one could have provided a nice choice-box within menuconfig to ensure only one board can be chosen.
When one does it, one realizes both generic and ULL firmwares are not actually tied to any specific board and with more boards (usecases) and more kconfigs code gets bloated.

Moving further, guarding apl_desc with #if-else depending on some global generic-vs-ULL configuration which would adjust said descriptors with proper FW filename actually seems like a better solution..

..and then kBOOM comes in and actual design pattern!
Board should have been stated tplg_filename, not the fw_filename. Said topology file contains manifest which tells host what libraries to load. And thus, we clear the mist and see that one single field (which is currently missing in snd_soc_acpi_mach) and some clever topology manifest make it all happen: platform-board conflicts cease to exist.

I am not going to argue further. I've spent a lot of time making sure the same kernel build can be used across multiple platforms, if you want to stick to static custom configurations I am not interested in debating. I just hope your team has enough support folks to deal with all these configurations.

Quoted 140 lines

Czarek

Quoted 137 lines
Quoted 137 lines

---

  sound/soc/intel/skylake/bxt-sst.c |  4 ++--
  sound/soc/intel/skylake/cnl-sst.c |  4 ++--
  sound/soc/intel/skylake/skl-sst.c |  4 ++--
  sound/soc/intel/skylake/skl.c     | 38 ++++++++++++++++++++++++++++++-
  sound/soc/intel/skylake/skl.h     |  3 +++
  5 files changed, 46 insertions(+), 7 deletions(-)
sound/soc/intel/skylake/bxt-sst.c +2 -2
index a547fb84eee9..06da822790a5 100644
@@ -531,7 +531,7 @@ static const struct skl_dsp_fw_ops bxt_fw_ops = {
       .load_library = bxt_load_library,
   };
-static struct sst_ops skl_ops = {
+struct sst_ops apl_sst_ops = {
       .irq_handler = skl_dsp_sst_interrupt,
       .thread_fn = skl_dsp_irq_thread_handler,
       .write = sst_shim32_write,
@@ -542,7 +542,7 @@ static struct sst_ops skl_ops = {
   };
   static struct sst_pdata skl_dev = {
-    .ops = &skl_ops,
+    .ops = &apl_sst_ops,
   };
   int bxt_sst_dsp_init(struct skl_dev *skl, const char *fw_name)
sound/soc/intel/skylake/cnl-sst.c +2 -2
index 5be0a8eb154d..c4dbf6655097 100644
@@ -408,7 +408,7 @@ static int cnl_ipc_init(struct device *dev, 
 struct skl_dev *cnl)
       return 0;
   }
-static struct sst_ops cnl_ops = {
+struct sst_ops cnl_sst_ops = {
       .irq_handler = cnl_dsp_sst_interrupt,
       .thread_fn = cnl_dsp_irq_thread_handler,
       .write = sst_shim32_write,
@@ -419,7 +419,7 @@ static struct sst_ops cnl_ops = {
   };
   static struct sst_pdata cnl_dev = {
-    .ops = &cnl_ops,
+    .ops = &cnl_sst_ops,
   };
   int cnl_sst_dsp_init(struct skl_dev *cnl, const char *fw_name)
sound/soc/intel/skylake/skl-sst.c +2 -2
index 8ae7fe73534e..122c07290440 100644
@@ -503,7 +503,7 @@ static const struct skl_dsp_fw_ops skl_fw_ops = {
       .unload_mod = skl_unload_module,
   };
-static struct sst_ops skl_ops = {
+struct sst_ops skl_sst_ops = {
       .irq_handler = skl_dsp_sst_interrupt,
       .write = sst_shim32_write,
       .read = sst_shim32_read,
@@ -513,7 +513,7 @@ static struct sst_ops skl_ops = {
   };
   static struct sst_pdata skl_dev = {
-    .ops = &skl_ops,
+    .ops = &skl_sst_ops,
   };
   int skl_sst_dsp_init(struct skl_dev *skl, const char *fw_name)
sound/soc/intel/skylake/skl.c +37 -1
index 54e1f957121d..d6d099aba834 100644
@@ -27,6 +27,7 @@
   #include <sound/hda_i915.h>
   #include <sound/hda_codec.h>
   #include <sound/intel-nhlt.h>
+#include "../common/sst-dsp.h"
   #include "skl.h"
   #include "skl-sst-dsp.h"
   #include "skl-sst-ipc.h"
@@ -1063,7 +1064,6 @@ static int skl_probe(struct pci_dev *pci,
       pci_set_drvdata(skl->pci, bus);
-
       err = skl_find_machine(skl, (void *)pci_id->driver_data);
       if (err < 0) {
           dev_err(bus->dev, "skl_find_machine failed with err: %d\n", err);
@@ -1153,6 +1153,42 @@ static void skl_remove(struct pci_dev *pci)
       dev_set_drvdata(&pci->dev, NULL);
   }
+static struct sst_pdata skl_desc = {
+    .fw_name = "intel/dsp_fw_release.bin",
+    .ops = &skl_sst_ops,
+    .boards = snd_soc_acpi_intel_skl_machines,
+};
+
+static struct sst_pdata kbl_desc = {
+    .fw_name = "intel/dsp_fw_kbl.bin",
+    .ops = &skl_sst_ops,
+    .boards = snd_soc_acpi_intel_kbl_machines,
+};
+
+static struct sst_pdata apl_desc = {
+    .fw_name = "intel/dsp_fw_bxtn.bin",
+    .ops = &apl_sst_ops,
+    .boards = snd_soc_acpi_intel_bxt_machines,
+};
+
+static struct sst_pdata glk_desc = {
+    .fw_name = "intel/dsp_fw_glk.bin",
+    .ops = &apl_sst_ops,
+    .boards = snd_soc_acpi_intel_glk_machines,
+};
+
+static struct sst_pdata cnl_desc = {
+    .fw_name = "intel/dsp_fw_cnl.bin",
+    .ops = &cnl_sst_ops,
+    .boards = snd_soc_acpi_intel_cnl_machines,
+};
+
+static struct sst_pdata icl_desc = {
+    .fw_name = "intel/dsp_fw_icl.bin",
+    .ops = &cnl_sst_ops,
+    .boards = snd_soc_acpi_intel_icl_machines,
+};
+
   /* PCI IDs */
   static const struct pci_device_id skl_ids[] = {
   #if IS_ENABLED(CONFIG_SND_SOC_INTEL_SKL)
sound/soc/intel/skylake/skl.h +2 -0
index 9f5aa53df9f8..2f2b5a141abf 100644
@@ -42,6 +42,9 @@
   #define AZX_REG_VS_EM2_L1SEN        BIT(13)
   struct skl_debug;
+extern struct sst_ops skl_sst_ops;
+extern struct sst_ops apl_sst_ops;
Quoted 8 lines
Quoted 4 lines

sound/soc/intel/skylake/skl.h

Quoted 4 lines
sound/soc/intel/skylake/skl.h +1 -0
+extern struct sst_ops cnl_sst_ops;
   struct skl_astate_param {
       u32 kcps;
 

_______________________________________________
Alsa-devel mailing list
[email protected]
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

_______________________________________________
Alsa-devel mailing list
[email protected]
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

author maintainer
#63 lore raw

Re: [PATCH 27/35] ASoC: Intel: Skylake: Define platform descriptors

Quoted 35 lines · Pierre-Louis Bossart
Quoted 15 lines · Cezary Rojewski
Quoted 11 lines · Pierre-Louis Bossart
Quoted 3 lines · Cezary Rojewski

Make use of sst_pdata and declare platform descriptors for all existing cAVS platforms. Each carries information about base_fw filename, platform specific operations and boards supported.

if you use a constant base_fw name that cannot be made board-specific for specific usages, you will restrict the ability to deal with quirks and custom cases.

real-life example: not so long ago there were two SST firmwares for 'regular' solutions and ultra-low-latency ones, so by having a single name for all APL-based platforms you will generate issues that don't exist today, or you will force users to patch something in the core.

I did not bring up ULL case for a reason. Guess Pandora box is to be opened.. so be it.

Quoted 16 lines

ULL stands for Ultra Low Latency and it can be described by the following:
- exists only for APL based platforms (more like single platform/
model though)
- in consequence, binary isn't present on any other FW branch and any
other platform apart from APL
- its existence is tied to hardware.. eh.. let's call it a "limitation"
- number of actual vendors is too Ultra Low..
- has limited functionality and validation
- is not the recommended FW for end users in any case
- binary is not going to be upstreamed
- reference board is not going to be upstreamed
- generic (so called main FW) and ULL share the board ACPI ID and thus
require kernel .config to be modified -or- blacklist.conf with be updated
- shares topology filename with generic (main) FW so user still has to
modify his /lib/firmware. Topology names are currently NHLT-based, built from NHLT header data and platform id which are BIOS/ ABL and platform specific respectively (...)

Quoted 3 lines

I would describe your answer as 'whatabout-ism'. Yes there are plenty of ways to screw-up, none of them is a justification for assuming that a single filename will work for everyone.

There are also plenty of good reasons to use a different fw and topology file name. Taking this capability away essentially corners users into non-upstreamed custom versions.

There is no "different filename" for /skylake topology on upstream, only fw.

Quoted 14 lines
Quoted 4 lines

TLDR:
There is total of 0 people sitting in front of their monitors who are consciously going to make use of ULL firmware. Any user that is going to, will have to play with their kconfig, blacklist and replace existing topology file.

that's where you are making too many assumptions, if quirks and dynamic detection capabilities are provided then it's possible to have a single kernel build that will deal with multiple configurations.

Quoted 7 lines

This is normally done by titanic build-bot which, among billion other things, ensures /lib/firmware looks like it should given the configuration.

-

So, one could have provided a nice choice-box within menuconfig to ensure only one board can be chosen.
When one does it, one realizes both generic and ULL firmwares are not actually tied to any specific board and with more boards (usecases) and more kconfigs code gets bloated.

Quoted 7 lines
Quoted 4 lines

Moving further, guarding apl_desc with #if-else depending on some global generic-vs-ULL configuration which would adjust said descriptors with proper FW filename actually seems like a better solution..

..and then kBOOM comes in and actual design pattern!
Board should have been stated tplg_filename, not the fw_filename. Said topology file contains manifest which tells host what libraries to load. And thus, we clear the mist and see that one single field (which is currently missing in snd_soc_acpi_mach) and some clever topology manifest make it all happen: platform-board conflicts cease to exist.

I am not going to argue further. I've spent a lot of time making sure the same kernel build can be used across multiple platforms, if you want to stick to static custom configurations I am not interested in debating. I just hope your team has enough support folks to deal with all these configurations.

Not arguing at all, just stating the facts.
Idea behind is rather straightforward and my guess it that either you missed the key part -or- my explanations were lackluster.
We do want kernel to support multiple configurations dynamically. Same goes for allowing for customizations, depending on board chosen. Although, we think topology alone is more than enough.

Existing mach::fw_filename and single tplg file based on data provided from NHLT (function: skl_nhlt_update_topology_bin skl-nhlt.c) already fails us. What is present on upstream is not sufficient and thus build-bots are doing more than they are supposed to.

Let uss checkout sof machine fields:
- sof_fw_filename
- sof_tplg_filename

and then again, the skl one(s):
- fw_filename

Is the difference clear now?
The key player here is topology file name. Once you tie board with topology you have more than enough customization to do whatever you want. As said, clever usage of topology may even allow you to skip fw_filename entirely. And this is the exact opposite of static configuration.

In my opinion, SOF needs sof_fw_filename neither.

#64 lore raw

Re: [PATCH 27/35] ASoC: Intel: Skylake: Define platform descriptors

Quoted 36 lines · Cezary Rojewski
Quoted 35 lines · Pierre-Louis Bossart
Quoted 31 lines · Cezary Rojewski
Quoted 11 lines · Pierre-Louis Bossart
Quoted 3 lines · Cezary Rojewski

Make use of sst_pdata and declare platform descriptors for all existing cAVS platforms. Each carries information about base_fw filename, platform specific operations and boards supported.

if you use a constant base_fw name that cannot be made board-specific for specific usages, you will restrict the ability to deal with quirks and custom cases.

real-life example: not so long ago there were two SST firmwares for 'regular' solutions and ultra-low-latency ones, so by having a single name for all APL-based platforms you will generate issues that don't exist today, or you will force users to patch something in the core.

I did not bring up ULL case for a reason. Guess Pandora box is to be opened.. so be it.

ULL stands for Ultra Low Latency and it can be described by the following:
- exists only for APL based platforms (more like single platform/
model though)
- in consequence, binary isn't present on any other FW branch and any
other platform apart from APL
- its existence is tied to hardware.. eh.. let's call it a "limitation"
- number of actual vendors is too Ultra Low..
- has limited functionality and validation
- is not the recommended FW for end users in any case
- binary is not going to be upstreamed
- reference board is not going to be upstreamed
- generic (so called main FW) and ULL share the board ACPI ID and
thus require kernel .config to be modified -or- blacklist.conf with be updated
- shares topology filename with generic (main) FW so user still has
to modify his /lib/firmware. Topology names are currently NHLT-based, built from NHLT header data and platform id which are BIOS/ ABL and platform specific respectively (...)

Quoted 5 lines
Quoted 3 lines

I would describe your answer as 'whatabout-ism'. Yes there are plenty of ways to screw-up, none of them is a justification for assuming that a single filename will work for everyone.

There are also plenty of good reasons to use a different fw and topology file name. Taking this capability away essentially corners users into non-upstreamed custom versions.

There is no "different filename" for /skylake topology on upstream, only fw.

I don't know why we would restrict the discussion to what has been upstreamed. This is a fundamental capability that will impact non-upstreamed configurations as well.

Quoted 20 lines
Quoted 20 lines
Quoted 5 lines

TLDR:
There is total of 0 people sitting in front of their monitors who are consciously going to make use of ULL firmware. Any user that is going to, will have to play with their kconfig, blacklist and replace existing topology file.

that's where you are making too many assumptions, if quirks and dynamic detection capabilities are provided then it's possible to have a single kernel build that will deal with multiple configurations.

Quoted 11 lines

This is normally done by titanic build-bot which, among billion other things, ensures /lib/firmware looks like it should given the configuration.

-

So, one could have provided a nice choice-box within menuconfig to ensure only one board can be chosen.
When one does it, one realizes both generic and ULL firmwares are not actually tied to any specific board and with more boards (usecases) and more kconfigs code gets bloated.

Moving further, guarding apl_desc with #if-else depending on some global generic-vs-ULL configuration which would adjust said descriptors with proper FW filename actually seems like a better solution..

..and then kBOOM comes in and actual design pattern!
Board should have been stated tplg_filename, not the fw_filename. Said topology file contains manifest which tells host what libraries to load. And thus, we clear the mist and see that one single field (which is currently missing in snd_soc_acpi_mach) and some clever topology manifest make it all happen: platform-board conflicts cease to exist.

Quoted 6 lines
Quoted 2 lines

I am not going to argue further. I've spent a lot of time making sure the same kernel build can be used across multiple platforms, if you want to stick to static custom configurations I am not interested in debating. I just hope your team has enough support folks to deal with all these configurations.

Not arguing at all, just stating the facts.
Idea behind is rather straightforward and my guess it that either you missed the key part -or- my explanations were lackluster.
We do want kernel to support multiple configurations dynamically. Same goes for allowing for customizations, depending on board chosen. Although, we think topology alone is more than enough.

I am having a hard time on this one. Most quirks are ACPI or DMI based, and assuming that the topology magically tells you about the right information is a leap of faith that I am not ready to take.

The complexity of the tools and skillset needed to generate a functional topology are several orders of magnitude larger than changing a file name in a C structure. Even for SOF, the topology is the source of many errors, and it feels a lot safer to keep a quirk mechanism that anyone can understand rather than assuming that everyone can generate a new topology file. There are fewer than 10 people on this planet who understand the alsa topology layers in depth, and I don't count myself in that lot...

Also for new platforms it's quite common that the tools are delivered sometime after power-on steps, so in the initial steps people in the trenches make the system work with a topology that was used on a previous silicon generation. Tying hardware-related debug and topology-related debug is not recommended.

Quoted 11 lines

Existing mach::fw_filename and single tplg file based on data provided from NHLT (function: skl_nhlt_update_topology_bin skl-nhlt.c) already fails us. What is present on upstream is not sufficient and thus build-bots are doing more than they are supposed to.

Let uss checkout sof machine fields:
- sof_fw_filename
- sof_tplg_filename

and then again, the skl one(s):
- fw_filename

Is the difference clear now?
The key player here is topology file name. Once you tie board with topology you have more than enough customization to do whatever you want. As said, clever usage of topology may even allow you to skip fw_filename entirely. And this is the exact opposite of static configuration.

Except that the boot flow is to first try to boot the DSP with a firmware file, then work on topology-related configurations. You would be adding a new step that is not desirable in all cases, e.g when you care about boot time.

It's also not necessary simpler to base your solution on topology. We have tons of topology configurations that are exactly the same for different devices, so it's useful to avoid bundling the firmware name inside of the topology file.

Quoted 1 line

In my opinion, SOF needs sof_fw_filename neither.

we will definitely keep the ability to add board-specific quirks. It's very useful for e.g. derivatives and experimental cases, e.g. A/B testing with one firmware selected with one ACPI ID and another firmware selected with another ACPI ID, without mucking with the topology.

author maintainer
#65 lore raw

PATCH 28/35 ASoC: Intel: Skylake: Update skl_ids table

In reply to Cezary Rojewski

With platform descriptors defined, update PCI ID table together with skl_probe to retrieve supported boards from saved sst_pdata objects instead.

---
 sound/soc/intel/skylake/skl.c | 20 +++++++++++---------
 1 file changed, 11 insertions(+), 9 deletions(-)
sound/soc/intel/skylake/skl.c +11 -9
index d6d099aba834..53a6befd5d68 100644
@@ -985,6 +985,7 @@ static int skl_probe(struct pci_dev *pci,
 {
 	struct skl_dev *skl;
 	struct hdac_bus *bus = NULL;
+	struct sst_pdata *desc;
 	int err;
 
 	switch (skl_pci_binding) {
@@ -1064,7 +1065,8 @@ static int skl_probe(struct pci_dev *pci,
 
 	pci_set_drvdata(skl->pci, bus);
 
-	err = skl_find_machine(skl, (void *)pci_id->driver_data);
+	desc = (struct sst_pdata *)pci_id->driver_data;
+	err = skl_find_machine(skl, desc->boards);
 	if (err < 0) {
 		dev_err(bus->dev, "skl_find_machine failed with err: %d\n", err);
 		goto out_nhlt_free;
@@ -1194,42 +1196,42 @@ static const struct pci_device_id skl_ids[] = {
 #if IS_ENABLED(CONFIG_SND_SOC_INTEL_SKL)
 	/* Sunrise Point-LP */
 	{ PCI_DEVICE(0x8086, 0x9d70),
-		.driver_data = (unsigned long)&snd_soc_acpi_intel_skl_machines},
+		.driver_data = (unsigned long)&skl_desc },
 #endif
 #if IS_ENABLED(CONFIG_SND_SOC_INTEL_APL)
 	/* BXT-P */
 	{ PCI_DEVICE(0x8086, 0x5a98),
-		.driver_data = (unsigned long)&snd_soc_acpi_intel_bxt_machines},
+		.driver_data = (unsigned long)&apl_desc },
 #endif
 #if IS_ENABLED(CONFIG_SND_SOC_INTEL_KBL)
 	/* KBL */
 	{ PCI_DEVICE(0x8086, 0x9D71),
-		.driver_data = (unsigned long)&snd_soc_acpi_intel_kbl_machines},
+		.driver_data = (unsigned long)&kbl_desc },
 #endif
 #if IS_ENABLED(CONFIG_SND_SOC_INTEL_GLK)
 	/* GLK */
 	{ PCI_DEVICE(0x8086, 0x3198),
-		.driver_data = (unsigned long)&snd_soc_acpi_intel_glk_machines},
+		.driver_data = (unsigned long)&glk_desc },
 #endif
 #if IS_ENABLED(CONFIG_SND_SOC_INTEL_CNL)
 	/* CNL */
 	{ PCI_DEVICE(0x8086, 0x9dc8),
-		.driver_data = (unsigned long)&snd_soc_acpi_intel_cnl_machines},
+		.driver_data = (unsigned long)&cnl_desc },
 #endif
 #if IS_ENABLED(CONFIG_SND_SOC_INTEL_CFL)
 	/* CFL */
 	{ PCI_DEVICE(0x8086, 0xa348),
-		.driver_data = (unsigned long)&snd_soc_acpi_intel_cnl_machines},
+		.driver_data = (unsigned long)&cnl_desc },
 #endif
 #if IS_ENABLED(CONFIG_SND_SOC_INTEL_CML_LP)
 	/* CML-LP */
 	{ PCI_DEVICE(0x8086, 0x02c8),
-		.driver_data = (unsigned long)&snd_soc_acpi_intel_cnl_machines},
+		.driver_data = (unsigned long)&cnl_desc },
 #endif
 #if IS_ENABLED(CONFIG_SND_SOC_INTEL_CML_H)
 	/* CML-H */
 	{ PCI_DEVICE(0x8086, 0x06c8),
-		.driver_data = (unsigned long)&snd_soc_acpi_intel_cnl_machines},
+		.driver_data = (unsigned long)&cnl_desc },
 #endif
 	{ 0, }
 };
Signature · 1 line
2.17.1
#66 lore raw

Re: [PATCH 28/35] ASoC: Intel: Skylake: Update skl_ids table

Quoted 3 lines · Cezary Rojewski

With platform descriptors defined, update PCI ID table together with skl_probe to retrieve supported boards from saved sst_pdata objects instead.

I don't get what you are trying to do here. the only 'benefit' seems to duplicate the firmware name, which as I mentioned earlier isn't such a good idea.

Quoted 80 lines
---
  sound/soc/intel/skylake/skl.c | 20 +++++++++++---------
  1 file changed, 11 insertions(+), 9 deletions(-)
sound/soc/intel/skylake/skl.c +11 -9
index d6d099aba834..53a6befd5d68 100644
@@ -985,6 +985,7 @@ static int skl_probe(struct pci_dev *pci,
  {
  	struct skl_dev *skl;
  	struct hdac_bus *bus = NULL;
+	struct sst_pdata *desc;
  	int err;
 
  	switch (skl_pci_binding) {
@@ -1064,7 +1065,8 @@ static int skl_probe(struct pci_dev *pci,
 
  	pci_set_drvdata(skl->pci, bus);
 
-	err = skl_find_machine(skl, (void *)pci_id->driver_data);
+	desc = (struct sst_pdata *)pci_id->driver_data;
+	err = skl_find_machine(skl, desc->boards);
  	if (err < 0) {
  		dev_err(bus->dev, "skl_find_machine failed with err: %d\n", err);
  		goto out_nhlt_free;
@@ -1194,42 +1196,42 @@ static const struct pci_device_id skl_ids[] = {
  #if IS_ENABLED(CONFIG_SND_SOC_INTEL_SKL)
  	/* Sunrise Point-LP */
  	{ PCI_DEVICE(0x8086, 0x9d70),
-		.driver_data = (unsigned long)&snd_soc_acpi_intel_skl_machines},
+		.driver_data = (unsigned long)&skl_desc },
  #endif
  #if IS_ENABLED(CONFIG_SND_SOC_INTEL_APL)
  	/* BXT-P */
  	{ PCI_DEVICE(0x8086, 0x5a98),
-		.driver_data = (unsigned long)&snd_soc_acpi_intel_bxt_machines},
+		.driver_data = (unsigned long)&apl_desc },
  #endif
  #if IS_ENABLED(CONFIG_SND_SOC_INTEL_KBL)
  	/* KBL */
  	{ PCI_DEVICE(0x8086, 0x9D71),
-		.driver_data = (unsigned long)&snd_soc_acpi_intel_kbl_machines},
+		.driver_data = (unsigned long)&kbl_desc },
  #endif
  #if IS_ENABLED(CONFIG_SND_SOC_INTEL_GLK)
  	/* GLK */
  	{ PCI_DEVICE(0x8086, 0x3198),
-		.driver_data = (unsigned long)&snd_soc_acpi_intel_glk_machines},
+		.driver_data = (unsigned long)&glk_desc },
  #endif
  #if IS_ENABLED(CONFIG_SND_SOC_INTEL_CNL)
  	/* CNL */
  	{ PCI_DEVICE(0x8086, 0x9dc8),
-		.driver_data = (unsigned long)&snd_soc_acpi_intel_cnl_machines},
+		.driver_data = (unsigned long)&cnl_desc },
  #endif
  #if IS_ENABLED(CONFIG_SND_SOC_INTEL_CFL)
  	/* CFL */
  	{ PCI_DEVICE(0x8086, 0xa348),
-		.driver_data = (unsigned long)&snd_soc_acpi_intel_cnl_machines},
+		.driver_data = (unsigned long)&cnl_desc },
  #endif
  #if IS_ENABLED(CONFIG_SND_SOC_INTEL_CML_LP)
  	/* CML-LP */
  	{ PCI_DEVICE(0x8086, 0x02c8),
-		.driver_data = (unsigned long)&snd_soc_acpi_intel_cnl_machines},
+		.driver_data = (unsigned long)&cnl_desc },
  #endif
  #if IS_ENABLED(CONFIG_SND_SOC_INTEL_CML_H)
  	/* CML-H */
  	{ PCI_DEVICE(0x8086, 0x06c8),
-		.driver_data = (unsigned long)&snd_soc_acpi_intel_cnl_machines},
+		.driver_data = (unsigned long)&cnl_desc },
  #endif
  	{ 0, }
  };
author maintainer
#67 lore raw

PATCH 29/35 ASoC: Intel: Skylake: Flip SST initialization order

In reply to Cezary Rojewski

To this date Skylake SST were following ill flow of initialization by bypassing sst_dsp_new -> sst_ops::init order. Fix that by flipping invocation order of handlers engaged in Skylake initialization.

---
 sound/soc/intel/skylake/bxt-sst.c      | 15 ++++-----------
 sound/soc/intel/skylake/cnl-sst-dsp.h  |  2 +-
 sound/soc/intel/skylake/cnl-sst.c      | 15 ++++-----------
 sound/soc/intel/skylake/skl-messages.c |  4 ++--
 sound/soc/intel/skylake/skl-sst-dsp.h  |  4 ++--
 sound/soc/intel/skylake/skl-sst.c      | 15 ++++-----------
 sound/soc/intel/skylake/skl.c          |  2 +-
 sound/soc/intel/skylake/skl.h          |  4 ++--
 8 files changed, 20 insertions(+), 41 deletions(-)
sound/soc/intel/skylake/bxt-sst.c +4 -11
index 06da822790a5..286da9fbc4de 100644
@@ -538,24 +538,17 @@ struct sst_ops apl_sst_ops = {
 	.read = sst_shim32_read,
 	.ram_read = sst_memcpy_fromio_32,
 	.ram_write = sst_memcpy_toio_32,
+	.init = bxt_sst_dsp_init,
 	.free = skl_dsp_free,
 };
 
-static struct sst_pdata skl_dev = {
-	.ops = &apl_sst_ops,
-};
-
-int bxt_sst_dsp_init(struct skl_dev *skl, const char *fw_name)
+int bxt_sst_dsp_init(struct sst_dsp *sst, struct sst_pdata *pdata)
 {
-	struct sst_dsp *sst;
+	struct skl_dev *skl = sst->thread_context;
 	void __iomem *mmio;
 	int ret;
 
-	ret = skl_sst_ctx_init(skl, fw_name, &skl_dev);
-	if (ret)
-		return ret;
-
-	sst = skl->dsp;
+	skl->dsp = sst;
 	sst->fw_ops = bxt_fw_ops;
 	mmio = pci_ioremap_bar(skl->pci, 4);
 	if (!mmio)
sound/soc/intel/skylake/cnl-sst-dsp.h +1 -1
index 02e070fae2ce..7810ae11954a 100644
@@ -87,6 +87,6 @@ void cnl_ipc_op_int_enable(struct sst_dsp *ctx);
 void cnl_ipc_op_int_disable(struct sst_dsp *ctx);
 bool cnl_ipc_int_status(struct sst_dsp *ctx);
 
-int cnl_sst_dsp_init(struct skl_dev *skl, const char *fw_name);
+int cnl_sst_dsp_init(struct sst_dsp *sst, struct sst_pdata *pdata);
 
 #endif /*__CNL_SST_DSP_H__*/
sound/soc/intel/skylake/cnl-sst.c +4 -11
index c4dbf6655097..a6113d8afcbb 100644
@@ -415,24 +415,17 @@ struct sst_ops cnl_sst_ops = {
 	.read = sst_shim32_read,
 	.ram_read = sst_memcpy_fromio_32,
 	.ram_write = sst_memcpy_toio_32,
+	.init = cnl_sst_dsp_init,
 	.free = cnl_dsp_free,
 };
 
-static struct sst_pdata cnl_dev = {
-	.ops = &cnl_sst_ops,
-};
-
-int cnl_sst_dsp_init(struct skl_dev *cnl, const char *fw_name)
+int cnl_sst_dsp_init(struct sst_dsp *sst, struct sst_pdata *pdata)
 {
-	struct sst_dsp *sst;
+	struct skl_dev *cnl = sst->thread_context;
 	void __iomem *mmio;
 	int ret;
 
-	ret = skl_sst_ctx_init(cnl, fw_name, &cnl_dev);
-	if (ret < 0)
-		return ret;
-
-	sst = cnl->dsp;
+	cnl->dsp = sst;
 	sst->fw_ops = cnl_fw_ops;
 	mmio = pci_ioremap_bar(cnl->pci, 4);
 	if (!mmio)
sound/soc/intel/skylake/skl-messages.c +2 -2
index 8c352255ff45..372c5fb83ddb 100644
@@ -187,7 +187,7 @@ const struct skl_dsp_ops *skl_get_dsp_ops(int pci_id)
 	return NULL;
 }
 
-int skl_init_dsp(struct skl_dev *skl)
+int skl_init_dsp(struct skl_dev *skl, struct sst_pdata *pdata)
 {
 	struct hdac_bus *bus = skl_to_bus(skl);
 	const struct skl_dsp_ops *ops;
@@ -201,7 +201,7 @@ int skl_init_dsp(struct skl_dev *skl)
 	if (!ops)
 		return -EIO;
 
-	ret = ops->init(skl, skl->fw_name);
+	ret = skl_sst_ctx_init(skl, skl->fw_name, pdata);
 	if (ret < 0)
 		return ret;
 
sound/soc/intel/skylake/skl-sst-dsp.h +2 -2
index b647e60d7a6d..8483c60f29ba 100644
@@ -206,8 +206,8 @@ int skl_dsp_get_core(struct sst_dsp *ctx, unsigned int core_id);
 int skl_dsp_put_core(struct sst_dsp *ctx, unsigned int core_id);
 
 int skl_dsp_boot(struct sst_dsp *ctx);
-int skl_sst_dsp_init(struct skl_dev *skl, const char *fw_name);
-int bxt_sst_dsp_init(struct skl_dev *skl, const char *fw_name);
+int skl_sst_dsp_init(struct sst_dsp *sst, struct sst_pdata *pdata);
+int bxt_sst_dsp_init(struct sst_dsp *sst, struct sst_pdata *pdata);
 int bxt_load_library(struct sst_dsp *ctx, struct skl_lib_info *linfo,
 		int lib_count);
 
sound/soc/intel/skylake/skl-sst.c +4 -11
index 122c07290440..e0f2bf828541 100644
@@ -509,24 +509,17 @@ struct sst_ops skl_sst_ops = {
 	.read = sst_shim32_read,
 	.ram_read = sst_memcpy_fromio_32,
 	.ram_write = sst_memcpy_toio_32,
+	.init = skl_sst_dsp_init,
 	.free = skl_dsp_free,
 };
 
-static struct sst_pdata skl_dev = {
-	.ops = &skl_sst_ops,
-};
-
-int skl_sst_dsp_init(struct skl_dev *skl, const char *fw_name)
+int skl_sst_dsp_init(struct sst_dsp *sst, struct sst_pdata *pdata)
 {
-	struct sst_dsp *sst;
+	struct skl_dev *skl = sst->thread_context;
 	void __iomem *mmio;
 	int ret;
 
-	ret = skl_sst_ctx_init(skl, fw_name, &skl_dev);
-	if (ret < 0)
-		return ret;
-
-	sst = skl->dsp;
+	skl->dsp = sst;
 	sst->fw_ops = skl_fw_ops;
 	mmio = pci_ioremap_bar(skl->pci, 4);
 	if (!mmio)
sound/soc/intel/skylake/skl.c +1 -1
index 53a6befd5d68..39442c80a179 100644
@@ -1072,7 +1072,7 @@ static int skl_probe(struct pci_dev *pci,
 		goto out_nhlt_free;
 	}
 
-	err = skl_init_dsp(skl);
+	err = skl_init_dsp(skl, desc);
 	if (err < 0) {
 		dev_dbg(bus->dev, "error failed to register dsp\n");
 		goto out_nhlt_free;
sound/soc/intel/skylake/skl.h +2 -2
index 2f2b5a141abf..f4cd5ccc1ff9 100644
@@ -159,7 +159,7 @@ struct skl_machine_pdata {
 
 struct skl_dsp_ops {
 	int id;
-	int (*init)(struct skl_dev *skl, const char *fw_name);
+	int (*init)(struct sst_dsp *dsp, struct sst_pdata *pdata);
 };
 
 int skl_platform_unregister(struct device *dev);
@@ -170,7 +170,7 @@ struct nhlt_specific_cfg *skl_get_ep_blob(struct skl_dev *skl, u32 instance,
 					u32 s_rate, u8 dirn, u8 dev_type);
 
 int skl_nhlt_update_topology_bin(struct skl_dev *skl);
-int skl_init_dsp(struct skl_dev *skl);
+int skl_init_dsp(struct skl_dev *skl, struct sst_pdata *pdata);
 int skl_free_dsp(struct skl_dev *skl);
 int skl_sst_init_fw(struct skl_dev *skl);
 void skl_sst_dsp_cleanup(struct skl_dev *skl);
Signature · 1 line
2.17.1
#68 lore raw

Re: [PATCH 29/35] ASoC: Intel: Skylake: Flip SST initialization order

Quoted 1 line · Cezary Rojewski

To this date Skylake SST were following ill flow of initialization by

'ill' as in 'sick'? that's probably a bit strong and judgmental? or is this a typo?

Quoted 199 lines

bypassing sst_dsp_new -> sst_ops::init order. Fix that by flipping invocation order of handlers engaged in Skylake initialization.

---
  sound/soc/intel/skylake/bxt-sst.c      | 15 ++++-----------
  sound/soc/intel/skylake/cnl-sst-dsp.h  |  2 +-
  sound/soc/intel/skylake/cnl-sst.c      | 15 ++++-----------
  sound/soc/intel/skylake/skl-messages.c |  4 ++--
  sound/soc/intel/skylake/skl-sst-dsp.h  |  4 ++--
  sound/soc/intel/skylake/skl-sst.c      | 15 ++++-----------
  sound/soc/intel/skylake/skl.c          |  2 +-
  sound/soc/intel/skylake/skl.h          |  4 ++--
  8 files changed, 20 insertions(+), 41 deletions(-)
sound/soc/intel/skylake/bxt-sst.c +4 -11
index 06da822790a5..286da9fbc4de 100644
@@ -538,24 +538,17 @@ struct sst_ops apl_sst_ops = {
  	.read = sst_shim32_read,
  	.ram_read = sst_memcpy_fromio_32,
  	.ram_write = sst_memcpy_toio_32,
+	.init = bxt_sst_dsp_init,
  	.free = skl_dsp_free,
  };
 
-static struct sst_pdata skl_dev = {
-	.ops = &apl_sst_ops,
-};
-
-int bxt_sst_dsp_init(struct skl_dev *skl, const char *fw_name)
+int bxt_sst_dsp_init(struct sst_dsp *sst, struct sst_pdata *pdata)
  {
-	struct sst_dsp *sst;
+	struct skl_dev *skl = sst->thread_context;
  	void __iomem *mmio;
  	int ret;
 
-	ret = skl_sst_ctx_init(skl, fw_name, &skl_dev);
-	if (ret)
-		return ret;
-
-	sst = skl->dsp;
+	skl->dsp = sst;
  	sst->fw_ops = bxt_fw_ops;
  	mmio = pci_ioremap_bar(skl->pci, 4);
  	if (!mmio)
sound/soc/intel/skylake/cnl-sst-dsp.h +1 -1
index 02e070fae2ce..7810ae11954a 100644
@@ -87,6 +87,6 @@ void cnl_ipc_op_int_enable(struct sst_dsp *ctx);
  void cnl_ipc_op_int_disable(struct sst_dsp *ctx);
  bool cnl_ipc_int_status(struct sst_dsp *ctx);
 
-int cnl_sst_dsp_init(struct skl_dev *skl, const char *fw_name);
+int cnl_sst_dsp_init(struct sst_dsp *sst, struct sst_pdata *pdata);
 
  #endif /*__CNL_SST_DSP_H__*/
sound/soc/intel/skylake/cnl-sst.c +4 -11
index c4dbf6655097..a6113d8afcbb 100644
@@ -415,24 +415,17 @@ struct sst_ops cnl_sst_ops = {
  	.read = sst_shim32_read,
  	.ram_read = sst_memcpy_fromio_32,
  	.ram_write = sst_memcpy_toio_32,
+	.init = cnl_sst_dsp_init,
  	.free = cnl_dsp_free,
  };
 
-static struct sst_pdata cnl_dev = {
-	.ops = &cnl_sst_ops,
-};
-
-int cnl_sst_dsp_init(struct skl_dev *cnl, const char *fw_name)
+int cnl_sst_dsp_init(struct sst_dsp *sst, struct sst_pdata *pdata)
  {
-	struct sst_dsp *sst;
+	struct skl_dev *cnl = sst->thread_context;
  	void __iomem *mmio;
  	int ret;
 
-	ret = skl_sst_ctx_init(cnl, fw_name, &cnl_dev);
-	if (ret < 0)
-		return ret;
-
-	sst = cnl->dsp;
+	cnl->dsp = sst;
  	sst->fw_ops = cnl_fw_ops;
  	mmio = pci_ioremap_bar(cnl->pci, 4);
  	if (!mmio)
sound/soc/intel/skylake/skl-messages.c +2 -2
index 8c352255ff45..372c5fb83ddb 100644
@@ -187,7 +187,7 @@ const struct skl_dsp_ops *skl_get_dsp_ops(int pci_id)
  	return NULL;
  }
 
-int skl_init_dsp(struct skl_dev *skl)
+int skl_init_dsp(struct skl_dev *skl, struct sst_pdata *pdata)
  {
  	struct hdac_bus *bus = skl_to_bus(skl);
  	const struct skl_dsp_ops *ops;
@@ -201,7 +201,7 @@ int skl_init_dsp(struct skl_dev *skl)
  	if (!ops)
  		return -EIO;
 
-	ret = ops->init(skl, skl->fw_name);
+	ret = skl_sst_ctx_init(skl, skl->fw_name, pdata);
  	if (ret < 0)
  		return ret;
 
sound/soc/intel/skylake/skl-sst-dsp.h +2 -2
index b647e60d7a6d..8483c60f29ba 100644
@@ -206,8 +206,8 @@ int skl_dsp_get_core(struct sst_dsp *ctx, unsigned int core_id);
  int skl_dsp_put_core(struct sst_dsp *ctx, unsigned int core_id);
 
  int skl_dsp_boot(struct sst_dsp *ctx);
-int skl_sst_dsp_init(struct skl_dev *skl, const char *fw_name);
-int bxt_sst_dsp_init(struct skl_dev *skl, const char *fw_name);
+int skl_sst_dsp_init(struct sst_dsp *sst, struct sst_pdata *pdata);
+int bxt_sst_dsp_init(struct sst_dsp *sst, struct sst_pdata *pdata);
  int bxt_load_library(struct sst_dsp *ctx, struct skl_lib_info *linfo,
  		int lib_count);
 
sound/soc/intel/skylake/skl-sst.c +4 -11
index 122c07290440..e0f2bf828541 100644
@@ -509,24 +509,17 @@ struct sst_ops skl_sst_ops = {
  	.read = sst_shim32_read,
  	.ram_read = sst_memcpy_fromio_32,
  	.ram_write = sst_memcpy_toio_32,
+	.init = skl_sst_dsp_init,
  	.free = skl_dsp_free,
  };
 
-static struct sst_pdata skl_dev = {
-	.ops = &skl_sst_ops,
-};
-
-int skl_sst_dsp_init(struct skl_dev *skl, const char *fw_name)
+int skl_sst_dsp_init(struct sst_dsp *sst, struct sst_pdata *pdata)
  {
-	struct sst_dsp *sst;
+	struct skl_dev *skl = sst->thread_context;
  	void __iomem *mmio;
  	int ret;
 
-	ret = skl_sst_ctx_init(skl, fw_name, &skl_dev);
-	if (ret < 0)
-		return ret;
-
-	sst = skl->dsp;
+	skl->dsp = sst;
  	sst->fw_ops = skl_fw_ops;
  	mmio = pci_ioremap_bar(skl->pci, 4);
  	if (!mmio)
sound/soc/intel/skylake/skl.c +1 -1
index 53a6befd5d68..39442c80a179 100644
@@ -1072,7 +1072,7 @@ static int skl_probe(struct pci_dev *pci,
  		goto out_nhlt_free;
  	}
 
-	err = skl_init_dsp(skl);
+	err = skl_init_dsp(skl, desc);
  	if (err < 0) {
  		dev_dbg(bus->dev, "error failed to register dsp\n");
  		goto out_nhlt_free;
sound/soc/intel/skylake/skl.h +2 -2
index 2f2b5a141abf..f4cd5ccc1ff9 100644
@@ -159,7 +159,7 @@ struct skl_machine_pdata {
 
  struct skl_dsp_ops {
  	int id;
-	int (*init)(struct skl_dev *skl, const char *fw_name);
+	int (*init)(struct sst_dsp *dsp, struct sst_pdata *pdata);
  };
 
  int skl_platform_unregister(struct device *dev);
@@ -170,7 +170,7 @@ struct nhlt_specific_cfg *skl_get_ep_blob(struct skl_dev *skl, u32 instance,
  					u32 s_rate, u8 dirn, u8 dev_type);
 
  int skl_nhlt_update_topology_bin(struct skl_dev *skl);
-int skl_init_dsp(struct skl_dev *skl);
+int skl_init_dsp(struct skl_dev *skl, struct sst_pdata *pdata);
  int skl_free_dsp(struct skl_dev *skl);
  int skl_sst_init_fw(struct skl_dev *skl);
  void skl_sst_dsp_cleanup(struct skl_dev *skl);
author maintainer
#69 lore raw

Re: [PATCH 29/35] ASoC: Intel: Skylake: Flip SST initialization order

Quoted 8 lines · Pierre-Louis Bossart
Quoted 1 line · Cezary Rojewski

To this date Skylake SST were following ill flow of initialization by

'ill' as in 'sick'? that's probably a bit strong and judgmental? or is this a typo?

ill seems like a perfect opposite of healthy, ain't it? Because certainly, the initialization pattern observed in /skylake is everything but healthy.

Quoted 176 lines
Quoted 176 lines

bypassing sst_dsp_new -> sst_ops::init order. Fix that by flipping invocation order of handlers engaged in Skylake initialization.

---
  sound/soc/intel/skylake/bxt-sst.c      | 15 ++++----------- sound/soc/intel/skylake/cnl-sst-dsp.h  |  2 +- sound/soc/intel/skylake/cnl-sst.c      | 15 ++++----------- sound/soc/intel/skylake/skl-messages.c |  4 ++-- sound/soc/intel/skylake/skl-sst-dsp.h  |  4 ++-- sound/soc/intel/skylake/skl-sst.c      | 15 ++++----------- sound/soc/intel/skylake/skl.c          |  2 +- sound/soc/intel/skylake/skl.h          |  4 ++--

  8 files changed, 20 insertions(+), 41 deletions(-)
sound/soc/intel/skylake/bxt-sst.c +4 -11
index 06da822790a5..286da9fbc4de 100644
@@ -538,24 +538,17 @@ struct sst_ops apl_sst_ops = {
       .read = sst_shim32_read,
       .ram_read = sst_memcpy_fromio_32,
       .ram_write = sst_memcpy_toio_32,
+    .init = bxt_sst_dsp_init,
       .free = skl_dsp_free,
   };
-static struct sst_pdata skl_dev = {
-    .ops = &apl_sst_ops,
-};
-
-int bxt_sst_dsp_init(struct skl_dev *skl, const char *fw_name)
+int bxt_sst_dsp_init(struct sst_dsp *sst, struct sst_pdata *pdata)
   {
-    struct sst_dsp *sst;
+    struct skl_dev *skl = sst->thread_context;
       void __iomem *mmio;
       int ret;
-    ret = skl_sst_ctx_init(skl, fw_name, &skl_dev);
-    if (ret)
-        return ret;
-
-    sst = skl->dsp;
+    skl->dsp = sst;
       sst->fw_ops = bxt_fw_ops;
       mmio = pci_ioremap_bar(skl->pci, 4);
       if (!mmio)
sound/soc/intel/skylake/cnl-sst-dsp.h +1 -1
index 02e070fae2ce..7810ae11954a 100644
@@ -87,6 +87,6 @@ void cnl_ipc_op_int_enable(struct sst_dsp *ctx);
   void cnl_ipc_op_int_disable(struct sst_dsp *ctx);
   bool cnl_ipc_int_status(struct sst_dsp *ctx);
-int cnl_sst_dsp_init(struct skl_dev *skl, const char *fw_name);
+int cnl_sst_dsp_init(struct sst_dsp *sst, struct sst_pdata *pdata);
   #endif /*__CNL_SST_DSP_H__*/
sound/soc/intel/skylake/cnl-sst.c +4 -11
index c4dbf6655097..a6113d8afcbb 100644
@@ -415,24 +415,17 @@ struct sst_ops cnl_sst_ops = {
       .read = sst_shim32_read,
       .ram_read = sst_memcpy_fromio_32,
       .ram_write = sst_memcpy_toio_32,
+    .init = cnl_sst_dsp_init,
       .free = cnl_dsp_free,
   };
-static struct sst_pdata cnl_dev = {
-    .ops = &cnl_sst_ops,
-};
-
-int cnl_sst_dsp_init(struct skl_dev *cnl, const char *fw_name)
+int cnl_sst_dsp_init(struct sst_dsp *sst, struct sst_pdata *pdata)
   {
-    struct sst_dsp *sst;
+    struct skl_dev *cnl = sst->thread_context;
       void __iomem *mmio;
       int ret;
-    ret = skl_sst_ctx_init(cnl, fw_name, &cnl_dev);
-    if (ret < 0)
-        return ret;
-
-    sst = cnl->dsp;
+    cnl->dsp = sst;
       sst->fw_ops = cnl_fw_ops;
       mmio = pci_ioremap_bar(cnl->pci, 4);
       if (!mmio)
sound/soc/intel/skylake/skl-messages.c +2 -2
index 8c352255ff45..372c5fb83ddb 100644
@@ -187,7 +187,7 @@ const struct skl_dsp_ops *skl_get_dsp_ops(int pci_id)
       return NULL;
   }
-int skl_init_dsp(struct skl_dev *skl)
+int skl_init_dsp(struct skl_dev *skl, struct sst_pdata *pdata)
   {
       struct hdac_bus *bus = skl_to_bus(skl);
       const struct skl_dsp_ops *ops;
@@ -201,7 +201,7 @@ int skl_init_dsp(struct skl_dev *skl)
       if (!ops)
           return -EIO;
-    ret = ops->init(skl, skl->fw_name);
+    ret = skl_sst_ctx_init(skl, skl->fw_name, pdata);
       if (ret < 0)
           return ret;
sound/soc/intel/skylake/skl-sst-dsp.h +2 -2
index b647e60d7a6d..8483c60f29ba 100644
@@ -206,8 +206,8 @@ int skl_dsp_get_core(struct sst_dsp *ctx, unsigned 
 int core_id);
   int skl_dsp_put_core(struct sst_dsp *ctx, unsigned int core_id);
   int skl_dsp_boot(struct sst_dsp *ctx);
-int skl_sst_dsp_init(struct skl_dev *skl, const char *fw_name);
-int bxt_sst_dsp_init(struct skl_dev *skl, const char *fw_name);
+int skl_sst_dsp_init(struct sst_dsp *sst, struct sst_pdata *pdata);
+int bxt_sst_dsp_init(struct sst_dsp *sst, struct sst_pdata *pdata);
   int bxt_load_library(struct sst_dsp *ctx, struct skl_lib_info *linfo,
           int lib_count);
sound/soc/intel/skylake/skl-sst.c +4 -11
index 122c07290440..e0f2bf828541 100644
@@ -509,24 +509,17 @@ struct sst_ops skl_sst_ops = {
       .read = sst_shim32_read,
       .ram_read = sst_memcpy_fromio_32,
       .ram_write = sst_memcpy_toio_32,
+    .init = skl_sst_dsp_init,
       .free = skl_dsp_free,
   };
-static struct sst_pdata skl_dev = {
-    .ops = &skl_sst_ops,
-};
-
-int skl_sst_dsp_init(struct skl_dev *skl, const char *fw_name)
+int skl_sst_dsp_init(struct sst_dsp *sst, struct sst_pdata *pdata)
   {
-    struct sst_dsp *sst;
+    struct skl_dev *skl = sst->thread_context;
       void __iomem *mmio;
       int ret;
-    ret = skl_sst_ctx_init(skl, fw_name, &skl_dev);
-    if (ret < 0)
-        return ret;
-
-    sst = skl->dsp;
+    skl->dsp = sst;
       sst->fw_ops = skl_fw_ops;
       mmio = pci_ioremap_bar(skl->pci, 4);
       if (!mmio)
sound/soc/intel/skylake/skl.c +1 -1
index 53a6befd5d68..39442c80a179 100644
@@ -1072,7 +1072,7 @@ static int skl_probe(struct pci_dev *pci,
           goto out_nhlt_free;
       }
-    err = skl_init_dsp(skl);
+    err = skl_init_dsp(skl, desc);
       if (err < 0) {
           dev_dbg(bus->dev, "error failed to register dsp\n");
           goto out_nhlt_free;
sound/soc/intel/skylake/skl.h +1 -1
index 2f2b5a141abf..f4cd5ccc1ff9 100644
@@ -159,7 +159,7 @@ struct skl_machine_pdata {
   struct skl_dsp_ops {
       int id;
-    int (*init)(struct skl_dev *skl, const char *fw_name);
+    int (*init)(struct sst_dsp *dsp, struct sst_pdata *pdata);
   };
   int skl_platform_unregister(struct device *dev);
@@ -170,7 +170,7 @@ struct nhlt_specific_cfg *skl_get_ep_blob(struct 
 skl_dev *skl, u32 instance,
Quoted 8 lines

sound/soc/intel/skylake/skl.h struct nhlt_specific_cfg *skl_get_ep_blob(struct skl_dev *skl, u32 instance, · line 176

Quoted 8 lines
sound/soc/intel/skylake/skl.h +1 -1
                       u32 s_rate, u8 dirn, u8 dev_type);
   int skl_nhlt_update_topology_bin(struct skl_dev *skl);
-int skl_init_dsp(struct skl_dev *skl);
+int skl_init_dsp(struct skl_dev *skl, struct sst_pdata *pdata);
   int skl_free_dsp(struct skl_dev *skl);
   int skl_sst_init_fw(struct skl_dev *skl);
   void skl_sst_dsp_cleanup(struct skl_dev *skl);

_______________________________________________
Alsa-devel mailing list
[email protected]
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

#70 lore raw

Re: [PATCH 29/35] ASoC: Intel: Skylake: Flip SST initialization order

Quoted 11 lines · Cezary Rojewski
Quoted 8 lines · Pierre-Louis Bossart
Quoted 1 line · Cezary Rojewski

To this date Skylake SST were following ill flow of initialization by

'ill' as in 'sick'? that's probably a bit strong and judgmental? or is this a typo?

ill seems like a perfect opposite of healthy, ain't it? Because certainly, the initialization pattern observed in /skylake is everything but healthy.

I don't know what 'healthy' means either in this context.

s/ill/incorrect/?

Quoted 178 lines
Quoted 178 lines
Quoted 178 lines

bypassing sst_dsp_new -> sst_ops::init order. Fix that by flipping invocation order of handlers engaged in Skylake initialization.

---
  sound/soc/intel/skylake/bxt-sst.c      | 15 ++++----------- sound/soc/intel/skylake/cnl-sst-dsp.h  |  2 +- sound/soc/intel/skylake/cnl-sst.c      | 15 ++++----------- sound/soc/intel/skylake/skl-messages.c |  4 ++-- sound/soc/intel/skylake/skl-sst-dsp.h  |  4 ++-- sound/soc/intel/skylake/skl-sst.c      | 15 ++++----------- sound/soc/intel/skylake/skl.c          |  2 +- sound/soc/intel/skylake/skl.h          |  4 ++--

  8 files changed, 20 insertions(+), 41 deletions(-)
sound/soc/intel/skylake/bxt-sst.c +4 -11
index 06da822790a5..286da9fbc4de 100644
@@ -538,24 +538,17 @@ struct sst_ops apl_sst_ops = {
       .read = sst_shim32_read,
       .ram_read = sst_memcpy_fromio_32,
       .ram_write = sst_memcpy_toio_32,
+    .init = bxt_sst_dsp_init,
       .free = skl_dsp_free,
   };
-static struct sst_pdata skl_dev = {
-    .ops = &apl_sst_ops,
-};
-
-int bxt_sst_dsp_init(struct skl_dev *skl, const char *fw_name)
+int bxt_sst_dsp_init(struct sst_dsp *sst, struct sst_pdata *pdata)
   {
-    struct sst_dsp *sst;
+    struct skl_dev *skl = sst->thread_context;
       void __iomem *mmio;
       int ret;
-    ret = skl_sst_ctx_init(skl, fw_name, &skl_dev);
-    if (ret)
-        return ret;
-
-    sst = skl->dsp;
+    skl->dsp = sst;
       sst->fw_ops = bxt_fw_ops;
       mmio = pci_ioremap_bar(skl->pci, 4);
       if (!mmio)
sound/soc/intel/skylake/cnl-sst-dsp.h +1 -1
index 02e070fae2ce..7810ae11954a 100644
@@ -87,6 +87,6 @@ void cnl_ipc_op_int_enable(struct sst_dsp *ctx);
   void cnl_ipc_op_int_disable(struct sst_dsp *ctx);
   bool cnl_ipc_int_status(struct sst_dsp *ctx);
-int cnl_sst_dsp_init(struct skl_dev *skl, const char *fw_name);
+int cnl_sst_dsp_init(struct sst_dsp *sst, struct sst_pdata *pdata);
   #endif /*__CNL_SST_DSP_H__*/
sound/soc/intel/skylake/cnl-sst.c +4 -11
index c4dbf6655097..a6113d8afcbb 100644
@@ -415,24 +415,17 @@ struct sst_ops cnl_sst_ops = {
       .read = sst_shim32_read,
       .ram_read = sst_memcpy_fromio_32,
       .ram_write = sst_memcpy_toio_32,
+    .init = cnl_sst_dsp_init,
       .free = cnl_dsp_free,
   };
-static struct sst_pdata cnl_dev = {
-    .ops = &cnl_sst_ops,
-};
-
-int cnl_sst_dsp_init(struct skl_dev *cnl, const char *fw_name)
+int cnl_sst_dsp_init(struct sst_dsp *sst, struct sst_pdata *pdata)
   {
-    struct sst_dsp *sst;
+    struct skl_dev *cnl = sst->thread_context;
       void __iomem *mmio;
       int ret;
-    ret = skl_sst_ctx_init(cnl, fw_name, &cnl_dev);
-    if (ret < 0)
-        return ret;
-
-    sst = cnl->dsp;
+    cnl->dsp = sst;
       sst->fw_ops = cnl_fw_ops;
       mmio = pci_ioremap_bar(cnl->pci, 4);
       if (!mmio)
sound/soc/intel/skylake/skl-messages.c +2 -2
index 8c352255ff45..372c5fb83ddb 100644
@@ -187,7 +187,7 @@ const struct skl_dsp_ops *skl_get_dsp_ops(int 
 pci_id)
       return NULL;
   }
-int skl_init_dsp(struct skl_dev *skl)
+int skl_init_dsp(struct skl_dev *skl, struct sst_pdata *pdata)
   {
       struct hdac_bus *bus = skl_to_bus(skl);
       const struct skl_dsp_ops *ops;
@@ -201,7 +201,7 @@ int skl_init_dsp(struct skl_dev *skl)
       if (!ops)
           return -EIO;
-    ret = ops->init(skl, skl->fw_name);
+    ret = skl_sst_ctx_init(skl, skl->fw_name, pdata);
       if (ret < 0)
           return ret;
sound/soc/intel/skylake/skl-sst-dsp.h +2 -2
index b647e60d7a6d..8483c60f29ba 100644
@@ -206,8 +206,8 @@ int skl_dsp_get_core(struct sst_dsp *ctx, 
 unsigned int core_id);
   int skl_dsp_put_core(struct sst_dsp *ctx, unsigned int core_id);
   int skl_dsp_boot(struct sst_dsp *ctx);
-int skl_sst_dsp_init(struct skl_dev *skl, const char *fw_name);
-int bxt_sst_dsp_init(struct skl_dev *skl, const char *fw_name);
+int skl_sst_dsp_init(struct sst_dsp *sst, struct sst_pdata *pdata);
+int bxt_sst_dsp_init(struct sst_dsp *sst, struct sst_pdata *pdata);
   int bxt_load_library(struct sst_dsp *ctx, struct skl_lib_info *linfo,
           int lib_count);
sound/soc/intel/skylake/skl-sst.c +4 -11
index 122c07290440..e0f2bf828541 100644
@@ -509,24 +509,17 @@ struct sst_ops skl_sst_ops = {
       .read = sst_shim32_read,
       .ram_read = sst_memcpy_fromio_32,
       .ram_write = sst_memcpy_toio_32,
+    .init = skl_sst_dsp_init,
       .free = skl_dsp_free,
   };
-static struct sst_pdata skl_dev = {
-    .ops = &skl_sst_ops,
-};
-
-int skl_sst_dsp_init(struct skl_dev *skl, const char *fw_name)
+int skl_sst_dsp_init(struct sst_dsp *sst, struct sst_pdata *pdata)
   {
-    struct sst_dsp *sst;
+    struct skl_dev *skl = sst->thread_context;
       void __iomem *mmio;
       int ret;
-    ret = skl_sst_ctx_init(skl, fw_name, &skl_dev);
-    if (ret < 0)
-        return ret;
-
-    sst = skl->dsp;
+    skl->dsp = sst;
       sst->fw_ops = skl_fw_ops;
       mmio = pci_ioremap_bar(skl->pci, 4);
       if (!mmio)
sound/soc/intel/skylake/skl.c +1 -1
index 53a6befd5d68..39442c80a179 100644
@@ -1072,7 +1072,7 @@ static int skl_probe(struct pci_dev *pci,
           goto out_nhlt_free;
       }
-    err = skl_init_dsp(skl);
+    err = skl_init_dsp(skl, desc);
       if (err < 0) {
           dev_dbg(bus->dev, "error failed to register dsp\n");
           goto out_nhlt_free;
sound/soc/intel/skylake/skl.h +1 -1
index 2f2b5a141abf..f4cd5ccc1ff9 100644
@@ -159,7 +159,7 @@ struct skl_machine_pdata {
   struct skl_dsp_ops {
       int id;
-    int (*init)(struct skl_dev *skl, const char *fw_name);
+    int (*init)(struct sst_dsp *dsp, struct sst_pdata *pdata);
   };
   int skl_platform_unregister(struct device *dev);
@@ -170,7 +170,7 @@ struct nhlt_specific_cfg *skl_get_ep_blob(struct 
 skl_dev *skl, u32 instance,
Quoted 8 lines
Quoted 8 lines

sound/soc/intel/skylake/skl.h struct nhlt_specific_cfg *skl_get_ep_blob(struct skl_dev *skl, u32 instance, · line 176

Quoted 8 lines
sound/soc/intel/skylake/skl.h +1 -1
                       u32 s_rate, u8 dirn, u8 dev_type);
   int skl_nhlt_update_topology_bin(struct skl_dev *skl);
-int skl_init_dsp(struct skl_dev *skl);
+int skl_init_dsp(struct skl_dev *skl, struct sst_pdata *pdata);
   int skl_free_dsp(struct skl_dev *skl);
   int skl_sst_init_fw(struct skl_dev *skl);
   void skl_sst_dsp_cleanup(struct skl_dev *skl);

_______________________________________________
Alsa-devel mailing list
[email protected]
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

author maintainer
#71 lore raw

Re: [PATCH 29/35] ASoC: Intel: Skylake: Flip SST initialization order

Quoted 13 lines · Pierre-Louis Bossart
Quoted 10 lines · Cezary Rojewski
Quoted 8 lines · Pierre-Louis Bossart
Quoted 1 line · Cezary Rojewski

To this date Skylake SST were following ill flow of initialization by

'ill' as in 'sick'? that's probably a bit strong and judgmental? or is this a typo?

Quoted 6 lines
Quoted 1 line

ill seems like a perfect opposite of healthy, ain't it? Because certainly, the initialization pattern observed in /skylake is everything but healthy.

I don't know what 'healthy' means either in this context.

s/ill/incorrect/?

In essence, most of what is required is actually done even in existing /skylake init. How it is done leaves a lot to be desired, though. Initialization is cleaned up to improve code quality and make it look cohesive - removal of duplications, usage of sst-framework functions and so on.

Followup segments - including but not limited to power-management - touch this stuff quite a bit. With initialization updated, each power-management patch fixes single spot rather than 3 (skl-sst, bxt-sst, cnl-sst). Should probe more readable and easy to review.

That's why I described it via 'ill'.
Although I do agree, could have chosen a better description.

author maintainer
#72 lore raw

PATCH 30/35 ASoC: Intel: Reuse sst_pdata::fw_name field

In reply to Cezary Rojewski

struct sst_pdata is equipped with fw_name field - a platform specific filename for basefw module. Usage of such allows for suther simplification of declaration of handlers directly involved with Skylake initialization procedure.

This change invalidates mach::fw_filename field and skl::fw_name.

---
 sound/soc/intel/common/sst-acpi.c       | 5 ++---
 sound/soc/intel/common/sst-firmware.c   | 1 +
 sound/soc/intel/skylake/skl-messages.c  | 2 +-
 sound/soc/intel/skylake/skl-sst-dsp.h   | 3 +--
 sound/soc/intel/skylake/skl-sst-utils.c | 4 +---
 sound/soc/intel/skylake/skl.c           | 4 ----
 6 files changed, 6 insertions(+), 13 deletions(-)
sound/soc/intel/common/sst-acpi.c +2 -3
index 53ac23f05966..15f2b27e643f 100644
@@ -28,11 +28,10 @@ static void sst_acpi_fw_cb(const struct firmware *fw, void *context)
 	struct sst_acpi_priv *sst_acpi = platform_get_drvdata(pdev);
 	struct sst_acpi_desc *desc = sst_acpi->desc;
 	struct sst_pdata *sst_pdata = desc->pdata;
-	struct snd_soc_acpi_mach *mach = sst_acpi->mach;
 
 	sst_pdata->fw = fw;
 	if (!fw) {
-		dev_err(dev, "Cannot load firmware %s\n", mach->fw_filename);
+		dev_err(dev, "Cannot load firmware %s\n", sst_pdata->fw_name);
 		return;
 	}
 
@@ -119,7 +118,7 @@ int sst_acpi_probe(struct platform_device *pdev)
 		return PTR_ERR(sst_acpi->pdev_mach);
 
 	/* continue SST probing after firmware is loaded */
-	ret = request_firmware_nowait(THIS_MODULE, true, mach->fw_filename,
+	ret = request_firmware_nowait(THIS_MODULE, true, sst_pdata->fw_name,
 				      dev, GFP_KERNEL, pdev, sst_acpi_fw_cb);
 	if (ret)
 		platform_device_unregister(sst_acpi->pdev_mach);
sound/soc/intel/common/sst-firmware.c +1 -0
index 61d3e6e46b98..cc88849eb10f 100644
@@ -1218,6 +1218,7 @@ struct sst_dsp *sst_dsp_new(struct device *dev, struct sst_pdata *pdata)
 	sst->thread_context = pdata->dsp;
 	sst->id = pdata->id;
 	sst->irq = pdata->irq;
+	sst->fw_name = pdata->fw_name;
 	sst->ops = pdata->ops;
 	sst->pdata = pdata;
 	INIT_LIST_HEAD(&sst->used_block_list);
sound/soc/intel/skylake/skl-messages.c +1 -1
index 372c5fb83ddb..e401edd8d44b 100644
@@ -201,7 +201,7 @@ int skl_init_dsp(struct skl_dev *skl, struct sst_pdata *pdata)
 	if (!ops)
 		return -EIO;
 
-	ret = skl_sst_ctx_init(skl, skl->fw_name, pdata);
+	ret = skl_sst_ctx_init(skl, pdata);
 	if (ret < 0)
 		return ret;
 
sound/soc/intel/skylake/skl-sst-dsp.h +1 -2
index 8483c60f29ba..a3714b706b8e 100644
@@ -223,8 +223,7 @@ int skl_dsp_strip_extended_manifest(struct firmware *fw);
 
 void skl_dsp_set_astate_cfg(struct skl_dev *skl, u32 cnt, void *data);
 
-int skl_sst_ctx_init(struct skl_dev *skl, const char *fw_name,
-		struct sst_pdata *pdata);
+int skl_sst_ctx_init(struct skl_dev *skl, struct sst_pdata *pdata);
 int skl_prepare_lib_load(struct skl_dev *skl, struct skl_lib_info *linfo,
 			struct firmware *stripped_fw,
 			unsigned int hdr_offset, int index);
sound/soc/intel/skylake/skl-sst-utils.c +1 -3
index a4ad213d34e0..ea5419012312 100644
@@ -354,8 +354,7 @@ int skl_dsp_strip_extended_manifest(struct firmware *fw)
 	return 0;
 }
 
-int skl_sst_ctx_init(struct skl_dev *skl, const char *fw_name,
-	struct sst_pdata *pdata)
+int skl_sst_ctx_init(struct skl_dev *skl, struct sst_pdata *pdata)
 {
 	struct sst_dsp *sst;
 	struct device *dev = skl->dev;
@@ -372,7 +371,6 @@ int skl_sst_ctx_init(struct skl_dev *skl, const char *fw_name,
 	}
 
 	skl->dsp = sst;
-	sst->fw_name = fw_name;
 	init_waitqueue_head(&skl->mod_load_wait);
 	skl->is_first_boot = true;
 
sound/soc/intel/skylake/skl.c +0 -4
index 39442c80a179..3225f4f8793e 100644
@@ -491,9 +491,6 @@ static struct snd_soc_acpi_mach *skl_find_hda_machine(struct skl_dev *skl,
 	/* point to common table */
 	mach = snd_soc_acpi_intel_hda_machines;
 
-	/* all entries in the machine table use the same firmware */
-	mach->fw_filename = machines->fw_filename;
-
 	return mach;
 }
 
@@ -514,7 +511,6 @@ static int skl_find_machine(struct skl_dev *skl, void *driver_data)
 	}
 
 	skl->mach = mach;
-	skl->fw_name = mach->fw_filename;
 	pdata = mach->pdata;
 
 	if (pdata) {
Signature · 1 line
2.17.1
#73 lore raw

Re: [PATCH 30/35] ASoC: Intel: Reuse sst_pdata::fw_name field

Quoted 6 lines · Cezary Rojewski

struct sst_pdata is equipped with fw_name field - a platform specific filename for basefw module. Usage of such allows for suther simplification of declaration of handlers directly involved with Skylake initialization procedure.

This change invalidates mach::fw_filename field and skl::fw_name.

Again bad move. While in theory it's true that a single firmware is all you need, you do want to keep the ability to quirk firmware names for specific cases. We've been there before, don't remove this capability please.

Quoted 121 lines
---
  sound/soc/intel/common/sst-acpi.c       | 5 ++---
  sound/soc/intel/common/sst-firmware.c   | 1 +
  sound/soc/intel/skylake/skl-messages.c  | 2 +-
  sound/soc/intel/skylake/skl-sst-dsp.h   | 3 +--
  sound/soc/intel/skylake/skl-sst-utils.c | 4 +---
  sound/soc/intel/skylake/skl.c           | 4 ----
  6 files changed, 6 insertions(+), 13 deletions(-)
sound/soc/intel/common/sst-acpi.c +2 -3
index 53ac23f05966..15f2b27e643f 100644
@@ -28,11 +28,10 @@ static void sst_acpi_fw_cb(const struct firmware *fw, void *context)
  	struct sst_acpi_priv *sst_acpi = platform_get_drvdata(pdev);
  	struct sst_acpi_desc *desc = sst_acpi->desc;
  	struct sst_pdata *sst_pdata = desc->pdata;
-	struct snd_soc_acpi_mach *mach = sst_acpi->mach;
 
  	sst_pdata->fw = fw;
  	if (!fw) {
-		dev_err(dev, "Cannot load firmware %s\n", mach->fw_filename);
+		dev_err(dev, "Cannot load firmware %s\n", sst_pdata->fw_name);
  		return;
  	}
 
@@ -119,7 +118,7 @@ int sst_acpi_probe(struct platform_device *pdev)
  		return PTR_ERR(sst_acpi->pdev_mach);
 
  	/* continue SST probing after firmware is loaded */
-	ret = request_firmware_nowait(THIS_MODULE, true, mach->fw_filename,
+	ret = request_firmware_nowait(THIS_MODULE, true, sst_pdata->fw_name,
  				      dev, GFP_KERNEL, pdev, sst_acpi_fw_cb);
  	if (ret)
  		platform_device_unregister(sst_acpi->pdev_mach);
sound/soc/intel/common/sst-firmware.c +1 -0
index 61d3e6e46b98..cc88849eb10f 100644
@@ -1218,6 +1218,7 @@ struct sst_dsp *sst_dsp_new(struct device *dev, struct sst_pdata *pdata)
  	sst->thread_context = pdata->dsp;
  	sst->id = pdata->id;
  	sst->irq = pdata->irq;
+	sst->fw_name = pdata->fw_name;
  	sst->ops = pdata->ops;
  	sst->pdata = pdata;
  	INIT_LIST_HEAD(&sst->used_block_list);
sound/soc/intel/skylake/skl-messages.c +1 -1
index 372c5fb83ddb..e401edd8d44b 100644
@@ -201,7 +201,7 @@ int skl_init_dsp(struct skl_dev *skl, struct sst_pdata *pdata)
  	if (!ops)
  		return -EIO;
 
-	ret = skl_sst_ctx_init(skl, skl->fw_name, pdata);
+	ret = skl_sst_ctx_init(skl, pdata);
  	if (ret < 0)
  		return ret;
 
sound/soc/intel/skylake/skl-sst-dsp.h +1 -2
index 8483c60f29ba..a3714b706b8e 100644
@@ -223,8 +223,7 @@ int skl_dsp_strip_extended_manifest(struct firmware *fw);
 
  void skl_dsp_set_astate_cfg(struct skl_dev *skl, u32 cnt, void *data);
 
-int skl_sst_ctx_init(struct skl_dev *skl, const char *fw_name,
-		struct sst_pdata *pdata);
+int skl_sst_ctx_init(struct skl_dev *skl, struct sst_pdata *pdata);
  int skl_prepare_lib_load(struct skl_dev *skl, struct skl_lib_info *linfo,
  			struct firmware *stripped_fw,
  			unsigned int hdr_offset, int index);
sound/soc/intel/skylake/skl-sst-utils.c +1 -3
index a4ad213d34e0..ea5419012312 100644
@@ -354,8 +354,7 @@ int skl_dsp_strip_extended_manifest(struct firmware *fw)
  	return 0;
  }
 
-int skl_sst_ctx_init(struct skl_dev *skl, const char *fw_name,
-	struct sst_pdata *pdata)
+int skl_sst_ctx_init(struct skl_dev *skl, struct sst_pdata *pdata)
  {
  	struct sst_dsp *sst;
  	struct device *dev = skl->dev;
@@ -372,7 +371,6 @@ int skl_sst_ctx_init(struct skl_dev *skl, const char *fw_name,
  	}
 
  	skl->dsp = sst;
-	sst->fw_name = fw_name;
  	init_waitqueue_head(&skl->mod_load_wait);
  	skl->is_first_boot = true;
 
sound/soc/intel/skylake/skl.c +0 -4
index 39442c80a179..3225f4f8793e 100644
@@ -491,9 +491,6 @@ static struct snd_soc_acpi_mach *skl_find_hda_machine(struct skl_dev *skl,
  	/* point to common table */
  	mach = snd_soc_acpi_intel_hda_machines;
 
-	/* all entries in the machine table use the same firmware */
-	mach->fw_filename = machines->fw_filename;
-
  	return mach;
  }
 
@@ -514,7 +511,6 @@ static int skl_find_machine(struct skl_dev *skl, void *driver_data)
  	}
 
  	skl->mach = mach;
-	skl->fw_name = mach->fw_filename;
  	pdata = mach->pdata;
 
  	if (pdata) {
author maintainer
#74 lore raw

Re: [PATCH 30/35] ASoC: Intel: Reuse sst_pdata::fw_name field

Quoted 12 lines · Pierre-Louis Bossart
Quoted 6 lines · Cezary Rojewski

struct sst_pdata is equipped with fw_name field - a platform specific filename for basefw module. Usage of such allows for suther simplification of declaration of handlers directly involved with Skylake initialization procedure.

This change invalidates mach::fw_filename field and skl::fw_name.

Again bad move. While in theory it's true that a single firmware is all you need, you do want to keep the ability to quirk firmware names for specific cases. We've been there before, don't remove this capability please.

Explained this on PATCH 27/35. This is the task for topology manifest. Please note basefw binary alone does not cut it. There are external libraries and vendor cases too. In actual real-life specific example, you need to replace everything, e.g.: basefw, ARSC, WoV and so on. Don't see how fw_filename can represent several files, really.

Quoted 107 lines
Quoted 107 lines

---
  sound/soc/intel/common/sst-acpi.c       | 5 ++--- sound/soc/intel/common/sst-firmware.c   | 1 + sound/soc/intel/skylake/skl-messages.c  | 2 +- sound/soc/intel/skylake/skl-sst-dsp.h   | 3 +-- sound/soc/intel/skylake/skl-sst-utils.c | 4 +--- sound/soc/intel/skylake/skl.c           | 4 ----

  6 files changed, 6 insertions(+), 13 deletions(-)
sound/soc/intel/common/sst-acpi.c +2 -3
index 53ac23f05966..15f2b27e643f 100644
@@ -28,11 +28,10 @@ static void sst_acpi_fw_cb(const struct firmware 
 *fw, void *context)
       struct sst_acpi_priv *sst_acpi = platform_get_drvdata(pdev);
       struct sst_acpi_desc *desc = sst_acpi->desc;
       struct sst_pdata *sst_pdata = desc->pdata;
-    struct snd_soc_acpi_mach *mach = sst_acpi->mach;
       sst_pdata->fw = fw;
       if (!fw) {
-        dev_err(dev, "Cannot load firmware %s\n", mach->fw_filename);
+        dev_err(dev, "Cannot load firmware %s\n", sst_pdata->fw_name);
           return;
       }
@@ -119,7 +118,7 @@ int sst_acpi_probe(struct platform_device *pdev)
           return PTR_ERR(sst_acpi->pdev_mach);
       /* continue SST probing after firmware is loaded */
-    ret = request_firmware_nowait(THIS_MODULE, true, mach->fw_filename,
+    ret = request_firmware_nowait(THIS_MODULE, true, sst_pdata->fw_name,
                         dev, GFP_KERNEL, pdev, sst_acpi_fw_cb);
       if (ret)
           platform_device_unregister(sst_acpi->pdev_mach);
sound/soc/intel/common/sst-firmware.c +1 -0
index 61d3e6e46b98..cc88849eb10f 100644
@@ -1218,6 +1218,7 @@ struct sst_dsp *sst_dsp_new(struct device *dev, 
 struct sst_pdata *pdata)
       sst->thread_context = pdata->dsp;
       sst->id = pdata->id;
       sst->irq = pdata->irq;
+    sst->fw_name = pdata->fw_name;
       sst->ops = pdata->ops;
       sst->pdata = pdata;

      INIT_LIST_HEAD(&sst->used_block_list);

sound/soc/intel/skylake/skl-messages.c +1 -1
index 372c5fb83ddb..e401edd8d44b 100644
@@ -201,7 +201,7 @@ int skl_init_dsp(struct skl_dev *skl, struct 
 sst_pdata *pdata)
       if (!ops)
           return -EIO;
-    ret = skl_sst_ctx_init(skl, skl->fw_name, pdata);
+    ret = skl_sst_ctx_init(skl, pdata);
       if (ret < 0)
           return ret;
sound/soc/intel/skylake/skl-sst-dsp.h +1 -2
index 8483c60f29ba..a3714b706b8e 100644
@@ -223,8 +223,7 @@ int skl_dsp_strip_extended_manifest(struct 
 firmware *fw);
   void skl_dsp_set_astate_cfg(struct skl_dev *skl, u32 cnt, void *data);
-int skl_sst_ctx_init(struct skl_dev *skl, const char *fw_name,
-        struct sst_pdata *pdata);
+int skl_sst_ctx_init(struct skl_dev *skl, struct sst_pdata *pdata);
   int skl_prepare_lib_load(struct skl_dev *skl, struct skl_lib_info *linfo,
               struct firmware *stripped_fw,
               unsigned int hdr_offset, int index);
sound/soc/intel/skylake/skl-sst-utils.c +1 -3
index a4ad213d34e0..ea5419012312 100644
@@ -354,8 +354,7 @@ int skl_dsp_strip_extended_manifest(struct 
 firmware *fw)
       return 0;
   }
-int skl_sst_ctx_init(struct skl_dev *skl, const char *fw_name,
-    struct sst_pdata *pdata)
+int skl_sst_ctx_init(struct skl_dev *skl, struct sst_pdata *pdata)
   {
       struct sst_dsp *sst;
       struct device *dev = skl->dev;
@@ -372,7 +371,6 @@ int skl_sst_ctx_init(struct skl_dev *skl, const 
 char *fw_name,
       }
       skl->dsp = sst;
-    sst->fw_name = fw_name;
       init_waitqueue_head(&skl->mod_load_wait);
       skl->is_first_boot = true;
sound/soc/intel/skylake/skl.c +0 -3
index 39442c80a179..3225f4f8793e 100644
@@ -491,9 +491,6 @@ static struct snd_soc_acpi_mach 
 *skl_find_hda_machine(struct skl_dev *skl,
       /* point to common table */
       mach = snd_soc_acpi_intel_hda_machines;
-    /* all entries in the machine table use the same firmware */
-    mach->fw_filename = machines->fw_filename;
-
       return mach;
   }
Quoted 8 lines

sound/soc/intel/skylake/skl.c static int skl_find_machine(struct skl_dev *skl, · line 516

Quoted 8 lines
sound/soc/intel/skylake/skl.c +0 -1
@@ -514,7 +511,6 @@ static int skl_find_machine(struct skl_dev *skl, 
 void *driver_data)
       }
       skl->mach = mach;
-    skl->fw_name = mach->fw_filename;
       pdata = mach->pdata;
       if (pdata) {
 

_______________________________________________
Alsa-devel mailing list
[email protected]
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

author maintainer
#75 lore raw

PATCH 31/35 ASoC: Intel: Reuse sst_pdata::fw field

In reply to Cezary Rojewski

Similarly to fw_name, sst_pdata::fw can be used to unify usage of firmware objects for all SSTs.

This change invalidates sst_dsp::fw field.

---
 sound/soc/intel/skylake/bxt-sst.c | 16 +++++++++-------
 sound/soc/intel/skylake/cnl-sst.c | 15 ++++++++-------
 sound/soc/intel/skylake/skl-sst.c | 23 +++++++++++++----------
 3 files changed, 30 insertions(+), 24 deletions(-)
sound/soc/intel/skylake/bxt-sst.c +9 -7
index 286da9fbc4de..79728e418176 100644
@@ -185,10 +185,11 @@ static int bxt_load_base_firmware(struct sst_dsp *ctx)
 {
 	struct firmware stripped_fw;
 	struct skl_dev *skl = ctx->thread_context;
+	struct sst_pdata *pdata = ctx->pdata;
 	int ret, i;
 
-	if (ctx->fw == NULL) {
-		ret = request_firmware(&ctx->fw, ctx->fw_name, ctx->dev);
+	if (!pdata->fw) {
+		ret = request_firmware(&pdata->fw, ctx->fw_name, ctx->dev);
 		if (ret < 0) {
 			dev_err(ctx->dev, "Request firmware failed %d\n", ret);
 			return ret;
@@ -197,13 +198,14 @@ static int bxt_load_base_firmware(struct sst_dsp *ctx)
 
 	/* prase uuids on first boot */
 	if (skl->is_first_boot) {
-		ret = snd_skl_parse_uuids(ctx, ctx->fw, BXT_ADSP_FW_BIN_HDR_OFFSET, 0);
+		ret = snd_skl_parse_uuids(ctx, pdata->fw,
+				BXT_ADSP_FW_BIN_HDR_OFFSET, 0);
 		if (ret < 0)
 			goto sst_load_base_firmware_failed;
 	}
 
-	stripped_fw.data = ctx->fw->data;
-	stripped_fw.size = ctx->fw->size;
+	stripped_fw.data = pdata->fw->data;
+	stripped_fw.size = pdata->fw->size;
 	skl_dsp_strip_extended_manifest(&stripped_fw);
 
 	for (i = 0; i < BXT_FW_ROM_INIT_RETRY; i++) {
@@ -246,8 +248,8 @@ static int bxt_load_base_firmware(struct sst_dsp *ctx)
 	return ret;
 
 sst_load_base_firmware_failed:
-	release_firmware(ctx->fw);
-	ctx->fw = NULL;
+	release_firmware(pdata->fw);
+	pdata->fw = NULL;
 	return ret;
 }
 
sound/soc/intel/skylake/cnl-sst.c +8 -7
index a6113d8afcbb..58efeb6c8a8a 100644
@@ -108,10 +108,11 @@ static int cnl_load_base_firmware(struct sst_dsp *ctx)
 {
 	struct firmware stripped_fw;
 	struct skl_dev *cnl = ctx->thread_context;
+	struct sst_pdata *pdata = ctx->pdata;
 	int ret;
 
-	if (!ctx->fw) {
-		ret = request_firmware(&ctx->fw, ctx->fw_name, ctx->dev);
+	if (!pdata->fw) {
+		ret = request_firmware(&pdata->fw, ctx->fw_name, ctx->dev);
 		if (ret < 0) {
 			dev_err(ctx->dev, "request firmware failed: %d\n", ret);
 			goto cnl_load_base_firmware_failed;
@@ -120,14 +121,14 @@ static int cnl_load_base_firmware(struct sst_dsp *ctx)
 
 	/* parse uuids if first boot */
 	if (cnl->is_first_boot) {
-		ret = snd_skl_parse_uuids(ctx, ctx->fw,
+		ret = snd_skl_parse_uuids(ctx, pdata->fw,
 					  CNL_ADSP_FW_HDR_OFFSET, 0);
 		if (ret < 0)
 			goto cnl_load_base_firmware_failed;
 	}
 
-	stripped_fw.data = ctx->fw->data;
-	stripped_fw.size = ctx->fw->size;
+	stripped_fw.data = pdata->fw->data;
+	stripped_fw.size = pdata->fw->size;
 	skl_dsp_strip_extended_manifest(&stripped_fw);
 
 	ret = cnl_prepare_fw(ctx, stripped_fw.data, stripped_fw.size);
@@ -157,8 +158,8 @@ static int cnl_load_base_firmware(struct sst_dsp *ctx)
 	return 0;
 
 cnl_load_base_firmware_failed:
-	release_firmware(ctx->fw);
-	ctx->fw = NULL;
+	release_firmware(pdata->fw);
+	pdata->fw = NULL;
 
 	return ret;
 }
sound/soc/intel/skylake/skl-sst.c +13 -10
index e0f2bf828541..8e1d02e29a32 100644
@@ -67,14 +67,15 @@ static int skl_load_base_firmware(struct sst_dsp *ctx)
 {
 	int ret = 0, i;
 	struct skl_dev *skl = ctx->thread_context;
+	struct sst_pdata *pdata = ctx->pdata;
 	struct firmware stripped_fw;
 	u32 reg;
 
 	skl->boot_complete = false;
 	init_waitqueue_head(&skl->boot_wait);
 
-	if (ctx->fw == NULL) {
-		ret = request_firmware(&ctx->fw, ctx->fw_name, ctx->dev);
+	if (!pdata->fw) {
+		ret = request_firmware(&pdata->fw, ctx->fw_name, ctx->dev);
 		if (ret < 0) {
 			dev_err(ctx->dev, "Request firmware failed %d\n", ret);
 			return -EIO;
@@ -83,18 +84,19 @@ static int skl_load_base_firmware(struct sst_dsp *ctx)
 
 	/* prase uuids on first boot */
 	if (skl->is_first_boot) {
-		ret = snd_skl_parse_uuids(ctx, ctx->fw, SKL_ADSP_FW_BIN_HDR_OFFSET, 0);
+		ret = snd_skl_parse_uuids(ctx, pdata->fw,
+				SKL_ADSP_FW_BIN_HDR_OFFSET, 0);
 		if (ret < 0) {
 			dev_err(ctx->dev, "UUID parsing err: %d\n", ret);
-			release_firmware(ctx->fw);
+			release_firmware(pdata->fw);
 			skl_dsp_disable_core(ctx, SKL_DSP_CORE0_MASK);
 			return ret;
 		}
 	}
 
 	/* check for extended manifest */
-	stripped_fw.data = ctx->fw->data;
-	stripped_fw.size = ctx->fw->size;
+	stripped_fw.data = pdata->fw->data;
+	stripped_fw.size = pdata->fw->size;
 
 	skl_dsp_strip_extended_manifest(&stripped_fw);
 
@@ -152,8 +154,8 @@ static int skl_load_base_firmware(struct sst_dsp *ctx)
 	ctx->cl_dev.ops.cl_cleanup_controller(ctx);
 skl_load_base_firmware_failed:
 	skl_dsp_disable_core(ctx, SKL_DSP_CORE0_MASK);
-	release_firmware(ctx->fw);
-	ctx->fw = NULL;
+	release_firmware(pdata->fw);
+	pdata->fw = NULL;
 	return ret;
 }
 
@@ -602,10 +604,11 @@ EXPORT_SYMBOL_GPL(skl_sst_init_fw);
 void skl_sst_dsp_cleanup(struct skl_dev *skl)
 {
 	struct sst_dsp *dsp = skl->dsp;
+	struct sst_pdata *pdata = dsp->pdata;
 
 	skl_release_library(skl->lib_info, skl->lib_count);
-	if (dsp->fw)
-		release_firmware(dsp->fw);
+	if (pdata->fw)
+		release_firmware(pdata->fw);
 	skl_clear_module_table(dsp);
 
 	skl_freeup_uuid_list(skl);
Signature · 1 line
2.17.1
author maintainer
#76 lore raw

PATCH 32/35 ASoC: Intel: Skylake: Remove skl_dsp_ops

In reply to Cezary Rojewski

All declaration simplication and addition of FIRMWARE_CONFIG and HARDWARE_CONFIG led to ultimate goal of removal of struct skl_dsp_ops. Strike it down, struct sst_pdata is more than enough is providing description for SST platforms.

---
 sound/soc/intel/skylake/skl-messages.c | 53 --------------------------
 sound/soc/intel/skylake/skl.h          |  8 ----
 2 files changed, 61 deletions(-)
sound/soc/intel/skylake/skl-messages.c +0 -53
index e401edd8d44b..5f63c3052db9 100644
@@ -140,72 +140,19 @@ int skl_dsp_cleanup(struct device *dev,
 	return 0;
 }
 
-static const struct skl_dsp_ops dsp_ops[] = {
-	{
-		.id = 0x9d70,
-		.init = skl_sst_dsp_init,
-	},
-	{
-		.id = 0x9d71,
-		.init = skl_sst_dsp_init,
-	},
-	{
-		.id = 0x5a98,
-		.init = bxt_sst_dsp_init,
-	},
-	{
-		.id = 0x3198,
-		.init = bxt_sst_dsp_init,
-	},
-	{
-		.id = 0x9dc8,
-		.init = cnl_sst_dsp_init,
-	},
-	{
-		.id = 0xa348,
-		.init = cnl_sst_dsp_init,
-	},
-	{
-		.id = 0x02c8,
-		.init = cnl_sst_dsp_init,
-	},
-	{
-		.id = 0x06c8,
-		.init = cnl_sst_dsp_init,
-	},
-};
-
-const struct skl_dsp_ops *skl_get_dsp_ops(int pci_id)
-{
-	int i;
-
-	for (i = 0; i < ARRAY_SIZE(dsp_ops); i++) {
-		if (dsp_ops[i].id == pci_id)
-			return &dsp_ops[i];
-	}
-
-	return NULL;
-}
-
 int skl_init_dsp(struct skl_dev *skl, struct sst_pdata *pdata)
 {
 	struct hdac_bus *bus = skl_to_bus(skl);
-	const struct skl_dsp_ops *ops;
 	int ret;
 
 	/* enable ppcap interrupt */
 	snd_hdac_ext_bus_ppcap_enable(bus, true);
 	snd_hdac_ext_bus_ppcap_int_enable(bus, true);
 
-	ops = skl_get_dsp_ops(skl->pci->device);
-	if (!ops)
-		return -EIO;
-
 	ret = skl_sst_ctx_init(skl, pdata);
 	if (ret < 0)
 		return ret;
 
-	skl->dsp_ops = ops;
 	dev_dbg(bus->dev, "dsp registration status=%d\n", ret);
 
 	return 0;
sound/soc/intel/skylake/skl.h +0 -8
index f4cd5ccc1ff9..218e8bda6cae 100644
@@ -135,8 +135,6 @@ struct skl_dev {
 
 	struct skl_d0i3_data d0i3;
 
-	const struct skl_dsp_ops *dsp_ops;
-
 	/* Callback to update dynamic clock and power gating registers */
 	void (*clock_power_gating)(struct device *dev, bool enable);
 };
@@ -157,11 +155,6 @@ struct skl_machine_pdata {
 	bool use_tplg_pcm; /* use dais and dai links from topology */
 };
 
-struct skl_dsp_ops {
-	int id;
-	int (*init)(struct sst_dsp *dsp, struct sst_pdata *pdata);
-};
-
 int skl_platform_unregister(struct device *dev);
 int skl_platform_register(struct device *dev);
 
@@ -178,7 +171,6 @@ int skl_suspend_late_dsp(struct skl_dev *skl);
 int skl_suspend_dsp(struct skl_dev *skl);
 int skl_resume_dsp(struct skl_dev *skl);
 void skl_cleanup_resources(struct skl_dev *skl);
-const struct skl_dsp_ops *skl_get_dsp_ops(int pci_id);
 void skl_update_d0i3c(struct device *dev, bool enable);
 int skl_nhlt_create_sysfs(struct skl_dev *skl);
 void skl_nhlt_remove_sysfs(struct skl_dev *skl);
Signature · 1 line
2.17.1
author maintainer
#77 lore raw

PATCH 33/35 ASoC: Intel: Skylake: Privatize SST init handlers

In reply to Cezary Rojewski

With initialization order repaired, sst_ops::init overloads can be privatized for Skylake platofmrs. Let's do so.

---
 sound/soc/intel/skylake/bxt-sst.c     | 25 ++++++++++++-------------
 sound/soc/intel/skylake/cnl-sst-dsp.h |  2 --
 sound/soc/intel/skylake/cnl-sst.c     | 25 ++++++++++++-------------
 sound/soc/intel/skylake/skl-sst-dsp.h |  2 --
 sound/soc/intel/skylake/skl-sst.c     | 23 +++++++++++------------
 5 files changed, 35 insertions(+), 42 deletions(-)
sound/soc/intel/skylake/bxt-sst.c +12 -13
index 79728e418176..1edc38069615 100644
@@ -533,18 +533,7 @@ static const struct skl_dsp_fw_ops bxt_fw_ops = {
 	.load_library = bxt_load_library,
 };
 
-struct sst_ops apl_sst_ops = {
-	.irq_handler = skl_dsp_sst_interrupt,
-	.thread_fn = skl_dsp_irq_thread_handler,
-	.write = sst_shim32_write,
-	.read = sst_shim32_read,
-	.ram_read = sst_memcpy_fromio_32,
-	.ram_write = sst_memcpy_toio_32,
-	.init = bxt_sst_dsp_init,
-	.free = skl_dsp_free,
-};
-
-int bxt_sst_dsp_init(struct sst_dsp *sst, struct sst_pdata *pdata)
+static int bxt_sst_init(struct sst_dsp *sst, struct sst_pdata *pdata)
 {
 	struct skl_dev *skl = sst->thread_context;
 	void __iomem *mmio;
@@ -578,7 +567,17 @@ int bxt_sst_dsp_init(struct sst_dsp *sst, struct sst_pdata *pdata)
 
 	return 0;
 }
-EXPORT_SYMBOL_GPL(bxt_sst_dsp_init);
+
+struct sst_ops apl_sst_ops = {
+	.irq_handler = skl_dsp_sst_interrupt,
+	.thread_fn = skl_dsp_irq_thread_handler,
+	.write = sst_shim32_write,
+	.read = sst_shim32_read,
+	.ram_read = sst_memcpy_fromio_32,
+	.ram_write = sst_memcpy_toio_32,
+	.init = bxt_sst_init,
+	.free = skl_dsp_free,
+};
 
 MODULE_LICENSE("GPL v2");
 MODULE_DESCRIPTION("Intel Broxton IPC driver");
sound/soc/intel/skylake/cnl-sst-dsp.h +0 -2
index 7810ae11954a..a1ea242e9539 100644
@@ -87,6 +87,4 @@ void cnl_ipc_op_int_enable(struct sst_dsp *ctx);
 void cnl_ipc_op_int_disable(struct sst_dsp *ctx);
 bool cnl_ipc_int_status(struct sst_dsp *ctx);
 
-int cnl_sst_dsp_init(struct sst_dsp *sst, struct sst_pdata *pdata);
-
 #endif /*__CNL_SST_DSP_H__*/
sound/soc/intel/skylake/cnl-sst.c +12 -13
index 58efeb6c8a8a..360e54d3c587 100644
@@ -409,18 +409,7 @@ static int cnl_ipc_init(struct device *dev, struct skl_dev *cnl)
 	return 0;
 }
 
-struct sst_ops cnl_sst_ops = {
-	.irq_handler = cnl_dsp_sst_interrupt,
-	.thread_fn = cnl_dsp_irq_thread_handler,
-	.write = sst_shim32_write,
-	.read = sst_shim32_read,
-	.ram_read = sst_memcpy_fromio_32,
-	.ram_write = sst_memcpy_toio_32,
-	.init = cnl_sst_dsp_init,
-	.free = cnl_dsp_free,
-};
-
-int cnl_sst_dsp_init(struct sst_dsp *sst, struct sst_pdata *pdata)
+static int cnl_sst_init(struct sst_dsp *sst, struct sst_pdata *pdata)
 {
 	struct skl_dev *cnl = sst->thread_context;
 	void __iomem *mmio;
@@ -449,7 +438,17 @@ int cnl_sst_dsp_init(struct sst_dsp *sst, struct sst_pdata *pdata)
 
 	return 0;
 }
-EXPORT_SYMBOL_GPL(cnl_sst_dsp_init);
+
+struct sst_ops cnl_sst_ops = {
+	.irq_handler = cnl_dsp_sst_interrupt,
+	.thread_fn = cnl_dsp_irq_thread_handler,
+	.write = sst_shim32_write,
+	.read = sst_shim32_read,
+	.ram_read = sst_memcpy_fromio_32,
+	.ram_write = sst_memcpy_toio_32,
+	.init = cnl_sst_init,
+	.free = cnl_dsp_free,
+};
 
 MODULE_LICENSE("GPL v2");
 MODULE_DESCRIPTION("Intel Cannonlake IPC driver");
sound/soc/intel/skylake/skl-sst-dsp.h +0 -2
index a3714b706b8e..3294826d5cf7 100644
@@ -206,8 +206,6 @@ int skl_dsp_get_core(struct sst_dsp *ctx, unsigned int core_id);
 int skl_dsp_put_core(struct sst_dsp *ctx, unsigned int core_id);
 
 int skl_dsp_boot(struct sst_dsp *ctx);
-int skl_sst_dsp_init(struct sst_dsp *sst, struct sst_pdata *pdata);
-int bxt_sst_dsp_init(struct sst_dsp *sst, struct sst_pdata *pdata);
 int bxt_load_library(struct sst_dsp *ctx, struct skl_lib_info *linfo,
 		int lib_count);
 
sound/soc/intel/skylake/skl-sst.c +11 -12
index 8e1d02e29a32..209f45e3d5d0 100644
@@ -505,17 +505,7 @@ static const struct skl_dsp_fw_ops skl_fw_ops = {
 	.unload_mod = skl_unload_module,
 };
 
-struct sst_ops skl_sst_ops = {
-	.irq_handler = skl_dsp_sst_interrupt,
-	.write = sst_shim32_write,
-	.read = sst_shim32_read,
-	.ram_read = sst_memcpy_fromio_32,
-	.ram_write = sst_memcpy_toio_32,
-	.init = skl_sst_dsp_init,
-	.free = skl_dsp_free,
-};
-
-int skl_sst_dsp_init(struct sst_dsp *sst, struct sst_pdata *pdata)
+static int skl_sst_init(struct sst_dsp *sst, struct sst_pdata *pdata)
 {
 	struct skl_dev *skl = sst->thread_context;
 	void __iomem *mmio;
@@ -541,7 +531,16 @@ int skl_sst_dsp_init(struct sst_dsp *sst, struct sst_pdata *pdata)
 
 	return 0;
 }
-EXPORT_SYMBOL_GPL(skl_sst_dsp_init);
+
+struct sst_ops skl_sst_ops = {
+	.irq_handler = skl_dsp_sst_interrupt,
+	.write = sst_shim32_write,
+	.read = sst_shim32_read,
+	.ram_read = sst_memcpy_fromio_32,
+	.ram_write = sst_memcpy_toio_32,
+	.init = skl_sst_init,
+	.free = skl_dsp_free,
+};
 
 int skl_sst_init_fw(struct skl_dev *skl)
 {
Signature · 1 line
2.17.1
#78 lore raw

Re: [PATCH 33/35] ASoC: Intel: Skylake: Privatize SST init handlers

Quoted 2 lines · Cezary Rojewski

With initialization order repaired, sst_ops::init overloads can be privatized for Skylake platofmrs. Let's do so.

platforms

Quoted 40 lines
---
  sound/soc/intel/skylake/bxt-sst.c     | 25 ++++++++++++-------------
  sound/soc/intel/skylake/cnl-sst-dsp.h |  2 --
  sound/soc/intel/skylake/cnl-sst.c     | 25 ++++++++++++-------------
  sound/soc/intel/skylake/skl-sst-dsp.h |  2 --
  sound/soc/intel/skylake/skl-sst.c     | 23 +++++++++++------------
  5 files changed, 35 insertions(+), 42 deletions(-)
sound/soc/intel/skylake/bxt-sst.c +2 -13
index 79728e418176..1edc38069615 100644
@@ -533,18 +533,7 @@ static const struct skl_dsp_fw_ops bxt_fw_ops = {
  	.load_library = bxt_load_library,
  };
 
-struct sst_ops apl_sst_ops = {
-	.irq_handler = skl_dsp_sst_interrupt,
-	.thread_fn = skl_dsp_irq_thread_handler,
-	.write = sst_shim32_write,
-	.read = sst_shim32_read,
-	.ram_read = sst_memcpy_fromio_32,
-	.ram_write = sst_memcpy_toio_32,
-	.init = bxt_sst_dsp_init,
-	.free = skl_dsp_free,
-};
-
-int bxt_sst_dsp_init(struct sst_dsp *sst, struct sst_pdata *pdata)
+static int bxt_sst_init(struct sst_dsp *sst, struct sst_pdata *pdata)
  {
  	struct skl_dev *skl = sst->thread_context;
  	void __iomem *mmio;
@@ -578,7 +567,17 @@ int bxt_sst_dsp_init(struct sst_dsp *sst, struct sst_pdata *pdata)
 
  	return 0;
  }
-EXPORT_SYMBOL_GPL(bxt_sst_dsp_init);
+

sound/soc/intel/skylake/bxt-sst.c int bxt_sst_dsp_init(struct sst_dsp *sst, struct sst_pdata *pdata) · line 580

Quoted 10 lines
sound/soc/intel/skylake/bxt-sst.c +10 -0
+struct sst_ops apl_sst_ops = {
+	.irq_handler = skl_dsp_sst_interrupt,
+	.thread_fn = skl_dsp_irq_thread_handler,
+	.write = sst_shim32_write,
+	.read = sst_shim32_read,
+	.ram_read = sst_memcpy_fromio_32,
+	.ram_write = sst_memcpy_toio_32,
+	.init = bxt_sst_init,
+	.free = skl_dsp_free,
+};

should these structures be static if they are not exported? sparse should tell you that: make -C 2

Quoted 112 lines
sound/soc/intel/skylake/bxt-sst.c +0 -0
  MODULE_LICENSE("GPL v2");
  MODULE_DESCRIPTION("Intel Broxton IPC driver");
sound/soc/intel/skylake/cnl-sst-dsp.h +0 -2
index 7810ae11954a..a1ea242e9539 100644
@@ -87,6 +87,4 @@ void cnl_ipc_op_int_enable(struct sst_dsp *ctx);
  void cnl_ipc_op_int_disable(struct sst_dsp *ctx);
  bool cnl_ipc_int_status(struct sst_dsp *ctx);
 
-int cnl_sst_dsp_init(struct sst_dsp *sst, struct sst_pdata *pdata);
-
  #endif /*__CNL_SST_DSP_H__*/
sound/soc/intel/skylake/cnl-sst.c +12 -13
index 58efeb6c8a8a..360e54d3c587 100644
@@ -409,18 +409,7 @@ static int cnl_ipc_init(struct device *dev, struct skl_dev *cnl)
  	return 0;
  }
 
-struct sst_ops cnl_sst_ops = {
-	.irq_handler = cnl_dsp_sst_interrupt,
-	.thread_fn = cnl_dsp_irq_thread_handler,
-	.write = sst_shim32_write,
-	.read = sst_shim32_read,
-	.ram_read = sst_memcpy_fromio_32,
-	.ram_write = sst_memcpy_toio_32,
-	.init = cnl_sst_dsp_init,
-	.free = cnl_dsp_free,
-};
-
-int cnl_sst_dsp_init(struct sst_dsp *sst, struct sst_pdata *pdata)
+static int cnl_sst_init(struct sst_dsp *sst, struct sst_pdata *pdata)
  {
  	struct skl_dev *cnl = sst->thread_context;
  	void __iomem *mmio;
@@ -449,7 +438,17 @@ int cnl_sst_dsp_init(struct sst_dsp *sst, struct sst_pdata *pdata)
 
  	return 0;
  }
-EXPORT_SYMBOL_GPL(cnl_sst_dsp_init);
+
+struct sst_ops cnl_sst_ops = {
+	.irq_handler = cnl_dsp_sst_interrupt,
+	.thread_fn = cnl_dsp_irq_thread_handler,
+	.write = sst_shim32_write,
+	.read = sst_shim32_read,
+	.ram_read = sst_memcpy_fromio_32,
+	.ram_write = sst_memcpy_toio_32,
+	.init = cnl_sst_init,
+	.free = cnl_dsp_free,
+};
 
  MODULE_LICENSE("GPL v2");
  MODULE_DESCRIPTION("Intel Cannonlake IPC driver");
sound/soc/intel/skylake/skl-sst-dsp.h +0 -2
index a3714b706b8e..3294826d5cf7 100644
@@ -206,8 +206,6 @@ int skl_dsp_get_core(struct sst_dsp *ctx, unsigned int core_id);
  int skl_dsp_put_core(struct sst_dsp *ctx, unsigned int core_id);
 
  int skl_dsp_boot(struct sst_dsp *ctx);
-int skl_sst_dsp_init(struct sst_dsp *sst, struct sst_pdata *pdata);
-int bxt_sst_dsp_init(struct sst_dsp *sst, struct sst_pdata *pdata);
  int bxt_load_library(struct sst_dsp *ctx, struct skl_lib_info *linfo,
  		int lib_count);
 
sound/soc/intel/skylake/skl-sst.c +11 -12
index 8e1d02e29a32..209f45e3d5d0 100644
@@ -505,17 +505,7 @@ static const struct skl_dsp_fw_ops skl_fw_ops = {
  	.unload_mod = skl_unload_module,
  };
 
-struct sst_ops skl_sst_ops = {
-	.irq_handler = skl_dsp_sst_interrupt,
-	.write = sst_shim32_write,
-	.read = sst_shim32_read,
-	.ram_read = sst_memcpy_fromio_32,
-	.ram_write = sst_memcpy_toio_32,
-	.init = skl_sst_dsp_init,
-	.free = skl_dsp_free,
-};
-
-int skl_sst_dsp_init(struct sst_dsp *sst, struct sst_pdata *pdata)
+static int skl_sst_init(struct sst_dsp *sst, struct sst_pdata *pdata)
  {
  	struct skl_dev *skl = sst->thread_context;
  	void __iomem *mmio;
@@ -541,7 +531,16 @@ int skl_sst_dsp_init(struct sst_dsp *sst, struct sst_pdata *pdata)
 
  	return 0;
  }
-EXPORT_SYMBOL_GPL(skl_sst_dsp_init);
+
+struct sst_ops skl_sst_ops = {
+	.irq_handler = skl_dsp_sst_interrupt,
+	.write = sst_shim32_write,
+	.read = sst_shim32_read,
+	.ram_read = sst_memcpy_fromio_32,
+	.ram_write = sst_memcpy_toio_32,
+	.init = skl_sst_init,
+	.free = skl_dsp_free,
+};
 
  int skl_sst_init_fw(struct skl_dev *skl)
  {
author maintainer
#79 lore raw

Re: [PATCH 33/35] ASoC: Intel: Skylake: Privatize SST init handlers

Quoted 8 lines · Pierre-Louis Bossart
Quoted 2 lines · Cezary Rojewski

With initialization order repaired, sst_ops::init overloads can be privatized for Skylake platofmrs. Let's do so.

platforms

Ack.

Quoted 44 lines
Quoted 44 lines

---
  sound/soc/intel/skylake/bxt-sst.c     | 25 ++++++++++++------------- sound/soc/intel/skylake/cnl-sst-dsp.h |  2 -- sound/soc/intel/skylake/cnl-sst.c     | 25 ++++++++++++------------- sound/soc/intel/skylake/skl-sst-dsp.h |  2 -- sound/soc/intel/skylake/skl-sst.c     | 23 +++++++++++------------

  5 files changed, 35 insertions(+), 42 deletions(-)
sound/soc/intel/skylake/bxt-sst.c +7 -13
index 79728e418176..1edc38069615 100644
@@ -533,18 +533,7 @@ static const struct skl_dsp_fw_ops bxt_fw_ops = {
       .load_library = bxt_load_library,
   };
-struct sst_ops apl_sst_ops = {
-    .irq_handler = skl_dsp_sst_interrupt,
-    .thread_fn = skl_dsp_irq_thread_handler,
-    .write = sst_shim32_write,
-    .read = sst_shim32_read,
-    .ram_read = sst_memcpy_fromio_32,
-    .ram_write = sst_memcpy_toio_32,
-    .init = bxt_sst_dsp_init,
-    .free = skl_dsp_free,
-};
-
-int bxt_sst_dsp_init(struct sst_dsp *sst, struct sst_pdata *pdata)
+static int bxt_sst_init(struct sst_dsp *sst, struct sst_pdata *pdata)
   {
       struct skl_dev *skl = sst->thread_context;
       void __iomem *mmio;
@@ -578,7 +567,17 @@ int bxt_sst_dsp_init(struct sst_dsp *sst, struct 
 sst_pdata *pdata)
       return 0;
   }
-EXPORT_SYMBOL_GPL(bxt_sst_dsp_init);
+
+struct sst_ops apl_sst_ops = {
+    .irq_handler = skl_dsp_sst_interrupt,
+    .thread_fn = skl_dsp_irq_thread_handler,
+    .write = sst_shim32_write,
+    .read = sst_shim32_read,
Quoted 9 lines

sound/soc/intel/skylake/bxt-sst.c int bxt_sst_dsp_init(struct sst_dsp *sst, struct sst_pdata *pdata) · line 580

Quoted 5 lines
sound/soc/intel/skylake/bxt-sst.c +5 -0
+    .ram_read = sst_memcpy_fromio_32,
+    .ram_write = sst_memcpy_toio_32,
+    .init = bxt_sst_init,
+    .free = skl_dsp_free,
+};

should these structures be static if they are not exported? sparse should tell you that: make -C 2

These are externed in skl.h. make -C 2 tells me it's fine as is. Thank you for being accurate though, indeed can be easy to miss.

Quoted 98 lines
Quoted 98 lines
sound/soc/intel/skylake/bxt-sst.c +0 -0
   MODULE_LICENSE("GPL v2");
   MODULE_DESCRIPTION("Intel Broxton IPC driver");
sound/soc/intel/skylake/cnl-sst-dsp.h +0 -2
index 7810ae11954a..a1ea242e9539 100644
@@ -87,6 +87,4 @@ void cnl_ipc_op_int_enable(struct sst_dsp *ctx);
   void cnl_ipc_op_int_disable(struct sst_dsp *ctx);
   bool cnl_ipc_int_status(struct sst_dsp *ctx);
-int cnl_sst_dsp_init(struct sst_dsp *sst, struct sst_pdata *pdata);
-
   #endif /*__CNL_SST_DSP_H__*/
sound/soc/intel/skylake/cnl-sst.c +12 -13
index 58efeb6c8a8a..360e54d3c587 100644
@@ -409,18 +409,7 @@ static int cnl_ipc_init(struct device *dev, 
 struct skl_dev *cnl)
       return 0;
   }
-struct sst_ops cnl_sst_ops = {
-    .irq_handler = cnl_dsp_sst_interrupt,
-    .thread_fn = cnl_dsp_irq_thread_handler,
-    .write = sst_shim32_write,
-    .read = sst_shim32_read,
-    .ram_read = sst_memcpy_fromio_32,
-    .ram_write = sst_memcpy_toio_32,
-    .init = cnl_sst_dsp_init,
-    .free = cnl_dsp_free,
-};
-
-int cnl_sst_dsp_init(struct sst_dsp *sst, struct sst_pdata *pdata)
+static int cnl_sst_init(struct sst_dsp *sst, struct sst_pdata *pdata)
   {
       struct skl_dev *cnl = sst->thread_context;
       void __iomem *mmio;
@@ -449,7 +438,17 @@ int cnl_sst_dsp_init(struct sst_dsp *sst, struct 
 sst_pdata *pdata)
       return 0;
   }
-EXPORT_SYMBOL_GPL(cnl_sst_dsp_init);
+
+struct sst_ops cnl_sst_ops = {
+    .irq_handler = cnl_dsp_sst_interrupt,
+    .thread_fn = cnl_dsp_irq_thread_handler,
+    .write = sst_shim32_write,
+    .read = sst_shim32_read,
+    .ram_read = sst_memcpy_fromio_32,
+    .ram_write = sst_memcpy_toio_32,
+    .init = cnl_sst_init,
+    .free = cnl_dsp_free,
+};
   MODULE_LICENSE("GPL v2");
   MODULE_DESCRIPTION("Intel Cannonlake IPC driver");
sound/soc/intel/skylake/skl-sst-dsp.h +0 -2
index a3714b706b8e..3294826d5cf7 100644
@@ -206,8 +206,6 @@ int skl_dsp_get_core(struct sst_dsp *ctx, unsigned 
 int core_id);
   int skl_dsp_put_core(struct sst_dsp *ctx, unsigned int core_id);
   int skl_dsp_boot(struct sst_dsp *ctx);
-int skl_sst_dsp_init(struct sst_dsp *sst, struct sst_pdata *pdata);
-int bxt_sst_dsp_init(struct sst_dsp *sst, struct sst_pdata *pdata);
   int bxt_load_library(struct sst_dsp *ctx, struct skl_lib_info *linfo,
           int lib_count);
sound/soc/intel/skylake/skl-sst.c +6 -12
index 8e1d02e29a32..209f45e3d5d0 100644
@@ -505,17 +505,7 @@ static const struct skl_dsp_fw_ops skl_fw_ops = {
       .unload_mod = skl_unload_module,
   };
-struct sst_ops skl_sst_ops = {
-    .irq_handler = skl_dsp_sst_interrupt,
-    .write = sst_shim32_write,
-    .read = sst_shim32_read,
-    .ram_read = sst_memcpy_fromio_32,
-    .ram_write = sst_memcpy_toio_32,
-    .init = skl_sst_dsp_init,
-    .free = skl_dsp_free,
-};
-
-int skl_sst_dsp_init(struct sst_dsp *sst, struct sst_pdata *pdata)
+static int skl_sst_init(struct sst_dsp *sst, struct sst_pdata *pdata)
   {
       struct skl_dev *skl = sst->thread_context;
       void __iomem *mmio;
@@ -541,7 +531,16 @@ int skl_sst_dsp_init(struct sst_dsp *sst, struct 
 sst_pdata *pdata)
       return 0;
   }
-EXPORT_SYMBOL_GPL(skl_sst_dsp_init);
+
+struct sst_ops skl_sst_ops = {
+    .irq_handler = skl_dsp_sst_interrupt,
+    .write = sst_shim32_write,
+    .read = sst_shim32_read,
Quoted 8 lines

sound/soc/intel/skylake/skl-sst.c int skl_sst_dsp_init(struct sst_dsp *sst, struct sst_pdata *pdata)

Quoted 8 lines
sound/soc/intel/skylake/skl-sst.c +5 -0
+    .ram_read = sst_memcpy_fromio_32,
+    .ram_write = sst_memcpy_toio_32,
+    .init = skl_sst_init,
+    .free = skl_dsp_free,
+};
   int skl_sst_init_fw(struct skl_dev *skl)
   {
 

_______________________________________________
Alsa-devel mailing list
[email protected]
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

author maintainer
#80 lore raw

PATCH 34/35 ASoC: Intel: Skylake: Merge skl_sst_ctx_init into skl_init_dsp

In reply to Cezary Rojewski

skl_init_dsp and skl_sst_ctx_init share the exact same purpose: trigger for sst_dsp creation. Merge them together. While adding code, change reorders certain blocks, so skl_dev instance is always initialized before sst_dsp_new cascade begins.

---
 sound/soc/intel/skylake/skl-messages.c  | 21 +++++++++++++++------
 sound/soc/intel/skylake/skl-sst-dsp.h   |  1 -
 sound/soc/intel/skylake/skl-sst-utils.c | 23 -----------------------
 3 files changed, 15 insertions(+), 30 deletions(-)
sound/soc/intel/skylake/skl-messages.c +15 -6
index 5f63c3052db9..7a161bbf8f26 100644
@@ -142,18 +142,27 @@ int skl_dsp_cleanup(struct device *dev,
 
 int skl_init_dsp(struct skl_dev *skl, struct sst_pdata *pdata)
 {
+	struct sst_dsp *dsp;
 	struct hdac_bus *bus = skl_to_bus(skl);
-	int ret;
+	struct device *dev = skl->dev;
 
 	/* enable ppcap interrupt */
 	snd_hdac_ext_bus_ppcap_enable(bus, true);
 	snd_hdac_ext_bus_ppcap_int_enable(bus, true);
 
-	ret = skl_sst_ctx_init(skl, pdata);
-	if (ret < 0)
-		return ret;
-
-	dev_dbg(bus->dev, "dsp registration status=%d\n", ret);
+	skl->is_first_boot = true;
+	INIT_LIST_HEAD(&skl->uuid_list);
+	init_waitqueue_head(&skl->mod_load_wait);
+
+	pdata->id = skl->pci->device;
+	pdata->irq = skl->pci->irq;
+	pdata->dma_base = -1;
+	pdata->dsp = skl;
+	dsp = sst_dsp_new(dev, pdata);
+	if (!dsp) {
+		dev_err(dev, "%s: no device\n", __func__);
+		return -ENODEV;
+	}
 
 	return 0;
 }
sound/soc/intel/skylake/skl-sst-dsp.h +0 -1
index 3294826d5cf7..eb8cc5606fc6 100644
@@ -221,7 +221,6 @@ int skl_dsp_strip_extended_manifest(struct firmware *fw);
 
 void skl_dsp_set_astate_cfg(struct skl_dev *skl, u32 cnt, void *data);
 
-int skl_sst_ctx_init(struct skl_dev *skl, struct sst_pdata *pdata);
 int skl_prepare_lib_load(struct skl_dev *skl, struct skl_lib_info *linfo,
 			struct firmware *stripped_fw,
 			unsigned int hdr_offset, int index);
sound/soc/intel/skylake/skl-sst-utils.c +0 -23
index ea5419012312..34ac21b85cd9 100644
@@ -354,29 +354,6 @@ int skl_dsp_strip_extended_manifest(struct firmware *fw)
 	return 0;
 }
 
-int skl_sst_ctx_init(struct skl_dev *skl, struct sst_pdata *pdata)
-{
-	struct sst_dsp *sst;
-	struct device *dev = skl->dev;
-
-	pdata->id = skl->pci->device;
-	pdata->irq = skl->pci->irq;
-	pdata->dma_base = -1;
-	pdata->dsp = skl;
-	INIT_LIST_HEAD(&skl->uuid_list);
-	sst = sst_dsp_new(dev, pdata);
-	if (!sst) {
-		dev_err(dev, "%s: no device\n", __func__);
-		return -ENODEV;
-	}
-
-	skl->dsp = sst;
-	init_waitqueue_head(&skl->mod_load_wait);
-	skl->is_first_boot = true;
-
-	return 0;
-}
-
 int skl_prepare_lib_load(struct skl_dev *skl, struct skl_lib_info *linfo,
 		struct firmware *stripped_fw,
 		unsigned int hdr_offset, int index)
Signature · 1 line
2.17.1
author maintainer
#81 lore raw

PATCH 35/35 ASoC: Intel: Remove obsolete firmware fields

In reply to Cezary Rojewski

FW filename fields are now deprecated in favour of ones coming from platform descriptors. This aligns with paradigm of FW being platform specific, not board specific.
Any remaining deprecated survivors of the precedding tidal wave are removed here too.

---
 sound/soc/intel/common/soc-acpi-intel-bxt-match.c    |  2 --
 sound/soc/intel/common/soc-acpi-intel-byt-match.c    |  2 --
 sound/soc/intel/common/soc-acpi-intel-cnl-match.c    |  1 -
 sound/soc/intel/common/soc-acpi-intel-glk-match.c    |  3 ---
 sound/soc/intel/common/soc-acpi-intel-hda-match.c    |  2 --
 .../soc/intel/common/soc-acpi-intel-hsw-bdw-match.c  |  4 ----
 sound/soc/intel/common/soc-acpi-intel-icl-match.c    |  1 -
 sound/soc/intel/common/soc-acpi-intel-kbl-match.c    | 12 ------------
 sound/soc/intel/common/soc-acpi-intel-skl-match.c    |  3 ---
 sound/soc/intel/common/sst-dsp-priv.h                |  1 -
 sound/soc/intel/skylake/skl.h                        |  1 -
 11 files changed, 32 deletions(-)
sound/soc/intel/common/soc-acpi-intel-bxt-match.c +0 -2
index 4a5adae1d785..eda799e49113 100644
@@ -50,14 +50,12 @@ struct snd_soc_acpi_mach snd_soc_acpi_intel_bxt_machines[] = {
 	{
 		.id = "INT343A",
 		.drv_name = "bxt_alc298s_i2s",
-		.fw_filename = "intel/dsp_fw_bxtn.bin",
 		.sof_fw_filename = "sof-apl.ri",
 		.sof_tplg_filename = "sof-apl-rt298.tplg",
 	},
 	{
 		.id = "DLGS7219",
 		.drv_name = "bxt_da7219_max98357a",
-		.fw_filename = "intel/dsp_fw_bxtn.bin",
 		.machine_quirk = snd_soc_acpi_codec_list,
 		.quirk_data = &bxt_codecs,
 		.sof_fw_filename = "sof-apl.ri",
sound/soc/intel/common/soc-acpi-intel-byt-match.c +0 -2
index 1cc801ba92eb..4d2ba663ee33 100644
@@ -124,12 +124,10 @@ struct snd_soc_acpi_mach snd_soc_acpi_intel_baytrail_legacy_machines[] = {
 	{
 		.id = "10EC5640",
 		.drv_name = "byt-rt5640",
-		.fw_filename = "intel/fw_sst_0f28.bin-48kHz_i2s_master",
 	},
 	{
 		.id = "193C9890",
 		.drv_name = "byt-max98090",
-		.fw_filename = "intel/fw_sst_0f28.bin-48kHz_i2s_master",
 	},
 	{}
 };
sound/soc/intel/common/soc-acpi-intel-cnl-match.c +0 -1
index 771b0ef21051..edc44a0dc96f 100644
@@ -23,7 +23,6 @@ struct snd_soc_acpi_mach snd_soc_acpi_intel_cnl_machines[] = {
 	{
 		.id = "INT34C2",
 		.drv_name = "cnl_rt274",
-		.fw_filename = "intel/dsp_fw_cnl.bin",
 		.pdata = &cnl_pdata,
 		.sof_fw_filename = "sof-cnl.ri",
 		.sof_tplg_filename = "sof-cnl-rt274.tplg",
sound/soc/intel/common/soc-acpi-intel-glk-match.c +0 -3
index 60dea358fa04..370487d13c85 100644
@@ -18,14 +18,12 @@ struct snd_soc_acpi_mach snd_soc_acpi_intel_glk_machines[] = {
 	{
 		.id = "INT343A",
 		.drv_name = "glk_alc298s_i2s",
-		.fw_filename = "intel/dsp_fw_glk.bin",
 		.sof_fw_filename = "sof-glk.ri",
 		.sof_tplg_filename = "sof-glk-alc298.tplg",
 	},
 	{
 		.id = "DLGS7219",
 		.drv_name = "glk_da7219_max98357a",
-		.fw_filename = "intel/dsp_fw_glk.bin",
 		.machine_quirk = snd_soc_acpi_codec_list,
 		.quirk_data = &glk_codecs,
 		.sof_fw_filename = "sof-glk.ri",
@@ -34,7 +32,6 @@ struct snd_soc_acpi_mach snd_soc_acpi_intel_glk_machines[] = {
 	{
 		.id = "10EC5682",
 		.drv_name = "glk_rt5682_max98357a",
-		.fw_filename = "intel/dsp_fw_glk.bin",
 		.machine_quirk = snd_soc_acpi_codec_list,
 		.quirk_data = &glk_codecs,
 		.sof_fw_filename = "sof-glk.ri",
sound/soc/intel/common/soc-acpi-intel-hda-match.c +0 -2
index cc972d2ac691..39827d2e8634 100644
@@ -19,8 +19,6 @@ struct snd_soc_acpi_mach snd_soc_acpi_intel_hda_machines[] = {
 		/* .id is not used in this file */
 		.drv_name = "skl_hda_dsp_generic",
 
-		/* .fw_filename is dynamically set in skylake driver */
-
 		/* .sof_fw_filename is dynamically set in sof/intel driver */
 
 		.sof_tplg_filename = "sof-hda-generic.tplg",
sound/soc/intel/common/soc-acpi-intel-hsw-bdw-match.c +0 -4
index 34eb0baaa951..6b113c32aff0 100644
@@ -13,7 +13,6 @@ struct snd_soc_acpi_mach snd_soc_acpi_intel_haswell_machines[] = {
 	{
 		.id = "INT33CA",
 		.drv_name = "haswell-audio",
-		.fw_filename = "intel/IntcSST1.bin",
 		.sof_fw_filename = "sof-hsw.ri",
 		.sof_tplg_filename = "sof-hsw.tplg",
 	},
@@ -25,21 +24,18 @@ struct snd_soc_acpi_mach snd_soc_acpi_intel_broadwell_machines[] = {
 	{
 		.id = "INT343A",
 		.drv_name = "broadwell-audio",
-		.fw_filename =  "intel/IntcSST2.bin",
 		.sof_fw_filename = "sof-bdw.ri",
 		.sof_tplg_filename = "sof-bdw-rt286.tplg",
 	},
 	{
 		.id = "RT5677CE",
 		.drv_name = "bdw-rt5677",
-		.fw_filename =  "intel/IntcSST2.bin",
 		.sof_fw_filename = "sof-bdw.ri",
 		.sof_tplg_filename = "sof-bdw-rt5677.tplg",
 	},
 	{
 		.id = "INT33CA",
 		.drv_name = "haswell-audio",
-		.fw_filename = "intel/IntcSST2.bin",
 		.sof_fw_filename = "sof-bdw.ri",
 		.sof_tplg_filename = "sof-bdw-rt5640.tplg",
 	},
sound/soc/intel/common/soc-acpi-intel-icl-match.c +0 -1
index 38977669b576..04a17da96f6a 100644
@@ -18,7 +18,6 @@ struct snd_soc_acpi_mach snd_soc_acpi_intel_icl_machines[] = {
 	{
 		.id = "INT34C2",
 		.drv_name = "icl_rt274",
-		.fw_filename = "intel/dsp_fw_icl.bin",
 		.pdata = &icl_pdata,
 		.sof_fw_filename = "sof-icl.ri",
 		.sof_tplg_filename = "sof-icl-rt274.tplg",
sound/soc/intel/common/soc-acpi-intel-kbl-match.c +0 -12
index e200baa11011..fe82d5472aa3 100644
@@ -46,12 +46,10 @@ struct snd_soc_acpi_mach snd_soc_acpi_intel_kbl_machines[] = {
 	{
 		.id = "INT343A",
 		.drv_name = "kbl_alc286s_i2s",
-		.fw_filename = "intel/dsp_fw_kbl.bin",
 	},
 	{
 		.id = "INT343B",
 		.drv_name = "kbl_n88l25_s4567",
-		.fw_filename = "intel/dsp_fw_kbl.bin",
 		.machine_quirk = snd_soc_acpi_codec_list,
 		.quirk_data = &kbl_codecs,
 		.pdata = &skl_dmic_data,
@@ -59,7 +57,6 @@ struct snd_soc_acpi_mach snd_soc_acpi_intel_kbl_machines[] = {
 	{
 		.id = "MX98357A",
 		.drv_name = "kbl_n88l25_m98357a",
-		.fw_filename = "intel/dsp_fw_kbl.bin",
 		.machine_quirk = snd_soc_acpi_codec_list,
 		.quirk_data = &kbl_codecs,
 		.pdata = &skl_dmic_data,
@@ -67,7 +64,6 @@ struct snd_soc_acpi_mach snd_soc_acpi_intel_kbl_machines[] = {
 	{
 		.id = "MX98927",
 		.drv_name = "kbl_r5514_5663_max",
-		.fw_filename = "intel/dsp_fw_kbl.bin",
 		.machine_quirk = snd_soc_acpi_codec_list,
 		.quirk_data = &kbl_5663_5514_codecs,
 		.pdata = &skl_dmic_data,
@@ -75,7 +71,6 @@ struct snd_soc_acpi_mach snd_soc_acpi_intel_kbl_machines[] = {
 	{
 		.id = "MX98927",
 		.drv_name = "kbl_rt5663_m98927",
-		.fw_filename = "intel/dsp_fw_kbl.bin",
 		.machine_quirk = snd_soc_acpi_codec_list,
 		.quirk_data = &kbl_poppy_codecs,
 		.pdata = &skl_dmic_data,
@@ -83,12 +78,10 @@ struct snd_soc_acpi_mach snd_soc_acpi_intel_kbl_machines[] = {
 	{
 		.id = "10EC5663",
 		.drv_name = "kbl_rt5663",
-		.fw_filename = "intel/dsp_fw_kbl.bin",
 	},
 	{
 		.id = "DLGS7219",
 		.drv_name = "kbl_da7219_max98357a",
-		.fw_filename = "intel/dsp_fw_kbl.bin",
 		.machine_quirk = snd_soc_acpi_codec_list,
 		.quirk_data = &kbl_7219_98357_codecs,
 		.pdata = &skl_dmic_data,
@@ -96,7 +89,6 @@ struct snd_soc_acpi_mach snd_soc_acpi_intel_kbl_machines[] = {
 	{
 		.id = "DLGS7219",
 		.drv_name = "kbl_da7219_max98927",
-		.fw_filename = "intel/dsp_fw_kbl.bin",
 		.machine_quirk = snd_soc_acpi_codec_list,
 		.quirk_data = &kbl_7219_98927_codecs,
 		.pdata = &skl_dmic_data
@@ -104,17 +96,14 @@ struct snd_soc_acpi_mach snd_soc_acpi_intel_kbl_machines[] = {
 	{
 		.id = "10EC5660",
 		.drv_name = "kbl_rt5660",
-		.fw_filename = "intel/dsp_fw_kbl.bin",
 	},
 	{
 		.id = "10EC3277",
 		.drv_name = "kbl_rt5660",
-		.fw_filename = "intel/dsp_fw_kbl.bin",
 	},
 	{
 		.id = "DLGS7219",
 		.drv_name = "kbl_da7219_max98373",
-		.fw_filename = "intel/dsp_fw_kbl.bin",
 		.machine_quirk = snd_soc_acpi_codec_list,
 		.quirk_data = &kbl_7219_98373_codecs,
 		.pdata = &skl_dmic_data
@@ -122,7 +111,6 @@ struct snd_soc_acpi_mach snd_soc_acpi_intel_kbl_machines[] = {
 	{
 		.id = "MX98373",
 		.drv_name = "kbl_max98373",
-		.fw_filename = "intel/dsp_fw_kbl.bin",
 		.pdata = &skl_dmic_data
 	},
 	{},
sound/soc/intel/common/soc-acpi-intel-skl-match.c +0 -3
index 42fa40a8d932..ec969044706c 100644
@@ -21,12 +21,10 @@ struct snd_soc_acpi_mach snd_soc_acpi_intel_skl_machines[] = {
 	{
 		.id = "INT343A",
 		.drv_name = "skl_alc286s_i2s",
-		.fw_filename = "intel/dsp_fw_release.bin",
 	},
 	{
 		.id = "INT343B",
 		.drv_name = "skl_n88l25_s4567",
-		.fw_filename = "intel/dsp_fw_release.bin",
 		.machine_quirk = snd_soc_acpi_codec_list,
 		.quirk_data = &skl_codecs,
 		.pdata = &skl_dmic_data,
@@ -34,7 +32,6 @@ struct snd_soc_acpi_mach snd_soc_acpi_intel_skl_machines[] = {
 	{
 		.id = "MX98357A",
 		.drv_name = "skl_n88l25_m98357a",
-		.fw_filename = "intel/dsp_fw_release.bin",
 		.machine_quirk = snd_soc_acpi_codec_list,
 		.quirk_data = &skl_codecs,
 		.pdata = &skl_dmic_data,
sound/soc/intel/common/sst-dsp-priv.h +0 -1
index a4628a89d47d..1a208ef65fa8 100644
@@ -306,7 +306,6 @@ struct sst_dsp {
 	int sst_state;
 	struct skl_cl_dev cl_dev;
 	u32 intr_status;
-	const struct firmware *fw;
 	struct snd_dma_buffer dmab;
 };
 
sound/soc/intel/skylake/skl.h +0 -1
index 218e8bda6cae..7b283c2bb7b5 100644
@@ -76,7 +76,6 @@ struct skl_dev {
 	struct list_head ppl_list;
 	struct list_head bind_list;
 
-	const char *fw_name;
 	char tplg_name[64];
 	unsigned short pci_id;
 	const struct firmware *tplg;
Signature · 1 line
2.17.1
#82 lore raw

Re: [PATCH 35/35] ASoC: Intel: Remove obsolete firmware fields

Quoted 3 lines · Cezary Rojewski

FW filename fields are now deprecated in favour of ones coming from platform descriptors. This aligns with paradigm of FW being platform specific, not board specific.

I don't agree here. The paradigm does not survive reality where we have different versions of firmware for the same platform. This is not the product of my imagination, the ULL story proves my point.

NAK.

Quoted 290 lines

Any remaining deprecated survivors of the precedding tidal wave are removed here too.

---
  sound/soc/intel/common/soc-acpi-intel-bxt-match.c    |  2 --
  sound/soc/intel/common/soc-acpi-intel-byt-match.c    |  2 --
  sound/soc/intel/common/soc-acpi-intel-cnl-match.c    |  1 -
  sound/soc/intel/common/soc-acpi-intel-glk-match.c    |  3 ---
  sound/soc/intel/common/soc-acpi-intel-hda-match.c    |  2 --
  .../soc/intel/common/soc-acpi-intel-hsw-bdw-match.c  |  4 ----
  sound/soc/intel/common/soc-acpi-intel-icl-match.c    |  1 -
  sound/soc/intel/common/soc-acpi-intel-kbl-match.c    | 12 ------------
  sound/soc/intel/common/soc-acpi-intel-skl-match.c    |  3 ---
  sound/soc/intel/common/sst-dsp-priv.h                |  1 -
  sound/soc/intel/skylake/skl.h                        |  1 -
  11 files changed, 32 deletions(-)
sound/soc/intel/common/soc-acpi-intel-bxt-match.c +0 -2
index 4a5adae1d785..eda799e49113 100644
@@ -50,14 +50,12 @@ struct snd_soc_acpi_mach snd_soc_acpi_intel_bxt_machines[] = {
  	{
  		.id = "INT343A",
  		.drv_name = "bxt_alc298s_i2s",
-		.fw_filename = "intel/dsp_fw_bxtn.bin",
  		.sof_fw_filename = "sof-apl.ri",
  		.sof_tplg_filename = "sof-apl-rt298.tplg",
  	},
  	{
  		.id = "DLGS7219",
  		.drv_name = "bxt_da7219_max98357a",
-		.fw_filename = "intel/dsp_fw_bxtn.bin",
  		.machine_quirk = snd_soc_acpi_codec_list,
  		.quirk_data = &bxt_codecs,
  		.sof_fw_filename = "sof-apl.ri",
sound/soc/intel/common/soc-acpi-intel-byt-match.c +0 -2
index 1cc801ba92eb..4d2ba663ee33 100644
@@ -124,12 +124,10 @@ struct snd_soc_acpi_mach snd_soc_acpi_intel_baytrail_legacy_machines[] = {
  	{
  		.id = "10EC5640",
  		.drv_name = "byt-rt5640",
-		.fw_filename = "intel/fw_sst_0f28.bin-48kHz_i2s_master",
  	},
  	{
  		.id = "193C9890",
  		.drv_name = "byt-max98090",
-		.fw_filename = "intel/fw_sst_0f28.bin-48kHz_i2s_master",
  	},
  	{}
  };
sound/soc/intel/common/soc-acpi-intel-cnl-match.c +0 -1
index 771b0ef21051..edc44a0dc96f 100644
@@ -23,7 +23,6 @@ struct snd_soc_acpi_mach snd_soc_acpi_intel_cnl_machines[] = {
  	{
  		.id = "INT34C2",
  		.drv_name = "cnl_rt274",
-		.fw_filename = "intel/dsp_fw_cnl.bin",
  		.pdata = &cnl_pdata,
  		.sof_fw_filename = "sof-cnl.ri",
  		.sof_tplg_filename = "sof-cnl-rt274.tplg",
sound/soc/intel/common/soc-acpi-intel-glk-match.c +0 -3
index 60dea358fa04..370487d13c85 100644
@@ -18,14 +18,12 @@ struct snd_soc_acpi_mach snd_soc_acpi_intel_glk_machines[] = {
  	{
  		.id = "INT343A",
  		.drv_name = "glk_alc298s_i2s",
-		.fw_filename = "intel/dsp_fw_glk.bin",
  		.sof_fw_filename = "sof-glk.ri",
  		.sof_tplg_filename = "sof-glk-alc298.tplg",
  	},
  	{
  		.id = "DLGS7219",
  		.drv_name = "glk_da7219_max98357a",
-		.fw_filename = "intel/dsp_fw_glk.bin",
  		.machine_quirk = snd_soc_acpi_codec_list,
  		.quirk_data = &glk_codecs,
  		.sof_fw_filename = "sof-glk.ri",
@@ -34,7 +32,6 @@ struct snd_soc_acpi_mach snd_soc_acpi_intel_glk_machines[] = {
  	{
  		.id = "10EC5682",
  		.drv_name = "glk_rt5682_max98357a",
-		.fw_filename = "intel/dsp_fw_glk.bin",
  		.machine_quirk = snd_soc_acpi_codec_list,
  		.quirk_data = &glk_codecs,
  		.sof_fw_filename = "sof-glk.ri",
sound/soc/intel/common/soc-acpi-intel-hda-match.c +0 -2
index cc972d2ac691..39827d2e8634 100644
@@ -19,8 +19,6 @@ struct snd_soc_acpi_mach snd_soc_acpi_intel_hda_machines[] = {
  		/* .id is not used in this file */
  		.drv_name = "skl_hda_dsp_generic",
 
-		/* .fw_filename is dynamically set in skylake driver */
-
  		/* .sof_fw_filename is dynamically set in sof/intel driver */
 
  		.sof_tplg_filename = "sof-hda-generic.tplg",
sound/soc/intel/common/soc-acpi-intel-hsw-bdw-match.c +0 -4
index 34eb0baaa951..6b113c32aff0 100644
@@ -13,7 +13,6 @@ struct snd_soc_acpi_mach snd_soc_acpi_intel_haswell_machines[] = {
  	{
  		.id = "INT33CA",
  		.drv_name = "haswell-audio",
-		.fw_filename = "intel/IntcSST1.bin",
  		.sof_fw_filename = "sof-hsw.ri",
  		.sof_tplg_filename = "sof-hsw.tplg",
  	},
@@ -25,21 +24,18 @@ struct snd_soc_acpi_mach snd_soc_acpi_intel_broadwell_machines[] = {
  	{
  		.id = "INT343A",
  		.drv_name = "broadwell-audio",
-		.fw_filename =  "intel/IntcSST2.bin",
  		.sof_fw_filename = "sof-bdw.ri",
  		.sof_tplg_filename = "sof-bdw-rt286.tplg",
  	},
  	{
  		.id = "RT5677CE",
  		.drv_name = "bdw-rt5677",
-		.fw_filename =  "intel/IntcSST2.bin",
  		.sof_fw_filename = "sof-bdw.ri",
  		.sof_tplg_filename = "sof-bdw-rt5677.tplg",
  	},
  	{
  		.id = "INT33CA",
  		.drv_name = "haswell-audio",
-		.fw_filename = "intel/IntcSST2.bin",
  		.sof_fw_filename = "sof-bdw.ri",
  		.sof_tplg_filename = "sof-bdw-rt5640.tplg",
  	},
sound/soc/intel/common/soc-acpi-intel-icl-match.c +0 -1
index 38977669b576..04a17da96f6a 100644
@@ -18,7 +18,6 @@ struct snd_soc_acpi_mach snd_soc_acpi_intel_icl_machines[] = {
  	{
  		.id = "INT34C2",
  		.drv_name = "icl_rt274",
-		.fw_filename = "intel/dsp_fw_icl.bin",
  		.pdata = &icl_pdata,
  		.sof_fw_filename = "sof-icl.ri",
  		.sof_tplg_filename = "sof-icl-rt274.tplg",
sound/soc/intel/common/soc-acpi-intel-kbl-match.c +0 -12
index e200baa11011..fe82d5472aa3 100644
@@ -46,12 +46,10 @@ struct snd_soc_acpi_mach snd_soc_acpi_intel_kbl_machines[] = {
  	{
  		.id = "INT343A",
  		.drv_name = "kbl_alc286s_i2s",
-		.fw_filename = "intel/dsp_fw_kbl.bin",
  	},
  	{
  		.id = "INT343B",
  		.drv_name = "kbl_n88l25_s4567",
-		.fw_filename = "intel/dsp_fw_kbl.bin",
  		.machine_quirk = snd_soc_acpi_codec_list,
  		.quirk_data = &kbl_codecs,
  		.pdata = &skl_dmic_data,
@@ -59,7 +57,6 @@ struct snd_soc_acpi_mach snd_soc_acpi_intel_kbl_machines[] = {
  	{
  		.id = "MX98357A",
  		.drv_name = "kbl_n88l25_m98357a",
-		.fw_filename = "intel/dsp_fw_kbl.bin",
  		.machine_quirk = snd_soc_acpi_codec_list,
  		.quirk_data = &kbl_codecs,
  		.pdata = &skl_dmic_data,
@@ -67,7 +64,6 @@ struct snd_soc_acpi_mach snd_soc_acpi_intel_kbl_machines[] = {
  	{
  		.id = "MX98927",
  		.drv_name = "kbl_r5514_5663_max",
-		.fw_filename = "intel/dsp_fw_kbl.bin",
  		.machine_quirk = snd_soc_acpi_codec_list,
  		.quirk_data = &kbl_5663_5514_codecs,
  		.pdata = &skl_dmic_data,
@@ -75,7 +71,6 @@ struct snd_soc_acpi_mach snd_soc_acpi_intel_kbl_machines[] = {
  	{
  		.id = "MX98927",
  		.drv_name = "kbl_rt5663_m98927",
-		.fw_filename = "intel/dsp_fw_kbl.bin",
  		.machine_quirk = snd_soc_acpi_codec_list,
  		.quirk_data = &kbl_poppy_codecs,
  		.pdata = &skl_dmic_data,
@@ -83,12 +78,10 @@ struct snd_soc_acpi_mach snd_soc_acpi_intel_kbl_machines[] = {
  	{
  		.id = "10EC5663",
  		.drv_name = "kbl_rt5663",
-		.fw_filename = "intel/dsp_fw_kbl.bin",
  	},
  	{
  		.id = "DLGS7219",
  		.drv_name = "kbl_da7219_max98357a",
-		.fw_filename = "intel/dsp_fw_kbl.bin",
  		.machine_quirk = snd_soc_acpi_codec_list,
  		.quirk_data = &kbl_7219_98357_codecs,
  		.pdata = &skl_dmic_data,
@@ -96,7 +89,6 @@ struct snd_soc_acpi_mach snd_soc_acpi_intel_kbl_machines[] = {
  	{
  		.id = "DLGS7219",
  		.drv_name = "kbl_da7219_max98927",
-		.fw_filename = "intel/dsp_fw_kbl.bin",
  		.machine_quirk = snd_soc_acpi_codec_list,
  		.quirk_data = &kbl_7219_98927_codecs,
  		.pdata = &skl_dmic_data
@@ -104,17 +96,14 @@ struct snd_soc_acpi_mach snd_soc_acpi_intel_kbl_machines[] = {
  	{
  		.id = "10EC5660",
  		.drv_name = "kbl_rt5660",
-		.fw_filename = "intel/dsp_fw_kbl.bin",
  	},
  	{
  		.id = "10EC3277",
  		.drv_name = "kbl_rt5660",
-		.fw_filename = "intel/dsp_fw_kbl.bin",
  	},
  	{
  		.id = "DLGS7219",
  		.drv_name = "kbl_da7219_max98373",
-		.fw_filename = "intel/dsp_fw_kbl.bin",
  		.machine_quirk = snd_soc_acpi_codec_list,
  		.quirk_data = &kbl_7219_98373_codecs,
  		.pdata = &skl_dmic_data
@@ -122,7 +111,6 @@ struct snd_soc_acpi_mach snd_soc_acpi_intel_kbl_machines[] = {
  	{
  		.id = "MX98373",
  		.drv_name = "kbl_max98373",
-		.fw_filename = "intel/dsp_fw_kbl.bin",
  		.pdata = &skl_dmic_data
  	},
  	{},
sound/soc/intel/common/soc-acpi-intel-skl-match.c +0 -3
index 42fa40a8d932..ec969044706c 100644
@@ -21,12 +21,10 @@ struct snd_soc_acpi_mach snd_soc_acpi_intel_skl_machines[] = {
  	{
  		.id = "INT343A",
  		.drv_name = "skl_alc286s_i2s",
-		.fw_filename = "intel/dsp_fw_release.bin",
  	},
  	{
  		.id = "INT343B",
  		.drv_name = "skl_n88l25_s4567",
-		.fw_filename = "intel/dsp_fw_release.bin",
  		.machine_quirk = snd_soc_acpi_codec_list,
  		.quirk_data = &skl_codecs,
  		.pdata = &skl_dmic_data,
@@ -34,7 +32,6 @@ struct snd_soc_acpi_mach snd_soc_acpi_intel_skl_machines[] = {
  	{
  		.id = "MX98357A",
  		.drv_name = "skl_n88l25_m98357a",
-		.fw_filename = "intel/dsp_fw_release.bin",
  		.machine_quirk = snd_soc_acpi_codec_list,
  		.quirk_data = &skl_codecs,
  		.pdata = &skl_dmic_data,
sound/soc/intel/common/sst-dsp-priv.h +0 -1
index a4628a89d47d..1a208ef65fa8 100644
@@ -306,7 +306,6 @@ struct sst_dsp {
  	int sst_state;
  	struct skl_cl_dev cl_dev;
  	u32 intr_status;
-	const struct firmware *fw;
  	struct snd_dma_buffer dmab;
  };
 
sound/soc/intel/skylake/skl.h +0 -1
index 218e8bda6cae..7b283c2bb7b5 100644
@@ -76,7 +76,6 @@ struct skl_dev {
  	struct list_head ppl_list;
  	struct list_head bind_list;
 
-	const char *fw_name;
  	char tplg_name[64];
  	unsigned short pci_id;
  	const struct firmware *tplg;
author maintainer
#83 lore raw

Re: [PATCH 35/35] ASoC: Intel: Remove obsolete firmware fields

Quoted 11 lines · Pierre-Louis Bossart
Quoted 3 lines · Cezary Rojewski

FW filename fields are now deprecated in favour of ones coming from platform descriptors. This aligns with paradigm of FW being platform specific, not board specific.

I don't agree here. The paradigm does not survive reality where we have different versions of firmware for the same platform. This is not the product of my imagination, the ULL story proves my point.

NAK.

And so ULL case has been explained in PATCH 27/35 as existing case does not survive real-life example either.

Quoted 297 lines
Quoted 297 lines

Any remaining deprecated survivors of the precedding tidal wave are removed here too.

---

  sound/soc/intel/common/soc-acpi-intel-bxt-match.c    |  2 --
  sound/soc/intel/common/soc-acpi-intel-byt-match.c    |  2 --
  sound/soc/intel/common/soc-acpi-intel-cnl-match.c    |  1 -
  sound/soc/intel/common/soc-acpi-intel-glk-match.c    |  3 ---
  sound/soc/intel/common/soc-acpi-intel-hda-match.c    |  2 --
  .../soc/intel/common/soc-acpi-intel-hsw-bdw-match.c  |  4 ----
  sound/soc/intel/common/soc-acpi-intel-icl-match.c    |  1 -
  sound/soc/intel/common/soc-acpi-intel-kbl-match.c    | 12 ------------
  sound/soc/intel/common/soc-acpi-intel-skl-match.c    |  3 ---
  sound/soc/intel/common/sst-dsp-priv.h                |  1 -
  sound/soc/intel/skylake/skl.h                        |  1 -
  11 files changed, 32 deletions(-)
sound/soc/intel/common/soc-acpi-intel-bxt-match.c +0 -2
index 4a5adae1d785..eda799e49113 100644
@@ -50,14 +50,12 @@ struct snd_soc_acpi_mach 
 snd_soc_acpi_intel_bxt_machines[] = {
       {
           .id = "INT343A",
           .drv_name = "bxt_alc298s_i2s",
-        .fw_filename = "intel/dsp_fw_bxtn.bin",
           .sof_fw_filename = "sof-apl.ri",
           .sof_tplg_filename = "sof-apl-rt298.tplg",
       },
       {
           .id = "DLGS7219",
           .drv_name = "bxt_da7219_max98357a",
-        .fw_filename = "intel/dsp_fw_bxtn.bin",
           .machine_quirk = snd_soc_acpi_codec_list,
           .quirk_data = &bxt_codecs,

          .sof_fw_filename = "sof-apl.ri",

sound/soc/intel/common/soc-acpi-intel-byt-match.c +0 -2
index 1cc801ba92eb..4d2ba663ee33 100644
@@ -124,12 +124,10 @@ struct snd_soc_acpi_mach 
 snd_soc_acpi_intel_baytrail_legacy_machines[] = {
       {
           .id = "10EC5640",
           .drv_name = "byt-rt5640",
-        .fw_filename = "intel/fw_sst_0f28.bin-48kHz_i2s_master",
       },
       {
           .id = "193C9890",
           .drv_name = "byt-max98090",
-        .fw_filename = "intel/fw_sst_0f28.bin-48kHz_i2s_master",
       },
       {}

  };

sound/soc/intel/common/soc-acpi-intel-cnl-match.c +0 -1
index 771b0ef21051..edc44a0dc96f 100644
@@ -23,7 +23,6 @@ struct snd_soc_acpi_mach 
 snd_soc_acpi_intel_cnl_machines[] = {
       {
           .id = "INT34C2",
           .drv_name = "cnl_rt274",
-        .fw_filename = "intel/dsp_fw_cnl.bin",
           .pdata = &cnl_pdata,
           .sof_fw_filename = "sof-cnl.ri",

          .sof_tplg_filename = "sof-cnl-rt274.tplg",

sound/soc/intel/common/soc-acpi-intel-glk-match.c +0 -2
index 60dea358fa04..370487d13c85 100644
@@ -18,14 +18,12 @@ struct snd_soc_acpi_mach 
 snd_soc_acpi_intel_glk_machines[] = {
       {
           .id = "INT343A",
           .drv_name = "glk_alc298s_i2s",
-        .fw_filename = "intel/dsp_fw_glk.bin",
           .sof_fw_filename = "sof-glk.ri",
           .sof_tplg_filename = "sof-glk-alc298.tplg",
       },
       {
           .id = "DLGS7219",
           .drv_name = "glk_da7219_max98357a",
-        .fw_filename = "intel/dsp_fw_glk.bin",
           .machine_quirk = snd_soc_acpi_codec_list,
           .quirk_data = &glk_codecs,

          .sof_fw_filename = "sof-glk.ri",

sound/soc/intel/common/soc-acpi-intel-glk-match.c +0 -1
@@ -34,7 +32,6 @@ struct snd_soc_acpi_mach 
 snd_soc_acpi_intel_glk_machines[] = {
       {
           .id = "10EC5682",
           .drv_name = "glk_rt5682_max98357a",
-        .fw_filename = "intel/dsp_fw_glk.bin",
           .machine_quirk = snd_soc_acpi_codec_list,
           .quirk_data = &glk_codecs,

          .sof_fw_filename = "sof-glk.ri",

sound/soc/intel/common/soc-acpi-intel-hda-match.c +0 -2
index cc972d2ac691..39827d2e8634 100644
@@ -19,8 +19,6 @@ struct snd_soc_acpi_mach 
 snd_soc_acpi_intel_hda_machines[] = {
           /* .id is not used in this file */
           .drv_name = "skl_hda_dsp_generic",
-        /* .fw_filename is dynamically set in skylake driver */
-
           /* .sof_fw_filename is dynamically set in sof/intel driver */
           .sof_tplg_filename = "sof-hda-generic.tplg",
sound/soc/intel/common/soc-acpi-intel-hsw-bdw-match.c +0 -1
index 34eb0baaa951..6b113c32aff0 100644
@@ -13,7 +13,6 @@ struct snd_soc_acpi_mach 
 snd_soc_acpi_intel_haswell_machines[] = {
       {
           .id = "INT33CA",
           .drv_name = "haswell-audio",
-        .fw_filename = "intel/IntcSST1.bin",
           .sof_fw_filename = "sof-hsw.ri",
           .sof_tplg_filename = "sof-hsw.tplg",

      },

sound/soc/intel/common/soc-acpi-intel-hsw-bdw-match.c +0 -3
@@ -25,21 +24,18 @@ struct snd_soc_acpi_mach 
 snd_soc_acpi_intel_broadwell_machines[] = {
       {
           .id = "INT343A",
           .drv_name = "broadwell-audio",
-        .fw_filename =  "intel/IntcSST2.bin",
           .sof_fw_filename = "sof-bdw.ri",
           .sof_tplg_filename = "sof-bdw-rt286.tplg",
       },
       {
           .id = "RT5677CE",
           .drv_name = "bdw-rt5677",
-        .fw_filename =  "intel/IntcSST2.bin",
           .sof_fw_filename = "sof-bdw.ri",
           .sof_tplg_filename = "sof-bdw-rt5677.tplg",
       },
       {
           .id = "INT33CA",
           .drv_name = "haswell-audio",
-        .fw_filename = "intel/IntcSST2.bin",
           .sof_fw_filename = "sof-bdw.ri",
           .sof_tplg_filename = "sof-bdw-rt5640.tplg",

      },

sound/soc/intel/common/soc-acpi-intel-icl-match.c +0 -1
index 38977669b576..04a17da96f6a 100644
@@ -18,7 +18,6 @@ struct snd_soc_acpi_mach 
 snd_soc_acpi_intel_icl_machines[] = {
       {
           .id = "INT34C2",
           .drv_name = "icl_rt274",
-        .fw_filename = "intel/dsp_fw_icl.bin",
           .pdata = &icl_pdata,
           .sof_fw_filename = "sof-icl.ri",

          .sof_tplg_filename = "sof-icl-rt274.tplg",

sound/soc/intel/common/soc-acpi-intel-kbl-match.c +0 -2
index e200baa11011..fe82d5472aa3 100644
@@ -46,12 +46,10 @@ struct snd_soc_acpi_mach 
 snd_soc_acpi_intel_kbl_machines[] = {
       {
           .id = "INT343A",
           .drv_name = "kbl_alc286s_i2s",
-        .fw_filename = "intel/dsp_fw_kbl.bin",
       },
       {
           .id = "INT343B",
           .drv_name = "kbl_n88l25_s4567",
-        .fw_filename = "intel/dsp_fw_kbl.bin",
           .machine_quirk = snd_soc_acpi_codec_list,
           .quirk_data = &kbl_codecs,

          .pdata = &skl_dmic_data,

sound/soc/intel/common/soc-acpi-intel-kbl-match.c +0 -1
@@ -59,7 +57,6 @@ struct snd_soc_acpi_mach 
 snd_soc_acpi_intel_kbl_machines[] = {
       {
           .id = "MX98357A",
           .drv_name = "kbl_n88l25_m98357a",
-        .fw_filename = "intel/dsp_fw_kbl.bin",
           .machine_quirk = snd_soc_acpi_codec_list,
           .quirk_data = &kbl_codecs,

          .pdata = &skl_dmic_data,

sound/soc/intel/common/soc-acpi-intel-kbl-match.c +0 -1
@@ -67,7 +64,6 @@ struct snd_soc_acpi_mach 
 snd_soc_acpi_intel_kbl_machines[] = {
       {
           .id = "MX98927",
           .drv_name = "kbl_r5514_5663_max",
-        .fw_filename = "intel/dsp_fw_kbl.bin",
           .machine_quirk = snd_soc_acpi_codec_list,
           .quirk_data = &kbl_5663_5514_codecs,

          .pdata = &skl_dmic_data,

sound/soc/intel/common/soc-acpi-intel-kbl-match.c +0 -1
@@ -75,7 +71,6 @@ struct snd_soc_acpi_mach 
 snd_soc_acpi_intel_kbl_machines[] = {
       {
           .id = "MX98927",
           .drv_name = "kbl_rt5663_m98927",
-        .fw_filename = "intel/dsp_fw_kbl.bin",
           .machine_quirk = snd_soc_acpi_codec_list,
           .quirk_data = &kbl_poppy_codecs,

          .pdata = &skl_dmic_data,

sound/soc/intel/common/soc-acpi-intel-kbl-match.c +0 -2
@@ -83,12 +78,10 @@ struct snd_soc_acpi_mach 
 snd_soc_acpi_intel_kbl_machines[] = {
       {
           .id = "10EC5663",
           .drv_name = "kbl_rt5663",
-        .fw_filename = "intel/dsp_fw_kbl.bin",
       },
       {
           .id = "DLGS7219",
           .drv_name = "kbl_da7219_max98357a",
-        .fw_filename = "intel/dsp_fw_kbl.bin",
           .machine_quirk = snd_soc_acpi_codec_list,
           .quirk_data = &kbl_7219_98357_codecs,

          .pdata = &skl_dmic_data,

sound/soc/intel/common/soc-acpi-intel-kbl-match.c +0 -1
@@ -96,7 +89,6 @@ struct snd_soc_acpi_mach 
 snd_soc_acpi_intel_kbl_machines[] = {
       {
           .id = "DLGS7219",
           .drv_name = "kbl_da7219_max98927",
-        .fw_filename = "intel/dsp_fw_kbl.bin",
           .machine_quirk = snd_soc_acpi_codec_list,
           .quirk_data = &kbl_7219_98927_codecs,

          .pdata = &skl_dmic_data

sound/soc/intel/common/soc-acpi-intel-kbl-match.c +0 -3
@@ -104,17 +96,14 @@ struct snd_soc_acpi_mach 
 snd_soc_acpi_intel_kbl_machines[] = {
       {
           .id = "10EC5660",
           .drv_name = "kbl_rt5660",
-        .fw_filename = "intel/dsp_fw_kbl.bin",
       },
       {
           .id = "10EC3277",
           .drv_name = "kbl_rt5660",
-        .fw_filename = "intel/dsp_fw_kbl.bin",
       },
       {
           .id = "DLGS7219",
           .drv_name = "kbl_da7219_max98373",
-        .fw_filename = "intel/dsp_fw_kbl.bin",
           .machine_quirk = snd_soc_acpi_codec_list,
           .quirk_data = &kbl_7219_98373_codecs,

          .pdata = &skl_dmic_data

sound/soc/intel/common/soc-acpi-intel-kbl-match.c +0 -1
@@ -122,7 +111,6 @@ struct snd_soc_acpi_mach 
 snd_soc_acpi_intel_kbl_machines[] = {
       {
           .id = "MX98373",
           .drv_name = "kbl_max98373",
-        .fw_filename = "intel/dsp_fw_kbl.bin",

          .pdata = &skl_dmic_data
      },
      {},

sound/soc/intel/common/soc-acpi-intel-skl-match.c +0 -2
index 42fa40a8d932..ec969044706c 100644
@@ -21,12 +21,10 @@ struct snd_soc_acpi_mach 
 snd_soc_acpi_intel_skl_machines[] = {
       {
           .id = "INT343A",
           .drv_name = "skl_alc286s_i2s",
-        .fw_filename = "intel/dsp_fw_release.bin",
       },
       {
           .id = "INT343B",
           .drv_name = "skl_n88l25_s4567",
-        .fw_filename = "intel/dsp_fw_release.bin",
           .machine_quirk = snd_soc_acpi_codec_list,
           .quirk_data = &skl_codecs,

          .pdata = &skl_dmic_data,

sound/soc/intel/common/soc-acpi-intel-skl-match.c +0 -1
@@ -34,7 +32,6 @@ struct snd_soc_acpi_mach 
 snd_soc_acpi_intel_skl_machines[] = {
       {
           .id = "MX98357A",
           .drv_name = "skl_n88l25_m98357a",
-        .fw_filename = "intel/dsp_fw_release.bin",
           .machine_quirk = snd_soc_acpi_codec_list,
           .quirk_data = &skl_codecs,

          .pdata = &skl_dmic_data,

sound/soc/intel/common/sst-dsp-priv.h +0 -1
index a4628a89d47d..1a208ef65fa8 100644
@@ -306,7 +306,6 @@ struct sst_dsp {
       int sst_state;
       struct skl_cl_dev cl_dev;
       u32 intr_status;
-    const struct firmware *fw;
       struct snd_dma_buffer dmab;
   };
sound/soc/intel/skylake/skl.h +0 -0
index 218e8bda6cae..7b283c2bb7b5 100644
Quoted 8 lines

sound/soc/intel/skylake/skl.h struct skl_dev { · line 81

Quoted 8 lines
sound/soc/intel/skylake/skl.h +0 -1
@@ -76,7 +76,6 @@ struct skl_dev {
       struct list_head ppl_list;
       struct list_head bind_list;
-    const char *fw_name;
       char tplg_name[64];
       unsigned short pci_id;
       const struct firmware *tplg;
 

_______________________________________________
Alsa-devel mailing list
[email protected]
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

#84 lore raw
In reply to Cezary Rojewski
Quoted 34 lines · Cezary Rojewski

This segment targets initialization procedures for all SST drivers. For legacy:
- it concentrates on updating ACPI loader so generic DSP framework is not fed any platform specific data. sst-acpi module ceases to exist and is replaced by hsw-acpi and byt-acpi

For cAVS (Skylake+):
- Repairs what is currently an initialization mess, given the order of invocation of engaged handlers and sheer amount of them.
- provides interface to offload hardware-specifics away from driver

Following is the order of Skylake initialization currently:
- skl_probe

    -> schedule skl_probe_work

- skl_first_init
- skl_create

-> skl_init_dsp
--> skl/ bxt/ cnl_sst_dsp_init
---> skl_sst_ctx_init
----> skl_dsp_ctx_init
-----> sst_dsp_new
------> sst_ops::init (invoked but unimplemented!)

Listing all the types engaged together with the naming chosen for the above paints an even darker picture. Code is unreadable and hides initialization for diffenret members is various handlers. Moreover, due to existing ill relationship between skl_dev, sst_dsp and sst_generic_ipc, one must be extra careful when accessing so called "dsp/ thread_context" as they all don't get initialized immediately before object is yield for further processing. However, 100/100 series is nonsense and thus cleanups have been divided into chunks and prioritized.

Quoted 8 lines

Code seen here is part of new Skylake fundament, located at the very bottom of internal mainline. Said mainline is tested constantly on at least sigle platform from every cAVS bucket (description below). This week, BDW has been added to the CI family and was essential in validating legacy changes. Baytrail platform is still missing. Changes for BYT directly mirror HSW/ BDW but due to current lack of platform were untested.
Boards engaged in testing: rt286, rt298, rt274.

this is not enough, sorry. these are RVPs and you need to check with commercial devices supported in sound/soc/intel/boards/.

Quoted 24 lines

!!! IMPORTANT !!!

Some upstream FW binaries are not compatible with existing /skylake driver while changes found here (HARDWARE_CONFIG/ FIRMWARE_CONFIG) make use of firmware ability to offload hardware-specifics away from driver. These and more are core part of any cAVS design and are to be implemented and used by host. This too is missing on Linux upstream.

As explanined once, five main FW branches are available:
- kbl, 1.5 cAVS (supports SKL, KBL, KBL-R, ABL, more..)
- apl_auto, 1.5+ cAVS (supports APL, GLK)
- cnl, 1.8 cAVS (supports CNL, CFL, WHL, CML)
- icl, 2.0 cAVS (supports ICL, LKF)
- master, 2.5 cAVS (supports TGL, EHL and everything above)

SKL FW binary existing on upstream is a descendant of old spt branch, obsoleted for 4-5 years now. That FW is a stub, quickly replaced by kbl which is to be used on all 1.5 cAVS platforms.

The same story goes with bxtn binary, a descendant of apl branch, replaced by apl_auto 2-3 years ago. All vendors, entire validation and development is located on apl_auto.

Quoted 7 lines

Message: all FW binaries are to be updated as we cannot guarantee these are still functional. Given the fact that all vendors are fed with new binaries on regular basis from all main branches, it's highly probable some scenarios fail with existing FWs. In consequence, linux-firmware patch will be provided with fresh, updated binaries, soon. Once more, please note, we do not support, nor test platforms using obsolete FW binaries. That includes all platforms, not just SKL or APL.

"we don't break userspace" means you have to be backwards compatible with whatever the user has on their filesystem when the kernel is updated. Or if you go ahead, you need to detect that the firmware is not supported and make it known to the user that it needs to be updated.

Quoted 82 lines

Amadeusz Sławiński (1):
ASoC: Intel: Skylake: Put FW runtime params defs in one place

Cezary Rojewski (34):
ASoC: Intel: Skylake: Add FIRMWARE_CONFIG IPC request
ASoC: Intel: Skylake: Add HARDWARE_CONFIG IPC request
ASoC: Intel: Skylake: Unify firmware loading mechanism
ASoC: Intel: Skylake: Reload libraries on D0 entry for CNL
ASoC: Intel: Skylake: Unhardcode dsp cores number
ASoC: Intel: Skylake: Update interrupt disabling routine
ASoC: Intel: Skylake: Inline ipc free operations
ASoC: Intel: Skylake: Unify driver cleanup mechanism
ASoC: Intel: Relocate irq thread header to sst_ops
ASoC: Intel: Merge sst_dsp_device into sst_pdata
ASoC: Intel: Skylake: Reuse sst_dsp_free
ASoC: Intel: Skylake: Reuse sst_dsp_new
ASoC: Intel: Skylake: Remove skl_dsp_acquire_irq
ASoC: Intel: Skylake: Use dsp loading functions directly
ASoC: Intel: Skylake: Make dsp_ops::stream_tag obsolete
ASoC: Intel: Skylake: Remove skl_dsp_loader_ops
ASoC: Intel: Skylake: Remove window0 sst_addr fields
ASoC: Intel: Skylake: Remove redundant W0 and W1 macros
ASoC: Intel: Skylake: Remove redundant SRAM fields
ASoC: Intel: Expose ACPI loading members
ASoC: Intel: Haswell: Define separate ACPI loader
ASoC: Intel: Baytrail: Define separate ACPI loader
ASoC: Intel: Refactor probing of ACPI devices
ASoC: Intel: Skylake: Simplify skl_sst_ctx_init declaration
ASoC: Intel: Skylake: Simplify all sst_dsp_init declarations
ASoC: Intel: Skylake: Define platform descriptors
ASoC: Intel: Skylake: Update skl_ids table
ASoC: Intel: Skylake: Flip SST initialization order
ASoC: Intel: Reuse sst_pdata::fw_name field
ASoC: Intel: Reuse sst_pdata::fw field
ASoC: Intel: Skylake: Remove skl_dsp_ops
ASoC: Intel: Skylake: Privatize SST init handlers
ASoC: Intel: Skylake: Merge skl_sst_ctx_init into skl_init_dsp
ASoC: Intel: Remove obsolete firmware fields

  sound/soc/intel/Kconfig                       |  14 +-
  sound/soc/intel/baytrail/Makefile             |   2 +
  sound/soc/intel/baytrail/acpi.c               |  64 +++++
  sound/soc/intel/baytrail/sst-baytrail-dsp.c   |   2 +-
  sound/soc/intel/baytrail/sst-baytrail-ipc.c   |  13 +-
  sound/soc/intel/baytrail/sst-baytrail-ipc.h   |   2 +
  sound/soc/intel/common/Makefile               |   4 +-
  .../intel/common/soc-acpi-intel-bxt-match.c   |   2 -
  .../intel/common/soc-acpi-intel-byt-match.c   |   2 -
  .../intel/common/soc-acpi-intel-cnl-match.c   |   1 -
  .../intel/common/soc-acpi-intel-glk-match.c   |   3 -
  .../intel/common/soc-acpi-intel-hda-match.c   |   2 -
  .../common/soc-acpi-intel-hsw-bdw-match.c     |   4 -
  .../intel/common/soc-acpi-intel-icl-match.c   |   1 -
  .../intel/common/soc-acpi-intel-kbl-match.c   |  12 -
  .../intel/common/soc-acpi-intel-skl-match.c   |   3 -
  sound/soc/intel/common/sst-acpi.c             | 117 +--------
  sound/soc/intel/common/sst-dsp-priv.h         |   8 +-
  sound/soc/intel/common/sst-dsp.h              |  37 +--
  sound/soc/intel/common/sst-firmware.c         |  13 +-
  sound/soc/intel/haswell/Makefile              |   2 +
  sound/soc/intel/haswell/acpi.c                |  78 ++++++
  sound/soc/intel/haswell/sst-haswell-dsp.c     |   1 +
  sound/soc/intel/haswell/sst-haswell-ipc.c     |  13 +-
  sound/soc/intel/haswell/sst-haswell-ipc.h     |   2 +
  sound/soc/intel/skylake/bxt-sst.c             | 143 ++++-------
  sound/soc/intel/skylake/cnl-sst-dsp.c         |  13 +-
  sound/soc/intel/skylake/cnl-sst-dsp.h         |  15 +-
  sound/soc/intel/skylake/cnl-sst.c             | 142 ++++-------
  sound/soc/intel/skylake/skl-debug.c           |   2 +-
  sound/soc/intel/skylake/skl-messages.c        | 194 ++------------
  sound/soc/intel/skylake/skl-pcm.c             |  22 +-
  sound/soc/intel/skylake/skl-sst-cldma.c       |  10 +-
  sound/soc/intel/skylake/skl-sst-dsp.c         |  79 ++----
  sound/soc/intel/skylake/skl-sst-dsp.h         |  55 ++--
  sound/soc/intel/skylake/skl-sst-ipc.c         | 238 ++++++++++++++++--
  sound/soc/intel/skylake/skl-sst-ipc.h         | 124 ++++++++-
  sound/soc/intel/skylake/skl-sst-utils.c       |  28 +--
  sound/soc/intel/skylake/skl-sst.c             | 150 ++++++-----
  sound/soc/intel/skylake/skl.c                 |  65 +++--
  sound/soc/intel/skylake/skl.h                 |  26 +-
  41 files changed, 877 insertions(+), 831 deletions(-)
Quoted 3 lines

create mode 100644 sound/soc/intel/baytrail/acpi.c create mode 100644 sound/soc/intel/haswell/acpi.c

_______________________________________________
Alsa-devel mailing list
[email protected]
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

author maintainer
#85 lore raw
Quoted 46 lines · Pierre-Louis Bossart
Quoted 34 lines · Cezary Rojewski

This segment targets initialization procedures for all SST drivers. For legacy:
- it concentrates on updating ACPI loader so generic DSP framework is not fed any platform specific data. sst-acpi module ceases to exist and is replaced by hsw-acpi and byt-acpi

For cAVS (Skylake+):
- Repairs what is currently an initialization mess, given the order of invocation of engaged handlers and sheer amount of them.
- provides interface to offload hardware-specifics away from driver

Following is the order of Skylake initialization currently:
- skl_probe
    -> schedule skl_probe_work
- skl_first_init
- skl_create

-> skl_init_dsp
--> skl/ bxt/ cnl_sst_dsp_init
---> skl_sst_ctx_init
----> skl_dsp_ctx_init
-----> sst_dsp_new
------> sst_ops::init (invoked but unimplemented!)

Listing all the types engaged together with the naming chosen for the above paints an even darker picture. Code is unreadable and hides initialization for diffenret members is various handlers. Moreover, due to existing ill relationship between skl_dev, sst_dsp and sst_generic_ipc, one must be extra careful when accessing so called "dsp/ thread_context" as they all don't get initialized immediately before object is yield for further processing. However, 100/100 series is nonsense and thus cleanups have been divided into chunks and prioritized.

Quoted 8 lines

Code seen here is part of new Skylake fundament, located at the very bottom of internal mainline. Said mainline is tested constantly on at least sigle platform from every cAVS bucket (description below). This week, BDW has been added to the CI family and was essential in validating legacy changes. Baytrail platform is still missing. Changes for BYT directly mirror HSW/ BDW but due to current lack of platform were untested.
Boards engaged in testing: rt286, rt298, rt274.

Quoted 2 lines

this is not enough, sorry. these are RVPs and you need to check with commercial devices supported in sound/soc/intel/boards/.

+Filip
+Michal

What machine board has to do with FW and host side? If it has, we better notify the owner so he can fix codec's code at once. All boards MUST follow recommended protocol whether its HDA or I2S in communicating with /skylake. This is hardware IP we taking about. I could as well test all platforms with AudioPrecision and say: shipit.

DSP "commercial devices" with 99% of home audio being routed through HD-Audio legacy? I do contact representatives of "commercial devices" daily, you of all should be aware of fact that in almost all cases they are fed neither with upstream code nor upstream binaries. For the first time since eons sound/soc/intel/skylake code is tested before upstreaming, yet you still defend the mistakes of the past?

I don't mind being extra careful, but testing every existing machine board is nonsense and you know it.
Extra careful: this should have been the main topic enforced by Intel audio representatives when existing stuff been upstreamed - years ago.

Quoted 32 lines
Quoted 24 lines

!!! IMPORTANT !!!

Some upstream FW binaries are not compatible with existing /skylake driver while changes found here (HARDWARE_CONFIG/ FIRMWARE_CONFIG) make use of firmware ability to offload hardware-specifics away from driver. These and more are core part of any cAVS design and are to be implemented and used by host. This too is missing on Linux upstream.

As explanined once, five main FW branches are available:
- kbl, 1.5 cAVS (supports SKL, KBL, KBL-R, ABL, more..)
- apl_auto, 1.5+ cAVS (supports APL, GLK)
- cnl, 1.8 cAVS (supports CNL, CFL, WHL, CML)
- icl, 2.0 cAVS (supports ICL, LKF)
- master, 2.5 cAVS (supports TGL, EHL and everything above)

SKL FW binary existing on upstream is a descendant of old spt branch, obsoleted for 4-5 years now. That FW is a stub, quickly replaced by kbl which is to be used on all 1.5 cAVS platforms.

The same story goes with bxtn binary, a descendant of apl branch, replaced by apl_auto 2-3 years ago. All vendors, entire validation and development is located on apl_auto.

Quoted 7 lines

Message: all FW binaries are to be updated as we cannot guarantee these are still functional. Given the fact that all vendors are fed with new binaries on regular basis from all main branches, it's highly probable some scenarios fail with existing FWs. In consequence, linux-firmware patch will be provided with fresh, updated binaries, soon. Once more, please note, we do not support, nor test platforms using obsolete FW binaries. That includes all platforms, not just SKL or APL.

Quoted 3 lines

"we don't break userspace" means you have to be backwards compatible with whatever the user has on their filesystem when the kernel is updated. Or if you go ahead, you need to detect that the firmware is not supported and make it known to the user that it needs to be updated.

Gotta be honest here. I'm surprised SPT binary even made it here. Same goes for bxtn one. The only real-life example of bxtn for linux is for 4.1.X kernels - where YES, /skylake and topology and a lot more stuff does not even exist and is simply backported internally.

If I could, I'd rather prefer the "detect and notify" as it is impossible to repair all the mistakes made in /sound/soc/intel/skylake.

However, in practice there isn't any reliable way to verify the actual usability of old FW binary against host site as the interface is volatile and numbers alone don't mean much. Patch with FW binaries would not remove old ones, simply add new versions to the directory.

Czarek

Quoted 77 lines
Quoted 77 lines

Amadeusz Sławiński (1):
   ASoC: Intel: Skylake: Put FW runtime params defs in one place

Cezary Rojewski (34):
   ASoC: Intel: Skylake: Add FIRMWARE_CONFIG IPC request
   ASoC: Intel: Skylake: Add HARDWARE_CONFIG IPC request
   ASoC: Intel: Skylake: Unify firmware loading mechanism
   ASoC: Intel: Skylake: Reload libraries on D0 entry for CNL
   ASoC: Intel: Skylake: Unhardcode dsp cores number
   ASoC: Intel: Skylake: Update interrupt disabling routine
   ASoC: Intel: Skylake: Inline ipc free operations
   ASoC: Intel: Skylake: Unify driver cleanup mechanism
   ASoC: Intel: Relocate irq thread header to sst_ops
   ASoC: Intel: Merge sst_dsp_device into sst_pdata
   ASoC: Intel: Skylake: Reuse sst_dsp_free
   ASoC: Intel: Skylake: Reuse sst_dsp_new
   ASoC: Intel: Skylake: Remove skl_dsp_acquire_irq
   ASoC: Intel: Skylake: Use dsp loading functions directly
   ASoC: Intel: Skylake: Make dsp_ops::stream_tag obsolete
   ASoC: Intel: Skylake: Remove skl_dsp_loader_ops
   ASoC: Intel: Skylake: Remove window0 sst_addr fields
   ASoC: Intel: Skylake: Remove redundant W0 and W1 macros
   ASoC: Intel: Skylake: Remove redundant SRAM fields
   ASoC: Intel: Expose ACPI loading members
   ASoC: Intel: Haswell: Define separate ACPI loader
   ASoC: Intel: Baytrail: Define separate ACPI loader
   ASoC: Intel: Refactor probing of ACPI devices
   ASoC: Intel: Skylake: Simplify skl_sst_ctx_init declaration
   ASoC: Intel: Skylake: Simplify all sst_dsp_init declarations
   ASoC: Intel: Skylake: Define platform descriptors
   ASoC: Intel: Skylake: Update skl_ids table
   ASoC: Intel: Skylake: Flip SST initialization order
   ASoC: Intel: Reuse sst_pdata::fw_name field
   ASoC: Intel: Reuse sst_pdata::fw field
   ASoC: Intel: Skylake: Remove skl_dsp_ops
   ASoC: Intel: Skylake: Privatize SST init handlers
   ASoC: Intel: Skylake: Merge skl_sst_ctx_init into skl_init_dsp
   ASoC: Intel: Remove obsolete firmware fields

  sound/soc/intel/Kconfig                       |  14 +- sound/soc/intel/baytrail/Makefile             |   2 + sound/soc/intel/baytrail/acpi.c               |  64 +++++

  sound/soc/intel/baytrail/sst-baytrail-dsp.c   |   2 +-
  sound/soc/intel/baytrail/sst-baytrail-ipc.c   |  13 +-
  sound/soc/intel/baytrail/sst-baytrail-ipc.h   |   2 +
  sound/soc/intel/common/Makefile               |   4 +-
  .../intel/common/soc-acpi-intel-bxt-match.c   |   2 -
  .../intel/common/soc-acpi-intel-byt-match.c   |   2 -
  .../intel/common/soc-acpi-intel-cnl-match.c   |   1 -
  .../intel/common/soc-acpi-intel-glk-match.c   |   3 -
  .../intel/common/soc-acpi-intel-hda-match.c   |   2 -
  .../common/soc-acpi-intel-hsw-bdw-match.c     |   4 -
  .../intel/common/soc-acpi-intel-icl-match.c   |   1 -
  .../intel/common/soc-acpi-intel-kbl-match.c   |  12 -
  .../intel/common/soc-acpi-intel-skl-match.c   |   3 -

  sound/soc/intel/common/sst-acpi.c             | 117 +-------- sound/soc/intel/common/sst-dsp-priv.h         |   8 +- sound/soc/intel/common/sst-dsp.h              |  37 +-- sound/soc/intel/common/sst-firmware.c         |  13 +- sound/soc/intel/haswell/Makefile              |   2 + sound/soc/intel/haswell/acpi.c                |  78 ++++++

  sound/soc/intel/haswell/sst-haswell-dsp.c     |   1 +
  sound/soc/intel/haswell/sst-haswell-ipc.c     |  13 +-
  sound/soc/intel/haswell/sst-haswell-ipc.h     |   2 +

  sound/soc/intel/skylake/bxt-sst.c             | 143 ++++------- sound/soc/intel/skylake/cnl-sst-dsp.c         |  13 +- sound/soc/intel/skylake/cnl-sst-dsp.h         |  15 +- sound/soc/intel/skylake/cnl-sst.c             | 142 ++++------- sound/soc/intel/skylake/skl-debug.c           |   2 +- sound/soc/intel/skylake/skl-messages.c        | 194 ++------------ sound/soc/intel/skylake/skl-pcm.c             |  22 +- sound/soc/intel/skylake/skl-sst-cldma.c       |  10 +-

  sound/soc/intel/skylake/skl-sst-dsp.c         |  79 ++----
  sound/soc/intel/skylake/skl-sst-dsp.h         |  55 ++--
  sound/soc/intel/skylake/skl-sst-ipc.c         | 238 ++++++++++++++++--
  sound/soc/intel/skylake/skl-sst-ipc.h         | 124 ++++++++-
Quoted 8 lines
Quoted 8 lines

  sound/soc/intel/skylake/skl-sst-utils.c       |  28 +-- sound/soc/intel/skylake/skl-sst.c             | 150 ++++++----- sound/soc/intel/skylake/skl.c                 |  65 +++-- sound/soc/intel/skylake/skl.h                 |  26 +-

  41 files changed, 877 insertions(+), 831 deletions(-)

  create mode 100644 sound/soc/intel/baytrail/acpi.c create mode 100644 sound/soc/intel/haswell/acpi.c

_______________________________________________
Alsa-devel mailing list
[email protected]
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel