linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/3] extcon: Add missing function defintion and update extcon driver
       [not found] <CGME20210215094951epcas1p1f9ab27ece5ee0deaf64ac1f593bdc976@epcas1p1.samsung.com>
@ 2021-02-15 10:06 ` Chanwoo Choi
       [not found]   ` <CGME20210215094951epcas1p1dd89e994519ae901dcbc743d0a9ae669@epcas1p1.samsung.com>
                     ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Chanwoo Choi @ 2021-02-15 10:06 UTC (permalink / raw)
  To: gregkh; +Cc: cw00.choi, chanwoo, myungjoo.ham, linux-kernel

Instead of pull request for extcon next of v5.12, send the patches
because the pull request was too late for merging them.

Detailed description of this patchset as following:
- Add missing function definitions for extcon_register_notifier()
- Add charging interrupt handling such as CHGINS and CHGRM interrupt for extcon-max8997.c
- Detect OTG when USB_ID is connected to ground for extcon-sm5502.c

Reference of previous pull request,
[1] [GIT PULL ,v3] extcon next for v5.12
- https://lore.kernel.org/patchwork/patch/1380533/
[2] [GIT PULL v2] extcon next for v5.12
- https://lore.kernel.org/patchwork/patch/1379836/
[3] [GIT PULL] extcon next for v5.12
- https://lore.kernel.org/patchwork/patch/1378261/

Krzysztof Kozlowski (1):
  extcon: Add stubs for extcon_register_notifier_all() functions

Nikita Travkin (1):
  extcon: sm5502: Detect OTG when USB_ID is connected to ground

Timon Baetz (1):
  extcon: max8997: Add CHGINS and CHGRM interrupt handling

 drivers/extcon/extcon-max8997.c |  4 ++++
 drivers/extcon/extcon-sm5502.c  | 22 ++++++++++++++++++++--
 include/linux/extcon.h          | 23 +++++++++++++++++++++++
 3 files changed, 47 insertions(+), 2 deletions(-)

-- 
2.17.1


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 1/3] extcon: Add stubs for extcon_register_notifier_all() functions
       [not found]   ` <CGME20210215094951epcas1p1dd89e994519ae901dcbc743d0a9ae669@epcas1p1.samsung.com>
@ 2021-02-15 10:06     ` Chanwoo Choi
  0 siblings, 0 replies; 4+ messages in thread
From: Chanwoo Choi @ 2021-02-15 10:06 UTC (permalink / raw)
  To: gregkh
  Cc: cw00.choi, chanwoo, myungjoo.ham, linux-kernel, Krzysztof Kozlowski

From: Krzysztof Kozlowski <krzk@kernel.org>

Add stubs for extcon_register_notifier_all() function for !CONFIG_EXTCON
case.  This is useful for compile testing and for drivers which use
EXTCON but do not require it (therefore do not depend on CONFIG_EXTCON).

Fixes: 815429b39d94 ("extcon: Add new extcon_register_notifier_all() to monitor all external connectors")
Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
---
 include/linux/extcon.h | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)

diff --git a/include/linux/extcon.h b/include/linux/extcon.h
index fd183fb9c20f..0c19010da77f 100644
--- a/include/linux/extcon.h
+++ b/include/linux/extcon.h
@@ -271,6 +271,29 @@ static inline  void devm_extcon_unregister_notifier(struct device *dev,
 				struct extcon_dev *edev, unsigned int id,
 				struct notifier_block *nb) { }
 
