linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "H. Nikolaus Schaller" <hns@goldelico.com>
To: Andreas Kemnade <andreas@kemnade.info>
Cc: Linus Walleij <linus.walleij@linaro.org>,
	Sven Van Asbroeck <thesven73@gmail.com>,
	Lukas Wunner <lukas@wunner.de>, Mark Brown <broonie@kernel.org>,
	kernel list <linux-kernel@vger.kernel.org>,
	Laurent Pinchart <laurent.pinchart@ideasonboard.com>,
	Discussions about the Letux Kernel 
	<letux-kernel@openphoenux.org>
Subject: Re: [BUG] SPI broken for SPI based panel drivers
Date: Wed, 9 Dec 2020 09:40:39 +0100	[thread overview]
Message-ID: <DF8D3CAC-49D1-4D34-9345-682E5C4D3CEF@goldelico.com> (raw)
In-Reply-To: <20201209090459.60ecb5ea@aktux>

Hi Andreas,

> Am 09.12.2020 um 09:04 schrieb Andreas Kemnade <andreas@kemnade.info>:
> 
> Hi,
> 
> On Sat, 5 Dec 2020 08:04:25 +0100
> "H. Nikolaus Schaller" <hns@goldelico.com> wrote:
> 
>> Hi Linus,
>> 
>>> Am 05.12.2020 um 01:25 schrieb Linus Walleij <linus.walleij@linaro.org>:
>>> 
>>> On Fri, Dec 4, 2020 at 5:52 PM H. Nikolaus Schaller <hns@goldelico.com> wrote:
>>> 
>>>> But what I don't know is if I can omit spi-cs-high and have to keep
>>>> ACTIVE_HIGH (my revert patch) or also change to ACTIVE_LOW (my additional
>>>> patch). This is arbitrary and someone has to decide what it should be.  
>>> (...)  
>>>> I'd prefer if you or maybe Linus could submit such a patch and I am happy to review it.  
>>> 
>>> It seems really ill-advised to have me do that since I have not
>>> managed very well to deal with this. Clearly better developers
>>> are needed. But I can review a patch and see if it makes me
>>> smarter :) 
> 
> Hmm, if those developers are not available, then probably finding
> those bugs has to be time-optimized, like establishing better automatic
> display testing.

Well, I don't think we need automatic display testing.

We just need to test if any SPI CS behaves correctly according to some
specification. Then all displays and other chips will work - unless
they have a bug in their DT.

Basically it would need a software unit-test going through all 6 variants
of having spi-cs-high and gpiod and parameters and looking if the chip
(maybe some SPI EEPROM with known SPI polarity) responds or not. This
can be done with hardware SPI controllers and spi-gpio.

And it can be re-run each time something significant in gpiolib or spi-gpio
is changed.

> 
>> 
>> I find it interesting that so far nobody wants to take responsibility
>> for a decision and to write down the behaviour really should be. Coding
>> is the second step then.
>> 
> well, the interesting people are not involved yet (DTML) because no
> patch is sent.

Well, I think we (gpiolib maintainers, spi maintainers and users of it) are
the right ones to define the truth table.

This is not primarily a DT issue, it is a matter of what we want to have
and then it is cast it into DT (documentation). So I am not sure if delegation
to someone else solves it.

> 
>> Anyways you did not cite the really important part of my mail. So let me
>> copy it back. Here it is again:
>> 
>>> What I can do is to provide just a skeleton for the table that you or Linus
>>> can fix/fill in and make a patch out of it. Is attached and the ??? is
>>> something you should discuss and define.  
>> 
>> Please take the attached diff, comment it here and define the question marks
>> according to your intention and then make a patch for the YAML bindings out
>> of it. (I can't do because I don't know your intentions and what to write into
>> the commit message).
>> 
> Well, I the easiest step forward is just to document clearer how things
> behave now, so the commit message is just something like
> 
> "Behavior of CS signal is not clearly documented, clarify the
> documentation". And then send the patch to the proper mailing lists
> including devicetree folks.

Ok, that looks like a good solution to get out of the deadlock.

BR and thanks,
Nikolaus

