aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/extcon
diff options
context:
space:
mode:
authorMarek Szyprowski <m.szyprowski@samsung.com>2018-11-08 08:45:46 -0500
committerChanwoo Choi <cw00.choi@samsung.com>2018-11-11 19:17:13 -0500
commit6865f2ef9d6576508498fe6127d252b22a70ab39 (patch)
tree4d23730e89bc3e83fab6c69712f99276efe12aaf /drivers/extcon
parentd9204acb37569579fc49af1689c0ae32bdd4710f (diff)
extcon: max77693: Avoid forcing UART path on drive probe
Driver unconditionally forces UART path during probe, probably to ensure that one can get kernel serial log as soon as possible. This approach causes some issues, especially when board is booted with non-UART cable connected to micro-USB port. For example, when USB cable is connected, UART TX/RX lines are unconditionally short-circuited to USB D+/D- lines. This is in turn recognized by a series of serial BREAK signals and some random characters when USB host tries to perform enumeration procedure. To solve the above issue and keep UART console operational as early as possible, set UART path only when USB ID reports UART capable cable. Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com> Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Diffstat (limited to 'drivers/extcon')
-rw-r--r--drivers/extcon/extcon-max77693.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/drivers/extcon/extcon-max77693.c b/drivers/extcon/extcon-max77693.c
index a79537ebb671..32fc5a66ffa9 100644
--- a/drivers/extcon/extcon-max77693.c
+++ b/drivers/extcon/extcon-max77693.c
@@ -1072,6 +1072,8 @@ static int max77693_muic_probe(struct platform_device *pdev)
1072 struct max77693_reg_data *init_data; 1072 struct max77693_reg_data *init_data;
1073 int num_init_data; 1073 int num_init_data;
1074 int delay_jiffies; 1074 int delay_jiffies;
1075 int cable_type;
1076 bool attached;
1075 int ret; 1077 int ret;
1076 int i; 1078 int i;
1077 unsigned int id; 1079 unsigned int id;
@@ -1212,8 +1214,18 @@ static int max77693_muic_probe(struct platform_device *pdev)
1212 delay_jiffies = msecs_to_jiffies(DELAY_MS_DEFAULT); 1214 delay_jiffies = msecs_to_jiffies(DELAY_MS_DEFAULT);
1213 } 1215 }
1214 1216
1215 /* Set initial path for UART */ 1217 /* Set initial path for UART when JIG is connected to get serial logs */
1216 max77693_muic_set_path(info, info->path_uart, true); 1218 ret = regmap_bulk_read(info->max77693->regmap_muic,
1219 MAX77693_MUIC_REG_STATUS1, info->status, 2);
1220 if (ret) {
1221 dev_err(info->dev, "failed to read MUIC register\n");
1222 return ret;
1223 }
1224 cable_type = max77693_muic_get_cable_type(info,
1225 MAX77693_CABLE_GROUP_ADC, &attached);
1226 if (attached && (cable_type == MAX77693_MUIC_ADC_FACTORY_MODE_UART_ON ||
1227 cable_type == MAX77693_MUIC_ADC_FACTORY_MODE_UART_OFF))
1228 max77693_muic_set_path(info, info->path_uart, true);
1217 1229
1218 /* Check revision number of MUIC device*/ 1230 /* Check revision number of MUIC device*/
1219 ret = regmap_read(info->max77693->regmap_muic, 1231 ret = regmap_read(info->max77693->regmap_muic,