cachepc-linux

Fork of AMDESE/linux with modifications for CachePC side-channel attack
git clone https://git.sinitax.com/sinitax/cachepc-linux
Log | Files | Refs | README | LICENSE | sfeed.txt

comparator.h (5054B)


      1/* SPDX-License-Identifier: GPL-2.0-or-later */
      2/*
      3 * comparator.h  --  Comparator Aux ADC for Wolfson WM8350 PMIC
      4 *
      5 * Copyright 2007 Wolfson Microelectronics PLC
      6 */
      7
      8#ifndef __LINUX_MFD_WM8350_COMPARATOR_H_
      9#define __LINUX_MFD_WM8350_COMPARATOR_H_
     10
     11/*
     12 * Registers
     13 */
     14
     15#define WM8350_DIGITISER_CONTROL_1              0x90
     16#define WM8350_DIGITISER_CONTROL_2              0x91
     17#define WM8350_AUX1_READBACK                    0x98
     18#define WM8350_AUX2_READBACK                    0x99
     19#define WM8350_AUX3_READBACK                    0x9A
     20#define WM8350_AUX4_READBACK                    0x9B
     21#define WM8350_CHIP_TEMP_READBACK               0x9F
     22#define WM8350_GENERIC_COMPARATOR_CONTROL       0xA3
     23#define WM8350_GENERIC_COMPARATOR_1             0xA4
     24#define WM8350_GENERIC_COMPARATOR_2             0xA5
     25#define WM8350_GENERIC_COMPARATOR_3             0xA6
     26#define WM8350_GENERIC_COMPARATOR_4             0xA7
     27
     28/*
     29 * R144 (0x90) - Digitiser Control (1)
     30 */
     31#define WM8350_AUXADC_CTC                       0x4000
     32#define WM8350_AUXADC_POLL                      0x2000
     33#define WM8350_AUXADC_HIB_MODE                  0x1000
     34#define WM8350_AUXADC_SEL8                      0x0080
     35#define WM8350_AUXADC_SEL7                      0x0040
     36#define WM8350_AUXADC_SEL6                      0x0020
     37#define WM8350_AUXADC_SEL5                      0x0010
     38#define WM8350_AUXADC_SEL4                      0x0008
     39#define WM8350_AUXADC_SEL3                      0x0004
     40#define WM8350_AUXADC_SEL2                      0x0002
     41#define WM8350_AUXADC_SEL1                      0x0001
     42
     43/*
     44 * R145 (0x91) - Digitiser Control (2)
     45 */
     46#define WM8350_AUXADC_MASKMODE_MASK             0x3000
     47#define WM8350_AUXADC_CRATE_MASK                0x0700
     48#define WM8350_AUXADC_CAL                       0x0004
     49#define WM8350_AUX_RBMODE                       0x0002
     50#define WM8350_AUXADC_WAIT                      0x0001
     51
     52/*
     53 * R152 (0x98) - AUX1 Readback
     54 */
     55#define WM8350_AUXADC_SCALE1_MASK               0x6000
     56#define WM8350_AUXADC_REF1                      0x1000
     57#define WM8350_AUXADC_DATA1_MASK                0x0FFF
     58
     59/*
     60 * R153 (0x99) - AUX2 Readback
     61 */
     62#define WM8350_AUXADC_SCALE2_MASK               0x6000
     63#define WM8350_AUXADC_REF2                      0x1000
     64#define WM8350_AUXADC_DATA2_MASK                0x0FFF
     65
     66/*
     67 * R154 (0x9A) - AUX3 Readback
     68 */
     69#define WM8350_AUXADC_SCALE3_MASK               0x6000
     70#define WM8350_AUXADC_REF3                      0x1000
     71#define WM8350_AUXADC_DATA3_MASK                0x0FFF
     72
     73/*
     74 * R155 (0x9B) - AUX4 Readback
     75 */
     76#define WM8350_AUXADC_SCALE4_MASK               0x6000
     77#define WM8350_AUXADC_REF4                      0x1000
     78#define WM8350_AUXADC_DATA4_MASK                0x0FFF
     79
     80/*
     81 * R156 (0x9C) - USB Voltage Readback
     82 */
     83#define WM8350_AUXADC_DATA_USB_MASK             0x0FFF
     84
     85/*
     86 * R157 (0x9D) - LINE Voltage Readback
     87 */
     88#define WM8350_AUXADC_DATA_LINE_MASK            0x0FFF
     89
     90/*
     91 * R158 (0x9E) - BATT Voltage Readback
     92 */
     93#define WM8350_AUXADC_DATA_BATT_MASK            0x0FFF
     94
     95/*
     96 * R159 (0x9F) - Chip Temp Readback
     97 */
     98#define WM8350_AUXADC_DATA_CHIPTEMP_MASK        0x0FFF
     99
    100/*
    101 * R163 (0xA3) - Generic Comparator Control
    102 */
    103#define WM8350_DCMP4_ENA                        0x0008
    104#define WM8350_DCMP3_ENA                        0x0004
    105#define WM8350_DCMP2_ENA                        0x0002
    106#define WM8350_DCMP1_ENA                        0x0001
    107
    108/*
    109 * R164 (0xA4) - Generic comparator 1
    110 */
    111#define WM8350_DCMP1_SRCSEL_MASK                0xE000
    112#define WM8350_DCMP1_GT                         0x1000
    113#define WM8350_DCMP1_THR_MASK                   0x0FFF
    114
    115/*
    116 * R165 (0xA5) - Generic comparator 2
    117 */
    118#define WM8350_DCMP2_SRCSEL_MASK                0xE000
    119#define WM8350_DCMP2_GT                         0x1000
    120#define WM8350_DCMP2_THR_MASK                   0x0FFF
    121
    122/*
    123 * R166 (0xA6) - Generic comparator 3
    124 */
    125#define WM8350_DCMP3_SRCSEL_MASK                0xE000
    126#define WM8350_DCMP3_GT                         0x1000
    127#define WM8350_DCMP3_THR_MASK                   0x0FFF
    128
    129/*
    130 * R167 (0xA7) - Generic comparator 4
    131 */
    132#define WM8350_DCMP4_SRCSEL_MASK                0xE000
    133#define WM8350_DCMP4_GT                         0x1000
    134#define WM8350_DCMP4_THR_MASK                   0x0FFF
    135
    136/*
    137 * Interrupts.
    138 */
    139#define WM8350_IRQ_AUXADC_DATARDY		16
    140#define WM8350_IRQ_AUXADC_DCOMP4		17
    141#define WM8350_IRQ_AUXADC_DCOMP3		18
    142#define WM8350_IRQ_AUXADC_DCOMP2		19
    143#define WM8350_IRQ_AUXADC_DCOMP1		20
    144#define WM8350_IRQ_SYS_HYST_COMP_FAIL		21
    145#define WM8350_IRQ_SYS_CHIP_GT115		22
    146#define WM8350_IRQ_SYS_CHIP_GT140		23
    147
    148/*
    149 * USB/2, LINE & BATT = ((VRTC * 2) / 4095)) * 10e6 uV
    150 * Where VRTC = 2.7 V
    151 */
    152#define WM8350_AUX_COEFF			1319
    153
    154#define WM8350_AUXADC_AUX1			0
    155#define WM8350_AUXADC_AUX2			1
    156#define WM8350_AUXADC_AUX3			2
    157#define WM8350_AUXADC_AUX4			3
    158#define WM8350_AUXADC_USB			4
    159#define WM8350_AUXADC_LINE			5
    160#define WM8350_AUXADC_BATT			6
    161#define WM8350_AUXADC_TEMP			7
    162
    163struct wm8350;
    164
    165/*
    166 * AUX ADC Readback
    167 */
    168int wm8350_read_auxadc(struct wm8350 *wm8350, int channel, int scale,
    169		       int vref);
    170
    171#endif