Merge branch 'for-john' of git://git.kernel.org/pub/scm/linux/kernel/git/jberg/mac80211
[deliverable/linux.git] / include / linux / mfd / smsc.h
1 /*
2 * SMSC ECE1099
3 *
4 * Copyright 2012 Texas Instruments Inc.
5 *
6 * Author: Sourav Poddar <sourav.poddar@ti.com>
7 *
8 * This program is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU General Public License as published by the
10 * Free Software Foundation; either version 2 of the License, or (at your
11 * option) any later version.
12 *
13 */
14
15 #ifndef __LINUX_MFD_SMSC_H
16 #define __LINUX_MFD_SMSC_H
17
18 #include <linux/regmap.h>
19
20 #define SMSC_ID_ECE1099 1
21 #define SMSC_NUM_CLIENTS 2
22
23 #define SMSC_BASE_ADDR 0x38
24 #define OMAP_GPIO_SMSC_IRQ 151
25
26 #define SMSC_MAXGPIO 32
27 #define SMSC_BANK(offs) ((offs) >> 3)
28 #define SMSC_BIT(offs) (1u << ((offs) & 0x7))
29
30 struct smsc {
31 struct device *dev;
32 struct i2c_client *i2c_clients[SMSC_NUM_CLIENTS];
33 struct regmap *regmap;
34 int clk;
35 /* Stored chip id */
36 int id;
37 };
38
39 struct smsc_gpio;
40 struct smsc_keypad;
41
42 static inline int smsc_read(struct device *child, unsigned int reg,
43 unsigned int *dest)
44 {
45 struct smsc *smsc = dev_get_drvdata(child->parent);
46
47 return regmap_read(smsc->regmap, reg, dest);
48 }
49
50 static inline int smsc_write(struct device *child, unsigned int reg,
51 unsigned int value)
52 {
53 struct smsc *smsc = dev_get_drvdata(child->parent);
54
55 return regmap_write(smsc->regmap, reg, value);
56 }
57
58 /* Registers for SMSC */
59 #define SMSC_RESET 0xF5
60 #define SMSC_GRP_INT 0xF9
61 #define SMSC_CLK_CTRL 0xFA
62 #define SMSC_WKUP_CTRL 0xFB
63 #define SMSC_DEV_ID 0xFC
64 #define SMSC_DEV_REV 0xFD
65 #define SMSC_VEN_ID_L 0xFE
66 #define SMSC_VEN_ID_H 0xFF
67
68 /* CLK VALUE */
69 #define SMSC_CLK_VALUE 0x13
70
71 /* Registers for function GPIO INPUT */
72 #define SMSC_GPIO_DATA_IN_START 0x00
73
74 /* Registers for function GPIO OUPUT */
75 #define SMSC_GPIO_DATA_OUT_START 0x05
76
77 /* Definitions for SMSC GPIO CONFIGURATION REGISTER*/
78 #define SMSC_GPIO_INPUT_LOW 0x01
79 #define SMSC_GPIO_INPUT_RISING 0x09
80 #define SMSC_GPIO_INPUT_FALLING 0x11
81 #define SMSC_GPIO_INPUT_BOTH_EDGE 0x19
82 #define SMSC_GPIO_OUTPUT_PP 0x21
83 #define SMSC_GPIO_OUTPUT_OP 0x31
84
85 #define GRP_INT_STAT 0xf9
86 #define SMSC_GPI_INT 0x0f
87 #define SMSC_CFG_START 0x0A
88
89 /* Registers for SMSC GPIO INTERRUPT STATUS REGISTER*/
90 #define SMSC_GPIO_INT_STAT_START 0x32
91
92 /* Registers for SMSC GPIO INTERRUPT MASK REGISTER*/
93 #define SMSC_GPIO_INT_MASK_START 0x37
94
95 /* Registers for SMSC function KEYPAD*/
96 #define SMSC_KP_OUT 0x40
97 #define SMSC_KP_IN 0x41
98 #define SMSC_KP_INT_STAT 0x42
99 #define SMSC_KP_INT_MASK 0x43
100
101 /* Definitions for keypad */
102 #define SMSC_KP_KSO 0x70
103 #define SMSC_KP_KSI 0x51
104 #define SMSC_KSO_ALL_LOW 0x20
105 #define SMSC_KP_SET_LOW_PWR 0x0B
106 #define SMSC_KP_SET_HIGH 0xFF
107 #define SMSC_KSO_EVAL 0x00
108
109 #endif /* __LINUX_MFD_SMSC_H */
This page took 0.033185 seconds and 6 git commands to generate.