extcon : callback function to read cable property
PATCH 1/1 extcon : callback function to read cable property
For some cables a boolean variable will not be enough to represent the state and properties of the cable. For example a charger cable can have states CONNECT,DISCOONECT,SUSPEND(Host suspend for SDP cable), RESUME(Host wakeup), and UPDATE (to increase the charge current after USB enumaeration).Also the properties of the cable may vary based on the state. FOr example in SUSPENDED state platforms can support 0/100/500/950(USB 3.0) mA based on the HW. To initiate charging the consumer should be able to get the charger properties dynamically.
--- include/linux/extcon.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+)
include/linux/extcon.h +14 -0
@@ -122,6 +122,7 @@ struct extcon_dev {/* --- Optional callbacks to override class functions --- */ ssize_t (*print_name)(struct extcon_dev *edev,char *buf);ssize_t (*print_state)(struct extcon_dev *edev,char *buf); +int (*get_cable_properties)(const char *cable_name,void *cable_props);/* --- Internal data. Please do not set. --- */ struct device *dev;
@@ -177,6 +178,19 @@ struct extcon_specific_cable_nb {unsigned long previous_value; }; +enum extcon_chrgr_cbl_stat { +EXTCON_CHRGR_CABLE_CONNECTED , +EXTCON_CHRGR_CABLE_DISCONNECTED , +EXTCON_CHRGR_CABLE_SUSPENDED , +EXTCON_CHRGR_CABLE_RESUMED , +EXTCON_CHRGR_CABLE_UPDATED , +}; + +struct extcon_chrgr_cbl_props { +enum extcon_chrgr_cbl_stat cable_stat; +unsigned long mA; +}; +#if IS_ENABLED (CONFIG_EXTCON )/*
Signature · 1 line
1.7.9.5
Quoted 27 lines · Jenny TC
For some cables a boolean variable will not be enough to represent the state and properties of the cable. For example a charger cable can have states CONNECT,DISCOONECT,SUSPEND(Host suspend for SDP cable), RESUME(Host wakeup), and UPDATE (to increase the charge current after USB enumaeration).Also the properties of the cable may vary based on the state. FOr example in SUSPENDED state platforms can support 0/100/500/950(USB 3.0) mA based on the HW. To initiate charging the consumer should be able to get the charger properties dynamically.
Signed-off-by Jenny TC <[email protected]>--- include/linux/extcon.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+)include/linux/extcon.h +1
-0@@ -122,6 +122,7 @@ struct extcon_dev {/* --- Optional callbacks to override class functions --- */ ssize_t (*print_name)(struct extcon_dev *edev,char *buf);ssize_t (*print_state)(struct extcon_dev *edev,char *buf); +int (*get_cable_properties)(const char *cable_name,void *cable_props);/* --- Internal data. Please do not set. --- */ struct device *dev;
include/linux/extcon.h struct extcon_specific_cable_nb { · line 187
Quoted 10 lines
include/linux/extcon.h +7
-0@@ -177,6 +178,19 @@ struct extcon_specific_cable_nb {unsigned long previous_value; }; +enum extcon_chrgr_cbl_stat { +EXTCON_CHRGR_CABLE_CONNECTED , +EXTCON_CHRGR_CABLE_DISCONNECTED , +EXTCON_CHRGR_CABLE_SUSPENDED , +EXTCON_CHRGR_CABLE_RESUMED , +EXTCON_CHRGR_CABLE_UPDATED , +};
I think the reason why we have extcon is in first place is to only notify the clients of cable connection and disconnection and it is up to the client to decide what else to do with the cable such as finding which state it is in and other details.
So I feel this should not be handled in the extcon.
However it is up to the maintainer to decide.
Quoted 9 lines
include/linux/extcon.h +6
-0+ +struct extcon_chrgr_cbl_props { +enum extcon_chrgr_cbl_stat cable_stat; +unsigned long mA; +}; +#if IS_ENABLED (CONFIG_EXTCON )/*
Quoted 7 lines
From: anish kumar [mailto:[email protected]]
Sent: Wednesday, October 10, 2012 8:15 PM
To: Tc, Jenny
Cc: [email protected]; [email protected]; linux- [email protected]
Subject: Re: [PATCH] extcon : callback function to read cable property
Quoted 7 lines
I think the reason why we have extcon is in first place is to only notify the clients of cable connection and disconnection and it is up to the client to decide what else to do with the cable such as finding which state it is in and other details.
So I feel this should not be handled in the extcon.However it is up to the maintainer to decide.
Once the consumer gets the notification, it needs to take some action. One of the action is to read the cable properties. This can be done by proprietary calls which is known both to the consumer and the provider. My intention is to avoid this proprietary calls. Since both the provider and consumer are communicating with the extcon subsystem , I feel having a callback function of this kind would help to avoid the use of proprietary calls. Also I agree that extcon notifier chains are used to notify the cable state (attach/detach). But if a cable has more than two states (like the charger cable) how do we support it without having a callback function like this? Let the maintainer take the final decision.
���{.n�+�������+%�����ݶ��w��{.n�+����{��G�����{ay�ʇڙ�,j��f���h��������z_�(�階�ݢj"���m������G������?����&���~��iO��z��v�^�m����������?�I�
Quoted 15 lines · Jenny
Quoted 7 lines
From: anish kumar [mailto:[email protected]]
Sent: Wednesday, October 10, 2012 8:15 PM
To: Tc, Jenny
Cc: [email protected]; [email protected]; linux- [email protected]
Subject: Re: [PATCH] extcon : callback function to read cable propertyQuoted 7 lines
I think the reason why we have extcon is in first place is to only notify the clients of cable connection and disconnection and it is up to the client to decide what else to do with the cable such as finding which state it is in and other details.
So I feel this should not be handled in the extcon.However it is up to the maintainer to decide.
Quoted 10 lines
Once the consumer gets the notification, it needs to take some action. One of the action is to read the cable properties. This can be done by proprietary calls which is known both to the consumer and the provider. My intention is to avoid this proprietary calls. Since both the provider and consumer are communicating with the extcon subsystem , I feel having a callback function of this kind would help to avoid the use of proprietary calls. Also I agree that extcon notifier chains are used to notify the cable state (attach/detach). But if a cable has more than two states (like the charger cable) how do we support it without having a callback function like this? Let the maintainer take the final decision.
Well this use case will keep on growing if we start factor in this kind of changes and that is why I am opposed to adding any other state. Maintainer?
Quoted 2 lines
Myunjoo/Chanwoo
Ping...
Could you please review this patch?
-jtc
Quoted 20 lines
Quoted 11 lines
Quoted 10 lines
Subject: Re: [PATCH] extcon : callback function to read cable property
I think the reason why we have extcon is in first place is to only notify the clients of cable connection and disconnection and it is up to the client to decide what else to do with the cable such as finding which state it is in and other details.
So I feel this should not be handled in the extcon.However it is up to the maintainer to decide.
Quoted 9 lines
Once the consumer gets the notification, it needs to take some action. One of the action is to read the cable properties. This can be done by proprietary calls which is known both to the consumer and the provider. My intention is to avoid this proprietary calls. Since both the provider and consumer are communicating with the extcon subsystem , I feel having a callback function of this kind would help to avoid the use of proprietary calls. Also I agree that extcon notifier chains are used to notify the cable state (attach/detach). But if a cable has more than two states (like the charger cable) how do we support it without
Quoted 8 lines
having a callback function like this?
Quoted 1 line
Let the maintainer take the final decision.
Well this use case will keep on growing if we start factor in this kind of changes and that is why I am opposed to adding any other state. Maintainer?
Quoted 2 lines
���{.n�+�������+%�����ݶ��w��{.n�+����{��G�����{ay�ʇڙ�,j��f���h��������z_�(�階�ݢj"���m������G������?����&���~��iO��z��v�^�m����������?�I�
Chanwoo Choi
maintainerQuoted 20 lines · Jenny
Quoted 20 lines
Quoted 20 lines
Quoted 10 lines
Subject: Re: [PATCH] extcon : callback function to read cable property
I think the reason why we have extcon is in first place is to only notify the clients of cable connection and disconnection and it is up to the client to decide what else to do with the cable such as finding which state it is in and other details.
So I feel this should not be handled in the extcon.However it is up to the maintainer to decide.
Once the consumer gets the notification, it needs to take some action. One of the action is to read the cable properties. This can be done by proprietary calls which is known both to the consumer and the provider. My intention is to avoid this proprietary calls. Since both the provider and consumer are communicating with the extcon subsystem , I feel having a callback function of this kind would help to avoid the use of proprietary calls. Also I agree that extcon notifier chains are used to notify the cable state (attach/detach). But if a cable has more than two states (like the charger cable) how do we support it without
Quoted 6 lines
Quoted 6 lines
having a callback function like this?
Quoted 1 line
Let the maintainer take the final decision.
Well this use case will keep on growing if we start factor in this kind of changes and that is why I am opposed to adding any other state. Maintainer?
Quoted 1 line
I think that the role of extcon subsystem notify changed state(attached/detached) of cable to notifiee, but if you want to add property feature of cable, you should solve ambiguous issues.
First,
This patch only support the properties of charger cable but, never support property of other cable. The following structure depend on only charger cable. We can check it the following structure:
struct extcon_chrg_cbl_props {
enum extcon_chrgr_cbl_stat cable_state;
unsigned long mA;
};I think that the patch have to support all of cables for property feature.
Second,
Certainly, you should define common properties of all cables and specific properties of each cable. The properties of charger cable should never be defined only.
Third,
If we finish to decide the properties for all cables, I'd like to see a example code.
You explained following changed state of USB according to Host state on other patch.
---------------------------
For USB2.0
1) CONNECT (100mA)->UPDATE(500mA)->DISCONNECT(0mA)
2) CONNECT (100mA)->UPDATE(500mA)->HOST SUSPEND(2.5mA/500mA)->DISCONNECT(0mA)
3) CONNECT (100mA)->UPDATE(500mA)->HOST SUSPEND(2.5mA/500mA)->HOST RESUME(500mA)->DISCONNECT(0mA)
For USB 3.0
4) CONNECT (150mA)->UPDATE(900mA)->DISCONNECT(0mA)
5) CONNECT (150mA)->UPDATE(900mA)-> HOST SUSPEND(2.5mA/900mA)->DISCONNECT(0mA)
6) CONNECT (100mA)->UPDATE(900mA)->HOST SUSPEND(2.5mA/900mA)->HOST RESUME(900mA)->DISCONNECT(0mA)
---------------------------
I have a question. Can the provider device driver(e.g., extcon-max77693.c/ extcon-max8997.c) detect the changed state of host? I'd like to see the example device driver that the provider device driver detect changed state of host. Could you provide example device driver?
Thanks,
Chanwoo Choi
Quoted 8 lines
I think that the role of extcon subsystem notify changed state(attached/detached) of cable to notifiee, but if you want to add property feature of cable, you should solve ambiguous issues.
First,
This patch only support the properties of charger cable but, never support property of other cable. The following structure depend on only charger cable. We can check it the following structure:
Quoted 6 lines
struct extcon_chrg_cbl_props { enum extcon_chrgr_cbl_stat cable_state; unsigned long mA; };I think that the patch have to support all of cables for property feature.
My suggestion is to have a structure like this
struct extcon_cablel_props {
unsigned int cable_state;
unsigned int data;
}Not all cables will have more than two states. If any cable has more than two states, the above structure makes it flexible to represent additional state and the data associated
Quoted 5 lines
Second,
Certainly, you should define common properties of all cables and specific properties of each cable. The properties of charger cable should never be defined only.
Hope above structure would be enough to represent the common cable state and
it's data. If a cable has more than two states, then extcon_update_state can be used to
notify the consumer
1)Provider can just toggle the "state" argument to notify the consumer that cable state is changed
OR
2) Add one more argument like extcon_update_state(struct extcon_dev *edev, u32 mask, u32 state1, u32 sate2) If the state2 is set, then consumers can use get_cable_properties() to query the cable properties. State2 need to be used only if the cable need to represent more than two state
Quoted 4 lines
Third,
If we finish to decide the properties for all cables, I'd like to see a example code.
Agreed. If we agree on the above structure, I can modify the charging subsystem patch to use the same structure. (https://lkml.org/lkml/2012/10/18/219). This would give a reference for the new feature.
Quoted 16 lines
You explained following changed state of USB according to Host state on other patch.
---------------------------
For USB2.0
1) CONNECT (100mA)->UPDATE(500mA)->DISCONNECT(0mA)
2) CONNECT (100mA)->UPDATE(500mA)->HOST SUSPEND(2.5mA/500mA)-Quoted 1 line
DISCONNECT(0mA)
3) CONNECT (100mA)->UPDATE(500mA)->HOST SUSPEND(2.5mA/500mA)-
Quoted 1 line
HOST RESUME(500mA)->DISCONNECT(0mA)
For USB 3.0
4) CONNECT (150mA)->UPDATE(900mA)->DISCONNECT(0mA)
5) CONNECT (150mA)->UPDATE(900mA)-> HOST SUSPEND(2.5mA/900mA)-Quoted 1 line
DISCONNECT(0mA)
6) CONNECT (100mA)->UPDATE(900mA)->HOST SUSPEND(2.5mA/900mA)-
Quoted 8 lines
Quoted 1 line
HOST RESUME(900mA)->DISCONNECT(0mA)
---------------------------
I have a question. Can the provider device
driver(e.g., extcon-max77693.c/ extcon-max8997.c)detect the changed state of host? I'd like to see the example device driver that the provider device driver detect changed state of host.
Could you provide example device driver?
Good question. The OTG drivers are capable of identifying the SUSPEND event. System cannot setup SDP (USB host) charging with maximum charging current - 500mA (USB2.0/ 900mA(USB 3)) without enumerating the USB. The USB enumeration can be done only with a USB/OTG driver. IMHO the above extcon drivers (extcon-max77693.c/ extcon-max8997.c) are not capable of doing the USB enumeration and identifying the charge current. They can just identify the charger type - SDP/DCP/CDP/ACA/AC. The intelligence for USB enumeration
should be inside USB/OTG driver.
���{.n�+�������+%�����ݶ��w��{.n�+����{��G�����{ay�ʇڙ�,j��f���h��������z_�(�階�ݢj"���m������G������?����&���~��iO��z��v�^�m����������?�I�
Quoted 13 lines · Jenny
Quoted 13 lines
I think that the role of extcon subsystem notify changed state(attached/detached) of cable to notifiee, but if you want to add property feature of cable, you should solve ambiguous issues.
First,
This patch only support the properties of charger cable but, never support property of other cable. The following structure depend on only charger cable. We can check it the following structure:struct extcon_chrg_cbl_props { enum extcon_chrgr_cbl_stat cable_state; unsigned long mA; };
Quoted 7 lines
Quoted 1 line
I think that the patch have to support all of cables for property feature.
My suggestion is to have a structure like this
struct extcon_cablel_props { unsigned int cable_state; unsigned int data;
Why can't it be float/long/double??
Quoted 9 lines
}
Not all cables will have more than two states. If any cable has more than two states, the above structure makes it flexible to represent additional state and the data associatedQuoted 5 lines
Second,
Certainly, you should define common properties of all cables and specific properties of each cable. The properties of charger cable should never be defined only.
IMHO the extcon doesn't know anything about the cable except the state which is currently it is in and which also is set by the provider.I am unable to understand why should extcon provide more than what it knows?It should just limit itself to broadcasting the cable state and exploiting it for any other information would only lead to more un-necessary code.
It should be same as IIO subsystem where the consumer and provider knows before hand what information they are going to share and with what precision and IIO core is just a way to do that.It doesn't know anything beyond what is given by the provider.
Same is the case with driver core where individual driver sets it's own private data and the driver core just gives that private data back to the driver as and when it needs but parsing the private data in the right way is up to the individual driver.
I fail to understand why is not the case here.
Quoted 8 lines
Hope above structure would be enough to represent the common cable state and
it's data. If a cable has more than two states, thenextcon_update_statecan be used to notify the consumer
1)Provider can just toggle the "state" argument to notify the consumer that cable state is changed
OR
2) Add one more argument likeextcon_update_state(struct extcon_dev *edev, u32 mask, u32 state1, u32 sate2)
This will cause other drivers to change such as arizona.
Quoted 6 lines
If the state2 is set, then consumers can use
get_cable_properties()to query the cable properties. State2 need to be used only if the cable need to represent more than two stateQuoted 3 lines
Third,
If we finish to decide the properties for all cables, I'd like to see a example
Why do we think that state and property is the only thing which the consumer want to know?I am sure there would be some more properties which would be of some interest to consumers and there is quite a possibility that in future we might get a patch for that also.So instead of that limiting it to just state is a good idea.
Quoted 40 lines
Quoted 1 line
code.
Agreed. If we agree on the above structure, I can modify the charging subsystem patch to use the same structure. (https://lkml.org/lkml/2012/10/18/219). This would give a reference for the new feature.
Quoted 16 lines
You explained following changed state of USB according to Host state on other patch.
---------------------------
For USB2.0
1) CONNECT (100mA)->UPDATE(500mA)->DISCONNECT(0mA)
2) CONNECT (100mA)->UPDATE(500mA)->HOST SUSPEND(2.5mA/500mA)-Quoted 1 line
DISCONNECT(0mA)
3) CONNECT (100mA)->UPDATE(500mA)->HOST SUSPEND(2.5mA/500mA)-
Quoted 1 line
HOST RESUME(500mA)->DISCONNECT(0mA)
For USB 3.0
4) CONNECT (150mA)->UPDATE(900mA)->DISCONNECT(0mA)
5) CONNECT (150mA)->UPDATE(900mA)-> HOST SUSPEND(2.5mA/900mA)-Quoted 1 line
DISCONNECT(0mA)
6) CONNECT (100mA)->UPDATE(900mA)->HOST SUSPEND(2.5mA/900mA)-
Quoted 8 lines
Quoted 1 line
HOST RESUME(900mA)->DISCONNECT(0mA)
---------------------------
I have a question. Can the provider device
driver(e.g., extcon-max77693.c/ extcon-max8997.c)detect the changed state of host? I'd like to see the example device driver that the provider device driver detect changed state of host.
Could you provide example device driver?Good question. The OTG drivers are capable of identifying the SUSPEND event. System cannot setup SDP (USB host) charging with maximum charging current - 500mA (USB2.0/ 900mA(USB 3)) without enumerating the USB. The USB enumeration can be done only with a USB/OTG driver. IMHO the above extcon drivers (extcon-max77693.c/
extcon-max8997.c) are not capable of doing the USB enumeration and identifying the charge current. They can just identify the charger type - SDP/DCP/CDP/ACA/AC. The intelligence for USB enumeration
should be inside USB/OTG driver.
Quoted 47 lines
Quoted 15 lines
Quoted 15 lines
I think that the role of extcon subsystem notify changed state(attached/detached) of cable to notifiee, but if you want to add property feature of cable, you should solve ambiguous issues.
First,
This patch only support the properties of charger cable but, never support property of other cable. The following structure depend on only charger cable. We can check it the following structure:struct extcon_chrg_cbl_props { enum extcon_chrgr_cbl_stat cable_state; unsigned long mA; };Quoted 7 lines
Quoted 1 line
I think that the patch have to support all of cables for property feature.
My suggestion is to have a structure like this
struct extcon_cablel_props { unsigned int cable_state; unsigned int data;Why can't it be float/long/double??
Quoted 10 lines
}
Not all cables will have more than two states. If any cable has more than two states, the above structure makes it flexible to represent additional state and the data associatedQuoted 5 lines
Second,
Certainly, you should define common properties of all cables and specific properties of each cable. The properties of charger cable should never be defined only.IMHO the extcon doesn't know anything about the cable except the state which is currently it is in and which also is set by the provider.I am unable to understand why should extcon provide more than what it knows?It should just limit itself to broadcasting the cable state and exploiting it for any other information would only lead to more un-necessary code.
It should be same as IIO subsystem where the consumer and provider knows before hand what information they are going to share and with what precision and IIO core is just a way to do that.It doesn't know anything beyond what is given by the provider.
Same is the case with driver core where individual driver sets it's own private data and the driver core just gives that private data back to the driver as and when it needs but parsing the private data in the right way is up to the individual driver.
Quoted 1 line
I fail to understand why is not the case here.
The requirement is different from the IIO case. I am trying to extend the Power Supply class to support charging in a generic way (https://lkml.org/lkml/2012/10/18/219).
The extcon consumer in this case is not a device driver. It's part of power supply class driver itself. I am open to any solution to get the cable properties dynamically. Do you find a better but generic mechanism for this?
I am trying to extend extcon just because I couldn’t find any other subsystem which gives cable notifications. IMHO, it's good if we can avoid consumer and provider driver level dependencies just by extending extcon. This will ensure that the same driver
will work on any platform as long as it's having the dependency only on extcon.
We shouldn't put any driver level dependency between extcon consumer and provider. When we do like that, the extcon consumer is expecting the
similar implementation for the provider on all platforms. This may not be possible and does not seems to be a scalable solution. IMHO, the extcon should provide a mechanism to retrieve the cable properties. Consumer drivers can use this API to get the cable properties without knowing the provider driver implementation. This will make the extcon drivers more scalable and reusable across multiple platforms.
Quoted 59 lines
Quoted 8 lines
Hope above structure would be enough to represent the common cable state and it's data. If a cable has more than two states, then
extcon_update_statecan be used to notify the consumer 1)Provider can just toggle the "state" argument to notify the consumer that cable state is changed OR
2) Add one more argument likeextcon_update_state(struct extcon_dev *edev, u32 mask, u32 state1, u32 sate2)This will cause other drivers to change such as arizona.
Quoted 8 lines
If the state2 is set, then consumers can use
get_cable_properties()to query the cable properties. State2 need to be used only if the cable need to represent more than two stateQuoted 4 lines
Third,
If we finish to decide the properties for all cables, I'd like to see a exampleWhy do we think that state and property is the only thing which the consumer want to know?I am sure there would be some more properties which would be of some interest to consumers and there is quite a possibility that in future we might get a patch for that also.So instead of that limiting it to just state is a good idea.
Quoted 5 lines
Quoted 1 line
code.
Agreed. If we agree on the above structure, I can modify the charging subsystem patch to use the same structure.
(https://lkml.org/lkml/2012/10/18/219). This would give a reference for thenew feature.
Quoted 8 lines
Quoted 8 lines
You explained following changed state of USB according to Host state on other patch.
---------------------------
For USB2.0
1) CONNECT (100mA)->UPDATE(500mA)->DISCONNECT(0mA)
2) CONNECT (100mA)->UPDATE(500mA)->HOSTSUSPEND(2.5mA/500mA)-
Quoted 2 lines
Quoted 2 lines
Quoted 1 line
DISCONNECT(0mA)
3) CONNECT (100mA)->UPDATE(500mA)->HOST
SUSPEND(2.5mA/500mA)-
Quoted 5 lines
Quoted 5 lines
Quoted 1 line
HOST RESUME(500mA)->DISCONNECT(0mA)
For USB 3.0
4) CONNECT (150mA)->UPDATE(900mA)->DISCONNECT(0mA)
5) CONNECT (150mA)->UPDATE(900mA)-> HOSTSUSPEND(2.5mA/900mA)-
Quoted 2 lines
Quoted 2 lines
Quoted 1 line
DISCONNECT(0mA)
6) CONNECT (100mA)->UPDATE(900mA)->HOST
SUSPEND(2.5mA/900mA)-
Quoted 10 lines
Quoted 9 lines
Quoted 1 line
HOST RESUME(900mA)->DISCONNECT(0mA)
---------------------------
I have a question. Can the provider device driver(e.g., extcon-max77693.c/
extcon-max8997.c) detect the changed state of host? I'd like to see the example device driver that the provider device driver detect changed state of host.
Could you provide example device driver?
Quoted 11 lines
Quoted 1 line
Good question. The OTG drivers are capable of identifying the SUSPEND
event.
Quoted 8 lines
System cannot setup SDP (USB host) charging with maximum charging current - 500mA (USB2.0/ 900mA(USB 3)) without enumerating the USB. The USB enumeration can be done only with a USB/OTG driver. IMHO the above extcon drivers (extcon-max77693.c/
extcon-max8997.c) are not capable of doing the USB enumeration and identifying the charge current. They can just identify the charger type - SDP/DCP/CDP/ACA/AC. The intelligence for USB enumeration should be inside USB/OTG driver.
���{.n�+�������+%�����ݶ��w��{.n�+����{��G�����{ay�ʇڙ�,j��f���h��������z_�(�階�ݢj"���m������G������?����&���~��iO��z��v�^�m����������?�I�
Quoted 55 lines · Jenny
Quoted 47 lines
Quoted 15 lines
Quoted 15 lines
I think that the role of extcon subsystem notify changed state(attached/detached) of cable to notifiee, but if you want to add property feature of cable, you should solve ambiguous issues.
First,
This patch only support the properties of charger cable but, never support property of other cable. The following structure depend on only charger cable. We can check it the following structure:struct extcon_chrg_cbl_props { enum extcon_chrgr_cbl_stat cable_state; unsigned long mA;};
Quoted 7 lines
Quoted 1 line
I think that the patch have to support all of cables for property feature.
My suggestion is to have a structure like this
struct extcon_cablel_props { unsigned int cable_state; unsigned int data;Why can't it be float/long/double??
Quoted 10 lines
}
Not all cables will have more than two states. If any cable has more than two states, the above structure makes it flexible to represent additional state and the data associatedQuoted 5 lines
Second,
Certainly, you should define common properties of all cables and specific properties of each cable. The properties of charger cable should never be defined only.IMHO the extcon doesn't know anything about the cable except the state which is currently it is in and which also is set by the provider.I am unable to understand why should extcon provide more than what it knows?It should just limit itself to broadcasting the cable state and exploiting it for any other information would only lead to more un-necessary code.
It should be same as IIO subsystem where the consumer and provider knows before hand what information they are going to share and with what precision and IIO core is just a way to do that.It doesn't know anything beyond what is given by the provider.
Same is the case with driver core where individual driver sets it's own private data and the driver core just gives that private data back to the driver as and when it needs but parsing the private data in the right way is up to the individual driver.Quoted 1 line
I fail to understand why is not the case here.
The requirement is different from the IIO case. I am trying to extend the Power Supply class to support charging in a generic way (https://lkml.org/lkml/2012/10/18/219).
The extcon consumer in this case is not a device driver. It's part of power supply class driver itself. I am open to any solution to get the cable properties dynamically. Do you find a better but generic mechanism for this?
Quoted 7 lines
I am trying to extend extcon just because I couldn’t find any other subsystem which gives cable notifications. IMHO, it's good if we can avoid consumer and provider driver level dependencies just by extending extcon. This will ensure that the same driver will work on any platform as long as it's having the dependency only on extcon. We shouldn't put any driver level dependency between extcon consumer and provider. When we do like that, the extcon consumer is expecting the
similar implementation for the provider on all platforms. This may not be possible
Is there anything wrong in assuming similar implementation for all the providers?I think the
providers know what it can provide and this may vary quite a lot.Or can we make a generic provider
driver which will encompass all the randomness in the various provider drivers?This generic
driver will get all the properties and since it will be generice anyone can use it to know what
properties to expect.This will keep the extcon design intact.
Quoted 76 lines
and does not seems to be a scalable solution. IMHO, the extcon should provide a mechanism to retrieve the cable properties. Consumer drivers can use this API to get the cable properties without knowing the provider driver implementation. This will make the extcon drivers more scalable and reusable across multiple platforms.
Quoted 70 lines
Quoted 8 lines
Hope above structure would be enough to represent the common cable state and it's data. If a cable has more than two states, then
extcon_update_statecan be used to notify the consumer 1)Provider can just toggle the "state" argument to notify the consumer that cable state is changed OR
2) Add one more argument likeextcon_update_state(struct extcon_dev *edev, u32 mask, u32 state1, u32 sate2)This will cause other drivers to change such as arizona.
Quoted 8 lines
If the state2 is set, then consumers can use
get_cable_properties()to query the cable properties. State2 need to be used only if the cable need to represent more than two stateQuoted 4 lines
Third,
If we finish to decide the properties for all cables, I'd like to see a exampleWhy do we think that state and property is the only thing which the consumer want to know?I am sure there would be some more properties which would be of some interest to consumers and there is quite a possibility that in future we might get a patch for that also.So instead of that limiting it to just state is a good idea.
Quoted 5 lines
Quoted 1 line
code.
Agreed. If we agree on the above structure, I can modify the charging subsystem patch to use the same structure.
(https://lkml.org/lkml/2012/10/18/219). This would give a reference for thenew feature.
Quoted 8 lines
Quoted 8 lines
You explained following changed state of USB according to Host state on other patch.
---------------------------
For USB2.0
1) CONNECT (100mA)->UPDATE(500mA)->DISCONNECT(0mA)
2) CONNECT (100mA)->UPDATE(500mA)->HOSTSUSPEND(2.5mA/500mA)-
Quoted 2 lines
Quoted 2 lines
Quoted 1 line
DISCONNECT(0mA)
3) CONNECT (100mA)->UPDATE(500mA)->HOST
SUSPEND(2.5mA/500mA)-
Quoted 5 lines
Quoted 5 lines
Quoted 1 line
HOST RESUME(500mA)->DISCONNECT(0mA)
For USB 3.0
4) CONNECT (150mA)->UPDATE(900mA)->DISCONNECT(0mA)
5) CONNECT (150mA)->UPDATE(900mA)-> HOSTSUSPEND(2.5mA/900mA)-
Quoted 2 lines
Quoted 2 lines
Quoted 1 line
DISCONNECT(0mA)
6) CONNECT (100mA)->UPDATE(900mA)->HOST
SUSPEND(2.5mA/900mA)-
Quoted 11 lines
Quoted 9 lines
Quoted 1 line
HOST RESUME(900mA)->DISCONNECT(0mA)
---------------------------
I have a question. Can the provider device driver(e.g., extcon-max77693.c/
extcon-max8997.c) detect the changed state of host? I'd like to see the example device driver that the provider device driver detect changed state of host.
Could you provide example device driver?Good question. The OTG drivers are capable of identifying the SUSPEND
event.
Quoted 8 lines
System cannot setup SDP (USB host) charging with maximum charging current - 500mA (USB2.0/ 900mA(USB 3)) without enumerating the USB. The USB enumeration can be done only with a USB/OTG driver. IMHO the above extcon drivers (extcon-max77693.c/
extcon-max8997.c) are not capable of doing the USB enumeration and identifying the charge current. They can just identify the charger type - SDP/DCP/CDP/ACA/AC. The intelligence for USB enumeration should be inside USB/OTG driver.
Quoted 67 lines
Quoted 13 lines
Quoted 13 lines
Quoted 13 lines
Quoted 13 lines
I think that the role of extcon subsystem notify changed state(attached/detached) of cable to notifiee, but if you want to add property feature of cable, you should solve ambiguous issues.
First,
This patch only support the properties of charger cable but, never support property of other cable. The following structure depend on only charger cable. We can check it the following structure:struct extcon_chrg_cbl_props { enum extcon_chrgr_cbl_stat cable_state; unsigned long mA;};
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
I think that the patch have to support all of cables for property
feature.
Quoted 17 lines
Quoted 17 lines
Quoted 6 lines
My suggestion is to have a structure like this
struct extcon_cablel_props { unsigned int cable_state; unsigned int data;Why can't it be float/long/double??
Quoted 10 lines
}
Not all cables will have more than two states. If any cable has more than two states, the above structure makes it flexible to represent additional state and the data associatedQuoted 5 lines
Second,
Certainly, you should define common properties of all cables and specific properties of each cable. The properties of charger cable should never be defined only.Quoted 5 lines
Quoted 5 lines
IMHO the extcon doesn't know anything about the cable except the state which is currently it is in and which also is set by the provider.I am unable to understand why should extcon provide more than what it knows?It should just limit itself to broadcasting the cable state and exploiting it for any other information would only lead to
more un-necessary code.
Quoted 9 lines
Quoted 9 lines
It should be same as IIO subsystem where the consumer and provider knows before hand what information they are going to share and with what precision and IIO core is just a way to do that.It doesn't know anything beyond what is given by the provider.
Same is the case with driver core where individual driver sets it's own private data and the driver core just gives that private data back to the driver as and when it needs but parsing the private data in the right way is up to the individual driver.Quoted 4 lines
Quoted 1 line
I fail to understand why is not the case here.
The requirement is different from the IIO case. I am trying to extend the Power Supply class to support charging in a generic way
(https://lkml.org/lkml/2012/10/18/219).
Quoted 1 line
The extcon consumer in this case is not a device driver. It's part of power
supply class driver itself.
Quoted 7 lines
I am open to any solution to get the cable properties dynamically. Do you find a better but generic mechanism for this?
I am trying to extend extcon just because I couldn’t find any other subsystem which gives cable notifications. IMHO, it's good if we can avoid consumer and provider driver level dependencies just by extending extcon. This will ensure that the same driver will work on any
platform as long as it's having the dependency only on extcon.
Quoted 1 line
We shouldn't put any driver level dependency between extcon consumer
and provider.
Quoted 3 lines
When we do like that, the extcon consumer is expecting the similar implementation for the provider on all platforms. This may not be possible
Quoted 6 lines
Is there anything wrong in assuming similar implementation for all the providers?I think the providers know what it can provide and this may vary quite a lot.Or can we make a generic provider driver which will encompass all the randomness in the various provider drivers?This generic driver will get all the properties and since it will be generice anyone can use it to know what properties to expect.This will keep the extcon design intact.
Maintainer??
Quoted 69 lines
Quoted 5 lines
and does not seems to be a scalable solution. IMHO, the extcon should provide a mechanism to retrieve the cable properties. Consumer drivers can use this API to get the cable properties without knowing the provider driver implementation. This will make the extcon drivers more
scalable and reusable across multiple platforms.
Quoted 63 lines
Quoted 63 lines
Quoted 9 lines
Hope above structure would be enough to represent the common cable state and it's data. If a cable has more than two states, then
extcon_update_statecan be used to notify the consumer 1)Provider can just toggle the "state" argument to notify the consumer that cable state is changed OR
2) Add one more argument likeextcon_update_state(struct extcon_dev *edev, u32 mask, u32 state1, u32 sate2)This will cause other drivers to change such as arizona.
Quoted 8 lines
If the state2 is set, then consumers can use
get_cable_properties()to query the cable properties. State2 need to be used only if the cable need to represent more than two stateQuoted 4 lines
Third,
If we finish to decide the properties for all cables, I'd like to see a exampleWhy do we think that state and property is the only thing which the consumer want to know?I am sure there would be some more properties which would be of some interest to consumers and there is quite a possibility that in future we might get a patch for that also.So instead of that limiting it to just state is a good idea.
Quoted 6 lines
Quoted 1 line
code.
Agreed. If we agree on the above structure, I can modify the charging subsystem patch to use the same structure.
(https://lkml.org/lkml/2012/10/18/219). This would give a reference for thenew feature.
Quoted 8 lines
Quoted 8 lines
You explained following changed state of USB according to Host state on other patch.
---------------------------
For USB2.0
1) CONNECT (100mA)->UPDATE(500mA)->DISCONNECT(0mA)
2) CONNECT (100mA)->UPDATE(500mA)->HOSTSUSPEND(2.5mA/500mA)-
Quoted 2 lines
Quoted 2 lines
Quoted 1 line
DISCONNECT(0mA)
3) CONNECT (100mA)->UPDATE(500mA)->HOST
SUSPEND(2.5mA/500mA)-
Quoted 5 lines
Quoted 5 lines
Quoted 1 line
HOST RESUME(500mA)->DISCONNECT(0mA)
For USB 3.0
4) CONNECT (150mA)->UPDATE(900mA)->DISCONNECT(0mA)
5) CONNECT (150mA)->UPDATE(900mA)-> HOSTSUSPEND(2.5mA/900mA)-
Quoted 2 lines
Quoted 2 lines
Quoted 1 line
DISCONNECT(0mA)
6) CONNECT (100mA)->UPDATE(900mA)->HOST
SUSPEND(2.5mA/900mA)-
Quoted 12 lines
Quoted 9 lines
Quoted 1 line
HOST RESUME(900mA)->DISCONNECT(0mA)
---------------------------
I have a question. Can the provider device driver(e.g., extcon-max77693.c/
extcon-max8997.c) detect the changed state of host? I'd like to see the example device driver that the provider device driver detect changed state of host.
Could you provide example device driver?Good question. The OTG drivers are capable of identifying the SUSPEND
Quoted 12 lines
Quoted 7 lines
Quoted 7 lines
event.
Quoted 6 lines
System cannot setup SDP (USB host) charging with maximum charging current - 500mA (USB2.0/ 900mA(USB 3)) without enumerating the USB. The USB enumeration can be done only with a USB/OTG driver. IMHO the above extcon drivers (extcon-max77693.c/
extcon-max8997.c) are not capable of doing the USB enumeration and identifying the charge current. They can just identify the charger type -SDP/DCP/CDP/ACA/AC.
Quoted 4 lines
Quoted 3 lines
Quoted 2 lines
The intelligence for USB enumeration should be inside USB/OTG driver.
���{.n�+�������+%�����ݶ��w��{.n�+����{��G�����{ay�ʇڙ�,j��f���h��������z_�(�階�ݢj"���m������G������?����&���~��iO��z��v�^�m����������?�I�
Chanwoo Choi
maintainerQuoted 67 lines · Jenny
Quoted 67 lines
Quoted 13 lines
Quoted 13 lines
Quoted 13 lines
Quoted 13 lines
I think that the role of extcon subsystem notify changed state(attached/detached) of cable to notifiee, but if you want to add property feature of cable, you should solve ambiguous issues.
First,
This patch only support the properties of charger cable but, never support property of other cable. The following structure depend on only charger cable. We can check it the following structure:struct extcon_chrg_cbl_props { enum extcon_chrgr_cbl_stat cable_state; unsigned long mA;};
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
I think that the patch have to support all of cables for property
feature.
Quoted 17 lines
Quoted 17 lines
Quoted 6 lines
My suggestion is to have a structure like this
struct extcon_cablel_props { unsigned int cable_state; unsigned int data;Why can't it be float/long/double??
Quoted 10 lines
}
Not all cables will have more than two states. If any cable has more than two states, the above structure makes it flexible to represent additional state and the data associatedQuoted 5 lines
Second,
Certainly, you should define common properties of all cables and specific properties of each cable. The properties of charger cable should never be defined only.Quoted 5 lines
Quoted 5 lines
IMHO the extcon doesn't know anything about the cable except the state which is currently it is in and which also is set by the provider.I am unable to understand why should extcon provide more than what it knows?It should just limit itself to broadcasting the cable state and exploiting it for any other information would only lead to
more un-necessary code.
Quoted 9 lines
Quoted 9 lines
It should be same as IIO subsystem where the consumer and provider knows before hand what information they are going to share and with what precision and IIO core is just a way to do that.It doesn't know anything beyond what is given by the provider.
Same is the case with driver core where individual driver sets it's own private data and the driver core just gives that private data back to the driver as and when it needs but parsing the private data in the right way is up to the individual driver.Quoted 4 lines
Quoted 1 line
I fail to understand why is not the case here.
The requirement is different from the IIO case. I am trying to extend the Power Supply class to support charging in a generic way
(https://lkml.org/lkml/2012/10/18/219).
Quoted 1 line
The extcon consumer in this case is not a device driver. It's part of power
supply class driver itself.
Quoted 7 lines
I am open to any solution to get the cable properties dynamically. Do you find a better but generic mechanism for this?
I am trying to extend extcon just because I couldn’t find any other subsystem which gives cable notifications. IMHO, it's good if we can avoid consumer and provider driver level dependencies just by extending extcon. This will ensure that the same driver will work on any
platform as long as it's having the dependency only on extcon.
Quoted 1 line
We shouldn't put any driver level dependency between extcon consumer
and provider.
Quoted 3 lines
When we do like that, the extcon consumer is expecting the similar implementation for the provider on all platforms. This may not be possible
Quoted 8 lines
Quoted 6 lines
Is there anything wrong in assuming similar implementation for all the providers?I think the providers know what it can provide and this may vary quite a lot.Or can we make a generic provider driver which will encompass all the randomness in the various provider drivers?This generic driver will get all the properties and since it will be generice anyone can use it to know what properties to expect.This will keep the extcon design intact.
Maintainer??
I agreed about opinion of anish singh. The extcon provider driver provide generic
----
struct extcon_cablel_props {
unsigned int cable_state;
unsigned int data;
}----
You suggested upper structure and said it is only flexible to represent additional state, But, it is non-standard. What store real data on "unsigned int data"? It isn't determined and flexible. That is extcon consumer driver should already know type of real data or value of real data. The extcon consumer driver has strong dependency on extcon provider driver. In this case, if extcon provider driver can change data value of "unsigned int data", extcon consumer provider have to be modified according to extcon provider driver. I think it isn't correct apporach. So, I proposed that we should define properties for all cables.
Quoted 78 lines
Quoted 78 lines
Quoted 5 lines
and does not seems to be a scalable solution. IMHO, the extcon should provide a mechanism to retrieve the cable properties. Consumer drivers can use this API to get the cable properties without knowing the provider driver implementation. This will make the extcon drivers more
scalable and reusable across multiple platforms.
Quoted 63 lines
Quoted 63 lines
Quoted 9 lines
Hope above structure would be enough to represent the common cable state and it's data. If a cable has more than two states, then
extcon_update_statecan be used to notify the consumer 1)Provider can just toggle the "state" argument to notify the consumer that cable state is changed OR
2) Add one more argument likeextcon_update_state(struct extcon_dev *edev, u32 mask, u32 state1, u32 sate2)This will cause other drivers to change such as arizona.
Quoted 8 lines
If the state2 is set, then consumers can use
get_cable_properties()to query the cable properties. State2 need to be used only if the cable need to represent more than two stateQuoted 4 lines
Third,
If we finish to decide the properties for all cables, I'd like to see a exampleWhy do we think that state and property is the only thing which the consumer want to know?I am sure there would be some more properties which would be of some interest to consumers and there is quite a possibility that in future we might get a patch for that also.So instead of that limiting it to just state is a good idea.
Quoted 6 lines
Quoted 1 line
code.
Agreed. If we agree on the above structure, I can modify the charging subsystem patch to use the same structure.
(https://lkml.org/lkml/2012/10/18/219). This would give a reference for thenew feature.
Quoted 8 lines
Quoted 8 lines
You explained following changed state of USB according to Host state on other patch.
---------------------------
For USB2.0
1) CONNECT (100mA)->UPDATE(500mA)->DISCONNECT(0mA)
2) CONNECT (100mA)->UPDATE(500mA)->HOSTSUSPEND(2.5mA/500mA)-
Quoted 2 lines
Quoted 2 lines
Quoted 1 line
DISCONNECT(0mA)
3) CONNECT (100mA)->UPDATE(500mA)->HOST
SUSPEND(2.5mA/500mA)-
Quoted 5 lines
Quoted 5 lines
Quoted 1 line
HOST RESUME(500mA)->DISCONNECT(0mA)
For USB 3.0
4) CONNECT (150mA)->UPDATE(900mA)->DISCONNECT(0mA)
5) CONNECT (150mA)->UPDATE(900mA)-> HOSTSUSPEND(2.5mA/900mA)-
Quoted 2 lines
Quoted 2 lines
Quoted 1 line
DISCONNECT(0mA)
6) CONNECT (100mA)->UPDATE(900mA)->HOST
SUSPEND(2.5mA/900mA)-
Quoted 12 lines
Quoted 9 lines
Quoted 1 line
HOST RESUME(900mA)->DISCONNECT(0mA)
---------------------------
I have a question. Can the provider device driver(e.g., extcon-max77693.c/
extcon-max8997.c) detect the changed state of host? I'd like to see the example device driver that the provider device driver detect changed state of host.
Could you provide example device driver?Good question. The OTG drivers are capable of identifying the SUSPEND
Quoted 7 lines
Quoted 7 lines
event.
Quoted 6 lines
System cannot setup SDP (USB host) charging with maximum charging current - 500mA (USB2.0/ 900mA(USB 3)) without enumerating the USB. The USB enumeration can be done only with a USB/OTG driver. IMHO the above extcon drivers (extcon-max77693.c/
extcon-max8997.c) are not capable of doing the USB enumeration and identifying the charge current. They can just identify the charger type -SDP/DCP/CDP/ACA/AC.
Quoted 1 line
Quoted 1 line
Quoted 1 line
The intelligence for USB enumeration should be inside USB/OTG driver.
Quoted 90 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
I think that the role of extcon subsystem notify changed state(attached/detached) of cable to notifiee, but if you want to add property feature of cable, you should solve ambiguous issues.
First,
This patch only support the properties of charger cable but, never support property of other cable. The following structure depend on only charger cable. We can check it the followingstructure:
Quoted 51 lines
Quoted 51 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
struct extcon_chrg_cbl_props { enum extcon_chrgr_cbl_stat cable_state; unsigned long mA; };I think that the patch have to support all of cables for property
feature.
Quoted 17 lines
Quoted 17 lines
Quoted 6 lines
My suggestion is to have a structure like this
struct extcon_cablel_props { unsigned int cable_state; unsigned int data;Why can't it be float/long/double??
Quoted 10 lines
}
Not all cables will have more than two states. If any cable has more than two states, the above structure makes it flexible to represent additional state and the data associatedQuoted 5 lines
Second,
Certainly, you should define common properties of all cables and specific properties of each cable. The properties of charger cable should never be defined only.Quoted 6 lines
Quoted 6 lines
IMHO the extcon doesn't know anything about the cable except the state which is currently it is in and which also is set by the provider.I am unable to understand why should extcon provide more than what it knows?It should just limit itself to broadcasting the cable state and exploiting it for any other information would only lead to
more un-necessary code.
Quoted 9 lines
Quoted 9 lines
It should be same as IIO subsystem where the consumer and provider knows before hand what information they are going to share and with what precision and IIO core is just a way to do that.It doesn't know anything beyond what is given by the provider.
Same is the case with driver core where individual driver sets it's own private data and the driver core just gives that private data back to the driver as and when it needs but parsing the private data in the right way is up to the individual driver.Quoted 4 lines
Quoted 1 line
I fail to understand why is not the case here.
The requirement is different from the IIO case. I am trying to extend the Power Supply class to support charging in a generic way
(https://lkml.org/lkml/2012/10/18/219).
Quoted 2 lines
The extcon consumer in this case is not a device driver. It's part of power
supply class driver itself.
Quoted 3 lines
I am open to any solution to get the cable properties dynamically. Do you find a better but generic mechanism for this?
Quoted 7 lines
Quoted 7 lines
Quoted 5 lines
I am trying to extend extcon just because I couldn’t find any other subsystem which gives cable notifications. IMHO, it's good if we can avoid consumer and provider driver level dependencies just by extending extcon. This will ensure that the same driver will work on any
platform as long as it's having the dependency only on extcon.
Quoted 1 line
We shouldn't put any driver level dependency between extcon
consumer
Quoted 10 lines
Quoted 10 lines
and provider.
Quoted 3 lines
When we do like that, the extcon consumer is expecting the similar implementation for the provider on all platforms. This may not be possible
Is there anything wrong in assuming similar implementation for all the providers?I think the providers know what it can provide and this may vary quite a lot.Or can we make a generic provider driver which will encompass all the randomness in the various provider drivers?This generic driver will get all the properties and since it will be generice anyone can use it to know what properties to expect.This
will keep the extcon design intact.
Quoted 2 lines
Maintainer??
I agreed about opinion of anish singh. The extcon provider driver provide generic
----
struct extcon_cablel_props { unsigned int cable_state; unsigned int data; }
Quoted 10 lines
----
You suggested upper structure and said it is only flexible to represent additional state, But, it is non-standard. What store real data on "unsigned int data"? It isn't determined and flexible. That is extcon consumer driver should already know type of real data or value of real data. The extcon consumer driver has strong dependency on extcon provider driver. In this case, if extcon provider driver can change data value of "unsigned int data", extcon consumer provider have to be modified according to extcon provider driver. I think it isn't correct apporach. So, I proposed that we should define properties for all cables.
I couldn’t find properties common for all type of cables. Alternate method I can think of is a new driver "extcon-charger.c". This driver will register with extcon subsystem.
The consumer and provider can use the APIs and properties exposed by this driver. This way we can ensure that extcon design is intact and the additional charger cable state and properties can be handled by this driver. Does that make sense?
Quoted 76 lines
Quoted 11 lines
Quoted 11 lines
Quoted 7 lines
and does not seems to be a scalable solution. IMHO, the extcon should provide a mechanism to retrieve the cable properties. Consumer drivers can use this API to get the cable properties without knowing the provider driver implementation. This will make the extcon drivers more
scalable and reusable across multiple platforms.
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Hope above structure would be enough to represent the common
cable
Quoted 12 lines
Quoted 12 lines
Quoted 12 lines
Quoted 12 lines
Quoted 6 lines
state and it's data. If a cable has more than two states, then
extcon_update_statecan be used to notify the consumer 1)Provider can just toggle the "state" argument to notify the consumer that cable state is changed OR
2) Add one more argument likeextcon_update_state(struct extcon_dev *edev, u32 mask, u32 state1, u32 sate2)This will cause other drivers to change such as arizona.
Quoted 5 lines
If the state2 is set, then consumers can use
get_cable_properties()to query the cable properties. State2 need to be used only if the cable need to represent more than two stateQuoted 1 line
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 3 lines
Quoted 3 lines
Third,
If we finish to decide the properties for all cables, I'd like to see a exampleWhy do we think that state and property is the only thing which the consumer want to know?I am sure there would be some more
properties
Quoted 41 lines
Quoted 41 lines
Quoted 41 lines
Quoted 41 lines
which would be of some interest to consumers and there is quite a possibility that in future we might get a patch for that also.So instead of that limiting it to just state is a good idea.
Quoted 6 lines
Quoted 1 line
code.
Agreed. If we agree on the above structure, I can modify the charging subsystem patch to use the same structure.
(https://lkml.org/lkml/2012/10/18/219). This would give a reference for thenew feature.
Quoted 8 lines
Quoted 8 lines
You explained following changed state of USB according to Host state on other patch.
---------------------------
For USB2.0
1) CONNECT (100mA)->UPDATE(500mA)->DISCONNECT(0mA)
2) CONNECT (100mA)->UPDATE(500mA)->HOSTSUSPEND(2.5mA/500mA)-
Quoted 2 lines
Quoted 2 lines
Quoted 1 line
DISCONNECT(0mA)
3) CONNECT (100mA)->UPDATE(500mA)->HOST
SUSPEND(2.5mA/500mA)-
Quoted 5 lines
Quoted 5 lines
Quoted 1 line
HOST RESUME(500mA)->DISCONNECT(0mA)
For USB 3.0
4) CONNECT (150mA)->UPDATE(900mA)->DISCONNECT(0mA)
5) CONNECT (150mA)->UPDATE(900mA)-> HOSTSUSPEND(2.5mA/900mA)-
Quoted 2 lines
Quoted 2 lines
Quoted 1 line
DISCONNECT(0mA)
6) CONNECT (100mA)->UPDATE(900mA)->HOST
SUSPEND(2.5mA/900mA)-
Quoted 10 lines
Quoted 9 lines
Quoted 1 line
HOST RESUME(900mA)->DISCONNECT(0mA)
---------------------------
I have a question. Can the provider device driver(e.g., extcon-max77693.c/
extcon-max8997.c) detect the changed state of host? I'd like to see the example device driver that the provider device driver detect changed state of host.
Could you provide example device driver?Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 2 lines
Good question. The OTG drivers are capable of identifying the SUSPEND
event.
Quoted 2 lines
System cannot setup SDP (USB host) charging with maximum charging current - 500mA (USB2.0/ 900mA(USB 3)) without enumerating the
Quoted 9 lines
USB.
Quoted 6 lines
Quoted 6 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
The USB enumeration can be done only with a USB/OTG driver. IMHO the above extcon drivers (extcon-max77693.c/
extcon-max8997.c) are not capable of doing the USB enumeration and identifying the charge current. They can just identify the charger type -SDP/DCP/CDP/ACA/AC.
Quoted 1 line
Quoted 1 line
Quoted 1 line
The intelligence for USB enumeration should be inside USB/OTG
driver.
���{.n�+�������+%�����ݶ��w��{.n�+����{��G�����{ay�ʇڙ�,j��f���h��������z_�(�階�ݢj"���m������G������?����&���~��iO��z��v�^�m����������?�I�
Chanwoo Choi
maintainerQuoted 101 lines · Jenny
Quoted 90 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
I think that the role of extcon subsystem notify changed state(attached/detached) of cable to notifiee, but if you want to add property feature of cable, you should solve ambiguous issues.
First,
This patch only support the properties of charger cable but, never support property of other cable. The following structure depend on only charger cable. We can check it the followingstructure:
Quoted 51 lines
Quoted 51 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
struct extcon_chrg_cbl_props { enum extcon_chrgr_cbl_stat cable_state; unsigned long mA; };I think that the patch have to support all of cables for property
feature.
Quoted 17 lines
Quoted 17 lines
Quoted 6 lines
My suggestion is to have a structure like this
struct extcon_cablel_props { unsigned int cable_state; unsigned int data;Why can't it be float/long/double??
Quoted 10 lines
}
Not all cables will have more than two states. If any cable has more than two states, the above structure makes it flexible to represent additional state and the data associatedQuoted 5 lines
Second,
Certainly, you should define common properties of all cables and specific properties of each cable. The properties of charger cable should never be defined only.Quoted 6 lines
Quoted 6 lines
IMHO the extcon doesn't know anything about the cable except the state which is currently it is in and which also is set by the provider.I am unable to understand why should extcon provide more than what it knows?It should just limit itself to broadcasting the cable state and exploiting it for any other information would only lead to
more un-necessary code.
Quoted 9 lines
Quoted 9 lines
It should be same as IIO subsystem where the consumer and provider knows before hand what information they are going to share and with what precision and IIO core is just a way to do that.It doesn't know anything beyond what is given by the provider.
Same is the case with driver core where individual driver sets it's own private data and the driver core just gives that private data back to the driver as and when it needs but parsing the private data in the right way is up to the individual driver.Quoted 4 lines
Quoted 1 line
I fail to understand why is not the case here.
The requirement is different from the IIO case. I am trying to extend the Power Supply class to support charging in a generic way
(https://lkml.org/lkml/2012/10/18/219).
Quoted 2 lines
The extcon consumer in this case is not a device driver. It's part of power
supply class driver itself.
Quoted 3 lines
I am open to any solution to get the cable properties dynamically. Do you find a better but generic mechanism for this?
Quoted 7 lines
Quoted 7 lines
Quoted 5 lines
I am trying to extend extcon just because I couldn’t find any other subsystem which gives cable notifications. IMHO, it's good if we can avoid consumer and provider driver level dependencies just by extending extcon. This will ensure that the same driver will work on any
platform as long as it's having the dependency only on extcon.
Quoted 1 line
We shouldn't put any driver level dependency between extcon
consumer
Quoted 10 lines
Quoted 10 lines
and provider.
Quoted 3 lines
When we do like that, the extcon consumer is expecting the similar implementation for the provider on all platforms. This may not be possible
Is there anything wrong in assuming similar implementation for all the providers?I think the providers know what it can provide and this may vary quite a lot.Or can we make a generic provider driver which will encompass all the randomness in the various provider drivers?This generic driver will get all the properties and since it will be generice anyone can use it to know what properties to expect.This
will keep the extcon design intact.
Quoted 2 lines
Maintainer??
I agreed about opinion of anish singh. The extcon provider driver provide generic
----
struct extcon_cablel_props { unsigned int cable_state; unsigned int data; }Quoted 10 lines
----
You suggested upper structure and said it is only flexible to represent additional state, But, it is non-standard. What store real data on "unsigned int data"? It isn't determined and flexible. That is extcon consumer driver should already know type of real data or value of real data. The extcon consumer driver has strong dependency on extcon provider driver. In this case, if extcon provider driver can change data value of "unsigned int data", extcon consumer provider have to be modified according to extcon provider driver. I think it isn't correct apporach. So, I proposed that we should define properties for all cables.
Quoted 6 lines
I couldn’t find properties common for all type of cables. Alternate method I can think of is a new driver "
extcon-charger.c". This driver will register with extcon subsystem.The consumer and provider can use the APIs and properties exposed by this driver. This way we can ensure that extcon design is intact and the additional charger cable state and properties can be handled by this driver. Does that make sense?
I don't agree about 'extcon-charger.c' because the 'extcon-class.c' driver support already charger cable.
Also it is duplicate feature between 'extcon-class.c' and 'extcon-charger.c'.
Also,
The obvious difference between the state of external cable and the state of host system is existence. I think that extcon cable state isn't changed when state of host system
move from normal state to suspend state or opposite case. If consumer driver
hope to know new state of host system, power_supply charging framework
communicate with other driver or framework that provide API for checking state
of host system.
I suggest a approach that some framework related OTG/USB need to implement something like below notifier block, this notifier block inform changed state of host system of some driver/framework that need state of host system.
/*
* Host system notifier
*/
#define HOST_SYSTEM_NORMAL 0x1
#define HOST_SYSTEM_SUSPEND 0x2
extern int register_host_system_notifier(struct notifier_block *nb); extern void unregister_host_system_notifier(struct notifier_block *nb); int host_system_notify(..)
For example,
Firstly, the power_supply charging framework check state of charger cable whether attached or detached cable. Second, when power_supply charging framework receive the changed state of host system from 'Host system notifier', change charging current of charger cable.
Quoted 87 lines
Quoted 86 lines
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
and does not seems to be a scalable solution. IMHO, the extcon should provide a mechanism to retrieve the cable properties. Consumer drivers can use this API to get the cable properties without knowing the provider driver implementation. This will make the extcon drivers more
Quoted 4 lines
Quoted 4 lines
scalable and reusable across multiple platforms.
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Hope above structure would be enough to represent the common
cable
Quoted 12 lines
Quoted 12 lines
Quoted 12 lines
Quoted 12 lines
Quoted 6 lines
state and it's data. If a cable has more than two states, then
extcon_update_statecan be used to notify the consumer 1)Provider can just toggle the "state" argument to notify the consumer that cable state is changed OR
2) Add one more argument likeextcon_update_state(struct extcon_dev *edev, u32 mask, u32 state1, u32 sate2)This will cause other drivers to change such as arizona.
Quoted 5 lines
If the state2 is set, then consumers can use
get_cable_properties()to query the cable properties. State2 need to be used only if the cable need to represent more than two stateQuoted 1 line
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 3 lines
Quoted 3 lines
Third,
If we finish to decide the properties for all cables, I'd like to see a exampleWhy do we think that state and property is the only thing which the consumer want to know?I am sure there would be some more
properties
Quoted 41 lines
Quoted 41 lines
Quoted 41 lines
Quoted 41 lines
which would be of some interest to consumers and there is quite a possibility that in future we might get a patch for that also.So instead of that limiting it to just state is a good idea.
Quoted 6 lines
Quoted 1 line
code.
Agreed. If we agree on the above structure, I can modify the charging subsystem patch to use the same structure.
(https://lkml.org/lkml/2012/10/18/219). This would give a reference for thenew feature.
Quoted 8 lines
Quoted 8 lines
You explained following changed state of USB according to Host state on other patch.
---------------------------
For USB2.0
1) CONNECT (100mA)->UPDATE(500mA)->DISCONNECT(0mA)
2) CONNECT (100mA)->UPDATE(500mA)->HOSTSUSPEND(2.5mA/500mA)-
Quoted 2 lines
Quoted 2 lines
Quoted 1 line
DISCONNECT(0mA)
3) CONNECT (100mA)->UPDATE(500mA)->HOST
SUSPEND(2.5mA/500mA)-
Quoted 5 lines
Quoted 5 lines
Quoted 1 line
HOST RESUME(500mA)->DISCONNECT(0mA)
For USB 3.0
4) CONNECT (150mA)->UPDATE(900mA)->DISCONNECT(0mA)
5) CONNECT (150mA)->UPDATE(900mA)-> HOSTSUSPEND(2.5mA/900mA)-
Quoted 2 lines
Quoted 2 lines
Quoted 1 line
DISCONNECT(0mA)
6) CONNECT (100mA)->UPDATE(900mA)->HOST
SUSPEND(2.5mA/900mA)-
Quoted 10 lines
Quoted 9 lines
Quoted 1 line
HOST RESUME(900mA)->DISCONNECT(0mA)
---------------------------
I have a question. Can the provider device driver(e.g., extcon-max77693.c/
extcon-max8997.c) detect the changed state of host? I'd like to see the example device driver that the provider device driver detect changed state of host.
Could you provide example device driver?Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 2 lines
Good question. The OTG drivers are capable of identifying the SUSPEND
event.
Quoted 2 lines
System cannot setup SDP (USB host) charging with maximum charging current - 500mA (USB2.0/ 900mA(USB 3)) without enumerating the
USB.
Quoted 6 lines
Quoted 6 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
The USB enumeration can be done only with a USB/OTG driver. IMHO the above extcon drivers (extcon-max77693.c/
extcon-max8997.c) are not capable of doing the USB enumeration and identifying the charge current. They can just identify the charger type -SDP/DCP/CDP/ACA/AC.
Quoted 1 line
Quoted 1 line
Quoted 1 line
The intelligence for USB enumeration should be inside USB/OTG
driver.
Quoted 143 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
I think that the role of extcon subsystem notify changed state(attached/detached) of cable to notifiee, but if you want to add property feature of cable, you should solve ambiguous
issues.
Quoted 27 lines
Quoted 27 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
First,
This patch only support the properties of charger cable but, never support property of other cable. The following structure depend on only charger cable. We can check it the followingstructure:
Quoted 21 lines
Quoted 21 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
struct extcon_chrg_cbl_props { enum extcon_chrgr_cbl_stat cable_state; unsigned long mA; };I think that the patch have to support all of cables for property
feature.
Quoted 13 lines
Quoted 13 lines
Quoted 6 lines
My suggestion is to have a structure like this
struct extcon_cablel_props { unsigned int cable_state; unsigned int data;Why can't it be float/long/double??
Quoted 6 lines
}
Not all cables will have more than two states. If any cable has more than two states, the above structure makes it flexible to represent additional state and the data associatedQuoted 1 line
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 4 lines
Quoted 4 lines
Second,
Certainly, you should define common properties of all cables and specific properties of each cable. The properties of charger cable should never be defined only.IMHO the extcon doesn't know anything about the cable except the state which is currently it is in and which also is set by the provider.I am unable to understand why should extcon provide
more
Quoted 50 lines
Quoted 50 lines
Quoted 24 lines
Quoted 24 lines
Quoted 3 lines
Quoted 3 lines
than what it knows?It should just limit itself to broadcasting the cable state and exploiting it for any other information would only lead to
more un-necessary code.
Quoted 9 lines
Quoted 9 lines
It should be same as IIO subsystem where the consumer and provider knows before hand what information they are going to share and with what precision and IIO core is just a way to do that.It doesn't know anything beyond what is given by the provider. Same is the case with driver core where individual driver sets it's own private data and the driver core just gives that private data back to the driver as and when it needs but parsing the private data in the right way is up to the individual driver.
Quoted 4 lines
Quoted 1 line
I fail to understand why is not the case here.
The requirement is different from the IIO case. I am trying to extend the Power Supply class to support charging in a generic way
(https://lkml.org/lkml/2012/10/18/219).
Quoted 2 lines
The extcon consumer in this case is not a device driver. It's part of power
supply class driver itself.
Quoted 3 lines
I am open to any solution to get the cable properties dynamically. Do you find a better but generic mechanism for this?
Quoted 7 lines
Quoted 7 lines
Quoted 5 lines
I am trying to extend extcon just because I couldn’t find any other subsystem which gives cable notifications. IMHO, it's good if we can avoid consumer and provider driver level dependencies just by extending extcon. This will ensure that the same driver will work on any
platform as long as it's having the dependency only on extcon.
Quoted 1 line
We shouldn't put any driver level dependency between extcon
consumer
Quoted 11 lines
Quoted 11 lines
and provider.
Quoted 3 lines
When we do like that, the extcon consumer is expecting the similar implementation for the provider on all platforms. This may not be possible
Is there anything wrong in assuming similar implementation for all the providers?I think the providers know what it can provide and this may vary quite a lot.Or can we make a generic provider driver which will encompass all the randomness in the various provider drivers?This generic driver will get all the properties and since it will be generice anyone can use it to know what properties to expect.This
will keep the extcon design intact.
Quoted 2 lines
Maintainer??
I agreed about opinion of anish singh. The extcon provider driver provide generic
Quoted 13 lines
Quoted 5 lines
----
struct extcon_cablel_props { unsigned int cable_state; unsigned int data; }Quoted 8 lines
----
You suggested upper structure and said it is only flexible to represent additional state, But, it is non-standard. What store real data on "unsigned int data"? It isn't determined and flexible. That is extcon consumer driver should already know type of real data or value of real data. The extcon consumer driver has strong dependency on extcon provider driver. In this case, if extcon provider driver can change data value of "unsigned int data", extcon consumer providerhave to be modified according to extcon provider driver.
Quoted 5 lines
Quoted 2 lines
I think it isn't correct apporach. So, I proposed that we should define properties for all cables.
I couldn’t find properties common for all type of cables. Alternate method I can think of is a new driver "
extcon-charger.c". This driver willregister with extcon subsystem.
Quoted 4 lines
The consumer and provider can use the APIs and properties exposed by this driver. This way we can ensure that extcon design is intact and the additional charger cable state and properties can be handled by this
driver. Does that make sense?
I don't agree about '
extcon-charger.c' because the 'extcon-class.c' driver support already charger cable.
Also it is duplicate feature between 'extcon-class.c' and 'extcon-charger.c'.Also,
The obvious difference between the state of external cable and the state of host system is existence.
I think that extcon cable state isn't changed when state of host system move from normal state to suspend state or opposite case. If consumer driver hope to know new state of host system,power_supplycharging framework communicate with other driver or framework that provide API for checking state of host system.I suggest a approach that some framework related OTG/USB need to implement something like below notifier block, this notifier block inform changed state of host system of some driver/framework that need state of host system.
/*
* Host system notifier
*/
#defineHOST_SYSTEM_NORMAL0x1
#defineHOST_SYSTEM_SUSPEND0x2extern int
register_host_system_notifier(struct notifier_block *nb); extern voidunregister_host_system_notifier(struct notifier_block *nb); inthost_system_notify(..)
Quoted 5 lines
For example,
Firstly, thepower_supplycharging framework check state of charger cable whether attached or detached cable. Second, whenpower_supplycharging framework receive the changed state of host system from 'Host system notifier', change charging current of charger cable.
Not just SUSPEND, but we need to handle RESUME , UPDATE etc. Also this doesn’t help us to define a standard interface for the charger cable state/properties. IMHO it's not right to provide different interfaces for different cables. This doesn't help us to standardize the charger cable interface.
This thread has been running for a quite long time. Unfortunately we couldn't make an agreement on the final solution. I would like to recap the overall requirement and would like to propose alternate solutions. The requirements is to "Provide a generic interface for charger cable states and charger cable properties"
Even though extcon subsystem handles charger cable states, it's not enough to handle
all kind of charger cable states. It can handle just 2 states CONNECT/DISCONNECT.
But there are scenarios where we need to handle more than 2 states
(eg. USB SUSPEND/RESUME/UPDATE etc). Also extcon doesn't have any mechanism to
read cable properties in a generic way. Extcon charger-cable consumer driver implementations (eg charger-manager), defines charger cable properties statically (current in mA) inside the consumer driver. This is not enough, since the charger cable properties may change dynamically
In existing form extcon cannot support different charger cable states and their properties in a generic way. Also we couldn't find a final solution on how to modify the extcon to support these requirements. From the whole discussion what I conclude is
* extcon is not designed to support cable properties
* extcon is not designed to support any cable state other than CONNECT/DISCONNECT
(Feel free to correct me if my conclusion is wrong)
Considering these facts and the above discussion, what I feel is extcon subsystem cannot provide generic interface to handle multiple charger cable states and their properties
Based on this, I would like to propose a generic interface for the charger cable notification which can handle multiple cable states and can provide charger cable properties in a generic manner. Since the charger cables are related to power supply subsystem, my suggestion is to have a notifier chain inside the power_supply subsystem and have APIs to query the charger cable properties. This will help to standardize the charger cable handling.
Both extcon and power_supply maintainers are CCed in this thread. Please help me to identify a solution.
Quoted 76 lines
Quoted 76 lines
Quoted 76 lines
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
and does not seems to be a scalable solution. IMHO, the extcon should provide a mechanism to retrieve the cable properties. Consumer drivers can use this API to get the cable properties without knowing the provider driver implementation. This will make the extcon drivers more
Quoted 4 lines
Quoted 4 lines
scalable and reusable across multiple platforms.
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Hope above structure would be enough to represent the common
cable
Quoted 13 lines
Quoted 13 lines
Quoted 13 lines
Quoted 13 lines
Quoted 6 lines
state and it's data. If a cable has more than two states, then
extcon_update_statecan be used to notify the consumer 1)Provider can just toggle the "state" argument to notify the consumer that cable state is changed OR
2) Add one more argument likeextcon_update_state(struct extcon_dev *edev, u32 mask, u32 state1, u32 sate2)This will cause other drivers to change such as arizona.
Quoted 6 lines
If the state2 is set, then consumers can use
get_cable_properties()to query the cable properties. State2 need to be used only if the cable need to represent more than two stateQuoted 1 line
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 3 lines
Quoted 3 lines
Third,
If we finish to decide the properties for all cables, I'd like to see a exampleWhy do we think that state and property is the only thing which the consumer want to know?I am sure there would be some more
properties
Quoted 43 lines
Quoted 43 lines
Quoted 43 lines
Quoted 43 lines
which would be of some interest to consumers and there is quite a possibility that in future we might get a patch for that also.So instead of that limiting it to just state is a good idea.
Quoted 6 lines
Quoted 1 line
code.
Agreed. If we agree on the above structure, I can modify the charging subsystem patch to use the same structure.
(https://lkml.org/lkml/2012/10/18/219). This would give a reference for thenew feature.
Quoted 8 lines
Quoted 8 lines
You explained following changed state of USB according to Host state on other patch.
---------------------------
For USB2.0
1) CONNECT (100mA)->UPDATE(500mA)->DISCONNECT(0mA)
2) CONNECT (100mA)->UPDATE(500mA)->HOSTSUSPEND(2.5mA/500mA)-
Quoted 2 lines
Quoted 2 lines
Quoted 1 line
DISCONNECT(0mA)
3) CONNECT (100mA)->UPDATE(500mA)->HOST
SUSPEND(2.5mA/500mA)-
Quoted 5 lines
Quoted 5 lines
Quoted 1 line
HOST RESUME(500mA)->DISCONNECT(0mA)
For USB 3.0
4) CONNECT (150mA)->UPDATE(900mA)->DISCONNECT(0mA)
5) CONNECT (150mA)->UPDATE(900mA)-> HOSTSUSPEND(2.5mA/900mA)-
Quoted 2 lines
Quoted 2 lines
Quoted 1 line
DISCONNECT(0mA)
6) CONNECT (100mA)->UPDATE(900mA)->HOST
SUSPEND(2.5mA/900mA)-
Quoted 12 lines
Quoted 9 lines
Quoted 1 line
HOST RESUME(900mA)->DISCONNECT(0mA)
---------------------------
I have a question. Can the provider device driver(e.g., extcon-max77693.c/
extcon-max8997.c) detect the changed state of host? I'd like to see the example device driver that the provider device driver detect changed state of host.
Could you provide example device driver?Good question. The OTG drivers are capable of identifying the SUSPEND
Quoted 15 lines
Quoted 6 lines
Quoted 6 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
event.
Quoted 3 lines
System cannot setup SDP (USB host) charging with maximum charging current - 500mA (USB2.0/ 900mA(USB 3)) without enumerating the
USB.
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
The USB enumeration can be done only with a USB/OTG driver.
IMHO
Quoted 8 lines
Quoted 7 lines
Quoted 5 lines
Quoted 5 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
the above extcon drivers (extcon-max77693.c/
extcon-max8997.c) are not capable of doing the USB enumeration and identifying the charge current. They can just identify the charger type -SDP/DCP/CDP/ACA/AC.
Quoted 1 line
Quoted 1 line
Quoted 1 line
The intelligence for USB enumeration should be inside USB/OTG
driver.
���{.n�+�������+%�����ݶ��w��{.n�+����{��G�����{ay�ʇڙ�,j��f���h��������z_�(�階�ݢj"���m������G������?����&���~��iO��z��v�^�m����������?�I�
On Tue, Nov 20, 2012 at 09:14:41AM +0000, Tc, Jenny wrote:
[...]
Quoted 24 lines
Quoted 5 lines
For example,
Firstly, thepower_supplycharging framework check state of charger cable whether attached or detached cable. Second, whenpower_supplycharging framework receive the changed state of host system from 'Host system notifier', change charging current of charger cable.Not just SUSPEND, but we need to handle RESUME , UPDATE etc. Also this doesn’t help us to define a standard interface for the charger cable state/properties. IMHO it's not right to provide different interfaces for different cables. This doesn't help us to standardize the charger cable interface.
This thread has been running for a quite long time. Unfortunately we couldn't make an agreement on the final solution. I would like to recap the overall requirement and would like to propose alternate solutions. The requirements is to "Provide a generic interface for charger cable states and charger cable properties"
Even though extcon subsystem handles charger cable states, it's not enough to handle
all kind of charger cable states. It can handle just 2 states CONNECT/DISCONNECT.
But there are scenarios where we need to handle more than 2 states
(eg. USB SUSPEND/RESUME/UPDATE etc). Also extcon doesn't have any mechanism to
read cable properties in a generic way. Extcon charger-cable consumer driver implementations (eg charger-manager), defines charger cable properties statically (current in mA) inside the consumer driver. This is not enough, since the charger cable properties may change dynamically
Quoted 4 lines
In existing form extcon cannot support different charger cable states and their properties in a generic way. Also we couldn't find a final solution on how to modify the extcon to support these requirements. From the whole discussion what I conclude is
* extcon is not designed to support cable properties
The idea of using union seemed good to me, what happened to it?
I mean, MyungJoo Ham wrote:
| We may have:
| enum extcon_cable_type {
| EXTCON_CT_REGULATOR,
| EXTCON_CT_PSY,
| EXTCON_CT_CHARGER_CB,
| ...
| };
| and have the following included at struct extcon_cable:
| union {
| struct regulator *reg;
| struct power_supply *psy;
| struct charger_cable *charger_cb;
| ...
| } cable data;
| enum extcon_cable_type cable_type;This sounds good to me...
Quoted 1 line
* extcon is not designed to support any cable state other than CONNECT/DISCONNECT
Dunno for this one. Can we get these additional states via "properties" as described above?
Thanks,
Anton.
Quoted 51 lines · Anton Vorontsov
On Tue, Nov 20, 2012 at 09:14:41AM +0000, Tc, Jenny wrote:
[...]Quoted 24 lines
Quoted 5 lines
For example,
Firstly, thepower_supplycharging framework check state of charger cable whether attached or detached cable. Second, whenpower_supplycharging framework receive the changed state of host system from 'Host system notifier', change charging current of charger cable.Not just SUSPEND, but we need to handle RESUME , UPDATE etc. Also this doesn’t help us to define a standard interface for the charger cable state/properties. IMHO it's not right to provide different interfaces for different cables. This doesn't help us to standardize the charger cable interface.
This thread has been running for a quite long time. Unfortunately we couldn't make an agreement on the final solution. I would like to recap the overall requirement and would like to propose alternate solutions. The requirements is to "Provide a generic interface for charger cable states and charger cable properties"
Even though extcon subsystem handles charger cable states, it's not enough to handle
all kind of charger cable states. It can handle just 2 states CONNECT/DISCONNECT.
But there are scenarios where we need to handle more than 2 states
(eg. USB SUSPEND/RESUME/UPDATE etc). Also extcon doesn't have any mechanism to
read cable properties in a generic way. Extcon charger-cable consumer driver implementations (eg charger-manager), defines charger cable properties statically (current in mA) inside the consumer driver. This is not enough, since the charger cable properties may change dynamicallyQuoted 4 lines
In existing form extcon cannot support different charger cable states and their properties in a generic way. Also we couldn't find a final solution on how to modify the extcon to support these requirements. From the whole discussion what I conclude is
* extcon is not designed to support cable propertiesThe idea of using union seemed good to me, what happened to it?
I mean, MyungJoo Ham wrote:
| We may have: | enum extcon_cable_type { | EXTCON_CT_REGULATOR, | EXTCON_CT_PSY, | EXTCON_CT_CHARGER_CB, | ... | }; | and have the following included at struct extcon_cable: | union { | struct regulator *reg; | struct power_supply *psy; | struct charger_cable *charger_cb; | ... | } cable data; | enum extcon_cable_type cable_type;
Quoted 1 line
This sounds good to me...
+1 for this idea.
Quoted 8 lines
Quoted 2 lines
* extcon is not designed to support any cable state other than CONNECT/DISCONNECT
Dunno for this one. Can we get these additional states via "properties" as described above?
Thanks,
Anton.
Quoted 55 lines
Quoted 10 lines
Quoted 5 lines
For example,
Firstly, thepower_supplycharging framework check state of charger cable whether attached or detached cable. Second, whenpower_supplycharging framework receive the changed state of host system from 'Host system notifier', change charging current of charger cable.Not just SUSPEND, but we need to handle RESUME , UPDATE etc. Also this doesn’t help us to define a standard interface for the charger cable state/properties. IMHO it's not right to provide different interfaces for different cables. This doesn't help us to standardize the
charger cable interface.
Quoted 5 lines
This thread has been running for a quite long time. Unfortunately we couldn't make an agreement on the final solution. I would like to recap the overall requirement and would like to propose alternate solutions. The requirements is to "Provide a generic interface for charger
cable states and charger cable properties"
Quoted 3 lines
Even though extcon subsystem handles charger cable states, it's not enough to handle all kind of charger cable states. It can handle just 2 states
CONNECT/DISCONNECT.
Quoted 8 lines
But there are scenarios where we need to handle more than 2 states (eg. USB SUSPEND/RESUME/UPDATE etc). Also extcon doesn't have any mechanism to read cable properties in a generic way. Extcon charger-cable consumer driver implementations (eg charger-manager), defines charger cable properties statically (current in mA) inside the consumer driver. This is not enough, since the charger cable properties may change dynamically
Quoted 5 lines
In existing form extcon cannot support different charger cable states and their properties in a generic way. Also we couldn't find a final solution on how to modify the extcon to support these requirements. From the whole discussion what I conclude is
* extcon is not designed to support cable propertiesThe idea of using union seemed good to me, what happened to it?
I mean, MyungJoo Ham wrote:
| We may have: | enum extcon_cable_type { | EXTCON_CT_REGULATOR, | EXTCON_CT_PSY, | EXTCON_CT_CHARGER_CB, | ... | }; | and have the following included at struct extcon_cable: | union { | struct regulator *reg; | struct power_supply *psy; | struct charger_cable *charger_cb; | ... | } cable data; | enum extcon_cable_type cable_type;
Quoted 1 line
This sounds good to me...
If I am right, this logic will help the consumer to know who will provide the properties and states. But currently none of these subsystems are capable of giving the charger cable properties because the information will be available only to the "provider driver". The provider driver need not to be in any of these subsystem. For example if the OTG driver need to notify the cable state (CONNECT/DISCONNECT/SUSPEND/RESUME..) and the properties (current in mA), it doesn't make sense to register the OTG driver with any of these subsystems.
But still it make sense to register with extcon since it can give the cable state information. I think this is applicable for all cable provider drivers.
If we are fine with union, then can we have the cable properties defined as unions?
struct charger_cable_props {
unsigned long state;
int mA;
}
struct extcon_cable {
.....
union {
struct charger_cable_props chrgr_props;
.....
} data;
enum extcon_cable_name cable_name;
};This way we are not restricting the cable properties just to the charger cable. We can add other charger cable properties as we identify the properties for them. We can use the cable_name variable to identify which cable property to use.
Quoted 7 lines
Quoted 3 lines
* extcon is not designed to support any cable state other than
CONNECT/DISCONNECDunno for this one. Can we get these additional states via "properties" as described above?
Quoted 7 lines
Thanks,
Anton.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected] More majordomo info at
http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
���{.n�+�������+%�����ݶ��w��{.n�+����{��G�����{ay�ʇڙ�,j��f���h��������z_�(�階�ݢj"���m������G������?����&���~��iO��z��v�^�m����������?�I�
On Tue, Nov 20, 2012 at 11:08:54AM +0000, Tc, Jenny wrote:
[...]
Quoted 15 lines
Quoted 15 lines
| We may have: | enum extcon_cable_type { | EXTCON_CT_REGULATOR, | EXTCON_CT_PSY, | EXTCON_CT_CHARGER_CB, | ... | }; | and have the following included at struct extcon_cable: | union { | struct regulator *reg; | struct power_supply *psy; | struct charger_cable *charger_cb; | ... | } cable data; | enum extcon_cable_type cable_type;
[...]
Quoted 13 lines
struct charger_cable_props {
unsigned long state;
int mA;
}
struct extcon_cable {
.....
union {
struct charger_cable_props chrgr_props;
.....
} data;
enum extcon_cable_name cable_name;
};Quoted 2 lines
This way we are not restricting the cable properties just to the charger cable. We can add other charger cable properties as we identify the properties for them.
Well, to me, it seems that if we have cable *type*, then having properties of the cable is the next logical step.
So, personally I see nothing wrong with it.
But you can look at this at the different angle: the type is just another property of the cable. Would it be better to have power_supply-like API for extcon? :)
if (extcon->get_prop(extcon, EXC_PROP_TYPE) == EXC_TYPE_CHARGER)) {
int max_uA = extcon->get_prop(extcon, EXC_PROP_MAX_CURRENT;
...
}Quoted 1 line
We can use the
cable_namevariable to identify which cable property to use.
This I didn't get, tho. Why would 'cable_name' tell us which property to use?. The type of the cable defines a set of its properties -- this I can understand.
Thanks,
Anton.