Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1453539 > unrolled thread
| Started by | Chanwoo Choi <cw00.choi@samsung.com> |
|---|---|
| First post | 2016-08-02 04:00 +0200 |
| Last post | 2016-08-02 10:00 +0200 |
| Articles | 3 — 2 participants |
Back to article view | Back to linux.kernel
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
[PATCH v3 1/6] extcon: Add the extcon_type to gather each connector into five category Chanwoo Choi <cw00.choi@samsung.com> - 2016-08-02 04:00 +0200
Re: [PATCH v3 1/6] extcon: Add the extcon_type to gather each connector into five category Chanwoo Choi <cw00.choi@samsung.com> - 2016-08-02 09:50 +0200
Re: [PATCH v3 1/6] extcon: Add the extcon_type to gather each connector into five category Roger Quadros <rogerq@ti.com> - 2016-08-02 10:00 +0200
| From | Chanwoo Choi <cw00.choi@samsung.com> |
|---|---|
| Date | 2016-08-02 04:00 +0200 |
| Subject | [PATCH v3 1/6] extcon: Add the extcon_type to gather each connector into five category |
| Message-ID | <s1x9T-65C-1@gated-at.bofh.it> |
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.choi@samsung.com>
Tested-by: Chris Zhong <zyw@rock-chips.com>
Tested-by: Guenter Roeck <groeck@chromium.org>
Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
Reviewed-by: Guenter Roeck <groeck@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",
+ },
/* Charging external connector */
- [EXTCON_CHG_USB_SDP] = "SDP",
- [EXTCON_CHG_USB_DCP] = "DCP",
- [EXTCON_CHG_USB_CDP] = "CDP",
- [EXTCON_CHG_USB_ACA] = "ACA",
- [EXTCON_CHG_USB_FAST] = "FAST-CHARGER",
- [EXTCON_CHG_USB_SLOW] = "SLOW-CHARGER",
+ [EXTCON_CHG_USB_SDP] = {
+ .type = EXTCON_TYPE_CHG | EXTCON_TYPE_USB,
+ .id = EXTCON_CHG_USB_SDP,
+ .name = "SDP",
+ },
+ [EXTCON_CHG_USB_DCP] = {
+ .type = EXTCON_TYPE_CHG | EXTCON_TYPE_USB,
+ .id = EXTCON_CHG_USB_DCP,
+ .name = "DCP",
+ },
+ [EXTCON_CHG_USB_CDP] = {
+ .type = EXTCON_TYPE_CHG | EXTCON_TYPE_USB,
+ .id = EXTCON_CHG_USB_CDP,
+ .name = "CDP",
+ },
+ [EXTCON_CHG_USB_ACA] = {
+ .type = EXTCON_TYPE_CHG | EXTCON_TYPE_USB,
+ .id = EXTCON_CHG_USB_ACA,
+ .name = "ACA",
+ },
+ [EXTCON_CHG_USB_FAST] = {
+ .type = EXTCON_TYPE_CHG | EXTCON_TYPE_USB,
+ .id = EXTCON_CHG_USB_FAST,
+ .name = "FAST-CHARGER",
+ },
+ [EXTCON_CHG_USB_SLOW] = {
+ .type = EXTCON_TYPE_CHG | EXTCON_TYPE_USB,
+ .id = EXTCON_CHG_USB_SLOW,
+ .name = "SLOW-CHARGER",
+ },
/* Jack external connector */
- [EXTCON_JACK_MICROPHONE] = "MICROPHONE",
- [EXTCON_JACK_HEADPHONE] = "HEADPHONE",
- [EXTCON_JACK_LINE_IN] = "LINE-IN",
- [EXTCON_JACK_LINE_OUT] = "LINE-OUT",
- [EXTCON_JACK_VIDEO_IN] = "VIDEO-IN",
- [EXTCON_JACK_VIDEO_OUT] = "VIDEO-OUT",
- [EXTCON_JACK_SPDIF_IN] = "SPDIF-IN",
- [EXTCON_JACK_SPDIF_OUT] = "SPDIF-OUT",
+ [EXTCON_JACK_MICROPHONE] = {
+ .type = EXTCON_TYPE_JACK,
+ .id = EXTCON_JACK_MICROPHONE,
+ .name = "MICROPHONE",
+ },
+ [EXTCON_JACK_HEADPHONE] = {
+ .type = EXTCON_TYPE_JACK,
+ .id = EXTCON_JACK_HEADPHONE,
+ .name = "HEADPHONE",
+ },
+ [EXTCON_JACK_LINE_IN] = {
+ .type = EXTCON_TYPE_JACK,
+ .id = EXTCON_JACK_LINE_IN,
+ .name = "LINE-IN",
+ },
+ [EXTCON_JACK_LINE_OUT] = {
+ .type = EXTCON_TYPE_JACK,
+ .id = EXTCON_JACK_LINE_OUT,
+ .name = "LINE-OUT",
+ },
+ [EXTCON_JACK_VIDEO_IN] = {
+ .type = EXTCON_TYPE_JACK,
+ .id = EXTCON_JACK_VIDEO_IN,
+ .name = "VIDEO-IN",
+ },
+ [EXTCON_JACK_VIDEO_OUT] = {
+ .type = EXTCON_TYPE_JACK,
+ .id = EXTCON_JACK_VIDEO_OUT,
+ .name = "VIDEO-OUT",
+ },
+ [EXTCON_JACK_SPDIF_IN] = {
+ .type = EXTCON_TYPE_JACK,
+ .id = EXTCON_JACK_SPDIF_IN,
+ .name = "SPDIF-IN",
+ },
+ [EXTCON_JACK_SPDIF_OUT] = {
+ .type = EXTCON_TYPE_JACK,
+ .id = EXTCON_JACK_SPDIF_OUT,
+ .name = "SPDIF-OUT",
+ },
/* Display external connector */
- [EXTCON_DISP_HDMI] = "HDMI",
- [EXTCON_DISP_MHL] = "MHL",
- [EXTCON_DISP_DVI] = "DVI",
- [EXTCON_DISP_VGA] = "VGA",
+ [EXTCON_DISP_HDMI] = {
+ .type = EXTCON_TYPE_DISP,
+ .id = EXTCON_DISP_HDMI,
+ .name = "HDMI",
+ },
+ [EXTCON_DISP_MHL] = {
+ .type = EXTCON_TYPE_DISP,
+ .id = EXTCON_DISP_MHL,
+ .name = "MHL",
+ },
+ [EXTCON_DISP_DVI] = {
+ .type = EXTCON_TYPE_DISP,
+ .id = EXTCON_DISP_DVI,
+ .name = "DVI",
+ },
+ [EXTCON_DISP_VGA] = {
+ .type = EXTCON_TYPE_DISP,
+ .id = EXTCON_DISP_VGA,
+ .name = "VGA",
+ },
/* Miscellaneous external connector */
- [EXTCON_DOCK] = "DOCK",
- [EXTCON_JIG] = "JIG",
- [EXTCON_MECHANICAL] = "MECHANICAL",
-
- NULL,
+ [EXTCON_DOCK] = {
+ .type = EXTCON_TYPE_MISC,
+ .id = EXTCON_DOCK,
+ .name = "DOCK",
+ },
+ [EXTCON_JIG] = {
+ .type = EXTCON_TYPE_MISC,
+ .id = EXTCON_JIG,
+ .name = "JIG",
+ },
+ [EXTCON_MECHANICAL] = {
+ .type = EXTCON_TYPE_MISC,
+ .id = EXTCON_MECHANICAL,
+ .name = "MECHANICAL",
+ },
+
+ { /* sentinel */ }
};
/**
@@ -168,7 +269,7 @@ static ssize_t state_show(struct device *dev, struct device_attribute *attr,
for (i = 0; i < edev->max_supported; i++) {
count += sprintf(buf + count, "%s=%d\n",
- extcon_name[edev->supported_cable[i]],
+ extcon_info[edev->supported_cable[i]].name,
!!(edev->state & (1 << i)));
}
@@ -193,7 +294,7 @@ static ssize_t cable_name_show(struct device *dev,
int i = cable->cable_index;
return sprintf(buf, "%s\n",
- extcon_name[cable->edev->supported_cable[i]]);
+ extcon_info[cable->edev->supported_cable[i]].name);
}
static ssize_t cable_state_show(struct device *dev,
diff --git a/include/linux/extcon.h b/include/linux/extcon.h
index 667b1d35af12..46d802892c82 100644
--- a/include/linux/extcon.h
+++ b/include/linux/extcon.h
@@ -29,6 +29,15 @@
#include <linux/device.h>
/*
+ * Define the type of supported external connectors
+ */
+#define EXTCON_TYPE_USB BIT(0) /* USB connector */
+#define EXTCON_TYPE_CHG BIT(1) /* Charger connector */
+#define EXTCON_TYPE_JACK BIT(2) /* Jack connector */
+#define EXTCON_TYPE_DISP BIT(3) /* Display connector */
+#define EXTCON_TYPE_MISC BIT(4) /* Miscellaneous connector */
+
+/*
* Define the unique id of supported external connectors
*/
#define EXTCON_NONE 0
--
1.9.1
[toc] | [next] | [standalone]
| From | Chanwoo Choi <cw00.choi@samsung.com> |
|---|---|
| Date | 2016-08-02 09:50 +0200 |
| Subject | Re: [PATCH v3 1/6] extcon: Add the extcon_type to gather each connector into five category |
| Message-ID | <s1CCB-1s4-3@gated-at.bofh.it> |
| In reply to | #1453539 |
Hi Roger,
On 2016년 08월 02일 16:27, Roger Quadros wrote:
> 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.choi@samsung.com>
>> Tested-by: Chris Zhong <zyw@rock-chips.com>
>> Tested-by: Guenter Roeck <groeck@chromium.org>
>> Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
>> Reviewed-by: Guenter Roeck <groeck@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.
It is my mistake. I'll fix it.
.id = EXTCON_USB, -> .id = EXTCON_USB_HOST,
On the user-space, the process don't handle the ID and VBUS information directly.
they need the identical type of attached external connector.
For exmaple,
The extcon separate the following two case:
- mobile phone is connected to desktop pc.
- mobile phone is connected to mouse/keyboard with otg cable.
Regards,
Chanwoo Choi
[toc] | [prev] | [next] | [standalone]
| From | Roger Quadros <rogerq@ti.com> |
|---|---|
| Date | 2016-08-02 10:00 +0200 |
| Subject | Re: [PATCH v3 1/6] extcon: Add the extcon_type to gather each connector into five category |
| Message-ID | <s1CCB-1s4-7@gated-at.bofh.it> |
| In reply to | #1453539 |
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.choi@samsung.com>
> Tested-by: Chris Zhong <zyw@rock-chips.com>
> Tested-by: Guenter Roeck <groeck@chromium.org>
> Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
> Reviewed-by: Guenter Roeck <groeck@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
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web