summaryrefslogtreecommitdiff
path: root/patches.tizen/1298-extcon-max77693-Fix-inaccurate-extcon-event-for-JIG-.patch
blob: 4cd2d80c6c75082cb805ac98dfd0854e37c81be4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
From 36bdb901c8c61448d9e1320641c3debebde03321 Mon Sep 17 00:00:00 2001
From: Jonghwa Lee <jonghwa3.lee@samsung.com>
Date: Mon, 17 Mar 2014 17:44:06 +0900
Subject: [PATCH 1298/1302] extcon: max77693: Fix inaccurate extcon event for
 JIG with USB cable

Dmitry's patch 'extcon: max77693: Force using UART~' fixes problem when
device is connected JIG with USB cable. However, with the patch, driver
sends inaccurate event "USB" even muic keeps path to UART not USB. This
would make users confused.

This patch keeps Dmitry's modification working and also bypasses signaling
event "USB" when device is connected to JIG with USB cable.

Change-Id: Ia5f3328e5b0827378178502c70cb90da48e9e3f7
Signed-off-by: Jonghwa Lee <jonghwa3.lee@samsung.com>
Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
---
 drivers/extcon/extcon-max77693.c | 23 ++++++++++++-----------
 1 file changed, 12 insertions(+), 11 deletions(-)

diff --git a/drivers/extcon/extcon-max77693.c b/drivers/extcon/extcon-max77693.c
index 903c507..b08a1e8 100644
--- a/drivers/extcon/extcon-max77693.c
+++ b/drivers/extcon/extcon-max77693.c
@@ -293,18 +293,10 @@ static int max77693_muic_set_path(struct max77693_muic_info *info,
 		return ret;
 	}
 
-	if (attached) {
-		if (info->prev_cable_type ==
-		    MAX77693_MUIC_ADC_FACTORY_MODE_UART_OFF) {
-			/* if cable_type is jig, then force UART */
-			dev_info(info->dev, "For jig force using UART path\n");
-			ctrl1 = CONTROL1_SW_UART;
-		} else {
-			ctrl1 = val;
-		}
-	} else {
+	if (attached)
+		ctrl1 = val;
+	else
 		ctrl1 = CONTROL1_SW_OPEN;
-	}
 
 	ret = max77693_update_reg(info->max77693->regmap_muic,
 			MAX77693_MUIC_REG_CTRL1, ctrl1, COMP_SW_MASK);
@@ -922,6 +914,15 @@ static int max77693_muic_chg_handler(struct max77693_muic_info *info)
 			 */
 			break;
 		case MAX77693_CHARGER_TYPE_USB:
+			/* If UART is still connected, do not set path to USB */
+			if (cable_type == MAX77693_MUIC_ADC_FACTORY_MODE_UART_OFF) {
+				ret = max77693_muic_set_path(info, info->path_uart,
+						    attached);
+				if (ret < 0)
+					return ret;
+				break;
+			}
+
 			/* Only USB cable, PATH:AP_USB */
 			ret = max77693_muic_set_path(info, info->path_usb, attached);
 			if (ret < 0)
-- 
1.8.3.2