/* SPDX-License-Identifier: GPL-2.0-or-later */1/*2* at91-pcm.h - ALSA PCM interface for the Atmel AT91 SoC.3*4* Copyright (C) 2005 SAN People5* Copyright (C) 2008 Atmel6*7* Authors: Sedji Gaouaou <[email protected]>8*9* Based on at91-pcm. by:10* Frank Mandarino <[email protected]>11* Copyright 2006 Endrelia Technologies Inc.12*13* Based on pxa2xx-pcm.c by:14*15* Author: Nicolas Pitre16* Created: Nov 30, 200417* Copyright: (C) 2004 MontaVista Software, Inc.18*/1920#ifndef _ATMEL_PCM_H21#define _ATMEL_PCM_H2223#include <linux/atmel-ssc.h>2425#define ATMEL_SSC_DMABUF_SIZE (64 * 1024)2627/*28* Registers and status bits that are required by the PCM driver.29*/30struct atmel_pdc_regs {31unsigned int xpr; /* PDC recv/trans pointer */32unsigned int xcr; /* PDC recv/trans counter */33unsigned int xnpr; /* PDC next recv/trans pointer */34unsigned int xncr; /* PDC next recv/trans counter */35unsigned int ptcr; /* PDC transfer control */36};3738struct atmel_ssc_mask {39u32 ssc_enable; /* SSC recv/trans enable */40u32 ssc_disable; /* SSC recv/trans disable */41u32 ssc_error; /* SSC error conditions */42u32 ssc_endx; /* SSC ENDTX or ENDRX */43u32 ssc_endbuf; /* SSC TXBUFE or RXBUFF */44u32 pdc_enable; /* PDC recv/trans enable */45u32 pdc_disable; /* PDC recv/trans disable */46};4748/*49* This structure, shared between the PCM driver and the interface,50* contains all information required by the PCM driver to perform the51* PDC DMA operation. All fields except dma_intr_handler() are initialized52* by the interface. The dma_intr_handler() pointer is set by the PCM53* driver and called by the interface SSC interrupt handler if it is54* non-NULL.55*/56struct atmel_pcm_dma_params {57char *name; /* stream identifier */58int pdc_xfer_size; /* PDC counter increment in bytes */59struct ssc_device *ssc; /* SSC device for stream */60struct atmel_pdc_regs *pdc; /* PDC receive or transmit registers */61struct atmel_ssc_mask *mask; /* SSC & PDC status bits */62struct snd_pcm_substream *substream;63void (*dma_intr_handler)(u32, struct snd_pcm_substream *);64};6566/*67* SSC register access (since ssc_writel() / ssc_readl() require literal name)68*/69#define ssc_readx(base, reg) (__raw_readl((base) + (reg)))70#define ssc_writex(base, reg, value) __raw_writel((value), (base) + (reg))7172#if IS_ENABLED(CONFIG_SND_ATMEL_SOC_PDC)73int atmel_pcm_pdc_platform_register(struct device *dev);74#else75static inline int atmel_pcm_pdc_platform_register(struct device *dev)76{77return 0;78}79#endif8081#if IS_ENABLED(CONFIG_SND_ATMEL_SOC_DMA)82int atmel_pcm_dma_platform_register(struct device *dev);83#else84static inline int atmel_pcm_dma_platform_register(struct device *dev)85{86return 0;87}88#endif8990#endif /* _ATMEL_PCM_H */919293