linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] Add TI tps6598x DT binding and probe
@ 2020-05-07 12:23 Bryan O'Donoghue
  2020-05-07 12:23 ` [PATCH 1/2] dt-bindings: usb: Add TI tps6598x device tree binding documentation Bryan O'Donoghue
  2020-05-07 12:23 ` [PATCH 2/2] usb: typec: tps6598x: Add OF probe binding Bryan O'Donoghue
  0 siblings, 2 replies; 5+ messages in thread
From: Bryan O'Donoghue @ 2020-05-07 12:23 UTC (permalink / raw)
  To: heikki.krogerus, robh+dt, linux-usb, devicetree
  Cc: gregkh, linux-kernel, nikolaus.voss, andriy.shevchenko, garsilva,
	keescook, Bryan O'Donoghue

This simple series adds DT binding yaml and a DT lookup table for the
tps6598x.

Its possible to use i2c id_table to match the 'compatible = "ti,tps6598x"
and probe that way, however I think it is worthwhile adding a specific OF
way of doing it and having an accompanying yaml as an example.

Bryan O'Donoghue (2):
  dt-bindings: usb: Add TI tps6598x device tree binding documentation
  usb: typec: tps6598x: Add OF probe binding

 .../devicetree/bindings/usb/ti,tps6598x.yaml  | 65 +++++++++++++++++++
 drivers/usb/typec/tps6598x.c                  |  9 +++
 2 files changed, 74 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/usb/ti,tps6598x.yaml

-- 
2.25.1


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

* [PATCH 1/2] dt-bindings: usb: Add TI tps6598x device tree binding documentation
  2020-05-07 12:23 [PATCH 0/2] Add TI tps6598x DT binding and probe Bryan O'Donoghue
@ 2020-05-07 12:23 ` Bryan O'Donoghue
  2020-05-07 12:32   ` Andy Shevchenko
  2020-05-07 12:23 ` [PATCH 2/2] usb: typec: tps6598x: Add OF probe binding Bryan O'Donoghue
  1 sibling, 1 reply; 5+ messages in thread
From: Bryan O'Donoghue @ 2020-05-07 12:23 UTC (permalink / raw)
  To: heikki.krogerus, robh+dt, linux-usb, devicetree
  Cc: gregkh, linux-kernel, nikolaus.voss, andriy.shevchenko, garsilva,
	keescook, Bryan O'Donoghue

Add device tree binding documentation for the Texas Instruments tps6598x
Type-C chip driver.

Cc: Rob Herring <robh+dt@kernel.org>
Cc: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: linux-usb@vger.kernel.org
Cc: devicetree@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
---
 .../devicetree/bindings/usb/ti,tps6598x.yaml  | 65 +++++++++++++++++++
 1 file changed, 65 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/usb/ti,tps6598x.yaml

diff --git a/Documentation/devicetree/bindings/usb/ti,tps6598x.yaml b/Documentation/devicetree/bindings/usb/ti,tps6598x.yaml
new file mode 100644
index 000000000000..fc18274d7775
--- /dev/null
+++ b/Documentation/devicetree/bindings/usb/ti,tps6598x.yaml
@@ -0,0 +1,65 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: "http://devicetree.org/schemas/usb/ti,tps6598x.yaml#"
+$schema: "http://devicetree.org/meta-schemas/core.yaml#"
+
+title: Texas Instruments 6598x Type-C Port Switch and Power Delivery controller DT bindings
+
+maintainers:
+  - Heikki Krogerus <heikki.krogerus@linux.intel.com>
+  - Bryan O'Donoghue <bryan.odonoghue@linaro.org>
+
+description: |
+  Texas Instruments 6598x Type-C Port Switch and Power Delivery controller
+
+properties:
+  compatible:
+    enum:
+      - ti,tps6598x
+  reg:
+    maxItems: 1
+
+  interrupts:
+    maxItems: 1
+
+  interrupt-names:
+    items:
+      - const: irq
+
+required:
+  - compatible
+  - reg
+  - interrupts
+  - interrupt-names
+
+examples:
+  - |
+    #include <dt-bindings/interrupt-controller/irq.h>
+    i2c0 {
+        #address-cells = <1>;
+        #size-cells = <0>;
+    
+        tps6598x: tps6598x@38 {
+            compatible = "ti,tps6598x";
+            reg = <0x38>;
+
+            interrupt-parent = <&msmgpio>;
+            interrupts = <107 IRQ_TYPE_LEVEL_LOW>;
+            interrupt-names = "irq";
+
+            pinctrl-names = "default";
+            pinctrl-0 = <&typec_pins>;
+
+            typec_con: connector {
+                compatible = "usb-c-connector";
+                label = "USB-C";
+                port {
+                    typec_ep: endpoint {
+                        remote-endpoint = <&otg_ep>;
+                    };
+                };
+            };
+        };
+    };
+...
-- 
2.25.1


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

* [PATCH 2/2] usb: typec: tps6598x: Add OF probe binding
  2020-05-07 12:23 [PATCH 0/2] Add TI tps6598x DT binding and probe Bryan O'Donoghue
  2020-05-07 12:23 ` [PATCH 1/2] dt-bindings: usb: Add TI tps6598x device tree binding documentation Bryan O'Donoghue
