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: 13040173 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A542BC4332F for ; Fri, 11 Nov 2022 11:28:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232341AbiKKL17 (ORCPT ); Fri, 11 Nov 2022 06:27:59 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39152 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231681AbiKKL16 (ORCPT ); Fri, 11 Nov 2022 06:27:58 -0500 Received: from dhl.lxnav.com (dhl.lxnav.com [168.119.248.164]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3E5D363150 for ; Fri, 11 Nov 2022 03:27:57 -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 Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org 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(-)