[PATCH 1/3] dt-bindings: iio: adc: sophgo,cv18xx-saradc.yaml: Add Sophgo SARADC binding documentation

Thomas Bonnefille posted 3 patches 1 year, 5 months ago
There is a newer version of this series
[PATCH 1/3] dt-bindings: iio: adc: sophgo,cv18xx-saradc.yaml: Add Sophgo SARADC binding documentation
Posted by Thomas Bonnefille 1 year, 5 months ago
The Sophgo SARADC is a Successive Approximation ADC that can be found in
the Sophgo SoC.

Signed-off-by: Thomas Bonnefille <thomas.bonnefille@bootlin.com>
---
 .../bindings/iio/adc/sophgo,cv18xx-saradc.yaml     | 51 ++++++++++++++++++++++
 MAINTAINERS                                        |  5 +++
 2 files changed, 56 insertions(+)

diff --git a/Documentation/devicetree/bindings/iio/adc/sophgo,cv18xx-saradc.yaml b/Documentation/devicetree/bindings/iio/adc/sophgo,cv18xx-saradc.yaml
new file mode 100644
index 000000000000..21fd5dc8e24e
--- /dev/null
+++ b/Documentation/devicetree/bindings/iio/adc/sophgo,cv18xx-saradc.yaml
@@ -0,0 +1,51 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/iio/adc/sophgo,cv18xx-adc.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Sophgo 3 channels Successive Approximation Analog to Digital Converters
+
+maintainers:
+  - Thomas Bonnefille <thomas.bonnefille@bootlin.com>
+
+description:
+  Datasheet at https://github.com/sophgo/sophgo-doc/releases
+
+properties:
+  compatible:
+    const: sophgo,cv18xx-saradc
+
+  reg:
+    maxItems: 1
+
+  interrupts:
+    maxItems: 1
+
+  clocks:
+    description:
+      SARADC will use the presence of this clock to determine if the controller
+      needs to be explicitly clocked by it (Active domain) or if it is part of
+      the No-Die Domain, along with the RTC, which does not require explicit
+      clocking.
+    maxItems: 1
+
+required:
+  - compatible
+  - reg
+
+examples:
+  - |
+    # ADC in the Active domain
+    adc@30f0000 {
+      compatible = "sophgo,cv18xx-saradc";
+      clocks = <&clk CLK_SARADC>;
+      interrupts = <100 IRQ_TYPE_LEVEL_HIGH>;
+      reg = <0x030F0000 0x1000>;
+    };
+  - |
+    # ADC in the No-Die domain
+    adc@502c000 {
+      compatible = "sophgo,cv18xx-saradc";
+      reg = <0x0502C000 0x1000>;
+    };
diff --git a/MAINTAINERS b/MAINTAINERS
index aacccb376c28..dc87898c518c 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -20901,6 +20901,11 @@ S:	Maintained
 N:	sophgo
 K:	sophgo
 
+SOPHGO SARADC DEVICE DRIVER
+M:	Thomas Bonnefille <thomas.bonnefille@bootlin.com>
+S:	Maintained
+F:	Documentation/devicetree/bindings/iio/adc/sophgo,cv18xx-saradc.yaml
+
 SOUND
 M:	Jaroslav Kysela <perex@perex.cz>
 M:	Takashi Iwai <tiwai@suse.com>

