linux-rockchip.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Chanwoo Choi <cw00.choi-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
To: Chris Zhong <zyw-TNX95d0MmH7DzftRWevZcw@public.gmane.org>,
	dianders-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org,
	tfiga-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org,
	heiko-4mtYJXux2i+zQB+pC5nmwQ@public.gmane.org,
	yzq-TNX95d0MmH7DzftRWevZcw@public.gmane.org,
	groeck-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org,
	myungjoo.ham-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org,
	wulf-TNX95d0MmH7DzftRWevZcw@public.gmane.org,
	marcheu-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org
Cc: linux-rockchip-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: [v5 PATCH 1/5] extcon: Add Type-C and DP support
Date: Wed, 13 Jul 2016 10:11:14 +0900	[thread overview]
Message-ID: <57859532.1010002@samsung.com> (raw)
In-Reply-To: <1468336188-565-2-git-send-email-zyw-TNX95d0MmH7DzftRWevZcw@public.gmane.org>

Hi Chris,

I'm now developing the extcon property on extcon-test branch.
But, it has not been completed.

On next version, I'll remove the notification about extcon property
and only support the following two functions.
- extcon_set_cable_property()
- extcon_get_cable_property()

Because the number of properties would be risen and the all properties
depend on the specific external connector(e.g., EXTCON_PROP_USB_VBUS
depend on the EXTCON_TYPE_USB type). When the specific external connector
is detached, extcon framework should make the property state as default state.

It may send the too many notification for extcon property.
For example, Assume that EXTCON_TYPE_USB has the over 20 properties,
when EXTCON_USB or EXTCON_USB_HOST is detached, extcon should send
the notification for the over 20 properties and one more notificaiton
for state of external connector.

So, I'll send the RFC patchset without the notification of proerty.

Lastly,
I have a comment on below.

Thanks,
Chanwoo Choi

