Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp970237pxu; Fri, 4 Dec 2020 23:11:03 -0800 (PST) X-Google-Smtp-Source: ABdhPJy3mbRnCS5TlZqQLqTGdIBEHrZ0JIqzp4vFcBMB2cWZR4Yt0cybkg84HOjbHzUL4ssdEsT7 X-Received: by 2002:a17:906:c1c6:: with SMTP id bw6mr10728813ejb.199.1607152263521; Fri, 04 Dec 2020 23:11:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1607152263; cv=none; d=google.com; s=arc-20160816; b=o97sfaMxnZQfLWUw7jOgoF9tKB73o6jhfWjhHtRbUcOs9ioamN+t0aTYZubUrmPVb3 OmSEOIDqN1cSO0hDo4ApxEYU+xxwxWiarIwgcdkR+mrMbAOMOxEI/TUUrKGzzeY4lbfj kU62bzeNQ07afo8hFJRpVCcxpU9AIhu34XsGDF/juusNDYt9hz4Z0kEth3scEj2DRLDA LtFb7hb+b2G86Rg0DDjsDBbaXG3ed+6cV4yC0U0VaGGsyZkV7oORpLAh5zB+qTN54sJb +RDSzafdBNWJpp0V9/aLlssmsrpbgOrrqiPC1y4+wh3rFQOsw0IUA9uTfM7/N/rFdAnB zuEA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:to:references:message-id :content-transfer-encoding:cc:date:in-reply-to:from:mime-version :subject:dkim-signature; bh=rb1iNJtZtqIe696Y0BSi+sRPb127OZ3/RYM4etoAKCI=; b=gzrsKzKPQDyM3v8waVjbQ3SkemLRr2hXrcRN/OITONX3ScwIcrWBxEBhxxUgD/uDsK f8NssGgqOsRk2vVhk4dPmilG9cw89MIu7Hnr9u1dji926+qrQzZnIZ1X3wvPfpifreE1 GrvV3l9JLmJJezRwgsFQk8ZBx698QTpEJMuPrFdt8LbqUvmxJIMSVr5jqXcFhXtTxrAk 7Rc05u/8CoeU7QWWTlMIfGFuxwsUPLUQZDWcJiYfc32VLzsZfThis20/zGgyKoIUXq+v geAlfHPlndpwzNyPvrBfYDNwmr1A+NTia0neILdP5gj0UuX7aTdvK5KIa1ACPkgng7c1 +RMA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@goldelico.com header.s=strato-dkim-0002 header.b=eND5+E4k; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id k16si4255115edr.236.2020.12.04.23.10.40; Fri, 04 Dec 2020 23:11:03 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@goldelico.com header.s=strato-dkim-0002 header.b=eND5+E4k; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727591AbgLEHHV (ORCPT + 99 others); Sat, 5 Dec 2020 02:07:21 -0500 Received: from mo4-p01-ob.smtp.rzone.de ([85.215.255.53]:16524 "EHLO mo4-p01-ob.smtp.rzone.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726031AbgLEHHV (ORCPT ); Sat, 5 Dec 2020 02:07:21 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; t=1607151869; s=strato-dkim-0002; d=goldelico.com; h=To:References:Message-Id:Cc:Date:In-Reply-To:From:Subject: X-RZG-CLASS-ID:X-RZG-AUTH:From:Subject:Sender; bh=rb1iNJtZtqIe696Y0BSi+sRPb127OZ3/RYM4etoAKCI=; b=eND5+E4kdAwiqFL+btnhIBP9lrf62VtnJIp3wRDwVlyjKJXDReoPdhtm69oYrEcWOQ Yo8LaoTI7ECDI9FRx1pQjpkG+8B6LHyEsixwgzsedQ6RvtXgsZjubxo/724PiBY/hJKz ziQImiEJfKk4lDJojSoxC5luEldOIyz1d5WG7KwtjWAk8MMsenT1a/A96IyIhMP48HF5 PNIkiYk0txKDrtbQC4okB4C93+hMB9qVQZonWtlNG6IaX6+oD/zK0aKdht6uZdtwP+bT /xKbRbz2cDAERPqQO+Ied2tQOdb3bIl+SZhYKNEvomU90I2RvU5y84As6X0xyW/4SQl+ bt9Q== X-RZG-AUTH: ":JGIXVUS7cutRB/49FwqZ7WcJeFKiMgPgp8VKxflSZ1P34KBj7wpz8NMGHPrtwDCrvXQ=" X-RZG-CLASS-ID: mo00 Received: from imac.fritz.box by smtp.strato.de (RZmta 47.3.4 DYNA|AUTH) with ESMTPSA id N02faawB574Qjfi (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (curve X9_62_prime256v1 with 256 ECDH bits, eq. 3072 bits RSA)) (Client did not present a certificate); Sat, 5 Dec 2020 08:04:26 +0100 (CET) Subject: Re: [BUG] SPI broken for SPI based panel drivers Mime-Version: 1.0 (Mac OS X Mail 9.3 \(3124\)) Content-Type: text/plain; charset=us-ascii From: "H. Nikolaus Schaller" In-Reply-To: Date: Sat, 5 Dec 2020 08:04:25 +0100 Cc: Sven Van Asbroeck , Lukas Wunner , Mark Brown , kernel list , Laurent Pinchart , Discussions about the Letux Kernel , Andreas Kemnade Content-Transfer-Encoding: quoted-printable Message-Id: References: <2D7916FA-678F-4236-B478-C953CADF2FFA@goldelico.com> <4AC29229-9542-4E77-B993-217E29C7E209@goldelico.com> <20201201121620.GB5239@sirena.org.uk> <6283C16F-549C-4463-BC08-E2C1A1D78B2F@goldelico.com> <9380CE00-9CE6-4E0B-B2E1-1B534F85E47D@goldelico.com> <7702A943-FCC5-416B-B53A-3B0427458915@goldelico.com> To: Linus Walleij X-Mailer: Apple Mail (2.3124) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Linus, > Am 05.12.2020 um 01:25 schrieb Linus Walleij = : >=20 > On Fri, Dec 4, 2020 at 5:52 PM H. Nikolaus Schaller = wrote: >=20 >> 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. >=20 > 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 :) 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. 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). 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 + =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D+=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D+=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D+=3D=3D=3D=3D=3D + 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: