RE: [PATCH 1/2] extcon: Modify the id and name of external connector

From: Pallala, Ramakrishna
Date: Tue Oct 06 2015 - 07:58:31 EST


> >> diff --git a/include/linux/extcon.h b/include/linux/extcon.h index
> >> c0f8c4fc5d45..c8dd881e2b8d 100644
> >> --- a/include/linux/extcon.h
> >> +++ b/include/linux/extcon.h
> >> @@ -31,32 +31,42 @@
> >> /*
> >> * Define the unique id of supported external connectors
> >> */
> >> -#define EXTCON_NONE 0
> >> -
> >> -#define EXTCON_USB 1 /* USB connector */
> >> -#define EXTCON_USB_HOST 2
> >> -
> >> -#define EXTCON_TA 3 /* Charger connector */
> >> -#define EXTCON_FAST_CHARGER 4
> >> -#define EXTCON_SLOW_CHARGER 5
> >> -#define EXTCON_CHARGE_DOWNSTREAM 6
> >> -
> >> -#define EXTCON_LINE_IN 7 /* Audio/Video
> >> connector */
> >> -#define EXTCON_LINE_OUT 8
> >> -#define EXTCON_MICROPHONE 9
> >> -#define EXTCON_HEADPHONE 10
> >> -#define EXTCON_HDMI 11
> >> -#define EXTCON_MHL 12
> >> -#define EXTCON_DVI 13
> >> -#define EXTCON_VGA 14
> >> -#define EXTCON_SPDIF_IN 15
> >> -#define EXTCON_SPDIF_OUT 16
> >> -#define EXTCON_VIDEO_IN 17
> >> -#define EXTCON_VIDEO_OUT 18
> >> -
> >> -#define EXTCON_DOCK 19 /* Misc connector */
> >> -#define EXTCON_JIG 20
> >> -#define EXTCON_MECHANICAL 21
> >> +#define EXTCON_NONE 0
> >> +
> >> +/* USB external connector */
> >> +#define EXTCON_USB 1 /* Universal Serial Bus */
> >> +#define EXTCON_USB_HOST 2
> >> +
> >> +/* Charging external connector */
> >> +#define EXTCON_CHG_USB 5 /* Standard Downstream Port
> >> */
> >> +#define EXTCON_CHG_USB_CDP 6 /* Charging Downstream Port
> >> */
> >> +#define EXTCON_CHG_USB_DCP 7 /* Dedicated Charging Port */
> >> +#define EXTCON_CHG_USB_DCP_FAST 8
> >> +#define EXTCON_CHG_USB_DCP_SLOW 9
> >> +#define EXTCON_CHG_USB_ACA 10 /* Accessory Charger Adapter
> >> */
> >> +
> >> +/* Jack external connector */
> >> +#define EXTCON_JACK_MICROPHONE 20
> >> +#define EXTCON_JACK_HEADPHONE 21
> >> +#define EXTCON_JACK_LINE_IN 22
> >> +#define EXTCON_JACK_LINE_OUT 23
> >> +#define EXTCON_JACK_VIDEO_IN 24
> >> +#define EXTCON_JACK_VIDEO_OUT 25
> >> +#define EXTCON_JACK_SPDIF_IN 26 /* Sony Philips Digital
> >> InterFace */
> >> +#define EXTCON_JACK_SPDIF_OUT 27
> >> +
> >> +/* Display external connector */
> >> +#define EXTCON_DISP_HDMI 40 /* High-Definition Multimedia
> >> Interface */
> >> +#define EXTCON_DISP_MHL 41 /* Mobile High-Definition Link
> >> */
> >> +#define EXTCON_DISP_DVI 42 /* Digital Visual Inteface */
> >> +#define EXTCON_DISP_VGA 43 /* Video Graphics Array */
> >> +
> >> +/* Miscellaneous external connector */
> >> +#define EXTCON_DOCK 60
> >> +#define EXTCON_JIG 61
> >> +#define EXTCON_MECHANICAL 62
> >> +
> >> +#define EXTCON_NUM 63
> >
> > Can we change the #define macro's to enum's? is there problem with that?
>
> It is possible. But, the unique id of external connector will be used on device tree
> file as following patch[1]. Following patch[1] defines the include/dt-
> bindings/extcon/extcon.h
> which is include in *.dts file. In *.dts file, we can not use the 'enum'.
> [1] https://lkml.org/lkml/2015/10/5/38
> So, I use the "#define" keyword instead of enum.
>
> I used the 'enum' on first patch to define the unique id but I altered it by using
> '#define' instead of 'enum' on following patch[2].
> [2] commit 73b6ecdb93e8e ("extcon: Redefine the unique id of supported
> external connectors without 'enum extcon' type")

Ok. Thanks.

-Ram