From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=74.125.82.170 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796401352; b=ZlUAMbCKJzTyR9s23E9O3M7Ni2qLwP2VW31BqXfLERinrhq2dmtC66vNDYmpmcKIix2p nKLHBbZ6Yz4WDwRuhJMAVTBjhM1BJ8WeSSfjDxrVKMG6C+Ep87Vqz7iFbOxiR+EjeVafc 4Q2ER7dP4dpCYgIzfj8xu+blvp5Nw7MHnrhDe2sd9BweFcDfJsDEVwa5AoNlfch5HEpIA 5JFfvY+pDNbzz/bgVjy39Rdwmu1uSlHJWcbmCr0snXWajd279j8ue4dnn4NnfL8JDZWPf 2oOcSvgdBj1rxjDhzLlI/xHoaLpBkSMYszC9dDahhobo5gRfP58QxRH71g4M5gG97+g== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796401352; h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature: X-Forwarded-Encrypted:X-Gm-Message-State:X-Gm-Gg:X-Received:Received: From:To:Cc:Subject:Date:Message-ID:X-Mailer:MIME-Version: Content-Transfer-Encoding; bh=uQ9UpaIn5Sy9eZLSXVOHaV4hArSKLBjxfK6P95zFN14=; b=likdeToQV2/rdo6MHOztEEfwDkSRtebu6hXvLRpIUuLa15gFVUsKBRcUMGfuoTqX15RK swC0TK0mAgVLlrF9znjvxiu0KNrXMD2ykkSChc6rbH37/2ubgLVyPPZMA9wUma8vvQLng AoNvE8gnWg14ZZIydLJcYDYDr1RfIxtnYrewn3vPIZwOeuenq1k9eOnNC8mlxMUuO7FZQ wuPK5OEtkdBK9LcQQ80bEwI/pX+jcEEvz4DWm1jnOG5idSoAw5p8DAxHuvvkYlZE1jJIc qijKua2IuL3zZmwxnGu49Bxkt79s8o17lh6aM2fVGK6kD/2AFTGwRJgXGmI0KH2Uv6g== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=jwJC6sg6; arc=none smtp.remote-ip=74.125.82.170 Received: from mail-dy1-f170.google.com (mail-dy1-f170.google.com [74.125.82.170]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CAA1A606A32C for ; Fri, 4 Dec 2026 16:22:31 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org CAA1A606A32C Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=jwJC6sg6 Received: by mail-dy1-f170.google.com with SMTP id 5a478bee46e88-386c71feeeaso1405071eec.0 for ; Fri, 04 Dec 2026 08:22:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20260707; t=1796401351; x=1797006151; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to:content-type; bh=uQ9UpaIn5Sy9eZLSXVOHaV4hArSKLBjxfK6P95zFN14=; b=jwJC6sg67EIZ52K59hQdQOTkgczHIII88MCnN25JfkYV1BDUjqKylW/AfYqy4gDBZb soUYIyFbCZGz4IcgTzHI41EFYK77RCOKto+WTuv1gtEpMPNXnBC756+hELVC+8TkwFBB vG0wE232xklZxzr4ojJvyjhgD3BY0oryrfNIKpB8zNmm4AA2pxkzIXjF4GWA/6Q3z4HM ADYI6usfx619E7/USASbButj1Oj6SgGpV1QoFOgygsttT7BKuVgbZnrTXkjnHddsGtKm 9LO4V7poptYM7nlMAZ7EAdvzUA0f9jgAAFodN6qG00QPFygDR12oVq2Zzh2eK+BSd5n7 96Dg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796401351; x=1797006151; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to:content-type; bh=uQ9UpaIn5Sy9eZLSXVOHaV4hArSKLBjxfK6P95zFN14=; b=VSOnZeh901Gyw+z7jKpWJa0dj+OngGfyQTW80NM7jInAQKsTAZteNNzPbl//X9eWif EzaKDu1FxBX5MWL5jrLV7lrLTfpdLRO0fqN3WpqUOA1fJxhA05XHD8dljy0smzyyUt/h 1oQANn4EfMtKcnk/SkMRTSNRP5rhbu+ivP62JD5aRo8dqRCUg2agReozceATL5Vb1lTF 92G27YnegWgXi5J4l/Tu1lK3DTWhqU7zAyXcT9ynfudvvQgC7Op5Ew1bOoqFhgY7rOjn aV6815wAPzkPTdUw13i/o3w0rtQiZ8Dwxgu42FtX3iilkL1ymedqwhEv3p6eSK3QmZQ8 pmcA== X-Forwarded-Encrypted: i=1; AL+hErGWf+tmqC2eNFpy0IdgddGjuexyTUP5aV2gEtmJ+hEcJ7PZbwn1Lz16a0NSkf25Tn87JCINYps0ujK91a4=@vger.kernel.org X-Gm-Message-State: AB4q+uGbvTbtxIhWLbuCtPhio44Hn4bnPc0Z3+zaq1675fPC/d8Dcp7h v5DB152J4tPNkqOFpgYldQjiYVDy3Se6Rh8Oo1nCEKVBIm4Jk4N+YJ+u X-Gm-Gg: AZFdTZcqvvyu/TesXE30qES+ZYCa9cPZrH//OzRnsPx4T1LiqNbzTCRI39obzlaApbp JLT3LA7vGaHSIPkrwBIW5Ono35n5KpasZtteJ5SmeZJl7idOX+IlF4rbn74+gw7xKXgtUP915MI kE4jtmi9nQOJ5pocO9SwBL3gSQVgzxP/ARPCAOxQdL18V3pWqoblj14ahoQAErDodDRYe+5ZP4C tNFy4QDNzY5ae4GjtskXc7WEXUu9MSz4qS2yrThLladnTnaoRlrweoqZiKS2+eXqWKCJQeRAx+k C6E+8rCzQj65KA+tQ8Sm6PtAvCkUtxC1B6g7TUVeiKnoSX44vdUyvkq7i1CPU0Vmhm12iAIT3Cc lLxzDQmICWPBYCywdyoTVdtMgV1+1dVONxxJsS5CMXhjWMnfD+beTqHUnD1B62MiUHaPuYO3xz1 ktl7nSQRqoOjC0momJ5romwr+pUij/ezs8HSBieeii6JI955g5jvS1ZF35HH4N7dzbHHv7uuLpO 0Sq6ev0EolzzYKbTJHIcBO4vg4gwG+wthFz82Fy88inpcKhEXJIg4W3aW4GeQnNua9NU3ciqvLw IeRUiRdLDnHaer3KlOeDzE0/8TM75TdYoon/tPtdrD+ZhDoHYH6nKqLfvGz2/eK4AL56SOHpqJj VxUmC48sKudqAzC5n2pmOLNUvi962zQ5N64r1ZHIRT86FZncYezjNCHjyPObDxp3mme9Vp3vATe y2cCBEO8jBLLFM7nf0GGZrR4LB3PbrRpWhele/MSvQIA== X-Received: by 2002:a05:693c:8116:b0:386:319b:fb0f with SMTP id 5a478bee46e88-3875220ddf9mr2757310eec.38.1796401350731; Fri, 04 Dec 2026 08:22:30 -0800 (PST) Received: from kapoor.iiserb.ac.in ([203.18.51.239]) by smtp.gmail.com with ESMTPSA id 5a478bee46e88-387521c17a3sm11834807eec.11.2026.12.04.08.22.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 04 Dec 2026 08:22:30 -0800 (PST) From: Arnav Kapoor To: Jonathan Cameron Cc: David Lechner , =?UTF-8?q?Nuno=20S=C3=A1?= , Andy Shevchenko , Andy Shevchenko , Gwendal Grignou , Stephen Boyd , linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org, Arnav Kapoor Subject: [PATCH v4 0/6] iio: proximity: sx93xx: fix raw reads, thresholds, hysteresis and gain Date: Fri, 4 Dec 2026 21:52:13 +0530 Message-ID: <20261204162221.923093-1-kapoorarnav43@gmail.com> X-Mailer: git-send-email 2.53.0 X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit The remaining sx93xx fixes, grouped by driver. 1: sx_common: a raw read can return on a stale completion (left by an interrupted read, or by conversions while another device uses the sensor's trigger), and it then turns off the CONVDONE interrupt the trigger depends on. 2, 5: sx9324/sx9360 write_thresh() lowers the threshold by one register value when the value just read from an odd register value is written back, and lets some negative values through. 3, 6: sx9324/sx9360 write_hysteresis() turns negative values into the largest hysteresis. 4: sx9360 gain encoding, as in Semtech's own SX9360 driver and as sx9324 got in 108e4d4de2b5. Changes in v4: - 4: refer to the Link: tag as [1] in the commit message (Andy) - Rebase on the current iio testing (no conflicts) Jonathan's point on v3 3/6, that the event value callers ignore val2 (so -0.999999 is accepted as 0), is not in this series; I'll send it as a separate fix. v3: https://lore.kernel.org/all/20261128115534.558478-1-kapoorarnav43@gmail.com/ v2: https://lore.kernel.org/all/20261122074649.239441-1-kapoorarnav43@gmail.com/ v1: https://lore.kernel.org/all/20261116205320.26070-1-kapoorarnav43@gmail.com/ The threshold change was checked against a userspace copy of both conversions for every val from 0 to 65535: all 256 register values round-trip, and every write picks the largest register value whose reported threshold doesn't exceed the request. Compile-tested only (W=1 for every patch, checkpatch --strict clean); I don't have SX93xx hardware. Arnav Kapoor (6): iio: proximity: sx_common: fix raw reads while the trigger is in use iio: proximity: sx9324: fix proximity threshold writes iio: proximity: sx9324: reject negative hysteresis values iio: proximity: sx9360: fix hardware gain encoding iio: proximity: sx9360: fix proximity threshold writes iio: proximity: sx9360: reject negative hysteresis values drivers/iio/proximity/sx9324.c | 21 +++++++++++++---- drivers/iio/proximity/sx9360.c | 39 +++++++++++++++++++++++-------- drivers/iio/proximity/sx_common.c | 25 +++++++++++++++----- 3 files changed, 64 insertions(+), 21 deletions(-) base-commit: fba506008a5b548ad2708bc2765a039cb00a47ab -- 2.53.0