Skip to contentSkip to conversation

Add MAX14526 MUIC driver

PATCH Superseded Svyatoslav Ryhel 3 participants 9 messages Apr 19, 2023 – Apr 21, 2023 Char and misc drivers

v1 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

cover Add MAX14526 MUIC driver

MAX14526 MUIC is used by LG P880/P895 which are currently in the process of merging.

Unfortunately U-Boot has no extcon driver model so I used a MISC model for now.

MAX14526 is a powerful extcon device which has the ability to accurately determine plugged devices. In this implementation muic can be configured to represent 3 modes: CP-USB/UART and AP-USB. Unfortunately AP-UART was disabled on P880/P895. Additionally the driver configures some stuff required by the charger.

Svyatoslav Ryhel (1):
misc: extcon: add MAX14526 MUIC support

 drivers/misc/Kconfig                  |   2 +
 drivers/misc/Makefile                 |   1 +
 drivers/misc/extcon/Kconfig           |   8 ++
 drivers/misc/extcon/Makefile          |   2 +
 drivers/misc/extcon/extcon-max14526.c | 153 ++++++++++++++++++++++++++
 5 files changed, 166 insertions(+)
 create mode 100644 drivers/misc/extcon/Kconfig
 create mode 100644 drivers/misc/extcon/Makefile
 create mode 100644 drivers/misc/extcon/extcon-max14526.c
Signature · 1 line
2.37.2
#1 lore raw

PATCH 1/1 misc: extcon: add MAX14526 MUIC support

MAX14526 is a powerful extcon chip which allows detection of various plugs like usb, mhl, uart, headset etc. This version of driver implements support of AP-usb and CP-usb/uart paths.

---
 drivers/misc/Kconfig                  |   2 +
 drivers/misc/Makefile                 |   1 +
 drivers/misc/extcon/Kconfig           |   8 ++
 drivers/misc/extcon/Makefile          |   2 +
 drivers/misc/extcon/extcon-max14526.c | 153 ++++++++++++++++++++++++++
 5 files changed, 166 insertions(+)
 create mode 100644 drivers/misc/extcon/Kconfig
 create mode 100644 drivers/misc/extcon/Makefile
 create mode 100644 drivers/misc/extcon/extcon-max14526.c
drivers/misc/Kconfig +2 -0
index 4e1ae03e9f..1b49f3cf72 100644
@@ -659,4 +659,6 @@ config SL28CPLD
 	  the base driver which provides common access methods for the
 	  sub-drivers.
 
+source "drivers/misc/extcon/Kconfig"
+
 endmenu
drivers/misc/Makefile +1 -0
index 3b792f2a14..6d4fc8ddf9 100644
@@ -87,3 +87,4 @@ obj-$(CONFIG_K3_AVS0) += k3_avs.o
 obj-$(CONFIG_ESM_K3) += k3_esm.o
 obj-$(CONFIG_ESM_PMIC) += esm_pmic.o
 obj-$(CONFIG_SL28CPLD) += sl28cpld.o
+obj-y += extcon/
drivers/misc/extcon/Kconfig new file +8 -0
new file mode 100644
index 0000000000..99c38224f3
@@ -0,0 +1,8 @@
+config EXTCON_MAX14526
+	bool "Maxim MAX14526 EXTCON Support"
+	select DM_I2C
+	select DM_MISC
+	help
+	  If you say yes here you get support for the MUIC device of
+	  Maxim MAX14526. The MAX14526 MUIC is a USB port accessory
+	  detector and switch.
drivers/misc/extcon/Makefile new file +2 -0
new file mode 100644
index 0000000000..f012b688ce
@@ -0,0 +1,2 @@
+# SPDX-License-Identifier: GPL-2.0+
+obj-$(CONFIG_EXTCON_MAX14526) += extcon-max14526.o
drivers/misc/extcon/extcon-max14526.c new file +153 -0

153 lines not on this page · raw message

Signature · 1 line
2.37.2
#2 lore raw

Re: [PATCH v1 1/1] misc: extcon: add MAX14526 MUIC support

Hi Svyatoslav,

Quoted 67 lines · Svyatoslav Ryhel

MAX14526 is a powerful extcon chip which allows detection of various plugs like usb, mhl, uart, headset etc. This version of driver implements support of AP-usb and CP-usb/uart paths.

