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


Groups > linux.kernel > #1712516 > unrolled thread

[PATCH 2/2] staging: typec: tcpm: explicit_contract is always established

Started byBadhri Jagan Sridharan <badhri@google.com>
First post2017-08-16 01:30 +0200
Last post2017-08-17 21:10 +0200
Articles 4 — 3 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH 2/2] staging: typec: tcpm: explicit_contract is always established Badhri Jagan Sridharan <badhri@google.com> - 2017-08-16 01:30 +0200
    Re: [PATCH 2/2] staging: typec: tcpm: explicit_contract is always  established Guenter Roeck <linux@roeck-us.net> - 2017-08-16 05:40 +0200
    Re: [PATCH 2/2] staging: typec: tcpm: explicit_contract is always  established Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2017-08-17 20:00 +0200
      Re: [PATCH 2/2] staging: typec: tcpm: explicit_contract is always established Badhri Jagan Sridharan <badhri@google.com> - 2017-08-17 21:10 +0200

#1712516 — [PATCH 2/2] staging: typec: tcpm: explicit_contract is always established

FromBadhri Jagan Sridharan <badhri@google.com>
Date2017-08-16 01:30 +0200
Subject[PATCH 2/2] staging: typec: tcpm: explicit_contract is always established
Message-ID<ueTrA-7KN-7@gated-at.bofh.it>
While in SNK_READY state, the explicit_contract seems to be
set to true irrespective of whether an explicit contract
was established for the current connection. TCPM also seems
to report the pwr_opmode as TYPEC_PWR_MODE_PD always once
the port gets into SNK_READY state. This isn't completely
true as port gets into the SNK_READY state for non-pd
type-c ports as well.

This patch sets the explicit_contract flag only when
the PS_READY message is received and the vbus has been
detected by the port controller.

Signed-off-by: Badhri Jagan Sridharan <Badhri@google.com>
---
 drivers/staging/typec/tcpm.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/typec/tcpm.c b/drivers/staging/typec/tcpm.c
