Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions sound/soc/sof/intel/apl.c
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ EXPORT_SYMBOL(sof_apl_ops);
const struct sof_intel_dsp_desc apl_chip_info = {
/* Apollolake */
.cores_num = 2,
.init_core_mask = 1,
.cores_mask = HDA_DSP_CORE_MASK(0) | HDA_DSP_CORE_MASK(1),
.ipc_req = HDA_DSP_REG_HIPCI,
.ipc_req_mask = HDA_DSP_REG_HIPCI_BUSY,
Expand Down
3 changes: 2 additions & 1 deletion sound/soc/sof/intel/bdw.c
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,8 @@ static int bdw_run(struct snd_sof_dev *sdev)
snd_sof_dsp_update_bits_unlocked(sdev, BDW_DSP_BAR, SHIM_CSR,
SHIM_CSR_STALL, 0x0);

return 0;
/* return init core mask */
return 1;
}

static int bdw_reset(struct snd_sof_dev *sdev)
Expand Down
3 changes: 2 additions & 1 deletion sound/soc/sof/intel/byt.c
Original file line number Diff line number Diff line change
Expand Up @@ -463,7 +463,8 @@ static int byt_run(struct snd_sof_dev *sdev)
return -ENODEV;
}

return 0;
/* return init core mask */
return 1;
}

static int byt_reset(struct snd_sof_dev *sdev)
Expand Down
1 change: 1 addition & 0 deletions sound/soc/sof/intel/cnl.c
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,7 @@ EXPORT_SYMBOL(sof_cnl_ops);
const struct sof_intel_dsp_desc cnl_chip_info = {
/* Cannonlake */
.cores_num = 4,
.init_core_mask = 1,
.cores_mask = HDA_DSP_CORE_MASK(0) |
HDA_DSP_CORE_MASK(1) |
HDA_DSP_CORE_MASK(2) |
Expand Down
11 changes: 9 additions & 2 deletions sound/soc/sof/intel/hda-loader.c
Original file line number Diff line number Diff line change
Expand Up @@ -248,10 +248,14 @@ static int cl_copy_fw(struct snd_sof_dev *sdev, struct hdac_ext_stream *stream)
int hda_dsp_cl_boot_firmware(struct snd_sof_dev *sdev)
{
struct snd_sof_pdata *plat_data = sdev->pdata;
const struct sof_dev_desc *desc = plat_data->desc;
const struct sof_intel_dsp_desc *chip_info;
struct hdac_ext_stream *stream;
struct firmware stripped_firmware;
int ret, ret1, tag, i;

chip_info = (struct sof_intel_dsp_desc *)desc->chip_info;

stripped_firmware.data = plat_data->fw->data;
stripped_firmware.size = plat_data->fw->size;

Expand Down Expand Up @@ -329,9 +333,12 @@ int hda_dsp_cl_boot_firmware(struct snd_sof_dev *sdev)
ret = ret1;
}

/* return if both copying fw and stream clean up are successful */
/*
* return master core id if both fw copy
* and stream clean up are successful
*/
if (!ret)
return ret;
return chip_info->init_core_mask;

/* dump dsp registers and disable DSP upon error */
err:
Expand Down
3 changes: 2 additions & 1 deletion sound/soc/sof/intel/hsw.c
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,8 @@ static int hsw_run(struct snd_sof_dev *sdev)
snd_sof_dsp_update_bits_unlocked(sdev, HSW_DSP_BAR, SHIM_CSR,
SHIM_CSR_STALL, 0x0);

return 0; //TODO: Fix return value
/* return init core mask */
return 1;
}

