aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarek Szyprowski <m.szyprowski@samsung.com>2018-11-08 08:45:48 -0500
committerChanwoo Choi <cw00.choi@samsung.com>2018-11-11 19:17:13 -0500
commit3e34c819896091d0f1bbf6ece8a620552f8dc04e (patch)
tree6c9dec0d742c67e4cbe25a10a94d8ca832c2219b
parent5a196c29bb27d606c4bd82f6893462a39766ff7a (diff)
extcon: max8997: 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>
-rw-r--r--drivers/extcon/extcon-max8997.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/drivers/extcon/extcon-max8997.c b/drivers/extcon/extcon-max8997.c
index bdabb2479e0d..632192d027bf 100644
--- a/drivers/extcon/extcon-max8997.c
+++ b/drivers/extcon/extcon-max8997.c
@@ -632,6 +632,8 @@ static int max8997_muic_probe(struct platform_device *pdev)
632 struct max8997_platform_data *pdata = dev_get_platdata(max8997->dev); 632 struct max8997_platform_data *pdata = dev_get_platdata(max8997->dev);
633 struct max8997_muic_info *info; 633 struct max8997_muic_info *info;
634 int delay_jiffies; 634 int delay_jiffies;
635 int cable_type;
636 bool attached;
635 int ret, i; 637 int ret, i;
636 638
637 info = devm_kzalloc(&pdev->dev, sizeof(struct max8997_muic_info), 639 info = devm_kzalloc(&pdev->dev, sizeof(struct max8997_muic_info),
@@ -724,8 +726,17 @@ static int max8997_muic_probe(struct platform_device *pdev)
724 delay_jiffies = msecs_to_jiffies(DELAY_MS_DEFAULT); 726 delay_jiffies = msecs_to_jiffies(DELAY_MS_DEFAULT);
725 } 727 }
726 728
727 /* Set initial path for UART */ 729 /* Set initial path for UART when JIG is connected to get serial logs */
728 max8997_muic_set_path(info, info->path_uart, true); 730 ret = max8997_bulk_read(info->muic, MAX8997_MUIC_REG_STATUS1,
731 2, info->status);
732 if (ret) {
733 dev_err(info->dev, "failed to read MUIC register\n");
734 return ret;
735 }
736 cable_type = max8997_muic_get_cable_type(info,
737 MAX8997_CABLE_GROUP_ADC, &attached);
738 if (attached && cable_type == MAX8997_MUIC_ADC_FACTORY_MODE_UART_OFF)
739 max8997_muic_set_path(info, info->path_uart, true);
729 740
730 /* Set ADC debounce time */ 741 /* Set ADC debounce time */
731 max8997_muic_set_debounce_time(info, ADC_DEBOUNCE_TIME_25MS); 742 max8997_muic_set_debounce_time(info, ADC_DEBOUNCE_TIME_25MS);