linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] usb: typec: fix "op-sink-microwatt" defaults that were in mW
@ 2020-01-20 10:53 Thomas Hebb
  2020-01-20 11:07 ` Heikki Krogerus
  0 siblings, 1 reply; 2+ messages in thread
From: Thomas Hebb @ 2020-01-20 10:53 UTC (permalink / raw)
  To: linux-kernel
  Cc: Thomas Hebb, Greg Kroah-Hartman, Guenter Roeck, Heikki Krogerus,
	linux-usb

commit 8f6244055bd3 ("usb: typec: fusb302: Always provide fwnode for the
port") and commit 4c912bff46cc ("usb: typec: wcove: Provide fwnode for
the port") converted a legacy TCPM platdata structure to a more generic
format. However, one field, denoting required sink power, was specified
in mW in the old format but uW in the new format. The migration failed
to account for this, meaning that the values are now 1000x too small.

Correct the issue by converting the values to uW.

Signed-off-by: Thomas Hebb <tommyhebb@gmail.com>

---

 drivers/usb/typec/tcpm/fusb302.c | 2 +-
 drivers/usb/typec/tcpm/wcove.c   | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/typec/tcpm/fusb302.c b/drivers/usb/typec/tcpm/fusb302.c
index ed8655c6af8c..b498960ff72b 100644
--- a/drivers/usb/typec/tcpm/fusb302.c
+++ b/drivers/usb/typec/tcpm/fusb302.c
@@ -1666,7 +1666,7 @@ static const struct property_entry port_props[] = {
 	PROPERTY_ENTRY_STRING("try-power-role", "sink"),
 	PROPERTY_ENTRY_U32_ARRAY("source-pdos", src_pdo),
 	PROPERTY_ENTRY_U32_ARRAY("sink-pdos", snk_pdo),
-	PROPERTY_ENTRY_U32("op-sink-microwatt", 2500),
+	PROPERTY_ENTRY_U32("op-sink-microwatt", 2500000),
 	{ }
 };
 
diff --git a/drivers/usb/typec/tcpm/wcove.c b/drivers/usb/typec/tcpm/wcove.c
index edc271da14f4..9b745f432c91 100644
--- a/drivers/usb/typec/tcpm/wcove.c
+++ b/drivers/usb/typec/tcpm/wcove.c
@@ -597,7 +597,7 @@ static const struct property_entry wcove_props[] = {
 	PROPERTY_ENTRY_STRING("try-power-role", "sink"),
 	PROPERTY_ENTRY_U32_ARRAY("source-pdos", src_pdo),
 	PROPERTY_ENTRY_U32_ARRAY("sink-pdos", snk_pdo),
-	PROPERTY_ENTRY_U32("op-sink-microwatt", 15000),
+	PROPERTY_ENTRY_U32("op-sink-microwatt", 15000000),
 	{ }
 };
 
-- 
2.24.1


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

* Re: [PATCH] usb: typec: fix "op-sink-microwatt" defaults that were in mW
  2020-01-20 10:53 [PATCH] usb: typec: fix "op-sink-microwatt" defaults that were in mW Thomas Hebb
@ 2020-01-20 11:07 ` Heikki Krogerus
  0 siblings, 0 replies; 2+ messages in thread
From: Heikki Krogerus @ 2020-01-20 11:07 UTC (permalink / raw)
  To: Thomas Hebb; +Cc: linux-kernel, Greg Kroah-Hartman, Guenter Roeck, linux-usb

Hi Thomas,

On Mon, Jan 20, 2020 at 02:53:16AM -0800, Thomas Hebb wrote:
> commit 8f6244055bd3 ("usb: typec: fusb302: Always provide fwnode for the
> port") and commit 4c912bff46cc ("usb: typec: wcove: Provide fwnode for
> the port") converted a legacy TCPM platdata structure to a more generic
> format. However, one field, denoting required sink power, was specified
> in mW in the old format but uW in the new format. The migration failed
> to account for this, meaning that the values are now 1000x too small.
> 
> Correct the issue by converting the values to uW.
> 
> Signed-off-by: Thomas Hebb <tommyhebb@gmail.com>

Thanks for catching this.

You should split this in two, one patch for each driver, and those
should have proper "Fixes:" tags.

I think those should also go to the stable trees, so you'll also need
the stable tag (Cc: stable@vger.kernel.org).

> ---
> 
>  drivers/usb/typec/tcpm/fusb302.c | 2 +-
>  drivers/usb/typec/tcpm/wcove.c   | 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/usb/typec/tcpm/fusb302.c b/drivers/usb/typec/tcpm/fusb302.c
> index ed8655c6af8c..b498960ff72b 100644
> --- a/drivers/usb/typec/tcpm/fusb302.c
> +++ b/drivers/usb/typec/tcpm/fusb302.c
> @@ -1666,7 +1666,7 @@ static const struct property_entry port_props[] = {
>  	PROPERTY_ENTRY_STRING("try-power-role", "sink"),
>  	PROPERTY_ENTRY_U32_ARRAY("source-pdos", src_pdo),
>  	PROPERTY_ENTRY_U32_ARRAY("sink-pdos", snk_pdo),
> -	PROPERTY_ENTRY_U32("op-sink-microwatt", 2500),
> +	PROPERTY_ENTRY_U32("op-sink-microwatt", 2500000),
>  	{ }
>  };
>  
> diff --git a/drivers/usb/typec/tcpm/wcove.c b/drivers/usb/typec/tcpm/wcove.c
> index edc271da14f4..9b745f432c91 100644
> --- a/drivers/usb/typec/tcpm/wcove.c
> +++ b/drivers/usb/typec/tcpm/wcove.c
> @@ -597,7 +597,7 @@ static const struct property_entry wcove_props[] = {
>  	PROPERTY_ENTRY_STRING("try-power-role", "sink"),
>  	PROPERTY_ENTRY_U32_ARRAY("source-pdos", src_pdo),
>  	PROPERTY_ENTRY_U32_ARRAY("sink-pdos", snk_pdo),
> -	PROPERTY_ENTRY_U32("op-sink-microwatt", 15000),
> +	PROPERTY_ENTRY_U32("op-sink-microwatt", 15000000),
>  	{ }
>  };
>  
> -- 
> 2.24.1

thanks,

-- 
heikki

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

end of thread, other threads:[~2020-01-20 11:07 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-01-20 10:53 [PATCH] usb: typec: fix "op-sink-microwatt" defaults that were in mW Thomas Hebb
2020-01-20 11:07 ` Heikki Krogerus

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).