index a24e6bbb909c..3e12cf101311 100644
--- a/drivers/staging/typec/tcpm.c
+++ b/drivers/staging/typec/tcpm.c
@@ -1367,6 +1367,7 @@ static void tcpm_pd_ctrl_request(struct tcpm_port *port,
 				tcpm_set_current_limit(port,
 						       port->current_limit,
 						       port->supply_voltage);
+				port->explicit_contract = true;
 				tcpm_set_state(port, SNK_READY, 0);
 			} else {
 				/*
@@ -2458,10 +2459,11 @@ static void run_state_machine(struct tcpm_port *port)
 		break;
 	case SNK_READY:
 		port->try_snk_count = 0;
-		port->explicit_contract = true;
-		typec_set_pwr_opmode(port->typec_port, TYPEC_PWR_MODE_PD);
-		port->pwr_opmode = TYPEC_PWR_MODE_PD;
-
+		if (port->explicit_contract) {
+			typec_set_pwr_opmode(port->typec_port,
+					     TYPEC_PWR_MODE_PD);
+			port->pwr_opmode = TYPEC_PWR_MODE_PD;
+		}
 		tcpm_typec_connect(port);
 
 		tcpm_check_send_discover(port);
@@ -2951,6 +2953,7 @@ static void _tcpm_pd_vbus_on(struct tcpm_port *port)
 	port->vbus_present = true;
 	switch (port->state) {
 	case SNK_TRANSITION_SINK_VBUS:
+		port->explicit_contract = true;
 		tcpm_set_state(port, SNK_READY, 0);
 		break;
 	case SNK_DISCOVERY:
-- 
2.14.1.480.gb18f417b89-goog

[toc] | [next] | [standalone]


#1712639 — Re: [PATCH 2/2] staging: typec: tcpm: explicit_contract is always established

FromGuenter Roeck <linux@roeck-us.net>
Date2017-08-16 05:40 +0200
SubjectRe: [PATCH 2/2] staging: typec: tcpm: explicit_contract is always established
Message-ID<ueXlw-1O3-9@gated-at.bofh.it>
In reply to#1712516
On 08/15/2017 04:23 PM, Badhri Jagan Sridharan wrote:
> While in SNK_READY state, the explicit_contract seems to be
> set to true irrespective of whether an explicit contract
> was established for the current connection. TCPM also seems
> to report the pwr_opmode as TYPEC_PWR_MODE_PD always once
> the port gets into SNK_READY state. This isn't completely
> true as port gets into the SNK_READY state for non-pd
> type-c ports as well.
> 
> This patch sets the explicit_contract flag only when
> the PS_READY message is received and the vbus has been
> detected by the port controller.
> 
> Signed-off-by: Badhri Jagan Sridharan <Badhri@google.com>

Reviewed-by: Guenter Roeck <linux@roeck-us.net>

> ---
>   drivers/staging/typec/tcpm.c | 11 +++++++----
>   1 file changed, 7 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/staging/typec/tcpm.c b/drivers/staging/typec/tcpm.c
> index a24e6bbb909c..3e12cf101311 100644
> --- a/drivers/staging/typec/tcpm.c
> +++ b/drivers/staging/typec/tcpm.c
> @@ -1367,6 +1367,7 @@ static void tcpm_pd_ctrl_request(struct tcpm_port *port,
>   				tcpm_set_current_limit(port,
>   						       port->current_limit,
>   						       port->supply_voltage);
> +				port->explicit_contract = true;
>   				tcpm_set_state(port, SNK_READY, 0);
>   			} else {
>   				/*
> @@ -2458,10 +2459,11 @@ static void run_state_machine(struct tcpm_port *port)
>   		break;
>   	case SNK_READY:
>   		port->try_snk_count = 0;
> -		port->explicit_contract = true;
> -		typec_set_pwr_opmode(port->typec_port, TYPEC_PWR_MODE_PD);
> -		port->pwr_opmode = TYPEC_PWR_MODE_PD;
> -
> +		if (port->explicit_contract) {
> +			typec_set_pwr_opmode(port->typec_port,
> +					     TYPEC_PWR_MODE_PD);
> +			port->pwr_opmode = TYPEC_PWR_MODE_PD;
> +		}
>   		tcpm_typec_connect(port);
>   
>   		tcpm_check_send_discover(port);
> @@ -2951,6 +2953,7 @@ static void _tcpm_pd_vbus_on(struct tcpm_port *port)
>   	port->vbus_present = true;
>   	switch (port->state) {
>   	case SNK_TRANSITION_SINK_VBUS:
> +		port->explicit_contract = true;
>   		tcpm_set_state(port, SNK_READY, 0);
>   		break;
>   	case SNK_DISCOVERY:
> 

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


#1714259 — Re: [PATCH 2/2] staging: typec: tcpm: explicit_contract is always established

FromGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Date2017-08-17 20:00 +0200
SubjectRe: [PATCH 2/2] staging: typec: tcpm: explicit_contract is always established
Message-ID<ufxfk-8ct-15@gated-at.bofh.it>
In reply to#1712516
On Tue, Aug 15, 2017 at 04:23:39PM -0700, Badhri Jagan Sridharan wrote:
> While in SNK_READY state, the explicit_contract seems to be
> set to true irrespective of whether an explicit contract
> was established for the current connection. TCPM also seems
> to report the pwr_opmode as TYPEC_PWR_MODE_PD always once
> the port gets into SNK_READY state. This isn't completely
> true as port gets into the SNK_READY state for non-pd
> type-c ports as well.
> 
> This patch sets the explicit_contract flag only when
> the PS_READY message is received and the vbus has been
> detected by the port controller.
> 
> Signed-off-by: Badhri Jagan Sridharan <Badhri@google.com>
> Reviewed-by: Guenter Roeck <linux@roeck-us.net>
> ---
>  drivers/staging/typec/tcpm.c | 11 +++++++----
>  1 file changed, 7 insertions(+), 4 deletions(-)

This patch doesn't apply to the tree now that Guenter's other patches
are applied :(

Please rebase and resend.

thanks,

greg k-h

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


#1714310

FromBadhri Jagan Sridharan <badhri@google.com>
Date2017-08-17 21:10 +0200
Message-ID<ufyl5-Fn-29@gated-at.bofh.it>
In reply to#1714259
Greg,

Sure. Resending the patch based on
https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git
staging-testing branch.

Thanks,
Badhri

On Thu, Aug 17, 2017 at 10:54 AM, Greg Kroah-Hartman
<gregkh@linuxfoundation.org> wrote:
> On Tue, Aug 15, 2017 at 04:23:39PM -0700, Badhri Jagan Sridharan wrote:
>> While in SNK_READY state, the explicit_contract seems to be
>> set to true irrespective of whether an explicit contract
>> was established for the current connection. TCPM also seems
>> to report the pwr_opmode as TYPEC_PWR_MODE_PD always once
>> the port gets into SNK_READY state. This isn't completely
>> true as port gets into the SNK_READY state for non-pd
>> type-c ports as well.
>>
>> This patch sets the explicit_contract flag only when
>> the PS_READY message is received and the vbus has been
>> detected by the port controller.
>>
>> Signed-off-by: Badhri Jagan Sridharan <Badhri@google.com>
>> Reviewed-by: Guenter Roeck <linux@roeck-us.net>
>> ---
>>  drivers/staging/typec/tcpm.c | 11 +++++++----
>>  1 file changed, 7 insertions(+), 4 deletions(-)
>
> This patch doesn't apply to the tree now that Guenter's other patches
> are applied :(
>
> Please rebase and resend.
>
> thanks,
>
> greg k-h

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web