---
 drivers/misc/Kconfig                  |   2 +
 drivers/misc/Makefile                 |   1 +
 drivers/misc/extcon/Kconfig           |   8 ++
 drivers/misc/extcon/Makefile          |   2 +
 drivers/misc/extcon/extcon-max14526.c | 153 ++++++++++++++++++++++++++
 5 files changed, 166 insertions(+)
 create mode 100644 drivers/misc/extcon/Kconfig
 create mode 100644 drivers/misc/extcon/Makefile
 create mode 100644 drivers/misc/extcon/extcon-max14526.c
drivers/misc/Kconfig +2 -0
index 4e1ae03e9f..1b49f3cf72 100644
@@ -659,4 +659,6 @@ config SL28CPLD
          the base driver which provides common access methods for the
          sub-drivers.
 
+source "drivers/misc/extcon/Kconfig"
+
 endmenu
drivers/misc/Makefile +1 -0
index 3b792f2a14..6d4fc8ddf9 100644
@@ -87,3 +87,4 @@ obj-$(CONFIG_K3_AVS0) += k3_avs.o
 obj-$(CONFIG_ESM_K3) += k3_esm.o
 obj-$(CONFIG_ESM_PMIC) += esm_pmic.o
 obj-$(CONFIG_SL28CPLD) += sl28cpld.o
+obj-y += extcon/
drivers/misc/extcon/Kconfig new file +8 -0
new file mode 100644
index 0000000000..99c38224f3
@@ -0,0 +1,8 @@
+config EXTCON_MAX14526
+       bool "Maxim MAX14526 EXTCON Support"
+       select DM_I2C
+       select DM_MISC
+       help
+         If you say yes here you get support for the MUIC device of
+         Maxim MAX14526. The MAX14526 MUIC is a USB port accessory
+         detector and switch.
drivers/misc/extcon/Makefile new file +2 -0
new file mode 100644
index 0000000000..f012b688ce
@@ -0,0 +1,2 @@
+# SPDX-License-Identifier: GPL-2.0+
+obj-$(CONFIG_EXTCON_MAX14526) += extcon-max14526.o
drivers/misc/extcon/extcon-max14526.c new file +0 -0
new file mode 100644
index 0000000000..c8505dae49

drivers/misc/extcon/extcon-max14526.c line 5

Quoted 5 lines
drivers/misc/extcon/extcon-max14526.c new file +5 -0
@@ -0,0 +1,153 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright (c) 2022 Svyatoslav Ryhel <[email protected]>
+ *
+ * U-boot lacks extcon DM.

In that case I think it is best to add a new uclass for it.

Regards,
Simon

#3 lore raw

Re: [PATCH v1 1/1] misc: extcon: add MAX14526 MUIC support

чт, 20 квіт. 2023 р. о 01:41 Simon Glass <[email protected]> пише:

Quoted 79 lines

Hi Svyatoslav,

Quoted 67 lines · Svyatoslav Ryhel

MAX14526 is a powerful extcon chip which allows detection of various plugs like usb, mhl, uart, headset etc. This version of driver implements support of AP-usb and CP-usb/uart paths.

---
 drivers/misc/Kconfig                  |   2 +
 drivers/misc/Makefile                 |   1 +
 drivers/misc/extcon/Kconfig           |   8 ++
 drivers/misc/extcon/Makefile          |   2 +
 drivers/misc/extcon/extcon-max14526.c | 153 ++++++++++++++++++++++++++
 5 files changed, 166 insertions(+)
 create mode 100644 drivers/misc/extcon/Kconfig
 create mode 100644 drivers/misc/extcon/Makefile
 create mode 100644 drivers/misc/extcon/extcon-max14526.c
drivers/misc/Kconfig +2 -0
index 4e1ae03e9f..1b49f3cf72 100644
@@ -659,4 +659,6 @@ config SL28CPLD
          the base driver which provides common access methods for the
          sub-drivers.
 
+source "drivers/misc/extcon/Kconfig"
+
 endmenu
drivers/misc/Makefile +1 -0
index 3b792f2a14..6d4fc8ddf9 100644
@@ -87,3 +87,4 @@ obj-$(CONFIG_K3_AVS0) += k3_avs.o
 obj-$(CONFIG_ESM_K3) += k3_esm.o
 obj-$(CONFIG_ESM_PMIC) += esm_pmic.o
 obj-$(CONFIG_SL28CPLD) += sl28cpld.o
