linux/drivers/iio/dac/stm32-dac-core.h
<<
>>
Prefs
   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
  22#ifndef __STM32_DAC_CORE_H
  23#define __STM32_DAC_CORE_H
  24
  25#include <linux/regmap.h>
  26
  27/* STM32 DAC registers */
  28#define STM32_DAC_CR            0x00
  29#define STM32_DAC_DHR12R1       0x08
  30#define STM32_DAC_DHR12R2       0x14
  31#define STM32_DAC_DOR1          0x2C
  32#define STM32_DAC_DOR2          0x30
  33
  34/* STM32_DAC_CR bit fields */
  35#define STM32_DAC_CR_EN1                BIT(0)
  36#define STM32H7_DAC_CR_HFSEL            BIT(15)
  37#define STM32_DAC_CR_EN2                BIT(16)
  38
  39/**
  40 * struct stm32_dac_common - stm32 DAC driver common data (for all instances)
  41 * @regmap: DAC registers shared via regmap
  42 * @vref_mv: reference voltage (mv)
  43 * @hfsel: high speed bus clock selected
  44 */
  45struct stm32_dac_common {
  46        struct regmap                   *regmap;
  47        int                             vref_mv;
  48        bool                            hfsel;
  49};
  50
  51#endif
  52