From patchwork Fri Sep 15 06:55:07 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matti Vaittinen X-Patchwork-Id: 14051 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:172:b0:3f2:4152:657d with SMTP id h50csp1135563vqi; Fri, 15 Sep 2023 08:37:31 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGP6aaTtHNGJByofd74HCKhOJVFnHda+X27cNynraO7hyVISr8+ePzcLd/LuzZuiyXj8Agr X-Received: by 2002:a05:6a00:10c3:b0:690:3a0f:4165 with SMTP id d3-20020a056a0010c300b006903a0f4165mr2350727pfu.32.1694792250975; Fri, 15 Sep 2023 08:37:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694792250; cv=none; d=google.com; s=arc-20160816; b=S+d8/+5/5D0/zJASj/LHoFKy+OI0TaQoJXxci74T4fuW5Ll+bZdBv00x8BgP46SawX bKvHB8Le3n3uATbZiLwLV53Q8siAwXfMwyGyvo6F7Mauc2r6wEm17t8AF/WNjet6IBdR eDTAhC2wbdnernfz+e7g6YYQngjZCiZBTQnuaTCaJbSvr2b0VbeFKO1hlQSP7YrACMFG EXaPMGfe8g3hpmDj21ueDNEKUv4tCWVFsPEuxNWrhJsL5ebIZW19dvUoWNDOrv5Nqoaw hHujKSZaQtjYgnhjObGbhMmKMztazvb8IeImPiGGG6H6uxO7WP9dvxK85b50tnqRfVgX mT9A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-disposition:mime-version:message-id :subject:cc:to:from:date:dkim-signature; bh=wLUQAZI1IJf0z26Sa3mrW7ObnZWoziopCsj/BOvrL+A=; fh=WDLteMbz/nUBfQOBDEEkPYvh0g9AsdjV/owl6WFMnNQ=; b=F87sXrnE+phMYwOHUgi9o1NEWTg3SJXbVDw4V4W3zpdqJnePLuqG3wUewWIMU2Bkot FdUefaTrvzdELciY3Zt1sTcdulN9k/zrxJyUYiQyl9palYe3fRWlvBUYmh6hhNminLfg z/fdmx0312KJRbVO673Kj+PPoB3YZh9bXWy098JxZhRjT54koq1D5oHJsYNeDWWLzG3q 01nRxf3E2muQcsuKTenkCs5q4euNATn+LHWvxkBO6LPFxh/OtctzkHLJ0ZRiRvwuVJwf OLOZcU25PykXwGxWtbPSINJiXOPoT9J5JjKCsCGOe0gpmTSKfp7lh2mD1nWuzpvmxYOQ ylvQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=POy51eqE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from howler.vger.email (howler.vger.email. [2620:137:e000::3:4]) by mx.google.com with ESMTPS id p42-20020a056a0026ea00b0068a49a550b9si3351432pfw.139.2023.09.15.08.37.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Sep 2023 08:37:30 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) client-ip=2620:137:e000::3:4; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=POy51eqE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id 7291882A41CE; Thu, 14 Sep 2023 23:55:41 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230109AbjIOGzi (ORCPT + 33 others); Fri, 15 Sep 2023 02:55:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55972 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232310AbjIOGzh (ORCPT ); Fri, 15 Sep 2023 02:55:37 -0400 Received: from mail-lj1-x22e.google.com (mail-lj1-x22e.google.com [IPv6:2a00:1450:4864:20::22e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CAD96270B; Thu, 14 Sep 2023 23:55:21 -0700 (PDT) Received: by mail-lj1-x22e.google.com with SMTP id 38308e7fff4ca-2ba1e9b1fa9so28794731fa.3; Thu, 14 Sep 2023 23:55:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1694760920; x=1695365720; darn=vger.kernel.org; h=content-disposition:mime-version:message-id:subject:cc:to:from:date :from:to:cc:subject:date:message-id:reply-to; bh=wLUQAZI1IJf0z26Sa3mrW7ObnZWoziopCsj/BOvrL+A=; b=POy51eqE6RgR+nYQHxVheC3/KEXo4T/wgDx5/292EQ4WLkJKiznBUu8T2zFWg0/0mE 8ZmujBMWZGLzMvfWuh97DdRrru4ooTwp9EhSubpd+oMVlEphMcnXgqGhztdlQ9HbQW9d R+86vIT2UlnTRfq7W0LVRpzJZi1L0hsvBHsPIqmJKBFOdhewGTzzyOu+eF3UI304/syd lIJdeKGLm0ysY3j45JzOwidb+4++R1AuNxuK75DZLRsoBekkBXn7zehSr7oy5sME5bNs jfRAnXeJ6mgRrCuSieAhBNJgGvAWQZX1W8kduVNUAlixC8IUh3vDhyefhxLB6hr5AaHV 0Q1A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1694760920; x=1695365720; h=content-disposition:mime-version:message-id:subject:cc:to:from:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=wLUQAZI1IJf0z26Sa3mrW7ObnZWoziopCsj/BOvrL+A=; b=bH4PEVoSCD52G3OEsc0bmLoKSNK2+znpXkJ453ITEKMeC3tQLz34vxAdnuQPkLvEFG 0OKzVtSp/wRnsj5ETzJ3sMUoi3WPf97WClkdeb7FyVVB5a6Ox2L+ozvl8kMJaiSfu40j xM5uIBC9Cb0vRG/63t1IrP5ex5Id2pEkdqMPS3YI9CRt9kuAElUC4CiWM9tJOrN6FTxB F57pxCxCHK+Q/37hL5gsySBTRf0PG9z+kVfnsbHR1MFD3wEF4nDdnQrt55aMPA9k6vcv +vvZbGDVk0cE6omeqcp3qSsOfGy/wFozvek6U/kzYZwc7yBYzt4Bipnr0dh3VnAOLjWP Ssaw== X-Gm-Message-State: AOJu0YzBfpIFlOqUUYx3nrV8zlum2mrV5abcmM4L3gzNDFUOoB+aCqJC 5cZ1Diz+xDp13kAGB1rwJUAsxIBRtG4= X-Received: by 2002:a2e:8887:0:b0:2bf:7dac:a51 with SMTP id k7-20020a2e8887000000b002bf7dac0a51mr832166lji.51.1694760919713; Thu, 14 Sep 2023 23:55:19 -0700 (PDT) Received: from dc78bmyyyyyyyyyyyyybt-3.rev.dnainternet.fi (dc78bmyyyyyyyyyyyyybt-3.rev.dnainternet.fi. [2001:14ba:16f8:1500::3]) by smtp.gmail.com with ESMTPSA id k2-20020a2ea282000000b002bfc5c77579sm583203lja.120.2023.09.14.23.55.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Sep 2023 23:55:18 -0700 (PDT) Date: Fri, 15 Sep 2023 09:55:07 +0300 From: Matti Vaittinen To: Matti Vaittinen , Matti Vaittinen Cc: Jonathan Cameron , Lars-Peter Clausen , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Matti Vaittinen , Angel Iglesias , Andy Shevchenko , Andreas Klinger , Benjamin Bara , linux-iio@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 0/3] Support ROHM BM1390 pressure sensor Message-ID: MIME-Version: 1.0 Content-Disposition: inline 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_BLOCKED,SPF_HELO_NONE,SPF_PASS 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 X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (howler.vger.email [0.0.0.0]); Thu, 14 Sep 2023 23:55:41 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1777118479758623276 X-GMAIL-MSGID: 1777118479758623276 ROHM BM1390 Pressure sensor (BM1390GLV-Z) can measure pressures ranging from 300 hPa to 1300 hPa with configurable measurement averaging and an internal FIFO. The sensor does also provide temperature measurements although, according to the data sheet, sensor performs internal temperature compensation for the MEMS. Sensor does also contain IIR filter implemented in HW. The data-sheet says the IIR filter can be configured to be "weak", "middle" or "strong". Some RMS noise figures are provided in data sheet but no accurate maths for the filter configurations is provided. I actually asked if we can define 3db frequencies corresponding to these IIR filter settings - and I received values 0.452Hz, 0.167Hz, and 0.047Hz but I am not at all sure we understood each others with the HW colleagues... Hence, the IIR filter configuration is not supported by this driver and the filter is just configured to the "middle" setting. (at least for now) It would also be possible to not use IIR filter but just do some simple averaging. I wonder if it would make sense to implement the OVERSAMPLING value setting so that if this value is written, IIR filter is disabled and number of samples to be averaged is set to value requested by OVERSAMPLING. The data-sheet has a mention that if IIR is used, the number of averaged samples must be set to a fixed value. The FIFO measurement mode (in sensor hardware) is only measuring the pressure and not the temperature. The driver measures temperature when FIFO is flushed and simply uses the same measured temperature value to all reported temperatures. This should not be a problem when temperature is not changing very rapidly (several degrees C / second) but allows users to get the temperature measurements from sensor without any additional logic. This driver has received limited amount of testing this far. It's in a state 'works on my machine, for my use cases' - and all feedback is appreciated! Revision history: Major changes here, please see the head room of individual patches for more detailed list. v1 => v2: rebased on v6.6-rc1 dt-bindings: - fix compatible in the example sensor driver: - drop unnecessary write_raw callback - plenty of small improvements and fixes MAINTAINERS: - No changes Matti Vaittinen (3): dt-bindings: Add ROHM BM1390 pressure sensor iio: pressure: Support ROHM BU1390 MAINTAINERS: Add ROHM BM1390 .../bindings/iio/pressure/rohm,bm1390.yaml | 52 + MAINTAINERS | 6 + drivers/iio/pressure/Kconfig | 9 + drivers/iio/pressure/Makefile | 1 + drivers/iio/pressure/rohm-bm1390.c | 899 ++++++++++++++++++ 5 files changed, 967 insertions(+) create mode 100644 Documentation/devicetree/bindings/iio/pressure/rohm,bm1390.yaml create mode 100644 drivers/iio/pressure/rohm-bm1390.c base-commit: 0bb80ecc33a8fb5a682236443c1e740d5c917d1d