Unverified Commit fb94b7b1 authored by Cezary Rojewski's avatar Cezary Rojewski Committed by Mark Brown
Browse files

ASoC: Intel: Remove SST firmware components



sst-firmware is host to many image loading over DMA operations. Majority
of code targets sound/soc/intel/haswell solution as /baytrail/ never
switched to DMA-based firmware loading. With /haswell/ removed this code
serves no purpose. Address this redundancy.

Signed-off-by: default avatarCezary Rojewski <cezary.rojewski@intel.com>
Reviewed-by: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Acked-by: default avatarLiam Girdwood <liam.r.girdwood@intel.com>
Link: https://lore.kernel.org/r/20201006064907.16277-7-cezary.rojewski@intel.com


Signed-off-by: default avatarMark Brown <broonie@kernel.org>
parent 05668be1
Loading
Loading
Loading
Loading
+0 −7
Original line number Diff line number Diff line
@@ -34,13 +34,6 @@ config SND_SST_IPC_ACPI
config SND_SOC_INTEL_SST
	tristate

config SND_SOC_INTEL_SST_FIRMWARE
	tristate
	select DW_DMAC_CORE
	# This option controls firmware download on
	# Haswell/Broadwell/Baytrail legacy and will be set
	# when these platforms are enabled

config SND_SOC_INTEL_CATPT
	tristate "Haswell and Broadwell"
	depends on ACPI || COMPILE_TEST
+0 −2
Original line number Diff line number Diff line
# SPDX-License-Identifier: GPL-2.0-only
snd-soc-sst-dsp-objs := sst-dsp.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 \
	soc-acpi-intel-hsw-bdw-match.o \
	soc-acpi-intel-skl-match.o soc-acpi-intel-kbl-match.o \
@@ -13,5 +12,4 @@ 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_FIRMWARE) += snd-soc-sst-firmware.o
obj-$(CONFIG_SND_SOC_ACPI_INTEL_MATCH) += snd-soc-acpi-intel-match.o
+0 −216
Original line number Diff line number Diff line
@@ -15,10 +15,6 @@

#include "../skylake/skl-sst-dsp.h"

struct sst_mem_block;
struct sst_module;
struct sst_fw;

/* do we need to remove or keep */
#define DSP_DRAM_ADDR_OFFSET		0x400000

@@ -53,9 +49,6 @@ struct sst_ops {
	/* SST init and free */
	int (*init)(struct sst_dsp *sst, struct sst_pdata *pdata);
	void (*free)(struct sst_dsp *sst);

	/* FW module parser/loader */
	int (*parse_fw)(struct sst_fw *sst_fw);
};

/*
@@ -88,168 +81,6 @@ struct sst_mailbox {
	size_t out_size;
};

/*
 * Audio DSP memory block types.
 */
enum sst_mem_type {
	SST_MEM_IRAM = 0,
	SST_MEM_DRAM = 1,
	SST_MEM_ANY  = 2,
	SST_MEM_CACHE= 3,
};

/*
 * Audio DSP Generic Firmware File.
 *
 * SST Firmware files can consist of 1..N modules. This generic structure is
 * used to manage each firmware file and it's modules regardless of SST firmware
 * type. A SST driver may load multiple FW files.
 */
struct sst_fw {
	struct sst_dsp *dsp;

	/* base addresses of FW file data */
	dma_addr_t dmable_fw_paddr;	/* physical address of fw data */
	void *dma_buf;			/* virtual address of fw data */
	u32 size;			/* size of fw data */

	/* lists */
	struct list_head list;		/* DSP list of FW */
	struct list_head module_list;	/* FW list of modules */

	void *private;			/* core doesn't touch this */
};

/*
 * Audio DSP Generic Module Template.
 *
 * Used to define and register a new FW module. This data is extracted from
 * FW module header information.
 */
struct sst_module_template {
	u32 id;
	u32 entry;			/* entry point */
	u32 scratch_size;
	u32 persistent_size;
};

/*
 * Block Allocator - Used to allocate blocks of DSP memory.
 */
struct sst_block_allocator {
	u32 id;
	u32 offset;
	int size;
	enum sst_mem_type type;
};

/*
 * Runtime Module Instance - A module object can be instantiated multiple
 * times within the DSP FW.
 */
struct sst_module_runtime {
	struct sst_dsp *dsp;
	int id;
	struct sst_module *module;	/* parent module we belong too */

	u32 persistent_offset;		/* private memory offset */
	void *private;

	struct list_head list;
	struct list_head block_list;	/* list of blocks used */
};

/*
 * Runtime Module Context - The runtime context must be manually stored by the
 * driver prior to enter S3 and restored after leaving S3. This should really be
 * part of the memory context saved by the enter D3 message IPC ???
 */
struct sst_module_runtime_context {
	dma_addr_t dma_buffer;
	u32 *buffer;
};

/*
 * Audio DSP Module State
 */
enum sst_module_state {
	SST_MODULE_STATE_UNLOADED = 0,	/* default state */
	SST_MODULE_STATE_LOADED,
	SST_MODULE_STATE_INITIALIZED,	/* and inactive */
	SST_MODULE_STATE_ACTIVE,
};

/*
 * Audio DSP Generic Module.
 *
 * Each Firmware file can consist of 1..N modules. A module can span multiple
 * ADSP memory blocks. The simplest FW will be a file with 1 module. A module
 * can be instantiated multiple times in the DSP.
 */
struct sst_module {
	struct sst_dsp *dsp;
	struct sst_fw *sst_fw;		/* parent FW we belong too */

