Skip to contentSkip to conversation

dw9807 binding and driver compatible changes

PATCH Superseded Sakari Ailus 2 participants 11 messages Mar 18, 2022 – Mar 23, 2022

Subsystems (4)

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore

Sakari Ailus

author maintainer
#0 lore raw

cover dw9807 binding and driver compatible changes

Hello everyone,

These two patches convert dw9807 bindings to json-schema and add a new compatible string to the dw9807-vcm driver in order to support existing ACPI firmware.

Sakari Ailus (2):
dt-bindings: Convert Dongwoon dw9807-vcm bindings to json-schema
dw9807-vcm: Add "dongwoon,dw9807" compatible string

 .../media/i2c/dongwoon,dw9807-vcm.txt         |  9 ----
 .../media/i2c/dongwoon,dw9807-vcm.yaml        | 43 +++++++++++++++++++
 drivers/media/i2c/dw9807-vcm.c                |  2 +
 3 files changed, 45 insertions(+), 9 deletions(-)
 delete mode 100644 Documentation/devicetree/bindings/media/i2c/dongwoon,dw9807-vcm.txt
 create mode 100644 Documentation/devicetree/bindings/media/i2c/dongwoon,dw9807-vcm.yaml
Signature · 1 line
2.30.2
author maintainer
#1 lore raw

PATCH 1/2 dt-bindings: Convert Dongwoon dw9807-vcm bindings to json-schema

Convert the old text based dw9807-vcm chip DT bindings to json-schema.

---
 .../media/i2c/dongwoon,dw9807-vcm.txt         |  9 ----
 .../media/i2c/dongwoon,dw9807-vcm.yaml        | 43 +++++++++++++++++++
 2 files changed, 43 insertions(+), 9 deletions(-)
 delete mode 100644 Documentation/devicetree/bindings/media/i2c/dongwoon,dw9807-vcm.txt
 create mode 100644 Documentation/devicetree/bindings/media/i2c/dongwoon,dw9807-vcm.yaml
Documentation/devicetree/bindings/media/i2c/dongwoon,dw9807-vcm.txt deleted +0 -9
deleted file mode 100644
index c4701f1eaaf63..0000000000000
@@ -1,9 +0,0 @@
-Dongwoon Anatech DW9807 voice coil lens driver
-
-DW9807 is a 10-bit DAC with current sink capability. It is intended for
-controlling voice coil lenses.
-
-Mandatory properties:
-
-- compatible: "dongwoon,dw9807-vcm"
-- reg: I2C slave address
Documentation/devicetree/bindings/media/i2c/dongwoon,dw9807-vcm.yaml new file +43 -0

43 lines not on this page · raw message

Signature · 1 line
2.30.2
Reviewed-by on v1 1/2
#2 lore raw

Re: [PATCH 1/2] dt-bindings: Convert Dongwoon dw9807-vcm bindings to json-schema

Quoted 39 lines · Sakari Ailus

Convert the old text based dw9807-vcm chip DT bindings to json-schema.

---
 .../media/i2c/dongwoon,dw9807-vcm.txt         |  9 ----
 .../media/i2c/dongwoon,dw9807-vcm.yaml        | 43 +++++++++++++++++++
 2 files changed, 43 insertions(+), 9 deletions(-)
 delete mode 100644 Documentation/devicetree/bindings/media/i2c/dongwoon,dw9807-vcm.txt
 create mode 100644 Documentation/devicetree/bindings/media/i2c/dongwoon,dw9807-vcm.yaml
Documentation/devicetree/bindings/media/i2c/dongwoon,dw9807-vcm.txt deleted +0 -9
deleted file mode 100644
index c4701f1eaaf63..0000000000000
@@ -1,9 +0,0 @@
-Dongwoon Anatech DW9807 voice coil lens driver
-
-DW9807 is a 10-bit DAC with current sink capability. It is intended for
-controlling voice coil lenses.
-
-Mandatory properties:
-
-- compatible: "dongwoon,dw9807-vcm"
-- reg: I2C slave address
Documentation/devicetree/bindings/media/i2c/dongwoon,dw9807-vcm.yaml new file +8 -0
new file mode 100644
index 0000000000000..0cf153ed547fe
@@ -0,0 +1,43 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+# Copyright (C) 2018, 2021 Intel Corporation
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/media/i2c/dongwoon,dw9807-vcm.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Dongwoon Anatech DW9807 voice coil lens driver

Documentation/devicetree/bindings/media/i2c/dongwoon,dw9807-vcm.yaml line 18

