xref: /openbmc/linux/sound/soc/codecs/tas2764.h (revision aca86ec9)
1827ed8a0SDan Murphy /* SPDX-License-Identifier: GPL-2.0-only */
2827ed8a0SDan Murphy /*
3827ed8a0SDan Murphy  * tas2764.h - ALSA SoC Texas Instruments TAS2764 Mono Audio Amplifier
4827ed8a0SDan Murphy  *
5827ed8a0SDan Murphy  * Copyright (C) 2020 Texas Instruments Incorporated -  https://www.ti.com
6827ed8a0SDan Murphy  *
7827ed8a0SDan Murphy  * Author: Dan Murphy <dmurphy@ti.com>
8827ed8a0SDan Murphy  */
9827ed8a0SDan Murphy 
10827ed8a0SDan Murphy #ifndef __TAS2764__
11827ed8a0SDan Murphy #define __TAS2764__
12827ed8a0SDan Murphy 
13827ed8a0SDan Murphy /* Book Control Register */
14827ed8a0SDan Murphy #define TAS2764_BOOKCTL_PAGE	0
15827ed8a0SDan Murphy #define TAS2764_BOOKCTL_REG	127
16827ed8a0SDan Murphy #define TAS2764_REG(page, reg)	((page * 128) + reg)
17827ed8a0SDan Murphy 
18827ed8a0SDan Murphy /* Page */
19827ed8a0SDan Murphy #define TAS2764_PAGE		TAS2764_REG(0X0, 0x00)
20827ed8a0SDan Murphy #define TAS2764_PAGE_PAGE_MASK	255
21827ed8a0SDan Murphy 
22827ed8a0SDan Murphy /* Software Reset */
23827ed8a0SDan Murphy #define TAS2764_SW_RST	TAS2764_REG(0X0, 0x01)
24827ed8a0SDan Murphy #define TAS2764_RST	BIT(0)
25827ed8a0SDan Murphy 
26827ed8a0SDan Murphy /* Power Control */
27827ed8a0SDan Murphy #define TAS2764_PWR_CTRL		TAS2764_REG(0X0, 0x02)
28827ed8a0SDan Murphy #define TAS2764_PWR_CTRL_MASK		GENMASK(1, 0)
29827ed8a0SDan Murphy #define TAS2764_PWR_CTRL_ACTIVE		0x0
30827ed8a0SDan Murphy #define TAS2764_PWR_CTRL_MUTE		BIT(0)
31827ed8a0SDan Murphy #define TAS2764_PWR_CTRL_SHUTDOWN	BIT(1)
32827ed8a0SDan Murphy 
33827ed8a0SDan Murphy #define TAS2764_VSENSE_POWER_EN		3
34827ed8a0SDan Murphy #define TAS2764_ISENSE_POWER_EN		4
35827ed8a0SDan Murphy 
36*aca86ec9SMartin Povišer /* DC Blocker Control */
37*aca86ec9SMartin Povišer #define TAS2764_DC_BLK0			TAS2764_REG(0x0, 0x04)
38*aca86ec9SMartin Povišer #define TAS2764_DC_BLK0_HPF_FREQ_PB_SHIFT  0
39*aca86ec9SMartin Povišer 
40827ed8a0SDan Murphy /* Digital Volume Control */
41827ed8a0SDan Murphy #define TAS2764_DVC	TAS2764_REG(0X0, 0x1a)
42827ed8a0SDan Murphy #define TAS2764_DVC_MAX	0xc9
43827ed8a0SDan Murphy 
44827ed8a0SDan Murphy #define TAS2764_CHNL_0  TAS2764_REG(0X0, 0x03)
45827ed8a0SDan Murphy 
46827ed8a0SDan Murphy /* TDM Configuration Reg0 */
47827ed8a0SDan Murphy #define TAS2764_TDM_CFG0		TAS2764_REG(0X0, 0x08)
48827ed8a0SDan Murphy #define TAS2764_TDM_CFG0_SMP_MASK	BIT(5)
49827ed8a0SDan Murphy #define TAS2764_TDM_CFG0_SMP_48KHZ	0x0
50827ed8a0SDan Murphy #define TAS2764_TDM_CFG0_SMP_44_1KHZ	BIT(5)
51827ed8a0SDan Murphy #define TAS2764_TDM_CFG0_MASK		GENMASK(3, 1)
52827ed8a0SDan Murphy #define TAS2764_TDM_CFG0_44_1_48KHZ	BIT(3)
53827ed8a0SDan Murphy #define TAS2764_TDM_CFG0_88_2_96KHZ	(BIT(3) | BIT(1))
54d1a10f1bSMartin Povišer #define TAS2764_TDM_CFG0_FRAME_START	BIT(0)
55827ed8a0SDan Murphy 
56827ed8a0SDan Murphy /* TDM Configuration Reg1 */
57827ed8a0SDan Murphy #define TAS2764_TDM_CFG1		TAS2764_REG(0X0, 0x09)
58827ed8a0SDan Murphy #define TAS2764_TDM_CFG1_MASK		GENMASK(5, 1)
59827ed8a0SDan Murphy #define TAS2764_TDM_CFG1_51_SHIFT	1
60827ed8a0SDan Murphy #define TAS2764_TDM_CFG1_RX_MASK	BIT(0)
61827ed8a0SDan Murphy #define TAS2764_TDM_CFG1_RX_RISING	0x0
62827ed8a0SDan Murphy #define TAS2764_TDM_CFG1_RX_FALLING	BIT(0)
63827ed8a0SDan Murphy 
64827ed8a0SDan Murphy /* TDM Configuration Reg2 */
65827ed8a0SDan Murphy #define TAS2764_TDM_CFG2		TAS2764_REG(0X0, 0x0a)
66827ed8a0SDan Murphy #define TAS2764_TDM_CFG2_RXW_MASK	GENMASK(3, 2)
67827ed8a0SDan Murphy #define TAS2764_TDM_CFG2_RXW_16BITS	0x0
68827ed8a0SDan Murphy #define TAS2764_TDM_CFG2_RXW_24BITS	BIT(3)
69827ed8a0SDan Murphy #define TAS2764_TDM_CFG2_RXW_32BITS	(BIT(3) | BIT(2))
70827ed8a0SDan Murphy #define TAS2764_TDM_CFG2_RXS_MASK	GENMASK(1, 0)
71827ed8a0SDan Murphy #define TAS2764_TDM_CFG2_RXS_16BITS	0x0
72827ed8a0SDan Murphy #define TAS2764_TDM_CFG2_RXS_24BITS	BIT(0)
73827ed8a0SDan Murphy #define TAS2764_TDM_CFG2_RXS_32BITS	BIT(1)
74d1a10f1bSMartin Povišer #define TAS2764_TDM_CFG2_SCFG_SHIFT	4
75827ed8a0SDan Murphy 
76827ed8a0SDan Murphy /* TDM Configuration Reg3 */
77827ed8a0SDan Murphy #define TAS2764_TDM_CFG3		TAS2764_REG(0X0, 0x0c)
78827ed8a0SDan Murphy #define TAS2764_TDM_CFG3_RXS_MASK	GENMASK(7, 4)
79827ed8a0SDan Murphy #define TAS2764_TDM_CFG3_RXS_SHIFT	0x4
80827ed8a0SDan Murphy #define TAS2764_TDM_CFG3_MASK		GENMASK(3, 0)
81827ed8a0SDan Murphy 
82827ed8a0SDan Murphy /* TDM Configuration Reg5 */
83827ed8a0SDan Murphy #define TAS2764_TDM_CFG5		TAS2764_REG(0X0, 0x0e)
84827ed8a0SDan Murphy #define TAS2764_TDM_CFG5_VSNS_MASK	BIT(6)
85827ed8a0SDan Murphy #define TAS2764_TDM_CFG5_VSNS_ENABLE	BIT(6)
86827ed8a0SDan Murphy #define TAS2764_TDM_CFG5_50_MASK	GENMASK(5, 0)
87827ed8a0SDan Murphy 
88827ed8a0SDan Murphy /* TDM Configuration Reg6 */
89827ed8a0SDan Murphy #define TAS2764_TDM_CFG6		TAS2764_REG(0X0, 0x0f)
90827ed8a0SDan Murphy #define TAS2764_TDM_CFG6_ISNS_MASK	BIT(6)
91827ed8a0SDan Murphy #define TAS2764_TDM_CFG6_ISNS_ENABLE	BIT(6)
92827ed8a0SDan Murphy #define TAS2764_TDM_CFG6_50_MASK	GENMASK(5, 0)
93827ed8a0SDan Murphy 
94dae191fbSMartin Povišer /* Interrupt Masks */
95dae191fbSMartin Povišer #define TAS2764_INT_MASK0               TAS2764_REG(0x0, 0x3b)
96dae191fbSMartin Povišer #define TAS2764_INT_MASK1               TAS2764_REG(0x0, 0x3c)
97dae191fbSMartin Povišer #define TAS2764_INT_MASK2               TAS2764_REG(0x0, 0x40)
98dae191fbSMartin Povišer #define TAS2764_INT_MASK3               TAS2764_REG(0x0, 0x41)
99dae191fbSMartin Povišer #define TAS2764_INT_MASK4               TAS2764_REG(0x0, 0x3d)
100dae191fbSMartin Povišer 
101dae191fbSMartin Povišer /* Latched Fault Registers */
102dae191fbSMartin Povišer #define TAS2764_INT_LTCH0               TAS2764_REG(0x0, 0x49)
103dae191fbSMartin Povišer #define TAS2764_INT_LTCH1               TAS2764_REG(0x0, 0x4a)
104dae191fbSMartin Povišer #define TAS2764_INT_LTCH1_0             TAS2764_REG(0x0, 0x4b)
105dae191fbSMartin Povišer #define TAS2764_INT_LTCH2               TAS2764_REG(0x0, 0x4f)
106dae191fbSMartin Povišer #define TAS2764_INT_LTCH3               TAS2764_REG(0x0, 0x50)
107dae191fbSMartin Povišer #define TAS2764_INT_LTCH4               TAS2764_REG(0x0, 0x51)
108dae191fbSMartin Povišer 
109dae191fbSMartin Povišer /* Clock/IRQ Settings */
110dae191fbSMartin Povišer #define TAS2764_INT_CLK_CFG             TAS2764_REG(0x0, 0x5c)
111dae191fbSMartin Povišer #define TAS2764_INT_CLK_CFG_IRQZ_CLR    BIT(2)
112dae191fbSMartin Povišer 
113827ed8a0SDan Murphy #endif /* __TAS2764__ */
114