Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp3090025rwb; Mon, 15 Aug 2022 17:53:06 -0700 (PDT) X-Google-Smtp-Source: AA6agR6eQFNR4YVU4n9g6VtmYkvLK1No0icIjnctpCE0mzEu4xEViXkT54aTvEo/JE1QiH8JwI18 X-Received: by 2002:a17:906:9be1:b0:730:957f:34a3 with SMTP id de33-20020a1709069be100b00730957f34a3mr11901286ejc.47.1660611186758; Mon, 15 Aug 2022 17:53:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660611186; cv=none; d=google.com; s=arc-20160816; b=izhFltGtqhWAvkaLI6iErzkslxW+2cyUKFkSjUvEFL5CwZVxKsnWlXdBWhza9vYKWP 28h9WOhgPSGZd+Z4GI9JmUESEVjWAq2RVyA7n5FSQeRsoNX2cpGxn0eeW8tnjXxRzENk QIYFXRjleXNwQ3z20V5lXGrm2m2jhkKFQxnApAFM3wIP/Kf5jQ62bPeaeaMigdu0pAeu R8CWEBP/SjvAGtavBoHVIwuusmHJX8/gA993Tt9eFeYGBBEzR+j0kln6Y8knEwzP/o/4 mhE0q9N8uimg0XCRDcwkepyTP7xJk7sVEkZDQYsgA4/ySaxjrQfSCGi7HilSimHsR1V8 oPmg== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=7/q92IiG327p6Ssxj/Rztadh+PhH0398OiHGZjUgkCU=; b=ho8z5xnvBBQTqvGFqYaTzaMG1M90pcWK35Kf3iJ+P+UdowKaxo6Pk428StTFXUSrJx KB6YX0pdTyBmgsKExoZwKlv0ED0j09A4Hbkn180GZub/8uU4b8tcSrTErwnL1CIkqkr+ EgaLwoL3MT3cUWJEVy95d75V0Cj/zB3t2B2vsLeL71J5+lZe7Z/NOjjwXk32FIAOjuCx 9+b3nB/B2+68HXM1az1lO2C2e4rLrJeMUBeJ4s3tNGVPzbkEk/kFukhDCR3OjW0uBHrV y16QkBTdeKNlTnpTw70bCekrZUGBdKoMe7kL+lxz0REoQrJFdNVdHEDkxz7/lqR8a8DM wdYw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=PEX0qeSR; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f13-20020a0564021e8d00b0043d85ca3c96si9162630edf.440.2022.08.15.17.52.41; Mon, 15 Aug 2022 17:53:06 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=PEX0qeSR; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1357119AbiHPANE (ORCPT + 99 others); Mon, 15 Aug 2022 20:13:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47912 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1356926AbiHPADV (ORCPT ); Mon, 15 Aug 2022 20:03:21 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 582AA16CCD4; Mon, 15 Aug 2022 13:25:05 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id BCF4BB8119B; Mon, 15 Aug 2022 20:25:03 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 084C1C433C1; Mon, 15 Aug 2022 20:25:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660595102; bh=dz7vQ4RXKIwyT5wUIh04z6+gRNzyrIgUgYrhIoQKgSM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PEX0qeSRp9MuRVJGIGBgsBH+6Ib1NlZ53tTP9NAbAhQ63lLNLCPcx95khKI7csLxz uUnqIzhj28MK8MGP3MZegBdqa6JASAQXhAs9KRDwGsbUAqkgjuM/tHbTronW/8qGLX rEo1Us/Oas9zL9Ly1qXaAo22RYe7rjZ1y/DRRP+Q= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jagath Jog J , Andy Shevchenko , Jonathan Cameron , Sasha Levin Subject: [PATCH 5.19 0625/1157] iio: accel: bma400: Fix the scale min and max macro values Date: Mon, 15 Aug 2022 19:59:41 +0200 Message-Id: <20220815180504.665455106@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180439.416659447@linuxfoundation.org> References: <20220815180439.416659447@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham 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 From: Jagath Jog J [ Upstream commit 747c7cf1592e226d40543231b26502b332d0ea2f ] 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 Link: https://lore.kernel.org/r/20220505133021.22362-2-jagathjog1996@gmail.com Signed-off-by: Jonathan Cameron Signed-off-by: Sasha Levin --- 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.35.1