+static inline int extcon_register_notifier_all(struct extcon_dev *edev,
+					       struct notifier_block *nb)
+{
+	return 0;
+}
+
+static inline int extcon_unregister_notifier_all(struct extcon_dev *edev,
+						 struct notifier_block *nb)
+{
+	return 0;
+}
+
+static inline int devm_extcon_register_notifier_all(struct device *dev,
+						    struct extcon_dev *edev,
+						    struct notifier_block *nb)
+{
+	return 0;
+}
+
+static inline void devm_extcon_unregister_notifier_all(struct device *dev,
+						       struct extcon_dev *edev,
+						       struct notifier_block *nb) { }
+
 static inline struct extcon_dev *extcon_get_extcon_dev(const char *extcon_name)
 {
 	return ERR_PTR(-ENODEV);
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 2/3] extcon: max8997: Add CHGINS and CHGRM interrupt handling
       [not found]   ` <CGME20210215094951epcas1p154078de1f5752fdcbb080056771c0c66@epcas1p1.samsung.com>
@ 2021-02-15 10:06     ` Chanwoo Choi
  0 siblings, 0 replies; 4+ messages in thread
From: Chanwoo Choi @ 2021-02-15 10:06 UTC (permalink / raw)
  To: gregkh; +Cc: cw00.choi, chanwoo, myungjoo.ham, linux-kernel, Timon Baetz

From: Timon Baetz <timon.baetz@protonmail.com>

This allows the MAX8997 charger to set the current limit depending on
the detected extcon charger type.

Signed-off-by: Timon Baetz <timon.baetz@protonmail.com>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
---
 drivers/extcon/extcon-max8997.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/extcon/extcon-max8997.c b/drivers/extcon/extcon-max8997.c
index 337b0eea4e62..e1408075ef7d 100644
--- a/drivers/extcon/extcon-max8997.c
+++ b/drivers/extcon/extcon-max8997.c
@@ -44,6 +44,8 @@ static struct max8997_muic_irq muic_irqs[] = {
 	{ MAX8997_MUICIRQ_ChgDetRun,	"muic-CHGDETRUN" },
 	{ MAX8997_MUICIRQ_ChgTyp,	"muic-CHGTYP" },
 	{ MAX8997_MUICIRQ_OVP,		"muic-OVP" },
+	{ MAX8997_PMICIRQ_CHGINS,	"pmic-CHGINS" },
+	{ MAX8997_PMICIRQ_CHGRM,	"pmic-CHGRM" },
 };
 
 /* Define supported cable type */
@@ -538,6 +540,8 @@ static void max8997_muic_irq_work(struct work_struct *work)
 	case MAX8997_MUICIRQ_DCDTmr:
 	case MAX8997_MUICIRQ_ChgDetRun:
 	case MAX8997_MUICIRQ_ChgTyp:
+	case MAX8997_PMICIRQ_CHGINS:
+	case MAX8997_PMICIRQ_CHGRM:
 		/* Handle charger cable */
 		ret = max8997_muic_chg_handler(info);
 		break;
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 3/3] extcon: sm5502: Detect OTG when USB_ID is connected to ground
       [not found]   ` <CGME20210215094951epcas1p3a7532c112193cbc9c2f3aa37a30ece33@epcas1p3.samsung.com>
@ 2021-02-15 10:06     ` Chanwoo Choi
  0 siblings, 0 replies; 4+ messages in thread
From: Chanwoo Choi @ 2021-02-15 10:06 UTC (permalink / raw)
  To: gregkh; +Cc: cw00.choi, chanwoo, myungjoo.ham, linux-kernel, Nikita Travkin

From: Nikita Travkin <nikitos.tr@gmail.com>

In it's curent state this driver ignores OTG adapters with ID pin
connected to ground. This commit adds a check to set extcon into
host mode when such OTG adapter is connected.

Signed-off-by: Nikita Travkin <nikitos.tr@gmail.com>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
---
 drivers/extcon/extcon-sm5502.c | 22 ++++++++++++++++++++--
 1 file changed, 20 insertions(+), 2 deletions(-)

