From patchwork Fri Jul 29 17:23:07 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Rokosov X-Patchwork-Id: 12932739 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 6F69AC00144 for ; Fri, 29 Jul 2022 17:23:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238379AbiG2RXq (ORCPT ); Fri, 29 Jul 2022 13:23:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40612 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236366AbiG2RXn (ORCPT ); Fri, 29 Jul 2022 13:23:43 -0400 Received: from mail.sberdevices.ru (mail.sberdevices.ru [45.89.227.171]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8DD7A82F84; Fri, 29 Jul 2022 10:23:40 -0700 (PDT) Received: from s-lin-edge02.sberdevices.ru (localhost [127.0.0.1]) by mail.sberdevices.ru (Postfix) with ESMTP id 4D7AD5FD04; Fri, 29 Jul 2022 20:23:38 +0300 (MSK) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sberdevices.ru; s=mail; t=1659115418; bh=GtXHsLQ6ogBma9gmqvBjy7eEPphOp16VWCwaSJGGTnU=; h=From:To:Subject:Date:Message-ID:Content-Type:MIME-Version; b=Y2FEP8yNDt2CjJ+ZMkTstl4/4hszIAmsV5QkUY8v9t9YRwj6xJyFWuqKCSFr99BHl Rfgu6OOMscXMkJ1OGMQreqlTUxB1UWxsHyYXRcYZUf+1SD9JRRms4EBhUO+7OpOElN YpxqbSGpbK9sqlybLSVkIl4EvzEBBvrYsE1DdcgQbb86GfhvujjSQcnSDLVCFNK41T nZYbtA4IYegg/iOpSLgarLjstVPVZ6y9CCreEUv9Z9IpgU92FiHkdIDYMO1QNzR+o0 kh2+9Zj8q+aAGYe/KbWrw8FJ+36tDkxqEK6RnynI1QV5eeUvl4cCp9lzngXy+brm03 umQAXvAeNG9QA== Received: from S-MS-EXCH02.sberdevices.ru (S-MS-EXCH02.sberdevices.ru [172.16.1.5]) by mail.sberdevices.ru (Postfix) with ESMTP; Fri, 29 Jul 2022 20:23:37 +0300 (MSK) From: Dmitry Rokosov To: "akpm@linux-foundation.org" , "andriy.shevchenko@linux.intel.com" , "daniel.lezcano@linaro.org" , "jic23@kernel.org" , "wsa@kernel.org" , "andy.shevchenko@gmail.com" , "lars@metafoo.de" , "Michael.Hennerich@analog.com" , "jbhayana@google.com" CC: "linux-iio@vger.kernel.org" , kernel , "linux-kernel@vger.kernel.org" , Dmitry Rokosov Subject: [PATCH v2 1/3] units: complement the set of Hz units Thread-Topic: [PATCH v2 1/3] units: complement the set of Hz units Thread-Index: AQHYo2/exMPEjcXGek6GXlZKNuELJw== Date: Fri, 29 Jul 2022 17:23:07 +0000 Message-ID: <20220729172332.19118-2-ddrokosov@sberdevices.ru> References: <20220729172332.19118-1-ddrokosov@sberdevices.ru> In-Reply-To: <20220729172332.19118-1-ddrokosov@sberdevices.ru> Accept-Language: ru-RU, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [172.16.1.12] MIME-Version: 1.0 X-KSMG-Rule-ID: 4 X-KSMG-Message-Action: clean X-KSMG-AntiSpam-Status: not scanned, disabled by settings X-KSMG-AntiSpam-Interceptor-Info: not scanned X-KSMG-AntiPhishing: not scanned, disabled by settings X-KSMG-AntiVirus: Kaspersky Secure Mail Gateway, version 1.1.2.30, bases: 2022/07/29 15:10:00 #20001216 X-KSMG-AntiVirus-Status: Clean, skipped Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org Currently, Hz units do not have milli, micro and nano Hz coefficients. Some drivers (IIO especially) use their analogues to calculate appropriate Hz values. This patch includes them to units.h definitions, so they can be used from different kernel places. Signed-off-by: Dmitry Rokosov --- include/linux/units.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/include/linux/units.h b/include/linux/units.h index 681fc652e3d7..8bb83c6ea97d 100644 --- a/include/linux/units.h +++ b/include/linux/units.h @@ -20,6 +20,9 @@ #define PICO 1000000000000ULL #define FEMTO 1000000000000000ULL +#define NHZ_PER_HZ 1000000000UL +#define UHZ_PER_HZ 1000000UL +#define MILLIHZ_PER_HZ 1000UL #define HZ_PER_KHZ 1000UL #define KHZ_PER_MHZ 1000UL #define HZ_PER_MHZ 1000000UL From patchwork Fri Jul 29 17:23:08 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Rokosov X-Patchwork-Id: 12932736 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 56E24C19F2A for ; Fri, 29 Jul 2022 17:23:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237781AbiG2RXo (ORCPT ); Fri, 29 Jul 2022 13:23:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40602 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236678AbiG2RXn (ORCPT ); Fri, 29 Jul 2022 13:23:43 -0400 Received: from mail.sberdevices.ru (mail.sberdevices.ru [45.89.227.171]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8DDFD82F97; Fri, 29 Jul 2022 10:23:40 -0700 (PDT) Received: from s-lin-edge02.sberdevices.ru (localhost [127.0.0.1]) by mail.sberdevices.ru (Postfix) with ESMTP id BF4E65FD05; Fri, 29 Jul 2022 20:23:38 +0300 (MSK) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sberdevices.ru; s=mail; t=1659115418; bh=w/d+593NX4cY87g/IJF8H7+dzrWxIdSP3VvXY0TJc5w=; h=From:To:Subject:Date:Message-ID:Content-Type:MIME-Version; b=nDxW8OCVWMmMeHvLKs+R5bzS/NcZd7WOMHdIAdd7WyzbqLhrlM4UHVqMcj7XWMmkC GIqpJleRovQHaaqB03RnBKjbjmSZCIcHkc00tLWpcGhvRAlnOPkxDiryueUlWSVhuJ GQ3LKXD538QiKiKVdaRjrIf/4CPWqom0uxKr+HGo1TmvyCTifoh2XFIv6UWpUeJK5V 06stLLkkk+UIREMEH7SsbzDNtILK5iof4xXTl78A/Rk6MqzYtdOiA+LcfohebeqDv9 1rNkRKQd64w60o6L95ofcZYBembu3XLRg/4Ooo/o5fweZu99alopJtJc5LrVj2Djch zKhvV8gEoG4EA== Received: from S-MS-EXCH01.sberdevices.ru (S-MS-EXCH01.sberdevices.ru [172.16.1.4]) by mail.sberdevices.ru (Postfix) with ESMTP; Fri, 29 Jul 2022 20:23:38 +0300 (MSK) From: Dmitry Rokosov To: "akpm@linux-foundation.org" , "andriy.shevchenko@linux.intel.com" , "daniel.lezcano@linaro.org" , "jic23@kernel.org" , "wsa@kernel.org" , "andy.shevchenko@gmail.com" , "lars@metafoo.de" , "Michael.Hennerich@analog.com" , "jbhayana@google.com" CC: "linux-iio@vger.kernel.org" , kernel , "linux-kernel@vger.kernel.org" , Dmitry Rokosov Subject: [PATCH v2 2/3] iio: accel: adxl345: use HZ macro from units.h Thread-Topic: [PATCH v2 2/3] iio: accel: adxl345: use HZ macro from units.h Thread-Index: AQHYo2/fZE/2bgRE9kWT1kuC+3KB3g== Date: Fri, 29 Jul 2022 17:23:08 +0000 Message-ID: <20220729172332.19118-3-ddrokosov@sberdevices.ru> References: <20220729172332.19118-1-ddrokosov@sberdevices.ru> In-Reply-To: <20220729172332.19118-1-ddrokosov@sberdevices.ru> Accept-Language: ru-RU, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [172.16.1.12] MIME-Version: 1.0 X-KSMG-Rule-ID: 4 X-KSMG-Message-Action: clean X-KSMG-AntiSpam-Status: not scanned, disabled by settings X-KSMG-AntiSpam-Interceptor-Info: not scanned X-KSMG-AntiPhishing: not scanned, disabled by settings X-KSMG-AntiVirus: Kaspersky Secure Mail Gateway, version 1.1.2.30, bases: 2022/07/29 15:10:00 #20001216 X-KSMG-AntiVirus-Status: Clean, skipped Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org Remove duplicated definition of NHZ_PER_HZ, because it's available in the units.h. Signed-off-by: Dmitry Rokosov Reviewed-by: Andy Shevchenko --- drivers/iio/accel/adxl345_core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/iio/accel/adxl345_core.c b/drivers/iio/accel/adxl345_core.c index 370bfec1275a..94189133fe8f 100644 --- a/drivers/iio/accel/adxl345_core.c +++ b/drivers/iio/accel/adxl345_core.c @@ -10,6 +10,7 @@ #include #include #include +#include #include #include @@ -32,7 +33,6 @@ #define ADXL345_BW_RATE GENMASK(3, 0) #define ADXL345_BASE_RATE_NANO_HZ 97656250LL -#define NHZ_PER_HZ 1000000000LL #define ADXL345_POWER_CTL_MEASURE BIT(3) #define ADXL345_POWER_CTL_STANDBY 0x00 From patchwork Fri Jul 29 17:23:09 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Rokosov X-Patchwork-Id: 12932737 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 A5BB4C19F2C for ; Fri, 29 Jul 2022 17:23:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237972AbiG2RXp (ORCPT ); Fri, 29 Jul 2022 13:23:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40614 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237393AbiG2RXn (ORCPT ); Fri, 29 Jul 2022 13:23:43 -0400 Received: from mail.sberdevices.ru (mail.sberdevices.ru [45.89.227.171]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 58DA988752; Fri, 29 Jul 2022 10:23:41 -0700 (PDT) Received: from s-lin-edge02.sberdevices.ru (localhost [127.0.0.1]) by mail.sberdevices.ru (Postfix) with ESMTP id A1F405FD08; Fri, 29 Jul 2022 20:23:39 +0300 (MSK) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sberdevices.ru; s=mail; t=1659115419; bh=PyxBA2BnLYxW1rMCm26qSJkySETPdFlB7N+MFu9zNgM=; h=From:To:Subject:Date:Message-ID:Content-Type:MIME-Version; b=oe4GcA4kRHmGtk9d0AcBZYjZzhXsM810HW6dLxRsV8aVZLYCW1637TqHT+VXtN7ak DBeoG2ENgldW4TQIPY1VFfzGXqyZ8UVP3m35N7xBkHUzvZbmEDIdVD/SNTFAhXdBqe C34m2GM/eEr9I5ze6fQXsnQmbXtiiWkgbRLa3O4UFnmDbE/Cd/bzTC/he6Y2wZAHPr m/PyqkXuKNF0+M0f5nckJDjpkvV0QUyMX1gAZfnVauHfGgJmpnxOeMjnfk35qRjplq GYF1haejajXZlQiwxlkSc+kExoa5TUrKD78d0YC4omy8JlSQsZcpnGJhtPfxZWg3/E bpVv5F0HM4lmA== Received: from S-MS-EXCH01.sberdevices.ru (S-MS-EXCH01.sberdevices.ru [172.16.1.4]) by mail.sberdevices.ru (Postfix) with ESMTP; Fri, 29 Jul 2022 20:23:39 +0300 (MSK) From: Dmitry Rokosov To: "akpm@linux-foundation.org" , "andriy.shevchenko@linux.intel.com" , "daniel.lezcano@linaro.org" , "jic23@kernel.org" , "wsa@kernel.org" , "andy.shevchenko@gmail.com" , "lars@metafoo.de" , "Michael.Hennerich@analog.com" , "jbhayana@google.com" CC: "linux-iio@vger.kernel.org" , kernel , "linux-kernel@vger.kernel.org" , Dmitry Rokosov Subject: [PATCH v2 3/3] iio: common: scmi_sensors: use HZ macro from units.h Thread-Topic: [PATCH v2 3/3] iio: common: scmi_sensors: use HZ macro from units.h Thread-Index: AQHYo2/ffOY1iq+jkk6eezTkPE4aJA== Date: Fri, 29 Jul 2022 17:23:09 +0000 Message-ID: <20220729172332.19118-4-ddrokosov@sberdevices.ru> References: <20220729172332.19118-1-ddrokosov@sberdevices.ru> In-Reply-To: <20220729172332.19118-1-ddrokosov@sberdevices.ru> Accept-Language: ru-RU, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [172.16.1.12] MIME-Version: 1.0 X-KSMG-Rule-ID: 4 X-KSMG-Message-Action: clean X-KSMG-AntiSpam-Status: not scanned, disabled by settings X-KSMG-AntiSpam-Interceptor-Info: not scanned X-KSMG-AntiPhishing: not scanned, disabled by settings X-KSMG-AntiVirus: Kaspersky Secure Mail Gateway, version 1.1.2.30, bases: 2022/07/29 15:10:00 #20001216 X-KSMG-AntiVirus-Status: Clean, skipped Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org Remove duplicated definition of UHZ_PER_HZ, because it's available in the units.h. Signed-off-by: Dmitry Rokosov Reviewed-by: Andy Shevchenko --- drivers/iio/common/scmi_sensors/scmi_iio.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/iio/common/scmi_sensors/scmi_iio.c b/drivers/iio/common/scmi_sensors/scmi_iio.c index 793d628db55f..c6d2cf5504cb 100644 --- a/drivers/iio/common/scmi_sensors/scmi_iio.c +++ b/drivers/iio/common/scmi_sensors/scmi_iio.c @@ -18,6 +18,7 @@ #include #include #include +#include #define SCMI_IIO_NUM_OF_AXIS 3 @@ -130,7 +131,6 @@ static const struct iio_buffer_setup_ops scmi_iio_buffer_ops = { static int scmi_iio_set_odr_val(struct iio_dev *iio_dev, int val, int val2) { struct scmi_iio_priv *sensor = iio_priv(iio_dev); - const unsigned long UHZ_PER_HZ = 1000000UL; u64 sec, mult, uHz, sf; u32 sensor_config; char buf[32];