Skip to contentSkip to conversation

trats: usb: Add usb_cable_connected() function

PATCH New Przemyslaw Marczak 2 participants 6 messages Nov 13, 2013 – Dec 3, 2013

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 trats: usb: Add usb_cable_connected() function

Changes:
- define function usb_cable_connected() in trats board file which returns 1 if cable is connected and 0 otherwise
- trats.h: add CONFIG_USB_CHECK_CABLE

---
 board/samsung/trats/trats.c |   10 ++++++++++
 include/configs/trats.h     |    1 +
 2 files changed, 11 insertions(+)
board/samsung/trats/trats.c +10 -0
index 7f61d17..9ed70d3 100644
@@ -500,6 +500,16 @@ void board_usb_init(void)
 	debug("USB_udc_probe\n");
 	s3c_udc_probe(&s5pc210_otg_data);
 }
+
+#ifdef CONFIG_USB_CABLE_CHECK
+int usb_cable_connected(void)
+{
+	struct pmic *muic = pmic_get("MAX8997_MUIC");
+	int cable_connected = muic->chrg->chrg_type(muic);
+
+	return !!cable_connected;
+}
+#endif
 #endif
 
 static void pmic_reset(void)
include/configs/trats.h +1 -0
index 24ea06b..7f8009e 100644
@@ -300,6 +300,7 @@
 #define CONFIG_USB_GADGET_S3C_UDC_OTG
 #define CONFIG_USB_GADGET_DUALSPEED
 #define CONFIG_USB_GADGET_VBUS_DRAW	2
+#define CONFIG_USB_CABLE_CHECK
 
 /* LCD */
 #define CONFIG_EXYNOS_FB
Signature · 1 line
1.7.9.5
#1 lore raw

PATCH 1/1 trats: usb: Add usb_cable_connected() function

Hello Minkyu,

Quoted 7 lines · Przemyslaw Marczak

Changes:
- define function usb_cable_connected() in trats board file which returns 1 if cable is connected and 0 otherwise
- trats.h: add CONFIG_USB_CHECK_CABLE

Could you review this patch, please?
Thanks

Signature · 4 lines
Przemyslaw Marczak
Samsung R&D Institute Poland
Samsung Electronics
p.marczak at samsung.com
#2 lore raw

PATCH 1/1 trats: usb: Add usb_cable_connected() function

In reply to Przemyslaw Marczak

Dear Przemyslaw Marczak,

Quoted 17 lines · Przemyslaw Marczak

Changes:
- define function usb_cable_connected() in trats board file which returns 1 if cable is connected and 0 otherwise
- trats.h: add CONFIG_USB_CHECK_CABLE

---
 board/samsung/trats/trats.c |   10 ++++++++++
 include/configs/trats.h     |    1 +
 2 files changed, 11 insertions(+)
board/samsung/trats/trats.c +0 -0
index 7f61d17..9ed70d3 100644

board/samsung/trats/trats.c void board_usb_init(void) · line 507

Quoted 8 lines
board/samsung/trats/trats.c +5 -0
@@ -500,6 +500,16 @@ void board_usb_init(void)
 	debug("USB_udc_probe\n");
 	s3c_udc_probe(&s5pc210_otg_data);
 }
+
+#ifdef CONFIG_USB_CABLE_CHECK
+int usb_cable_connected(void)
+{
+	struct pmic *muic = pmic_get("MAX8997_MUIC");

Please check that muic is available.

board/samsung/trats/trats.c void board_usb_init(void) · line 510

Quoted 3 lines
board/samsung/trats/trats.c +3 -0
+	int cable_connected = muic->chrg->chrg_type(muic);
+
+	return !!cable_connected;

I think, cable_connected is unnecessary.

return !!muic->chrg->chrg_type(muic);

Quoted 11 lines
board/samsung/trats/trats.c +2 -0
+}
+#endif
 #endif
 
 static void pmic_reset(void)
