Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0-only */
0002 /*
0003  * Copyright (C) ST-Ericsson SA 2010
0004  */
0005 
0006 #ifndef __LINUX_MFD_TC3589x_H
0007 #define __LINUX_MFD_TC3589x_H
0008 
0009 struct device;
0010 
0011 enum tx3589x_block {
0012     TC3589x_BLOCK_GPIO        = 1 << 0,
0013     TC3589x_BLOCK_KEYPAD      = 1 << 1,
0014 };
0015 
0016 #define TC3589x_RSTCTRL_IRQRST  (1 << 4)
0017 #define TC3589x_RSTCTRL_TIMRST  (1 << 3)
0018 #define TC3589x_RSTCTRL_ROTRST  (1 << 2)
0019 #define TC3589x_RSTCTRL_KBDRST  (1 << 1)
0020 #define TC3589x_RSTCTRL_GPIRST  (1 << 0)
0021 
0022 #define TC3589x_DKBDMSK_ELINT   (1 << 1)
0023 #define TC3589x_DKBDMSK_EINT    (1 << 0)
0024 
0025 /* Keyboard Configuration Registers */
0026 #define TC3589x_KBDSETTLE_REG   0x01
0027 #define TC3589x_KBDBOUNCE       0x02
0028 #define TC3589x_KBDSIZE         0x03
0029 #define TC3589x_KBCFG_LSB       0x04
0030 #define TC3589x_KBCFG_MSB       0x05
0031 #define TC3589x_KBDIC           0x08
0032 #define TC3589x_KBDMSK          0x09
0033 #define TC3589x_EVTCODE_FIFO    0x10
0034 #define TC3589x_KBDMFS      0x8F
0035 
0036 #define TC3589x_IRQST       0x91
0037 
0038 #define TC3589x_MANFCODE_MAGIC  0x03
0039 #define TC3589x_MANFCODE    0x80
0040 #define TC3589x_VERSION     0x81
0041 #define TC3589x_IOCFG       0xA7
0042 
0043 #define TC3589x_CLKMODE     0x88
0044 #define TC3589x_CLKCFG      0x89
0045 #define TC3589x_CLKEN       0x8A
0046 
0047 #define TC3589x_RSTCTRL     0x82
0048 #define TC3589x_EXTRSTN     0x83
0049 #define TC3589x_RSTINTCLR   0x84
0050 
0051 /* Pull up/down configuration registers */
0052 #define TC3589x_IOCFG           0xA7
0053 #define TC3589x_IOPULLCFG0_LSB  0xAA
0054 #define TC3589x_IOPULLCFG0_MSB  0xAB
0055 #define TC3589x_IOPULLCFG1_LSB  0xAC
0056 #define TC3589x_IOPULLCFG1_MSB  0xAD
0057 #define TC3589x_IOPULLCFG2_LSB  0xAE
0058 
0059 #define TC3589x_GPIOIS0     0xC9
0060 #define TC3589x_GPIOIS1     0xCA
0061 #define TC3589x_GPIOIS2     0xCB
0062 #define TC3589x_GPIOIBE0    0xCC
0063 #define TC3589x_GPIOIBE1    0xCD
0064 #define TC3589x_GPIOIBE2    0xCE
0065 #define TC3589x_GPIOIEV0    0xCF
0066 #define TC3589x_GPIOIEV1    0xD0
0067 #define TC3589x_GPIOIEV2    0xD1
0068 #define TC3589x_GPIOIE0     0xD2
0069 #define TC3589x_GPIOIE1     0xD3
0070 #define TC3589x_GPIOIE2     0xD4
0071 #define TC3589x_GPIORIS0    0xD6
0072 #define TC3589x_GPIORIS1    0xD7
0073 #define TC3589x_GPIORIS2    0xD8
0074 #define TC3589x_GPIOMIS0    0xD9
0075 #define TC3589x_GPIOMIS1    0xDA
0076 #define TC3589x_GPIOMIS2    0xDB
0077 #define TC3589x_GPIOIC0     0xDC
0078 #define TC3589x_GPIOIC1     0xDD
0079 #define TC3589x_GPIOIC2     0xDE
0080 
0081 #define TC3589x_GPIODATA0   0xC0
0082 #define TC3589x_GPIOMASK0   0xc1
0083 #define TC3589x_GPIODATA1   0xC2
0084 #define TC3589x_GPIOMASK1   0xc3
0085 #define TC3589x_GPIODATA2   0xC4
0086 #define TC3589x_GPIOMASK2   0xC5
0087 
0088 #define TC3589x_GPIODIR0    0xC6
0089 #define TC3589x_GPIODIR1    0xC7
0090 #define TC3589x_GPIODIR2    0xC8
0091 
0092 #define TC3589x_GPIOSYNC0   0xE6
0093 #define TC3589x_GPIOSYNC1   0xE7
0094 #define TC3589x_GPIOSYNC2   0xE8
0095 
0096 #define TC3589x_GPIOWAKE0   0xE9
0097 #define TC3589x_GPIOWAKE1   0xEA
0098 #define TC3589x_GPIOWAKE2   0xEB
0099 
0100 #define TC3589x_GPIOODM0    0xE0
0101 #define TC3589x_GPIOODE0    0xE1
0102 #define TC3589x_GPIOODM1    0xE2
0103 #define TC3589x_GPIOODE1    0xE3
0104 #define TC3589x_GPIOODM2    0xE4
0105 #define TC3589x_GPIOODE2    0xE5
0106 
0107 #define TC3589x_DIRECT0     0xEC
0108 #define TC3589x_DKBDMSK     0xF3
0109 
0110 #define TC3589x_INT_GPIIRQ  0
0111 #define TC3589x_INT_TI0IRQ  1
0112 #define TC3589x_INT_TI1IRQ  2
0113 #define TC3589x_INT_TI2IRQ  3
0114 #define TC3589x_INT_ROTIRQ  5
0115 #define TC3589x_INT_KBDIRQ  6
0116 #define TC3589x_INT_PORIRQ  7
0117 
0118 #define TC3589x_NR_INTERNAL_IRQS    8
0119 
0120 struct tc3589x {
0121     struct mutex lock;
0122     struct device *dev;
0123     struct i2c_client *i2c;
0124     struct irq_domain *domain;
0125 
0126     int irq_base;
0127     int num_gpio;
0128     struct tc3589x_platform_data *pdata;
0129 };
0130 
0131 extern int tc3589x_reg_write(struct tc3589x *tc3589x, u8 reg, u8 data);
0132 extern int tc3589x_reg_read(struct tc3589x *tc3589x, u8 reg);
0133 extern int tc3589x_block_read(struct tc3589x *tc3589x, u8 reg, u8 length,
0134                   u8 *values);
0135 extern int tc3589x_block_write(struct tc3589x *tc3589x, u8 reg, u8 length,
0136                    const u8 *values);
0137 extern int tc3589x_set_bits(struct tc3589x *tc3589x, u8 reg, u8 mask, u8 val);
0138 
0139 /*
0140  * Keypad related platform specific constants
0141  * These values may be modified for fine tuning
0142  */
0143 #define TC_KPD_ROWS             0x8
0144 #define TC_KPD_COLUMNS          0x8
0145 #define TC_KPD_DEBOUNCE_PERIOD  0xA3
0146 #define TC_KPD_SETTLE_TIME      0xA3
0147 
0148 
0149 /**
0150  * struct tc3589x_platform_data - TC3589x platform data
0151  * @block: bitmask of blocks to enable (use TC3589x_BLOCK_*)
0152  */
0153 struct tc3589x_platform_data {
0154     unsigned int block;
0155 };
0156 
0157 #endif