dt-bindings: bus: add Wiegand bus dt documentation
Subsystems (2)
RFC PATCH v2 1/4 dt-bindings: bus: add Wiegand bus dt documentation
This patch documents the devicetree entry for enabling Wiegand bus driver. The drivers that will use Wiegand bus driver shall create a sub-node of the documented node.
---
Hello again,
this is the second round of RFC patches in an attempt to add Wiegand driver to linux kernel. Thank you for all the issues you have pointed out in the first round. I have tried to fix all of them and I have also implemented a Wiegand bus driver, that is now used by the GPIO driver itself - as suggested by Linus.
Any advice you have for me regarding the patches will be appreciated!
With regards,
Martin Zaťovič
--- .../devicetree/bindings/bus/wiegand.yaml | 50 +++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 Documentation/devicetree/bindings/bus/wiegand.yaml
Documentation/devicetree/bindings/bus/wiegand.yaml new file +50 -0
@@ -0,0 +1,50 @@ +# SPDX-License-Identifier: GPL-2.0 +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/bus/wiegand.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Wiegand Bus + +maintainers: + - Martin Zaťovič <[email protected]> + +description: | + Wiegand interface is a wiring standard popularized in the 1980s. To this day + many card readers, fingerprint readers, sensors, etc. use Wiegand interface + particularly for access control applications. It utilizes two wires to + transmit the data - D0 and D1. + + Both data lines are initially pulled up. To send a bit of value 1, the D1 + line is set low. Similarly to send a bit of value 0, the D0 line is set low. + +properties: + $nodename: + pattern: "^wiegand(@[0-9a-f]+)?$" + + compatible: + contains: + const: wiegand + +required: + - compatible + +additionalProperties: false + +examples: + - | + #include <dt-bindings/gpio/gpio.h> + + wiegand { + compatible = "wiegand"; + + wiegand-gpio { + compatible = "wiegand,wiegand-gpio"; + pinctrl-names = "default"; + pinctrl-0 = <&pinctrl_uart2_wiegand>; + data-hi-gpios = <&gpio 7 (GPIO_ACTIVE_HIGH|GPIO_OPEN_DRAIN)>; + data-lo-gpios = <&gpio 6 (GPIO_ACTIVE_HIGH|GPIO_OPEN_DRAIN)>; + }; + }; + +...
Signature · 1 line
2.37.3
RFC PATCH v2 2/4 bus: add Wiegand bus driver
The Wiegand bus driver spawns devices and matches them with drivers.
---
The bus driver currently assumes that any new Wiegand driver will have a matching entry in the devicetree. It is currently sufficient as I will only be implementing the GPIO driver. If someone implements a Wiegand driver that will not use devicetree, he will also have to edit this bus driver, in order to match properly. Is that a correct approach?
--- drivers/bus/Kconfig | 6 + drivers/bus/Makefile | 2 + drivers/bus/wiegand.c | 339 ++++++++++++++++++++++++++++++++++++++++ include/linux/wiegand.h | 110 +++++++++++++ 4 files changed, 457 insertions(+) create mode 100644 drivers/bus/wiegand.c create mode 100644 include/linux/wiegand.h
drivers/bus/Kconfig +6 -0
@@ -241,6 +241,12 @@ config VEXPRESS_CONFIG Platform configuration infrastructure for the ARM Ltd. Versatile Express. +config WIEGAND + tristate "Wiegand bus" + help + Wiegand Protocol is a low level 2-wire serial protocol. This + enables the support of the bus. + config DA8XX_MSTPRI bool "TI da8xx master peripheral priority driver" depends on ARCH_DAVINCI_DA8XX
drivers/bus/Makefile +2 -0
@@ -36,6 +36,8 @@ obj-$(CONFIG_TI_SYSC) += ti-sysc.o obj-$(CONFIG_TS_NBUS) += ts-nbus.o obj-$(CONFIG_UNIPHIER_SYSTEM_BUS) += uniphier-system-bus.o obj-$(CONFIG_VEXPRESS_CONFIG) += vexpress-config.o +obj-$(CONFIG_WIEGAND) += wiegand.o + obj-$(CONFIG_DA8XX_MSTPRI) += da8xx-mstpri.o
drivers/bus/wiegand.c new file +339 -0
339 lines not on this page · raw message
include/linux/wiegand.h new file +110 -0
110 lines not on this page · raw message
Signature · 1 line
2.37.3
Re: [RFCv2 PATCH 2/4] bus: add Wiegand bus driver
Quoted 11 lines · Martin Zaťovič
The Wiegand bus driver spawns devices and matches them with drivers.
Signed-off-by Martin Zaťovič <[email protected]>---
The bus driver currently assumes that any new Wiegand driver will have a matching entry in the devicetree. It is currently sufficient as I will only be implementing the GPIO driver. If someone implements a Wiegand driver that will not use devicetree, he will also have to edit this bus driver, in order to match properly. Is that a correct approach?
(...)
Quoted 12 lines
drivers/bus/wiegand.c new file +12
-0+static struct wiegand_device * +of_register_wiegand_device (struct wiegand *wiegand,struct device_node *nc) +{ +struct wiegand_device *dev; +const char *val; +int ret; + + dev =wiegand_alloc_device (wiegand); +if (!dev) { +dev_err (wiegand->dev, +"Wiegand device alloc error for %pOF\n" , nc); +return ERR_PTR (-ENOMEM );
drivers/bus/wiegand.c line 217
Quoted 10 lines
drivers/bus/wiegand.c new file +10
-0+ } + + ret =of_property_read_string (nc,"compatible" , &val); +if (ret) { +dev_err (wiegand->dev,"%pOF has no valid 'compatible' property (%d)\n" , + nc, ret); + goto err_put; + } + +if (strcmp (val,"wiegand,wiegand-gpio" ) ==0 ) {
This does not look right. Bus can have any device attached, so limiting some bus behavior to a specific device is not really scalable.
Anyway device and node matching should not be with strcmp but rather of_*_match().
Best regards,
Krzysztof
Re: [RFCv2 PATCH 2/4] bus: add Wiegand bus driver
In reply to Martin ZaťovičQuoted 4 lines · Martin Zaťovič
The Wiegand bus driver spawns devices and matches them with drivers.
Signed-off-by Martin Zaťovič <[email protected]>
Overall this is a vast improvement over the first patches!
I might not have time to look closer right now, but I see you got a lot of comments from Krzysztof et al so you have some stuff to work on.
Looking forward to the first non-RFC patch series!
Yours,
Linus Walleij
RFC PATCH v2 3/4 dt-bindings: gpio: add Wiegand GPIO driver dt documentation
In reply to Martin ZaťovičThe Wiegand GPIO driver uses two GPIO lines to transmit data - data-hi and data-lo. These lines need to be defined in the devicetree, otherwise the driver will not probe successfully.
--- .../bindings/gpio/gpio-wiegand.yaml | 53 +++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 Documentation/devicetree/bindings/gpio/gpio-wiegand.yaml
Documentation/devicetree/bindings/gpio/gpio-wiegand.yaml new file +53 -0
@@ -0,0 +1,53 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/gpio/gpio-wiegand.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Wiegand GPIO controller + +description: | + Wiegand GPIO controller running under Wiegand bus. + +maintainers: + - Martin Zaťovič <[email protected]> + +properties: + $nodename: + pattern: "^wiegand-gpio@[0-9a-f]+$" + + compatible: + const: wiegand,wiegand-gpio + + data-hi-gpios: + description: GPIO spec for data-hi line to use + maxItems: 1 + + data-lo-gpios: + description: GPIO spec for data-lo line to use + maxItems: 1 + +required: + - compatible + - data-hi-gpios + - data-lo-gpios + +additionalProperties: false + +examples: + - | + #include <dt-bindings/gpio/gpio.h> + + wiegand { + compatible = "wiegand"; + + wiegand-gpio { + compatible = "wiegand,wiegand-gpio"; + pinctrl-names = "default"; + pinctrl-0 = <&pinctrl_uart2_wiegand>; + data-hi-gpios = <&gpio2 7 (GPIO_ACTIVE_HIGH|GPIO_OPEN_DRAIN)>; + data-lo-gpios = <&gpio2 6 (GPIO_ACTIVE_HIGH|GPIO_OPEN_DRAIN)>; + }; + }; + +...
Signature · 1 line
2.37.3
Rob Herring
maintainerRe: [RFCv2 PATCH 3/4] dt-bindings: gpio: add Wiegand GPIO driver dt documentation
Quoted 10 lines · Martin Zaťovič
The Wiegand GPIO driver uses two GPIO lines to transmit data - data-hi and data-lo. These lines need to be defined in the devicetree, otherwise the driver will not probe successfully.
Signed-off-by Martin Zaťovič <[email protected]>--- .../bindings/gpio/gpio-wiegand.yaml | 53 +++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 Documentation/devicetree/bindings/gpio/gpio-wiegand.yaml
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:
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/gpio/gpio-wiegand.example.dtb: wiegand: wiegand-gpio: {'compatible': ['wiegand,wiegand-gpio'], 'pinctrl-names': ['default'], 'pinctrl-0': [[4294967295]], 'data-hi-gpios': [[4294967295, 7, 6]], 'data-lo-gpios': [[4294967295, 6, 6]]} is not of type 'array'
From schema: /usr/local/lib/python3.10/dist-packages/dtschema/schemas/gpio/gpio-consumer.yamlDocumentation/devicetree/bindings/gpio/gpio-wiegand.example.dtb:0:0: /example-0/wiegand: failed to match any schema with compatible: ['wiegand']
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/gpio/gpio-wiegand.example.dtb: wiegand-gpio: $nodename:0: 'wiegand-gpio' does not match '^wiegand-gpio@[0-9a-f]+$'
From schema: /builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/gpio/gpio-wiegand.yaml
doc reference errors (make refcheckdocs):
See https://patchwork.ozlabs.org/patch/
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.
Re: [RFCv2 PATCH 3/4] dt-bindings: gpio: add Wiegand GPIO driver dt documentation
In reply to Martin ZaťovičQuoted 16 lines · Martin Zaťovič
The Wiegand GPIO driver uses two GPIO lines to transmit data - data-hi and data-lo. These lines need to be defined in the devicetree, otherwise the driver will not probe successfully.
Signed-off-by Martin Zaťovič <[email protected]>--- .../bindings/gpio/gpio-wiegand.yaml | 53 +++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 Documentation/devicetree/bindings/gpio/gpio-wiegand.yamlDocumentation/devicetree/bindings/gpio/gpio-wiegand.yaml new file +0
-0
Documentation/devicetree/bindings/gpio/gpio-wiegand.yaml line 10
Quoted 10 lines
Documentation/devicetree/bindings/gpio/gpio-wiegand.yaml new file +10
-0@@ -0,0 +1,53 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/gpio/gpio-wiegand.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Wiegand GPIO controller + +description: | + Wiegand GPIO controller running under Wiegand bus.
GPIO controllers need "gpio-controller" property, so this seems to be something else.
Documentation/devicetree/bindings/gpio/gpio-wiegand.yaml line 17
Quoted 7 lines
Documentation/devicetree/bindings/gpio/gpio-wiegand.yaml new file +7
-0+ +maintainers: + - Martin Zaťovič <[email protected]> + +properties: + $nodename: + pattern: "^wiegand-gpio@[0-9a-f]+$"
No need to enforce node name, unless this is for a class of devices. But then why "gpio" not just "wiegand"?
Quoted 17 lines
Documentation/devicetree/bindings/gpio/gpio-wiegand.yaml new file +17
-0+ + compatible: + const: wiegand,wiegand-gpio + + data-hi-gpios: + description: GPIO spec for data-hi line to use + maxItems: 1 + + data-lo-gpios: + description: GPIO spec for data-lo line to use + maxItems: 1 + +required: + - compatible + - data-hi-gpios + - data-lo-gpios +
Documentation/devicetree/bindings/gpio/gpio-wiegand.yaml line 44
Quoted 10 lines
Documentation/devicetree/bindings/gpio/gpio-wiegand.yaml new file +10
-0+additionalProperties: false + +examples: + - | + #include <dt-bindings/gpio/gpio.h> + + wiegand { + compatible = "wiegand"; + + wiegand-gpio {
I have troubles understanding this. The "wiegand" node is the bus, right? Then what is "wiegand-gpio"? GPIO controller? Then why it is not marked as GPIO controller? What GPIOs does it control?
Documentation/devicetree/bindings/gpio/gpio-wiegand.yaml line 49
Quoted 5 lines
Documentation/devicetree/bindings/gpio/gpio-wiegand.yaml new file +5
-0+ compatible = "wiegand,wiegand-gpio"; + pinctrl-names = "default"; + pinctrl-0 = <&pinctrl_uart2_wiegand>; + data-hi-gpios = <&gpio2 7 (GPIO_ACTIVE_HIGH|GPIO_OPEN_DRAIN)>; + data-lo-gpios = <&gpio2 6 (GPIO_ACTIVE_HIGH|GPIO_OPEN_DRAIN)>;
Aren't these properties of the bus, not the device?
Documentation/devicetree/bindings/gpio/gpio-wiegand.yaml line 53
Quoted 4 lines
Documentation/devicetree/bindings/gpio/gpio-wiegand.yaml new file +4
-0+ }; + }; + +...
Best regards,
Krzysztof
Re: [RFCv2 PATCH 3/4] dt-bindings: gpio: add Wiegand GPIO driver dt documentation
Quoted 74 lines · Krzysztof Kozlowski
Quoted 16 lines · Martin Zaťovič
The Wiegand GPIO driver uses two GPIO lines to transmit data - data-hi and data-lo. These lines need to be defined in the devicetree, otherwise the driver will not probe successfully.
Signed-off-by Martin Zaťovič <[email protected]>--- .../bindings/gpio/gpio-wiegand.yaml | 53 +++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 Documentation/devicetree/bindings/gpio/gpio-wiegand.yamlDocumentation/devicetree/bindings/gpio/gpio-wiegand.yaml new file +0
-0Documentation/devicetree/bindings/gpio/gpio-wiegand.yaml line 10
Quoted 10 lines
Documentation/devicetree/bindings/gpio/gpio-wiegand.yaml new file +10
-0@@ -0,0 +1,53 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/gpio/gpio-wiegand.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Wiegand GPIO controller + +description: | + Wiegand GPIO controller running under Wiegand bus.GPIO controllers need "gpio-controller" property, so this seems to be something else.
Documentation/devicetree/bindings/gpio/gpio-wiegand.yaml line 17
Quoted 7 lines
Documentation/devicetree/bindings/gpio/gpio-wiegand.yaml new file +7
-0+ +maintainers: + - Martin Zaťovič <[email protected]> + +properties: + $nodename: + pattern: "^wiegand-gpio@[0-9a-f]+$"No need to enforce node name, unless this is for a class of devices. But then why "gpio" not just "wiegand"?
Quoted 17 lines
Documentation/devicetree/bindings/gpio/gpio-wiegand.yaml new file +17
-0+ + compatible: + const: wiegand,wiegand-gpio + + data-hi-gpios: + description: GPIO spec for data-hi line to use + maxItems: 1 + + data-lo-gpios: + description: GPIO spec for data-lo line to use + maxItems: 1 + +required: + - compatible + - data-hi-gpios + - data-lo-gpios +Documentation/devicetree/bindings/gpio/gpio-wiegand.yaml line 44
Quoted 10 lines
Documentation/devicetree/bindings/gpio/gpio-wiegand.yaml new file +10
-0+additionalProperties: false + +examples: + - | + #include <dt-bindings/gpio/gpio.h> + + wiegand { + compatible = "wiegand"; + + wiegand-gpio {I have troubles understanding this. The "wiegand" node is the bus, right? Then what is "wiegand-gpio"? GPIO controller? Then why it is not marked as GPIO controller? What GPIOs does it control?
Quoted 7 lines
Documentation/devicetree/bindings/gpio/gpio-wiegand.yaml line 49
Quoted 5 lines
Documentation/devicetree/bindings/gpio/gpio-wiegand.yaml new file +5
-0+ compatible = "wiegand,wiegand-gpio"; + pinctrl-names = "default"; + pinctrl-0 = <&pinctrl_uart2_wiegand>; + data-hi-gpios = <&gpio2 7 (GPIO_ACTIVE_HIGH|GPIO_OPEN_DRAIN)>; + data-lo-gpios = <&gpio2 6 (GPIO_ACTIVE_HIGH|GPIO_OPEN_DRAIN)>;Aren't these properties of the bus, not the device?
So this looks like specific implementation of Wiegand bus - a Wiegand bus controller. If it is correct, it should not be represented as child of a bus... because this is a bus. IOW, just like SPI or I2C controllers (why is this one different?), the bus is defined by SPI controller:
wiegand {
compatible = "wiegand,wiegand-gpio";
data-hi-gpios = <&gpio2 7 (GPIO_ACTIVE_HIGH|GPIO_OPEN_DRAIN)>;
data-lo-gpios = <&gpio2 6 (GPIO_ACTIVE_HIGH|GPIO_OPEN_DRAIN)>;
child-device, e.g. some-card {
compatible = "foo,bar";
// more properties of the device
};
};Best regards,
Krzysztof
RFC PATCH v2 4/4 gpio: add Wiegand GPIO driver
In reply to Martin ZaťovičWiegand GPIO driver uses GPIO lines defined in the devicetree to transmit data following the Wiegand protocol.
--- .../ABI/testing/sysfs-driver-gpio-wiegand | 40 ++ MAINTAINERS | 9 + drivers/gpio/Kconfig | 7 + drivers/gpio/Makefile | 1 + drivers/gpio/gpio-wiegand.c | 492 ++++++++++++++++++ 5 files changed, 549 insertions(+) create mode 100644 Documentation/ABI/testing/sysfs-driver-gpio-wiegand create mode 100644 drivers/gpio/gpio-wiegand.c
Documentation/ABI/testing/sysfs-driver-gpio-wiegand new file +40 -0
@@ -0,0 +1,40 @@ +What: /sys/devices/platform/.../wiegand-gpio-attributes/format +Date: October 2022 +Contact: Martin Zaťovič <[email protected]> +Description: Sets a format of Wiegand communication. Currently supported + formats are 26, 36 and 37 bits. These formats automatically add + checksums to the first and last bits of a message. To set a custom + format, 0 needs to be written here. Custom format writes an amount of + bits defined by payload_len(see below) and it does not add checksums so + the user is responsible for that. +Users: any user space application which wants to communicate using Wiegand + +What: /sys/devices/platform/.../wiegand-gpio-attributes/payload_len +Date: October 2022 +Contact: Martin Zaťovič <[email protected]> +Description: Depends on format attribute - using one of the standard formats + the payload_len attribute file becomes read-only and it contains the + number of bits of a message without the checksum bits(e.g. 24 for + 26-bit format). Using a custom format makes this file writable for + configuring the Wiegand message length in bits. +Users: any user space application which wants to communicate using Wiegand + +What: /sys/devices/platform/.../wiegand-gpio-attributes/pulse_len +Date: October 2022 +Contact: Martin Zaťovič +Description: Length of the low pulse in usecs; defaults to 50us. +Users: any user space application which wants to communicate using Wiegand + +What: /sys/devices/platform/.../wiegand-gpio-attributes/interval_len +Date: October 2022 +Contact: Martin Zaťovič +Description: Length of the whole bit(both the pulse and the high phase) in + usecs; defaults to 2000us +Users: any user space application which wants to communicate using Wiegand + +What: /sys/devices/platform/.../wiegand-gpio-attributes/frame_gap +Date: October 2022 +Contact: Martin Zaťovič +Description: Length of the last bit of a frame(both the pulse and the high + phase) in usecs; defaults to interval_len +Users: any user space application which wants to communicate using Wiegand
MAINTAINERS +9 -0
@@ -21960,6 +21960,15 @@ L: [email protected] S: Maintained F: drivers/hid/hid-wiimote* +WIEGAND DRIVER +M: Martin Zaťovič <[email protected]> +S: Maintained +F: Documentation/devicetree/bindings/bus/wiegand.yaml +F: Documentation/devicetree/bindings/gpio/gpio-wiegand.yaml +F: drivers/bus/wiegand.c +F: drivers/gpio/gpio-wiegand.c +F: include/linux/wiegand.h + WILOCITY WIL6210 WIRELESS DRIVER L: [email protected] S: Orphan
drivers/gpio/Kconfig +7 -0
@@ -703,6 +703,13 @@ config GPIO_VX855 Additional drivers must be enabled in order to use the functionality of the device. +config GPIO_WIEGAND + tristate "Wiegand GPIO support" + depends on WIEGAND + help + This enables the GPIO module for Wiegand protocol communication. + The Wiegand bus driver has to be enabled first. + config GPIO_WCD934X tristate "Qualcomm Technologies Inc WCD9340/WCD9341 GPIO controller driver" depends on MFD_WCD934X && OF_GPIO
drivers/gpio/Makefile +1 -0
@@ -173,6 +173,7 @@ obj-$(CONFIG_GPIO_VISCONTI) += gpio-visconti.o obj-$(CONFIG_GPIO_VX855) += gpio-vx855.o obj-$(CONFIG_GPIO_WCD934X) += gpio-wcd934x.o obj-$(CONFIG_GPIO_WHISKEY_COVE) += gpio-wcove.o +obj-$(CONFIG_GPIO_WIEGAND) += gpio-wiegand.o obj-$(CONFIG_GPIO_WINBOND) += gpio-winbond.o obj-$(CONFIG_GPIO_WM831X) += gpio-wm831x.o obj-$(CONFIG_GPIO_WM8350) += gpio-wm8350.o
drivers/gpio/gpio-wiegand.c new file +492 -0
492 lines not on this page · raw message
Signature · 1 line
2.37.3
Re: [RFCv2 PATCH 4/4] gpio: add Wiegand GPIO driver
Quoted 6 lines · Martin Zaťovič
Wiegand GPIO driver uses GPIO lines defined in the devicetree to transmit data following the Wiegand protocol.
Signed-off-by Martin Zaťovič <[email protected]>---
[snip]
drivers/gpio/gpio-wiegand.c line 391
Quoted 7 lines
drivers/gpio/gpio-wiegand.c new file +7
-0+ +DEVICE_ATTR_RW (pulse_len); +DEVICE_ATTR_RW (interval_len); +DEVICE_ATTR_RW (frame_gap); +DEVICE_ATTR_RW (format); +DEVICE_ATTR_RW (payload_len); +
We don't really allow GPIO drivers to define all kinds of custom device attributes. Also: this driver does not register a GPIO provider
- rather it's a GPIO consumer.
For what you're trying to achieve: have you tried using libgpiod and controlling the lines from user-space? If that's too slow, then I'd say this driver should go somewhere else. Maybe you'd need a whole new protocol sub-system for that. In any case - this subsystem is not the right place.
Bartosz
[snip]
Rob Herring
maintainerQuoted 14 lines · Martin Zaťovič
This patch documents the devicetree entry for enabling Wiegand bus driver. The drivers that will use Wiegand bus driver shall create a sub-node of the documented node.
Signed-off-by Martin Zaťovič <[email protected]>---
Hello again,this is the second round of RFC patches in an attempt to add Wiegand driver to linux kernel. Thank you for all the issues you have pointed out in the first round. I have tried to fix all of them and I have also implemented a Wiegand bus driver, that is now used by the GPIO driver itself - as suggested by Linus.
Quoted 9 lines
Any advice you have for me regarding the patches will be appreciated!
With regards,
Martin Zaťovič--- .../devicetree/bindings/bus/wiegand.yaml | 50 +++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 Documentation/devicetree/bindings/bus/wiegand.yaml
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:
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/bus/wiegand.example.dtb: wiegand: 'wiegand-gpio' does not match any of the regexes: 'pinctrl-[0-9]+'
From schema: /builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/bus/wiegand.yaml
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/bus/wiegand.example.dtb: wiegand: wiegand-gpio: {'compatible': ['wiegand,wiegand-gpio'], 'pinctrl-names': ['default'], 'pinctrl-0': [[4294967295]], 'data-hi-gpios': [[4294967295, 7, 6]], 'data-lo-gpios': [[4294967295, 6, 6]]} is not of type 'array'
From schema: /usr/local/lib/python3.10/dist-packages/dtschema/schemas/gpio/gpio-consumer.yamlDocumentation/devicetree/bindings/bus/wiegand.example.dtb:0:0: /example-0/wiegand/wiegand-gpio: failed to match any schema with compatible: ['wiegand,wiegand-gpio']
doc reference errors (make refcheckdocs):
See https://patchwork.ozlabs.org/patch/
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.
Quoted 47 lines · Martin Zaťovič
This patch documents the devicetree entry for enabling Wiegand bus driver. The drivers that will use Wiegand bus driver shall create a sub-node of the documented node.
Signed-off-by Martin Zaťovič <[email protected]>---
Hello again,this is the second round of RFC patches in an attempt to add Wiegand driver to linux kernel. Thank you for all the issues you have pointed out in the first round. I have tried to fix all of them and I have also implemented a Wiegand bus driver, that is now used by the GPIO driver itself - as suggested by Linus.
Any advice you have for me regarding the patches will be appreciated!
With regards,
Martin Zaťovič--- .../devicetree/bindings/bus/wiegand.yaml | 50 +++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 Documentation/devicetree/bindings/bus/wiegand.yamlDocumentation/devicetree/bindings/bus/wiegand.yaml new file +18
-0@@ -0,0 +1,50 @@ +# SPDX-License-Identifier: GPL-2.0 +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/bus/wiegand.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Wiegand Bus + +maintainers: + - Martin Zaťovič <[email protected]> + +description: | + Wiegand interface is a wiring standard popularized in the 1980s. To this day + many card readers, fingerprint readers, sensors, etc. use Wiegand interface + particularly for access control applications. It utilizes two wires to + transmit the data - D0 and D1. + + Both data lines are initially pulled up. To send a bit of value 1, the D1
Documentation/devicetree/bindings/bus/wiegand.yaml line 28
Quoted 10 lines
Documentation/devicetree/bindings/bus/wiegand.yaml new file +10
-0+ line is set low. Similarly to send a bit of value 0, the D0 line is set low. + +properties: + $nodename: + pattern: "^wiegand(@[0-9a-f]+)?$" + + compatible: + contains: + const: wiegand +
If the bus uses two wires, shouldn't you describe them here? Otherwise what wires are you using?
Quoted 12 lines
Documentation/devicetree/bindings/bus/wiegand.yaml new file +12
-0+required: + - compatible + +additionalProperties: false + +examples: + - | + #include <dt-bindings/gpio/gpio.h> + + wiegand { + compatible = "wiegand"; +
Documentation/devicetree/bindings/bus/wiegand.yaml line 50
Quoted 10 lines
Documentation/devicetree/bindings/bus/wiegand.yaml new file +10
-0+ wiegand-gpio { + compatible = "wiegand,wiegand-gpio"; + pinctrl-names = "default"; + pinctrl-0 = <&pinctrl_uart2_wiegand>; + data-hi-gpios = <&gpio 7 (GPIO_ACTIVE_HIGH|GPIO_OPEN_DRAIN)>; + data-lo-gpios = <&gpio 6 (GPIO_ACTIVE_HIGH|GPIO_OPEN_DRAIN)>; + }; + }; + +...
Best regards,
Krzysztof
Quoted 8 lines · Martin Zaťovič
This patch documents the devicetree entry for enabling Wiegand bus driver. The drivers that will use Wiegand bus driver shall create a sub-node of the documented node.
Signed-off-by Martin Zaťovič <[email protected]>---
Hello again,
Missing cover letter and changelog.
Best regards,
Krzysztof