RE: [PATCH 1/2] extcon: Modify the id and name of external connector
> >> 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_USB1 /* 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_IN7 /* Audio/Video > >> connector */ > >> -#define EXTCON_LINE_OUT 8 > >> -#define EXTCON_MICROPHONE 9 > >> -#define EXTCON_HEADPHONE 10 > >> -#define EXTCON_HDMI 11 > >> -#define EXTCON_MHL12 > >> -#define EXTCON_DVI13 > >> -#define EXTCON_VGA14 > >> -#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_JIG20 > >> -#define EXTCON_MECHANICAL 21 > >> +#define EXTCON_NONE 0 > >> + > >> +/* USB external connector */ > >> +#define EXTCON_USB1 /* Universal Serial Bus */ > >> +#define EXTCON_USB_HOST 2 > >> + > >> +/* Charging external connector */ > >> +#define EXTCON_CHG_USB5 /* Standard Downstream Port > >> */ > >> +#define EXTCON_CHG_USB_CDP6 /* Charging Downstream Port > >> */ > >> +#define EXTCON_CHG_USB_DCP7 /* Dedicated Charging Port */ > >> +#define EXTCON_CHG_USB_DCP_FAST 8 > >> +#define EXTCON_CHG_USB_DCP_SLOW 9 > >> +#define EXTCON_CHG_USB_ACA10 /* Accessory Charger Adapter > >> */ > >> + > >> +/* Jack external connector */ > >> +#define EXTCON_JACK_MICROPHONE20 > >> +#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_JIG61 > >> +#define EXTCON_MECHANICAL 62 > >> + > >> +#define EXTCON_NUM63 > > > > 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
Re: [PATCH 1/2] extcon: Modify the id and name of external connector
Hi Ram, On 2015년 10월 06일 20:42, Pallala, Ramakrishna wrote: > Hi Choi, > > >> Subject: [PATCH 1/2] extcon: Modify the id and name of external connector >> >> This patch modifies the id and name of external connector with the additional >> prefix to clarify both attribute and meaning of external connector as >> following: >> - EXTCON_CHG_* mean the charger connector. >> - EXTCON_JACK_* mean the jack connector. >> - EXTCON_DISP_* mean the display port connector. >> >> Following table show the new name of external connector with old name: >> -- >> Old extcon name | New extcon name| >> -- >> EXTCON_TA | EXTCON_CHG_USB_DCP | >> EXTCON_FAST_CHARGER | EXTCON_CHG_USB_DCP_FAST| >> EXTCON_SLOW_CHARGER | EXTCON_CHG_USB_DCP_SLOW| >> EXTCON_CHARGE_DOWNSTREAM| EXTCON_CHG_USB_CDP | >> -- >> EXTCON_MICROPHONE | EXTCON_JACK_MICROPHONE | >> EXTCON_HEADPHONE| EXTCON_JACK_HEADPHONE | >> EXTCON_LINE_IN | EXTCON_JACK_LINE_IN| >> EXTCON_LINE_OUT | EXTCON_JACK_LINE_OUT | >> EXTCON_VIDEO_IN | EXTCON_JACK_VIDEO_IN | >> EXTCON_VIDEO_OUT| EXTCON_JACK_VIDEO_OUT | >> EXTCON_SPDIF_IN | EXTCON_JACK_SPDIF_IN | >> EXTCON_SPDIF_OUT| EXTCON_JACK_SPDIF_OUT | >> -- >> EXTCON_HMDI | EXTCON_DISP_HDMI | >> EXTCON_MHL | EXTCON_DISP_MHL| >> EXTCON_DVI | EXTCON_DISP_DVI| >> EXTCON_VGA | EXTCON_DISP_VGA| >> -- >> >> And, when altering the name of USB charger connector, EXTCON refers to the >> "Battery Charging v1.2 Spec and Adopters Agreement"[1] to use the standard >> name of USB charging port as following. Following name of USB charging port >> are already used in power_supply subsystem. We chan check it on patch[2]. >> - EXTCON_CHG_USB /* Standard Downstream Port */ >> - EXTCON_CHG_USB_DCP /* Dedicated Charging Port */ >> - EXTCON_CHG_USB_CDP /* Charging Downstream Port */ >> - EXTCON_CHG_USB_ACA /* Accessory Charger Adapter */ >> >> [1] www.usb.org/developers/docs/devclass_docs/BCv1.2_070312.zip >> [2] commit 85efc8a18ce ("[PATCH] power_supply: Add types for USB chargers") >> >> Signed-off-by: Chanwoo Choi >> [ckeepax: For the Arizona changes] >> Acked-by: Charles Keepax >> --- >> drivers/extcon/extcon-arizona.c | 18 ++-- >> drivers/extcon/extcon-axp288.c | 12 >> drivers/extcon/extcon-max14577.c | 17 +-- drivers/extcon/extcon- >> max77693.c | 32 +++-- drivers/extcon/extcon-max77843.c | 27 >> + drivers/extcon/extcon-max8997.c | 21 +++--- >> drivers/extcon/extcon-rt8973a.c | 4 +-- >> drivers/extcon/extcon-sm5502.c | 4 +-- >> drivers/extcon/extcon.c | 61 >> --- >> include/linux/extcon.h | 62 >> +++- >> 10 files changed, 139 insertions(+), 119 deletions(-) >> >> diff --git a/drivers/extcon/extcon-arizona.c >> b/drivers/extcon/extcon-arizona.c >> index a1ab0a56b798..e4890dd4fefd 100644 >> --- a/drivers/extcon/extcon-arizona.c >> +++ b/drivers/extcon/extcon-arizona.c >> @@ -137,9 +137,9 @@ static const int arizona_micd_levels[] = { >> >> static const unsigned int arizona_cable[] = { >> EXTCON_MECHANICAL, >> -EXTCON_MICROPHONE, >> -EXTCON_HEADPHONE, >> -EXTCON_LINE_OUT, >> +EXTCON_JACK_MICROPHONE, >> +EXTCON_JACK_HEADPHONE, >> +EXTCON_JACK_LINE_OUT, >> EXTCON_NONE, >> }; >> >> @@ -600,7 +600,7 @@ static irqreturn_t arizona_hpdet_irq(int irq, void *data) >> struct arizona_extcon_info *info = data; >> struct arizona *arizona = info->arizona; >> int id_gpio = arizona->pdata.hpdet_id_gpio; >> -unsigned int report = EXTCON_HEADPHONE; >> +unsigned int report = EXTCON_JACK_HEADPHONE; >> int ret, reading; >> bool mic = false; >> >> @@ -645,9 +645,9 @@ static irqreturn_t arizona_hpdet_irq(int irq, void *data) >> >> /* Report high impedence cables as line outputs */ >> if (reading >= 5000) >> -report = EXTCON_LINE_OUT; >> +report = EXTCON_JA
RE: [PATCH 1/2] extcon: Modify the id and name of external connector
Hi Choi, > Subject: [PATCH 1/2] extcon: Modify the id and name of external connector > > This patch modifies the id and name of external connector with the additional > prefix to clarify both attribute and meaning of external connector as > following: > - EXTCON_CHG_* mean the charger connector. > - EXTCON_JACK_* mean the jack connector. > - EXTCON_DISP_* mean the display port connector. > > Following table show the new name of external connector with old name: > -- > Old extcon name | New extcon name| > -- > EXTCON_TA | EXTCON_CHG_USB_DCP | > EXTCON_FAST_CHARGER | EXTCON_CHG_USB_DCP_FAST| > EXTCON_SLOW_CHARGER | EXTCON_CHG_USB_DCP_SLOW| > EXTCON_CHARGE_DOWNSTREAM| EXTCON_CHG_USB_CDP | > -- > EXTCON_MICROPHONE | EXTCON_JACK_MICROPHONE | > EXTCON_HEADPHONE| EXTCON_JACK_HEADPHONE | > EXTCON_LINE_IN | EXTCON_JACK_LINE_IN| > EXTCON_LINE_OUT | EXTCON_JACK_LINE_OUT | > EXTCON_VIDEO_IN | EXTCON_JACK_VIDEO_IN | > EXTCON_VIDEO_OUT| EXTCON_JACK_VIDEO_OUT | > EXTCON_SPDIF_IN | EXTCON_JACK_SPDIF_IN | > EXTCON_SPDIF_OUT| EXTCON_JACK_SPDIF_OUT | > -- > EXTCON_HMDI | EXTCON_DISP_HDMI | > EXTCON_MHL | EXTCON_DISP_MHL| > EXTCON_DVI | EXTCON_DISP_DVI| > EXTCON_VGA | EXTCON_DISP_VGA| > -- > > And, when altering the name of USB charger connector, EXTCON refers to the > "Battery Charging v1.2 Spec and Adopters Agreement"[1] to use the standard > name of USB charging port as following. Following name of USB charging port > are already used in power_supply subsystem. We chan check it on patch[2]. > - EXTCON_CHG_USB /* Standard Downstream Port */ > - EXTCON_CHG_USB_DCP /* Dedicated Charging Port */ > - EXTCON_CHG_USB_CDP /* Charging Downstream Port */ > - EXTCON_CHG_USB_ACA /* Accessory Charger Adapter */ > > [1] www.usb.org/developers/docs/devclass_docs/BCv1.2_070312.zip > [2] commit 85efc8a18ce ("[PATCH] power_supply: Add types for USB chargers") > > Signed-off-by: Chanwoo Choi > [ckeepax: For the Arizona changes] > Acked-by: Charles Keepax > --- > drivers/extcon/extcon-arizona.c | 18 ++-- > drivers/extcon/extcon-axp288.c | 12 > drivers/extcon/extcon-max14577.c | 17 +-- drivers/extcon/extcon- > max77693.c | 32 +++-- drivers/extcon/extcon-max77843.c | 27 > + drivers/extcon/extcon-max8997.c | 21 +++--- > drivers/extcon/extcon-rt8973a.c | 4 +-- > drivers/extcon/extcon-sm5502.c | 4 +-- > drivers/extcon/extcon.c | 61 --- > include/linux/extcon.h | 62 > +++- > 10 files changed, 139 insertions(+), 119 deletions(-) > > diff --git a/drivers/extcon/extcon-arizona.c b/drivers/extcon/extcon-arizona.c > index a1ab0a56b798..e4890dd4fefd 100644 > --- a/drivers/extcon/extcon-arizona.c > +++ b/drivers/extcon/extcon-arizona.c > @@ -137,9 +137,9 @@ static const int arizona_micd_levels[] = { > > static const unsigned int arizona_cable[] = { > EXTCON_MECHANICAL, > - EXTCON_MICROPHONE, > - EXTCON_HEADPHONE, > - EXTCON_LINE_OUT, > + EXTCON_JACK_MICROPHONE, > + EXTCON_JACK_HEADPHONE, > + EXTCON_JACK_LINE_OUT, > EXTCON_NONE, > }; > > @@ -600,7 +600,7 @@ static irqreturn_t arizona_hpdet_irq(int irq, void *data) > struct arizona_extcon_info *info = data; > struct arizona *arizona = info->arizona; > int id_gpio = arizona->pdata.hpdet_id_gpio; > - unsigned int report = EXTCON_HEADPHONE; > + unsigned int report = EXTCON_JACK_HEADPHONE; > int ret, reading; > bool mic = false; > > @@ -645,9 +645,9 @@ static irqreturn_t arizona_hpdet_irq(int irq, void *data) > > /* Report high impedence cables as line outputs */ > if (reading >= 5000) > - report = EXTCON_LINE_OUT; > + report = EXTCON_JACK_LINE_OUT; > else > - report = EXTCON_HEADPHONE; > + report = EXTCON_JACK_HEADPHONE; > > ret = extcon_set_cable_state_(info->edev, report, true); > if (ret != 0) > @@ -732,7 +732,7 @@ err: > ARIZONA_ACCDET_MODE_MASK, > ARIZONA_ACCDET_MODE_MIC); > > /* Just report headphone */ > - ret = extcon_set_cable_state_(info
[PATCH 1/2] extcon: Modify the id and name of external connector
This patch modifies the id and name of external connector with the additional prefix to clarify both attribute and meaning of external connector as following: - EXTCON_CHG_* mean the charger connector. - EXTCON_JACK_* mean the jack connector. - EXTCON_DISP_* mean the display port connector. Following table show the new name of external connector with old name: -- Old extcon name | New extcon name| -- EXTCON_TA | EXTCON_CHG_USB_DCP | EXTCON_FAST_CHARGER | EXTCON_CHG_USB_DCP_FAST| EXTCON_SLOW_CHARGER | EXTCON_CHG_USB_DCP_SLOW| EXTCON_CHARGE_DOWNSTREAM| EXTCON_CHG_USB_CDP | -- EXTCON_MICROPHONE | EXTCON_JACK_MICROPHONE | EXTCON_HEADPHONE| EXTCON_JACK_HEADPHONE | EXTCON_LINE_IN | EXTCON_JACK_LINE_IN| EXTCON_LINE_OUT | EXTCON_JACK_LINE_OUT | EXTCON_VIDEO_IN | EXTCON_JACK_VIDEO_IN | EXTCON_VIDEO_OUT| EXTCON_JACK_VIDEO_OUT | EXTCON_SPDIF_IN | EXTCON_JACK_SPDIF_IN | EXTCON_SPDIF_OUT| EXTCON_JACK_SPDIF_OUT | -- EXTCON_HMDI | EXTCON_DISP_HDMI | EXTCON_MHL | EXTCON_DISP_MHL| EXTCON_DVI | EXTCON_DISP_DVI| EXTCON_VGA | EXTCON_DISP_VGA| -- And, when altering the name of USB charger connector, EXTCON refers to the "Battery Charging v1.2 Spec and Adopters Agreement"[1] to use the standard name of USB charging port as following. Following name of USB charging port are already used in power_supply subsystem. We chan check it on patch[2]. - EXTCON_CHG_USB/* Standard Downstream Port */ - EXTCON_CHG_USB_DCP/* Dedicated Charging Port */ - EXTCON_CHG_USB_CDP/* Charging Downstream Port */ - EXTCON_CHG_USB_ACA/* Accessory Charger Adapter */ [1] www.usb.org/developers/docs/devclass_docs/BCv1.2_070312.zip [2] commit 85efc8a18ce ("[PATCH] power_supply: Add types for USB chargers") Signed-off-by: Chanwoo Choi [ckeepax: For the Arizona changes] Acked-by: Charles Keepax --- drivers/extcon/extcon-arizona.c | 18 ++-- drivers/extcon/extcon-axp288.c | 12 drivers/extcon/extcon-max14577.c | 17 +-- drivers/extcon/extcon-max77693.c | 32 +++-- drivers/extcon/extcon-max77843.c | 27 + drivers/extcon/extcon-max8997.c | 21 +++--- drivers/extcon/extcon-rt8973a.c | 4 +-- drivers/extcon/extcon-sm5502.c | 4 +-- drivers/extcon/extcon.c | 61 --- include/linux/extcon.h | 62 +++- 10 files changed, 139 insertions(+), 119 deletions(-) diff --git a/drivers/extcon/extcon-arizona.c b/drivers/extcon/extcon-arizona.c index a1ab0a56b798..e4890dd4fefd 100644 --- a/drivers/extcon/extcon-arizona.c +++ b/drivers/extcon/extcon-arizona.c @@ -137,9 +137,9 @@ static const int arizona_micd_levels[] = { static const unsigned int arizona_cable[] = { EXTCON_MECHANICAL, - EXTCON_MICROPHONE, - EXTCON_HEADPHONE, - EXTCON_LINE_OUT, + EXTCON_JACK_MICROPHONE, + EXTCON_JACK_HEADPHONE, + EXTCON_JACK_LINE_OUT, EXTCON_NONE, }; @@ -600,7 +600,7 @@ static irqreturn_t arizona_hpdet_irq(int irq, void *data) struct arizona_extcon_info *info = data; struct arizona *arizona = info->arizona; int id_gpio = arizona->pdata.hpdet_id_gpio; - unsigned int report = EXTCON_HEADPHONE; + unsigned int report = EXTCON_JACK_HEADPHONE; int ret, reading; bool mic = false; @@ -645,9 +645,9 @@ static irqreturn_t arizona_hpdet_irq(int irq, void *data) /* Report high impedence cables as line outputs */ if (reading >= 5000) - report = EXTCON_LINE_OUT; + report = EXTCON_JACK_LINE_OUT; else - report = EXTCON_HEADPHONE; + report = EXTCON_JACK_HEADPHONE; ret = extcon_set_cable_state_(info->edev, report, true); if (ret != 0) @@ -732,7 +732,7 @@ err: ARIZONA_ACCDET_MODE_MASK, ARIZONA_ACCDET_MODE_MIC); /* Just report headphone */ - ret = extcon_set_cable_state_(info->edev, EXTCON_HEADPHONE, true); + ret = extcon_set_cable_state_(info->edev, EXTCON_JACK_HEADPHONE, true); if (ret != 0) dev_err(arizona->dev, "Failed to report headphone: %d\n", ret); @@ -789,7 +789,7 @@ err: ARIZONA_ACCDET_MODE_MASK, ARIZONA_ACCDET_MODE_MIC); /* Just report headphone */ - ret = extcon_set_cable_state_(info->edev, EXTCON_HEADPHONE, true); + ret = extcon_set_cable_state_(info->edev, EXTCON_JACK_HEADPHONE, true); if (ret != 0) dev_err(arizona->dev, "Failed