diff options
Diffstat (limited to 'include/linux')
-rw-r--r-- | include/linux/device.h | 34 | ||||
-rw-r--r-- | include/linux/dynamic_debug.h | 22 | ||||
-rw-r--r-- | include/linux/extcon.h | 324 | ||||
-rw-r--r-- | include/linux/extcon/extcon_gpio.h | 52 | ||||
-rw-r--r-- | include/linux/hyperv.h | 4 | ||||
-rw-r--r-- | include/linux/mfd/max8997.h | 23 | ||||
-rw-r--r-- | include/linux/moduleparam.h | 3 | ||||
-rw-r--r-- | include/linux/platform_data/emif_plat.h | 128 | ||||
-rw-r--r-- | include/linux/printk.h | 13 | ||||
-rw-r--r-- | include/linux/sysfs.h | 12 |
10 files changed, 587 insertions, 28 deletions
diff --git a/include/linux/device.h b/include/linux/device.h index 5ad17cccdd71..e04f5776f6d0 100644 --- a/include/linux/device.h +++ b/include/linux/device.h | |||
@@ -23,6 +23,7 @@ | |||
23 | #include <linux/mutex.h> | 23 | #include <linux/mutex.h> |
24 | #include <linux/pm.h> | 24 | #include <linux/pm.h> |
25 | #include <linux/atomic.h> | 25 | #include <linux/atomic.h> |
26 | #include <linux/ratelimit.h> | ||
26 | #include <asm/device.h> | 27 | #include <asm/device.h> |
27 | 28 | ||
28 | struct device; | 29 | struct device; |
@@ -502,7 +503,10 @@ ssize_t device_store_int(struct device *dev, struct device_attribute *attr, | |||
502 | { __ATTR(_name, _mode, device_show_ulong, device_store_ulong), &(_var) } | 503 | { __ATTR(_name, _mode, device_show_ulong, device_store_ulong), &(_var) } |
503 | #define DEVICE_INT_ATTR(_name, _mode, _var) \ | 504 | #define DEVICE_INT_ATTR(_name, _mode, _var) \ |
504 | struct dev_ext_attribute dev_attr_##_name = \ | 505 | struct dev_ext_attribute dev_attr_##_name = \ |
505 | { __ATTR(_name, _mode, device_show_ulong, device_store_ulong), &(_var) } | 506 | { __ATTR(_name, _mode, device_show_int, device_store_int), &(_var) } |
507 | #define DEVICE_ATTR_IGNORE_LOCKDEP(_name, _mode, _show, _store) \ | ||
508 | struct device_attribute dev_attr_##_name = \ | ||
509 | __ATTR_IGNORE_LOCKDEP(_name, _mode, _show, _store) | ||
506 | 510 | ||
507 | extern int device_create_file(struct device *device, | 511 | extern int device_create_file(struct device *device, |
508 | const struct device_attribute *entry); | 512 | const struct device_attribute *entry); |
@@ -541,6 +545,8 @@ extern void *devres_remove(struct device *dev, dr_release_t release, | |||
541 | dr_match_t match, void *match_data); | 545 | dr_match_t match, void *match_data); |
542 | extern int devres_destroy(struct device *dev, dr_release_t release, | 546 | extern int devres_destroy(struct device *dev, dr_release_t release, |
543 | dr_match_t match, void *match_data); | 547 | dr_match_t match, void *match_data); |
548 | extern int devres_release(struct device *dev, dr_release_t release, | ||
549 | dr_match_t match, void *match_data); | ||
544 | 550 | ||
545 | /* devres group */ | 551 | /* devres group */ |
546 | extern void * __must_check devres_open_group(struct device *dev, void *id, | 552 | extern void * __must_check devres_open_group(struct device *dev, void *id, |
@@ -931,6 +937,32 @@ int _dev_info(const struct device *dev, const char *fmt, ...) | |||
931 | 937 | ||
932 | #endif | 938 | #endif |
933 | 939 | ||
940 | #define dev_level_ratelimited(dev_level, dev, fmt, ...) \ | ||
941 | do { \ | ||
942 | static DEFINE_RATELIMIT_STATE(_rs, \ | ||
943 | DEFAULT_RATELIMIT_INTERVAL, \ | ||
944 | DEFAULT_RATELIMIT_BURST); \ | ||
945 | if (__ratelimit(&_rs)) \ | ||
946 | dev_level(dev, fmt, ##__VA_ARGS__); \ | ||
947 | } while (0) | ||
948 | |||
949 | #define dev_emerg_ratelimited(dev, fmt, ...) \ | ||
950 | dev_level_ratelimited(dev_emerg, dev, fmt, ##__VA_ARGS__) | ||
951 | #define dev_alert_ratelimited(dev, fmt, ...) \ | ||
952 | dev_level_ratelimited(dev_alert, dev, fmt, ##__VA_ARGS__) | ||
953 | #define dev_crit_ratelimited(dev, fmt, ...) \ | ||
954 | dev_level_ratelimited(dev_crit, dev, fmt, ##__VA_ARGS__) | ||
955 | #define dev_err_ratelimited(dev, fmt, ...) \ | ||
956 | dev_level_ratelimited(dev_err, dev, fmt, ##__VA_ARGS__) | ||
957 | #define dev_warn_ratelimited(dev, fmt, ...) \ | ||
958 | dev_level_ratelimited(dev_warn, dev, fmt, ##__VA_ARGS__) | ||
959 | #define dev_notice_ratelimited(dev, fmt, ...) \ | ||
960 | dev_level_ratelimited(dev_notice, dev, fmt, ##__VA_ARGS__) | ||
961 | #define dev_info_ratelimited(dev, fmt, ...) \ | ||
962 | dev_level_ratelimited(dev_info, dev, fmt, ##__VA_ARGS__) | ||
963 | #define dev_dbg_ratelimited(dev, fmt, ...) \ | ||
964 | dev_level_ratelimited(dev_dbg, dev, fmt, ##__VA_ARGS__) | ||
965 | |||
934 | /* | 966 | /* |
935 | * Stupid hackaround for existing uses of non-printk uses dev_info | 967 | * Stupid hackaround for existing uses of non-printk uses dev_info |
936 | * | 968 | * |
diff --git a/include/linux/dynamic_debug.h b/include/linux/dynamic_debug.h index 7e3c53a900d8..c18257b0fa72 100644 --- a/include/linux/dynamic_debug.h +++ b/include/linux/dynamic_debug.h | |||
@@ -17,8 +17,8 @@ struct _ddebug { | |||
17 | const char *format; | 17 | const char *format; |
18 | unsigned int lineno:18; | 18 | unsigned int lineno:18; |
19 | /* | 19 | /* |
20 | * The flags field controls the behaviour at the callsite. | 20 | * The flags field controls the behaviour at the callsite. |
21 | * The bits here are changed dynamically when the user | 21 | * The bits here are changed dynamically when the user |
22 | * writes commands to <debugfs>/dynamic_debug/control | 22 | * writes commands to <debugfs>/dynamic_debug/control |
23 | */ | 23 | */ |
24 | #define _DPRINTK_FLAGS_NONE 0 | 24 | #define _DPRINTK_FLAGS_NONE 0 |
@@ -44,6 +44,9 @@ extern int ddebug_remove_module(const char *mod_name); | |||
44 | extern __printf(2, 3) | 44 | extern __printf(2, 3) |
45 | int __dynamic_pr_debug(struct _ddebug *descriptor, const char *fmt, ...); | 45 | int __dynamic_pr_debug(struct _ddebug *descriptor, const char *fmt, ...); |
46 | 46 | ||
47 | extern int ddebug_dyndbg_module_param_cb(char *param, char *val, | ||
48 | const char *modname); | ||
49 | |||
47 | struct device; | 50 | struct device; |
48 | 51 | ||
49 | extern __printf(3, 4) | 52 | extern __printf(3, 4) |
@@ -94,11 +97,26 @@ do { \ | |||
94 | 97 | ||
95 | #else | 98 | #else |
96 | 99 | ||
100 | #include <linux/string.h> | ||
101 | #include <linux/errno.h> | ||
102 | |||
97 | static inline int ddebug_remove_module(const char *mod) | 103 | static inline int ddebug_remove_module(const char *mod) |
98 | { | 104 | { |
99 | return 0; | 105 | return 0; |
100 | } | 106 | } |
101 | 107 | ||
108 | static inline int ddebug_dyndbg_module_param_cb(char *param, char *val, | ||
109 | const char *modname) | ||
110 | { | ||
111 | if (strstr(param, "dyndbg")) { | ||
112 | /* avoid pr_warn(), which wants pr_fmt() fully defined */ | ||
113 | printk(KERN_WARNING "dyndbg param is supported only in " | ||
114 | "CONFIG_DYNAMIC_DEBUG builds\n"); | ||
115 | return 0; /* allow and ignore */ | ||
116 | } | ||
117 | return -EINVAL; | ||
118 | } | ||
119 | |||
102 | #define dynamic_pr_debug(fmt, ...) \ | 120 | #define dynamic_pr_debug(fmt, ...) \ |
103 | do { if (0) printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__); } while (0) | 121 | do { if (0) printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__); } while (0) |
104 | #define dynamic_dev_dbg(dev, fmt, ...) \ | 122 | #define dynamic_dev_dbg(dev, fmt, ...) \ |
diff --git a/include/linux/extcon.h b/include/linux/extcon.h new file mode 100644 index 000000000000..cdd401477656 --- /dev/null +++ b/include/linux/extcon.h | |||
@@ -0,0 +1,324 @@ | |||
1 | /* | ||
2 | * External connector (extcon) class driver | ||
3 | * | ||
4 | * Copyright (C) 2012 Samsung Electronics | ||
5 | * Author: Donggeun Kim <dg77.kim@samsung.com> | ||
6 | * Author: MyungJoo Ham <myungjoo.ham@samsung.com> | ||
7 | * | ||
8 | * based on switch class driver | ||
9 | * Copyright (C) 2008 Google, Inc. | ||
10 | * Author: Mike Lockwood <lockwood@android.com> | ||
11 | * | ||
12 | * This software is licensed under the terms of the GNU General Public | ||
13 | * License version 2, as published by the Free Software Foundation, and | ||
14 | * may be copied, distributed, and modified under those terms. | ||
15 | * | ||
16 | * This program is distributed in the hope that it will be useful, | ||
17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
19 | * GNU General Public License for more details. | ||
20 | * | ||
21 | */ | ||
22 | |||
23 | #ifndef __LINUX_EXTCON_H__ | ||
24 | #define __LINUX_EXTCON_H__ | ||
25 | |||
26 | #include <linux/notifier.h> | ||
27 | |||
28 | #define SUPPORTED_CABLE_MAX 32 | ||
29 | #define CABLE_NAME_MAX 30 | ||
30 | |||
31 | /* | ||
32 | * The standard cable name is to help support general notifier | ||
33 | * and notifee device drivers to share the common names. | ||
34 | * Please use standard cable names unless your notifier device has | ||
35 | * a very unique and abnormal cable or | ||
36 | * the cable type is supposed to be used with only one unique | ||
37 | * pair of notifier/notifee devices. | ||
38 | * | ||
39 | * Please add any other "standard" cables used with extcon dev. | ||
40 | * | ||
41 | * You may add a dot and number to specify version or specification | ||
42 | * of the specific cable if it is required. (e.g., "Fast-charger.18" | ||
43 | * and "Fast-charger.10" for 1.8A and 1.0A chargers) | ||
44 | * However, the notifee and notifier should be able to handle such | ||
45 | * string and if the notifee can negotiate the protocol or idenify, | ||
46 | * you don't need such convention. This convention is helpful when | ||
47 | * notifier can distinguish but notifiee cannot. | ||
48 | */ | ||
49 | enum extcon_cable_name { | ||
50 | EXTCON_USB = 0, | ||
51 | EXTCON_USB_HOST, | ||
52 | EXTCON_TA, /* Travel Adaptor */ | ||
53 | EXTCON_FAST_CHARGER, | ||
54 | EXTCON_SLOW_CHARGER, | ||
55 | EXTCON_CHARGE_DOWNSTREAM, /* Charging an external device */ | ||
56 | EXTCON_HDMI, | ||
57 | EXTCON_MHL, | ||
58 | EXTCON_DVI, | ||
59 | EXTCON_VGA, | ||
60 | EXTCON_DOCK, | ||
61 | EXTCON_LINE_IN, | ||
62 | EXTCON_LINE_OUT, | ||
63 | EXTCON_MIC_IN, | ||
64 | EXTCON_HEADPHONE_OUT, | ||
65 | EXTCON_SPDIF_IN, | ||
66 | EXTCON_SPDIF_OUT, | ||
67 | EXTCON_VIDEO_IN, | ||
68 | EXTCON_VIDEO_OUT, | ||
69 | EXTCON_MECHANICAL, | ||
70 | }; | ||
71 | extern const char *extcon_cable_name[]; | ||
72 | |||
73 | struct extcon_cable; | ||
74 | |||
75 | /** | ||
76 | * struct extcon_dev - An extcon device represents one external connector. | ||
77 | * @name The name of this extcon device. Parent device name is used | ||
78 | * if NULL. | ||
79 | * @supported_cable Array of supported cable name ending with NULL. | ||
80 | * If supported_cable is NULL, cable name related APIs | ||
81 | * are disabled. | ||
82 | * @mutually_exclusive Array of mutually exclusive set of cables that cannot | ||
83 | * be attached simultaneously. The array should be | ||
84 | * ending with NULL or be NULL (no mutually exclusive | ||
85 | * cables). For example, if it is { 0x7, 0x30, 0}, then, | ||
86 | * {0, 1}, {0, 1, 2}, {0, 2}, {1, 2}, or {4, 5} cannot | ||
87 | * be attached simulataneously. {0x7, 0} is equivalent to | ||
88 | * {0x3, 0x6, 0x5, 0}. If it is {0xFFFFFFFF, 0}, there | ||
89 | * can be no simultaneous connections. | ||
90 | * @print_name An optional callback to override the method to print the | ||
91 | * name of the extcon device. | ||
92 | * @print_state An optional callback to override the method to print the | ||
93 | * status of the extcon device. | ||
94 | * @dev Device of this extcon. Do not provide at register-time. | ||
95 | * @state Attach/detach state of this extcon. Do not provide at | ||
96 | * register-time | ||
97 | * @nh Notifier for the state change events from this extcon | ||
98 | * @entry To support list of extcon devices so that uses can search | ||
99 | * for extcon devices based on the extcon name. | ||
100 | * @lock | ||
101 | * @max_supported Internal value to store the number of cables. | ||
102 | * @extcon_dev_type Device_type struct to provide attribute_groups | ||
103 | * customized for each extcon device. | ||
104 | * @cables Sysfs subdirectories. Each represents one cable. | ||
105 | * | ||
106 | * In most cases, users only need to provide "User initializing data" of | ||
107 | * this struct when registering an extcon. In some exceptional cases, | ||
108 | * optional callbacks may be needed. However, the values in "internal data" | ||
109 | * are overwritten by register function. | ||
110 | */ | ||
111 | struct extcon_dev { | ||
112 | /* --- Optional user initializing data --- */ | ||
113 | const char *name; | ||
114 | const char **supported_cable; | ||
115 | const u32 *mutually_exclusive; | ||
116 | |||
117 | /* --- Optional callbacks to override class functions --- */ | ||
118 | ssize_t (*print_name)(struct extcon_dev *edev, char *buf); | ||
119 | ssize_t (*print_state)(struct extcon_dev *edev, char *buf); | ||
120 | |||
121 | /* --- Internal data. Please do not set. --- */ | ||
122 | struct device *dev; | ||
123 | u32 state; | ||
124 | struct raw_notifier_head nh; | ||
125 | struct list_head entry; | ||
126 | spinlock_t lock; /* could be called by irq handler */ | ||
127 | int max_supported; | ||
128 | |||
129 | /* /sys/class/extcon/.../cable.n/... */ | ||
130 | struct device_type extcon_dev_type; | ||
131 | struct extcon_cable *cables; | ||
132 | /* /sys/class/extcon/.../mutually_exclusive/... */ | ||
133 | struct attribute_group attr_g_muex; | ||
134 | struct attribute **attrs_muex; | ||
135 | struct device_attribute *d_attrs_muex; | ||
136 | }; | ||
137 | |||
138 | /** | ||
139 | * struct extcon_cable - An internal data for each cable of extcon device. | ||
140 | * @edev The extcon device | ||
141 | * @cable_index Index of this cable in the edev | ||
142 | * @attr_g Attribute group for the cable | ||
143 | * @attr_name "name" sysfs entry | ||
144 | * @attr_state "state" sysfs entry | ||
145 | * @attrs Array pointing to attr_name and attr_state for attr_g | ||
146 | */ | ||
147 | struct extcon_cable { | ||
148 | struct extcon_dev *edev; | ||
149 | int cable_index; | ||
150 | |||
151 | struct attribute_group attr_g; | ||
152 | struct device_attribute attr_name; | ||
153 | struct device_attribute attr_state; | ||
154 | |||
155 | struct attribute *attrs[3]; /* to be fed to attr_g.attrs */ | ||
156 | }; | ||
157 | |||
158 | /** | ||
159 | * struct extcon_specific_cable_nb - An internal data for | ||
160 | * extcon_register_interest(). | ||
161 | * @internal_nb a notifier block bridging extcon notifier and cable notifier. | ||
162 | * @user_nb user provided notifier block for events from a specific cable. | ||
163 | * @cable_index the target cable. | ||
164 | * @edev the target extcon device. | ||
165 | * @previous_value the saved previous event value. | ||
166 | */ | ||
167 | struct extcon_specific_cable_nb { | ||
168 | struct notifier_block internal_nb; | ||
169 | struct notifier_block *user_nb; | ||
170 | int cable_index; | ||
171 | struct extcon_dev *edev; | ||
172 | unsigned long previous_value; | ||
173 | }; | ||
174 | |||
175 | #if IS_ENABLED(CONFIG_EXTCON) | ||
176 | |||
177 | /* | ||
178 | * Following APIs are for notifiers or configurations. | ||
179 | * Notifiers are the external port and connection devices. | ||
180 | */ | ||
181 | extern int extcon_dev_register(struct extcon_dev *edev, struct device *dev); | ||
182 | extern void extcon_dev_unregister(struct extcon_dev *edev); | ||
183 | extern struct extcon_dev *extcon_get_extcon_dev(const char *extcon_name); | ||
184 | |||
185 | /* | ||
186 | * get/set/update_state access the 32b encoded state value, which represents | ||
187 | * states of all possible cables of the multistate port. For example, if one | ||
188 | * calls extcon_set_state(edev, 0x7), it may mean that all the three cables | ||
189 | * are attached to the port. | ||
190 | */ | ||
191 | static inline u32 extcon_get_state(struct extcon_dev *edev) | ||
192 | { | ||
193 | return edev->state; | ||
194 | } | ||
195 | |||
196 | extern int extcon_set_state(struct extcon_dev *edev, u32 state); | ||
197 | extern int extcon_update_state(struct extcon_dev *edev, u32 mask, u32 state); | ||
198 | |||
199 | /* | ||
200 | * get/set_cable_state access each bit of the 32b encoded state value. | ||
201 | * They are used to access the status of each cable based on the cable_name | ||
202 | * or cable_index, which is retrived by extcon_find_cable_index | ||
203 | */ | ||
204 | extern int extcon_find_cable_index(struct extcon_dev *sdev, | ||
205 | const char *cable_name); | ||
206 | extern int extcon_get_cable_state_(struct extcon_dev *edev, int cable_index); | ||
207 | extern int extcon_set_cable_state_(struct extcon_dev *edev, int cable_index, | ||
208 | bool cable_state); | ||
209 | |||
210 | extern int extcon_get_cable_state(struct extcon_dev *edev, | ||
211 | const char *cable_name); | ||
212 | extern int extcon_set_cable_state(struct extcon_dev *edev, | ||
213 | const char *cable_name, bool cable_state); | ||
214 | |||
215 | /* | ||
216 | * Following APIs are for notifiees (those who want to be notified) | ||
217 | * to register a callback for events from a specific cable of the extcon. | ||
218 | * Notifiees are the connected device drivers wanting to get notified by | ||
219 | * a specific external port of a connection device. | ||
220 | */ | ||
221 | extern int extcon_register_interest(struct extcon_specific_cable_nb *obj, | ||
222 | const char *extcon_name, | ||
223 | const char *cable_name, | ||
224 | struct notifier_block *nb); | ||
225 | extern int extcon_unregister_interest(struct extcon_specific_cable_nb *nb); | ||
226 | |||
227 | /* | ||
228 | * Following APIs are to monitor every action of a notifier. | ||
229 | * Registerer gets notified for every external port of a connection device. | ||
230 | * Probably this could be used to debug an action of notifier; however, | ||
231 | * we do not recommend to use this at normal 'notifiee' device drivers who | ||
232 | * want to be notified by a specific external port of the notifier. | ||
233 | */ | ||
234 | extern int extcon_register_notifier(struct extcon_dev *edev, | ||
235 | struct notifier_block *nb); | ||
236 | extern int extcon_unregister_notifier(struct extcon_dev *edev, | ||
237 | struct notifier_block *nb); | ||
238 | #else /* CONFIG_EXTCON */ | ||
239 | static inline int extcon_dev_register(struct extcon_dev *edev, | ||
240 | struct device *dev) | ||
241 | { | ||
242 | return 0; | ||
243 | } | ||
244 | |||
245 | static inline void extcon_dev_unregister(struct extcon_dev *edev) { } | ||
246 | |||
247 | static inline u32 extcon_get_state(struct extcon_dev *edev) | ||
248 | { | ||
249 | return 0; | ||
250 | } | ||
251 | |||
252 | static inline int extcon_set_state(struct extcon_dev *edev, u32 state) | ||
253 | { | ||
254 | return 0; | ||
255 | } | ||
256 | |||
257 | static inline int extcon_update_state(struct extcon_dev *edev, u32 mask, | ||
258 | u32 state) | ||
259 | { | ||
260 | return 0; | ||
261 | } | ||
262 | |||
263 | static inline int extcon_find_cable_index(struct extcon_dev *edev, | ||
264 | const char *cable_name) | ||
265 | { | ||
266 | return 0; | ||
267 | } | ||
268 | |||
269 | static inline int extcon_get_cable_state_(struct extcon_dev *edev, | ||
270 | int cable_index) | ||
271 | { | ||
272 | return 0; | ||
273 | } | ||
274 | |||
275 | static inline int extcon_set_cable_state_(struct extcon_dev *edev, | ||
276 | int cable_index, bool cable_state) | ||
277 | { | ||
278 | return 0; | ||
279 | } | ||
280 | |||
281 | static inline int extcon_get_cable_state(struct extcon_dev *edev, | ||
282 | const char *cable_name) | ||
283 | { | ||
284 | return 0; | ||
285 | } | ||
286 | |||
287 | static inline int extcon_set_cable_state(struct extcon_dev *edev, | ||
288 | const char *cable_name, int state) | ||
289 | { | ||
290 | return 0; | ||
291 | } | ||
292 | |||
293 | static inline struct extcon_dev *extcon_get_extcon_dev(const char *extcon_name) | ||
294 | { | ||
295 | return NULL; | ||
296 | } | ||
297 | |||
298 | static inline int extcon_register_notifier(struct extcon_dev *edev, | ||
299 | struct notifier_block *nb) | ||
300 | { | ||
301 | return 0; | ||
302 | } | ||
303 | |||
304 | static inline int extcon_unregister_notifier(struct extcon_dev *edev, | ||
305 | struct notifier_block *nb) | ||
306 | { | ||
307 | return 0; | ||
308 | } | ||
309 | |||
310 | static inline int extcon_register_interest(struct extcon_specific_cable_nb *obj, | ||
311 | const char *extcon_name, | ||
312 | const char *cable_name, | ||
313 | struct notifier_block *nb) | ||
314 | { | ||
315 | return 0; | ||
316 | } | ||
317 | |||
318 | static inline int extcon_unregister_interest(struct extcon_specific_cable_nb | ||
319 | *obj) | ||
320 | { | ||
321 | return 0; | ||
322 | } | ||
323 | #endif /* CONFIG_EXTCON */ | ||
324 | #endif /* __LINUX_EXTCON_H__ */ | ||
diff --git a/include/linux/extcon/extcon_gpio.h b/include/linux/extcon/extcon_gpio.h new file mode 100644 index 000000000000..a2129b73dcb1 --- /dev/null +++ b/include/linux/extcon/extcon_gpio.h | |||
@@ -0,0 +1,52 @@ | |||
1 | /* | ||
2 | * External connector (extcon) class generic GPIO driver | ||
3 | * | ||
4 | * Copyright (C) 2012 Samsung Electronics | ||
5 | * Author: MyungJoo Ham <myungjoo.ham@samsung.com> | ||
6 | * | ||
7 | * based on switch class driver | ||
8 | * Copyright (C) 2008 Google, Inc. | ||
9 | * Author: Mike Lockwood <lockwood@android.com> | ||
10 | * | ||
11 | * This software is licensed under the terms of the GNU General Public | ||
12 | * License version 2, as published by the Free Software Foundation, and | ||
13 | * may be copied, distributed, and modified under those terms. | ||
14 | * | ||
15 | * This program is distributed in the hope that it will be useful, | ||
16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
18 | * GNU General Public License for more details. | ||
19 | * | ||
20 | */ | ||
21 | #ifndef __EXTCON_GPIO_H__ | ||
22 | #define __EXTCON_GPIO_H__ __FILE__ | ||
23 | |||
24 | #include <linux/extcon.h> | ||
25 | |||
26 | /** | ||
27 | * struct gpio_extcon_platform_data - A simple GPIO-controlled extcon device. | ||
28 | * @name The name of this GPIO extcon device. | ||
29 | * @gpio Corresponding GPIO. | ||
30 | * @debounce Debounce time for GPIO IRQ in ms. | ||
31 | * @irq_flags IRQ Flags (e.g., IRQF_TRIGGER_LOW). | ||
32 | * @state_on print_state is overriden with state_on if attached. If Null, | ||
33 | * default method of extcon class is used. | ||
34 | * @state_off print_state is overriden with state_on if dettached. If Null, | ||
35 | * default method of extcon class is used. | ||
36 | * | ||
37 | * Note that in order for state_on or state_off to be valid, both state_on | ||
38 | * and state_off should be not NULL. If at least one of them is NULL, | ||
39 | * the print_state is not overriden. | ||
40 | */ | ||
41 | struct gpio_extcon_platform_data { | ||
42 | const char *name; | ||
43 | unsigned gpio; | ||
44 | unsigned long debounce; | ||
45 | unsigned long irq_flags; | ||
46 | |||
47 | /* if NULL, "0" or "1" will be printed */ | ||
48 | const char *state_on; | ||
49 | const char *state_off; | ||
50 | }; | ||
51 | |||
52 | #endif /* __EXTCON_GPIO_H__ */ | ||
diff --git a/include/linux/hyperv.h b/include/linux/hyperv.h index 6af8738ae7e9..68ed7f7e1fc9 100644 --- a/include/linux/hyperv.h +++ b/include/linux/hyperv.h | |||
@@ -1062,8 +1062,10 @@ struct hyperv_service_callback { | |||
1062 | void (*callback) (void *context); | 1062 | void (*callback) (void *context); |
1063 | }; | 1063 | }; |
1064 | 1064 | ||
1065 | #define MAX_SRV_VER 0x7ffffff | ||
1065 | extern void vmbus_prep_negotiate_resp(struct icmsg_hdr *, | 1066 | extern void vmbus_prep_negotiate_resp(struct icmsg_hdr *, |
1066 | struct icmsg_negotiate *, u8 *); | 1067 | struct icmsg_negotiate *, u8 *, int, |
1068 | int); | ||
1067 | 1069 | ||
1068 | int hv_kvp_init(struct hv_util_service *); | 1070 | int hv_kvp_init(struct hv_util_service *); |
1069 | void hv_kvp_deinit(void); | 1071 | void hv_kvp_deinit(void); |
diff --git a/include/linux/mfd/max8997.h b/include/linux/mfd/max8997.h index 28726dd540f2..b40c08cd30bc 100644 --- a/include/linux/mfd/max8997.h +++ b/include/linux/mfd/max8997.h | |||
@@ -99,34 +99,11 @@ struct max8997_muic_reg_data { | |||
99 | 99 | ||
100 | /** | 100 | /** |
101 | * struct max8997_muic_platform_data | 101 | * struct max8997_muic_platform_data |
102 | * @usb_callback: callback function for USB | ||
103 | * inform callee of USB type (HOST or DEVICE) | ||
104 | * and attached state(true or false) | ||
105 | * @charger_callback: callback function for charger | ||
106 | * inform callee of charger_type | ||
107 | * and attached state(true or false) | ||
108 | * @deskdock_callback: callback function for desk dock | ||
109 | * inform callee of attached state(true or false) | ||
110 | * @cardock_callback: callback function for car dock | ||
111 | * inform callee of attached state(true or false) | ||
112 | * @mhl_callback: callback function for MHL (Mobile High-definition Link) | ||
113 | * inform callee of attached state(true or false) | ||
114 | * @uart_callback: callback function for JIG UART | ||
115 | * inform callee of attached state(true or false) | ||
116 | * @init_data: array of max8997_muic_reg_data | 102 | * @init_data: array of max8997_muic_reg_data |
117 | * used for initializing registers of MAX8997 MUIC device | 103 | * used for initializing registers of MAX8997 MUIC device |
118 | * @num_init_data: array size of init_data | 104 | * @num_init_data: array size of init_data |
119 | */ | 105 | */ |
120 | struct max8997_muic_platform_data { | 106 | struct max8997_muic_platform_data { |
121 | void (*usb_callback)(enum max8997_muic_usb_type usb_type, | ||
122 | bool attached); | ||
123 | void (*charger_callback)(bool attached, | ||
124 | enum max8997_muic_charger_type charger_type); | ||
125 | void (*deskdock_callback) (bool attached); | ||
126 | void (*cardock_callback) (bool attached); | ||
127 | void (*mhl_callback) (bool attached); | ||
128 | void (*uart_callback) (bool attached); | ||
129 | |||
130 | struct max8997_muic_reg_data *init_data; | 107 | struct max8997_muic_reg_data *init_data; |
131 | int num_init_data; | 108 | int num_init_data; |
132 | }; | 109 | }; |
diff --git a/include/linux/moduleparam.h b/include/linux/moduleparam.h index ea36486378d8..1b14d25162cb 100644 --- a/include/linux/moduleparam.h +++ b/include/linux/moduleparam.h | |||
@@ -320,7 +320,8 @@ extern int parse_args(const char *name, | |||
320 | unsigned num, | 320 | unsigned num, |
321 | s16 level_min, | 321 | s16 level_min, |
322 | s16 level_max, | 322 | s16 level_max, |
323 | int (*unknown)(char *param, char *val)); | 323 | int (*unknown)(char *param, char *val, |
324 | const char *doing)); | ||
324 | 325 | ||
325 | /* Called by module remove. */ | 326 | /* Called by module remove. */ |
326 | #ifdef CONFIG_SYSFS | 327 | #ifdef CONFIG_SYSFS |
diff --git a/include/linux/platform_data/emif_plat.h b/include/linux/platform_data/emif_plat.h new file mode 100644 index 000000000000..03378ca84061 --- /dev/null +++ b/include/linux/platform_data/emif_plat.h | |||
@@ -0,0 +1,128 @@ | |||
1 | /* | ||
2 | * Definitions for TI EMIF device platform data | ||
3 | * | ||
4 | * Copyright (C) 2012 Texas Instruments, Inc. | ||
5 | * | ||
6 | * Aneesh V <aneesh@ti.com> | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or modify | ||
9 | * it under the terms of the GNU General Public License version 2 as | ||
10 | * published by the Free Software Foundation. | ||
11 | */ | ||
12 | #ifndef __EMIF_PLAT_H | ||
13 | #define __EMIF_PLAT_H | ||
14 | |||
15 | /* Low power modes - EMIF_PWR_MGMT_CTRL */ | ||
16 | #define EMIF_LP_MODE_DISABLE 0 | ||
17 | #define EMIF_LP_MODE_CLOCK_STOP 1 | ||
18 | #define EMIF_LP_MODE_SELF_REFRESH 2 | ||
19 | #define EMIF_LP_MODE_PWR_DN 4 | ||
20 | |||
21 | /* Hardware capabilities */ | ||
22 | #define EMIF_HW_CAPS_LL_INTERFACE 0x00000001 | ||
23 | |||
24 | /* | ||
25 | * EMIF IP Revisions | ||
26 | * EMIF4D - Used in OMAP4 | ||
27 | * EMIF4D5 - Used in OMAP5 | ||
28 | */ | ||
29 | #define EMIF_4D 1 | ||
30 | #define EMIF_4D5 2 | ||
31 | |||
32 | /* | ||
33 | * PHY types | ||
34 | * ATTILAPHY - Used in OMAP4 | ||
35 | * INTELLIPHY - Used in OMAP5 | ||
36 | */ | ||
37 | #define EMIF_PHY_TYPE_ATTILAPHY 1 | ||
38 | #define EMIF_PHY_TYPE_INTELLIPHY 2 | ||
39 | |||
40 | /* Custom config requests */ | ||
41 | #define EMIF_CUSTOM_CONFIG_LPMODE 0x00000001 | ||
42 | #define EMIF_CUSTOM_CONFIG_TEMP_ALERT_POLL_INTERVAL 0x00000002 | ||
43 | |||
44 | #ifndef __ASSEMBLY__ | ||
45 | /** | ||
46 | * struct ddr_device_info - All information about the DDR device except AC | ||
47 | * timing parameters | ||
48 | * @type: Device type (LPDDR2-S4, LPDDR2-S2 etc) | ||
49 | * @density: Device density | ||
50 | * @io_width: Bus width | ||
51 | * @cs1_used: Whether there is a DDR device attached to the second | ||
52 | * chip-select(CS1) of this EMIF instance | ||
53 | * @cal_resistors_per_cs: Whether there is one calibration resistor per | ||
54 | * chip-select or whether it's a single one for both | ||
55 | * @manufacturer: Manufacturer name string | ||
56 | */ | ||
57 | struct ddr_device_info { | ||
58 | u32 type; | ||
59 | u32 density; | ||
60 | u32 io_width; | ||
61 | u32 cs1_used; | ||
62 | u32 cal_resistors_per_cs; | ||
63 | char manufacturer[10]; | ||
64 | }; | ||
65 | |||
66 | /** | ||
67 | * struct emif_custom_configs - Custom configuration parameters/policies | ||
68 | * passed from the platform layer | ||
69 | * @mask: Mask to indicate which configs are requested | ||
70 | * @lpmode: LPMODE to be used in PWR_MGMT_CTRL register | ||
71 | * @lpmode_timeout_performance: Timeout before LPMODE entry when higher | ||
72 | * performance is desired at the cost of power (typically | ||
73 | * at higher OPPs) | ||
74 | * @lpmode_timeout_power: Timeout before LPMODE entry when better power | ||
75 | * savings is desired and performance is not important | ||
76 | * (typically at lower loads indicated by lower OPPs) | ||
77 | * @lpmode_freq_threshold: The DDR frequency threshold to identify between | ||
78 | * the above two cases: | ||
79 | * timeout = (freq >= lpmode_freq_threshold) ? | ||
80 | * lpmode_timeout_performance : | ||
81 | * lpmode_timeout_power; | ||
82 | * @temp_alert_poll_interval_ms: LPDDR2 MR4 polling interval at nominal | ||
83 | * temperature(in milliseconds). When temperature is high | ||
84 | * polling is done 4 times as frequently. | ||
85 | */ | ||
86 | struct emif_custom_configs { | ||
87 | u32 mask; | ||
88 | u32 lpmode; | ||
89 | u32 lpmode_timeout_performance; | ||
90 | u32 lpmode_timeout_power; | ||
91 | u32 lpmode_freq_threshold; | ||
92 | u32 temp_alert_poll_interval_ms; | ||
93 | }; | ||
94 | |||
95 | /** | ||
96 | * struct emif_platform_data - Platform data passed on EMIF platform | ||
97 | * device creation. Used by the driver. | ||
98 | * @hw_caps: Hw capabilities of the EMIF IP in the respective SoC | ||
99 | * @device_info: Device info structure containing information such | ||
100 | * as type, bus width, density etc | ||
101 | * @timings: Timings information from device datasheet passed | ||
102 | * as an array of 'struct lpddr2_timings'. Can be NULL | ||
103 | * if if default timings are ok | ||
104 | * @timings_arr_size: Size of the timings array. Depends on the number | ||
105 | * of different frequencies for which timings data | ||
106 | * is provided | ||
107 | * @min_tck: Minimum value of some timing parameters in terms | ||
108 | * of number of cycles. Can be NULL if default values | ||
109 | * are ok | ||
110 | * @custom_configs: Custom configurations requested by SoC or board | ||
111 | * code and the data for them. Can be NULL if default | ||
112 | * configurations done by the driver are ok. See | ||
113 | * documentation for 'struct emif_custom_configs' for | ||
114 | * more details | ||
115 | */ | ||
116 | struct emif_platform_data { | ||
117 | u32 hw_caps; | ||
118 | struct ddr_device_info *device_info; | ||
119 | const struct lpddr2_timings *timings; | ||
120 | u32 timings_arr_size; | ||
121 | const struct lpddr2_min_tck *min_tck; | ||
122 | struct emif_custom_configs *custom_configs; | ||
123 | u32 ip_rev; | ||
124 | u32 phy_type; | ||
125 | }; | ||
126 | #endif /* __ASSEMBLY__ */ | ||
127 | |||
128 | #endif /* __LINUX_EMIF_H */ | ||
diff --git a/include/linux/printk.h b/include/linux/printk.h index 0525927f203f..1bec2f7a2d42 100644 --- a/include/linux/printk.h +++ b/include/linux/printk.h | |||
@@ -95,8 +95,19 @@ extern int printk_needs_cpu(int cpu); | |||
95 | extern void printk_tick(void); | 95 | extern void printk_tick(void); |
96 | 96 | ||
97 | #ifdef CONFIG_PRINTK | 97 | #ifdef CONFIG_PRINTK |
98 | asmlinkage __printf(5, 0) | ||
99 | int vprintk_emit(int facility, int level, | ||
100 | const char *dict, size_t dictlen, | ||
101 | const char *fmt, va_list args); | ||
102 | |||
98 | asmlinkage __printf(1, 0) | 103 | asmlinkage __printf(1, 0) |
99 | int vprintk(const char *fmt, va_list args); | 104 | int vprintk(const char *fmt, va_list args); |
105 | |||
106 | asmlinkage __printf(5, 6) __cold | ||
107 | asmlinkage int printk_emit(int facility, int level, | ||
108 | const char *dict, size_t dictlen, | ||
109 | const char *fmt, ...); | ||
110 | |||
100 | asmlinkage __printf(1, 2) __cold | 111 | asmlinkage __printf(1, 2) __cold |
101 | int printk(const char *fmt, ...); | 112 | int printk(const char *fmt, ...); |
102 | 113 | ||
@@ -289,6 +300,8 @@ extern void dump_stack(void) __cold; | |||
289 | no_printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__) | 300 | no_printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__) |
290 | #endif | 301 | #endif |
291 | 302 | ||
303 | extern const struct file_operations kmsg_fops; | ||
304 | |||
292 | enum { | 305 | enum { |
293 | DUMP_PREFIX_NONE, | 306 | DUMP_PREFIX_NONE, |
294 | DUMP_PREFIX_ADDRESS, | 307 | DUMP_PREFIX_ADDRESS, |
diff --git a/include/linux/sysfs.h b/include/linux/sysfs.h index 0010009b2f00..381f06db2fe5 100644 --- a/include/linux/sysfs.h +++ b/include/linux/sysfs.h | |||
@@ -27,6 +27,7 @@ struct attribute { | |||
27 | const char *name; | 27 | const char *name; |
28 | umode_t mode; | 28 | umode_t mode; |
29 | #ifdef CONFIG_DEBUG_LOCK_ALLOC | 29 | #ifdef CONFIG_DEBUG_LOCK_ALLOC |
30 | bool ignore_lockdep:1; | ||
30 | struct lock_class_key *key; | 31 | struct lock_class_key *key; |
31 | struct lock_class_key skey; | 32 | struct lock_class_key skey; |
32 | #endif | 33 | #endif |
@@ -80,6 +81,17 @@ struct attribute_group { | |||
80 | 81 | ||
81 | #define __ATTR_NULL { .attr = { .name = NULL } } | 82 | #define __ATTR_NULL { .attr = { .name = NULL } } |
82 | 83 | ||
84 | #ifdef CONFIG_DEBUG_LOCK_ALLOC | ||
85 | #define __ATTR_IGNORE_LOCKDEP(_name, _mode, _show, _store) { \ | ||
86 | .attr = {.name = __stringify(_name), .mode = _mode, \ | ||
87 | .ignore_lockdep = true }, \ | ||
88 | .show = _show, \ | ||
89 | .store = _store, \ | ||
90 | } | ||
91 | #else | ||
92 | #define __ATTR_IGNORE_LOCKDEP __ATTR | ||
93 | #endif | ||
94 | |||
83 | #define attr_name(_attr) (_attr).attr.name | 95 | #define attr_name(_attr) (_attr).attr.name |
84 | 96 | ||
85 | struct file; | 97 | struct file; |