1 /* SPDX-License-Identifier: GPL-2.0-or-later */
5 * Copyright 2012 Texas Instruments Inc.
7 * Author: Sourav Poddar <sourav.poddar@ti.com>
10 #ifndef __LINUX_MFD_SMSC_H
11 #define __LINUX_MFD_SMSC_H
13 #include <linux/regmap.h>
15 #define SMSC_ID_ECE1099 1
16 #define SMSC_NUM_CLIENTS 2
18 #define SMSC_BASE_ADDR 0x38
19 #define OMAP_GPIO_SMSC_IRQ 151
21 #define SMSC_MAXGPIO 32
22 #define SMSC_BANK(offs) ((offs) >> 3)
23 #define SMSC_BIT(offs) (1u << ((offs) & 0x7))
27 struct i2c_client *i2c_clients[SMSC_NUM_CLIENTS];
28 struct regmap *regmap;
37 static inline int smsc_read(struct device *child, unsigned int reg,
40 struct smsc *smsc = dev_get_drvdata(child->parent);
42 return regmap_read(smsc->regmap, reg, dest);
45 static inline int smsc_write(struct device *child, unsigned int reg,
48 struct smsc *smsc = dev_get_drvdata(child->parent);
50 return regmap_write(smsc->regmap, reg, value);
53 /* Registers for SMSC */
54 #define SMSC_RESET 0xF5
55 #define SMSC_GRP_INT 0xF9
56 #define SMSC_CLK_CTRL 0xFA
57 #define SMSC_WKUP_CTRL 0xFB
58 #define SMSC_DEV_ID 0xFC
59 #define SMSC_DEV_REV 0xFD
60 #define SMSC_VEN_ID_L 0xFE
61 #define SMSC_VEN_ID_H 0xFF
64 #define SMSC_CLK_VALUE 0x13
66 /* Registers for function GPIO INPUT */
67 #define SMSC_GPIO_DATA_IN_START 0x00
69 /* Registers for function GPIO OUPUT */
70 #define SMSC_GPIO_DATA_OUT_START 0x05
72 /* Definitions for SMSC GPIO CONFIGURATION REGISTER*/
73 #define SMSC_GPIO_INPUT_LOW 0x01
74 #define SMSC_GPIO_INPUT_RISING 0x09
75 #define SMSC_GPIO_INPUT_FALLING 0x11
76 #define SMSC_GPIO_INPUT_BOTH_EDGE 0x19
77 #define SMSC_GPIO_OUTPUT_PP 0x21
78 #define SMSC_GPIO_OUTPUT_OP 0x31
80 #define GRP_INT_STAT 0xf9
81 #define SMSC_GPI_INT 0x0f
82 #define SMSC_CFG_START 0x0A
84 /* Registers for SMSC GPIO INTERRUPT STATUS REGISTER*/
85 #define SMSC_GPIO_INT_STAT_START 0x32
87 /* Registers for SMSC GPIO INTERRUPT MASK REGISTER*/
88 #define SMSC_GPIO_INT_MASK_START 0x37
90 /* Registers for SMSC function KEYPAD*/
91 #define SMSC_KP_OUT 0x40
92 #define SMSC_KP_IN 0x41
93 #define SMSC_KP_INT_STAT 0x42
94 #define SMSC_KP_INT_MASK 0x43
96 /* Definitions for keypad */
97 #define SMSC_KP_KSO 0x70
98 #define SMSC_KP_KSI 0x51
99 #define SMSC_KSO_ALL_LOW 0x20
100 #define SMSC_KP_SET_LOW_PWR 0x0B
101 #define SMSC_KP_SET_HIGH 0xFF
102 #define SMSC_KSO_EVAL 0x00
104 #endif /* __LINUX_MFD_SMSC_H */