Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1730059 > unrolled thread

[PATCH 1/5] staging: typec: tcpm: Drop commented out code

Started byGuenter Roeck <linux@roeck-us.net>
First post2017-09-10 22:40 +0200
Last post2017-09-11 22:00 +0200
Articles 10 — 4 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH 1/5] staging: typec: tcpm: Drop commented out code Guenter Roeck <linux@roeck-us.net> - 2017-09-10 22:40 +0200
    [PATCH 3/5] staging: typec: pd: Document struct pd_message Guenter Roeck <linux@roeck-us.net> - 2017-09-10 22:40 +0200
      Re: [PATCH 3/5] staging: typec: pd: Document struct pd_message Sergei Shtylyov <sergei.shtylyov@cogentembedded.com> - 2017-09-11 12:10 +0200
    [PATCH 2/5] staging: typec: tcpm: Document data structures Guenter Roeck <linux@roeck-us.net> - 2017-09-10 22:40 +0200
    Re: [PATCH 4/5] typec: tcpm: Move out of staging Joe Perches <joe@perches.com> - 2017-09-10 22:50 +0200
      Re: [PATCH 4/5] typec: tcpm: Move out of staging Guenter Roeck <linux@roeck-us.net> - 2017-09-10 23:20 +0200
    Re: [PATCH 1/5] staging: typec: tcpm: Drop commented out code Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-09-11 18:30 +0200
      Re: [PATCH 1/5] staging: typec: tcpm: Drop commented out code Guenter Roeck <linux@roeck-us.net> - 2017-09-11 19:40 +0200
        Re: [PATCH 1/5] staging: typec: tcpm: Drop commented out code Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-09-11 20:30 +0200
          Re: [PATCH 1/5] staging: typec: tcpm: Drop commented out code Guenter Roeck <linux@roeck-us.net> - 2017-09-11 22:00 +0200

#1730059 — [PATCH 1/5] staging: typec: tcpm: Drop commented out code

FromGuenter Roeck <linux@roeck-us.net>
Date2017-09-10 22:40 +0200
Subject[PATCH 1/5] staging: typec: tcpm: Drop commented out code
Message-ID<uohbj-Dm-3@gated-at.bofh.it>
Commented out code can be added as needed. Drop it.
Also drop TODO and an obsolete XXX comment.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
---
 drivers/staging/typec/tcpm.c | 37 +------------------------------------
 1 file changed, 1 insertion(+), 36 deletions(-)

