Skip to content

Commit ae0bc13

Browse files
brentlumwasko
authored andcommitted
intel: ssp: implement mclk always-on feature
In the earliest design, mclk is turned on in set_config() and never turned off. The behavior is modified in this commit: d5840a9 ("ssp: move mclk request/release to pre_start and post_stop") Now the mclk is enabled only during audio streaming so some codec may pop. This commit adds the always-on behavior back as an new feature. Signed-off-by: Brent Lu <brent.lu@intel.com> (cherry picked from commit 8dfc008)
1 parent 9cafa47 commit ae0bc13

5 files changed

Lines changed: 22 additions & 4 deletions

File tree

src/drivers/intel/ssp/ssp.c

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -712,6 +712,17 @@ static int ssp_set_config(struct dai *dai,
712712
ssp->state[DAI_DIR_CAPTURE] = COMP_STATE_PREPARE;
713713

714714
clk:
715+
/* MCLK always-on: turn on mclk and never turn it off */
716+
if (ssp->params.clks_control & SOF_DAI_INTEL_SSP_CLKCTRL_MCLK_AON) {
717+
ret = ssp_mclk_prepare_enable(dai);
718+
if (ret < 0)
719+
goto out;
720+
721+
ssp->clk_active |= SSP_CLK_MCLK_AON_REQ;
722+
723+
dai_info(dai, "ssp_set_config(): enable MCLK for SSP%d", dai->index);
724+
}
725+
715726
switch (config->flags & SOF_DAI_CONFIG_FLAGS_MASK) {
716727
case SOF_DAI_CONFIG_FLAGS_HW_PARAMS:
717728
if (ssp->params.clks_control & SOF_DAI_INTEL_SSP_CLKCTRL_MCLK_ES) {
@@ -811,7 +822,8 @@ static int ssp_pre_start(struct dai *dai)
811822
* We will test if mclk/bclk is configured in
812823
* ssp_mclk/bclk_prepare_enable/disable functions
813824
*/
814-
if (!(ssp->clk_active & SSP_CLK_MCLK_ES_REQ)) {
825+
if (!(ssp->clk_active & SSP_CLK_MCLK_ES_REQ) &&
826+
!(ssp->clk_active & SSP_CLK_MCLK_AON_REQ)) {
815827
/* MCLK config */
816828
ret = ssp_mclk_prepare_enable(dai);
817829
if (ret < 0)
@@ -841,7 +853,8 @@ static void ssp_post_stop(struct dai *dai)
841853
dai->index);
842854
ssp_bclk_disable_unprepare(dai);
843855
}
844-
if (!(ssp->clk_active & SSP_CLK_MCLK_ES_REQ)) {
856+
if (!(ssp->clk_active & SSP_CLK_MCLK_ES_REQ) &&
857+
!(ssp->clk_active & SSP_CLK_MCLK_AON_REQ)) {
845858
dai_info(dai, "ssp_post_stop releasing MCLK clocks for SSP%d...",
846859
dai->index);
847860
ssp_mclk_disable_unprepare(dai);

src/include/ipc/dai-intel.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,8 @@
6060
#define SOF_DAI_INTEL_SSP_CLKCTRL_MCLK_ES BIT(6)
6161
/* bclk early start */
6262
#define SOF_DAI_INTEL_SSP_CLKCTRL_BCLK_ES BIT(7)
63+
/* mclk always on */
64+
#define SOF_DAI_INTEL_SSP_CLKCTRL_MCLK_AON BIT(8)
6365

6466
/* DMIC max. four controllers for eight microphone channels */
6567
#define SOF_DAI_INTEL_DMIC_NUM_CTRL 4

src/include/kernel/abi.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@
2929

3030
/** \brief SOF ABI version major, minor and patch numbers */
3131
#define SOF_ABI_MAJOR 3
32-
#define SOF_ABI_MINOR 18
33-
#define SOF_ABI_PATCH 1
32+
#define SOF_ABI_MINOR 19
33+
#define SOF_ABI_PATCH 0
3434

3535
/** \brief SOF ABI version number. Format within 32bit word is MMmmmppp */
3636
#define SOF_ABI_MAJOR_SHIFT 24

src/include/sof/drivers/ssp.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,7 @@ extern const struct dai_driver ssp_driver;
228228
#define SSP_CLK_MCLK_ACTIVE BIT(1)
229229
#define SSP_CLK_BCLK_ES_REQ BIT(2)
230230
#define SSP_CLK_BCLK_ACTIVE BIT(3)
231+
#define SSP_CLK_MCLK_AON_REQ BIT(4)
231232

232233
/* SSP private data */
233234
struct ssp_pdata {

tools/topology/platform/common/ssp.m4

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ dnl SSP_CC_MCLK_ES 64 = (1 << 6)
3434
define(`SSP_CC_MCLK_ES', 64)
3535
dnl SSP_CC_BCLK_ES 128 = (1 << 7)
3636
define(`SSP_CC_BCLK_ES', 128)
37+
dnl SSP_CC_BCLK_ES 256 = (1 << 8)
38+
define(`SSP_CC_MCLK_AON', 256)
3739

3840
dnl SSP_CONFIG_DATA(type, idx, valid bits, mclk_id, quirks, bclk_delay,
3941
dnl clks_control, pulse_width, padding)

0 commit comments

Comments
 (0)