Received: by 2002:a05:6a10:9e8c:0:0:0:0 with SMTP id y12csp2579pxx; Tue, 27 Oct 2020 18:50:31 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzALQAJ2TD9QlHwoy01DZVdwX70i9ovcjXh0yWuSD7cg0EXTtSdSUneGIwNK0ZAxPLY6QZq X-Received: by 2002:a17:906:139a:: with SMTP id f26mr5182955ejc.472.1603849831073; Tue, 27 Oct 2020 18:50:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603849831; cv=none; d=google.com; s=arc-20160816; b=mDCn41TBB4iRI95Ad6zTzUT7IXeBuPVFFg5KIPnnnFUNtpBljrMhY//Vi7tE5ctAm3 8+l6Cpc5J6H1evro2OPfw+XZ9bjB/eVsTx9BoH2dizk9O5vSAfSrXus+u3NtezJ23eGD 63hhi2zMnSuuT+oSMQ3hbxRa1Ju1yjrkeEOr+fW2/HLxgd1V3p7UUjpl7zopiYgLZmTe fi0ikPsM3K4olNBNvqx0/eK8cQEWKklLrRkK/2crMwyjKxOOk8AGva5JVVuFEtkuBlfH 0dbbO9rjrlAHDW/bA3ngG4QCX4jbLRWGJLuwf/Q0uHJ46EOgBhNcmL0y0PvbBo4NViR9 1pCA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=mGOJO+L4XUGywyfb35jo38PR4OkGuvkUCrubqRNDNts=; b=DUJDbPXYcpXNseTRF3Rkcc9ccOqwlGU5AAONbv4s9y0QyuRP0DCIva/WUl/+/v4u68 ONU64EGS+BQ5pR0IThpZNe3Yl4LpVH7nlm+gCk/zlyFD8Ev0i5ZtzqO7J9Jt1TgUHH2Z 694Xnp79/AdC23xmgH+xCtWxD5FSf2DC+bUMpBl9kPm8PKjWUEREmCRmHDkEQFI1zoft qmNSTQSj2wxEqIxLJGPP1RvcxPzccO7/uXwU+HfoQoCFuiqixH4KOZth8/+/h91DYkyY olCu6FRxkhdWpPCNMd/OsGhn3Cp9qrYOzD+3L74WzuuieZfW+ut44lrM1+DwHzlX7kjB 8AZA== ARC-Authentication-Results: i=1; mx.google.com; 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 q1si2376171ejf.509.2020.10.27.18.50.09; Tue, 27 Oct 2020 18:50:31 -0700 (PDT) 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; 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 S2508790AbgJ0IHk convert rfc822-to-8bit (ORCPT + 99 others); Tue, 27 Oct 2020 04:07:40 -0400 Received: from metis.ext.pengutronix.de ([85.220.165.71]:35917 "EHLO metis.ext.pengutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2508774AbgJ0IH2 (ORCPT ); Tue, 27 Oct 2020 04:07:28 -0400 Received: from pty.hi.pengutronix.de ([2001:67c:670:100:1d::c5]) by metis.ext.pengutronix.de with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kXK0n-0008HG-7x; Tue, 27 Oct 2020 09:07:21 +0100 Received: from ore by pty.hi.pengutronix.de with local (Exim 4.89) (envelope-from ) id 1kXK0l-0006i8-RJ; Tue, 27 Oct 2020 09:07:19 +0100 Date: Tue, 27 Oct 2020 09:07:19 +0100 From: Oleksij Rempel To: Dmitry Torokhov Cc: "Ardelean, Alexandru" , David Jander , "linux-kernel@vger.kernel.org" , "kernel@pengutronix.de" , "linux-input@vger.kernel.org" Subject: Re: [PATCH v1] Input: ads7846: do not overwrite spi->mode flags set by spi framework Message-ID: <20201027080719.utujr2p6pbzpvb3j@pengutronix.de> References: <20201021090434.16387-1-o.rempel@pengutronix.de> <20201021105614.tc3jnv5g62hvl5vg@pengutronix.de> <20201021182757.GA444962@dtor-ws> <20201022065402.x7hlp2zncmnjyum7@pengutronix.de> <20201027035309.GI444962@dtor-ws> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8BIT In-Reply-To: <20201027035309.GI444962@dtor-ws> X-Sent-From: Pengutronix Hildesheim X-URL: http://www.pengutronix.de/ X-IRC: #ptxdist @freenode X-Accept-Language: de,en X-Accept-Content-Type: text/plain X-Uptime: 09:06:46 up 346 days, 23:25, 374 users, load average: 0.08, 0.04, 0.00 User-Agent: NeoMutt/20170113 (1.7.2) X-SA-Exim-Connect-IP: 2001:67c:670:100:1d::c5 X-SA-Exim-Mail-From: ore@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-kernel@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Oct 26, 2020 at 08:53:09PM -0700, Dmitry Torokhov wrote: > On Thu, Oct 22, 2020 at 08:54:02AM +0200, Oleksij Rempel wrote: > > On Wed, Oct 21, 2020 at 11:27:57AM -0700, Dmitry Torokhov wrote: > > > On Wed, Oct 21, 2020 at 12:56:14PM +0200, Oleksij Rempel wrote: > > > > > > > > As you can see, I would need to configure my dts with spi-cs-high flag, > > > > even if the hardware is actually ACTIVE_LOW. If I will go this way, I > > > > would risk a regression as soon as this issue is fixed. > > > > > > > > Since the spi framework is already parsing devicetree and set all needed > > > > flags, I assume it is wrong to blindly drop all this flags in the > > > > driver. > > > > > > Yes, but I wonder if the devices can only work in mode 0 we should be > > > doing: > > > > > > spi->mode &= ~SPI_MODE_MASK; // to be defined as 0x03 in spi.h > > > spi->mode |= SPI_MODE_0; > > > > > > as we can't simply "or" mode value as is > > > > Why not? This values are taken from device tree. If some developer > > decided to add them, then driver should take it over. Even if this > > values will break the functionality. > > > > Other properties of this driver will break the functionality too of this > > driver too, so why should we silently filter only set of this bits? > > What I was trying to say is that if driver wants to set mode to > particular value it should not "or" the value, as it will not reset the > relevant bits. I.e. if there some undesirable data in spi->mode mode > bits it will not get set properly by essentially doing "spi->mode |= 0". > That is why I said the driver needs to clear mode bits and set them to > the desired mode. Ok, i'll update this patch as you suggested. Regards, Oleksij -- Pengutronix e.K. | | Steuerwalder Str. 21 | http://www.pengutronix.de/ | 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |