162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-or-later */
262306a36Sopenharmony_ci/*
362306a36Sopenharmony_ci * Driver for Digigram VX222 PCI soundcards
462306a36Sopenharmony_ci *
562306a36Sopenharmony_ci * Copyright (c) 2002 by Takashi Iwai <tiwai@suse.de>
662306a36Sopenharmony_ci */
762306a36Sopenharmony_ci
862306a36Sopenharmony_ci#ifndef __VX222_H
962306a36Sopenharmony_ci#define __VX222_H
1062306a36Sopenharmony_ci
1162306a36Sopenharmony_ci#include <sound/vx_core.h>
1262306a36Sopenharmony_ci
1362306a36Sopenharmony_cistruct snd_vx222 {
1462306a36Sopenharmony_ci
1562306a36Sopenharmony_ci	struct vx_core core;
1662306a36Sopenharmony_ci
1762306a36Sopenharmony_ci	/* h/w config; for PLX and for DSP */
1862306a36Sopenharmony_ci	struct pci_dev *pci;
1962306a36Sopenharmony_ci	unsigned long port[2];
2062306a36Sopenharmony_ci
2162306a36Sopenharmony_ci	unsigned int regCDSP;	/* current CDSP register */
2262306a36Sopenharmony_ci	unsigned int regCFG;	/* current CFG register */
2362306a36Sopenharmony_ci	unsigned int regSELMIC;	/* current SELMIC reg. (for VX222 Mic) */
2462306a36Sopenharmony_ci
2562306a36Sopenharmony_ci	int input_level[2];	/* input level for vx222 mic */
2662306a36Sopenharmony_ci	int mic_level;		/* mic level for vx222 mic */
2762306a36Sopenharmony_ci};
2862306a36Sopenharmony_ci
2962306a36Sopenharmony_ci#define to_vx222(x)	container_of(x, struct snd_vx222, core)
3062306a36Sopenharmony_ci
3162306a36Sopenharmony_ci/* we use a lookup table with 148 values, see vx_mixer.c */
3262306a36Sopenharmony_ci#define VX2_AKM_LEVEL_MAX	0x93
3362306a36Sopenharmony_ci
3462306a36Sopenharmony_ciextern const struct snd_vx_ops vx222_ops;
3562306a36Sopenharmony_ciextern const struct snd_vx_ops vx222_old_ops;
3662306a36Sopenharmony_ci
3762306a36Sopenharmony_ci/* Offset of registers with base equal to portDSP. */
3862306a36Sopenharmony_ci#define VX_RESET_DMA_REGISTER_OFFSET    0x00000008
3962306a36Sopenharmony_ci
4062306a36Sopenharmony_ci/* Constants used to access the INTCSR register. */
4162306a36Sopenharmony_ci#define VX_INTCSR_VALUE                 0x00000001
4262306a36Sopenharmony_ci#define VX_PCI_INTERRUPT_MASK           0x00000040
4362306a36Sopenharmony_ci
4462306a36Sopenharmony_ci/* Constants used to access the CDSP register (0x20). */
4562306a36Sopenharmony_ci#define VX_CDSP_TEST1_MASK              0x00000080
4662306a36Sopenharmony_ci#define VX_CDSP_TOR1_MASK               0x00000040
4762306a36Sopenharmony_ci#define VX_CDSP_TOR2_MASK               0x00000020
4862306a36Sopenharmony_ci#define VX_CDSP_RESERVED0_0_MASK        0x00000010
4962306a36Sopenharmony_ci#define VX_CDSP_CODEC_RESET_MASK        0x00000008
5062306a36Sopenharmony_ci#define VX_CDSP_VALID_IRQ_MASK          0x00000004
5162306a36Sopenharmony_ci#define VX_CDSP_TEST0_MASK              0x00000002
5262306a36Sopenharmony_ci#define VX_CDSP_DSP_RESET_MASK          0x00000001
5362306a36Sopenharmony_ci
5462306a36Sopenharmony_ci#define VX_CDSP_GPIO_OUT_MASK           0x00000060
5562306a36Sopenharmony_ci#define VX_GPIO_OUT_BIT_OFFSET          5               // transform output to bit 0 and 1
5662306a36Sopenharmony_ci
5762306a36Sopenharmony_ci/* Constants used to access the CFG register (0x24). */
5862306a36Sopenharmony_ci#define VX_CFG_SYNCDSP_MASK             0x00000080
5962306a36Sopenharmony_ci#define VX_CFG_RESERVED0_0_MASK         0x00000040
6062306a36Sopenharmony_ci#define VX_CFG_RESERVED1_0_MASK         0x00000020
6162306a36Sopenharmony_ci#define VX_CFG_RESERVED2_0_MASK         0x00000010
6262306a36Sopenharmony_ci#define VX_CFG_DATAIN_SEL_MASK          0x00000008     // 0 (ana), 1 (UER)
6362306a36Sopenharmony_ci#define VX_CFG_RESERVED3_0_MASK         0x00000004
6462306a36Sopenharmony_ci#define VX_CFG_RESERVED4_0_MASK         0x00000002
6562306a36Sopenharmony_ci#define VX_CFG_CLOCKIN_SEL_MASK         0x00000001     // 0 (internal), 1 (AES/EBU)
6662306a36Sopenharmony_ci
6762306a36Sopenharmony_ci/* Constants used to access the STATUS register (0x30). */
6862306a36Sopenharmony_ci#define VX_STATUS_DATA_XICOR_MASK       0x00000080
6962306a36Sopenharmony_ci#define VX_STATUS_VAL_TEST1_MASK        0x00000040
7062306a36Sopenharmony_ci#define VX_STATUS_VAL_TEST0_MASK        0x00000020
7162306a36Sopenharmony_ci#define VX_STATUS_RESERVED0_MASK        0x00000010
7262306a36Sopenharmony_ci#define VX_STATUS_VAL_TOR1_MASK         0x00000008
7362306a36Sopenharmony_ci#define VX_STATUS_VAL_TOR0_MASK         0x00000004
7462306a36Sopenharmony_ci#define VX_STATUS_LEVEL_IN_MASK         0x00000002    // 6 dBu (0), 22 dBu (1)
7562306a36Sopenharmony_ci#define VX_STATUS_MEMIRQ_MASK           0x00000001
7662306a36Sopenharmony_ci
7762306a36Sopenharmony_ci#define VX_STATUS_GPIO_IN_MASK          0x0000000C
7862306a36Sopenharmony_ci#define VX_GPIO_IN_BIT_OFFSET           0             // leave input as bit 2 and 3
7962306a36Sopenharmony_ci
8062306a36Sopenharmony_ci/* Constants used to access the MICRO INPUT SELECT register (0x40). */
8162306a36Sopenharmony_ci#define MICRO_SELECT_INPUT_NORM        0x00
8262306a36Sopenharmony_ci#define MICRO_SELECT_INPUT_MUTE        0x01
8362306a36Sopenharmony_ci#define MICRO_SELECT_INPUT_LIMIT       0x02
8462306a36Sopenharmony_ci#define MICRO_SELECT_INPUT_MASK        0x03
8562306a36Sopenharmony_ci
8662306a36Sopenharmony_ci#define MICRO_SELECT_PREAMPLI_G_0      0x00
8762306a36Sopenharmony_ci#define MICRO_SELECT_PREAMPLI_G_1      0x04
8862306a36Sopenharmony_ci#define MICRO_SELECT_PREAMPLI_G_2      0x08
8962306a36Sopenharmony_ci#define MICRO_SELECT_PREAMPLI_G_3      0x0C
9062306a36Sopenharmony_ci#define MICRO_SELECT_PREAMPLI_MASK     0x0C
9162306a36Sopenharmony_ci#define MICRO_SELECT_PREAMPLI_OFFSET   2
9262306a36Sopenharmony_ci
9362306a36Sopenharmony_ci#define MICRO_SELECT_RAISE_COMPR       0x10
9462306a36Sopenharmony_ci
9562306a36Sopenharmony_ci#define MICRO_SELECT_NOISE_T_52DB      0x00
9662306a36Sopenharmony_ci#define MICRO_SELECT_NOISE_T_42DB      0x20
9762306a36Sopenharmony_ci#define MICRO_SELECT_NOISE_T_32DB      0x40
9862306a36Sopenharmony_ci#define MICRO_SELECT_NOISE_T_MASK      0x60
9962306a36Sopenharmony_ci
10062306a36Sopenharmony_ci#define MICRO_SELECT_PHANTOM_ALIM      0x80
10162306a36Sopenharmony_ci
10262306a36Sopenharmony_ci
10362306a36Sopenharmony_ci#endif /* __VX222_H */
104