-- 
2.45.2
Re: [PATCH 1/3] dt-bindings: iio: adc: sophgo,cv18xx-saradc.yaml: Add Sophgo SARADC binding documentation
Posted by Krzysztof Kozlowski 1 year, 5 months ago
On 02/07/2024 13:52, Thomas Bonnefille wrote:
> The Sophgo SARADC is a Successive Approximation ADC that can be found in
> the Sophgo SoC.
> 
> Signed-off-by: Thomas Bonnefille <thomas.bonnefille@bootlin.com>
> ---
>  .../bindings/iio/adc/sophgo,cv18xx-saradc.yaml     | 51 ++++++++++++++++++++++
>  MAINTAINERS                                        |  5 +++
>  2 files changed, 56 insertions(+)
> 
> diff --git a/Documentation/devicetree/bindings/iio/adc/sophgo,cv18xx-saradc.yaml b/Documentation/devicetree/bindings/iio/adc/sophgo,cv18xx-saradc.yaml
> new file mode 100644
> index 000000000000..21fd5dc8e24e
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/iio/adc/sophgo,cv18xx-saradc.yaml
> @@ -0,0 +1,51 @@
> +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/iio/adc/sophgo,cv18xx-adc.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: Sophgo 3 channels Successive Approximation Analog to Digital Converters
> +
> +maintainers:
> +  - Thomas Bonnefille <thomas.bonnefille@bootlin.com>
> +
> +description:
> +  Datasheet at https://github.com/sophgo/sophgo-doc/releases
> +
> +properties:
> +  compatible:
> +    const: sophgo,cv18xx-saradc

Except that this was never tested... wild-cards are generally not allowed.

Best regards,
Krzysztof
Re: [PATCH 1/3] dt-bindings: iio: adc: sophgo,cv18xx-saradc.yaml: Add Sophgo SARADC binding documentation
Posted by Thomas Bonnefille 1 year, 5 months ago
Hello Krzysztof,
Thank you for your feedback

On 7/3/24 7:08 AM, Krzysztof Kozlowski wrote:
> On 02/07/2024 13:52, Thomas Bonnefille wrote:
>> The Sophgo SARADC is a Successive Approximation ADC that can be found in
>> the Sophgo SoC.
>>
>> Signed-off-by: Thomas Bonnefille <thomas.bonnefille@bootlin.com>
>> ---
>>   .../bindings/iio/adc/sophgo,cv18xx-saradc.yaml     | 51 ++++++++++++++++++++++
>>   MAINTAINERS                                        |  5 +++
>>   2 files changed, 56 insertions(+)
>>
>> diff --git a/Documentation/devicetree/bindings/iio/adc/sophgo,cv18xx-saradc.yaml b/Documentation/devicetree/bindings/iio/adc/sophgo,cv18xx-saradc.yaml
>> new file mode 100644
>> index 000000000000..21fd5dc8e24e
>> --- /dev/null
>> +++ b/Documentation/devicetree/bindings/iio/adc/sophgo,cv18xx-saradc.yaml
>> @@ -0,0 +1,51 @@
>> +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
>> +%YAML 1.2
>> +---
>> +$id: http://devicetree.org/schemas/iio/adc/sophgo,cv18xx-adc.yaml#
>> +$schema: http://devicetree.org/meta-schemas/core.yaml#
>> +
>> +title: Sophgo 3 channels Successive Approximation Analog to Digital Converters
>> +
>> +maintainers:
>> +  - Thomas Bonnefille <thomas.bonnefille@bootlin.com>
>> +
>> +description:
>> +  Datasheet at https://github.com/sophgo/sophgo-doc/releases
>> +
>> +properties:
>> +  compatible:
>> +    const: sophgo,cv18xx-saradc
> 
> Except that this was never tested... wild-cards are generally not allowed.
> 

I realized I made a mistake when using the "make dt_binding_check" 
command, which led to some errors in this dt_binding. I have now 
addressed all of them, but I'm not sure I understand your comment.

I don't see any wildcards in the YAML file. Could you please provide 
more details on what you expect?

