Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Marek Szyprowski and committed by
Chanwoo Choi
6865f2ef d9204acb

+14 -2
+14 -2
drivers/extcon/extcon-max77693.c
··· 1072 1072 struct max77693_reg_data *init_data; 1073 1073 int num_init_data; 1074 1074 int delay_jiffies; 1075 + int cable_type; 1076 + bool attached; 1075 1077 int ret; 1076 1078 int i; 1077 1079 unsigned int id; ··· 1214 1212 delay_jiffies = msecs_to_jiffies(DELAY_MS_DEFAULT); 1215 1213 } 1216 1214 1217 - /* Set initial path for UART */ 1218 - max77693_muic_set_path(info, info->path_uart, true); 1215 + /* Set initial path for UART when JIG is connected to get serial logs */ 1216 + ret = regmap_bulk_read(info->max77693->regmap_muic, 1217 + MAX77693_MUIC_REG_STATUS1, info->status, 2); 1218 + if (ret) { 1219 + dev_err(info->dev, "failed to read MUIC register\n"); 1220 + return ret; 1221 + } 1222 + cable_type = max77693_muic_get_cable_type(info, 1223 + MAX77693_CABLE_GROUP_ADC, &attached); 1224 + if (attached && (cable_type == MAX77693_MUIC_ADC_FACTORY_MODE_UART_ON || 1225 + cable_type == MAX77693_MUIC_ADC_FACTORY_MODE_UART_OFF)) 1226 + max77693_muic_set_path(info, info->path_uart, true); 1219 1227 1220 1228 /* Check revision number of MUIC device*/ 1221 1229 ret = regmap_read(info->max77693->regmap_muic,