aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/intel/skylake
diff options
context:
space:
mode:
authorMark Brown <broonie@kernel.org>2019-07-06 12:25:26 +0100
committerMark Brown <broonie@kernel.org>2019-07-06 12:25:26 +0100
commit043b35f281f5f141e7a928d27492133ef33b8119 (patch)
tree30a9598866d6b8d44ee6b3fe88506881f23e0203 /sound/soc/intel/skylake
parentMerge branch 'asoc-5.2' into asoc-linus (diff)
parentASoC: SOF: Intel: implement runtime idle for CNL/APL (diff)
downloadlinux-dev-043b35f281f5f141e7a928d27492133ef33b8119.tar.xz
linux-dev-043b35f281f5f141e7a928d27492133ef33b8119.zip
Merge branch 'asoc-5.3' into asoc-next
Diffstat (limited to 'sound/soc/intel/skylake')
-rw-r--r--sound/soc/intel/skylake/cnl-sst.c2
-rw-r--r--sound/soc/intel/skylake/skl-debug.c9
-rw-r--r--sound/soc/intel/skylake/skl-messages.c39
-rw-r--r--sound/soc/intel/skylake/skl-pcm.c44
-rw-r--r--sound/soc/intel/skylake/skl-ssp-clk.c16
-rw-r--r--sound/soc/intel/skylake/skl-sst-dsp.h6
-rw-r--r--sound/soc/intel/skylake/skl-sst-ipc.c4
-rw-r--r--sound/soc/intel/skylake/skl-sst-utils.c23
-rw-r--r--sound/soc/intel/skylake/skl-sst.c4
-rw-r--r--sound/soc/intel/skylake/skl-topology.c72
-rw-r--r--sound/soc/intel/skylake/skl-topology.h8
-rw-r--r--sound/soc/intel/skylake/skl.c17
-rw-r--r--sound/soc/intel/skylake/skl.h5
13 files changed, 153 insertions, 96 deletions
diff --git a/sound/soc/intel/skylake/cnl-sst.c b/sound/soc/intel/skylake/cnl-sst.c
index d0dcf596c72c..f2c09fa6ea40 100644
--- a/sound/soc/intel/skylake/cnl-sst.c
+++ b/sound/soc/intel/skylake/cnl-sst.c
@@ -305,6 +305,7 @@ static irqreturn_t cnl_dsp_irq_thread_handler(int irq, void *context)
hipcida = sst_dsp_shim_read_unlocked(dsp, CNL_ADSP_REG_HIPCIDA);
hipctdr = sst_dsp_shim_read_unlocked(dsp, CNL_ADSP_REG_HIPCTDR);
+ hipctdd = sst_dsp_shim_read_unlocked(dsp, CNL_ADSP_REG_HIPCTDD);
/* reply message from dsp */
if (hipcida & CNL_ADSP_REG_HIPCIDA_DONE) {
@@ -324,7 +325,6 @@ static irqreturn_t cnl_dsp_irq_thread_handler(int irq, void *context)
/* new message from dsp */
if (hipctdr & CNL_ADSP_REG_HIPCTDR_BUSY) {
- hipctdd = sst_dsp_shim_read_unlocked(dsp, CNL_ADSP_REG_HIPCTDD);
header.primary = hipctdr;
header.extension = hipctdd;
dev_dbg(dsp->dev, "IPC irq: Firmware respond primary:%x",
diff --git a/sound/soc/intel/skylake/skl-debug.c b/sound/soc/intel/skylake/skl-debug.c
index 69cbe9eb026b..b9b4a72a4334 100644
--- a/sound/soc/intel/skylake/skl-debug.c
+++ b/sound/soc/intel/skylake/skl-debug.c
@@ -251,3 +251,12 @@ err:
debugfs_remove_recursive(d->fs);
return NULL;
}
+
+void skl_debugfs_exit(struct skl *skl)
+{
+ struct skl_debug *d = skl->debugfs;
+
+ debugfs_remove_recursive(d->fs);
+
+ d = NULL;
+}
diff --git a/sound/soc/intel/skylake/skl-messages.c b/sound/soc/intel/skylake/skl-messages.c
index a37d86e80008..febc070839e0 100644
--- a/sound/soc/intel/skylake/skl-messages.c
+++ b/sound/soc/intel/skylake/skl-messages.c
@@ -247,6 +247,22 @@ static const struct skl_dsp_ops dsp_ops[] = {
.init_fw = cnl_sst_init_fw,
.cleanup = cnl_sst_dsp_cleanup
},
+ {
+ .id = 0x02c8,
+ .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
+ },
+ {
+ .id = 0x06c8,
+ .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
+ },
};
const struct skl_dsp_ops *skl_get_dsp_ops(int pci_id)
@@ -1241,10 +1257,10 @@ int skl_create_pipeline(struct skl_sst *ctx, struct skl_pipe *pipe)
}
/*
- * A pipeline needs to be deleted on cleanup. If a pipeline is running, then
- * pause the pipeline first and then delete it
- * The pipe delete is done by sending delete pipeline IPC. DSP will stop the
- * DMA engines and releases resources
+ * A pipeline needs to be deleted on cleanup. If a pipeline is running,
+ * then pause it first. Before actual deletion, pipeline should enter
+ * reset state. Finish the procedure by sending delete pipeline IPC.
+ * DSP will stop the DMA engines and release resources
*/
int skl_delete_pipe(struct skl_sst *ctx, struct skl_pipe *pipe)
{
@@ -1252,6 +1268,10 @@ int skl_delete_pipe(struct skl_sst *ctx, struct skl_pipe *pipe)
dev_dbg(ctx->dev, "%s: pipe = %d\n", __func__, pipe->ppl_id);
+ /* If pipe was not created in FW, do not try to delete it */
+ if (pipe->state < SKL_PIPE_CREATED)
+ return 0;
+
/* If pipe is started, do stop the pipe in FW. */
if (pipe->state >= SKL_PIPE_STARTED) {
ret = skl_set_pipe_state(ctx, pipe, PPL_PAUSED);
@@ -1263,9 +1283,14 @@ int skl_delete_pipe(struct skl_sst *ctx, struct skl_pipe *pipe)
pipe->state = SKL_PIPE_PAUSED;
}
- /* If pipe was not created in FW, do not try to delete it */
- if (pipe->state < SKL_PIPE_CREATED)
- return 0;
+ /* reset pipe state before deletion */
+ ret = skl_set_pipe_state(ctx, pipe, PPL_RESET);
+ if (ret < 0) {
+ dev_err(ctx->dev, "Failed to reset pipe ret=%d\n", ret);
+ return ret;
+ }
+
+ pipe->state = SKL_PIPE_RESET;
ret = skl_ipc_delete_pipeline(&ctx->ipc, pipe->ppl_id);
if (ret < 0) {
diff --git a/sound/soc/intel/skylake/skl-pcm.c b/sound/soc/intel/skylake/skl-pcm.c
index 68ab978a8e13..760bbcf9a469 100644
--- a/sound/soc/intel/skylake/skl-pcm.c
+++ b/sound/soc/intel/skylake/skl-pcm.c
@@ -132,6 +132,7 @@ static void skl_set_suspend_active(struct snd_pcm_substream *substream,
int skl_pcm_host_dma_prepare(struct device *dev, struct skl_pipe_params *params)
{
struct hdac_bus *bus = dev_get_drvdata(dev);
+ struct skl *skl = bus_to_skl(bus);
unsigned int format_val;
struct hdac_stream *hstream;
struct hdac_ext_stream *stream;
@@ -156,7 +157,18 @@ int skl_pcm_host_dma_prepare(struct device *dev, struct skl_pipe_params *params)
if (err < 0)
return err;
- err = snd_hdac_stream_setup(hdac_stream(stream));
+ /*
+ * The recommended SDxFMT programming sequence for BXT
+ * platforms is to couple the stream before writing the format
+ */
+ if (IS_BXT(skl->pci)) {
+ snd_hdac_ext_stream_decouple(bus, stream, false);
+ err = snd_hdac_stream_setup(hdac_stream(stream));
+ snd_hdac_ext_stream_decouple(bus, stream, true);
+ } else {
+ err = snd_hdac_stream_setup(hdac_stream(stream));
+ }
+
if (err < 0)
return err;
@@ -1076,7 +1088,7 @@ static int skl_platform_open(struct snd_pcm_substream *substream)
struct snd_soc_dai_link *dai_link = rtd->dai_link;
dev_dbg(rtd->cpu_dai->dev, "In %s:%s\n", __func__,
- dai_link->cpu_dai_name);
+ dai_link->cpus->dai_name);
snd_soc_set_runtime_hwparams(substream, &azx_pcm_hw);
@@ -1310,12 +1322,12 @@ static int skl_get_module_info(struct skl *skl, struct skl_module_cfg *mconfig)
{
struct skl_sst *ctx = skl->skl_sst;
struct skl_module_inst_id *pin_id;
- uuid_le *uuid_mod, *uuid_tplg;
+ guid_t *uuid_mod, *uuid_tplg;
struct skl_module *skl_module;
struct uuid_module *module;
int i, ret = -EIO;
- uuid_mod = (uuid_le *)mconfig->guid;
+ uuid_mod = (guid_t *)mconfig->guid;
if (list_empty(&ctx->uuid_list)) {
dev_err(ctx->dev, "Module list is empty\n");
@@ -1323,7 +1335,7 @@ static int skl_get_module_info(struct skl *skl, struct skl_module_cfg *mconfig)
}
list_for_each_entry(module, &ctx->uuid_list, list) {
- if (uuid_le_cmp(*uuid_mod, module->uuid) == 0) {
+ if (guid_equal(uuid_mod, &module->uuid)) {
mconfig->id.module_id = module->id;
if (mconfig->module)
mconfig->module->loadable = module->is_loadable;
@@ -1340,7 +1352,7 @@ static int skl_get_module_info(struct skl *skl, struct skl_module_cfg *mconfig)
for (i = 0; i < skl->nr_modules; i++) {
skl_module = skl->modules[i];
uuid_tplg = &skl_module->uuid;
- if (!uuid_le_cmp(*uuid_mod, *uuid_tplg)) {
+ if (guid_equal(uuid_mod, uuid_tplg)) {
mconfig->module = skl_module;
ret = 0;
break;
@@ -1352,13 +1364,13 @@ static int skl_get_module_info(struct skl *skl, struct skl_module_cfg *mconfig)
list_for_each_entry(module, &ctx->uuid_list, list) {
for (i = 0; i < MAX_IN_QUEUE; i++) {
pin_id = &mconfig->m_in_pin[i].id;
- if (!uuid_le_cmp(pin_id->mod_uuid, module->uuid))
+ if (guid_equal(&pin_id->mod_uuid, &module->uuid))
pin_id->module_id = module->id;
}
for (i = 0; i < MAX_OUT_QUEUE; i++) {
pin_id = &mconfig->m_out_pin[i].id;
- if (!uuid_le_cmp(pin_id->mod_uuid, module->uuid))
+ if (guid_equal(&pin_id->mod_uuid, &module->uuid))
pin_id->module_id = module->id;
}
}
@@ -1418,11 +1430,6 @@ static int skl_platform_soc_probe(struct snd_soc_component *component)
if (!ops)
return -EIO;
- if (!skl->skl_sst->is_first_boot) {
- dev_err(component->dev, "DSP reports first boot done!!!\n");
- return -EIO;
- }
-
/*
* Disable dynamic clock and power gating during firmware
* and library download
@@ -1455,8 +1462,12 @@ static int skl_platform_soc_probe(struct snd_soc_component *component)
static void skl_pcm_remove(struct snd_soc_component *component)
{
- /* remove topology */
- snd_soc_tplg_component_remove(component, SND_SOC_TPLG_INDEX_ALL);
+ struct hdac_bus *bus = dev_get_drvdata(component->dev);
+ struct skl *skl = bus_to_skl(bus);
+
+ skl_tplg_exit(component, bus);
+
+ skl_debugfs_exit(skl);
}
static const struct snd_soc_component_driver skl_component = {
@@ -1477,9 +1488,6 @@ int skl_platform_register(struct device *dev)
struct hdac_bus *bus = dev_get_drvdata(dev);
struct skl *skl = bus_to_skl(bus);
- INIT_LIST_HEAD(&skl->ppl_list);
- INIT_LIST_HEAD(&skl->bind_list);
-
skl->dais = kmemdup(skl_platform_dai, sizeof(skl_platform_dai),
GFP_KERNEL);
if (!skl->dais) {
diff --git a/sound/soc/intel/skylake/skl-ssp-clk.c b/sound/soc/intel/skylake/skl-ssp-clk.c
index cda1b5fa7436..5bb6e40d4d3e 100644
--- a/sound/soc/intel/skylake/skl-ssp-clk.c
+++ b/sound/soc/intel/skylake/skl-ssp-clk.c
@@ -276,10 +276,8 @@ static void unregister_parent_src_clk(struct skl_clk_parent *pclk,
static void unregister_src_clk(struct skl_clk_data *dclk)
{
- u8 cnt = dclk->avail_clk_cnt;
-
- while (cnt--)
- clkdev_drop(dclk->clk[cnt]->lookup);
+ while (dclk->avail_clk_cnt--)
+ clkdev_drop(dclk->clk[dclk->avail_clk_cnt]->lookup);
}
static int skl_register_parent_clks(struct device *dev,
@@ -381,13 +379,13 @@ static int skl_clk_dev_probe(struct platform_device *pdev)
if (clks[i].rate_cfg[0].rate == 0)
continue;
- data->clk[i] = register_skl_clk(dev, &clks[i], clk_pdata, i);
- if (IS_ERR(data->clk[i])) {
- ret = PTR_ERR(data->clk[i]);
+ data->clk[data->avail_clk_cnt] = register_skl_clk(dev,
+ &clks[i], clk_pdata, i);
+
+ if (IS_ERR(data->clk[data->avail_clk_cnt])) {
+ ret = PTR_ERR(data->clk[data->avail_clk_cnt++]);
goto err_unreg_skl_clk;
}
-
- data->avail_clk_cnt++;
}
platform_set_drvdata(pdev, data);
diff --git a/sound/soc/intel/skylake/skl-sst-dsp.h b/sound/soc/intel/skylake/skl-sst-dsp.h
index 8ec494a214f1..a80219562036 100644
--- a/sound/soc/intel/skylake/skl-sst-dsp.h
+++ b/sound/soc/intel/skylake/skl-sst-dsp.h
@@ -169,7 +169,7 @@ struct skl_dsp_loader_ops {
#define MAX_INSTANCE_BUFF 2
struct uuid_module {
- uuid_le uuid;
+ guid_t uuid;
int id;
int is_loadable;
int max_instance;
@@ -233,8 +233,8 @@ void bxt_sst_dsp_cleanup(struct device *dev, struct skl_sst *ctx);
int snd_skl_parse_uuids(struct sst_dsp *ctx, const struct firmware *fw,
unsigned int offset, int index);
-int skl_get_pvt_id(struct skl_sst *ctx, uuid_le *uuid_mod, int instance_id);
-int skl_put_pvt_id(struct skl_sst *ctx, uuid_le *uuid_mod, int *pvt_id);
+int skl_get_pvt_id(struct skl_sst *ctx, guid_t *uuid_mod, int instance_id);
+int skl_put_pvt_id(struct skl_sst *ctx, guid_t *uuid_mod, int *pvt_id);
int skl_get_pvt_instance_id_map(struct skl_sst *ctx,
int module_id, int instance_id);
void skl_freeup_uuid_list(struct skl_sst *ctx);
diff --git a/sound/soc/intel/skylake/skl-sst-ipc.c b/sound/soc/intel/skylake/skl-sst-ipc.c
index 2e9d35e2766a..2cc8f7d2d319 100644
--- a/sound/soc/intel/skylake/skl-sst-ipc.c
+++ b/sound/soc/intel/skylake/skl-sst-ipc.c
@@ -336,6 +336,7 @@ static struct ipc_message *skl_ipc_reply_get_msg(struct sst_generic_ipc *ipc,
msg = list_first_entry(&ipc->rx_list, struct ipc_message, list);
+ list_del(&msg->list);
out:
return msg;
@@ -480,7 +481,6 @@ void skl_ipc_process_reply(struct sst_generic_ipc *ipc,
}
spin_lock_irqsave(&ipc->dsp->spinlock, flags);
- list_del(&msg->list);
sst_ipc_tx_msg_reply_complete(ipc, msg);
spin_unlock_irqrestore(&ipc->dsp->spinlock, flags);
}
@@ -503,6 +503,7 @@ irqreturn_t skl_dsp_irq_thread_handler(int irq, void *context)
hipcie = sst_dsp_shim_read_unlocked(dsp, SKL_ADSP_REG_HIPCIE);
hipct = sst_dsp_shim_read_unlocked(dsp, SKL_ADSP_REG_HIPCT);
+ hipcte = sst_dsp_shim_read_unlocked(dsp, SKL_ADSP_REG_HIPCTE);
/* reply message from DSP */
if (hipcie & SKL_ADSP_REG_HIPCIE_DONE) {
@@ -522,7 +523,6 @@ irqreturn_t skl_dsp_irq_thread_handler(int irq, void *context)
/* New message from DSP */
if (hipct & SKL_ADSP_REG_HIPCT_BUSY) {
- hipcte = sst_dsp_shim_read_unlocked(dsp, SKL_ADSP_REG_HIPCTE);
header.primary = hipct;
header.extension = hipcte;
dev_dbg(dsp->dev, "IPC irq: Firmware respond primary:%x\n",
diff --git a/sound/soc/intel/skylake/skl-sst-utils.c b/sound/soc/intel/skylake/skl-sst-utils.c
index cf442d96a54a..928c677b506c 100644
--- a/sound/soc/intel/skylake/skl-sst-utils.c
+++ b/sound/soc/intel/skylake/skl-sst-utils.c
@@ -13,17 +13,11 @@
#include "../common/sst-dsp-priv.h"
#include "skl-sst-ipc.h"
-
-#define UUID_STR_SIZE 37
#define DEFAULT_HASH_SHA256_LEN 32
/* FW Extended Manifest Header id = $AE1 */
#define SKL_EXT_MANIFEST_HEADER_MAGIC 0x31454124
-struct UUID {
- u8 id[16];
-};
-
union seg_flags {
u32 ul;
struct {
@@ -57,7 +51,7 @@ struct module_type {
struct adsp_module_entry {
u32 struct_id;
u8 name[8];
- struct UUID uuid;
+ u8 uuid[16];
struct module_type type;
u8 hash1[DEFAULT_HASH_SHA256_LEN];
u32 entry_point;
@@ -176,13 +170,13 @@ static inline int skl_pvtid_128(struct uuid_module *module)
* This generates a 128 bit private unique id for a module TYPE so that
* module instance is unique
*/
-int skl_get_pvt_id(struct skl_sst *ctx, uuid_le *uuid_mod, int instance_id)
+int skl_get_pvt_id(struct skl_sst *ctx, guid_t *uuid_mod, int instance_id)
{
struct uuid_module *module;
int pvt_id;
list_for_each_entry(module, &ctx->uuid_list, list) {
- if (uuid_le_cmp(*uuid_mod, module->uuid) == 0) {
+ if (guid_equal(uuid_mod, &module->uuid)) {
pvt_id = skl_pvtid_128(module);
if (pvt_id >= 0) {
@@ -206,13 +200,13 @@ EXPORT_SYMBOL_GPL(skl_get_pvt_id);
*
* This frees a 128 bit private unique id previously generated
*/
-int skl_put_pvt_id(struct skl_sst *ctx, uuid_le *uuid_mod, int *pvt_id)
+int skl_put_pvt_id(struct skl_sst *ctx, guid_t *uuid_mod, int *pvt_id)
{
int i;
struct uuid_module *module;
list_for_each_entry(module, &ctx->uuid_list, list) {
- if (uuid_le_cmp(*uuid_mod, module->uuid) == 0) {
+ if (guid_equal(uuid_mod, &module->uuid)) {
if (*pvt_id != 0)
i = (*pvt_id) / 64;
@@ -239,7 +233,6 @@ int snd_skl_parse_uuids(struct sst_dsp *ctx, const struct firmware *fw,
struct adsp_fw_hdr *adsp_hdr;
struct adsp_module_entry *mod_entry;
int i, num_entry, size;
- uuid_le *uuid_bin;
const char *buf;
struct skl_sst *skl = ctx->thread_context;
struct uuid_module *module;
@@ -271,8 +264,7 @@ int snd_skl_parse_uuids(struct sst_dsp *ctx, const struct firmware *fw,
return -EINVAL;
}
- mod_entry = (struct adsp_module_entry *)
- (buf + offset + adsp_hdr->len);
+ mod_entry = (struct adsp_module_entry *)(buf + offset + adsp_hdr->len);
num_entry = adsp_hdr->num_modules;
@@ -299,8 +291,7 @@ int snd_skl_parse_uuids(struct sst_dsp *ctx, const struct firmware *fw,
goto free_uuid_list;
}
- uuid_bin = (uuid_le *)mod_entry->uuid.id;
- memcpy(&module->uuid, uuid_bin, sizeof(module->uuid));
+ guid_copy(&module->uuid, (guid_t *)&mod_entry->uuid);
module->id = (i | (index << 12));
module->is_loadable = mod_entry->type.load_type;
diff --git a/sound/soc/intel/skylake/skl-sst.c b/sound/soc/intel/skylake/skl-sst.c
index 8369585174ac..70c3a604c381 100644
--- a/sound/soc/intel/skylake/skl-sst.c
+++ b/sound/soc/intel/skylake/skl-sst.c
@@ -412,11 +412,9 @@ static int skl_load_module(struct sst_dsp *ctx, u16 mod_id, u8 *guid)
struct skl_module_table *module_entry = NULL;
int ret = 0;
char mod_name[64]; /* guid str = 32 chars + 4 hyphens */
- uuid_le *uuid_mod;
- uuid_mod = (uuid_le *)guid;
snprintf(mod_name, sizeof(mod_name), "%s%pUL%s",
- "intel/dsp_fw_", uuid_mod, ".bin");
+ "intel/dsp_fw_", guid, ".bin");
module_entry = skl_module_get_from_id(ctx, mod_id);
if (module_entry == NULL) {
diff --git a/sound/soc/intel/skylake/skl-topology.c b/sound/soc/intel/skylake/skl-topology.c
index bc897ec5c961..6241e35213af 100644
--- a/sound/soc/intel/skylake/skl-topology.c
+++ b/sound/soc/intel/skylake/skl-topology.c
@@ -572,7 +572,7 @@ skl_tplg_init_pipe_modules(struct skl *skl, struct skl_pipe *pipe)
int ret = 0;
list_for_each_entry(w_module, &pipe->w_list, node) {
- uuid_le *uuid_mod;
+ guid_t *uuid_mod;
w = w_module->w;
mconfig = w->priv;
@@ -580,7 +580,7 @@ skl_tplg_init_pipe_modules(struct skl *skl, struct skl_pipe *pipe)
if (mconfig->id.module_id < 0) {
dev_err(skl->skl_sst->dev,
"module %pUL id not populated\n",
- (uuid_le *)mconfig->guid);
+ (guid_t *)mconfig->guid);
return -EIO;
}
@@ -614,7 +614,7 @@ skl_tplg_init_pipe_modules(struct skl *skl, struct skl_pipe *pipe)
* FE/BE params
*/
skl_tplg_update_module_params(w, ctx);
- uuid_mod = (uuid_le *)mconfig->guid;
+ uuid_mod = (guid_t *)mconfig->guid;
mconfig->id.pvt_id = skl_get_pvt_id(ctx, uuid_mod,
mconfig->id.instance_id);
if (mconfig->id.pvt_id < 0)
@@ -653,9 +653,9 @@ static int skl_tplg_unload_pipe_modules(struct skl_sst *ctx,
struct skl_module_cfg *mconfig = NULL;
list_for_each_entry(w_module, &pipe->w_list, node) {
- uuid_le *uuid_mod;
+ guid_t *uuid_mod;
mconfig = w_module->w->priv;
- uuid_mod = (uuid_le *)mconfig->guid;
+ uuid_mod = (guid_t *)mconfig->guid;
if (mconfig->module->loadable && ctx->dsp->fw_ops.unload_mod &&
mconfig->m_state > SKL_MODULE_UNINIT) {
@@ -910,12 +910,12 @@ static int skl_tplg_set_module_bind_params(struct snd_soc_dapm_widget *w,
return 0;
}
-static int skl_get_module_id(struct skl_sst *ctx, uuid_le *uuid)
+static int skl_get_module_id(struct skl_sst *ctx, guid_t *uuid)
{
struct uuid_module *module;
list_for_each_entry(module, &ctx->uuid_list, list) {
- if (uuid_le_cmp(*uuid, module->uuid) == 0)
+ if (guid_equal(uuid, &module->uuid))
return module->id;
}
@@ -933,9 +933,7 @@ static int skl_tplg_find_moduleid_from_uuid(struct skl *skl,
if (bc->set_params == SKL_PARAM_BIND && bc->max) {
uuid_params = (struct skl_kpb_params *)bc->params;
- size = uuid_params->num_modules *
- sizeof(struct skl_mod_inst_map) +
- sizeof(uuid_params->num_modules);
+ size = struct_size(params, u.map, uuid_params->num_modules);
params = devm_kzalloc(bus->dev, size, GFP_KERNEL);
if (!params)
@@ -1486,22 +1484,18 @@ static int skl_tplg_tlv_control_set(struct snd_kcontrol *kcontrol,
struct skl *skl = get_skl_ctx(w->dapm->dev);
if (ac->params) {
+ /*
+ * Widget data is expected to be stripped of T and L
+ */
+ size -= 2 * sizeof(unsigned int);
+ data += 2;
+
if (size > ac->max)
return -EINVAL;
-
ac->size = size;
- /*
- * if the param_is is of type Vendor, firmware expects actual
- * parameter id and size from the control.
- */
- if (ac->param_id == SKL_PARAM_VENDOR_ID) {
- if (copy_from_user(ac->params, data, size))
- return -EFAULT;
- } else {
- if (copy_from_user(ac->params,
- data + 2, size))
- return -EFAULT;
- }
+
+ if (copy_from_user(ac->params, data, size))
+ return -EFAULT;
if (w->power)
return skl_set_module_params(skl->skl_sst,
@@ -2115,11 +2109,11 @@ static int skl_tplg_add_pipe(struct device *dev,
return 0;
}
-static int skl_tplg_get_uuid(struct device *dev, u8 *guid,
+static int skl_tplg_get_uuid(struct device *dev, guid_t *guid,
struct snd_soc_tplg_vendor_uuid_elem *uuid_tkn)
{
if (uuid_tkn->token == SKL_TKN_UUID) {
- memcpy(guid, &uuid_tkn->uuid, 16);
+ guid_copy(guid, (guid_t *)&uuid_tkn->uuid);
return 0;
}
@@ -2145,7 +2139,7 @@ static int skl_tplg_fill_pin(struct device *dev,
break;
case SKL_TKN_UUID:
- ret = skl_tplg_get_uuid(dev, m_pin[pin_index].id.mod_uuid.b,
+ ret = skl_tplg_get_uuid(dev, &m_pin[pin_index].id.mod_uuid,
(struct snd_soc_tplg_vendor_uuid_elem *)tkn_elem);
if (ret < 0)
return ret;
@@ -2661,7 +2655,7 @@ static int skl_tplg_get_tokens(struct device *dev,
case SND_SOC_TPLG_TUPLE_TYPE_UUID:
if (is_module_guid) {
- ret = skl_tplg_get_uuid(dev, mconfig->guid,
+ ret = skl_tplg_get_uuid(dev, (guid_t *)mconfig->guid,
array->uuid);
is_module_guid = false;
} else {
@@ -3307,7 +3301,7 @@ static int skl_tplg_get_int_tkn(struct device *dev,
struct snd_soc_tplg_vendor_value_elem *tkn_elem,
struct skl *skl)
{
- int tkn_count = 0, ret, size;
+ int tkn_count = 0, ret;
static int mod_idx, res_val_idx, intf_val_idx, dir, pin_idx;
struct skl_module_res *res = NULL;
struct skl_module_iface *fmt = NULL;
@@ -3315,6 +3309,7 @@ static int skl_tplg_get_int_tkn(struct device *dev,
static struct skl_astate_param *astate_table;
static int astate_cfg_idx, count;
int i;
+ size_t size;
if (skl->modules) {
mod = skl->modules[mod_idx];
@@ -3358,8 +3353,8 @@ static int skl_tplg_get_int_tkn(struct device *dev,
return -EINVAL;
}
- size = tkn_elem->value * sizeof(struct skl_astate_param) +
- sizeof(count);
+ size = struct_size(skl->cfg.astate_cfg, astate_table,
+ tkn_elem->value);
skl->cfg.astate_cfg = devm_kzalloc(dev, size, GFP_KERNEL);
if (!skl->cfg.astate_cfg)
return -ENOMEM;
@@ -3479,7 +3474,7 @@ static int skl_tplg_get_manifest_uuid(struct device *dev,
if (uuid_tkn->token == SKL_TKN_UUID) {
mod = skl->modules[ref_count];
- memcpy(&mod->uuid, &uuid_tkn->uuid, sizeof(uuid_tkn->uuid));
+ guid_copy(&mod->uuid, (guid_t *)&uuid_tkn->uuid);
ref_count++;
} else {
dev_err(dev, "Not an UUID token tkn %d\n", uuid_tkn->token);
@@ -3750,3 +3745,18 @@ int skl_tplg_init(struct snd_soc_component *component, struct hdac_bus *bus)
return 0;
}
+
+void skl_tplg_exit(struct snd_soc_component *component, struct hdac_bus *bus)
+{
+ struct skl *skl = bus_to_skl(bus);
+ struct skl_pipeline *ppl, *tmp;
+
+ if (!list_empty(&skl->ppl_list))
+ list_for_each_entry_safe(ppl, tmp, &skl->ppl_list, node)
+ list_del(&ppl->node);
+
+ /* clean up topology */
+ snd_soc_tplg_component_remove(component, SND_SOC_TPLG_INDEX_ALL);
+
+ release_firmware(skl->tplg);
+}
diff --git a/sound/soc/intel/skylake/skl-topology.h b/sound/soc/intel/skylake/skl-topology.h
index b66e3a728853..665e35cee50d 100644
--- a/sound/soc/intel/skylake/skl-topology.h
+++ b/sound/soc/intel/skylake/skl-topology.h
@@ -215,7 +215,7 @@ struct skl_mod_inst_map {
struct skl_uuid_inst_map {
u16 inst_id;
u16 reserved;
- uuid_le mod_uuid;
+ guid_t mod_uuid;
} __packed;
struct skl_kpb_params {
@@ -227,7 +227,7 @@ struct skl_kpb_params {
};
struct skl_module_inst_id {
- uuid_le mod_uuid;
+ guid_t mod_uuid;
int module_id;
u32 instance_id;
int pvt_id;
@@ -360,7 +360,7 @@ struct skl_module_res {
};
struct skl_module {
- uuid_le uuid;
+ guid_t uuid;
u8 loadable;
u8 input_pin_type;
u8 output_pin_type;
@@ -462,6 +462,8 @@ void skl_tplg_set_be_dmic_config(struct snd_soc_dai *dai,
struct skl_pipe_params *params, int stream);
int skl_tplg_init(struct snd_soc_component *component,
struct hdac_bus *ebus);
+void skl_tplg_exit(struct snd_soc_component *component,
+ struct hdac_bus *bus);
struct skl_module_cfg *skl_tplg_fe_get_cpr_module(
struct snd_soc_dai *dai, int stream);
int skl_tplg_update_pipe_params(struct device *dev,
diff --git a/sound/soc/intel/skylake/skl.c b/sound/soc/intel/skylake/skl.c
index 91e5a7753eba..3362e71b4563 100644
--- a/sound/soc/intel/skylake/skl.c
+++ b/sound/soc/intel/skylake/skl.c
@@ -450,7 +450,6 @@ static int skl_free(struct hdac_bus *bus)
snd_hdac_ext_bus_exit(bus);
- cancel_work_sync(&skl->probe_work);
if (IS_ENABLED(CONFIG_SND_SOC_HDAC_HDMI)) {
snd_hdac_display_power(bus, HDA_CODEC_IDX_CONTROLLER, false);
snd_hdac_i915_exit(bus);
@@ -879,6 +878,9 @@ static int skl_create(struct pci_dev *pci,
hbus = skl_to_hbus(skl);
bus = skl_to_bus(skl);
+ INIT_LIST_HEAD(&skl->ppl_list);
+ INIT_LIST_HEAD(&skl->bind_list);
+
#if IS_ENABLED(CONFIG_SND_SOC_INTEL_SKYLAKE_HDAUDIO_CODEC)
ext_ops = snd_soc_hdac_hda_get_ops();
#endif
@@ -1129,14 +1131,13 @@ static void skl_remove(struct pci_dev *pci)
struct hdac_bus *bus = pci_get_drvdata(pci);
struct skl *skl = bus_to_skl(bus);
- release_firmware(skl->tplg);
+ cancel_work_sync(&skl->probe_work);
pm_runtime_get_noresume(&pci->dev);
/* codec removal, invoke bus_device_remove */
snd_hdac_ext_bus_device_remove(bus);
- skl->debugfs = NULL;
skl_platform_unregister(&pci->dev);
skl_free_dsp(skl);
skl_machine_device_unregister(skl);
@@ -1180,6 +1181,16 @@ static const struct pci_device_id skl_ids[] = {
{ PCI_DEVICE(0x8086, 0xa348),
.driver_data = (unsigned long)&snd_soc_acpi_intel_cnl_machines},
#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},
+#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},
+#endif
{ 0, }
};
MODULE_DEVICE_TABLE(pci, skl_ids);
diff --git a/sound/soc/intel/skylake/skl.h b/sound/soc/intel/skylake/skl.h
index 4e571562261a..6070666a6392 100644
--- a/sound/soc/intel/skylake/skl.h
+++ b/sound/soc/intel/skylake/skl.h
@@ -156,6 +156,7 @@ struct skl_module_cfg;
#ifdef CONFIG_DEBUG_FS
struct skl_debug *skl_debugfs_init(struct skl *skl);
+void skl_debugfs_exit(struct skl *skl);
void skl_debug_init_module(struct skl_debug *d,
struct snd_soc_dapm_widget *w,
struct skl_module_cfg *mconfig);
@@ -164,6 +165,10 @@ static inline struct skl_debug *skl_debugfs_init(struct skl *skl)
{
return NULL;
}
+
+static inline void skl_debugfs_exit(struct skl *skl)
+{}
+
static inline void skl_debug_init_module(struct skl_debug *d,
struct snd_soc_dapm_widget *w,
struct skl_module_cfg *mconfig)