MyungJoo Ham | de55d87 | 2012-04-20 14:16:22 +0900 | [diff] [blame] | 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 | |
Chanwoo Choi | d851718 | 2012-11-08 18:39:41 +0900 | [diff] [blame] | 26 | #include <linux/device.h> |
Donggeun Kim | 74c5d09 | 2012-04-20 14:16:24 +0900 | [diff] [blame] | 27 | #include <linux/notifier.h> |
Chanwoo Choi | d851718 | 2012-11-08 18:39:41 +0900 | [diff] [blame] | 28 | #include <linux/sysfs.h> |
MyungJoo Ham | 806d9dd | 2012-04-20 14:16:25 +0900 | [diff] [blame] | 29 | |
| 30 | #define SUPPORTED_CABLE_MAX 32 |
| 31 | #define CABLE_NAME_MAX 30 |
| 32 | |
| 33 | /* |
| 34 | * The standard cable name is to help support general notifier |
Peter Meerwald | c338bb0 | 2012-08-23 09:11:54 +0900 | [diff] [blame] | 35 | * and notifiee device drivers to share the common names. |
MyungJoo Ham | 806d9dd | 2012-04-20 14:16:25 +0900 | [diff] [blame] | 36 | * Please use standard cable names unless your notifier device has |
| 37 | * a very unique and abnormal cable or |
| 38 | * the cable type is supposed to be used with only one unique |
Peter Meerwald | c338bb0 | 2012-08-23 09:11:54 +0900 | [diff] [blame] | 39 | * pair of notifier/notifiee devices. |
MyungJoo Ham | 806d9dd | 2012-04-20 14:16:25 +0900 | [diff] [blame] | 40 | * |
| 41 | * Please add any other "standard" cables used with extcon dev. |
| 42 | * |
| 43 | * You may add a dot and number to specify version or specification |
| 44 | * of the specific cable if it is required. (e.g., "Fast-charger.18" |
| 45 | * and "Fast-charger.10" for 1.8A and 1.0A chargers) |
Peter Meerwald | c338bb0 | 2012-08-23 09:11:54 +0900 | [diff] [blame] | 46 | * However, the notifiee and notifier should be able to handle such |
| 47 | * string and if the notifiee can negotiate the protocol or identify, |
MyungJoo Ham | 806d9dd | 2012-04-20 14:16:25 +0900 | [diff] [blame] | 48 | * you don't need such convention. This convention is helpful when |
| 49 | * notifier can distinguish but notifiee cannot. |
| 50 | */ |
| 51 | enum extcon_cable_name { |
| 52 | EXTCON_USB = 0, |
| 53 | EXTCON_USB_HOST, |
Chanwoo Choi | a75e1c7 | 2013-08-31 13:16:49 +0900 | [diff] [blame] | 54 | EXTCON_TA, /* Travel Adaptor */ |
MyungJoo Ham | 806d9dd | 2012-04-20 14:16:25 +0900 | [diff] [blame] | 55 | EXTCON_FAST_CHARGER, |
| 56 | EXTCON_SLOW_CHARGER, |
Chanwoo Choi | a75e1c7 | 2013-08-31 13:16:49 +0900 | [diff] [blame] | 57 | EXTCON_CHARGE_DOWNSTREAM, /* Charging an external device */ |
MyungJoo Ham | 806d9dd | 2012-04-20 14:16:25 +0900 | [diff] [blame] | 58 | EXTCON_HDMI, |
| 59 | EXTCON_MHL, |
| 60 | EXTCON_DVI, |
| 61 | EXTCON_VGA, |
| 62 | EXTCON_DOCK, |
| 63 | EXTCON_LINE_IN, |
| 64 | EXTCON_LINE_OUT, |
| 65 | EXTCON_MIC_IN, |
| 66 | EXTCON_HEADPHONE_OUT, |
| 67 | EXTCON_SPDIF_IN, |
| 68 | EXTCON_SPDIF_OUT, |
| 69 | EXTCON_VIDEO_IN, |
| 70 | EXTCON_VIDEO_OUT, |
Mark Brown | 0e1507c | 2012-05-02 10:38:51 +0100 | [diff] [blame] | 71 | EXTCON_MECHANICAL, |
MyungJoo Ham | 806d9dd | 2012-04-20 14:16:25 +0900 | [diff] [blame] | 72 | }; |
anish kumar | 0cf6ad8 | 2012-08-30 00:35:09 +0530 | [diff] [blame] | 73 | extern const char extcon_cable_name[][CABLE_NAME_MAX + 1]; |
MyungJoo Ham | 806d9dd | 2012-04-20 14:16:25 +0900 | [diff] [blame] | 74 | |
| 75 | struct extcon_cable; |
| 76 | |
MyungJoo Ham | de55d87 | 2012-04-20 14:16:22 +0900 | [diff] [blame] | 77 | /** |
| 78 | * struct extcon_dev - An extcon device represents one external connector. |
Chanwoo Choi | a75e1c7 | 2013-08-31 13:16:49 +0900 | [diff] [blame] | 79 | * @name: The name of this extcon device. Parent device name is |
| 80 | * used if NULL. |
MyungJoo Ham | df072eb | 2012-11-20 19:22:33 +0900 | [diff] [blame] | 81 | * @supported_cable: Array of supported cable names ending with NULL. |
MyungJoo Ham | 806d9dd | 2012-04-20 14:16:25 +0900 | [diff] [blame] | 82 | * If supported_cable is NULL, cable name related APIs |
| 83 | * are disabled. |
MyungJoo Ham | df072eb | 2012-11-20 19:22:33 +0900 | [diff] [blame] | 84 | * @mutually_exclusive: Array of mutually exclusive set of cables that cannot |
MyungJoo Ham | bde68e6 | 2012-04-20 14:16:26 +0900 | [diff] [blame] | 85 | * be attached simultaneously. The array should be |
| 86 | * ending with NULL or be NULL (no mutually exclusive |
| 87 | * cables). For example, if it is { 0x7, 0x30, 0}, then, |
| 88 | * {0, 1}, {0, 1, 2}, {0, 2}, {1, 2}, or {4, 5} cannot |
| 89 | * be attached simulataneously. {0x7, 0} is equivalent to |
| 90 | * {0x3, 0x6, 0x5, 0}. If it is {0xFFFFFFFF, 0}, there |
| 91 | * can be no simultaneous connections. |
Chanwoo Choi | a75e1c7 | 2013-08-31 13:16:49 +0900 | [diff] [blame] | 92 | * @print_name: An optional callback to override the method to print the |
| 93 | * name of the extcon device. |
MyungJoo Ham | df072eb | 2012-11-20 19:22:33 +0900 | [diff] [blame] | 94 | * @print_state: An optional callback to override the method to print the |
Chanwoo Choi | a75e1c7 | 2013-08-31 13:16:49 +0900 | [diff] [blame] | 95 | * status of the extcon device. |
Chanwoo Choi | dae6165 | 2013-09-27 09:19:40 +0900 | [diff] [blame] | 96 | * @dev: Device of this extcon. |
Chanwoo Choi | a75e1c7 | 2013-08-31 13:16:49 +0900 | [diff] [blame] | 97 | * @state: Attach/detach state of this extcon. Do not provide at |
| 98 | * register-time. |
| 99 | * @nh: Notifier for the state change events from this extcon |
| 100 | * @entry: To support list of extcon devices so that users can search |
| 101 | * for extcon devices based on the extcon name. |
MyungJoo Ham | df072eb | 2012-11-20 19:22:33 +0900 | [diff] [blame] | 102 | * @lock: |
| 103 | * @max_supported: Internal value to store the number of cables. |
| 104 | * @extcon_dev_type: Device_type struct to provide attribute_groups |
MyungJoo Ham | 806d9dd | 2012-04-20 14:16:25 +0900 | [diff] [blame] | 105 | * customized for each extcon device. |
Chanwoo Choi | a75e1c7 | 2013-08-31 13:16:49 +0900 | [diff] [blame] | 106 | * @cables: Sysfs subdirectories. Each represents one cable. |
MyungJoo Ham | de55d87 | 2012-04-20 14:16:22 +0900 | [diff] [blame] | 107 | * |
| 108 | * In most cases, users only need to provide "User initializing data" of |
| 109 | * this struct when registering an extcon. In some exceptional cases, |
| 110 | * optional callbacks may be needed. However, the values in "internal data" |
| 111 | * are overwritten by register function. |
| 112 | */ |
| 113 | struct extcon_dev { |
Chanwoo Choi | a75e1c7 | 2013-08-31 13:16:49 +0900 | [diff] [blame] | 114 | /* Optional user initializing data */ |
| 115 | const char *name; |
MyungJoo Ham | 806d9dd | 2012-04-20 14:16:25 +0900 | [diff] [blame] | 116 | const char **supported_cable; |
Chanwoo Choi | a75e1c7 | 2013-08-31 13:16:49 +0900 | [diff] [blame] | 117 | const u32 *mutually_exclusive; |
MyungJoo Ham | de55d87 | 2012-04-20 14:16:22 +0900 | [diff] [blame] | 118 | |
Chanwoo Choi | a75e1c7 | 2013-08-31 13:16:49 +0900 | [diff] [blame] | 119 | /* Optional callbacks to override class functions */ |
MyungJoo Ham | de55d87 | 2012-04-20 14:16:22 +0900 | [diff] [blame] | 120 | ssize_t (*print_name)(struct extcon_dev *edev, char *buf); |
| 121 | ssize_t (*print_state)(struct extcon_dev *edev, char *buf); |
| 122 | |
Chanwoo Choi | a75e1c7 | 2013-08-31 13:16:49 +0900 | [diff] [blame] | 123 | /* Internal data. Please do not set. */ |
Chanwoo Choi | dae6165 | 2013-09-27 09:19:40 +0900 | [diff] [blame] | 124 | struct device dev; |
Donggeun Kim | 74c5d09 | 2012-04-20 14:16:24 +0900 | [diff] [blame] | 125 | struct raw_notifier_head nh; |
| 126 | struct list_head entry; |
MyungJoo Ham | 806d9dd | 2012-04-20 14:16:25 +0900 | [diff] [blame] | 127 | int max_supported; |
Chanwoo Choi | a75e1c7 | 2013-08-31 13:16:49 +0900 | [diff] [blame] | 128 | spinlock_t lock; /* could be called by irq handler */ |
| 129 | u32 state; |
MyungJoo Ham | 806d9dd | 2012-04-20 14:16:25 +0900 | [diff] [blame] | 130 | |
| 131 | /* /sys/class/extcon/.../cable.n/... */ |
| 132 | struct device_type extcon_dev_type; |
| 133 | struct extcon_cable *cables; |
Chanwoo Choi | a75e1c7 | 2013-08-31 13:16:49 +0900 | [diff] [blame] | 134 | |
MyungJoo Ham | bde68e6 | 2012-04-20 14:16:26 +0900 | [diff] [blame] | 135 | /* /sys/class/extcon/.../mutually_exclusive/... */ |
| 136 | struct attribute_group attr_g_muex; |
| 137 | struct attribute **attrs_muex; |
| 138 | struct device_attribute *d_attrs_muex; |
MyungJoo Ham | 806d9dd | 2012-04-20 14:16:25 +0900 | [diff] [blame] | 139 | }; |
| 140 | |
| 141 | /** |
Chanwoo Choi | a75e1c7 | 2013-08-31 13:16:49 +0900 | [diff] [blame] | 142 | * struct extcon_cable - An internal data for each cable of extcon device. |
| 143 | * @edev: The extcon device |
MyungJoo Ham | df072eb | 2012-11-20 19:22:33 +0900 | [diff] [blame] | 144 | * @cable_index: Index of this cable in the edev |
Chanwoo Choi | a75e1c7 | 2013-08-31 13:16:49 +0900 | [diff] [blame] | 145 | * @attr_g: Attribute group for the cable |
| 146 | * @attr_name: "name" sysfs entry |
| 147 | * @attr_state: "state" sysfs entry |
| 148 | * @attrs: Array pointing to attr_name and attr_state for attr_g |
MyungJoo Ham | 806d9dd | 2012-04-20 14:16:25 +0900 | [diff] [blame] | 149 | */ |
| 150 | struct extcon_cable { |
| 151 | struct extcon_dev *edev; |
| 152 | int cable_index; |
| 153 | |
| 154 | struct attribute_group attr_g; |
| 155 | struct device_attribute attr_name; |
| 156 | struct device_attribute attr_state; |
| 157 | |
| 158 | struct attribute *attrs[3]; /* to be fed to attr_g.attrs */ |
| 159 | }; |
| 160 | |
| 161 | /** |
| 162 | * struct extcon_specific_cable_nb - An internal data for |
Chanwoo Choi | a75e1c7 | 2013-08-31 13:16:49 +0900 | [diff] [blame] | 163 | * extcon_register_interest(). |
| 164 | * @internal_nb: A notifier block bridging extcon notifier |
| 165 | * and cable notifier. |
| 166 | * @user_nb: user provided notifier block for events from |
| 167 | * a specific cable. |
MyungJoo Ham | df072eb | 2012-11-20 19:22:33 +0900 | [diff] [blame] | 168 | * @cable_index: the target cable. |
Chanwoo Choi | a75e1c7 | 2013-08-31 13:16:49 +0900 | [diff] [blame] | 169 | * @edev: the target extcon device. |
MyungJoo Ham | df072eb | 2012-11-20 19:22:33 +0900 | [diff] [blame] | 170 | * @previous_value: the saved previous event value. |
MyungJoo Ham | 806d9dd | 2012-04-20 14:16:25 +0900 | [diff] [blame] | 171 | */ |
| 172 | struct extcon_specific_cable_nb { |
| 173 | struct notifier_block internal_nb; |
| 174 | struct notifier_block *user_nb; |
| 175 | int cable_index; |
| 176 | struct extcon_dev *edev; |
| 177 | unsigned long previous_value; |
MyungJoo Ham | de55d87 | 2012-04-20 14:16:22 +0900 | [diff] [blame] | 178 | }; |
| 179 | |
| 180 | #if IS_ENABLED(CONFIG_EXTCON) |
Donggeun Kim | 74c5d09 | 2012-04-20 14:16:24 +0900 | [diff] [blame] | 181 | |
| 182 | /* |
| 183 | * Following APIs are for notifiers or configurations. |
| 184 | * Notifiers are the external port and connection devices. |
| 185 | */ |
Chanwoo Choi | 42d7d75 | 2013-09-27 09:20:26 +0900 | [diff] [blame] | 186 | extern int extcon_dev_register(struct extcon_dev *edev); |
MyungJoo Ham | de55d87 | 2012-04-20 14:16:22 +0900 | [diff] [blame] | 187 | extern void extcon_dev_unregister(struct extcon_dev *edev); |
Sangjung Woo | 1111244 | 2014-04-21 19:10:08 +0900 | [diff] [blame] | 188 | extern int devm_extcon_dev_register(struct device *dev, |
| 189 | struct extcon_dev *edev); |
| 190 | extern void devm_extcon_dev_unregister(struct device *dev, |
| 191 | struct extcon_dev *edev); |
Donggeun Kim | 74c5d09 | 2012-04-20 14:16:24 +0900 | [diff] [blame] | 192 | extern struct extcon_dev *extcon_get_extcon_dev(const char *extcon_name); |
MyungJoo Ham | de55d87 | 2012-04-20 14:16:22 +0900 | [diff] [blame] | 193 | |
MyungJoo Ham | 806d9dd | 2012-04-20 14:16:25 +0900 | [diff] [blame] | 194 | /* |
Chanwoo Choi | a9af652 | 2014-04-24 19:46:49 +0900 | [diff] [blame] | 195 | * Following APIs control the memory of extcon device. |
| 196 | */ |
| 197 | extern struct extcon_dev *extcon_dev_allocate(const char **cables); |
| 198 | extern void extcon_dev_free(struct extcon_dev *edev); |
Chanwoo Choi | 739ba1b | 2014-04-24 20:12:15 +0900 | [diff] [blame^] | 199 | extern struct extcon_dev *devm_extcon_dev_allocate(struct device *dev, |
| 200 | const char **cables); |
| 201 | extern void devm_extcon_dev_free(struct device *dev, struct extcon_dev *edev); |
Chanwoo Choi | a9af652 | 2014-04-24 19:46:49 +0900 | [diff] [blame] | 202 | |
| 203 | /* |
MyungJoo Ham | 806d9dd | 2012-04-20 14:16:25 +0900 | [diff] [blame] | 204 | * get/set/update_state access the 32b encoded state value, which represents |
| 205 | * states of all possible cables of the multistate port. For example, if one |
| 206 | * calls extcon_set_state(edev, 0x7), it may mean that all the three cables |
| 207 | * are attached to the port. |
| 208 | */ |
MyungJoo Ham | de55d87 | 2012-04-20 14:16:22 +0900 | [diff] [blame] | 209 | static inline u32 extcon_get_state(struct extcon_dev *edev) |
| 210 | { |
| 211 | return edev->state; |
| 212 | } |
| 213 | |
MyungJoo Ham | bde68e6 | 2012-04-20 14:16:26 +0900 | [diff] [blame] | 214 | extern int extcon_set_state(struct extcon_dev *edev, u32 state); |
| 215 | extern int extcon_update_state(struct extcon_dev *edev, u32 mask, u32 state); |
MyungJoo Ham | 806d9dd | 2012-04-20 14:16:25 +0900 | [diff] [blame] | 216 | |
| 217 | /* |
| 218 | * get/set_cable_state access each bit of the 32b encoded state value. |
| 219 | * They are used to access the status of each cable based on the cable_name |
Peter Meerwald | c338bb0 | 2012-08-23 09:11:54 +0900 | [diff] [blame] | 220 | * or cable_index, which is retrieved by extcon_find_cable_index |
MyungJoo Ham | 806d9dd | 2012-04-20 14:16:25 +0900 | [diff] [blame] | 221 | */ |
| 222 | extern int extcon_find_cable_index(struct extcon_dev *sdev, |
| 223 | const char *cable_name); |
| 224 | extern int extcon_get_cable_state_(struct extcon_dev *edev, int cable_index); |
| 225 | extern int extcon_set_cable_state_(struct extcon_dev *edev, int cable_index, |
| 226 | bool cable_state); |
| 227 | |
| 228 | extern int extcon_get_cable_state(struct extcon_dev *edev, |
| 229 | const char *cable_name); |
| 230 | extern int extcon_set_cable_state(struct extcon_dev *edev, |
| 231 | const char *cable_name, bool cable_state); |
| 232 | |
| 233 | /* |
| 234 | * Following APIs are for notifiees (those who want to be notified) |
| 235 | * to register a callback for events from a specific cable of the extcon. |
| 236 | * Notifiees are the connected device drivers wanting to get notified by |
| 237 | * a specific external port of a connection device. |
| 238 | */ |
| 239 | extern int extcon_register_interest(struct extcon_specific_cable_nb *obj, |
| 240 | const char *extcon_name, |
| 241 | const char *cable_name, |
| 242 | struct notifier_block *nb); |
| 243 | extern int extcon_unregister_interest(struct extcon_specific_cable_nb *nb); |
Donggeun Kim | 74c5d09 | 2012-04-20 14:16:24 +0900 | [diff] [blame] | 244 | |
| 245 | /* |
| 246 | * Following APIs are to monitor every action of a notifier. |
Peter Meerwald | c338bb0 | 2012-08-23 09:11:54 +0900 | [diff] [blame] | 247 | * Registrar gets notified for every external port of a connection device. |
MyungJoo Ham | 806d9dd | 2012-04-20 14:16:25 +0900 | [diff] [blame] | 248 | * Probably this could be used to debug an action of notifier; however, |
Peter Meerwald | c338bb0 | 2012-08-23 09:11:54 +0900 | [diff] [blame] | 249 | * we do not recommend to use this for normal 'notifiee' device drivers who |
MyungJoo Ham | 806d9dd | 2012-04-20 14:16:25 +0900 | [diff] [blame] | 250 | * want to be notified by a specific external port of the notifier. |
Donggeun Kim | 74c5d09 | 2012-04-20 14:16:24 +0900 | [diff] [blame] | 251 | */ |
| 252 | extern int extcon_register_notifier(struct extcon_dev *edev, |
| 253 | struct notifier_block *nb); |
| 254 | extern int extcon_unregister_notifier(struct extcon_dev *edev, |
| 255 | struct notifier_block *nb); |
Chanwoo Choi | 1ad94ff | 2014-03-18 19:55:46 +0900 | [diff] [blame] | 256 | |
| 257 | /* |
| 258 | * Following API get the extcon device from devicetree. |
| 259 | * This function use phandle of devicetree to get extcon device directly. |
| 260 | */ |
| 261 | extern struct extcon_dev *extcon_get_edev_by_phandle(struct device *dev, int index); |
MyungJoo Ham | de55d87 | 2012-04-20 14:16:22 +0900 | [diff] [blame] | 262 | #else /* CONFIG_EXTCON */ |
Chanwoo Choi | 42d7d75 | 2013-09-27 09:20:26 +0900 | [diff] [blame] | 263 | static inline int extcon_dev_register(struct extcon_dev *edev) |
MyungJoo Ham | de55d87 | 2012-04-20 14:16:22 +0900 | [diff] [blame] | 264 | { |
| 265 | return 0; |
| 266 | } |
| 267 | |
| 268 | static inline void extcon_dev_unregister(struct extcon_dev *edev) { } |
| 269 | |
Sangjung Woo | 1111244 | 2014-04-21 19:10:08 +0900 | [diff] [blame] | 270 | static inline int devm_extcon_dev_register(struct device *dev, |
| 271 | struct extcon_dev *edev) |
| 272 | { |
| 273 | return -EINVAL; |
| 274 | } |
| 275 | |
| 276 | static inline void devm_extcon_dev_unregister(struct device *dev, |
| 277 | struct extcon_dev *edev) { } |
| 278 | |
Chanwoo Choi | a9af652 | 2014-04-24 19:46:49 +0900 | [diff] [blame] | 279 | static inline struct extcon_dev *extcon_dev_allocate(const char **cables) |
| 280 | { |
| 281 | return ERR_PTR(-ENOSYS); |
| 282 | } |
| 283 | |
| 284 | static inline void extcon_dev_free(struct extcon_dev *edev) { } |
| 285 | |
Chanwoo Choi | 739ba1b | 2014-04-24 20:12:15 +0900 | [diff] [blame^] | 286 | static inline struct extcon_dev *devm_extcon_dev_allocate(struct device *dev, |
| 287 | const char **cables) |
| 288 | { |
| 289 | return ERR_PTR(-ENOSYS); |
| 290 | } |
| 291 | |
| 292 | static inline void devm_extcon_dev_free(struct extcon_dev *edev) { } |
| 293 | |
MyungJoo Ham | de55d87 | 2012-04-20 14:16:22 +0900 | [diff] [blame] | 294 | static inline u32 extcon_get_state(struct extcon_dev *edev) |
| 295 | { |
| 296 | return 0; |
| 297 | } |
| 298 | |
MyungJoo Ham | bde68e6 | 2012-04-20 14:16:26 +0900 | [diff] [blame] | 299 | static inline int extcon_set_state(struct extcon_dev *edev, u32 state) |
| 300 | { |
| 301 | return 0; |
| 302 | } |
MyungJoo Ham | 806d9dd | 2012-04-20 14:16:25 +0900 | [diff] [blame] | 303 | |
MyungJoo Ham | bde68e6 | 2012-04-20 14:16:26 +0900 | [diff] [blame] | 304 | static inline int extcon_update_state(struct extcon_dev *edev, u32 mask, |
MyungJoo Ham | 806d9dd | 2012-04-20 14:16:25 +0900 | [diff] [blame] | 305 | u32 state) |
MyungJoo Ham | bde68e6 | 2012-04-20 14:16:26 +0900 | [diff] [blame] | 306 | { |
| 307 | return 0; |
| 308 | } |
MyungJoo Ham | 806d9dd | 2012-04-20 14:16:25 +0900 | [diff] [blame] | 309 | |
| 310 | static inline int extcon_find_cable_index(struct extcon_dev *edev, |
| 311 | const char *cable_name) |
| 312 | { |
| 313 | return 0; |
| 314 | } |
| 315 | |
| 316 | static inline int extcon_get_cable_state_(struct extcon_dev *edev, |
| 317 | int cable_index) |
| 318 | { |
| 319 | return 0; |
| 320 | } |
| 321 | |
| 322 | static inline int extcon_set_cable_state_(struct extcon_dev *edev, |
| 323 | int cable_index, bool cable_state) |
| 324 | { |
| 325 | return 0; |
| 326 | } |
| 327 | |
| 328 | static inline int extcon_get_cable_state(struct extcon_dev *edev, |
| 329 | const char *cable_name) |
| 330 | { |
| 331 | return 0; |
| 332 | } |
| 333 | |
| 334 | static inline int extcon_set_cable_state(struct extcon_dev *edev, |
| 335 | const char *cable_name, int state) |
| 336 | { |
| 337 | return 0; |
| 338 | } |
| 339 | |
Donggeun Kim | 74c5d09 | 2012-04-20 14:16:24 +0900 | [diff] [blame] | 340 | static inline struct extcon_dev *extcon_get_extcon_dev(const char *extcon_name) |
| 341 | { |
| 342 | return NULL; |
| 343 | } |
| 344 | |
| 345 | static inline int extcon_register_notifier(struct extcon_dev *edev, |
| 346 | struct notifier_block *nb) |
| 347 | { |
| 348 | return 0; |
| 349 | } |
| 350 | |
| 351 | static inline int extcon_unregister_notifier(struct extcon_dev *edev, |
| 352 | struct notifier_block *nb) |
| 353 | { |
| 354 | return 0; |
| 355 | } |
| 356 | |
MyungJoo Ham | 806d9dd | 2012-04-20 14:16:25 +0900 | [diff] [blame] | 357 | static inline int extcon_register_interest(struct extcon_specific_cable_nb *obj, |
| 358 | const char *extcon_name, |
| 359 | const char *cable_name, |
| 360 | struct notifier_block *nb) |
| 361 | { |
| 362 | return 0; |
| 363 | } |
| 364 | |
| 365 | static inline int extcon_unregister_interest(struct extcon_specific_cable_nb |
| 366 | *obj) |
| 367 | { |
| 368 | return 0; |
| 369 | } |
Chanwoo Choi | 1ad94ff | 2014-03-18 19:55:46 +0900 | [diff] [blame] | 370 | |
| 371 | static inline struct extcon_dev *extcon_get_edev_by_phandle(struct device *dev, |
| 372 | int index) |
| 373 | { |
| 374 | return ERR_PTR(-ENODEV); |
| 375 | } |
MyungJoo Ham | de55d87 | 2012-04-20 14:16:22 +0900 | [diff] [blame] | 376 | #endif /* CONFIG_EXTCON */ |
| 377 | #endif /* __LINUX_EXTCON_H__ */ |