+obj-y += extcon/
drivers/misc/extcon/Kconfig new file +8 -0
new file mode 100644
index 0000000000..99c38224f3
@@ -0,0 +1,8 @@
+config EXTCON_MAX14526
+       bool "Maxim MAX14526 EXTCON Support"
+       select DM_I2C
+       select DM_MISC
+       help
+         If you say yes here you get support for the MUIC device of
+         Maxim MAX14526. The MAX14526 MUIC is a USB port accessory
+         detector and switch.
drivers/misc/extcon/Makefile new file +2 -0
new file mode 100644
index 0000000000..f012b688ce
@@ -0,0 +1,2 @@
+# SPDX-License-Identifier: GPL-2.0+
+obj-$(CONFIG_EXTCON_MAX14526) += extcon-max14526.o
drivers/misc/extcon/extcon-max14526.c new file +0 -0
new file mode 100644
index 0000000000..c8505dae49

drivers/misc/extcon/extcon-max14526.c line 5

Quoted 5 lines
drivers/misc/extcon/extcon-max14526.c new file +5 -0
@@ -0,0 +1,153 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright (c) 2022 Svyatoslav Ryhel <[email protected]>
+ *
+ * U-boot lacks extcon DM.

In that case I think it is best to add a new uclass for it.

Quoted 2 lines

Regards,
Simon

Thank you, Simon!

First of all, thanks for your reviews, all of them apart from those I have responded to are fairly reasonable and will be implemented.

About extcon uclass. My vision is to leave this driver as is in misc for some time and check if there will be any other extcon devices added. In case these devices become at least sometimes used on supported devices there will be good reasons to create a new uclass. As for now, it is a bit pointless to waste time for a new uclass and new framework for only one device used by one board.

Best regards,
Svyatoslav R.

#4 lore raw

Re: [PATCH v1 1/1] misc: extcon: add MAX14526 MUIC support

Hi Svyatoslav,

Quoted 89 lines · Svyatoslav Ryhel

чт, 20 квіт. 2023 р. о 01:41 Simon Glass <[email protected]> пише:

Quoted 79 lines

Hi Svyatoslav,

Quoted 67 lines · Svyatoslav Ryhel

MAX14526 is a powerful extcon chip which allows detection of various plugs like usb, mhl, uart, headset etc. This version of driver implements support of AP-usb and CP-usb/uart paths.

---
 drivers/misc/Kconfig                  |   2 +
 drivers/misc/Makefile                 |   1 +
 drivers/misc/extcon/Kconfig           |   8 ++
 drivers/misc/extcon/Makefile          |   2 +
 drivers/misc/extcon/extcon-max14526.c | 153 ++++++++++++++++++++++++++
 5 files changed, 166 insertions(+)
 create mode 100644 drivers/misc/extcon/Kconfig
 create mode 100644 drivers/misc/extcon/Makefile
 create mode 100644 drivers/misc/extcon/extcon-max14526.c
drivers/misc/Kconfig +2 -0
index 4e1ae03e9f..1b49f3cf72 100644
@@ -659,4 +659,6 @@ config SL28CPLD
          the base driver which provides common access methods for the
          sub-drivers.
 
+source "drivers/misc/extcon/Kconfig"
+
 endmenu
drivers/misc/Makefile +1 -0
index 3b792f2a14..6d4fc8ddf9 100644
@@ -87,3 +87,4 @@ obj-$(CONFIG_K3_AVS0) += k3_avs.o
 obj-$(CONFIG_ESM_K3) += k3_esm.o
 obj-$(CONFIG_ESM_PMIC) += esm_pmic.o
 obj-$(CONFIG_SL28CPLD) += sl28cpld.o
