From patchwork Thu Oct 6 14:35:51 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matti Vaittinen X-Patchwork-Id: 13000441 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 98B8EC433F5 for ; Thu, 6 Oct 2022 14:36:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230435AbiJFOgb (ORCPT ); Thu, 6 Oct 2022 10:36:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60166 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229675AbiJFOg3 (ORCPT ); Thu, 6 Oct 2022 10:36:29 -0400 Received: from mail-lf1-x12f.google.com (mail-lf1-x12f.google.com [IPv6:2a00:1450:4864:20::12f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5C3EA8321A; Thu, 6 Oct 2022 07:36:28 -0700 (PDT) Received: by mail-lf1-x12f.google.com with SMTP id f37so2989207lfv.8; Thu, 06 Oct 2022 07:36:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-disposition:mime-version:message-id:subject:cc:to:from:date :from:to:cc:subject:date; bh=0LJXSAjlHYI55JFfwv9jIlyOz6bdbyg6pzb/vBLLAuQ=; b=it6nQNjj6nwzVKrb6vdVfbDEgN/Sh75cV7D4H+Md/7z1ErKQ2ctHRwpgeoLRXo3zHI x5yZT7jiLhjRXRFZQMn7jxXDL6pZstwIwqNTBDv1zsfAAiR0EkS3q75+bqXflso77YAg k+dj06ZohaOn8qxz+0IDc4khCVLZlfyOFyVu9GPLtBodv94RlzrmLnw7W4vs7noF384I nk7yIL1QOU+aJoCwzTX0aINY9xVPbBFPXMJJzRm4DCgITqcwEyinLGO9bzJWyg5GwJlC sVYBHZvluhOMnMtJcXo5qvSTmQdZGtu2gG5Xnnvaktt5xJfof3/MoO4QdbFUH17NL3Xk 4iRQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-disposition:mime-version:message-id:subject:cc:to:from:date :x-gm-message-state:from:to:cc:subject:date; bh=0LJXSAjlHYI55JFfwv9jIlyOz6bdbyg6pzb/vBLLAuQ=; b=IW61gWjKZoQzdNeDpSUodu1jg5VKRHhJEn1G476u6+4frVywLbvzfJsDVnKylh0Yda HpNkgNajO7dqGbGegqe3uE4J5mzj/W+ND7ODAsyeMluRcFCM0SBCl2pp5n4fCMYqx0bq hykIOp4AUM1hEP5WlUUiG8Ixn2O3bFewj4r4U2qlPu7dkp5OHX6Hm5ybWUrBA20w3VC2 2jkqNp7bqPOk2BN7TI+lL5tlmLLGpH9Sly78GGOwk6sifCFdJVxdFz9mUQA19URxw9ZH sMaGFgZoL/H7ts+vlt0PxFQezEmiT0UCjlbSdSbQchV0LxttlaHkJoYAkqjgKuy/MWRh MJpQ== X-Gm-Message-State: ACrzQf37XrkSzIjgWzU4ZXPcDud/zTbT9bd78IZW9lfJ6esSMISXkLFB 9QzOEgfyyRQ+SRoKwb5LHU4= X-Google-Smtp-Source: AMsMyM5hZz4rcnE9KS/Vf4honsSr9PBWYwEHs7zy/SU9UJUqDfBq8mcApoutvCkeYne/j/2eX0pASA== X-Received: by 2002:a05:6512:110f:b0:4a2:697f:c39a with SMTP id l15-20020a056512110f00b004a2697fc39amr80467lfg.685.1665066986544; Thu, 06 Oct 2022 07:36:26 -0700 (PDT) Received: from dc75zzyyyyyyyyyyyyyyt-3.rev.dnainternet.fi (dc75zzyyyyyyyyyyyyyyt-3.rev.dnainternet.fi. [2001:14ba:16f3:4a00::1]) by smtp.gmail.com with ESMTPSA id a18-20020a05651c031200b0026c5579c64csm1918271ljp.89.2022.10.06.07.36.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Oct 2022 07:36:25 -0700 (PDT) Date: Thu, 6 Oct 2022 17:35:51 +0300 From: Matti Vaittinen To: Matti Vaittinen , Matti Vaittinen Cc: Jonathan Cameron , Lars-Peter Clausen , Rob Herring , Krzysztof Kozlowski , Matti Vaittinen , Andy Shevchenko , Jagath Jog J , Nikita Yushchenko , Cosmin Tanislav , linux-iio@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [RFC PATCH v2 0/5] iio: Support ROHM/Kionix kx022a Message-ID: MIME-Version: 1.0 Content-Disposition: inline Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org Add initial support for ROHM/Kionix kx022a accelerometer This series is not ready for being merged as such. The first two patches in the series (the new regulator devm interfaces) are already merged to Mark's tree but have not yet found their way to the mainline. This is the reason I marked series as RFC. You can also skip the reviewing of first two patches as they are there just to make the series compile on top of the v6.0-rc7. I will re-spin the series without the patches 0001 and 0002 and drop the RFC tag when the v6.1-rc1 is out. About the HW: KX022A accelerometer is a sensor which: - supports G-ranges of (+/-) 2, 4, 8, and 16G - can be connected to I2C or SPI - has internal HW FIFO buffer - supports various ODRs (output data rates) - support detecting special events like double tap or motion - can be configured to wake-up system when events are detected. About the series: This series adds support for only getting the accelerometer data and configuring the G-range / ODR via IIO. Motion detection or double-tap detection are not supported by the series. The other quite important but still missing piece is the runtime PM. Nevertheless, the driver should be usable and brings the basic support for getting accelerometer data. Changelog v2: (More detailed log in individual patches) - dt-bindings: fixed as suggested by Krzysztof - dt-bindings: support both INT1 and INT2 - KX022A: multiple fixes as suggested by Jonathan - fixed SPI driver after some testing --- Matti Vaittinen (5): regulator: Add devm helpers for get and enable regulator: Add devm helpers for get and enable dt-bindings: iio: Add KX022A accelerometer iio: accel: Support Kionix/ROHM KX022A accelerometer MAINTAINERS: Add KX022A maintainer entry .../bindings/iio/accel/kionix,kx022a.yaml | 67 + MAINTAINERS | 5 + drivers/iio/accel/Kconfig | 21 + drivers/iio/accel/Makefile | 3 + drivers/iio/accel/kionix-kx022a-i2c.c | 53 + drivers/iio/accel/kionix-kx022a-spi.c | 59 + drivers/iio/accel/kionix-kx022a.c | 1138 +++++++++++++++++ drivers/iio/accel/kionix-kx022a.h | 81 ++ drivers/regulator/devres.c | 164 +++ include/linux/regulator/consumer.h | 27 + 10 files changed, 1618 insertions(+) create mode 100644 Documentation/devicetree/bindings/iio/accel/kionix,kx022a.yaml create mode 100644 drivers/iio/accel/kionix-kx022a-i2c.c create mode 100644 drivers/iio/accel/kionix-kx022a-spi.c create mode 100644 drivers/iio/accel/kionix-kx022a.c create mode 100644 drivers/iio/accel/kionix-kx022a.h base-commit: f76349cf41451c5c42a99f18a9163377e4b364ff