stm32-dac-core.h 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. /*
  2. * This file is part of STM32 DAC driver
  3. *
  4. * Copyright (C) 2017, STMicroelectronics - All Rights Reserved
  5. * Author: Fabrice Gasnier <fabrice.gasnier@st.com>.
  6. *
  7. * License type: GPLv2
  8. *
  9. * This program is free software; you can redistribute it and/or modify it
  10. * under the terms of the GNU General Public License version 2 as published by
  11. * the Free Software Foundation.
  12. *
  13. * This program is distributed in the hope that it will be useful, but
  14. * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
  15. * or FITNESS FOR A PARTICULAR PURPOSE.
  16. * See the GNU General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU General Public License along with
  19. * this program. If not, see <http://www.gnu.org/licenses/>.
  20. */
  21. #ifndef __STM32_DAC_CORE_H
  22. #define __STM32_DAC_CORE_H
  23. #include <linux/regmap.h>
  24. /* STM32 DAC registers */
  25. #define STM32_DAC_CR 0x00
  26. #define STM32_DAC_DHR12R1 0x08
  27. #define STM32_DAC_DHR12R2 0x14
  28. #define STM32_DAC_DOR1 0x2C
  29. #define STM32_DAC_DOR2 0x30
  30. /* STM32_DAC_CR bit fields */
  31. #define STM32_DAC_CR_EN1 BIT(0)
  32. #define STM32H7_DAC_CR_HFSEL BIT(15)
  33. #define STM32_DAC_CR_EN2 BIT(16)
  34. /**
  35. * struct stm32_dac_common - stm32 DAC driver common data (for all instances)
  36. * @regmap: DAC registers shared via regmap
  37. * @vref_mv: reference voltage (mv)
  38. * @hfsel: high speed bus clock selected
  39. */
  40. struct stm32_dac_common {
  41. struct regmap *regmap;
  42. int vref_mv;
  43. bool hfsel;
  44. };
  45. #endif