Hi, On 02/08/16 04:58, Chanwoo Choi wrote: > This patch adds the new extcon type to group the each connecotr > into following five category. This type would be used to handle > the connectors as a group unit instead of a connector unit. > - EXTCON_TYPE_USB : USB connector > - EXTCON_TYPE_CHG : Charger connector > - EXTCON_TYPE_JACK : Jack connector > - EXTCON_TYPE_DISP : Display connector > - EXTCON_TYPE_MISC : Miscellaneous connector > > Also, each external connector is possible to belong to one more extcon type. > In caes of EXTCON_CHG_USB_SDP, it have the EXTCON_TYPE_CHG and > EXTCON_TYPE_USB. > > Signed-off-by: Chanwoo Choi <cw00.c...@samsung.com> > Tested-by: Chris Zhong <z...@rock-chips.com> > Tested-by: Guenter Roeck <gro...@chromium.org> > Signed-off-by: MyungJoo Ham <myungjoo....@samsung.com> > Reviewed-by: Guenter Roeck <gro...@chromium.org> > --- > drivers/extcon/extcon.c | 159 > +++++++++++++++++++++++++++++++++++++++--------- > include/linux/extcon.h | 9 +++ > 2 files changed, 139 insertions(+), 29 deletions(-) > > diff --git a/drivers/extcon/extcon.c b/drivers/extcon/extcon.c > index 9a266e5c7e10..129afc87313e 100644 > --- a/drivers/extcon/extcon.c > +++ b/drivers/extcon/extcon.c > @@ -38,43 +38,144 @@ > #define SUPPORTED_CABLE_MAX 32 > #define CABLE_NAME_MAX 30 > > -static const char *extcon_name[] = { > - [EXTCON_NONE] = "NONE", > +struct __extcon_info { > + unsigned int type; > + unsigned int id; > + const char *name; > + > +} extcon_info[] = { > + [EXTCON_NONE] = { > + .type = EXTCON_TYPE_MISC, > + .id = EXTCON_NONE, > + .name = "NONE", > + }, > > /* USB external connector */ > - [EXTCON_USB] = "USB", > - [EXTCON_USB_HOST] = "USB-HOST", > + [EXTCON_USB] = { > + .type = EXTCON_TYPE_USB, > + .id = EXTCON_USB, > + .name = "USB", > + }, > + [EXTCON_USB_HOST] = { > + .type = EXTCON_TYPE_USB, > + .id = EXTCON_USB, > + .name = "USB_HOST", > + },
EXTCON_USB_HOST should now be redundant as we can get all the necessary information via EXTCON_USB. > > /* Charging external connector */ <snip> cheers, -roger