From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796388486; b=el/bQ6U0fP4Kz88PoqFpCiLi9ExL7HfVEvXg7poy+Bi2VXaOjWB1gh57Ir7HaZaVyDDg xUhWjY7lGxGbYs84tzoIwLmn5TKh+4oFPiGA1JXAGtcV4mCgbqMXKYTyuuFxHPJG8Jh5t YeM1DqJBFPfyBh7JqnMYX30MRYu5Hq00kwzYHB7HWXqJ6/1UGt0X5EF9W4Dwr2Ws92G1j 6rWUZWHQO+X2Ma/NC19hhHujqV/Z3p2A2HGxBGGW+mmB3rbkUnTCRMFqMGnsPPcAnKTCz ZFEFTQEIVXVkNmOy5vlASQa3mWt7ysXAdp1Sgli6WfxjiNuxTwkTxUxZbufQcVYiMSg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796388486; h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:User-Agent:X-stable:X-Patchwork-Hint: MIME-Version:Content-Transfer-Encoding; bh=81lH4o9pY/Vklgjl4q/DHHlYvX22UnuMS/n9aNJdTc4=; b=4i8YEke4P6O0BttUAuhvu8J6TfdWLBNDe0XfrwSvZCjN7IAvn4ugnx7tbCw//LdYWyU2 gOm3+KivjtPubZgn/PogWMh7RgXhglhIh5nEoIqPJmm26Iyj0D4SbxLznZ3u/OHKXpjgP +09AGwdf/i2obKp2889b9dznbZZe06DxzulbDQxTJWjPQ5NdlRqGSV+fj4bTD/xlkU/Qs P37KOD2pXIVXIu6M7X7S37B75xRs2j2V49OWXmg9JzMrTDJj40D2N/4yo1NrIrNczwtjJ Ipq6egFpn9FqXXBH/oaWUTgtPTQJiDmfhH53o3Ys24/XdXHPF+YyuAnfiWvTuhGj3tg== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=SsDP8NRb; arc=none 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 A589C606A33A; Fri, 4 Dec 2026 12:48:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=SsDP8NRb Received: by smtp.kernel.org (Postfix) with ESMTPSA id E61301F000CE; Fri, 4 Dec 2026 12:48:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796388486; bh=81lH4o9pY/Vklgjl4q/DHHlYvX22UnuMS/n9aNJdTc4=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=SsDP8NRb5cfPBedOCVdr2cPLKJtcL+Al5L+OBZslUZp6OqZDWYoo8E1VfIOTGOZDV RXTu8lEy9eTmNUx1R4A+6ZtnNzS3VxNm9SLORTajTGt+oKP/tLef13oGlq9LA3QdPH j6DQv1HKk3d/g5TFzFcgNfbXopIyoZRceWIyD9Cc= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Arnav Kapoor , Jean-Baptiste Maneyrol , Jonathan Cameron Subject: [PATCH 6.1 0635/1059] iio: imu: inv_mpu6050: fix magnetometer scale of Y and Z axes Date: Fri, 4 Dec 2026 19:02:46 +0900 Message-ID: <20261204100700.531757984@linuxfoundation.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261204100643.980430235@linuxfoundation.org> References: <20261204100643.980430235@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore X-Mailing-List: patches@lists.linux.dev List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.1-stable review patch. If anyone has any objections, please let me know. ------------------ From: Arnav Kapoor commit e5f7a6684a23d9b20184a81b4ebded3b3504ccdc upstream. inv_mpu_magn_get_scale() returns st->magn_raw_to_gauss[chan->address], where magn_raw_to_gauss[] holds one coefficient per axis, computed in inv_magn_init() from the per-axis factory sensitivity adjustment values (ASAX, ASAY, ASAZ) of the AK8975/AK8963 magnetometer. However INV_MPU9X50_MAGN_CHAN() never sets .address, so it is 0 for all three magnetometer channels. As a result the Y and Z channels report the scale computed from the X axis adjustment value, and userspace scales the Y and Z readings with the wrong per-axis calibration. Set .address to the axis index (0 for X, 1 for Y, 2 for Z) in the channel macro, matching the order used to fill magn_raw_to_gauss[]. Fixes: b1392de06184 ("iio: imu: inv_mpu6050: add MPU925x magnetometer support") Signed-off-by: Arnav Kapoor Acked-by: Jean-Baptiste Maneyrol Cc: stable@vger.kernel.org Signed-off-by: Jonathan Cameron Signed-off-by: Greg Kroah-Hartman --- drivers/iio/imu/inv_mpu6050/inv_mpu_core.c | 2 ++ 1 file changed, 2 insertions(+) --- a/drivers/iio/imu/inv_mpu6050/inv_mpu_core.c +++ b/drivers/iio/imu/inv_mpu6050/inv_mpu_core.c @@ -1162,6 +1162,8 @@ static const unsigned long inv_mpu_scan_ .type = IIO_MAGN, \ .modified = 1, \ .channel2 = _chan2, \ + /* index of the axis in magn_raw_to_gauss[] */ \ + .address = (_chan2) - IIO_MOD_X, \ .info_mask_separate = BIT(IIO_CHAN_INFO_SCALE) | \ BIT(IIO_CHAN_INFO_RAW), \ .scan_index = _index, \