+obj-y += extcon/
drivers/misc/extcon/Kconfig new file +8 -0
new file mode 100644
index 0000000000..99c38224f3
@@ -0,0 +1,8 @@
+config EXTCON_MAX14526
+       bool "Maxim MAX14526 EXTCON Support"
+       select DM_I2C
+       select DM_MISC
+       help
+         If you say yes here you get support for the MUIC device of
+         Maxim MAX14526. The MAX14526 MUIC is a USB port accessory
+         detector and switch.
drivers/misc/extcon/Makefile new file +2 -0
new file mode 100644
index 0000000000..f012b688ce
@@ -0,0 +1,2 @@
+# SPDX-License-Identifier: GPL-2.0+
+obj-$(CONFIG_EXTCON_MAX14526) += extcon-max14526.o
drivers/misc/extcon/extcon-max14526.c new file +0 -0
new file mode 100644
index 0000000000..c8505dae49

drivers/misc/extcon/extcon-max14526.c line 5

Quoted 5 lines
drivers/misc/extcon/extcon-max14526.c new file +5 -0
@@ -0,0 +1,153 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright (c) 2022 Svyatoslav Ryhel <[email protected]>
+ *
+ * U-boot lacks extcon DM.

In that case I think it is best to add a new uclass for it.

Quoted 2 lines

Regards,
Simon

Thank you, Simon!

First of all, thanks for your reviews, all of them apart from those I have responded to are fairly reasonable and will be implemented.

Quoted 6 lines

About extcon uclass. My vision is to leave this driver as is in misc for some time and check if there will be any other extcon devices added. In case these devices become at least sometimes used on supported devices there will be good reasons to create a new uclass. As for now, it is a bit pointless to waste time for a new uclass and new framework for only one device used by one board.

I am sure there will be more.

The problem with accepting this patch as is, is that the burden of creating the uclass (which is actually not that large at all) falls on the second driver submitter, as well as the burden of converting your driver. In practice what happens is that no one can be bothered.

See UCLASS_PCH for a simple uclass. You just need to define the API (which may just be empty), any uclass-private struct then add something to test.dst and a simple test to test/dm/extcon.c

Regards

Simon

#5 lore raw

Re: [PATCH v1 1/1] misc: extcon: add MAX14526 MUIC support

чт, 20 квіт. 2023 р. о 19:30 Simon Glass <[email protected]> пише:

Quoted 107 lines

Hi Svyatoslav,

Quoted 89 lines · Svyatoslav Ryhel

чт, 20 квіт. 2023 р. о 01:41 Simon Glass <[email protected]> пише:

Quoted 79 lines

Hi Svyatoslav,

Quoted 67 lines · Svyatoslav Ryhel

MAX14526 is a powerful extcon chip which allows detection of various plugs like usb, mhl, uart, headset etc. This version of driver implements support of AP-usb and CP-usb/uart paths.

---
 drivers/misc/Kconfig                  |   2 +
 drivers/misc/Makefile                 |   1 +
 drivers/misc/extcon/Kconfig           |   8 ++
 drivers/misc/extcon/Makefile          |   2 +
 drivers/misc/extcon/extcon-max14526.c | 153 ++++++++++++++++++++++++++
 5 files changed, 166 insertions(+)
 create mode 100644 drivers/misc/extcon/Kconfig
 create mode 100644 drivers/misc/extcon/Makefile
 create mode 100644 drivers/misc/extcon/extcon-max14526.c
drivers/misc/Kconfig +2 -0
index 4e1ae03e9f..1b49f3cf72 100644
@@ -659,4 +659,6 @@ config SL28CPLD
          the base driver which provides common access methods for the
          sub-drivers.
 
+source "drivers/misc/extcon/Kconfig"
+
 endmenu
drivers/misc/Makefile +1 -0
index 3b792f2a14..6d4fc8ddf9 100644
@@ -87,3 +87,4 @@ obj-$(CONFIG_K3_AVS0) += k3_avs.o
 obj-$(CONFIG_ESM_K3) += k3_esm.o
 obj-$(CONFIG_ESM_PMIC) += esm_pmic.o
 obj-$(CONFIG_SL28CPLD) += sl28cpld.o
+obj-y += extcon/
drivers/misc/extcon/Kconfig new file +8 -0
new file mode 100644
index 0000000000..99c38224f3
@@ -0,0 +1,8 @@
+config EXTCON_MAX14526
+       bool "Maxim MAX14526 EXTCON Support"
+       select DM_I2C
+       select DM_MISC
+       help
+         If you say yes here you get support for the MUIC device of
+         Maxim MAX14526. The MAX14526 MUIC is a USB port accessory
+         detector and switch.
drivers/misc/extcon/Makefile new file +2 -0
new file mode 100644
index 0000000000..f012b688ce
@@ -0,0 +1,2 @@
+# SPDX-License-Identifier: GPL-2.0+
+obj-$(CONFIG_EXTCON_MAX14526) += extcon-max14526.o
drivers/misc/extcon/extcon-max14526.c new file +0 -0
new file mode 100644
index 0000000000..c8505dae49

