Received: by 2002:a05:6a10:c604:0:0:0:0 with SMTP id y4csp1987100pxt; Sun, 8 Aug 2021 07:55:36 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy1WgPxcLpOD0BqQIJsvoM8QsyuYCy7G+UWjD1k0QUK6+Nm93MIsvM9U08gQ4HwftAFUBa0 X-Received: by 2002:a50:bb43:: with SMTP id y61mr24056221ede.22.1628434536412; Sun, 08 Aug 2021 07:55:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1628434536; cv=none; d=google.com; s=arc-20160816; b=uXp200S5o3xN0iCu3i5m/dm0jwdqZBQCvNzfkZgIE73+ZpAvHINHmV+JdP36EWsJ9e B/VtAzENup4KqJ419GSexpZOjdLS+wvbyUHyjBJhFe3yEciB+Ydw5vFCEuqnDtNAtaNz s3UzcQUPVX8bMCYR+qc9K84Ey7Sa30WKkahgo/TKlz20rnfp90HLJe3IIkHGiBA2exiT TrmAMrrgYlVSMssv+Xayp34ZFoBzP2DsjilEscCDtVI9oILshDXxWNTLss/ecFdPhdMW xy1Q8y8TLTWv0wLTe3EgVXz8QoMI/o/HZhz0Tsb1eM9uEEeCv8Jg6bUksF66OJg7zT0I fAOg== 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 :references:in-reply-to:message-id:subject:cc:to:from:date; bh=gEGAe7idxrqIKZyuHS7AHMGBcFNDGFS6/2gBj8iyJIo=; b=GSUAgASNi/GJsn712vgliqN8s5orYWd5h8MLgRzRBw0sx6FN9s76MdJrrFmMFJwwrY F+J2HsSn5omAYJCL6SCDfh60Lh4cl7q+OIYxdfFba1ad7IG4jmWBrdhQ6UK97mZVg105 O3MsEztwm429ye0QgpEE9j7+e+1I/hVg/jn5pzhxJVtllyEC6xf2/y30QFe19O43hD81 GExAWoHtNfhJrQJSVGEyfIb1qHFgnzP5+eQePl5hTRIj7JwKomZQFRXL5sLIGxQkAhrH v9yQ4kCnxajkWu4Lqo++M++ShfGqwt6VCbpx/BzftODBdgaX8YW6IYIjnOHg74d+zaA2 XmoA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id k13si14328243edq.400.2021.08.08.07.55.12; Sun, 08 Aug 2021 07:55:36 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231854AbhHHOtZ (ORCPT + 99 others); Sun, 8 Aug 2021 10:49:25 -0400 Received: from mail.kernel.org ([198.145.29.99]:45456 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231932AbhHHOtV (ORCPT ); Sun, 8 Aug 2021 10:49:21 -0400 Received: from jic23-huawei (cpc108967-cmbg20-2-0-cust86.5-4.cable.virginm.net [81.101.6.87]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 217B360560; Sun, 8 Aug 2021 14:48:59 +0000 (UTC) Date: Sun, 8 Aug 2021 15:51:49 +0100 From: Jonathan Cameron To: Lucas Stankus Cc: Andy Shevchenko , "lars@metafoo.de" , "Michael.Hennerich@analog.com" , "robh+dt@kernel.org" , "Dragos.Bogdan@analog.com" , "Darius.Berghe@analog.com" , "linux-iio@vger.kernel.org" , "devicetree@vger.kernel.org" , "linux-kernel@vger.kernel.org" Subject: Re: [PATCH v2 2/2] iio: accel: Add driver support for ADXL313 Message-ID: <20210808155149.1c435b88@jic23-huawei> In-Reply-To: References: <22ad63af54e6cfc9486d44d05ba3d2f7482c7b1e.1628143857.git.lucas.p.stankus@gmail.com> X-Mailer: Claws Mail 4.0.0 (GTK+ 3.24.30; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 6 Aug 2021 21:22:46 -0300 Lucas Stankus wrote: > On Fri, Aug 6, 2021 at 9:35 AM Andy Shevchenko > wrote: > > > > > > > > On Thursday, August 5, 2021, Lucas Stankus wrote: > >> > >> ADXL313 is a small, thin, low power, 3-axis accelerometer with high > >> resolution measurement up to +/-4g. It includes an integrated 32-level > >> FIFO and has activity and inactivity sensing capabilities. > >> > >> Datasheet: https://www.analog.com/media/en/technical-documentation/data-sheets/ADXL313.pdf > >> Signed-off-by: Lucas Stankus > >> --- > >> MAINTAINERS | 9 + > >> drivers/iio/accel/Kconfig | 29 +++ > >> drivers/iio/accel/Makefile | 3 + > >> drivers/iio/accel/adxl313.h | 63 ++++++ > >> drivers/iio/accel/adxl313_core.c | 321 +++++++++++++++++++++++++++++++ > >> drivers/iio/accel/adxl313_i2c.c | 65 +++++++ > >> drivers/iio/accel/adxl313_spi.c | 85 ++++++++ > >> 7 files changed, 575 insertions(+) > >> create mode 100644 drivers/iio/accel/adxl313.h > >> create mode 100644 drivers/iio/accel/adxl313_core.c > >> create mode 100644 drivers/iio/accel/adxl313_i2c.c > >> create mode 100644 drivers/iio/accel/adxl313_spi.c > >> > >> diff --git a/MAINTAINERS b/MAINTAINERS > >> index a61f4f3b78a9..566055450b6b 100644 > >> --- a/MAINTAINERS > >> +++ b/MAINTAINERS > >> @@ -585,6 +585,15 @@ L: platform-driver-x86@vger.kernel.org > >> S: Maintained > >> F: drivers/platform/x86/adv_swbutton.c > >> > >> +ADXL313 THREE-AXIS DIGITAL ACCELEROMETER DRIVER > >> +M: Lucas Stankus > >> +S: Supported > >> +F: Documentation/devicetree/bindings/iio/accel/adi,adxl313.yaml > >> +F: drivers/iio/accel/adxl313.h > >> +F: drivers/iio/accel/adxl313_core.c > >> +F: drivers/iio/accel/adxl313_i2c.c > >> +F: drivers/iio/accel/adxl313_spi.c > > > > > > > > adxl313*? > > > > Didn't know this would work, but I think I prefer the way it is now. > Are you proposing this as a suggestion or more of a change request? It's a bit neater and very unlikely we'll get a clash on that wild card in the long run, so I'd 'slightly' prefer this as well. ... >> +/* > >> + * Scale for any g range is given in datasheet as > >> + * 1024 LSB/g = 0.0009765625 * 9.80665 = 0.009576806640625 m/s^2 > >> + */ > >> +#define ADXL313_NSCALE 9576806 > > > > > > > > Is it in nanonewtons? Perhaps add a suffix _nN? > > > > It's actually in meters per second squared, so I couldn't come up with > a good suffix. Do you have any suggestions? Easy. Don't have a #define :) In all seriousness it isn't a 'magic' number, it's an actual real world value, so move the comment down to where it's used and put the number directly were it is needed. Jonathan