[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAGngYiVL9M72hFRWnmT_8RRX9pUTSLsNuYz6mUo0Be4Vivk7Xw@mail.gmail.com>
Date: Wed, 9 Dec 2020 14:04:26 -0500
From: Sven Van Asbroeck <thesven73@...il.com>
To: "H. Nikolaus Schaller" <hns@...delico.com>
Cc: Mark Brown <broonie@...nel.org>, Rob Herring <robh+dt@...nel.org>,
Linus Walleij <linus.walleij@...aro.org>,
linux-spi <linux-spi@...r.kernel.org>,
linux-gpio@...r.kernel.org,
devicetree <devicetree@...r.kernel.org>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
Discussions about the Letux Kernel
<letux-kernel@...nphoenux.org>, kernel@...a-handheld.com,
Maxime Ripard <maxime.ripard@...tlin.com>,
Lukas Wunner <lukas@...ner.de>,
Laurent Pinchart <laurent.pinchart@...asonboard.com>,
Andreas Kemnade <andreas@...nade.info>,
Maxime Ripard <maxime@...no.tech>
Subject: Re: [PATCH] spi: dt-bindings: clarify CS behavior for spi-cs-high and
gpio descriptors
On Wed, Dec 9, 2020 at 1:16 PM H. Nikolaus Schaller <hns@...delico.com> wrote:
>
> This is also what made me wonder if that is really intended because then
> the whole discussion about the cs-gpio-flags and inversion and the fixes
> would not have been needed. The current code and fixes are all about
> not ignoring the flags...
The inversion you witnessed was a bug caused by spi client drivers that
simply "plow over" the SPI_CS_HIGH mode flag. This includes the panel driver
you're using, see:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/gpu/drm/panel/panel-tpo-td028ttec1.c?h=v5.10-rc6#n337
You responded to this inversion bug by inverting your chip select, which made
things work again. Now that the bug is gone, you can indicate the correct
polarity in your devicetree, i.e. add 'spi-cs-high' for an active-high
CS, and leave it out for an active-low CS.
Your panel's CS is active-low, so it should not contain spi-cs-high.
> Secondly, please imagine some reader of a device tree who finds
>
> cs-gpios = <&gpio 7 ACTIVE_LOW>;
> spi-cs-high;
That reader looks at the rules, sees that:
- the ACTIVE_LOW is ignored,
- presence of spi-cs-high means active-high
and concludes this chip-select is active-high.
Powered by blists - more mailing lists