On 2016년 07월 13일 00:09, Chris Zhong wrote:
> Add EXTCON_DISP_DP for the Display external connector. For Type-C
> connector the DisplayPort can work as an Alternate Mode(VESA DisplayPort
> Alt Mode on USB Type-C Standard). The Type-C support both normal and
> flipped orientation, so add a property to extcon.
> 
> Signe-off-by: Chris Zhong <zyw@rock-chips.com>
> 
> Signed-off-by: Chris Zhong <zyw@rock-chips.com>
> ---
> 
> Changes in v5:
> - support get property
> 
> Changes in v4: None
> Changes in v3: None
> Changes in v2: None
> Changes in v1: None
> 
>  drivers/extcon/extcon.c | 28 ++++++++++++++++++++++++++++
>  include/linux/extcon.h  | 13 +++++++++++++
>  2 files changed, 41 insertions(+)
> 
> diff --git a/drivers/extcon/extcon.c b/drivers/extcon/extcon.c
> index a1117db..2591b28 100644
> --- a/drivers/extcon/extcon.c
> +++ b/drivers/extcon/extcon.c
> @@ -157,6 +157,11 @@ struct __extcon_info {
>  		.id = EXTCON_DISP_VGA,
>  		.name = "VGA",
>  	},
> +	[EXTCON_DISP_DP] = {
> +		.type = EXTCON_TYPE_DISP,
> +		.id = EXTCON_DISP_DP,
> +		.name = "DP",
> +	},
>  
>  	/* Miscellaneous external connector */
>  	[EXTCON_DOCK] = {
> @@ -270,6 +275,7 @@ static bool is_extcon_property_supported(unsigned int id,
>  		switch (prop) {
>  		case EXTCON_PROP_USB_ID:
>  		case EXTCON_PROP_USB_VBUS:
> +		case EXTCON_PROP_TYPEC_POLARITY:
>  			return true;
>  		default:
>  			break;
> @@ -286,6 +292,8 @@ static bool is_extcon_property_supported(unsigned int id,
>  		}
>  	case EXTCON_TYPE_DISP:
>  		switch (prop) {
> +		case EXTCON_PROP_TYPEC_POLARITY:

Should EXTCON_PROP_TYPEC_POLARITY property add to both EXTCON_TYPE_USB and EXTCON_TYP_DISP?
EXTCON_PROP_TYPEC_POLARITY is the property of USB C-type?

> +			return true;
>  		default:
>  			break;
>  		}
> @@ -547,6 +555,26 @@ int extcon_get_cable_property(struct extcon_dev *edev, unsigned int id,
>  				enum extcon_property prop,
>  				union extcon_property_value *val)
>  {
> +	struct extcon_cable *cable;
> +	int index;
> +
> +	if (!edev)
> +		return -EINVAL;
> +
> +	/* Check the property whether is supported or not */
> +	if (!is_extcon_property_supported(id, prop))
> +		return -EINVAL;
> +
> +	/* Find the cable index of external connector by using id */
> +	index = find_cable_index_by_id(edev, id);
> +	if (index < 0)
> +		return index;
> +
> +	/* Store the property value */
> +	cable = &edev->cables[index];
> +
> +	val->intval = cable->propval[prop].intval;
> +
>  	return 0;
>  }

After I develop it about get_cable_property, I'll send RFC patchset.

>  
> diff --git a/include/linux/extcon.h b/include/linux/extcon.h
> index f6f0a8d..50ef87f 100644
> --- a/include/linux/extcon.h
> +++ b/include/linux/extcon.h
> @@ -77,6 +77,7 @@ enum extcon_type {
>  #define EXTCON_DISP_MHL		41	/* Mobile High-Definition Link */
>  #define EXTCON_DISP_DVI		42	/* Digital Visual Interface */
>  #define EXTCON_DISP_VGA		43	/* Video Graphics Array */
> +#define EXTCON_DISP_DP		44	/* DisplayPort */
>  
>  /* Miscellaneous external connector */
>  #define EXTCON_DOCK		60
> @@ -108,9 +109,13 @@ enum extcon_property {
>  	 * - EXTCON_PROP_USB_USB
>  	 * @type:	integer (int value)
>  	 * @value:	0 (low) or 1 (high)
> +	 * - EXTCON_PROP_TYPEC_POLARITY,
> +	 * @type:	integer (int value)
> +	 * @value:	0 (normal) or 1 (flip)
>  	 */
>  	EXTCON_PROP_USB_ID = 0,
>  	EXTCON_PROP_USB_VBUS,
> +	EXTCON_PROP_TYPEC_POLARITY,
>  
>  	/* Properties of EXTCON_TYPE_CHG. */
>  	/* Properties of EXTCON_TYPE_JACK. */
> @@ -225,6 +230,14 @@ extern int extcon_get_cable_state_(struct extcon_dev *edev, unsigned int id);
>  extern int extcon_set_cable_state_(struct extcon_dev *edev, unsigned int id,
>  				   bool cable_state);
>  
> +extern int extcon_get_cable_property(struct extcon_dev *edev, unsigned int id,
> +				     enum extcon_property prop,
> +				     union extcon_property_value *val);
> +
> +extern int extcon_set_cable_property(struct extcon_dev *edev, unsigned int id,
> +				     enum extcon_property prop,
> +				     union extcon_property_value val);
> +

ditto.

Thanks,
Chanwoo Choi

_______________________________________________
Linux-rockchip mailing list
Linux-rockchip@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-rockchip

  parent reply	other threads:[~2016-07-13  1:11 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-12 15:09 [v5 PATCH 0/5] Rockchip Type-C and DisplayPort driver Chris Zhong
     [not found] ` <1468336188-565-1-git-send-email-zyw-TNX95d0MmH7DzftRWevZcw@public.gmane.org>
2016-07-12 15:09   ` [v5 PATCH 1/5] extcon: Add Type-C and DP support Chris Zhong
     [not found]     ` <1468336188-565-2-git-send-email-zyw-TNX95d0MmH7DzftRWevZcw@public.gmane.org>
2016-07-13  1:11       ` Chanwoo Choi [this message]
     [not found]         ` <57859532.1010002-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
2016-07-13  1:39           ` Chris Zhong
2016-07-13  2:05             ` Chanwoo Choi
     [not found]               ` <5785A1F3.1020703-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
2016-07-13  2:54                 ` Chris Zhong
     [not found]                   ` <5785AD61.3070307-TNX95d0MmH7DzftRWevZcw@public.gmane.org>
2016-07-14  0:49                     ` Chanwoo Choi
     [not found]                       ` <5786E1B6.2000805-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
2016-07-14  1:03                         ` Chris Zhong
2016-07-14  1:15                           ` Chanwoo Choi
2016-07-14  2:07                             ` Chris Zhong
2016-07-14  2:10                               ` Chanwoo Choi
2016-07-12 15:09 ` [v5 PATCH 2/5] Documentation: bindings: add dt doc for Rockchip USB Type-C PHY Chris Zhong
2016-07-12 15:09 ` [v5 PATCH 3/5] phy: Add USB Type-C PHY driver for rk3399 Chris Zhong
2016-07-12 15:09 ` [v5 PATCH 4/5] Documentation: bindings: add dt documentation for cdn DP controller Chris Zhong
2016-07-12 15:09 ` [v5 PATCH 5/5] drm/rockchip: cdn-dp: add cdn DP support for rk3399 Chris Zhong
     [not found]   ` <1468336188-565-6-git-send-email-zyw-TNX95d0MmH7DzftRWevZcw@public.gmane.org>
2016-07-13 13:59     ` Sean Paul
2016-07-14  3:08       ` Chris Zhong
2016-07-14 14:02         ` Sean Paul
2016-07-15  5:52           ` [v5.1 " Chris Zhong
2016-07-15  8:18           ` [v5.2 " Chris Zhong
2016-07-19 16:44             ` Sean Paul

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=57859532.1010002@samsung.com \
    --to=cw00.choi-sze3o3uu22jbdgjk7y7tuq@public.gmane.org \
    --cc=dianders-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org \
    --cc=groeck-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org \
    --cc=heiko-4mtYJXux2i+zQB+pC5nmwQ@public.gmane.org \
    --cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-rockchip-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org \
    --cc=marcheu-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org \
    --cc=myungjoo.ham-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org \
    --cc=tfiga-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org \
    --cc=wulf-TNX95d0MmH7DzftRWevZcw@public.gmane.org \
    --cc=yzq-TNX95d0MmH7DzftRWevZcw@public.gmane.org \
    --cc=zyw-TNX95d0MmH7DzftRWevZcw@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).