Received: by 2002:a05:6a10:c604:0:0:0:0 with SMTP id y4csp2001026pxt; Sun, 8 Aug 2021 08:17:52 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyC/vXWKLJ9P1y8NbeMe1EVUJa/87tmloGKMJQOkhwfsg+Cs/rknUhn/3GfJL3riAMqek3H X-Received: by 2002:a17:907:78cf:: with SMTP id kv15mr5008139ejc.460.1628435872480; Sun, 08 Aug 2021 08:17:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1628435872; cv=none; d=google.com; s=arc-20160816; b=ZxaK5FBJaTi5fjka1J2taDGiPHqQxcAURCj2LlC7BDyAp86Uwbde21ThmY8EISNlxl aCFR2P8QvjIXxnZFXO4pI/OgENeufBpzALsvx0ZFAFamD6pZEqbE0A3zUzn1YfTi3kuW 1pNlSqlQKTfLswbRlnASVA21JJj5Oo9G/68OKPWHPqUcwQi6ee3oRDRdHbUkBKwBob3e QDVSo5jU/4kYOezTmPrG9igPOTQafR70HYmAb8ia0nSP2NthV5ZegU6VlRmppkY/FZ3y kyL9i4le4NtQxlnS32VQA1A3O2mEmqGRG1VEGFIYWwPVSSKHszK0LJYGGeSWAyNan5B8 DJ7g== 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=QgnGGf/c1n8OhXMTZuE3OTj7bJSS/VxOGltvrshTu9w=; b=luN3GcUkvUHFXEucu8qEsUjHWleUKDetXtAL6O/c4PUBEL5V3/27+YIAaX9+OsKYlk SGdqkOMWXVhvd/Xkpyl3tfJXCfIn4ua7s7fE49Q4om8/QJoEHRxRwzkHBDmt+28TQ3+f CK7vERkIDy47fLVH7zLr5I27hxi3vZWfj6+qHd5XprDB58ay1Mxl5dWlx4306PP3klFO WPAbSa7oEwW+w6qM7KZVOx/Qe8svI4LRKNUPbE1x9yHFMJVuQDq3qsLHWoKUOG9YNnKs YhfzATimrN2TPMmVCsafHpIa2ooxgT/VvsocHpaLyH945fnYh/zoY/A5rDCE7nKTfh0E 6kOw== 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 y21si75505edq.281.2021.08.08.08.17.26; Sun, 08 Aug 2021 08:17:52 -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 S232049AbhHHPCK (ORCPT + 99 others); Sun, 8 Aug 2021 11:02:10 -0400 Received: from mail.kernel.org ([198.145.29.99]:46594 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231414AbhHHPCJ (ORCPT ); Sun, 8 Aug 2021 11:02:09 -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 4D31160F35; Sun, 8 Aug 2021 15:01:48 +0000 (UTC) Date: Sun, 8 Aug 2021 16:04:37 +0100 From: Jonathan Cameron To: Puranjay Mohan Cc: Michael.Hennerich@analog.com, devicetree@vger.kernel.org, linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org, lars@metafoo.de, Dragos.Bogdan@analog.com, Darius.Berghe@analog.com Subject: Re: [PATCH v8 2/3] iio: accel: Add driver support for ADXL355 Message-ID: <20210808160437.4cf3a280@jic23-huawei> In-Reply-To: <20210804140309.31468-3-puranjay12@gmail.com> References: <20210804140309.31468-1-puranjay12@gmail.com> <20210804140309.31468-3-puranjay12@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 Wed, 4 Aug 2021 19:33:08 +0530 Puranjay Mohan wrote: > ADXL355 is 3-axis MEMS Accelerometer. It offers low noise density, > low 0g offset drift, low power with selectable measurement ranges. > It also features programmable high-pass and low-pass filters. > > Datasheet: https://www.analog.com/media/en/technical-documentation/data-sheets/adxl354_adxl355.pdf > Signed-off-by: Puranjay Mohan Hi Puranjay, One comment below, but it's a follow up on a discussion going on in the ADXL313 driver review. I might just make that change whilst applying this, or leave it for another day. Either way, no need for you to change anything unless you are doing a v9 for another reason. ... > + > +/* > + * The datasheet defines an intercept of 1885 LSB at 25 degC > + * and a slope of -9.05 LSB/C. The following formula can be used to find the > + * temperature: > + * Temp = ((RAW - 1885)/(-9.05)) + 25 but this doesn't follow the format of > + * the IIO which is Temp = (RAW + OFFSET) * SCALE. Hence using some rearranging > + * we get the scale as -110.49723 and offset as -2111.25 > + */ > +#define TEMP_SCALE_VAL -110 > +#define TEMP_SCALE_VAL2 497238 > +#define TEMP_OFFSET_VAL -2111 > +#define TEMP_OFFSET_VAL2 250000 > + > +/* > + * At +/- 2g with 20-bit resolution, scale is given in datasheet as > + * 3.9ug/LSB = 0.0000039 * 9.80665 = 0.00003824593 m/s^2 > + */ > +#define ADXL355_NSCALE 38245 This just came up in another review and wasn't something I've been picking up on in reviews before now. These scale defines would be better dropped and the values moved inline (along with the comments). It avoids possible unit misunderstandings etc In short the key thing is, sometimes a number is just a number and using a define to give it a name is not always helpful, particularly if it's only used in one place in the code.