static int hsw_reset(struct snd_sof_dev *sdev)
Expand Down
1 change: 1 addition & 0 deletions sound/soc/sof/intel/shim.h
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,7 @@
struct sof_intel_dsp_desc {
int cores_num;
int cores_mask;
int init_core_mask; /* cores available after fw boot */
int ipc_req;
int ipc_req_mask;
int ipc_ack;
Expand Down
1 change: 1 addition & 0 deletions sound/soc/sof/intel/skl.c
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ EXPORT_SYMBOL(sof_skl_ops);
const struct sof_intel_dsp_desc skl_chip_info = {
/* Apollolake */
.cores_num = 2,
.init_core_mask = 1,
.cores_mask = HDA_DSP_CORE_MASK(0) | HDA_DSP_CORE_MASK(1),
.ipc_req = HDA_DSP_REG_HIPCI,
.ipc_req_mask = HDA_DSP_REG_HIPCI_BUSY,
Expand Down
6 changes: 6 additions & 0 deletions sound/soc/sof/loader.c
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,7 @@ EXPORT_SYMBOL(snd_sof_load_firmware);
int snd_sof_run_firmware(struct snd_sof_dev *sdev)
{
int ret;
int init_core_mask;

init_waitqueue_head(&sdev->boot_wait);
sdev->boot_complete = false;
Expand Down Expand Up @@ -333,6 +334,8 @@ int snd_sof_run_firmware(struct snd_sof_dev *sdev)
return ret;
}

init_core_mask = ret;

/* now wait for the DSP to boot */
ret = wait_event_timeout(sdev->boot_wait, sdev->boot_complete,
msecs_to_jiffies(sdev->boot_timeout));
Expand All @@ -352,6 +355,9 @@ int snd_sof_run_firmware(struct snd_sof_dev *sdev)
return ret;
}

/* fw boot is complete. Update the active cores mask */
sdev->enabled_cores_mask = init_core_mask;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is changed in the next patch, so could we squash this into the next patch and only add the definitions for active core mask in this patch, and make use of it in the next?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@plbossart fixed now

return 0;
}
EXPORT_SYMBOL(snd_sof_run_firmware);
Expand Down
5 changes: 5 additions & 0 deletions sound/soc/sof/ops.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,11 @@ static inline int snd_sof_remove(struct snd_sof_dev *sdev)
}

/* control */

/*
* snd_sof_dsp_run returns the core mask of the cores that are available
* after successful fw boot
*/
static inline int snd_sof_dsp_run(struct snd_sof_dev *sdev)
{
if (sof_ops(sdev)->run)
Expand Down
1 change: 1 addition & 0 deletions sound/soc/sof/sof-priv.h
Original file line number Diff line number Diff line change
Expand Up @@ -392,6 +392,7 @@ struct snd_sof_dev {
struct list_head dai_list;
struct list_head route_list;
struct snd_soc_component *component;
u32 enabled_cores_mask; /* keep track of enabled cores */

/* FW configuration */
struct sof_ipc_dma_buffer_data *info_buffer;
Expand Down
9 changes: 8 additions & 1 deletion sound/soc/sof/topology.c
Original file line number Diff line number Diff line change
Expand Up @@ -1110,12 +1110,15 @@ int sof_load_pipeline_ipc(struct snd_sof_dev *sdev,
return ret;
}

/* update enabled cores mask */
sdev->enabled_cores_mask |= 1 << pipeline->core;

/*
* Now notify DSP that the core that this pipeline is scheduled on
* has been powered up
*/
memset(&pm_core_config, 0, sizeof(pm_core_config));
pm_core_config.enable_mask = 1 << pipeline->core;
pm_core_config.enable_mask = sdev->enabled_cores_mask;

/* configure CORE_ENABLE ipc message */
pm_core_config.hdr.size = sizeof(pm_core_config);
Expand Down Expand Up @@ -1842,6 +1845,10 @@ static int sof_widget_unload(struct snd_soc_component *scomp,
if (ret < 0)
dev_err(sdev->dev, "error: powering down pipeline schedule core %d\n",
pipeline->core);

/* update enabled cores mask */
sdev->enabled_cores_mask &= ~(1 << pipeline->core);

break;
case snd_soc_dapm_pga:

Expand Down