drivers/misc/extcon/extcon-max14526.c line 5

Quoted 5 lines
drivers/misc/extcon/extcon-max14526.c new file +5 -0
@@ -0,0 +1,153 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright (c) 2022 Svyatoslav Ryhel <[email protected]>
+ *
+ * U-boot lacks extcon DM.

In that case I think it is best to add a new uclass for it.

Quoted 2 lines

Regards,
Simon

Thank you, Simon!

First of all, thanks for your reviews, all of them apart from those I have responded to are fairly reasonable and will be implemented.

Quoted 6 lines

About extcon uclass. My vision is to leave this driver as is in misc for some time and check if there will be any other extcon devices added. In case these devices become at least sometimes used on supported devices there will be good reasons to create a new uclass. As for now, it is a bit pointless to waste time for a new uclass and new framework for only one device used by one board.

I am sure there will be more.

The problem with accepting this patch as is, is that the burden of creating the uclass (which is actually not that large at all) falls on the second driver submitter, as well as the burden of converting your driver. In practice what happens is that no one can be bothered.

Quoted 7 lines

See UCLASS_PCH for a simple uclass. You just need to define the API (which may just be empty), any uclass-private struct then add something to test.dst and a simple test to test/dm/extcon.c

Regards

Simon

Ok, I will look into this a bit deeper

#6 lore raw

Re: [PATCH v1 1/1] misc: extcon: add MAX14526 MUIC support

Quoted 113 lines · Svyatoslav Ryhel

чт, 20 квіт. 2023 р. о 19:30 Simon Glass <[email protected]> пише:

Quoted 111 lines

Hi Svyatoslav,

Quoted 89 lines · Svyatoslav Ryhel

чт, 20 квіт. 2023 р. о 01:41 Simon Glass <[email protected]> пише:

Quoted 79 lines

Hi Svyatoslav,

Quoted 67 lines · Svyatoslav Ryhel

MAX14526 is a powerful extcon chip which allows detection of various plugs like usb, mhl, uart, headset etc. This version of driver implements support of AP-usb and CP-usb/uart paths.

---
 drivers/misc/Kconfig                  |   2 +
 drivers/misc/Makefile                 |   1 +
 drivers/misc/extcon/Kconfig           |   8 ++
 drivers/misc/extcon/Makefile          |   2 +
 drivers/misc/extcon/extcon-max14526.c | 153 ++++++++++++++++++++++++++
 5 files changed, 166 insertions(+)
 create mode 100644 drivers/misc/extcon/Kconfig
 create mode 100644 drivers/misc/extcon/Makefile
 create mode 100644 drivers/misc/extcon/extcon-max14526.c
drivers/misc/Kconfig +2 -0
index 4e1ae03e9f..1b49f3cf72 100644
@@ -659,4 +659,6 @@ config SL28CPLD
          the base driver which provides common access methods for the
          sub-drivers.
 
+source "drivers/misc/extcon/Kconfig"
+
 endmenu
drivers/misc/Makefile +1 -0
index 3b792f2a14..6d4fc8ddf9 100644
@@ -87,3 +87,4 @@ obj-$(CONFIG_K3_AVS0) += k3_avs.o
 obj-$(CONFIG_ESM_K3) += k3_esm.o
 obj-$(CONFIG_ESM_PMIC) += esm_pmic.o
 obj-$(CONFIG_SL28CPLD) += sl28cpld.o
+obj-y += extcon/
drivers/misc/extcon/Kconfig new file +8 -0
new file mode 100644
index 0000000000..99c38224f3
@@ -0,0 +1,8 @@
+config EXTCON_MAX14526
+       bool "Maxim MAX14526 EXTCON Support"
+       select DM_I2C
+       select DM_MISC
+       help
+         If you say yes here you get support for the MUIC device of
+         Maxim MAX14526. The MAX14526 MUIC is a USB port accessory
+         detector and switch.
drivers/misc/extcon/Makefile new file +2 -0
new file mode 100644
index 0000000000..f012b688ce
@@ -0,0 +1,2 @@
+# SPDX-License-Identifier: GPL-2.0+
+obj-$(CONFIG_EXTCON_MAX14526) += extcon-max14526.o
drivers/misc/extcon/extcon-max14526.c new file +0 -0
new file mode 100644
index 0000000000..c8505dae49

drivers/misc/extcon/extcon-max14526.c line 5

Quoted 5 lines
drivers/misc/extcon/extcon-max14526.c new file +5 -0
@@ -0,0 +1,153 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright (c) 2022 Svyatoslav Ryhel <[email protected]>
+ *
+ * U-boot lacks extcon DM.

In that case I think it is best to add a new uclass for it.

Quoted 2 lines

Regards,
Simon

Thank you, Simon!

First of all, thanks for your reviews, all of them apart from those I have responded to are fairly reasonable and will be implemented.

Quoted 6 lines

About extcon uclass. My vision is to leave this driver as is in misc for some time and check if there will be any other extcon devices added. In case these devices become at least sometimes used on supported devices there will be good reasons to create a new uclass. As for now, it is a bit pointless to waste time for a new uclass and new framework for only one device used by one board.

I am sure there will be more.

The problem with accepting this patch as is, is that the burden of creating the uclass (which is actually not that large at all) falls on the second driver submitter, as well as the burden of converting your driver. In practice what happens is that no one can be bothered.

See UCLASS_PCH for a simple uclass. You just need to define the API (which may just be empty), any uclass-private struct then add something to test.dst and a simple test to test/dm/extcon.c

Quoted 5 lines
Quoted 3 lines

Regards

Simon

Ok, I will look into this a bit deeper

Svyatoslav,

I agree with Simon and would like to see a uclass. We do have the need for a U-Boot driver that supports gpio based USB ID such as Linux drivers/usb/common/usb-conn-gpio.c (compatible "gpio-usb-b-connector") and drivers/extcon/extcon-usb-gpio.c (compatible "linux,extcon-usb-gpio") (which I believe is deprecated) as there are many usb controllers that use this that appear unsupported for role-switch in U-Boot today.

Best Regards,

Tim

#7 lore raw

Re: [PATCH v1 1/1] misc: extcon: add MAX14526 MUIC support

пт, 21 квіт. 2023 р. о 19:30 Tim Harvey <[email protected]> пише:

Quoted 131 lines · Svyatoslav Ryhel
Quoted 113 lines

чт, 20 квіт. 2023 р. о 19:30 Simon Glass <[email protected]> пише:

Quoted 111 lines

Hi Svyatoslav,

Quoted 89 lines · Svyatoslav Ryhel

чт, 20 квіт. 2023 р. о 01:41 Simon Glass <[email protected]> пише:

Quoted 79 lines

Hi Svyatoslav,

Quoted 67 lines · Svyatoslav Ryhel

MAX14526 is a powerful extcon chip which allows detection of various plugs like usb, mhl, uart, headset etc. This version of driver implements support of AP-usb and CP-usb/uart paths.

---
 drivers/misc/Kconfig                  |   2 +
 drivers/misc/Makefile                 |   1 +
 drivers/misc/extcon/Kconfig           |   8 ++
 drivers/misc/extcon/Makefile          |   2 +
 drivers/misc/extcon/extcon-max14526.c | 153 ++++++++++++++++++++++++++
 5 files changed, 166 insertions(+)
 create mode 100644 drivers/misc/extcon/Kconfig
 create mode 100644 drivers/misc/extcon/Makefile
 create mode 100644 drivers/misc/extcon/extcon-max14526.c
drivers/misc/Kconfig +2 -0
index 4e1ae03e9f..1b49f3cf72 100644
@@ -659,4 +659,6 @@ config SL28CPLD
          the base driver which provides common access methods for the
          sub-drivers.
 
+source "drivers/misc/extcon/Kconfig"
+
 endmenu
drivers/misc/Makefile +1 -0
index 3b792f2a14..6d4fc8ddf9 100644
@@ -87,3 +87,4 @@ obj-$(CONFIG_K3_AVS0) += k3_avs.o
 obj-$(CONFIG_ESM_K3) += k3_esm.o
 obj-$(CONFIG_ESM_PMIC) += esm_pmic.o
 obj-$(CONFIG_SL28CPLD) += sl28cpld.o
