All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 00/35] ASoC: Intel: Clenaup SST initialization
@ 2019-08-22 19:03 Cezary Rojewski
  2019-08-22 19:03 ` [PATCH 01/35] ASoC: Intel: Skylake: Put FW runtime params defs in one place Cezary Rojewski
                   ` (35 more replies)
  0 siblings, 36 replies; 107+ messages in thread
From: Cezary Rojewski @ 2019-08-22 19:03 UTC (permalink / raw)
  To: alsa-devel
  Cc: lgirdwood, Cezary Rojewski, broonie, tiwai, pierre-louis.bossart

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

-- 
2.17.1

_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

^ permalink raw reply	[flat|nested] 107+ messages in thread

* [PATCH 01/35] ASoC: Intel: Skylake: Put FW runtime params defs in one place
  2019-08-22 19:03 [PATCH 00/35] ASoC: Intel: Clenaup SST initialization Cezary Rojewski
@ 2019-08-22 19:03 ` Cezary Rojewski
  2019-08-22 19:03 ` [PATCH 02/35] ASoC: Intel: Skylake: Add FIRMWARE_CONFIG IPC request Cezary Rojewski
                   ` (34 subsequent siblings)
  35 siblings, 0 replies; 107+ messages in thread
From: Cezary Rojewski @ 2019-08-22 19:03 UTC (permalink / raw)
  To: alsa-devel
  Cc: lgirdwood, broonie, tiwai, Amadeusz Sławiński,
	pierre-louis.bossart

From: Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com>

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

Signed-off-by: Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com>
---
 sound/soc/intel/skylake/skl-messages.c | 7 ++-----
 sound/soc/intel/skylake/skl-sst-ipc.h  | 5 +++++
 2 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/sound/soc/intel/skylake/skl-messages.c b/sound/soc/intel/skylake/skl-messages.c
index d43496c5f29e..b6cefb1f9b12 100644
--- a/sound/soc/intel/skylake/skl-messages.c
+++ b/sound/soc/intel/skylake/skl-messages.c
@@ -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);
diff --git a/sound/soc/intel/skylake/skl-sst-ipc.h b/sound/soc/intel/skylake/skl-sst-ipc.h
index 08ac31778325..0058d82bd5a4 100644
--- a/sound/soc/intel/skylake/skl-sst-ipc.h
+++ b/sound/soc/intel/skylake/skl-sst-ipc.h
@@ -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;
-- 
2.17.1

_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

^ permalink raw reply related	[flat|nested] 107+ messages in thread

* [PATCH 02/35] ASoC: Intel: Skylake: Add FIRMWARE_CONFIG IPC request
  2019-08-22 19:03 [PATCH 00/35] ASoC: Intel: Clenaup SST initialization Cezary Rojewski
  2019-08-22 19:03 ` [PATCH 01/35] ASoC: Intel: Skylake: Put FW runtime params defs in one place Cezary Rojewski
@ 2019-08-22 19:03 ` Cezary Rojewski
  2019-08-23 18:24   ` Pierre-Louis Bossart
  2019-08-22 19:03 ` [PATCH 03/35] ASoC: Intel: Skylake: Add HARDWARE_CONFIG " Cezary Rojewski
                   ` (33 subsequent siblings)
  35 siblings, 1 reply; 107+ messages in thread
From: Cezary Rojewski @ 2019-08-22 19:03 UTC (permalink / raw)
  To: alsa-devel
  Cc: lgirdwood, Cezary Rojewski, broonie, tiwai, pierre-louis.bossart

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.

Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
---
 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(+)

diff --git a/sound/soc/intel/skylake/skl-sst-ipc.c b/sound/soc/intel/skylake/skl-sst-ipc.c
index 667cdddc289f..e9e11ec4c97b 100644
--- a/sound/soc/intel/skylake/skl-sst-ipc.c
+++ b/sound/soc/intel/skylake/skl-sst-ipc.c
@@ -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);
diff --git a/sound/soc/intel/skylake/skl-sst-ipc.h b/sound/soc/intel/skylake/skl-sst-ipc.h
index 0058d82bd5a4..ebc5852e15d0 100644
--- a/sound/soc/intel/skylake/skl-sst-ipc.h
+++ b/sound/soc/intel/skylake/skl-sst-ipc.h
@@ -15,6 +15,12 @@
 struct sst_dsp;
 struct sst_generic_ipc;
 
+struct skl_tlv {
+	u32 type;
+	u32 length;
+	u8 value[0];
+};
+
 enum skl_ipc_pipeline_state {
 	PPL_INVALID_STATE =	0,
 	PPL_UNINITIALIZED =	1,
@@ -70,6 +76,69 @@ struct skl_lib_info {
 enum skl_basefw_runtime_param {
 	SKL_BASEFW_ASTATE_TABLE = 4,
 	SKL_BASEFW_DMA_CONTROL = 5,
+	SKL_BASEFW_FIRMWARE_CONFIG = 7,
+};
+
+enum skl_fw_cfg_params {
+	SKL_FW_CFG_FW_VERSION = 0,
+	SKL_FW_CFG_MEMORY_RECLAIMED,
+	SKL_FW_CFG_SLOW_CLOCK_FREQ_HZ,
+	SKL_FW_CFG_FAST_CLOCK_FREQ_HZ,
+	SKL_FW_CFG_DMA_BUFFER_CONFIG,
+	SKL_FW_CFG_ALH_SUPPORT_LEVEL,
+	SKL_FW_CFG_IPC_DL_MAILBOX_BYTES,
+	SKL_FW_CFG_IPC_UL_MAILBOX_BYTES,
+	SKL_FW_CFG_TRACE_LOG_BYTES,
+	SKL_FW_CFG_MAX_PPL_COUNT,
+	SKL_FW_CFG_MAX_ASTATE_COUNT,
+	SKL_FW_CFG_MAX_MODULE_PIN_COUNT,
+	SKL_FW_CFG_MODULES_COUNT,
+	SKL_FW_CFG_MAX_MOD_INST_COUNT,
+	SKL_FW_CFG_MAX_LL_TASKS_PER_PRI_COUNT,
+	SKL_FW_CFG_LL_PRI_COUNT,
+	SKL_FW_CFG_MAX_DP_TASKS_COUNT,
+	SKL_FW_CFG_MAX_LIBS_COUNT,
+	SKL_FW_CFG_SCHEDULER_CONFIG,
+	SKL_FW_CFG_XTAL_FREQ_HZ,
+	SKL_FW_CFG_CLOCKS_CONFIG,
+	SKL_FW_CFG_UAOL_SUPPORT,
+	SKL_FW_CFG_POWER_GATING_POLICY,
+	SKL_FW_CFG_ASSERT_MODE,
+};
+
+struct skl_fw_version {
+	u16 major;
+	u16 minor;
+	u16 hotfix;
+	u16 build;
+};
+
+enum skl_alh_support_level {
+	ALH_NO_SUPPORT = 0x00000,
+	ALH_CAVS_1_8_CNL = 0x10000,
+};
+
+struct skl_fw_cfg {
+	struct skl_fw_version fw_version;
+	u32 memory_reclaimed;
+	u32 slow_clock_freq_hz;
+	u32 fast_clock_freq_hz;
+	enum skl_alh_support_level alh_support;
+	u32 ipc_dl_mailbox_bytes;
+	u32 ipc_ul_mailbox_bytes;
+	u32 trace_log_bytes;
+	u32 max_ppl_count;
+	u32 max_astate_count;
+	u32 max_module_pin_count;
+	u32 modules_count;
+	u32 max_mod_inst_count;
+	u32 max_ll_tasks_per_pri_count;
+	u32 ll_pri_count;
+	u32 max_dp_tasks_count;
+	u32 max_libs_count;
+	u32 xtal_freq_hz;
+	u32 uaol_support;
+	u32 power_gating_policy;
 };
 
 struct skl_ipc_init_instance_msg {
@@ -171,4 +240,7 @@ int skl_ipc_process_notification(struct sst_generic_ipc *ipc,
 		struct skl_ipc_header header);
 void skl_ipc_tx_data_copy(struct ipc_message *msg, char *tx_data,
 		size_t tx_size);
+
+int skl_ipc_fw_cfg_get(struct sst_generic_ipc *ipc, struct skl_fw_cfg *cfg);
+
 #endif /* __SKL_IPC_H */
diff --git a/sound/soc/intel/skylake/skl.h b/sound/soc/intel/skylake/skl.h
index f8c714153610..0d1c820e11cd 100644
--- a/sound/soc/intel/skylake/skl.h
+++ b/sound/soc/intel/skylake/skl.h
@@ -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;
-- 
2.17.1

^ permalink raw reply related	[flat|nested] 107+ messages in thread

* [PATCH 03/35] ASoC: Intel: Skylake: Add HARDWARE_CONFIG IPC request
  2019-08-22 19:03 [PATCH 00/35] ASoC: Intel: Clenaup SST initialization Cezary Rojewski
  2019-08-22 19:03 ` [PATCH 01/35] ASoC: Intel: Skylake: Put FW runtime params defs in one place Cezary Rojewski
  2019-08-22 19:03 ` [PATCH 02/35] ASoC: Intel: Skylake: Add FIRMWARE_CONFIG IPC request Cezary Rojewski
@ 2019-08-22 19:03 ` Cezary Rojewski
  2019-08-23 18:32   ` Pierre-Louis Bossart
  2019-08-22 19:03 ` [PATCH 04/35] ASoC: Intel: Skylake: Unify firmware loading mechanism Cezary Rojewski
                   ` (32 subsequent siblings)
  35 siblings, 1 reply; 107+ messages in thread
From: Cezary Rojewski @ 2019-08-22 19:03 UTC (permalink / raw)
  To: alsa-devel
  Cc: lgirdwood, Cezary Rojewski, broonie, tiwai, pierre-louis.bossart

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.

Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
---
 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(+)

diff --git a/sound/soc/intel/skylake/skl-messages.c b/sound/soc/intel/skylake/skl-messages.c
index b6cefb1f9b12..d28b4887de27 100644
--- a/sound/soc/intel/skylake/skl-messages.c
+++ b/sound/soc/intel/skylake/skl-messages.c
@@ -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);
 
diff --git a/sound/soc/intel/skylake/skl-sst-ipc.c b/sound/soc/intel/skylake/skl-sst-ipc.c
index e9e11ec4c97b..91b5440c643d 100644
--- a/sound/soc/intel/skylake/skl-sst-ipc.c
+++ b/sound/soc/intel/skylake/skl-sst-ipc.c
@@ -1189,3 +1189,90 @@ int skl_ipc_fw_cfg_get(struct sst_generic_ipc *ipc, struct skl_fw_cfg *cfg)
 	return ret;
 }
 EXPORT_SYMBOL_GPL(skl_ipc_fw_cfg_get);
+
+int skl_ipc_hw_cfg_get(struct sst_generic_ipc *ipc, struct skl_hw_cfg *cfg)
+{
+	struct skl_ipc_large_config_msg msg = {0};
+	struct skl_tlv *tlv;
+	size_t size, bytes = 0, offset = 0;
+	u8 *payload = NULL;
+	int ret;
+
+	msg.module_id = 0;
+	msg.instance_id = 0;
+	msg.large_param_id = SKL_BASEFW_HARDWARE_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_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;
+			if (!size)
+				break;
+
+			size *= sizeof(*cfg->i2s_caps.ctrl_base_addr);
+			cfg->i2s_caps.ctrl_base_addr =
+				kmemdup(&tlv->value[2], size, GFP_KERNEL);
+			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;
+			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;
+		}
+
+		offset += sizeof(*tlv) + tlv->length;
+	}
+
+exit:
+	kfree(payload);
+	return ret;
+}
+EXPORT_SYMBOL_GPL(skl_ipc_hw_cfg_get);
diff --git a/sound/soc/intel/skylake/skl-sst-ipc.h b/sound/soc/intel/skylake/skl-sst-ipc.h
index ebc5852e15d0..eefa52f7f97a 100644
--- a/sound/soc/intel/skylake/skl-sst-ipc.h
+++ b/sound/soc/intel/skylake/skl-sst-ipc.h
@@ -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 {
+	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,
+};
+
+struct skl_i2s_caps {
+	enum skl_i2s_version version;
+	u32 ctrl_count;
+	u32 *ctrl_base_addr;
+};
+
+struct skl_hw_cfg {
+	enum skl_cavs_version cavs_version;
+	u32 dsp_cores;
+	u32 mem_page_bytes;
+	u32 total_phys_mem_pages;
+	struct skl_i2s_caps i2s_caps;
+	u32 gateway_count;
+	u32 hp_ebb_count;
+	u32 lp_ebb_count;
+	u32 ebb_size_bytes;
+};
+
 struct skl_ipc_init_instance_msg {
 	u32 module_id;
 	u32 instance_id;
@@ -242,5 +287,6 @@ void skl_ipc_tx_data_copy(struct ipc_message *msg, char *tx_data,
 		size_t tx_size);
 
 int skl_ipc_fw_cfg_get(struct sst_generic_ipc *ipc, struct skl_fw_cfg *cfg);
+int skl_ipc_hw_cfg_get(struct sst_generic_ipc *ipc, struct skl_hw_cfg *cfg);
 
 #endif /* __SKL_IPC_H */
diff --git a/sound/soc/intel/skylake/skl.h b/sound/soc/intel/skylake/skl.h
index 0d1c820e11cd..972de5ddf2b7 100644
--- a/sound/soc/intel/skylake/skl.h
+++ b/sound/soc/intel/skylake/skl.h
@@ -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;
-- 
2.17.1

^ permalink raw reply related	[flat|nested] 107+ messages in thread

* [PATCH 04/35] ASoC: Intel: Skylake: Unify firmware loading mechanism
  2019-08-22 19:03 [PATCH 00/35] ASoC: Intel: Clenaup SST initialization Cezary Rojewski
                   ` (2 preceding siblings ...)
  2019-08-22 19:03 ` [PATCH 03/35] ASoC: Intel: Skylake: Add HARDWARE_CONFIG " Cezary Rojewski
@ 2019-08-22 19:03 ` Cezary Rojewski
  2019-08-23 18:40   ` Pierre-Louis Bossart
  2019-08-22 19:03 ` [PATCH 05/35] ASoC: Intel: Skylake: Reload libraries on D0 entry for CNL Cezary Rojewski
                   ` (31 subsequent siblings)
  35 siblings, 1 reply; 107+ messages in thread
From: Cezary Rojewski @ 2019-08-22 19:03 UTC (permalink / raw)
  To: alsa-devel
  Cc: lgirdwood, Cezary Rojewski, broonie, tiwai, pierre-louis.bossart

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.

Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
---
 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(-)

diff --git a/sound/soc/intel/skylake/bxt-sst.c b/sound/soc/intel/skylake/bxt-sst.c
index 92a82e6b5fe6..5bece3a6d741 100644
--- a/sound/soc/intel/skylake/bxt-sst.c
+++ b/sound/soc/intel/skylake/bxt-sst.c
@@ -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)
 {
 
diff --git a/sound/soc/intel/skylake/cnl-sst-dsp.h b/sound/soc/intel/skylake/cnl-sst-dsp.h
index 7bd4d2a8fdfa..50f4a53a607c 100644
--- a/sound/soc/intel/skylake/cnl-sst-dsp.h
+++ b/sound/soc/intel/skylake/cnl-sst-dsp.h
@@ -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__*/
diff --git a/sound/soc/intel/skylake/cnl-sst.c b/sound/soc/intel/skylake/cnl-sst.c
index 4f64f097e9ae..8984653d925d 100644
--- a/sound/soc/intel/skylake/cnl-sst.c
+++ b/sound/soc/intel/skylake/cnl-sst.c
@@ -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)
diff --git a/sound/soc/intel/skylake/skl-messages.c b/sound/soc/intel/skylake/skl-messages.c
index d28b4887de27..cc949904717e 100644
--- a/sound/soc/intel/skylake/skl-messages.c
+++ b/sound/soc/intel/skylake/skl-messages.c
@@ -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
 	},
 };
diff --git a/sound/soc/intel/skylake/skl-pcm.c b/sound/soc/intel/skylake/skl-pcm.c
index 7f287424af9b..1dbab3eac0e5 100644
--- a/sound/soc/intel/skylake/skl-pcm.c
+++ b/sound/soc/intel/skylake/skl-pcm.c
@@ -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;
 
diff --git a/sound/soc/intel/skylake/skl-sst-dsp.c b/sound/soc/intel/skylake/skl-sst-dsp.c
index 225706d148d8..0eecf26986f9 100644
--- a/sound/soc/intel/skylake/skl-sst-dsp.c
+++ b/sound/soc/intel/skylake/skl-sst-dsp.c
@@ -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)
diff --git a/sound/soc/intel/skylake/skl-sst-dsp.h b/sound/soc/intel/skylake/skl-sst-dsp.h
index cdfec0fca577..4da240582454 100644
--- a/sound/soc/intel/skylake/skl-sst-dsp.h
+++ b/sound/soc/intel/skylake/skl-sst-dsp.h
@@ -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);
 
diff --git a/sound/soc/intel/skylake/skl-sst.c b/sound/soc/intel/skylake/skl-sst.c
index 8af7546def1f..8a8ecb9a4fc6 100644
--- a/sound/soc/intel/skylake/skl-sst.c
+++ b/sound/soc/intel/skylake/skl-sst.c
@@ -555,30 +555,59 @@ int skl_sst_dsp_init(struct device *dev, void __iomem *mmio_base, int irq,
 }
 EXPORT_SYMBOL_GPL(skl_sst_dsp_init);
 
-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;
+	}
+
+	if (!skl->is_first_boot)
+		goto library_load;
+	/* Disable power check during cfg setup */
+	skl->ipc.ops.check_dsp_lp_on = NULL;
+
+	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);
 
diff --git a/sound/soc/intel/skylake/skl.h b/sound/soc/intel/skylake/skl.h
index 972de5ddf2b7..1f86543fe954 100644
--- a/sound/soc/intel/skylake/skl.h
+++ b/sound/soc/intel/skylake/skl.h
@@ -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);
-- 
2.17.1

^ permalink raw reply related	[flat|nested] 107+ messages in thread

* [PATCH 05/35] ASoC: Intel: Skylake: Reload libraries on D0 entry for CNL
  2019-08-22 19:03 [PATCH 00/35] ASoC: Intel: Clenaup SST initialization Cezary Rojewski
                   ` (3 preceding siblings ...)
  2019-08-22 19:03 ` [PATCH 04/35] ASoC: Intel: Skylake: Unify firmware loading mechanism Cezary Rojewski
@ 2019-08-22 19:03 ` Cezary Rojewski
  2019-08-22 19:03 ` [PATCH 06/35] ASoC: Intel: Skylake: Unhardcode dsp cores number Cezary Rojewski
                   ` (30 subsequent siblings)
  35 siblings, 0 replies; 107+ messages in thread
From: Cezary Rojewski @ 2019-08-22 19:03 UTC (permalink / raw)
  To: alsa-devel
  Cc: lgirdwood, Cezary Rojewski, broonie, tiwai, pierre-louis.bossart

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.

Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
---
 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(-)

diff --git a/sound/soc/intel/skylake/bxt-sst.c b/sound/soc/intel/skylake/bxt-sst.c
index 5bece3a6d741..cc9507d4702b 100644
--- a/sound/soc/intel/skylake/bxt-sst.c
+++ b/sound/soc/intel/skylake/bxt-sst.c
@@ -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
diff --git a/sound/soc/intel/skylake/cnl-sst.c b/sound/soc/intel/skylake/cnl-sst.c
index 8984653d925d..a2b3bce631fc 100644
--- a/sound/soc/intel/skylake/cnl-sst.c
+++ b/sound/soc/intel/skylake/cnl-sst.c
@@ -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 = {
diff --git a/sound/soc/intel/skylake/skl-sst-dsp.h b/sound/soc/intel/skylake/skl-sst-dsp.h
index 4da240582454..06979652985c 100644
--- a/sound/soc/intel/skylake/skl-sst-dsp.h
+++ b/sound/soc/intel/skylake/skl-sst-dsp.h
@@ -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);
-- 
2.17.1

^ permalink raw reply related	[flat|nested] 107+ messages in thread

* [PATCH 06/35] ASoC: Intel: Skylake: Unhardcode dsp cores number
  2019-08-22 19:03 [PATCH 00/35] ASoC: Intel: Clenaup SST initialization Cezary Rojewski
                   ` (4 preceding siblings ...)
  2019-08-22 19:03 ` [PATCH 05/35] ASoC: Intel: Skylake: Reload libraries on D0 entry for CNL Cezary Rojewski
@ 2019-08-22 19:03 ` Cezary Rojewski
  2019-08-22 19:03 ` [PATCH 07/35] ASoC: Intel: Skylake: Update interrupt disabling routine Cezary Rojewski
                   ` (29 subsequent siblings)
  35 siblings, 0 replies; 107+ messages in thread
From: Cezary Rojewski @ 2019-08-22 19:03 UTC (permalink / raw)
  To: alsa-devel
  Cc: lgirdwood, Cezary Rojewski, broonie, tiwai, pierre-louis.bossart

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

Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
---
 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(-)

diff --git a/sound/soc/intel/skylake/skl-messages.c b/sound/soc/intel/skylake/skl-messages.c
index cc949904717e..e4ac1ae777e0 100644
--- a/sound/soc/intel/skylake/skl-messages.c
+++ b/sound/soc/intel/skylake/skl-messages.c
@@ -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);
 
diff --git a/sound/soc/intel/skylake/skl-sst-dsp.c b/sound/soc/intel/skylake/skl-sst-dsp.c
index 0eecf26986f9..15acbe80711e 100644
--- a/sound/soc/intel/skylake/skl-sst-dsp.c
+++ b/sound/soc/intel/skylake/skl-sst-dsp.c
@@ -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);
 
diff --git a/sound/soc/intel/skylake/skl-sst-dsp.h b/sound/soc/intel/skylake/skl-sst-dsp.h
index 06979652985c..2129627e6255 100644
--- a/sound/soc/intel/skylake/skl-sst-dsp.h
+++ b/sound/soc/intel/skylake/skl-sst-dsp.h
@@ -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);
diff --git a/sound/soc/intel/skylake/skl-sst.c b/sound/soc/intel/skylake/skl-sst.c
index 8a8ecb9a4fc6..163590682e1a 100644
--- a/sound/soc/intel/skylake/skl-sst.c
+++ b/sound/soc/intel/skylake/skl-sst.c
@@ -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) {
diff --git a/sound/soc/intel/skylake/skl.h b/sound/soc/intel/skylake/skl.h
index 1f86543fe954..71e69f52b7ab 100644
--- a/sound/soc/intel/skylake/skl.h
+++ b/sound/soc/intel/skylake/skl.h
@@ -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,
-- 
2.17.1

^ permalink raw reply related	[flat|nested] 107+ messages in thread

* [PATCH 07/35] ASoC: Intel: Skylake: Update interrupt disabling routine
  2019-08-22 19:03 [PATCH 00/35] ASoC: Intel: Clenaup SST initialization Cezary Rojewski
                   ` (5 preceding siblings ...)
  2019-08-22 19:03 ` [PATCH 06/35] ASoC: Intel: Skylake: Unhardcode dsp cores number Cezary Rojewski
@ 2019-08-22 19:03 ` Cezary Rojewski
  2019-08-22 19:03 ` [PATCH 08/35] ASoC: Intel: Skylake: Inline ipc free operations Cezary Rojewski
                   ` (28 subsequent siblings)
  35 siblings, 0 replies; 107+ messages in thread
From: Cezary Rojewski @ 2019-08-22 19:03 UTC (permalink / raw)
  To: alsa-devel
  Cc: lgirdwood, Cezary Rojewski, broonie, tiwai, pierre-louis.bossart

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.

Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
---
 sound/soc/intel/skylake/skl-sst-ipc.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/sound/soc/intel/skylake/skl-sst-ipc.c b/sound/soc/intel/skylake/skl-sst-ipc.c
index 91b5440c643d..4875a518dd54 100644
--- a/sound/soc/intel/skylake/skl-sst-ipc.c
+++ b/sound/soc/intel/skylake/skl-sst-ipc.c
@@ -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);
 
 }
-- 
2.17.1

^ permalink raw reply related	[flat|nested] 107+ messages in thread

* [PATCH 08/35] ASoC: Intel: Skylake: Inline ipc free operations
  2019-08-22 19:03 [PATCH 00/35] ASoC: Intel: Clenaup SST initialization Cezary Rojewski
                   ` (6 preceding siblings ...)
  2019-08-22 19:03 ` [PATCH 07/35] ASoC: Intel: Skylake: Update interrupt disabling routine Cezary Rojewski
@ 2019-08-22 19:03 ` Cezary Rojewski
  2019-08-22 19:03 ` [PATCH 09/35] ASoC: Intel: Skylake: Unify driver cleanup mechanism Cezary Rojewski
                   ` (27 subsequent siblings)
  35 siblings, 0 replies; 107+ messages in thread
From: Cezary Rojewski @ 2019-08-22 19:03 UTC (permalink / raw)
  To: alsa-devel
  Cc: lgirdwood, Cezary Rojewski, broonie, tiwai, pierre-louis.bossart

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

Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
---
 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(-)

diff --git a/sound/soc/intel/skylake/bxt-sst.c b/sound/soc/intel/skylake/bxt-sst.c
index cc9507d4702b..68f400cfb390 100644
--- a/sound/soc/intel/skylake/bxt-sst.c
+++ b/sound/soc/intel/skylake/bxt-sst.c
@@ -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);
diff --git a/sound/soc/intel/skylake/cnl-sst-dsp.c b/sound/soc/intel/skylake/cnl-sst-dsp.c
index 3ef1b194add1..189c1c7086e3 100644
--- a/sound/soc/intel/skylake/cnl-sst-dsp.c
+++ b/sound/soc/intel/skylake/cnl-sst-dsp.c
@@ -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);
-}
diff --git a/sound/soc/intel/skylake/cnl-sst-dsp.h b/sound/soc/intel/skylake/cnl-sst-dsp.h
index 50f4a53a607c..b1417639bc1c 100644
--- a/sound/soc/intel/skylake/cnl-sst-dsp.h
+++ b/sound/soc/intel/skylake/cnl-sst-dsp.h
@@ -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,
diff --git a/sound/soc/intel/skylake/cnl-sst.c b/sound/soc/intel/skylake/cnl-sst.c
index a2b3bce631fc..76b23ea7802e 100644
--- a/sound/soc/intel/skylake/cnl-sst.c
+++ b/sound/soc/intel/skylake/cnl-sst.c
@@ -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);
 }
diff --git a/sound/soc/intel/skylake/skl-sst-dsp.c b/sound/soc/intel/skylake/skl-sst-dsp.c
index 15acbe80711e..e0807db225f4 100644
--- a/sound/soc/intel/skylake/skl-sst-dsp.c
+++ b/sound/soc/intel/skylake/skl-sst-dsp.c
@@ -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);
diff --git a/sound/soc/intel/skylake/skl-sst-ipc.c b/sound/soc/intel/skylake/skl-sst-ipc.c
index 4875a518dd54..2700f882103d 100644
--- a/sound/soc/intel/skylake/skl-sst-ipc.c
+++ b/sound/soc/intel/skylake/skl-sst-ipc.c
@@ -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)
 {
diff --git a/sound/soc/intel/skylake/skl-sst-ipc.h b/sound/soc/intel/skylake/skl-sst-ipc.h
index eefa52f7f97a..fb150e656379 100644
--- a/sound/soc/intel/skylake/skl-sst-ipc.h
+++ b/sound/soc/intel/skylake/skl-sst-ipc.h
@@ -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);
 
diff --git a/sound/soc/intel/skylake/skl-sst.c b/sound/soc/intel/skylake/skl-sst.c
index 163590682e1a..72ab579ddd27 100644
--- a/sound/soc/intel/skylake/skl-sst.c
+++ b/sound/soc/intel/skylake/skl-sst.c
@@ -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);
-- 
2.17.1

^ permalink raw reply related	[flat|nested] 107+ messages in thread

* [PATCH 09/35] ASoC: Intel: Skylake: Unify driver cleanup mechanism
  2019-08-22 19:03 [PATCH 00/35] ASoC: Intel: Clenaup SST initialization Cezary Rojewski
                   ` (7 preceding siblings ...)
  2019-08-22 19:03 ` [PATCH 08/35] ASoC: Intel: Skylake: Inline ipc free operations Cezary Rojewski
@ 2019-08-22 19:03 ` Cezary Rojewski
  2019-08-22 19:04 ` [PATCH 10/35] ASoC: Intel: Relocate irq thread header to sst_ops Cezary Rojewski
                   ` (26 subsequent siblings)
  35 siblings, 0 replies; 107+ messages in thread
From: Cezary Rojewski @ 2019-08-22 19:03 UTC (permalink / raw)
  To: alsa-devel
  Cc: lgirdwood, Cezary Rojewski, broonie, tiwai, pierre-louis.bossart

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.

Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
---
 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(-)

diff --git a/sound/soc/intel/skylake/bxt-sst.c b/sound/soc/intel/skylake/bxt-sst.c
index 68f400cfb390..4e5fb7684415 100644
--- a/sound/soc/intel/skylake/bxt-sst.c
+++ b/sound/soc/intel/skylake/bxt-sst.c
@@ -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");
diff --git a/sound/soc/intel/skylake/cnl-sst-dsp.h b/sound/soc/intel/skylake/cnl-sst-dsp.h
index b1417639bc1c..f3d320b05eb5 100644
--- a/sound/soc/intel/skylake/cnl-sst-dsp.h
+++ b/sound/soc/intel/skylake/cnl-sst-dsp.h
@@ -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__*/
diff --git a/sound/soc/intel/skylake/cnl-sst.c b/sound/soc/intel/skylake/cnl-sst.c
index 76b23ea7802e..5143200579aa 100644
--- a/sound/soc/intel/skylake/cnl-sst.c
+++ b/sound/soc/intel/skylake/cnl-sst.c
@@ -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");
diff --git a/sound/soc/intel/skylake/skl-messages.c b/sound/soc/intel/skylake/skl-messages.c
index e4ac1ae777e0..8fd682872d0c 100644
--- a/sound/soc/intel/skylake/skl-messages.c
+++ b/sound/soc/intel/skylake/skl-messages.c
@@ -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);
diff --git a/sound/soc/intel/skylake/skl-sst-dsp.h b/sound/soc/intel/skylake/skl-sst-dsp.h
index 2129627e6255..21d376692503 100644
--- a/sound/soc/intel/skylake/skl-sst-dsp.h
+++ b/sound/soc/intel/skylake/skl-sst-dsp.h
@@ -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);
 
diff --git a/sound/soc/intel/skylake/skl-sst.c b/sound/soc/intel/skylake/skl-sst.c
index 72ab579ddd27..a7a285ea24e1 100644
--- a/sound/soc/intel/skylake/skl-sst.c
+++ b/sound/soc/intel/skylake/skl-sst.c
@@ -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);
diff --git a/sound/soc/intel/skylake/skl.h b/sound/soc/intel/skylake/skl.h
index 71e69f52b7ab..62e2f2d450e4 100644
--- a/sound/soc/intel/skylake/skl.h
+++ b/sound/soc/intel/skylake/skl.h
@@ -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);
-- 
2.17.1

^ permalink raw reply related	[flat|nested] 107+ messages in thread

* [PATCH 10/35] ASoC: Intel: Relocate irq thread header to sst_ops
  2019-08-22 19:03 [PATCH 00/35] ASoC: Intel: Clenaup SST initialization Cezary Rojewski
                   ` (8 preceding siblings ...)
  2019-08-22 19:03 ` [PATCH 09/35] ASoC: Intel: Skylake: Unify driver cleanup mechanism Cezary Rojewski
@ 2019-08-22 19:04 ` Cezary Rojewski
  2019-08-22 19:04 ` [PATCH 11/35] ASoC: Intel: Merge sst_dsp_device into sst_pdata Cezary Rojewski
                   ` (25 subsequent siblings)
  35 siblings, 0 replies; 107+ messages in thread
From: Cezary Rojewski @ 2019-08-22 19:04 UTC (permalink / raw)
  To: alsa-devel
  Cc: lgirdwood, Cezary Rojewski, broonie, tiwai, pierre-louis.bossart

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.

Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
---
 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(-)

diff --git a/sound/soc/intel/baytrail/sst-baytrail-dsp.c b/sound/soc/intel/baytrail/sst-baytrail-dsp.c
index 4116ba66a4c2..4869e18116eb 100644
--- a/sound/soc/intel/baytrail/sst-baytrail-dsp.c
+++ b/sound/soc/intel/baytrail/sst-baytrail-dsp.c
@@ -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,
diff --git a/sound/soc/intel/baytrail/sst-baytrail-ipc.c b/sound/soc/intel/baytrail/sst-baytrail-ipc.c
index 74274bd38f7a..23d65ad38e19 100644
--- a/sound/soc/intel/baytrail/sst-baytrail-ipc.c
+++ b/sound/soc/intel/baytrail/sst-baytrail-ipc.c
@@ -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,
 };
 
diff --git a/sound/soc/intel/baytrail/sst-baytrail-ipc.h b/sound/soc/intel/baytrail/sst-baytrail-ipc.h
index 755098509327..9aba6b83ee5f 100644
--- a/sound/soc/intel/baytrail/sst-baytrail-ipc.h
+++ b/sound/soc/intel/baytrail/sst-baytrail-ipc.h
@@ -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
diff --git a/sound/soc/intel/common/sst-dsp-priv.h b/sound/soc/intel/common/sst-dsp-priv.h
index 3d8765ce3e0d..7ec477108948 100644
--- a/sound/soc/intel/common/sst-dsp-priv.h
+++ b/sound/soc/intel/common/sst-dsp-priv.h
@@ -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);
diff --git a/sound/soc/intel/common/sst-dsp.h b/sound/soc/intel/common/sst-dsp.h
index 604a80c5859b..05fa1ca72f46 100644
--- a/sound/soc/intel/common/sst-dsp.h
+++ b/sound/soc/intel/common/sst-dsp.h
@@ -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;
 };
 
diff --git a/sound/soc/intel/common/sst-firmware.c b/sound/soc/intel/common/sst-firmware.c
index d27947aeb079..c18236ca77f4 100644
--- a/sound/soc/intel/common/sst-firmware.c
+++ b/sound/soc/intel/common/sst-firmware.c
@@ -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;
 
diff --git a/sound/soc/intel/haswell/sst-haswell-dsp.c b/sound/soc/intel/haswell/sst-haswell-dsp.c
index 88c3f63bded9..c099dec7d61f 100644
--- a/sound/soc/intel/haswell/sst-haswell-dsp.c
+++ b/sound/soc/intel/haswell/sst-haswell-dsp.c
@@ -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,
diff --git a/sound/soc/intel/haswell/sst-haswell-ipc.c b/sound/soc/intel/haswell/sst-haswell-ipc.c
index 5c73b11375e3..e25358d19aae 100644
--- a/sound/soc/intel/haswell/sst-haswell-ipc.c
+++ b/sound/soc/intel/haswell/sst-haswell-ipc.c
@@ -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,
 };
 
diff --git a/sound/soc/intel/haswell/sst-haswell-ipc.h b/sound/soc/intel/haswell/sst-haswell-ipc.h
index fdc70c77e688..d4a936a75f7d 100644
--- a/sound/soc/intel/haswell/sst-haswell-ipc.h
+++ b/sound/soc/intel/haswell/sst-haswell-ipc.h
@@ -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);
diff --git a/sound/soc/intel/skylake/bxt-sst.c b/sound/soc/intel/skylake/bxt-sst.c
index 4e5fb7684415..8faffec4e943 100644
--- a/sound/soc/intel/skylake/bxt-sst.c
+++ b/sound/soc/intel/skylake/bxt-sst.c
@@ -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,
 };
 
diff --git a/sound/soc/intel/skylake/cnl-sst.c b/sound/soc/intel/skylake/cnl-sst.c
index 5143200579aa..02d8e72d2d5a 100644
--- a/sound/soc/intel/skylake/cnl-sst.c
+++ b/sound/soc/intel/skylake/cnl-sst.c
@@ -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)
diff --git a/sound/soc/intel/skylake/skl-sst-dsp.c b/sound/soc/intel/skylake/skl-sst-dsp.c
index e0807db225f4..8d98089e3177 100644
--- a/sound/soc/intel/skylake/skl-sst-dsp.c
+++ b/sound/soc/intel/skylake/skl-sst-dsp.c
@@ -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);
diff --git a/sound/soc/intel/skylake/skl-sst.c b/sound/soc/intel/skylake/skl-sst.c
index a7a285ea24e1..9fd3cf30e87c 100644
--- a/sound/soc/intel/skylake/skl-sst.c
+++ b/sound/soc/intel/skylake/skl-sst.c
@@ -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,
 };
 
-- 
2.17.1

^ permalink raw reply related	[flat|nested] 107+ messages in thread

* [PATCH 11/35] ASoC: Intel: Merge sst_dsp_device into sst_pdata
  2019-08-22 19:03 [PATCH 00/35] ASoC: Intel: Clenaup SST initialization Cezary Rojewski
                   ` (9 preceding siblings ...)
  2019-08-22 19:04 ` [PATCH 10/35] ASoC: Intel: Relocate irq thread header to sst_ops Cezary Rojewski
@ 2019-08-22 19:04 ` Cezary Rojewski
  2019-08-23 18:54   ` Pierre-Louis Bossart
  2019-08-22 19:04 ` [PATCH 12/35] ASoC: Intel: Skylake: Reuse sst_dsp_free Cezary Rojewski
                   ` (24 subsequent siblings)
  35 siblings, 1 reply; 107+ messages in thread
From: Cezary Rojewski @ 2019-08-22 19:04 UTC (permalink / raw)
  To: alsa-devel
  Cc: lgirdwood, Cezary Rojewski, broonie, tiwai, pierre-louis.bossart

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.

Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
---
 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(-)

diff --git a/sound/soc/intel/baytrail/sst-baytrail-ipc.c b/sound/soc/intel/baytrail/sst-baytrail-ipc.c
index 23d65ad38e19..efa78e33caf2 100644
--- a/sound/soc/intel/baytrail/sst-baytrail-ipc.c
+++ b/sound/soc/intel/baytrail/sst-baytrail-ipc.c
@@ -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;
diff --git a/sound/soc/intel/common/sst-dsp-priv.h b/sound/soc/intel/common/sst-dsp-priv.h
index 7ec477108948..8a7009937d59 100644
--- a/sound/soc/intel/common/sst-dsp-priv.h
+++ b/sound/soc/intel/common/sst-dsp-priv.h
@@ -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;
diff --git a/sound/soc/intel/common/sst-dsp.h b/sound/soc/intel/common/sst-dsp.h
index 05fa1ca72f46..63c29bb45cf1 100644
--- a/sound/soc/intel/common/sst-dsp.h
+++ b/sound/soc/intel/common/sst-dsp.h
@@ -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
 
diff --git a/sound/soc/intel/common/sst-firmware.c b/sound/soc/intel/common/sst-firmware.c
index c18236ca77f4..6b6af11c32c3 100644
--- a/sound/soc/intel/common/sst-firmware.c
+++ b/sound/soc/intel/common/sst-firmware.c
@@ -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);
diff --git a/sound/soc/intel/haswell/sst-haswell-ipc.c b/sound/soc/intel/haswell/sst-haswell-ipc.c
index e25358d19aae..61c4d674940e 100644
--- a/sound/soc/intel/haswell/sst-haswell-ipc.c
+++ b/sound/soc/intel/haswell/sst-haswell-ipc.c
@@ -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:
diff --git a/sound/soc/intel/skylake/bxt-sst.c b/sound/soc/intel/skylake/bxt-sst.c
index 8faffec4e943..e3614acff34d 100644
--- a/sound/soc/intel/skylake/bxt-sst.c
+++ b/sound/soc/intel/skylake/bxt-sst.c
@@ -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,
 };
 
diff --git a/sound/soc/intel/skylake/cnl-sst-dsp.h b/sound/soc/intel/skylake/cnl-sst-dsp.h
index f3d320b05eb5..30b586acc858 100644
--- a/sound/soc/intel/skylake/cnl-sst-dsp.h
+++ b/sound/soc/intel/skylake/cnl-sst-dsp.h
@@ -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 */
diff --git a/sound/soc/intel/skylake/cnl-sst.c b/sound/soc/intel/skylake/cnl-sst.c
index 02d8e72d2d5a..84dc6b82831d 100644
--- a/sound/soc/intel/skylake/cnl-sst.c
+++ b/sound/soc/intel/skylake/cnl-sst.c
@@ -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,
 };
 
diff --git a/sound/soc/intel/skylake/skl-sst-dsp.c b/sound/soc/intel/skylake/skl-sst-dsp.c
index 8d98089e3177..348e69226e46 100644
--- a/sound/soc/intel/skylake/skl-sst-dsp.c
+++ b/sound/soc/intel/skylake/skl-sst-dsp.c
@@ -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) {
diff --git a/sound/soc/intel/skylake/skl-sst-dsp.h b/sound/soc/intel/skylake/skl-sst-dsp.h
index 21d376692503..ba37433e4efa 100644
--- a/sound/soc/intel/skylake/skl-sst-dsp.h
+++ b/sound/soc/intel/skylake/skl-sst-dsp.h
@@ -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);
diff --git a/sound/soc/intel/skylake/skl-sst-utils.c b/sound/soc/intel/skylake/skl-sst-utils.c
index d43cbf4a71ef..9061a9b17ea0 100644
--- a/sound/soc/intel/skylake/skl-sst-utils.c
+++ b/sound/soc/intel/skylake/skl-sst-utils.c
@@ -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;
diff --git a/sound/soc/intel/skylake/skl-sst.c b/sound/soc/intel/skylake/skl-sst.c
index 9fd3cf30e87c..72ee3d8a1d7d 100644
--- a/sound/soc/intel/skylake/skl-sst.c
+++ b/sound/soc/intel/skylake/skl-sst.c
@@ -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,
 };
 
-- 
2.17.1

^ permalink raw reply related	[flat|nested] 107+ messages in thread

* [PATCH 12/35] ASoC: Intel: Skylake: Reuse sst_dsp_free
  2019-08-22 19:03 [PATCH 00/35] ASoC: Intel: Clenaup SST initialization Cezary Rojewski
                   ` (10 preceding siblings ...)
  2019-08-22 19:04 ` [PATCH 11/35] ASoC: Intel: Merge sst_dsp_device into sst_pdata Cezary Rojewski
@ 2019-08-22 19:04 ` Cezary Rojewski
  2019-08-23 19:07   ` Pierre-Louis Bossart
  2019-08-22 19:04 ` [PATCH 13/35] ASoC: Intel: Skylake: Reuse sst_dsp_new Cezary Rojewski
                   ` (23 subsequent siblings)
  35 siblings, 1 reply; 107+ messages in thread
From: Cezary Rojewski @ 2019-08-22 19:04 UTC (permalink / raw)
  To: alsa-devel
  Cc: lgirdwood, Cezary Rojewski, broonie, tiwai, pierre-louis.bossart

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.

Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
---
 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(-)

diff --git a/sound/soc/intel/skylake/cnl-sst-dsp.c b/sound/soc/intel/skylake/cnl-sst-dsp.c
index 189c1c7086e3..48b465939ef8 100644
--- a/sound/soc/intel/skylake/cnl-sst-dsp.c
+++ b/sound/soc/intel/skylake/cnl-sst-dsp.c
@@ -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);
diff --git a/sound/soc/intel/skylake/skl-sst-dsp.c b/sound/soc/intel/skylake/skl-sst-dsp.c
index 348e69226e46..1c4ecbcd7db7 100644
--- a/sound/soc/intel/skylake/skl-sst-dsp.c
+++ b/sound/soc/intel/skylake/skl-sst-dsp.c
@@ -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);
diff --git a/sound/soc/intel/skylake/skl-sst.c b/sound/soc/intel/skylake/skl-sst.c
index 72ee3d8a1d7d..e55523826346 100644
--- a/sound/soc/intel/skylake/skl-sst.c
+++ b/sound/soc/intel/skylake/skl-sst.c
@@ -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);
-- 
2.17.1

^ permalink raw reply related	[flat|nested] 107+ messages in thread

* [PATCH 13/35] ASoC: Intel: Skylake: Reuse sst_dsp_new
  2019-08-22 19:03 [PATCH 00/35] ASoC: Intel: Clenaup SST initialization Cezary Rojewski
                   ` (11 preceding siblings ...)
  2019-08-22 19:04 ` [PATCH 12/35] ASoC: Intel: Skylake: Reuse sst_dsp_free Cezary Rojewski
@ 2019-08-22 19:04 ` Cezary Rojewski
  2019-08-23 19:09   ` Pierre-Louis Bossart
  2019-08-22 19:04 ` [PATCH 14/35] ASoC: Intel: Skylake: Remove skl_dsp_acquire_irq Cezary Rojewski
                   ` (22 subsequent siblings)
  35 siblings, 1 reply; 107+ messages in thread
From: Cezary Rojewski @ 2019-08-22 19:04 UTC (permalink / raw)
  To: alsa-devel
  Cc: lgirdwood, Cezary Rojewski, broonie, tiwai, pierre-louis.bossart

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.

Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
---
 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(-)

diff --git a/sound/soc/intel/skylake/bxt-sst.c b/sound/soc/intel/skylake/bxt-sst.c
index e3614acff34d..a8a2783f9b37 100644
--- a/sound/soc/intel/skylake/bxt-sst.c
+++ b/sound/soc/intel/skylake/bxt-sst.c
@@ -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);
 
diff --git a/sound/soc/intel/skylake/cnl-sst.c b/sound/soc/intel/skylake/cnl-sst.c
index 84dc6b82831d..0b0337f6ebff 100644
--- a/sound/soc/intel/skylake/cnl-sst.c
+++ b/sound/soc/intel/skylake/cnl-sst.c
@@ -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);
 
diff --git a/sound/soc/intel/skylake/skl-sst-dsp.c b/sound/soc/intel/skylake/skl-sst-dsp.c
index 1c4ecbcd7db7..9d8eb1af4798 100644
--- a/sound/soc/intel/skylake/skl-sst-dsp.c
+++ b/sound/soc/intel/skylake/skl-sst-dsp.c
@@ -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;
diff --git a/sound/soc/intel/skylake/skl-sst-dsp.h b/sound/soc/intel/skylake/skl-sst-dsp.h
index ba37433e4efa..1d579d59de60 100644
--- a/sound/soc/intel/skylake/skl-sst-dsp.h
+++ b/sound/soc/intel/skylake/skl-sst-dsp.h
@@ -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);
 
diff --git a/sound/soc/intel/skylake/skl-sst-utils.c b/sound/soc/intel/skylake/skl-sst-utils.c
index 9061a9b17ea0..8e03a10855c4 100644
--- a/sound/soc/intel/skylake/skl-sst-utils.c
+++ b/sound/soc/intel/skylake/skl-sst-utils.c
@@ -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;
diff --git a/sound/soc/intel/skylake/skl-sst.c b/sound/soc/intel/skylake/skl-sst.c
index e55523826346..6bb003add9e2 100644
--- a/sound/soc/intel/skylake/skl-sst.c
+++ b/sound/soc/intel/skylake/skl-sst.c
@@ -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);
 
-- 
2.17.1

^ permalink raw reply related	[flat|nested] 107+ messages in thread

* [PATCH 14/35] ASoC: Intel: Skylake: Remove skl_dsp_acquire_irq
  2019-08-22 19:03 [PATCH 00/35] ASoC: Intel: Clenaup SST initialization Cezary Rojewski
                   ` (12 preceding siblings ...)
  2019-08-22 19:04 ` [PATCH 13/35] ASoC: Intel: Skylake: Reuse sst_dsp_new Cezary Rojewski
@ 2019-08-22 19:04 ` Cezary Rojewski
  2019-08-22 19:04 ` [PATCH 15/35] ASoC: Intel: Skylake: Use dsp loading functions directly Cezary Rojewski
                   ` (21 subsequent siblings)
  35 siblings, 0 replies; 107+ messages in thread
From: Cezary Rojewski @ 2019-08-22 19:04 UTC (permalink / raw)
  To: alsa-devel
  Cc: lgirdwood, Cezary Rojewski, broonie, tiwai, pierre-louis.bossart

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.

Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
---
 sound/soc/intel/skylake/skl-sst-dsp.c | 14 --------------
 sound/soc/intel/skylake/skl-sst-dsp.h |  1 -
 2 files changed, 15 deletions(-)

diff --git a/sound/soc/intel/skylake/skl-sst-dsp.c b/sound/soc/intel/skylake/skl-sst-dsp.c
index 9d8eb1af4798..773b4b562a07 100644
--- a/sound/soc/intel/skylake/skl-sst-dsp.c
+++ b/sound/soc/intel/skylake/skl-sst-dsp.c
@@ -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;
diff --git a/sound/soc/intel/skylake/skl-sst-dsp.h b/sound/soc/intel/skylake/skl-sst-dsp.h
index 1d579d59de60..45d99b6b448e 100644
--- a/sound/soc/intel/skylake/skl-sst-dsp.h
+++ b/sound/soc/intel/skylake/skl-sst-dsp.h
@@ -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);
-- 
2.17.1

^ permalink raw reply related	[flat|nested] 107+ messages in thread

* [PATCH 15/35] ASoC: Intel: Skylake: Use dsp loading functions directly
  2019-08-22 19:03 [PATCH 00/35] ASoC: Intel: Clenaup SST initialization Cezary Rojewski
                   ` (13 preceding siblings ...)
  2019-08-22 19:04 ` [PATCH 14/35] ASoC: Intel: Skylake: Remove skl_dsp_acquire_irq Cezary Rojewski
@ 2019-08-22 19:04 ` Cezary Rojewski
  2019-08-23 19:17   ` Pierre-Louis Bossart
  2019-08-22 19:04 ` [PATCH 16/35] ASoC: Intel: Skylake: Make dsp_ops::stream_tag obsolete Cezary Rojewski
                   ` (20 subsequent siblings)
  35 siblings, 1 reply; 107+ messages in thread
From: Cezary Rojewski @ 2019-08-22 19:04 UTC (permalink / raw)
  To: alsa-devel
  Cc: lgirdwood, Cezary Rojewski, broonie, tiwai, pierre-louis.bossart

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.

Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
---
 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(-)

diff --git a/sound/soc/intel/skylake/bxt-sst.c b/sound/soc/intel/skylake/bxt-sst.c
index a8a2783f9b37..1ca4fba0f35f 100644
--- a/sound/soc/intel/skylake/bxt-sst.c
+++ b/sound/soc/intel/skylake/bxt-sst.c
@@ -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;
 }
diff --git a/sound/soc/intel/skylake/cnl-sst.c b/sound/soc/intel/skylake/cnl-sst.c
index 0b0337f6ebff..5ad34e9f51eb 100644
--- a/sound/soc/intel/skylake/cnl-sst.c
+++ b/sound/soc/intel/skylake/cnl-sst.c
@@ -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;
 }
diff --git a/sound/soc/intel/skylake/skl-messages.c b/sound/soc/intel/skylake/skl-messages.c
index 8fd682872d0c..20ab980fe8a1 100644
--- a/sound/soc/intel/skylake/skl-messages.c
+++ b/sound/soc/intel/skylake/skl-messages.c
@@ -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);
diff --git a/sound/soc/intel/skylake/skl-sst-cldma.c b/sound/soc/intel/skylake/skl-sst-cldma.c
index 5a2c35f58fda..ca2e18666582 100644
--- a/sound/soc/intel/skylake/skl-sst-cldma.c
+++ b/sound/soc/intel/skylake/skl-sst-cldma.c
@@ -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;
diff --git a/sound/soc/intel/skylake/skl-sst-dsp.h b/sound/soc/intel/skylake/skl-sst-dsp.h
index 45d99b6b448e..97e16a602331 100644
--- a/sound/soc/intel/skylake/skl-sst-dsp.h
+++ b/sound/soc/intel/skylake/skl-sst-dsp.h
@@ -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);
-- 
2.17.1

^ permalink raw reply related	[flat|nested] 107+ messages in thread

* [PATCH 16/35] ASoC: Intel: Skylake: Make dsp_ops::stream_tag obsolete
  2019-08-22 19:03 [PATCH 00/35] ASoC: Intel: Clenaup SST initialization Cezary Rojewski
                   ` (14 preceding siblings ...)
  2019-08-22 19:04 ` [PATCH 15/35] ASoC: Intel: Skylake: Use dsp loading functions directly Cezary Rojewski
@ 2019-08-22 19:04 ` Cezary Rojewski
  2019-08-22 19:04 ` [PATCH 17/35] ASoC: Intel: Skylake: Remove skl_dsp_loader_ops Cezary Rojewski
                   ` (19 subsequent siblings)
  35 siblings, 0 replies; 107+ messages in thread
From: Cezary Rojewski @ 2019-08-22 19:04 UTC (permalink / raw)
  To: alsa-devel
  Cc: lgirdwood, Cezary Rojewski, broonie, tiwai, pierre-louis.bossart

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.

Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
---
 sound/soc/intel/skylake/bxt-sst.c | 14 ++++++--------
 sound/soc/intel/skylake/cnl-sst.c | 13 ++++++-------
 2 files changed, 12 insertions(+), 15 deletions(-)

diff --git a/sound/soc/intel/skylake/bxt-sst.c b/sound/soc/intel/skylake/bxt-sst.c
index 1ca4fba0f35f..45da02f74f4d 100644
--- a/sound/soc/intel/skylake/bxt-sst.c
+++ b/sound/soc/intel/skylake/bxt-sst.c
@@ -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",
diff --git a/sound/soc/intel/skylake/cnl-sst.c b/sound/soc/intel/skylake/cnl-sst.c
index 5ad34e9f51eb..4d9a4d5886f4 100644
--- a/sound/soc/intel/skylake/cnl-sst.c
+++ b/sound/soc/intel/skylake/cnl-sst.c
@@ -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);
-- 
2.17.1

^ permalink raw reply related	[flat|nested] 107+ messages in thread

* [PATCH 17/35] ASoC: Intel: Skylake: Remove skl_dsp_loader_ops
  2019-08-22 19:03 [PATCH 00/35] ASoC: Intel: Clenaup SST initialization Cezary Rojewski
                   ` (15 preceding siblings ...)
  2019-08-22 19:04 ` [PATCH 16/35] ASoC: Intel: Skylake: Make dsp_ops::stream_tag obsolete Cezary Rojewski
@ 2019-08-22 19:04 ` Cezary Rojewski
  2019-08-23 19:21   ` Pierre-Louis Bossart
  2019-08-22 19:04 ` [PATCH 18/35] ASoC: Intel: Skylake: Remove window0 sst_addr fields Cezary Rojewski
                   ` (18 subsequent siblings)
  35 siblings, 1 reply; 107+ messages in thread
From: Cezary Rojewski @ 2019-08-22 19:04 UTC (permalink / raw)
  To: alsa-devel
  Cc: lgirdwood, Cezary Rojewski, broonie, tiwai, pierre-louis.bossart

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.

Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
---
 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(-)

diff --git a/sound/soc/intel/common/sst-dsp-priv.h b/sound/soc/intel/common/sst-dsp-priv.h
index 8a7009937d59..0fe9bebcfb38 100644
--- a/sound/soc/intel/common/sst-dsp-priv.h
+++ b/sound/soc/intel/common/sst-dsp-priv.h
@@ -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;
diff --git a/sound/soc/intel/skylake/bxt-sst.c b/sound/soc/intel/skylake/bxt-sst.c
index 45da02f74f4d..c7961050c2ee 100644
--- a/sound/soc/intel/skylake/bxt-sst.c
+++ b/sound/soc/intel/skylake/bxt-sst.c
@@ -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;
diff --git a/sound/soc/intel/skylake/cnl-sst-dsp.h b/sound/soc/intel/skylake/cnl-sst-dsp.h
index 30b586acc858..70da4f312f53 100644
--- a/sound/soc/intel/skylake/cnl-sst-dsp.h
+++ b/sound/soc/intel/skylake/cnl-sst-dsp.h
@@ -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__*/
diff --git a/sound/soc/intel/skylake/cnl-sst.c b/sound/soc/intel/skylake/cnl-sst.c
index 4d9a4d5886f4..2f10076cc906 100644
--- a/sound/soc/intel/skylake/cnl-sst.c
+++ b/sound/soc/intel/skylake/cnl-sst.c
@@ -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;
diff --git a/sound/soc/intel/skylake/skl-messages.c b/sound/soc/intel/skylake/skl-messages.c
index 20ab980fe8a1..6fbceec67b53 100644
--- a/sound/soc/intel/skylake/skl-messages.c
+++ b/sound/soc/intel/skylake/skl-messages.c
@@ -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;
diff --git a/sound/soc/intel/skylake/skl-sst-dsp.h b/sound/soc/intel/skylake/skl-sst-dsp.h
index 97e16a602331..9f2dae92c1c9 100644
--- a/sound/soc/intel/skylake/skl-sst-dsp.h
+++ b/sound/soc/intel/skylake/skl-sst-dsp.h
@@ -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,
diff --git a/sound/soc/intel/skylake/skl-sst-utils.c b/sound/soc/intel/skylake/skl-sst-utils.c
index 8e03a10855c4..bbe67e298efe 100644
--- a/sound/soc/intel/skylake/skl-sst-utils.c
+++ b/sound/soc/intel/skylake/skl-sst-utils.c
@@ -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);
 
diff --git a/sound/soc/intel/skylake/skl-sst.c b/sound/soc/intel/skylake/skl-sst.c
index 6bb003add9e2..e9a7b2509b35 100644
--- a/sound/soc/intel/skylake/skl-sst.c
+++ b/sound/soc/intel/skylake/skl-sst.c
@@ -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;
diff --git a/sound/soc/intel/skylake/skl.h b/sound/soc/intel/skylake/skl.h
index 62e2f2d450e4..beeef67cb55f 100644
--- a/sound/soc/intel/skylake/skl.h
+++ b/sound/soc/intel/skylake/skl.h
@@ -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);
 };
 
-- 
2.17.1

^ permalink raw reply related	[flat|nested] 107+ messages in thread

* [PATCH 18/35] ASoC: Intel: Skylake: Remove window0 sst_addr fields
  2019-08-22 19:03 [PATCH 00/35] ASoC: Intel: Clenaup SST initialization Cezary Rojewski
                   ` (16 preceding siblings ...)
  2019-08-22 19:04 ` [PATCH 17/35] ASoC: Intel: Skylake: Remove skl_dsp_loader_ops Cezary Rojewski
@ 2019-08-22 19:04 ` Cezary Rojewski
  2019-08-23 19:26   ` Pierre-Louis Bossart
  2019-08-22 19:04 ` [PATCH 19/35] ASoC: Intel: Skylake: Remove redundant W0 and W1 macros Cezary Rojewski
                   ` (17 subsequent siblings)
  35 siblings, 1 reply; 107+ messages in thread
From: Cezary Rojewski @ 2019-08-22 19:04 UTC (permalink / raw)
  To: alsa-devel
  Cc: lgirdwood, Cezary Rojewski, broonie, tiwai, pierre-louis.bossart

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.

Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
---
 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(-)

diff --git a/sound/soc/intel/common/sst-dsp-priv.h b/sound/soc/intel/common/sst-dsp-priv.h
index 0fe9bebcfb38..53dcd87bab44 100644
--- a/sound/soc/intel/common/sst-dsp-priv.h
+++ b/sound/soc/intel/common/sst-dsp-priv.h
@@ -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;
diff --git a/sound/soc/intel/skylake/bxt-sst.c b/sound/soc/intel/skylake/bxt-sst.c
index c7961050c2ee..641d5cf4aeb1 100644
--- a/sound/soc/intel/skylake/bxt-sst.c
+++ b/sound/soc/intel/skylake/bxt-sst.c
@@ -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);
diff --git a/sound/soc/intel/skylake/cnl-sst.c b/sound/soc/intel/skylake/cnl-sst.c
index 2f10076cc906..64971966af38 100644
--- a/sound/soc/intel/skylake/cnl-sst.c
+++ b/sound/soc/intel/skylake/cnl-sst.c
@@ -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,
diff --git a/sound/soc/intel/skylake/skl-debug.c b/sound/soc/intel/skylake/skl-debug.c
index 212370bf704c..6781eac13232 100644
--- a/sound/soc/intel/skylake/skl-debug.c
+++ b/sound/soc/intel/skylake/skl-debug.c
@@ -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;
diff --git a/sound/soc/intel/skylake/skl-sst-dsp.h b/sound/soc/intel/skylake/skl-sst-dsp.h
index 9f2dae92c1c9..5a0cb7f3d57e 100644
--- a/sound/soc/intel/skylake/skl-sst-dsp.h
+++ b/sound/soc/intel/skylake/skl-sst-dsp.h
@@ -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
diff --git a/sound/soc/intel/skylake/skl-sst.c b/sound/soc/intel/skylake/skl-sst.c
index e9a7b2509b35..7e63c91cea54 100644
--- a/sound/soc/intel/skylake/skl-sst.c
+++ b/sound/soc/intel/skylake/skl-sst.c
@@ -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);
-- 
2.17.1

^ permalink raw reply related	[flat|nested] 107+ messages in thread

* [PATCH 19/35] ASoC: Intel: Skylake: Remove redundant W0 and W1 macros
  2019-08-22 19:03 [PATCH 00/35] ASoC: Intel: Clenaup SST initialization Cezary Rojewski
                   ` (17 preceding siblings ...)
  2019-08-22 19:04 ` [PATCH 18/35] ASoC: Intel: Skylake: Remove window0 sst_addr fields Cezary Rojewski
@ 2019-08-22 19:04 ` Cezary Rojewski
  2019-08-23 19:28   ` Pierre-Louis Bossart
  2019-08-22 19:04 ` [PATCH 20/35] ASoC: Intel: Skylake: Remove redundant SRAM fields Cezary Rojewski
                   ` (16 subsequent siblings)
  35 siblings, 1 reply; 107+ messages in thread
From: Cezary Rojewski @ 2019-08-22 19:04 UTC (permalink / raw)
  To: alsa-devel
  Cc: lgirdwood, Cezary Rojewski, broonie, tiwai, pierre-louis.bossart

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.

Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
---
 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(-)

diff --git a/sound/soc/intel/skylake/bxt-sst.c b/sound/soc/intel/skylake/bxt-sst.c
index 641d5cf4aeb1..fdd94711c3b4 100644
--- a/sound/soc/intel/skylake/bxt-sst.c
+++ b/sound/soc/intel/skylake/bxt-sst.c
@@ -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) {
diff --git a/sound/soc/intel/skylake/cnl-sst-dsp.h b/sound/soc/intel/skylake/cnl-sst-dsp.h
index 70da4f312f53..a465cc42b7e8 100644
--- a/sound/soc/intel/skylake/cnl-sst-dsp.h
+++ b/sound/soc/intel/skylake/cnl-sst-dsp.h
@@ -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
diff --git a/sound/soc/intel/skylake/cnl-sst.c b/sound/soc/intel/skylake/cnl-sst.c
index 64971966af38..d3da23e0ef05 100644
--- a/sound/soc/intel/skylake/cnl-sst.c
+++ b/sound/soc/intel/skylake/cnl-sst.c
@@ -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) {
diff --git a/sound/soc/intel/skylake/skl-sst-dsp.h b/sound/soc/intel/skylake/skl-sst-dsp.h
index 5a0cb7f3d57e..3c92b1d849e4 100644
--- a/sound/soc/intel/skylake/skl-sst-dsp.h
+++ b/sound/soc/intel/skylake/skl-sst-dsp.h
@@ -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
 
diff --git a/sound/soc/intel/skylake/skl-sst-ipc.c b/sound/soc/intel/skylake/skl-sst-ipc.c
index 2700f882103d..72d7284d2fff 100644
--- a/sound/soc/intel/skylake/skl-sst-ipc.c
+++ b/sound/soc/intel/skylake/skl-sst-ipc.c
@@ -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)
diff --git a/sound/soc/intel/skylake/skl-sst.c b/sound/soc/intel/skylake/skl-sst.c
index 7e63c91cea54..191931578fd2 100644
--- a/sound/soc/intel/skylake/skl-sst.c
+++ b/sound/soc/intel/skylake/skl-sst.c
@@ -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) {
-- 
2.17.1

^ permalink raw reply related	[flat|nested] 107+ messages in thread

* [PATCH 20/35] ASoC: Intel: Skylake: Remove redundant SRAM fields
  2019-08-22 19:03 [PATCH 00/35] ASoC: Intel: Clenaup SST initialization Cezary Rojewski
                   ` (18 preceding siblings ...)
  2019-08-22 19:04 ` [PATCH 19/35] ASoC: Intel: Skylake: Remove redundant W0 and W1 macros Cezary Rojewski
@ 2019-08-22 19:04 ` Cezary Rojewski
  2019-08-22 19:04 ` [PATCH 21/35] ASoC: Intel: Expose ACPI loading members Cezary Rojewski
                   ` (15 subsequent siblings)
  35 siblings, 0 replies; 107+ messages in thread
From: Cezary Rojewski @ 2019-08-22 19:04 UTC (permalink / raw)
  To: alsa-devel
  Cc: lgirdwood, Cezary Rojewski, broonie, tiwai, pierre-louis.bossart

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.

Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
---
 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(-)

diff --git a/sound/soc/intel/common/sst-dsp-priv.h b/sound/soc/intel/common/sst-dsp-priv.h
index 53dcd87bab44..a4628a89d47d 100644
--- a/sound/soc/intel/common/sst-dsp-priv.h
+++ b/sound/soc/intel/common/sst-dsp-priv.h
@@ -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;
diff --git a/sound/soc/intel/skylake/bxt-sst.c b/sound/soc/intel/skylake/bxt-sst.c
index fdd94711c3b4..5b46215fbc0f 100644
--- a/sound/soc/intel/skylake/bxt-sst.c
+++ b/sound/soc/intel/skylake/bxt-sst.c
@@ -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,
diff --git a/sound/soc/intel/skylake/cnl-sst.c b/sound/soc/intel/skylake/cnl-sst.c
index d3da23e0ef05..47b991c03742 100644
--- a/sound/soc/intel/skylake/cnl-sst.c
+++ b/sound/soc/intel/skylake/cnl-sst.c
@@ -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,
diff --git a/sound/soc/intel/skylake/skl-sst.c b/sound/soc/intel/skylake/skl-sst.c
index 191931578fd2..c823936ffd34 100644
--- a/sound/soc/intel/skylake/skl-sst.c
+++ b/sound/soc/intel/skylake/skl-sst.c
@@ -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,
-- 
2.17.1

^ permalink raw reply related	[flat|nested] 107+ messages in thread

* [PATCH 21/35] ASoC: Intel: Expose ACPI loading members
  2019-08-22 19:03 [PATCH 00/35] ASoC: Intel: Clenaup SST initialization Cezary Rojewski
                   ` (19 preceding siblings ...)
  2019-08-22 19:04 ` [PATCH 20/35] ASoC: Intel: Skylake: Remove redundant SRAM fields Cezary Rojewski
@ 2019-08-22 19:04 ` Cezary Rojewski
  2019-08-23 19:32   ` Pierre-Louis Bossart
  2019-08-22 19:04 ` [PATCH 22/35] ASoC: Intel: Haswell: Define separate ACPI loader Cezary Rojewski
                   ` (14 subsequent siblings)
  35 siblings, 1 reply; 107+ messages in thread
From: Cezary Rojewski @ 2019-08-22 19:04 UTC (permalink / raw)
  To: alsa-devel
  Cc: lgirdwood, Cezary Rojewski, broonie, tiwai, pierre-louis.bossart

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.

Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
---
 sound/soc/intel/common/sst-acpi.c | 23 ++++-------------------
 sound/soc/intel/common/sst-dsp.h  | 21 +++++++++++++++++++++
 2 files changed, 25 insertions(+), 19 deletions(-)

diff --git a/sound/soc/intel/common/sst-acpi.c b/sound/soc/intel/common/sst-acpi.c
index 0e8e0a7a11df..42f9b02f2ea3 100644
--- a/sound/soc/intel/common/sst-acpi.c
+++ b/sound/soc/intel/common/sst-acpi.c
@@ -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",
diff --git a/sound/soc/intel/common/sst-dsp.h b/sound/soc/intel/common/sst-dsp.h
index 63c29bb45cf1..a2ac7998fbdb 100644
--- a/sound/soc/intel/common/sst-dsp.h
+++ b/sound/soc/intel/common/sst-dsp.h
@@ -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.
-- 
2.17.1

^ permalink raw reply related	[flat|nested] 107+ messages in thread

* [PATCH 22/35] ASoC: Intel: Haswell: Define separate ACPI loader
  2019-08-22 19:03 [PATCH 00/35] ASoC: Intel: Clenaup SST initialization Cezary Rojewski
                   ` (20 preceding siblings ...)
  2019-08-22 19:04 ` [PATCH 21/35] ASoC: Intel: Expose ACPI loading members Cezary Rojewski
@ 2019-08-22 19:04 ` Cezary Rojewski
  2019-08-23 19:35   ` Pierre-Louis Bossart
  2019-08-22 19:04 ` [PATCH 23/35] ASoC: Intel: Baytrail: " Cezary Rojewski
                   ` (13 subsequent siblings)
  35 siblings, 1 reply; 107+ messages in thread
From: Cezary Rojewski @ 2019-08-22 19:04 UTC (permalink / raw)
  To: alsa-devel
  Cc: lgirdwood, Cezary Rojewski, broonie, tiwai, pierre-louis.bossart

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.

Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
---
 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

diff --git a/sound/soc/intel/Kconfig b/sound/soc/intel/Kconfig
index a3ec17fd63cd..9191773d203c 100644
--- a/sound/soc/intel/Kconfig
+++ b/sound/soc/intel/Kconfig
@@ -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
diff --git a/sound/soc/intel/common/sst-acpi.c b/sound/soc/intel/common/sst-acpi.c
index 42f9b02f2ea3..7d2f04ff0479 100644
--- a/sound/soc/intel/common/sst-acpi.c
+++ b/sound/soc/intel/common/sst-acpi.c
@@ -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
diff --git a/sound/soc/intel/haswell/Makefile b/sound/soc/intel/haswell/Makefile
index ad2341aea8ae..0af852d0577b 100644
--- a/sound/soc/intel/haswell/Makefile
+++ b/sound/soc/intel/haswell/Makefile
@@ -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
diff --git a/sound/soc/intel/haswell/acpi.c b/sound/soc/intel/haswell/acpi.c
new file mode 100644
index 000000000000..7bd8b03851c4
--- /dev/null
+++ b/sound/soc/intel/haswell/acpi.c
@@ -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 <cezary.rojewski@intel.com>");
+MODULE_DESCRIPTION("Intel HSW loader on ACPI systems");
+MODULE_LICENSE("GPL v2");
-- 
2.17.1

^ permalink raw reply related	[flat|nested] 107+ messages in thread

* [PATCH 23/35] ASoC: Intel: Baytrail: Define separate ACPI loader
  2019-08-22 19:03 [PATCH 00/35] ASoC: Intel: Clenaup SST initialization Cezary Rojewski
                   ` (21 preceding siblings ...)
  2019-08-22 19:04 ` [PATCH 22/35] ASoC: Intel: Haswell: Define separate ACPI loader Cezary Rojewski
@ 2019-08-22 19:04 ` Cezary Rojewski
  2019-08-23 19:36   ` Pierre-Louis Bossart
  2019-08-22 19:04 ` [PATCH 24/35] ASoC: Intel: Refactor probing of ACPI devices Cezary Rojewski
                   ` (12 subsequent siblings)
  35 siblings, 1 reply; 107+ messages in thread
From: Cezary Rojewski @ 2019-08-22 19:04 UTC (permalink / raw)
  To: alsa-devel
  Cc: lgirdwood, Cezary Rojewski, broonie, tiwai, pierre-louis.bossart

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.

Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
---
 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

diff --git a/sound/soc/intel/Kconfig b/sound/soc/intel/Kconfig
index 9191773d203c..baab845ea0ef 100644
--- a/sound/soc/intel/Kconfig
+++ b/sound/soc/intel/Kconfig
@@ -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
diff --git a/sound/soc/intel/baytrail/Makefile b/sound/soc/intel/baytrail/Makefile
index 4d0806aac6bd..b59d4893b46b 100644
--- a/sound/soc/intel/baytrail/Makefile
+++ b/sound/soc/intel/baytrail/Makefile
@@ -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
diff --git a/sound/soc/intel/baytrail/acpi.c b/sound/soc/intel/baytrail/acpi.c
new file mode 100644
index 000000000000..57d10a6e3be2
--- /dev/null
+++ b/sound/soc/intel/baytrail/acpi.c
@@ -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 <cezary.rojewski@intel.com>");
+MODULE_DESCRIPTION("Intel BYT loader on ACPI systems");
+MODULE_LICENSE("GPL v2");
diff --git a/sound/soc/intel/baytrail/sst-baytrail-dsp.c b/sound/soc/intel/baytrail/sst-baytrail-dsp.c
index 4869e18116eb..81bc05d62d5d 100644
--- a/sound/soc/intel/baytrail/sst-baytrail-dsp.c
+++ b/sound/soc/intel/baytrail/sst-baytrail-dsp.c
@@ -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"
diff --git a/sound/soc/intel/common/Makefile b/sound/soc/intel/common/Makefile
index 56c81e20b5bf..65e0e66ab64f 100644
--- a/sound/soc/intel/common/Makefile
+++ b/sound/soc/intel/common/Makefile
@@ -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
diff --git a/sound/soc/intel/common/sst-acpi.c b/sound/soc/intel/common/sst-acpi.c
index 7d2f04ff0479..8e75126106ea 100644
--- a/sound/soc/intel/common/sst-acpi.c
+++ b/sound/soc/intel/common/sst-acpi.c
@@ -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 <jarkko.nikula@linux.intel.com>");
-MODULE_DESCRIPTION("Intel SST loader on ACPI systems");
-MODULE_LICENSE("GPL v2");
-- 
2.17.1

^ permalink raw reply related	[flat|nested] 107+ messages in thread

* [PATCH 24/35] ASoC: Intel: Refactor probing of ACPI devices
  2019-08-22 19:03 [PATCH 00/35] ASoC: Intel: Clenaup SST initialization Cezary Rojewski
                   ` (22 preceding siblings ...)
  2019-08-22 19:04 ` [PATCH 23/35] ASoC: Intel: Baytrail: " Cezary Rojewski
@ 2019-08-22 19:04 ` Cezary Rojewski
  2019-08-23 19:43   ` Pierre-Louis Bossart
  2019-08-22 19:04 ` [PATCH 25/35] ASoC: Intel: Skylake: Simplify skl_sst_ctx_init declaration Cezary Rojewski
                   ` (11 subsequent siblings)
  35 siblings, 1 reply; 107+ messages in thread
From: Cezary Rojewski @ 2019-08-22 19:04 UTC (permalink / raw)
  To: alsa-devel
  Cc: lgirdwood, Cezary Rojewski, broonie, tiwai, pierre-louis.bossart

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.

Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
---
 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(-)

diff --git a/sound/soc/intel/baytrail/acpi.c b/sound/soc/intel/baytrail/acpi.c
index 57d10a6e3be2..bf2560a8f3e2 100644
--- a/sound/soc/intel/baytrail/acpi.c
+++ b/sound/soc/intel/baytrail/acpi.c
@@ -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",
diff --git a/sound/soc/intel/common/sst-acpi.c b/sound/soc/intel/common/sst-acpi.c
index 8e75126106ea..53ac23f05966 100644
--- a/sound/soc/intel/common/sst-acpi.c
+++ b/sound/soc/intel/common/sst-acpi.c
@@ -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))
diff --git a/sound/soc/intel/common/sst-dsp.h b/sound/soc/intel/common/sst-dsp.h
index a2ac7998fbdb..87d39b0e79c0 100644
--- a/sound/soc/intel/common/sst-dsp.h
+++ b/sound/soc/intel/common/sst-dsp.h
@@ -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;
diff --git a/sound/soc/intel/common/sst-firmware.c b/sound/soc/intel/common/sst-firmware.c
index 6b6af11c32c3..61d3e6e46b98 100644
--- a/sound/soc/intel/common/sst-firmware.c
+++ b/sound/soc/intel/common/sst-firmware.c
@@ -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;
 
diff --git a/sound/soc/intel/haswell/acpi.c b/sound/soc/intel/haswell/acpi.c
index 7bd8b03851c4..3c49ec257e56 100644
--- a/sound/soc/intel/haswell/acpi.c
+++ b/sound/soc/intel/haswell/acpi.c
@@ -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",
diff --git a/sound/soc/intel/skylake/skl-sst-utils.c b/sound/soc/intel/skylake/skl-sst-utils.c
index bbe67e298efe..ac0a0e4c2d68 100644
--- a/sound/soc/intel/skylake/skl-sst-utils.c
+++ b/sound/soc/intel/skylake/skl-sst-utils.c
@@ -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);
-- 
2.17.1

^ permalink raw reply related	[flat|nested] 107+ messages in thread

* [PATCH 25/35] ASoC: Intel: Skylake: Simplify skl_sst_ctx_init declaration
  2019-08-22 19:03 [PATCH 00/35] ASoC: Intel: Clenaup SST initialization Cezary Rojewski
                   ` (23 preceding siblings ...)
  2019-08-22 19:04 ` [PATCH 24/35] ASoC: Intel: Refactor probing of ACPI devices Cezary Rojewski
@ 2019-08-22 19:04 ` Cezary Rojewski
  2019-08-22 19:04 ` [PATCH 26/35] ASoC: Intel: Skylake: Simplify all sst_dsp_init declarations Cezary Rojewski
                   ` (10 subsequent siblings)
  35 siblings, 0 replies; 107+ messages in thread
From: Cezary Rojewski @ 2019-08-22 19:04 UTC (permalink / raw)
  To: alsa-devel
  Cc: lgirdwood, Cezary Rojewski, broonie, tiwai, pierre-louis.bossart

'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.

Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
---
 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(-)

diff --git a/sound/soc/intel/skylake/bxt-sst.c b/sound/soc/intel/skylake/bxt-sst.c
index 5b46215fbc0f..e72cd63eb113 100644
--- a/sound/soc/intel/skylake/bxt-sst.c
+++ b/sound/soc/intel/skylake/bxt-sst.c
@@ -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;
diff --git a/sound/soc/intel/skylake/cnl-sst.c b/sound/soc/intel/skylake/cnl-sst.c
index 47b991c03742..93b98281083c 100644
--- a/sound/soc/intel/skylake/cnl-sst.c
+++ b/sound/soc/intel/skylake/cnl-sst.c
@@ -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;
diff --git a/sound/soc/intel/skylake/skl-sst-dsp.h b/sound/soc/intel/skylake/skl-sst-dsp.h
index 3c92b1d849e4..e14d76ed0100 100644
--- a/sound/soc/intel/skylake/skl-sst-dsp.h
+++ b/sound/soc/intel/skylake/skl-sst-dsp.h
@@ -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,
diff --git a/sound/soc/intel/skylake/skl-sst-utils.c b/sound/soc/intel/skylake/skl-sst-utils.c
index ac0a0e4c2d68..a4ad213d34e0 100644
--- a/sound/soc/intel/skylake/skl-sst-utils.c
+++ b/sound/soc/intel/skylake/skl-sst-utils.c
@@ -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;
diff --git a/sound/soc/intel/skylake/skl-sst.c b/sound/soc/intel/skylake/skl-sst.c
index c823936ffd34..f8aecd2ca8bb 100644
--- a/sound/soc/intel/skylake/skl-sst.c
+++ b/sound/soc/intel/skylake/skl-sst.c
@@ -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;
diff --git a/sound/soc/intel/skylake/skl.c b/sound/soc/intel/skylake/skl.c
index 141dbbf975ac..54e1f957121d 100644
--- a/sound/soc/intel/skylake/skl.c
+++ b/sound/soc/intel/skylake/skl.c
@@ -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;
 
-- 
2.17.1

^ permalink raw reply related	[flat|nested] 107+ messages in thread

* [PATCH 26/35] ASoC: Intel: Skylake: Simplify all sst_dsp_init declarations
  2019-08-22 19:03 [PATCH 00/35] ASoC: Intel: Clenaup SST initialization Cezary Rojewski
                   ` (24 preceding siblings ...)
  2019-08-22 19:04 ` [PATCH 25/35] ASoC: Intel: Skylake: Simplify skl_sst_ctx_init declaration Cezary Rojewski
@ 2019-08-22 19:04 ` Cezary Rojewski
  2019-08-22 19:04 ` [PATCH 27/35] ASoC: Intel: Skylake: Define platform descriptors Cezary Rojewski
                   ` (9 subsequent siblings)
  35 siblings, 0 replies; 107+ messages in thread
From: Cezary Rojewski @ 2019-08-22 19:04 UTC (permalink / raw)
  To: alsa-devel
  Cc: lgirdwood, Cezary Rojewski, broonie, tiwai, pierre-louis.bossart

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.

Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
---
 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(-)

diff --git a/sound/soc/intel/skylake/bxt-sst.c b/sound/soc/intel/skylake/bxt-sst.c
index e72cd63eb113..a547fb84eee9 100644
--- a/sound/soc/intel/skylake/bxt-sst.c
+++ b/sound/soc/intel/skylake/bxt-sst.c
@@ -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;
diff --git a/sound/soc/intel/skylake/cnl-sst-dsp.h b/sound/soc/intel/skylake/cnl-sst-dsp.h
index a465cc42b7e8..02e070fae2ce 100644
--- a/sound/soc/intel/skylake/cnl-sst-dsp.h
+++ b/sound/soc/intel/skylake/cnl-sst-dsp.h
@@ -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__*/
diff --git a/sound/soc/intel/skylake/cnl-sst.c b/sound/soc/intel/skylake/cnl-sst.c
index 93b98281083c..5be0a8eb154d 100644
--- a/sound/soc/intel/skylake/cnl-sst.c
+++ b/sound/soc/intel/skylake/cnl-sst.c
@@ -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;
diff --git a/sound/soc/intel/skylake/skl-messages.c b/sound/soc/intel/skylake/skl-messages.c
index 6fbceec67b53..8c352255ff45 100644
--- a/sound/soc/intel/skylake/skl-messages.c
+++ b/sound/soc/intel/skylake/skl-messages.c
@@ -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)
diff --git a/sound/soc/intel/skylake/skl-sst-dsp.h b/sound/soc/intel/skylake/skl-sst-dsp.h
index e14d76ed0100..b647e60d7a6d 100644
--- a/sound/soc/intel/skylake/skl-sst-dsp.h
+++ b/sound/soc/intel/skylake/skl-sst-dsp.h
@@ -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);
 
diff --git a/sound/soc/intel/skylake/skl-sst.c b/sound/soc/intel/skylake/skl-sst.c
index f8aecd2ca8bb..8ae7fe73534e 100644
--- a/sound/soc/intel/skylake/skl-sst.c
+++ b/sound/soc/intel/skylake/skl-sst.c
@@ -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);
diff --git a/sound/soc/intel/skylake/skl.h b/sound/soc/intel/skylake/skl.h
index beeef67cb55f..9f5aa53df9f8 100644
--- a/sound/soc/intel/skylake/skl.h
+++ b/sound/soc/intel/skylake/skl.h
@@ -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);
-- 
2.17.1

^ permalink raw reply related	[flat|nested] 107+ messages in thread

* [PATCH 27/35] ASoC: Intel: Skylake: Define platform descriptors
  2019-08-22 19:03 [PATCH 00/35] ASoC: Intel: Clenaup SST initialization Cezary Rojewski
                   ` (25 preceding siblings ...)
  2019-08-22 19:04 ` [PATCH 26/35] ASoC: Intel: Skylake: Simplify all sst_dsp_init declarations Cezary Rojewski
@ 2019-08-22 19:04 ` Cezary Rojewski
  2019-08-23 19:50   ` Pierre-Louis Bossart
  2019-08-22 19:04 ` [PATCH 28/35] ASoC: Intel: Skylake: Update skl_ids table Cezary Rojewski
                   ` (8 subsequent siblings)
  35 siblings, 1 reply; 107+ messages in thread
From: Cezary Rojewski @ 2019-08-22 19:04 UTC (permalink / raw)
  To: alsa-devel
  Cc: lgirdwood, Cezary Rojewski, broonie, tiwai, pierre-louis.bossart

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.

Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
---
 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(-)

diff --git a/sound/soc/intel/skylake/bxt-sst.c b/sound/soc/intel/skylake/bxt-sst.c
index a547fb84eee9..06da822790a5 100644
--- a/sound/soc/intel/skylake/bxt-sst.c
+++ b/sound/soc/intel/skylake/bxt-sst.c
@@ -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)
diff --git a/sound/soc/intel/skylake/cnl-sst.c b/sound/soc/intel/skylake/cnl-sst.c
index 5be0a8eb154d..c4dbf6655097 100644
--- a/sound/soc/intel/skylake/cnl-sst.c
+++ b/sound/soc/intel/skylake/cnl-sst.c
@@ -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)
diff --git a/sound/soc/intel/skylake/skl-sst.c b/sound/soc/intel/skylake/skl-sst.c
index 8ae7fe73534e..122c07290440 100644
--- a/sound/soc/intel/skylake/skl-sst.c
+++ b/sound/soc/intel/skylake/skl-sst.c
@@ -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)
diff --git a/sound/soc/intel/skylake/skl.c b/sound/soc/intel/skylake/skl.c
index 54e1f957121d..d6d099aba834 100644
--- a/sound/soc/intel/skylake/skl.c
+++ b/sound/soc/intel/skylake/skl.c
@@ -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)
diff --git a/sound/soc/intel/skylake/skl.h b/sound/soc/intel/skylake/skl.h
index 9f5aa53df9f8..2f2b5a141abf 100644
--- a/sound/soc/intel/skylake/skl.h
+++ b/sound/soc/intel/skylake/skl.h
@@ -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;
-- 
2.17.1

^ permalink raw reply related	[flat|nested] 107+ messages in thread

* [PATCH 28/35] ASoC: Intel: Skylake: Update skl_ids table
  2019-08-22 19:03 [PATCH 00/35] ASoC: Intel: Clenaup SST initialization Cezary Rojewski
                   ` (26 preceding siblings ...)
  2019-08-22 19:04 ` [PATCH 27/35] ASoC: Intel: Skylake: Define platform descriptors Cezary Rojewski
@ 2019-08-22 19:04 ` Cezary Rojewski
  2019-08-23 20:15   ` Pierre-Louis Bossart
  2019-08-22 19:04 ` [PATCH 29/35] ASoC: Intel: Skylake: Flip SST initialization order Cezary Rojewski
                   ` (7 subsequent siblings)
  35 siblings, 1 reply; 107+ messages in thread
From: Cezary Rojewski @ 2019-08-22 19:04 UTC (permalink / raw)
  To: alsa-devel
  Cc: lgirdwood, Cezary Rojewski, broonie, tiwai, pierre-louis.bossart

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

Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
---
 sound/soc/intel/skylake/skl.c | 20 +++++++++++---------
 1 file changed, 11 insertions(+), 9 deletions(-)

diff --git a/sound/soc/intel/skylake/skl.c b/sound/soc/intel/skylake/skl.c
index d6d099aba834..53a6befd5d68 100644
--- a/sound/soc/intel/skylake/skl.c
+++ b/sound/soc/intel/skylake/skl.c
@@ -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, }
 };
-- 
2.17.1

^ permalink raw reply related	[flat|nested] 107+ messages in thread

* [PATCH 29/35] ASoC: Intel: Skylake: Flip SST initialization order
  2019-08-22 19:03 [PATCH 00/35] ASoC: Intel: Clenaup SST initialization Cezary Rojewski
                   ` (27 preceding siblings ...)
  2019-08-22 19:04 ` [PATCH 28/35] ASoC: Intel: Skylake: Update skl_ids table Cezary Rojewski
@ 2019-08-22 19:04 ` Cezary Rojewski
  2019-08-23 20:18   ` Pierre-Louis Bossart
  2019-08-22 19:04 ` [PATCH 30/35] ASoC: Intel: Reuse sst_pdata::fw_name field Cezary Rojewski
                   ` (6 subsequent siblings)
  35 siblings, 1 reply; 107+ messages in thread
From: Cezary Rojewski @ 2019-08-22 19:04 UTC (permalink / raw)
  To: alsa-devel
  Cc: lgirdwood, Cezary Rojewski, broonie, tiwai, pierre-louis.bossart

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.

Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
---
 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(-)

diff --git a/sound/soc/intel/skylake/bxt-sst.c b/sound/soc/intel/skylake/bxt-sst.c
index 06da822790a5..286da9fbc4de 100644
--- a/sound/soc/intel/skylake/bxt-sst.c
+++ b/sound/soc/intel/skylake/bxt-sst.c
@@ -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)
diff --git a/sound/soc/intel/skylake/cnl-sst-dsp.h b/sound/soc/intel/skylake/cnl-sst-dsp.h
index 02e070fae2ce..7810ae11954a 100644
--- a/sound/soc/intel/skylake/cnl-sst-dsp.h
+++ b/sound/soc/intel/skylake/cnl-sst-dsp.h
@@ -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__*/
diff --git a/sound/soc/intel/skylake/cnl-sst.c b/sound/soc/intel/skylake/cnl-sst.c
index c4dbf6655097..a6113d8afcbb 100644
--- a/sound/soc/intel/skylake/cnl-sst.c
+++ b/sound/soc/intel/skylake/cnl-sst.c
@@ -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)
diff --git a/sound/soc/intel/skylake/skl-messages.c b/sound/soc/intel/skylake/skl-messages.c
index 8c352255ff45..372c5fb83ddb 100644
--- a/sound/soc/intel/skylake/skl-messages.c
+++ b/sound/soc/intel/skylake/skl-messages.c
@@ -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;
 
diff --git a/sound/soc/intel/skylake/skl-sst-dsp.h b/sound/soc/intel/skylake/skl-sst-dsp.h
index b647e60d7a6d..8483c60f29ba 100644
--- a/sound/soc/intel/skylake/skl-sst-dsp.h
+++ b/sound/soc/intel/skylake/skl-sst-dsp.h
@@ -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);
 
diff --git a/sound/soc/intel/skylake/skl-sst.c b/sound/soc/intel/skylake/skl-sst.c
index 122c07290440..e0f2bf828541 100644
--- a/sound/soc/intel/skylake/skl-sst.c
+++ b/sound/soc/intel/skylake/skl-sst.c
@@ -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)
diff --git a/sound/soc/intel/skylake/skl.c b/sound/soc/intel/skylake/skl.c
index 53a6befd5d68..39442c80a179 100644
--- a/sound/soc/intel/skylake/skl.c
+++ b/sound/soc/intel/skylake/skl.c
@@ -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;
diff --git a/sound/soc/intel/skylake/skl.h b/sound/soc/intel/skylake/skl.h
index 2f2b5a141abf..f4cd5ccc1ff9 100644
--- a/sound/soc/intel/skylake/skl.h
+++ b/sound/soc/intel/skylake/skl.h
@@ -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);
-- 
2.17.1

^ permalink raw reply related	[flat|nested] 107+ messages in thread

* [PATCH 30/35] ASoC: Intel: Reuse sst_pdata::fw_name field
  2019-08-22 19:03 [PATCH 00/35] ASoC: Intel: Clenaup SST initialization Cezary Rojewski
                   ` (28 preceding siblings ...)
  2019-08-22 19:04 ` [PATCH 29/35] ASoC: Intel: Skylake: Flip SST initialization order Cezary Rojewski
@ 2019-08-22 19:04 ` Cezary Rojewski
  2019-08-23 20:20   ` Pierre-Louis Bossart
  2019-08-22 19:04 ` [PATCH 31/35] ASoC: Intel: Reuse sst_pdata::fw field Cezary Rojewski
                   ` (5 subsequent siblings)
  35 siblings, 1 reply; 107+ messages in thread
From: Cezary Rojewski @ 2019-08-22 19:04 UTC (permalink / raw)
  To: alsa-devel
  Cc: lgirdwood, Cezary Rojewski, broonie, tiwai, pierre-louis.bossart

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.

Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
---
 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(-)

diff --git a/sound/soc/intel/common/sst-acpi.c b/sound/soc/intel/common/sst-acpi.c
index 53ac23f05966..15f2b27e643f 100644
--- a/sound/soc/intel/common/sst-acpi.c
+++ b/sound/soc/intel/common/sst-acpi.c
@@ -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);
diff --git a/sound/soc/intel/common/sst-firmware.c b/sound/soc/intel/common/sst-firmware.c
index 61d3e6e46b98..cc88849eb10f 100644
--- a/sound/soc/intel/common/sst-firmware.c
+++ b/sound/soc/intel/common/sst-firmware.c
@@ -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);
diff --git a/sound/soc/intel/skylake/skl-messages.c b/sound/soc/intel/skylake/skl-messages.c
index 372c5fb83ddb..e401edd8d44b 100644
--- a/sound/soc/intel/skylake/skl-messages.c
+++ b/sound/soc/intel/skylake/skl-messages.c
@@ -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;
 
diff --git a/sound/soc/intel/skylake/skl-sst-dsp.h b/sound/soc/intel/skylake/skl-sst-dsp.h
index 8483c60f29ba..a3714b706b8e 100644
--- a/sound/soc/intel/skylake/skl-sst-dsp.h
+++ b/sound/soc/intel/skylake/skl-sst-dsp.h
@@ -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);
diff --git a/sound/soc/intel/skylake/skl-sst-utils.c b/sound/soc/intel/skylake/skl-sst-utils.c
index a4ad213d34e0..ea5419012312 100644
--- a/sound/soc/intel/skylake/skl-sst-utils.c
+++ b/sound/soc/intel/skylake/skl-sst-utils.c
@@ -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;
 
diff --git a/sound/soc/intel/skylake/skl.c b/sound/soc/intel/skylake/skl.c
index 39442c80a179..3225f4f8793e 100644
--- a/sound/soc/intel/skylake/skl.c
+++ b/sound/soc/intel/skylake/skl.c
@@ -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) {
-- 
2.17.1

^ permalink raw reply related	[flat|nested] 107+ messages in thread

* [PATCH 31/35] ASoC: Intel: Reuse sst_pdata::fw field
  2019-08-22 19:03 [PATCH 00/35] ASoC: Intel: Clenaup SST initialization Cezary Rojewski
                   ` (29 preceding siblings ...)
  2019-08-22 19:04 ` [PATCH 30/35] ASoC: Intel: Reuse sst_pdata::fw_name field Cezary Rojewski
@ 2019-08-22 19:04 ` Cezary Rojewski
  2019-08-22 19:04 ` [PATCH 32/35] ASoC: Intel: Skylake: Remove skl_dsp_ops Cezary Rojewski
                   ` (4 subsequent siblings)
  35 siblings, 0 replies; 107+ messages in thread
From: Cezary Rojewski @ 2019-08-22 19:04 UTC (permalink / raw)
  To: alsa-devel
  Cc: lgirdwood, Cezary Rojewski, broonie, tiwai, pierre-louis.bossart

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.

Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
---
 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(-)

diff --git a/sound/soc/intel/skylake/bxt-sst.c b/sound/soc/intel/skylake/bxt-sst.c
index 286da9fbc4de..79728e418176 100644
--- a/sound/soc/intel/skylake/bxt-sst.c
+++ b/sound/soc/intel/skylake/bxt-sst.c
@@ -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;
 }
 
diff --git a/sound/soc/intel/skylake/cnl-sst.c b/sound/soc/intel/skylake/cnl-sst.c
index a6113d8afcbb..58efeb6c8a8a 100644
--- a/sound/soc/intel/skylake/cnl-sst.c
+++ b/sound/soc/intel/skylake/cnl-sst.c
@@ -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;
 }
diff --git a/sound/soc/intel/skylake/skl-sst.c b/sound/soc/intel/skylake/skl-sst.c
index e0f2bf828541..8e1d02e29a32 100644
--- a/sound/soc/intel/skylake/skl-sst.c
+++ b/sound/soc/intel/skylake/skl-sst.c
@@ -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);
-- 
2.17.1

^ permalink raw reply related	[flat|nested] 107+ messages in thread

* [PATCH 32/35] ASoC: Intel: Skylake: Remove skl_dsp_ops
  2019-08-22 19:03 [PATCH 00/35] ASoC: Intel: Clenaup SST initialization Cezary Rojewski
                   ` (30 preceding siblings ...)
  2019-08-22 19:04 ` [PATCH 31/35] ASoC: Intel: Reuse sst_pdata::fw field Cezary Rojewski
@ 2019-08-22 19:04 ` Cezary Rojewski
  2019-08-22 19:04 ` [PATCH 33/35] ASoC: Intel: Skylake: Privatize SST init handlers Cezary Rojewski
                   ` (3 subsequent siblings)
  35 siblings, 0 replies; 107+ messages in thread
From: Cezary Rojewski @ 2019-08-22 19:04 UTC (permalink / raw)
  To: alsa-devel
  Cc: lgirdwood, Cezary Rojewski, broonie, tiwai, pierre-louis.bossart

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.

Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
---
 sound/soc/intel/skylake/skl-messages.c | 53 --------------------------
 sound/soc/intel/skylake/skl.h          |  8 ----
 2 files changed, 61 deletions(-)

diff --git a/sound/soc/intel/skylake/skl-messages.c b/sound/soc/intel/skylake/skl-messages.c
index e401edd8d44b..5f63c3052db9 100644
--- a/sound/soc/intel/skylake/skl-messages.c
+++ b/sound/soc/intel/skylake/skl-messages.c
@@ -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;
diff --git a/sound/soc/intel/skylake/skl.h b/sound/soc/intel/skylake/skl.h
index f4cd5ccc1ff9..218e8bda6cae 100644
--- a/sound/soc/intel/skylake/skl.h
+++ b/sound/soc/intel/skylake/skl.h
@@ -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);
-- 
2.17.1

^ permalink raw reply related	[flat|nested] 107+ messages in thread

* [PATCH 33/35] ASoC: Intel: Skylake: Privatize SST init handlers
  2019-08-22 19:03 [PATCH 00/35] ASoC: Intel: Clenaup SST initialization Cezary Rojewski
                   ` (31 preceding siblings ...)
  2019-08-22 19:04 ` [PATCH 32/35] ASoC: Intel: Skylake: Remove skl_dsp_ops Cezary Rojewski
@ 2019-08-22 19:04 ` Cezary Rojewski
  2019-08-23 20:25   ` Pierre-Louis Bossart
  2019-08-22 19:04 ` [PATCH 34/35] ASoC: Intel: Skylake: Merge skl_sst_ctx_init into skl_init_dsp Cezary Rojewski
                   ` (2 subsequent siblings)
  35 siblings, 1 reply; 107+ messages in thread
From: Cezary Rojewski @ 2019-08-22 19:04 UTC (permalink / raw)
  To: alsa-devel
  Cc: lgirdwood, Cezary Rojewski, broonie, tiwai, pierre-louis.bossart

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

Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
---
 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(-)

diff --git a/sound/soc/intel/skylake/bxt-sst.c b/sound/soc/intel/skylake/bxt-sst.c
index 79728e418176..1edc38069615 100644
--- a/sound/soc/intel/skylake/bxt-sst.c
+++ b/sound/soc/intel/skylake/bxt-sst.c
@@ -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");
diff --git a/sound/soc/intel/skylake/cnl-sst-dsp.h b/sound/soc/intel/skylake/cnl-sst-dsp.h
index 7810ae11954a..a1ea242e9539 100644
--- a/sound/soc/intel/skylake/cnl-sst-dsp.h
+++ b/sound/soc/intel/skylake/cnl-sst-dsp.h
@@ -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__*/
diff --git a/sound/soc/intel/skylake/cnl-sst.c b/sound/soc/intel/skylake/cnl-sst.c
index 58efeb6c8a8a..360e54d3c587 100644
--- a/sound/soc/intel/skylake/cnl-sst.c
+++ b/sound/soc/intel/skylake/cnl-sst.c
@@ -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");
diff --git a/sound/soc/intel/skylake/skl-sst-dsp.h b/sound/soc/intel/skylake/skl-sst-dsp.h
index a3714b706b8e..3294826d5cf7 100644
--- a/sound/soc/intel/skylake/skl-sst-dsp.h
+++ b/sound/soc/intel/skylake/skl-sst-dsp.h
@@ -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);
 
diff --git a/sound/soc/intel/skylake/skl-sst.c b/sound/soc/intel/skylake/skl-sst.c
index 8e1d02e29a32..209f45e3d5d0 100644
--- a/sound/soc/intel/skylake/skl-sst.c
+++ b/sound/soc/intel/skylake/skl-sst.c
@@ -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)
 {
-- 
2.17.1

^ permalink raw reply related	[flat|nested] 107+ messages in thread

* [PATCH 34/35] ASoC: Intel: Skylake: Merge skl_sst_ctx_init into skl_init_dsp
  2019-08-22 19:03 [PATCH 00/35] ASoC: Intel: Clenaup SST initialization Cezary Rojewski
                   ` (32 preceding siblings ...)
  2019-08-22 19:04 ` [PATCH 33/35] ASoC: Intel: Skylake: Privatize SST init handlers Cezary Rojewski
@ 2019-08-22 19:04 ` Cezary Rojewski
  2019-08-22 19:04 ` [PATCH 35/35] ASoC: Intel: Remove obsolete firmware fields Cezary Rojewski
  2019-08-22 20:55 ` [PATCH 00/35] ASoC: Intel: Clenaup SST initialization Pierre-Louis Bossart
  35 siblings, 0 replies; 107+ messages in thread
From: Cezary Rojewski @ 2019-08-22 19:04 UTC (permalink / raw)
  To: alsa-devel
  Cc: lgirdwood, Cezary Rojewski, broonie, tiwai, pierre-louis.bossart

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.

Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
---
 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(-)

diff --git a/sound/soc/intel/skylake/skl-messages.c b/sound/soc/intel/skylake/skl-messages.c
index 5f63c3052db9..7a161bbf8f26 100644
--- a/sound/soc/intel/skylake/skl-messages.c
+++ b/sound/soc/intel/skylake/skl-messages.c
@@ -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;
 }
diff --git a/sound/soc/intel/skylake/skl-sst-dsp.h b/sound/soc/intel/skylake/skl-sst-dsp.h
index 3294826d5cf7..eb8cc5606fc6 100644
--- a/sound/soc/intel/skylake/skl-sst-dsp.h
+++ b/sound/soc/intel/skylake/skl-sst-dsp.h
@@ -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);
diff --git a/sound/soc/intel/skylake/skl-sst-utils.c b/sound/soc/intel/skylake/skl-sst-utils.c
index ea5419012312..34ac21b85cd9 100644
--- a/sound/soc/intel/skylake/skl-sst-utils.c
+++ b/sound/soc/intel/skylake/skl-sst-utils.c
@@ -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)
-- 
2.17.1

^ permalink raw reply related	[flat|nested] 107+ messages in thread

* [PATCH 35/35] ASoC: Intel: Remove obsolete firmware fields
  2019-08-22 19:03 [PATCH 00/35] ASoC: Intel: Clenaup SST initialization Cezary Rojewski
                   ` (33 preceding siblings ...)
  2019-08-22 19:04 ` [PATCH 34/35] ASoC: Intel: Skylake: Merge skl_sst_ctx_init into skl_init_dsp Cezary Rojewski
@ 2019-08-22 19:04 ` Cezary Rojewski
  2019-08-23 20:27   ` Pierre-Louis Bossart
  2019-08-22 20:55 ` [PATCH 00/35] ASoC: Intel: Clenaup SST initialization Pierre-Louis Bossart
  35 siblings, 1 reply; 107+ messages in thread
From: Cezary Rojewski @ 2019-08-22 19:04 UTC (permalink / raw)
  To: alsa-devel
  Cc: lgirdwood, Cezary Rojewski, broonie, tiwai, pierre-louis.bossart

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.

Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
---
 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(-)

diff --git a/sound/soc/intel/common/soc-acpi-intel-bxt-match.c b/sound/soc/intel/common/soc-acpi-intel-bxt-match.c
index 4a5adae1d785..eda799e49113 100644
--- a/sound/soc/intel/common/soc-acpi-intel-bxt-match.c
+++ b/sound/soc/intel/common/soc-acpi-intel-bxt-match.c
@@ -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",
diff --git a/sound/soc/intel/common/soc-acpi-intel-byt-match.c b/sound/soc/intel/common/soc-acpi-intel-byt-match.c
index 1cc801ba92eb..4d2ba663ee33 100644
--- a/sound/soc/intel/common/soc-acpi-intel-byt-match.c
+++ b/sound/soc/intel/common/soc-acpi-intel-byt-match.c
@@ -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",
 	},
 	{}
 };
diff --git a/sound/soc/intel/common/soc-acpi-intel-cnl-match.c b/sound/soc/intel/common/soc-acpi-intel-cnl-match.c
index 771b0ef21051..edc44a0dc96f 100644
--- a/sound/soc/intel/common/soc-acpi-intel-cnl-match.c
+++ b/sound/soc/intel/common/soc-acpi-intel-cnl-match.c
@@ -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",
diff --git a/sound/soc/intel/common/soc-acpi-intel-glk-match.c b/sound/soc/intel/common/soc-acpi-intel-glk-match.c
index 60dea358fa04..370487d13c85 100644
--- a/sound/soc/intel/common/soc-acpi-intel-glk-match.c
+++ b/sound/soc/intel/common/soc-acpi-intel-glk-match.c
@@ -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",
diff --git a/sound/soc/intel/common/soc-acpi-intel-hda-match.c b/sound/soc/intel/common/soc-acpi-intel-hda-match.c
index cc972d2ac691..39827d2e8634 100644
--- a/sound/soc/intel/common/soc-acpi-intel-hda-match.c
+++ b/sound/soc/intel/common/soc-acpi-intel-hda-match.c
@@ -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",
diff --git a/sound/soc/intel/common/soc-acpi-intel-hsw-bdw-match.c b/sound/soc/intel/common/soc-acpi-intel-hsw-bdw-match.c
index 34eb0baaa951..6b113c32aff0 100644
--- a/sound/soc/intel/common/soc-acpi-intel-hsw-bdw-match.c
+++ b/sound/soc/intel/common/soc-acpi-intel-hsw-bdw-match.c
@@ -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",
 	},
diff --git a/sound/soc/intel/common/soc-acpi-intel-icl-match.c b/sound/soc/intel/common/soc-acpi-intel-icl-match.c
index 38977669b576..04a17da96f6a 100644
--- a/sound/soc/intel/common/soc-acpi-intel-icl-match.c
+++ b/sound/soc/intel/common/soc-acpi-intel-icl-match.c
@@ -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",
diff --git a/sound/soc/intel/common/soc-acpi-intel-kbl-match.c b/sound/soc/intel/common/soc-acpi-intel-kbl-match.c
index e200baa11011..fe82d5472aa3 100644
--- a/sound/soc/intel/common/soc-acpi-intel-kbl-match.c
+++ b/sound/soc/intel/common/soc-acpi-intel-kbl-match.c
@@ -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
 	},
 	{},
diff --git a/sound/soc/intel/common/soc-acpi-intel-skl-match.c b/sound/soc/intel/common/soc-acpi-intel-skl-match.c
index 42fa40a8d932..ec969044706c 100644
--- a/sound/soc/intel/common/soc-acpi-intel-skl-match.c
+++ b/sound/soc/intel/common/soc-acpi-intel-skl-match.c
@@ -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,
diff --git a/sound/soc/intel/common/sst-dsp-priv.h b/sound/soc/intel/common/sst-dsp-priv.h
index a4628a89d47d..1a208ef65fa8 100644
--- a/sound/soc/intel/common/sst-dsp-priv.h
+++ b/sound/soc/intel/common/sst-dsp-priv.h
@@ -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;
 };
 
diff --git a/sound/soc/intel/skylake/skl.h b/sound/soc/intel/skylake/skl.h
index 218e8bda6cae..7b283c2bb7b5 100644
--- a/sound/soc/intel/skylake/skl.h
+++ b/sound/soc/intel/skylake/skl.h
@@ -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;
-- 
2.17.1

^ permalink raw reply related	[flat|nested] 107+ messages in thread

* Re: [PATCH 00/35] ASoC: Intel: Clenaup SST initialization
  2019-08-22 19:03 [PATCH 00/35] ASoC: Intel: Clenaup SST initialization Cezary Rojewski
                   ` (34 preceding siblings ...)
  2019-08-22 19:04 ` [PATCH 35/35] ASoC: Intel: Remove obsolete firmware fields Cezary Rojewski
@ 2019-08-22 20:55 ` Pierre-Louis Bossart
  2019-08-23  8:29   ` Cezary Rojewski
  35 siblings, 1 reply; 107+ messages in thread
From: Pierre-Louis Bossart @ 2019-08-22 20:55 UTC (permalink / raw)
  To: Cezary Rojewski, alsa-devel; +Cc: broonie, lgirdwood, tiwai



On 8/22/19 2:03 PM, Cezary Rojewski wrote:
> 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.

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

> 
> !!! 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.

"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.

> 
> 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
> 
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

^ permalink raw reply	[flat|nested] 107+ messages in thread

* Re: [PATCH 00/35] ASoC: Intel: Clenaup SST initialization
  2019-08-22 20:55 ` [PATCH 00/35] ASoC: Intel: Clenaup SST initialization Pierre-Louis Bossart
@ 2019-08-23  8:29   ` Cezary Rojewski
  2019-08-23 10:26     ` Mark Brown
  0 siblings, 1 reply; 107+ messages in thread
From: Cezary Rojewski @ 2019-08-23  8:29 UTC (permalink / raw)
  To: Pierre-Louis Bossart, alsa-devel
  Cc: Wasko, Michal, Kaczmarski, Filip, broonie, lgirdwood, tiwai

On 2019-08-22 22:55, Pierre-Louis Bossart wrote:
> 
> 
> On 8/22/19 2:03 PM, Cezary Rojewski wrote:
>> 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.
> 
> 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.

>>
>> !!! 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.
> 
> "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

>>
>> 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
>>
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

^ permalink raw reply	[flat|nested] 107+ messages in thread

* Re: [PATCH 00/35] ASoC: Intel: Clenaup SST initialization
  2019-08-23  8:29   ` Cezary Rojewski
@ 2019-08-23 10:26     ` Mark Brown
  2019-08-23 10:43       ` Cezary Rojewski
  0 siblings, 1 reply; 107+ messages in thread
From: Mark Brown @ 2019-08-23 10:26 UTC (permalink / raw)
  To: Cezary Rojewski
  Cc: alsa-devel, Kaczmarski, Filip, lgirdwood, tiwai,
	Pierre-Louis Bossart, Wasko, Michal


[-- Attachment #1.1: Type: text/plain, Size: 3440 bytes --]

On Fri, Aug 23, 2019 at 10:29:59AM +0200, Cezary Rojewski wrote:
> On 2019-08-22 22:55, Pierre-Louis Bossart wrote:
> > On 8/22/19 2:03 PM, Cezary Rojewski wrote:

> > > 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/.

> 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?

System vendors don't really matter here, end users with their
desktops and laptops do.  If a user has a system and they for
whatever reason upgrade their kernel from one upstream version to
another and don't touch any other aspect of their system the
expectation is that they'll still have everything working after
the upgrade.  This means that if there's bugs in how things were
deployed in the past the kernel ought to try to work with those
bugs.

> > > 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.

This sounds like it might be a problem.

> > > 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.

That's well within the lifespan people will expect from a PC
these days, my personal systems are mostly older than that and
do fine at most things except for big builds.

> 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.

Do we have a sense of how many such systems exist?

> 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.

Can you do things the other way around and positively identify
firmwares that meet whatever standards you're interested in here?

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

[-- Attachment #2: Type: text/plain, Size: 0 bytes --]



^ permalink raw reply	[flat|nested] 107+ messages in thread

* Re: [PATCH 00/35] ASoC: Intel: Clenaup SST initialization
  2019-08-23 10:26     ` Mark Brown
@ 2019-08-23 10:43       ` Cezary Rojewski
  2019-08-23 16:26         ` Pierre-Louis Bossart
  0 siblings, 1 reply; 107+ messages in thread
From: Cezary Rojewski @ 2019-08-23 10:43 UTC (permalink / raw)
  To: Mark Brown
  Cc: alsa-devel, Kaczmarski, Filip, lgirdwood, tiwai,
	Pierre-Louis Bossart, Wasko, Michal

On 2019-08-23 12:26, Mark Brown wrote:
> On Fri, Aug 23, 2019 at 10:29:59AM +0200, Cezary Rojewski wrote:
>> On 2019-08-22 22:55, Pierre-Louis Bossart wrote:
>>> On 8/22/19 2:03 PM, Cezary Rojewski wrote:
> 
>>>> 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/.
> 
>> 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?
> 
> System vendors don't really matter here, end users with their
> desktops and laptops do.  If a user has a system and they for
> whatever reason upgrade their kernel from one upstream version to
> another and don't touch any other aspect of their system the
> expectation is that they'll still have everything working after
> the upgrade.  This means that if there's bugs in how things were
> deployed in the past the kernel ought to try to work with those
> bugs.
> 

Noted, see below comments.

>>>> 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.
> 
> This sounds like it might be a problem.
> 

Problem is, HARDWARE/ FIRMWARE_CONFIG (and more upcoming) should be the 
core part of cAVS driver, implemented before any PCM related code is added.

>>>> 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.
> 
> That's well within the lifespan people will expect from a PC
> these days, my personal systems are mostly older than that and
> do fine at most things except for big builds.
> 

It's not about age itself. It's about the fact that FW binaries from 
non-supported or main FW branches ended here and given the date these 
have been added, it has already been recommended to make use of kbl or 
apl_auto branches.

>> 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.
> 
> Do we have a sense of how many such systems exist?
> 
>> 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.
> 
> Can you do things the other way around and positively identify
> firmwares that meet whatever standards you're interested in here?
> 

The only thing that comes to my mind is the following:
- during boot up sequence, in response to any INVALID_REQUEST or such 
coming from FW, collapse and dump: "upgrade firmware" message

- once boot up sequence is completed, disregard INVALID_REQUEST check as 
it is also the common response of FW in various scenarios

- user removes existing sym link from /lib/firmware/intel and creates 
new one, pointing to updated FW binary that should also be present in 
/lib/firmware/intel

^ permalink raw reply	[flat|nested] 107+ messages in thread

* Re: [PATCH 00/35] ASoC: Intel: Clenaup SST initialization
  2019-08-23 10:43       ` Cezary Rojewski
@ 2019-08-23 16:26         ` Pierre-Louis Bossart
  2019-08-23 18:44           ` Cezary Rojewski
  0 siblings, 1 reply; 107+ messages in thread
From: Pierre-Louis Bossart @ 2019-08-23 16:26 UTC (permalink / raw)
  To: Cezary Rojewski, Mark Brown
  Cc: Wasko, Michal, alsa-devel, tiwai, lgirdwood, Kaczmarski, Filip



On 8/23/19 5:43 AM, Cezary Rojewski wrote:
> On 2019-08-23 12:26, Mark Brown wrote:
>> On Fri, Aug 23, 2019 at 10:29:59AM +0200, Cezary Rojewski wrote:
>>> On 2019-08-22 22:55, Pierre-Louis Bossart wrote:
>>>> On 8/22/19 2:03 PM, Cezary Rojewski wrote:
>>
>>>>> 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/.
>>
>>> 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.

The machine driver defines how many links are used, and in what mode for 
the older cases where the topology is not used. You have configurations 
with very complicated links, e.g. with amplifiers in TDM mode plus IV 
feedback that will stress the firmware in ways that regular RVPs don't. 
Same for the case where the SSP clock is turned on at the request of the 
machine drivers. That's another case that can't be tested on RVPs.

I am not saying you need to test with every single commercial device, 
but that testing on RVPs is not a representative sample of the 
configurations and actual workloads.

>>
>> ...
>>
>>> 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?
>>
>> System vendors don't really matter here, end users with their
>> desktops and laptops do.  If a user has a system and they for
>> whatever reason upgrade their kernel from one upstream version to
>> another and don't touch any other aspect of their system the
>> expectation is that they'll still have everything working after
>> the upgrade.  This means that if there's bugs in how things were
>> deployed in the past the kernel ought to try to work with those
>> bugs.
>>
> 
> Noted, see below comments.
> 
>>>>> 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.
>>
>> This sounds like it might be a problem.
>>
> 
> Problem is, HARDWARE/ FIRMWARE_CONFIG (and more upcoming) should be the 
> core part of cAVS driver, implemented before any PCM related code is added.
> 
>>>>> 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.
>>
>> That's well within the lifespan people will expect from a PC
>> these days, my personal systems are mostly older than that and
>> do fine at most things except for big builds.
>>
> 
> It's not about age itself. It's about the fact that FW binaries from 
> non-supported or main FW branches ended here and given the date these 
> have been added, it has already been recommended to make use of kbl or 
> apl_auto branches.
> 
>>> 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.
>>
>> Do we have a sense of how many such systems exist?

My understanding is that the SST driver is used for Skylake for 
Chromebooks only. For platforms defined for Windows the cases where the 
DSP is used are marginal. I'd view the risk of updating the firmware for 
Skylake as very limited but that's my personal opinion only.
For APL/KBL it's a lot harder to track, there are industrial/embedded 
cases and that's where we'd really want to trap any incompatibilities.

>>
>>> 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.
>>
>> Can you do things the other way around and positively identify
>> firmwares that meet whatever standards you're interested in here?
>>
> 
> The only thing that comes to my mind is the following:
> - during boot up sequence, in response to any INVALID_REQUEST or such 
> coming from FW, collapse and dump: "upgrade firmware" message
> 
> - once boot up sequence is completed, disregard INVALID_REQUEST check as 
> it is also the common response of FW in various scenarios

With the request_firmware() mechanism, the kernel cannot parse the file 
ahead of time, but don't you have a version information reported by the 
firmware post-boot that can be used by the kernel so track that the 
firmware isn't likely to work?

> 
> - user removes existing sym link from /lib/firmware/intel and creates 
> new one, pointing to updated FW binary that should also be present in 
> /lib/firmware/intel

That's typically handled by distributions updating the linux-firmware 
package. Only advanced users and developers can change these symlinks.

The other point that comes to my mind is whether we are going to see 
dependencies between firmware and topology files? Can you use an 'old' 
topology with a 'newer' firmware, or is this a 3-way interoperability issue?
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

^ permalink raw reply	[flat|nested] 107+ messages in thread

* Re: [PATCH 02/35] ASoC: Intel: Skylake: Add FIRMWARE_CONFIG IPC request
  2019-08-22 19:03 ` [PATCH 02/35] ASoC: Intel: Skylake: Add FIRMWARE_CONFIG IPC request Cezary Rojewski
@ 2019-08-23 18:24   ` Pierre-Louis Bossart
  2019-08-24  9:17     ` Cezary Rojewski
  0 siblings, 1 reply; 107+ messages in thread
From: Pierre-Louis Bossart @ 2019-08-23 18:24 UTC (permalink / raw)
  To: Cezary Rojewski, alsa-devel; +Cc: broonie, tiwai, lgirdwood



On 8/22/19 2:03 PM, Cezary Rojewski wrote:
> 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.
> 
> Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
> ---
>   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(+)
> 
> diff --git a/sound/soc/intel/skylake/skl-sst-ipc.c b/sound/soc/intel/skylake/skl-sst-ipc.c
> index 667cdddc289f..e9e11ec4c97b 100644
> --- a/sound/soc/intel/skylake/skl-sst-ipc.c
> +++ b/sound/soc/intel/skylake/skl-sst-ipc.c
> @@ -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;

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

> +		}
> +
> +		offset += sizeof(*tlv) + tlv->length;
> +	}
> +
> +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.

^ permalink raw reply	[flat|nested] 107+ messages in thread

* Re: [PATCH 03/35] ASoC: Intel: Skylake: Add HARDWARE_CONFIG IPC request
  2019-08-22 19:03 ` [PATCH 03/35] ASoC: Intel: Skylake: Add HARDWARE_CONFIG " Cezary Rojewski
@ 2019-08-23 18:32   ` Pierre-Louis Bossart
  2019-08-24  9:30     ` Cezary Rojewski
  0 siblings, 1 reply; 107+ messages in thread
From: Pierre-Louis Bossart @ 2019-08-23 18:32 UTC (permalink / raw)
  To: Cezary Rojewski, alsa-devel; +Cc: broonie, tiwai, lgirdwood


> +	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;
> +
> +		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?

> +			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;
> +			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.

> +		}
> +
> +		offset += sizeof(*tlv) + tlv->length;
> +	}
> +
> +exit:
> +	kfree(payload);
> +	return ret;
> +}
> +EXPORT_SYMBOL_GPL(skl_ipc_hw_cfg_get);
> diff --git a/sound/soc/intel/skylake/skl-sst-ipc.h b/sound/soc/intel/skylake/skl-sst-ipc.h
> index ebc5852e15d0..eefa52f7f97a 100644
> --- a/sound/soc/intel/skylake/skl-sst-ipc.h
> +++ b/sound/soc/intel/skylake/skl-sst-ipc.h
> @@ -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 {
> +	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?)

^ permalink raw reply	[flat|nested] 107+ messages in thread

* Re: [PATCH 04/35] ASoC: Intel: Skylake: Unify firmware loading mechanism
  2019-08-22 19:03 ` [PATCH 04/35] ASoC: Intel: Skylake: Unify firmware loading mechanism Cezary Rojewski
@ 2019-08-23 18:40   ` Pierre-Louis Bossart
  2019-08-24  9:34     ` Cezary Rojewski
  0 siblings, 1 reply; 107+ messages in thread
From: Pierre-Louis Bossart @ 2019-08-23 18:40 UTC (permalink / raw)
  To: Cezary Rojewski, alsa-devel; +Cc: broonie, tiwai, lgirdwood


> -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;
> +	}
> +
> +	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.

> +
> +	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);

^ permalink raw reply	[flat|nested] 107+ messages in thread

* Re: [PATCH 00/35] ASoC: Intel: Clenaup SST initialization
  2019-08-23 16:26         ` Pierre-Louis Bossart
@ 2019-08-23 18:44           ` Cezary Rojewski
  2019-08-23 20:12             ` Pierre-Louis Bossart
  0 siblings, 1 reply; 107+ messages in thread
From: Cezary Rojewski @ 2019-08-23 18:44 UTC (permalink / raw)
  To: Pierre-Louis Bossart, Mark Brown
  Cc: Wasko, Michal, alsa-devel, tiwai, lgirdwood, Kaczmarski, Filip

On 2019-08-23 18:26, Pierre-Louis Bossart wrote:
> 
> 
> On 8/23/19 5:43 AM, Cezary Rojewski wrote:
>> On 2019-08-23 12:26, Mark Brown wrote:
>>> On Fri, Aug 23, 2019 at 10:29:59AM +0200, Cezary Rojewski wrote:
>>>> On 2019-08-22 22:55, Pierre-Louis Bossart wrote:
>>>>> On 8/22/19 2:03 PM, Cezary Rojewski wrote:
>>>
>>>>>> 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/.
>>>
>>>> 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.
> 
> The machine driver defines how many links are used, and in what mode for 
> the older cases where the topology is not used. You have configurations 
> with very complicated links, e.g. with amplifiers in TDM mode plus IV 
> feedback that will stress the firmware in ways that regular RVPs don't. 
> Same for the case where the SSP clock is turned on at the request of the 
> machine drivers. That's another case that can't be tested on RVPs.
> 
> I am not saying you need to test with every single commercial device, 
> but that testing on RVPs is not a representative sample of the 
> configurations and actual workloads.
> 

Each and every FW coming from main branch gets tested on both RVP and 
production devices what is done with cooperation with integration teams, 
PAEs and such. Windows teams alone ensures each binary gets smashed by 
ten of thousands tests each week - this is true for any release 
candidate, the standards are very high. Moreover, array of platforms is 
engaged per target (e.g.: TGL) as single platform alone does not cut it.

So, I'd not worry about FW being vulnerable to any scenario as long as 
recommended protocol is followed.

>>>
>>> ...
>>>
>>>> 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?
>>>
>>> System vendors don't really matter here, end users with their
>>> desktops and laptops do.  If a user has a system and they for
>>> whatever reason upgrade their kernel from one upstream version to
>>> another and don't touch any other aspect of their system the
>>> expectation is that they'll still have everything working after
>>> the upgrade.  This means that if there's bugs in how things were
>>> deployed in the past the kernel ought to try to work with those
>>> bugs.
>>>
>>
>> Noted, see below comments.
>>
>>>>>> 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.
>>>
>>> This sounds like it might be a problem.
>>>
>>
>> Problem is, HARDWARE/ FIRMWARE_CONFIG (and more upcoming) should be 
>> the core part of cAVS driver, implemented before any PCM related code 
>> is added.
>>
>>>>>> 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.
>>>
>>> That's well within the lifespan people will expect from a PC
>>> these days, my personal systems are mostly older than that and
>>> do fine at most things except for big builds.
>>>
>>
>> It's not about age itself. It's about the fact that FW binaries from 
>> non-supported or main FW branches ended here and given the date these 
>> have been added, it has already been recommended to make use of kbl or 
>> apl_auto branches.
>>
>>>> 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.
>>>
>>> Do we have a sense of how many such systems exist?
> 
> My understanding is that the SST driver is used for Skylake for 
> Chromebooks only. For platforms defined for Windows the cases where the 
> DSP is used are marginal. I'd view the risk of updating the firmware for 
> Skylake as very limited but that's my personal opinion only.
> For APL/KBL it's a lot harder to track, there are industrial/embedded 
> cases and that's where we'd really want to trap any incompatibilities.
> 

APL/ KBL - are there any examples I should be aware of? To my knowledge 
we are handling all of them internally and they have not seen any 
obsolete binary for quite some time already. For some, FW has been 
updated even this week..

>>>
>>>> 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.
>>>
>>> Can you do things the other way around and positively identify
>>> firmwares that meet whatever standards you're interested in here?
>>>
>>
>> The only thing that comes to my mind is the following:
>> - during boot up sequence, in response to any INVALID_REQUEST or such 
>> coming from FW, collapse and dump: "upgrade firmware" message
>>
>> - once boot up sequence is completed, disregard INVALID_REQUEST check 
>> as it is also the common response of FW in various scenarios
> 
> With the request_firmware() mechanism, the kernel cannot parse the file 
> ahead of time, but don't you have a version information reported by the 
> firmware post-boot that can be used by the kernel so track that the 
> firmware isn't likely to work?
> 

Wasn't lying about FW version being unreliable. Let's say vendor 
receives quick FW drop with new RCR.. such eng drop may carry invalid 
numbers such as 0.0.0.0..
In general, I try to avoid relying on FW version whenever possible. It 
can be dumped for debug reasons, true, but to be relied on? Not really.

>>
>> - user removes existing sym link from /lib/firmware/intel and creates 
>> new one, pointing to updated FW binary that should also be present in 
>> /lib/firmware/intel
> 
> That's typically handled by distributions updating the linux-firmware 
> package. Only advanced users and developers can change these symlinks.
> 
> The other point that comes to my mind is whether we are going to see 
> dependencies between firmware and topology files? Can you use an 'old' 
> topology with a 'newer' firmware, or is this a 3-way interoperability 
> issue?

Precisely! Three-way-tie!
It's best FW get updated together with topology as old FW may enforce 
different constraints on pipeline modules.

Yay, between rock and hard place. On one side we got old buggy FWs which 
should (more like should NOT be even here..) be updated to improve 
user's experience but updating these alone won't cut it as host side 
needs to be aligned too.
On the other we want to align upstream /skylake with actual working 
example, which will quickly fail if it encounters obsolete FW binary.
And if that wasn't enough, lovely topologies come into picture where 
some of these were developed behind FDK's back and thus completely 
bypassing deployment process.

First thing we will do now is prioritizing topology refactor so all 
initialization/ load oriented thingies will be visible for upstream 
review. By doing so, we got all elephants in one room and can discuss 
how to handle it in best fashion: seamless transition for end-users.

There aren't many options available: notify user -or- fallback to 
defaults (hardcodes)? in case encountered binaries do not meet cAVS 
design criteria.

Personally, I'm against all hardcodes and would simply recommend all 
user to redirect their symlinks when they do switch kernel - along with 
dumping warning/ error message in dmesg. Hardcodes bring problems with 
forward compatibility and that's why host should offload them away to FW.

Czarek
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

^ permalink raw reply	[flat|nested] 107+ messages in thread

* Re: [PATCH 11/35] ASoC: Intel: Merge sst_dsp_device into sst_pdata
  2019-08-22 19:04 ` [PATCH 11/35] ASoC: Intel: Merge sst_dsp_device into sst_pdata Cezary Rojewski
@ 2019-08-23 18:54   ` Pierre-Louis Bossart
  2019-08-24 10:52     ` Cezary Rojewski
  0 siblings, 1 reply; 107+ messages in thread
From: Pierre-Louis Bossart @ 2019-08-23 18:54 UTC (permalink / raw)
  To: Cezary Rojewski, alsa-devel; +Cc: broonie, tiwai, lgirdwood


> @@ -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;
};

^ permalink raw reply	[flat|nested] 107+ messages in thread

* Re: [PATCH 12/35] ASoC: Intel: Skylake: Reuse sst_dsp_free
  2019-08-22 19:04 ` [PATCH 12/35] ASoC: Intel: Skylake: Reuse sst_dsp_free Cezary Rojewski
@ 2019-08-23 19:07   ` Pierre-Louis Bossart
  2019-08-24  9:35     ` Cezary Rojewski
  0 siblings, 1 reply; 107+ messages in thread
From: Pierre-Louis Bossart @ 2019-08-23 19:07 UTC (permalink / raw)
  To: Cezary Rojewski, alsa-devel; +Cc: broonie, tiwai, lgirdwood



On 8/22/19 2:04 PM, Cezary Rojewski wrote:
> 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...

> 
> Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
> ---
>   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(-)
> 
> diff --git a/sound/soc/intel/skylake/cnl-sst-dsp.c b/sound/soc/intel/skylake/cnl-sst-dsp.c
> index 189c1c7086e3..48b465939ef8 100644
> --- a/sound/soc/intel/skylake/cnl-sst-dsp.c
> +++ b/sound/soc/intel/skylake/cnl-sst-dsp.c
> @@ -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);
> diff --git a/sound/soc/intel/skylake/skl-sst-dsp.c b/sound/soc/intel/skylake/skl-sst-dsp.c
> index 348e69226e46..1c4ecbcd7db7 100644
> --- a/sound/soc/intel/skylake/skl-sst-dsp.c
> +++ b/sound/soc/intel/skylake/skl-sst-dsp.c
> @@ -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);
> diff --git a/sound/soc/intel/skylake/skl-sst.c b/sound/soc/intel/skylake/skl-sst.c
> index 72ee3d8a1d7d..e55523826346 100644
> --- a/sound/soc/intel/skylake/skl-sst.c
> +++ b/sound/soc/intel/skylake/skl-sst.c
> @@ -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);
> 

^ permalink raw reply	[flat|nested] 107+ messages in thread

* Re: [PATCH 13/35] ASoC: Intel: Skylake: Reuse sst_dsp_new
  2019-08-22 19:04 ` [PATCH 13/35] ASoC: Intel: Skylake: Reuse sst_dsp_new Cezary Rojewski
@ 2019-08-23 19:09   ` Pierre-Louis Bossart
  2019-08-24  9:37     ` Cezary Rojewski
  0 siblings, 1 reply; 107+ messages in thread
From: Pierre-Louis Bossart @ 2019-08-23 19:09 UTC (permalink / raw)
  To: Cezary Rojewski, alsa-devel; +Cc: broonie, tiwai, lgirdwood



On 8/22/19 2:04 PM, Cezary Rojewski wrote:
> skl_dsp_ctx_init is dumplication of sst_dsp_new and usage of such

typo: duplication.

> 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

 > -	return skl_dsp_acquire_irq(sst);
 > +	return 0;

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

> 
> Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
> ---
>   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(-)
> 
> diff --git a/sound/soc/intel/skylake/bxt-sst.c b/sound/soc/intel/skylake/bxt-sst.c
> index e3614acff34d..a8a2783f9b37 100644
> --- a/sound/soc/intel/skylake/bxt-sst.c
> +++ b/sound/soc/intel/skylake/bxt-sst.c
> @@ -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);
>   
> diff --git a/sound/soc/intel/skylake/cnl-sst.c b/sound/soc/intel/skylake/cnl-sst.c
> index 84dc6b82831d..0b0337f6ebff 100644
> --- a/sound/soc/intel/skylake/cnl-sst.c
> +++ b/sound/soc/intel/skylake/cnl-sst.c
> @@ -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);
>   
> diff --git a/sound/soc/intel/skylake/skl-sst-dsp.c b/sound/soc/intel/skylake/skl-sst-dsp.c
> index 1c4ecbcd7db7..9d8eb1af4798 100644
> --- a/sound/soc/intel/skylake/skl-sst-dsp.c
> +++ b/sound/soc/intel/skylake/skl-sst-dsp.c
> @@ -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;
> diff --git a/sound/soc/intel/skylake/skl-sst-dsp.h b/sound/soc/intel/skylake/skl-sst-dsp.h
> index ba37433e4efa..1d579d59de60 100644
> --- a/sound/soc/intel/skylake/skl-sst-dsp.h
> +++ b/sound/soc/intel/skylake/skl-sst-dsp.h
> @@ -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);
>   
> diff --git a/sound/soc/intel/skylake/skl-sst-utils.c b/sound/soc/intel/skylake/skl-sst-utils.c
> index 9061a9b17ea0..8e03a10855c4 100644
> --- a/sound/soc/intel/skylake/skl-sst-utils.c
> +++ b/sound/soc/intel/skylake/skl-sst-utils.c
> @@ -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;
> diff --git a/sound/soc/intel/skylake/skl-sst.c b/sound/soc/intel/skylake/skl-sst.c
> index e55523826346..6bb003add9e2 100644
> --- a/sound/soc/intel/skylake/skl-sst.c
> +++ b/sound/soc/intel/skylake/skl-sst.c
> @@ -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);
>   
> 

^ permalink raw reply	[flat|nested] 107+ messages in thread

* Re: [PATCH 15/35] ASoC: Intel: Skylake: Use dsp loading functions directly
  2019-08-22 19:04 ` [PATCH 15/35] ASoC: Intel: Skylake: Use dsp loading functions directly Cezary Rojewski
@ 2019-08-23 19:17   ` Pierre-Louis Bossart
  2019-08-24  9:41     ` Cezary Rojewski
  0 siblings, 1 reply; 107+ messages in thread
From: Pierre-Louis Bossart @ 2019-08-23 19:17 UTC (permalink / raw)
  To: Cezary Rojewski, alsa-devel; +Cc: broonie, tiwai, lgirdwood



On 8/22/19 2:04 PM, Cezary Rojewski wrote:
> 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?

> use of said operation directly. Takes part in remal of

removal?

> skl_dsp_loader_ops structure.
> 
> Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
> ---
>   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(-)
> 
> diff --git a/sound/soc/intel/skylake/bxt-sst.c b/sound/soc/intel/skylake/bxt-sst.c
> index a8a2783f9b37..1ca4fba0f35f 100644
> --- a/sound/soc/intel/skylake/bxt-sst.c
> +++ b/sound/soc/intel/skylake/bxt-sst.c
> @@ -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?

>   		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?

>   
> -		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);

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

^ permalink raw reply	[flat|nested] 107+ messages in thread

* Re: [PATCH 17/35] ASoC: Intel: Skylake: Remove skl_dsp_loader_ops
  2019-08-22 19:04 ` [PATCH 17/35] ASoC: Intel: Skylake: Remove skl_dsp_loader_ops Cezary Rojewski
@ 2019-08-23 19:21   ` Pierre-Louis Bossart
  2019-08-24  9:49     ` Cezary Rojewski
  0 siblings, 1 reply; 107+ messages in thread
From: Pierre-Louis Bossart @ 2019-08-23 19:21 UTC (permalink / raw)
  To: Cezary Rojewski, alsa-devel; +Cc: broonie, tiwai, lgirdwood



On 8/22/19 2:04 PM, Cezary Rojewski wrote:
> 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?

> 
> Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
> ---
>   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(-)
> 
> diff --git a/sound/soc/intel/common/sst-dsp-priv.h b/sound/soc/intel/common/sst-dsp-priv.h
> index 8a7009937d59..0fe9bebcfb38 100644
> --- a/sound/soc/intel/common/sst-dsp-priv.h
> +++ b/sound/soc/intel/common/sst-dsp-priv.h
> @@ -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;
> diff --git a/sound/soc/intel/skylake/bxt-sst.c b/sound/soc/intel/skylake/bxt-sst.c
> index 45da02f74f4d..c7961050c2ee 100644
> --- a/sound/soc/intel/skylake/bxt-sst.c
> +++ b/sound/soc/intel/skylake/bxt-sst.c
> @@ -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;
> diff --git a/sound/soc/intel/skylake/cnl-sst-dsp.h b/sound/soc/intel/skylake/cnl-sst-dsp.h
> index 30b586acc858..70da4f312f53 100644
> --- a/sound/soc/intel/skylake/cnl-sst-dsp.h
> +++ b/sound/soc/intel/skylake/cnl-sst-dsp.h
> @@ -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__*/
> diff --git a/sound/soc/intel/skylake/cnl-sst.c b/sound/soc/intel/skylake/cnl-sst.c
> index 4d9a4d5886f4..2f10076cc906 100644
> --- a/sound/soc/intel/skylake/cnl-sst.c
> +++ b/sound/soc/intel/skylake/cnl-sst.c
> @@ -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;
> diff --git a/sound/soc/intel/skylake/skl-messages.c b/sound/soc/intel/skylake/skl-messages.c
> index 20ab980fe8a1..6fbceec67b53 100644
> --- a/sound/soc/intel/skylake/skl-messages.c
> +++ b/sound/soc/intel/skylake/skl-messages.c
> @@ -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;
> diff --git a/sound/soc/intel/skylake/skl-sst-dsp.h b/sound/soc/intel/skylake/skl-sst-dsp.h
> index 97e16a602331..9f2dae92c1c9 100644
> --- a/sound/soc/intel/skylake/skl-sst-dsp.h
> +++ b/sound/soc/intel/skylake/skl-sst-dsp.h
> @@ -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,
> diff --git a/sound/soc/intel/skylake/skl-sst-utils.c b/sound/soc/intel/skylake/skl-sst-utils.c
> index 8e03a10855c4..bbe67e298efe 100644
> --- a/sound/soc/intel/skylake/skl-sst-utils.c
> +++ b/sound/soc/intel/skylake/skl-sst-utils.c
> @@ -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);
>   
> diff --git a/sound/soc/intel/skylake/skl-sst.c b/sound/soc/intel/skylake/skl-sst.c
> index 6bb003add9e2..e9a7b2509b35 100644
> --- a/sound/soc/intel/skylake/skl-sst.c
> +++ b/sound/soc/intel/skylake/skl-sst.c
> @@ -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;
> diff --git a/sound/soc/intel/skylake/skl.h b/sound/soc/intel/skylake/skl.h
> index 62e2f2d450e4..beeef67cb55f 100644
> --- a/sound/soc/intel/skylake/skl.h
> +++ b/sound/soc/intel/skylake/skl.h
> @@ -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);
>   };
>   
> 

^ permalink raw reply	[flat|nested] 107+ messages in thread

* Re: [PATCH 18/35] ASoC: Intel: Skylake: Remove window0 sst_addr fields
  2019-08-22 19:04 ` [PATCH 18/35] ASoC: Intel: Skylake: Remove window0 sst_addr fields Cezary Rojewski
@ 2019-08-23 19:26   ` Pierre-Louis Bossart
  2019-08-24  9:57     ` Cezary Rojewski
  0 siblings, 1 reply; 107+ messages in thread
From: Pierre-Louis Bossart @ 2019-08-23 19:26 UTC (permalink / raw)
  To: Cezary Rojewski, alsa-devel; +Cc: broonie, tiwai, lgirdwood



On 8/22/19 2:04 PM, Cezary Rojewski wrote:
> 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.
> 
> Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
> ---
>   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(-)
> 
> diff --git a/sound/soc/intel/common/sst-dsp-priv.h b/sound/soc/intel/common/sst-dsp-priv.h
> index 0fe9bebcfb38..53dcd87bab44 100644
> --- a/sound/soc/intel/common/sst-dsp-priv.h
> +++ b/sound/soc/intel/common/sst-dsp-priv.h
> @@ -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;
> diff --git a/sound/soc/intel/skylake/bxt-sst.c b/sound/soc/intel/skylake/bxt-sst.c
> index c7961050c2ee..641d5cf4aeb1 100644
> --- a/sound/soc/intel/skylake/bxt-sst.c
> +++ b/sound/soc/intel/skylake/bxt-sst.c
> @@ -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...

> diff --git a/sound/soc/intel/skylake/cnl-sst.c b/sound/soc/intel/skylake/cnl-sst.c
> index 2f10076cc906..64971966af38 100644
> --- a/sound/soc/intel/skylake/cnl-sst.c
> +++ b/sound/soc/intel/skylake/cnl-sst.c
> @@ -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...

> diff --git a/sound/soc/intel/skylake/skl-debug.c b/sound/soc/intel/skylake/skl-debug.c
> index 212370bf704c..6781eac13232 100644
> --- a/sound/soc/intel/skylake/skl-debug.c
> +++ b/sound/soc/intel/skylake/skl-debug.c
> @@ -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?

>   	void __iomem *in_base = sst->mailbox.in_base;
>   	void __iomem *fw_reg_addr;
>   	unsigned int offset;
> diff --git a/sound/soc/intel/skylake/skl-sst-dsp.h b/sound/soc/intel/skylake/skl-sst-dsp.h
> index 9f2dae92c1c9..5a0cb7f3d57e 100644
> --- a/sound/soc/intel/skylake/skl-sst-dsp.h
> +++ b/sound/soc/intel/skylake/skl-sst-dsp.h
> @@ -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
> diff --git a/sound/soc/intel/skylake/skl-sst.c b/sound/soc/intel/skylake/skl-sst.c
> index e9a7b2509b35..7e63c91cea54 100644
> --- a/sound/soc/intel/skylake/skl-sst.c
> +++ b/sound/soc/intel/skylake/skl-sst.c
> @@ -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);
> 

^ permalink raw reply	[flat|nested] 107+ messages in thread

* Re: [PATCH 19/35] ASoC: Intel: Skylake: Remove redundant W0 and W1 macros
  2019-08-22 19:04 ` [PATCH 19/35] ASoC: Intel: Skylake: Remove redundant W0 and W1 macros Cezary Rojewski
@ 2019-08-23 19:28   ` Pierre-Louis Bossart
  2019-08-24 11:52     ` Cezary Rojewski
  0 siblings, 1 reply; 107+ messages in thread
From: Pierre-Louis Bossart @ 2019-08-23 19:28 UTC (permalink / raw)
  To: Cezary Rojewski, alsa-devel; +Cc: broonie, tiwai, lgirdwood



On 8/22/19 2:04 PM, Cezary Rojewski wrote:
> The existing upling, downling and FW register size macros are

uplink and downlink?

> 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.

> 
> Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
> ---
>   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(-)
> 
> diff --git a/sound/soc/intel/skylake/bxt-sst.c b/sound/soc/intel/skylake/bxt-sst.c
> index 641d5cf4aeb1..fdd94711c3b4 100644
> --- a/sound/soc/intel/skylake/bxt-sst.c
> +++ b/sound/soc/intel/skylake/bxt-sst.c
> @@ -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) {
> diff --git a/sound/soc/intel/skylake/cnl-sst-dsp.h b/sound/soc/intel/skylake/cnl-sst-dsp.h
> index 70da4f312f53..a465cc42b7e8 100644
> --- a/sound/soc/intel/skylake/cnl-sst-dsp.h
> +++ b/sound/soc/intel/skylake/cnl-sst-dsp.h
> @@ -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
> diff --git a/sound/soc/intel/skylake/cnl-sst.c b/sound/soc/intel/skylake/cnl-sst.c
> index 64971966af38..d3da23e0ef05 100644
> --- a/sound/soc/intel/skylake/cnl-sst.c
> +++ b/sound/soc/intel/skylake/cnl-sst.c
> @@ -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) {
> diff --git a/sound/soc/intel/skylake/skl-sst-dsp.h b/sound/soc/intel/skylake/skl-sst-dsp.h
> index 5a0cb7f3d57e..3c92b1d849e4 100644
> --- a/sound/soc/intel/skylake/skl-sst-dsp.h
> +++ b/sound/soc/intel/skylake/skl-sst-dsp.h
> @@ -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
>   
> diff --git a/sound/soc/intel/skylake/skl-sst-ipc.c b/sound/soc/intel/skylake/skl-sst-ipc.c
> index 2700f882103d..72d7284d2fff 100644
> --- a/sound/soc/intel/skylake/skl-sst-ipc.c
> +++ b/sound/soc/intel/skylake/skl-sst-ipc.c
> @@ -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)
> diff --git a/sound/soc/intel/skylake/skl-sst.c b/sound/soc/intel/skylake/skl-sst.c
> index 7e63c91cea54..191931578fd2 100644
> --- a/sound/soc/intel/skylake/skl-sst.c
> +++ b/sound/soc/intel/skylake/skl-sst.c
> @@ -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) {
> 

^ permalink raw reply	[flat|nested] 107+ messages in thread

* Re: [PATCH 21/35] ASoC: Intel: Expose ACPI loading members
  2019-08-22 19:04 ` [PATCH 21/35] ASoC: Intel: Expose ACPI loading members Cezary Rojewski
@ 2019-08-23 19:32   ` Pierre-Louis Bossart
  2019-08-24  9:58     ` Cezary Rojewski
  0 siblings, 1 reply; 107+ messages in thread
From: Pierre-Louis Bossart @ 2019-08-23 19:32 UTC (permalink / raw)
  To: Cezary Rojewski, alsa-devel; +Cc: broonie, tiwai, lgirdwood


> diff --git a/sound/soc/intel/common/sst-dsp.h b/sound/soc/intel/common/sst-dsp.h
> index 63c29bb45cf1..a2ac7998fbdb 100644
> --- a/sound/soc/intel/common/sst-dsp.h
> +++ b/sound/soc/intel/common/sst-dsp.h
> @@ -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.

> +
> +/* 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.
> 

^ permalink raw reply	[flat|nested] 107+ messages in thread

* Re: [PATCH 22/35] ASoC: Intel: Haswell: Define separate ACPI loader
  2019-08-22 19:04 ` [PATCH 22/35] ASoC: Intel: Haswell: Define separate ACPI loader Cezary Rojewski
@ 2019-08-23 19:35   ` Pierre-Louis Bossart
  2019-08-24  9:59     ` Cezary Rojewski
  0 siblings, 1 reply; 107+ messages in thread
From: Pierre-Louis Bossart @ 2019-08-23 19:35 UTC (permalink / raw)
  To: Cezary Rojewski, alsa-devel; +Cc: broonie, tiwai, lgirdwood



On 8/22/19 2:04 PM, Cezary Rojewski wrote:
> 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.
> 
> Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
> ---
>   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
> 
> diff --git a/sound/soc/intel/Kconfig b/sound/soc/intel/Kconfig
> index a3ec17fd63cd..9191773d203c 100644
> --- a/sound/soc/intel/Kconfig
> +++ b/sound/soc/intel/Kconfig
> @@ -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?

> +
>   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
> diff --git a/sound/soc/intel/common/sst-acpi.c b/sound/soc/intel/common/sst-acpi.c
> index 42f9b02f2ea3..7d2f04ff0479 100644
> --- a/sound/soc/intel/common/sst-acpi.c
> +++ b/sound/soc/intel/common/sst-acpi.c
> @@ -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
> diff --git a/sound/soc/intel/haswell/Makefile b/sound/soc/intel/haswell/Makefile
> index ad2341aea8ae..0af852d0577b 100644
> --- a/sound/soc/intel/haswell/Makefile
> +++ b/sound/soc/intel/haswell/Makefile
> @@ -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
> diff --git a/sound/soc/intel/haswell/acpi.c b/sound/soc/intel/haswell/acpi.c
> new file mode 100644
> index 000000000000..7bd8b03851c4
> --- /dev/null
> +++ b/sound/soc/intel/haswell/acpi.c
> @@ -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 <cezary.rojewski@intel.com>");
> +MODULE_DESCRIPTION("Intel HSW loader on ACPI systems");
> +MODULE_LICENSE("GPL v2");
> 

^ permalink raw reply	[flat|nested] 107+ messages in thread

* Re: [PATCH 23/35] ASoC: Intel: Baytrail: Define separate ACPI loader
  2019-08-22 19:04 ` [PATCH 23/35] ASoC: Intel: Baytrail: " Cezary Rojewski
@ 2019-08-23 19:36   ` Pierre-Louis Bossart
  0 siblings, 0 replies; 107+ messages in thread
From: Pierre-Louis Bossart @ 2019-08-23 19:36 UTC (permalink / raw)
  To: Cezary Rojewski, alsa-devel; +Cc: broonie, tiwai, lgirdwood



On 8/22/19 2:04 PM, Cezary Rojewski wrote:
> 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.
> 
> Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
> ---
>   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
> 
> diff --git a/sound/soc/intel/Kconfig b/sound/soc/intel/Kconfig
> index 9191773d203c..baab845ea0ef 100644
> --- a/sound/soc/intel/Kconfig
> +++ b/sound/soc/intel/Kconfig
> @@ -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?

>   
>   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
> diff --git a/sound/soc/intel/baytrail/Makefile b/sound/soc/intel/baytrail/Makefile
> index 4d0806aac6bd..b59d4893b46b 100644
> --- a/sound/soc/intel/baytrail/Makefile
> +++ b/sound/soc/intel/baytrail/Makefile
> @@ -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
> diff --git a/sound/soc/intel/baytrail/acpi.c b/sound/soc/intel/baytrail/acpi.c
> new file mode 100644
> index 000000000000..57d10a6e3be2
> --- /dev/null
> +++ b/sound/soc/intel/baytrail/acpi.c
> @@ -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 <cezary.rojewski@intel.com>");
> +MODULE_DESCRIPTION("Intel BYT loader on ACPI systems");
> +MODULE_LICENSE("GPL v2");
> diff --git a/sound/soc/intel/baytrail/sst-baytrail-dsp.c b/sound/soc/intel/baytrail/sst-baytrail-dsp.c
> index 4869e18116eb..81bc05d62d5d 100644
> --- a/sound/soc/intel/baytrail/sst-baytrail-dsp.c
> +++ b/sound/soc/intel/baytrail/sst-baytrail-dsp.c
> @@ -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"
> diff --git a/sound/soc/intel/common/Makefile b/sound/soc/intel/common/Makefile
> index 56c81e20b5bf..65e0e66ab64f 100644
> --- a/sound/soc/intel/common/Makefile
> +++ b/sound/soc/intel/common/Makefile
> @@ -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
> diff --git a/sound/soc/intel/common/sst-acpi.c b/sound/soc/intel/common/sst-acpi.c
> index 7d2f04ff0479..8e75126106ea 100644
> --- a/sound/soc/intel/common/sst-acpi.c
> +++ b/sound/soc/intel/common/sst-acpi.c
> @@ -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 <jarkko.nikula@linux.intel.com>");
> -MODULE_DESCRIPTION("Intel SST loader on ACPI systems");
> -MODULE_LICENSE("GPL v2");
> 

^ permalink raw reply	[flat|nested] 107+ messages in thread

* Re: [PATCH 24/35] ASoC: Intel: Refactor probing of ACPI devices
  2019-08-22 19:04 ` [PATCH 24/35] ASoC: Intel: Refactor probing of ACPI devices Cezary Rojewski
@ 2019-08-23 19:43   ` Pierre-Louis Bossart
  2019-08-24 10:16     ` Cezary Rojewski
  0 siblings, 1 reply; 107+ messages in thread
From: Pierre-Louis Bossart @ 2019-08-23 19:43 UTC (permalink / raw)
  To: Cezary Rojewski, alsa-devel; +Cc: broonie, tiwai, lgirdwood



On 8/22/19 2:04 PM, Cezary Rojewski wrote:
> 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.
> 
> Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
> ---
>   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(-)
> 
> diff --git a/sound/soc/intel/baytrail/acpi.c b/sound/soc/intel/baytrail/acpi.c
> index 57d10a6e3be2..bf2560a8f3e2 100644
> --- a/sound/soc/intel/baytrail/acpi.c
> +++ b/sound/soc/intel/baytrail/acpi.c
> @@ -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,

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?

> +	.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;

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?


> +	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",
> diff --git a/sound/soc/intel/common/sst-acpi.c b/sound/soc/intel/common/sst-acpi.c
> index 8e75126106ea..53ac23f05966 100644
> --- a/sound/soc/intel/common/sst-acpi.c
> +++ b/sound/soc/intel/common/sst-acpi.c
> @@ -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))
> diff --git a/sound/soc/intel/common/sst-dsp.h b/sound/soc/intel/common/sst-dsp.h
> index a2ac7998fbdb..87d39b0e79c0 100644
> --- a/sound/soc/intel/common/sst-dsp.h
> +++ b/sound/soc/intel/common/sst-dsp.h
> @@ -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;
> diff --git a/sound/soc/intel/common/sst-firmware.c b/sound/soc/intel/common/sst-firmware.c
> index 6b6af11c32c3..61d3e6e46b98 100644
> --- a/sound/soc/intel/common/sst-firmware.c
> +++ b/sound/soc/intel/common/sst-firmware.c
> @@ -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;
>   
> diff --git a/sound/soc/intel/haswell/acpi.c b/sound/soc/intel/haswell/acpi.c
> index 7bd8b03851c4..3c49ec257e56 100644
> --- a/sound/soc/intel/haswell/acpi.c
> +++ b/sound/soc/intel/haswell/acpi.c
> @@ -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",
> diff --git a/sound/soc/intel/skylake/skl-sst-utils.c b/sound/soc/intel/skylake/skl-sst-utils.c
> index bbe67e298efe..ac0a0e4c2d68 100644
> --- a/sound/soc/intel/skylake/skl-sst-utils.c
> +++ b/sound/soc/intel/skylake/skl-sst-utils.c
> @@ -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);
> 

^ permalink raw reply	[flat|nested] 107+ messages in thread

* Re: [PATCH 27/35] ASoC: Intel: Skylake: Define platform descriptors
  2019-08-22 19:04 ` [PATCH 27/35] ASoC: Intel: Skylake: Define platform descriptors Cezary Rojewski
@ 2019-08-23 19:50   ` Pierre-Louis Bossart
  2019-08-24 10:51     ` Cezary Rojewski
  0 siblings, 1 reply; 107+ messages in thread
From: Pierre-Louis Bossart @ 2019-08-23 19:50 UTC (permalink / raw)
  To: Cezary Rojewski, alsa-devel; +Cc: broonie, tiwai, lgirdwood



On 8/22/19 2:04 PM, Cezary Rojewski wrote:
> 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.

> 
> Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
> ---
>   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(-)
> 
> diff --git a/sound/soc/intel/skylake/bxt-sst.c b/sound/soc/intel/skylake/bxt-sst.c
> index a547fb84eee9..06da822790a5 100644
> --- a/sound/soc/intel/skylake/bxt-sst.c
> +++ b/sound/soc/intel/skylake/bxt-sst.c
> @@ -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)
> diff --git a/sound/soc/intel/skylake/cnl-sst.c b/sound/soc/intel/skylake/cnl-sst.c
> index 5be0a8eb154d..c4dbf6655097 100644
> --- a/sound/soc/intel/skylake/cnl-sst.c
> +++ b/sound/soc/intel/skylake/cnl-sst.c
> @@ -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)
> diff --git a/sound/soc/intel/skylake/skl-sst.c b/sound/soc/intel/skylake/skl-sst.c
> index 8ae7fe73534e..122c07290440 100644
> --- a/sound/soc/intel/skylake/skl-sst.c
> +++ b/sound/soc/intel/skylake/skl-sst.c
> @@ -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)
> diff --git a/sound/soc/intel/skylake/skl.c b/sound/soc/intel/skylake/skl.c
> index 54e1f957121d..d6d099aba834 100644
> --- a/sound/soc/intel/skylake/skl.c
> +++ b/sound/soc/intel/skylake/skl.c
> @@ -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)
> diff --git a/sound/soc/intel/skylake/skl.h b/sound/soc/intel/skylake/skl.h
> index 9f5aa53df9f8..2f2b5a141abf 100644
> --- a/sound/soc/intel/skylake/skl.h
> +++ b/sound/soc/intel/skylake/skl.h
> @@ -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;
> 

^ permalink raw reply	[flat|nested] 107+ messages in thread

* Re: [PATCH 00/35] ASoC: Intel: Clenaup SST initialization
  2019-08-23 18:44           ` Cezary Rojewski
@ 2019-08-23 20:12             ` Pierre-Louis Bossart
  2019-08-23 21:39               ` Mark Brown
  0 siblings, 1 reply; 107+ messages in thread
From: Pierre-Louis Bossart @ 2019-08-23 20:12 UTC (permalink / raw)
  To: Cezary Rojewski, Mark Brown
  Cc: Wasko, Michal, alsa-devel, tiwai, lgirdwood, Kaczmarski, Filip



On 8/23/19 1:44 PM, Cezary Rojewski wrote:
> On 2019-08-23 18:26, Pierre-Louis Bossart wrote:
>>
>>
>> On 8/23/19 5:43 AM, Cezary Rojewski wrote:
>>> On 2019-08-23 12:26, Mark Brown wrote:
>>>> On Fri, Aug 23, 2019 at 10:29:59AM +0200, Cezary Rojewski wrote:
>>>>> On 2019-08-22 22:55, Pierre-Louis Bossart wrote:
>>>>>> On 8/22/19 2:03 PM, Cezary Rojewski wrote:
>>>>
>>>>>>> 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/.
>>>>
>>>>> 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.
>>
>> The machine driver defines how many links are used, and in what mode 
>> for the older cases where the topology is not used. You have 
>> configurations with very complicated links, e.g. with amplifiers in 
>> TDM mode plus IV feedback that will stress the firmware in ways that 
>> regular RVPs don't. Same for the case where the SSP clock is turned on 
>> at the request of the machine drivers. That's another case that can't 
>> be tested on RVPs.
>>
>> I am not saying you need to test with every single commercial device, 
>> but that testing on RVPs is not a representative sample of the 
>> configurations and actual workloads.
>>
> 
> Each and every FW coming from main branch gets tested on both RVP and 
> production devices what is done with cooperation with integration teams, 
> PAEs and such. Windows teams alone ensures each binary gets smashed by 
> ten of thousands tests each week - this is true for any release 
> candidate, the standards are very high. Moreover, array of platforms is 
> engaged per target (e.g.: TGL) as single platform alone does not cut it.
> 
> So, I'd not worry about FW being vulnerable to any scenario as long as 
> recommended protocol is followed.

I didn't mean to diss the validation work, but the Chromebook cases and 
amplifiers over TDM with IV feedback are certainly not configurations 
tested by Windows folks who are using HDaudio+DMIC only.

>> With the request_firmware() mechanism, the kernel cannot parse the 
>> file ahead of time, but don't you have a version information reported 
>> by the firmware post-boot that can be used by the kernel so track that 
>> the firmware isn't likely to work?
>>
> 
> Wasn't lying about FW version being unreliable. Let's say vendor 
> receives quick FW drop with new RCR.. such eng drop may carry invalid 
> numbers such as 0.0.0.0..
> In general, I try to avoid relying on FW version whenever possible. It 
> can be dumped for debug reasons, true, but to be relied on? Not really.

Goodness, that's really bad. I didn't realize this.

> 
>>>
>>> - user removes existing sym link from /lib/firmware/intel and creates 
>>> new one, pointing to updated FW binary that should also be present in 
>>> /lib/firmware/intel
>>
>> That's typically handled by distributions updating the linux-firmware 
>> package. Only advanced users and developers can change these symlinks.
>>
>> The other point that comes to my mind is whether we are going to see 
>> dependencies between firmware and topology files? Can you use an 'old' 
>> topology with a 'newer' firmware, or is this a 3-way interoperability 
>> issue?
> 
> Precisely! Three-way-tie!
> It's best FW get updated together with topology as old FW may enforce 
> different constraints on pipeline modules.
> 
> Yay, between rock and hard place. On one side we got old buggy FWs which 
> should (more like should NOT be even here..) be updated to improve 
> user's experience but updating these alone won't cut it as host side 
> needs to be aligned too.
> On the other we want to align upstream /skylake with actual working 
> example, which will quickly fail if it encounters obsolete FW binary.
> And if that wasn't enough, lovely topologies come into picture where 
> some of these were developed behind FDK's back and thus completely 
> bypassing deployment process.
> 
> First thing we will do now is prioritizing topology refactor so all 
> initialization/ load oriented thingies will be visible for upstream 
> review. By doing so, we got all elephants in one room and can discuss 
> how to handle it in best fashion: seamless transition for end-users.
> 
> There aren't many options available: notify user -or- fallback to 
> defaults (hardcodes)? in case encountered binaries do not meet cAVS 
> design criteria.
> 
> Personally, I'm against all hardcodes and would simply recommend all 
> user to redirect their symlinks when they do switch kernel - along with 
> dumping warning/ error message in dmesg. Hardcodes bring problems with 
> forward compatibility and that's why host should offload them away to FW.

Cezary, I know you are not responsible for all this, but at this point 
if we (Intel) can't guarantee any sort of interoperability with both 
firmware and topology we should make it clear that this driver is not 
recommended unless specific versions of the firmware/topology are used, 
and as a consequence the typical client distros and desktop/laptop users 
should use HDaudio legacy or SOF (for DMICs)

^ permalink raw reply	[flat|nested] 107+ messages in thread

* Re: [PATCH 28/35] ASoC: Intel: Skylake: Update skl_ids table
  2019-08-22 19:04 ` [PATCH 28/35] ASoC: Intel: Skylake: Update skl_ids table Cezary Rojewski
@ 2019-08-23 20:15   ` Pierre-Louis Bossart
  0 siblings, 0 replies; 107+ messages in thread
From: Pierre-Louis Bossart @ 2019-08-23 20:15 UTC (permalink / raw)
  To: Cezary Rojewski, alsa-devel; +Cc: broonie, tiwai, lgirdwood



On 8/22/19 2:04 PM, Cezary Rojewski wrote:
> 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.

> 
> Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
> ---
>   sound/soc/intel/skylake/skl.c | 20 +++++++++++---------
>   1 file changed, 11 insertions(+), 9 deletions(-)
> 
> diff --git a/sound/soc/intel/skylake/skl.c b/sound/soc/intel/skylake/skl.c
> index d6d099aba834..53a6befd5d68 100644
> --- a/sound/soc/intel/skylake/skl.c
> +++ b/sound/soc/intel/skylake/skl.c
> @@ -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, }
>   };
> 

^ permalink raw reply	[flat|nested] 107+ messages in thread

* Re: [PATCH 29/35] ASoC: Intel: Skylake: Flip SST initialization order
  2019-08-22 19:04 ` [PATCH 29/35] ASoC: Intel: Skylake: Flip SST initialization order Cezary Rojewski
@ 2019-08-23 20:18   ` Pierre-Louis Bossart
  2019-08-24 10:54     ` Cezary Rojewski
  0 siblings, 1 reply; 107+ messages in thread
From: Pierre-Louis Bossart @ 2019-08-23 20:18 UTC (permalink / raw)
  To: Cezary Rojewski, alsa-devel; +Cc: broonie, tiwai, lgirdwood



On 8/22/19 2:04 PM, Cezary Rojewski wrote:
> 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?

> bypassing sst_dsp_new -> sst_ops::init order. Fix that by flipping
> invocation order of handlers engaged in Skylake initialization.
> 
> Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
> ---
>   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(-)
> 
> diff --git a/sound/soc/intel/skylake/bxt-sst.c b/sound/soc/intel/skylake/bxt-sst.c
> index 06da822790a5..286da9fbc4de 100644
> --- a/sound/soc/intel/skylake/bxt-sst.c
> +++ b/sound/soc/intel/skylake/bxt-sst.c
> @@ -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)
> diff --git a/sound/soc/intel/skylake/cnl-sst-dsp.h b/sound/soc/intel/skylake/cnl-sst-dsp.h
> index 02e070fae2ce..7810ae11954a 100644
> --- a/sound/soc/intel/skylake/cnl-sst-dsp.h
> +++ b/sound/soc/intel/skylake/cnl-sst-dsp.h
> @@ -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__*/
> diff --git a/sound/soc/intel/skylake/cnl-sst.c b/sound/soc/intel/skylake/cnl-sst.c
> index c4dbf6655097..a6113d8afcbb 100644
> --- a/sound/soc/intel/skylake/cnl-sst.c
> +++ b/sound/soc/intel/skylake/cnl-sst.c
> @@ -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)
> diff --git a/sound/soc/intel/skylake/skl-messages.c b/sound/soc/intel/skylake/skl-messages.c
> index 8c352255ff45..372c5fb83ddb 100644
> --- a/sound/soc/intel/skylake/skl-messages.c
> +++ b/sound/soc/intel/skylake/skl-messages.c
> @@ -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;
>   
> diff --git a/sound/soc/intel/skylake/skl-sst-dsp.h b/sound/soc/intel/skylake/skl-sst-dsp.h
> index b647e60d7a6d..8483c60f29ba 100644
> --- a/sound/soc/intel/skylake/skl-sst-dsp.h
> +++ b/sound/soc/intel/skylake/skl-sst-dsp.h
> @@ -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);
>   
> diff --git a/sound/soc/intel/skylake/skl-sst.c b/sound/soc/intel/skylake/skl-sst.c
> index 122c07290440..e0f2bf828541 100644
> --- a/sound/soc/intel/skylake/skl-sst.c
> +++ b/sound/soc/intel/skylake/skl-sst.c
> @@ -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)
> diff --git a/sound/soc/intel/skylake/skl.c b/sound/soc/intel/skylake/skl.c
> index 53a6befd5d68..39442c80a179 100644
> --- a/sound/soc/intel/skylake/skl.c
> +++ b/sound/soc/intel/skylake/skl.c
> @@ -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;
> diff --git a/sound/soc/intel/skylake/skl.h b/sound/soc/intel/skylake/skl.h
> index 2f2b5a141abf..f4cd5ccc1ff9 100644
> --- a/sound/soc/intel/skylake/skl.h
> +++ b/sound/soc/intel/skylake/skl.h
> @@ -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);
> 

^ permalink raw reply	[flat|nested] 107+ messages in thread

* Re: [PATCH 30/35] ASoC: Intel: Reuse sst_pdata::fw_name field
  2019-08-22 19:04 ` [PATCH 30/35] ASoC: Intel: Reuse sst_pdata::fw_name field Cezary Rojewski
@ 2019-08-23 20:20   ` Pierre-Louis Bossart
  2019-08-24 10:57     ` Cezary Rojewski
  0 siblings, 1 reply; 107+ messages in thread
From: Pierre-Louis Bossart @ 2019-08-23 20:20 UTC (permalink / raw)
  To: Cezary Rojewski, alsa-devel; +Cc: broonie, tiwai, lgirdwood



On 8/22/19 2:04 PM, Cezary Rojewski wrote:
> 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.

> 
> Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
> ---
>   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(-)
> 
> diff --git a/sound/soc/intel/common/sst-acpi.c b/sound/soc/intel/common/sst-acpi.c
> index 53ac23f05966..15f2b27e643f 100644
> --- a/sound/soc/intel/common/sst-acpi.c
> +++ b/sound/soc/intel/common/sst-acpi.c
> @@ -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);
> diff --git a/sound/soc/intel/common/sst-firmware.c b/sound/soc/intel/common/sst-firmware.c
> index 61d3e6e46b98..cc88849eb10f 100644
> --- a/sound/soc/intel/common/sst-firmware.c
> +++ b/sound/soc/intel/common/sst-firmware.c
> @@ -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);
> diff --git a/sound/soc/intel/skylake/skl-messages.c b/sound/soc/intel/skylake/skl-messages.c
> index 372c5fb83ddb..e401edd8d44b 100644
> --- a/sound/soc/intel/skylake/skl-messages.c
> +++ b/sound/soc/intel/skylake/skl-messages.c
> @@ -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;
>   
> diff --git a/sound/soc/intel/skylake/skl-sst-dsp.h b/sound/soc/intel/skylake/skl-sst-dsp.h
> index 8483c60f29ba..a3714b706b8e 100644
> --- a/sound/soc/intel/skylake/skl-sst-dsp.h
> +++ b/sound/soc/intel/skylake/skl-sst-dsp.h
> @@ -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);
> diff --git a/sound/soc/intel/skylake/skl-sst-utils.c b/sound/soc/intel/skylake/skl-sst-utils.c
> index a4ad213d34e0..ea5419012312 100644
> --- a/sound/soc/intel/skylake/skl-sst-utils.c
> +++ b/sound/soc/intel/skylake/skl-sst-utils.c
> @@ -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;
>   
> diff --git a/sound/soc/intel/skylake/skl.c b/sound/soc/intel/skylake/skl.c
> index 39442c80a179..3225f4f8793e 100644
> --- a/sound/soc/intel/skylake/skl.c
> +++ b/sound/soc/intel/skylake/skl.c
> @@ -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) {
> 

^ permalink raw reply	[flat|nested] 107+ messages in thread

* Re: [PATCH 33/35] ASoC: Intel: Skylake: Privatize SST init handlers
  2019-08-22 19:04 ` [PATCH 33/35] ASoC: Intel: Skylake: Privatize SST init handlers Cezary Rojewski
@ 2019-08-23 20:25   ` Pierre-Louis Bossart
  2019-08-24 11:01     ` Cezary Rojewski
  0 siblings, 1 reply; 107+ messages in thread
From: Pierre-Louis Bossart @ 2019-08-23 20:25 UTC (permalink / raw)
  To: Cezary Rojewski, alsa-devel; +Cc: broonie, tiwai, lgirdwood



On 8/22/19 2:04 PM, Cezary Rojewski wrote:
> With initialization order repaired, sst_ops::init overloads can be
> privatized for Skylake platofmrs. Let's do so.

platforms

> 
> Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
> ---
>   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(-)
> 
> diff --git a/sound/soc/intel/skylake/bxt-sst.c b/sound/soc/intel/skylake/bxt-sst.c
> index 79728e418176..1edc38069615 100644
> --- a/sound/soc/intel/skylake/bxt-sst.c
> +++ b/sound/soc/intel/skylake/bxt-sst.c
> @@ -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,
> +};

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

>   
>   MODULE_LICENSE("GPL v2");
>   MODULE_DESCRIPTION("Intel Broxton IPC driver");
> diff --git a/sound/soc/intel/skylake/cnl-sst-dsp.h b/sound/soc/intel/skylake/cnl-sst-dsp.h
> index 7810ae11954a..a1ea242e9539 100644
> --- a/sound/soc/intel/skylake/cnl-sst-dsp.h
> +++ b/sound/soc/intel/skylake/cnl-sst-dsp.h
> @@ -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__*/
> diff --git a/sound/soc/intel/skylake/cnl-sst.c b/sound/soc/intel/skylake/cnl-sst.c
> index 58efeb6c8a8a..360e54d3c587 100644
> --- a/sound/soc/intel/skylake/cnl-sst.c
> +++ b/sound/soc/intel/skylake/cnl-sst.c
> @@ -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");
> diff --git a/sound/soc/intel/skylake/skl-sst-dsp.h b/sound/soc/intel/skylake/skl-sst-dsp.h
> index a3714b706b8e..3294826d5cf7 100644
> --- a/sound/soc/intel/skylake/skl-sst-dsp.h
> +++ b/sound/soc/intel/skylake/skl-sst-dsp.h
> @@ -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);
>   
> diff --git a/sound/soc/intel/skylake/skl-sst.c b/sound/soc/intel/skylake/skl-sst.c
> index 8e1d02e29a32..209f45e3d5d0 100644
> --- a/sound/soc/intel/skylake/skl-sst.c
> +++ b/sound/soc/intel/skylake/skl-sst.c
> @@ -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)
>   {
> 

^ permalink raw reply	[flat|nested] 107+ messages in thread

* Re: [PATCH 35/35] ASoC: Intel: Remove obsolete firmware fields
  2019-08-22 19:04 ` [PATCH 35/35] ASoC: Intel: Remove obsolete firmware fields Cezary Rojewski
@ 2019-08-23 20:27   ` Pierre-Louis Bossart
  2019-08-24 11:02     ` Cezary Rojewski
  0 siblings, 1 reply; 107+ messages in thread
From: Pierre-Louis Bossart @ 2019-08-23 20:27 UTC (permalink / raw)
  To: Cezary Rojewski, alsa-devel; +Cc: broonie, lgirdwood, tiwai



On 8/22/19 2:04 PM, Cezary Rojewski wrote:
> 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.

> Any remaining deprecated survivors of the precedding tidal wave are
> removed here too.
> 
> Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
> ---
>   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(-)
> 
> diff --git a/sound/soc/intel/common/soc-acpi-intel-bxt-match.c b/sound/soc/intel/common/soc-acpi-intel-bxt-match.c
> index 4a5adae1d785..eda799e49113 100644
> --- a/sound/soc/intel/common/soc-acpi-intel-bxt-match.c
> +++ b/sound/soc/intel/common/soc-acpi-intel-bxt-match.c
> @@ -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",
> diff --git a/sound/soc/intel/common/soc-acpi-intel-byt-match.c b/sound/soc/intel/common/soc-acpi-intel-byt-match.c
> index 1cc801ba92eb..4d2ba663ee33 100644
> --- a/sound/soc/intel/common/soc-acpi-intel-byt-match.c
> +++ b/sound/soc/intel/common/soc-acpi-intel-byt-match.c
> @@ -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",
>   	},
>   	{}
>   };
> diff --git a/sound/soc/intel/common/soc-acpi-intel-cnl-match.c b/sound/soc/intel/common/soc-acpi-intel-cnl-match.c
> index 771b0ef21051..edc44a0dc96f 100644
> --- a/sound/soc/intel/common/soc-acpi-intel-cnl-match.c
> +++ b/sound/soc/intel/common/soc-acpi-intel-cnl-match.c
> @@ -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",
> diff --git a/sound/soc/intel/common/soc-acpi-intel-glk-match.c b/sound/soc/intel/common/soc-acpi-intel-glk-match.c
> index 60dea358fa04..370487d13c85 100644
> --- a/sound/soc/intel/common/soc-acpi-intel-glk-match.c
> +++ b/sound/soc/intel/common/soc-acpi-intel-glk-match.c
> @@ -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",
> diff --git a/sound/soc/intel/common/soc-acpi-intel-hda-match.c b/sound/soc/intel/common/soc-acpi-intel-hda-match.c
> index cc972d2ac691..39827d2e8634 100644
> --- a/sound/soc/intel/common/soc-acpi-intel-hda-match.c
> +++ b/sound/soc/intel/common/soc-acpi-intel-hda-match.c
> @@ -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",
> diff --git a/sound/soc/intel/common/soc-acpi-intel-hsw-bdw-match.c b/sound/soc/intel/common/soc-acpi-intel-hsw-bdw-match.c
> index 34eb0baaa951..6b113c32aff0 100644
> --- a/sound/soc/intel/common/soc-acpi-intel-hsw-bdw-match.c
> +++ b/sound/soc/intel/common/soc-acpi-intel-hsw-bdw-match.c
> @@ -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",
>   	},
> diff --git a/sound/soc/intel/common/soc-acpi-intel-icl-match.c b/sound/soc/intel/common/soc-acpi-intel-icl-match.c
> index 38977669b576..04a17da96f6a 100644
> --- a/sound/soc/intel/common/soc-acpi-intel-icl-match.c
> +++ b/sound/soc/intel/common/soc-acpi-intel-icl-match.c
> @@ -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",
> diff --git a/sound/soc/intel/common/soc-acpi-intel-kbl-match.c b/sound/soc/intel/common/soc-acpi-intel-kbl-match.c
> index e200baa11011..fe82d5472aa3 100644
> --- a/sound/soc/intel/common/soc-acpi-intel-kbl-match.c
> +++ b/sound/soc/intel/common/soc-acpi-intel-kbl-match.c
> @@ -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
>   	},
>   	{},
> diff --git a/sound/soc/intel/common/soc-acpi-intel-skl-match.c b/sound/soc/intel/common/soc-acpi-intel-skl-match.c
> index 42fa40a8d932..ec969044706c 100644
> --- a/sound/soc/intel/common/soc-acpi-intel-skl-match.c
> +++ b/sound/soc/intel/common/soc-acpi-intel-skl-match.c
> @@ -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,
> diff --git a/sound/soc/intel/common/sst-dsp-priv.h b/sound/soc/intel/common/sst-dsp-priv.h
> index a4628a89d47d..1a208ef65fa8 100644
> --- a/sound/soc/intel/common/sst-dsp-priv.h
> +++ b/sound/soc/intel/common/sst-dsp-priv.h
> @@ -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;
>   };
>   
> diff --git a/sound/soc/intel/skylake/skl.h b/sound/soc/intel/skylake/skl.h
> index 218e8bda6cae..7b283c2bb7b5 100644
> --- a/sound/soc/intel/skylake/skl.h
> +++ b/sound/soc/intel/skylake/skl.h
> @@ -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;
> 

^ permalink raw reply	[flat|nested] 107+ messages in thread

* Re: [PATCH 00/35] ASoC: Intel: Clenaup SST initialization
  2019-08-23 20:12             ` Pierre-Louis Bossart
@ 2019-08-23 21:39               ` Mark Brown
  2019-08-24 13:51                 ` Cezary Rojewski
  0 siblings, 1 reply; 107+ messages in thread
From: Mark Brown @ 2019-08-23 21:39 UTC (permalink / raw)
  To: Pierre-Louis Bossart
  Cc: Cezary Rojewski, alsa-devel, Kaczmarski, Filip, lgirdwood, tiwai,
	Wasko, Michal


[-- Attachment #1.1: Type: text/plain, Size: 2193 bytes --]

On Fri, Aug 23, 2019 at 03:12:18PM -0500, Pierre-Louis Bossart wrote:
> On 8/23/19 1:44 PM, Cezary Rojewski wrote:

> > Wasn't lying about FW version being unreliable. Let's say vendor
> > receives quick FW drop with new RCR.. such eng drop may carry invalid
> > numbers such as 0.0.0.0..
> > In general, I try to avoid relying on FW version whenever possible. It
> > can be dumped for debug reasons, true, but to be relied on? Not really.

> Goodness, that's really bad. I didn't realize this.

At a previous employer I modified our build stamping
infrastructure to also include both a timestamp and a serialized
build number in the version number since one of my colleagues was
fond of sending people prereleases of what he was working on to
other people with identical version numbers on different
binaries leading to much confusion and checksumming.  You do see
a lot of things with those serialized version numbers, especially
SVN based projects.

> > Personally, I'm against all hardcodes and would simply recommend all
> > user to redirect their symlinks when they do switch kernel - along with
> > dumping warning/ error message in dmesg. Hardcodes bring problems with
> > forward compatibility and that's why host should offload them away to
> > FW.

> Cezary, I know you are not responsible for all this, but at this point if we
> (Intel) can't guarantee any sort of interoperability with both firmware and
> topology we should make it clear that this driver is not recommended unless
> specific versions of the firmware/topology are used, and as a consequence
> the typical client distros and desktop/laptop users should use HDaudio
> legacy or SOF (for DMICs)

Not the most elegent solution but I'm wondering if keeping a copy
of the driver as is around and using new locations for the fixed
firmware might be the safest way to handle this.  We could have a
wrapper which tries to load the newer firmware and uses the fixed
driver code if that's there, otherwise tries the old driver with
the existing firmware paths.  This is obviously a horror show and
leaves the old code sitting there but given the mistakes that
have been made the whole situation looks like a house of cards.

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

[-- Attachment #2: Type: text/plain, Size: 0 bytes --]



^ permalink raw reply	[flat|nested] 107+ messages in thread

* Re: [PATCH 02/35] ASoC: Intel: Skylake: Add FIRMWARE_CONFIG IPC request
  2019-08-23 18:24   ` Pierre-Louis Bossart
@ 2019-08-24  9:17     ` Cezary Rojewski
  2019-08-26 16:27       ` Pierre-Louis Bossart
  0 siblings, 1 reply; 107+ messages in thread
From: Cezary Rojewski @ 2019-08-24  9:17 UTC (permalink / raw)
  To: Pierre-Louis Bossart, alsa-devel; +Cc: broonie, tiwai, lgirdwood

On 2019-08-23 20:24, Pierre-Louis Bossart wrote:
> 
> 
> On 8/22/19 2:03 PM, Cezary Rojewski wrote:
>> 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.
>>
>> Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
>> ---
>>   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(+)
>>
>> diff --git a/sound/soc/intel/skylake/skl-sst-ipc.c 
>> b/sound/soc/intel/skylake/skl-sst-ipc.c
>> index 667cdddc289f..e9e11ec4c97b 100644
>> --- a/sound/soc/intel/skylake/skl-sst-ipc.c
>> +++ b/sound/soc/intel/skylake/skl-sst-ipc.c
>> @@ -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;
> 
> 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.

>> +        }
>> +
>> +        offset += sizeof(*tlv) + tlv->length;
>> +    }
>> +
>> +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.

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

^ permalink raw reply	[flat|nested] 107+ messages in thread

* Re: [PATCH 03/35] ASoC: Intel: Skylake: Add HARDWARE_CONFIG IPC request
  2019-08-23 18:32   ` Pierre-Louis Bossart
@ 2019-08-24  9:30     ` Cezary Rojewski
  0 siblings, 0 replies; 107+ messages in thread
From: Cezary Rojewski @ 2019-08-24  9:30 UTC (permalink / raw)
  To: Pierre-Louis Bossart, alsa-devel; +Cc: broonie, tiwai, lgirdwood

On 2019-08-23 20:32, Pierre-Louis Bossart wrote:
> 
>> +    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;
>> +
>> +        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?
> 

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.

>> +            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;
>> +            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.

Same answer as for FIRMWARE_CONFIG.

> 
>> +        }
>> +
>> +        offset += sizeof(*tlv) + tlv->length;
>> +    }
>> +
>> +exit:
>> +    kfree(payload);
>> +    return ret;
>> +}
>> +EXPORT_SYMBOL_GPL(skl_ipc_hw_cfg_get);
>> diff --git a/sound/soc/intel/skylake/skl-sst-ipc.h 
>> b/sound/soc/intel/skylake/skl-sst-ipc.h
>> index ebc5852e15d0..eefa52f7f97a 100644
>> --- a/sound/soc/intel/skylake/skl-sst-ipc.h
>> +++ b/sound/soc/intel/skylake/skl-sst-ipc.h
>> @@ -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 {
>> +    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
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

^ permalink raw reply	[flat|nested] 107+ messages in thread

* Re: [PATCH 04/35] ASoC: Intel: Skylake: Unify firmware loading mechanism
  2019-08-23 18:40   ` Pierre-Louis Bossart
@ 2019-08-24  9:34     ` Cezary Rojewski
  2019-08-26 16:31       ` Pierre-Louis Bossart
  0 siblings, 1 reply; 107+ messages in thread
From: Cezary Rojewski @ 2019-08-24  9:34 UTC (permalink / raw)
  To: Pierre-Louis Bossart, alsa-devel; +Cc: broonie, tiwai, lgirdwood

On 2019-08-23 20:40, Pierre-Louis Bossart wrote:
> 
>> -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;
>> +    }
>> +
>> +    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.

>> +
>> +    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);
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

^ permalink raw reply	[flat|nested] 107+ messages in thread

* Re: [PATCH 12/35] ASoC: Intel: Skylake: Reuse sst_dsp_free
  2019-08-23 19:07   ` Pierre-Louis Bossart
@ 2019-08-24  9:35     ` Cezary Rojewski
  0 siblings, 0 replies; 107+ messages in thread
From: Cezary Rojewski @ 2019-08-24  9:35 UTC (permalink / raw)
  To: Pierre-Louis Bossart, alsa-devel; +Cc: broonie, tiwai, lgirdwood

On 2019-08-23 21:07, Pierre-Louis Bossart wrote:
> 
> 
> On 8/22/19 2:04 PM, Cezary Rojewski wrote:
>> 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.

>>
>> Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
>> ---
>>   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(-)
>>
>> diff --git a/sound/soc/intel/skylake/cnl-sst-dsp.c 
>> b/sound/soc/intel/skylake/cnl-sst-dsp.c
>> index 189c1c7086e3..48b465939ef8 100644
>> --- a/sound/soc/intel/skylake/cnl-sst-dsp.c
>> +++ b/sound/soc/intel/skylake/cnl-sst-dsp.c
>> @@ -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);
>> diff --git a/sound/soc/intel/skylake/skl-sst-dsp.c 
>> b/sound/soc/intel/skylake/skl-sst-dsp.c
>> index 348e69226e46..1c4ecbcd7db7 100644
>> --- a/sound/soc/intel/skylake/skl-sst-dsp.c
>> +++ b/sound/soc/intel/skylake/skl-sst-dsp.c
>> @@ -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);
>> diff --git a/sound/soc/intel/skylake/skl-sst.c 
>> b/sound/soc/intel/skylake/skl-sst.c
>> index 72ee3d8a1d7d..e55523826346 100644
>> --- a/sound/soc/intel/skylake/skl-sst.c
>> +++ b/sound/soc/intel/skylake/skl-sst.c
>> @@ -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
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

^ permalink raw reply	[flat|nested] 107+ messages in thread

* Re: [PATCH 13/35] ASoC: Intel: Skylake: Reuse sst_dsp_new
  2019-08-23 19:09   ` Pierre-Louis Bossart
@ 2019-08-24  9:37     ` Cezary Rojewski
  0 siblings, 0 replies; 107+ messages in thread
From: Cezary Rojewski @ 2019-08-24  9:37 UTC (permalink / raw)
  To: Pierre-Louis Bossart, alsa-devel; +Cc: broonie, tiwai, lgirdwood

On 2019-08-23 21:09, Pierre-Louis Bossart wrote:
> 
> 
> On 8/22/19 2:04 PM, Cezary Rojewski wrote:
>> skl_dsp_ctx_init is dumplication of sst_dsp_new and usage of such
> 
> typo: duplication.
> 

Ack.

>> 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
> 
>  > -    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.

>>
>> Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
>> ---
>>   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(-)
>>
>> diff --git a/sound/soc/intel/skylake/bxt-sst.c 
>> b/sound/soc/intel/skylake/bxt-sst.c
>> index e3614acff34d..a8a2783f9b37 100644
>> --- a/sound/soc/intel/skylake/bxt-sst.c
>> +++ b/sound/soc/intel/skylake/bxt-sst.c
>> @@ -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);
>> diff --git a/sound/soc/intel/skylake/cnl-sst.c 
>> b/sound/soc/intel/skylake/cnl-sst.c
>> index 84dc6b82831d..0b0337f6ebff 100644
>> --- a/sound/soc/intel/skylake/cnl-sst.c
>> +++ b/sound/soc/intel/skylake/cnl-sst.c
>> @@ -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);
>> diff --git a/sound/soc/intel/skylake/skl-sst-dsp.c 
>> b/sound/soc/intel/skylake/skl-sst-dsp.c
>> index 1c4ecbcd7db7..9d8eb1af4798 100644
>> --- a/sound/soc/intel/skylake/skl-sst-dsp.c
>> +++ b/sound/soc/intel/skylake/skl-sst-dsp.c
>> @@ -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;
>> diff --git a/sound/soc/intel/skylake/skl-sst-dsp.h 
>> b/sound/soc/intel/skylake/skl-sst-dsp.h
>> index ba37433e4efa..1d579d59de60 100644
>> --- a/sound/soc/intel/skylake/skl-sst-dsp.h
>> +++ b/sound/soc/intel/skylake/skl-sst-dsp.h
>> @@ -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);
>> diff --git a/sound/soc/intel/skylake/skl-sst-utils.c 
>> b/sound/soc/intel/skylake/skl-sst-utils.c
>> index 9061a9b17ea0..8e03a10855c4 100644
>> --- a/sound/soc/intel/skylake/skl-sst-utils.c
>> +++ b/sound/soc/intel/skylake/skl-sst-utils.c
>> @@ -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;
>> diff --git a/sound/soc/intel/skylake/skl-sst.c 
>> b/sound/soc/intel/skylake/skl-sst.c
>> index e55523826346..6bb003add9e2 100644
>> --- a/sound/soc/intel/skylake/skl-sst.c
>> +++ b/sound/soc/intel/skylake/skl-sst.c
>> @@ -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
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

^ permalink raw reply	[flat|nested] 107+ messages in thread

* Re: [PATCH 15/35] ASoC: Intel: Skylake: Use dsp loading functions directly
  2019-08-23 19:17   ` Pierre-Louis Bossart
@ 2019-08-24  9:41     ` Cezary Rojewski
  0 siblings, 0 replies; 107+ messages in thread
From: Cezary Rojewski @ 2019-08-24  9:41 UTC (permalink / raw)
  To: Pierre-Louis Bossart, alsa-devel; +Cc: broonie, tiwai, lgirdwood

On 2019-08-23 21:17, Pierre-Louis Bossart wrote:
> 
> 
> On 8/22/19 2:04 PM, Cezary Rojewski wrote:
>> 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?
> 
>> use of said operation directly. Takes part in remal of
> 
> removal?
> 

Ack on both.

>> skl_dsp_loader_ops structure.
>>
>> Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
>> ---
>>   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(-)
>>
>> diff --git a/sound/soc/intel/skylake/bxt-sst.c 
>> b/sound/soc/intel/skylake/bxt-sst.c
>> index a8a2783f9b37..1ca4fba0f35f 100644
>> --- a/sound/soc/intel/skylake/bxt-sst.c
>> +++ b/sound/soc/intel/skylake/bxt-sst.c
>> @@ -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.

>>           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?
> 

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

>> -        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);
> 
> 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
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

^ permalink raw reply	[flat|nested] 107+ messages in thread

* Re: [PATCH 17/35] ASoC: Intel: Skylake: Remove skl_dsp_loader_ops
  2019-08-23 19:21   ` Pierre-Louis Bossart
@ 2019-08-24  9:49     ` Cezary Rojewski
  0 siblings, 0 replies; 107+ messages in thread
From: Cezary Rojewski @ 2019-08-24  9:49 UTC (permalink / raw)
  To: Pierre-Louis Bossart, alsa-devel; +Cc: broonie, tiwai, lgirdwood

On 2019-08-23 21:21, Pierre-Louis Bossart wrote:
> 
> 
> On 8/22/19 2:04 PM, Cezary Rojewski wrote:
>> 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.

>>
>> Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
>> ---
>>   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(-)
>>
>> diff --git a/sound/soc/intel/common/sst-dsp-priv.h 
>> b/sound/soc/intel/common/sst-dsp-priv.h
>> index 8a7009937d59..0fe9bebcfb38 100644
>> --- a/sound/soc/intel/common/sst-dsp-priv.h
>> +++ b/sound/soc/intel/common/sst-dsp-priv.h
>> @@ -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;
>> diff --git a/sound/soc/intel/skylake/bxt-sst.c 
>> b/sound/soc/intel/skylake/bxt-sst.c
>> index 45da02f74f4d..c7961050c2ee 100644
>> --- a/sound/soc/intel/skylake/bxt-sst.c
>> +++ b/sound/soc/intel/skylake/bxt-sst.c
>> @@ -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;
>> diff --git a/sound/soc/intel/skylake/cnl-sst-dsp.h 
>> b/sound/soc/intel/skylake/cnl-sst-dsp.h
>> index 30b586acc858..70da4f312f53 100644
>> --- a/sound/soc/intel/skylake/cnl-sst-dsp.h
>> +++ b/sound/soc/intel/skylake/cnl-sst-dsp.h
>> @@ -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__*/
>> diff --git a/sound/soc/intel/skylake/cnl-sst.c 
>> b/sound/soc/intel/skylake/cnl-sst.c
>> index 4d9a4d5886f4..2f10076cc906 100644
>> --- a/sound/soc/intel/skylake/cnl-sst.c
>> +++ b/sound/soc/intel/skylake/cnl-sst.c
>> @@ -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;
>> diff --git a/sound/soc/intel/skylake/skl-messages.c 
>> b/sound/soc/intel/skylake/skl-messages.c
>> index 20ab980fe8a1..6fbceec67b53 100644
>> --- a/sound/soc/intel/skylake/skl-messages.c
>> +++ b/sound/soc/intel/skylake/skl-messages.c
>> @@ -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;
>> diff --git a/sound/soc/intel/skylake/skl-sst-dsp.h 
>> b/sound/soc/intel/skylake/skl-sst-dsp.h
>> index 97e16a602331..9f2dae92c1c9 100644
>> --- a/sound/soc/intel/skylake/skl-sst-dsp.h
>> +++ b/sound/soc/intel/skylake/skl-sst-dsp.h
>> @@ -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,
>> diff --git a/sound/soc/intel/skylake/skl-sst-utils.c 
>> b/sound/soc/intel/skylake/skl-sst-utils.c
>> index 8e03a10855c4..bbe67e298efe 100644
>> --- a/sound/soc/intel/skylake/skl-sst-utils.c
>> +++ b/sound/soc/intel/skylake/skl-sst-utils.c
>> @@ -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);
>> diff --git a/sound/soc/intel/skylake/skl-sst.c 
>> b/sound/soc/intel/skylake/skl-sst.c
>> index 6bb003add9e2..e9a7b2509b35 100644
>> --- a/sound/soc/intel/skylake/skl-sst.c
>> +++ b/sound/soc/intel/skylake/skl-sst.c
>> @@ -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;
>> diff --git a/sound/soc/intel/skylake/skl.h 
>> b/sound/soc/intel/skylake/skl.h
>> index 62e2f2d450e4..beeef67cb55f 100644
>> --- a/sound/soc/intel/skylake/skl.h
>> +++ b/sound/soc/intel/skylake/skl.h
>> @@ -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);
>>   };
>>
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

^ permalink raw reply	[flat|nested] 107+ messages in thread

* Re: [PATCH 18/35] ASoC: Intel: Skylake: Remove window0 sst_addr fields
  2019-08-23 19:26   ` Pierre-Louis Bossart
@ 2019-08-24  9:57     ` Cezary Rojewski
  0 siblings, 0 replies; 107+ messages in thread
From: Cezary Rojewski @ 2019-08-24  9:57 UTC (permalink / raw)
  To: Pierre-Louis Bossart, alsa-devel; +Cc: broonie, tiwai, lgirdwood

On 2019-08-23 21:26, Pierre-Louis Bossart wrote:
> 
> 
> On 8/22/19 2:04 PM, Cezary Rojewski wrote:
>> 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.
>>
>> Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
>> ---
>>   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(-)
>>
>> diff --git a/sound/soc/intel/common/sst-dsp-priv.h 
>> b/sound/soc/intel/common/sst-dsp-priv.h
>> index 0fe9bebcfb38..53dcd87bab44 100644
>> --- a/sound/soc/intel/common/sst-dsp-priv.h
>> +++ b/sound/soc/intel/common/sst-dsp-priv.h
>> @@ -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;
>> diff --git a/sound/soc/intel/skylake/bxt-sst.c 
>> b/sound/soc/intel/skylake/bxt-sst.c
>> index c7961050c2ee..641d5cf4aeb1 100644
>> --- a/sound/soc/intel/skylake/bxt-sst.c
>> +++ b/sound/soc/intel/skylake/bxt-sst.c
>> @@ -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...
> 

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).

>> diff --git a/sound/soc/intel/skylake/cnl-sst.c 
>> b/sound/soc/intel/skylake/cnl-sst.c
>> index 2f10076cc906..64971966af38 100644
>> --- a/sound/soc/intel/skylake/cnl-sst.c
>> +++ b/sound/soc/intel/skylake/cnl-sst.c
>> @@ -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...
> 
>> diff --git a/sound/soc/intel/skylake/skl-debug.c 
>> b/sound/soc/intel/skylake/skl-debug.c
>> index 212370bf704c..6781eac13232 100644
>> --- a/sound/soc/intel/skylake/skl-debug.c
>> +++ b/sound/soc/intel/skylake/skl-debug.c
>> @@ -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.

>>       void __iomem *in_base = sst->mailbox.in_base;
>>       void __iomem *fw_reg_addr;
>>       unsigned int offset;
>> diff --git a/sound/soc/intel/skylake/skl-sst-dsp.h 
>> b/sound/soc/intel/skylake/skl-sst-dsp.h
>> index 9f2dae92c1c9..5a0cb7f3d57e 100644
>> --- a/sound/soc/intel/skylake/skl-sst-dsp.h
>> +++ b/sound/soc/intel/skylake/skl-sst-dsp.h
>> @@ -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
>> diff --git a/sound/soc/intel/skylake/skl-sst.c 
>> b/sound/soc/intel/skylake/skl-sst.c
>> index e9a7b2509b35..7e63c91cea54 100644
>> --- a/sound/soc/intel/skylake/skl-sst.c
>> +++ b/sound/soc/intel/skylake/skl-sst.c
>> @@ -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);
>>
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

^ permalink raw reply	[flat|nested] 107+ messages in thread

* Re: [PATCH 21/35] ASoC: Intel: Expose ACPI loading members
  2019-08-23 19:32   ` Pierre-Louis Bossart
@ 2019-08-24  9:58     ` Cezary Rojewski
  0 siblings, 0 replies; 107+ messages in thread
From: Cezary Rojewski @ 2019-08-24  9:58 UTC (permalink / raw)
  To: Pierre-Louis Bossart, alsa-devel; +Cc: broonie, tiwai, lgirdwood

On 2019-08-23 21:32, Pierre-Louis Bossart wrote:
> 
>> diff --git a/sound/soc/intel/common/sst-dsp.h 
>> b/sound/soc/intel/common/sst-dsp.h
>> index 63c29bb45cf1..a2ac7998fbdb 100644
>> --- a/sound/soc/intel/common/sst-dsp.h
>> +++ b/sound/soc/intel/common/sst-dsp.h
>> @@ -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.

>> +
>> +/* 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.
>>
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

^ permalink raw reply	[flat|nested] 107+ messages in thread

* Re: [PATCH 22/35] ASoC: Intel: Haswell: Define separate ACPI loader
  2019-08-23 19:35   ` Pierre-Louis Bossart
@ 2019-08-24  9:59     ` Cezary Rojewski
  0 siblings, 0 replies; 107+ messages in thread
From: Cezary Rojewski @ 2019-08-24  9:59 UTC (permalink / raw)
  To: Pierre-Louis Bossart, alsa-devel; +Cc: broonie, tiwai, lgirdwood

On 2019-08-23 21:35, Pierre-Louis Bossart wrote:
> 
> 
> On 8/22/19 2:04 PM, Cezary Rojewski wrote:
>> 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.
>>
>> Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
>> ---
>>   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
>>
>> diff --git a/sound/soc/intel/Kconfig b/sound/soc/intel/Kconfig
>> index a3ec17fd63cd..9191773d203c 100644
>> --- a/sound/soc/intel/Kconfig
>> +++ b/sound/soc/intel/Kconfig
>> @@ -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.

>> +
>>   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
>> diff --git a/sound/soc/intel/common/sst-acpi.c 
>> b/sound/soc/intel/common/sst-acpi.c
>> index 42f9b02f2ea3..7d2f04ff0479 100644
>> --- a/sound/soc/intel/common/sst-acpi.c
>> +++ b/sound/soc/intel/common/sst-acpi.c
>> @@ -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
>> diff --git a/sound/soc/intel/haswell/Makefile 
>> b/sound/soc/intel/haswell/Makefile
>> index ad2341aea8ae..0af852d0577b 100644
>> --- a/sound/soc/intel/haswell/Makefile
>> +++ b/sound/soc/intel/haswell/Makefile
>> @@ -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
>> diff --git a/sound/soc/intel/haswell/acpi.c 
>> b/sound/soc/intel/haswell/acpi.c
>> new file mode 100644
>> index 000000000000..7bd8b03851c4
>> --- /dev/null
>> +++ b/sound/soc/intel/haswell/acpi.c
>> @@ -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 <cezary.rojewski@intel.com>");
>> +MODULE_DESCRIPTION("Intel HSW loader on ACPI systems");
>> +MODULE_LICENSE("GPL v2");
>>
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

^ permalink raw reply	[flat|nested] 107+ messages in thread

* Re: [PATCH 24/35] ASoC: Intel: Refactor probing of ACPI devices
  2019-08-23 19:43   ` Pierre-Louis Bossart
@ 2019-08-24 10:16     ` Cezary Rojewski
  0 siblings, 0 replies; 107+ messages in thread
From: Cezary Rojewski @ 2019-08-24 10:16 UTC (permalink / raw)
  To: Pierre-Louis Bossart, alsa-devel; +Cc: broonie, tiwai, lgirdwood

On 2019-08-23 21:43, Pierre-Louis Bossart wrote:
> 
> 
> On 8/22/19 2:04 PM, Cezary Rojewski wrote:
>> 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.
>>
>> Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
>> ---
>>   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(-)
>>
>> diff --git a/sound/soc/intel/baytrail/acpi.c 
>> b/sound/soc/intel/baytrail/acpi.c
>> index 57d10a6e3be2..bf2560a8f3e2 100644
>> --- a/sound/soc/intel/baytrail/acpi.c
>> +++ b/sound/soc/intel/baytrail/acpi.c
>> @@ -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,
> 
> 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?
> 

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.

>> +    .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;
> 
> 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?
> 
> 

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.

>> +    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",
>> diff --git a/sound/soc/intel/common/sst-acpi.c 
>> b/sound/soc/intel/common/sst-acpi.c
>> index 8e75126106ea..53ac23f05966 100644
>> --- a/sound/soc/intel/common/sst-acpi.c
>> +++ b/sound/soc/intel/common/sst-acpi.c
>> @@ -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))
>> diff --git a/sound/soc/intel/common/sst-dsp.h 
>> b/sound/soc/intel/common/sst-dsp.h
>> index a2ac7998fbdb..87d39b0e79c0 100644
>> --- a/sound/soc/intel/common/sst-dsp.h
>> +++ b/sound/soc/intel/common/sst-dsp.h
>> @@ -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;
>> diff --git a/sound/soc/intel/common/sst-firmware.c 
>> b/sound/soc/intel/common/sst-firmware.c
>> index 6b6af11c32c3..61d3e6e46b98 100644
>> --- a/sound/soc/intel/common/sst-firmware.c
>> +++ b/sound/soc/intel/common/sst-firmware.c
>> @@ -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;
>> diff --git a/sound/soc/intel/haswell/acpi.c 
>> b/sound/soc/intel/haswell/acpi.c
>> index 7bd8b03851c4..3c49ec257e56 100644
>> --- a/sound/soc/intel/haswell/acpi.c
>> +++ b/sound/soc/intel/haswell/acpi.c
>> @@ -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",
>> diff --git a/sound/soc/intel/skylake/skl-sst-utils.c 
>> b/sound/soc/intel/skylake/skl-sst-utils.c
>> index bbe67e298efe..ac0a0e4c2d68 100644
>> --- a/sound/soc/intel/skylake/skl-sst-utils.c
>> +++ b/sound/soc/intel/skylake/skl-sst-utils.c
>> @@ -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);
>>
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

^ permalink raw reply	[flat|nested] 107+ messages in thread

* Re: [PATCH 27/35] ASoC: Intel: Skylake: Define platform descriptors
  2019-08-23 19:50   ` Pierre-Louis Bossart
@ 2019-08-24 10:51     ` Cezary Rojewski
  2019-08-26 17:13       ` Pierre-Louis Bossart
  0 siblings, 1 reply; 107+ messages in thread
From: Cezary Rojewski @ 2019-08-24 10:51 UTC (permalink / raw)
  To: Pierre-Louis Bossart, alsa-devel; +Cc: broonie, tiwai, lgirdwood

On 2019-08-23 21:50, Pierre-Louis Bossart wrote:
> 
> 
> On 8/22/19 2:04 PM, Cezary Rojewski wrote:
>> 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

>>
>> Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
>> ---
>>   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(-)
>>
>> diff --git a/sound/soc/intel/skylake/bxt-sst.c 
>> b/sound/soc/intel/skylake/bxt-sst.c
>> index a547fb84eee9..06da822790a5 100644
>> --- a/sound/soc/intel/skylake/bxt-sst.c
>> +++ b/sound/soc/intel/skylake/bxt-sst.c
>> @@ -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)
>> diff --git a/sound/soc/intel/skylake/cnl-sst.c 
>> b/sound/soc/intel/skylake/cnl-sst.c
>> index 5be0a8eb154d..c4dbf6655097 100644
>> --- a/sound/soc/intel/skylake/cnl-sst.c
>> +++ b/sound/soc/intel/skylake/cnl-sst.c
>> @@ -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)
>> diff --git a/sound/soc/intel/skylake/skl-sst.c 
>> b/sound/soc/intel/skylake/skl-sst.c
>> index 8ae7fe73534e..122c07290440 100644
>> --- a/sound/soc/intel/skylake/skl-sst.c
>> +++ b/sound/soc/intel/skylake/skl-sst.c
>> @@ -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)
>> diff --git a/sound/soc/intel/skylake/skl.c 
>> b/sound/soc/intel/skylake/skl.c
>> index 54e1f957121d..d6d099aba834 100644
>> --- a/sound/soc/intel/skylake/skl.c
>> +++ b/sound/soc/intel/skylake/skl.c
>> @@ -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)
>> diff --git a/sound/soc/intel/skylake/skl.h 
>> b/sound/soc/intel/skylake/skl.h
>> index 9f5aa53df9f8..2f2b5a141abf 100644
>> --- a/sound/soc/intel/skylake/skl.h
>> +++ b/sound/soc/intel/skylake/skl.h
>> @@ -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;
>>
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

^ permalink raw reply	[flat|nested] 107+ messages in thread

* Re: [PATCH 11/35] ASoC: Intel: Merge sst_dsp_device into sst_pdata
  2019-08-23 18:54   ` Pierre-Louis Bossart
@ 2019-08-24 10:52     ` Cezary Rojewski
  0 siblings, 0 replies; 107+ messages in thread
From: Cezary Rojewski @ 2019-08-24 10:52 UTC (permalink / raw)
  To: Pierre-Louis Bossart, alsa-devel; +Cc: broonie, tiwai, lgirdwood

On 2019-08-23 20:54, Pierre-Louis Bossart wrote:
> 
>> @@ -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.

> 
> /* 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
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

^ permalink raw reply	[flat|nested] 107+ messages in thread

* Re: [PATCH 29/35] ASoC: Intel: Skylake: Flip SST initialization order
  2019-08-23 20:18   ` Pierre-Louis Bossart
@ 2019-08-24 10:54     ` Cezary Rojewski
  2019-08-26 16:39       ` Pierre-Louis Bossart
  0 siblings, 1 reply; 107+ messages in thread
From: Cezary Rojewski @ 2019-08-24 10:54 UTC (permalink / raw)
  To: Pierre-Louis Bossart, alsa-devel; +Cc: broonie, tiwai, lgirdwood

On 2019-08-23 22:18, Pierre-Louis Bossart wrote:
> 
> 
> On 8/22/19 2:04 PM, Cezary Rojewski wrote:
>> 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.

>> bypassing sst_dsp_new -> sst_ops::init order. Fix that by flipping
>> invocation order of handlers engaged in Skylake initialization.
>>
>> Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
>> ---
>>   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(-)
>>
>> diff --git a/sound/soc/intel/skylake/bxt-sst.c 
>> b/sound/soc/intel/skylake/bxt-sst.c
>> index 06da822790a5..286da9fbc4de 100644
>> --- a/sound/soc/intel/skylake/bxt-sst.c
>> +++ b/sound/soc/intel/skylake/bxt-sst.c
>> @@ -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)
>> diff --git a/sound/soc/intel/skylake/cnl-sst-dsp.h 
>> b/sound/soc/intel/skylake/cnl-sst-dsp.h
>> index 02e070fae2ce..7810ae11954a 100644
>> --- a/sound/soc/intel/skylake/cnl-sst-dsp.h
>> +++ b/sound/soc/intel/skylake/cnl-sst-dsp.h
>> @@ -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__*/
>> diff --git a/sound/soc/intel/skylake/cnl-sst.c 
>> b/sound/soc/intel/skylake/cnl-sst.c
>> index c4dbf6655097..a6113d8afcbb 100644
>> --- a/sound/soc/intel/skylake/cnl-sst.c
>> +++ b/sound/soc/intel/skylake/cnl-sst.c
>> @@ -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)
>> diff --git a/sound/soc/intel/skylake/skl-messages.c 
>> b/sound/soc/intel/skylake/skl-messages.c
>> index 8c352255ff45..372c5fb83ddb 100644
>> --- a/sound/soc/intel/skylake/skl-messages.c
>> +++ b/sound/soc/intel/skylake/skl-messages.c
>> @@ -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;
>> diff --git a/sound/soc/intel/skylake/skl-sst-dsp.h 
>> b/sound/soc/intel/skylake/skl-sst-dsp.h
>> index b647e60d7a6d..8483c60f29ba 100644
>> --- a/sound/soc/intel/skylake/skl-sst-dsp.h
>> +++ b/sound/soc/intel/skylake/skl-sst-dsp.h
>> @@ -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);
>> diff --git a/sound/soc/intel/skylake/skl-sst.c 
>> b/sound/soc/intel/skylake/skl-sst.c
>> index 122c07290440..e0f2bf828541 100644
>> --- a/sound/soc/intel/skylake/skl-sst.c
>> +++ b/sound/soc/intel/skylake/skl-sst.c
>> @@ -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)
>> diff --git a/sound/soc/intel/skylake/skl.c 
>> b/sound/soc/intel/skylake/skl.c
>> index 53a6befd5d68..39442c80a179 100644
>> --- a/sound/soc/intel/skylake/skl.c
>> +++ b/sound/soc/intel/skylake/skl.c
>> @@ -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;
>> diff --git a/sound/soc/intel/skylake/skl.h 
>> b/sound/soc/intel/skylake/skl.h
>> index 2f2b5a141abf..f4cd5ccc1ff9 100644
>> --- a/sound/soc/intel/skylake/skl.h
>> +++ b/sound/soc/intel/skylake/skl.h
>> @@ -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);
>>
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

^ permalink raw reply	[flat|nested] 107+ messages in thread

* Re: [PATCH 30/35] ASoC: Intel: Reuse sst_pdata::fw_name field
  2019-08-23 20:20   ` Pierre-Louis Bossart
@ 2019-08-24 10:57     ` Cezary Rojewski
  0 siblings, 0 replies; 107+ messages in thread
From: Cezary Rojewski @ 2019-08-24 10:57 UTC (permalink / raw)
  To: Pierre-Louis Bossart, alsa-devel; +Cc: broonie, tiwai, lgirdwood

On 2019-08-23 22:20, Pierre-Louis Bossart wrote:
> 
> 
> On 8/22/19 2:04 PM, Cezary Rojewski wrote:
>> 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.

>>
>> Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
>> ---
>>   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(-)
>>
>> diff --git a/sound/soc/intel/common/sst-acpi.c 
>> b/sound/soc/intel/common/sst-acpi.c
>> index 53ac23f05966..15f2b27e643f 100644
>> --- a/sound/soc/intel/common/sst-acpi.c
>> +++ b/sound/soc/intel/common/sst-acpi.c
>> @@ -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);
>> diff --git a/sound/soc/intel/common/sst-firmware.c 
>> b/sound/soc/intel/common/sst-firmware.c
>> index 61d3e6e46b98..cc88849eb10f 100644
>> --- a/sound/soc/intel/common/sst-firmware.c
>> +++ b/sound/soc/intel/common/sst-firmware.c
>> @@ -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);
>> diff --git a/sound/soc/intel/skylake/skl-messages.c 
>> b/sound/soc/intel/skylake/skl-messages.c
>> index 372c5fb83ddb..e401edd8d44b 100644
>> --- a/sound/soc/intel/skylake/skl-messages.c
>> +++ b/sound/soc/intel/skylake/skl-messages.c
>> @@ -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;
>> diff --git a/sound/soc/intel/skylake/skl-sst-dsp.h 
>> b/sound/soc/intel/skylake/skl-sst-dsp.h
>> index 8483c60f29ba..a3714b706b8e 100644
>> --- a/sound/soc/intel/skylake/skl-sst-dsp.h
>> +++ b/sound/soc/intel/skylake/skl-sst-dsp.h
>> @@ -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);
>> diff --git a/sound/soc/intel/skylake/skl-sst-utils.c 
>> b/sound/soc/intel/skylake/skl-sst-utils.c
>> index a4ad213d34e0..ea5419012312 100644
>> --- a/sound/soc/intel/skylake/skl-sst-utils.c
>> +++ b/sound/soc/intel/skylake/skl-sst-utils.c
>> @@ -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;
>> diff --git a/sound/soc/intel/skylake/skl.c 
>> b/sound/soc/intel/skylake/skl.c
>> index 39442c80a179..3225f4f8793e 100644
>> --- a/sound/soc/intel/skylake/skl.c
>> +++ b/sound/soc/intel/skylake/skl.c
>> @@ -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) {
>>
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

^ permalink raw reply	[flat|nested] 107+ messages in thread

* Re: [PATCH 33/35] ASoC: Intel: Skylake: Privatize SST init handlers
  2019-08-23 20:25   ` Pierre-Louis Bossart
@ 2019-08-24 11:01     ` Cezary Rojewski
  0 siblings, 0 replies; 107+ messages in thread
From: Cezary Rojewski @ 2019-08-24 11:01 UTC (permalink / raw)
  To: Pierre-Louis Bossart, alsa-devel; +Cc: broonie, tiwai, lgirdwood

On 2019-08-23 22:25, Pierre-Louis Bossart wrote:
> 
> 
> On 8/22/19 2:04 PM, Cezary Rojewski wrote:
>> With initialization order repaired, sst_ops::init overloads can be
>> privatized for Skylake platofmrs. Let's do so.
> 
> platforms
> 

Ack.

>>
>> Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
>> ---
>>   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(-)
>>
>> diff --git a/sound/soc/intel/skylake/bxt-sst.c 
>> b/sound/soc/intel/skylake/bxt-sst.c
>> index 79728e418176..1edc38069615 100644
>> --- a/sound/soc/intel/skylake/bxt-sst.c
>> +++ b/sound/soc/intel/skylake/bxt-sst.c
>> @@ -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,
>> +};
> 
> 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.

>>   MODULE_LICENSE("GPL v2");
>>   MODULE_DESCRIPTION("Intel Broxton IPC driver");
>> diff --git a/sound/soc/intel/skylake/cnl-sst-dsp.h 
>> b/sound/soc/intel/skylake/cnl-sst-dsp.h
>> index 7810ae11954a..a1ea242e9539 100644
>> --- a/sound/soc/intel/skylake/cnl-sst-dsp.h
>> +++ b/sound/soc/intel/skylake/cnl-sst-dsp.h
>> @@ -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__*/
>> diff --git a/sound/soc/intel/skylake/cnl-sst.c 
>> b/sound/soc/intel/skylake/cnl-sst.c
>> index 58efeb6c8a8a..360e54d3c587 100644
>> --- a/sound/soc/intel/skylake/cnl-sst.c
>> +++ b/sound/soc/intel/skylake/cnl-sst.c
>> @@ -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");
>> diff --git a/sound/soc/intel/skylake/skl-sst-dsp.h 
>> b/sound/soc/intel/skylake/skl-sst-dsp.h
>> index a3714b706b8e..3294826d5cf7 100644
>> --- a/sound/soc/intel/skylake/skl-sst-dsp.h
>> +++ b/sound/soc/intel/skylake/skl-sst-dsp.h
>> @@ -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);
>> diff --git a/sound/soc/intel/skylake/skl-sst.c 
>> b/sound/soc/intel/skylake/skl-sst.c
>> index 8e1d02e29a32..209f45e3d5d0 100644
>> --- a/sound/soc/intel/skylake/skl-sst.c
>> +++ b/sound/soc/intel/skylake/skl-sst.c
>> @@ -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)
>>   {
>>
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

^ permalink raw reply	[flat|nested] 107+ messages in thread

* Re: [PATCH 35/35] ASoC: Intel: Remove obsolete firmware fields
  2019-08-23 20:27   ` Pierre-Louis Bossart
@ 2019-08-24 11:02     ` Cezary Rojewski
  0 siblings, 0 replies; 107+ messages in thread
From: Cezary Rojewski @ 2019-08-24 11:02 UTC (permalink / raw)
  To: Pierre-Louis Bossart, alsa-devel; +Cc: broonie, lgirdwood, tiwai

On 2019-08-23 22:27, Pierre-Louis Bossart wrote:
> 
> 
> On 8/22/19 2:04 PM, Cezary Rojewski wrote:
>> 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.

>> Any remaining deprecated survivors of the precedding tidal wave are
>> removed here too.
>>
>> Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
>> ---
>>   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(-)
>>
>> diff --git a/sound/soc/intel/common/soc-acpi-intel-bxt-match.c 
>> b/sound/soc/intel/common/soc-acpi-intel-bxt-match.c
>> index 4a5adae1d785..eda799e49113 100644
>> --- a/sound/soc/intel/common/soc-acpi-intel-bxt-match.c
>> +++ b/sound/soc/intel/common/soc-acpi-intel-bxt-match.c
>> @@ -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",
>> diff --git a/sound/soc/intel/common/soc-acpi-intel-byt-match.c 
>> b/sound/soc/intel/common/soc-acpi-intel-byt-match.c
>> index 1cc801ba92eb..4d2ba663ee33 100644
>> --- a/sound/soc/intel/common/soc-acpi-intel-byt-match.c
>> +++ b/sound/soc/intel/common/soc-acpi-intel-byt-match.c
>> @@ -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",
>>       },
>>       {}
>>   };
>> diff --git a/sound/soc/intel/common/soc-acpi-intel-cnl-match.c 
>> b/sound/soc/intel/common/soc-acpi-intel-cnl-match.c
>> index 771b0ef21051..edc44a0dc96f 100644
>> --- a/sound/soc/intel/common/soc-acpi-intel-cnl-match.c
>> +++ b/sound/soc/intel/common/soc-acpi-intel-cnl-match.c
>> @@ -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",
>> diff --git a/sound/soc/intel/common/soc-acpi-intel-glk-match.c 
>> b/sound/soc/intel/common/soc-acpi-intel-glk-match.c
>> index 60dea358fa04..370487d13c85 100644
>> --- a/sound/soc/intel/common/soc-acpi-intel-glk-match.c
>> +++ b/sound/soc/intel/common/soc-acpi-intel-glk-match.c
>> @@ -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",
>> diff --git a/sound/soc/intel/common/soc-acpi-intel-hda-match.c 
>> b/sound/soc/intel/common/soc-acpi-intel-hda-match.c
>> index cc972d2ac691..39827d2e8634 100644
>> --- a/sound/soc/intel/common/soc-acpi-intel-hda-match.c
>> +++ b/sound/soc/intel/common/soc-acpi-intel-hda-match.c
>> @@ -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",
>> diff --git a/sound/soc/intel/common/soc-acpi-intel-hsw-bdw-match.c 
>> b/sound/soc/intel/common/soc-acpi-intel-hsw-bdw-match.c
>> index 34eb0baaa951..6b113c32aff0 100644
>> --- a/sound/soc/intel/common/soc-acpi-intel-hsw-bdw-match.c
>> +++ b/sound/soc/intel/common/soc-acpi-intel-hsw-bdw-match.c
>> @@ -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",
>>       },
>> diff --git a/sound/soc/intel/common/soc-acpi-intel-icl-match.c 
>> b/sound/soc/intel/common/soc-acpi-intel-icl-match.c
>> index 38977669b576..04a17da96f6a 100644
>> --- a/sound/soc/intel/common/soc-acpi-intel-icl-match.c
>> +++ b/sound/soc/intel/common/soc-acpi-intel-icl-match.c
>> @@ -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",
>> diff --git a/sound/soc/intel/common/soc-acpi-intel-kbl-match.c 
>> b/sound/soc/intel/common/soc-acpi-intel-kbl-match.c
>> index e200baa11011..fe82d5472aa3 100644
>> --- a/sound/soc/intel/common/soc-acpi-intel-kbl-match.c
>> +++ b/sound/soc/intel/common/soc-acpi-intel-kbl-match.c
>> @@ -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
>>       },
>>       {},
>> diff --git a/sound/soc/intel/common/soc-acpi-intel-skl-match.c 
>> b/sound/soc/intel/common/soc-acpi-intel-skl-match.c
>> index 42fa40a8d932..ec969044706c 100644
>> --- a/sound/soc/intel/common/soc-acpi-intel-skl-match.c
>> +++ b/sound/soc/intel/common/soc-acpi-intel-skl-match.c
>> @@ -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,
>> diff --git a/sound/soc/intel/common/sst-dsp-priv.h 
>> b/sound/soc/intel/common/sst-dsp-priv.h
>> index a4628a89d47d..1a208ef65fa8 100644
>> --- a/sound/soc/intel/common/sst-dsp-priv.h
>> +++ b/sound/soc/intel/common/sst-dsp-priv.h
>> @@ -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;
>>   };
>> diff --git a/sound/soc/intel/skylake/skl.h 
>> b/sound/soc/intel/skylake/skl.h
>> index 218e8bda6cae..7b283c2bb7b5 100644
>> --- a/sound/soc/intel/skylake/skl.h
>> +++ b/sound/soc/intel/skylake/skl.h
>> @@ -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
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

^ permalink raw reply	[flat|nested] 107+ messages in thread

* Re: [PATCH 19/35] ASoC: Intel: Skylake: Remove redundant W0 and W1 macros
  2019-08-23 19:28   ` Pierre-Louis Bossart
@ 2019-08-24 11:52     ` Cezary Rojewski
  2019-08-24 12:04       ` Cezary Rojewski
  0 siblings, 1 reply; 107+ messages in thread
From: Cezary Rojewski @ 2019-08-24 11:52 UTC (permalink / raw)
  To: Pierre-Louis Bossart, alsa-devel; +Cc: broonie, tiwai, lgirdwood

On 2019-08-23 21:28, Pierre-Louis Bossart wrote:
> 
> 
> On 8/22/19 2:04 PM, Cezary Rojewski wrote:
>> The existing upling, downling and FW register size macros are
> 
> uplink and downlink?
> 
>> 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.

>>
>> Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
>> ---
>>   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(-)
>>
>> diff --git a/sound/soc/intel/skylake/bxt-sst.c 
>> b/sound/soc/intel/skylake/bxt-sst.c
>> index 641d5cf4aeb1..fdd94711c3b4 100644
>> --- a/sound/soc/intel/skylake/bxt-sst.c
>> +++ b/sound/soc/intel/skylake/bxt-sst.c
>> @@ -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) {
>> diff --git a/sound/soc/intel/skylake/cnl-sst-dsp.h 
>> b/sound/soc/intel/skylake/cnl-sst-dsp.h
>> index 70da4f312f53..a465cc42b7e8 100644
>> --- a/sound/soc/intel/skylake/cnl-sst-dsp.h
>> +++ b/sound/soc/intel/skylake/cnl-sst-dsp.h
>> @@ -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
>> diff --git a/sound/soc/intel/skylake/cnl-sst.c 
>> b/sound/soc/intel/skylake/cnl-sst.c
>> index 64971966af38..d3da23e0ef05 100644
>> --- a/sound/soc/intel/skylake/cnl-sst.c
>> +++ b/sound/soc/intel/skylake/cnl-sst.c
>> @@ -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) {
>> diff --git a/sound/soc/intel/skylake/skl-sst-dsp.h 
>> b/sound/soc/intel/skylake/skl-sst-dsp.h
>> index 5a0cb7f3d57e..3c92b1d849e4 100644
>> --- a/sound/soc/intel/skylake/skl-sst-dsp.h
>> +++ b/sound/soc/intel/skylake/skl-sst-dsp.h
>> @@ -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
>> diff --git a/sound/soc/intel/skylake/skl-sst-ipc.c 
>> b/sound/soc/intel/skylake/skl-sst-ipc.c
>> index 2700f882103d..72d7284d2fff 100644
>> --- a/sound/soc/intel/skylake/skl-sst-ipc.c
>> +++ b/sound/soc/intel/skylake/skl-sst-ipc.c
>> @@ -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)
>> diff --git a/sound/soc/intel/skylake/skl-sst.c 
>> b/sound/soc/intel/skylake/skl-sst.c
>> index 7e63c91cea54..191931578fd2 100644
>> --- a/sound/soc/intel/skylake/skl-sst.c
>> +++ b/sound/soc/intel/skylake/skl-sst.c
>> @@ -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) {
>>
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

^ permalink raw reply	[flat|nested] 107+ messages in thread

* Re: [PATCH 19/35] ASoC: Intel: Skylake: Remove redundant W0 and W1 macros
  2019-08-24 11:52     ` Cezary Rojewski
@ 2019-08-24 12:04       ` Cezary Rojewski
  0 siblings, 0 replies; 107+ messages in thread
From: Cezary Rojewski @ 2019-08-24 12:04 UTC (permalink / raw)
  To: alsa-devel

On 2019-08-24 13:52, Cezary Rojewski wrote:
> On 2019-08-23 21:28, Pierre-Louis Bossart wrote:
>>
>>
>> On 8/22/19 2:04 PM, Cezary Rojewski wrote:
>>> The existing upling, downling and FW register size macros are
>>
>> uplink and downlink?
>>
>>> 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.
> 

s/seer/sheer
This is escalating quickly..

>>>
>>> Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
>>> ---
>>>   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(-)
>>>
>>> diff --git a/sound/soc/intel/skylake/bxt-sst.c 
>>> b/sound/soc/intel/skylake/bxt-sst.c
>>> index 641d5cf4aeb1..fdd94711c3b4 100644
>>> --- a/sound/soc/intel/skylake/bxt-sst.c
>>> +++ b/sound/soc/intel/skylake/bxt-sst.c
>>> @@ -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) {
>>> diff --git a/sound/soc/intel/skylake/cnl-sst-dsp.h 
>>> b/sound/soc/intel/skylake/cnl-sst-dsp.h
>>> index 70da4f312f53..a465cc42b7e8 100644
>>> --- a/sound/soc/intel/skylake/cnl-sst-dsp.h
>>> +++ b/sound/soc/intel/skylake/cnl-sst-dsp.h
>>> @@ -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
>>> diff --git a/sound/soc/intel/skylake/cnl-sst.c 
>>> b/sound/soc/intel/skylake/cnl-sst.c
>>> index 64971966af38..d3da23e0ef05 100644
>>> --- a/sound/soc/intel/skylake/cnl-sst.c
>>> +++ b/sound/soc/intel/skylake/cnl-sst.c
>>> @@ -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) {
>>> diff --git a/sound/soc/intel/skylake/skl-sst-dsp.h 
>>> b/sound/soc/intel/skylake/skl-sst-dsp.h
>>> index 5a0cb7f3d57e..3c92b1d849e4 100644
>>> --- a/sound/soc/intel/skylake/skl-sst-dsp.h
>>> +++ b/sound/soc/intel/skylake/skl-sst-dsp.h
>>> @@ -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
>>> diff --git a/sound/soc/intel/skylake/skl-sst-ipc.c 
>>> b/sound/soc/intel/skylake/skl-sst-ipc.c
>>> index 2700f882103d..72d7284d2fff 100644
>>> --- a/sound/soc/intel/skylake/skl-sst-ipc.c
>>> +++ b/sound/soc/intel/skylake/skl-sst-ipc.c
>>> @@ -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)
>>> diff --git a/sound/soc/intel/skylake/skl-sst.c 
>>> b/sound/soc/intel/skylake/skl-sst.c
>>> index 7e63c91cea54..191931578fd2 100644
>>> --- a/sound/soc/intel/skylake/skl-sst.c
>>> +++ b/sound/soc/intel/skylake/skl-sst.c
>>> @@ -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) {
>>>
> _______________________________________________
> Alsa-devel mailing list
> Alsa-devel@alsa-project.org
> https://mailman.alsa-project.org/mailman/listinfo/alsa-devel
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

^ permalink raw reply	[flat|nested] 107+ messages in thread

* Re: [PATCH 00/35] ASoC: Intel: Clenaup SST initialization
  2019-08-23 21:39               ` Mark Brown
@ 2019-08-24 13:51                 ` Cezary Rojewski
  2019-08-25 11:06                   ` Cezary Rojewski
  0 siblings, 1 reply; 107+ messages in thread
From: Cezary Rojewski @ 2019-08-24 13:51 UTC (permalink / raw)
  To: Mark Brown, Pierre-Louis Bossart
  Cc: Wasko, Michal, alsa-devel, tiwai, lgirdwood, Kaczmarski, Filip

On 2019-08-23 23:39, Mark Brown wrote:
> On Fri, Aug 23, 2019 at 03:12:18PM -0500, Pierre-Louis Bossart wrote:
>> On 8/23/19 1:44 PM, Cezary Rojewski wrote:
> 
>>> Wasn't lying about FW version being unreliable. Let's say vendor
>>> receives quick FW drop with new RCR.. such eng drop may carry invalid
>>> numbers such as 0.0.0.0..
>>> In general, I try to avoid relying on FW version whenever possible. It
>>> can be dumped for debug reasons, true, but to be relied on? Not really.
> 
>> Goodness, that's really bad. I didn't realize this.
> 
> At a previous employer I modified our build stamping
> infrastructure to also include both a timestamp and a serialized
> build number in the version number since one of my colleagues was
> fond of sending people prereleases of what he was working on to
> other people with identical version numbers on different
> binaries leading to much confusion and checksumming.  You do see
> a lot of things with those serialized version numbers, especially
> SVN based projects.
> 
>>> Personally, I'm against all hardcodes and would simply recommend all
>>> user to redirect their symlinks when they do switch kernel - along with
>>> dumping warning/ error message in dmesg. Hardcodes bring problems with
>>> forward compatibility and that's why host should offload them away to
>>> FW.
> 
>> Cezary, I know you are not responsible for all this, but at this point if we
>> (Intel) can't guarantee any sort of interoperability with both firmware and
>> topology we should make it clear that this driver is not recommended unless
>> specific versions of the firmware/topology are used, and as a consequence
>> the typical client distros and desktop/laptop users should use HDaudio
>> legacy or SOF (for DMICs)
> 
> Not the most elegent solution but I'm wondering if keeping a copy
> of the driver as is around and using new locations for the fixed
> firmware might be the safest way to handle this.  We could have a
> wrapper which tries to load the newer firmware and uses the fixed
> driver code if that's there, otherwise tries the old driver with
> the existing firmware paths.  This is obviously a horror show and
> leaves the old code sitting there but given the mistakes that
> have been made the whole situation looks like a house of cards.
> 

Thanks for the feedback Mark. While I'm not yet on the "SOF will fix 
this" train, I'm keen to agree to leaving this entirely to SOF if it 
comes down to us duplicating /skylake.

However, we are not going to give up that easily. I'll see if some 
"golden config" hardcodes can't be provided in some legacy.c file which 
would be fetched if initial setup fails. E.g.: 2cores, 3ssps, 1PAGE_SIZE 
per trace buffer.. and such. There are quite a few factors to take into 
consideration though. If "asking" user via dmesg to upgrade the firmware 
if his/her setup contains obsolete binary is really not an option, then 
some magic words got to be involved.

Czarek

^ permalink raw reply	[flat|nested] 107+ messages in thread

* Re: [PATCH 00/35] ASoC: Intel: Clenaup SST initialization
  2019-08-24 13:51                 ` Cezary Rojewski
@ 2019-08-25 11:06                   ` Cezary Rojewski
  2019-08-26  7:24                     ` Wasko, Michal
  0 siblings, 1 reply; 107+ messages in thread
From: Cezary Rojewski @ 2019-08-25 11:06 UTC (permalink / raw)
  To: Mark Brown, Pierre-Louis Bossart
  Cc: Wasko, Michal, alsa-devel, Kaczmarski, Filip, tiwai, lgirdwood

On 2019-08-24 15:51, Cezary Rojewski wrote:
> On 2019-08-23 23:39, Mark Brown wrote:
>> On Fri, Aug 23, 2019 at 03:12:18PM -0500, Pierre-Louis Bossart wrote:
>>> On 8/23/19 1:44 PM, Cezary Rojewski wrote:
>>
>>>> Wasn't lying about FW version being unreliable. Let's say vendor
>>>> receives quick FW drop with new RCR.. such eng drop may carry invalid
>>>> numbers such as 0.0.0.0..
>>>> In general, I try to avoid relying on FW version whenever possible. It
>>>> can be dumped for debug reasons, true, but to be relied on? Not really.
>>
>>> Goodness, that's really bad. I didn't realize this.
>>
>> At a previous employer I modified our build stamping
>> infrastructure to also include both a timestamp and a serialized
>> build number in the version number since one of my colleagues was
>> fond of sending people prereleases of what he was working on to
>> other people with identical version numbers on different
>> binaries leading to much confusion and checksumming.  You do see
>> a lot of things with those serialized version numbers, especially
>> SVN based projects.
>>
>>>> Personally, I'm against all hardcodes and would simply recommend all
>>>> user to redirect their symlinks when they do switch kernel - along with
>>>> dumping warning/ error message in dmesg. Hardcodes bring problems with
>>>> forward compatibility and that's why host should offload them away to
>>>> FW.
>>
>>> Cezary, I know you are not responsible for all this, but at this 
>>> point if we
>>> (Intel) can't guarantee any sort of interoperability with both 
>>> firmware and
>>> topology we should make it clear that this driver is not recommended 
>>> unless
>>> specific versions of the firmware/topology are used, and as a 
>>> consequence
>>> the typical client distros and desktop/laptop users should use HDaudio
>>> legacy or SOF (for DMICs)
>>
>> Not the most elegent solution but I'm wondering if keeping a copy
>> of the driver as is around and using new locations for the fixed
>> firmware might be the safest way to handle this.  We could have a
>> wrapper which tries to load the newer firmware and uses the fixed
>> driver code if that's there, otherwise tries the old driver with
>> the existing firmware paths.  This is obviously a horror show and
>> leaves the old code sitting there but given the mistakes that
>> have been made the whole situation looks like a house of cards.
>>
> 
> Thanks for the feedback Mark. While I'm not yet on the "SOF will fix 
> this" train, I'm keen to agree to leaving this entirely to SOF if it 
> comes down to us duplicating /skylake.
> 
> However, we are not going to give up that easily. I'll see if some 
> "golden config" hardcodes can't be provided in some legacy.c file which 
> would be fetched if initial setup fails. E.g.: 2cores, 3ssps, 1PAGE_SIZE 
> per trace buffer.. and such. There are quite a few factors to take into 
> consideration though. If "asking" user via dmesg to upgrade the firmware 
> if his/her setup contains obsolete binary is really not an option, then 
> some magic words got to be involved.
> 
> Czarek

On the second thought what if instead of duplicating kernel code, 
binaries would be duplicated?
I.e. rather than targeting /intel/dsp_fw_cnl.bin, _new_ /skylake would 
be expecting /intel/dsp_fw_cnl_release.bin? Same with topology binaries.
In such case, we "only" need to figure out how to propagate new files to 
Linux distos so whenever someone updates their kernel, new binaries are 
already present in their /lib/firmware.

If such option is valid, we can postpone /skylake upgrade till 5.4 
merging window closes and the patches (rough estimation is 150) would 
descend upon alsa-devel in time between 5.4 and 5.5.
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

^ permalink raw reply	[flat|nested] 107+ messages in thread

* Re: [PATCH 00/35] ASoC: Intel: Clenaup SST initialization
  2019-08-25 11:06                   ` Cezary Rojewski
@ 2019-08-26  7:24                     ` Wasko, Michal
  2019-08-26 16:51                       ` Pierre-Louis Bossart
  0 siblings, 1 reply; 107+ messages in thread
From: Wasko, Michal @ 2019-08-26  7:24 UTC (permalink / raw)
  To: Cezary Rojewski, Mark Brown, Pierre-Louis Bossart
  Cc: Wasko, Michal, lgirdwood, alsa-devel, tiwai, Kaczmarski, Filip


On 8/25/2019 1:06 PM, Cezary Rojewski wrote:
> On 2019-08-24 15:51, Cezary Rojewski wrote:
>> On 2019-08-23 23:39, Mark Brown wrote:
>>> On Fri, Aug 23, 2019 at 03:12:18PM -0500, Pierre-Louis Bossart wrote:
>>>> On 8/23/19 1:44 PM, Cezary Rojewski wrote:
>>>
>>>>> Wasn't lying about FW version being unreliable. Let's say vendor
>>>>> receives quick FW drop with new RCR.. such eng drop may carry invalid
>>>>> numbers such as 0.0.0.0..
>>>>> In general, I try to avoid relying on FW version whenever 
>>>>> possible. It
>>>>> can be dumped for debug reasons, true, but to be relied on? Not 
>>>>> really.
>>>
>>>> Goodness, that's really bad. I didn't realize this.
>>>
>>> At a previous employer I modified our build stamping
>>> infrastructure to also include both a timestamp and a serialized
>>> build number in the version number since one of my colleagues was
>>> fond of sending people prereleases of what he was working on to
>>> other people with identical version numbers on different
>>> binaries leading to much confusion and checksumming.  You do see
>>> a lot of things with those serialized version numbers, especially
>>> SVN based projects.
>>>
>>>>> Personally, I'm against all hardcodes and would simply recommend all
>>>>> user to redirect their symlinks when they do switch kernel - along 
>>>>> with
>>>>> dumping warning/ error message in dmesg. Hardcodes bring problems 
>>>>> with
>>>>> forward compatibility and that's why host should offload them away to
>>>>> FW.
>>>
>>>> Cezary, I know you are not responsible for all this, but at this 
>>>> point if we
>>>> (Intel) can't guarantee any sort of interoperability with both 
>>>> firmware and
>>>> topology we should make it clear that this driver is not 
>>>> recommended unless
>>>> specific versions of the firmware/topology are used, and as a 
>>>> consequence
>>>> the typical client distros and desktop/laptop users should use HDaudio
>>>> legacy or SOF (for DMICs)
>>>
>>> Not the most elegent solution but I'm wondering if keeping a copy
>>> of the driver as is around and using new locations for the fixed
>>> firmware might be the safest way to handle this.  We could have a
>>> wrapper which tries to load the newer firmware and uses the fixed
>>> driver code if that's there, otherwise tries the old driver with
>>> the existing firmware paths.  This is obviously a horror show and
>>> leaves the old code sitting there but given the mistakes that
>>> have been made the whole situation looks like a house of cards.
>>>
>>
>> Thanks for the feedback Mark. While I'm not yet on the "SOF will fix 
>> this" train, I'm keen to agree to leaving this entirely to SOF if it 
>> comes down to us duplicating /skylake.
>>
>> However, we are not going to give up that easily. I'll see if some 
>> "golden config" hardcodes can't be provided in some legacy.c file 
>> which would be fetched if initial setup fails. E.g.: 2cores, 3ssps, 
>> 1PAGE_SIZE per trace buffer.. and such. There are quite a few factors 
>> to take into consideration though. If "asking" user via dmesg to 
>> upgrade the firmware if his/her setup contains obsolete binary is 
>> really not an option, then some magic words got to be involved.
>>
>> Czarek
>
> On the second thought what if instead of duplicating kernel code, 
> binaries would be duplicated?
> I.e. rather than targeting /intel/dsp_fw_cnl.bin, _new_ /skylake would 
> be expecting /intel/dsp_fw_cnl_release.bin? Same with topology binaries.
> In such case, we "only" need to figure out how to propagate new files 
> to Linux distos so whenever someone updates their kernel, new binaries 
> are already present in their /lib/firmware.
>
> If such option is valid, we can postpone /skylake upgrade till 5.4 
> merging window closes and the patches (rough estimation is 150) would 
> descend upon alsa-devel in time between 5.4 and 5.5.

If the driver and FW update will be within the same kernel release then IMHO
there should be no compatibility problem between those two components, 
right?
This way kernel users willing to stick to old FW can stay on older 
kernel version while
others can update and receive all the latest FW functionality that was 
developed and enabled.

In terms of FW topology compatibility there is an option to read from 
topology manifest
a FW version that it was build for and in  case if it does not match FW 
version present on
the platform then print warning that the FW topology binary should be 
rebuild for current
FW version (x.x.x.x).

The above approach at the end may be less confusing then source code or 
binary duplication.
> _______________________________________________
> Alsa-devel mailing list
> Alsa-devel@alsa-project.org
> https://mailman.alsa-project.org/mailman/listinfo/alsa-devel
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

^ permalink raw reply	[flat|nested] 107+ messages in thread

* Re: [PATCH 02/35] ASoC: Intel: Skylake: Add FIRMWARE_CONFIG IPC request
  2019-08-24  9:17     ` Cezary Rojewski
@ 2019-08-26 16:27       ` Pierre-Louis Bossart
  2019-08-26 19:34         ` Cezary Rojewski
  0 siblings, 1 reply; 107+ messages in thread
From: Pierre-Louis Bossart @ 2019-08-26 16:27 UTC (permalink / raw)
  To: Cezary Rojewski, alsa-devel; +Cc: broonie, tiwai, lgirdwood



On 8/24/19 4:17 AM, Cezary Rojewski wrote:
> On 2019-08-23 20:24, Pierre-Louis Bossart wrote:
>>
>>
>> On 8/22/19 2:03 PM, Cezary Rojewski wrote:
>>> 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.
>>>
>>> Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
>>> ---
>>>   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(+)
>>>
>>> diff --git a/sound/soc/intel/skylake/skl-sst-ipc.c 
>>> b/sound/soc/intel/skylake/skl-sst-ipc.c
>>> index 667cdddc289f..e9e11ec4c97b 100644
>>> --- a/sound/soc/intel/skylake/skl-sst-ipc.c
>>> +++ b/sound/soc/intel/skylake/skl-sst-ipc.c
>>> @@ -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;
>>
>> 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.

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.

> 
>>> +        }
>>> +
>>> +        offset += sizeof(*tlv) + tlv->length;
>>> +    }
>>> +
>>> +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.
> 
> 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
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

^ permalink raw reply	[flat|nested] 107+ messages in thread

* Re: [PATCH 04/35] ASoC: Intel: Skylake: Unify firmware loading mechanism
  2019-08-24  9:34     ` Cezary Rojewski
@ 2019-08-26 16:31       ` Pierre-Louis Bossart
  2019-08-26 19:50         ` Cezary Rojewski
  0 siblings, 1 reply; 107+ messages in thread
From: Pierre-Louis Bossart @ 2019-08-26 16:31 UTC (permalink / raw)
  To: Cezary Rojewski, alsa-devel; +Cc: broonie, tiwai, lgirdwood



On 8/24/19 4:34 AM, Cezary Rojewski wrote:
> On 2019-08-23 20:40, Pierre-Louis Bossart wrote:
>>
>>> -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;
>>> +    }
>>> +
>>> +    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.

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

> 
>>> +
>>> +    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);
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

^ permalink raw reply	[flat|nested] 107+ messages in thread

* Re: [PATCH 29/35] ASoC: Intel: Skylake: Flip SST initialization order
  2019-08-24 10:54     ` Cezary Rojewski
@ 2019-08-26 16:39       ` Pierre-Louis Bossart
  2019-08-26 20:03         ` Cezary Rojewski
  0 siblings, 1 reply; 107+ messages in thread
From: Pierre-Louis Bossart @ 2019-08-26 16:39 UTC (permalink / raw)
  To: Cezary Rojewski, alsa-devel; +Cc: broonie, tiwai, lgirdwood



On 8/24/19 5:54 AM, Cezary Rojewski wrote:
> On 2019-08-23 22:18, Pierre-Louis Bossart wrote:
>>
>>
>> On 8/22/19 2:04 PM, Cezary Rojewski wrote:
>>> 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/?


> 
>>> bypassing sst_dsp_new -> sst_ops::init order. Fix that by flipping
>>> invocation order of handlers engaged in Skylake initialization.
>>>
>>> Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
>>> ---
>>>   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(-)
>>>
>>> diff --git a/sound/soc/intel/skylake/bxt-sst.c 
>>> b/sound/soc/intel/skylake/bxt-sst.c
>>> index 06da822790a5..286da9fbc4de 100644
>>> --- a/sound/soc/intel/skylake/bxt-sst.c
>>> +++ b/sound/soc/intel/skylake/bxt-sst.c
>>> @@ -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)
>>> diff --git a/sound/soc/intel/skylake/cnl-sst-dsp.h 
>>> b/sound/soc/intel/skylake/cnl-sst-dsp.h
>>> index 02e070fae2ce..7810ae11954a 100644
>>> --- a/sound/soc/intel/skylake/cnl-sst-dsp.h
>>> +++ b/sound/soc/intel/skylake/cnl-sst-dsp.h
>>> @@ -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__*/
>>> diff --git a/sound/soc/intel/skylake/cnl-sst.c 
>>> b/sound/soc/intel/skylake/cnl-sst.c
>>> index c4dbf6655097..a6113d8afcbb 100644
>>> --- a/sound/soc/intel/skylake/cnl-sst.c
>>> +++ b/sound/soc/intel/skylake/cnl-sst.c
>>> @@ -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)
>>> diff --git a/sound/soc/intel/skylake/skl-messages.c 
>>> b/sound/soc/intel/skylake/skl-messages.c
>>> index 8c352255ff45..372c5fb83ddb 100644
>>> --- a/sound/soc/intel/skylake/skl-messages.c
>>> +++ b/sound/soc/intel/skylake/skl-messages.c
>>> @@ -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;
>>> diff --git a/sound/soc/intel/skylake/skl-sst-dsp.h 
>>> b/sound/soc/intel/skylake/skl-sst-dsp.h
>>> index b647e60d7a6d..8483c60f29ba 100644
>>> --- a/sound/soc/intel/skylake/skl-sst-dsp.h
>>> +++ b/sound/soc/intel/skylake/skl-sst-dsp.h
>>> @@ -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);
>>> diff --git a/sound/soc/intel/skylake/skl-sst.c 
>>> b/sound/soc/intel/skylake/skl-sst.c
>>> index 122c07290440..e0f2bf828541 100644
>>> --- a/sound/soc/intel/skylake/skl-sst.c
>>> +++ b/sound/soc/intel/skylake/skl-sst.c
>>> @@ -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)
>>> diff --git a/sound/soc/intel/skylake/skl.c 
>>> b/sound/soc/intel/skylake/skl.c
>>> index 53a6befd5d68..39442c80a179 100644
>>> --- a/sound/soc/intel/skylake/skl.c
>>> +++ b/sound/soc/intel/skylake/skl.c
>>> @@ -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;
>>> diff --git a/sound/soc/intel/skylake/skl.h 
>>> b/sound/soc/intel/skylake/skl.h
>>> index 2f2b5a141abf..f4cd5ccc1ff9 100644
>>> --- a/sound/soc/intel/skylake/skl.h
>>> +++ b/sound/soc/intel/skylake/skl.h
>>> @@ -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);
>>>
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

^ permalink raw reply	[flat|nested] 107+ messages in thread

* Re: [PATCH 00/35] ASoC: Intel: Clenaup SST initialization
  2019-08-26  7:24                     ` Wasko, Michal
@ 2019-08-26 16:51                       ` Pierre-Louis Bossart
  2019-08-26 20:08                         ` Cezary Rojewski
  2019-08-27 19:06                         ` Mark Brown
  0 siblings, 2 replies; 107+ messages in thread
From: Pierre-Louis Bossart @ 2019-08-26 16:51 UTC (permalink / raw)
  To: Wasko, Michal, Cezary Rojewski, Mark Brown
  Cc: Wasko, Michal, lgirdwood, alsa-devel, tiwai, Kaczmarski, Filip



On 8/26/19 2:24 AM, Wasko, Michal wrote:
> 
> On 8/25/2019 1:06 PM, Cezary Rojewski wrote:
>> On 2019-08-24 15:51, Cezary Rojewski wrote:
>>> On 2019-08-23 23:39, Mark Brown wrote:
>>>> On Fri, Aug 23, 2019 at 03:12:18PM -0500, Pierre-Louis Bossart wrote:
>>>>> On 8/23/19 1:44 PM, Cezary Rojewski wrote:
>>>>
>>>>>> Wasn't lying about FW version being unreliable. Let's say vendor
>>>>>> receives quick FW drop with new RCR.. such eng drop may carry invalid
>>>>>> numbers such as 0.0.0.0..
>>>>>> In general, I try to avoid relying on FW version whenever 
>>>>>> possible. It
>>>>>> can be dumped for debug reasons, true, but to be relied on? Not 
>>>>>> really.
>>>>
>>>>> Goodness, that's really bad. I didn't realize this.
>>>>
>>>> At a previous employer I modified our build stamping
>>>> infrastructure to also include both a timestamp and a serialized
>>>> build number in the version number since one of my colleagues was
>>>> fond of sending people prereleases of what he was working on to
>>>> other people with identical version numbers on different
>>>> binaries leading to much confusion and checksumming.  You do see
>>>> a lot of things with those serialized version numbers, especially
>>>> SVN based projects.
>>>>
>>>>>> Personally, I'm against all hardcodes and would simply recommend all
>>>>>> user to redirect their symlinks when they do switch kernel - along 
>>>>>> with
>>>>>> dumping warning/ error message in dmesg. Hardcodes bring problems 
>>>>>> with
>>>>>> forward compatibility and that's why host should offload them away to
>>>>>> FW.
>>>>
>>>>> Cezary, I know you are not responsible for all this, but at this 
>>>>> point if we
>>>>> (Intel) can't guarantee any sort of interoperability with both 
>>>>> firmware and
>>>>> topology we should make it clear that this driver is not 
>>>>> recommended unless
>>>>> specific versions of the firmware/topology are used, and as a 
>>>>> consequence
>>>>> the typical client distros and desktop/laptop users should use HDaudio
>>>>> legacy or SOF (for DMICs)
>>>>
>>>> Not the most elegent solution but I'm wondering if keeping a copy
>>>> of the driver as is around and using new locations for the fixed
>>>> firmware might be the safest way to handle this.  We could have a
>>>> wrapper which tries to load the newer firmware and uses the fixed
>>>> driver code if that's there, otherwise tries the old driver with
>>>> the existing firmware paths.  This is obviously a horror show and
>>>> leaves the old code sitting there but given the mistakes that
>>>> have been made the whole situation looks like a house of cards.
>>>>
>>>
>>> Thanks for the feedback Mark. While I'm not yet on the "SOF will fix 
>>> this" train, I'm keen to agree to leaving this entirely to SOF if it 
>>> comes down to us duplicating /skylake.
>>>
>>> However, we are not going to give up that easily. I'll see if some 
>>> "golden config" hardcodes can't be provided in some legacy.c file 
>>> which would be fetched if initial setup fails. E.g.: 2cores, 3ssps, 
>>> 1PAGE_SIZE per trace buffer.. and such. There are quite a few factors 
>>> to take into consideration though. If "asking" user via dmesg to 
>>> upgrade the firmware if his/her setup contains obsolete binary is 
>>> really not an option, then some magic words got to be involved.
>>>
>>> Czarek
>>
>> On the second thought what if instead of duplicating kernel code, 
>> binaries would be duplicated?
>> I.e. rather than targeting /intel/dsp_fw_cnl.bin, _new_ /skylake would 
>> be expecting /intel/dsp_fw_cnl_release.bin? Same with topology binaries.
>> In such case, we "only" need to figure out how to propagate new files 
>> to Linux distos so whenever someone updates their kernel, new binaries 
>> are already present in their /lib/firmware.
>>
>> If such option is valid, we can postpone /skylake upgrade till 5.4 
>> merging window closes and the patches (rough estimation is 150) would 
>> descend upon alsa-devel in time between 5.4 and 5.5.
> 
> If the driver and FW update will be within the same kernel release then 
> IMHO
> there should be no compatibility problem between those two components, 
> right?
> This way kernel users willing to stick to old FW can stay on older 
> kernel version while
> others can update and receive all the latest FW functionality that was 
> developed and enabled.

I am not comfortable with precluding a kernel update because of a single 
firmware file. There are all sort of reasons for updating a kernel, 
security, sideband attacks and Android CDD compatibility being the most 
obvious ones.

> 
> In terms of FW topology compatibility there is an option to read from 
> topology manifest
> a FW version that it was build for and in  case if it does not match FW 
> version present on
> the platform then print warning that the FW topology binary should be 
> rebuild for current
> FW version (x.x.x.x).

Can you provide a pointer on how the FW version is embedded in a 
.conf/.tplg file? I see a couple where that information does not seem 
present.

> The above approach at the end may be less confusing then source code or 
> binary duplication.

_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

^ permalink raw reply	[flat|nested] 107+ messages in thread

* Re: [PATCH 27/35] ASoC: Intel: Skylake: Define platform descriptors
  2019-08-24 10:51     ` Cezary Rojewski
@ 2019-08-26 17:13       ` Pierre-Louis Bossart
  2019-08-26 19:18         ` Cezary Rojewski
  0 siblings, 1 reply; 107+ messages in thread
From: Pierre-Louis Bossart @ 2019-08-26 17:13 UTC (permalink / raw)
  To: Cezary Rojewski, alsa-devel; +Cc: broonie, tiwai, lgirdwood



On 8/24/19 5:51 AM, Cezary Rojewski wrote:
> On 2019-08-23 21:50, Pierre-Louis Bossart wrote:
>>
>>
>> On 8/22/19 2:04 PM, Cezary Rojewski wrote:
>>> 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
> (...)

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.

> 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.

> 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.

> 
> Czarek
> 
>>>
>>> Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
>>> ---
>>>   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(-)
>>>
>>> diff --git a/sound/soc/intel/skylake/bxt-sst.c 
>>> b/sound/soc/intel/skylake/bxt-sst.c
>>> index a547fb84eee9..06da822790a5 100644
>>> --- a/sound/soc/intel/skylake/bxt-sst.c
>>> +++ b/sound/soc/intel/skylake/bxt-sst.c
>>> @@ -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)
>>> diff --git a/sound/soc/intel/skylake/cnl-sst.c 
>>> b/sound/soc/intel/skylake/cnl-sst.c
>>> index 5be0a8eb154d..c4dbf6655097 100644
>>> --- a/sound/soc/intel/skylake/cnl-sst.c
>>> +++ b/sound/soc/intel/skylake/cnl-sst.c
>>> @@ -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)
>>> diff --git a/sound/soc/intel/skylake/skl-sst.c 
>>> b/sound/soc/intel/skylake/skl-sst.c
>>> index 8ae7fe73534e..122c07290440 100644
>>> --- a/sound/soc/intel/skylake/skl-sst.c
>>> +++ b/sound/soc/intel/skylake/skl-sst.c
>>> @@ -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)
>>> diff --git a/sound/soc/intel/skylake/skl.c 
>>> b/sound/soc/intel/skylake/skl.c
>>> index 54e1f957121d..d6d099aba834 100644
>>> --- a/sound/soc/intel/skylake/skl.c
>>> +++ b/sound/soc/intel/skylake/skl.c
>>> @@ -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)
>>> diff --git a/sound/soc/intel/skylake/skl.h 
>>> b/sound/soc/intel/skylake/skl.h
>>> index 9f5aa53df9f8..2f2b5a141abf 100644
>>> --- a/sound/soc/intel/skylake/skl.h
>>> +++ b/sound/soc/intel/skylake/skl.h
>>> @@ -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;
>>>
> _______________________________________________
> Alsa-devel mailing list
> Alsa-devel@alsa-project.org
> https://mailman.alsa-project.org/mailman/listinfo/alsa-devel
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

^ permalink raw reply	[flat|nested] 107+ messages in thread

* Re: [PATCH 27/35] ASoC: Intel: Skylake: Define platform descriptors
  2019-08-26 17:13       ` Pierre-Louis Bossart
@ 2019-08-26 19:18         ` Cezary Rojewski
  2019-08-26 21:53           ` Pierre-Louis Bossart
  0 siblings, 1 reply; 107+ messages in thread
From: Cezary Rojewski @ 2019-08-26 19:18 UTC (permalink / raw)
  To: Pierre-Louis Bossart, alsa-devel; +Cc: broonie, tiwai, lgirdwood

On 2019-08-26 19:13, Pierre-Louis Bossart wrote:
> 
> 
> On 8/24/19 5:51 AM, Cezary Rojewski wrote:
>> On 2019-08-23 21:50, Pierre-Louis Bossart wrote:
>>>
>>>
>>> On 8/22/19 2:04 PM, Cezary Rojewski wrote:
>>>> 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
>> (...)
> 
> 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.

> 
>> 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.
> 
>> 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.
> 

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.

^ permalink raw reply	[flat|nested] 107+ messages in thread

* Re: [PATCH 02/35] ASoC: Intel: Skylake: Add FIRMWARE_CONFIG IPC request
  2019-08-26 16:27       ` Pierre-Louis Bossart
@ 2019-08-26 19:34         ` Cezary Rojewski
  0 siblings, 0 replies; 107+ messages in thread
From: Cezary Rojewski @ 2019-08-26 19:34 UTC (permalink / raw)
  To: Pierre-Louis Bossart, alsa-devel; +Cc: broonie, tiwai, lgirdwood

On 2019-08-26 18:27, Pierre-Louis Bossart wrote:
> 
> 
> On 8/24/19 4:17 AM, Cezary Rojewski wrote:
>> On 2019-08-23 20:24, Pierre-Louis Bossart wrote:
>>>
>>>
>>> On 8/22/19 2:03 PM, Cezary Rojewski wrote:
>>>> 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.
>>>>
>>>> Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
>>>> ---
>>>>   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(+)
>>>>
>>>> diff --git a/sound/soc/intel/skylake/skl-sst-ipc.c 
>>>> b/sound/soc/intel/skylake/skl-sst-ipc.c
>>>> index 667cdddc289f..e9e11ec4c97b 100644
>>>> --- a/sound/soc/intel/skylake/skl-sst-ipc.c
>>>> +++ b/sound/soc/intel/skylake/skl-sst-ipc.c
>>>> @@ -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;
>>>
>>> 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.
> 
> 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.

>>
>>>> +        }
>>>> +
>>>> +        offset += sizeof(*tlv) + tlv->length;
>>>> +    }
>>>> +
>>>> +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.
>>
>> 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
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

^ permalink raw reply	[flat|nested] 107+ messages in thread

* Re: [PATCH 04/35] ASoC: Intel: Skylake: Unify firmware loading mechanism
  2019-08-26 16:31       ` Pierre-Louis Bossart
@ 2019-08-26 19:50         ` Cezary Rojewski
  0 siblings, 0 replies; 107+ messages in thread
From: Cezary Rojewski @ 2019-08-26 19:50 UTC (permalink / raw)
  To: Pierre-Louis Bossart, alsa-devel; +Cc: broonie, tiwai, lgirdwood

On 2019-08-26 18:31, Pierre-Louis Bossart wrote:
> 
> 
> On 8/24/19 4:34 AM, Cezary Rojewski wrote:
>> On 2019-08-23 20:40, Pierre-Louis Bossart wrote:
>>>
>>>> -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;
>>>> +    }
>>>> +
>>>> +    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.
> 
> 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
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

^ permalink raw reply	[flat|nested] 107+ messages in thread

* Re: [PATCH 29/35] ASoC: Intel: Skylake: Flip SST initialization order
  2019-08-26 16:39       ` Pierre-Louis Bossart
@ 2019-08-26 20:03         ` Cezary Rojewski
  0 siblings, 0 replies; 107+ messages in thread
From: Cezary Rojewski @ 2019-08-26 20:03 UTC (permalink / raw)
  To: Pierre-Louis Bossart, alsa-devel; +Cc: broonie, tiwai, lgirdwood

On 2019-08-26 18:39, Pierre-Louis Bossart wrote:
> 
> 
> On 8/24/19 5:54 AM, Cezary Rojewski wrote:
>> On 2019-08-23 22:18, Pierre-Louis Bossart wrote:
>>>
>>>
>>> On 8/22/19 2:04 PM, Cezary Rojewski wrote:
>>>> 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/?
> 

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.

^ permalink raw reply	[flat|nested] 107+ messages in thread

* Re: [PATCH 00/35] ASoC: Intel: Clenaup SST initialization
  2019-08-26 16:51                       ` Pierre-Louis Bossart
@ 2019-08-26 20:08                         ` Cezary Rojewski
  2019-08-26 21:57                           ` Pierre-Louis Bossart
  2019-08-27 19:06                         ` Mark Brown
  1 sibling, 1 reply; 107+ messages in thread
From: Cezary Rojewski @ 2019-08-26 20:08 UTC (permalink / raw)
  To: Pierre-Louis Bossart, Wasko, Michal, Mark Brown
  Cc: Wasko, Michal, lgirdwood, alsa-devel, tiwai, Kaczmarski, Filip

On 2019-08-26 18:51, Pierre-Louis Bossart wrote:
> 
> 
> On 8/26/19 2:24 AM, Wasko, Michal wrote:
>>
>> On 8/25/2019 1:06 PM, Cezary Rojewski wrote:
>>> On 2019-08-24 15:51, Cezary Rojewski wrote:
>>>> On 2019-08-23 23:39, Mark Brown wrote:
>>>>> On Fri, Aug 23, 2019 at 03:12:18PM -0500, Pierre-Louis Bossart wrote:
>>>>>> On 8/23/19 1:44 PM, Cezary Rojewski wrote:
>>>>>
>>>>>>> Wasn't lying about FW version being unreliable. Let's say vendor
>>>>>>> receives quick FW drop with new RCR.. such eng drop may carry 
>>>>>>> invalid
>>>>>>> numbers such as 0.0.0.0..
>>>>>>> In general, I try to avoid relying on FW version whenever 
>>>>>>> possible. It
>>>>>>> can be dumped for debug reasons, true, but to be relied on? Not 
>>>>>>> really.
>>>>>
>>>>>> Goodness, that's really bad. I didn't realize this.
>>>>>
>>>>> At a previous employer I modified our build stamping
>>>>> infrastructure to also include both a timestamp and a serialized
>>>>> build number in the version number since one of my colleagues was
>>>>> fond of sending people prereleases of what he was working on to
>>>>> other people with identical version numbers on different
>>>>> binaries leading to much confusion and checksumming.  You do see
>>>>> a lot of things with those serialized version numbers, especially
>>>>> SVN based projects.
>>>>>
>>>>>>> Personally, I'm against all hardcodes and would simply recommend all
>>>>>>> user to redirect their symlinks when they do switch kernel - 
>>>>>>> along with
>>>>>>> dumping warning/ error message in dmesg. Hardcodes bring problems 
>>>>>>> with
>>>>>>> forward compatibility and that's why host should offload them 
>>>>>>> away to
>>>>>>> FW.
>>>>>
>>>>>> Cezary, I know you are not responsible for all this, but at this 
>>>>>> point if we
>>>>>> (Intel) can't guarantee any sort of interoperability with both 
>>>>>> firmware and
>>>>>> topology we should make it clear that this driver is not 
>>>>>> recommended unless
>>>>>> specific versions of the firmware/topology are used, and as a 
>>>>>> consequence
>>>>>> the typical client distros and desktop/laptop users should use 
>>>>>> HDaudio
>>>>>> legacy or SOF (for DMICs)
>>>>>
>>>>> Not the most elegent solution but I'm wondering if keeping a copy
>>>>> of the driver as is around and using new locations for the fixed
>>>>> firmware might be the safest way to handle this.  We could have a
>>>>> wrapper which tries to load the newer firmware and uses the fixed
>>>>> driver code if that's there, otherwise tries the old driver with
>>>>> the existing firmware paths.  This is obviously a horror show and
>>>>> leaves the old code sitting there but given the mistakes that
>>>>> have been made the whole situation looks like a house of cards.
>>>>>
>>>>
>>>> Thanks for the feedback Mark. While I'm not yet on the "SOF will fix 
>>>> this" train, I'm keen to agree to leaving this entirely to SOF if it 
>>>> comes down to us duplicating /skylake.
>>>>
>>>> However, we are not going to give up that easily. I'll see if some 
>>>> "golden config" hardcodes can't be provided in some legacy.c file 
>>>> which would be fetched if initial setup fails. E.g.: 2cores, 3ssps, 
>>>> 1PAGE_SIZE per trace buffer.. and such. There are quite a few 
>>>> factors to take into consideration though. If "asking" user via 
>>>> dmesg to upgrade the firmware if his/her setup contains obsolete 
>>>> binary is really not an option, then some magic words got to be 
>>>> involved.
>>>>
>>>> Czarek
>>>
>>> On the second thought what if instead of duplicating kernel code, 
>>> binaries would be duplicated?
>>> I.e. rather than targeting /intel/dsp_fw_cnl.bin, _new_ /skylake 
>>> would be expecting /intel/dsp_fw_cnl_release.bin? Same with topology 
>>> binaries.
>>> In such case, we "only" need to figure out how to propagate new files 
>>> to Linux distos so whenever someone updates their kernel, new 
>>> binaries are already present in their /lib/firmware.
>>>
>>> If such option is valid, we can postpone /skylake upgrade till 5.4 
>>> merging window closes and the patches (rough estimation is 150) would 
>>> descend upon alsa-devel in time between 5.4 and 5.5.
>>
>> If the driver and FW update will be within the same kernel release 
>> then IMHO
>> there should be no compatibility problem between those two components, 
>> right?
>> This way kernel users willing to stick to old FW can stay on older 
>> kernel version while
>> others can update and receive all the latest FW functionality that was 
>> developed and enabled.
> 
> I am not comfortable with precluding a kernel update because of a single 
> firmware file. There are all sort of reasons for updating a kernel, 
> security, sideband attacks and Android CDD compatibility being the most 
> obvious ones.
> 
>>
>> In terms of FW topology compatibility there is an option to read from 
>> topology manifest
>> a FW version that it was build for and in  case if it does not match 
>> FW version present on
>> the platform then print warning that the FW topology binary should be 
>> rebuild for current
>> FW version (x.x.x.x).
> 
> Can you provide a pointer on how the FW version is embedded in a 
> .conf/.tplg file? I see a couple where that information does not seem 
> present.
> 
>> The above approach at the end may be less confusing then source code 
>> or binary duplication.
> 

Indeed. Our existing topology skips that part of internal .xml and thus 
such information is not propagated to kernel.

Pierre, how about the binary-duplication - as described above? Btw, 
that's not a single firmware file ^)^ We would immediately update all of 
them, together with topologies.
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

^ permalink raw reply	[flat|nested] 107+ messages in thread

* Re: [PATCH 27/35] ASoC: Intel: Skylake: Define platform descriptors
  2019-08-26 19:18         ` Cezary Rojewski
@ 2019-08-26 21:53           ` Pierre-Louis Bossart
  0 siblings, 0 replies; 107+ messages in thread
From: Pierre-Louis Bossart @ 2019-08-26 21:53 UTC (permalink / raw)
  To: Cezary Rojewski, alsa-devel; +Cc: broonie, tiwai, lgirdwood



On 8/26/19 2:18 PM, Cezary Rojewski wrote:
> On 2019-08-26 19:13, Pierre-Louis Bossart wrote:
>>
>>
>> On 8/24/19 5:51 AM, Cezary Rojewski wrote:
>>> On 2019-08-23 21:50, Pierre-Louis Bossart wrote:
>>>>
>>>>
>>>> On 8/22/19 2:04 PM, Cezary Rojewski wrote:
>>>>> 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
>>> (...)
>>
>> 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.

> 
>>
>>> 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.
>>
>>> 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.
>>
> 
> 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.

> 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.

> 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.

^ permalink raw reply	[flat|nested] 107+ messages in thread

* Re: [PATCH 00/35] ASoC: Intel: Clenaup SST initialization
  2019-08-26 20:08                         ` Cezary Rojewski
@ 2019-08-26 21:57                           ` Pierre-Louis Bossart
  2019-08-27  8:33                             ` Wasko, Michal
  0 siblings, 1 reply; 107+ messages in thread
From: Pierre-Louis Bossart @ 2019-08-26 21:57 UTC (permalink / raw)
  To: Cezary Rojewski, Wasko, Michal, Mark Brown
  Cc: Wasko, Michal, lgirdwood, alsa-devel, tiwai, Kaczmarski, Filip



On 8/26/19 3:08 PM, Cezary Rojewski wrote:
> On 2019-08-26 18:51, Pierre-Louis Bossart wrote:
>>
>>
>> On 8/26/19 2:24 AM, Wasko, Michal wrote:
>>>
>>> On 8/25/2019 1:06 PM, Cezary Rojewski wrote:
>>>> On 2019-08-24 15:51, Cezary Rojewski wrote:
>>>>> On 2019-08-23 23:39, Mark Brown wrote:
>>>>>> On Fri, Aug 23, 2019 at 03:12:18PM -0500, Pierre-Louis Bossart wrote:
>>>>>>> On 8/23/19 1:44 PM, Cezary Rojewski wrote:
>>>>>>
>>>>>>>> Wasn't lying about FW version being unreliable. Let's say vendor
>>>>>>>> receives quick FW drop with new RCR.. such eng drop may carry 
>>>>>>>> invalid
>>>>>>>> numbers such as 0.0.0.0..
>>>>>>>> In general, I try to avoid relying on FW version whenever 
>>>>>>>> possible. It
>>>>>>>> can be dumped for debug reasons, true, but to be relied on? Not 
>>>>>>>> really.
>>>>>>
>>>>>>> Goodness, that's really bad. I didn't realize this.
>>>>>>
>>>>>> At a previous employer I modified our build stamping
>>>>>> infrastructure to also include both a timestamp and a serialized
>>>>>> build number in the version number since one of my colleagues was
>>>>>> fond of sending people prereleases of what he was working on to
>>>>>> other people with identical version numbers on different
>>>>>> binaries leading to much confusion and checksumming.  You do see
>>>>>> a lot of things with those serialized version numbers, especially
>>>>>> SVN based projects.
>>>>>>
>>>>>>>> Personally, I'm against all hardcodes and would simply recommend 
>>>>>>>> all
>>>>>>>> user to redirect their symlinks when they do switch kernel - 
>>>>>>>> along with
>>>>>>>> dumping warning/ error message in dmesg. Hardcodes bring 
>>>>>>>> problems with
>>>>>>>> forward compatibility and that's why host should offload them 
>>>>>>>> away to
>>>>>>>> FW.
>>>>>>
>>>>>>> Cezary, I know you are not responsible for all this, but at this 
>>>>>>> point if we
>>>>>>> (Intel) can't guarantee any sort of interoperability with both 
>>>>>>> firmware and
>>>>>>> topology we should make it clear that this driver is not 
>>>>>>> recommended unless
>>>>>>> specific versions of the firmware/topology are used, and as a 
>>>>>>> consequence
>>>>>>> the typical client distros and desktop/laptop users should use 
>>>>>>> HDaudio
>>>>>>> legacy or SOF (for DMICs)
>>>>>>
>>>>>> Not the most elegent solution but I'm wondering if keeping a copy
>>>>>> of the driver as is around and using new locations for the fixed
>>>>>> firmware might be the safest way to handle this.  We could have a
>>>>>> wrapper which tries to load the newer firmware and uses the fixed
>>>>>> driver code if that's there, otherwise tries the old driver with
>>>>>> the existing firmware paths.  This is obviously a horror show and
>>>>>> leaves the old code sitting there but given the mistakes that
>>>>>> have been made the whole situation looks like a house of cards.
>>>>>>
>>>>>
>>>>> Thanks for the feedback Mark. While I'm not yet on the "SOF will 
>>>>> fix this" train, I'm keen to agree to leaving this entirely to SOF 
>>>>> if it comes down to us duplicating /skylake.
>>>>>
>>>>> However, we are not going to give up that easily. I'll see if some 
>>>>> "golden config" hardcodes can't be provided in some legacy.c file 
>>>>> which would be fetched if initial setup fails. E.g.: 2cores, 3ssps, 
>>>>> 1PAGE_SIZE per trace buffer.. and such. There are quite a few 
>>>>> factors to take into consideration though. If "asking" user via 
>>>>> dmesg to upgrade the firmware if his/her setup contains obsolete 
>>>>> binary is really not an option, then some magic words got to be 
>>>>> involved.
>>>>>
>>>>> Czarek
>>>>
>>>> On the second thought what if instead of duplicating kernel code, 
>>>> binaries would be duplicated?
>>>> I.e. rather than targeting /intel/dsp_fw_cnl.bin, _new_ /skylake 
>>>> would be expecting /intel/dsp_fw_cnl_release.bin? Same with topology 
>>>> binaries.
>>>> In such case, we "only" need to figure out how to propagate new 
>>>> files to Linux distos so whenever someone updates their kernel, new 
>>>> binaries are already present in their /lib/firmware.
>>>>
>>>> If such option is valid, we can postpone /skylake upgrade till 5.4 
>>>> merging window closes and the patches (rough estimation is 150) 
>>>> would descend upon alsa-devel in time between 5.4 and 5.5.
>>>
>>> If the driver and FW update will be within the same kernel release 
>>> then IMHO
>>> there should be no compatibility problem between those two 
>>> components, right?
>>> This way kernel users willing to stick to old FW can stay on older 
>>> kernel version while
>>> others can update and receive all the latest FW functionality that 
>>> was developed and enabled.
>>
>> I am not comfortable with precluding a kernel update because of a 
>> single firmware file. There are all sort of reasons for updating a 
>> kernel, security, sideband attacks and Android CDD compatibility being 
>> the most obvious ones.
>>
>>>
>>> In terms of FW topology compatibility there is an option to read from 
>>> topology manifest
>>> a FW version that it was build for and in  case if it does not match 
>>> FW version present on
>>> the platform then print warning that the FW topology binary should be 
>>> rebuild for current
>>> FW version (x.x.x.x).
>>
>> Can you provide a pointer on how the FW version is embedded in a 
>> .conf/.tplg file? I see a couple where that information does not seem 
>> present.
>>
>>> The above approach at the end may be less confusing then source code 
>>> or binary duplication.
>>
> 
> Indeed. Our existing topology skips that part of internal .xml and thus 
> such information is not propagated to kernel.
> 
> Pierre, how about the binary-duplication - as described above? Btw, 
> that's not a single firmware file ^)^ We would immediately update all of 
> them, together with topologies.

I didn't understand how you would select the new firmwares? Some code 
change needs to happen as well?
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

^ permalink raw reply	[flat|nested] 107+ messages in thread

* Re: [PATCH 00/35] ASoC: Intel: Clenaup SST initialization
  2019-08-26 21:57                           ` Pierre-Louis Bossart
@ 2019-08-27  8:33                             ` Wasko, Michal
  2019-08-27 13:52                               ` Pierre-Louis Bossart
  0 siblings, 1 reply; 107+ messages in thread
From: Wasko, Michal @ 2019-08-27  8:33 UTC (permalink / raw)
  To: Pierre-Louis Bossart, Cezary Rojewski, Mark Brown
  Cc: Wasko, Michal, alsa-devel, Kaczmarski, Filip, lgirdwood, tiwai

On 8/26/2019 11:57 PM, Pierre-Louis Bossart wrote:

>
>
> On 8/26/19 3:08 PM, Cezary Rojewski wrote:
>> On 2019-08-26 18:51, Pierre-Louis Bossart wrote:
>>>
>>>
>>> On 8/26/19 2:24 AM, Wasko, Michal wrote:
>>>>
>>>> On 8/25/2019 1:06 PM, Cezary Rojewski wrote:
>>>>> On 2019-08-24 15:51, Cezary Rojewski wrote:
>>>>>> On 2019-08-23 23:39, Mark Brown wrote:
>>>>>>> On Fri, Aug 23, 2019 at 03:12:18PM -0500, Pierre-Louis Bossart 
>>>>>>> wrote:
>>>>>>>> On 8/23/19 1:44 PM, Cezary Rojewski wrote:
>>>>>>>
>>>>>>>>> Wasn't lying about FW version being unreliable. Let's say vendor
>>>>>>>>> receives quick FW drop with new RCR.. such eng drop may carry 
>>>>>>>>> invalid
>>>>>>>>> numbers such as 0.0.0.0..
>>>>>>>>> In general, I try to avoid relying on FW version whenever 
>>>>>>>>> possible. It
>>>>>>>>> can be dumped for debug reasons, true, but to be relied on? 
>>>>>>>>> Not really.
>>>>>>>
>>>>>>>> Goodness, that's really bad. I didn't realize this.
>>>>>>>
>>>>>>> At a previous employer I modified our build stamping
>>>>>>> infrastructure to also include both a timestamp and a serialized
>>>>>>> build number in the version number since one of my colleagues was
>>>>>>> fond of sending people prereleases of what he was working on to
>>>>>>> other people with identical version numbers on different
>>>>>>> binaries leading to much confusion and checksumming. You do see
>>>>>>> a lot of things with those serialized version numbers, especially
>>>>>>> SVN based projects.
>>>>>>>
>>>>>>>>> Personally, I'm against all hardcodes and would simply 
>>>>>>>>> recommend all
>>>>>>>>> user to redirect their symlinks when they do switch kernel - 
>>>>>>>>> along with
>>>>>>>>> dumping warning/ error message in dmesg. Hardcodes bring 
>>>>>>>>> problems with
>>>>>>>>> forward compatibility and that's why host should offload them 
>>>>>>>>> away to
>>>>>>>>> FW.
>>>>>>>
>>>>>>>> Cezary, I know you are not responsible for all this, but at 
>>>>>>>> this point if we
>>>>>>>> (Intel) can't guarantee any sort of interoperability with both 
>>>>>>>> firmware and
>>>>>>>> topology we should make it clear that this driver is not 
>>>>>>>> recommended unless
>>>>>>>> specific versions of the firmware/topology are used, and as a 
>>>>>>>> consequence
>>>>>>>> the typical client distros and desktop/laptop users should use 
>>>>>>>> HDaudio
>>>>>>>> legacy or SOF (for DMICs)
>>>>>>>
>>>>>>> Not the most elegent solution but I'm wondering if keeping a copy
>>>>>>> of the driver as is around and using new locations for the fixed
>>>>>>> firmware might be the safest way to handle this.  We could have a
>>>>>>> wrapper which tries to load the newer firmware and uses the fixed
>>>>>>> driver code if that's there, otherwise tries the old driver with
>>>>>>> the existing firmware paths.  This is obviously a horror show and
>>>>>>> leaves the old code sitting there but given the mistakes that
>>>>>>> have been made the whole situation looks like a house of cards.
>>>>>>>
>>>>>>
>>>>>> Thanks for the feedback Mark. While I'm not yet on the "SOF will 
>>>>>> fix this" train, I'm keen to agree to leaving this entirely to 
>>>>>> SOF if it comes down to us duplicating /skylake.
>>>>>>
>>>>>> However, we are not going to give up that easily. I'll see if 
>>>>>> some "golden config" hardcodes can't be provided in some legacy.c 
>>>>>> file which would be fetched if initial setup fails. E.g.: 2cores, 
>>>>>> 3ssps, 1PAGE_SIZE per trace buffer.. and such. There are quite a 
>>>>>> few factors to take into consideration though. If "asking" user 
>>>>>> via dmesg to upgrade the firmware if his/her setup contains 
>>>>>> obsolete binary is really not an option, then some magic words 
>>>>>> got to be involved.
>>>>>>
>>>>>> Czarek
>>>>>
>>>>> On the second thought what if instead of duplicating kernel code, 
>>>>> binaries would be duplicated?
>>>>> I.e. rather than targeting /intel/dsp_fw_cnl.bin, _new_ /skylake 
>>>>> would be expecting /intel/dsp_fw_cnl_release.bin? Same with 
>>>>> topology binaries.
>>>>> In such case, we "only" need to figure out how to propagate new 
>>>>> files to Linux distos so whenever someone updates their kernel, 
>>>>> new binaries are already present in their /lib/firmware.
>>>>>
>>>>> If such option is valid, we can postpone /skylake upgrade till 5.4 
>>>>> merging window closes and the patches (rough estimation is 150) 
>>>>> would descend upon alsa-devel in time between 5.4 and 5.5.
>>>>
>>>> If the driver and FW update will be within the same kernel release 
>>>> then IMHO
>>>> there should be no compatibility problem between those two 
>>>> components, right?
>>>> This way kernel users willing to stick to old FW can stay on older 
>>>> kernel version while
>>>> others can update and receive all the latest FW functionality that 
>>>> was developed and enabled.
>>>
>>> I am not comfortable with precluding a kernel update because of a 
>>> single firmware file. There are all sort of reasons for updating a 
>>> kernel, security, sideband attacks and Android CDD compatibility 
>>> being the most obvious ones.
>>>
The single firmware file will not be a blocker as the driver included in 
updated kernel will support it.
All you have to do is the little effort to re-generate your custom 
topology for the new firmware target.
The entire operation should not be a problem as there are dedicated 
utilities like FDK to do that.

Your statement Pierre suggest that everyone should avoid any functional 
changes in kernel
that are not critical because that would be problematic for others who 
switch from older kernel version.
>>>>
>>>> In terms of FW topology compatibility there is an option to read 
>>>> from topology manifest
>>>> a FW version that it was build for and in  case if it does not 
>>>> match FW version present on
>>>> the platform then print warning that the FW topology binary should 
>>>> be rebuild for current
>>>> FW version (x.x.x.x).
>>>
>>> Can you provide a pointer on how the FW version is embedded in a 
>>> .conf/.tplg file? I see a couple where that information does not 
>>> seem present.
>>>
>>>> The above approach at the end may be less confusing then source 
>>>> code or binary duplication.
>>>
>>
>> Indeed. Our existing topology skips that part of internal .xml and 
>> thus such information is not propagated to kernel.
>>
>> Pierre, how about the binary-duplication - as described above? Btw, 
>> that's not a single firmware file ^)^ We would immediately update all 
>> of them, together with topologies.
>
> I didn't understand how you would select the new firmwares? Some code 
> change needs to happen as well?
> _______________________________________________
> Alsa-devel mailing list
> Alsa-devel@alsa-project.org
> https://mailman.alsa-project.org/mailman/listinfo/alsa-devel
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

^ permalink raw reply	[flat|nested] 107+ messages in thread

* Re: [PATCH 00/35] ASoC: Intel: Clenaup SST initialization
  2019-08-27  8:33                             ` Wasko, Michal
@ 2019-08-27 13:52                               ` Pierre-Louis Bossart
  2019-08-27 14:58                                 ` Cezary Rojewski
  0 siblings, 1 reply; 107+ messages in thread
From: Pierre-Louis Bossart @ 2019-08-27 13:52 UTC (permalink / raw)
  To: Wasko, Michal, Cezary Rojewski, Mark Brown
  Cc: Wasko, Michal, alsa-devel, tiwai, lgirdwood, Kaczmarski, Filip


>>>>>>>> Not the most elegent solution but I'm wondering if keeping a copy
>>>>>>>> of the driver as is around and using new locations for the fixed
>>>>>>>> firmware might be the safest way to handle this.  We could have a
>>>>>>>> wrapper which tries to load the newer firmware and uses the fixed
>>>>>>>> driver code if that's there, otherwise tries the old driver with
>>>>>>>> the existing firmware paths.  This is obviously a horror show and
>>>>>>>> leaves the old code sitting there but given the mistakes that
>>>>>>>> have been made the whole situation looks like a house of cards.
>>>>>>>>
>>>>>>>
>>>>>>> Thanks for the feedback Mark. While I'm not yet on the "SOF will 
>>>>>>> fix this" train, I'm keen to agree to leaving this entirely to 
>>>>>>> SOF if it comes down to us duplicating /skylake.
>>>>>>>
>>>>>>> However, we are not going to give up that easily. I'll see if 
>>>>>>> some "golden config" hardcodes can't be provided in some legacy.c 
>>>>>>> file which would be fetched if initial setup fails. E.g.: 2cores, 
>>>>>>> 3ssps, 1PAGE_SIZE per trace buffer.. and such. There are quite a 
>>>>>>> few factors to take into consideration though. If "asking" user 
>>>>>>> via dmesg to upgrade the firmware if his/her setup contains 
>>>>>>> obsolete binary is really not an option, then some magic words 
>>>>>>> got to be involved.
>>>>>>>
>>>>>>> Czarek
>>>>>>
>>>>>> On the second thought what if instead of duplicating kernel code, 
>>>>>> binaries would be duplicated?
>>>>>> I.e. rather than targeting /intel/dsp_fw_cnl.bin, _new_ /skylake 
>>>>>> would be expecting /intel/dsp_fw_cnl_release.bin? Same with 
>>>>>> topology binaries.
>>>>>> In such case, we "only" need to figure out how to propagate new 
>>>>>> files to Linux distos so whenever someone updates their kernel, 
>>>>>> new binaries are already present in their /lib/firmware.
>>>>>>
>>>>>> If such option is valid, we can postpone /skylake upgrade till 5.4 
>>>>>> merging window closes and the patches (rough estimation is 150) 
>>>>>> would descend upon alsa-devel in time between 5.4 and 5.5.
>>>>>
>>>>> If the driver and FW update will be within the same kernel release 
>>>>> then IMHO
>>>>> there should be no compatibility problem between those two 
>>>>> components, right?
>>>>> This way kernel users willing to stick to old FW can stay on older 
>>>>> kernel version while
>>>>> others can update and receive all the latest FW functionality that 
>>>>> was developed and enabled.
>>>>
>>>> I am not comfortable with precluding a kernel update because of a 
>>>> single firmware file. There are all sort of reasons for updating a 
>>>> kernel, security, sideband attacks and Android CDD compatibility 
>>>> being the most obvious ones.
>>>>
> The single firmware file will not be a blocker as the driver included in 
> updated kernel will support it.
> All you have to do is the little effort to re-generate your custom 
> topology for the new firmware target.
> The entire operation should not be a problem as there are dedicated 
> utilities like FDK to do that.

The issue is the same whether it's a topology file or a firmware file. 
The ideal situation is that when the kernel is updated it handles both 
in backwards compatible ways.

If to deal with a new firmware file you have to regenerate a new 
topology, you are in a different model altogether.

> Your statement Pierre suggest that everyone should avoid any functional 
> changes in kernel
> that are not critical because that would be problematic for others who 
> switch from older kernel version.
  All I said was that you cannot assume that people who are using an old 
firmware/driver will remain on an old kernel.

Mark made an initial proposal to essentially freeze the current 
solution, which would make it possible to update the kernel but keep the 
same skylake driver in legacy/maintenance mode only, and an 'new' option 
that would rely on an updated distribution of firmware/driver. I did not 
get the counter proposal from Cezary at all.
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

^ permalink raw reply	[flat|nested] 107+ messages in thread

* Re: [PATCH 00/35] ASoC: Intel: Clenaup SST initialization
  2019-08-27 13:52                               ` Pierre-Louis Bossart
@ 2019-08-27 14:58                                 ` Cezary Rojewski
  2019-08-27 15:00                                   ` Pierre-Louis Bossart
  0 siblings, 1 reply; 107+ messages in thread
From: Cezary Rojewski @ 2019-08-27 14:58 UTC (permalink / raw)
  To: Pierre-Louis Bossart, Wasko, Michal, Mark Brown
  Cc: Wasko, Michal, alsa-devel, tiwai, lgirdwood, Kaczmarski, Filip

On 2019-08-27 15:52, Pierre-Louis Bossart wrote:
> 
>>>>>>>>> Not the most elegent solution but I'm wondering if keeping a copy
>>>>>>>>> of the driver as is around and using new locations for the fixed
>>>>>>>>> firmware might be the safest way to handle this.  We could have a
>>>>>>>>> wrapper which tries to load the newer firmware and uses the fixed
>>>>>>>>> driver code if that's there, otherwise tries the old driver with
>>>>>>>>> the existing firmware paths.  This is obviously a horror show and
>>>>>>>>> leaves the old code sitting there but given the mistakes that
>>>>>>>>> have been made the whole situation looks like a house of cards.
>>>>>>>>>
>>>>>>>>
>>>>>>>> Thanks for the feedback Mark. While I'm not yet on the "SOF will 
>>>>>>>> fix this" train, I'm keen to agree to leaving this entirely to 
>>>>>>>> SOF if it comes down to us duplicating /skylake.
>>>>>>>>
>>>>>>>> However, we are not going to give up that easily. I'll see if 
>>>>>>>> some "golden config" hardcodes can't be provided in some 
>>>>>>>> legacy.c file which would be fetched if initial setup fails. 
>>>>>>>> E.g.: 2cores, 3ssps, 1PAGE_SIZE per trace buffer.. and such. 
>>>>>>>> There are quite a few factors to take into consideration though. 
>>>>>>>> If "asking" user via dmesg to upgrade the firmware if his/her 
>>>>>>>> setup contains obsolete binary is really not an option, then 
>>>>>>>> some magic words got to be involved.
>>>>>>>>
>>>>>>>> Czarek
>>>>>>>
>>>>>>> On the second thought what if instead of duplicating kernel code, 
>>>>>>> binaries would be duplicated?
>>>>>>> I.e. rather than targeting /intel/dsp_fw_cnl.bin, _new_ /skylake 
>>>>>>> would be expecting /intel/dsp_fw_cnl_release.bin? Same with 
>>>>>>> topology binaries.
>>>>>>> In such case, we "only" need to figure out how to propagate new 
>>>>>>> files to Linux distos so whenever someone updates their kernel, 
>>>>>>> new binaries are already present in their /lib/firmware.
>>>>>>>
>>>>>>> If such option is valid, we can postpone /skylake upgrade till 
>>>>>>> 5.4 merging window closes and the patches (rough estimation is 
>>>>>>> 150) would descend upon alsa-devel in time between 5.4 and 5.5.
>>>>>>
>>>>>> If the driver and FW update will be within the same kernel release 
>>>>>> then IMHO
>>>>>> there should be no compatibility problem between those two 
>>>>>> components, right?
>>>>>> This way kernel users willing to stick to old FW can stay on older 
>>>>>> kernel version while
>>>>>> others can update and receive all the latest FW functionality that 
>>>>>> was developed and enabled.
>>>>>
>>>>> I am not comfortable with precluding a kernel update because of a 
>>>>> single firmware file. There are all sort of reasons for updating a 
>>>>> kernel, security, sideband attacks and Android CDD compatibility 
>>>>> being the most obvious ones.
>>>>>
>> The single firmware file will not be a blocker as the driver included 
>> in updated kernel will support it.
>> All you have to do is the little effort to re-generate your custom 
>> topology for the new firmware target.
>> The entire operation should not be a problem as there are dedicated 
>> utilities like FDK to do that.
> 
> The issue is the same whether it's a topology file or a firmware file. 
> The ideal situation is that when the kernel is updated it handles both 
> in backwards compatible ways.
> 
> If to deal with a new firmware file you have to regenerate a new 
> topology, you are in a different model altogether.
> 
>> Your statement Pierre suggest that everyone should avoid any 
>> functional changes in kernel
>> that are not critical because that would be problematic for others who 
>> switch from older kernel version.
>   All I said was that you cannot assume that people who are using an old 
> firmware/driver will remain on an old kernel.
> 
> Mark made an initial proposal to essentially freeze the current 
> solution, which would make it possible to update the kernel but keep the 
> same skylake driver in legacy/maintenance mode only, and an 'new' option 
> that would rely on an updated distribution of firmware/driver. I did not 
> get the counter proposal from Cezary at all.

Ain't my previous message:

-

On the second thought what if instead of duplicating kernel code, 
binaries would be duplicated?
I.e. rather than targeting /intel/dsp_fw_cnl.bin, _new_ /skylake would 
be expecting /intel/dsp_fw_cnl_release.bin? Same with topology binaries.
In such case, we "only" need to figure out how to propagate new files to 
Linux distos so whenever someone updates their kernel, new binaries are 
already present in their /lib/firmware.

If such option is valid, we can postpone /skylake upgrade till 5.4 
merging window closes and the patches (rough estimation is 150) would 
descend upon alsa-devel in time between 5.4 and 5.5.

-

a counter proposal?
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

^ permalink raw reply	[flat|nested] 107+ messages in thread

* Re: [PATCH 00/35] ASoC: Intel: Clenaup SST initialization
  2019-08-27 14:58                                 ` Cezary Rojewski
@ 2019-08-27 15:00                                   ` Pierre-Louis Bossart
  2019-08-27 15:08                                     ` Cezary Rojewski
  0 siblings, 1 reply; 107+ messages in thread
From: Pierre-Louis Bossart @ 2019-08-27 15:00 UTC (permalink / raw)
  To: Cezary Rojewski, Wasko, Michal, Mark Brown
  Cc: Wasko, Michal, alsa-devel, tiwai, lgirdwood, Kaczmarski, Filip



On 8/27/19 9:58 AM, Cezary Rojewski wrote:
> On 2019-08-27 15:52, Pierre-Louis Bossart wrote:
>>
>>>>>>>>>> Not the most elegent solution but I'm wondering if keeping a copy
>>>>>>>>>> of the driver as is around and using new locations for the fixed
>>>>>>>>>> firmware might be the safest way to handle this.  We could have a
>>>>>>>>>> wrapper which tries to load the newer firmware and uses the fixed
>>>>>>>>>> driver code if that's there, otherwise tries the old driver with
>>>>>>>>>> the existing firmware paths.  This is obviously a horror show and
>>>>>>>>>> leaves the old code sitting there but given the mistakes that
>>>>>>>>>> have been made the whole situation looks like a house of cards.
>>>>>>>>>>
>>>>>>>>>
>>>>>>>>> Thanks for the feedback Mark. While I'm not yet on the "SOF 
>>>>>>>>> will fix this" train, I'm keen to agree to leaving this 
>>>>>>>>> entirely to SOF if it comes down to us duplicating /skylake.
>>>>>>>>>
>>>>>>>>> However, we are not going to give up that easily. I'll see if 
>>>>>>>>> some "golden config" hardcodes can't be provided in some 
>>>>>>>>> legacy.c file which would be fetched if initial setup fails. 
>>>>>>>>> E.g.: 2cores, 3ssps, 1PAGE_SIZE per trace buffer.. and such. 
>>>>>>>>> There are quite a few factors to take into consideration 
>>>>>>>>> though. If "asking" user via dmesg to upgrade the firmware if 
>>>>>>>>> his/her setup contains obsolete binary is really not an option, 
>>>>>>>>> then some magic words got to be involved.
>>>>>>>>>
>>>>>>>>> Czarek
>>>>>>>>
>>>>>>>> On the second thought what if instead of duplicating kernel 
>>>>>>>> code, binaries would be duplicated?
>>>>>>>> I.e. rather than targeting /intel/dsp_fw_cnl.bin, _new_ /skylake 
>>>>>>>> would be expecting /intel/dsp_fw_cnl_release.bin? Same with 
>>>>>>>> topology binaries.
>>>>>>>> In such case, we "only" need to figure out how to propagate new 
>>>>>>>> files to Linux distos so whenever someone updates their kernel, 
>>>>>>>> new binaries are already present in their /lib/firmware.
>>>>>>>>
>>>>>>>> If such option is valid, we can postpone /skylake upgrade till 
>>>>>>>> 5.4 merging window closes and the patches (rough estimation is 
>>>>>>>> 150) would descend upon alsa-devel in time between 5.4 and 5.5.
>>>>>>>
>>>>>>> If the driver and FW update will be within the same kernel 
>>>>>>> release then IMHO
>>>>>>> there should be no compatibility problem between those two 
>>>>>>> components, right?
>>>>>>> This way kernel users willing to stick to old FW can stay on 
>>>>>>> older kernel version while
>>>>>>> others can update and receive all the latest FW functionality 
>>>>>>> that was developed and enabled.
>>>>>>
>>>>>> I am not comfortable with precluding a kernel update because of a 
>>>>>> single firmware file. There are all sort of reasons for updating a 
>>>>>> kernel, security, sideband attacks and Android CDD compatibility 
>>>>>> being the most obvious ones.
>>>>>>
>>> The single firmware file will not be a blocker as the driver included 
>>> in updated kernel will support it.
>>> All you have to do is the little effort to re-generate your custom 
>>> topology for the new firmware target.
>>> The entire operation should not be a problem as there are dedicated 
>>> utilities like FDK to do that.
>>
>> The issue is the same whether it's a topology file or a firmware file. 
>> The ideal situation is that when the kernel is updated it handles both 
>> in backwards compatible ways.
>>
>> If to deal with a new firmware file you have to regenerate a new 
>> topology, you are in a different model altogether.
>>
>>> Your statement Pierre suggest that everyone should avoid any 
>>> functional changes in kernel
>>> that are not critical because that would be problematic for others 
>>> who switch from older kernel version.
>>   All I said was that you cannot assume that people who are using an 
>> old firmware/driver will remain on an old kernel.
>>
>> Mark made an initial proposal to essentially freeze the current 
>> solution, which would make it possible to update the kernel but keep 
>> the same skylake driver in legacy/maintenance mode only, and an 'new' 
>> option that would rely on an updated distribution of firmware/driver. 
>> I did not get the counter proposal from Cezary at all.
> 
> Ain't my previous message:
> 
> -
> 
> On the second thought what if instead of duplicating kernel code, 
> binaries would be duplicated?
> I.e. rather than targeting /intel/dsp_fw_cnl.bin, _new_ /skylake would 
> be expecting /intel/dsp_fw_cnl_release.bin? Same with topology binaries.
> In such case, we "only" need to figure out how to propagate new files to 
> Linux distos so whenever someone updates their kernel, new binaries are 
> already present in their /lib/firmware.
> 
> If such option is valid, we can postpone /skylake upgrade till 5.4 
> merging window closes and the patches (rough estimation is 150) would 
> descend upon alsa-devel in time between 5.4 and 5.5.
> 
> -
> 
> a counter proposal?

you didn't explain how the 'duplicated binaries' would be selected. And 
'instead of' means you suggested an alternative to Mark's proposal.
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

^ permalink raw reply	[flat|nested] 107+ messages in thread

* Re: [PATCH 00/35] ASoC: Intel: Clenaup SST initialization
  2019-08-27 15:00                                   ` Pierre-Louis Bossart
@ 2019-08-27 15:08                                     ` Cezary Rojewski
  2019-08-27 17:18                                       ` Pierre-Louis Bossart
  0 siblings, 1 reply; 107+ messages in thread
From: Cezary Rojewski @ 2019-08-27 15:08 UTC (permalink / raw)
  To: Pierre-Louis Bossart, Wasko, Michal, Mark Brown
  Cc: Wasko, Michal, alsa-devel, tiwai, lgirdwood, Kaczmarski, Filip

On 2019-08-27 17:00, Pierre-Louis Bossart wrote:

>>>>>>>>> On the second thought what if instead of duplicating kernel 
>>>>>>>>> code, binaries would be duplicated?
>>>>>>>>> I.e. rather than targeting /intel/dsp_fw_cnl.bin, _new_ 
>>>>>>>>> /skylake would be expecting /intel/dsp_fw_cnl_release.bin? Same 
>>>>>>>>> with topology binaries.
>>>>>>>>> In such case, we "only" need to figure out how to propagate new 
>>>>>>>>> files to Linux distos so whenever someone updates their kernel, 
>>>>>>>>> new binaries are already present in their /lib/firmware.
>>>>>>>>>
>>>>>>>>> If such option is valid, we can postpone /skylake upgrade till 
>>>>>>>>> 5.4 merging window closes and the patches (rough estimation is 
>>>>>>>>> 150) would descend upon alsa-devel in time between 5.4 and 5.5.
>>>>>>>>
>>>>>>>> If the driver and FW update will be within the same kernel 
>>>>>>>> release then IMHO
>>>>>>>> there should be no compatibility problem between those two 
>>>>>>>> components, right?
>>>>>>>> This way kernel users willing to stick to old FW can stay on 
>>>>>>>> older kernel version while
>>>>>>>> others can update and receive all the latest FW functionality 
>>>>>>>> that was developed and enabled.
>>>>>>>
>>>>>>> I am not comfortable with precluding a kernel update because of a 
>>>>>>> single firmware file. There are all sort of reasons for updating 
>>>>>>> a kernel, security, sideband attacks and Android CDD 
>>>>>>> compatibility being the most obvious ones.
>>>>>>>
>>>> The single firmware file will not be a blocker as the driver 
>>>> included in updated kernel will support it.
>>>> All you have to do is the little effort to re-generate your custom 
>>>> topology for the new firmware target.
>>>> The entire operation should not be a problem as there are dedicated 
>>>> utilities like FDK to do that.
>>>
>>> The issue is the same whether it's a topology file or a firmware 
>>> file. The ideal situation is that when the kernel is updated it 
>>> handles both in backwards compatible ways.
>>>
>>> If to deal with a new firmware file you have to regenerate a new 
>>> topology, you are in a different model altogether.
>>>
>>>> Your statement Pierre suggest that everyone should avoid any 
>>>> functional changes in kernel
>>>> that are not critical because that would be problematic for others 
>>>> who switch from older kernel version.
>>>   All I said was that you cannot assume that people who are using an 
>>> old firmware/driver will remain on an old kernel.
>>>
>>> Mark made an initial proposal to essentially freeze the current 
>>> solution, which would make it possible to update the kernel but keep 
>>> the same skylake driver in legacy/maintenance mode only, and an 'new' 
>>> option that would rely on an updated distribution of firmware/driver. 
>>> I did not get the counter proposal from Cezary at all.
>>
>> Ain't my previous message:
>>
>> -
>>
>> On the second thought what if instead of duplicating kernel code, 
>> binaries would be duplicated?
>> I.e. rather than targeting /intel/dsp_fw_cnl.bin, _new_ /skylake would 
>> be expecting /intel/dsp_fw_cnl_release.bin? Same with topology binaries.
>> In such case, we "only" need to figure out how to propagate new files 
>> to Linux distos so whenever someone updates their kernel, new binaries 
>> are already present in their /lib/firmware.
>>
>> If such option is valid, we can postpone /skylake upgrade till 5.4 
>> merging window closes and the patches (rough estimation is 150) would 
>> descend upon alsa-devel in time between 5.4 and 5.5.
>>
>> -
>>
>> a counter proposal?
> 
> you didn't explain how the 'duplicated binaries' would be selected. And 
> 'instead of' means you suggested an alternative to Mark's proposal.

What I have in mind:

We leave the old stuff as is, e.g:
/lib/firmware/intel/dsp_fw_cnl.bin -> points to _old_ FW binaries
/lib/firmware/<PCI-ID>-INTEL-<oem_data_from_NHLT -> points to old topology

Existing /skylake i.e. before our initialization refactor would (kernels 
<5.5?) would still point to these and since they are not being removed 
from linux-firmware, nothing gets broken.


And then we "duplicate" and simply append the new ones:
/lib/firmware/intel/dsp_fw_cnl_release.bin -> points to _new_ FW
/lib/firmware/dfw_cnl_rt274 -> points to _new_ topology

Updated /skylake would simply expect the _new_ files and totally ignore 
the old ones i.e.: descriptors would be pointing to dsp_fw_cnl_release 
and dfw_cnl_rt274.
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

^ permalink raw reply	[flat|nested] 107+ messages in thread

* Re: [PATCH 00/35] ASoC: Intel: Clenaup SST initialization
  2019-08-27 15:08                                     ` Cezary Rojewski
@ 2019-08-27 17:18                                       ` Pierre-Louis Bossart
  2019-08-27 18:13                                         ` Cezary Rojewski
  2019-08-27 19:20                                         ` Mark Brown
  0 siblings, 2 replies; 107+ messages in thread
From: Pierre-Louis Bossart @ 2019-08-27 17:18 UTC (permalink / raw)
  To: Cezary Rojewski, Wasko, Michal, Mark Brown
  Cc: Wasko, Michal, alsa-devel, tiwai, lgirdwood, Kaczmarski, Filip



On 8/27/19 10:08 AM, Cezary Rojewski wrote:
> On 2019-08-27 17:00, Pierre-Louis Bossart wrote:
> 
>>>>>>>>>> On the second thought what if instead of 
>>>>>>>>>> duplicating kernel code, binaries would be 
>>>>>>>>>> duplicated? I.e. rather than targeting 
>>>>>>>>>> /intel/dsp_fw_cnl.bin, _new_ /skylake would be 
>>>>>>>>>> expecting /intel/dsp_fw_cnl_release.bin? Same with 
>>>>>>>>>> topology binaries. In such case, we "only" need to 
>>>>>>>>>> figure out how to propagate new files to Linux 
>>>>>>>>>> distos so whenever someone updates their kernel, 
>>>>>>>>>> new binaries are already present in their 
>>>>>>>>>> /lib/firmware.
>>>>>>>>>> 
>>>>>>>>>> If such option is valid, we can postpone /skylake 
>>>>>>>>>> upgrade till 5.4 merging window closes and the 
>>>>>>>>>> patches (rough estimation is 150) would descend 
>>>>>>>>>> upon alsa-devel in time between 5.4 and 5.5.
>>>>>>>>> 
>>>>>>>>> If the driver and FW update will be within the same 
>>>>>>>>> kernel release then IMHO there should be no 
>>>>>>>>> compatibility problem between those two components, 
>>>>>>>>> right? This way kernel users willing to stick to old 
>>>>>>>>> FW can stay on older kernel version while others can 
>>>>>>>>> update and receive all the latest FW functionality 
>>>>>>>>> that was developed and enabled.
>>>>>>>> 
>>>>>>>> I am not comfortable with precluding a kernel update 
>>>>>>>> because of a single firmware file. There are all sort 
>>>>>>>> of reasons for updating a kernel, security, sideband 
>>>>>>>> attacks and Android CDD compatibility being the most 
>>>>>>>> obvious ones.
>>>>>>>> 
>>>>> The single firmware file will not be a blocker as the driver 
>>>>> included in updated kernel will support it. All you have to 
>>>>> do is the little effort to re-generate your custom topology 
>>>>> for the new firmware target. The entire operation should not 
>>>>> be a problem as there are dedicated utilities like FDK to do 
>>>>> that.
>>>> 
>>>> The issue is the same whether it's a topology file or a 
>>>> firmware file. The ideal situation is that when the kernel is 
>>>> updated it handles both in backwards compatible ways.
>>>> 
>>>> If to deal with a new firmware file you have to regenerate a 
>>>> new topology, you are in a different model altogether.
>>>> 
>>>>> Your statement Pierre suggest that everyone should avoid any 
>>>>> functional changes in kernel that are not critical because 
>>>>> that would be problematic for others who switch from older 
>>>>> kernel version.
>>>> All I said was that you cannot assume that people who are
>>>> using an old firmware/driver will remain on an old kernel.
>>>> 
>>>> Mark made an initial proposal to essentially freeze the
>>>> current solution, which would make it possible to update the
>>>> kernel but keep the same skylake driver in legacy/maintenance
>>>> mode only, and an 'new' option that would rely on an updated 
>>>> distribution of firmware/driver. I did not get the counter 
>>>> proposal from Cezary at all.
>>> 
>>> Ain't my previous message:
>>> 
>>> -
>>> 
>>> On the second thought what if instead of duplicating kernel
>>> code, binaries would be duplicated? I.e. rather than targeting 
>>> /intel/dsp_fw_cnl.bin, _new_ /skylake would be expecting 
>>> /intel/dsp_fw_cnl_release.bin? Same with topology binaries. In 
>>> such case, we "only" need to figure out how to propagate new 
>>> files to Linux distos so whenever someone updates their kernel, 
>>> new binaries are already present in their /lib/firmware.
>>> 
>>> If such option is valid, we can postpone /skylake upgrade till 
>>> 5.4 merging window closes and the patches (rough estimation is 
>>> 150) would descend upon alsa-devel in time between 5.4 and 5.5.
>>> 
>>> -
>>> 
>>> a counter proposal?
>> 
>> you didn't explain how the 'duplicated binaries' would be
>> selected. And 'instead of' means you suggested an alternative to
>> Mark's proposal.
> 
> What I have in mind:
> 
> We leave the old stuff as is, e.g:
> /lib/firmware/intel/dsp_fw_cnl.bin -> points to _old_ FW binaries 
> /lib/firmware/<PCI-ID>-INTEL-<oem_data_from_NHLT -> points to old 
> topology
> 
> Existing /skylake i.e. before our initialization refactor would 
> (kernels <5.5?) would still point to these and since they are not 
> being removed from linux-firmware, nothing gets broken.
> 
> 
> And then we "duplicate" and simply append the new ones: 
> /lib/firmware/intel/dsp_fw_cnl_release.bin -> points to _new_ FW 
> /lib/firmware/dfw_cnl_rt274 -> points to _new_ topology
> 
> Updated /skylake would simply expect the _new_ files and totally 
> ignore the old ones i.e.: descriptors would be pointing to 
> dsp_fw_cnl_release and dfw_cnl_rt274.

What if those new files are not present on the filesystem?

Mark suggested:
"We could have a wrapper which tries to load the newer firmware and uses
the fixed driver code if that's there, otherwise tries the old driver
with the existing firmware paths."

Maybe that's too complicated, I had in mind some sort of opt-in Kconfig 
where you only use the new firmware/topology when the user/distro gives 
a clear hint than it's fine to use newer stuff.

I also wonder how you are going to deal with all these topology files 
with a name derived from the OEM/NHLT. There's just so many of 
them...For upstream you probably want to provide ONE per platform 
variant, which limits you to the number of machine drivers supported.

^ permalink raw reply	[flat|nested] 107+ messages in thread

* Re: [PATCH 00/35] ASoC: Intel: Clenaup SST initialization
  2019-08-27 17:18                                       ` Pierre-Louis Bossart
@ 2019-08-27 18:13                                         ` Cezary Rojewski
  2019-08-27 19:20                                         ` Mark Brown
  1 sibling, 0 replies; 107+ messages in thread
From: Cezary Rojewski @ 2019-08-27 18:13 UTC (permalink / raw)
  To: Pierre-Louis Bossart
  Cc: alsa-devel, Kaczmarski, Filip, lgirdwood, tiwai, Mark Brown,
	Wasko, Michal, Wasko, Michal

On 2019-08-27 19:18, Pierre-Louis Bossart wrote:
> 
> 
> On 8/27/19 10:08 AM, Cezary Rojewski wrote:
>> On 2019-08-27 17:00, Pierre-Louis Bossart wrote:
>>
>>>>>>>>>>> On the second thought what if instead of duplicating kernel 
>>>>>>>>>>> code, binaries would be duplicated? I.e. rather than 
>>>>>>>>>>> targeting /intel/dsp_fw_cnl.bin, _new_ /skylake would be 
>>>>>>>>>>> expecting /intel/dsp_fw_cnl_release.bin? Same with topology 
>>>>>>>>>>> binaries. In such case, we "only" need to figure out how to 
>>>>>>>>>>> propagate new files to Linux distos so whenever someone 
>>>>>>>>>>> updates their kernel, new binaries are already present in 
>>>>>>>>>>> their /lib/firmware.
>>>>>>>>>>>
>>>>>>>>>>> If such option is valid, we can postpone /skylake upgrade 
>>>>>>>>>>> till 5.4 merging window closes and the patches (rough 
>>>>>>>>>>> estimation is 150) would descend upon alsa-devel in time 
>>>>>>>>>>> between 5.4 and 5.5.
>>>>>>>>>>
>>>>>>>>>> If the driver and FW update will be within the same kernel 
>>>>>>>>>> release then IMHO there should be no compatibility problem 
>>>>>>>>>> between those two components, right? This way kernel users 
>>>>>>>>>> willing to stick to old FW can stay on older kernel version 
>>>>>>>>>> while others can update and receive all the latest FW 
>>>>>>>>>> functionality that was developed and enabled.
>>>>>>>>>
>>>>>>>>> I am not comfortable with precluding a kernel update because of 
>>>>>>>>> a single firmware file. There are all sort of reasons for 
>>>>>>>>> updating a kernel, security, sideband attacks and Android CDD 
>>>>>>>>> compatibility being the most obvious ones.
>>>>>>>>>
>>>>>> The single firmware file will not be a blocker as the driver 
>>>>>> included in updated kernel will support it. All you have to do is 
>>>>>> the little effort to re-generate your custom topology for the new 
>>>>>> firmware target. The entire operation should not be a problem as 
>>>>>> there are dedicated utilities like FDK to do that.
>>>>>
>>>>> The issue is the same whether it's a topology file or a firmware 
>>>>> file. The ideal situation is that when the kernel is updated it 
>>>>> handles both in backwards compatible ways.
>>>>>
>>>>> If to deal with a new firmware file you have to regenerate a new 
>>>>> topology, you are in a different model altogether.
>>>>>
>>>>>> Your statement Pierre suggest that everyone should avoid any 
>>>>>> functional changes in kernel that are not critical because that 
>>>>>> would be problematic for others who switch from older kernel version.
>>>>> All I said was that you cannot assume that people who are
>>>>> using an old firmware/driver will remain on an old kernel.
>>>>>
>>>>> Mark made an initial proposal to essentially freeze the
>>>>> current solution, which would make it possible to update the
>>>>> kernel but keep the same skylake driver in legacy/maintenance
>>>>> mode only, and an 'new' option that would rely on an updated 
>>>>> distribution of firmware/driver. I did not get the counter proposal 
>>>>> from Cezary at all.
>>>>
>>>> Ain't my previous message:
>>>>
>>>> -
>>>>
>>>> On the second thought what if instead of duplicating kernel
>>>> code, binaries would be duplicated? I.e. rather than targeting 
>>>> /intel/dsp_fw_cnl.bin, _new_ /skylake would be expecting 
>>>> /intel/dsp_fw_cnl_release.bin? Same with topology binaries. In such 
>>>> case, we "only" need to figure out how to propagate new files to 
>>>> Linux distos so whenever someone updates their kernel, new binaries 
>>>> are already present in their /lib/firmware.
>>>>
>>>> If such option is valid, we can postpone /skylake upgrade till 5.4 
>>>> merging window closes and the patches (rough estimation is 150) 
>>>> would descend upon alsa-devel in time between 5.4 and 5.5.
>>>>
>>>> -
>>>>
>>>> a counter proposal?
>>>
>>> you didn't explain how the 'duplicated binaries' would be
>>> selected. And 'instead of' means you suggested an alternative to
>>> Mark's proposal.
>>
>> What I have in mind:
>>
>> We leave the old stuff as is, e.g:
>> /lib/firmware/intel/dsp_fw_cnl.bin -> points to _old_ FW binaries 
>> /lib/firmware/<PCI-ID>-INTEL-<oem_data_from_NHLT -> points to old 
>> topology
>>
>> Existing /skylake i.e. before our initialization refactor would 
>> (kernels <5.5?) would still point to these and since they are not 
>> being removed from linux-firmware, nothing gets broken.
>>
>>
>> And then we "duplicate" and simply append the new ones: 
>> /lib/firmware/intel/dsp_fw_cnl_release.bin -> points to _new_ FW 
>> /lib/firmware/dfw_cnl_rt274 -> points to _new_ topology
>>
>> Updated /skylake would simply expect the _new_ files and totally 
>> ignore the old ones i.e.: descriptors would be pointing to 
>> dsp_fw_cnl_release and dfw_cnl_rt274.
> 
> What if those new files are not present on the filesystem?

That's the hard part - we need to propagate these the Linux distos, much 
like older topologies are.

5.5+ (?) /skylake would rely on those new files as if the _old_ ones 
never existed.

> 
> Mark suggested:
> "We could have a wrapper which tries to load the newer firmware and uses
> the fixed driver code if that's there, otherwise tries the old driver
> with the existing firmware paths."
> 
> Maybe that's too complicated, I had in mind some sort of opt-in Kconfig 
> where you only use the new firmware/topology when the user/distro gives 
> a clear hint than it's fine to use newer stuff.


In one of the email you mentioned resources - human resources. If 
/skylake was to be duplicated, I fear maintenance of both would require 
too many resources. In such case we cannot guarantee same level of 
quality and coverage as in the _new_ /skylake-only case.

> 
> I also wonder how you are going to deal with all these topology files 
> with a name derived from the OEM/NHLT. There's just so many of 
> them...For upstream you probably want to provide ONE per platform 
> variant, which limits you to the number of machine drivers supported.


Precisely! That's why we resign from these and move to a simpler format 
- dfw_cnl_rt274 or something of that sort. And no, we would provide as 
many topologies (e.g. dfw_cnl_my_wondeful_board123) as it's necessary. 
_Old_ topologies are not even propagated for every OEM/NHLT - there are 
sightings such as:
https://bugzilla.kernel.org/show_bug.cgi?id=200963
or:
https://github.com/GalliumOS/galliumos-distro/issues/379

See the -ENOENT (-2) in the logs dumped. The debug-only dfw_sst.bin 
fallback plays a role there too when in fact, it should not be even 
present on upstream : )

I even saw cases where peps are copying binaries (FW) from Windows machines.

"we don't break userspace" - I'm all aboard, Pierre, but our ship has 
too many holes already. For a short while it was possible not to notice 
the water pouring in through them. But now ship is literally sinking. 
Userspace is broken.

Improper process led to distributed topologies missing or not even being 
compatible with all upstreamed FWs. These FWs are also carrying some 
bugs as they are deprecated for quite a while. In order to update them, 
host side (driver) needs to be aligned - there is no escaping that. And 
so the loop closes.

We want to - rather MUST - fix that and make Intel SST works as it 
should for the sake of all users.

^ permalink raw reply	[flat|nested] 107+ messages in thread

* Re: [PATCH 00/35] ASoC: Intel: Clenaup SST initialization
  2019-08-26 16:51                       ` Pierre-Louis Bossart
  2019-08-26 20:08                         ` Cezary Rojewski
@ 2019-08-27 19:06                         ` Mark Brown
  1 sibling, 0 replies; 107+ messages in thread
From: Mark Brown @ 2019-08-27 19:06 UTC (permalink / raw)
  To: Pierre-Louis Bossart
  Cc: Cezary Rojewski, alsa-devel, Kaczmarski, Filip, tiwai, lgirdwood,
	Wasko, Michal, Wasko, Michal


[-- Attachment #1.1: Type: text/plain, Size: 871 bytes --]

On Mon, Aug 26, 2019 at 11:51:32AM -0500, Pierre-Louis Bossart wrote:
> On 8/26/19 2:24 AM, Wasko, Michal wrote:

> > If the driver and FW update will be within the same kernel release then
> > IMHO
> > there should be no compatibility problem between those two components,
> > right?
> > This way kernel users willing to stick to old FW can stay on older
> > kernel version while
> > others can update and receive all the latest FW functionality that was
> > developed and enabled.

> I am not comfortable with precluding a kernel update because of a single
> firmware file. There are all sort of reasons for updating a kernel,
> security, sideband attacks and Android CDD compatibility being the most
> obvious ones.

Right, this is the whole ABI guarantee thing - we'd need an
incredibly strong reason to require a change in firmware for
upgrade of existing systems.


[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

[-- Attachment #2: Type: text/plain, Size: 0 bytes --]



^ permalink raw reply	[flat|nested] 107+ messages in thread

* Re: [PATCH 00/35] ASoC: Intel: Clenaup SST initialization
  2019-08-27 17:18                                       ` Pierre-Louis Bossart
  2019-08-27 18:13                                         ` Cezary Rojewski
@ 2019-08-27 19:20                                         ` Mark Brown
  1 sibling, 0 replies; 107+ messages in thread
From: Mark Brown @ 2019-08-27 19:20 UTC (permalink / raw)
  To: Pierre-Louis Bossart
  Cc: Cezary Rojewski, alsa-devel, Kaczmarski, Filip, lgirdwood, tiwai,
	Wasko, Michal, Wasko, Michal


[-- Attachment #1.1: Type: text/plain, Size: 973 bytes --]

On Tue, Aug 27, 2019 at 12:18:12PM -0500, Pierre-Louis Bossart wrote:

> Mark suggested:
> "We could have a wrapper which tries to load the newer firmware and uses
> the fixed driver code if that's there, otherwise tries the old driver
> with the existing firmware paths."

> Maybe that's too complicated, I had in mind some sort of opt-in Kconfig
> where you only use the new firmware/topology when the user/distro gives a
> clear hint than it's fine to use newer stuff.

To be clear I don't think this is a *good* idea, but I'm not sure
that there are any options that are good ideas.

> I also wonder how you are going to deal with all these topology files with a
> name derived from the OEM/NHLT. There's just so many of them...For upstream
> you probably want to provide ONE per platform variant, which limits you to
> the number of machine drivers supported.

Unless the way they're generated is consistent (or often
consistent) in which case you can just derive it?

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

[-- Attachment #2: Type: text/plain, Size: 0 bytes --]



^ permalink raw reply	[flat|nested] 107+ messages in thread

end of thread, other threads:[~2019-08-27 19:20 UTC | newest]

Thread overview: 107+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-08-22 19:03 [PATCH 00/35] ASoC: Intel: Clenaup SST initialization Cezary Rojewski
2019-08-22 19:03 ` [PATCH 01/35] ASoC: Intel: Skylake: Put FW runtime params defs in one place Cezary Rojewski
2019-08-22 19:03 ` [PATCH 02/35] ASoC: Intel: Skylake: Add FIRMWARE_CONFIG IPC request Cezary Rojewski
2019-08-23 18:24   ` Pierre-Louis Bossart
2019-08-24  9:17     ` Cezary Rojewski
2019-08-26 16:27       ` Pierre-Louis Bossart
2019-08-26 19:34         ` Cezary Rojewski
2019-08-22 19:03 ` [PATCH 03/35] ASoC: Intel: Skylake: Add HARDWARE_CONFIG " Cezary Rojewski
2019-08-23 18:32   ` Pierre-Louis Bossart
2019-08-24  9:30     ` Cezary Rojewski
2019-08-22 19:03 ` [PATCH 04/35] ASoC: Intel: Skylake: Unify firmware loading mechanism Cezary Rojewski
2019-08-23 18:40   ` Pierre-Louis Bossart
2019-08-24  9:34     ` Cezary Rojewski
2019-08-26 16:31       ` Pierre-Louis Bossart
2019-08-26 19:50         ` Cezary Rojewski
2019-08-22 19:03 ` [PATCH 05/35] ASoC: Intel: Skylake: Reload libraries on D0 entry for CNL Cezary Rojewski
2019-08-22 19:03 ` [PATCH 06/35] ASoC: Intel: Skylake: Unhardcode dsp cores number Cezary Rojewski
2019-08-22 19:03 ` [PATCH 07/35] ASoC: Intel: Skylake: Update interrupt disabling routine Cezary Rojewski
2019-08-22 19:03 ` [PATCH 08/35] ASoC: Intel: Skylake: Inline ipc free operations Cezary Rojewski
2019-08-22 19:03 ` [PATCH 09/35] ASoC: Intel: Skylake: Unify driver cleanup mechanism Cezary Rojewski
2019-08-22 19:04 ` [PATCH 10/35] ASoC: Intel: Relocate irq thread header to sst_ops Cezary Rojewski
2019-08-22 19:04 ` [PATCH 11/35] ASoC: Intel: Merge sst_dsp_device into sst_pdata Cezary Rojewski
2019-08-23 18:54   ` Pierre-Louis Bossart
2019-08-24 10:52     ` Cezary Rojewski
2019-08-22 19:04 ` [PATCH 12/35] ASoC: Intel: Skylake: Reuse sst_dsp_free Cezary Rojewski
2019-08-23 19:07   ` Pierre-Louis Bossart
2019-08-24  9:35     ` Cezary Rojewski
2019-08-22 19:04 ` [PATCH 13/35] ASoC: Intel: Skylake: Reuse sst_dsp_new Cezary Rojewski
2019-08-23 19:09   ` Pierre-Louis Bossart
2019-08-24  9:37     ` Cezary Rojewski
2019-08-22 19:04 ` [PATCH 14/35] ASoC: Intel: Skylake: Remove skl_dsp_acquire_irq Cezary Rojewski
2019-08-22 19:04 ` [PATCH 15/35] ASoC: Intel: Skylake: Use dsp loading functions directly Cezary Rojewski
2019-08-23 19:17   ` Pierre-Louis Bossart
2019-08-24  9:41     ` Cezary Rojewski
2019-08-22 19:04 ` [PATCH 16/35] ASoC: Intel: Skylake: Make dsp_ops::stream_tag obsolete Cezary Rojewski
2019-08-22 19:04 ` [PATCH 17/35] ASoC: Intel: Skylake: Remove skl_dsp_loader_ops Cezary Rojewski
2019-08-23 19:21   ` Pierre-Louis Bossart
2019-08-24  9:49     ` Cezary Rojewski
2019-08-22 19:04 ` [PATCH 18/35] ASoC: Intel: Skylake: Remove window0 sst_addr fields Cezary Rojewski
2019-08-23 19:26   ` Pierre-Louis Bossart
2019-08-24  9:57     ` Cezary Rojewski
2019-08-22 19:04 ` [PATCH 19/35] ASoC: Intel: Skylake: Remove redundant W0 and W1 macros Cezary Rojewski
2019-08-23 19:28   ` Pierre-Louis Bossart
2019-08-24 11:52     ` Cezary Rojewski
2019-08-24 12:04       ` Cezary Rojewski
2019-08-22 19:04 ` [PATCH 20/35] ASoC: Intel: Skylake: Remove redundant SRAM fields Cezary Rojewski
2019-08-22 19:04 ` [PATCH 21/35] ASoC: Intel: Expose ACPI loading members Cezary Rojewski
2019-08-23 19:32   ` Pierre-Louis Bossart
2019-08-24  9:58     ` Cezary Rojewski
2019-08-22 19:04 ` [PATCH 22/35] ASoC: Intel: Haswell: Define separate ACPI loader Cezary Rojewski
2019-08-23 19:35   ` Pierre-Louis Bossart
2019-08-24  9:59     ` Cezary Rojewski
2019-08-22 19:04 ` [PATCH 23/35] ASoC: Intel: Baytrail: " Cezary Rojewski
2019-08-23 19:36   ` Pierre-Louis Bossart
2019-08-22 19:04 ` [PATCH 24/35] ASoC: Intel: Refactor probing of ACPI devices Cezary Rojewski
2019-08-23 19:43   ` Pierre-Louis Bossart
2019-08-24 10:16     ` Cezary Rojewski
2019-08-22 19:04 ` [PATCH 25/35] ASoC: Intel: Skylake: Simplify skl_sst_ctx_init declaration Cezary Rojewski
2019-08-22 19:04 ` [PATCH 26/35] ASoC: Intel: Skylake: Simplify all sst_dsp_init declarations Cezary Rojewski
2019-08-22 19:04 ` [PATCH 27/35] ASoC: Intel: Skylake: Define platform descriptors Cezary Rojewski
2019-08-23 19:50   ` Pierre-Louis Bossart
2019-08-24 10:51     ` Cezary Rojewski
2019-08-26 17:13       ` Pierre-Louis Bossart
2019-08-26 19:18         ` Cezary Rojewski
2019-08-26 21:53           ` Pierre-Louis Bossart
2019-08-22 19:04 ` [PATCH 28/35] ASoC: Intel: Skylake: Update skl_ids table Cezary Rojewski
2019-08-23 20:15   ` Pierre-Louis Bossart
2019-08-22 19:04 ` [PATCH 29/35] ASoC: Intel: Skylake: Flip SST initialization order Cezary Rojewski
2019-08-23 20:18   ` Pierre-Louis Bossart
2019-08-24 10:54     ` Cezary Rojewski
2019-08-26 16:39       ` Pierre-Louis Bossart
2019-08-26 20:03         ` Cezary Rojewski
2019-08-22 19:04 ` [PATCH 30/35] ASoC: Intel: Reuse sst_pdata::fw_name field Cezary Rojewski
2019-08-23 20:20   ` Pierre-Louis Bossart
2019-08-24 10:57     ` Cezary Rojewski
2019-08-22 19:04 ` [PATCH 31/35] ASoC: Intel: Reuse sst_pdata::fw field Cezary Rojewski
2019-08-22 19:04 ` [PATCH 32/35] ASoC: Intel: Skylake: Remove skl_dsp_ops Cezary Rojewski
2019-08-22 19:04 ` [PATCH 33/35] ASoC: Intel: Skylake: Privatize SST init handlers Cezary Rojewski
2019-08-23 20:25   ` Pierre-Louis Bossart
2019-08-24 11:01     ` Cezary Rojewski
2019-08-22 19:04 ` [PATCH 34/35] ASoC: Intel: Skylake: Merge skl_sst_ctx_init into skl_init_dsp Cezary Rojewski
2019-08-22 19:04 ` [PATCH 35/35] ASoC: Intel: Remove obsolete firmware fields Cezary Rojewski
2019-08-23 20:27   ` Pierre-Louis Bossart
2019-08-24 11:02     ` Cezary Rojewski
2019-08-22 20:55 ` [PATCH 00/35] ASoC: Intel: Clenaup SST initialization Pierre-Louis Bossart
2019-08-23  8:29   ` Cezary Rojewski
2019-08-23 10:26     ` Mark Brown
2019-08-23 10:43       ` Cezary Rojewski
2019-08-23 16:26         ` Pierre-Louis Bossart
2019-08-23 18:44           ` Cezary Rojewski
2019-08-23 20:12             ` Pierre-Louis Bossart
2019-08-23 21:39               ` Mark Brown
2019-08-24 13:51                 ` Cezary Rojewski
2019-08-25 11:06                   ` Cezary Rojewski
2019-08-26  7:24                     ` Wasko, Michal
2019-08-26 16:51                       ` Pierre-Louis Bossart
2019-08-26 20:08                         ` Cezary Rojewski
2019-08-26 21:57                           ` Pierre-Louis Bossart
2019-08-27  8:33                             ` Wasko, Michal
2019-08-27 13:52                               ` Pierre-Louis Bossart
2019-08-27 14:58                                 ` Cezary Rojewski
2019-08-27 15:00                                   ` Pierre-Louis Bossart
2019-08-27 15:08                                     ` Cezary Rojewski
2019-08-27 17:18                                       ` Pierre-Louis Bossart
2019-08-27 18:13                                         ` Cezary Rojewski
2019-08-27 19:20                                         ` Mark Brown
2019-08-27 19:06                         ` Mark Brown

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.