linux/include/sound/cs8427.h

/* SPDX-License-Identifier: GPL-2.0-or-later */
#ifndef __SOUND_CS8427_H
#define __SOUND_CS8427_H

/*
 *  Routines for Cirrus Logic CS8427
 *  Copyright (c) by Jaroslav Kysela <[email protected]>,
 */

#include <sound/i2c.h>

#define CS8427_BASE_ADDR

#define CS8427_REG_AUTOINC
#define CS8427_REG_CONTROL1
#define CS8427_REG_CONTROL2
#define CS8427_REG_DATAFLOW
#define CS8427_REG_CLOCKSOURCE
#define CS8427_REG_SERIALINPUT
#define CS8427_REG_SERIALOUTPUT
#define CS8427_REG_INT1STATUS
#define CS8427_REG_INT2STATUS
#define CS8427_REG_INT1MASK
#define CS8427_REG_INT1MODEMSB
#define CS8427_REG_INT1MODELSB
#define CS8427_REG_INT2MASK
#define CS8427_REG_INT2MODEMSB
#define CS8427_REG_INT2MODELSB
#define CS8427_REG_RECVCSDATA
#define CS8427_REG_RECVERRORS
#define CS8427_REG_RECVERRMASK
#define CS8427_REG_CSDATABUF
#define CS8427_REG_UDATABUF
#define CS8427_REG_QSUBCODE
#define CS8427_REG_OMCKRMCKRATIO
#define CS8427_REG_CORU_DATABUF
#define CS8427_REG_ID_AND_VER

/* CS8427_REG_CONTROL1 bits */
#define CS8427_SWCLK
#define CS8427_VSET
#define CS8427_MUTESAO
#define CS8427_MUTEAES
#define CS8427_INTMASK
#define CS8427_INTACTHIGH
#define CS8427_INTACTLOW
#define CS8427_INTOPENDRAIN
#define CS8427_TCBLDIR

/* CS8427_REQ_CONTROL2 bits */
#define CS8427_HOLDMASK
#define CS8427_HOLDLASTSAMPLE
#define CS8427_HOLDZERO
#define CS8427_HOLDNOCHANGE
#define CS8427_RMCKF
#define CS8427_MMR
#define CS8427_MMT
#define CS8427_MMTCS
#define CS8427_MMTLR

/* CS8427_REG_DATAFLOW */
#define CS8427_TXOFF
#define CS8427_AESBP
#define CS8427_TXDMASK
#define CS8427_TXDSERIAL
#define CS8427_TXAES3DRECEIVER
#define CS8427_SPDMASK
#define CS8427_SPDSERIAL
#define CS8427_SPDAES3RECEIVER

/* CS8427_REG_CLOCKSOURCE */
#define CS8427_RUN
#define CS8427_CLKMASK
#define CS8427_CLK256
#define CS8427_CLK384
#define CS8427_CLK512
#define CS8427_OUTC
#define CS8427_INC
#define CS8427_RXDMASK
#define CS8427_RXDILRCK
#define CS8427_RXDAES3INPUT
#define CS8427_EXTCLOCKRESET
#define CS8427_EXTCLOCK

/* CS8427_REG_SERIALINPUT */
#define CS8427_SIMS
#define CS8427_SISF
#define CS8427_SIRESMASK
#define CS8427_SIRES24
#define CS8427_SIRES20
#define CS8427_SIRES16
#define CS8427_SIJUST
#define CS8427_SIDEL
#define CS8427_SISPOL
#define CS8427_SILRPOL

/* CS8427_REG_SERIALOUTPUT */
#define CS8427_SOMS
#define CS8427_SOSF
#define CS8427_SORESMASK
#define CS8427_SORES24
#define CS8427_SORES20
#define CS8427_SORES16
#define CS8427_SORESDIRECT
#define CS8427_SOJUST
#define CS8427_SODEL
#define CS8427_SOSPOL
#define CS8427_SOLRPOL

/* CS8427_REG_INT1STATUS */
#define CS8427_TSLIP
#define CS8427_OSLIP
#define CS8427_DETC
#define CS8427_EFTC
#define CS8427_RERR

/* CS8427_REG_INT2STATUS */
#define CS8427_DETU
#define CS8427_EFTU
#define CS8427_QCH

/* CS8427_REG_INT1MODEMSB && CS8427_REG_INT1MODELSB */
/* bits are defined in CS8427_REG_INT1STATUS */
/* CS8427_REG_INT2MODEMSB && CS8427_REG_INT2MODELSB */
/* bits are defined in CS8427_REG_INT2STATUS */
#define CS8427_INTMODERISINGMSB
#define CS8427_INTMODERESINGLSB
#define CS8427_INTMODEFALLINGMSB
#define CS8427_INTMODEFALLINGLSB
#define CS8427_INTMODELEVELMSB
#define CS8427_INTMODELEVELLSB

/* CS8427_REG_RECVCSDATA */
#define CS8427_AUXMASK
#define CS8427_AUXSHIFT
#define CS8427_PRO
#define CS8427_AUDIO
#define CS8427_COPY
#define CS8427_ORIG

/* CS8427_REG_RECVERRORS */
/* CS8427_REG_RECVERRMASK for CS8427_RERR */
#define CS8427_QCRC
#define CS8427_CCRC
#define CS8427_UNLOCK
#define CS8427_V
#define CS8427_CONF
#define CS8427_BIP
#define CS8427_PAR

/* CS8427_REG_CSDATABUF	*/
#define CS8427_BSEL
#define CS8427_CBMR
#define CS8427_DETCI
#define CS8427_EFTCI
#define CS8427_CAM
#define CS8427_CHS

/* CS8427_REG_UDATABUF */
#define CS8427_UD
#define CS8427_UBMMASK
#define CS8427_UBMZEROS
#define CS8427_UBMBLOCK
#define CS8427_DETUI
#define CS8427_EFTUI

/* CS8427_REG_ID_AND_VER */
#define CS8427_IDMASK
#define CS8427_IDSHIFT
#define CS8427_VERMASK
#define CS8427_VERSHIFT
#define CS8427_VER8427A

struct snd_pcm_substream;

int snd_cs8427_init(struct snd_i2c_bus *bus, struct snd_i2c_device *device);
int snd_cs8427_create(struct snd_i2c_bus *bus, unsigned char addr,
		      unsigned int reset_timeout, struct snd_i2c_device **r_cs8427);
int snd_cs8427_reg_write(struct snd_i2c_device *device, unsigned char reg,
			 unsigned char val);
int snd_cs8427_iec958_build(struct snd_i2c_device *cs8427,
			    struct snd_pcm_substream *playback_substream,
			    struct snd_pcm_substream *capture_substream);
int snd_cs8427_iec958_active(struct snd_i2c_device *cs8427, int active);
int snd_cs8427_iec958_pcm(struct snd_i2c_device *cs8427, unsigned int rate);

#endif /* __SOUND_CS8427_H */