linux-usb.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/3] usb: typec: fusb302: Small changes
@ 2019-08-14 13:24 Heikki Krogerus
  2019-08-14 13:24 ` [PATCH 1/3] usb: typec: fusb302: Remove unused properties Heikki Krogerus
                   ` (4 more replies)
  0 siblings, 5 replies; 13+ messages in thread
From: Heikki Krogerus @ 2019-08-14 13:24 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Guenter Roeck
  Cc: Rob Herring, Mark Rutland, Hans de Goede, linux-usb, linux-kernel

Hi,

This series removes the deprecated fusb302 specific properties, and
stops using struct tcpc_config in the driver.

thanks,

Heikki Krogerus (3):
  usb: typec: fusb302: Remove unused properties
  dt-bindings: usb: fusb302: Remove deprecated properties
  usb: typec: fusb302: Always provide fwnode for the port

 .../devicetree/bindings/usb/fcs,fusb302.txt   |  7 --
 drivers/usb/typec/tcpm/fusb302.c              | 85 ++++++++-----------
 2 files changed, 36 insertions(+), 56 deletions(-)

-- 
2.20.1


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

* [PATCH 1/3] usb: typec: fusb302: Remove unused properties
  2019-08-14 13:24 [PATCH 0/3] usb: typec: fusb302: Small changes Heikki Krogerus
@ 2019-08-14 13:24 ` Heikki Krogerus
  2019-08-14 13:37   ` Guenter Roeck
  2019-08-14 13:24 ` [PATCH 2/3] dt-bindings: usb: fusb302: Remove deprecated properties Heikki Krogerus
                   ` (3 subsequent siblings)
  4 siblings, 1 reply; 13+ messages in thread
From: Heikki Krogerus @ 2019-08-14 13:24 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Guenter Roeck
  Cc: Rob Herring, Mark Rutland, Hans de Goede, linux-usb, linux-kernel

Removing the deprecated fusb302 specific properties. There
are no more platforms using them.

Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
---
 drivers/usb/typec/tcpm/fusb302.c | 31 +++----------------------------
 1 file changed, 3 insertions(+), 28 deletions(-)

diff --git a/drivers/usb/typec/tcpm/fusb302.c b/drivers/usb/typec/tcpm/fusb302.c
index c524088246ee..074fbb17fa8b 100644
--- a/drivers/usb/typec/tcpm/fusb302.c
+++ b/drivers/usb/typec/tcpm/fusb302.c
@@ -1670,29 +1670,6 @@ static int init_gpio(struct fusb302_chip *chip)
 	return 0;
 }
 