> 
> Regards,
> Andreas
> 
>> As soon as we have settled this, we can check if code is correct and really
>> define if my device tree fits and which change it needs exactly.
>> 
>> BR and thanks,
>> Nikolaus
>> 
>> [slightly edited]
>> 
>> diff --git a/Documentation/devicetree/bindings/spi/spi-controller.yaml b/Documentation/devicetree/bindings/spi/spi-controller.yaml
>> index 1b56d5e40f1f..4f8755dabecc 100644
>> --- a/Documentation/devicetree/bindings/spi/spi-controller.yaml
>> +++ b/Documentation/devicetree/bindings/spi/spi-controller.yaml
>> @@ -42,6 +42,30 @@ properties:
>>        cs2 : &gpio1 1 0
>>        cs3 : &gpio1 2 0
>> 
>> +      The second flag of a gpio descriptor can be GPIO_ACTIVE_HIGH/0
>> +      or GPIO_ACTIVE_LOW/1.
>> +
>> +      There is a special rule set for combining the second flag of an
>> +      cs-gpio with the optional spi-cs-high flag for SPI slaves.
>> +
>> +      Each table entry defines how the CS pin is physically driven
>> +      (not considering potential gpio inversions by pinmux):
>> +
>> +      device node     | cs-gpio       | CS pin state active | Note
>> +      ================+===============+=====================+=====
>> +      spi-cs-high     | -             | H                   |
>> +      -               | -             | L                   |
>> +      spi-cs-high     | ACTIVE_HIGH   | H                   |
>> +      -               | ACTIVE_HIGH   | L (or H ???)        | 1
>> +      spi-cs-high     | ACTIVE_LOW    | H (or L ???)        | 2
>> +      -               | ACTIVE_LOW    | L                   |
>> +
>> +      Notes:
>> +      1) should print a warning about polarity inversion
>> +         because here it would be wise to define the gpio as ACTIVE_LOW
>> +      2) could print a warning about polarity inversion
>> +         because ACTIVE_LOW is overridden by spi-cs-high
>> +      3) Effectively this rule defines that the ACTIVE level of the
>> +         gpio has to be ignored
>> +
>>  num-cs:
>>    $ref: /schemas/types.yaml#/definitions/uint32
>>    description:
>> 
>> 
>> 
> 


  reply	other threads:[~2020-12-09  8:44 UTC|newest]

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-30 19:03 [BUG] SPI broken for SPI based panel drivers H. Nikolaus Schaller
2020-11-30 20:13 ` Sven Van Asbroeck
2020-11-30 20:22   ` Sven Van Asbroeck
2020-12-01  8:59   ` H. Nikolaus Schaller
2020-12-01 12:16     ` Mark Brown
2020-12-01 14:05       ` H. Nikolaus Schaller
2020-12-01 14:20         ` Linus Walleij
2020-12-01 14:34           ` Sven Van Asbroeck
2020-12-01 14:35           ` H. Nikolaus Schaller
2020-12-01 15:52             ` Sven Van Asbroeck
2020-12-01 16:46               ` H. Nikolaus Schaller
2020-12-01 16:10             ` Sven Van Asbroeck
2020-12-01 16:39               ` H. Nikolaus Schaller
2020-12-01 16:53                 ` Sven Van Asbroeck
2020-12-01 17:10                   ` H. Nikolaus Schaller
2020-12-01 18:43                     ` Sven Van Asbroeck
2020-12-02 12:19                       ` Mark Brown
2020-12-04 10:08                       ` H. Nikolaus Schaller
2020-12-04 13:46                         ` Sven Van Asbroeck
2020-12-04 16:49                           ` H. Nikolaus Schaller
2020-12-04 19:19                             ` Sven Van Asbroeck
2020-12-04 21:31                               ` H. Nikolaus Schaller
2020-12-05  0:25                             ` Linus Walleij
2020-12-05  7:04                               ` H. Nikolaus Schaller
2020-12-09  8:04                                 ` Andreas Kemnade
2020-12-09  8:40                                   ` H. Nikolaus Schaller [this message]
2020-12-09  8:38                                 ` Linus Walleij
2020-12-09  8:45                                   ` H. Nikolaus Schaller
2020-12-01 22:51                     ` Linus Walleij
2020-12-01 16:44               ` [Letux-kernel] " Andreas Kemnade
2020-12-01 16:51                 ` H. Nikolaus Schaller
2020-12-01 16:52                 ` H. Nikolaus Schaller
2020-12-01 16:55                 ` Sven Van Asbroeck
2020-12-01 16:20           ` Mark Brown
2020-12-01 16:41             ` H. Nikolaus Schaller
2020-12-01 17:11               ` Mark Brown
2020-12-01 12:41     ` Sven Van Asbroeck
2020-12-01 13:32       ` H. Nikolaus Schaller
2020-12-01 14:08         ` Sven Van Asbroeck
2020-12-01 15:33           ` Mark Brown
2020-12-05 20:57   ` Pavel Machek
2020-12-07 13:43     ` Mark Brown

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=DF8D3CAC-49D1-4D34-9345-682E5C4D3CEF@goldelico.com \
    --to=hns@goldelico.com \
    --cc=andreas@kemnade.info \
    --cc=broonie@kernel.org \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=letux-kernel@openphoenux.org \
    --cc=linus.walleij@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lukas@wunner.de \
    --cc=thesven73@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).