All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] usb: typec: tcpm: Fix APDO PPS order checking to be based on voltage
@ 2018-09-21 15:04 ` Opensource [Adam Thomson]
  0 siblings, 0 replies; 6+ messages in thread
From: Adam Thomson @ 2018-09-21 15:04 UTC (permalink / raw)
  To: Heikki Krogerus, Guenter Roeck, Greg Kroah-Hartman
  Cc: linux-usb, linux-kernel, stable, support.opensource

Current code mistakenly checks against max current to determine
order but this should be max voltage. This commit fixes the issue
so order is correctly determined, thus avoiding failure based on
a higher voltage PPS APDO having a lower maximum current output,
which is actually valid.

Fixes: 2eadc33f40d4 ("typec: tcpm: Add core support for sink side PPS")
Cc: <stable@vger.kernel.org>
Signed-off-by: Adam Thomson <Adam.Thomson.Opensource@diasemi.com>
---
Code based on usb-testing branch (ae8a2ca8a2215c7e31e6d874f7303801bb15fbb)

 drivers/usb/typec/tcpm/tcpm.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/typec/tcpm/tcpm.c b/drivers/usb/typec/tcpm/tcpm.c
index 4f1f421..c11b3be 100644
--- a/drivers/usb/typec/tcpm/tcpm.c
+++ b/drivers/usb/typec/tcpm/tcpm.c
@@ -1430,8 +1430,8 @@ static enum pdo_err tcpm_caps_err(struct tcpm_port *port, const u32 *pdo,
 				if (pdo_apdo_type(pdo[i]) != APDO_TYPE_PPS)
 					break;
 
-				if (pdo_pps_apdo_max_current(pdo[i]) <
-				    pdo_pps_apdo_max_current(pdo[i - 1]))
+				if (pdo_pps_apdo_max_voltage(pdo[i]) <
+				    pdo_pps_apdo_max_voltage(pdo[i - 1]))
 					return PDO_ERR_PPS_APDO_NOT_SORTED;
 				else if (pdo_pps_apdo_min_voltage(pdo[i]) ==
 					  pdo_pps_apdo_min_voltage(pdo[i - 1]) &&
-- 
1.9.1


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

* usb: typec: tcpm: Fix APDO PPS order checking to be based on voltage
@ 2018-09-21 15:04 ` Opensource [Adam Thomson]
  0 siblings, 0 replies; 6+ messages in thread
From: Opensource [Adam Thomson] @ 2018-09-21 15:04 UTC (permalink / raw)
  To: Heikki Krogerus, Guenter Roeck, Greg Kroah-Hartman
  Cc: linux-usb, linux-kernel, stable, support.opensource

Current code mistakenly checks against max current to determine
order but this should be max voltage. This commit fixes the issue
so order is correctly determined, thus avoiding failure based on
a higher voltage PPS APDO having a lower maximum current output,
which is actually valid.

Fixes: 2eadc33f40d4 ("typec: tcpm: Add core support for sink side PPS")
Cc: <stable@vger.kernel.org>
Signed-off-by: Adam Thomson <Adam.Thomson.Opensource@diasemi.com>
---
Code based on usb-testing branch (ae8a2ca8a2215c7e31e6d874f7303801bb15fbb)

 drivers/usb/typec/tcpm/tcpm.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/typec/tcpm/tcpm.c b/drivers/usb/typec/tcpm/tcpm.c
