Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp1001050rwd; Tue, 13 Jun 2023 03:31:03 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6008G/BI32lbArJh34g454IJksClzoDxiknSSs9yMxseofV3pZr2HYhAaINypkCY/QdzSO X-Received: by 2002:a17:907:1c88:b0:96f:1629:3e9a with SMTP id nb8-20020a1709071c8800b0096f16293e9amr12809555ejc.34.1686652263128; Tue, 13 Jun 2023 03:31:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686652263; cv=none; d=google.com; s=arc-20160816; b=z3cV4qbFu5heNZTkiTh/NSQprMLtMGh2uv2lx9PCyCP/LxBxvPhxh0qFSRBKf+T98O PMRVVu4PnpEQiQuY/axK39qvF3lTdbo4Qsn9VAnCvZfdvG/8o4i26OtUhEXIN7V5bkNe Bqgbr4ACTZ0HXuIul4uMefHiUuwcFeb8irkpoIcY/MchkJxSe6+BPYF6RfzKPTkcO639 JIskqbkRvYBqcLIH/79xkAVB3ov9hIgQwPcreIy/ttQb85SJ5NE5seuBoYCRKUT16/qi G5UBwyS51apg+uzmS55ZdHh7QZ1XsooRBVVJLvpv7WhOv7FfN5EJASfZ3foQyjw9hInV zXAA== 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=EUCnj0ZPld4vqxanptYEvW6XmMYghvfI8oxWwI+FpaU=; b=t2g7UhmT6pcEOgL/icHFVDvIWPC//S2U8Q2dlArL1DdNrtdebAwbT1tcjtLkXxv05/ WCM6b3zBTplQH1PzLZmxJ1y9RkcRnC6PZpm6ueQWW6iWjjRbUK42sOEbceKy053icUul YFQ91tYgsst2eV9Ev76TSmE5wEb+WxSb3qSF03FYN4vdnN4g8qSoENo7UYVtg6EmxbpQ Z+WMfJpbnS3hSpCYHwCv3PITvhLrBkgd2mVBcydBJwTNfNyxcH6B9JHtMLDf59MHdTAv HR1mH57/vox22WfMmkrrbhGpOBBwgy+dMMVHC8GHzRFa9NwFc2OTnAR87KgY2U625Lee tt9A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=U4GmKt5d; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id jw20-20020a17090776b400b00977c8b82fa4si7359866ejc.894.2023.06.13.03.30.38; Tue, 13 Jun 2023 03:31:03 -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=@gmail.com header.s=20221208 header.b=U4GmKt5d; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239434AbjFMKXa (ORCPT + 99 others); Tue, 13 Jun 2023 06:23:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52108 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241027AbjFMKWw (ORCPT ); Tue, 13 Jun 2023 06:22:52 -0400 Received: from mail-ej1-x62e.google.com (mail-ej1-x62e.google.com [IPv6:2a00:1450:4864:20::62e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 78B861727; Tue, 13 Jun 2023 03:22:51 -0700 (PDT) Received: by mail-ej1-x62e.google.com with SMTP id a640c23a62f3a-97454836448so760734466b.2; Tue, 13 Jun 2023 03:22:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1686651770; x=1689243770; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=EUCnj0ZPld4vqxanptYEvW6XmMYghvfI8oxWwI+FpaU=; b=U4GmKt5dlbIp5dn+6ShMpUaKUDy5rHVKJ1V/NRI43IKoPBhCorzEe9s25aOh/7Mr+U m1RC3Cu3H5NwJ8XvTNDn7lByCet06z8Vhqga/i+MQtmfFCLPc5K+1RNywHB1A8zR5nmc mwzeBIEdqMkBaSzDY5wXSSrToxuSZyAJaDQ3aBW/GxEfxy3znUdlkYpmVdD1j2GJqVMP jAt71mr7oWPvU7jKz+3q/PpE82ywjeB0J1EcnJSyZ4QvnqKbmoaOFhEl59uTfWsh1x5+ +MSTXrJVtf3DZBgxyEIHK6kl3Di9lIlAMEUXbl/L2on1o/EL5a2UhVNyKUZ7qnTsWdlA KQQA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686651770; x=1689243770; 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=EUCnj0ZPld4vqxanptYEvW6XmMYghvfI8oxWwI+FpaU=; b=LuxDbGabffM+z/Ofwvt8hJ5iTxCdGOyYty72Nwe8Wsp7Uh93Z9Nf2KNUdeEL+4tn1+ iioTGnusNIzWCzCKQG7WbN/Lp1Tzh+AnorTN6yLU8cVxzx8y7f48Q/mXbR7v2Eg2TIkF KTVZjU7wS4RIDKEWrYg8ZyqD4yQgAAN5BAyL9kxWXbfmDlX+d5o9O2gI39MgbxYqXjH0 lH0okrwR24T6X2XQLfNyKuZYz0U3vxVy1adDfq5laJjJ+1dixYNN0HNe9ww3nrlRgiIB BIWL9BnASX/iDTTyzZKPLTG7aTc/NeXGKm27GnXlw4UZNom9bMNPZwsGV0OdW43EIyxs f1Gg== X-Gm-Message-State: AC+VfDymQMoEycejjbJdToH00phl01UyBe2TOe8OYU+JLgjWkvr41YPk 8ulg2Uk0c7IcMugxhobOKk4= X-Received: by 2002:a17:907:6d08:b0:978:992e:efc4 with SMTP id sa8-20020a1709076d0800b00978992eefc4mr11081904ejc.8.1686651769678; Tue, 13 Jun 2023 03:22:49 -0700 (PDT) Received: from localhost.localdomain ([2a02:8109:aa3f:ead8::298a]) by smtp.gmail.com with ESMTPSA id b7-20020a170906038700b009787b18c253sm6492493eja.181.2023.06.13.03.22.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 13 Jun 2023 03:22:49 -0700 (PDT) From: Mehdi Djait To: jic23@kernel.org, mazziesaccount@gmail.com Cc: krzysztof.kozlowski+dt@linaro.org, andriy.shevchenko@linux.intel.com, robh+dt@kernel.org, lars@metafoo.de, linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, Mehdi Djait Subject: [PATCH v6 0/7] iio: accel: Add support for Kionix/ROHM KX132-1211 accelerometer Date: Tue, 13 Jun 2023 12:22:33 +0200 Message-Id: X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham 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 Hello everyone, Version 6 for adding support for the kx132-1211 accelerometer KX132-1211 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) The KX132-1211 accelerometer is very similar to the KX022A. One key difference is number of bits to report the number of data bytes that have been stored in the buffer: 8 bits for KX022A vs 10 bits for KX132-1211. Changes in v6: - check for availability of chip_info for the SPI case - changed the order of elements in the kx022a_data struct to save memory Changes in v5: - moved the "kfree" call to match the reverse of what happens in kx022a_fifo_enable() as suggested by Matti and Jonathan - used min_t, checked for availability of chip_info and moved the position of u16 buf_smp_lvl_mask as suggested by Andy - introduced buf_smp_lvl_mask in Patch 7 as suggested by Jonathan Changes in v4: - moved the allocation of the fifo_buffer to kx022a_fifo_enable and kx022a_fifo_disable - some fixes to the regmap ranges of kx132-1211 Changes in v3: - added two new patches by separating the addition of the i2c_device_id table and the removal of blank lines from other unrelated changes - fixes a warning detected by the kernel test robot - made all the changes related the chip_info in one patch Changes in v2: - added a new patch for warning when the device_id match fails in the probe function - added a new patch for the function that retrieves the number of bytes in the buffer - added a change to the Kconfig file in the patch adding the support for the kx132-1211 - various fixes and modifications listed under each patch Mehdi Djait (7): dt-bindings: iio: Add KX132-1211 accelerometer iio: accel: kionix-kx022a: Remove blank lines iio: accel: kionix-kx022a: Warn on failed matches and assume compatibility iio: accel: kionix-kx022a: Add an i2c_device_id table iio: accel: kionix-kx022a: Refactor driver and add chip_info structure iio: accel: kionix-kx022a: Add a function to retrieve number of bytes in buffer iio: accel: Add support for Kionix/ROHM KX132-1211 accelerometer .../bindings/iio/accel/kionix,kx022a.yaml | 12 +- drivers/iio/accel/Kconfig | 8 +- drivers/iio/accel/kionix-kx022a-i2c.c | 24 +- drivers/iio/accel/kionix-kx022a-spi.c | 15 +- drivers/iio/accel/kionix-kx022a.c | 312 ++++++++++++++---- drivers/iio/accel/kionix-kx022a.h | 110 +++++- 6 files changed, 406 insertions(+), 75 deletions(-) -- 2.30.2