diff mbox series

[1/5] media: dt-bindings: i2c: add DW9719/DW9718S VCM binding

Message ID 20250210082035.8670-2-val@packett.cool (mailing list archive)
State New
Headers show
Series media: i2c: dw9719: add DT compatible and DW9718S support | expand

Commit Message

Val Packett Feb. 10, 2025, 8:19 a.m. UTC
Add DT bindings for the dw9719 voice coil motor driver, which is getting
devicetree compatibles added along with DW9718S support.

Also mention the binding file in the corresponding MAINTAINERS entry.

Signed-off-by: Val Packett <val@packett.cool>
---
 .../bindings/media/i2c/dongwoon,dw9719.yaml   | 110 ++++++++++++++++++
 MAINTAINERS                                   |   1 +
 2 files changed, 111 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/media/i2c/dongwoon,dw9719.yaml

Comments

Krzysztof Kozlowski Feb. 10, 2025, 8:29 a.m. UTC | #1
On 10/02/2025 09:19, Val Packett wrote:
> Add DT bindings for the dw9719 voice coil motor driver, which is getting
> devicetree compatibles added along with DW9718S support.
> 
> Also mention the binding file in the corresponding MAINTAINERS entry.
> 
> Signed-off-by: Val Packett <val@packett.cool>
> ---
>  .../bindings/media/i2c/dongwoon,dw9719.yaml   | 110 ++++++++++++++++++
>  MAINTAINERS                                   |   1 +
>  2 files changed, 111 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/media/i2c/dongwoon,dw9719.yaml
> 
> diff --git a/Documentation/devicetree/bindings/media/i2c/dongwoon,dw9719.yaml b/Documentation/devicetree/bindings/media/i2c/dongwoon,dw9719.yaml
> new file mode 100644
> index 000000000000..88161038223f
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/media/i2c/dongwoon,dw9719.yaml
> @@ -0,0 +1,110 @@
> +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/media/i2c/dongwoon,dw9719.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: Dongwoon Anatech DW9719 Voice Coil Motor (VCM) DAC
> +
> +maintainers:
> +  - Daniel Scally <djrscally@gmail.com>
> +
> +description: |-
> +  The Dongwoon DW9719/DW9718S is a single 10-bit digital-to-analog converter
> +  with 100 mA output current sink capability, designed for linear control of
> +  voice coil motors (VCM) in camera lenses. This chip provides a Smart Actuator
> +  Control (SAC) mode intended for driving voice coil lenses in camera modules.
> +
> +properties:
> +  compatible:
> +    enum:
> +      - dongwoon,dw9719
> +      - dongwoon,dw9718s

Keep alphabetical order.

> +
> +  reg:
> +    maxItems: 1
> +
> +  vdd-supply:
> +    description: VDD power supply
> +
> +  dongwoon,sac-mode:
> +    description: |
> +      Slew Rate Control mode to use: direct, LSC (Linear Slope Control) or
> +      SAC1-SAC6 (Smart Actuator Control).
> +    $ref: /schemas/types.yaml#/definitions/uint32
> +    enum:
> +      - 0    # Direct mode
> +      - 1    # LSC mode
> +      - 2    # SAC1 mode (operation time# 0.32 x Tvib)
> +      - 3    # SAC2 mode (operation time# 0.48 x Tvib)
> +      - 4    # SAC3 mode (operation time# 0.72 x Tvib)
> +      - 5    # SAC4 mode (operation time# 1.20 x Tvib)
> +      - 6    # SAC5 mode (operation time# 1.64 x Tvib)
> +      - 7    # SAC6 mode (operation time# 1.88 x Tvib)
> +    default: 4
> +
> +  dongwoon,vcm-freq:
> +    description:
> +      The switching frequency for the voice coil motor.

Frequency is in Hertz, so use proper property unit suffix. BTW, you
cannot add incorrect properties post-factum based on already accepted
ACPI driver. This would be nice bypass of review, right?

> +    $ref: /schemas/types.yaml#/definitions/uint32

Drop.

minimum/maximum constraints

> +

No reset/powerdown gpios in the hardware?

Missing required block.