diff --git a/drivers/staging/typec/tcpm.c b/drivers/staging/typec/tcpm.c
index 8af62e74d54c..cb25ec8334b0 100644
--- a/drivers/staging/typec/tcpm.c
+++ b/drivers/staging/typec/tcpm.c
@@ -908,27 +908,6 @@ static void svdm_consume_identity(struct tcpm_port *port, const __le32 *payload,
 
 	memset(&port->mode_data, 0, sizeof(port->mode_data));
 
-#if 0 /* Not really a match */
-	switch (PD_IDH_PTYPE(vdo)) {
-	case IDH_PTYPE_UNDEF:
-		port->partner.type = TYPEC_PARTNER_NONE; /* no longer exists */
-		break;
-	case IDH_PTYPE_HUB:
-		break;
-	case IDH_PTYPE_PERIPH:
-		break;
-	case IDH_PTYPE_PCABLE:
-		break;
-	case IDH_PTYPE_ACABLE:
-		break;
-	case IDH_PTYPE_AMA:
-		port->partner.type = TYPEC_PARTNER_ALTMODE;
-		break;
-	default:
-		break;
-	}
-#endif
-
 	port->partner_ident.id_header = vdo;
 	port->partner_ident.cert_stat = le32_to_cpu(payload[VDO_INDEX_CSTAT]);
 	port->partner_ident.product = product;
@@ -1103,11 +1082,7 @@ static int tcpm_pd_svdm(struct tcpm_port *port, const __le32 *payload, int cnt,
 				response[0] = VDO(svid, 1, CMD_DISCOVER_MODES);
 				rlen = 1;
 			} else {
-#if 0
-				response[0] = pd_dfp_enter_mode(port, 0, 0);
-				if (response[0])
-					rlen = 1;
-#endif
+				/* enter alternate mode if/when implemented */
 			}
 			break;
 		case CMD_ENTER_MODE:
@@ -1145,10 +1120,6 @@ static void tcpm_handle_vdm_request(struct tcpm_port *port,
 
 	if (PD_VDO_SVDM(p0))
 		rlen = tcpm_pd_svdm(port, payload, cnt, response);
-#if 0
-	else
-		rlen = tcpm_pd_custom_vdm(port, cnt, payload, response);
-#endif
 
 	if (rlen > 0) {
 		tcpm_queue_vdm(port, response[0], &response[1], rlen - 1);
@@ -2442,7 +2413,6 @@ static void run_state_machine(struct tcpm_port *port)
 			tcpm_set_state(port, SNK_STARTUP, 0);
 		break;
 	case SNK_STARTUP:
-		/* XXX: callback into infrastructure */
 		opmode =  tcpm_get_pwr_opmode(port->polarity ?
 					      port->cc2 : port->cc1);
 		typec_set_pwr_opmode(port->typec_port, opmode);
@@ -3589,11 +3559,6 @@ struct tcpm_port *tcpm_register_port(struct device *dev, struct tcpc_dev *tcpc)
 
 	port->partner_desc.identity = &port->partner_ident;
 	port->port_type = tcpc->config->type;
-	/*
-	 * TODO:
-	 *  - alt_modes, set_alt_mode
-	 *  - {debug,audio}_accessory
-	 */
 
 	port->typec_port = typec_register_port(port->dev, &port->typec_caps);
 	if (!port->typec_port) {
-- 
2.7.4

[toc] | [next] | [standalone]


#1730060 — [PATCH 3/5] staging: typec: pd: Document struct pd_message

FromGuenter Roeck <linux@roeck-us.net>
Date2017-09-10 22:40 +0200
Subject[PATCH 3/5] staging: typec: pd: Document struct pd_message
Message-ID<uohbl-Dm-11@gated-at.bofh.it>
In reply to#1730059
struct pd_message is the format of a PD message as seen on the wire.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
---
 drivers/staging/typec/pd.h | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/staging/typec/pd.h b/drivers/staging/typec/pd.h
index 30b32ad72acd..42a10883a2cb 100644
--- a/drivers/staging/typec/pd.h
+++ b/drivers/staging/typec/pd.h
@@ -104,6 +104,11 @@ static inline unsigned int pd_header_msgid_le(__le16 header)
 
 #define PD_MAX_PAYLOAD		7
 
+/*
+ * struct pd_message - PD message as seen on wire
+ * @header:	PD message header
+ * @payload:	PD message payload
+ */
 struct pd_message {
 	__le16 header;
 	__le32 payload[PD_MAX_PAYLOAD];
-- 
2.7.4

[toc] | [prev] | [next] | [standalone]


#1730253 — Re: [PATCH 3/5] staging: typec: pd: Document struct pd_message

FromSergei Shtylyov <sergei.shtylyov@cogentembedded.com>
Date2017-09-11 12:10 +0200
SubjectRe: [PATCH 3/5] staging: typec: pd: Document struct pd_message
Message-ID<uotPb-1xj-5@gated-at.bofh.it>
In reply to#1730060
Hello.

On 9/10/2017 11:37 PM, Guenter Roeck wrote:

> struct pd_message is the format of a PD message as seen on the wire.
> 
> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
> ---
>   drivers/staging/typec/pd.h | 5 +++++
>   1 file changed, 5 insertions(+)
> 
> diff --git a/drivers/staging/typec/pd.h b/drivers/staging/typec/pd.h
> index 30b32ad72acd..42a10883a2cb 100644
> --- a/drivers/staging/typec/pd.h
> +++ b/drivers/staging/typec/pd.h
> @@ -104,6 +104,11 @@ static inline unsigned int pd_header_msgid_le(__le16 header)
>   
>   #define PD_MAX_PAYLOAD		7
>   
> +/*

    The kernel-doc comments (to which this comment looks alike) should start 
with /**.

> + * struct pd_message - PD message as seen on wire
> + * @header:	PD message header
> + * @payload:	PD message payload
> + */
>   struct pd_message {
>   	__le16 header;
>   	__le32 payload[PD_MAX_PAYLOAD];

MBR, Sergei

[toc] | [prev] | [next] | [standalone]


#1730063 — [PATCH 2/5] staging: typec: tcpm: Document data structures

FromGuenter Roeck <linux@roeck-us.net>
Date2017-09-10 22:40 +0200
Subject[PATCH 2/5] staging: typec: tcpm: Document data structures
Message-ID<uohbn-Dm-27@gated-at.bofh.it>
In reply to#1730059
Document struct tcpc_config and struct tcpc_dev.
Drop unused TCPC_USB_SWITCH_RESTORE.

Signed-off-by: Guenter Roeck <linux@roeck-us.net>
---
 drivers/staging/typec/tcpm.h | 57 ++++++++++++++++++++++++++++++++++++++------
 1 file changed, 50 insertions(+), 7 deletions(-)

diff --git a/drivers/staging/typec/tcpm.h b/drivers/staging/typec/tcpm.h
index 7e9a6b7b5cd6..073197f0d2bb 100644
--- a/drivers/staging/typec/tcpm.h
+++ b/drivers/staging/typec/tcpm.h
@@ -54,6 +54,27 @@ enum tcpm_transmit_type {
 	TCPC_TX_BIST_MODE_2 = 7
 };
 
+/**
+ * struct tcpc_config - Port configuration
+ * @src_pdo:	PDO parameters sent to port partner as response to
+ *		PD_CTRL_GET_SOURCE_CAP message
+ * @nr_src_pdo:	Number of entries in @src_pdo
+ * @snk_pdo:	PDO parameters sent to partner as response to
+ *		PD_CTRL_GET_SINK_CAP message
+ * @nr_snk_pdo:	Number of entries in @snk_pdo
+ * @max_snk_mv:	Maximum acceptable sink voltage in mV
+ * @max_snk_ma:	Maximum sink current in mA
+ * @max_snk_mw:	Maximum required sink power in mW
+ * @operating_snk_mw:
+ *		Required operating sink power in mW
+ * @type:	Port type (TYPEC_PORT_DFP, TYPEC_PORT_UFP, or
+ *		TYPEC_PORT_DRP)
+ * @default_role:
+ *		Default port role (TYPEC_SINK or TYPEC_SOURCE).
+ *		Set to TYPEC_NO_PREFERRED_ROLE if no default role.
+ * @try_role_hw:True if try.{Src,Snk} is implemented in hardware
+ * @alt_modes:	List of supported alternate modes
+ */
 struct tcpc_config {
 	const u32 *src_pdo;
 	unsigned int nr_src_pdo;
@@ -79,7 +100,6 @@ struct tcpc_config {
 enum tcpc_usb_switch {
 	TCPC_USB_SWITCH_CONNECT,
 	TCPC_USB_SWITCH_DISCONNECT,
-	TCPC_USB_SWITCH_RESTORE,	/* TODO FIXME */
 };
 
 /* Mux state attributes */
@@ -104,17 +124,40 @@ struct tcpc_mux_dev {
 	void *priv_data;
 };
 
+/**
+ * struct tcpc_dev - Port configuration and callback functions
+ * @config:	Pointer to port configuration
+ * @get_vbus:	Called to read current VBUS state
+ * @get_current_limit:
+ *		Optional; called by the tcpm core when configured as a snk
+ *		and cc=Rp-def. This allows the tcpm to provide a fallback
+ *		current-limit detection method for the cc=Rp-def case.
+ *		For example, some tcpcs may include BC1.2 charger detection
+ *		and use that in this case.
+ * @set_cc:	Called to set value of CC pins
+ * @get_cc:	Called to read current CC pin values
+ * @set_polarity:
+ *		Called to set polarity
+ * @set_vconn:	Called to enable or disable VCONN
+ * @set_vbus:	Called to enable or disable VBUS
+ * @set_current_limit:
+ *		Optional; called to set current limit as negotiated
+ *		with partner.
+ * @set_pd_rx:	Called to enable or disable reception of PD messages
+ * @set_roles:	Called to set power and data roles
+ * @start_drp_toggling:
+ *		Optional; if supported by hardware, called to start DRP
+ *		toggling. DRP toggling is stopped automatically if
+ *		a connection is established.
+ * @try_role:	Optional; called to set a preferred role
+ * @pd_transmit:Called to transmit PD message
+ * @mux:	Pointer to multiplexer data
+ */
 struct tcpc_dev {
 	const struct tcpc_config *config;
 
 	int (*init)(struct tcpc_dev *dev);
 	int (*get_vbus)(struct tcpc_dev *dev);
-	/*
-	 * This optional callback gets called by the tcpm core when configured
-	 * as a snk and cc=Rp-def. This allows the tcpm to provide a fallback
-	 * current-limit detection method for the cc=Rp-def case. E.g. some
-	 * tcpcs may include BC1.2 charger detection and use that in this case.
-	 */
 	int (*get_current_limit)(struct tcpc_dev *dev);
 	int (*set_cc)(struct tcpc_dev *dev, enum typec_cc_status cc);
 	int (*get_cc)(struct tcpc_dev *dev, enum typec_cc_status *cc1,
-- 
2.7.4

[toc] | [prev] | [next] | [standalone]


#1730065 — Re: [PATCH 4/5] typec: tcpm: Move out of staging

FromJoe Perches <joe@perches.com>
Date2017-09-10 22:50 +0200
SubjectRe: [PATCH 4/5] typec: tcpm: Move out of staging
Message-ID<uohkZ-HY-5@gated-at.bofh.it>
In reply to#1730059
On Sun, 2017-09-10 at 13:37 -0700, Guenter Roeck wrote:
> Move tcpm (USB Type-C Port Manager) out of staging.

git format-patch -M

[toc] | [prev] | [next] | [standalone]


#1730070 — Re: [PATCH 4/5] typec: tcpm: Move out of staging

FromGuenter Roeck <linux@roeck-us.net>
Date2017-09-10 23:20 +0200
SubjectRe: [PATCH 4/5] typec: tcpm: Move out of staging
Message-ID<uohO2-1dX-9@gated-at.bofh.it>
In reply to#1730065
On 09/10/2017 01:46 PM, Joe Perches wrote:
> On Sun, 2017-09-10 at 13:37 -0700, Guenter Roeck wrote:
>> Move tcpm (USB Type-C Port Manager) out of staging.
> 
> git format-patch -M
> 
> 
Thanks - I'll resend but wait a bit for additional comments before I do.

Guenter

[toc] | [prev] | [next] | [standalone]


#1730429

FromGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Date2017-09-11 18:30 +0200
Message-ID<uozKW-5Lj-13@gated-at.bofh.it>
In reply to#1730059
On Sun, Sep 10, 2017 at 01:37:01PM -0700, Guenter Roeck wrote:
> Commented out code can be added as needed. Drop it.
> Also drop TODO and an obsolete XXX comment.
> 
> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
> ---
>  drivers/staging/typec/tcpm.c | 37 +------------------------------------
>  1 file changed, 1 insertion(+), 36 deletions(-)

Thans for the series, I'll queue it up once 4.14-rc1 is out and make a
branch that can get pulled into both the staging and usb trees, so that
future work on this can all happen through the usb tree.

thanks,

greg k-h

[toc] | [prev] | [next] | [standalone]


#1730463

FromGuenter Roeck <linux@roeck-us.net>
Date2017-09-11 19:40 +0200
Message-ID<uoAQF-6s2-11@gated-at.bofh.it>
In reply to#1730429
On Mon, Sep 11, 2017 at 09:23:34AM -0700, Greg Kroah-Hartman wrote:
> On Sun, Sep 10, 2017 at 01:37:01PM -0700, Guenter Roeck wrote:
> > Commented out code can be added as needed. Drop it.
> > Also drop TODO and an obsolete XXX comment.
> > 
> > Signed-off-by: Guenter Roeck <linux@roeck-us.net>
> > ---
> >  drivers/staging/typec/tcpm.c | 37 +------------------------------------
> >  1 file changed, 1 insertion(+), 36 deletions(-)
> 
> Thans for the series, I'll queue it up once 4.14-rc1 is out and make a
> branch that can get pulled into both the staging and usb trees, so that
> future work on this can all happen through the usb tree.
> 
Should I resend to add the '/**' in patch 3, or can you take care of it ?

Thanks,
Guenter

[toc] | [prev] | [next] | [standalone]


#1730470

FromGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Date2017-09-11 20:30 +0200
Message-ID<uoBD4-6YB-3@gated-at.bofh.it>
In reply to#1730463
On Mon, Sep 11, 2017 at 10:37:11AM -0700, Guenter Roeck wrote:
> On Mon, Sep 11, 2017 at 09:23:34AM -0700, Greg Kroah-Hartman wrote:
> > On Sun, Sep 10, 2017 at 01:37:01PM -0700, Guenter Roeck wrote:
> > > Commented out code can be added as needed. Drop it.
> > > Also drop TODO and an obsolete XXX comment.
> > > 
> > > Signed-off-by: Guenter Roeck <linux@roeck-us.net>
> > > ---
> > >  drivers/staging/typec/tcpm.c | 37 +------------------------------------
> > >  1 file changed, 1 insertion(+), 36 deletions(-)
> > 
> > Thans for the series, I'll queue it up once 4.14-rc1 is out and make a
> > branch that can get pulled into both the staging and usb trees, so that
> > future work on this can all happen through the usb tree.
> > 
> Should I resend to add the '/**' in patch 3, or can you take care of it ?

A resend, with -M format, would always be appreciated :)

thanks,

greg k-h

[toc] | [prev] | [next] | [standalone]


#1730506

FromGuenter Roeck <linux@roeck-us.net>
Date2017-09-11 22:00 +0200
Message-ID<uoD2a-7Me-17@gated-at.bofh.it>
In reply to#1730470
On Mon, Sep 11, 2017 at 11:26:01AM -0700, Greg Kroah-Hartman wrote:
> On Mon, Sep 11, 2017 at 10:37:11AM -0700, Guenter Roeck wrote:
> > On Mon, Sep 11, 2017 at 09:23:34AM -0700, Greg Kroah-Hartman wrote:
> > > On Sun, Sep 10, 2017 at 01:37:01PM -0700, Guenter Roeck wrote:
> > > > Commented out code can be added as needed. Drop it.
> > > > Also drop TODO and an obsolete XXX comment.
> > > > 
> > > > Signed-off-by: Guenter Roeck <linux@roeck-us.net>
> > > > ---
> > > >  drivers/staging/typec/tcpm.c | 37 +------------------------------------
> > > >  1 file changed, 1 insertion(+), 36 deletions(-)
> > > 
> > > Thans for the series, I'll queue it up once 4.14-rc1 is out and make a
> > > branch that can get pulled into both the staging and usb trees, so that
> > > future work on this can all happen through the usb tree.
> > > 
> > Should I resend to add the '/**' in patch 3, or can you take care of it ?
> 
> A resend, with -M format, would always be appreciated :)
> 
I did that, as v2, but it does not include the comment change in patch 3.

I'll send v3 tonight.

Guenter

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web