diff --git a/drivers/extcon/extcon-sm5502.c b/drivers/extcon/extcon-sm5502.c
index 106d4da647bd..db41d1c58efd 100644
--- a/drivers/extcon/extcon-sm5502.c
+++ b/drivers/extcon/extcon-sm5502.c
@@ -144,6 +144,7 @@ enum sm5502_muic_acc_type {
 	SM5502_MUIC_ADC_AUDIO_TYPE1_FULL_REMOTE = 0x3e,	/* |      001|11110| */
 	SM5502_MUIC_ADC_AUDIO_TYPE1_SEND_END = 0x5e,	/* |      010|11110| */
 							/* |Dev Type1|--ADC| */
+	SM5502_MUIC_ADC_GROUND_USB_OTG = 0x80,		/* |      100|00000| */
 	SM5502_MUIC_ADC_OPEN_USB = 0x5f,		/* |      010|11111| */
 	SM5502_MUIC_ADC_OPEN_TA = 0xdf,			/* |      110|11111| */
 	SM5502_MUIC_ADC_OPEN_USB_OTG = 0xff,		/* |      111|11111| */
@@ -291,11 +292,27 @@ static unsigned int sm5502_muic_get_cable_type(struct sm5502_muic_info *info)
 	 * connected with to MUIC device.
 	 */
 	cable_type = adc & SM5502_REG_ADC_MASK;
-	if (cable_type == SM5502_MUIC_ADC_GROUND)
-		return SM5502_MUIC_ADC_GROUND;
 
 	switch (cable_type) {
 	case SM5502_MUIC_ADC_GROUND:
+		ret = regmap_read(info->regmap, SM5502_REG_DEV_TYPE1,
+				  &dev_type1);
+		if (ret) {
+			dev_err(info->dev, "failed to read DEV_TYPE1 reg\n");
+			return ret;
+		}
+
+		switch (dev_type1) {
+		case SM5502_REG_DEV_TYPE1_USB_OTG_MASK:
+			cable_type = SM5502_MUIC_ADC_GROUND_USB_OTG;
+			break;
+		default:
+			dev_dbg(info->dev,
+				"cannot identify the cable type: adc(0x%x), dev_type1(0x%x)\n",
+				adc, dev_type1);
+			return -EINVAL;
+		}
+		break;
 	case SM5502_MUIC_ADC_SEND_END_BUTTON:
 	case SM5502_MUIC_ADC_REMOTE_S1_BUTTON:
 	case SM5502_MUIC_ADC_REMOTE_S2_BUTTON:
@@ -396,6 +413,7 @@ static int sm5502_muic_cable_handler(struct sm5502_muic_info *info,
 		con_sw	= DM_DP_SWITCH_OPEN;
 		vbus_sw	= VBUSIN_SWITCH_VBUSOUT;
 		break;
+	case SM5502_MUIC_ADC_GROUND_USB_OTG:
 	case SM5502_MUIC_ADC_OPEN_USB_OTG:
 		id	= EXTCON_USB_HOST;
 		con_sw	= DM_DP_SWITCH_USB;
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-02-15  9:51 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <CGME20210215094951epcas1p1f9ab27ece5ee0deaf64ac1f593bdc976@epcas1p1.samsung.com>
2021-02-15 10:06 ` [PATCH 0/3] extcon: Add missing function defintion and update extcon driver Chanwoo Choi
     [not found]   ` <CGME20210215094951epcas1p1dd89e994519ae901dcbc743d0a9ae669@epcas1p1.samsung.com>
2021-02-15 10:06     ` [PATCH 1/3] extcon: Add stubs for extcon_register_notifier_all() functions Chanwoo Choi
     [not found]   ` <CGME20210215094951epcas1p154078de1f5752fdcbb080056771c0c66@epcas1p1.samsung.com>
2021-02-15 10:06     ` [PATCH 2/3] extcon: max8997: Add CHGINS and CHGRM interrupt handling Chanwoo Choi
     [not found]   ` <CGME20210215094951epcas1p3a7532c112193cbc9c2f3aa37a30ece33@epcas1p3.samsung.com>
2021-02-15 10:06     ` [PATCH 3/3] extcon: sm5502: Detect OTG when USB_ID is connected to ground Chanwoo Choi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).