ASoC: Intel: Sklyake - add IPC routines
Subsystems (3)
cover ASoC: Intel: Sklyake - add IPC routines
The SKL aDSP needs to send and receive IPCs to and from aDSP. To aid this we add IPC and aDSP management routines as a library for driver to use. For most of IPC handling we use the common IPC Intel code in place and add the messaging and message parsing bits on top.
First 4 patches are against common IPC code and can be applied independently Last two add IPC handling and aDSP management routines, they are not dependent upon anything and can be applied independently but they are generated against SKL PCM driver series so Makefile updates expect those to be there
Subhransu S. Prusty (6):
ASoC: Intel: Add helper to poll register for DSP status
ASoC: Intel: Define SKL ADSP IPC and general purpose registers
ASoC: Intel: Reorganize the common dsp structure
ASoC: Intel: Add helper to update register bits with attr RWC
ASoC: Intel: Add Skylake IPC library
ASoC: Intel: Add DSP init and boot up functionality for SKL
sound/soc/intel/common/sst-dsp-priv.h | 20 +- sound/soc/intel/common/sst-dsp.c | 51 +++ sound/soc/intel/common/sst-dsp.h | 6 + sound/soc/intel/skylake/Makefile | 5 + sound/soc/intel/skylake/skl-sst-dsp.c | 338 +++++++++++++++ sound/soc/intel/skylake/skl-sst-dsp.h | 124 ++++++ sound/soc/intel/skylake/skl-sst-ipc.c | 751 ++++++++++++++++++++++++++++++++++ sound/soc/intel/skylake/skl-sst-ipc.h | 126 ++++++ 8 files changed, 1417 insertions(+), 4 deletions(-) create mode 100644 sound/soc/intel/skylake/skl-sst-dsp.c create mode 100644 sound/soc/intel/skylake/skl-sst-dsp.h create mode 100644 sound/soc/intel/skylake/skl-sst-ipc.c create mode 100644 sound/soc/intel/skylake/skl-sst-ipc.h
Signature · 1 line
1.9.1
PATCH 1/6 ASoC: Intel: Add helper to poll register for DSP status
From: "Subhransu S. Prusty" <[email protected]>
This patch adds helper to poll register for DSP status.
--- sound/soc/intel/common/sst-dsp.c | 23 +++++++++++++++++++++++ sound/soc/intel/common/sst-dsp.h | 2 ++ 2 files changed, 25 insertions(+)
sound/soc/intel/common/sst-dsp.c +23 -0
@@ -20,6 +20,7 @@#include <linux/module.h> #include <linux/platform_device.h> #include <linux/io.h> +#include <linux/delay.h> #include "sst-dsp.h" #include "sst-dsp-priv.h"
@@ -222,6 +223,28 @@ int sst_dsp_shim_update_bits64(struct sst_dsp *sst, u32 offset, }EXPORT_SYMBOL_GPL (sst_dsp_shim_update_bits64); +int sst_dsp_register_poll (struct sst_dsp *ctx,u32 offset,u32 mask, +u32 expected_value,u32 timeout,char *operation) +{ +int time, ret; +u32 reg; + +/* check if set state successful */ +for (time =0 ; time < timeout; time++) { +if ((sst_dsp_shim_read_unlocked (ctx, offset) & mask) == expected_value) +break ; + +mdelay (1 ); + } + reg =sst_dsp_shim_read_unlocked (ctx, offset); +dev_info (ctx->dev,"FW Poll Status: reg=%#x %s %s\n" , reg, operation, + (time < timeout) ?"successful" :"timedout" ); + ret = time < timeout ?0 : -ETIME ; + +return ret; +} +EXPORT_SYMBOL_GPL (sst_dsp_register_poll); +void sst_dsp_dump (struct sst_dsp *sst) {if (sst->ops->dump)
sound/soc/intel/common/sst-dsp.h +2 -0
@@ -278,6 +278,8 @@ void sst_dsp_inbox_read(struct sst_dsp *dsp, void *message, size_t bytes);void sst_dsp_outbox_write (struct sst_dsp *dsp,void *message,size_t bytes);void sst_dsp_outbox_read (struct sst_dsp *dsp,void *message,size_t bytes);void sst_dsp_mailbox_dump (struct sst_dsp *dsp,size_t bytes); +int sst_dsp_register_poll (struct sst_dsp *dsp,u32 offset,u32 mask, +u32 expected_value,u32 timeout,char *operation);/* Debug */ void sst_dsp_dump (struct sst_dsp *sst);
Signature · 1 line
1.9.1
PATCH 2/6 ASoC: Intel: Define SKL ADSP IPC and general purpose registers
In reply to Vinod KoulFrom: "Subhransu S. Prusty" <[email protected]>
--- sound/soc/intel/skylake/skl-sst-dsp.h | 63 +++++++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 sound/soc/intel/skylake/skl-sst-dsp.h
sound/soc/intel/skylake/skl-sst-dsp.h new file +63 -0
@@ -0,0 +1,63 @@ +/* +* Skylake SST DSP Support +* +* Copyright (C) 2014-15, Intel Corporation. All rights reserved. +* +* This program is free software; you can redistribute it and/or +* modify it under the terms of the GNU General Public License version +* 2 as published by the Free Software Foundation. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +*/ + +#ifndef __SKL_SST_DSP_H__ +#define __SKL_SST_DSP_H__ + +/* Intel HD Audio General DSP Registers */ +#define SKL_ADSP_GEN_BASE 0x0 +#define SKL_ADSP_REG_ADSPCS (SKL_ADSP_GEN_BASE + 0x04) +#define SKL_ADSP_REG_ADSPIC (SKL_ADSP_GEN_BASE + 0x08) +#define SKL_ADSP_REG_ADSPIS (SKL_ADSP_GEN_BASE + 0x0C) +#define SKL_ADSP_REG_ADSPIC2 (SKL_ADSP_GEN_BASE + 0x10) +#define SKL_ADSP_REG_ADSPIS2 (SKL_ADSP_GEN_BASE + 0x14) + +/* Intel HD Audio Inter-Processor Communication Registers */ +#define SKL_ADSP_IPC_BASE 0x40 +#define SKL_ADSP_REG_HIPCT (SKL_ADSP_IPC_BASE + 0x00) +#define SKL_ADSP_REG_HIPCTE (SKL_ADSP_IPC_BASE + 0x04) +#define SKL_ADSP_REG_HIPCI (SKL_ADSP_IPC_BASE + 0x08) +#define SKL_ADSP_REG_HIPCIE (SKL_ADSP_IPC_BASE + 0x0C) +#define SKL_ADSP_REG_HIPCCTL (SKL_ADSP_IPC_BASE + 0x10) + +/* HIPCI */ +#define SKL_ADSP_REG_HIPCI_BUSY BIT(31) + +/* HIPCIE */ +#define SKL_ADSP_REG_HIPCIE_DONE BIT(30) + +/* HIPCCTL */ +#define SKL_ADSP_REG_HIPCCTL_DONE BIT(1) +#define SKL_ADSP_REG_HIPCCTL_BUSY BIT(0) + +/* HIPCT */ +#define SKL_ADSP_REG_HIPCT_BUSY BIT(31) + +/* Intel HD Audio SRAM Window 1 */ +#define SKL_ADSP_SRAM1_BASE 0xA000 + +#define SKL_ADSP_MMIO_LEN 0x10000 + +#define SKL_ADSP_W0_STAT_SZ 0x800 + +#define SKL_ADSP_W0_UP_SZ 0x800 + +#define SKL_ADSP_W1_SZ 0x1000 + +#define SKL_ADSPIC_IPC 1 +#define SKL_ADSPIS_IPC 1 + +#endif /*__SKL_SST_DSP_H__*/
Signature · 1 line
1.9.1
PATCH 3/6 ASoC: Intel: Reorganize the common dsp structure
In reply to Vinod KoulFrom: "Subhransu S. Prusty" <[email protected]>
We will add SKL platform data. So organizing common and platform specific data helps.
--- sound/soc/intel/common/sst-dsp-priv.h | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-)
sound/soc/intel/common/sst-dsp-priv.h +8 -4
@@ -258,6 +258,8 @@ struct sst_mem_block {*/ struct sst_dsp { +/* Shared for all platforms */ +/* runtime */ struct sst_dsp_device *sst_dev;spinlock_t spinlock;/* IPC locking */
@@ -268,10 +270,6 @@ struct sst_dsp {int irq;u32 id; -/* list of free and used ADSP memory blocks */ -struct list_head used_block_list; -struct list_head free_block_list; -/* operations */ struct sst_ops *ops;
@@ -284,6 +282,12 @@ struct sst_dsp {/* mailbox */ struct sst_mailbox mailbox; +/* HSW/Byt data */ + +/* list of free and used ADSP memory blocks */ +struct list_head used_block_list; +struct list_head free_block_list; +/* SST FW files loaded and their modules */ struct list_head module_list;struct list_head fw_list;
Signature · 1 line
1.9.1
PATCH 4/6 ASoC: Intel: Add helper to update register bits with attr RWC
In reply to Vinod KoulFrom: "Subhransu S. Prusty" <[email protected]>
For SKL IPC, we have some register bits with attribute RWC. So we need to force update them. Add helper to force update this type of registers bits.
--- sound/soc/intel/common/sst-dsp.c | 28 ++++++++++++++++++++++++++++ sound/soc/intel/common/sst-dsp.h | 4 ++++ 2 files changed, 32 insertions(+)
sound/soc/intel/common/sst-dsp.c +28 -0
@@ -197,6 +197,22 @@ int sst_dsp_shim_update_bits64_unlocked(struct sst_dsp *sst, u32 offset, }EXPORT_SYMBOL_GPL (sst_dsp_shim_update_bits64_unlocked); +/* This is for registers bits with attribute RWC */ +void sst_dsp_shim_update_bits_forced_unlocked (struct sst_dsp *sst,u32 offset, +u32 mask,u32 value) +{ +unsigned int old, new; +u32 ret; + + ret =sst_dsp_shim_read_unlocked (sst, offset); + + old = ret; + new = (old & (~mask)) | (value & mask); + +sst_dsp_shim_write_unlocked (sst, offset, new); +} +EXPORT_SYMBOL_GPL (sst_dsp_shim_update_bits_forced_unlocked); +int sst_dsp_shim_update_bits (struct sst_dsp *sst,u32 offset,u32 mask,u32 value) {
@@ -223,6 +239,18 @@ int sst_dsp_shim_update_bits64(struct sst_dsp *sst, u32 offset, }EXPORT_SYMBOL_GPL (sst_dsp_shim_update_bits64); +/* This is for registers bits with attribute RWC */ +void sst_dsp_shim_update_bits_forced (struct sst_dsp *sst,u32 offset, +u32 mask,u32 value) +{ +unsigned long flags; + +spin_lock_irqsave (&sst->spinlock, flags); +sst_dsp_shim_update_bits_forced_unlocked (sst, offset, mask, value); +spin_unlock_irqrestore (&sst->spinlock, flags); +} +EXPORT_SYMBOL_GPL (sst_dsp_shim_update_bits_forced); +int sst_dsp_register_poll (struct sst_dsp *ctx,u32 offset,u32 mask,u32 expected_value,u32 timeout,char *operation) {
sound/soc/intel/common/sst-dsp.h +4 -0
@@ -230,6 +230,8 @@ void sst_dsp_shim_write64(struct sst_dsp *sst, u32 offset, u64 value);u64 sst_dsp_shim_read64 (struct sst_dsp *sst,u32 offset);int sst_dsp_shim_update_bits64 (struct sst_dsp *sst,u32 offset,u64 mask,u64 value); +void sst_dsp_shim_update_bits_forced (struct sst_dsp *sst,u32 offset, +u32 mask,u32 value);/* SHIM Read / Write Unlocked for callers already holding sst lock */ void sst_dsp_shim_write_unlocked (struct sst_dsp *sst,u32 offset,u32 value);
@@ -240,6 +242,8 @@ void sst_dsp_shim_write64_unlocked(struct sst_dsp *sst, u32 offset, u64 value);u64 sst_dsp_shim_read64_unlocked (struct sst_dsp *sst,u32 offset);int sst_dsp_shim_update_bits64_unlocked (struct sst_dsp *sst,u32 offset,u64 mask,u64 value); +void sst_dsp_shim_update_bits_forced_unlocked (struct sst_dsp *sst,u32 offset, +u32 mask,u32 value);/* Internal generic low-level SST IO functions - can be overidden */ void sst_shim32_write (void __iomem *addr,u32 offset,u32 value);
Signature · 1 line
1.9.1
PATCH 5/6 ASoC: Intel: Add Skylake IPC library
In reply to Vinod KoulFrom: "Subhransu S. Prusty" <[email protected]>
This adds base SKL IPC library which uses common SST IPC lib. Here we add definition for IPC types, sending and recieving IPC messages from aDSP, handling interrupt, sending different types of messages etc
--- sound/soc/intel/common/sst-dsp-priv.h | 4 + sound/soc/intel/skylake/Makefile | 5 + sound/soc/intel/skylake/skl-sst-ipc.c | 751 ++++++++++++++++++++++++++++++++++ sound/soc/intel/skylake/skl-sst-ipc.h | 126 ++++++ 4 files changed, 886 insertions(+) create mode 100644 sound/soc/intel/skylake/skl-sst-ipc.c create mode 100644 sound/soc/intel/skylake/skl-sst-ipc.h
sound/soc/intel/common/sst-dsp-priv.h +4 -0
@@ -303,6 +303,10 @@ struct sst_dsp {/* DMA FW loading */ struct sst_dma *dma;bool fw_use_dma; + +/* SKL data */ + +u32 intr_status; };/* Size optimised DRAM/IRAM memcpy */
sound/soc/intel/skylake/Makefile +5 -0
@@ -1,3 +1,8 @@ snd-soc-skl-objs := skl.o skl-pcm.o obj-$(CONFIG_SND_SOC_INTEL_SKYLAKE) += snd-soc-skl.o + +# Skylake IPC Support +snd-soc-skl-ipc-objs := skl-sst-ipc.o + +obj-$(CONFIG_SND_SOC_INTEL_SKYLAKE) += snd-soc-skl-ipc.o
sound/soc/intel/skylake/skl-sst-ipc.c new file +751 -0
751 lines not on this page · raw message
sound/soc/intel/skylake/skl-sst-ipc.h new file +126 -0
126 lines not on this page · raw message
Signature · 1 line
1.9.1
PATCH 6/6 ASoC: Intel: Add DSP init and boot up functionality for SKL
In reply to Vinod KoulFrom: "Subhransu S. Prusty" <[email protected]>
This patch adds code to enable, disable and boot DSP core. Also provide some helpers to reset and power up/down the core.
--- sound/soc/intel/common/sst-dsp-priv.h | 4 + sound/soc/intel/skylake/Makefile | 2 +- sound/soc/intel/skylake/skl-sst-dsp.c | 338 ++++++++++++++++++++++++++++++++++ sound/soc/intel/skylake/skl-sst-dsp.h | 61 ++++++ 4 files changed, 404 insertions(+), 1 deletion(-) create mode 100644 sound/soc/intel/skylake/skl-sst-dsp.c
sound/soc/intel/common/sst-dsp-priv.h +4 -0
@@ -22,6 +22,8 @@#include <linux/interrupt.h> #include <linux/firmware.h> +#include "../skylake/skl-sst-dsp.h" +struct sst_mem_block ;struct sst_module ;struct sst_fw ;
@@ -306,6 +308,8 @@ struct sst_dsp {/* SKL data */ +struct skl_fw_ops fw_ops; +int sst_state;u32 intr_status; };
sound/soc/intel/skylake/Makefile +1 -1
@@ -3,6 +3,6 @@ snd-soc-skl-objs := skl.o skl-pcm.o obj-$(CONFIG_SND_SOC_INTEL_SKYLAKE) += snd-soc-skl.o # Skylake IPC Support -snd-soc-skl-ipc-objs := skl-sst-ipc.o +snd-soc-skl-ipc-objs := skl-sst-ipc.o skl-sst-dsp.o obj-$(CONFIG_SND_SOC_INTEL_SKYLAKE) += snd-soc-skl-ipc.o
sound/soc/intel/skylake/skl-sst-dsp.c new file +338 -0
338 lines not on this page · raw message
sound/soc/intel/skylake/skl-sst-dsp.h +61 -0
71 lines not on this page · raw message
Signature · 1 line
1.9.1