blob: 9af51ab381372e8bd56e4b5295f1782b5771f99e [file] [log] [blame]
Minkyu Kangb1b24682011-01-24 15:22:23 +09001/*
2 * Copyright (C) 2010 Samsung Electronics
3 * Minkyu Kang <mk7.kang@samsung.com>
4 * MyungJoo Ham <myungjoo.ham@samsung.com>
5 *
Wolfgang Denkd79de1d2013-07-08 09:37:19 +02006 * SPDX-License-Identifier: GPL-2.0+
Minkyu Kangb1b24682011-01-24 15:22:23 +09007 */
8
9#ifndef __ASM_ARM_ARCH_ADC_H_
10#define __ASM_ARM_ARCH_ADC_H_
11
Przemyslaw Marczakd8c15622015-10-27 13:08:01 +010012#define ADC_V2_CON1_SOFT_RESET (0x2 << 1)
13#define ADC_V2_CON1_STC_EN 0x1
14
15#define ADC_V2_CON2_OSEL(x) (((x) & 0x1) << 10)
16#define OSEL_2S 0x0
17#define OSEL_BINARY 0x1
18#define ADC_V2_CON2_ESEL(x) (((x) & 0x1) << 9)
19#define ESEL_ADC_EVAL_TIME_40CLK 0x0
20#define ESEL_ADC_EVAL_TIME_20CLK 0x1
21#define ADC_V2_CON2_HIGHF(x) (((x) & 0x1) << 8)
22#define HIGHF_CONV_RATE_30KSPS 0x0
23#define HIGHF_CONV_RATE_600KSPS 0x1
24#define ADC_V2_CON2_C_TIME(x) (((x) & 0x7) << 4)
25#define ADC_V2_CON2_CHAN_SEL_MASK 0xf
26#define ADC_V2_CON2_CHAN_SEL(x) ((x) & ADC_V2_CON2_CHAN_SEL_MASK)
27
28#define ADC_V2_GET_STATUS_FLAG(x) (((x) >> 2) & 0x1)
29#define FLAG_CONV_END 0x1
30
31#define ADC_V2_INT_DISABLE 0x0
32#define ADC_V2_INT_ENABLE 0x1
33#define INT_NOT_GENERATED 0x0
34#define INT_GENERATED 0x1
35
36#define ADC_V2_VERSION 0x80000008
37
38#define ADC_V2_MAX_CHANNEL 9
39
40/* For default 8 time convertion with sample rate 600 kSPS - 15us timeout */
41#define ADC_V2_CONV_TIMEOUT_US 15
42
43#define ADC_V2_DAT_MASK 0xfff
44
Minkyu Kangb1b24682011-01-24 15:22:23 +090045#ifndef __ASSEMBLY__
46struct s5p_adc {
47 unsigned int adccon;
48 unsigned int adctsc;
49 unsigned int adcdly;
50 unsigned int adcdat0;
51 unsigned int adcdat1;
52 unsigned int adcupdn;
53 unsigned int adcclrint;
54 unsigned int adcmux;
55 unsigned int adcclrintpndnup;
56};
Przemyslaw Marczakd8c15622015-10-27 13:08:01 +010057
58struct exynos_adc_v2 {
59 unsigned int con1;
60 unsigned int con2;
61 unsigned int status;
62 unsigned int dat;
63 unsigned int int_en;
64 unsigned int int_status;
65 unsigned int reserved[2];
66 unsigned int version;
67};
Minkyu Kangb1b24682011-01-24 15:22:23 +090068#endif
69
70#endif /* __ASM_ARM_ARCH_ADC_H_ */