2021-08-31 08:15:01

by navin

[permalink] [raw]
Subject: [PATCH] rtc: bq32000: Add TI BQ32002 compatible

The TI BQ32002 is software compatible with the TI BQ32000,
add DT compatible entries

Signed-off-by: Navin Sankar Velliangiri <[email protected]>
---
Documentation/devicetree/bindings/rtc/ti,bq32000.yaml | 11 +++++++++++
drivers/rtc/rtc-bq32k.c | 2 ++
2 files changed, 13 insertions(+)

diff --git a/Documentation/devicetree/bindings/rtc/ti,bq32000.yaml b/Documentation/devicetree/bindings/rtc/ti,bq32000.yaml
index bf9c1c4ddb7e..2ddf1cc097d8 100644
--- a/Documentation/devicetree/bindings/rtc/ti,bq32000.yaml
+++ b/Documentation/devicetree/bindings/rtc/ti,bq32000.yaml
@@ -15,6 +15,7 @@ allOf:
properties:
compatible:
const: ti,bq32000
+ const: ti,bq32002

reg:
const: 0x68
@@ -35,6 +36,16 @@ required:

additionalProperties: false

+if:
+ properties:
+ compatible:
+ items:
+ - const: ti,bq32002
+then:
+ properties:
+ trickle-resistor-ohms: false
+ trickle-diode-disable: false
+
examples:
- |
i2c {
diff --git a/drivers/rtc/rtc-bq32k.c b/drivers/rtc/rtc-bq32k.c
index 2235c968842d..a167a6afdc7e 100644
--- a/drivers/rtc/rtc-bq32k.c
+++ b/drivers/rtc/rtc-bq32k.c
@@ -307,12 +307,14 @@ static int bq32k_remove(struct i2c_client *client)

static const struct i2c_device_id bq32k_id[] = {
{ "bq32000", 0 },
+ { "bq32002", 0 },
{ }
};
MODULE_DEVICE_TABLE(i2c, bq32k_id);

static const __maybe_unused struct of_device_id bq32k_of_match[] = {
{ .compatible = "ti,bq32000" },
+ { .compatible = "ti,bq32002" },
{ }
};
MODULE_DEVICE_TABLE(of, bq32k_of_match);
--
2.32.0


2021-08-31 14:05:19

by Rob Herring

[permalink] [raw]
Subject: Re: [PATCH] rtc: bq32000: Add TI BQ32002 compatible

On Tue, 31 Aug 2021 13:19:22 +0530, Navin Sankar Velliangiri wrote:
> The TI BQ32002 is software compatible with the TI BQ32000,
> add DT compatible entries
>
> Signed-off-by: Navin Sankar Velliangiri <[email protected]>
> ---
> Documentation/devicetree/bindings/rtc/ti,bq32000.yaml | 11 +++++++++++
> drivers/rtc/rtc-bq32k.c | 2 ++
> 2 files changed, 13 insertions(+)
>

My bot found errors running 'make DT_CHECKER_FLAGS=-m dt_binding_check'
on your patch (DT_CHECKER_FLAGS is new in v5.13):

yamllint warnings/errors:

dtschema/dtc warnings/errors:
make[1]: *** Deleting file 'Documentation/devicetree/bindings/rtc/ti,bq32000.example.dts'
Traceback (most recent call last):
File "/usr/local/bin/dt-extract-example", line 45, in <module>
binding = yaml.load(open(args.yamlfile, encoding='utf-8').read())
File "/usr/local/lib/python3.8/dist-packages/ruamel/yaml/main.py", line 434, in load
return constructor.get_single_data()
File "/usr/local/lib/python3.8/dist-packages/ruamel/yaml/constructor.py", line 122, in get_single_data
return self.construct_document(node)
File "/usr/local/lib/python3.8/dist-packages/ruamel/yaml/constructor.py", line 132, in construct_document
for _dummy in generator:
File "/usr/local/lib/python3.8/dist-packages/ruamel/yaml/constructor.py", line 722, in construct_yaml_map
value = self.construct_mapping(node)
File "/usr/local/lib/python3.8/dist-packages/ruamel/yaml/constructor.py", line 446, in construct_mapping
return BaseConstructor.construct_mapping(self, node, deep=deep)
File "/usr/local/lib/python3.8/dist-packages/ruamel/yaml/constructor.py", line 264, in construct_mapping
if self.check_mapping_key(node, key_node, mapping, key, value):
File "/usr/local/lib/python3.8/dist-packages/ruamel/yaml/constructor.py", line 295, in check_mapping_key
raise DuplicateKeyError(*args)
ruamel.yaml.constructor.DuplicateKeyError: while constructing a mapping
in "<unicode string>", line 17, column 5
found duplicate key "const" with value "ti,bq32002" (original value: "ti,bq32000")
in "<unicode string>", line 18, column 5

To suppress this check see:
http://yaml.readthedocs.io/en/latest/api.html#duplicate-keys

make[1]: *** [Documentation/devicetree/bindings/Makefile:20: Documentation/devicetree/bindings/rtc/ti,bq32000.example.dts] Error 1
make[1]: *** Waiting for unfinished jobs....
Traceback (most recent call last):
File "/usr/local/bin/dt-doc-validate", line 25, in check_doc
testtree = dtschema.load(filename, line_number=line_number)
File "/usr/local/lib/python3.8/dist-packages/dtschema/lib.py", line 623, in load
return yaml.load(f.read())
File "/usr/local/lib/python3.8/dist-packages/ruamel/yaml/main.py", line 434, in load
return constructor.get_single_data()
File "/usr/local/lib/python3.8/dist-packages/ruamel/yaml/constructor.py", line 122, in get_single_data
return self.construct_document(node)
File "/usr/local/lib/python3.8/dist-packages/ruamel/yaml/constructor.py", line 132, in construct_document
for _dummy in generator:
File "/usr/local/lib/python3.8/dist-packages/ruamel/yaml/constructor.py", line 722, in construct_yaml_map
value = self.construct_mapping(node)
File "/usr/local/lib/python3.8/dist-packages/ruamel/yaml/constructor.py", line 446, in construct_mapping
return BaseConstructor.construct_mapping(self, node, deep=deep)
File "/usr/local/lib/python3.8/dist-packages/ruamel/yaml/constructor.py", line 264, in construct_mapping
if self.check_mapping_key(node, key_node, mapping, key, value):
File "/usr/local/lib/python3.8/dist-packages/ruamel/yaml/constructor.py", line 295, in check_mapping_key
raise DuplicateKeyError(*args)
ruamel.yaml.constructor.DuplicateKeyError: while constructing a mapping
in "<unicode string>", line 17, column 5
found duplicate key "const" with value "ti,bq32002" (original value: "ti,bq32000")
in "<unicode string>", line 18, column 5

To suppress this check see:
http://yaml.readthedocs.io/en/latest/api.html#duplicate-keys


During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/usr/local/bin/dt-doc-validate", line 67, in <module>
ret = check_doc(f)
File "/usr/local/bin/dt-doc-validate", line 30, in check_doc
print(filename + ":", exc.path[-1], exc.message, file=sys.stderr)
AttributeError: 'DuplicateKeyError' object has no attribute 'path'
/builds/robherring/linux-dt-review/Documentation/devicetree/bindings/rtc/ti,bq32000.yaml: ignoring, error parsing file
warning: no schema found in file: ./Documentation/devicetree/bindings/rtc/ti,bq32000.yaml
make: *** [Makefile:1419: dt_binding_check] Error 2

doc reference errors (make refcheckdocs):

See https://patchwork.ozlabs.org/patch/1522467

This check can fail if there are any dependencies. The base for a patch
series is generally the most recent rc1.

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.

2021-08-31 19:06:49

by Rob Herring

[permalink] [raw]
Subject: Re: [PATCH] rtc: bq32000: Add TI BQ32002 compatible

On Tue, Aug 31, 2021 at 01:19:22PM +0530, Navin Sankar Velliangiri wrote:
> The TI BQ32002 is software compatible with the TI BQ32000,
> add DT compatible entries
>
> Signed-off-by: Navin Sankar Velliangiri <[email protected]>
> ---
> Documentation/devicetree/bindings/rtc/ti,bq32000.yaml | 11 +++++++++++
> drivers/rtc/rtc-bq32k.c | 2 ++
> 2 files changed, 13 insertions(+)
>
> diff --git a/Documentation/devicetree/bindings/rtc/ti,bq32000.yaml b/Documentation/devicetree/bindings/rtc/ti,bq32000.yaml
> index bf9c1c4ddb7e..2ddf1cc097d8 100644
> --- a/Documentation/devicetree/bindings/rtc/ti,bq32000.yaml
> +++ b/Documentation/devicetree/bindings/rtc/ti,bq32000.yaml
> @@ -15,6 +15,7 @@ allOf:
> properties:
> compatible:
> const: ti,bq32000
> + const: ti,bq32002

'enum' is what you want here.

>
> reg:
> const: 0x68
> @@ -35,6 +36,16 @@ required:
>
> additionalProperties: false
>
> +if:
> + properties:
> + compatible:
> + items:

Use 'contains'

> + - const: ti,bq32002
> +then:
> + properties:
> + trickle-resistor-ohms: false
> + trickle-diode-disable: false
> +
> examples:
> - |
> i2c {
> diff --git a/drivers/rtc/rtc-bq32k.c b/drivers/rtc/rtc-bq32k.c
> index 2235c968842d..a167a6afdc7e 100644
> --- a/drivers/rtc/rtc-bq32k.c
> +++ b/drivers/rtc/rtc-bq32k.c
> @@ -307,12 +307,14 @@ static int bq32k_remove(struct i2c_client *client)
>
> static const struct i2c_device_id bq32k_id[] = {
> { "bq32000", 0 },
> + { "bq32002", 0 },
> { }
> };
> MODULE_DEVICE_TABLE(i2c, bq32k_id);
>
> static const __maybe_unused struct of_device_id bq32k_of_match[] = {
> { .compatible = "ti,bq32000" },
> + { .compatible = "ti,bq32002" },
> { }
> };
> MODULE_DEVICE_TABLE(of, bq32k_of_match);
> --
> 2.32.0
>
>