linux/sound/soc/codecs/es8311.h

/* SPDX-License-Identifier: GPL-2.0-only */
/*
 * es8311.c -- es8311 ALSA SoC audio driver
 *
 * Copyright (C) 2024 Matteo Martelli <[email protected]>
 *
 * Author: Matteo Martelli <[email protected]>
 */

#ifndef _ES8311_H
#define _ES8311_H

#include <linux/bitops.h>

#define ES8311_RESET
#define ES8311_RESET_CSM_ON
#define ES8311_RESET_MSC
#define ES8311_RESET_RST_MASK

/* Clock Manager Registers */
#define ES8311_CLKMGR1
#define ES8311_CLKMGR1_MCLK_SEL
#define ES8311_CLKMGR1_MCLK_ON
#define ES8311_CLKMGR1_BCLK_ON
#define ES8311_CLKMGR1_CLKADC_ON_SHIFT
#define ES8311_CLKMGR1_CLKDAC_ON_SHIFT
#define ES8311_CLKMGR1_ANACLKADC_ON_SHIFT
#define ES8311_CLKMGR1_ANACLKDAC_ON_SHIFT
#define ES8311_CLKMGR2
#define ES8311_CLKMGR2_DIV_PRE_MASK
#define ES8311_CLKMGR2_DIV_PRE_SHIFT
#define ES8311_CLKMGR2_DIV_PRE_MAX
#define ES8311_CLKMGR2_MULT_PRE_MASK
#define ES8311_CLKMGR2_MULT_PRE_SHIFT
#define ES8311_CLKMGR3
#define ES8311_CLKMGR4
#define ES8311_CLKMGR5
#define ES8311_CLKMGR5_ADC_DIV_MASK
#define ES8311_CLKMGR5_ADC_DIV_SHIFT
#define ES8311_CLKMGR5_DAC_DIV_MASK
#define ES8311_CLKMGR5_DAC_DIV_SHIFT
#define ES8311_CLKMGR6
#define ES8311_CLKMGR6_BCLK_INV
#define ES8311_CLKMGR6_DIV_BCLK_MASK
#define ES8311_CLKMGR7
#define ES8311_CLKMGR7_LRCLK_DIV_H_MASK
#define ES8311_CLKMGR8
#define ES8311_CLKMGR_LRCLK_DIV_MAX

/* SDP Mode Registers */
#define ES8311_SDP_IN
#define ES8311_SDP_IN_SEL_SHIFT
#define ES8311_SDP_OUT
/* Following values are the same for both SPD_IN and SDP_OUT */
#define ES8311_SDP_MUTE_SHIFT
#define ES8311_SDP_LRP
#define ES8311_SDP_WL_MASK
#define ES8311_SDP_WL_SHIFT
#define ES8311_SDP_WL_24
#define ES8311_SDP_WL_20
#define ES8311_SDP_WL_18
#define ES8311_SDP_WL_16
#define ES8311_SDP_WL_32
#define ES8311_SDP_FMT_MASK
#define ES8311_SDP_FMT_I2S
#define ES8311_SDP_FMT_LEFT_J
#define ES8311_SDP_FMT_DSP

