summaryrefslogtreecommitdiffstats
path: root/include/linux/extcon.h
diff options
context:
space:
mode:
authorChanwoo Choi <cw00.choi@samsung.com>2016-07-11 06:30:43 -0400
committerKishon Vijay Abraham I <kishon@ti.com>2016-09-10 07:18:51 -0400
commit067c1652e7a7d50d951eee1d34a414ea931cee6c (patch)
treeb1b87736cf50c5c13962170718dea64a97b3ab0a /include/linux/extcon.h
parent505cf01f984bdcf088c9ec1e96f987f1ff47dc21 (diff)
extcon: Add the support for extcon property according to extcon type
This patch support the extcon property for the external connector because each external connector might have the property according to the H/W design and the specific characteristics. - EXTCON_PROP_USB_[property name] - EXTCON_PROP_CHG_[property name] - EXTCON_PROP_JACK_[property name] - EXTCON_PROP_DISP_[property name] Add the new extcon APIs to get/set the property value as following: - int extcon_get_property(struct extcon_dev *edev, unsigned int id, unsigned int prop, union extcon_property_value *prop_val) - int extcon_set_property(struct extcon_dev *edev, unsigned int id, unsigned int prop, union extcon_property_value prop_val) Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com> Tested-by: Chris Zhong <zyw@rock-chips.com> Tested-by: Guenter Roeck <groeck@chromium.org> Reviewed-by: Guenter Roeck <groeck@chromium.org>
Diffstat (limited to 'include/linux/extcon.h')
-rw-r--r--include/linux/extcon.h81
1 files changed, 81 insertions, 0 deletions
diff --git a/include/linux/extcon.h b/include/linux/extcon.h
index 46d802892c82..f9d4a44e86d3 100644
--- a/include/linux/extcon.h
+++ b/include/linux/extcon.h
@@ -77,6 +77,63 @@
77 77
78#define EXTCON_NUM 63 78#define EXTCON_NUM 63
79 79
80/*
81 * Define the property of supported external connectors.
82 *
83 * When adding the new extcon property, they *must* have
84 * the type/value/default information. Also, you *have to*
85 * modify the EXTCON_PROP_[type]_START/END definitions
86 * which mean the range of the supported properties
87 * for each extcon type.
88 *
89 * The naming style of property
90 * : EXTCON_PROP_[type]_[property name]
91 *
92 * EXTCON_PROP_USB_[property name] : USB property
93 * EXTCON_PROP_CHG_[property name] : Charger property
94 * EXTCON_PROP_JACK_[property name] : Jack property
95 * EXTCON_PROP_DISP_[property name] : Display property
96 */
97
98/*
99 * Properties of EXTCON_TYPE_USB.
100 *
101 * - EXTCON_PROP_USB_VBUS
102 * @type: integer (intval)
103 * @value: 0 (low) or 1 (high)
104 * @default: 0 (low)
105 */
106#define EXTCON_PROP_USB_VBUS 0
107
108#define EXTCON_PROP_USB_MIN 0
109#define EXTCON_PROP_USB_MAX 0
110#define EXTCON_PROP_USB_CNT (EXTCON_PROP_USB_MAX - EXTCON_PROP_USB_MIN + 1)
111
112/* Properties of EXTCON_TYPE_CHG. */
113#define EXTCON_PROP_CHG_MIN 50
114#define EXTCON_PROP_CHG_MAX 50
115#define EXTCON_PROP_CHG_CNT (EXTCON_PROP_CHG_MAX - EXTCON_PROP_CHG_MIN + 1)
116
117/* Properties of EXTCON_TYPE_JACK. */
118#define EXTCON_PROP_JACK_MIN 100
119#define EXTCON_PROP_JACK_MAX 100
120#define EXTCON_PROP_JACK_CNT (EXTCON_PROP_JACK_MAX - EXTCON_PROP_JACK_MIN + 1)
121
122/* Properties of EXTCON_TYPE_DISP. */
123#define EXTCON_PROP_DISP_MIN 150
124#define EXTCON_PROP_DISP_MAX 150
125#define EXTCON_PROP_DISP_CNT (EXTCON_PROP_DISP_MAX - EXTCON_PROP_DISP_MIN + 1)
126
127/*
128 * Define the type of property's value.
129 *
130 * Define the property's value as union type. Because each property
131 * would need the different data type to store it.
132 */
133union extcon_property_value {
134 int intval; /* type : integer (intval) */
135};
136
80struct extcon_cable; 137struct extcon_cable;
81 138
82/** 139/**
@@ -167,6 +224,17 @@ extern int extcon_set_cable_state_(struct extcon_dev *edev, unsigned int id,
167 bool cable_state); 224 bool cable_state);
168 225
169/* 226/*
227 * get/set_property access the property value of each external connector.
228 * They are used to access the property of each cable based on the property id.
229 */
230extern int extcon_get_property(struct extcon_dev *edev, unsigned int id,
231 unsigned int prop,
232 union extcon_property_value *prop_val);
233extern int extcon_set_property(struct extcon_dev *edev, unsigned int id,
234 unsigned int prop,
235 union extcon_property_value prop_val);
236
237/*
170 * Following APIs are to monitor every action of a notifier. 238 * Following APIs are to monitor every action of a notifier.
171 * Registrar gets notified for every external port of a connection device. 239 * Registrar gets notified for every external port of a connection device.
172 * Probably this could be used to debug an action of notifier; however, 240 * Probably this could be used to debug an action of notifier; however,
@@ -239,6 +307,19 @@ static inline int extcon_set_cable_state_(struct extcon_dev *edev,
239 return 0; 307 return 0;
240} 308}
241 309
310static inline int extcon_get_property(struct extcon_dev *edev, unsigned int id,
311 unsigned int prop,
312 union extcon_property_value *prop_val)
313{
314 return 0;
315}
316static inline int extcon_set_property(struct extcon_dev *edev, unsigned int id,
317 unsigned int prop,
318 union extcon_property_value prop_val)
319{
320 return 0;
321}
322
242static inline struct extcon_dev *extcon_get_extcon_dev(const char *extcon_name) 323static inline struct extcon_dev *extcon_get_extcon_dev(const char *extcon_name)
243{ 324{
244 return NULL; 325 return NULL;