> +allOf:
> +  - if:
> +      properties:
> +        compatible:
> +          contains:
> +            const: dongwoon,dw9718s
> +    then:
> +      properties:
> +        dongwoon,vcm-freq:
> +          default: 0
> +          enum:
> +            - 0    # 5.00 MHz
> +            - 1    # 3.33 MHz
> +            - 2    # 2.50 MHz
> +            - 3    # 2.00 MHz
> +            - 4    # 1.67 MHz
> +            - 5    # 1.43 MHz
> +            - 6    # 1.25 MHz
> +            - 7    # 1.11 MHz
> +            - 8    # 1.00 MHz
> +            - 9    # 0.91 MHz
> +            - 10   # 0.83 MHz
> +            - 11   # 0.77 MHz
> +            - 12   # 0.71 MHz
> +            - 13   # 0.67 MHz
> +            - 14   # 0.63 MHz
> +            - 15   # 0.59 MHz
> +  - if:
> +      properties:
> +        compatible:
> +          contains:
> +            const: dongwoon,dw9719
> +    then:
> +      properties:
> +        dongwoon,vcm-freq:
> +          default: 0x60

Why no constraints? Why suddenly hex?
> +
> +required:
> +  - compatible
> +  - reg
> +  - vdd-supply

required always follows properties.

> +
> +additionalProperties: false
> +
> +examples:
> +  - |
> +

Drop stray blank line

> +    i2c {
> +        #address-cells = <1>;
> +        #size-cells = <0>;
> +
> +        vcm_rear: camera-lens@c {
> +            compatible = "dongwoon,dw9718s";
> +            reg = <0x0c>;
> +
> +            vdd-supply = <&pm8937_l17>;

Missing properties, make the example complete.

> +        };
> +    };
> +
> +...



Best regards,
Krzysztof
Sakari Ailus Feb. 10, 2025, 10:36 a.m. UTC | #2
Hi Krzysztof,

On Mon, Feb 10, 2025 at 09:29:25AM +0100, Krzysztof Kozlowski wrote:
> > +  dongwoon,vcm-freq:
> > +    description:
> > +      The switching frequency for the voice coil motor.
> 
> Frequency is in Hertz, so use proper property unit suffix. BTW, you
> cannot add incorrect properties post-factum based on already accepted
> ACPI driver. This would be nice bypass of review, right?

What's actually configured here is the divisor (10 MHz clock, divisor seems
to be value + 2). It's similar to existing
Documentation/devicetree/bindings/media/i2c/dongwoon,dw9768.yaml . I prefer
this as it's much easier to use that in a driver (think of having values
like 1428571 in DT, too).

> 
> > +    $ref: /schemas/types.yaml#/definitions/uint32
> 
> Drop.
> 
> minimum/maximum constraints
> 
> > +
> 
> No reset/powerdown gpios in the hardware?
> 
> Missing required block.
> 
> > +allOf:
> > +  - if:
> > +      properties:
> > +        compatible:
> > +          contains:
> > +            const: dongwoon,dw9718s
> > +    then:
> > +      properties:
> > +        dongwoon,vcm-freq:
> > +          default: 0
> > +          enum:
> > +            - 0    # 5.00 MHz
> > +            - 1    # 3.33 MHz
> > +            - 2    # 2.50 MHz
> > +            - 3    # 2.00 MHz
> > +            - 4    # 1.67 MHz
> > +            - 5    # 1.43 MHz
> > +            - 6    # 1.25 MHz
> > +            - 7    # 1.11 MHz
> > +            - 8    # 1.00 MHz
> > +            - 9    # 0.91 MHz
> > +            - 10   # 0.83 MHz
> > +            - 11   # 0.77 MHz
> > +            - 12   # 0.71 MHz
> > +            - 13   # 0.67 MHz
> > +            - 14   # 0.63 MHz
> > +            - 15   # 0.59 MHz
> > +  - if:
> > +      properties:
> > +        compatible:
> > +          contains:
> > +            const: dongwoon,dw9719
> > +    then:
> > +      properties:
> > +        dongwoon,vcm-freq:
> > +          default: 0x60
Krzysztof Kozlowski Feb. 10, 2025, 11:04 a.m. UTC | #3
On 10/02/2025 11:36, Sakari Ailus wrote:
> Hi Krzysztof,
> 
> On Mon, Feb 10, 2025 at 09:29:25AM +0100, Krzysztof Kozlowski wrote:
>>> +  dongwoon,vcm-freq:
>>> +    description:
>>> +      The switching frequency for the voice coil motor.
>>
>> Frequency is in Hertz, so use proper property unit suffix. BTW, you
>> cannot add incorrect properties post-factum based on already accepted
>> ACPI driver. This would be nice bypass of review, right?
> 
> What's actually configured here is the divisor (10 MHz clock, divisor seems
> to be value + 2). It's similar to existing
> Documentation/devicetree/bindings/media/i2c/dongwoon,dw9768.yaml . I prefer
> this as it's much easier to use that in a driver (think of having values
> like 1428571 in DT, too).


