* [PATCH 0/3] dt-bindings: connector: Add USB-PD PPS APDO support
@ 2018-08-21 12:28 Adam Thomson
2018-08-21 12:28 ` [PATCH 1/3] dt-bindings: connector: Add support for USB-PD PPS APDOs to bindings Adam Thomson
` (2 more replies)
0 siblings, 3 replies; 8+ messages in thread
From: Adam Thomson @ 2018-08-21 12:28 UTC (permalink / raw)
To: Heikki Krogerus, Guenter Roeck, Greg Kroah-Hartman, Rob Herring,
Mark Rutland, Hans de Goede, Li Jun
Cc: linux-usb, devicetree, linux-kernel, support.opensource
This patch set adds DT bindings support for PPS APDOs, and updates the FUSB302
to use the generic connector bindings allowing for PPS support in this Type-C
port controller. Existing FUSB302 device specific bindings still work, but
are now deprecated in favour of the generic connector approach.
Adam Thomson (3):
dt-bindings: connector: Add support for USB-PD PPS APDOs to bindings
dt-bindings: usb: fusb302: Use usb-connector bindings for
configuration
usb: typec: fusb302: Populate tcpc fwnode for TCPM property handling
.../bindings/connector/usb-connector.txt | 8 +++---
.../devicetree/bindings/usb/fcs,fusb302.txt | 32 +++++++++++++++++-----
drivers/usb/typec/fusb302/fusb302.c | 3 ++
include/dt-bindings/usb/pd.h | 26 ++++++++++++++++++
4 files changed, 58 insertions(+), 11 deletions(-)
--
1.9.1
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH 1/3] dt-bindings: connector: Add support for USB-PD PPS APDOs to bindings
2018-08-21 12:28 [PATCH 0/3] dt-bindings: connector: Add USB-PD PPS APDO support Adam Thomson
@ 2018-08-21 12:28 ` Adam Thomson
2018-08-31 12:16 ` Rob Herring
2018-08-21 12:28 ` [PATCH 2/3] dt-bindings: usb: fusb302: Use usb-connector bindings for configuration Adam Thomson
2018-08-21 12:28 ` [PATCH 3/3] usb: typec: fusb302: Populate tcpc fwnode for TCPM property handling Adam Thomson
2 siblings, 1 reply; 8+ messages in thread
From: Adam Thomson @ 2018-08-21 12:28 UTC (permalink / raw)
To: Heikki Krogerus, Guenter Roeck, Greg Kroah-Hartman, Rob Herring,
Mark Rutland, Hans de Goede, Li Jun
Cc: linux-usb, devicetree, linux-kernel, support.opensource
Add support for PPS APDOs to connector bindings so a port controller
can specify support for PPS, as per existing FIXED/BATT/VAR PDOs.
Signed-off-by: Adam Thomson <Adam.Thomson.Opensource@diasemi.com>
---
.../bindings/connector/usb-connector.txt | 8 +++----
include/dt-bindings/usb/pd.h | 26 ++++++++++++++++++++++
2 files changed, 30 insertions(+), 4 deletions(-)
diff --git a/Documentation/devicetree/bindings/connector/usb-connector.txt b/Documentation/devicetree/bindings/connector/usb-connector.txt
index 8855bfc..d90e17e 100644
--- a/Documentation/devicetree/bindings/connector/usb-connector.txt
+++ b/Documentation/devicetree/bindings/connector/usb-connector.txt
@@ -29,15 +29,15 @@ Required properties for usb-c-connector with power delivery support:
in "Universal Serial Bus Power Delivery Specification" chapter 6.4.1.2
Source_Capabilities Message, the order of each entry(PDO) should follow
the PD spec chapter 6.4.1. Required for power source and power dual role.
- User can specify the source PDO array via PDO_FIXED/BATT/VAR() defined in
- dt-bindings/usb/pd.h.
+ User can specify the source PDO array via PDO_FIXED/BATT/VAR/PPS_APDO()
+ defined in dt-bindings/usb/pd.h.
- sink-pdos: An array of u32 with each entry providing supported power
sink data object(PDO), the detailed bit definitions of PDO can be found
in "Universal Serial Bus Power Delivery Specification" chapter 6.4.1.3
Sink Capabilities Message, the order of each entry(PDO) should follow
the PD spec chapter 6.4.1. Required for power sink and power dual role.
- User can specify the sink PDO array via PDO_FIXED/BATT/VAR() defined in
- dt-bindings/usb/pd.h.
+ User can specify the sink PDO array via PDO_FIXED/BATT/VAR/PPS_APDO() defined
+ in dt-bindings/usb/pd.h.
- op-sink-microwatt: Sink required operating power in microwatt, if source
can't offer the power, Capability Mismatch is set. Required for power
sink and power dual role.
diff --git a/include/dt-bindings/usb/pd.h b/include/dt-bindings/usb/pd.h
index 7b7a92f..985f2bb 100644
--- a/include/dt-bindings/usb/pd.h
+++ b/include/dt-bindings/usb/pd.h
@@ -59,4 +59,30 @@
(PDO_TYPE(PDO_TYPE_VAR) | PDO_VAR_MIN_VOLT(min_mv) | \
PDO_VAR_MAX_VOLT(max_mv) | PDO_VAR_MAX_CURR(max_ma))
+#define APDO_TYPE_PPS 0
+
+#define PDO_APDO_TYPE_SHIFT 28 /* Only valid value currently is 0x0 - PPS */
+#define PDO_APDO_TYPE_MASK 0x3
+
+#define PDO_APDO_TYPE(t) ((t) << PDO_APDO_TYPE_SHIFT)
+
+#define PDO_PPS_APDO_MAX_VOLT_SHIFT 17 /* 100mV units */
+#define PDO_PPS_APDO_MIN_VOLT_SHIFT 8 /* 100mV units */
+#define PDO_PPS_APDO_MAX_CURR_SHIFT 0 /* 50mA units */
+
+#define PDO_PPS_APDO_VOLT_MASK 0xff
+#define PDO_PPS_APDO_CURR_MASK 0x7f
+
+#define PDO_PPS_APDO_MIN_VOLT(mv) \
+ ((((mv) / 100) & PDO_PPS_APDO_VOLT_MASK) << PDO_PPS_APDO_MIN_VOLT_SHIFT)
+#define PDO_PPS_APDO_MAX_VOLT(mv) \
+ ((((mv) / 100) & PDO_PPS_APDO_VOLT_MASK) << PDO_PPS_APDO_MAX_VOLT_SHIFT)
+#define PDO_PPS_APDO_MAX_CURR(ma) \
+ ((((ma) / 50) & PDO_PPS_APDO_CURR_MASK) << PDO_PPS_APDO_MAX_CURR_SHIFT)
+
+#define PDO_PPS_APDO(min_mv, max_mv, max_ma) \
+ (PDO_TYPE(PDO_TYPE_APDO) | PDO_APDO_TYPE(APDO_TYPE_PPS) | \
+ PDO_PPS_APDO_MIN_VOLT(min_mv) | PDO_PPS_APDO_MAX_VOLT(max_mv) | \
+ PDO_PPS_APDO_MAX_CURR(max_ma))
+
#endif /* __DT_POWER_DELIVERY_H */
--
1.9.1
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 2/3] dt-bindings: usb: fusb302: Use usb-connector bindings for configuration
2018-08-21 12:28 [PATCH 0/3] dt-bindings: connector: Add USB-PD PPS APDO support Adam Thomson
2018-08-21 12:28 ` [PATCH 1/3] dt-bindings: connector: Add support for USB-PD PPS APDOs to bindings Adam Thomson
@ 2018-08-21 12:28 ` Adam Thomson
2018-08-31 12:17 ` Rob Herring
2018-08-21 12:28 ` [PATCH 3/3] usb: typec: fusb302: Populate tcpc fwnode for TCPM property handling Adam Thomson
2 siblings, 1 reply; 8+ messages in thread
From: Adam Thomson @ 2018-08-21 12:28 UTC (permalink / raw)
To: Heikki Krogerus, Guenter Roeck, Greg Kroah-Hartman, Rob Herring,
Mark Rutland, Hans de Goede, Li Jun
Cc: linux-usb, devicetree, linux-kernel, support.opensource
There are now generic usb-connector bindings which can be used
to define a port controllers configuration for USB-PD, so device
specific bindings are no longer necessary.
This update deprecates 'fcs,operating-sink-microwatt', and references
the 'usb-connector' bindings instead to achieve the required port
config.
Signed-off-by: Adam Thomson <Adam.Thomson.Opensource@diasemi.com>
---
.../devicetree/bindings/usb/fcs,fusb302.txt | 32 +++++++++++++++++-----
1 file changed, 25 insertions(+), 7 deletions(-)
diff --git a/Documentation/devicetree/bindings/usb/fcs,fusb302.txt b/Documentation/devicetree/bindings/usb/fcs,fusb302.txt
index 6087dc7..a5d011d 100644
--- a/Documentation/devicetree/bindings/usb/fcs,fusb302.txt
+++ b/Documentation/devicetree/bindings/usb/fcs,fusb302.txt
@@ -5,10 +5,19 @@ Required properties :
- reg : I2C slave address
- interrupts : Interrupt specifier
-Optional properties :
-- fcs,operating-sink-microwatt :
- Minimum amount of power accepted from a sink
- when negotiating
+Required sub-node:
+- connector : The "usb-c-connector" attached to the FUSB302 IC. The bindings
+ of the connector node are specified in:
+
+ Documentation/devicetree/bindings/connector/usb-connector.txt
+
+Deprecated properties :
+- fcs,max-sink-microvolt : Maximum sink voltage accepted by port controller
+- fcs,max-sink-microamp : Maximum sink current accepted by port controller
+- fcs,max-sink-microwatt : Maximum sink power accepted by port controller
+- fcs,operating-sink-microwatt : Minimum amount of power accepted from a sink
+ when negotiating
+
Example:
@@ -17,7 +26,16 @@ fusb302: typec-portc@54 {
reg = <0x54>;
interrupt-parent = <&nmi_intc>;
interrupts = <0 IRQ_TYPE_LEVEL_LOW>;
- fcs,max-sink-microvolt = <12000000>;
- fcs,max-sink-microamp = <3000000>;
- fcs,max-sink-microwatt = <36000000>;
+
+ usb_con: connector {
+ compatible = "usb-c-connector";
+ label = "USB-C";
+ power-role = "dual";
+ try-power-role = "sink";
+ source-pdos = <PDO_FIXED(5000, 3000, PDO_FIXED_USB_COMM)>;
+ sink-pdos = <PDO_FIXED(5000, 3000, PDO_FIXED_USB_COMM)
+ PDO_VAR(3000, 12000, 3000)
+ PDO_PPS_APDO(3000, 11000, 3000)>;
+ op-sink-microwatt = <10000000>;
+ };
};
--
1.9.1
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 3/3] usb: typec: fusb302: Populate tcpc fwnode for TCPM property handling
2018-08-21 12:28 [PATCH 0/3] dt-bindings: connector: Add USB-PD PPS APDO support Adam Thomson
2018-08-21 12:28 ` [PATCH 1/3] dt-bindings: connector: Add support for USB-PD PPS APDOs to bindings Adam Thomson
2018-08-21 12:28 ` [PATCH 2/3] dt-bindings: usb: fusb302: Use usb-connector bindings for configuration Adam Thomson
@ 2018-08-21 12:28 ` Adam Thomson
2018-08-21 13:22 ` Heikki Krogerus
2018-08-21 14:03 ` Guenter Roeck
2 siblings, 2 replies; 8+ messages in thread
From: Adam Thomson @ 2018-08-21 12:28 UTC (permalink / raw)
To: Heikki Krogerus, Guenter Roeck, Greg Kroah-Hartman, Rob Herring,
Mark Rutland, Hans de Goede, Li Jun
Cc: linux-usb, devicetree, linux-kernel, support.opensource
This update populates the tcpc handle's fwnode pointer with the
child usb-connector node, if it exists, so that TCPM can perform
generic property handling to define the ports capabilities.
Signed-off-by: Adam Thomson <Adam.Thomson.Opensource@diasemi.com>
---
drivers/usb/typec/fusb302/fusb302.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/usb/typec/fusb302/fusb302.c b/drivers/usb/typec/fusb302/fusb302.c
index 82bed98..1b464c9 100644
--- a/drivers/usb/typec/fusb302/fusb302.c
+++ b/drivers/usb/typec/fusb302/fusb302.c
@@ -1736,6 +1736,9 @@ static int fusb302_probe(struct i2c_client *client,
chip->tcpc_dev.config = &chip->tcpc_config;
mutex_init(&chip->lock);
+ chip->tcpc_dev.fwnode =
+ device_get_named_child_node(dev, "connector");
+
if (!device_property_read_u32(dev, "fcs,operating-sink-microwatt", &v))
chip->tcpc_config.operating_snk_mw = v / 1000;
--
1.9.1
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH 3/3] usb: typec: fusb302: Populate tcpc fwnode for TCPM property handling
2018-08-21 12:28 ` [PATCH 3/3] usb: typec: fusb302: Populate tcpc fwnode for TCPM property handling Adam Thomson
@ 2018-08-21 13:22 ` Heikki Krogerus
2018-08-21 14:03 ` Guenter Roeck
1 sibling, 0 replies; 8+ messages in thread
From: Heikki Krogerus @ 2018-08-21 13:22 UTC (permalink / raw)
To: Adam Thomson
Cc: Guenter Roeck, Greg Kroah-Hartman, Rob Herring, Mark Rutland,
Hans de Goede, Li Jun, linux-usb, devicetree, linux-kernel,
support.opensource
On Tue, Aug 21, 2018 at 01:28:23PM +0100, Adam Thomson wrote:
> This update populates the tcpc handle's fwnode pointer with the
> child usb-connector node, if it exists, so that TCPM can perform
> generic property handling to define the ports capabilities.
>
> Signed-off-by: Adam Thomson <Adam.Thomson.Opensource@diasemi.com>
Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
> ---
> drivers/usb/typec/fusb302/fusb302.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/drivers/usb/typec/fusb302/fusb302.c b/drivers/usb/typec/fusb302/fusb302.c
> index 82bed98..1b464c9 100644
> --- a/drivers/usb/typec/fusb302/fusb302.c
> +++ b/drivers/usb/typec/fusb302/fusb302.c
> @@ -1736,6 +1736,9 @@ static int fusb302_probe(struct i2c_client *client,
> chip->tcpc_dev.config = &chip->tcpc_config;
> mutex_init(&chip->lock);
>
> + chip->tcpc_dev.fwnode =
> + device_get_named_child_node(dev, "connector");
> +
> if (!device_property_read_u32(dev, "fcs,operating-sink-microwatt", &v))
> chip->tcpc_config.operating_snk_mw = v / 1000;
Thanks,
--
heikki
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 3/3] usb: typec: fusb302: Populate tcpc fwnode for TCPM property handling
2018-08-21 12:28 ` [PATCH 3/3] usb: typec: fusb302: Populate tcpc fwnode for TCPM property handling Adam Thomson
2018-08-21 13:22 ` Heikki Krogerus
@ 2018-08-21 14:03 ` Guenter Roeck
1 sibling, 0 replies; 8+ messages in thread
From: Guenter Roeck @ 2018-08-21 14:03 UTC (permalink / raw)
To: Adam Thomson
Cc: Heikki Krogerus, Greg Kroah-Hartman, Rob Herring, Mark Rutland,
Hans de Goede, Li Jun, linux-usb, devicetree, linux-kernel,
support.opensource
On Tue, Aug 21, 2018 at 01:28:23PM +0100, Adam Thomson wrote:
> This update populates the tcpc handle's fwnode pointer with the
> child usb-connector node, if it exists, so that TCPM can perform
> generic property handling to define the ports capabilities.
>
> Signed-off-by: Adam Thomson <Adam.Thomson.Opensource@diasemi.com>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
> ---
> drivers/usb/typec/fusb302/fusb302.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/drivers/usb/typec/fusb302/fusb302.c b/drivers/usb/typec/fusb302/fusb302.c
> index 82bed98..1b464c9 100644
> --- a/drivers/usb/typec/fusb302/fusb302.c
> +++ b/drivers/usb/typec/fusb302/fusb302.c
> @@ -1736,6 +1736,9 @@ static int fusb302_probe(struct i2c_client *client,
> chip->tcpc_dev.config = &chip->tcpc_config;
> mutex_init(&chip->lock);
>
> + chip->tcpc_dev.fwnode =
> + device_get_named_child_node(dev, "connector");
> +
> if (!device_property_read_u32(dev, "fcs,operating-sink-microwatt", &v))
> chip->tcpc_config.operating_snk_mw = v / 1000;
>
> --
> 1.9.1
>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 1/3] dt-bindings: connector: Add support for USB-PD PPS APDOs to bindings
2018-08-21 12:28 ` [PATCH 1/3] dt-bindings: connector: Add support for USB-PD PPS APDOs to bindings Adam Thomson
@ 2018-08-31 12:16 ` Rob Herring
0 siblings, 0 replies; 8+ messages in thread
From: Rob Herring @ 2018-08-31 12:16 UTC (permalink / raw)
To: Adam Thomson
Cc: Heikki Krogerus, Guenter Roeck, Greg Kroah-Hartman, Mark Rutland,
Hans de Goede, Li Jun, linux-usb, devicetree, linux-kernel,
support.opensource
On Tue, 21 Aug 2018 13:28:21 +0100, Adam Thomson wrote:
> Add support for PPS APDOs to connector bindings so a port controller
> can specify support for PPS, as per existing FIXED/BATT/VAR PDOs.
>
> Signed-off-by: Adam Thomson <Adam.Thomson.Opensource@diasemi.com>
> ---
> .../bindings/connector/usb-connector.txt | 8 +++----
> include/dt-bindings/usb/pd.h | 26 ++++++++++++++++++++++
> 2 files changed, 30 insertions(+), 4 deletions(-)
>
Reviewed-by: Rob Herring <robh@kernel.org>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 2/3] dt-bindings: usb: fusb302: Use usb-connector bindings for configuration
2018-08-21 12:28 ` [PATCH 2/3] dt-bindings: usb: fusb302: Use usb-connector bindings for configuration Adam Thomson
@ 2018-08-31 12:17 ` Rob Herring
0 siblings, 0 replies; 8+ messages in thread
From: Rob Herring @ 2018-08-31 12:17 UTC (permalink / raw)
To: Adam Thomson
Cc: Heikki Krogerus, Guenter Roeck, Greg Kroah-Hartman, Mark Rutland,
Hans de Goede, Li Jun, linux-usb, devicetree, linux-kernel,
support.opensource
On Tue, 21 Aug 2018 13:28:22 +0100, Adam Thomson wrote:
> There are now generic usb-connector bindings which can be used
> to define a port controllers configuration for USB-PD, so device
> specific bindings are no longer necessary.
>
> This update deprecates 'fcs,operating-sink-microwatt', and references
> the 'usb-connector' bindings instead to achieve the required port
> config.
>
> Signed-off-by: Adam Thomson <Adam.Thomson.Opensource@diasemi.com>
> ---
> .../devicetree/bindings/usb/fcs,fusb302.txt | 32 +++++++++++++++++-----
> 1 file changed, 25 insertions(+), 7 deletions(-)
>
Reviewed-by: Rob Herring <robh@kernel.org>
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2018-08-31 12:17 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-08-21 12:28 [PATCH 0/3] dt-bindings: connector: Add USB-PD PPS APDO support Adam Thomson
2018-08-21 12:28 ` [PATCH 1/3] dt-bindings: connector: Add support for USB-PD PPS APDOs to bindings Adam Thomson
2018-08-31 12:16 ` Rob Herring
2018-08-21 12:28 ` [PATCH 2/3] dt-bindings: usb: fusb302: Use usb-connector bindings for configuration Adam Thomson
2018-08-31 12:17 ` Rob Herring
2018-08-21 12:28 ` [PATCH 3/3] usb: typec: fusb302: Populate tcpc fwnode for TCPM property handling Adam Thomson
2018-08-21 13:22 ` Heikki Krogerus
2018-08-21 14:03 ` Guenter Roeck
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).