/* System registers */
#define ES8311_SYS1
#define ES8311_SYS2
#define ES8311_SYS3
#define ES8311_SYS3_PDN_ANA_SHIFT
#define ES8311_SYS3_PDN_IBIASGEN_SHIFT
#define ES8311_SYS3_PDN_ADCBIASGEN_SHIFT
#define ES8311_SYS3_PDN_ADCVREFGEN_SHIFT
#define ES8311_SYS3_PDN_DACVREFGEN_SHIFT
#define ES8311_SYS3_PDN_VREF_SHIFT
#define ES8311_SYS3_PDN_VMIDSEL_MASK
#define ES8311_SYS3_PDN_VMIDSEL_POWER_DOWN
#define ES8311_SYS3_PDN_VMIDSEL_STARTUP_NORMAL_SPEED
#define ES8311_SYS3_PDN_VMIDSEL_NORMAL_OPERATION
#define ES8311_SYS3_PDN_VMIDSEL_STARTUP_FAST_SPEED
#define ES8311_SYS4
#define ES8311_SYS4_PDN_PGA_SHIFT
#define ES8311_SYS4_PDN_MOD_SHIFT
#define ES8311_SYS5
#define ES8311_SYS6
#define ES8311_SYS7
#define ES8311_SYS8
#define ES8311_SYS8_PDN_DAC_SHIFT
#define ES8311_SYS9
#define ES8311_SYS9_HPSW_SHIFT
#define ES8311_SYS10
#define ES8311_SYS10_DMIC_ON_SHIFT
#define ES8311_SYS10_LINESEL_SHIFT
#define ES8311_SYS10_PGAGAIN_SHIFT
#define ES8311_SYS10_PGAGAIN_MAX

/* ADC Registers*/
#define ES8311_ADC1
#define ES8311_ADC1_RAMPRATE_SHIFT
#define ES8311_ADC2
#define ES8311_ADC2_INV_SHIFT
#define ES8311_ADC2_SCALE_SHIFT
#define ES8311_ADC2_SCALE_MAX
#define ES8311_ADC3
#define ES8311_ADC3_VOLUME_SHIFT
#define ES8311_ADC3_VOLUME_MAX
#define ES8311_ADC4
#define ES8311_ADC4_ALC_EN_SHIFT
#define ES8311_ADC4_AUTOMUTE_EN_SHIFT
#define ES8311_ADC4_ALC_WINSIZE_SHIFT
#define ES8311_ADC5
#define ES8311_ADC5_ALC_MAXLEVEL_SHIFT
#define ES8311_ADC5_ALC_MAXLEVEL_MAX
#define ES8311_ADC5_ALC_MINLEVEL_SHIFT
#define ES8311_ADC5_ALC_MINLEVEL_MAX
#define ES8311_ADC6
#define ES8311_ADC6_AUTOMUTE_WS_SHIFT
#define ES8311_ADC6_AUTOMUTE_NG_SHIFT
#define ES8311_ADC6_AUTOMUTE_NG_MAX

#define ES8311_ADC7
#define ES8311_ADC7_AUTOMUTE_VOL_SHIFT
#define ES8311_ADC7_AUTOMUTE_VOL_MAX
#define ES8311_ADC8
#define ES8311_ADC8_EQBYPASS_SHIFT
#define ES8311_ADC8_HPF_SHIFT

/* DAC Registers */
#define ES8311_DAC1
#define ES8311_DAC1_DAC_DSMMUTE
#define ES8311_DAC1_DAC_DEMMUTE
#define ES8311_DAC2
#define ES8311_DAC2_VOLUME_MAX
#define ES8311_DAC3
#define ES8311_DAC4
#define ES8311_DAC4_DRC_EN_SHIFT
#define ES8311_DAC4_DRC_WINSIZE_SHIFT
#define ES8311_DAC5
#define ES8311_DAC5_DRC_MAXLEVEL_SHIFT
#define ES8311_DAC5_DRC_MAXLEVEL_MAX
#define ES8311_DAC5_DRC_MINLEVEL_SHIFT
#define ES8311_DAC5_DRC_MINLEVEL_MAX
#define ES8311_DAC6
#define ES8311_DAC6_RAMPRATE_SHIFT
#define ES8311_DAC6_EQBYPASS_SHIFT

/* GPIO Registers */
#define ES8311_GPIO
#define ES8311_GPIO_ADC2DAC_SEL_SHIFT
#define ES8311_GPIO_ADCDAT_SEL_SHIFT

/* Chip Info Registers */
#define ES8311_CHIPID1
#define ES8311_CHIPID2
#define ES8311_CHIPVER

#define ES8311_REG_MAX

#endif