From patchwork Thu Sep 21 14:19:26 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Lechner X-Patchwork-Id: 14361 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:172:b0:3f2:4152:657d with SMTP id h50csp5460472vqi; Fri, 22 Sep 2023 03:29:50 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEYlhN1PirTA+EqdlTWjWF5d+2DA5rBQCXVJe2UNayB2kVl0w0bOQi7b4amB0Sl7O58Jzt0 X-Received: by 2002:a17:903:230c:b0:1c3:8976:e821 with SMTP id d12-20020a170903230c00b001c38976e821mr8036864plh.15.1695378590638; Fri, 22 Sep 2023 03:29:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695378590; cv=none; d=google.com; s=arc-20160816; b=Wmqx2OMztPj1/GSbImtC3pVcakly/FnkpRV8W7tN4BCZS7wXC61ZPcsq1kz60rxInl V8smSSrhZPxteS3nUWhQ1aDaznjW7pdEIfGJlknw2lFkbaWEhfY4rK5hOkMhsOWchw36 gMt7yLDyxksBwWpK0XfHm+gF1xHyGNFN+8roqq9hD9Lmm7HLK452xliD+fmkWMOVEzjJ ZVOPXQXeBBrdyJ2A8VtPKP4L11pJQv2ufgP++ROsuLs3l3Z35vYvRyyS9+97bKPzbYxN H/RHVLPoYniVYVch0W810/GDpzYFMRXDEw1pYZYL7J36eyu3FXrULgM0Jyk4S2DK+5JS 2vNQ== 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=iwcSCZesHpouCmyM1x03gSJSlBimDoKKMQ92GEpbtM8=; fh=rOC7q8UJisRayejF6PsoKdRfRTtXVZOwgDCXOG0B/ws=; b=VFbN3CvBcD2OkbP4V4kOX3PEHbvOXYPwOBzNFAsTytKiGXqBpoHfltk2LtEBlHQ9MF Bz4MGjl4TD3EGdW21qW+4beA+lhxnrOq7cxJhH3RI7KVY8ABGw3DHF+CS0GCcqQgLZNg dKJ3m7zBMjXFJ1dzclGp5d7jIg3l/BrPAxOYz49IadGrYX0HBhTxiAKesQAiUHgqX1ZG bTHsf917zcaghB/Yr6XykKoV6kX9+zMl/Lisg/4p8SktKbIf0sfi5febxsib2BdTQRiJ f9nIga/JZdSDk/4HGt6nl9AlQtXQ7fW6Ix5gEJDZ/Y2kkT2IBHkXpJwS9Pa5FqKJO5Am NiIA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@baylibre-com.20230601.gappssmtp.com header.s=20230601 header.b="xz/CsYbc"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id le11-20020a170902fb0b00b001b9f55d28a2si3245847plb.205.2023.09.22.03.29.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Sep 2023 03:29:50 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@baylibre-com.20230601.gappssmtp.com header.s=20230601 header.b="xz/CsYbc"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id F15AE82A38E9; Thu, 21 Sep 2023 11:12:25 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229781AbjIUSLu (ORCPT + 29 others); Thu, 21 Sep 2023 14:11:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54266 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229797AbjIUSLP (ORCPT ); Thu, 21 Sep 2023 14:11:15 -0400 Received: from mail-lj1-x233.google.com (mail-lj1-x233.google.com [IPv6:2a00:1450:4864:20::233]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0CA7688AF5 for ; Thu, 21 Sep 2023 10:39:32 -0700 (PDT) Received: by mail-lj1-x233.google.com with SMTP id 38308e7fff4ca-2c131ddfc95so11279081fa.0 for ; Thu, 21 Sep 2023 10:39:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20230601.gappssmtp.com; s=20230601; t=1695317970; x=1695922770; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=iwcSCZesHpouCmyM1x03gSJSlBimDoKKMQ92GEpbtM8=; b=xz/CsYbcXOwsxy9WmPSpJWVz5tyr848KrseYwoMQgZuh9n+kQ5QGTso/ZPepu4wNBt GHkKSzPDmZagVeQycIKFT0FWgDYup7qaM4+Ww9FtAG/0rx032uhgMa9tX2bhojPbJRfv Jxjb4ZhPggDK+IIIIAN7QdLCxZEbeDNu9Xhc9uM+6/ASJ+/ubWL/KUriJMyz+WPFk0kV aPVoeu+Q3h0DPZLcU1+jDPB2uA4DNdK69uYpeAIz+n3dy3exuCa4cZVZnDwfUdS+WXat I/pRz+6yz+6cUUXNsPa3wrns80s6M1F4vCCg1WTSrBNImk+FJrIMBtydDiuZBdQC3NX1 x3LQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695317970; x=1695922770; 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=iwcSCZesHpouCmyM1x03gSJSlBimDoKKMQ92GEpbtM8=; b=Po7aCISAsK3LA7pHYpcsYC5HRzyF8sNIHtFnOux4SIH7JDobWQbtE8rdu7VKXvUkQW sy85Hz+C+QcGtwE/WJAnzMmXdJk4+hDGBo7QcHtRmjF/+EQ6qurhTcn9LCT7wF6zxPI3 MMqBvT+KFpm8di+UkhklKWKVVqbInKbPd7Gsp5xnvTlIFRRtA+zR+g8tiVumLxUT9KZP fm79P/UlUcCasG/VywmBdXFkB/Rw2WrYT3V2U1qJxjHjp84ZTJMsGJarG9Axyo06d4l8 07YnPUhTzJzewLgqbZ0XPxkDY0SQIpCm0T3zIAvq7Gvkudv31qYWPe/PsiNEkJmAy8a5 rMMA== X-Gm-Message-State: AOJu0Yyv+yE10Jx9hxb71R4/nCcGL1l1unoaCfir6oGZLH8K0xTGBWPo FzI5zjnI4oDrq7voa3HAKJB+aD5NunVdUhQOP12omA8W X-Received: by 2002:a05:6000:1752:b0:322:4892:17f with SMTP id m18-20020a056000175200b003224892017fmr922723wrf.7.1695306149946; Thu, 21 Sep 2023 07:22:29 -0700 (PDT) Received: from localhost.localdomain (abordeaux-655-1-129-86.w90-5.abo.wanadoo.fr. [90.5.10.86]) by smtp.gmail.com with ESMTPSA id n11-20020a5d4c4b000000b0031fbbe347ebsm1901426wrt.22.2023.09.21.07.22.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Sep 2023 07:22:29 -0700 (PDT) From: David Lechner To: linux-iio@vger.kernel.org, devicetree@vger.kernel.org, linux-staging@lists.linux.dev Cc: linux-kernel@vger.kernel.org, Jonathan Cameron , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Michael Hennerich , =?utf-8?q?Nuno_S=C3=A1?= , Axel Haslam , Philip Molloy , David Lechner Subject: [v2 00/19] iio: resolver: move ad2s1210 out of staging Date: Thu, 21 Sep 2023 09:19:26 -0500 Message-Id: <20230921141947.57784-1-dlechner@baylibre.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,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 X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Thu, 21 Sep 2023 11:12:26 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1777687734293669667 X-GMAIL-MSGID: 1777733300940528002 Changes since v1: * Address initial device tree patch feedback * Drop "iio: sysfs: add IIO_DEVICE_ATTR_NAMED_RW macro" (related cleanups also dropped for now, will address in a future series if needed) * Apply improvements as a series as patches to the staging driver. It is not quite ready for the move out of staging patch yet. This series has been tested on actual hardware using a EVAL-AD2S1210 evaluation board. (Note: not all device tree features have been implemented in the driver since the eval board doesn't support them out of the box. We plan to add them later if needed.) One thing left over from the staging driver that probably needs more attention still is the fault handling (both the fault threshold attributes and how userspace gets notified of fault conditions). We considered adding these as events, but the fault conditions are related to internal measurements in the chip that aren't available as channels. Since the chip is designed to read the fault register each time we read the data registers for one of the two channels it seems like faults should be associated with channels one way or another. Would it make sense to add extra channels for the internal signals that only have fault events (mostly with IIO_EV_TYPE_THRESH)? Or would it make sense to add a new "flags" channel type where the "raw" value is bit flags? Or something else? Here is the table of available faults for context. Sine/cosine inputs are internal signals. | Bit | Description +-----+------------ | D7 | Sine/cosine inputs clipped | D6 | Sine/cosine inputs below LOS threshold | D5 | Sine/cosine inputs exceed DOS overrange threshold | D4 | Sine/cosine inputs exceed DOS mismatch threshold | D3 | Tracking error exceeds LOT threshold | D2 | Velocity exceeds maximum tracking rate | D1 | Phase error exceeds phase lock range | D0 | Configuration parity error David Lechner (19): dt-bindings: iio: resolver: add devicetree bindings for ad2s1210 staging: iio: Documentation: document IIO resolver AD2S1210 sysfs attributes staging: iio: resolver: ad2s1210: fix ad2s1210_show_fault staging: iio: resolver: ad2s1210: fix not restoring sample gpio in channel read staging: iio: resolver: ad2s1210: fix probe staging: iio: resolver: ad2s1210: always use 16-bit value for raw read staging: iio: resolver: ad2s1210: implement IIO_CHAN_INFO_SCALE staging: iio: resolver: ad2s1210: use devicetree to get fclkin staging: iio: resolver: ad2s1210: use regmap for config registers staging: iio: resolver: ad2s1210: add debugfs reg access staging: iio: resolver: ad2s1210: remove config attribute staging: iio: resolver: ad2s1210: rework gpios staging: iio: resolver: ad2s1210: implement hysteresis as channel attr staging: iio: resolver: ad2s1210: refactor setting excitation frequency staging: iio: resolver: ad2s1210: read excitation frequency from control register staging: iio: resolver: ad2s1210: rename fexcit attribute staging: iio: resolver: ad2s1210: convert resolution to devicetree property staging: iio: resolver: ad2s1210: add phase_lock_range attributes staging: iio: resolver: ad2s1210: add triggered buffer support .../bindings/iio/resolver/adi,ad2s1210.yaml | 150 +++ .../sysfs-bus-iio-resolver-ad2s1210 | 109 ++ drivers/staging/iio/resolver/Kconfig | 1 + drivers/staging/iio/resolver/ad2s1210.c | 948 +++++++++++------- 4 files changed, 857 insertions(+), 351 deletions(-) create mode 100644 Documentation/devicetree/bindings/iio/resolver/adi,ad2s1210.yaml create mode 100644 drivers/staging/iio/Documentation/sysfs-bus-iio-resolver-ad2s1210