Skip to contentSkip to conversation

ASoC: dt-bindings: sound: asahi-kasei,ak4118: Convert DT schema

PATCH Superseded Manish Baing 2 participants 2 messages May 24

Subsystems (3)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ASoC: dt-bindings: sound: asahi-kasei,ak4118: Convert DT schema

Convert the Asahi Kasei AK4118 S/PDIF transceiver bindings from text format to YAML schema.

---
 .../devicetree/bindings/sound/ak4118.txt      | 22 -------
 .../bindings/sound/asahi-kasei,ak4118.yaml    | 57 +++++++++++++++++++
 2 files changed, 57 insertions(+), 22 deletions(-)
 delete mode 100644 Documentation/devicetree/bindings/sound/ak4118.txt
 create mode 100644 Documentation/devicetree/bindings/sound/asahi-kasei,ak4118.yaml
Documentation/devicetree/bindings/sound/ak4118.txt deleted +0 -22
deleted file mode 100644
index 6e11a2f7404c..000000000000
@@ -1,22 +0,0 @@
-AK4118 S/PDIF transceiver
-
-This device supports I2C mode.
-
-Required properties:
-
-- compatible : "asahi-kasei,ak4118"
-- reg : The I2C address of the device for I2C
-- reset-gpios: A GPIO specifier for the reset pin
-- irq-gpios: A GPIO specifier for the IRQ pin
-
-Example:
-
-&i2c {
-	ak4118: ak4118@13 {
-		#sound-dai-cells = <0>;
-		compatible = "asahi-kasei,ak4118";
-		reg = <0x13>;
-		reset-gpios = <&gpio 0 GPIO_ACTIVE_LOW>
-		irq-gpios = <&gpio 1 GPIO_ACTIVE_HIGH>;
-	};
-};
Documentation/devicetree/bindings/sound/asahi-kasei,ak4118.yaml new file +57 -0

57 lines not on this page · raw message

Signature · 1 line
2.43.0
#1 lore raw
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider: - [Critical] The schema conversion incorrectly replaces the 'irq-gpios' property with 'interrupts'…

Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [Critical] The schema conversion incorrectly replaces the 'irq-gpios' property with 'interrupts', breaking compatibility with existing device trees and the driver.
- [High] The 'reset-gpios' and 'irq-gpios' properties are missing from the YAML 'required' list, weakening schema constraints.
--

commit 0e4f9fd8065be8e0dd8e4f0d56bb269c25f2d4bb
Author: Manish Baing <[email protected]>

ASoC: dt-bindings: sound: asahi-kasei,ak4118: Convert DT schema

Convert the Asahi Kasei AK4118 S/PDIF transceiver bindings from text format to YAML schema.

Quoted 5 lines
Documentation/devicetree/bindings/sound/asahi-kasei,ak4118.yaml new file +0 -0
new file mode 100644
index 0000000000000..54cee45ac0513

[ ... ]

Quoted 1 line
Documentation/devicetree/bindings/sound/asahi-kasei,ak4118.yaml new file +0 -0
@@ -0,0 +1,57 @@

[ ... ]

Documentation/devicetree/bindings/sound/asahi-kasei,ak4118.yaml line 27

Quoted 5 lines
Documentation/devicetree/bindings/sound/asahi-kasei,ak4118.yaml new file +5 -0
+  "#sound-dai-cells":
+    const: 0
+
+  interrupts:
+    maxItems: 1

[Severity: Critical]
Does changing the property from irq-gpios to interrupts cause a regression for existing device trees and the driver?

Looking at the original text binding, irq-gpios was specified. The driver in sound/soc/codecs/ak4118.c fetches the interrupt line as a gpio:

devm_gpiod_get(&i2c->dev, "irq", GPIOD_IN)

Since the schema sets unevaluatedProperties to false, existing device trees containing irq-gpios will fail validation.

Additionally, if new device trees use interrupts instead, won't the driver fail during probe due to a missing gpio?

Documentation/devicetree/bindings/sound/asahi-kasei,ak4118.yaml line 36

Quoted 9 lines
Documentation/devicetree/bindings/sound/asahi-kasei,ak4118.yaml new file +9 -0
+
+  reset-gpios:
+    maxItems: 1
+    description: GPIO used for the Reset pin
+
+required:
+  - compatible
+  - reg
+  - "#sound-dai-cells"

[Severity: High]
Should reset-gpios and irq-gpios be included in this required list?

The original ak4118.txt binding marked both of these as required properties. The driver unconditionally calls devm_gpiod_get() for both reset and irq rather than the optional variants.

Omitting them here could allow incomplete device trees to silently pass schema validation but still fail at runtime during the driver probe.

Quoted 2 lines
Documentation/devicetree/bindings/sound/asahi-kasei,ak4118.yaml new file +2 -0
+
+unevaluatedProperties: false
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1