adc.h 1.7 KB

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