Quoted 10 lines
Documentation/devicetree/bindings/media/i2c/dongwoon,dw9807-vcm.yaml new file +10 -0
+
+maintainers:
+  - Sakari Ailus <[email protected]>
+
+description: |
+  DW9807 is a 10-bit DAC with current sink capability. It is intended for
+  controlling voice coil lenses.
+
+properties:
+

No blank line.

Documentation/devicetree/bindings/media/i2c/dongwoon,dw9807-vcm.yaml line 20

Quoted 2 lines
Documentation/devicetree/bindings/media/i2c/dongwoon,dw9807-vcm.yaml new file +2 -0
+  compatible:
+    const: "dongwoon,dw9807-vcm"

No quotes.

Documentation/devicetree/bindings/media/i2c/dongwoon,dw9807-vcm.yaml line 33

Quoted 13 lines
Documentation/devicetree/bindings/media/i2c/dongwoon,dw9807-vcm.yaml new file +13 -0
+
+  reg:
+    maxItems: 1
+
+required:
+  - compatible
+  - reg
+
+additionalProperties: false
+
+examples:
+  - |
+

No blank line.

With the changes above:

Best regards,
Krzysztof

author maintainer
#3 lore raw

Re: [PATCH 1/2] dt-bindings: Convert Dongwoon dw9807-vcm bindings to json-schema

Hi Krzysztof,

Quoted 18 lines · Krzysztof Kozlowski
Quoted 4 lines · Sakari Ailus

+$id: http://devicetree.org/schemas/media/i2c/dongwoon,dw9807-vcm.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#

Documentation/devicetree/bindings/media/i2c/dongwoon,dw9807-vcm.yaml new file +2 -0
+
+title: Dongwoon Anatech DW9807 voice coil lens driver

Documentation/devicetree/bindings/media/i2c/dongwoon,dw9807-vcm.yaml line 18

Quoted 10 lines
Documentation/devicetree/bindings/media/i2c/dongwoon,dw9807-vcm.yaml new file +10 -0
+
+maintainers:
+  - Sakari Ailus <[email protected]>
+
+description: |
+  DW9807 is a 10-bit DAC with current sink capability. It is intended for
+  controlling voice coil lenses.
+
+properties:
+

No blank line.

Quoted 4 lines

Documentation/devicetree/bindings/media/i2c/dongwoon,dw9807-vcm.yaml line 20

Quoted 2 lines
Documentation/devicetree/bindings/media/i2c/dongwoon,dw9807-vcm.yaml new file +2 -0
+  compatible:
+    const: "dongwoon,dw9807-vcm"

No quotes.

Hmm. Strings generally need to be quoted, including the compatible strings.

I'll remove the extra blank lines.

Signature · 1 line
Sakari Ailus
#4 lore raw

Re: [PATCH 1/2] dt-bindings: Convert Dongwoon dw9807-vcm bindings to json-schema

Quoted 21 lines · Sakari Ailus

Hi Krzysztof,

Quoted 18 lines · Krzysztof Kozlowski
Quoted 4 lines · Sakari Ailus

+$id: http://devicetree.org/schemas/media/i2c/dongwoon,dw9807-vcm.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#

Documentation/devicetree/bindings/media/i2c/dongwoon,dw9807-vcm.yaml new file +2 -0
+
+title: Dongwoon Anatech DW9807 voice coil lens driver

Documentation/devicetree/bindings/media/i2c/dongwoon,dw9807-vcm.yaml line 18

Quoted 10 lines
Documentation/devicetree/bindings/media/i2c/dongwoon,dw9807-vcm.yaml new file +10 -0
+
+maintainers:
+  - Sakari Ailus <[email protected]>
+
+description: |
+  DW9807 is a 10-bit DAC with current sink capability. It is intended for
+  controlling voice coil lenses.
+
+properties:
+

No blank line.

Quoted 7 lines
Quoted 4 lines

Documentation/devicetree/bindings/media/i2c/dongwoon,dw9807-vcm.yaml line 20

Quoted 2 lines
Documentation/devicetree/bindings/media/i2c/dongwoon,dw9807-vcm.yaml new file +2 -0
+  compatible:
+    const: "dongwoon,dw9807-vcm"

No quotes.

Hmm. Strings generally need to be quoted, including the compatible strings.

No, not in dtschema. Almost none of strings are ever quoted. If you need reference - you example-schema.yaml.

Best regards,
Krzysztof

author maintainer
#5 lore raw

Re: [PATCH 1/2] dt-bindings: Convert Dongwoon dw9807-vcm bindings to json-schema

Quoted 25 lines · Krzysztof Kozlowski
Quoted 24 lines · Sakari Ailus

Hi Krzysztof,

Quoted 21 lines · Krzysztof Kozlowski
Quoted 4 lines · Sakari Ailus