+obj-y += extcon/
drivers/misc/extcon/Kconfig new file +8 -0
new file mode 100644
index 0000000000..99c38224f3
@@ -0,0 +1,8 @@
+config EXTCON_MAX14526
+       bool "Maxim MAX14526 EXTCON Support"
+       select DM_I2C
+       select DM_MISC
+       help
+         If you say yes here you get support for the MUIC device of
+         Maxim MAX14526. The MAX14526 MUIC is a USB port accessory
+         detector and switch.
drivers/misc/extcon/Makefile new file +2 -0
new file mode 100644
index 0000000000..f012b688ce
@@ -0,0 +1,2 @@
+# SPDX-License-Identifier: GPL-2.0+
+obj-$(CONFIG_EXTCON_MAX14526) += extcon-max14526.o
drivers/misc/extcon/extcon-max14526.c new file +0 -0
new file mode 100644
index 0000000000..c8505dae49

drivers/misc/extcon/extcon-max14526.c line 5

Quoted 5 lines
drivers/misc/extcon/extcon-max14526.c new file +5 -0
@@ -0,0 +1,153 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright (c) 2022 Svyatoslav Ryhel <[email protected]>
+ *
+ * U-boot lacks extcon DM.

In that case I think it is best to add a new uclass for it.

Quoted 2 lines

Regards,
Simon

Thank you, Simon!

First of all, thanks for your reviews, all of them apart from those I have responded to are fairly reasonable and will be implemented.

Quoted 6 lines

About extcon uclass. My vision is to leave this driver as is in misc for some time and check if there will be any other extcon devices added. In case these devices become at least sometimes used on supported devices there will be good reasons to create a new uclass. As for now, it is a bit pointless to waste time for a new uclass and new framework for only one device used by one board.

I am sure there will be more.

The problem with accepting this patch as is, is that the burden of creating the uclass (which is actually not that large at all) falls on the second driver submitter, as well as the burden of converting your driver. In practice what happens is that no one can be bothered.

See UCLASS_PCH for a simple uclass. You just need to define the API (which may just be empty), any uclass-private struct then add something to test.dst and a simple test to test/dm/extcon.c

Quoted 5 lines
Quoted 3 lines

Regards

Simon

Ok, I will look into this a bit deeper

Svyatoslav,

I agree with Simon and would like to see a uclass. We do have the need for a U-Boot driver that supports gpio based USB ID such as Linux drivers/usb/common/usb-conn-gpio.c (compatible "gpio-usb-b-connector") and drivers/extcon/extcon-usb-gpio.c (compatible "linux,extcon-usb-gpio") (which I believe is deprecated) as there are many usb controllers that use this that appear unsupported for role-switch in U-Boot today.

Quoted 3 lines

Best Regards,

Tim

Tim,

I have implemented simple extcon uclass in v3 iteration. As for now it has empty platform struct and no ops but those will be added once required.

Best regards,
Svyatoslav R.

#8 lore raw

Re: [PATCH v1 1/1] misc: extcon: add MAX14526 MUIC support

Quoted 137 lines · Svyatoslav Ryhel

пт, 21 квіт. 2023 р. о 19:30 Tim Harvey <[email protected]> пише:

Quoted 131 lines · Svyatoslav Ryhel
Quoted 113 lines

чт, 20 квіт. 2023 р. о 19:30 Simon Glass <[email protected]> пише:

Quoted 111 lines

Hi Svyatoslav,

Quoted 89 lines · Svyatoslav Ryhel

чт, 20 квіт. 2023 р. о 01:41 Simon Glass <[email protected]> пише:

Quoted 79 lines

Hi Svyatoslav,

Quoted 67 lines · Svyatoslav Ryhel

MAX14526 is a powerful extcon chip which allows detection of various plugs like usb, mhl, uart, headset etc. This version of driver implements support of AP-usb and CP-usb/uart paths.

