Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp473986pxj; Fri, 14 May 2021 08:00:23 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwdjMNn27+rg7GZDbYegVQ2a73qrg6WhgzbBUK+xdnYWnZ2Bp7O66yhbSPPw3xkue9uL0c/ X-Received: by 2002:a05:6402:22af:: with SMTP id cx15mr57157994edb.317.1621004423614; Fri, 14 May 2021 08:00:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621004423; cv=none; d=google.com; s=arc-20160816; b=qFAuVgPmudCTQikwbOQZmnr1Qok+qY1GaQzCHUF9hDc527it/2ztyepXAGUiv72zbb HTOlqk+tKcD62PYGvdM8BJOzFiqCxqeU5CL4NzMWbxqeN+ZkQg9ytELHzFGuxcEnT+V5 ke86O8/kpaR9eVZN6AJp1AOO9gsIVpLZ5b4zb1KkoVSPSIAhKoabti/2yEaQzd+w5HrD KxmA4WrcYcUl+7c9TPCcy9KNcUX1rvOqxDOdkrfuyPwkKGMFmpWD5vbndh55qn3huHxN nDLJAXEzCSxQexWzwNhCFdBp7TXtIeRyk/sNOo6yGJMQeR3cug17mmpCo7Un+HkYOv62 uUdA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :organization:references:in-reply-to:message-id:subject:cc:to:from :date; bh=4UN5LZLfEynSIz7BXxr9vvwXIxk+0yD9m/2sHVA2btM=; b=y1QVVpMbHTHcaLkElFgpILJn71gPt2qqZIEzDpglekatOACch8TGeLKmqCeOKORwxo QjA2axH6P4lQXRcmnlzd7uefyrpyR3/KGqoCGgpDKE9p3peN3vCpK1PfNfR+FBiQG4vp aHMZ6aBbzgmOExxds3+2VqiYcukRrs09JV6krkDV0EbqF7GZ49oCdX+g5rFFDeV/TYvv l2qPOAbhrR+tApci6mftUTNrI9qzh6gVLuPUjevoQTUjlbYLbI0e48jm7A69t9XPhQ8z 3Y3f/BnGn08gVMrIdt3ZwdhRt1hh7zkqm+B8XOFyO1w3a0Oda3rI7g/2PEiFePjRrOiA t3Gg== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=huawei.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id i3si6572683ejp.610.2021.05.14.07.59.56; Fri, 14 May 2021 08:00:23 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233404AbhENISb (ORCPT + 99 others); Fri, 14 May 2021 04:18:31 -0400 Received: from szxga04-in.huawei.com ([45.249.212.190]:3758 "EHLO szxga04-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229654AbhENIS1 (ORCPT ); Fri, 14 May 2021 04:18:27 -0400 Received: from dggems705-chm.china.huawei.com (unknown [172.30.72.58]) by szxga04-in.huawei.com (SkyGuard) with ESMTP id 4FhLrt2vd4zqTrp; Fri, 14 May 2021 16:13:50 +0800 (CST) Received: from lhreml710-chm.china.huawei.com (10.201.108.61) by dggems705-chm.china.huawei.com (10.3.19.182) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.2; Fri, 14 May 2021 16:17:14 +0800 Received: from localhost (10.52.120.239) by lhreml710-chm.china.huawei.com (10.201.108.61) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.1.2176.2; Fri, 14 May 2021 09:17:07 +0100 Date: Fri, 14 May 2021 09:15:20 +0100 From: Jonathan Cameron To: Oleksij Rempel CC: Jonathan Cameron , Rob Herring , , , "Pengutronix Kernel Team" , David Jander , "Robin van der Gracht" , , "Lars-Peter Clausen" , Peter Meerwald-Stadler , "Dmitry Torokhov" Subject: Re: [PATCH v6 0/3] mainline ti tsc2046 adc driver Message-ID: <20210514091520.00004930@Huawei.com> In-Reply-To: <20210514075731.ipxq2o4cdxd3piu3@pengutronix.de> References: <20210428073208.19570-1-o.rempel@pengutronix.de> <20210503122818.59f50e45@jic23-huawei> <20210514075731.ipxq2o4cdxd3piu3@pengutronix.de> Organization: Huawei Technologies Research and Development (UK) Ltd. X-Mailer: Claws Mail 3.17.8 (GTK+ 2.24.33; i686-w64-mingw32) MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit X-Originating-IP: [10.52.120.239] X-ClientProxiedBy: lhreml706-chm.china.huawei.com (10.201.108.55) To lhreml710-chm.china.huawei.com (10.201.108.61) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 14 May 2021 09:57:31 +0200 Oleksij Rempel wrote: > Hi Jonathan, > > On Mon, May 03, 2021 at 12:28:18PM +0100, Jonathan Cameron wrote: > > On Wed, 28 Apr 2021 09:32:05 +0200 > > Oleksij Rempel wrote: > > > > Hi Oleksij, > > > > Series applied with the tweaks as per review to patch 3. Please > > check I didn't mess those up though. > > > > Applied to the togreg branch of iio.git and pushed out as testing for > > the autobuilders to poke at it. > > It works. Thx! > > Now i need to make configurable iio buffer layout > > for the drivers/input/touchscreen/resistive-adc-touch.c > > Do you have ideas what is the proper way to make it? So IIRC the issue here was making the ordering of the channels more flexible? We should be able to do that using the names in DT. Right now the touch screen driver just grabs them all an assumes a particular order, but if you look at the binding it requires naming https://elixir.bootlin.com/linux/latest/source/Documentation/devicetree/bindings/input/touchscreen/resistive-adc-touch.txt That naming should associate 'which channel' is which when we then do the get_all() in the driver. If it matches the existing layout, nothing to do, but if we have something more complex then we can do data shuffling etc in the touchscreen driver to compensate for that. A useful starting point is probably to do a yaml conversion of that binding doc. Then follow that up by making the doc more flexible so that it copes with what you want to do. That should give us a good basis on which to then implement the handling in driver (which is often easier than defining the binding!) Jonathan > > Regards, > Oleksij > > > > > Jonathan > > > > > changes v6: > > > - get blessing from Dmitry Torokhov > > > - rebase against latest iio/testing > > > - use simple name for iio_dev->name > > > - use Jonathan's version for oversampling-ratio description > > > > > > changes v5: > > > - remove type for the settling-time-us property > > > > > > changes v4: > > > - spell fixes > > > - add more comments > > > - make code more readable > > > - move scan_buf to the priv > > > - use FIELD_GET to extract ADC data > > > - make some multi line code as one line > > > - do not use atomic API for trig_more_count > > > - fix build warning on 64bit system > > > - add NULL check for the devm_kasprintf() > > > - use return devm_iio_device_register(), without additional error > > > printing. > > > > > > changes v3: > > > - different spell fixes > > > - add some notes about driver structure > > > - rename the trigger to point on the touchscreen nature of it > > > - rename DT binding to oversampling-ratio > > > - make sure we have some defaults in case no DT property is set > > > > > > changes v2: > > > - rework and extend DT binding properties > > > - remove touchscreen related code from the IIO ADC driver > > > - make trigger be active longer then IRQ is requesting. This is needed > > > to get "inactive" samples > > > - make oversampling and settle time configurable > > > > > > TI TSC2046 is a touchscreen controller based on 8 channel ADC. Since most of > > > this ADC based touchscreen controller share same set of challenges, it > > > is better keep then as simple IIO ADC devices attached to a generic > > > resistive-adc-touch driver. > > > > > > This driver can replace drivers/input/touchscreen/ads7846.c and has > > > following advantages over it: > > > - less code to maintain > > > - shared code paths (resistive-adc-touch, iio-hwmon, etc) > > > - can be used as plain IIO ADC to investigate signaling issues or test > > > real capacity of the plates and attached low-pass filters > > > (or use the touchscreen as a microphone if you like ;) ) > > > > > > Oleksij Rempel (3): > > > dt-bindings:iio:adc: add generic settling-time-us and > > > oversampling-ratio channel properties > > > dt-bindings:iio:adc: add documentation for TI TSC2046 controller > > > iio: adc: add ADC driver for the TI TSC2046 controller > > > > > > .../devicetree/bindings/iio/adc/adc.yaml | 12 + > > > .../bindings/iio/adc/ti,tsc2046.yaml | 115 +++ > > > MAINTAINERS | 8 + > > > drivers/iio/adc/Kconfig | 12 + > > > drivers/iio/adc/Makefile | 1 + > > > drivers/iio/adc/ti-tsc2046.c | 720 ++++++++++++++++++ > > > 6 files changed, 868 insertions(+) > > > create mode 100644 Documentation/devicetree/bindings/iio/adc/ti,tsc2046.yaml > > > create mode 100644 drivers/iio/adc/ti-tsc2046.c > > > > > > > >