Best regards,
Thomas
Re: [PATCH 1/3] dt-bindings: iio: adc: sophgo,cv18xx-saradc.yaml: Add Sophgo SARADC binding documentation
Posted by Krzysztof Kozlowski 1 year, 5 months ago
On 04/07/2024 10:35, Thomas Bonnefille wrote:
> Hello Krzysztof,
> Thank you for your feedback
> 
> On 7/3/24 7:08 AM, Krzysztof Kozlowski wrote:
>> On 02/07/2024 13:52, Thomas Bonnefille wrote:
>>> The Sophgo SARADC is a Successive Approximation ADC that can be found in
>>> the Sophgo SoC.
>>>
>>> Signed-off-by: Thomas Bonnefille <thomas.bonnefille@bootlin.com>
>>> ---
>>>   .../bindings/iio/adc/sophgo,cv18xx-saradc.yaml     | 51 ++++++++++++++++++++++
>>>   MAINTAINERS                                        |  5 +++
>>>   2 files changed, 56 insertions(+)
>>>
>>> diff --git a/Documentation/devicetree/bindings/iio/adc/sophgo,cv18xx-saradc.yaml b/Documentation/devicetree/bindings/iio/adc/sophgo,cv18xx-saradc.yaml
>>> new file mode 100644
>>> index 000000000000..21fd5dc8e24e
>>> --- /dev/null
>>> +++ b/Documentation/devicetree/bindings/iio/adc/sophgo,cv18xx-saradc.yaml
>>> @@ -0,0 +1,51 @@
>>> +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
>>> +%YAML 1.2
>>> +---
>>> +$id: http://devicetree.org/schemas/iio/adc/sophgo,cv18xx-adc.yaml#
>>> +$schema: http://devicetree.org/meta-schemas/core.yaml#
>>> +
>>> +title: Sophgo 3 channels Successive Approximation Analog to Digital Converters
>>> +
>>> +maintainers:
>>> +  - Thomas Bonnefille <thomas.bonnefille@bootlin.com>
>>> +
>>> +description:
>>> +  Datasheet at https://github.com/sophgo/sophgo-doc/releases
>>> +
>>> +properties:
>>> +  compatible:
>>> +    const: sophgo,cv18xx-saradc
>>
>> Except that this was never tested... wild-cards are generally not allowed.
>>
> 
> I realized I made a mistake when using the "make dt_binding_check" 
> command, which led to some errors in this dt_binding. I have now 
> addressed all of them, but I'm not sure I understand your comment.
> 
> I don't see any wildcards in the YAML file. Could you please provide 
> more details on what you expect?

What is "xx"? Sounds like wildcard. I do not see such SoC compatible.

Best regards,
Krzysztof
Re: [PATCH 1/3] dt-bindings: iio: adc: sophgo,cv18xx-saradc.yaml: Add Sophgo SARADC binding documentation
Posted by Thomas Bonnefille 1 year, 5 months ago

On 7/4/24 10:39 AM, Krzysztof Kozlowski wrote:
> On 04/07/2024 10:35, Thomas Bonnefille wrote:
>> Hello Krzysztof,
>> Thank you for your feedback
>>
>> On 7/3/24 7:08 AM, Krzysztof Kozlowski wrote:
>>> On 02/07/2024 13:52, Thomas Bonnefille wrote:
>>>> The Sophgo SARADC is a Successive Approximation ADC that can be found in
>>>> the Sophgo SoC.
>>>>
>>>> Signed-off-by: Thomas Bonnefille <thomas.bonnefille@bootlin.com>
>>>> ---
>>>>    .../bindings/iio/adc/sophgo,cv18xx-saradc.yaml     | 51 ++++++++++++++++++++++
>>>>    MAINTAINERS                                        |  5 +++
>>>>    2 files changed, 56 insertions(+)
>>>>
>>>> diff --git a/Documentation/devicetree/bindings/iio/adc/sophgo,cv18xx-saradc.yaml b/Documentation/devicetree/bindings/iio/adc/sophgo,cv18xx-saradc.yaml
>>>> new file mode 100644
>>>> index 000000000000..21fd5dc8e24e
>>>> --- /dev/null
>>>> +++ b/Documentation/devicetree/bindings/iio/adc/sophgo,cv18xx-saradc.yaml
>>>> @@ -0,0 +1,51 @@
>>>> +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
>>>> +%YAML 1.2
>>>> +---
>>>> +$id: http://devicetree.org/schemas/iio/adc/sophgo,cv18xx-adc.yaml#
>>>> +$schema: http://devicetree.org/meta-schemas/core.yaml#
>>>> +
>>>> +title: Sophgo 3 channels Successive Approximation Analog to Digital Converters
>>>> +
>>>> +maintainers:
>>>> +  - Thomas Bonnefille <thomas.bonnefille@bootlin.com>
>>>> +
>>>> +description:
>>>> +  Datasheet at https://github.com/sophgo/sophgo-doc/releases
>>>> +
>>>> +properties:
>>>> +  compatible:
>>>> +    const: sophgo,cv18xx-saradc
>>>
>>> Except that this was never tested... wild-cards are generally not allowed.
>>>
>>
>> I realized I made a mistake when using the "make dt_binding_check"
>> command, which led to some errors in this dt_binding. I have now
>> addressed all of them, but I'm not sure I understand your comment.
>>
>> I don't see any wildcards in the YAML file. Could you please provide
>> more details on what you expect?
> 
> What is "xx"? Sounds like wildcard. I do not see such SoC compatible.
> 

