All of lore.kernel.org
 help / color / mirror / Atom feed
From: Heikki Krogerus <heikki.krogerus@linux.intel.com>
To: Adam Thomson <Adam.Thomson.Opensource@diasemi.com>
Cc: Guenter Roeck <linux@roeck-us.net>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org,
	support.opensource@diasemi.com
Subject: usb: typec: tcpm: Fix sink PDO starting index for PPS APDO selection
Date: Fri, 20 Jul 2018 13:42:23 +0300	[thread overview]
Message-ID: <20180720104223.GA13264@kuha.fi.intel.com> (raw)

On Tue, Jul 17, 2018 at 03:36:19PM +0100, Adam Thomson wrote:
> There is a bug in the sink PDO search code when trying to select
> a PPS APDO. The current code actually sets the starting index for
> searching to whatever value 'i' is, rather than choosing index 1
> to avoid the first PDO (always 5V fixed). As a result, for sources
> which support PPS but whose PPS APDO index does not match with the
> supporting sink PPS APDO index for the platform, no valid PPS APDO
> will be found so this feature will not be permitted.
> 
> Sadly in testing, both Source and Sink capabilities matched up and
> this was missed. Code is now updated to correctly set the start
> index to 1, and testing with additional PPS capable sources show
> this to work as expected.
> 
> Signed-off-by: Adam Thomson <Adam.Thomson.Opensource@diasemi.com>

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

> ---
>  drivers/usb/typec/tcpm.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/usb/typec/tcpm.c b/drivers/usb/typec/tcpm.c
> index 74e0cda..4f1f421 100644
> --- a/drivers/usb/typec/tcpm.c
> +++ b/drivers/usb/typec/tcpm.c
> @@ -2238,7 +2238,7 @@ static unsigned int tcpm_pd_select_pps_apdo(struct tcpm_port *port)
>  			 * PPS APDO. Again skip the first sink PDO as this will
>  			 * always be 5V 3A.
>  			 */
> -			for (j = i; j < port->nr_snk_pdo; j++) {
> +			for (j = 1; j < port->nr_snk_pdo; j++) {
>  				pdo = port->snk_pdo[j];
>  
>  				switch (pdo_type(pdo)) {

Thanks,

WARNING: multiple messages have this Message-ID (diff)
From: Heikki Krogerus <heikki.krogerus@linux.intel.com>
To: Adam Thomson <Adam.Thomson.Opensource@diasemi.com>
Cc: Guenter Roeck <linux@roeck-us.net>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org,
	support.opensource@diasemi.com
Subject: Re: [PATCH] usb: typec: tcpm: Fix sink PDO starting index for PPS APDO selection
Date: Fri, 20 Jul 2018 13:42:23 +0300	[thread overview]
Message-ID: <20180720104223.GA13264@kuha.fi.intel.com> (raw)
In-Reply-To: <20180717143619.80EEB3FBB7@swsrvapps-01.diasemi.com>

On Tue, Jul 17, 2018 at 03:36:19PM +0100, Adam Thomson wrote:
> There is a bug in the sink PDO search code when trying to select
> a PPS APDO. The current code actually sets the starting index for
> searching to whatever value 'i' is, rather than choosing index 1
> to avoid the first PDO (always 5V fixed). As a result, for sources
> which support PPS but whose PPS APDO index does not match with the
> supporting sink PPS APDO index for the platform, no valid PPS APDO
> will be found so this feature will not be permitted.
> 
> Sadly in testing, both Source and Sink capabilities matched up and
> this was missed. Code is now updated to correctly set the start
> index to 1, and testing with additional PPS capable sources show
> this to work as expected.
> 
> Signed-off-by: Adam Thomson <Adam.Thomson.Opensource@diasemi.com>

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

> ---
>  drivers/usb/typec/tcpm.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/usb/typec/tcpm.c b/drivers/usb/typec/tcpm.c
> index 74e0cda..4f1f421 100644
> --- a/drivers/usb/typec/tcpm.c
> +++ b/drivers/usb/typec/tcpm.c
> @@ -2238,7 +2238,7 @@ static unsigned int tcpm_pd_select_pps_apdo(struct tcpm_port *port)
>  			 * PPS APDO. Again skip the first sink PDO as this will
>  			 * always be 5V 3A.
>  			 */
> -			for (j = i; j < port->nr_snk_pdo; j++) {
> +			for (j = 1; j < port->nr_snk_pdo; j++) {
>  				pdo = port->snk_pdo[j];
>  
>  				switch (pdo_type(pdo)) {

Thanks,

-- 
heikki

             reply	other threads:[~2018-07-20 10:42 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-20 10:42 Heikki Krogerus [this message]
2018-07-20 10:42 ` [PATCH] usb: typec: tcpm: Fix sink PDO starting index for PPS APDO selection Heikki Krogerus
  -- strict thread matches above, loose matches on Subject: below --
2018-07-20 14:44 Opensource [Adam Thomson]
2018-07-20 14:44 ` [PATCH] " Adam Thomson
2018-07-20 14:39 Greg Kroah-Hartman
2018-07-20 14:39 ` [PATCH] " Greg Kroah-Hartman
2018-07-20 14:16 Opensource [Adam Thomson]
2018-07-20 14:16 ` [PATCH] " Adam Thomson
2018-07-20 13:59 Greg Kroah-Hartman
2018-07-20 13:59 ` [PATCH] " Greg Kroah-Hartman
2018-07-17 15:51 Guenter Roeck
2018-07-17 15:51 ` [PATCH] " Guenter Roeck
2018-07-17 14:36 Opensource [Adam Thomson]
2018-07-17 14:36 ` [PATCH] " Adam Thomson

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=20180720104223.GA13264@kuha.fi.intel.com \
    --to=heikki.krogerus@linux.intel.com \
    --cc=Adam.Thomson.Opensource@diasemi.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=linux@roeck-us.net \
    --cc=support.opensource@diasemi.com \
    /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 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.