From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=100.103.45.18 ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass; t=1796020204; b=1QvXAb+vMbOOrhAZgZGuAAqhZTtOqbd6/fHvQmyAzHeqDtRSdk9T7zAX0qJ1W1sKGhpu 8X3DL+8V/c4Ut5uPLLRBjWGdcCZZoptbcAkzDdp44wDS0z/KA8iiRxvKxx/wfT9LdtYEA NWGnLIPQkQwMN4oRnyQxoX+c/QM3+asBiW45mIxHu8F6advbZDFbRpquu+8RmgFjMnQnh 7uPstwJ88+wKBouPzRs3oea6jST4CWQdmsrFgbK4PLGpySumfny++UeoFB45NNoL+RT9V ZEEKLhf3YLfO/N+D8TkzAKIs8yAANMfeY+pRfKL0IB8lgIatMB2H0ytQsV9veYkNqjg== ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796020204; h=Received:DKIM-Signature:Received:From:Subject:Date:Message-Id: MIME-Version:Content-Type:Content-Transfer-Encoding:X-B4-Tracking: X-Change-ID:To:Cc:X-Mailer:X-Developer-Signature:X-Developer-Key: X-Endpoint-Received:X-Original-From:Reply-To; bh=6TptwTSHGfgDSeVsGB7+glbZ2Qk6I5oC2eN8pboIgNQ=; b=RO6xUd7qyz4Yhc2PxbwyyBEGrkqbGCb358yRxdbLBw0IKh6CeZuNyTvXrvPhEKTOmdXS xFLls3xWOTTOl1bu6QeiiOG3WQwRFSEm6aTMsvk3JfU+92FSA7ZcT5QxfWwAOVUVP/ffT zmX44L5S4pUUGEvboEAhdaROHZxA+WcYrKk4GzitT6djLF1gWIOR+g4phVuA5AyrjJP8k IpA176Bjml4v5zjbCZ2kcc9YEEgv6KBUU/VzmM57O47IAP0/So+aaHWmZh70N97mtIH9i 0q2C9k5c0HIdJy50+CHjJfvqfCkhD8Pw9AsiAollVupvAv3akJKAv68zDyxKY7bh0rA== ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=a5b577yA; arc=pass header.oldest-pass=0 smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 629D3606A330 for ; Mon, 30 Nov 2026 06:30:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=a5b577yA Authentication-Results: smtp.kernel.org; arc=none smtp.remote-ip=100.80.115.77 ARC-Seal: i=1; d=kernel.org; s=arc20260519; a=rsa-sha256; cv=none; t=1796020204; b=TodOo1SepO+okwYGhDmB66Gn4tMPBKQINtMgcDNCyItPWO/XIbkSyDiUXtC6/bIwzRKd fw9KagbCS6EjzYGAKBVjNEeCJ1fBEUHMm73wYqGZShYRRByhqNqRHI5HkRqelpi9NcUd/ FGcbX3yVNEMm7jIyqKUTWma05fV6RTv5B4h59peV0P3IeIMyjYlP1pagtNYfdE22jl52A +quBeaJDj69sFWAb9k0Ze/BFGsHGPeXsvdGKdLU+ipJPDsdoUF7SF2DpZqC8T+x89Lxb/ s0Vx9rshcRAm3ksUPuAZnplYt2qkFON8NaO4C22ymW+/f9uUSmoXchG3sjtcALwqizA== ARC-Message-Signature: i=1; d=kernel.org; s=arc20260519; a=rsa-sha256; c=relaxed/relaxed; t=1796020204; h=DKIM-Signature:Received:From:Subject:Date:Message-Id:MIME-Version: Content-Type:Content-Transfer-Encoding:X-B4-Tracking:X-Change-ID:To: Cc:X-Mailer:X-Developer-Signature:X-Developer-Key:X-Endpoint-Received: X-Original-From:Reply-To; bh=6TptwTSHGfgDSeVsGB7+glbZ2Qk6I5oC2eN8pboIgNQ=; b=0q5OOThDUSDdq4X0b/yFJ0LOYwno1U4aZXGaEmCnjejMRVslfFwSiCQDCg5//A/4WPf1 hClfEShxyfI5/ZzYKyjcnwQxcUuRNoDbWG2GcGPqahx75nRrB6yucx4OfkaieajXxU2Ao dRDYxOwMzW09Dh/FuLc1lXj7YmjkxJKq/oH5224s+sga6RLgt81GpQw+J4I6GhIKqhQjS d5qaDm7ZyMKxcFPqwPgZ1aBvUNta6mI1ho7VDB4Q5tGlqJbfkD5+WUpk7bEQU4yCPu/JI rB57X2XHMEBXVnYEfoXVyQuSC+kK+DnuLZXqlC+KJli06wh+5IVzsRhvtMyIADw4x7w== ARC-Authentication-Results: i=1; smtp.kernel.org; arc=none smtp.remote-ip=100.80.115.77 Received: from lkml.kernel.org (nexus.subspace.kernel.org [100.80.115.77]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.kernel.org (Postfix) with ESMTPS id 6629A1F00898; Mon, 30 Nov 2026 06:29:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796020204; bh=6TptwTSHGfgDSeVsGB7+glbZ2Qk6I5oC2eN8pboIgNQ=; h=From:Subject:Date:To:Cc:Reply-To; b=a5b577yADonbex0+BtFN068Arx74kbVjdEECpmYXscxnMCfdXqRgeLFkIXHXf4QhD xQ/2blqfKvgD8eeJHzEH5ti8bG6JWCKtuugaJX1Ws1V4QjOWyQVo2Zt5Uy6T2w5epB IDwk3Y4u2LK5W84jW/XGzV3WVd0AOh5di9V5ER8vBj6c5dTB7BgVKkDgMCVRt78ell wENSWPAartn12nkdHznhbyfLTJjLjVd+GgVJiEyfMdbSW/+EtGJRh1qW5u0SV4MXq9 dviKsK03JqrlZLGZsLX45QB3+25elaCzx8rCbknFmwphbg/57ldtIN+9vZEyiQvrRs picpmN8pwuU7A== Received: from nexus.subspace.kernel.org (localhost [IPv6:::1]) by lkml.kernel.org (Postfix) with ESMTP id B6E914E6EA; Mon, 30 Nov 2026 06:29:54 +0000 (UTC) From: He Xin via B4 Relay Subject: [PATCH v2 00/18] iio: accel: add mount matrix support to 18 accelerometer drivers Date: Mon, 30 Nov 2026 14:29:29 +0800 Message-Id: <20261130-work-v2-0-9eccecc71702@hexin.host> X-Mailing-List: linux-iio@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-B4-Tracking: v=1; b=H4sIAAAAAAAC/6tWKk4tykwtVrJSqFYqSi3LLM7MzwNyjHQUlJIzE vPSU3UzU4B8JSMDIzNDQ2MD3fL8omzdxCSDFEuz1GQzQ5NUJaDSgqLUtMwKsDHRsbW1AE+JPfd WAAAA X-Change-ID: 20261130-work-ab0d96ec614e To: linux-iio@vger.kernel.org, Michael Hennerich , Puranjay Mohan , Marcelo Schmitt , Antoniu Miclaus , Ramona Gradinariu , Petre Rodan Cc: Jonathan Cameron , David Lechner , =?utf-8?q?Nuno_S=C3=A1?= , Andy Shevchenko , linux@analog.com, He Xin X-Mailer: b4 0.14.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1796020192; l=4460; i=hexin@hexin.host; s=20261130; h=from:subject:message-id; bh=18K405pR/z2mJ7T4pXHVfrEeE+/kEuX7KkJjKtsfnmM=; b=0s6WuTGTjphuadC/bJB7zLTvtK8oZkgzFgoESjUL4ORpmWoOMKltWKSxqQOKmeOm5k8fINPr7 Xvt2EmDR89ABuuD6pA/c6evyz2TfhAKtud63VkjOF+WORBBeMm6VzvH X-Developer-Key: i=hexin@hexin.host; a=ed25519; pk=XShmjlZrsbSLtSY1GT4Ptl+4KQ/QVjE9VGdvbN87rFk= X-Endpoint-Received: by B4 Relay for hexin@hexin.host/20261130 with auth_id=1691 X-Original-From: He Xin Reply-To: hexin@hexin.host These drivers ignore the "mount-matrix" property that other accelerometer drivers already honour, so userspace gets raw sensor axes on any board whose sensor is not mounted axis-aligned with the display. A udev/hwdb override does not cover it either: it keys off the sensor modalias and DMI, which do not tell such boards apart. Each patch is mechanical and independent: store the matrix in the driver's private data, add an IIO_MOUNT_MATRIX() ext_info entry to the accelerometer channels, and read the property once in probe. One behaviour change: a board whose firmware describes a matrix with the wrong number of entries now fails to probe with -EINVAL instead of being ignored, which is what the drivers that already support the property do. Not converted here, because the change would not have the same shape: adis16201, adis16209 and sca3000 list their channels as array literals, adxl313_core and fxls8962af-core keep the probe in the bus wrappers, and mma9551/mma9553 differ in both. hid-sensor-accel-3d, ssp_accel_sensor and cros_ec_accel_legacy take the orientation from the HID/SSP/EC side rather than from a firmware property. Changes in v2: - move stk8ba50 to patch 1 - place the mount matrix before the __aligned(IIO_DMA_MINALIGN) members in adxl345, adxl355, adxl367, adxl380, bma220, bmi088 and sca3300, so the DMA buffers keep their own cacheline - add the missing blank line after the mount matrix read in probe - add the @orientation kernel-doc entry for msa311 and sca3300 - shorten the stk8ba50 test note to the behaviour observed on the device - v1 lost its threading because the sending MTA rewrote Message-IDs while leaving References untouched; v2 is posted as a new series Build tested with allmodconfig: drivers/iio/accel, 71 objects, no warnings; checkpatch.pl is silent in default and in --strict mode. Only stk8ba50 was tested on hardware; the other 17 are compile tested. Link: https://lore.kernel.org/linux-iio/5F08289E852625FC+20261127030810.3150676-1-hexin@hexin.host/ Signed-off-by: He Xin --- He Xin (18): iio: accel: stk8ba50: support mount matrix iio: accel: adxl345_core: support mount matrix iio: accel: adxl355_core: support mount matrix iio: accel: adxl367: support mount matrix iio: accel: adxl372: support mount matrix iio: accel: adxl380: support mount matrix iio: accel: bma220_core: support mount matrix iio: accel: bmi088-accel-core: support mount matrix iio: accel: da280: support mount matrix iio: accel: da311: support mount matrix iio: accel: dmard06: support mount matrix iio: accel: dmard09: support mount matrix iio: accel: dmard10: support mount matrix iio: accel: mma7455_core: support mount matrix iio: accel: msa311: support mount matrix iio: accel: mxc6255: support mount matrix iio: accel: sca3300: support mount matrix iio: accel: stk8312: support mount matrix drivers/iio/accel/adxl345_core.c | 21 +++++++++++++++++++++ drivers/iio/accel/adxl355_core.c | 21 +++++++++++++++++++++ drivers/iio/accel/adxl367.c | 21 +++++++++++++++++++++ drivers/iio/accel/adxl372.c | 25 +++++++++++++++++++++++++ drivers/iio/accel/adxl380.c | 20 ++++++++++++++++++++ drivers/iio/accel/bma220_core.c | 25 +++++++++++++++++++++++++ drivers/iio/accel/bmi088-accel-core.c | 21 +++++++++++++++++++++ drivers/iio/accel/da280.c | 25 +++++++++++++++++++++++++ drivers/iio/accel/da311.c | 25 +++++++++++++++++++++++++ drivers/iio/accel/dmard06.c | 25 +++++++++++++++++++++++++ drivers/iio/accel/dmard09.c | 21 +++++++++++++++++++++ drivers/iio/accel/dmard10.c | 25 +++++++++++++++++++++++++ drivers/iio/accel/mma7455_core.c | 21 +++++++++++++++++++++ drivers/iio/accel/msa311.c | 22 ++++++++++++++++++++++ drivers/iio/accel/mxc6255.c | 21 +++++++++++++++++++++ drivers/iio/accel/sca3300.c | 26 ++++++++++++++++++++++++++ drivers/iio/accel/stk8312.c | 25 +++++++++++++++++++++++++ drivers/iio/accel/stk8ba50.c | 21 +++++++++++++++++++++ 18 files changed, 411 insertions(+) --- base-commit: fe6ff8d5d675c01793b9f051d16055dd4aa75244 change-id: 20261130-work-ab0d96ec614e Best regards, -- He Xin