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
6 changes: 4 additions & 2 deletions src/include/sof/wait.h
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,8 @@ static inline void wait_delay(uint64_t number_of_clks)

static inline int poll_for_completion_delay(completion_t *comp, uint64_t us)
{
uint64_t tick = clock_ms_to_ticks(CLK_CPU, 1) * us / 1000;
uint64_t tick = clock_ms_to_ticks(PLATFORM_DEFAULT_CLOCK, 1) *
us / 1000;
uint32_t tries = DEFAULT_TRY_TIMES;
uint64_t delta = tick / tries;

Expand All @@ -191,7 +192,8 @@ static inline int poll_for_register_delay(uint32_t reg,
uint32_t mask,
uint32_t val, uint64_t us)
{
uint64_t tick = clock_ms_to_ticks(CLK_CPU, 1) * us / 1000;
uint64_t tick = clock_ms_to_ticks(PLATFORM_DEFAULT_CLOCK, 1) *
us / 1000;
uint32_t tries = DEFAULT_TRY_TIMES;
uint64_t delta = tick / tries;

Expand Down
20 changes: 6 additions & 14 deletions src/ipc/pmc-ipc.c
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ static void irq_handler(void *arg)
int ipc_pmc_send_msg(uint32_t message)
{
uint32_t ipclpesch;
int try = 0;
int ret;

trace_ipc("SMs");

Expand All @@ -142,21 +142,13 @@ int ipc_pmc_send_msg(uint32_t message)
shim_write(SHIM_IPCLPESCL, 0);
shim_write(SHIM_IPCLPESCH, SHIM_IPCLPESCH_BUSY | message);

/* check status */
ipclpesch = shim_read(SHIM_IPCLPESCH);

while (ipclpesch & SHIM_IPCLPESCH_BUSY) {
/* now wait for clock change */
idelay(PLATFORM_LPE_DELAY);
ipclpesch = shim_read(SHIM_IPCLPESCH);

try++;
if (try > 10)
break;
}
/* wait for idle status */
ret = poll_for_register_delay(SHIM_BASE + SHIM_IPCLPESCH,
SHIM_IPCLPESCH_BUSY, 0,
PLATFORM_LPE_DELAY);

/* did command succeed */
if (ipclpesch & SHIM_IPCLPESCH_BUSY) {
if (ret < 0) {
trace_ipc_error("ePf");
return -EINVAL;
}
Expand Down
13 changes: 11 additions & 2 deletions src/platform/apollolake/include/platform/platform.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,15 @@

struct sof;

/*! \def PLATFORM_DEFAULT_CLOCK
* \brief clock source for audio pipeline
*
* There are two types of clock: cpu clock which is a internal clock in
* xtensa core, and ssp clock which is provided by external HW IP.
* The choice depends on HW features on different platform
*/
#define PLATFORM_DEFAULT_CLOCK CLK_SSP

/* DGMBS align value */
#define PLATFORM_HDA_BUFFER_ALIGNMENT 0x20

Expand Down Expand Up @@ -74,7 +83,7 @@ struct sof;
#define PLATFORM_MAX_STREAMS 16

/* clock source used by scheduler for deadline calculations */
#define PLATFORM_SCHED_CLOCK CLK_SSP
#define PLATFORM_SCHED_CLOCK PLATFORM_DEFAULT_CLOCK

/* DMA channel drain timeout in microseconds - TODO: caclulate based on topology */
#define PLATFORM_DMA_TIMEOUT 1333
Expand All @@ -86,7 +95,7 @@ struct sof;
#define PLATFORM_WORKQ_WINDOW 2000

/* platform WorkQ clock */
#define PLATFORM_WORKQ_CLOCK CLK_SSP
#define PLATFORM_WORKQ_CLOCK PLATFORM_DEFAULT_CLOCK

/* Host finish work schedule delay in microseconds */
#define PLATFORM_HOST_FINISH_DELAY 100
Expand Down
13 changes: 11 additions & 2 deletions src/platform/baytrail/include/platform/platform.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,15 @@

struct sof;

/*! \def PLATFORM_DEFAULT_CLOCK
* \brief clock source for audio pipeline
*
* There are two types of clock: cpu clock which is a internal clock in
* xtensa core, and ssp clock which is provided by external HW IP.
* The choice depends on HW features on different platform
*/
#define PLATFORM_DEFAULT_CLOCK CLK_SSP

/* IPC Interrupt */
#define PLATFORM_IPC_INTERRUPT IRQ_NUM_EXT_IA

Expand Down Expand Up @@ -67,7 +76,7 @@ struct sof;
#define PLATFORM_MAX_STREAMS 5

/* clock source used by scheduler for deadline calculations */
#define PLATFORM_SCHED_CLOCK CLK_SSP
#define PLATFORM_SCHED_CLOCK PLATFORM_DEFAULT_CLOCK

/* DMA channel drain timeout in microseconds - TODO: caclulate based on topology */
#define PLATFORM_DMA_TIMEOUT 1333
Expand All @@ -79,7 +88,7 @@ struct sof;
#define PLATFORM_WORKQ_WINDOW 2000

/* platform WorkQ clock */
#define PLATFORM_WORKQ_CLOCK CLK_SSP
#define PLATFORM_WORKQ_CLOCK PLATFORM_DEFAULT_CLOCK

/* local buffer size of DMA tracing */
#define DMA_TRACE_LOCAL_SIZE HOST_PAGE_SIZE
Expand Down
13 changes: 11 additions & 2 deletions src/platform/cannonlake/include/platform/platform.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,15 @@

struct sof;

/*! \def PLATFORM_DEFAULT_CLOCK
* \brief clock source for audio pipeline
*
* There are two types of clock: cpu clock which is a internal clock in
* xtensa core, and ssp clock which is provided by external HW IP.
* The choice depends on HW features on different platform
*/
#define PLATFORM_DEFAULT_CLOCK CLK_SSP

#define PLATFORM_WAITI_DELAY 1

#define PLATFORM_SSP_COUNT 3
Expand Down Expand Up @@ -80,7 +89,7 @@ struct sof;
#define PLATFORM_MAX_STREAMS 5

/* clock source used by scheduler for deadline calculations */
#define PLATFORM_SCHED_CLOCK CLK_SSP
#define PLATFORM_SCHED_CLOCK PLATFORM_DEFAULT_CLOCK

/* DMA channel drain timeout in microseconds - TODO: caclulate based on topology */
#define PLATFORM_DMA_TIMEOUT 1333
Expand All @@ -92,7 +101,7 @@ struct sof;
#define PLATFORM_WORKQ_WINDOW 2000

/* platform WorkQ clock */
#define PLATFORM_WORKQ_CLOCK CLK_SSP
#define PLATFORM_WORKQ_CLOCK PLATFORM_DEFAULT_CLOCK

/* Host finish work schedule delay in microseconds */
#define PLATFORM_HOST_FINISH_DELAY 100
Expand Down
13 changes: 11 additions & 2 deletions src/platform/haswell/include/platform/platform.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,15 @@

struct sof;

/*! \def PLATFORM_DEFAULT_CLOCK
* \brief clock source for audio pipeline
*
* There are two types of clock: cpu clock which is a internal clock in
* xtensa core, and ssp clock which is provided by external HW IP.
* The choice depends on HW features on different platform
*/
#define PLATFORM_DEFAULT_CLOCK CLK_CPU

/* IPC Interrupt */
#define PLATFORM_IPC_INTERRUPT IRQ_NUM_EXT_IA

Expand Down Expand Up @@ -66,7 +75,7 @@ struct sof;
#define PLATFORM_MAX_STREAMS 5

/* clock source used by scheduler for deadline calculations */
#define PLATFORM_SCHED_CLOCK CLK_CPU
#define PLATFORM_SCHED_CLOCK PLATFORM_DEFAULT_CLOCK

/* DMA channel drain timeout in microseconds - TODO: caclulate based on topology */
#define PLATFORM_DMA_TIMEOUT 1333
Expand All @@ -78,7 +87,7 @@ struct sof;
#define PLATFORM_WORKQ_WINDOW 2000

/* platform WorkQ clock */
#define PLATFORM_WORKQ_CLOCK CLK_CPU
#define PLATFORM_WORKQ_CLOCK PLATFORM_DEFAULT_CLOCK

/* local buffer size of DMA tracing */
#define DMA_TRACE_LOCAL_SIZE HOST_PAGE_SIZE
Expand Down
13 changes: 11 additions & 2 deletions src/platform/icelake/include/platform/platform.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,15 @@

struct sof;

/*! \def PLATFORM_DEFAULT_CLOCK
* \brief clock source for audio pipeline
*
* There are two types of clock: cpu clock which is a internal clock in
* xtensa core, and ssp clock which is provided by external HW IP.
* The choice depends on HW features on different platform
*/
#define PLATFORM_DEFAULT_CLOCK CLK_SSP

#define PLATFORM_WAITI_DELAY 1

#define PLATFORM_SSP_COUNT 3
Expand Down Expand Up @@ -80,7 +89,7 @@ struct sof;
#define PLATFORM_MAX_STREAMS 5

/* clock source used by scheduler for deadline calculations */
#define PLATFORM_SCHED_CLOCK CLK_SSP
#define PLATFORM_SCHED_CLOCK PLATFORM_DEFAULT_CLOCK

/* DMA channel drain timeout in microseconds - TODO: caclulate based on topology */
#define PLATFORM_DMA_TIMEOUT 1333
Expand All @@ -92,7 +101,7 @@ struct sof;
#define PLATFORM_WORKQ_WINDOW 2000

/* platform WorkQ clock */
#define PLATFORM_WORKQ_CLOCK CLK_SSP
#define PLATFORM_WORKQ_CLOCK PLATFORM_DEFAULT_CLOCK

/* Host finish work schedule delay in microseconds */
#define PLATFORM_HOST_FINISH_DELAY 100
Expand Down