xref: /openbmc/linux/drivers/iio/dac/stm32-dac-core.h (revision 2f164822)
1 /* SPDX-License-Identifier: GPL-2.0 */
2 /*
3  * This file is part of STM32 DAC driver
4  *
5  * Copyright (C) 2017, STMicroelectronics - All Rights Reserved
6  * Author: Fabrice Gasnier <fabrice.gasnier@st.com>.
7  */
8 
9 #ifndef __STM32_DAC_CORE_H
10 #define __STM32_DAC_CORE_H
11 
12 #include <linux/regmap.h>
13 
14 /* STM32 DAC registers */
15 #define STM32_DAC_CR		0x00
16 #define STM32_DAC_DHR12R1	0x08
17 #define STM32_DAC_DHR12R2	0x14
18 #define STM32_DAC_DOR1		0x2C
19 #define STM32_DAC_DOR2		0x30
20 
21 /* STM32_DAC_CR bit fields */
22 #define STM32_DAC_CR_EN1		BIT(0)
23 #define STM32H7_DAC_CR_HFSEL		BIT(15)
24 #define STM32_DAC_CR_EN2		BIT(16)
25 
26 /**
27  * struct stm32_dac_common - stm32 DAC driver common data (for all instances)
28  * @regmap: DAC registers shared via regmap
29  * @vref_mv: reference voltage (mv)
30  * @hfsel: high speed bus clock selected
31  */
32 struct stm32_dac_common {
33 	struct regmap			*regmap;
34 	int				vref_mv;
35 	bool				hfsel;
36 };
37 
38 #endif
39