Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp2246151rwl; Thu, 6 Apr 2023 07:44:55 -0700 (PDT) X-Google-Smtp-Source: AKy350ZcBSTdpfRE0o8HbCviG/MiGpVDryXCmj79WnVn0WdF2P4hhzSOYT2scVLBSXTA32hbUTNM X-Received: by 2002:aa7:de19:0:b0:4fc:535c:3aa1 with SMTP id h25-20020aa7de19000000b004fc535c3aa1mr5161077edv.10.1680792295599; Thu, 06 Apr 2023 07:44:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680792295; cv=none; d=google.com; s=arc-20160816; b=lFB7JNik4BH+3OxFzojjq1iFcY/AzOW2lJltc2tz5RZUYo3TjxE0Tfr2STo4EXlbXT f5WUSpj/N/3IDjsqtPIvB9LtgRXglcetYhhDsShTNfleJX7uWgg9pVy9dYQsHpyppWwm J6yj2GiZO37w0O4Zv4lzQWsUA/t6Luy/PSnJ6XKXxXu9uXnKxhdLl1pAaEcdM5/cOjq3 W6XH7DW3lC5+KXlIB+sMDbgBJSFZmB1mLTpSm2J/UkTLsw+Q7EXRWOuSHYlmOU/7r98c TFDLmZPO4wsZtDm9gC5gBCcwnQ96Jw8CpAnCmUBCQm9+wYsXO92Ota4dlcVMozD7kGxT BAXQ== 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:cc:to:from:dkim-signature; bh=haQfQLtIHX3AMbhEtmhPzNtAxG8NcBrSOSgfDzvgaZY=; b=EcHttgGsQsuYjY1UFZye2eOn2xS7vjGJjHMIBZ+92ijovsQliWxGyvRbrutmweSFiz ecp1S8/T5R+sP55U6TpVUwl2ORSCL2kYyD4BOmwbpGSTyuBCK1j767OTyZtzBlncGPK2 PiRSKjdjm9SYa5cHYkw9Z6F2AvEpFkwFQI4VESUdCnpzjzIegpa0qFWFjt4/sUoNWYiq bQ7UaHQLyJY+OVogLbhyIoHj4nmgcRuKNvtitLZReGV3PZyxP+9WZUB6Xn6K4FaAOkMe MLdLvqC9Ax5M8mNWrMiCxFgZ9ntkEYsIzL70ClZ1DNUSrS4TiSmpe4YlcSJxhEGfy5Bt HI7A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=F3Pny9qK; 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=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id t26-20020a05640203da00b004c1bfa5adf8si1314662edw.611.2023.04.06.07.44.30; Thu, 06 Apr 2023 07:44:55 -0700 (PDT) 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=@linaro.org header.s=google header.b=F3Pny9qK; 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=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238446AbjDFOm1 (ORCPT + 99 others); Thu, 6 Apr 2023 10:42:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43156 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238037AbjDFOmG (ORCPT ); Thu, 6 Apr 2023 10:42:06 -0400 Received: from mail-oi1-x230.google.com (mail-oi1-x230.google.com [IPv6:2607:f8b0:4864:20::230]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 83EEFB757 for ; Thu, 6 Apr 2023 07:40:33 -0700 (PDT) Received: by mail-oi1-x230.google.com with SMTP id w133so29220315oib.1 for ; Thu, 06 Apr 2023 07:40:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1680792033; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=haQfQLtIHX3AMbhEtmhPzNtAxG8NcBrSOSgfDzvgaZY=; b=F3Pny9qKyanQubI7PdZw9QaNyLe7fQBOJpafO6/1MP6WO9qK8J764Dz1ugy4uiUt+Y J6DhtffYYSyxZjEqblmuzrAEFhyM7I9h66VXSxGlu8GlU+AGzegBnNH88A9hO+3jneGS n/bmxHJ1Y9s/Q1i7PsIlgY1+DC49LBNpCtZ/CcQqDkSYkY6RckBpnSLH+0cSQkfilidO 03fzOTVcyQkou7OrImqXWBRQev3FnX34TMphjc1hUPqEeldktCYsPTI+qM3+b4FgF+gQ Zn7o7M1weH0i1P72NDArqhDujrnobGXt/rxWvAyf9kU7/dHeuaUxn84C3XbbHKnXXEXH 8Xjg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680792033; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=haQfQLtIHX3AMbhEtmhPzNtAxG8NcBrSOSgfDzvgaZY=; b=HsyYElCEFlGRkRq1J5/Ix0PksuzRVbhKbtFGu8KyC69tbkJ55W3X39mxlHiaWxKPLG lhyTHHe5gNSM2QszTCaewr2WSgGtdgVy9WuZv9q0Vi05Z+5I+l7yUVjpIp08YWqbMjwR 3fzV+rqzwPE0zvh2qGo9tSvGssIVFFv0bMMdlooh+yEa0H+LbigMYBDApuX8mUC5zgcY McMrm+jeku124h095cKzU/D0wXy5w7deU7d8nAT3guY2Hbj3ZWOCP/SUzaGZ+Vu6MPos gUs5Yqv/9474iQ8yBn3dNuy5jMC5YFKk1dCSIGqibAwDGAX+p238p1hdMAWrN38Hivxr FHkQ== X-Gm-Message-State: AAQBX9eYI9EZ7pmx1zKVdEb2cJnFmp6bVDT/MSL/LChwcX00HZhdhM3C etrLqTosUGNZJHrWEWrBTbarwA== X-Received: by 2002:aca:c0c1:0:b0:389:6b33:fe9e with SMTP id q184-20020acac0c1000000b003896b33fe9emr3282758oif.58.1680792032654; Thu, 06 Apr 2023 07:40:32 -0700 (PDT) Received: from fedora.attlocal.net (69-109-179-158.lightspeed.dybhfl.sbcglobal.net. [69.109.179.158]) by smtp.gmail.com with ESMTPSA id q7-20020acaf207000000b0037d7f4eb7e8sm726209oih.31.2023.04.06.07.40.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Apr 2023 07:40:32 -0700 (PDT) From: William Breathitt Gray To: Jonathan Cameron , Lars-Peter Clausen Cc: linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org, Andy Shevchenko , William Breathitt Gray Subject: [PATCH v5 0/6] Migrate STX104 to the regmap API Date: Thu, 6 Apr 2023 10:40:09 -0400 Message-Id: X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-0.2 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,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 Changes in v5: - Explicitly check for negative val for IIO_CHAN_INFO_RAW case in stx104_write_raw(); this avoids the explicit case previously used - Use U16_MAX rather than hardcoding unsigned 16-bit maximum value - Improve ADC conversion comment format and use proper SI units format Changes in v4: - Fix race conditions in stx104_read_raw() and stx104_write_raw() by utilizing a mutex - Improve indentation in stx104_write_raw() by bailing out early if chan->output is false in for the IIO_CHAN_INFO_RAW case - Remove regmap_config max_register lines as superfluous - Utilize BIT() for gain calculation in stx104_read_raw() Changes in v3: - Add STX104_ prefixes to defines to avoid potential name classes - Rename SAME_CHANNEL() to STX104_SINGLE_CHANNEL() to convey intention better - Utilize u8_encode_bits() to define STX104_SOFTWARE_TRIGGER - Adjust to utilize reg_base members in regmap_config structures - Fix off-by-one errors in aio_data_wr_ranges[], aio_data_rd_ranges[], and aio_data_regmap_config max_register - Inline gpio_config initialization to avoid zeroing it at declaration - Add blank lines between register map init blocks for clarity - Utilize regmap_read_poll_timeout() for ADC conversion status poll Changes in v2: - Relocate struct stx104_iio for the sake of a clearer patch diff - Replace FIELD_PREP() and FIELD_GET() with u8_encode_bits() and u8_get_bits() The regmap API supports IO port accessors so we can take advantage of regmap abstractions rather than handling access to the device registers directly in the driver. To make the git history cleaner, precursor patches to use a define rather than hardcoded limit and to improve indentation in stx104_write_raw(), and a follow-up patch to utilize regmap_read_poll_timeout() for polling the ADC conversion status are included. William Breathitt Gray (6): iio: addac: stx104: Fix race condition for stx104_write_raw() iio: addac: stx104: Fix race condition when converting analog-to-digital iio: addac: stx104: Use define rather than hardcoded limit for write val iio: addac: stx104: Improve indentation in stx104_write_raw() iio: addac: stx104: Migrate to the regmap API iio: addac: stx104: Use regmap_read_poll_timeout() for conversion poll drivers/iio/addac/Kconfig | 2 + drivers/iio/addac/stx104.c | 460 +++++++++++++++++++++---------------- 2 files changed, 264 insertions(+), 198 deletions(-) base-commit: f73df43e957a6fc705a9bd6d143585bdf1b13365 -- 2.39.2