xref: /openbmc/linux/sound/soc/codecs/tpa6130a2.h (revision 2b27bdcc)
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 /*
3  * ALSA SoC TPA6130A2 amplifier driver
4  *
5  * Copyright (C) Nokia Corporation
6  *
7  * Author: Peter Ujfalusi <peter.ujfalusi@ti.com>
8  */
9 
10 #ifndef __TPA6130A2_H__
11 #define __TPA6130A2_H__
12 
13 /* Register addresses */
14 #define TPA6130A2_REG_CONTROL		0x01
15 #define TPA6130A2_REG_VOL_MUTE		0x02
16 #define TPA6130A2_REG_OUT_IMPEDANCE	0x03
17 #define TPA6130A2_REG_VERSION		0x04
18 
19 /* Register bits */
20 /* TPA6130A2_REG_CONTROL (0x01) */
21 #define TPA6130A2_SWS_SHIFT		0
22 #define TPA6130A2_SWS			(0x01 << TPA6130A2_SWS_SHIFT)
23 #define TPA6130A2_TERMAL		(0x01 << 1)
24 #define TPA6130A2_MODE(x)		(x << 4)
25 #define TPA6130A2_MODE_STEREO		(0x00)
26 #define TPA6130A2_MODE_DUAL_MONO	(0x01)
27 #define TPA6130A2_MODE_BRIDGE		(0x02)
28 #define TPA6130A2_MODE_MASK		(0x03)
29 #define TPA6130A2_HP_EN_R_SHIFT		6
30 #define TPA6130A2_HP_EN_R		(0x01 << TPA6130A2_HP_EN_R_SHIFT)
31 #define TPA6130A2_HP_EN_L_SHIFT		7
32 #define TPA6130A2_HP_EN_L		(0x01 << TPA6130A2_HP_EN_L_SHIFT)
33 
34 /* TPA6130A2_REG_VOL_MUTE (0x02) */
35 #define TPA6130A2_VOLUME(x)		((x & 0x3f) << 0)
36 #define TPA6130A2_MUTE_R		(0x01 << 6)
37 #define TPA6130A2_MUTE_L		(0x01 << 7)
38 
39 /* TPA6130A2_REG_OUT_IMPEDANCE (0x03) */
40 #define TPA6130A2_HIZ_R			(0x01 << 0)
41 #define TPA6130A2_HIZ_L			(0x01 << 1)
42 
43 /* TPA6130A2_REG_VERSION (0x04) */
44 #define TPA6130A2_VERSION_MASK		(0x0f)
45 
46 #endif /* __TPA6130A2_H__ */
47