summaryrefslogtreecommitdiffstats
path: root/drivers/extcon
diff options
context:
space:
mode:
authorAndy Shevchenko <andriy.shevchenko@linux.intel.com>2019-03-19 10:30:41 -0400
committerChanwoo Choi <cw00.choi@samsung.com>2019-04-04 21:21:41 -0400
commit098b7ae8ec431465b319e2157f848df50dc6b7e0 (patch)
tree386debbb38ab1484e6781d4695575ffdfc799102 /drivers/extcon
parentdb8b4aefd17b1ccf108d81a4fbb181c8e50abf0e (diff)
extcon: intel: Split out some definitions to a common header
We are going to use some definitions in the other Intel extcon drivers, thus, split out them to a common header file. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Diffstat (limited to 'drivers/extcon')
-rw-r--r--drivers/extcon/extcon-intel-cht-wc.c21
-rw-r--r--drivers/extcon/extcon-intel.h20
2 files changed, 27 insertions, 14 deletions
diff --git a/drivers/extcon/extcon-intel-cht-wc.c b/drivers/extcon/extcon-intel-cht-wc.c
index 53b28ecc4ad1..9d32150e68db 100644
--- a/drivers/extcon/extcon-intel-cht-wc.c
+++ b/drivers/extcon/extcon-intel-cht-wc.c
@@ -17,6 +17,8 @@
17#include <linux/regmap.h> 17#include <linux/regmap.h>
18#include <linux/slab.h> 18#include <linux/slab.h>
19 19
20#include "extcon-intel.h"
21
20#define CHT_WC_PHYCTRL 0x5e07 22#define CHT_WC_PHYCTRL 0x5e07
21 23
22#define CHT_WC_CHGRCTRL0 0x5e16 24#define CHT_WC_CHGRCTRL0 0x5e16
@@ -80,15 +82,6 @@
80#define CHT_WC_VBUS_GPIO_CTLO_DRV_OD BIT(4) 82#define CHT_WC_VBUS_GPIO_CTLO_DRV_OD BIT(4)
81#define CHT_WC_VBUS_GPIO_CTLO_DIR_OUT BIT(5) 83#define CHT_WC_VBUS_GPIO_CTLO_DIR_OUT BIT(5)
82 84
83enum cht_wc_usb_id {
84 USB_ID_OTG,
85 USB_ID_GND,
86 USB_ID_FLOAT,
87 USB_RID_A,
88 USB_RID_B,
89 USB_RID_C,
90};
91
92enum cht_wc_mux_select { 85enum cht_wc_mux_select {
93 MUX_SEL_PMIC = 0, 86 MUX_SEL_PMIC = 0,
94 MUX_SEL_SOC, 87 MUX_SEL_SOC,
@@ -116,9 +109,9 @@ static int cht_wc_extcon_get_id(struct cht_wc_extcon_data *ext, int pwrsrc_sts)
116{ 109{
117 switch ((pwrsrc_sts & CHT_WC_PWRSRC_USBID_MASK) >> CHT_WC_PWRSRC_USBID_SHIFT) { 110 switch ((pwrsrc_sts & CHT_WC_PWRSRC_USBID_MASK) >> CHT_WC_PWRSRC_USBID_SHIFT) {
118 case CHT_WC_PWRSRC_RID_GND: 111 case CHT_WC_PWRSRC_RID_GND:
119 return USB_ID_GND; 112 return INTEL_USB_ID_GND;
120 case CHT_WC_PWRSRC_RID_FLOAT: 113 case CHT_WC_PWRSRC_RID_FLOAT:
121 return USB_ID_FLOAT; 114 return INTEL_USB_ID_FLOAT;
122 case CHT_WC_PWRSRC_RID_ACA: 115 case CHT_WC_PWRSRC_RID_ACA:
123 default: 116 default:
124 /* 117 /*
@@ -126,7 +119,7 @@ static int cht_wc_extcon_get_id(struct cht_wc_extcon_data *ext, int pwrsrc_sts)
126 * the USBID GPADC channel here and determine ACA role 119 * the USBID GPADC channel here and determine ACA role
127 * based on that. 120 * based on that.
128 */ 121 */
129 return USB_ID_FLOAT; 122 return INTEL_USB_ID_FLOAT;
130 } 123 }
131} 124}
132 125
@@ -260,7 +253,7 @@ static void cht_wc_extcon_pwrsrc_event(struct cht_wc_extcon_data *ext)
260 } 253 }
261 254
262 id = cht_wc_extcon_get_id(ext, pwrsrc_sts); 255 id = cht_wc_extcon_get_id(ext, pwrsrc_sts);
263 if (id == USB_ID_GND) { 256 if (id == INTEL_USB_ID_GND) {
264 cht_wc_extcon_enable_charging(ext, false); 257 cht_wc_extcon_enable_charging(ext, false);
265 cht_wc_extcon_set_otgmode(ext, true); 258 cht_wc_extcon_set_otgmode(ext, true);
266 259
@@ -293,7 +286,7 @@ set_state:
293 ext->previous_cable = cable; 286 ext->previous_cable = cable;
294 } 287 }
295 288
296 ext->usb_host = ((id == USB_ID_GND) || (id == USB_RID_A)); 289 ext->usb_host = ((id == INTEL_USB_ID_GND) || (id == INTEL_USB_RID_A));
297 extcon_set_state_sync(ext->edev, EXTCON_USB_HOST, ext->usb_host); 290 extcon_set_state_sync(ext->edev, EXTCON_USB_HOST, ext->usb_host);
298} 291}
299 292
diff --git a/drivers/extcon/extcon-intel.h b/drivers/extcon/extcon-intel.h
new file mode 100644
index 000000000000..0ad645ec7b33
--- /dev/null
+++ b/drivers/extcon/extcon-intel.h
@@ -0,0 +1,20 @@
1/* SPDX-License-Identifier: GPL-2.0 */
2/*
3 * Header file for Intel extcon hardware
4 *
5 * Copyright (C) 2019 Intel Corporation. All rights reserved.
6 */
7
8#ifndef __EXTCON_INTEL_H__
9#define __EXTCON_INTEL_H__
10
11enum extcon_intel_usb_id {
12 INTEL_USB_ID_OTG,
13 INTEL_USB_ID_GND,
14 INTEL_USB_ID_FLOAT,
15 INTEL_USB_RID_A,
16 INTEL_USB_RID_B,
17 INTEL_USB_RID_C,
18};
19
20#endif /* __EXTCON_INTEL_H__ */