From patchwork Mon Jul 25 18:44:26 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Rokosov X-Patchwork-Id: 12928310 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 0E764C43334 for ; Mon, 25 Jul 2022 18:44:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230468AbiGYSo5 (ORCPT ); Mon, 25 Jul 2022 14:44:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53260 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229841AbiGYSo4 (ORCPT ); Mon, 25 Jul 2022 14:44:56 -0400 Received: from mail.sberdevices.ru (mail.sberdevices.ru [45.89.227.171]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DA5711F2C2; Mon, 25 Jul 2022 11:44:53 -0700 (PDT) Received: from s-lin-edge02.sberdevices.ru (localhost [127.0.0.1]) by mail.sberdevices.ru (Postfix) with ESMTP id 96D5D5FD04; Mon, 25 Jul 2022 21:44:50 +0300 (MSK) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sberdevices.ru; s=mail; t=1658774690; bh=2ohaLhMELb91V7BEJJEZfttiFP9L2P05/VDEIgOFXsU=; h=From:To:Subject:Date:Message-ID:Content-Type:MIME-Version; b=BeuoQuSufNrajgKEu/tgsKmxWCppTcQtqmRL7PMhvQfNpfDG3wzOEyu4O4XF/o2Zz okuU2mAmuUgxuk1hS139jJuhCyTzKAEe8zmTL/C2K98VTzfi/iGmDQgri1NzahQ5xS wOg41fHQokVLQB56sjOnQbBXhMuGv+/WYM6Ze5rmIZX3t+G+5W4zssiDFt5VCKbN9d yu0F5Qae05fH+L9XUXfaAH1QVkuZX9u4TQZ5yEWhNV6yh8cfkEBD+Y9AgtsVfPSjy9 RbsURGDirdeYaMZPoE664Ixg+VRyNs5i7vodUoA0fdWBGjl7nmk1hS67nURmCpp99f lWuZvW378sxOA== Received: from S-MS-EXCH01.sberdevices.ru (S-MS-EXCH01.sberdevices.ru [172.16.1.4]) by mail.sberdevices.ru (Postfix) with ESMTP; Mon, 25 Jul 2022 21:44:48 +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 v1 1/3] units: complement the set of Hz units Thread-Topic: [PATCH v1 1/3] units: complement the set of Hz units Thread-Index: AQHYoFaQAQbyP6ttz02qWm6Ywvl4BQ== Date: Mon, 25 Jul 2022 18:44:26 +0000 Message-ID: <20220725184439.7618-2-ddrokosov@sberdevices.ru> References: <20220725184439.7618-1-ddrokosov@sberdevices.ru> In-Reply-To: <20220725184439.7618-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/25 14:44:00 #19963834 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..900a642f0ff8 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 MHZ_PER_HZ 1000UL #define HZ_PER_KHZ 1000UL #define KHZ_PER_MHZ 1000UL #define HZ_PER_MHZ 1000000UL From patchwork Mon Jul 25 18:44:27 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Rokosov X-Patchwork-Id: 12928312 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 4FA70CCA48A for ; Mon, 25 Jul 2022 18:44:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229841AbiGYSo6 (ORCPT ); Mon, 25 Jul 2022 14:44:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53268 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230348AbiGYSo4 (ORCPT ); Mon, 25 Jul 2022 14:44:56 -0400 Received: from mail.sberdevices.ru (mail.sberdevices.ru [45.89.227.171]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DA3951C914; Mon, 25 Jul 2022 11:44:53 -0700 (PDT) Received: from s-lin-edge02.sberdevices.ru (localhost [127.0.0.1]) by mail.sberdevices.ru (Postfix) with ESMTP id AF5105FD05; Mon, 25 Jul 2022 21:44:50 +0300 (MSK) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sberdevices.ru; s=mail; t=1658774690; bh=ifgblJjfbsaU4skWDeNZKH5Eit2GbzhVYvV5tKaGzP0=; h=From:To:Subject:Date:Message-ID:Content-Type:MIME-Version; b=R1038QC6cdSlvtEXKYOrZeB53VeZwM4Jk+s1YSUXfnj+uyE/Pq5ShXN8ZTYknIANB T7sAEXFb0VCxHpHp6AoS5tFBst3ejoQC/DmeD1TNwNVO3xIL2Wq6+iVTYWIoTfHoFv qj583DzQJexHeOKizcJGClH50hIrZLHp5acqqMeZympaY3/fEiI6e19iiA3VBu4L8V WlP2pYVn1+93dEs0fy6AgHsSkjFR68eU04zevqTXptKCDTBtKJDRrh3t3ZR3fadNPY g4fbJQwPw9jBK6ZrZrKk/uBFzYEIcl53qpzCCb6D0/+G0Y1tZliTMr/xqNj54BZnOs t7dS92K4W8aSA== Received: from S-MS-EXCH02.sberdevices.ru (S-MS-EXCH02.sberdevices.ru [172.16.1.5]) by mail.sberdevices.ru (Postfix) with ESMTP; Mon, 25 Jul 2022 21:44:50 +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 v1 2/3] iio: accel: adxl345: use HZ macro from units.h Thread-Topic: [PATCH v1 2/3] iio: accel: adxl345: use HZ macro from units.h Thread-Index: AQHYoFaR+WIztEOtDUqH63tAvzLe1Q== Date: Mon, 25 Jul 2022 18:44:27 +0000 Message-ID: <20220725184439.7618-3-ddrokosov@sberdevices.ru> References: <20220725184439.7618-1-ddrokosov@sberdevices.ru> In-Reply-To: <20220725184439.7618-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/25 14:44:00 #19963834 X-KSMG-AntiVirus-Status: Clean, skipped Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org Remove duplicate definition of NHZ_PER_HZ, because it's available in the units.h. Signed-off-by: Dmitry Rokosov --- 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 Mon Jul 25 18:44:28 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Rokosov X-Patchwork-Id: 12928313 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 F1DC2CCA48D for ; Mon, 25 Jul 2022 18:44:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236084AbiGYSo6 (ORCPT ); Mon, 25 Jul 2022 14:44:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53262 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229947AbiGYSo4 (ORCPT ); Mon, 25 Jul 2022 14:44:56 -0400 Received: from mail.sberdevices.ru (mail.sberdevices.ru [45.89.227.171]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DADD51F2EC; Mon, 25 Jul 2022 11:44:53 -0700 (PDT) Received: from s-lin-edge02.sberdevices.ru (localhost [127.0.0.1]) by mail.sberdevices.ru (Postfix) with ESMTP id D28DC5FD06; Mon, 25 Jul 2022 21:44:50 +0300 (MSK) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sberdevices.ru; s=mail; t=1658774690; bh=QpaBQJcbjdnu9SDzc6opNHgRycoO3tNZDzVMIW2qPJ4=; h=From:To:Subject:Date:Message-ID:Content-Type:MIME-Version; b=oURdaKDGKLC1avHIkHxnlr29CgJnnjBxTHiISE+IKFlSaEQ0eK00jXjFN4NYPUMHg BFa+VCBWWmOZ8Zcbv/UliLMxkw9/qqZNGXEqcPqLnO4fLQ8Z6CtipGhN0NvcMJpNsJ AYe4Le1eEj614H7EGJWTsSE3Nt+BUJB2ekmTb0Gsxmbj1I1Eaj7khIfuz6hQ95//ev ZnSxcahQtkPSyz9evXJUkSLoYsCtu01qAkQrGK9d179vL+TPGeTTCTHa6RKYR2+347 1oU8RIDUtdKRthGruKx6LG4w7Qd+juK5SEpOfJJBccyqTS1sseTP2TpbAaxxhaZXZp o8FSVsRBkXCxg== Received: from S-MS-EXCH02.sberdevices.ru (S-MS-EXCH02.sberdevices.ru [172.16.1.5]) by mail.sberdevices.ru (Postfix) with ESMTP; Mon, 25 Jul 2022 21:44:50 +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 v1 3/3] iio: common: scmi_sensors: use HZ macro from units.h Thread-Topic: [PATCH v1 3/3] iio: common: scmi_sensors: use HZ macro from units.h Thread-Index: AQHYoFaRbBw0+Bf9VEi6RsC5NjNiJg== Date: Mon, 25 Jul 2022 18:44:28 +0000 Message-ID: <20220725184439.7618-4-ddrokosov@sberdevices.ru> References: <20220725184439.7618-1-ddrokosov@sberdevices.ru> In-Reply-To: <20220725184439.7618-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/25 14:44:00 #19963834 X-KSMG-AntiVirus-Status: Clean, skipped Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org Remove duplicate definition of UHZ_PER_HZ, because it's available in the units.h. Signed-off-by: Dmitry Rokosov --- 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];