Re: [BUG] SPI broken for SPI based panel drivers

From: Sven Van Asbroeck
Date: Tue Dec 01 2020 - 13:44:51 EST


Hi Nikolaus,

On Tue, Dec 1, 2020 at 12:13 PM H. Nikolaus Schaller <hns@xxxxxxxxxxxxx> wrote:
> > Am 01.12.2020 um 17:53 schrieb Sven Van Asbroeck <thesven73@xxxxxxxxx>:
> > On Tue, Dec 1, 2020 at 11:43 AM H. Nikolaus Schaller <hns@xxxxxxxxxxxxx> wrote:
> >>
> >> You are right. It is active low.
> >>
> >
> > In that case, we have a very simple solution, just remove the spi-cs-high,
> > and things will work.
>
> We originally had it that way and because there was a change in gpiolib we had
> to introduce it.

The current rules re. spi chip-selects in devicetrees are here:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/gpio/gpiolib-of.c?h=v5.10-rc6#n191

This is the way I see things:
- according to the current rules, your devicetree describes a spi panel with
an active-high chip select
- the actual chip select of your panel is active-low
- a spi/gpiod bug inverted the chip-select in many instances
- because of this bug, your devicetree happened to work before 766c6b63aa04
- 766c6b63aa04 ("spi: fix client driver breakages when using GPIO descriptors")
fixes this chip-select polarity bug
- you now need to remove your devicetree work-around for this bug by reverting
f1f028ff89cb0d3

>
> I am not sure if DT maintainers accept that we revert a DT change just to
> handle some change in a driver. Usually they insist on fixing a driver and
> live with the DT. DT is carved in stone or could be ROM...

This is above my paygrade, but I've always assumed that the devicetree ABI
is an in-kernel ABI, i.e. not a userspace ABI. Meaning that it is flexible and
there is no obligation to keep it 100% backwards compatible. Of course Rob
Herring may want to keep it as backwards-compatible as possible, but that's
an altogether different thing from having a userspace-type ABI.

>
> So you could try to submit a revert of f1f028ff89cb0d3 with a description
> why it is needed. And please make sure that it is also applied where your
> patch is backported to stable. So it should have some
>
> Fixes: 766c6b63aa04 ("spi: fix client driver breakages when using GPIO descriptors")

I have no insight in your devicetrees, and no hardware to test it out either.
As a user of these trees, you are best placed to make the change and test it
out. I invite you to submit a patch (revert of f1f028ff89cb0d3) to the
mailing list.

>
>
> So you mean you are just restoring the behaviour before
>
> 6953c57ab172
>
> was introduced?
>

That was based on my incorrect interpretation of the devicetree spi cs
rules, my apologies. I have linked to the correct rules in the link above.