Skip to content

Commit c86b6b6

Browse files
authored
Merge pull request #162 from bkokoszx/ssp_clock_idle
drivers: apl-ssp: change clock idle state
2 parents d582a36 + 1d2c681 commit c86b6b6

2 files changed

Lines changed: 34 additions & 7 deletions

File tree

src/drivers/intel/cavs/ssp.c

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,7 @@ static inline int ssp_set_config(struct dai *dai,
165165
uint32_t active_rx_slots = 2;
166166
uint32_t sample_width = 2;
167167

168+
bool inverted_bclk = false;
168169
bool inverted_frame = false;
169170
bool cfs = false;
170171
bool start_delay = false;
@@ -260,18 +261,28 @@ static inline int ssp_set_config(struct dai *dai,
260261
inverted_frame = true; /* handled later with format */
261262
break;
262263
case SOF_DAI_FMT_IB_IF:
263-
sspsp |= SSPSP_SCMODE(2);
264+
inverted_bclk = true; /* handled later with bclk idle */
264265
inverted_frame = true; /* handled later with format */
265266
break;
266267
case SOF_DAI_FMT_IB_NF:
267-
sspsp |= SSPSP_SCMODE(2);
268+
inverted_bclk = true; /* handled later with bclk idle */
268269
break;
269270
default:
270271
trace_ssp_error("ec3");
271272
ret = -EINVAL;
272273
goto out;
273274
}
274275

276+
/* supporting bclk idle state */
277+
if (ssp->params.clks_control &
278+
SOF_DAI_INTEL_SSP_CLKCTRL_BCLK_IDLE_HIGH) {
279+
/* bclk idle state high */
280+
sspsp |= SSPSP_SCMODE((inverted_bclk ^ 0x3) & 0x3);
281+
} else {
282+
/* bclk idle state low */
283+
sspsp |= SSPSP_SCMODE(inverted_bclk);
284+
}
285+
275286
sscr0 |= SSCR0_MOD | SSCR0_ACS;
276287

277288
mdivc = mn_reg_read(0x0);

src/include/uapi/ipc.h

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
#define __INCLUDE_UAPI_IPC_H__
4141

4242
#include <uapi/abi.h>
43+
#include <sof/io.h>
4344

4445
/** \addtogroup sof_uapi uAPI
4546
* SOF uAPI specification.
@@ -249,6 +250,24 @@ struct sof_ipc_compound_hdr {
249250
#define SOF_DAI_INTEL_SSP_FRAME_PULSE_WIDTH_MAX 38
250251
#define SOF_DAI_INTEL_SSP_SLOT_PADDING_MAX 31
251252

253+
/* SSP clocks control settings
254+
*
255+
* Macros for clks_control field in sof_ipc_dai_ssp_params struct.
256+
*/
257+
258+
/* mclk 0 disable */
259+
#define SOF_DAI_INTEL_SSP_MCLK_0_DISABLE BIT(0)
260+
/* mclk 1 disable */
261+
#define SOF_DAI_INTEL_SSP_MCLK_1_DISABLE BIT(1)
262+
/* mclk keep active */
263+
#define SOF_DAI_INTEL_SSP_CLKCTRL_MCLK_KA BIT(2)
264+
/* bclk keep active */
265+
#define SOF_DAI_INTEL_SSP_CLKCTRL_BCLK_KA BIT(3)
266+
/* fs keep active */
267+
#define SOF_DAI_INTEL_SSP_CLKCTRL_FS_KA BIT(4)
268+
/* bclk idle */
269+
#define SOF_DAI_INTEL_SSP_CLKCTRL_BCLK_IDLE_HIGH BIT(5)
270+
252271
/** \brief Types of DAI */
253272
enum sof_ipc_dai_type {
254273
SOF_DAI_INTEL_NONE = 0, /**< None */
@@ -278,14 +297,11 @@ struct sof_ipc_dai_ssp_params {
278297

279298
/* MCLK */
280299
uint32_t mclk_direction;
281-
uint32_t mclk_keep_active;
282-
uint32_t bclk_keep_active;
283-
uint32_t fs_keep_active;
284300

285301
uint16_t frame_pulse_width;
286-
uint32_t quirks; // FIXME: is 32 bits enough ?
287-
288302
uint16_t tdm_per_slot_padding_flag;
303+
uint32_t clks_control;
304+
uint32_t quirks; // FIXME: is 32 bits enough ?
289305
/* private data, e.g. for quirks */
290306
//uint32_t pdata[10]; // FIXME: would really need ~16 u32
291307
} __attribute__((packed));

0 commit comments

Comments
 (0)