Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp4822522iob; Mon, 9 May 2022 02:25:51 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxn9EI2Y33mmZUj7dZW/lcXDyxhrFgT1vxt2s1m2qNJvZ7HeNwXCM4QzLLy6CqA/3yyVcpT X-Received: by 2002:a05:6a00:16cd:b0:4e1:366:7ee8 with SMTP id l13-20020a056a0016cd00b004e103667ee8mr15469844pfc.9.1652088351294; Mon, 09 May 2022 02:25:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652088351; cv=none; d=google.com; s=arc-20160816; b=YLd8lagD2nS1m76fecbiWZOVCOV8fzes9Wjs4wjaMuWOlQez2rFbyx4r+icwxj8jNY gc/igqjuM0D2CqkSA1bD8Mz0aQMZKlW3Wtkw67hdmIm1e9iAdHRZd4K0imdGASE3KzJ/ f2sONx7iSHNkAU5UsKqTKFnmHq20Wi+sAisC18msvnSI3A7nrnAGb8eIPR5ELmDilP8l x9fsvb4BlQhVxo7+NiyEVis9yYNxDJuhtmDrf889n5erTiieSsXqD6aMSbpfZPhWY9zt cGipkIRKMEQq8u0wC8IiqO223iFJ8+iRRp9LikUqukf4+/sO04mF/td3cbNHgd28zNLT Pr2A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:in-reply-to:message-id:date:subject :cc:to:from:dkim-signature; bh=ScUwdLygZAJBLNzZb5DPx3aH0d7kiLkb+57GQJMLhHA=; b=OlV1iKRMyNQfwFkm74fHQLblPCwnNi/hhmIeh2OKevwTAE3uMZYU4KHoLo0VbXKGMj h+VyuiwxZ0zWvV9VBz6fJLrufnFt5XWJFIq8tbjd1VCwy5EBQ6YsT+CGiSwYKHSlN/pv epMu+r4KZXwPa8r1nMfMDkEczZz6tltiBxOyrM/nQmnKCOJC5qT/+qaUYUeQSYCH+wfh BG5bTYnI+zI9ANHsWBr17B6pZdj+NIyXQ10Q+YlYsoa0/1C/zT9Krc1J3Q2nCHYui2Gr n4OSQIWtoanKed2UeGiiMWmU5sFayoBgzRLMBTCpv7ekhFOIkW7ltBJIEJoEfqcI3rPo IxRQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=O1J0ZczF; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id dt15-20020a17090afa4f00b001cba2c0d367si18815434pjb.115.2022.05.09.02.25.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 May 2022 02:25:51 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=O1J0ZczF; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 184941C3451; Mon, 9 May 2022 02:15:35 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1379570AbiEENeU (ORCPT + 99 others); Thu, 5 May 2022 09:34:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45268 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1379551AbiEENeJ (ORCPT ); Thu, 5 May 2022 09:34:09 -0400 Received: from mail-pg1-x535.google.com (mail-pg1-x535.google.com [IPv6:2607:f8b0:4864:20::535]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E42161B7A5; Thu, 5 May 2022 06:30:28 -0700 (PDT) Received: by mail-pg1-x535.google.com with SMTP id x12so3638348pgj.7; Thu, 05 May 2022 06:30:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=ScUwdLygZAJBLNzZb5DPx3aH0d7kiLkb+57GQJMLhHA=; b=O1J0ZczFqlulozW3TK0yGqCukjH8F98Zz1I6QTbtsESqDOsOYZPYv/W4c1Bgbk4Gbb bw8mdougfWtlGfdBJf9FuwhWLnAEtr9mUfRaaFaRZx33h1Y2Qq8ebPJlUsyRH9AE3QQQ WNurtbQjyY8z0iJGw4Dd4WQQrIPib1ZtW9Db5tTx7oY3EueesQ/2GdQ2SDLEpOb5kVet IJTeMeyteomOQKFjMMoL4U3ZtjXuEN35/c/Sf/diqCjlRP7u76CxlcDhScfNVVE5xNc5 D0+7VfxGc+5uHZVNKfNfoXIgdXNBio0XjuUIEPtbgnzllgGy2ebEmEmefi0msGffwjX8 01Lg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=ScUwdLygZAJBLNzZb5DPx3aH0d7kiLkb+57GQJMLhHA=; b=igWTr/1GhZL2gEt5YZg9mBtc7HBP2GBg4XRIwYaDDofKur6z0NCsAgvSOd5l9C6tfc FN85fGzZIUk/rwJxCI3ZkyHK/oV9e1qP82jwMSWlKHNcw20X7uEXoq6qksUJrZdWE++S 4m1bkKp3sVAx10Kva1wiiKpWZvdTIRR/8OX2OCTDV2TBwgkjNIc3xj5XowsUHPnK+arg ZiTRguUOmYSpzBgr8cyKtPkVqT/UvuBhI9wpKsyMWRD+2T21o2rPSEkL+tIawT513JVS mizEOFgkK+UUPupe51KsDj5zs0i3uHrv7GQy3DEBg7mrjTTG6KGgGkLceP720ySom1aL Ziiw== X-Gm-Message-State: AOAM531DLwmxAmYUgFNabaS+HWMLk4U+EvC0FwffjH9y7x5ok3ATdwDe Bal7JNjIylOA/yfvDASgrVw= X-Received: by 2002:a63:84c3:0:b0:3aa:f229:45c5 with SMTP id k186-20020a6384c3000000b003aaf22945c5mr21977602pgd.415.1651757428359; Thu, 05 May 2022 06:30:28 -0700 (PDT) Received: from localhost.localdomain ([115.99.184.228]) by smtp.gmail.com with ESMTPSA id c64-20020a624e43000000b0050dc7628135sm1420120pfb.15.2022.05.05.06.30.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 05 May 2022 06:30:27 -0700 (PDT) From: Jagath Jog J To: dan@dlrobertson.com, jic23@kernel.org, andy.shevchenko@gmail.com Cc: linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v5 01/10] iio: accel: bma400: Fix the scale min and max macro values Date: Thu, 5 May 2022 19:00:12 +0530 Message-Id: <20220505133021.22362-2-jagathjog1996@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20220505133021.22362-1-jagathjog1996@gmail.com> References: <20220505133021.22362-1-jagathjog1996@gmail.com> X-Spam-Status: No, score=-1.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no 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 Changing the scale macro values to match the bma400 sensitivity for 1 LSB of all the available ranges. Fixes: 465c811f1f20 ("iio: accel: Add driver for the BMA400") Signed-off-by: Jagath Jog J Reviewed-by: Andy Shevchenko --- drivers/iio/accel/bma400.h | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/drivers/iio/accel/bma400.h b/drivers/iio/accel/bma400.h index c4c8d74155c2..80330c7ce17f 100644 --- a/drivers/iio/accel/bma400.h +++ b/drivers/iio/accel/bma400.h @@ -83,8 +83,27 @@ #define BMA400_ACC_ODR_MIN_WHOLE_HZ 25 #define BMA400_ACC_ODR_MIN_HZ 12 -#define BMA400_SCALE_MIN 38357 -#define BMA400_SCALE_MAX 306864 +/* + * BMA400_SCALE_MIN macro value represents m/s^2 for 1 LSB before + * converting to micro values for +-2g range. + * + * For +-2g - 1 LSB = 0.976562 milli g = 0.009576 m/s^2 + * For +-4g - 1 LSB = 1.953125 milli g = 0.019153 m/s^2 + * For +-16g - 1 LSB = 7.8125 milli g = 0.076614 m/s^2 + * + * The raw value which is used to select the different ranges is determined + * by the first bit set position from the scale value, so BMA400_SCALE_MIN + * should be odd. + * + * Scale values for +-2g, +-4g, +-8g and +-16g are populated into bma400_scales + * array by left shifting BMA400_SCALE_MIN. + * e.g.: + * To select +-2g = 9577 << 0 = raw value to write is 0. + * To select +-8g = 9577 << 2 = raw value to write is 2. + * To select +-16g = 9577 << 3 = raw value to write is 3. + */ +#define BMA400_SCALE_MIN 9577 +#define BMA400_SCALE_MAX 76617 #define BMA400_NUM_REGULATORS 2 #define BMA400_VDD_REGULATOR 0 -- 2.17.1