linux/sound/soc/codecs/cs530x.h

/* SPDX-License-Identifier: GPL-2.0 */
/*
 * CS530x CODEC driver internal data
 *
 * Copyright (C) 2023-2024 Cirrus Logic, Inc. and
 *                         Cirrus Logic International Semiconductor Ltd.
 */

#ifndef _CS530X_H
#define _CS530X_H

#include <linux/device.h>
#include <linux/gpio/consumer.h>
#include <linux/regmap.h>
#include <linux/regulator/consumer.h>

/* Devices */
#define CS530X_2CH_ADC_DEV_ID
#define CS530X_4CH_ADC_DEV_ID
#define CS530X_8CH_ADC_DEV_ID

/* Registers */

#define CS530X_DEVID
#define CS530X_REVID
#define CS530X_SW_RESET

#define CS530X_CLK_CFG_0
#define CS530X_CLK_CFG_1
#define CS530X_CHIP_ENABLE
#define CS530X_ASP_CFG
#define CS530X_SIGNAL_PATH_CFG
#define CS530X_IN_ENABLES
#define CS530X_IN_RAMP_SUM
#define CS530X_IN_FILTER
#define CS530X_IN_HIZ
#define CS530X_IN_INV
#define CS530X_IN_VOL_CTRL1_0
#define CS530X_IN_VOL_CTRL1_1
#define CS530X_IN_VOL_CTRL2_0
#define CS530X_IN_VOL_CTRL2_1
#define CS530X_IN_VOL_CTRL3_0
#define CS530X_IN_VOL_CTRL3_1
#define CS530X_IN_VOL_CTRL4_0
#define CS530X_IN_VOL_CTRL4_1
#define CS530X_IN_VOL_CTRL5

#define CS530X_PAD_FN
#define CS530X_PAD_LVL

#define CS530X_MAX_REGISTER

/* Register Fields */

/* REVID */
#define CS530X_MTLREVID
#define CS530X_AREVID

/* SW_RESET */
#define CS530X_SW_RST_SHIFT
#define CS530X_SW_RST_VAL

/* CLK_CFG_0 */
#define CS530X_PLL_REFCLK_SRC_MASK
#define CS530X_PLL_REFCLK_FREQ_MASK
#define CS530X_SYSCLK_SRC_MASK
#define CS530X_SYSCLK_SRC_SHIFT
#define CS530X_REFCLK_2P822_3P072
#define CS530X_REFCLK_5P6448_6P144
#define CS530X_REFCLK_11P2896_12P288
#define CS530X_REFCLK_24P5792_24P576

/* CLK_CFG_1 */
#define CS530X_SAMPLE_RATE_MASK
#define CS530X_FS_32K
#define CS530X_FS_48K_44P1K
#define CS530X_FS_96K_88P2K
#define CS530X_FS_192K_176P4K
#define CS530X_FS_384K_356P8K
#define CS530X_FS_768K_705P6K

/* CHIP_ENABLE */
#define CS530X_GLOBAL_EN

/* ASP_CFG */
#define CS530X_ASP_BCLK_FREQ_MASK
#define CS530X_ASP_PRIMARY
#define CS530X_ASP_BCLK_INV
#define CS530X_BCLK_2P822_3P072
#define CS530X_BCLK_5P6448_6P144
#define CS530X_BCLK_11P2896_12P288
#define CS530X_BCLK_24P5792_24P576

/* SIGNAL_PATH_CFG */
#define CS530X_ASP_FMT_MASK
#define CS530X_ASP_TDM_SLOT_MASK
#define CS530X_ASP_TDM_SLOT_SHIFT
#define CS530X_ASP_CH_REVERSE
#define CS530X_TDM_EN_MASK
#define CS530X_ASP_FMT_I2S
#define CS530X_ASP_FMT_LJ
#define CS530X_ASP_FMT_DSP_A

/* TDM Slots */
#define CS530X_0_1_TDM_SLOT_MASK
#define CS530X_0_3_TDM_SLOT_MASK
#define CS530X_0_7_TDM_SLOT_MASK
#define CS530X_0_7_TDM_SLOT_VAL

#define CS530X_2_3_TDM_SLOT_MASK
#define CS530X_2_3_TDM_SLOT_VAL

#define CS530X_4_5_TDM_SLOT_MASK
#define CS530X_4_7_TDM_SLOT_MASK
#define CS530X_4_7_TDM_SLOT_VAL

#define CS530X_6_7_TDM_SLOT_MASK
#define CS530X_6_7_TDM_SLOT_VAL

#define CS530X_8_9_TDM_SLOT_MASK
#define CS530X_8_11_TDM_SLOT_MASK
#define CS530X_8_15_TDM_SLOT_MASK
#define CS530X_8_15_TDM_SLOT_VAL

#define CS530X_10_11_TDM_SLOT_MASK
#define CS530X_10_11_TDM_SLOT_VAL

#define CS530X_12_13_TDM_SLOT_MASK
#define CS530X_12_15_TDM_SLOT_MASK
#define CS530X_12_15_TDM_SLOT_VAL

#define CS530X_14_15_TDM_SLOT_MASK
#define CS530X_14_15_TDM_SLOT_VAL

/* IN_RAMP_SUM */
#define CS530X_RAMP_RATE_INC_SHIFT
#define CS530X_RAMP_RATE_DEC_SHIFT
#define CS530X_IN_SUM_MODE_SHIFT

/* IN_FILTER */
#define CS530X_IN_FILTER_SHIFT
#define CS530X_IN_HPF_EN_SHIFT

/* IN_HIZ */
#define CS530X_IN12_HIZ
#define CS530X_IN34_HIZ
#define CS530X_IN56_HIZ
#define CS530X_IN78_HIZ

/* IN_INV */
#define CS530X_IN1_INV_SHIFT
#define CS530X_IN2_INV_SHIFT
#define CS530X_IN3_INV_SHIFT
#define CS530X_IN4_INV_SHIFT
#define CS530X_IN5_INV_SHIFT
#define CS530X_IN6_INV_SHIFT
#define CS530X_IN7_INV_SHIFT
#define CS530X_IN8_INV_SHIFT

/* IN_VOL_CTLy_z */
#define CS530X_IN_MUTE

/* IN_VOL_CTL5 */
#define CS530X_IN_VU

/* PAD_FN */
#define CS530X_DOUT2_FN
#define CS530X_DOUT3_FN
#define CS530X_DOUT4_FN
#define CS530X_SPI_CS_FN
#define CS530X_CONFIG2_FN
#define CS530X_CONFIG3_FN
#define CS530X_CONFIG4_FN
#define CS530X_CONFIG5_FN

/* PAD_LVL */
#define CS530X_CONFIG2_LVL
#define CS530X_CONFIG3_LVL
#define CS530X_CONFIG4_LVL
#define CS530X_CONFIG5_LVL

/* System Clock Source */
#define CS530X_SYSCLK_SRC_MCLK
#define CS530X_SYSCLK_SRC_PLL

/* PLL Reference Clock Source */
#define CS530X_PLL_SRC_BCLK
#define CS530X_PLL_SRC_MCLK

#define CS530X_NUM_SUPPLIES

enum cs530x_type {};

/* codec private data */
struct cs530x_priv {};

extern const struct regmap_config cs530x_regmap;
int cs530x_probe(struct cs530x_priv *cs530x);

#endif