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

Simon Glass sjg at chromium.org
Thu Apr 20 18:30:39 CEST 2023


Hi Svyatoslav,

On Thu, 20 Apr 2023 at 18:01, Svyatoslav Ryhel <clamor95 at gmail.com> wrote:
>
> чт, 20 квіт. 2023 р. о 01:41 Simon Glass <sjg at chromium.org> пише:
> >
> > Hi Svyatoslav,
> >
> > On Wed, 19 Apr 2023 at 12:53, Svyatoslav Ryhel <clamor95 at gmail.com> wrote:
> > >
> > > 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.
> > >
> > > Tested-by: Andreas Westman Dorcsak <hedmoo at yahoo.com> # LG P880 T30
> > > Tested-by: Svyatoslav Ryhel <clamor95 at gmail.com> # LG P895 T30
> > > Signed-off-by: Svyatoslav Ryhel <clamor95 at gmail.com>
> > > ---
> > >  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
> > >
> > > diff --git a/drivers/misc/Kconfig b/drivers/misc/Kconfig
> > > index 4e1ae03e9f..1b49f3cf72 100644
> > > --- a/drivers/misc/Kconfig
> > > +++ b/drivers/misc/Kconfig
> > > @@ -659,4 +659,6 @@ config SL28CPLD
> > >           the base driver which provides common access methods for the
> > >           sub-drivers.
> > >
> > > +source "drivers/misc/extcon/Kconfig"
> > > +
> > >  endmenu
> > > diff --git a/drivers/misc/Makefile b/drivers/misc/Makefile
> > > index 3b792f2a14..6d4fc8ddf9 100644
> > > --- a/drivers/misc/Makefile
> > > +++ b/drivers/misc/Makefile
> > > @@ -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/
> > > diff --git a/drivers/misc/extcon/Kconfig b/drivers/misc/extcon/Kconfig
> > > new file mode 100644
> > > index 0000000000..99c38224f3
> > > --- /dev/null
> > > +++ b/drivers/misc/extcon/Kconfig
> > > @@ -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.
> > > diff --git a/drivers/misc/extcon/Makefile b/drivers/misc/extcon/Makefile
> > > new file mode 100644
> > > index 0000000000..f012b688ce
> > > --- /dev/null
> > > +++ b/drivers/misc/extcon/Makefile
> > > @@ -0,0 +1,2 @@
> > > +# SPDX-License-Identifier: GPL-2.0+
> > > +obj-$(CONFIG_EXTCON_MAX14526) += extcon-max14526.o
> > > diff --git a/drivers/misc/extcon/extcon-max14526.c b/drivers/misc/extcon/extcon-max14526.c
> > > new file mode 100644
> > > index 0000000000..c8505dae49
> > > --- /dev/null
> > > +++ b/drivers/misc/extcon/extcon-max14526.c
> > > @@ -0,0 +1,153 @@
> > > +// SPDX-License-Identifier: GPL-2.0+
> > > +/*
> > > + * Copyright (c) 2022 Svyatoslav Ryhel <clamor95 at gmail.com>
> > > + *
> > > + * U-boot lacks extcon DM.
> >
> > In that case I think it is best to add a new uclass for it.
> >
> > 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.

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


More information about the U-Boot mailing list