Sure, but then this should be renamed to match purpose and description
rephrased.

> 
>>
>>> +    $ref: /schemas/types.yaml#/definitions/uint32


And this would stay + constraints.


Best regards,
Krzysztof
diff mbox series

Patch

diff --git a/Documentation/devicetree/bindings/media/i2c/dongwoon,dw9719.yaml b/Documentation/devicetree/bindings/media/i2c/dongwoon,dw9719.yaml
new file mode 100644
index 000000000000..88161038223f
--- /dev/null
+++ b/Documentation/devicetree/bindings/media/i2c/dongwoon,dw9719.yaml
@@ -0,0 +1,110 @@ 
+# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/media/i2c/dongwoon,dw9719.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Dongwoon Anatech DW9719 Voice Coil Motor (VCM) DAC
+
+maintainers:
+  - Daniel Scally <djrscally@gmail.com>
+
+description: |-
+  The Dongwoon DW9719/DW9718S is a single 10-bit digital-to-analog converter
+  with 100 mA output current sink capability, designed for linear control of
+  voice coil motors (VCM) in camera lenses. This chip provides a Smart Actuator
+  Control (SAC) mode intended for driving voice coil lenses in camera modules.
+
+properties:
+  compatible:
+    enum:
+      - dongwoon,dw9719
+      - dongwoon,dw9718s
+
+  reg:
+    maxItems: 1
+
+  vdd-supply:
+    description: VDD power supply
+
+  dongwoon,sac-mode:
+    description: |
+      Slew Rate Control mode to use: direct, LSC (Linear Slope Control) or
+      SAC1-SAC6 (Smart Actuator Control).
+    $ref: /schemas/types.yaml#/definitions/uint32
+    enum:
+      - 0    # Direct mode
+      - 1    # LSC mode
+      - 2    # SAC1 mode (operation time# 0.32 x Tvib)
+      - 3    # SAC2 mode (operation time# 0.48 x Tvib)
+      - 4    # SAC3 mode (operation time# 0.72 x Tvib)
+      - 5    # SAC4 mode (operation time# 1.20 x Tvib)
+      - 6    # SAC5 mode (operation time# 1.64 x Tvib)
+      - 7    # SAC6 mode (operation time# 1.88 x Tvib)
+    default: 4
+
+  dongwoon,vcm-freq:
+    description:
+      The switching frequency for the voice coil motor.
+    $ref: /schemas/types.yaml#/definitions/uint32
+
+allOf:
+  - if:
+      properties:
+        compatible:
+          contains:
+            const: dongwoon,dw9718s
+    then:
+      properties:
+        dongwoon,vcm-freq:
+          default: 0
+          enum:
+            - 0    # 5.00 MHz
+            - 1    # 3.33 MHz
+            - 2    # 2.50 MHz
+            - 3    # 2.00 MHz
+            - 4    # 1.67 MHz
+            - 5    # 1.43 MHz
+            - 6    # 1.25 MHz
+            - 7    # 1.11 MHz
+            - 8    # 1.00 MHz
+            - 9    # 0.91 MHz
+            - 10   # 0.83 MHz
+            - 11   # 0.77 MHz
+            - 12   # 0.71 MHz
+            - 13   # 0.67 MHz
+            - 14   # 0.63 MHz
+            - 15   # 0.59 MHz
+  - if:
+      properties:
+        compatible:
+          contains:
+            const: dongwoon,dw9719
+    then:
+      properties:
+        dongwoon,vcm-freq:
+          default: 0x60
+
+required:
+  - compatible
+  - reg
+  - vdd-supply
+
+additionalProperties: false
+
+examples:
+  - |
+
+    i2c {
+        #address-cells = <1>;
+        #size-cells = <0>;
+
+        vcm_rear: camera-lens@c {
+            compatible = "dongwoon,dw9718s";
+            reg = <0x0c>;
+
+            vdd-supply = <&pm8937_l17>;
+        };
+    };
+
+...
diff --git a/MAINTAINERS b/MAINTAINERS
index 603b11222d67..42dd86f5d5c8 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -6932,6 +6932,7 @@  M:	Daniel Scally <djrscally@gmail.com>
 L:	linux-media@vger.kernel.org
 S:	Maintained
 T:	git git://linuxtv.org/media.git
+F:	Documentation/devicetree/bindings/media/i2c/dongwoon,dw9719.yaml
 F:	drivers/media/i2c/dw9719.c
 
 DONGWOON DW9768 LENS VOICE COIL DRIVER