@ 2020-05-07 12:23 ` Bryan O'Donoghue
  2020-05-07 12:33   ` Andy Shevchenko
  1 sibling, 1 reply; 5+ messages in thread
From: Bryan O'Donoghue @ 2020-05-07 12:23 UTC (permalink / raw)
  To: heikki.krogerus, robh+dt, linux-usb, devicetree
  Cc: gregkh, linux-kernel, nikolaus.voss, andriy.shevchenko, garsilva,
	keescook, Bryan O'Donoghue

Adds a MODULE_DEVICE_TABLE() to allow probing of this driver from a DTS
setting.

Cc: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Nikolaus Voss <nikolaus.voss@loewensteinmedical.de>
Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: Gustavo A. R. Silva <garsilva@embeddedor.com>
Cc: Kees Cook <keescook@chromium.org>
Cc: linux-usb@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
---
 drivers/usb/typec/tps6598x.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/drivers/usb/typec/tps6598x.c b/drivers/usb/typec/tps6598x.c
index 0698addd1185..61c6761072c9 100644
--- a/drivers/usb/typec/tps6598x.c
+++ b/drivers/usb/typec/tps6598x.c
@@ -563,6 +563,14 @@ static int tps6598x_remove(struct i2c_client *client)
 	return 0;
 }
 
