linux/sound/soc/sof/amd/acp.c

// SPDX-License-Identifier: (GPL-2.0-only OR BSD-3-Clause)
//
// This file is provided under a dual BSD/GPLv2 license. When using or
// redistributing this file, you may do so under either license.
//
// Copyright(c) 2021, 2023 Advanced Micro Devices, Inc. All rights reserved.
//
// Authors: Vijendar Mukunda <[email protected]>
//	    Ajit Kumar Pandey <[email protected]>

/*
 * Hardware interface for generic AMD ACP processor
 */

#include <linux/io.h>
#include <linux/module.h>
#include <linux/pci.h>

#include "../ops.h"
#include "acp.h"
#include "acp-dsp-offset.h"

static bool enable_fw_debug;
module_param(enable_fw_debug, bool, 0444);
MODULE_PARM_DESC();

static struct acp_quirk_entry quirk_valve_galileo =;

const struct dmi_system_id acp_sof_quirk_table[] =;
EXPORT_SYMBOL_GPL();

static int smn_write(struct pci_dev *dev, u32 smn_addr, u32 data)
{}

static int smn_read(struct pci_dev *dev, u32 smn_addr)
{}

static void init_dma_descriptor(struct acp_dev_data *adata)
{}

static void configure_dma_descriptor(struct acp_dev_data *adata, unsigned short idx,
				     struct dma_descriptor *dscr_info)
{}

static int config_dma_channel(struct acp_dev_data *adata, unsigned int ch,
			      unsigned int idx, unsigned int dscr_count)
{}

static int acpbus_dma_start(struct acp_dev_data *adata, unsigned int ch,
			    unsigned int dscr_count, struct dma_descriptor *dscr_info)
{}

int configure_and_run_dma(struct acp_dev_data *adata, unsigned int src_addr,
			  unsigned int dest_addr, int dsp_data_size)
{}

/*
 * psp_mbox_ready- function to poll ready bit of psp mbox
 * @adata: acp device data
 * @ack: bool variable to check ready bit status or psp ack
 */

static int psp_mbox_ready(struct acp_dev_data *adata, bool ack)
{}

/*
 * psp_send_cmd - function to send psp command over mbox
 * @adata: acp device data
 * @cmd: non zero integer value for command type
 */

static int psp_send_cmd(struct acp_dev_data *adata, int cmd)
{}

int configure_and_run_sha_dma(struct acp_dev_data *adata, void *image_addr,
			      unsigned int start_addr, unsigned int dest_addr,
			      unsigned int image_length)
{}

int acp_dma_status(struct acp_dev_data *adata, unsigned char ch)
{}

void memcpy_from_scratch(struct snd_sof_dev *sdev, u32 offset, unsigned int *dst, size_t bytes)
{}

void memcpy_to_scratch(struct snd_sof_dev *sdev, u32 offset, unsigned int *src, size_t bytes)
{}

static int acp_memory_init(struct snd_sof_dev *sdev)
{}

static irqreturn_t acp_irq_thread(int irq, void *context)
{
	struct snd_sof_dev *sdev = context;
	const struct sof_amd_acp_desc *desc = get_chip_info(sdev->pdata);
	unsigned int count = ACP_HW_SEM_RETRY_COUNT;

	spin_lock_irq(&sdev->ipc_lock);
	/* Wait until acquired HW Semaphore lock or timeout */
	while (snd_sof_dsp_read(sdev, ACP_DSP_BAR, desc->hw_semaphore_offset) && --count)
		;
	spin_unlock_irq(&sdev->ipc_lock);

	if (!count) {
		dev_err(sdev->dev, "%s: Failed to acquire HW lock\n", __func__);
		return IRQ_NONE;
	}

	sof_ops(sdev)->irq_thread(irq, sdev);
	/* Unlock or Release HW Semaphore */
	snd_sof_dsp_write(sdev, ACP_DSP_BAR, desc->hw_semaphore_offset, 0x0);

	return IRQ_HANDLED;
};

static irqreturn_t acp_irq_handler(int irq, void *dev_id)
{}

static int acp_power_on(struct snd_sof_dev *sdev)
{}

static int acp_reset(struct snd_sof_dev *sdev)
{}

static int acp_dsp_reset(struct snd_sof_dev *sdev)
{}

static int acp_init(struct snd_sof_dev *sdev)
{}

static bool check_acp_sdw_enable_status(struct snd_sof_dev *sdev)
{}

int amd_sof_acp_suspend(struct snd_sof_dev *sdev, u32 target_state)
{}
EXPORT_SYMBOL_NS();

int amd_sof_acp_resume(struct snd_sof_dev *sdev)
{}
EXPORT_SYMBOL_NS();

#if IS_ENABLED(CONFIG_SND_SOC_SOF_AMD_SOUNDWIRE)
static int acp_sof_scan_sdw_devices(struct snd_sof_dev *sdev, u64 addr)
{}

static int amd_sof_sdw_probe(struct snd_sof_dev *sdev)
{}

static int amd_sof_sdw_exit(struct snd_sof_dev *sdev)
{}

#else
static int acp_sof_scan_sdw_devices(struct snd_sof_dev *sdev, u64 addr)
{
	return 0;
}

static int amd_sof_sdw_probe(struct snd_sof_dev *sdev)
{
	return 0;
}

static int amd_sof_sdw_exit(struct snd_sof_dev *sdev)
{
	return 0;
}
#endif

int amd_sof_acp_probe(struct snd_sof_dev *sdev)
{}
EXPORT_SYMBOL_NS();

void amd_sof_acp_remove(struct snd_sof_dev *sdev)
{}
EXPORT_SYMBOL_NS();

MODULE_LICENSE();
MODULE_DESCRIPTION();
MODULE_IMPORT_NS();
MODULE_IMPORT_NS();