-static int fusb302_composite_snk_pdo_array(struct fusb302_chip *chip)
-{
-	struct device *dev = chip->dev;
-	u32 max_uv, max_ua;
-
-	chip->snk_pdo[0] = PDO_FIXED(5000, 400, PDO_FIXED_FLAGS);
-
-	/*
-	 * As max_snk_ma/mv/mw is not needed for tcpc_config,
-	 * those settings should be passed in via sink PDO, so
-	 * "fcs, max-sink-*" properties will be deprecated, to
-	 * perserve compatibility with existing users of them,
-	 * we read those properties to convert them to be a var
-	 * PDO.
-	 */
-	if (device_property_read_u32(dev, "fcs,max-sink-microvolt", &max_uv) ||
-		device_property_read_u32(dev, "fcs,max-sink-microamp", &max_ua))
-		return 1;
-
-	chip->snk_pdo[1] = PDO_VAR(5000, max_uv / 1000, max_ua / 1000);
-	return 2;
-}
-
 static int fusb302_probe(struct i2c_client *client,
 			 const struct i2c_device_id *id)
 {
@@ -1701,7 +1678,6 @@ static int fusb302_probe(struct i2c_client *client,
 	struct device *dev = &client->dev;
 	const char *name;
 	int ret = 0;
-	u32 v;
 
 	if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_I2C_BLOCK)) {
 		dev_err(&client->dev,
@@ -1721,11 +1697,10 @@ static int fusb302_probe(struct i2c_client *client,
 	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;
-
 	/* Composite sink PDO */
-	chip->tcpc_config.nr_snk_pdo = fusb302_composite_snk_pdo_array(chip);
+	chip->snk_pdo[0] = PDO_FIXED(5000, 400, PDO_FIXED_FLAGS);
+
+	chip->tcpc_config.nr_snk_pdo = 1;
 	chip->tcpc_config.snk_pdo = chip->snk_pdo;
 
 	/*
-- 
2.20.1


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

* [PATCH 2/3] dt-bindings: usb: fusb302: Remove deprecated properties
  2019-08-14 13:24 [PATCH 0/3] usb: typec: fusb302: Small changes Heikki Krogerus
  2019-08-14 13:24 ` [PATCH 1/3] usb: typec: fusb302: Remove unused properties Heikki Krogerus
@ 2019-08-14 13:24 ` Heikki Krogerus
  2019-08-14 13:37   ` Guenter Roeck
  2019-08-14 13:24 ` [PATCH 3/3] usb: typec: fusb302: Always provide fwnode for the port Heikki Krogerus
                   ` (2 subsequent siblings)
  4 siblings, 1 reply; 13+ messages in thread
From: Heikki Krogerus @ 2019-08-14 13:24 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Guenter Roeck
  Cc: Rob Herring, Mark Rutland, Hans de Goede, linux-usb, linux-kernel

There are no platforms using them anymore.

Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
---
 Documentation/devicetree/bindings/usb/fcs,fusb302.txt | 7 -------
 1 file changed, 7 deletions(-)

diff --git a/Documentation/devicetree/bindings/usb/fcs,fusb302.txt b/Documentation/devicetree/bindings/usb/fcs,fusb302.txt
index a5d011d2efc8..ba2e32d500c0 100644
--- a/Documentation/devicetree/bindings/usb/fcs,fusb302.txt
+++ b/Documentation/devicetree/bindings/usb/fcs,fusb302.txt
@@ -11,13 +11,6 @@ Required sub-node:
 
 	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:
 
-- 
2.20.1


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

* [PATCH 3/3] usb: typec: fusb302: Always provide fwnode for the port
  2019-08-14 13:24 [PATCH 0/3] usb: typec: fusb302: Small changes Heikki Krogerus
  2019-08-14 13:24 ` [PATCH 1/3] usb: typec: fusb302: Remove unused properties Heikki Krogerus
  2019-08-14 13:24 ` [PATCH 2/3] dt-bindings: usb: fusb302: Remove deprecated properties Heikki Krogerus
@ 2019-08-14 13:24 ` Heikki Krogerus
  2019-08-14 13:37   ` Guenter Roeck
  2019-08-14 13:42 ` [PATCH 0/3] usb: typec: fusb302: Small changes Hans de Goede
  2019-08-15 17:26 ` Hans de Goede
  4 siblings, 1 reply; 13+ messages in thread
From: Heikki Krogerus @ 2019-08-14 13:24 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Guenter Roeck
  Cc: Rob Herring, Mark Rutland, Hans de Goede, linux-usb, linux-kernel

By registering a software fwnode for the port when the
firmware does not supply one, we can always provide tcpm the
connector capabilities by using the common USB connector
device properties instead of using tcpc_config platform data.

Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
---
 drivers/usb/typec/tcpm/fusb302.c | 70 +++++++++++++++++++-------------
 1 file changed, 41 insertions(+), 29 deletions(-)

diff --git a/drivers/usb/typec/tcpm/fusb302.c b/drivers/usb/typec/tcpm/fusb302.c
index 074fbb17fa8b..93244d6c4bff 100644
--- a/drivers/usb/typec/tcpm/fusb302.c
+++ b/drivers/usb/typec/tcpm/fusb302.c
@@ -75,7 +75,6 @@ struct fusb302_chip {
 	struct i2c_client *i2c_client;
 	struct tcpm_port *tcpm_port;
 	struct tcpc_dev tcpc_dev;
-	struct tcpc_config tcpc_config;
 
 	struct regulator *vbus;
 
@@ -1110,23 +1109,6 @@ static void fusb302_bc_lvl_handler_work(struct work_struct *work)
 	mutex_unlock(&chip->lock);
 }
 
-#define PDO_FIXED_FLAGS \
-	(PDO_FIXED_DUAL_ROLE | PDO_FIXED_DATA_SWAP | PDO_FIXED_USB_COMM)
-
-static const u32 src_pdo[] = {
-	PDO_FIXED(5000, 400, PDO_FIXED_FLAGS),
-};
-
-static const struct tcpc_config fusb302_tcpc_config = {
-	.src_pdo = src_pdo,
-	.nr_src_pdo = ARRAY_SIZE(src_pdo),
-	.operating_snk_mw = 2500,
-	.type = TYPEC_PORT_DRP,
-	.data = TYPEC_PORT_DRD,
-	.default_role = TYPEC_SINK,
-	.alt_modes = NULL,
-};
-
 static void init_tcpc_dev(struct tcpc_dev *fusb302_tcpc_dev)
 {
 	fusb302_tcpc_dev->init = tcpm_init;
@@ -1670,6 +1652,38 @@ static int init_gpio(struct fusb302_chip *chip)
 	return 0;
 }
 
+#define PDO_FIXED_FLAGS \
+	(PDO_FIXED_DUAL_ROLE | PDO_FIXED_DATA_SWAP | PDO_FIXED_USB_COMM)
+
+static const u32 src_pdo[] = {
+	PDO_FIXED(5000, 400, PDO_FIXED_FLAGS)
+};
+
+static const u32 snk_pdo[] = {
+	PDO_FIXED(5000, 400, PDO_FIXED_FLAGS)
+};
+
+static const struct property_entry port_props[] = {
+	PROPERTY_ENTRY_STRING("data-role", "dual"),
+	PROPERTY_ENTRY_STRING("power-role", "dual"),
+	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),
+	{ }
+};
+
+static struct fwnode_handle *fusb302_fwnode_get(struct device *dev)
+{
+	struct fwnode_handle *fwnode;
+
+	fwnode = device_get_named_child_node(dev, "connector");
+	if (!fwnode)
+		fwnode = fwnode_create_software_node(port_props, NULL);
+
+	return fwnode;
+}
+
 static int fusb302_probe(struct i2c_client *client,
 			 const struct i2c_device_id *id)
 {
@@ -1690,19 +1704,8 @@ static int fusb302_probe(struct i2c_client *client,
 
 	chip->i2c_client = client;
 	chip->dev = &client->dev;
-	chip->tcpc_config = fusb302_tcpc_config;
-	chip->tcpc_dev.config = &chip->tcpc_config;
 	mutex_init(&chip->lock);
 
-	chip->tcpc_dev.fwnode =
-		device_get_named_child_node(dev, "connector");
-
-	/* Composite sink PDO */
-	chip->snk_pdo[0] = PDO_FIXED(5000, 400, PDO_FIXED_FLAGS);
-
-	chip->tcpc_config.nr_snk_pdo = 1;
-	chip->tcpc_config.snk_pdo = chip->snk_pdo;
-
 	/*
 	 * Devicetree platforms should get extcon via phandle (not yet
 	 * supported). On ACPI platforms, we get the name from a device prop.
@@ -1737,8 +1740,15 @@ static int fusb302_probe(struct i2c_client *client,
 			goto destroy_workqueue;
 	}
 
+	chip->tcpc_dev.fwnode = fusb302_fwnode_get(dev);
+	if (IS_ERR(chip->tcpc_dev.fwnode)) {
+		ret = PTR_ERR(chip->tcpc_dev.fwnode);
+		goto destroy_workqueue;
+	}
+
 	chip->tcpm_port = tcpm_register_port(&client->dev, &chip->tcpc_dev);
 	if (IS_ERR(chip->tcpm_port)) {
+		fwnode_handle_put(chip->tcpc_dev.fwnode);
 		ret = PTR_ERR(chip->tcpm_port);
 		if (ret != -EPROBE_DEFER)
 			dev_err(dev, "cannot register tcpm port, ret=%d", ret);
@@ -1760,6 +1770,7 @@ static int fusb302_probe(struct i2c_client *client,
 
 tcpm_unregister_port:
 	tcpm_unregister_port(chip->tcpm_port);
+	fwnode_handle_put(chip->tcpc_dev.fwnode);
 destroy_workqueue:
 	destroy_workqueue(chip->wq);
 
@@ -1775,6 +1786,7 @@ static int fusb302_remove(struct i2c_client *client)
 	cancel_work_sync(&chip->irq_work);
 	cancel_delayed_work_sync(&chip->bc_lvl_handler);
 	tcpm_unregister_port(chip->tcpm_port);
+	fwnode_handle_put(chip->tcpc_dev.fwnode);
 	destroy_workqueue(chip->wq);
 	fusb302_debugfs_exit(chip);
 
-- 
2.20.1


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

* Re: [PATCH 1/3] usb: typec: fusb302: Remove unused properties
  2019-08-14 13:24 ` [PATCH 1/3] usb: typec: fusb302: Remove unused properties Heikki Krogerus
@ 2019-08-14 13:37   ` Guenter Roeck
  0 siblings, 0 replies; 13+ messages in thread
From: Guenter Roeck @ 2019-08-14 13:37 UTC (permalink / raw)
  To: Heikki Krogerus
  Cc: Greg Kroah-Hartman, Rob Herring, Mark Rutland, Hans de Goede,
	linux-usb, linux-kernel

On Wed, Aug 14, 2019 at 04:24:17PM +0300, Heikki Krogerus wrote:
> Removing the deprecated fusb302 specific properties. There
> are no more platforms using them.
> 
> Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>

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

> ---
>  drivers/usb/typec/tcpm/fusb302.c | 31 +++----------------------------
>  1 file changed, 3 insertions(+), 28 deletions(-)
> 
> diff --git a/drivers/usb/typec/tcpm/fusb302.c b/drivers/usb/typec/tcpm/fusb302.c
> index c524088246ee..074fbb17fa8b 100644
> --- a/drivers/usb/typec/tcpm/fusb302.c
> +++ b/drivers/usb/typec/tcpm/fusb302.c
> @@ -1670,29 +1670,6 @@ static int init_gpio(struct fusb302_chip *chip)
>  	return 0;
>  }
>  
> -static int fusb302_composite_snk_pdo_array(struct fusb302_chip *chip)
> -{
> -	struct device *dev = chip->dev;
> -	u32 max_uv, max_ua;
> -
> -	chip->snk_pdo[0] = PDO_FIXED(5000, 400, PDO_FIXED_FLAGS);
> -
> -	/*
> -	 * As max_snk_ma/mv/mw is not needed for tcpc_config,
> -	 * those settings should be passed in via sink PDO, so
> -	 * "fcs, max-sink-*" properties will be deprecated, to
> -	 * perserve compatibility with existing users of them,
> -	 * we read those properties to convert them to be a var
> -	 * PDO.
> -	 */
> -	if (device_property_read_u32(dev, "fcs,max-sink-microvolt", &max_uv) ||
> -		device_property_read_u32(dev, "fcs,max-sink-microamp", &max_ua))
> -		return 1;
> -
> -	chip->snk_pdo[1] = PDO_VAR(5000, max_uv / 1000, max_ua / 1000);
> -	return 2;
> -}
> -
>  static int fusb302_probe(struct i2c_client *client,
>  			 const struct i2c_device_id *id)
>  {
> @@ -1701,7 +1678,6 @@ static int fusb302_probe(struct i2c_client *client,
>  	struct device *dev = &client->dev;
>  	const char *name;
>  	int ret = 0;
> -	u32 v;
>  
>  	if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_I2C_BLOCK)) {
>  		dev_err(&client->dev,
> @@ -1721,11 +1697,10 @@ static int fusb302_probe(struct i2c_client *client,
>  	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;
> -
>  	/* Composite sink PDO */
> -	chip->tcpc_config.nr_snk_pdo = fusb302_composite_snk_pdo_array(chip);
> +	chip->snk_pdo[0] = PDO_FIXED(5000, 400, PDO_FIXED_FLAGS);
> +
> +	chip->tcpc_config.nr_snk_pdo = 1;
>  	chip->tcpc_config.snk_pdo = chip->snk_pdo;
>  
>  	/*
> -- 
> 2.20.1
> 

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

* Re: [PATCH 2/3] dt-bindings: usb: fusb302: Remove deprecated properties
  2019-08-14 13:24 ` [PATCH 2/3] dt-bindings: usb: fusb302: Remove deprecated properties Heikki Krogerus
@ 2019-08-14 13:37   ` Guenter Roeck
  0 siblings, 0 replies; 13+ messages in thread
From: Guenter Roeck @ 2019-08-14 13:37 UTC (permalink / raw)
  To: Heikki Krogerus
  Cc: Greg Kroah-Hartman, Rob Herring, Mark Rutland, Hans de Goede,
	linux-usb, linux-kernel

On Wed, Aug 14, 2019 at 04:24:18PM +0300, Heikki Krogerus wrote:
> There are no platforms using them anymore.
> 
> Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>

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

> ---
>  Documentation/devicetree/bindings/usb/fcs,fusb302.txt | 7 -------
>  1 file changed, 7 deletions(-)
> 
> diff --git a/Documentation/devicetree/bindings/usb/fcs,fusb302.txt b/Documentation/devicetree/bindings/usb/fcs,fusb302.txt
> index a5d011d2efc8..ba2e32d500c0 100644
> --- a/Documentation/devicetree/bindings/usb/fcs,fusb302.txt
> +++ b/Documentation/devicetree/bindings/usb/fcs,fusb302.txt
> @@ -11,13 +11,6 @@ Required sub-node:
>  
>  	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:
>  
> -- 
> 2.20.1
> 

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

* Re: [PATCH 3/3] usb: typec: fusb302: Always provide fwnode for the port
  2019-08-14 13:24 ` [PATCH 3/3] usb: typec: fusb302: Always provide fwnode for the port Heikki Krogerus
@ 2019-08-14 13:37   ` Guenter Roeck
  0 siblings, 0 replies; 13+ messages in thread
From: Guenter Roeck @ 2019-08-14 13:37 UTC (permalink / raw)
  To: Heikki Krogerus
  Cc: Greg Kroah-Hartman, Rob Herring, Mark Rutland, Hans de Goede,
	linux-usb, linux-kernel

On Wed, Aug 14, 2019 at 04:24:19PM +0300, Heikki Krogerus wrote:
> By registering a software fwnode for the port when the
> firmware does not supply one, we can always provide tcpm the
> connector capabilities by using the common USB connector
> device properties instead of using tcpc_config platform data.
> 
> Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>

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

> ---
>  drivers/usb/typec/tcpm/fusb302.c | 70 +++++++++++++++++++-------------
>  1 file changed, 41 insertions(+), 29 deletions(-)
> 
> diff --git a/drivers/usb/typec/tcpm/fusb302.c b/drivers/usb/typec/tcpm/fusb302.c
> index 074fbb17fa8b..93244d6c4bff 100644
> --- a/drivers/usb/typec/tcpm/fusb302.c
> +++ b/drivers/usb/typec/tcpm/fusb302.c
> @@ -75,7 +75,6 @@ struct fusb302_chip {
>  	struct i2c_client *i2c_client;
>  	struct tcpm_port *tcpm_port;
>  	struct tcpc_dev tcpc_dev;
> -	struct tcpc_config tcpc_config;
>  
>  	struct regulator *vbus;
>  
> @@ -1110,23 +1109,6 @@ static void fusb302_bc_lvl_handler_work(struct work_struct *work)
>  	mutex_unlock(&chip->lock);
>  }
>  
> -#define PDO_FIXED_FLAGS \
> -	(PDO_FIXED_DUAL_ROLE | PDO_FIXED_DATA_SWAP | PDO_FIXED_USB_COMM)
> -
> -static const u32 src_pdo[] = {
> -	PDO_FIXED(5000, 400, PDO_FIXED_FLAGS),
> -};
> -
> -static const struct tcpc_config fusb302_tcpc_config = {
> -	.src_pdo = src_pdo,
> -	.nr_src_pdo = ARRAY_SIZE(src_pdo),
> -	.operating_snk_mw = 2500,
> -	.type = TYPEC_PORT_DRP,
> -	.data = TYPEC_PORT_DRD,
> -	.default_role = TYPEC_SINK,
> -	.alt_modes = NULL,
> -};
> -
>  static void init_tcpc_dev(struct tcpc_dev *fusb302_tcpc_dev)
>  {
>  	fusb302_tcpc_dev->init = tcpm_init;
> @@ -1670,6 +1652,38 @@ static int init_gpio(struct fusb302_chip *chip)
>  	return 0;
>  }
>  
> +#define PDO_FIXED_FLAGS \
> +	(PDO_FIXED_DUAL_ROLE | PDO_FIXED_DATA_SWAP | PDO_FIXED_USB_COMM)
> +
> +static const u32 src_pdo[] = {
> +	PDO_FIXED(5000, 400, PDO_FIXED_FLAGS)
> +};
> +
> +static const u32 snk_pdo[] = {
> +	PDO_FIXED(5000, 400, PDO_FIXED_FLAGS)
> +};
> +
> +static const struct property_entry port_props[] = {
> +	PROPERTY_ENTRY_STRING("data-role", "dual"),
> +	PROPERTY_ENTRY_STRING("power-role", "dual"),
> +	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),
> +	{ }
> +};
> +
> +static struct fwnode_handle *fusb302_fwnode_get(struct device *dev)
> +{
> +	struct fwnode_handle *fwnode;
> +
> +	fwnode = device_get_named_child_node(dev, "connector");
> +	if (!fwnode)
> +		fwnode = fwnode_create_software_node(port_props, NULL);
> +
> +	return fwnode;
> +}
> +
>  static int fusb302_probe(struct i2c_client *client,
>  			 const struct i2c_device_id *id)
>  {
> @@ -1690,19 +1704,8 @@ static int fusb302_probe(struct i2c_client *client,
>  
>  	chip->i2c_client = client;
>  	chip->dev = &client->dev;
> -	chip->tcpc_config = fusb302_tcpc_config;
> -	chip->tcpc_dev.config = &chip->tcpc_config;
>  	mutex_init(&chip->lock);
>  
> -	chip->tcpc_dev.fwnode =
> -		device_get_named_child_node(dev, "connector");
> -
> -	/* Composite sink PDO */
> -	chip->snk_pdo[0] = PDO_FIXED(5000, 400, PDO_FIXED_FLAGS);
> -
> -	chip->tcpc_config.nr_snk_pdo = 1;
> -	chip->tcpc_config.snk_pdo = chip->snk_pdo;
> -
>  	/*
>  	 * Devicetree platforms should get extcon via phandle (not yet
>  	 * supported). On ACPI platforms, we get the name from a device prop.
> @@ -1737,8 +1740,15 @@ static int fusb302_probe(struct i2c_client *client,
>  			goto destroy_workqueue;
>  	}
>  
> +	chip->tcpc_dev.fwnode = fusb302_fwnode_get(dev);
> +	if (IS_ERR(chip->tcpc_dev.fwnode)) {
> +		ret = PTR_ERR(chip->tcpc_dev.fwnode);
> +		goto destroy_workqueue;
> +	}
> +
>  	chip->tcpm_port = tcpm_register_port(&client->dev, &chip->tcpc_dev);
>  	if (IS_ERR(chip->tcpm_port)) {
> +		fwnode_handle_put(chip->tcpc_dev.fwnode);
>  		ret = PTR_ERR(chip->tcpm_port);
>  		if (ret != -EPROBE_DEFER)
>  			dev_err(dev, "cannot register tcpm port, ret=%d", ret);
> @@ -1760,6 +1770,7 @@ static int fusb302_probe(struct i2c_client *client,
>  
>  tcpm_unregister_port:
>  	tcpm_unregister_port(chip->tcpm_port);
> +	fwnode_handle_put(chip->tcpc_dev.fwnode);
>  destroy_workqueue:
>  	destroy_workqueue(chip->wq);
>  
> @@ -1775,6 +1786,7 @@ static int fusb302_remove(struct i2c_client *client)
>  	cancel_work_sync(&chip->irq_work);
>  	cancel_delayed_work_sync(&chip->bc_lvl_handler);
>  	tcpm_unregister_port(chip->tcpm_port);
> +	fwnode_handle_put(chip->tcpc_dev.fwnode);
>  	destroy_workqueue(chip->wq);
>  	fusb302_debugfs_exit(chip);
>  
> -- 
> 2.20.1
> 

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

* Re: [PATCH 0/3] usb: typec: fusb302: Small changes
  2019-08-14 13:24 [PATCH 0/3] usb: typec: fusb302: Small changes Heikki Krogerus
                   ` (2 preceding siblings ...)
  2019-08-14 13:24 ` [PATCH 3/3] usb: typec: fusb302: Always provide fwnode for the port Heikki Krogerus
@ 2019-08-14 13:42 ` Hans de Goede
  2019-08-14 15:07   ` Heikki Krogerus
  2019-08-15 12:55   ` Greg Kroah-Hartman
  2019-08-15 17:26 ` Hans de Goede
  4 siblings, 2 replies; 13+ messages in thread
From: Hans de Goede @ 2019-08-14 13:42 UTC (permalink / raw)
  To: Heikki Krogerus, Greg Kroah-Hartman, Guenter Roeck
  Cc: Rob Herring, Mark Rutland, linux-usb, linux-kernel

Hi,

On 14-08-19 15:24, Heikki Krogerus wrote:
> Hi,
> 
> This series removes the deprecated fusb302 specific properties, and
> stops using struct tcpc_config in the driver.

Series looks good to me:

Reviewed-by: Hans de Goede <hdegoede@redhat.com>

This has a small conflict with my
"[PATCH] usb: typec: fusb302: Call fusb302_debugfs_init earlier"
patch.

Since we've agreed to do the rootdir leak fix as a separate patch
(which I will write when I find some time probably tomorrow), I
was wondering if we can merge my patch first. I would like to see
a "Cc: stable@vger.kernel.org" added to my patch and then it would
be good to have it merged first.

Regardless we should probable prepare one series with all patches
for Greg to make this easy to merge for him.

Shall I combine this series + my fix + my to be written fix into
1 series, test that on actual hardware and then post that?

Regards,

Hans

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

* Re: [PATCH 0/3] usb: typec: fusb302: Small changes
  2019-08-14 13:42 ` [PATCH 0/3] usb: typec: fusb302: Small changes Hans de Goede
@ 2019-08-14 15:07   ` Heikki Krogerus
  2019-08-15 12:55   ` Greg Kroah-Hartman
  1 sibling, 0 replies; 13+ messages in thread
From: Heikki Krogerus @ 2019-08-14 15:07 UTC (permalink / raw)
  To: Hans de Goede
  Cc: Greg Kroah-Hartman, Guenter Roeck, Rob Herring, Mark Rutland,
	linux-usb, linux-kernel

On Wed, Aug 14, 2019 at 03:42:46PM +0200, Hans de Goede wrote:
> Hi,
> 
> On 14-08-19 15:24, Heikki Krogerus wrote:
> > Hi,
> > 
> > This series removes the deprecated fusb302 specific properties, and
> > stops using struct tcpc_config in the driver.
> 
> Series looks good to me:
> 
> Reviewed-by: Hans de Goede <hdegoede@redhat.com>
> 
> This has a small conflict with my
> "[PATCH] usb: typec: fusb302: Call fusb302_debugfs_init earlier"
> patch.

Oh, damn it. Sorry.

> Since we've agreed to do the rootdir leak fix as a separate patch
> (which I will write when I find some time probably tomorrow), I
> was wondering if we can merge my patch first. I would like to see
> a "Cc: stable@vger.kernel.org" added to my patch and then it would
> be good to have it merged first.
> 
> Regardless we should probable prepare one series with all patches
> for Greg to make this easy to merge for him.
> 
> Shall I combine this series + my fix + my to be written fix into
> 1 series, test that on actual hardware and then post that?

That works for me.

thanks,

-- 
heikki

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

* Re: [PATCH 0/3] usb: typec: fusb302: Small changes
  2019-08-14 13:42 ` [PATCH 0/3] usb: typec: fusb302: Small changes Hans de Goede
  2019-08-14 15:07   ` Heikki Krogerus
@ 2019-08-15 12:55   ` Greg Kroah-Hartman
  2019-08-15 14:03     ` Hans de Goede
  1 sibling, 1 reply; 13+ messages in thread
From: Greg Kroah-Hartman @ 2019-08-15 12:55 UTC (permalink / raw)
  To: Hans de Goede
  Cc: Heikki Krogerus, Guenter Roeck, Rob Herring, Mark Rutland,
	linux-usb, linux-kernel

On Wed, Aug 14, 2019 at 03:42:46PM +0200, Hans de Goede wrote:
> Hi,
> 
> On 14-08-19 15:24, Heikki Krogerus wrote:
> > Hi,
> > 
> > This series removes the deprecated fusb302 specific properties, and
> > stops using struct tcpc_config in the driver.
> 
> Series looks good to me:
> 
> Reviewed-by: Hans de Goede <hdegoede@redhat.com>
> 
> This has a small conflict with my
> "[PATCH] usb: typec: fusb302: Call fusb302_debugfs_init earlier"
> patch.
> 
> Since we've agreed to do the rootdir leak fix as a separate patch
> (which I will write when I find some time probably tomorrow), I
> was wondering if we can merge my patch first. I would like to see
> a "Cc: stable@vger.kernel.org" added to my patch and then it would
> be good to have it merged first.
> 
> Regardless we should probable prepare one series with all patches
> for Greg to make this easy to merge for him.

I'll take this series now, and you can redo your patch based on my
usb-next branch with them in it.

thanks,

greg k-h

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

* Re: [PATCH 0/3] usb: typec: fusb302: Small changes
  2019-08-15 12:55   ` Greg Kroah-Hartman
@ 2019-08-15 14:03     ` Hans de Goede
  0 siblings, 0 replies; 13+ messages in thread
From: Hans de Goede @ 2019-08-15 14:03 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Heikki Krogerus, Guenter Roeck, Rob Herring, Mark Rutland,
	linux-usb, linux-kernel

Hi,

On 15-08-19 14:55, Greg Kroah-Hartman wrote:
> On Wed, Aug 14, 2019 at 03:42:46PM +0200, Hans de Goede wrote:
>> Hi,
>>
>> On 14-08-19 15:24, Heikki Krogerus wrote:
>>> Hi,
>>>
>>> This series removes the deprecated fusb302 specific properties, and
>>> stops using struct tcpc_config in the driver.
>>
>> Series looks good to me:
>>
>> Reviewed-by: Hans de Goede <hdegoede@redhat.com>
>>
>> This has a small conflict with my
>> "[PATCH] usb: typec: fusb302: Call fusb302_debugfs_init earlier"
>> patch.
>>
>> Since we've agreed to do the rootdir leak fix as a separate patch
>> (which I will write when I find some time probably tomorrow), I
>> was wondering if we can merge my patch first. I would like to see
>> a "Cc: stable@vger.kernel.org" added to my patch and then it would
>> be good to have it merged first.
>>
>> Regardless we should probable prepare one series with all patches
>> for Greg to make this easy to merge for him.
> 
> I'll take this series now, and you can redo your patch based on my
> usb-next branch with them in it.

Ok.

Regards,

Hans

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

* Re: [PATCH 0/3] usb: typec: fusb302: Small changes
  2019-08-14 13:24 [PATCH 0/3] usb: typec: fusb302: Small changes Heikki Krogerus
                   ` (3 preceding siblings ...)
  2019-08-14 13:42 ` [PATCH 0/3] usb: typec: fusb302: Small changes Hans de Goede
@ 2019-08-15 17:26 ` Hans de Goede
  2019-08-15 19:30   ` Greg Kroah-Hartman
  4 siblings, 1 reply; 13+ messages in thread
From: Hans de Goede @ 2019-08-15 17:26 UTC (permalink / raw)
  To: Heikki Krogerus, Greg Kroah-Hartman, Guenter Roeck
  Cc: Rob Herring, Mark Rutland, linux-usb, linux-kernel

Hi,

On 14-08-19 15:24, Heikki Krogerus wrote:
> Hi,
> 
> This series removes the deprecated fusb302 specific properties, and
> stops using struct tcpc_config in the driver.
> 
> thanks,
> 
> Heikki Krogerus (3):
>    usb: typec: fusb302: Remove unused properties
>    dt-bindings: usb: fusb302: Remove deprecated properties
>    usb: typec: fusb302: Always provide fwnode for the port

I know this series is already in usb-testing, still I thought
it would be a good idea to test it on my CHT hw with a fusb302
TypeC controller. So I've just completed testing this and it
works as advertised:

So FWIW:

Tested-by: Hans de Goede <hdegoede@redhat.com>

Regards,

Hans


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

* Re: [PATCH 0/3] usb: typec: fusb302: Small changes
  2019-08-15 17:26 ` Hans de Goede
@ 2019-08-15 19:30   ` Greg Kroah-Hartman
  0 siblings, 0 replies; 13+ messages in thread
From: Greg Kroah-Hartman @ 2019-08-15 19:30 UTC (permalink / raw)
  To: Hans de Goede
  Cc: Heikki Krogerus, Guenter Roeck, Rob Herring, Mark Rutland,
	linux-usb, linux-kernel

On Thu, Aug 15, 2019 at 07:26:42PM +0200, Hans de Goede wrote:
> Hi,
> 
> On 14-08-19 15:24, Heikki Krogerus wrote:
> > Hi,
> > 
> > This series removes the deprecated fusb302 specific properties, and
> > stops using struct tcpc_config in the driver.
> > 
> > thanks,
> > 
> > Heikki Krogerus (3):
> >    usb: typec: fusb302: Remove unused properties
> >    dt-bindings: usb: fusb302: Remove deprecated properties
> >    usb: typec: fusb302: Always provide fwnode for the port
> 
> I know this series is already in usb-testing, still I thought
> it would be a good idea to test it on my CHT hw with a fusb302
> TypeC controller. So I've just completed testing this and it
> works as advertised:
> 
> So FWIW:
> 
> Tested-by: Hans de Goede <hdegoede@redhat.com>

Thanks, I'll go add this as I can rebase that branch...

greg k-h

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

end of thread, other threads:[~2019-08-15 19:30 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-08-14 13:24 [PATCH 0/3] usb: typec: fusb302: Small changes Heikki Krogerus
2019-08-14 13:24 ` [PATCH 1/3] usb: typec: fusb302: Remove unused properties Heikki Krogerus
2019-08-14 13:37   ` Guenter Roeck
2019-08-14 13:24 ` [PATCH 2/3] dt-bindings: usb: fusb302: Remove deprecated properties Heikki Krogerus
2019-08-14 13:37   ` Guenter Roeck
2019-08-14 13:24 ` [PATCH 3/3] usb: typec: fusb302: Always provide fwnode for the port Heikki Krogerus
2019-08-14 13:37   ` Guenter Roeck
2019-08-14 13:42 ` [PATCH 0/3] usb: typec: fusb302: Small changes Hans de Goede
2019-08-14 15:07   ` Heikki Krogerus
2019-08-15 12:55   ` Greg Kroah-Hartman
2019-08-15 14:03     ` Hans de Goede
2019-08-15 17:26 ` Hans de Goede
2019-08-15 19:30   ` Greg Kroah-Hartman

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