The point of cv18xx is to have a single compatible for all SoCs of the 
cv18xx series from Sophgo (cv1800b, cv1812h but also sg2000 and sg2002). 
I used that as a reflection of the cv18xx.dtsi used for all those SoCs.

Should I create multiple compatible for all the SoCs of a same brand ?

> Best regards,
> Krzysztof
>
Re: [PATCH 1/3] dt-bindings: iio: adc: sophgo,cv18xx-saradc.yaml: Add Sophgo SARADC binding documentation
Posted by Krzysztof Kozlowski 1 year, 5 months ago
On 04/07/2024 10:52, Thomas Bonnefille wrote:
> 
> 
> On 7/4/24 10:39 AM, Krzysztof Kozlowski wrote:
>> On 04/07/2024 10:35, Thomas Bonnefille wrote:
>>> Hello Krzysztof,
>>> Thank you for your feedback
>>>
>>> On 7/3/24 7:08 AM, Krzysztof Kozlowski wrote:
>>>> On 02/07/2024 13:52, Thomas Bonnefille wrote:
>>>>> The Sophgo SARADC is a Successive Approximation ADC that can be found in
>>>>> the Sophgo SoC.
>>>>>
>>>>> Signed-off-by: Thomas Bonnefille <thomas.bonnefille@bootlin.com>
>>>>> ---
>>>>>    .../bindings/iio/adc/sophgo,cv18xx-saradc.yaml     | 51 ++++++++++++++++++++++
>>>>>    MAINTAINERS                                        |  5 +++
>>>>>    2 files changed, 56 insertions(+)
>>>>>
>>>>> diff --git a/Documentation/devicetree/bindings/iio/adc/sophgo,cv18xx-saradc.yaml b/Documentation/devicetree/bindings/iio/adc/sophgo,cv18xx-saradc.yaml
>>>>> new file mode 100644
>>>>> index 000000000000..21fd5dc8e24e
>>>>> --- /dev/null
>>>>> +++ b/Documentation/devicetree/bindings/iio/adc/sophgo,cv18xx-saradc.yaml
>>>>> @@ -0,0 +1,51 @@
>>>>> +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
>>>>> +%YAML 1.2
>>>>> +---
>>>>> +$id: http://devicetree.org/schemas/iio/adc/sophgo,cv18xx-adc.yaml#
>>>>> +$schema: http://devicetree.org/meta-schemas/core.yaml#
>>>>> +
>>>>> +title: Sophgo 3 channels Successive Approximation Analog to Digital Converters
>>>>> +
>>>>> +maintainers:
>>>>> +  - Thomas Bonnefille <thomas.bonnefille@bootlin.com>
>>>>> +
>>>>> +description:
>>>>> +  Datasheet at https://github.com/sophgo/sophgo-doc/releases
>>>>> +
>>>>> +properties:
>>>>> +  compatible:
>>>>> +    const: sophgo,cv18xx-saradc
>>>>
>>>> Except that this was never tested... wild-cards are generally not allowed.
>>>>
>>>
>>> I realized I made a mistake when using the "make dt_binding_check"
>>> command, which led to some errors in this dt_binding. I have now
>>> addressed all of them, but I'm not sure I understand your comment.
>>>
>>> I don't see any wildcards in the YAML file. Could you please provide
>>> more details on what you expect?
>>
>> What is "xx"? Sounds like wildcard. I do not see such SoC compatible.
>>
> 
> The point of cv18xx is to have a single compatible for all SoCs of the 
> cv18xx series from Sophgo (cv1800b, cv1812h but also sg2000 and sg2002). 
> I used that as a reflection of the cv18xx.dtsi used for all those SoCs.
> 
> Should I create multiple compatible for all the SoCs of a same brand ?