+$id: http://devicetree.org/schemas/media/i2c/dongwoon,dw9807-vcm.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#

Documentation/devicetree/bindings/media/i2c/dongwoon,dw9807-vcm.yaml new file +2 -0
+
+title: Dongwoon Anatech DW9807 voice coil lens driver

Documentation/devicetree/bindings/media/i2c/dongwoon,dw9807-vcm.yaml line 18

Quoted 10 lines
Documentation/devicetree/bindings/media/i2c/dongwoon,dw9807-vcm.yaml new file +10 -0
+
+maintainers:
+  - Sakari Ailus <[email protected]>
+
+description: |
+  DW9807 is a 10-bit DAC with current sink capability. It is intended for
+  controlling voice coil lenses.
+
+properties:
+

No blank line.

Quoted 2 lines
Documentation/devicetree/bindings/media/i2c/dongwoon,dw9807-vcm.yaml new file +2 -0
+  compatible:
+    const: "dongwoon,dw9807-vcm"
Quoted 7 lines
Quoted 4 lines
Quoted 1 line

No quotes.

Hmm. Strings generally need to be quoted, including the compatible strings.

No, not in dtschema. Almost none of strings are ever quoted. If you need reference - you example-schema.yaml.

Good point. I suppose it's because YAML doesn't require that.

I'll drop the quotes in v2.

Signature · 1 line
Sakari Ailus
author maintainer
#6 lore raw

PATCH 2/2 dw9807-vcm: Add "dongwoon,dw9807" compatible string

In reply to Sakari Ailus

There is firmware out there that uses "dongwoon,dw9807" compatible string that never made it to upstream as-is. Add it to the driver to make it load on such systems.

The chip also has an EEPROM part which is AT24 compatible (for reading purposes) on a separate I²C address. Adding possible support for this in the future is not affected by this change.

---
 drivers/media/i2c/dw9807-vcm.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/media/i2c/dw9807-vcm.c +2 -0
index 95e06f13bc9ed..ada8e467a0450 100644
@@ -295,6 +295,8 @@ static int  __maybe_unused dw9807_vcm_resume(struct device *dev)
 
 static const struct of_device_id dw9807_of_table[] = {
 	{ .compatible = "dongwoon,dw9807-vcm" },
+	/* Compatibility for older firmware */
+	{ .compatible = "dongwoon,dw9807" },
 	{ /* sentinel */ }
 };
 MODULE_DEVICE_TABLE(of, dw9807_of_table);
Signature · 1 line
2.30.2
#7 lore raw

Re: [PATCH 2/2] dw9807-vcm: Add "dongwoon,dw9807" compatible string

Quoted 18 lines · Sakari Ailus

There is firmware out there that uses "dongwoon,dw9807" compatible string that never made it to upstream as-is. Add it to the driver to make it load on such systems.

The chip also has an EEPROM part which is AT24 compatible (for reading purposes) on a separate I²C address. Adding possible support for this in the future is not affected by this change.

---
 drivers/media/i2c/dw9807-vcm.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/media/i2c/dw9807-vcm.c +0 -0
index 95e06f13bc9ed..ada8e467a0450 100644

drivers/media/i2c/dw9807-vcm.c static int __maybe_unused dw9807_vcm_resume(struct device *dev) · line 299

