From patchwork Fri Nov 11 11:26:52 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Mitja_=C5=A0pes?= X-Patchwork-Id: 1508 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp684668wru; Fri, 11 Nov 2022 03:30:21 -0800 (PST) X-Google-Smtp-Source: AA0mqf496GWXcWkNgMOL/aW0puUxKQWgEwcLjza77vhPdGAY589A/jP0t6L7tpB46v1067ca24DQ X-Received: by 2002:a63:481c:0:b0:470:514e:1f15 with SMTP id v28-20020a63481c000000b00470514e1f15mr1288205pga.358.1668166221411; Fri, 11 Nov 2022 03:30:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668166221; cv=none; d=google.com; s=arc-20160816; b=hLri4u3dq0FTPcbtaUhFaBgx9eAZu//yLh666mUWcFr6qqOGhYuGoOa9nhUeIyKxI8 9L2i+t7j9o7/lw6iptGmwrVfdmLp7i1qGc18lghyk5BmJGPsiOyiUTdmgJEMBfOuFq+J qQDU0PRAVrRlQWcbSnqNIcM0S0pc4SG2K2HawSrxBiUBIH127Yq/i3tS3m9cc8kgpkPi WruO5+1nN7M488S6Gws1/PvHSiPY2pd9a5+z0oCNCX6Aovh6igqVDhrZoYvEzds1aRum cR+BcvL5aPP2QG4MF+/LPFMsNqNgCjw32sAimWdvf8cyDy8D86B92wVYDu7jR1GCsNy/ ruBw== 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 :message-id:date:subject:to:from:dkim-signature; bh=ZVhcBWv5g++vNVOshFC8d1giINTc5zv0mibtU5uzEW4=; b=GYlvHtyBvDk2c5rx/T4i2arX5N61CVXgiyzH4g8Eh+THfm8cWaRarfWN+UDuTXjymm cYDrRi67IAnGuzlUPrHqZPu5nH/KUDj0c7No4DB2ShyTtkNTH7Bb7qekzeXTYCL1iStU ek9XofGI6nQSNKhuPoHTY0Ppo1gxJAol6YnSMu9ejNNCfnEDa75A+hRwPXajmi6tlf6Q li2RrCji//ZDPN8D2H9BDT9HGnxTmnLCBee9lSqyzBKph0utqafPqy1c9nwz1KOJZ3b6 7Yg9qlQTgocbqktAuouJ+eVzq3/DnecTpYXf7agdOgP2TVFscY8MRAvc82QNOML1GHoR O92w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lxnav.com header.s=dhl header.b=FkdTYr2r; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=lxnav.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w185-20020a6382c2000000b0045cbd4e43a1si2106792pgd.57.2022.11.11.03.30.07; Fri, 11 Nov 2022 03:30:21 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@lxnav.com header.s=dhl header.b=FkdTYr2r; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=lxnav.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233048AbiKKL2C (ORCPT + 99 others); Fri, 11 Nov 2022 06:28:02 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39164 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232004AbiKKL2B (ORCPT ); Fri, 11 Nov 2022 06:28:01 -0500 Received: from dhl.lxnav.com (dhl.lxnav.com [IPv6:2a01:4f8:c010:2f07::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5D09263150 for ; Fri, 11 Nov 2022 03:28:00 -0800 (PST) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id 1CE4D4070A; Fri, 11 Nov 2022 12:27:55 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=lxnav.com; s=dhl; t=1668166075; h=from:subject:date:message-id:to:mime-version: content-transfer-encoding; bh=ZVhcBWv5g++vNVOshFC8d1giINTc5zv0mibtU5uzEW4=; b=FkdTYr2rkOHQ4Dd4bwx5IJz4B5YoLsUtiapRqvDRTUp4s1+X9+0ENFeBjiNBAGalqatIf5 Xo+PiMQ1DdJb7gaLs9Vh+1TuHk1JaNUGqdkAuxSjJTCxuSiJ8g7jJoqcFVNlbhnifR///B 4Td7kOzm1yHERrGhRZCBm8itFfCdUujdd7gsYF7ioE2lwgjjkML187OBjwR+Jn/cBFo4Mu LXFk4tkHSZxAgoyJFWlzOXGsn9tx3Yi2F0Y97obye4qGDMME1nUmMkeMtcgKaTQ5GlodIS odWgrZ8P6WeVCpegYfpEv9CfKH9cCkBcoge4raFhRJmvf7pD6gcOu7JslLVxZw== From: Mitja Spes To: Jonathan Cameron , Lars-Peter Clausen , Mitja Spes , Angelo Compagnucci , linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 0/4] iio: adc: mcp3422 improvements Date: Fri, 11 Nov 2022 12:26:52 +0100 Message-Id: <20221111112657.1521307-1-mitja@lxnav.com> MIME-Version: 1.0 X-Last-TLS-Session-Version: TLSv1.3 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_PASS,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1749199063936512541?= X-GMAIL-MSGID: =?utf-8?q?1749199063936512541?= Fixes: * iio: adc: mcp3422: fix scale read bug Scale was always returned for the last read input instead of the specified channel. Improvements: * iio: adc: mcp3422: allow setting gain and sampling per channel Sampling was the same for all channels. This patch adds the ability to select different gain and sampling per channel. They can be set together via scale attribute. Sampling can be set also via the standalone attribute which is now per channel. This might be a breaking change for some. * iio: adc: mcp3422: add hardware gain attribute Setting via scale is cumbersome. This patch just adds a concise way to set the gain, since sampling can already be set separately. * iio: adc: mcp3422: reduce sleep for fast sampling rates msleep can produce a delay which is fi. 30ms off the mark. This patch uses usleep_range for the higher sampling rates. Mitja Spes (4): iio: adc: mcp3422: fix scale read bug iio: adc: mcp3422: allow setting gain and sampling per channel iio: adc: mcp3422: add hardware gain attribute iio: adc: mcp3422: reduce sleep for fast sampling rates drivers/iio/adc/mcp3422.c | 161 ++++++++++++++++++++++++-------------- 1 file changed, 103 insertions(+), 58 deletions(-)