linux/sound/soc/codecs/pcm512x.h

/* SPDX-License-Identifier: GPL-2.0-only */
/*
 * Driver for the PCM512x CODECs
 *
 * Author:	Mark Brown <[email protected]>
 *		Copyright 2014 Linaro Ltd
 */

#ifndef _SND_SOC_PCM512X
#define _SND_SOC_PCM512X

#include <linux/pm.h>
#include <linux/regmap.h>

#define PCM512x_VIRT_BASE
#define PCM512x_PAGE_LEN
#define PCM512x_PAGE_BASE(n)

#define PCM512x_PAGE

#define PCM512x_RESET
#define PCM512x_POWER
#define PCM512x_MUTE
#define PCM512x_PLL_EN
#define PCM512x_SPI_MISO_FUNCTION
#define PCM512x_DSP
#define PCM512x_GPIO_EN
#define PCM512x_BCLK_LRCLK_CFG
#define PCM512x_DSP_GPIO_INPUT
#define PCM512x_MASTER_MODE
#define PCM512x_PLL_REF
#define PCM512x_DAC_REF
#define PCM512x_GPIO_DACIN
#define PCM512x_GPIO_PLLIN
#define PCM512x_SYNCHRONIZE
#define PCM512x_PLL_COEFF_0
#define PCM512x_PLL_COEFF_1
#define PCM512x_PLL_COEFF_2
#define PCM512x_PLL_COEFF_3
#define PCM512x_PLL_COEFF_4
#define PCM512x_DSP_CLKDIV
#define PCM512x_DAC_CLKDIV
#define PCM512x_NCP_CLKDIV
#define PCM512x_OSR_CLKDIV
#define PCM512x_MASTER_CLKDIV_1
#define PCM512x_MASTER_CLKDIV_2
#define PCM512x_FS_SPEED_MODE
#define PCM512x_IDAC_1
#define PCM512x_IDAC_2
#define PCM512x_ERROR_DETECT
#define PCM512x_I2S_1
#define PCM512x_I2S_2
#define PCM512x_DAC_ROUTING
#define PCM512x_DSP_PROGRAM
#define PCM512x_CLKDET
#define PCM512x_AUTO_MUTE
#define PCM512x_DIGITAL_VOLUME_1
#define PCM512x_DIGITAL_VOLUME_2
#define PCM512x_DIGITAL_VOLUME_3
#define PCM512x_DIGITAL_MUTE_1
#define PCM512x_DIGITAL_MUTE_2
#define PCM512x_DIGITAL_MUTE_3
#define PCM512x_GPIO_OUTPUT_1
#define PCM512x_GPIO_OUTPUT_2
#define PCM512x_GPIO_OUTPUT_3
#define PCM512x_GPIO_OUTPUT_4
#define PCM512x_GPIO_OUTPUT_5
#define PCM512x_GPIO_OUTPUT_6
#define PCM512x_GPIO_CONTROL_1
#define PCM512x_GPIO_CONTROL_2
#define PCM512x_OVERFLOW
#define PCM512x_RATE_DET_1
#define PCM512x_RATE_DET_2
#define PCM512x_RATE_DET_3
#define PCM512x_RATE_DET_4
#define PCM512x_CLOCK_STATUS
#define PCM512x_ANALOG_MUTE_DET
#define PCM512x_GPIN
#define PCM512x_DIGITAL_MUTE_DET

#define PCM512x_OUTPUT_AMPLITUDE
#define PCM512x_ANALOG_GAIN_CTRL
#define PCM512x_UNDERVOLTAGE_PROT
#define PCM512x_ANALOG_MUTE_CTRL
#define PCM512x_ANALOG_GAIN_BOOST
#define PCM512x_VCOM_CTRL_1
#define PCM512x_VCOM_CTRL_2

#define PCM512x_CRAM_CTRL

#define PCM512x_FLEX_A
#define PCM512x_FLEX_B

#define PCM512x_MAX_REGISTER

/* Page 0, Register 1 - reset */
#define PCM512x_RSTR
#define PCM512x_RSTM

/* Page 0, Register 2 - power */
#define PCM512x_RQPD
#define PCM512x_RQPD_SHIFT
#define PCM512x_RQST
#define PCM512x_RQST_SHIFT

/* Page 0, Register 3 - mute */
#define PCM512x_RQMR
#define PCM512x_RQMR_SHIFT
#define PCM512x_RQML
#define PCM512x_RQML_SHIFT

/* Page 0, Register 4 - PLL */
#define PCM512x_PLLE
#define PCM512x_PLLE_SHIFT
#define PCM512x_PLCK
#define PCM512x_PLCK_SHIFT

/* Page 0, Register 7 - DSP */
#define PCM512x_SDSL
#define PCM512x_SDSL_SHIFT
#define PCM512x_DEMP
#define PCM512x_DEMP_SHIFT

/* Page 0, Register 8 - GPIO output enable */
#define PCM512x_G1OE
#define PCM512x_G2OE
#define PCM512x_G3OE
#define PCM512x_G4OE
#define PCM512x_G5OE
#define PCM512x_G6OE

