From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.6 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE, SPF_PASS,USER_AGENT_SANE_2 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D7719C432C3 for ; Sun, 1 Dec 2019 11:40:39 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id AE513215F1 for ; Sun, 1 Dec 2019 11:40:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1575200439; bh=QADRPI/v7uWFrZlAU+lAp7qfdc0QVa9R92Z8HOa8KhA=; h=Date:From:To:Cc:Subject:In-Reply-To:References:List-ID:From; b=R3AySkWCawNVtGuOyv8EEi8imdC24biIs/wNhFsyCBUoorjYtpRiujnYDuKBXku4M Cw1NSXRPRx8wELobvrJCrh+LSW0X+jhs9+CHsDHzi/3AfKVjE+0LW26WWL8hCdy0m+ wqExwRj66aDkewlKnyR2DSibpl09JsFlMcaUTIho= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726303AbfLALkj (ORCPT ); Sun, 1 Dec 2019 06:40:39 -0500 Received: from mail.kernel.org ([198.145.29.99]:44164 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726162AbfLALki (ORCPT ); Sun, 1 Dec 2019 06:40:38 -0500 Received: from archlinux (cpc149474-cmbg20-2-0-cust94.5-4.cable.virginm.net [82.4.196.95]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 005C620833; Sun, 1 Dec 2019 11:40:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1575200437; bh=QADRPI/v7uWFrZlAU+lAp7qfdc0QVa9R92Z8HOa8KhA=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=IZpF2yGCdLXKN8JNr0Y7btEYg90Ty8DjDGwzbAQMzKDCMHYhZ1JMkeGoLlGRCSk4J G3aARmYvar7U0WdKDgaTQSI8TrJmXBz/fVU2xd8//C46c064OHw+/nE/j7VQhCiSZU DOE6vym2k+qL7osP6u4bcuBUDVZ1RaF5NKXtSzF0= Date: Sun, 1 Dec 2019 11:40:32 +0000 From: Jonathan Cameron To: "Ardelean, Alexandru" Cc: "rodrigorsdc@gmail.com" , "Popa, Stefan Serban" , "kernel-usp@googlegroups.com" , "devel@driverdev.osuosl.org" , "linux-iio@vger.kernel.org" , "devicetree@vger.kernel.org" , "gregkh@linuxfoundation.org" , "lars@metafoo.de" , "pmeerw@pmeerw.net" , "Hennerich, Michael" , "linux-kernel@vger.kernel.org" , "knaack.h@gmx.de" , Mark Brown Subject: Re: [PATCH v4] dt-bindings: iio: accel: add binding documentation for ADIS16240 Message-ID: <20191201114032.1a972dda@archlinux> In-Reply-To: References: <20191123051927.5016-1-rodrigorsdc@gmail.com> <20191123114119.7b0c3447@archlinux> X-Mailer: Claws Mail 3.17.4 (GTK+ 2.24.32; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: devicetree-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org +CC Mark as we probably need a more general view point on the question of whether SPI mode should be enforced by binding or in the driver. On Mon, 25 Nov 2019 07:51:30 +0000 "Ardelean, Alexandru" wrote: > On Sat, 2019-11-23 at 11:41 +0000, Jonathan Cameron wrote: > > On Sat, 23 Nov 2019 02:19:27 -0300 > > Rodrigo Carvalho wrote: > > > > > This patch add device tree binding documentation for ADIS16240. > > > > > > Signed-off-by: Rodrigo Ribeiro Carvalho > > My bad for the late timing on this. > I'm slightly more fresh on Mondays. > But I will get overloaded with work in a few hours, so I may not have time > ot respond. > > > No problem with this patch, but I definitely want to see an accompanying > > one enforcing the SPI mode in the driver. > > > > So, then the binding should probably also define spi-cpol & spi-cpha > as mandatory. > Maybe, the driver would do a check and print a warning. > > I'm noticing that this device uses SPI mode 3, but this DT binding defaults > to SPI mode 0 > > > Right now the driver doesn't set it and so I'm fairly sure not putting > > it in the binding will leave you with a non working device. > > > > The right option if only one option is supported is for the driver > > to call spi_setup with the relevant options. > > > > What if the board uses some level inverters [because of some weird reason] > and that messes up with the SPI mode? > It's not common, but it is possible. I have wondered the same and have a few boards that do this sort of thing. My personal feeling is that such level convertors should have explicit representation rather than being hidden in changes to the devicetree. Perhaps via a single input single output mux that would wrap up the actions of any inverters in the path. As you say, the alternative is to just leave it to the devicetree bindings. Jonathan > > > Thanks, > > > > Jonathan > > > > > --- > > > V4: > > > - Remove spi-cpha and spi-cpol in binding example, since this driver > > > supports only one timing mode. > > > .../bindings/iio/accel/adi,adis16240.yaml | 49 +++++++++++++++++++ > > > 1 file changed, 49 insertions(+) > > > create mode 100644 > > > Documentation/devicetree/bindings/iio/accel/adi,adis16240.yaml > > > > > > diff --git > > > a/Documentation/devicetree/bindings/iio/accel/adi,adis16240.yaml > > > b/Documentation/devicetree/bindings/iio/accel/adi,adis16240.yaml > > > new file mode 100644 > > > index 000000000000..8e902f7c49e6 > > > --- /dev/null > > > +++ b/Documentation/devicetree/bindings/iio/accel/adi,adis16240.yaml > > > @@ -0,0 +1,49 @@ > > > +# SPDX-License-Identifier: GPL-2.0 > > > +%YAML 1.2 > > > +--- > > > +$id: http://devicetree.org/schemas/iio/accel/adi,adis16240.yaml# > > > +$schema: http://devicetree.org/meta-schemas/core.yaml# > > > + > > > +title: ADIS16240 Programmable Impact Sensor and Recorder driver > > > + > > > +maintainers: > > > + - Alexandru Ardelean > > > + > > > +description: | > > > + ADIS16240 Programmable Impact Sensor and Recorder driver that > > > supports > > > + SPI interface. > > > + https://www.analog.com/en/products/adis16240.html > > > + > > > +properties: > > > + compatible: > > > + enum: > > > + - adi,adis16240 > > > + > > > + reg: > > > + maxItems: 1 > > > + > > > + interrupts: > > > + maxItems: 1 > > > + > > > +required: > > > + - compatible > > > + - reg > > > + - interrupts > > > + > > > +examples: > > > + - | > > > + #include > > > + #include > > > + spi0 { > > > + #address-cells = <1>; > > > + #size-cells = <0>; > > > + > > > + /* Example for a SPI device node */ > > > + accelerometer@0 { > > > + compatible = "adi,adis16240"; > > > + reg = <0>; > > > + spi-max-frequency = <2500000>; > > > + interrupt-parent = <&gpio0>; > > > + interrupts = <0 IRQ_TYPE_LEVEL_HIGH>; > > > + }; > > > + };