---
 drivers/misc/Kconfig                  |   2 +
 drivers/misc/Makefile                 |   1 +
 drivers/misc/extcon/Kconfig           |   8 ++
 drivers/misc/extcon/Makefile          |   2 +
 drivers/misc/extcon/extcon-max14526.c | 153 ++++++++++++++++++++++++++
 5 files changed, 166 insertions(+)
 create mode 100644 drivers/misc/extcon/Kconfig
 create mode 100644 drivers/misc/extcon/Makefile
 create mode 100644 drivers/misc/extcon/extcon-max14526.c
drivers/misc/Kconfig +2 -0
index 4e1ae03e9f..1b49f3cf72 100644
@@ -659,4 +659,6 @@ config SL28CPLD
          the base driver which provides common access methods for the
          sub-drivers.
 
+source "drivers/misc/extcon/Kconfig"
+
 endmenu
drivers/misc/Makefile +1 -0
index 3b792f2a14..6d4fc8ddf9 100644
@@ -87,3 +87,4 @@ obj-$(CONFIG_K3_AVS0) += k3_avs.o
 obj-$(CONFIG_ESM_K3) += k3_esm.o
 obj-$(CONFIG_ESM_PMIC) += esm_pmic.o
 obj-$(CONFIG_SL28CPLD) += sl28cpld.o
+obj-y += extcon/
drivers/misc/extcon/Kconfig new file +8 -0
new file mode 100644
index 0000000000..99c38224f3
@@ -0,0 +1,8 @@
+config EXTCON_MAX14526
+       bool "Maxim MAX14526 EXTCON Support"
+       select DM_I2C
+       select DM_MISC
+       help
+         If you say yes here you get support for the MUIC device of
+         Maxim MAX14526. The MAX14526 MUIC is a USB port accessory
+         detector and switch.
drivers/misc/extcon/Makefile new file +2 -0
new file mode 100644
index 0000000000..f012b688ce
@@ -0,0 +1,2 @@
+# SPDX-License-Identifier: GPL-2.0+
+obj-$(CONFIG_EXTCON_MAX14526) += extcon-max14526.o
drivers/misc/extcon/extcon-max14526.c new file +0 -0
new file mode 100644
index 0000000000..c8505dae49

drivers/misc/extcon/extcon-max14526.c line 5

Quoted 5 lines
drivers/misc/extcon/extcon-max14526.c new file +5 -0
@@ -0,0 +1,153 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Copyright (c) 2022 Svyatoslav Ryhel <[email protected]>
+ *
+ * U-boot lacks extcon DM.

In that case I think it is best to add a new uclass for it.

Quoted 2 lines

Regards,
Simon

Thank you, Simon!

First of all, thanks for your reviews, all of them apart from those I have responded to are fairly reasonable and will be implemented.

Quoted 6 lines

About extcon uclass. My vision is to leave this driver as is in misc for some time and check if there will be any other extcon devices added. In case these devices become at least sometimes used on supported devices there will be good reasons to create a new uclass. As for now, it is a bit pointless to waste time for a new uclass and new framework for only one device used by one board.

I am sure there will be more.

The problem with accepting this patch as is, is that the burden of creating the uclass (which is actually not that large at all) falls on the second driver submitter, as well as the burden of converting your driver. In practice what happens is that no one can be bothered.

See UCLASS_PCH for a simple uclass. You just need to define the API (which may just be empty), any uclass-private struct then add something to test.dst and a simple test to test/dm/extcon.c

Quoted 5 lines
Quoted 3 lines

Regards

Simon

Ok, I will look into this a bit deeper

Svyatoslav,

I agree with Simon and would like to see a uclass. We do have the need for a U-Boot driver that supports gpio based USB ID such as Linux drivers/usb/common/usb-conn-gpio.c (compatible "gpio-usb-b-connector") and drivers/extcon/extcon-usb-gpio.c (compatible "linux,extcon-usb-gpio") (which I believe is deprecated) as there are many usb controllers that use this that appear unsupported for role-switch in U-Boot today.

Quoted 3 lines

Best Regards,

Tim

Quoted 7 lines

Tim,

I have implemented simple extcon uclass in v3 iteration. As for now it has empty platform struct and no ops but those will be added once required.

Best regards,
Svyatoslav R.

Marek,

Is there any common API in U-Boot USB controller drivers for role selection that would lend itself to an extcon uclass driver? I'm only familiar with ehci-mx6 which has an internal register mapped to a dedicated ID pin and not clear what the other dual-role USB host controllers use for role determination.

Best Regards,

Tim