linux/sound/soc/amd/acp/amd.h

/* 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 Advanced Micro Devices, Inc. All rights reserved.
 *
 * Author: Ajit Kumar Pandey <[email protected]>
 */

#ifndef __AMD_ACP_H
#define __AMD_ACP_H

#include <sound/pcm.h>
#include <sound/soc.h>
#include <sound/soc-acpi.h>
#include <sound/soc-dai.h>

#include "chip_offset_byte.h"

#define ACP3X_DEV
#define ACP6X_DEV
#define ACP63_DEV
#define ACP70_DEV

#define DMIC_INSTANCE
#define I2S_SP_INSTANCE
#define I2S_BT_INSTANCE
#define I2S_HS_INSTANCE

#define MEM_WINDOW_START

#define ACP_I2S_REG_START
#define ACP_I2S_REG_END
#define ACP3x_I2STDM_REG_START
#define ACP3x_I2STDM_REG_END
#define ACP3x_BT_TDM_REG_START
#define ACP3x_BT_TDM_REG_END

#define THRESHOLD(bit, base)
#define I2S_RX_THRESHOLD(base)
#define I2S_TX_THRESHOLD(base)
#define BT_TX_THRESHOLD(base)
#define BT_RX_THRESHOLD(base)
#define HS_TX_THRESHOLD(base)
#define HS_RX_THRESHOLD(base)

#define ACP_SRAM_SP_PB_PTE_OFFSET
#define ACP_SRAM_SP_CP_PTE_OFFSET
#define ACP_SRAM_BT_PB_PTE_OFFSET
#define ACP_SRAM_BT_CP_PTE_OFFSET
#define ACP_SRAM_PDM_PTE_OFFSET
#define ACP_SRAM_HS_PB_PTE_OFFSET
#define ACP_SRAM_HS_CP_PTE_OFFSET
#define PAGE_SIZE_4K_ENABLE

#define I2S_SP_TX_MEM_WINDOW_START
#define I2S_SP_RX_MEM_WINDOW_START
#define I2S_BT_TX_MEM_WINDOW_START
#define I2S_BT_RX_MEM_WINDOW_START
#define I2S_HS_TX_MEM_WINDOW_START
#define I2S_HS_RX_MEM_WINDOW_START

#define SP_PB_FIFO_ADDR_OFFSET
#define SP_CAPT_FIFO_ADDR_OFFSET
#define BT_PB_FIFO_ADDR_OFFSET
#define BT_CAPT_FIFO_ADDR_OFFSET
#define HS_PB_FIFO_ADDR_OFFSET
#define HS_CAPT_FIFO_ADDR_OFFSET
#define PLAYBACK_MIN_NUM_PERIODS
#define PLAYBACK_MAX_NUM_PERIODS
#define PLAYBACK_MAX_PERIOD_SIZE
#define PLAYBACK_MIN_PERIOD_SIZE
#define CAPTURE_MIN_NUM_PERIODS
#define CAPTURE_MAX_NUM_PERIODS
#define CAPTURE_MAX_PERIOD_SIZE
#define CAPTURE_MIN_PERIOD_SIZE

#define MAX_BUFFER
#define MIN_BUFFER
#define FIFO_SIZE
#define DMA_SIZE
#define FRM_LEN

#define ACP3x_ITER_IRER_SAMP_LEN_MASK

#define ACP_MAX_STREAM

#define TDM_ENABLE
#define TDM_DISABLE

#define SLOT_WIDTH_8
#define SLOT_WIDTH_16
#define SLOT_WIDTH_24
#define SLOT_WIDTH_32

#define ACP6X_PGFSM_CONTROL
#define ACP6X_PGFSM_STATUS

#define ACP63_PGFSM_CONTROL
#define ACP63_PGFSM_STATUS

#define ACP70_PGFSM_CONTROL
#define ACP70_PGFSM_STATUS

#define ACP_SOFT_RST_DONE_MASK

#define ACP_PGFSM_CNTL_POWER_ON_MASK
#define ACP_PGFSM_CNTL_POWER_OFF_MASK
#define ACP_PGFSM_STATUS_MASK
#define ACP_POWERED_ON
#define ACP_POWER_ON_IN_PROGRESS
#define ACP_POWERED_OFF
#define ACP_POWER_OFF_IN_PROGRESS

#define ACP_ERROR_MASK
#define ACP_EXT_INTR_STAT_CLEAR_MASK

#define ACP_TIMEOUT
#define DELAY_US
#define ACP_SUSPEND_DELAY_MS

#define PDM_DMA_STAT
#define PDM_DMA_INTR_MASK
#define PDM_DEC_64
#define PDM_CLK_FREQ_MASK
#define PDM_MISC_CTRL_MASK
#define PDM_ENABLE
#define PDM_DISABLE
#define DMA_EN_MASK
#define DELAY_US
#define PDM_TIMEOUT
#define ACP_REGION2_OFFSET

struct acp_chip_info {};

struct acp_stream {};

struct acp_resource {};

struct acp_dev_data {};

enum acp_config {};

extern const struct snd_soc_dai_ops asoc_acp_cpu_dai_ops;
extern const struct snd_soc_dai_ops acp_dmic_dai_ops;

int acp_platform_register(struct device *dev);
int acp_platform_unregister(struct device *dev);

int acp_machine_select(struct acp_dev_data *adata);

int smn_read(struct pci_dev *dev, u32 smn_addr);
int smn_write(struct pci_dev *dev, u32 smn_addr, u32 data);

int acp_init(struct acp_chip_info *chip);
int acp_deinit(struct acp_chip_info *chip);
void acp_enable_interrupts(struct acp_dev_data *adata);
void acp_disable_interrupts(struct acp_dev_data *adata);
/* Machine configuration */
int snd_amd_acp_find_config(struct pci_dev *pci);

void config_pte_for_stream(struct acp_dev_data *adata, struct acp_stream *stream);
void config_acp_dma(struct acp_dev_data *adata, struct acp_stream *stream, int size);
void restore_acp_pdm_params(struct snd_pcm_substream *substream,
			    struct acp_dev_data *adata);

int restore_acp_i2s_params(struct snd_pcm_substream *substream,
			   struct acp_dev_data *adata, struct acp_stream *stream);

void check_acp_config(struct pci_dev *pci, struct acp_chip_info *chip);

static inline u64 acp_get_byte_count(struct acp_dev_data *adata, int dai_id, int direction)
{}
#endif