See writing bindings (and numerous presentation on this topic).

Best regards,
Krzysztof
Re: [PATCH 1/3] dt-bindings: iio: adc: sophgo,cv18xx-saradc.yaml: Add Sophgo SARADC binding documentation
Posted by Rob Herring (Arm) 1 year, 5 months ago
On Tue, 02 Jul 2024 13:52:21 +0200, Thomas Bonnefille wrote:
> The Sophgo SARADC is a Successive Approximation ADC that can be found in
> the Sophgo SoC.
> 
> Signed-off-by: Thomas Bonnefille <thomas.bonnefille@bootlin.com>
> ---
>  .../bindings/iio/adc/sophgo,cv18xx-saradc.yaml     | 51 ++++++++++++++++++++++
>  MAINTAINERS                                        |  5 +++
>  2 files changed, 56 insertions(+)
> 

My bot found errors running 'make dt_binding_check' on your patch:

yamllint warnings/errors:

dtschema/dtc warnings/errors:
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/iio/adc/sophgo,cv18xx-saradc.yaml: 'oneOf' conditional failed, one must be fixed:
	'unevaluatedProperties' is a required property
	'additionalProperties' is a required property
	hint: Either unevaluatedProperties or additionalProperties must be present
	from schema $id: http://devicetree.org/meta-schemas/core.yaml#
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/iio/adc/sophgo,cv18xx-saradc.yaml: $id: Cannot determine base path from $id, relative path/filename doesn't match actual path or filename
 	 $id: http://devicetree.org/schemas/iio/adc/sophgo,cv18xx-adc.yaml
 	file: /builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/iio/adc/sophgo,cv18xx-saradc.yaml
Error: Documentation/devicetree/bindings/iio/adc/sophgo,cv18xx-saradc.example.dts:24.11-12 syntax error
FATAL ERROR: Unable to parse input tree
make[2]: *** [scripts/Makefile.lib:427: Documentation/devicetree/bindings/iio/adc/sophgo,cv18xx-saradc.example.dtb] Error 1
make[2]: *** Waiting for unfinished jobs....
make[1]: *** [/builds/robherring/dt-review-ci/linux/Makefile:1430: dt_binding_check] Error 2
make: *** [Makefile:240: __sub-make] Error 2

doc reference errors (make refcheckdocs):

See https://patchwork.ozlabs.org/project/devicetree-bindings/patch/20240702-sg2002-adc-v1-1-ac66e076a756@bootlin.com

The base for the series is generally the latest rc1. A different dependency
should be noted in *this* patch.

If you already ran 'make dt_binding_check' and didn't see the above
error(s), then make sure 'yamllint' is installed and dt-schema is up to
date:

pip3 install dtschema --upgrade

Please check and re-submit after running the above command yourself. Note
that DT_SCHEMA_FILES can be set to your schema file to speed up checking
your schema. However, it must be unset to test all examples with your schema.