Quoted 5 lines
drivers/media/i2c/dw9807-vcm.c +2 -0
@@ -295,6 +295,8 @@ static int  __maybe_unused dw9807_vcm_resume(struct device *dev)
 
 static const struct of_device_id dw9807_of_table[] = {
 	{ .compatible = "dongwoon,dw9807-vcm" },
+	/* Compatibility for older firmware */
+	{ .compatible = "dongwoon,dw9807" },

You need to add it to the bindings as well.

Best regards,
Krzysztof

author maintainer
#8 lore raw

Re: [PATCH 2/2] dw9807-vcm: Add "dongwoon,dw9807" compatible string

Hi Krysztof,

Quoted 20 lines · Krzysztof Kozlowski
Quoted 19 lines · Sakari Ailus

There is firmware out there that uses "dongwoon,dw9807" compatible string that never made it to upstream as-is. Add it to the driver to make it load on such systems.

The chip also has an EEPROM part which is AT24 compatible (for reading purposes) on a separate I²C address. Adding possible support for this in the future is not affected by this change.

---
 drivers/media/i2c/dw9807-vcm.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/media/i2c/dw9807-vcm.c +0 -0
index 95e06f13bc9ed..ada8e467a0450 100644
@@ -295,6 +295,8 @@ static int  __maybe_unused dw9807_vcm_resume(struct device *dev)
 
Quoted 6 lines

drivers/media/i2c/dw9807-vcm.c static int __maybe_unused dw9807_vcm_resume(struct device *dev) · line 299

Quoted 4 lines
drivers/media/i2c/dw9807-vcm.c +2 -0
 static const struct of_device_id dw9807_of_table[] = {
 	{ .compatible = "dongwoon,dw9807-vcm" },
+	/* Compatibility for older firmware */
+	{ .compatible = "dongwoon,dw9807" },

You need to add it to the bindings as well.

Why? Generally things that are there for binary compatibility but deprecated are not documented in bindings.

Signature · 1 line
Sakari Ailus
#9 lore raw

Re: [PATCH 2/2] dw9807-vcm: Add "dongwoon,dw9807" compatible string

Quoted 30 lines · Sakari Ailus

Hi Krysztof,

Quoted 20 lines · Krzysztof Kozlowski
Quoted 19 lines · Sakari Ailus

There is firmware out there that uses "dongwoon,dw9807" compatible string that never made it to upstream as-is. Add it to the driver to make it load on such systems.

The chip also has an EEPROM part which is AT24 compatible (for reading purposes) on a separate I²C address. Adding possible support for this in the future is not affected by this change.

---
 drivers/media/i2c/dw9807-vcm.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/media/i2c/dw9807-vcm.c +0 -0
index 95e06f13bc9ed..ada8e467a0450 100644
@@ -295,6 +295,8 @@ static int  __maybe_unused dw9807_vcm_resume(struct device *dev)
 
Quoted 6 lines

drivers/media/i2c/dw9807-vcm.c static int __maybe_unused dw9807_vcm_resume(struct device *dev) · line 299

Quoted 4 lines
drivers/media/i2c/dw9807-vcm.c +2 -0
 static const struct of_device_id dw9807_of_table[] = {
 	{ .compatible = "dongwoon,dw9807-vcm" },
+	/* Compatibility for older firmware */
+	{ .compatible = "dongwoon,dw9807" },

You need to add it to the bindings as well.

Quoted 2 lines

Why? Generally things that are there for binary compatibility but deprecated are not documented in bindings.

Because:
1. Otherwise it will get removed by someone as undocumented, unknown stuff. Someone might treat it as mistake.
2. Putting it in the driver code is already self-documenting, so someone might start using it. This should be clearly discouraged and bindings help in it - the compatible is marked as deprecated with the comment you mentioned.
3. Bindings are used beyond Linux kernel, so they might document something more than we use here in DT.

Best regards,
Krzysztof

author maintainer
#10 lore raw

Re: [PATCH 2/2] dw9807-vcm: Add "dongwoon,dw9807" compatible string

Quoted 34 lines · Krzysztof Kozlowski
Quoted 30 lines · Sakari Ailus

Hi Krysztof,

Quoted 20 lines · Krzysztof Kozlowski
Quoted 19 lines · Sakari Ailus

There is firmware out there that uses "dongwoon,dw9807" compatible string that never made it to upstream as-is. Add it to the driver to make it load on such systems.

The chip also has an EEPROM part which is AT24 compatible (for reading purposes) on a separate I²C address. Adding possible support for this in the future is not affected by this change.

---
 drivers/media/i2c/dw9807-vcm.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/media/i2c/dw9807-vcm.c +0 -0
index 95e06f13bc9ed..ada8e467a0450 100644
@@ -295,6 +295,8 @@ static int  __maybe_unused dw9807_vcm_resume(struct device *dev)
 
Quoted 6 lines

drivers/media/i2c/dw9807-vcm.c static int __maybe_unused dw9807_vcm_resume(struct device *dev) · line 299

Quoted 4 lines
drivers/media/i2c/dw9807-vcm.c +2 -0
 static const struct of_device_id dw9807_of_table[] = {
 	{ .compatible = "dongwoon,dw9807-vcm" },
+	/* Compatibility for older firmware */
+	{ .compatible = "dongwoon,dw9807" },

You need to add it to the bindings as well.

Quoted 2 lines

Why? Generally things that are there for binary compatibility but deprecated are not documented in bindings.

Quoted 7 lines

Because:
1. Otherwise it will get removed by someone as undocumented, unknown stuff. Someone might treat it as mistake.
2. Putting it in the driver code is already self-documenting, so someone might start using it. This should be clearly discouraged and bindings help in it - the compatible is marked as deprecated with the comment you mentioned.

That's why there's a comment. I could add a warning telling not to use it anywhere.

This really does not belong to bindings.

Quoted 2 lines

3. Bindings are used beyond Linux kernel, so they might document something more than we use here in DT.

Signature · 1 line
Sakari Ailus