Re: [PATCH dt-schema] schemas: gpio: gpio-consumer: Fix false positives on nodes named gpio

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 23/10/2023 20:08, Geert Uytterhoeven wrote:
> Hi Krzysztof,
> 
> On Mon, Oct 23, 2023 at 5:24 PM Krzysztof Kozlowski
> <krzysztof.kozlowski@xxxxxxxxxx> wrote:
>> On 23/10/2023 16:41, Geert Uytterhoeven wrote:
>>> Just like for "gpio", nodes can be named "gpios" or
>>> "<something>-gpio(s)", causing false positive failures.
>>>
>>> See also commit 80120fccde170902 ("schemas: gpio: fix false positive
>>> failures on nodes named 'gpio'").
>>>
>>> Signed-off-by: Geert Uytterhoeven <geert+renesas@xxxxxxxxx>
>>> ---
>>> Seen on Linux, e.g.:
>>>
>>>     arch/arm/boot/dts/renesas/r8a7779-marzen.dtb: /: keyboard-gpio: {'compatible': ['gpio-keys-polled'], 'poll-interval': [[50]], 'pinctrl-0': [[29]], 'pinctrl-names': ['default'], 'key-3': {'gpios': [[28, 19, 1]], 'linux,code': [[4]], 'label': ['SW1-3'], 'debounce-interval': [[20]]}, 'key-4': {'gpios': [[28, 20, 1]], 'linux,code': [[5]], 'label': ['SW1-4'], 'debounce-interval': [[20]]}} is not of type 'array'
>>>           from schema $id: http://devicetree.org/schemas/gpio/gpio-consumer.yaml#
>>>     arch/arm/boot/dts/renesas/r8a7779-marzen.dtb: pinctrl@fffc0000: keyboard-gpio: {'pins': ['GP_0_19', 'GP_0_20'], 'bias-pull-up': True, 'phandle': [[29]]} is not of type 'array'
>>>           from schema $id: http://devicetree.org/schemas/gpio/gpio-consumer.yaml#
>>
>> keyboard-gpio is not commonly used names. Most (almost all) boards just
>> call it "gpio-keys".
> 
> Most call it "keyboard".

Most? My grep counted only 14.

520 for gpio-keys (not counting -polled)

But sure, can be keyboard.

> 
> Marzen has 4 keys split in two keyboards due to hardware limitations,
> hence I had called them "keyboard-irq" (using falling edge interrupts,
> i.e. no real key-up events)  and "keyboard-gpio" (gpio polling
> without interrupts).
keyboard-0
keyboard-1

> 
>>>     arch/arm/boot/dts/microchip/at91-kizbox3-hs.dtb: /: gpios: {'compatible': ['gpio'], 'status': ['okay'], 'rf_on': {'label': ['rf on'], 'gpio': [[38, 83, 0]], 'output': True, 'init-low': True}, 'wifi_on': {'label': ['wifi on'], 'gpio': [[38, 84, 0]], 'output': True, 'init-low': True}, 'zbe_test_radio': {'label': ['zbe test radio'], 'gpio': [[38, 53, 0]], 'output': True, 'init-low': True}, 'zbe_rst': {'label': ['zbe rst'], 'gpio': [[38, 57, 0]], 'output': True, 'init-low': True}, 'io_reset': {'label': ['io reset'], 'gpio': [[38, 62, 0]], 'output': True, 'init-low': True}, 'io_test_radio': {'label': ['io test radio'], 'gpio': [[38, 73, 0]], 'output': True, 'init-low': True}, 'io_boot_0': {'label': ['io boot 0'], 'gpio': [[38, 75, 0]], 'output': True, 'init-low': True}, 'io_boot_1': {'label': ['io boot 1'], 'gpio': [[38, 81, 0]], 'output': True, 'init-low': True}, 'verbose_bootloader': {'label': ['verbose bootloader'], 'gpio': [[38, 43, 0]], 'input': True}, 'nail_bed_detection': {'label': ['nail bed detection'], 'gpio': [[38, 44, 0]], 'input': True}, 'id_usba': {'label': ['id usba'], 'gpio': [[38, 64, 1]], 'input': True}} is not of type 'array'
>>>           from schema $id: http://devicetree.org/schemas/gpio/gpio-consumer.yaml#
>>
>> compatible = "gpio"? Is there such binding?
>>
>> I think we should not allow "gpios" as a node, at least above examples
>> do not justify it.
> 
> Note that there are more.  I used grep, and picked just one to see if I could
> fix that one too while at it:
> 
> $ git grep "\<gpios\s*{"
> arch/arm/boot/dts/marvell/kirkwood-db.dtsi:
> pmx_sdio_gpios: pmx-sdio-gpios {
> arch/arm/boot/dts/marvell/orion5x-netgear-wnr854t.dts:  pmx_pci_gpios:
> pmx-pci-gpios {
> arch/arm/boot/dts/marvell/orion5x-rd88f5182-nas.dts:
> pmx_misc_gpios: pmx-misc-gpios {
> arch/arm/boot/dts/marvell/orion5x-rd88f5182-nas.dts:    pmx_pci_gpios:
> pmx-pci-gpios {
> arch/arm/boot/dts/microchip/at91-kizbox3-hs.dts:        gpios {
> arch/arm/boot/dts/qcom/qcom-apq8064-pins.dtsi:  sdc4_gpios: sdc4-gpios {
> arch/arm/boot/dts/st/ste-hrefv60plus.dtsi:                      gpios {
> arch/mips/boot/dts/ingenic/qi_lb60.dts:         mmc-gpios {

These look like pins so they would have their own schema, most likely
not "gpios" but "pins" or something similar.

> 
> Or:
> 
> $ git grep -e "-gpio\s*{" | wc -l
> 64

For example Xilinx ones are pincfg, so they should have some name with
known pattern (e.g. mentioned "pins").

> 
>>> For marzen, the alternative fix would be to
>>> s/keyboard-gpio/keyboard-polled/g.
> 
> Do you prefer the alternative?

I would propose to change the names in the DTS. For pin configuration
nodes this however might require first having DT schema for them.

Best regards,
Krzysztof





[Index of Archives]     [Linux Samsung SOC]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]

  Powered by Linux