// SPDX-License-Identifier: GPL-2.0-only /* * sst_dsp.c - Intel SST Driver for audio engine * * Copyright (C) 2008-14 Intel Corp * Authors: Vinod Koul <[email protected]> * Harsha Priya <[email protected]> * Dharageswari R <[email protected]> * KP Jeeja <[email protected]> * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * * This file contains all dsp controlling functions like firmware download, * setting/resetting dsp cores, etc */ #include <linux/pci.h> #include <linux/delay.h> #include <linux/fs.h> #include <linux/sched.h> #include <linux/firmware.h> #include <linux/dmaengine.h> #include <linux/pm_qos.h> #include <sound/core.h> #include <sound/pcm.h> #include <sound/soc.h> #include <sound/compress_driver.h> #include <asm/platform_sst_audio.h> #include "../sst-mfld-platform.h" #include "sst.h" void memcpy32_toio(void __iomem *dst, const void *src, int count) { … } void memcpy32_fromio(void *dst, const void __iomem *src, int count) { … } /** * intel_sst_reset_dsp_mrfld - Resetting SST DSP * @sst_drv_ctx: intel_sst_drv context pointer * * This resets DSP in case of MRFLD platfroms */ int intel_sst_reset_dsp_mrfld(struct intel_sst_drv *sst_drv_ctx) { … } /** * sst_start_mrfld - Start the SST DSP processor * @sst_drv_ctx: intel_sst_drv context pointer * * This starts the DSP in MERRIFIELD platfroms */ int sst_start_mrfld(struct intel_sst_drv *sst_drv_ctx) { … } static int sst_validate_fw_image(struct intel_sst_drv *ctx, unsigned long size, struct fw_module_header **module, u32 *num_modules) { … } /* * sst_fill_memcpy_list - Fill the memcpy list * * @memcpy_list: List to be filled * @destn: Destination addr to be filled in the list * @src: Source addr to be filled in the list * @size: Size to be filled in the list * * Adds the node to the list after required fields * are populated in the node */ static int sst_fill_memcpy_list(struct list_head *memcpy_list, void *destn, const void *src, u32 size, bool is_io) { … } /** * sst_parse_module_memcpy - Parse audio FW modules and populate the memcpy list * * @sst_drv_ctx : driver context * @module : FW module header * @memcpy_list : Pointer to the list to be populated * Create the memcpy list as the number of block to be copied * returns error or 0 if module sizes are proper */ static int sst_parse_module_memcpy(struct intel_sst_drv *sst_drv_ctx, struct fw_module_header *module, struct list_head *memcpy_list) { … } /** * sst_parse_fw_memcpy - parse the firmware image & populate the list for memcpy * * @ctx : pointer to drv context * @size : size of the firmware * @fw_list : pointer to list_head to be populated * This function parses the FW image and saves the parsed image in the list * for memcpy */ static int sst_parse_fw_memcpy(struct intel_sst_drv *ctx, unsigned long size, struct list_head *fw_list) { … } /** * sst_do_memcpy - function initiates the memcpy * * @memcpy_list: Pter to memcpy list on which the memcpy needs to be initiated * * Triggers the memcpy */ static void sst_do_memcpy(struct list_head *memcpy_list) { … } void sst_memcpy_free_resources(struct intel_sst_drv *sst_drv_ctx) { … } static int sst_cache_and_parse_fw(struct intel_sst_drv *sst, const struct firmware *fw) { … } void sst_firmware_load_cb(const struct firmware *fw, void *context) { … } /* * sst_request_fw - requests audio fw from kernel and saves a copy * * This function requests the SST FW from the kernel, parses it and * saves a copy in the driver context */ static int sst_request_fw(struct intel_sst_drv *sst) { … } /* * Writing the DDR physical base to DCCM offset * so that FW can use it to setup TLB */ static void sst_dccm_config_write(void __iomem *dram_base, unsigned int ddr_base) { … } void sst_post_download_mrfld(struct intel_sst_drv *ctx) { … } /** * sst_load_fw - function to load FW into DSP * @sst_drv_ctx: intel_sst_drv context pointer * * Transfers the FW to DSP using dma/memcpy */ int sst_load_fw(struct intel_sst_drv *sst_drv_ctx) { … }