0001
0002
0003
0004
0005
0006
0007
0008
0009
0010 #ifndef __LINUX_EXTCON_PROVIDER_H__
0011 #define __LINUX_EXTCON_PROVIDER_H__
0012
0013 #include <linux/extcon.h>
0014
0015 struct extcon_dev;
0016
0017 #if IS_ENABLED(CONFIG_EXTCON)
0018
0019
0020 int extcon_dev_register(struct extcon_dev *edev);
0021 void extcon_dev_unregister(struct extcon_dev *edev);
0022 int devm_extcon_dev_register(struct device *dev,
0023 struct extcon_dev *edev);
0024 void devm_extcon_dev_unregister(struct device *dev,
0025 struct extcon_dev *edev);
0026
0027
0028 struct extcon_dev *extcon_dev_allocate(const unsigned int *cable);
0029 void extcon_dev_free(struct extcon_dev *edev);
0030 struct extcon_dev *devm_extcon_dev_allocate(struct device *dev,
0031 const unsigned int *cable);
0032 void devm_extcon_dev_free(struct device *dev, struct extcon_dev *edev);
0033
0034
0035 int extcon_sync(struct extcon_dev *edev, unsigned int id);
0036
0037
0038
0039
0040
0041 int extcon_set_state(struct extcon_dev *edev, unsigned int id,
0042 bool state);
0043 int extcon_set_state_sync(struct extcon_dev *edev, unsigned int id,
0044 bool state);
0045
0046
0047
0048
0049
0050
0051
0052
0053
0054
0055 int extcon_set_property(struct extcon_dev *edev, unsigned int id,
0056 unsigned int prop,
0057 union extcon_property_value prop_val);
0058 int extcon_set_property_sync(struct extcon_dev *edev, unsigned int id,
0059 unsigned int prop,
0060 union extcon_property_value prop_val);
0061 int extcon_set_property_capability(struct extcon_dev *edev,
0062 unsigned int id, unsigned int prop);
0063
0064 #else
0065 static inline int extcon_dev_register(struct extcon_dev *edev)
0066 {
0067 return 0;
0068 }
0069
0070 static inline void extcon_dev_unregister(struct extcon_dev *edev) { }
0071
0072 static inline int devm_extcon_dev_register(struct device *dev,
0073 struct extcon_dev *edev)
0074 {
0075 return -EINVAL;
0076 }
0077
0078 static inline void devm_extcon_dev_unregister(struct device *dev,
0079 struct extcon_dev *edev) { }
0080
0081 static inline struct extcon_dev *extcon_dev_allocate(const unsigned int *cable)
0082 {
0083 return ERR_PTR(-ENOSYS);
0084 }
0085
0086 static inline void extcon_dev_free(struct extcon_dev *edev) { }
0087
0088 static inline struct extcon_dev *devm_extcon_dev_allocate(struct device *dev,
0089 const unsigned int *cable)
0090 {
0091 return ERR_PTR(-ENOSYS);
0092 }
0093
0094 static inline void devm_extcon_dev_free(struct extcon_dev *edev) { }
0095
0096
0097 static inline int extcon_set_state(struct extcon_dev *edev, unsigned int id,
0098 bool state)
0099 {
0100 return 0;
0101 }
0102
0103 static inline int extcon_set_state_sync(struct extcon_dev *edev, unsigned int id,
0104 bool state)
0105 {
0106 return 0;
0107 }
0108
0109 static inline int extcon_sync(struct extcon_dev *edev, unsigned int id)
0110 {
0111 return 0;
0112 }
0113
0114 static inline int extcon_set_property(struct extcon_dev *edev, unsigned int id,
0115 unsigned int prop,
0116 union extcon_property_value prop_val)
0117 {
0118 return 0;
0119 }
0120
0121 static inline int extcon_set_property_sync(struct extcon_dev *edev,
0122 unsigned int id, unsigned int prop,
0123 union extcon_property_value prop_val)
0124 {
0125 return 0;
0126 }
0127
0128 static inline int extcon_set_property_capability(struct extcon_dev *edev,
0129 unsigned int id, unsigned int prop)
0130 {
0131 return 0;
0132 }
0133 #endif
0134 #endif