index 4f1f421..c11b3be 100644
--- a/drivers/usb/typec/tcpm/tcpm.c
+++ b/drivers/usb/typec/tcpm/tcpm.c
@@ -1430,8 +1430,8 @@ static enum pdo_err tcpm_caps_err(struct tcpm_port *port, const u32 *pdo,
 				if (pdo_apdo_type(pdo[i]) != APDO_TYPE_PPS)
 					break;
 
-				if (pdo_pps_apdo_max_current(pdo[i]) <
-				    pdo_pps_apdo_max_current(pdo[i - 1]))
+				if (pdo_pps_apdo_max_voltage(pdo[i]) <
+				    pdo_pps_apdo_max_voltage(pdo[i - 1]))
 					return PDO_ERR_PPS_APDO_NOT_SORTED;
 				else if (pdo_pps_apdo_min_voltage(pdo[i]) ==
 					  pdo_pps_apdo_min_voltage(pdo[i - 1]) &&

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

* Re: [PATCH] usb: typec: tcpm: Fix APDO PPS order checking to be based on voltage
@ 2018-09-21 15:52   ` Guenter Roeck
  0 siblings, 0 replies; 6+ messages in thread
From: Guenter Roeck @ 2018-09-21 15:52 UTC (permalink / raw)
  To: Adam Thomson
  Cc: Heikki Krogerus, Greg Kroah-Hartman, linux-usb, linux-kernel,
	stable, support.opensource

On Fri, Sep 21, 2018 at 04:04:11PM +0100, Adam Thomson wrote:
> Current code mistakenly checks against max current to determine
> order but this should be max voltage. This commit fixes the issue
> so order is correctly determined, thus avoiding failure based on
> a higher voltage PPS APDO having a lower maximum current output,
> which is actually valid.
> 
> Fixes: 2eadc33f40d4 ("typec: tcpm: Add core support for sink side PPS")
> Cc: <stable@vger.kernel.org>
> Signed-off-by: Adam Thomson <Adam.Thomson.Opensource@diasemi.com>

Makes sense.

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

> ---
> Code based on usb-testing branch (ae8a2ca8a2215c7e31e6d874f7303801bb15fbb)
> 
>  drivers/usb/typec/tcpm/tcpm.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/usb/typec/tcpm/tcpm.c b/drivers/usb/typec/tcpm/tcpm.c
> index 4f1f421..c11b3be 100644
> --- a/drivers/usb/typec/tcpm/tcpm.c
> +++ b/drivers/usb/typec/tcpm/tcpm.c
> @@ -1430,8 +1430,8 @@ static enum pdo_err tcpm_caps_err(struct tcpm_port *port, const u32 *pdo,
>  				if (pdo_apdo_type(pdo[i]) != APDO_TYPE_PPS)
>  					break;
>  
> -				if (pdo_pps_apdo_max_current(pdo[i]) <
> -				    pdo_pps_apdo_max_current(pdo[i - 1]))
> +				if (pdo_pps_apdo_max_voltage(pdo[i]) <
> +				    pdo_pps_apdo_max_voltage(pdo[i - 1]))
>  					return PDO_ERR_PPS_APDO_NOT_SORTED;
>  				else if (pdo_pps_apdo_min_voltage(pdo[i]) ==
>  					  pdo_pps_apdo_min_voltage(pdo[i - 1]) &&
> -- 
> 1.9.1
> 

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

* usb: typec: tcpm: Fix APDO PPS order checking to be based on voltage
@ 2018-09-21 15:52   ` Guenter Roeck
  0 siblings, 0 replies; 6+ messages in thread
From: Guenter Roeck @ 2018-09-21 15:52 UTC (permalink / raw)
  To: Adam Thomson
  Cc: Heikki Krogerus, Greg Kroah-Hartman, linux-usb, linux-kernel,
	stable, support.opensource

On Fri, Sep 21, 2018 at 04:04:11PM +0100, Adam Thomson wrote:
> Current code mistakenly checks against max current to determine
> order but this should be max voltage. This commit fixes the issue
> so order is correctly determined, thus avoiding failure based on
> a higher voltage PPS APDO having a lower maximum current output,
> which is actually valid.
> 
> Fixes: 2eadc33f40d4 ("typec: tcpm: Add core support for sink side PPS")
> Cc: <stable@vger.kernel.org>
> Signed-off-by: Adam Thomson <Adam.Thomson.Opensource@diasemi.com>

Makes sense.

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

> ---
> Code based on usb-testing branch (ae8a2ca8a2215c7e31e6d874f7303801bb15fbb)
> 
>  drivers/usb/typec/tcpm/tcpm.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/usb/typec/tcpm/tcpm.c b/drivers/usb/typec/tcpm/tcpm.c
> index 4f1f421..c11b3be 100644
> --- a/drivers/usb/typec/tcpm/tcpm.c
> +++ b/drivers/usb/typec/tcpm/tcpm.c
> @@ -1430,8 +1430,8 @@ static enum pdo_err tcpm_caps_err(struct tcpm_port *port, const u32 *pdo,
>  				if (pdo_apdo_type(pdo[i]) != APDO_TYPE_PPS)
>  					break;
>  
> -				if (pdo_pps_apdo_max_current(pdo[i]) <
> -				    pdo_pps_apdo_max_current(pdo[i - 1]))
> +				if (pdo_pps_apdo_max_voltage(pdo[i]) <
> +				    pdo_pps_apdo_max_voltage(pdo[i - 1]))
>  					return PDO_ERR_PPS_APDO_NOT_SORTED;
>  				else if (pdo_pps_apdo_min_voltage(pdo[i]) ==
>  					  pdo_pps_apdo_min_voltage(pdo[i - 1]) &&
> -- 
> 1.9.1
>

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

* Re: [PATCH] usb: typec: tcpm: Fix APDO PPS order checking to be based on voltage
@ 2018-09-24  7:35   ` Heikki Krogerus
  0 siblings, 0 replies; 6+ messages in thread
From: Heikki Krogerus @ 2018-09-24  7:35 UTC (permalink / raw)
  To: Adam Thomson
  Cc: Guenter Roeck, Greg Kroah-Hartman, linux-usb, linux-kernel,
	stable, support.opensource

On Fri, Sep 21, 2018 at 04:04:11PM +0100, Adam Thomson wrote:
> Current code mistakenly checks against max current to determine
> order but this should be max voltage. This commit fixes the issue
> so order is correctly determined, thus avoiding failure based on
> a higher voltage PPS APDO having a lower maximum current output,
> which is actually valid.
> 
> Fixes: 2eadc33f40d4 ("typec: tcpm: Add core support for sink side PPS")
> Cc: <stable@vger.kernel.org>
> Signed-off-by: Adam Thomson <Adam.Thomson.Opensource@diasemi.com>

Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>

> ---
> Code based on usb-testing branch (ae8a2ca8a2215c7e31e6d874f7303801bb15fbb)
> 
>  drivers/usb/typec/tcpm/tcpm.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/usb/typec/tcpm/tcpm.c b/drivers/usb/typec/tcpm/tcpm.c
> index 4f1f421..c11b3be 100644
> --- a/drivers/usb/typec/tcpm/tcpm.c
> +++ b/drivers/usb/typec/tcpm/tcpm.c
> @@ -1430,8 +1430,8 @@ static enum pdo_err tcpm_caps_err(struct tcpm_port *port, const u32 *pdo,
>  				if (pdo_apdo_type(pdo[i]) != APDO_TYPE_PPS)
>  					break;
>  
> -				if (pdo_pps_apdo_max_current(pdo[i]) <
> -				    pdo_pps_apdo_max_current(pdo[i - 1]))
> +				if (pdo_pps_apdo_max_voltage(pdo[i]) <
> +				    pdo_pps_apdo_max_voltage(pdo[i - 1]))
>  					return PDO_ERR_PPS_APDO_NOT_SORTED;
>  				else if (pdo_pps_apdo_min_voltage(pdo[i]) ==
>  					  pdo_pps_apdo_min_voltage(pdo[i - 1]) &&
> -- 
> 1.9.1

Thanks,

-- 
heikki

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

* usb: typec: tcpm: Fix APDO PPS order checking to be based on voltage
@ 2018-09-24  7:35   ` Heikki Krogerus
  0 siblings, 0 replies; 6+ messages in thread
From: Heikki Krogerus @ 2018-09-24  7:35 UTC (permalink / raw)
  To: Adam Thomson
  Cc: Guenter Roeck, Greg Kroah-Hartman, linux-usb, linux-kernel,
	stable, support.opensource

On Fri, Sep 21, 2018 at 04:04:11PM +0100, Adam Thomson wrote:
> Current code mistakenly checks against max current to determine
> order but this should be max voltage. This commit fixes the issue
> so order is correctly determined, thus avoiding failure based on
> a higher voltage PPS APDO having a lower maximum current output,
> which is actually valid.
> 
> Fixes: 2eadc33f40d4 ("typec: tcpm: Add core support for sink side PPS")
> Cc: <stable@vger.kernel.org>
> Signed-off-by: Adam Thomson <Adam.Thomson.Opensource@diasemi.com>

Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>

> ---
> Code based on usb-testing branch (ae8a2ca8a2215c7e31e6d874f7303801bb15fbb)
> 
>  drivers/usb/typec/tcpm/tcpm.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/usb/typec/tcpm/tcpm.c b/drivers/usb/typec/tcpm/tcpm.c
> index 4f1f421..c11b3be 100644
> --- a/drivers/usb/typec/tcpm/tcpm.c
> +++ b/drivers/usb/typec/tcpm/tcpm.c
> @@ -1430,8 +1430,8 @@ static enum pdo_err tcpm_caps_err(struct tcpm_port *port, const u32 *pdo,
>  				if (pdo_apdo_type(pdo[i]) != APDO_TYPE_PPS)
>  					break;
>  
> -				if (pdo_pps_apdo_max_current(pdo[i]) <
> -				    pdo_pps_apdo_max_current(pdo[i - 1]))
> +				if (pdo_pps_apdo_max_voltage(pdo[i]) <
> +				    pdo_pps_apdo_max_voltage(pdo[i - 1]))
>  					return PDO_ERR_PPS_APDO_NOT_SORTED;
>  				else if (pdo_pps_apdo_min_voltage(pdo[i]) ==
>  					  pdo_pps_apdo_min_voltage(pdo[i - 1]) &&
> -- 
> 1.9.1

Thanks,

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

end of thread, other threads:[~2018-09-24  7:37 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-09-21 15:04 [PATCH] usb: typec: tcpm: Fix APDO PPS order checking to be based on voltage Adam Thomson
2018-09-21 15:04 ` Opensource [Adam Thomson]
2018-09-21 15:52 ` [PATCH] " Guenter Roeck
2018-09-21 15:52   ` Guenter Roeck
2018-09-24  7:35 ` [PATCH] " Heikki Krogerus
2018-09-24  7:35   ` Heikki Krogerus

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.