Re: [PATCH 1/2] extcon: Use the unique id for external connector instead of string

Krzysztof Kozlowski
2015-05-17T09:09:43Z

--george.cherian@ti.com
Mail bounces.

2015-05-17 16:53 GMT+09:00 Chanwoo Choi <cwchoi00@gmail.com>:
> Hi Krzysztof,
>
> On Sun, May 17, 2015 at 4:10 PM, Krzysztof Kozlowski
>>> @@ -32,36 +35,43 @@
>>> #include <linux/slab.h>
>>> #include <linux/sysfs.h>
>>>
>>> -/*
>>> - * extcon_cable_name suggests the standard cable names for commonly used
>>> - * cable types.
>>> - *
>>> - * However, please do not use extcon_cable_name directly for extcon_dev
>>> - * struct's supported_cable pointer unless your device really supports
>>> - * every single port-type of the following cable names. Please choose cable
>>> - * names that are actually used in your extcon device.
>>> - */
>>> -const char extcon_cable_name[][CABLE_NAME_MAX + 1] = {
>>> +#define SUPPORTED_CABLE_MAX 32
>>
>> Why only 32 cables are supported? I mean what is the reason behind the
>> hard limit?
>
> Current extcon core use the 32bit variable to identify the supported
> external connectors of each extcon device. But, the number of
> supported connectors should be updated. I have the plan about it.

I get it, it is related to 'state' variable which is u32 now.

>
>>
>>> +#define CABLE_NAME_MAX 30
>>> +
>>> +static const char *extcon_name[] = {
>>> + [EXTCON_NONE] = "NONE",
>>> +
>>> + /* USB external connector */
>>> [EXTCON_USB] = "USB",
>>> - [EXTCON_USB_HOST] = "USB-Host",
>>> + [EXTCON_USB_HOST] = "USB-HOST",
>>> +
>>> + /* Charger external connector */
>>> [EXTCON_TA] = "TA",
>>> - [EXTCON_FAST_CHARGER] = "Fast-charger",
>>> - [EXTCON_SLOW_CHARGER] = "Slow-charger",
>>> - [EXTCON_CHARGE_DOWNSTREAM] = "Charge-downstream",
>>> + [EXTCON_FAST_CHARGER] = "FAST-CHARGER",
>>> + [EXTCON_SLOW_CHARGER] = "SLOW-CHARGER",
>>> + [EXTCON_CHARGE_DOWNSTREAM] = "CHARGE-DOWNSTREAM",
>>> +
>>> + /* Audio/Video external connector */
>>> + [EXTCON_LINE_IN] = "LINE-IN",
>>> + [EXTCON_LINE_OUT] = "LINE-OUT",
>>> + [EXTCON_MICROPHONE] = "MICROPHONE",
>>> + [EXTCON_HEADPHONE] = "HEADPHONE",
>>> +
>>> [EXTCON_HDMI] = "HDMI",
>>> [EXTCON_MHL] = "MHL",
>>> [EXTCON_DVI] = "DVI",
>>> [EXTCON_VGA] = "VGA",
>>> - [EXTCON_DOCK] = "Dock",
>>> - [EXTCON_LINE_IN] = "Line-in",
>>> - [EXTCON_LINE_OUT] = "Line-out",
>>> - [EXTCON_MIC_IN] = "Microphone",
>>> - [EXTCON_HEADPHONE_OUT] = "Headphone",
>>> - [EXTCON_SPDIF_IN] = "SPDIF-in",
>>> - [EXTCON_SPDIF_OUT] = "SPDIF-out",
>>> - [EXTCON_VIDEO_IN] = "Video-in",
>>> - [EXTCON_VIDEO_OUT] = "Video-out",
>>> - [EXTCON_MECHANICAL] = "Mechanical",
>>> + [EXTCON_SPDIF_IN] = "SPDIF-IN",
>>> + [EXTCON_SPDIF_OUT] = "SPDIF-OUT",
>>> + [EXTCON_VIDEO_IN] = "VIDEO-IN",
>>> + [EXTCON_VIDEO_OUT] = "VIDEO-OUT",
>>> +
>>> + /* Etc external connector */
>>> + [EXTCON_DOCK] = "DOCK",
>>> + [EXTCON_JIG] = "JIG",
>>> + [EXTCON_MECHANICAL] = "MECHANICAL",
>>> +
>>> + NULL,
>>> };
>>
>> This change does not look related to the topic. Can you split it to
>> separate patch?
>
> Do you mean about changing the name of external connectors from small
> letter to capital letter?

Yes. This should be separate commit.

Best regards,
Krzysztof