+#ifdef CONFIG_OF
+static const struct of_device_id tps6598x_of_match[] = {
+	{ .compatible = "ti,tps6598x", },
+	{},
+};
+MODULE_DEVICE_TABLE(of, tps6598x_of_match);
+#endif
+
 static const struct i2c_device_id tps6598x_id[] = {
 	{ "tps6598x" },
 	{ }
@@ -572,6 +580,7 @@ MODULE_DEVICE_TABLE(i2c, tps6598x_id);
 static struct i2c_driver tps6598x_i2c_driver = {
 	.driver = {
 		.name = "tps6598x",
+		.of_match_table = of_match_ptr(tps6598x_of_match),
 	},
 	.probe_new = tps6598x_probe,
 	.remove = tps6598x_remove,
-- 
2.25.1


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

* Re: [PATCH 1/2] dt-bindings: usb: Add TI tps6598x device tree binding documentation
  2020-05-07 12:23 ` [PATCH 1/2] dt-bindings: usb: Add TI tps6598x device tree binding documentation Bryan O'Donoghue
@ 2020-05-07 12:32   ` Andy Shevchenko
  0 siblings, 0 replies; 5+ messages in thread
From: Andy Shevchenko @ 2020-05-07 12:32 UTC (permalink / raw)
  To: Bryan O'Donoghue
  Cc: heikki.krogerus, robh+dt, linux-usb, devicetree, gregkh,
	linux-kernel, nikolaus.voss, garsilva, keescook

On Thu, May 07, 2020 at 01:23:51PM +0100, Bryan O'Donoghue wrote:
> Add device tree binding documentation for the Texas Instruments tps6598x
> Type-C chip driver.

> +maintainers:
> +  - Heikki Krogerus <heikki.krogerus@linux.intel.com>
> +  - Bryan O'Donoghue <bryan.odonoghue@linaro.org>

This makes Heikki maintainer of a shema. I dunno if he want this.

> +        #size-cells = <0>;
> +    

Trailing spaces.

-- 
With Best Regards,
Andy Shevchenko



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

* Re: [PATCH 2/2] usb: typec: tps6598x: Add OF probe binding
  2020-05-07 12:23 ` [PATCH 2/2] usb: typec: tps6598x: Add OF probe binding Bryan O'Donoghue
@ 2020-05-07 12:33   ` Andy Shevchenko
  0 siblings, 0 replies; 5+ messages in thread
From: Andy Shevchenko @ 2020-05-07 12:33 UTC (permalink / raw)
  To: Bryan O'Donoghue
  Cc: heikki.krogerus, robh+dt, linux-usb, devicetree, gregkh,
	linux-kernel, nikolaus.voss, garsilva, keescook

On Thu, May 07, 2020 at 01:23:52PM +0100, Bryan O'Donoghue wrote:
> Adds a MODULE_DEVICE_TABLE() to allow probing of this driver from a DTS
> setting.
> 
> Cc: Heikki Krogerus <heikki.krogerus@linux.intel.com>
> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> Cc: Nikolaus Voss <nikolaus.voss@loewensteinmedical.de>
> Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> Cc: Gustavo A. R. Silva <garsilva@embeddedor.com>
> Cc: Kees Cook <keescook@chromium.org>
> Cc: linux-usb@vger.kernel.org
> Cc: linux-kernel@vger.kernel.org
> Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
> ---
>  drivers/usb/typec/tps6598x.c | 9 +++++++++
>  1 file changed, 9 insertions(+)
> 
> diff --git a/drivers/usb/typec/tps6598x.c b/drivers/usb/typec/tps6598x.c
> index 0698addd1185..61c6761072c9 100644
> --- a/drivers/usb/typec/tps6598x.c
> +++ b/drivers/usb/typec/tps6598x.c
> @@ -563,6 +563,14 @@ static int tps6598x_remove(struct i2c_client *client)
>  	return 0;
>  }
>  
> +#ifdef CONFIG_OF

No need for this (and thus for of_match_ptr() macro below). Saving few dozens of bytes?

> +static const struct of_device_id tps6598x_of_match[] = {
> +	{ .compatible = "ti,tps6598x", },

> +	{},

No comma for terminator line.

> +};
> +MODULE_DEVICE_TABLE(of, tps6598x_of_match);
> +#endif
> +
>  static const struct i2c_device_id tps6598x_id[] = {
>  	{ "tps6598x" },
>  	{ }
> @@ -572,6 +580,7 @@ MODULE_DEVICE_TABLE(i2c, tps6598x_id);
>  static struct i2c_driver tps6598x_i2c_driver = {
>  	.driver = {
>  		.name = "tps6598x",
> +		.of_match_table = of_match_ptr(tps6598x_of_match),

-- 
With Best Regards,
Andy Shevchenko



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

end of thread, other threads:[~2020-05-07 12:33 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-07 12:23 [PATCH 0/2] Add TI tps6598x DT binding and probe Bryan O'Donoghue
2020-05-07 12:23 ` [PATCH 1/2] dt-bindings: usb: Add TI tps6598x device tree binding documentation Bryan O'Donoghue
2020-05-07 12:32   ` Andy Shevchenko
2020-05-07 12:23 ` [PATCH 2/2] usb: typec: tps6598x: Add OF probe binding Bryan O'Donoghue
2020-05-07 12:33   ` Andy Shevchenko

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