Skip to content

Commit

Permalink
extcon: max8997: Avoid forcing UART path on drive probe
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Marek Szyprowski authored and Chanwoo Choi committed Nov 12, 2018
1 parent 5a196c2 commit 3e34c81
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions drivers/extcon/extcon-max8997.c
Original file line number Diff line number Diff line change
Expand Up @@ -632,6 +632,8 @@ static int max8997_muic_probe(struct platform_device *pdev)
struct max8997_platform_data *pdata = dev_get_platdata(max8997->dev);
struct max8997_muic_info *info;
int delay_jiffies;
int cable_type;
bool attached;
int ret, i;

info = devm_kzalloc(&pdev->dev, sizeof(struct max8997_muic_info),
Expand Down Expand Up @@ -724,8 +726,17 @@ static int max8997_muic_probe(struct platform_device *pdev)
delay_jiffies = msecs_to_jiffies(DELAY_MS_DEFAULT);
}

/* Set initial path for UART */
max8997_muic_set_path(info, info->path_uart, true);
/* Set initial path for UART when JIG is connected to get serial logs */
ret = max8997_bulk_read(info->muic, MAX8997_MUIC_REG_STATUS1,
2, info->status);
if (ret) {
dev_err(info->dev, "failed to read MUIC register\n");
return ret;
}
cable_type = max8997_muic_get_cable_type(info,
MAX8997_CABLE_GROUP_ADC, &attached);
if (attached && cable_type == MAX8997_MUIC_ADC_FACTORY_MODE_UART_OFF)
max8997_muic_set_path(info, info->path_uart, true);

/* Set ADC debounce time */
max8997_muic_set_debounce_time(info, ADC_DEBOUNCE_TIME_25MS);
Expand Down

0 comments on commit 3e34c81

Please sign in to comment.