2020-05-19 01:16:52 +08:00
|
|
|
/* SPDX-License-Identifier: GPL-2.0+ */
|
|
|
|
/*
|
|
|
|
* AMD ALSA SoC PDM Driver
|
|
|
|
*
|
|
|
|
* Copyright 2020 Advanced Micro Devices, Inc.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "rn_chip_offset_byte.h"
|
|
|
|
|
|
|
|
#define ACP_PHY_BASE_ADDRESS 0x1240000
|
2020-05-19 01:16:54 +08:00
|
|
|
#define ACP_REG_START 0x1240000
|
|
|
|
#define ACP_REG_END 0x1250200
|
|
|
|
|
2020-05-19 01:16:52 +08:00
|
|
|
#define ACP_DEVICE_ID 0x15E2
|
2020-05-19 01:16:53 +08:00
|
|
|
#define ACP_POWER_ON 0x00
|
|
|
|
#define ACP_POWER_ON_IN_PROGRESS 0x01
|
|
|
|
#define ACP_POWER_OFF 0x02
|
|
|
|
#define ACP_POWER_OFF_IN_PROGRESS 0x03
|
|
|
|
#define ACP_SOFT_RESET_SOFTRESET_AUDDONE_MASK 0x00010001
|
|
|
|
|
|
|
|
#define ACP_PGFSM_CNTL_POWER_ON_MASK 0x01
|
|
|
|
#define ACP_PGFSM_CNTL_POWER_OFF_MASK 0x00
|
|
|
|
#define ACP_PGFSM_STATUS_MASK 0x03
|
|
|
|
#define ACP_POWERED_ON 0x00
|
|
|
|
#define ACP_POWER_ON_IN_PROGRESS 0x01
|
|
|
|
#define ACP_POWERED_OFF 0x02
|
|
|
|
#define ACP_POWER_OFF_IN_PROGRESS 0x03
|
|
|
|
|
|
|
|
#define ACP_ERROR_MASK 0x20000000
|
|
|
|
#define ACP_EXT_INTR_STAT_CLEAR_MASK 0xFFFFFFFF
|
2020-05-19 01:16:56 +08:00
|
|
|
#define PDM_DMA_STAT 0x10
|
2020-05-19 01:16:52 +08:00
|
|
|
|
2020-05-19 01:16:55 +08:00
|
|
|
struct pdm_dev_data {
|
2020-05-19 01:16:56 +08:00
|
|
|
u32 pdm_irq;
|
2020-05-19 01:16:55 +08:00
|
|
|
void __iomem *acp_base;
|
|
|
|
struct snd_pcm_substream *capture_stream;
|
|
|
|
};
|
|
|
|
|
2020-05-19 01:16:52 +08:00
|
|
|
static inline u32 rn_readl(void __iomem *base_addr)
|
|
|
|
{
|
|
|
|
return readl(base_addr - ACP_PHY_BASE_ADDRESS);
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline void rn_writel(u32 val, void __iomem *base_addr)
|
|
|
|
{
|
|
|
|
writel(val, base_addr - ACP_PHY_BASE_ADDRESS);
|
|
|
|
}
|