All of lore.kernel.org
 help / color / mirror / Atom feed
* Re: RE: [PATCH] extcon : callback function to read cable property
@ 2012-10-17  7:08 MyungJoo Ham
  2012-10-19  3:13 ` Tc, Jenny
  0 siblings, 1 reply; 23+ messages in thread
From: MyungJoo Ham @ 2012-10-17  7:08 UTC (permalink / raw)
  To: Tc, Jenny, 최찬우
  Cc: linux-kernel@vger.kernel.org, anish kumar

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset=euc-kr, Size: 2738 bytes --]

> Myunjoo/Chanwoo
> 
> Ping...
> Could you please review this patch?
> 
> -jtc
> 
> > > > 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
> > 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?
> > >
> > >
> > 

Hello,


I don't think it's appropriate to declare the charger specific
properties in extcon.h. The status of a charger should be and can be
represented by an instance of regulator, power-supply-class,
or charger-manager.

Thus, we may (I'm still not sure) need to let extcon to relay
the instance (struct device? or char *devname?) with some callback
similar with get_cable_device().  However, allowing (and encouraging)
to pass void pointer of cable_props to extcon users from extcon device
appears not adequete. If the both parties can use their own "private"
data structure, why they cannot simply pass their own data witht the
"private" data channel?
 

Recap:
- The later part of patch: NACK
- The first part of patch (callback): need to reconsider the data type.
We may get device pointer or device name that is correspondant to the
cable, which in turn, guides us to the corresponding data structure
(charger-manager, regulator, or something) However, I'm still not sure
which should be appropriate for this.


Cheers!
MyungJoo
ÿôèº{.nÇ+‰·Ÿ®‰­†+%ŠËÿ±éݶ\x17¥Šwÿº{.nÇ+‰·¥Š{±þG«éÿŠ{ayº\x1dʇڙë,j\a­¢f£¢·hšïêÿ‘êçz_è®\x03(­éšŽŠÝ¢j"ú\x1a¶^[m§ÿÿ¾\a«þG«éÿ¢¸?™¨è­Ú&£ø§~á¶iO•æ¬z·švØ^\x14\x04\x1a¶^[m§ÿÿÃ\fÿ¶ìÿ¢¸?–I¥

^ permalink raw reply	[flat|nested] 23+ messages in thread
* [PATCH] extcon : callback function to read cable property
@ 2012-10-10 10:23 Jenny TC
  2012-10-10 14:45 ` anish kumar
  0 siblings, 1 reply; 23+ messages in thread
From: Jenny TC @ 2012-10-10 10:23 UTC (permalink / raw)
  To: myungjoo.ham, cw00.choi, linux-kernel; +Cc: 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 <jenny.tc@intel.com>
---
 include/linux/extcon.h |   14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/include/linux/extcon.h b/include/linux/extcon.h
index 073fd49..2e61ee0 100644
--- a/include/linux/extcon.h
+++ b/include/linux/extcon.h
@@ -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)
 
 /*
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 23+ messages in thread

end of thread, other threads:[~2012-11-20 11:24 UTC | newest]

Thread overview: 23+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-10-17  7:08 RE: [PATCH] extcon : callback function to read cable property MyungJoo Ham
2012-10-19  3:13 ` Tc, Jenny
2012-10-20  1:40   ` Chanwoo Choi
2012-10-25  3:18     ` Tc, Jenny
  -- strict thread matches above, loose matches on Subject: below --
2012-10-10 10:23 Jenny TC
2012-10-10 14:45 ` anish kumar
2012-10-11  1:20   ` Tc, Jenny
2012-10-11 13:47     ` anish kumar
2012-10-17  6:34       ` Tc, Jenny
2012-11-08  1:25         ` Chanwoo Choi
2012-11-09 14:05           ` Tc, Jenny
2012-11-10  4:18             ` anish kumar
2012-11-15  4:05               ` Tc, Jenny
2012-11-15 19:31                 ` anish singh
2012-11-20  1:39                   ` Tc, Jenny
2012-11-20  2:29                     ` Chanwoo Choi
2012-11-20  2:42                       ` Tc, Jenny
2012-11-20  6:10                         ` Chanwoo Choi
2012-11-20  9:14                           ` Tc, Jenny
2012-11-20  9:24                             ` Anton Vorontsov
2012-11-20  9:32                               ` anish singh
2012-11-20 11:08                               ` Tc, Jenny
2012-11-20 11:21                                 ` Anton Vorontsov

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.