dt-bindings: input: ti,ads7843: Allow SPI clock polarity
Subsystems (3)
PATCH 1/1 dt-bindings: input: ti,ads7843: Allow SPI clock polarity
imx27-eukrea-mbimxsd27-baseboard passes 'spi-cpol' in the ads7846 touchscreen node, which causes the following dt-schema warning:
imx27-eukrea-mbimxsd27-baseboard.dtb: ads7846@0 (ti,ads7846):
Unevaluated properties are not allowed (spi-cpol was unexpected)
Allow spi-cpol so the binding describes the existing configuration without changing its SPI mode.
--- .../devicetree/bindings/input/touchscreen/ti,ads7843.yaml | 2 ++ 1 file changed, 2 insertions(+)
Documentation/devicetree/bindings/input/touchscreen/ti,ads7843.yaml +2 -0
@@ -32,6 +32,8 @@ properties: description: GPIO handle describing the pin the !PENIRQ line is connected to. + spi-cpol: true + vcc-supply: description: A regulator node for the supply voltage.
Signature · 1 line
2.43.0
[email protected]
AI reviewThank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider: - [Medium] dt-bindings: input: ti,ads7843: invalid spi-cpol ignored by ads7846_probe() --
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] dt-bindings: input: ti,ads7843: invalid spi-cpol ignored by ads7846_probe() --
commit d8ba40e3cdda072fca3161a79055b07f36780581
Author: Fabio Estevam <[email protected]>
dt-bindings: input: ti,ads7843: Allow SPI clock polarity
This commit adds the spi-cpol property to the ti,ads7843 device tree binding schema to address a dtbs_check warning for the ads7846@0 node in arch/arm/boot/dts/nxp/imx/imx27-eukrea-mbimxsd27-baseboard.dts.
Documentation/devicetree/bindings/input/touchscreen/ti,ads7843.yaml properties: · line 39
Quoted 13 lines
Documentation/devicetree/bindings/input/touchscreen/ti,ads7843.yaml +2
-0@@ -32,6 +32,8 @@ properties: description: GPIO handle describing the pin the !PENIRQ line is connected to. + spi-cpol: true + vcc-supply: description: A regulator node for the supply voltage.
[Severity: Medium]
Should spi-cpol be removed from the ads7846@0 node in arch/arm/boot/dts/nxp/imx/imx27-eukrea-mbimxsd27-baseboard.dts instead of being added to the properties block in Documentation/devicetree/bindings/input/touchscreen/ti,ads7843.yaml?
The commit message states:
Allow spi-cpol so the binding describes the existing configuration without changing its SPI mode.
However, in drivers/input/touchscreen/ads7846.c, ads7846_probe() unconditionally clears SPI_MODE_X_MASK (SPI_CPOL | SPI_CPHA) and forces SPI_MODE_0 before calling spi_setup():
spi->bits_per_word = 8; spi->mode &= ~SPI_MODE_X_MASK; spi->mode |= SPI_MODE_0; err = spi_setup(spi);
Because ads7846_probe() overrides any polarity flags parsed from Device Tree, the spi-cpol property in imx27-eukrea-mbimxsd27-baseboard.dts has no effect on the operating SPI mode of the touchscreen driver, and removing it from the DTS would not change the operational SPI mode.
Furthermore, the TI ADS7843, ADS7845, ADS7846, ADS7873, and TSC2046 controllers latch DIN on the rising edge of DCLK and shift DOUT on the falling edge (SPI Mode 0: CPOL=0, CPHA=0). Allowing spi-cpol without spi-cpha in the binding schema permits SPI Mode 2 (CPOL=1, CPHA=0), which does not match the hardware protocol or the forced SPI_MODE_0 configuration in ads7846_probe().
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1