forked from Minki/linux
95e339b6e8
Add support for STM32H7 Analog to Digital Converter. It has up to 20 external channels, resolution ranges from 8 to 16bits. Either bus or asynchronous adc clock may be used. Add registers & bitfields definition. Also add new configuration options to enter/exit powerdown and perform self-calibration. Signed-off-by: Fabrice Gasnier <fabrice.gasnier@st.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
57 lines
1.9 KiB
C
57 lines
1.9 KiB
C
/*
|
|
* This file is part of STM32 ADC driver
|
|
*
|
|
* Copyright (C) 2016, STMicroelectronics - All Rights Reserved
|
|
* Author: Fabrice Gasnier <fabrice.gasnier@st.com>.
|
|
*
|
|
* License type: GPLv2
|
|
*
|
|
* This program is free software; you can redistribute it and/or modify it
|
|
* under the terms of the GNU General Public License version 2 as published by
|
|
* the Free Software Foundation.
|
|
*
|
|
* This program is distributed in the hope that it will be useful, but
|
|
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
|
* or FITNESS FOR A PARTICULAR PURPOSE.
|
|
* See the GNU General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU General Public License along with
|
|
* this program. If not, see <http://www.gnu.org/licenses/>.
|
|
*/
|
|
|
|
#ifndef __STM32_ADC_H
|
|
#define __STM32_ADC_H
|
|
|
|
/*
|
|
* STM32 - ADC global register map
|
|
* ________________________________________________________
|
|
* | Offset | Register |
|
|
* --------------------------------------------------------
|
|
* | 0x000 | Master ADC1 |
|
|
* --------------------------------------------------------
|
|
* | 0x100 | Slave ADC2 |
|
|
* --------------------------------------------------------
|
|
* | 0x200 | Slave ADC3 |
|
|
* --------------------------------------------------------
|
|
* | 0x300 | Master & Slave common regs |
|
|
* --------------------------------------------------------
|
|
*/
|
|
#define STM32_ADC_MAX_ADCS 3
|
|
#define STM32_ADCX_COMN_OFFSET 0x300
|
|
|
|
/**
|
|
* struct stm32_adc_common - stm32 ADC driver common data (for all instances)
|
|
* @base: control registers base cpu addr
|
|
* @phys_base: control registers base physical addr
|
|
* @rate: clock rate used for analog circuitry
|
|
* @vref_mv: vref voltage (mv)
|
|
*/
|
|
struct stm32_adc_common {
|
|
void __iomem *base;
|
|
phys_addr_t phys_base;
|
|
unsigned long rate;
|
|
int vref_mv;
|
|
};
|
|
|
|
#endif
|