From patchwork Sun Feb 11 07:56:32 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Petre Rodan X-Patchwork-Id: 13552384 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 4489544C73; Sun, 11 Feb 2024 07:56:56 +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=1707638219; cv=none; b=FkWyYzkaTPfCjRJVOEoDlmKfOwewW+2op3TP9FJ3hW0jON4S9LUjgDMopYbwyGHmTdzuug0dBGtpZtHWzaXkXfcYO0MXe0LuvjOHnxsL98/xU6n4xdoyMuGRrxLh1h4NaO0ScvVCdNjPmom6ZD6nQL+oeiPZ383Qwq+rxWmi5TQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707638219; c=relaxed/simple; bh=ssqUa2WO6ImmQTiORIBKgCT7bL6cC03SOZkFNoSNvTI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=igYeTOs+4+QMtuEOuxRd1YfVzlTIA005MwXaBEcq/tH967CnfKnk1BJV89IS2EoYWjQxfRsfRRs5ne/ymQ6GPBieMLdGPvp5/KdKogLfNJArCSTa5STPsmIjh+BQh0ss4j+nuVarcB6l0XO4+xl/tdGrbyQj/0dIYAk4wjRZP4Q= 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=eoDPkcoI; 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=subdimension.ro header.i=@subdimension.ro header.b="eoDPkcoI" 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 B107A331877; Sun, 11 Feb 2024 07:56:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=subdimension.ro; s=skycaves; t=1707638209; bh=ssqUa2WO6ImmQTiORIBKgCT7bL6cC03SOZkFNoSNvTI=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=eoDPkcoIXPKp0jXFgIOfJzEI94mmPOsrG4vRtVN22gQRIAFewhHGcyaxOLYgIqpz8 BRZW4nUZvCzXqZvk1rqRU1jkd1md6+QmkwQy7t6/cspQ+fIRyksOaqNnqTwaky1ETU MuCK5VNd86D2Fo7axyLQcfCoWxuJqKW/REG8oawY= From: Petre Rodan To: linux-iio@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Petre Rodan , Jonathan Cameron , Lars-Peter Clausen , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Krzysztof Kozlowski Subject: [PATCH v3 1/6] dt-bindings: iio: pressure: honeywell,hsc030pa.yaml add spi props Date: Sun, 11 Feb 2024 09:56:32 +0200 Message-ID: <20240211075645.28777-2-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-iio@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Add spi-peripheral-props.yaml requirement needed by the spi-max-frequency property. Reviewed-by: Krzysztof Kozlowski Signed-off-by: Petre Rodan --- v1 -> v2 change the commit message based on Krzysztof's request v2 -> v3 no changes .../devicetree/bindings/iio/pressure/honeywell,hsc030pa.yaml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Documentation/devicetree/bindings/iio/pressure/honeywell,hsc030pa.yaml b/Documentation/devicetree/bindings/iio/pressure/honeywell,hsc030pa.yaml index 65a24ed67b3c..89977b9f01cf 100644 --- a/Documentation/devicetree/bindings/iio/pressure/honeywell,hsc030pa.yaml +++ b/Documentation/devicetree/bindings/iio/pressure/honeywell,hsc030pa.yaml @@ -99,6 +99,9 @@ required: - honeywell,transfer-function - honeywell,pressure-triplet +allOf: + - $ref: /schemas/spi/spi-peripheral-props.yaml + additionalProperties: false dependentSchemas: From patchwork Sun Feb 11 07:56:33 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Petre Rodan X-Patchwork-Id: 13552382 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 448644437A; Sun, 11 Feb 2024 07:56:56 +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=1707638218; cv=none; b=AZnOR3gdz1fwAXhDmKfM0ZBoWQvWT82BtTHQnaI3IMu4PLT3vxqyxWi1pm/ETkqfL0Q5WZyA/ABt/8v2fRbg9rlKsKk8QQ4qo8zmBKmTNdVEk1E5yevypbdrD9K3QzhCHfK2lCSwI5lzs/ZdN9dQbi6QrERlXusBCYM94Jpt/WI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707638218; c=relaxed/simple; bh=6AKgtrBfCsel99oJPCAdmr2PiW5gpjpbUluGKeTb9f0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=pfSSvt9k3yzgYiWs2G7sORxdFhk1Yml9RdpiUbIhjN9D8nZpetg6zDFW5f2bKbzvs6kQKIle5ZIP2s2+Xb5iFaBXH9BSrU3VcnnBrUw7HZLgrmKN/+CAJIeI2jcHyvtq+ljIvCNpfKs4Lfe+rg8is1NZDxjaCQr447P6wvlw9OU= 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=AXuAnsP4; 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=subdimension.ro header.i=@subdimension.ro header.b="AXuAnsP4" 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 1CD4A327B85; 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=1707638209; bh=6AKgtrBfCsel99oJPCAdmr2PiW5gpjpbUluGKeTb9f0=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=AXuAnsP4jq5ARLjpnPbunCokwUwWzvPk4NpkL3xoiCmBoyZp1ihKkzLFUbz8Wq5Qx eFFjZIvYlPx4WdcR/45b2vYQKUwPfUg9A1qoRjyKbh1B6Hv2R4C8sI6ab83uFNTZ5N EdE7nQSpdadKuU1HRuAcfr51RsWwZlbEbHDjNfXY= 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 2/6] iio: pressure: hsc030pa: use signed type to hold div_64() result Date: Sun, 11 Feb 2024 09:56:33 +0200 Message-ID: <20240211075645.28777-3-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-iio@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Use signed type to variable holding the result given by div_s64(). Signed-off-by: Petre Rodan --- v1 -> v2 no changes v2 -> v3 split cleanup patch into 3 parts, no code changes drivers/iio/pressure/hsc030pa.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/iio/pressure/hsc030pa.c b/drivers/iio/pressure/hsc030pa.c index d6a51f0c335f..7e3f74d53b47 100644 --- a/drivers/iio/pressure/hsc030pa.c +++ b/drivers/iio/pressure/hsc030pa.c @@ -406,7 +406,7 @@ int hsc_common_probe(struct device *dev, hsc_recv_fn recv) struct hsc_data *hsc; struct iio_dev *indio_dev; const char *triplet; - u64 tmp; + s64 tmp; int ret; indio_dev = devm_iio_device_alloc(dev, sizeof(*hsc)); From patchwork Sun Feb 11 07:56:34 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Petre Rodan X-Patchwork-Id: 13552383 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 55F0D45016; Sun, 11 Feb 2024 07:56:57 +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=1707638218; cv=none; b=cOrQIHzH9GQfK2jRPFaKNg2DW/3kSdt0jKzrBcWghISj8yoM/+C/aYxJVuXHtCejLyHZ15jFMoyR05NOw60h4M+O649d2cbWF7rdkDqq6kwIM29OZepKKgwhrgOm9fPBTIu8W8NRXS+1XDHDH3aXMx9V/FAZ86WaDoBmSxDk4Wk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707638218; c=relaxed/simple; bh=KPGBnj0ZTjzETULRrhkS68q97OwTkGoJ0Kz/Oy+38+E=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=foVdIkG+EOxfj+7+uC0YbB1NnnulK97tIhYLeY7Ef9hOSX6rS/hvOaECghBCiYbjydlIsi40e4IusfrrAln8c1WelZF4+Hg4+8a8vpkvoE9ujbBLw2G7iO71P5FpqF2sLnueElr39nK70/Ijx+q4bLtXRJ/RMCi1jWEFrVXhSsE= 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=ZLcX3PHD; 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=subdimension.ro header.i=@subdimension.ro header.b="ZLcX3PHD" 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 6886F33BBBB; 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=1707638209; bh=KPGBnj0ZTjzETULRrhkS68q97OwTkGoJ0Kz/Oy+38+E=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=ZLcX3PHDP2ihgdgBQp+gV53OxjvjcJNKraYw8PjjLjK3riO4MGcENlyOxABjamQBg dwsZcBUx4BqlB6bNZ638yKNlOs0lcQ4dWS0xj5TDzVWMdtzLioCjO30m4NbBoLc9NE 6NCZ1kub/wuOQPlcC4uelvTZ+F2lvU5VHOIDiMz0= 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 3/6] iio: pressure: hsc030pa: include cleanup Date: Sun, 11 Feb 2024 09:56:34 +0200 Message-ID: <20240211075645.28777-4-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-iio@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Add includes based on prior reviews from Andy. Signed-off-by: Petre Rodan --- v1 -> v2 no changes v2 -> v3 split cleanup patch into 3 parts, no code changes drivers/iio/pressure/hsc030pa.h | 2 ++ drivers/iio/pressure/hsc030pa_i2c.c | 2 ++ 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 d20420dba4f6..f1079a70799f 100644 --- a/drivers/iio/pressure/hsc030pa.h +++ b/drivers/iio/pressure/hsc030pa.h @@ -10,6 +10,8 @@ #include +#include + #define HSC_REG_MEASUREMENT_RD_SIZE 4 struct device; diff --git a/drivers/iio/pressure/hsc030pa_i2c.c b/drivers/iio/pressure/hsc030pa_i2c.c index e2b524b36417..b0c47f863afb 100644 --- a/drivers/iio/pressure/hsc030pa_i2c.c +++ b/drivers/iio/pressure/hsc030pa_i2c.c @@ -8,10 +8,12 @@ * Datasheet: https://prod-edam.honeywell.com/content/dam/honeywell-edam/sps/siot/en-us/products/sensors/pressure-sensors/board-mount-pressure-sensors/common/documents/sps-siot-i2c-comms-digital-output-pressure-sensors-tn-008201-3-en-ciid-45841.pdf [i2c related] */ +#include #include #include #include #include +#include #include diff --git a/drivers/iio/pressure/hsc030pa_spi.c b/drivers/iio/pressure/hsc030pa_spi.c index a719bade8326..f6da49cdb5e5 100644 --- a/drivers/iio/pressure/hsc030pa_spi.c +++ b/drivers/iio/pressure/hsc030pa_spi.c @@ -7,10 +7,12 @@ * Datasheet: https://prod-edam.honeywell.com/content/dam/honeywell-edam/sps/siot/en-us/products/sensors/pressure-sensors/board-mount-pressure-sensors/trustability-hsc-series/documents/sps-siot-trustability-hsc-series-high-accuracy-board-mount-pressure-sensors-50099148-a-en-ciid-151133.pdf */ +#include #include #include #include #include +#include #include From patchwork Sun Feb 11 07:56:35 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Petre Rodan X-Patchwork-Id: 13552386 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 574FE45018; Sun, 11 Feb 2024 07:56:57 +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=1707638220; cv=none; b=tCFWJ3NtISMfcuSIxcBOGa6/La+LmQ+x5uA88ovI767eYR6gks3cJrg0Na2dAyXxQ2YTU+83Lcrp/n61rinGE6vZcK3EAleu7ks6uJghpqlne3yGfLQE94+Zsflj7BZSeKOhsyJofT4os81V+d3dNCtPz59iQ9b5G094AuiKP2I= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707638220; c=relaxed/simple; bh=wNBkdVLyeOQ8x7+iyTGkd18QjqQbam0wLSd/ELJIWfw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ars/S6BrA7lHJfNTGUi6TAt5cvVFznTRPfCtbaQDJ+onk5C9Rv6X2719PlXB6fwT1n22PTaCUtvl83baCW299XKztoz5DqYyFe4nOJrs4yor4euXAeeKNu9+BG8mR4ZodmMeeDmf5PcfV4uOeL+6d8HklRbbi2oiiyRubzN7FAY= 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=vO9wcHof; 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=subdimension.ro header.i=@subdimension.ro header.b="vO9wcHof" 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 AADA933BBBD; 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=1707638209; bh=wNBkdVLyeOQ8x7+iyTGkd18QjqQbam0wLSd/ELJIWfw=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=vO9wcHof7POCfjrX+pzF2SLjiQgOVQsuiZS05FFn9iSfJpzFGBhCcrTkplkRzihmK lINysF0o6MXs7W9ZlD8dZZ3f1dVYDFQkb7vux+XfakUwtXgAXuOKa6XVrPPxdSTuas dBaI18aZDvWfr7xb1kKI0RypmuRTQWQtpIz2u2rA= 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 4/6] iio: pressure: hsc030pa: update datasheet URLs Date: Sun, 11 Feb 2024 09:56:35 +0200 Message-ID: <20240211075645.28777-5-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-iio@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Provide bus-specific technical datasheet in the _i2c.c _spi.c headers instead of the generic one. Signed-off-by: Petre Rodan --- v1 -> v2 no changes v2 -> v3 split cleanup patch into 3 parts, no code changes drivers/iio/pressure/hsc030pa_i2c.c | 4 ++-- drivers/iio/pressure/hsc030pa_spi.c | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/iio/pressure/hsc030pa_i2c.c b/drivers/iio/pressure/hsc030pa_i2c.c index b0c47f863afb..b5810bafef40 100644 --- a/drivers/iio/pressure/hsc030pa_i2c.c +++ b/drivers/iio/pressure/hsc030pa_i2c.c @@ -4,8 +4,8 @@ * * Copyright (c) 2023 Petre Rodan * - * Datasheet: https://prod-edam.honeywell.com/content/dam/honeywell-edam/sps/siot/en-us/products/sensors/pressure-sensors/board-mount-pressure-sensors/trustability-hsc-series/documents/sps-siot-trustability-hsc-series-high-accuracy-board-mount-pressure-sensors-50099148-a-en-ciid-151133.pdf [hsc] - * Datasheet: https://prod-edam.honeywell.com/content/dam/honeywell-edam/sps/siot/en-us/products/sensors/pressure-sensors/board-mount-pressure-sensors/common/documents/sps-siot-i2c-comms-digital-output-pressure-sensors-tn-008201-3-en-ciid-45841.pdf [i2c related] + * Datasheet: https://prod-edam.honeywell.com/content/dam/honeywell-edam/sps/siot/en-us/products/sensors/pressure-sensors/board-mount-pressure-sensors/common/documents/sps-siot-i2c-comms-digital-output-pressure-sensors-tn-008201-3-en-ciid-45841.pdf + * 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 diff --git a/drivers/iio/pressure/hsc030pa_spi.c b/drivers/iio/pressure/hsc030pa_spi.c index f6da49cdb5e5..8d3441f1dcf9 100644 --- a/drivers/iio/pressure/hsc030pa_spi.c +++ b/drivers/iio/pressure/hsc030pa_spi.c @@ -4,7 +4,8 @@ * * Copyright (c) 2023 Petre Rodan * - * Datasheet: https://prod-edam.honeywell.com/content/dam/honeywell-edam/sps/siot/en-us/products/sensors/pressure-sensors/board-mount-pressure-sensors/trustability-hsc-series/documents/sps-siot-trustability-hsc-series-high-accuracy-board-mount-pressure-sensors-50099148-a-en-ciid-151133.pdf + * Datasheet: https://prod-edam.honeywell.com/content/dam/honeywell-edam/sps/siot/en-us/products/sensors/pressure-sensors/common/documents/sps-siot-spi-comms-digital-ouptu-pressure-sensors-tn-008202-3-en-ciid-45843.pdf + * 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 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: 13552387 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=subdimension.ro header.i=@subdimension.ro header.b="G9bS6ykP" 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-iio@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 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); } From patchwork Sun Feb 11 07:56:37 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Petre Rodan X-Patchwork-Id: 13552388 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 AF1F745C12; 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=iqs7yDEldYezoMbh7kmRgITAB5GWx5sJd8JxcMrs8POs8KEDSDSsCiE/ZZDynsYJXSg+E4tfwrrm6S1Q2TySHEO3x+yK8/eOD3UeJFeRsIe5vOU8WLp4Ql6LDggEu8KEWIJt8ZqD6603NYQPs1WOkIb9PDi0ewLMICnMbBtqiN8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707638221; c=relaxed/simple; bh=UVd7+V2rqSalUQgPUjmz/S3icJ28UTSb6PeWFe4ToSU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=EBiTieuVcos+kpaA1DnqXWscz74FopXtPKS9k8mqFwwl4urtmuktIpJmt98RQcAh06MqyDOVcSzDB3+UAT9nvD7Rs1x9XFMA3GBZ9si34FN7Qfbq9OoF0b7V1iJ1rWTrgwzDpfz+XZXGt0d6CjT+1pu+7EQko8f5YMECDLYhLoo= 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=IFBzVMHE; 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=subdimension.ro header.i=@subdimension.ro header.b="IFBzVMHE" 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 36CE930FB54; Sun, 11 Feb 2024 07:56:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=subdimension.ro; s=skycaves; t=1707638210; bh=UVd7+V2rqSalUQgPUjmz/S3icJ28UTSb6PeWFe4ToSU=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=IFBzVMHE06tdit4VK7X/I3ev870lmPdPY/gKqWI2tW14eW0v12eFf6G/m9at/p4rl l0lPStg+y3r0mHszcO5d0oMOIFVdUY2cYYY0Q4n83xBtLr2P5Cj2ooSGhg5EBRfnX5 NI1BvjaUfcK2Ack3Jd8MWQ4Nhaa3rp4cXl4t7p1k= 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 6/6] iio: pressure: hsc030pa add triggered buffer Date: Sun, 11 Feb 2024 09:56:37 +0200 Message-ID: <20240211075645.28777-7-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-iio@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Add triggered buffer feature. Signed-off-by: Petre Rodan --- v1 -> v2 add Kconfig select for IIO_*BUFFER a few changes based on Jonathan's review v2 -> v3 fixed array pointer based on Andy's review drivers/iio/pressure/Kconfig | 2 ++ drivers/iio/pressure/hsc030pa.c | 47 +++++++++++++++++++++++++++++++++ drivers/iio/pressure/hsc030pa.h | 4 +++ 3 files changed, 53 insertions(+) diff --git a/drivers/iio/pressure/Kconfig b/drivers/iio/pressure/Kconfig index 5da7931dc537..3ad38506028e 100644 --- a/drivers/iio/pressure/Kconfig +++ b/drivers/iio/pressure/Kconfig @@ -114,6 +114,8 @@ config HSC030PA depends on (I2C || SPI_MASTER) select HSC030PA_I2C if I2C select HSC030PA_SPI if SPI_MASTER + select IIO_BUFFER + select IIO_TRIGGERED_BUFFER help Say Y here to build support for the Honeywell TruStability HSC and SSC pressure and temperature sensor series. diff --git a/drivers/iio/pressure/hsc030pa.c b/drivers/iio/pressure/hsc030pa.c index 7e3f74d53b47..1682b90d4557 100644 --- a/drivers/iio/pressure/hsc030pa.c +++ b/drivers/iio/pressure/hsc030pa.c @@ -22,8 +22,11 @@ #include #include +#include #include #include +#include +#include #include @@ -297,6 +300,29 @@ static int hsc_get_measurement(struct hsc_data *data) return 0; } +static irqreturn_t hsc_trigger_handler(int irq, void *private) +{ + struct iio_poll_func *pf = private; + struct iio_dev *indio_dev = pf->indio_dev; + struct hsc_data *data = iio_priv(indio_dev); + int ret; + + ret = hsc_get_measurement(data); + if (ret) + goto error; + + memcpy(&data->scan.chan[0], &data->buffer[0], 2); + memcpy(&data->scan.chan[1], &data->buffer[2], 2); + + iio_push_to_buffers_with_timestamp(indio_dev, &data->scan, + iio_get_time_ns(indio_dev)); + +error: + iio_trigger_notify_done(indio_dev->trig); + + return IRQ_HANDLED; +} + /* * IIO ABI expects * value = (conv + offset) * scale @@ -382,13 +408,29 @@ static const struct iio_chan_spec hsc_channels[] = { .info_mask_separate = BIT(IIO_CHAN_INFO_RAW) | BIT(IIO_CHAN_INFO_SCALE) | BIT(IIO_CHAN_INFO_OFFSET), + .scan_index = 0, + .scan_type = { + .sign = 'u', + .realbits = 14, + .storagebits = 16, + .endianness = IIO_BE, + }, }, { .type = IIO_TEMP, .info_mask_separate = BIT(IIO_CHAN_INFO_RAW) | BIT(IIO_CHAN_INFO_SCALE) | BIT(IIO_CHAN_INFO_OFFSET), + .scan_index = 1, + .scan_type = { + .sign = 'u', + .realbits = 11, + .storagebits = 16, + .shift = 5, + .endianness = IIO_BE, + }, }, + IIO_CHAN_SOFT_TIMESTAMP(2), }; static const struct iio_info hsc_info = { @@ -485,6 +527,11 @@ int hsc_common_probe(struct device *dev, hsc_recv_fn recv) indio_dev->channels = hsc->chip->channels; indio_dev->num_channels = hsc->chip->num_channels; + ret = devm_iio_triggered_buffer_setup(dev, indio_dev, NULL, + hsc_trigger_handler, NULL); + if (ret) + return ret; + return devm_iio_device_register(dev, indio_dev); } EXPORT_SYMBOL_NS(hsc_common_probe, IIO_HONEYWELL_HSC030PA); diff --git a/drivers/iio/pressure/hsc030pa.h b/drivers/iio/pressure/hsc030pa.h index 56dc8e88194b..9b40f46f575f 100644 --- a/drivers/iio/pressure/hsc030pa.h +++ b/drivers/iio/pressure/hsc030pa.h @@ -56,6 +56,10 @@ struct hsc_data { s32 p_scale_dec; s64 p_offset; s32 p_offset_dec; + struct { + __be16 chan[2]; + s64 timestamp __aligned(8); + } scan; u8 buffer[HSC_REG_MEASUREMENT_RD_SIZE] __aligned(IIO_DMA_MINALIGN); };