/* Page 0, Register 9 - BCK, LRCLK configuration */
#define PCM512x_LRKO
#define PCM512x_LRKO_SHIFT
#define PCM512x_BCKO
#define PCM512x_BCKO_SHIFT
#define PCM512x_BCKP
#define PCM512x_BCKP_SHIFT

/* Page 0, Register 12 - Master mode BCK, LRCLK reset */
#define PCM512x_RLRK
#define PCM512x_RLRK_SHIFT
#define PCM512x_RBCK
#define PCM512x_RBCK_SHIFT

/* Page 0, Register 13 - PLL reference */
#define PCM512x_SREF
#define PCM512x_SREF_SHIFT
#define PCM512x_SREF_SCK
#define PCM512x_SREF_BCK
#define PCM512x_SREF_GPIO

/* Page 0, Register 14 - DAC reference */
#define PCM512x_SDAC
#define PCM512x_SDAC_SHIFT
#define PCM512x_SDAC_MCK
#define PCM512x_SDAC_PLL
#define PCM512x_SDAC_SCK
#define PCM512x_SDAC_BCK
#define PCM512x_SDAC_GPIO

/* Page 0, Register 16, 18 - GPIO source for DAC, PLL */
#define PCM512x_GREF
#define PCM512x_GREF_SHIFT
#define PCM512x_GREF_GPIO1
#define PCM512x_GREF_GPIO2
#define PCM512x_GREF_GPIO3
#define PCM512x_GREF_GPIO4
#define PCM512x_GREF_GPIO5
#define PCM512x_GREF_GPIO6

/* Page 0, Register 19 - synchronize */
#define PCM512x_RQSY
#define PCM512x_RQSY_RESUME
#define PCM512x_RQSY_HALT

/* Page 0, Register 34 - fs speed mode */
#define PCM512x_FSSP
#define PCM512x_FSSP_SHIFT
#define PCM512x_FSSP_48KHZ
#define PCM512x_FSSP_96KHZ
#define PCM512x_FSSP_192KHZ
#define PCM512x_FSSP_384KHZ

/* Page 0, Register 37 - Error detection */
#define PCM512x_IPLK
#define PCM512x_DCAS
#define PCM512x_IDCM
#define PCM512x_IDCH
#define PCM512x_IDSK
#define PCM512x_IDBK
#define PCM512x_IDFS

/* Page 0, Register 40 - I2S configuration */
#define PCM512x_ALEN
#define PCM512x_ALEN_SHIFT
#define PCM512x_ALEN_16
#define PCM512x_ALEN_20
#define PCM512x_ALEN_24
#define PCM512x_ALEN_32
#define PCM512x_AFMT
#define PCM512x_AFMT_SHIFT
#define PCM512x_AFMT_I2S
#define PCM512x_AFMT_DSP
#define PCM512x_AFMT_RTJ
#define PCM512x_AFMT_LTJ

/* Page 0, Register 42 - DAC routing */
#define PCM512x_AUPR_SHIFT
#define PCM512x_AUPL_SHIFT

/* Page 0, Register 59 - auto mute */
#define PCM512x_ATMR_SHIFT
#define PCM512x_ATML_SHIFT

/* Page 0, Register 63 - ramp rates */
#define PCM512x_VNDF_SHIFT
#define PCM512x_VNDS_SHIFT
#define PCM512x_VNUF_SHIFT
#define PCM512x_VNUS_SHIFT

/* Page 0, Register 64 - emergency ramp rates */
#define PCM512x_VEDF_SHIFT
#define PCM512x_VEDS_SHIFT

/* Page 0, Register 65 - Digital mute enables */
#define PCM512x_ACTL_SHIFT
#define PCM512x_AMLE_SHIFT
#define PCM512x_AMRE_SHIFT

/* Page 0, Register 80-85, GPIO output selection */
#define PCM512x_GxSL
#define PCM512x_GxSL_SHIFT
#define PCM512x_GxSL_OFF
#define PCM512x_GxSL_DSP
#define PCM512x_GxSL_REG
#define PCM512x_GxSL_AMUTB
#define PCM512x_GxSL_AMUTL
#define PCM512x_GxSL_AMUTR
#define PCM512x_GxSL_CLKI
#define PCM512x_GxSL_SDOUT
#define PCM512x_GxSL_ANMUL
#define PCM512x_GxSL_ANMUR
#define PCM512x_GxSL_PLLLK
#define PCM512x_GxSL_CPCLK
#define PCM512x_GxSL_UV0_7
#define PCM512x_GxSL_UV0_3
#define PCM512x_GxSL_PLLCK

/* Page 1, Register 2 - analog volume control */
#define PCM512x_RAGN_SHIFT
#define PCM512x_LAGN_SHIFT

/* Page 1, Register 7 - analog boost control */
#define PCM512x_AGBR_SHIFT
#define PCM512x_AGBL_SHIFT

extern const struct dev_pm_ops pcm512x_pm_ops;
extern const struct regmap_config pcm512x_regmap;

int pcm512x_probe(struct device *dev, struct regmap *regmap);
void pcm512x_remove(struct device *dev);

#endif