Received: by 2002:a05:7412:b995:b0:f9:9502:5bb8 with SMTP id it21csp1893983rdb; Sun, 24 Dec 2023 06:37:20 -0800 (PST) X-Google-Smtp-Source: AGHT+IGVSm2/KIc3tdYisHJd5pvKkS4f2zCxLJMi3uaonLKg0tnKJqjZSiHszN801zFqfUijjlNo X-Received: by 2002:a05:6e02:349f:b0:35f:eb24:6bbe with SMTP id bp31-20020a056e02349f00b0035feb246bbemr6105542ilb.41.1703428640663; Sun, 24 Dec 2023 06:37:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703428640; cv=none; d=google.com; s=arc-20160816; b=olKIQEd+vGFsqEjZjzHubYu/+CLevK5NZDQdkC3aaeavShqPvqbbreMNLX0ehV5ZpL 10HIp2zwqcHnsu+CvrshR08/Tr3qjXFcHsJKovkaJvii9ENVvRCgo8zowCEI/0gCLdvr edQLP6G4O39tRBJmiYq205MD1Mx1ngkDLos1JJHlnlwZb5avTHBVRphaZZS8zNEOpF+p pcNKd1PlnDgDlIiaoFtSL5eiaEKY1szktda+6Dfiy1o1pxm6tI6bZR2nCrr2rUcIlOQ4 O7AjC9MOx4FE7qjJb0WaX2bDHVUnfvSgg2nu8w0mpx2LDw5MVPeebheH/YooG3TMFitn 06eg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=l+WbjiSPttgkzMPObEerdUnw+7bIGedu47TBP2OO5E8=; fh=cuSrpdmFbNnIGKLvcD6905UtzyKVEbJe+tTFY3eiseU=; b=rolGIFLzSeICTkd+maJ5PeVX7WjyIYWWtYvQi3MvshU7Vtc0CwQluml7zAILtesRJx ML2PvFQ8Jbh9DiL3yFTnLSg6W6pRdTXlFkoyIOjmz+OmueEOt1nRW2heFzuNBEZXHJXn v2uaEPmflj1SSZ9M5ar4JCPOZIpuRmp7KTWcRObeeXzSAm2oNrBQrmVEA3+nM60TPuRr PfG5VmAM8BDTl8r4zhI7Xz4//pxqYPZzo0R41LHeFV+ZgYoTewsp+q4M8jE0qyBy1SQL HCqtUIDv3nRDIfMWpt2nb0Tio3z5hTp7NPwX0B0QZhmVzawDi2jJO7JpxtbmjApW8Hba 73Sg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@subdimension.ro header.s=skycaves header.b=DFtXG4Gv; spf=pass (google.com: domain of linux-kernel+bounces-10731-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-10731-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=subdimension.ro Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id o8-20020a17090ac08800b0028bc7cefee2si6586697pjs.34.2023.12.24.06.37.20 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 24 Dec 2023 06:37:20 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-10731-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@subdimension.ro header.s=skycaves header.b=DFtXG4Gv; spf=pass (google.com: domain of linux-kernel+bounces-10731-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-10731-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=subdimension.ro Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 4ED80B215F9 for ; Sun, 24 Dec 2023 14:37:12 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3349510A27; Sun, 24 Dec 2023 14:35:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=subdimension.ro header.i=@subdimension.ro header.b="DFtXG4Gv" X-Original-To: linux-kernel@vger.kernel.org Received: from mail.subdimension.ro (skycaves.subdimension.ro [172.104.132.142]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CE769C8FF; Sun, 24 Dec 2023 14:35:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=subdimension.ro Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=subdimension.ro Received: from localhost.localdomain (unknown [188.24.94.216]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mail.subdimension.ro (Postfix) with ESMTPSA id 908FE28B587; Sun, 24 Dec 2023 14:35:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=subdimension.ro; s=skycaves; t=1703428511; bh=TorcAZcZKDG1z0F/unbmrv9wp4dcwJcvTKt25PvrhyE=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=DFtXG4GvUwQ2ns94vrVKLH0jDz6XEmK/tdCJCMoG/Nmm2tHtMZDwKFP3O9vfgLJ4K plV4eWge9vXJxKGFZcI2xrM9AjVBtPQW2V7gHSg0WOCCmnZAbPFj33cjs4cQ0zr7Uu 8qgbNpyfkPHqEqs6QZQp4o7KVkg9D4KVpK3djA+8= From: Petre Rodan To: linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Petre Rodan , Andreas Klinger , Jonathan Cameron , Lars-Peter Clausen , Andy Shevchenko , Angel Iglesias , Matti Vaittinen Subject: [PATCH v2 05/10] iio: pressure: mprls0025pa.c fix error flag check Date: Sun, 24 Dec 2023 16:34:50 +0200 Message-ID: <20231224143500.10940-6-petre.rodan@subdimension.ro> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231224143500.10940-1-petre.rodan@subdimension.ro> References: <20231224143500.10940-1-petre.rodan@subdimension.ro> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Take into account all 3 error flags while interacting with the sensor. Based on the datasheet, in table 14 on page 14, the status byte contains: bit 5 busy flag - 1 if device is busy bit 2 memory integrity/error flag - 1 if integrity test failed bit 0 math saturation - 1 if internal math saturation has occurred Signed-off-by: Petre Rodan Signed-off-by: Andreas Klinger --- drivers/iio/pressure/mprls0025pa.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/iio/pressure/mprls0025pa.c b/drivers/iio/pressure/mprls0025pa.c index e3f0de020a40..233cc1dc38ad 100644 --- a/drivers/iio/pressure/mprls0025pa.c +++ b/drivers/iio/pressure/mprls0025pa.c @@ -39,6 +39,8 @@ #define MPR_I2C_MEMORY BIT(2) /* integrity test passed */ #define MPR_I2C_MATH BIT(0) /* internal math saturation */ +#define MPR_I2C_ERR_FLAG (MPR_I2C_BUSY | MPR_I2C_MEMORY | MPR_I2C_MATH) + /* * support _RAW sysfs interface: * @@ -213,7 +215,7 @@ static int mpr_read_pressure(struct mpr_data *data, s32 *press) status); return status; } - if (!(status & MPR_I2C_BUSY)) + if (!(status & MPR_I2C_ERR_FLAG)) break; } if (i == nloops) { @@ -233,7 +235,7 @@ static int mpr_read_pressure(struct mpr_data *data, s32 *press) return -EIO; } - if (buf[0] & MPR_I2C_BUSY) { + if (buf[0] & MPR_I2C_ERR_FLAG) { /* * it should never be the case that status still indicates * business -- 2.41.0