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/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -316,6 +316,7 @@ int snd_sof_device_probe(struct device *dev, struct snd_sof_pdata *plat_data)
INIT_LIST_HEAD(&sdev->route_list);
spin_lock_init(&sdev->ipc_lock);
spin_lock_init(&sdev->hw_lock);
mutex_init(&sdev->power_state_access);

if (IS_ENABLED(CONFIG_SND_SOC_SOF_PROBE_WORK_QUEUE))
INIT_WORK(&sdev->probe_work, sof_probe_work);
Expand Down
11 changes: 8 additions & 3 deletions sound/soc/sof/ops.h
Original file line number Diff line number Diff line change
Expand Up @@ -220,11 +220,16 @@ static inline int
snd_sof_dsp_set_power_state(struct snd_sof_dev *sdev,
const struct sof_dsp_power_state *target_state)
{
int ret = 0;

mutex_lock(&sdev->power_state_access);

if (sof_ops(sdev)->set_power_state)
return sof_ops(sdev)->set_power_state(sdev, target_state);
ret = sof_ops(sdev)->set_power_state(sdev, target_state);

/* D0 substate is not supported, do nothing here. */
return 0;
mutex_unlock(&sdev->power_state_access);

return ret;
Comment thread
kv2019i marked this conversation as resolved.
Resolved
}

/* debug */
Expand Down
2 changes: 2 additions & 0 deletions sound/soc/sof/sof-priv.h
Original file line number Diff line number Diff line change
Expand Up @@ -375,6 +375,8 @@ struct snd_sof_dev {

/* current DSP power state */
struct sof_dsp_power_state dsp_power_state;
/* mutex to protect the dsp_power_state access */
struct mutex power_state_access;

/* Intended power target of system suspend */
enum sof_system_suspend_state system_suspend_target;
Expand Down