From patchwork Wed Jan 10 17:22: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: 186959 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:2411:b0:101:2151:f287 with SMTP id m17csp937586dyi; Wed, 10 Jan 2024 09:24:43 -0800 (PST) X-Google-Smtp-Source: AGHT+IFPEmbmz5B6xF59rLnLYr4jz2PJPW78RyxY66ja2efSdk1M44jhg0saYrnPOfMhJeZP2641 X-Received: by 2002:a17:90a:1042:b0:28d:b6c3:17ed with SMTP id y2-20020a17090a104200b0028db6c317edmr931981pjd.41.1704907482836; Wed, 10 Jan 2024 09:24:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704907482; cv=none; d=google.com; s=arc-20160816; b=OIe0bJvTRisvxhlF2RgSrZUYWhJCIQ5fqYPgyOhB0ew2ilf7gg/ZbgIQAWa0/PoMxw +i459z9PLTuJ4wPTSykfgmOcVYkS+fS8WQjXPkhdfXq21CM0k4h0/oHgWr4EDKx6nTWG HkVwwQ4e9h24Vo50G89Q5xW4PaYNHVe0g2cD9OxAFSHTUZroD8XffcZ71fb0NVyMke6v gNqa2DfpJy11qNEL1JTI5S/MEioIaVsEBxw3fBE2Nq3Uirk96+YivrXawzKnDINeGi22 DGYbmYPmCr+zxXgkNUOqBUgn5i2Ml6cbW0VYHlZwiEfA27MhIGkfKUF2d9818acP9EPG 97ow== 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=CYrZxEkCIJn8pC8m7tJFRBnQQf3GqHUY45Aqdxv8FYk=; fh=qAPe5qiEjGEI6PAB4iGo703ejtRIE8f07Uvyp/kzsRs=; b=PZklC2ZYi02qjg5LY9Mi51ss8wuYj5E2lXB4A8rrf+I1i3vWADikHErxMNbryj/Qib 8pWMDPVnTsbd7MeUB5dzAN00uNTrugusLTRHTcjFD+Y6qNM9n5FCaBVBSE3QKc0Di/EH senAw0LjSvqEi+mFcDsloJVMpfZKMOWD/SUw3CZVkKCFFefb5/RdgwBJzf4sD8vY8Vf0 y3N0OCiIzhYEAdG6msdQ7SgAXmQXnS37V2mivLNEH8QZRwnQJz2FNoclkikhActNDRWr G4lbx9ZD+BU7cSnqnlBGmRONNvN9rFAt8cGV5C1Zwgfr2gp/cDZ+qIA8Ldoz3ar0kFR/ r3WA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@subdimension.ro header.s=skycaves header.b=Pp+AexdE; spf=pass (google.com: domain of linux-kernel+bounces-22525-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-22525-ouuuleilei=gmail.com@vger.kernel.org" Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id z7-20020a170903018700b001d54c4a7f65si1384412plg.147.2024.01.10.09.24.42 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Jan 2024 09:24:42 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-22525-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=Pp+AexdE; spf=pass (google.com: domain of linux-kernel+bounces-22525-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-22525-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 2DD0228A11B for ; Wed, 10 Jan 2024 17:24:33 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id BA06F4E1C9; Wed, 10 Jan 2024 17:23:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=subdimension.ro header.i=@subdimension.ro header.b="Pp+AexdE" 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 78AC94D103; Wed, 10 Jan 2024 17:23:20 +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 C3C9628B588; Wed, 10 Jan 2024 17:23:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=subdimension.ro; s=skycaves; t=1704907393; bh=DxtsSCEvWQRHWiPHNXgzK9xMclvnNxJ+k/fFzf/cKLs=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=Pp+AexdEAIHFFgNZSmvhttyO+r9qJ2uPA9N4i+VFnKlFxp3jkhP7+R3KxrmWkv1a2 WdXcwjZvdpr2LTLA5fRyriU5fvvmbfa46qIiP3o59sMbhdw0Js6N4AiM76XWcTQ61o DpsmzCA2GDEY6xJK7otYa1H4cQNCgfkOs3Uw2kSk= 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 Subject: [PATCH 1/6] dt-bindings: iio: pressure: honeywell,hsc030pa.yaml add spi props Date: Wed, 10 Jan 2024 19:22:36 +0200 Message-ID: <20240110172306.31273-2-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 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1787725068925293669 X-GMAIL-MSGID: 1787725068925293669 Add spi-peripheral-props.yaml requirement Signed-off-by: Petre Rodan --- .../devicetree/bindings/iio/pressure/honeywell,hsc030pa.yaml | 3 +++ 1 file changed, 3 insertions(+) -- 2.41.0 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 Wed Jan 10 17:22: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: 186957 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:2411:b0:101:2151:f287 with SMTP id m17csp937558dyi; Wed, 10 Jan 2024 09:24:39 -0800 (PST) X-Google-Smtp-Source: AGHT+IH9AuK1yDXcFfZCdnfRh8OpcRLG914uXA20IPp5XDWQVQtAflcKvs5odEm2wmeSK5ZsF7e3 X-Received: by 2002:a9d:6404:0:b0:6dd:de32:6f66 with SMTP id h4-20020a9d6404000000b006ddde326f66mr1014682otl.35.1704907478689; Wed, 10 Jan 2024 09:24:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704907478; cv=none; d=google.com; s=arc-20160816; b=UqSnB6V5KQY9ADXV3hflgrxAToWckvqhpWLXPGMX+t4ARMx1z4u60RfpeE47xAYVA8 TIFiKKIBNMMRXlnkiQZySWxzRY6ZoBejkNbdWqJMpBjYp/kYjfYgLGOjAiFJkeJsYLHE h9Cn/IcP4SxD2P12lmBDye1V4XX2KubyuU+ry1Fdc1MmPYZCFt6ay8q9SYmB4wyUO3Gk BZGPhvnVwYR4D85zqiSP3T3ziT0lbit2e2cNS3ohyDwgIbInVZtLyNssVhz8MqCaJ6/3 DnppDX1iiggTRuKaWb9RcBuDGRoPQCzAh7bo4PUDWzy2uSoF6OjNWHYSQAPIAonxfdih Q9uQ== 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=+wcYTvY5S+UCp4ZM6lF9MNwYesqZrvxfyXKrJPscr4M=; fh=qAPe5qiEjGEI6PAB4iGo703ejtRIE8f07Uvyp/kzsRs=; b=Dv3mal+16ajzrA6sDktA673a5ORoAYpIHp70eRCZks/0K5hJFCHADUYUPQ1fTZbNaa d7IxHweMX/HTz8EZypMtiO5wlu1WmeHMztBwIkrAyhvv3/VT1VYQTM5mA8xCyNLpWJmg LJRz7Yq5MLP/9djFji1d/+sEXxqw4Yt+oByWpJwJSxOlv4/N8tDQslzn9VD/PjVGGiQI YynknRYyPYKLlpjgG6xJpLH3kFiCBnPLfjaDYOeNDEEvl7hohh/qrfbqKC7RX/JbTj6o 4k4yeMqhogvyHy1GOxCfLWwLpxRQlEF1rr3Z9OzzjZDScs9+7YRvDmOBQ/sq/aAA4oS7 HXAg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@subdimension.ro header.s=skycaves header.b=Q+R50F5j; spf=pass (google.com: domain of linux-kernel+bounces-22526-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-22526-ouuuleilei=gmail.com@vger.kernel.org" Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id e19-20020a05622a111300b0042992268779si4586321qty.665.2024.01.10.09.24.38 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Jan 2024 09:24:38 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-22526-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@subdimension.ro header.s=skycaves header.b=Q+R50F5j; spf=pass (google.com: domain of linux-kernel+bounces-22526-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-22526-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 776C11C22982 for ; Wed, 10 Jan 2024 17:24:38 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 074BE4E1D4; Wed, 10 Jan 2024 17:23:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=subdimension.ro header.i=@subdimension.ro header.b="Q+R50F5j" 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 78AF24D105; Wed, 10 Jan 2024 17:23:20 +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 27AF6295116; 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=JR2K1BGHxcrEH+xlbeKvVMsrrRoi4/Miv25LV1xkXWs=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=Q+R50F5jAAkGNV5MXSZqLkl4o0OpmvSKhAdLA4tRMfd/7asJONo/36bTmpWvHYbBE IouYktqbeh9Knwqp26O6aVbhSdp1mEexnlVj5CLq/BDwIpIFiSH1YRw2A7kujBWfp6 mKb2fmRzPhfw55g0Sxqk4BEEHL/WkwW8Y/z/3vMQ= 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 Subject: [PATCH 2/6] dt-bindings: iio: pressure: honeywell,hsc030pa.yaml add sleep-mode Date: Wed, 10 Jan 2024 19:22:37 +0200 Message-ID: <20240110172306.31273-3-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 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1787725064562990515 X-GMAIL-MSGID: 1787725064562990515 Add sleep-mode property present in some custom chips. This flag activates a special wakeup sequence prior to conversion. Signed-off-by: Petre Rodan --- .../bindings/iio/pressure/honeywell,hsc030pa.yaml | 10 ++++++++++ 1 file changed, 10 insertions(+) -- 2.41.0 diff --git a/Documentation/devicetree/bindings/iio/pressure/honeywell,hsc030pa.yaml b/Documentation/devicetree/bindings/iio/pressure/honeywell,hsc030pa.yaml index 89977b9f01cf..350da1d6991b 100644 --- a/Documentation/devicetree/bindings/iio/pressure/honeywell,hsc030pa.yaml +++ b/Documentation/devicetree/bindings/iio/pressure/honeywell,hsc030pa.yaml @@ -86,6 +86,15 @@ properties: Maximum pressure value the sensor can measure in pascal. To be specified only if honeywell,pressure-triplet is set to "NA". + honeywell,sleep-mode: + description: | + 'Sleep Mode' is a special factory set mode of the chip that allows the + sensor to power down between measurements. It is implemented only on + special request, and it is an attribute not present in the HSC/SSC series + nomenclature. + Set in order to enable the special wakeup sequence prior to conversion. + $ref: /schemas/types.yaml#/definitions/flag + vdd-supply: description: Provide VDD power to the sensor (either 3.3V or 5V depending on the chip) @@ -140,6 +149,7 @@ examples: honeywell,pressure-triplet = "NA"; honeywell,pmin-pascal = <0>; honeywell,pmax-pascal = <200000>; + //honeywell,sleep-mode; }; }; ... From patchwork Wed Jan 10 17:22:38 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Petre Rodan X-Patchwork-Id: 186956 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:2411:b0:101:2151:f287 with SMTP id m17csp937391dyi; Wed, 10 Jan 2024 09:24:20 -0800 (PST) X-Google-Smtp-Source: AGHT+IGpXwQ2mJvvxwfRXK1plE9UCijZzgpI6W5FqjaaaJnYBsbnhnSB0H1BuIvWZcQFnOQhYQeB X-Received: by 2002:a05:6a00:2d2a:b0:6d9:8453:1b55 with SMTP id fa42-20020a056a002d2a00b006d984531b55mr1661134pfb.0.1704907460666; Wed, 10 Jan 2024 09:24:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704907460; cv=none; d=google.com; s=arc-20160816; b=HQ+clPHEyWPyVoGlrQhgVALFranki77WRj3y94mwMqjftDwoOjxVIS3g3VUxstdfoM dtJN1z2J+5vXpWCPpkGZVIQeDnQhLU/wQdou6OICMmpjQ3PtkVbfHIZjEnD75r8vEFI9 NQOuC84Gm+4CY4z8Hc8uM4VfNdksBB73XpwynIDbsDKyjmJbtUB+R1yaedB6/Yo1qYmc zCwToMsLl8UUx50fg3CEMfqx+3KFd42/RXOsuvOemBkMTNNHWs5lzqPtAkPB8Fjgx42n mZ3R9VI2Y3CLdlysWOzLxfMJExRF1TQRrBAhbDQZP/sovWcdqyULYn9BUxq/+Pej0Vpl Wgkw== 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=yJ4L7DIDo5l8F6M5ECy3IgIJ/rr20wjKxds3USWhRi4=; fh=RpJjGiuDlOjmyoLhPwSzjbPbeK51vYo3I0V3BuRLNmU=; b=RsupCUh8YE8pnxqc7cU/gpCrsw7OAr6hy2CjE9t9aGebLF9KHHnGPmvXNcaui3nbbU DXRj6lhgL8z0L4dnjGh2u5YpEz+7yPBnLx47Lw0LxMvXwhH6iqm0UM/v1I9ndLSvpDvm J46WPD4V/1SElKdCOfZNMbykOAzzCzZrEgYbbovAUDaCsQesZ+JCyplhtj+zJm07wl+b kYDXMJS+jwqxvnOPpKzc1udND5W6nicrOAp6MgaobmCDYm3syXgBV3cNpvPYZ2CLEZYb H3r4u8Ty6NCz+V2OlW6guC7SGRhnjb3EL2Z4Pv8J3vhiEYL+IJ16YLJS7HGzojGRzBNg FYew== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@subdimension.ro header.s=skycaves header.b=QXRUqKUM; spf=pass (google.com: domain of linux-kernel+bounces-22523-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-22523-ouuuleilei=gmail.com@vger.kernel.org" Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id cz3-20020aa79303000000b006da8b3df0desi4049155pfb.359.2024.01.10.09.24.20 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Jan 2024 09:24:20 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-22523-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@subdimension.ro header.s=skycaves header.b=QXRUqKUM; spf=pass (google.com: domain of linux-kernel+bounces-22523-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-22523-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 7262328314B for ; Wed, 10 Jan 2024 17:24:13 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id D55B14D5BA; Wed, 10 Jan 2024 17:23:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=subdimension.ro header.i=@subdimension.ro header.b="QXRUqKUM" 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 78A6E4D100; Wed, 10 Jan 2024 17:23:20 +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 73A052997CD; 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=zZSi6xnStqinb9unKQaoLA9OH8LjSeJ51f1fcYz+zOQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=QXRUqKUMozz/FzNQ318X/xtt3o3MhygrvIzU4myhRfdf/Hj71wKILBz3s+lldDybh Tk3Gc2TWNVezvEzvaeFVIuuPKMjMiapP+IkZ/c20Ou/3Zr6YrSaFLYGDLguZm0QPV6 accir+3Ryq41R3RPYy/5ttjrZYNgT7AhKq9raZWQ= From: Petre Rodan To: linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Petre Rodan , Jonathan Cameron , Lars-Peter Clausen Subject: [PATCH 3/6] iio: pressure: hsc030pa cleanup Date: Wed, 10 Jan 2024 19:22:38 +0200 Message-ID: <20240110172306.31273-4-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 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1787725045502896678 X-GMAIL-MSGID: 1787725045502896678 Use signed type to variable holding the result given by div_s64(). Add includes based on prior reviews from Andy. Provide bus-specific technical datasheet in the _i2c.c _spi.c headers instead of the generic one. Signed-off-by: Petre Rodan --- drivers/iio/pressure/hsc030pa.c | 2 +- drivers/iio/pressure/hsc030pa.h | 2 ++ drivers/iio/pressure/hsc030pa_i2c.c | 6 ++++-- drivers/iio/pressure/hsc030pa_spi.c | 5 ++++- 4 files changed, 11 insertions(+), 4 deletions(-) -- 2.41.0 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)); 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..b5810bafef40 100644 --- a/drivers/iio/pressure/hsc030pa_i2c.c +++ b/drivers/iio/pressure/hsc030pa_i2c.c @@ -4,14 +4,16 @@ * * 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 #include #include #include #include +#include #include diff --git a/drivers/iio/pressure/hsc030pa_spi.c b/drivers/iio/pressure/hsc030pa_spi.c index a719bade8326..8d3441f1dcf9 100644 --- a/drivers/iio/pressure/hsc030pa_spi.c +++ b/drivers/iio/pressure/hsc030pa_spi.c @@ -4,13 +4,16 @@ * * 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 #include #include #include #include +#include #include From patchwork Wed Jan 10 17:22:39 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Petre Rodan X-Patchwork-Id: 186958 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:2411:b0:101:2151:f287 with SMTP id m17csp937567dyi; Wed, 10 Jan 2024 09:24:40 -0800 (PST) X-Google-Smtp-Source: AGHT+IG/TVE/5oJsp3STuS8we1NJ06y7LlEyo4rwt70Y/9svXTgZkkU32IXaRpdGYR4nyqiant1j X-Received: by 2002:a05:6870:c6a0:b0:203:f62c:96ab with SMTP id cv32-20020a056870c6a000b00203f62c96abmr1098741oab.83.1704907480371; Wed, 10 Jan 2024 09:24:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704907480; cv=none; d=google.com; s=arc-20160816; b=tBSOJZllnttRilvGnbkA+dw1uzKzOjGHNweurGOruOiW0vwaoZ/ybaJ0iL2Hy2lNlG 47FNgOxfNw4YEcqrOCOeHnipgqi1oVPWvbPmIE5ya42pq41TETL2JquQAUkNivRzjXM9 wHL1AbfOGXLuuZBWHBC9bvjgyjmdnjUjfs72Rdg2p36RLp0UYR+gVJrN6vQlESHwYOIu 7m/TV35Sbes/tH09VUNn92NSdajpuueciRxl8EF7F2i4VtsociwBrXmMtDnT0mHRr7/p NT2IUzZ4FkxNBCo90HxJlp1e5g7ZMqzvEJLZe6D4PcNFbmC81Dt94ojspI+Zqyqfgk3l 2pfw== 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-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-22524-ouuuleilei=gmail.com@vger.kernel.org" Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id 6-20020a630e46000000b005ced19e2d21si3956481pgo.676.2024.01.10.09.24.40 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Jan 2024 09:24:40 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-22524-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::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-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-22524-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 BA2D2284448 for ; Wed, 10 Jan 2024 17:24:30 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 9D5D84E1C4; Wed, 10 Jan 2024 17:23:25 +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 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1787725066060917700 X-GMAIL-MSGID: 1787725066060917700 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(+) -- 2.41.0 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); } From patchwork Wed Jan 10 17:22:40 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Petre Rodan X-Patchwork-Id: 186960 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:2411:b0:101:2151:f287 with SMTP id m17csp938066dyi; Wed, 10 Jan 2024 09:25:33 -0800 (PST) X-Google-Smtp-Source: AGHT+IHOAEvjuL7MMju2mWK3ZmUpPuyhF/b3Wjy20X/s7PwHlvWRnM0wpHd02gOK7DVP6tFlvfBf X-Received: by 2002:a05:6830:4414:b0:6dd:e1cf:221c with SMTP id q20-20020a056830441400b006dde1cf221cmr1362220otv.70.1704907533556; Wed, 10 Jan 2024 09:25:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704907533; cv=none; d=google.com; s=arc-20160816; b=yu0/nYvpo+dztmFsKLdsB9zfT/p2MHuzcDAyryZOb52ec7VLJWZB2Xekky32vKN+Y5 vtaApb6EJcYt/aXfaRx6TZEOEyBROKFYjda2aanR8uFESjT1Y0regoQhi45bkbUfKlRZ 30fgit+O12XGslfCv2QLhGN40Yb31vzDcjpGYdH/B5LuhInUue5HdfxfyCN2QK6GmTT9 7TECW9OPng0HnkzUacA5quwPybSpMAe8L1kMxldNi/E7pPkZ62CJXOYw+APK83ZG0usI kJFXvQaNxQJTOYr8VskqlG9eJCNfDg8xGbiukF8JAh3nN9x4bNnLDbWwuK7OULzLDdQu ytzw== 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=SxYZjWx28XlWmdB8JzPnfbuHml7CBR0773UBh1Dw9Jc=; fh=RpJjGiuDlOjmyoLhPwSzjbPbeK51vYo3I0V3BuRLNmU=; b=CzY6bVdHNgKwgS8VE9J1G9dWOOeAgYRLX1L7BHXYt/7Usp8dfW0k1CYKfAhFnDpjJ0 +4ZzXG202H4irlntoXZ6PRyz7UwgUtAqtwOk5PYDfMckBM8Ue7Sy/Bd6FiJX9JewpVIG 41oqB+WxnHDoYBxIQRnbesWYsvGztpkQbTqQaPJx7G8ahPCDc8M9UwiOqcdZNPN1Z885 m3oATtBYqxG8LY7Yk2j2NgAiWjf5tRWOJJZJLeZ3Br+BF+tMJqnxXkodQyLeyU9wP8u0 yDnE/832pUN+kUPOjzjN44cN/Y7J7Urf0a5ixrcpDR//Cv8LgZHuR8BA0a6NU82+17Ea TVmw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@subdimension.ro header.s=skycaves header.b=Ab8AWGqI; spf=pass (google.com: domain of linux-kernel+bounces-22527-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-22527-ouuuleilei=gmail.com@vger.kernel.org" Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id e15-20020a63e00f000000b005c6bab48f48si3913923pgh.111.2024.01.10.09.25.33 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Jan 2024 09:25:33 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-22527-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=Ab8AWGqI; spf=pass (google.com: domain of linux-kernel+bounces-22527-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-22527-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 C89E9281A84 for ; Wed, 10 Jan 2024 17:24:56 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id D3E054EB3E; Wed, 10 Jan 2024 17:23:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=subdimension.ro header.i=@subdimension.ro header.b="Ab8AWGqI" 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 566DB4D12B; Wed, 10 Jan 2024 17:23:23 +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 E2D9B2997DA; 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=1704907394; bh=qsDFAv93tu0XrFFcOWZhPLu9VlWsI+eQCLQ6AKV/vgw=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=Ab8AWGqIod2UVn0PU6YsPL9vvuD3qMkhpVANQ0PjIzBItuIfQsorp4ubOErYrvAC3 0wJL50jUOR0QJs/SwWeHdzb/KvxBO6Gga97UiN2dPYO4PRoOZKwN3AuGv4oxm+pbLe FdUARi04f1kbMx5AW9Qzv+jbwokEzG41uwbbSzXk= From: Petre Rodan To: linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Petre Rodan , Jonathan Cameron , Lars-Peter Clausen Subject: [PATCH 5/6] iio: pressure: hsc030pa add triggered buffer Date: Wed, 10 Jan 2024 19:22:40 +0200 Message-ID: <20240110172306.31273-6-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 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1787725121698688314 X-GMAIL-MSGID: 1787725121698688314 Add triggered buffer feature. Signed-off-by: Petre Rodan --- drivers/iio/pressure/hsc030pa.c | 42 +++++++++++++++++++++++++++++++++ drivers/iio/pressure/hsc030pa.h | 2 +- 2 files changed, 43 insertions(+), 1 deletion(-) -- 2.41.0 diff --git a/drivers/iio/pressure/hsc030pa.c b/drivers/iio/pressure/hsc030pa.c index 7e3f74d53b47..3faa0fd42201 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,23 @@ 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) { + iio_push_to_buffers_with_timestamp(indio_dev, &data->buffer, + iio_get_time_ns(indio_dev)); + } + iio_trigger_notify_done(indio_dev->trig); + + return IRQ_HANDLED; +} + /* * IIO ABI expects * value = (conv + offset) * scale @@ -382,13 +402,30 @@ 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, + .shift = 0, + .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 +522,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..6c635c42d85d 100644 --- a/drivers/iio/pressure/hsc030pa.h +++ b/drivers/iio/pressure/hsc030pa.h @@ -56,7 +56,7 @@ struct hsc_data { s32 p_scale_dec; s64 p_offset; s32 p_offset_dec; - u8 buffer[HSC_REG_MEASUREMENT_RD_SIZE] __aligned(IIO_DMA_MINALIGN); + u8 buffer[16] __aligned(IIO_DMA_MINALIGN); }; struct hsc_chip_data { From patchwork Wed Jan 10 17:22:41 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Petre Rodan X-Patchwork-Id: 186961 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:2411:b0:101:2151:f287 with SMTP id m17csp938077dyi; Wed, 10 Jan 2024 09:25:35 -0800 (PST) X-Google-Smtp-Source: AGHT+IGzhZl1W5HsEzIROJ1zGBJUalO3nHWEX3PDIF3kb8ZEpZ2glGfE6CeeNp16XqbwXh312QbT X-Received: by 2002:a9d:66ca:0:b0:6dd:e62d:8b35 with SMTP id t10-20020a9d66ca000000b006dde62d8b35mr1177525otm.5.1704907534922; Wed, 10 Jan 2024 09:25:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704907534; cv=none; d=google.com; s=arc-20160816; b=Srz4D+lh2VTzZ3DHTMpbzkktTJSsHE0+co3txUYViZFJBPvtg9lPt6Mbx0waA8Z6vz jzkPfbadWimdJEx0WSSW67iLE/Sxdh3FMWMopWlzYiCbb2lhcGbpsu80ji+1iTMrpmMM mVgByqiPbziScgEad1l+HyCJsJNVZoEHOKoYFSvNnTvnPWqL06oI0etbndXJ/5s1C1vk jVbuaatLz3FbwXMZ9WAP2y2L2igPAQCFKzVJaw2GDsFKgTSevJ9MfOgKFAjHop9SpK75 YuBZZLJfddTtff2rn35n5jCYj9Tkbo3ONG/QDmkpAyt8lzZv6Wq4q1dBjXIQhaKto5nr YtzA== 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=H5LkmGQ5ELwOuq7kis1SJG7hSXiDUnrrlUAvwJK77+0=; fh=RpJjGiuDlOjmyoLhPwSzjbPbeK51vYo3I0V3BuRLNmU=; b=xwESiGZlR5UZiiN/n1W7CfINi+r0D8RHP5OWgICA2DMfGJHm6oGobONf7rW7937mul ceEUz3RFp4E8BjV5EHN2Pqt3U1SSrkm5/TgSXtD36vwDrMtH62RNr3ZOao2G8k62cWjt qovsSScRKYmPxSZMjFPwlrkWrp4Gqw2Fg893TrG5ZCMpQxJt8tQyHIxAHSolyMkQPEku J64zgkufjCqrfgQ+l/Cb+Dxd0tEy4/koZLJuOHsqtBeViUS4jCi89Zut65U8wdvSRQDX KnPE+vi+NBuN2aoW9Q/nM7rDFd/kE7B4eGDzrTDgzkglwuCfc1z1QTj0bXIfVrKAbsud bcVA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@subdimension.ro header.s=skycaves header.b=BOkdNBYH; spf=pass (google.com: domain of linux-kernel+bounces-22528-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-22528-ouuuleilei=gmail.com@vger.kernel.org" Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id 6-20020a630e46000000b005cd88161d2fsi4120907pgo.694.2024.01.10.09.25.34 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Jan 2024 09:25:34 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-22528-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=BOkdNBYH; spf=pass (google.com: domain of linux-kernel+bounces-22528-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-22528-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 3DAD4281D4C for ; Wed, 10 Jan 2024 17:24:58 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 0BC1C4EB41; Wed, 10 Jan 2024 17:23:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=subdimension.ro header.i=@subdimension.ro header.b="BOkdNBYH" 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 5068C4D12A; Wed, 10 Jan 2024 17:23:23 +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 273BF2997DB; Wed, 10 Jan 2024 17:23:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=subdimension.ro; s=skycaves; t=1704907394; bh=a99HJeBqxKiszZ3/n26SSt4qM8aVMV+50WhhkOqCi0c=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=BOkdNBYHOJICY6O7CLE5FWgbRm02PGZiB9dKdc4xzY06u7BpPRPFO0NSeo7IMFhGW 1Php8euSF1ZNsjtzupz34EU1I2SVGL6SEwB4QZnrdPf/tHSSAVw+MmDvfPf6PzX+4m EQk3C9MddhP/o+iyRsF1Z33LMeUt34wRF5XP0+0Y= From: Petre Rodan To: linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Petre Rodan , Jonathan Cameron , Lars-Peter Clausen Subject: [PATCH 6/6] iio: pressure: hsc030pa add sleep mode Date: Wed, 10 Jan 2024 19:22:41 +0200 Message-ID: <20240110172306.31273-7-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 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1787725123263828591 X-GMAIL-MSGID: 1787725123263828591 Some custom chips from this series require a wakeup sequence before the measurement cycle is started. Quote from the product datasheet: "Optional sleep mode available upon special request." Signed-off-by: Petre Rodan --- drivers/iio/pressure/hsc030pa.c | 4 ++++ drivers/iio/pressure/hsc030pa.h | 4 ++++ drivers/iio/pressure/hsc030pa_i2c.c | 19 +++++++++++++++++ drivers/iio/pressure/hsc030pa_spi.c | 32 +++++++++++++++++++++++++++-- 4 files changed, 57 insertions(+), 2 deletions(-) -- 2.41.0 diff --git a/drivers/iio/pressure/hsc030pa.c b/drivers/iio/pressure/hsc030pa.c index 3faa0fd42201..9e66fd561801 100644 --- a/drivers/iio/pressure/hsc030pa.c +++ b/drivers/iio/pressure/hsc030pa.c @@ -501,6 +501,10 @@ int hsc_common_probe(struct device *dev, hsc_recv_fn recv) return dev_err_probe(dev, -EINVAL, "pressure limits are invalid\n"); + ret = device_property_read_bool(dev, "honeywell,sleep-mode"); + if (ret) + hsc->capabilities |= HSC_CAP_SLEEP; + ret = devm_regulator_get_enable(dev, "vdd"); if (ret) return dev_err_probe(dev, ret, "can't get vdd supply\n"); diff --git a/drivers/iio/pressure/hsc030pa.h b/drivers/iio/pressure/hsc030pa.h index 6c635c42d85d..4e356944d67d 100644 --- a/drivers/iio/pressure/hsc030pa.h +++ b/drivers/iio/pressure/hsc030pa.h @@ -15,6 +15,8 @@ #define HSC_REG_MEASUREMENT_RD_SIZE 4 #define HSC_RESP_TIME_MS 2 +#define HSC_CAP_SLEEP 0x1 + struct device; struct iio_chan_spec; @@ -29,6 +31,7 @@ typedef int (*hsc_recv_fn)(struct hsc_data *); * struct hsc_data * @dev: current device structure * @chip: structure containing chip's channel properties + * @capabilities: chip specific attributes * @recv_cb: function that implements the chip reads * @is_valid: true if last transfer has been validated * @pmin: minimum measurable pressure limit @@ -45,6 +48,7 @@ typedef int (*hsc_recv_fn)(struct hsc_data *); struct hsc_data { struct device *dev; const struct hsc_chip_data *chip; + u32 capabilities; hsc_recv_fn recv_cb; bool is_valid; s32 pmin; diff --git a/drivers/iio/pressure/hsc030pa_i2c.c b/drivers/iio/pressure/hsc030pa_i2c.c index b3fd230e71da..62bdae272012 100644 --- a/drivers/iio/pressure/hsc030pa_i2c.c +++ b/drivers/iio/pressure/hsc030pa_i2c.c @@ -24,8 +24,27 @@ static int hsc_i2c_recv(struct hsc_data *data) { struct i2c_client *client = to_i2c_client(data->dev); struct i2c_msg msg; + u8 buf; int ret; + if (data->capabilities & HSC_CAP_SLEEP) { + /* + * Send the Full Measurement Request (FMR) command on the CS + * line in order to wake up the sensor as per + * "Sleep Mode for Use with Honeywell Digital Pressure Sensors" + * technical note (consult the datasheet link in the header). + * + * These specifications require a dummy packet comprised only by + * a single byte that contains the 7bit slave address and the + * READ bit followed by a STOP. + * Because the i2c API does not allow packets without a payload, + * the driver sends two bytes in this implementation. + */ + ret = i2c_master_recv(client, &buf, 1); + if (ret < 0) + return ret; + } + msleep_interruptible(HSC_RESP_TIME_MS); msg.addr = client->addr; diff --git a/drivers/iio/pressure/hsc030pa_spi.c b/drivers/iio/pressure/hsc030pa_spi.c index 737197eddff0..1c139cdfe856 100644 --- a/drivers/iio/pressure/hsc030pa_spi.c +++ b/drivers/iio/pressure/hsc030pa_spi.c @@ -25,12 +25,40 @@ static int hsc_spi_recv(struct hsc_data *data) struct spi_device *spi = to_spi_device(data->dev); struct spi_transfer xfer = { .tx_buf = NULL, - .rx_buf = data->buffer, - .len = HSC_REG_MEASUREMENT_RD_SIZE, + .rx_buf = NULL, + .len = 0, }; + u16 orig_cs_setup_value; + u8 orig_cs_setup_unit; + + if (data->capabilities & HSC_CAP_SLEEP) { + /* + * Send the Full Measurement Request (FMR) command on the CS + * line in order to wake up the sensor as per + * "Sleep Mode for Use with Honeywell Digital Pressure Sensors" + * technical note (consult the datasheet link in the header). + * + * These specifications require the CS line to be held asserted + * for at least 8µs without any payload being generated. + */ + orig_cs_setup_value = spi->cs_setup.value; + orig_cs_setup_unit = spi->cs_setup.unit; + spi->cs_setup.value = 8; + spi->cs_setup.unit = SPI_DELAY_UNIT_USECS; + /* + * Send a dummy 0-size packet so that CS gets toggled. + * Trying to manually call spi->controller->set_cs() instead + * does not work as expected during the second call. + */ + spi_sync_transfer(spi, &xfer, 1); + spi->cs_setup.value = orig_cs_setup_value; + spi->cs_setup.unit = orig_cs_setup_unit; + } msleep_interruptible(HSC_RESP_TIME_MS); + xfer.rx_buf = data->buffer; + xfer.len = HSC_REG_MEASUREMENT_RD_SIZE; return spi_sync_transfer(spi, &xfer, 1); }