	/* module configuration */
	u32 id;
	u32 entry;			/* module entry point */
	s32 offset;			/* module offset in firmware file */
	u32 size;			/* module size */
	u32 scratch_size;		/* global scratch memory required */
	u32 persistent_size;		/* private memory required */
	enum sst_mem_type type;		/* destination memory type */
	u32 data_offset;		/* offset in ADSP memory space */
	void *data;			/* module data */

	/* runtime */
	u32 usage_count;		/* can be unloaded if count == 0 */
	void *private;			/* core doesn't touch this */

	/* lists */
	struct list_head block_list;	/* Module list of blocks in use */
	struct list_head list;		/* DSP list of modules */
	struct list_head list_fw;	/* FW list of modules */
	struct list_head runtime_list;	/* list of runtime module objects*/

	/* state */
	enum sst_module_state state;
};

/*
 * SST Memory Block operations.
 */
struct sst_block_ops {
	int (*enable)(struct sst_mem_block *block);
	int (*disable)(struct sst_mem_block *block);
};

/*
 * SST Generic Memory Block.
 *
 * SST ADP  memory has multiple IRAM and DRAM blocks. Some ADSP blocks can be
 * power gated.
 */
struct sst_mem_block {
	struct sst_dsp *dsp;
	struct sst_module *module;	/* module that uses this block */

	/* block config */
	u32 offset;			/* offset from base */
	u32 size;			/* block size */
	u32 index;			/* block index 0..N */
	enum sst_mem_type type;		/* block memory type IRAM/DRAM */
	const struct sst_block_ops *ops;/* block operations, if any */

	/* block status */
	u32 bytes_used;			/* bytes in use by modules */
	void *private;			/* generic core does not touch this */
	int users;			/* number of modules using this block */

	/* block lists */
	struct list_head module_list;	/* Module list of blocks */
	struct list_head list;		/* Map list of free/used blocks */
};

/*
 * Generic SST Shim Interface.
 */
@@ -333,51 +164,4 @@ static inline void *sst_dsp_get_thread_context(struct sst_dsp *sst)
	return sst->thread_context;
}

/* Create/Free FW files - can contain multiple modules */
struct sst_fw *sst_fw_new(struct sst_dsp *dsp,
	const struct firmware *fw, void *private);
void sst_fw_free(struct sst_fw *sst_fw);
void sst_fw_free_all(struct sst_dsp *dsp);
int sst_fw_reload(struct sst_fw *sst_fw);
void sst_fw_unload(struct sst_fw *sst_fw);

/* Create/Free firmware modules */
struct sst_module *sst_module_new(struct sst_fw *sst_fw,
	struct sst_module_template *template, void *private);
void sst_module_free(struct sst_module *sst_module);
struct sst_module *sst_module_get_from_id(struct sst_dsp *dsp, u32 id);
int sst_module_alloc_blocks(struct sst_module *module);
int sst_module_free_blocks(struct sst_module *module);

/* Create/Free firmware module runtime instances */
struct sst_module_runtime *sst_module_runtime_new(struct sst_module *module,
	int id, void *private);
void sst_module_runtime_free(struct sst_module_runtime *runtime);
struct sst_module_runtime *sst_module_runtime_get_from_id(
	struct sst_module *module, u32 id);
int sst_module_runtime_alloc_blocks(struct sst_module_runtime *runtime,
	int offset);
int sst_module_runtime_free_blocks(struct sst_module_runtime *runtime);
int sst_module_runtime_save(struct sst_module_runtime *runtime,
	struct sst_module_runtime_context *context);
int sst_module_runtime_restore(struct sst_module_runtime *runtime,
	struct sst_module_runtime_context *context);

/* generic block allocation */
int sst_alloc_blocks(struct sst_dsp *dsp, struct sst_block_allocator *ba,
	struct list_head *block_list);
int sst_free_blocks(struct sst_dsp *dsp, struct list_head *block_list);

/* scratch allocation */
int sst_block_alloc_scratch(struct sst_dsp *dsp);
void sst_block_free_scratch(struct sst_dsp *dsp);

/* Register the DSPs memory blocks - would be nice to read from ACPI */
struct sst_mem_block *sst_mem_block_register(struct sst_dsp *dsp, u32 offset,
	u32 size, enum sst_mem_type type, const struct sst_block_ops *ops,
	u32 index, void *private);
void sst_mem_block_unregister_all(struct sst_dsp *dsp);

u32 sst_dsp_get_offset(struct sst_dsp *dsp, u32 offset,
	enum sst_mem_type type);
#endif
+0 −15
Original line number Diff line number Diff line
@@ -207,13 +207,6 @@ struct sst_pdata {
	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);
void sst_dsp_free(struct sst_dsp *sst);
#endif

/* SHIM Read / Write */
void sst_dsp_shim_write(struct sst_dsp *sst, u32 offset, u32 value);
u32 sst_dsp_shim_read(struct sst_dsp *sst, u32 offset);
@@ -255,14 +248,6 @@ int sst_dsp_wake(struct sst_dsp *sst);
void sst_dsp_sleep(struct sst_dsp *sst);
void sst_dsp_stall(struct sst_dsp *sst);

/* DMA */
int sst_dsp_dma_get_channel(struct sst_dsp *dsp, int chan_id);
void sst_dsp_dma_put_channel(struct sst_dsp *dsp);
int sst_dsp_dma_copyfrom(struct sst_dsp *sst, dma_addr_t dest_addr,
	dma_addr_t src_addr, size_t size);
int sst_dsp_dma_copyto(struct sst_dsp *sst, dma_addr_t dest_addr,
	dma_addr_t src_addr, size_t size);

/* Msg IO */
void sst_dsp_ipc_msg_tx(struct sst_dsp *dsp, u32 msg);
u32 sst_dsp_ipc_msg_rx(struct sst_dsp *dsp);
+0 −1273

File deleted.

Preview size limit exceeded, changes collapsed.