Skip to content
Closed
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
17 changes: 17 additions & 0 deletions src/drivers/intel/ssp/ssp.c
Original file line number Diff line number Diff line change
Expand Up @@ -645,6 +645,11 @@ static int ssp_set_config(struct dai *dai,
ssp->state[DAI_DIR_CAPTURE] = COMP_STATE_PREPARE;

out:
ssp->mdivc = mn_reg_read(MN_MDIVCTRL, 0);
mn_reg_write(MN_MDIVCTRL, 0, 0);

pm_runtime_put_sync(SSP_POW, dai->index);

platform_shared_commit(ssp, sizeof(*ssp));

spin_unlock(&dai->lock);
Expand Down Expand Up @@ -691,6 +696,10 @@ static void ssp_start(struct dai *dai, int direction)

spin_lock(&dai->lock);

pm_runtime_get_sync(SSP_POW, dai->index);

mn_reg_write(MN_MDIVCTRL, 0, ssp->mdivc);

/* enable port */
ssp_update_bits(dai, SSCR0, SSCR0_SSE, SSCR0_SSE);
ssp->state[direction] = COMP_STATE_ACTIVE;
Expand Down Expand Up @@ -754,6 +763,8 @@ static void ssp_stop(struct dai *dai, int direction)
if (ssp->state[SOF_IPC_STREAM_CAPTURE] == COMP_STATE_PREPARE &&
ssp->state[SOF_IPC_STREAM_PLAYBACK] == COMP_STATE_PREPARE) {
ssp_update_bits(dai, SSCR0, SSCR0_SSE, 0);
mn_reg_write(MN_MDIVCTRL, 0, 0);

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.

useful to have an inline comment here stating we are powering off.

pm_runtime_put_sync(SSP_POW, dai->index);
dai_info(dai, "ssp_stop(), SSP port disabled");
}

Expand All @@ -770,6 +781,12 @@ static void ssp_pause(struct dai *dai, int direction)
dai_info(dai, "ssp_pause(), TX");

ssp->state[direction] = COMP_STATE_PAUSED;

if (ssp->state[SOF_IPC_STREAM_CAPTURE] == COMP_STATE_PAUSED &&
ssp->state[SOF_IPC_STREAM_PLAYBACK] == COMP_STATE_PAUSED) {
mn_reg_write(MN_MDIVCTRL, 0, 0);

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.

ditto for comment here too, this way its obvious to everyone.

pm_runtime_put_sync(SSP_POW, dai->index);
}
}

static int ssp_trigger(struct dai *dai, int cmd, int direction)
Expand Down
1 change: 1 addition & 0 deletions src/include/sof/drivers/ssp.h
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,7 @@ struct ssp_pdata {
uint32_t sscr1;
uint32_t psp;
uint32_t state[2]; /* SSP_STATE_ for each direction */
uint32_t mdivc;
struct sof_ipc_dai_config config;
struct sof_ipc_dai_ssp_params params;
};
Expand Down