Received: by 2002:a05:7412:e794:b0:fa:551:50a7 with SMTP id o20csp1129096rdd; Wed, 10 Jan 2024 09:23:57 -0800 (PST) X-Google-Smtp-Source: AGHT+IFcP2asgk1eRRTfMZ9dUrelZqD/3SHKVyITYNWVrCqph/Cqq5T8lqdP5D86deCgsW0xYDJl X-Received: by 2002:a17:90a:ac16:b0:28c:4b9:4fcc with SMTP id o22-20020a17090aac1600b0028c04b94fccmr941716pjq.74.1704907437202; Wed, 10 Jan 2024 09:23:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704907437; cv=none; d=google.com; s=arc-20160816; b=0QHxb2Zx8bUasYcdhR78k+uD1oF8TBKFxSv5QGaKmBnU7MThnEkV91YegjEJXkS6s8 l3VlvuN38ykUpMTY854/bB6Q2MdUIue7GWGOqMzC8mNaiYHlIdLkfImAib/n91vAWJ+P oGy0GZ4OMSuBgZmeqlI6MWTDe5DBMYjV2RGsOkMAP+l0snl2pfTGov8qFgYKyPgYVWkP H4/1jmd0jqJows592qZHuhinUqgwKC7MqJv/hcu2mKgb9AAy3ALjFfvWAlH7xVWWukaa TX8E5uRDIGZzscAZvgwiuC9dKngIfPei37jEJ7BIhNXMHl2snV78VJvFuWtePWyEXtAR Bw5Q== 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=20sJVa2TliHJHyaFQzTgAIa3C7vSqtTYxDXykl8tAx0=; fh=RpJjGiuDlOjmyoLhPwSzjbPbeK51vYo3I0V3BuRLNmU=; b=rvMTFL9UKdbnLRp1hq4MHSi3B54VhalRvAQjEtKIaCmu/Opdn1CavYRHN0VIlbJu/6 w1RmJ14RYflgnP27m6CmiKvY1vY+lr8l0MMClxRnEPXV3iva5TTDGxP9mj0KMpt4Ihcv tzFIfnaR/Tko6EDS8MS6lSkxutF0cTvOcYnFgcjQDr18YzV8bfgF2Ad16KZ7AvZr0f/9 IsP/lgHw0+aOyvvs91XdbA50O0By/VT3J2ReRXPAJNSa8eFpY4vYwIoeWArdgEgVqskR NvHt+gyyrhPwupcY4YeeBLAcDFO4pnFH1Q6z1TcgduYnjid0YQlcKfhULAxUqiYs9KMf 5+Rw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@subdimension.ro header.s=skycaves header.b=kKvFcFA3; spf=pass (google.com: domain of linux-kernel+bounces-22524-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-22524-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id iq18-20020a17090afb5200b0028d0d35df7dsi1762086pjb.62.2024.01.10.09.23.56 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Jan 2024 09:23:57 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-22524-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@subdimension.ro header.s=skycaves header.b=kKvFcFA3; spf=pass (google.com: domain of linux-kernel+bounces-22524-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-22524-linux.lists.archive=gmail.com@vger.kernel.org" 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 2F826B23797 for ; Wed, 10 Jan 2024 17:23:52 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id BEA5E4D588; Wed, 10 Jan 2024 17:23:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=subdimension.ro header.i=@subdimension.ro header.b="kKvFcFA3" 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 7A9524D106; Wed, 10 Jan 2024 17:23:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=none (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 AB2922997D9; Wed, 10 Jan 2024 17:23:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=subdimension.ro; s=skycaves; t=1704907393; bh=bJudPKqGqIgjI+/dfFvGjSd/B1+nwirpU35vJKxcnno=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=kKvFcFA3eZvR+v7AAVF3GVhKcJ4nwkwV2mITWr5yoMkiG6rY85LirBHnhI+6ZBIcv DfNDVroWA1rbSo46zNcPIbkK1lpxOTAl9rT23mqMifDKNoYvmVKHdaG81cr+qboRiv lajI+0PWd7QOUvHVO8PWNW5Z3rP5kgLiigxWvKKc= From: Petre Rodan To: linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Petre Rodan , Jonathan Cameron , Lars-Peter Clausen Subject: [PATCH 4/6] iio: pressure: hsc030pa add mandatory delay Date: Wed, 10 Jan 2024 19:22:39 +0200 Message-ID: <20240110172306.31273-5-petre.rodan@subdimension.ro> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240110172306.31273-1-petre.rodan@subdimension.ro> References: <20240110172306.31273-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 Add a mandatory 2ms delay between consecutive chip reads. I found a new Technical Note pdf that specifies that the measurement cycle in these chips takes around 1.26ms. By adding this 2ms delay we make sure that we never get stale measurements. This feature is also needed by the "iio: pressure: hsc030pa add sleep mode" patch below. For more details, please see "Figure 1" in the pdf below: https://prod-edam.honeywell.com/content/dam/honeywell-edam/sps/siot/en-us/products/sensors/pressure-sensors/common/documents/sps-siot-sleep-mode-technical-note-008286-1-en-ciid-155793.pdf Signed-off-by: Petre Rodan --- drivers/iio/pressure/hsc030pa.h | 1 + drivers/iio/pressure/hsc030pa_i2c.c | 3 +++ drivers/iio/pressure/hsc030pa_spi.c | 3 +++ 3 files changed, 7 insertions(+) diff --git a/drivers/iio/pressure/hsc030pa.h b/drivers/iio/pressure/hsc030pa.h index f1079a70799f..56dc8e88194b 100644 --- a/drivers/iio/pressure/hsc030pa.h +++ b/drivers/iio/pressure/hsc030pa.h @@ -13,6 +13,7 @@ #include #define HSC_REG_MEASUREMENT_RD_SIZE 4 +#define HSC_RESP_TIME_MS 2 struct device; diff --git a/drivers/iio/pressure/hsc030pa_i2c.c b/drivers/iio/pressure/hsc030pa_i2c.c index b5810bafef40..b3fd230e71da 100644 --- a/drivers/iio/pressure/hsc030pa_i2c.c +++ b/drivers/iio/pressure/hsc030pa_i2c.c @@ -8,6 +8,7 @@ * Datasheet: https://prod-edam.honeywell.com/content/dam/honeywell-edam/sps/siot/en-us/products/sensors/pressure-sensors/common/documents/sps-siot-sleep-mode-technical-note-008286-1-en-ciid-155793.pdf */ +#include #include #include #include @@ -25,6 +26,8 @@ static int hsc_i2c_recv(struct hsc_data *data) struct i2c_msg msg; int ret; + msleep_interruptible(HSC_RESP_TIME_MS); + msg.addr = client->addr; msg.flags = client->flags | I2C_M_RD; msg.len = HSC_REG_MEASUREMENT_RD_SIZE; diff --git a/drivers/iio/pressure/hsc030pa_spi.c b/drivers/iio/pressure/hsc030pa_spi.c index 8d3441f1dcf9..737197eddff0 100644 --- a/drivers/iio/pressure/hsc030pa_spi.c +++ b/drivers/iio/pressure/hsc030pa_spi.c @@ -8,6 +8,7 @@ * Datasheet: https://prod-edam.honeywell.com/content/dam/honeywell-edam/sps/siot/en-us/products/sensors/pressure-sensors/common/documents/sps-siot-sleep-mode-technical-note-008286-1-en-ciid-155793.pdf */ +#include #include #include #include @@ -28,6 +29,8 @@ static int hsc_spi_recv(struct hsc_data *data) .len = HSC_REG_MEASUREMENT_RD_SIZE, }; + msleep_interruptible(HSC_RESP_TIME_MS); + return spi_sync_transfer(spi, &xfer, 1); } -- 2.41.0