| .. | .. | 
|---|
|  | 1 | +/* SPDX-License-Identifier: GPL-2.0-only */ | 
|---|
| 1 | 2 | /* | 
|---|
| 2 | 3 | * External Connector (extcon) framework | 
|---|
| 3 | 4 | * - linux/include/linux/extcon.h for extcon consumer device driver. | 
|---|
| .. | .. | 
|---|
| 12 | 13 | * based on switch class driver | 
|---|
| 13 | 14 | * Copyright (C) 2008 Google, Inc. | 
|---|
| 14 | 15 | * Author: Mike Lockwood <lockwood@android.com> | 
|---|
| 15 |  | - * | 
|---|
| 16 |  | - * This software is licensed under the terms of the GNU General Public | 
|---|
| 17 |  | - * License version 2, as published by the Free Software Foundation, and | 
|---|
| 18 |  | - * may be copied, distributed, and modified under those terms. | 
|---|
| 19 |  | - * | 
|---|
| 20 |  | - * This program is distributed in the hope that it will be useful, | 
|---|
| 21 |  | - * but WITHOUT ANY WARRANTY; without even the implied warranty of | 
|---|
| 22 |  | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | 
|---|
| 23 |  | - * GNU General Public License for more details. | 
|---|
| 24 | 16 | */ | 
|---|
| 25 | 17 |  | 
|---|
| 26 | 18 | #ifndef __LINUX_EXTCON_H__ | 
|---|
| .. | .. | 
|---|
| 85 | 77 | #define EXTCON_DISP_VGA		43	/* Video Graphics Array */ | 
|---|
| 86 | 78 | #define EXTCON_DISP_DP		44	/* Display Port */ | 
|---|
| 87 | 79 | #define EXTCON_DISP_HMD		45	/* Head-Mounted Display */ | 
|---|
| 88 |  | -#define EXTCON_DISP_HDMI_AUDIO	46	/* High-Definition Multimedia Interface Audio */ | 
|---|
|  | 80 | +#define EXTCON_DISP_CVBS	46	/* Composite Video Broadcast Signal */ | 
|---|
|  | 81 | +#define EXTCON_DISP_EDP		47	/* Embedded Display Port */ | 
|---|
| 89 | 82 |  | 
|---|
| 90 | 83 | /* Miscellaneous external connector */ | 
|---|
| 91 | 84 | #define EXTCON_DOCK		60 | 
|---|
| .. | .. | 
|---|
| 127 | 120 | * @type:       integer (intval) | 
|---|
| 128 | 121 | * @value:      0 (USB/USB2) or 1 (USB3) | 
|---|
| 129 | 122 | * @default:    0 (USB/USB2) | 
|---|
| 130 |  | - * - EXTCON_PROP_USB_TYPEC_MED_HIGH_CURRENT | 
|---|
| 131 |  | - * @type:       integer (intval) | 
|---|
| 132 |  | - * @value:      0 (default current), 1 (medium or high current) | 
|---|
| 133 |  | - * @default:    0 (default current) | 
|---|
| 134 | 123 | * | 
|---|
| 135 | 124 | */ | 
|---|
| 136 | 125 | #define EXTCON_PROP_USB_VBUS		0 | 
|---|
| 137 | 126 | #define EXTCON_PROP_USB_TYPEC_POLARITY	1 | 
|---|
| 138 | 127 | #define EXTCON_PROP_USB_SS		2 | 
|---|
| 139 |  | -#define EXTCON_PROP_USB_TYPEC_MED_HIGH_CURRENT	3 | 
|---|
| 140 | 128 |  | 
|---|
| 141 | 129 | #define EXTCON_PROP_USB_MIN		0 | 
|---|
| 142 |  | -#define EXTCON_PROP_USB_MAX		3 | 
|---|
|  | 130 | +#define EXTCON_PROP_USB_MAX		2 | 
|---|
| 143 | 131 | #define EXTCON_PROP_USB_CNT	(EXTCON_PROP_USB_MAX - EXTCON_PROP_USB_MIN + 1) | 
|---|
| 144 | 132 |  | 
|---|
| 145 | 133 | /* Properties of EXTCON_TYPE_CHG. */ | 
|---|
| .. | .. | 
|---|
| 185 | 173 | * Following APIs get the connected state of each external connector. | 
|---|
| 186 | 174 | * The 'id' argument indicates the defined external connector. | 
|---|
| 187 | 175 | */ | 
|---|
| 188 |  | -extern int extcon_get_state(struct extcon_dev *edev, unsigned int id); | 
|---|
|  | 176 | +int extcon_get_state(struct extcon_dev *edev, unsigned int id); | 
|---|
| 189 | 177 |  | 
|---|
| 190 | 178 | /* | 
|---|
| 191 | 179 | * Following APIs get the property of each external connector. | 
|---|
| .. | .. | 
|---|
| 196 | 184 | * for each external connector. They are used to get the capability of the | 
|---|
| 197 | 185 | * property of each external connector based on the id and property. | 
|---|
| 198 | 186 | */ | 
|---|
| 199 |  | -extern int extcon_get_property(struct extcon_dev *edev, unsigned int id, | 
|---|
|  | 187 | +int extcon_get_property(struct extcon_dev *edev, unsigned int id, | 
|---|
| 200 | 188 | unsigned int prop, | 
|---|
| 201 | 189 | union extcon_property_value *prop_val); | 
|---|
| 202 |  | -extern int extcon_get_property_capability(struct extcon_dev *edev, | 
|---|
|  | 190 | +int extcon_get_property_capability(struct extcon_dev *edev, | 
|---|
| 203 | 191 | unsigned int id, unsigned int prop); | 
|---|
| 204 | 192 |  | 
|---|
| 205 | 193 | /* | 
|---|
| .. | .. | 
|---|
| 211 | 199 | * extcon_register_notifier_all(*edev, *nb) : Register a notifier block | 
|---|
| 212 | 200 | *			for all supported external connectors of the extcon. | 
|---|
| 213 | 201 | */ | 
|---|
| 214 |  | -extern int extcon_register_notifier(struct extcon_dev *edev, unsigned int id, | 
|---|
|  | 202 | +int extcon_register_notifier(struct extcon_dev *edev, unsigned int id, | 
|---|
| 215 | 203 | struct notifier_block *nb); | 
|---|
| 216 |  | -extern int extcon_unregister_notifier(struct extcon_dev *edev, unsigned int id, | 
|---|
|  | 204 | +int extcon_unregister_notifier(struct extcon_dev *edev, unsigned int id, | 
|---|
| 217 | 205 | struct notifier_block *nb); | 
|---|
| 218 |  | -extern int extcon_register_blocking_notifier(struct extcon_dev *edev, | 
|---|
| 219 |  | -		unsigned int id, struct notifier_block *nb); | 
|---|
| 220 |  | -extern int extcon_unregister_blocking_notifier(struct extcon_dev *edev, | 
|---|
| 221 |  | -		unsigned int id, struct notifier_block *nb); | 
|---|
| 222 |  | -extern int devm_extcon_register_notifier(struct device *dev, | 
|---|
|  | 206 | +int devm_extcon_register_notifier(struct device *dev, | 
|---|
| 223 | 207 | struct extcon_dev *edev, unsigned int id, | 
|---|
| 224 | 208 | struct notifier_block *nb); | 
|---|
| 225 |  | -extern void devm_extcon_unregister_notifier(struct device *dev, | 
|---|
|  | 209 | +void devm_extcon_unregister_notifier(struct device *dev, | 
|---|
| 226 | 210 | struct extcon_dev *edev, unsigned int id, | 
|---|
| 227 | 211 | struct notifier_block *nb); | 
|---|
| 228 | 212 |  | 
|---|
| 229 |  | -extern int extcon_register_notifier_all(struct extcon_dev *edev, | 
|---|
|  | 213 | +int extcon_register_notifier_all(struct extcon_dev *edev, | 
|---|
| 230 | 214 | struct notifier_block *nb); | 
|---|
| 231 |  | -extern int extcon_unregister_notifier_all(struct extcon_dev *edev, | 
|---|
|  | 215 | +int extcon_unregister_notifier_all(struct extcon_dev *edev, | 
|---|
| 232 | 216 | struct notifier_block *nb); | 
|---|
| 233 |  | -extern int devm_extcon_register_notifier_all(struct device *dev, | 
|---|
|  | 217 | +int devm_extcon_register_notifier_all(struct device *dev, | 
|---|
| 234 | 218 | struct extcon_dev *edev, | 
|---|
| 235 | 219 | struct notifier_block *nb); | 
|---|
| 236 |  | -extern void devm_extcon_unregister_notifier_all(struct device *dev, | 
|---|
|  | 220 | +void devm_extcon_unregister_notifier_all(struct device *dev, | 
|---|
| 237 | 221 | struct extcon_dev *edev, | 
|---|
| 238 | 222 | struct notifier_block *nb); | 
|---|
| 239 | 223 |  | 
|---|
| 240 | 224 | /* | 
|---|
| 241 | 225 | * Following APIs get the extcon_dev from devicetree or by through extcon name. | 
|---|
| 242 | 226 | */ | 
|---|
| 243 |  | -extern struct extcon_dev *extcon_get_extcon_dev(const char *extcon_name); | 
|---|
| 244 |  | -extern struct extcon_dev *extcon_find_edev_by_node(struct device_node *node); | 
|---|
| 245 |  | -extern struct extcon_dev *extcon_get_edev_by_phandle(struct device *dev, | 
|---|
|  | 227 | +struct extcon_dev *extcon_get_extcon_dev(const char *extcon_name); | 
|---|
|  | 228 | +struct extcon_dev *extcon_find_edev_by_node(struct device_node *node); | 
|---|
|  | 229 | +struct extcon_dev *extcon_get_edev_by_phandle(struct device *dev, | 
|---|
| 246 | 230 | int index); | 
|---|
| 247 | 231 |  | 
|---|
| 248 | 232 | /* Following API get the name of extcon device. */ | 
|---|
| 249 |  | -extern const char *extcon_get_edev_name(struct extcon_dev *edev); | 
|---|
|  | 233 | +const char *extcon_get_edev_name(struct extcon_dev *edev); | 
|---|
| 250 | 234 |  | 
|---|
| 251 |  | -extern int extcon_blocking_sync(struct extcon_dev *edev, unsigned int id, | 
|---|
| 252 |  | -							bool val); | 
|---|
| 253 | 235 | #else /* CONFIG_EXTCON */ | 
|---|
| 254 | 236 | static inline int extcon_get_state(struct extcon_dev *edev, unsigned int id) | 
|---|
| 255 | 237 | { | 
|---|
| .. | .. | 
|---|
| 277 | 259 |  | 
|---|
| 278 | 260 | static inline int extcon_unregister_notifier(struct extcon_dev *edev, | 
|---|
| 279 | 261 | unsigned int id, struct notifier_block *nb) | 
|---|
| 280 |  | -{ | 
|---|
| 281 |  | -	return 0; | 
|---|
| 282 |  | -} | 
|---|
| 283 |  | - | 
|---|
| 284 |  | -static inline int extcon_register_blocking_notifier(struct extcon_dev *edev, | 
|---|
| 285 |  | -					unsigned int id, | 
|---|
| 286 |  | -					struct notifier_block *nb) | 
|---|
| 287 |  | -{ | 
|---|
| 288 |  | -	return 0; | 
|---|
| 289 |  | -} | 
|---|
| 290 |  | - | 
|---|
| 291 |  | -static inline int extcon_unregister_blocking_notifier(struct extcon_dev *edev, | 
|---|
| 292 |  | -					unsigned int id, | 
|---|
| 293 |  | -					struct notifier_block *nb) | 
|---|
| 294 | 262 | { | 
|---|
| 295 | 263 | return 0; | 
|---|
| 296 | 264 | } | 
|---|
| .. | .. | 
|---|
| 334 | 302 | return ERR_PTR(-ENODEV); | 
|---|
| 335 | 303 | } | 
|---|
| 336 | 304 |  | 
|---|
| 337 |  | -static inline const char *extcon_get_edev_name(struct extcon_dev *edev) | 
|---|
| 338 |  | -{ | 
|---|
| 339 |  | -  return NULL; | 
|---|
| 340 |  | -} | 
|---|
| 341 |  | - | 
|---|
| 342 | 305 | static inline struct extcon_dev *extcon_find_edev_by_node(struct device_node *node) | 
|---|
| 343 | 306 | { | 
|---|
| 344 | 307 | return ERR_PTR(-ENODEV); | 
|---|
| .. | .. | 
|---|
| 349 | 312 | { | 
|---|
| 350 | 313 | return ERR_PTR(-ENODEV); | 
|---|
| 351 | 314 | } | 
|---|
|  | 315 | + | 
|---|
|  | 316 | +static inline const char *extcon_get_edev_name(struct extcon_dev *edev) | 
|---|
|  | 317 | +{ | 
|---|
|  | 318 | +	return NULL; | 
|---|
|  | 319 | +} | 
|---|
| 352 | 320 | #endif /* CONFIG_EXTCON */ | 
|---|
| 353 | 321 |  | 
|---|
| 354 | 322 | /* | 
|---|