From patchwork Sun Feb 11 07:56:36 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Petre Rodan X-Patchwork-Id: 199379 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:50ea:b0:106:860b:bbdd with SMTP id r10csp1820558dyd; Sat, 10 Feb 2024 23:58:51 -0800 (PST) X-Google-Smtp-Source: AGHT+IG3UwaU3tIglWCDzU9g6tUWSOWZ78JSdwiu2Ko75I7HBc8DphbBQTUM8/2yacvngDx15033 X-Received: by 2002:a62:e308:0:b0:6e0:9fa8:3d12 with SMTP id g8-20020a62e308000000b006e09fa83d12mr3533921pfh.5.1707638331757; Sat, 10 Feb 2024 23:58:51 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707638331; cv=pass; d=google.com; s=arc-20160816; b=E7lFySjlUwFKyWOFYPGvtMNgSFwqlUEh7bjil2llfvatojVbTnrna1HFXW2beoVxBg wy3qQt/29k+ABjohCDjcqkAeEq4N00YyfFt4RmJ+EWxsg2BVwwZSkOQ4cPYFGJ5R1Jlq rZmo13+DIhXQTht4y+x7f1vDhWiYIa/53rL1vgnchMfVW3z50pHQ32z8b7ozHod4C2Ph 4wHnDviLG/Y/hrJAQMrcgvhLvMzX1XV6MM6wnhqUEpiRtmrBrAVNBmv+zMdgMUC/eT1q 6wH7zO6DGI1H8FCSKAXndsjhqlhUs/+M4jAfMuiXDfdCZTFSGUIgyNpzUf6m7hre2KVB Jgcg== ARC-Message-Signature: i=2; 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=/cyuUWS1466p5sYnP/UOQLuIkTzJmBRK93BItUqnlSs=; fh=LTuAxkHlGJeJSxMUiNmszs5ClJ6PsOEvz4sm4QO/5UQ=; b=Mk90ByrAn+v3rqKgDt+Yo4JuEG+XtktKB9lByxpeoN3wHe3nBr95wjUqwl64s+wQRr rZNIs54YI1fjktL+fDLFKJl7+ipbyFnS2hae5growKzNTYX+QBrKCKKCk43rRmDFtYhe +l1UA4xYFUslrgC7CDHGnSc7Cc2FxnJjwJMrwUQL/leo0wo4/3X7IUh+TUPJrN3K4Tq7 UbzOJele3k/gUZG0CmCj//5Ayjg7tIZYn90usqRgHk1F6gKX2hB+TFmmxzb2rQQ63pAF o8hOJdka5XddHKYUBxRgVG8O0Ot4RdjGleY1XxSGcWXwMUHwYazXjCppy3sgrbkMX8y5 Kxmg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@subdimension.ro header.s=skycaves header.b=G9bS6ykP; arc=pass (i=1 spf=pass spfdomain=subdimension.ro dkim=pass dkdomain=subdimension.ro); spf=pass (google.com: domain of linux-kernel+bounces-60653-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-60653-ouuuleilei=gmail.com@vger.kernel.org" X-Forwarded-Encrypted: i=2; AJvYcCUpUXsDygM8AsGHj0glbpodUFQwZ/XR2epJK+6l2k+BBFcNNHh5KVY9TkzK+CtI0o1rlmbKQnvKBsOIt0lg4A8UW7thhQ== Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id lo17-20020a056a003d1100b006e02ddb10f4si3169230pfb.352.2024.02.10.23.58.51 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 10 Feb 2024 23:58:51 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-60653-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@subdimension.ro header.s=skycaves header.b=G9bS6ykP; arc=pass (i=1 spf=pass spfdomain=subdimension.ro dkim=pass dkdomain=subdimension.ro); spf=pass (google.com: domain of linux-kernel+bounces-60653-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-60653-ouuuleilei=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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 883A2283AAF for ; Sun, 11 Feb 2024 07:58:51 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 1277C4C61F; Sun, 11 Feb 2024 07:57:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=subdimension.ro header.i=@subdimension.ro header.b="G9bS6ykP" 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 AF22A45C14; Sun, 11 Feb 2024 07:56:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=172.104.132.142 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707638221; cv=none; b=uYDzISAt0YmT2xu8EooBv60QAB1al8813fegQkhNOLCXtlVVG6iJJr1+SewQTNwQnm5JEq33hognA9M7tj0uoJOS0tfkf3QertGkmjVMQYlVN/JXqLmriiqMmj/g7CBBPmGpQyJE7lARet85+tYRfsfpylHdHyRxnJ6n8UQ0LEo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707638221; c=relaxed/simple; bh=h9oO5QOlg26/w1S5GFWhUe5tICf6isWwo0AeSnwaHWQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Fr0CNeWBjNzaGd8PLGQPzrdQe6zdwWOh+4LJbyENTx3iQcorHvU0CTmybgh3k/muPcHhzA7js6ugWcbHfIU7H2z/nrsvb9U2qYa0jbh3uByBcFDL79fPtb/BgZ0z2L07JDSAa2A7nwykhyCtocZrJrD4VsLxHPwZ4JcvuJcFFjk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=subdimension.ro; spf=pass smtp.mailfrom=subdimension.ro; dkim=pass (1024-bit key) header.d=subdimension.ro header.i=@subdimension.ro header.b=G9bS6ykP; arc=none smtp.client-ip=172.104.132.142 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.101.32]) (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 EAD2730FB4B; Sun, 11 Feb 2024 07:56:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=subdimension.ro; s=skycaves; t=1707638210; bh=h9oO5QOlg26/w1S5GFWhUe5tICf6isWwo0AeSnwaHWQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=G9bS6ykPPFHQZR4vK4OGgQnvxYV7SM4TY0Zu1pJlITzCZ8AqSI5LnNejIypYJChhv ILv80Eq+zJkIukjz0RvMk8tpPdF4xQAiHd2lfEfkYC+DQqXCh/SsnsYtmfUDOksINz L/4ePiyQvm8wgO5DyF+D3YPEU07Bp6qIa5ZFWdbQ= From: Petre Rodan To: linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Petre Rodan , Jonathan Cameron , Lars-Peter Clausen Subject: [PATCH v3 5/6] iio: pressure: hsc030pa add mandatory delay Date: Sun, 11 Feb 2024 09:56:36 +0200 Message-ID: <20240211075645.28777-6-petre.rodan@subdimension.ro> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240211075645.28777-1-petre.rodan@subdimension.ro> References: <20240211075645.28777-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 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790588571353706563 X-GMAIL-MSGID: 1790588571353706563 Add a mandatory 2ms delay between consecutive chip reads. A Technical Note pdf 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. 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 --- v1 -> v3 no changes drivers/iio/pressure/hsc030pa.h | 1 + drivers/iio/pressure/hsc030pa_i2c.c | 3 +++ drivers/iio/pressure/hsc030pa_spi.c | 2 ++ 3 files changed, 6 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..818fa6303454 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,7 @@ 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); }