include/configs/trats.h +0 -0
index 24ea06b..7f8009e 100644

include/configs/trats.h line 306

Quoted 7 lines
include/configs/trats.h +1 -0
@@ -300,6 +300,7 @@
 #define CONFIG_USB_GADGET_S3C_UDC_OTG
 #define CONFIG_USB_GADGET_DUALSPEED
 #define CONFIG_USB_GADGET_VBUS_DRAW	2
+#define CONFIG_USB_CABLE_CHECK
 
 /* LCD */
 #define CONFIG_EXYNOS_FB

Thanks,
Minkyu Kang.

#3 lore raw

PATCH v2 1/1 trats: usb: Add usb_cable_connected() function

In reply to Przemyslaw Marczak

Changes:
- define function usb_cable_connected() in trats board file which returns 1 if cable is connected and 0 otherwise
- trats.h: add CONFIG_USB_CHECK_CABLE

Changes v2:
- add muic avaibility check

---
 board/samsung/trats/trats.c |   11 +++++++++++
 include/configs/trats.h     |    1 +
 2 files changed, 12 insertions(+)
board/samsung/trats/trats.c +11 -0
index 7012c13..6bd106e 100644
@@ -501,6 +501,17 @@ int board_usb_init(int index, enum usb_init_type init)
 	debug("USB_udc_probe\n");
 	return s3c_udc_probe(&s5pc210_otg_data);
 }
+
+#ifdef CONFIG_USB_CABLE_CHECK
+int usb_cable_connected(void)
+{
+	struct pmic *muic = pmic_get("MAX8997_MUIC");
+	if (!muic)
+		return 0;
+
+	return !!muic->chrg->chrg_type(muic);
+}
+#endif
 #endif
 
 static void pmic_reset(void)
include/configs/trats.h +1 -0
index 3d080c4..8ff9800 100644
@@ -308,6 +308,7 @@
 #define CONFIG_USB_GADGET_S3C_UDC_OTG
 #define CONFIG_USB_GADGET_DUALSPEED
 #define CONFIG_USB_GADGET_VBUS_DRAW	2
+#define CONFIG_USB_CABLE_CHECK
 
 /* LCD */
 #define CONFIG_EXYNOS_FB
Signature · 1 line
1.7.9.5
#4 lore raw

PATCH v2 1/1 trats: usb: Add usb_cable_connected() function

Quoted 7 lines · Przemyslaw Marczak

Changes:
- define function usb_cable_connected() in trats board file which returns 1 if cable is connected and 0 otherwise
- trats.h: add CONFIG_USB_CHECK_CABLE

Changes v2:
- add muic avaibility check

Change log should be under --- line.
This is not a commit message.

Quoted 8 lines
---
 board/samsung/trats/trats.c |   11 +++++++++++
 include/configs/trats.h     |    1 +
 2 files changed, 12 insertions(+)

Anyway...
applied to u-boot-samsung.

Thanks,
Minkyu Kang.

#5 lore raw

PATCH v2 1/1 trats: usb: Add usb_cable_connected() function

Hello,

Quoted 21 lines · Minkyu Kang
Quoted 7 lines · Przemyslaw Marczak

Changes:
- define function usb_cable_connected() in trats board file which returns 1 if cable is connected and 0 otherwise
- trats.h: add CONFIG_USB_CHECK_CABLE

Changes v2:
- add muic avaibility check

Change log should be under --- line.
This is not a commit message.

Quoted 8 lines
---
  board/samsung/trats/trats.c |   11 +++++++++++
  include/configs/trats.h     |    1 +
  2 files changed, 12 insertions(+)
Quoted 7 lines

Anyway...
applied to u-boot-samsung.

Thanks,
Minkyu Kang.

Sorry for this issue and thank you for patch apply. Could you also check my patch to s5p gpio?

Regards

Signature · 4 lines
Przemyslaw Marczak
Samsung R&D Institute Poland
Samsung Electronics
p.marczak at samsung.com