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=1796385769; b=IipfBq9fYFIpGRYpCL9lHKEx8f7+6eVDnPljDm2Uuw8rhcoYl7ZyLUQY8PZGAk1ZwA6V B11C1trKS4+ZhiM++R3ZHwO0cVmUDRwxEpmqt1YQMi94qJmmtOIiCldAs+JSg4H3/6vda c5+11lTfAp+OaUJIVkIMgfXwg2Z0BffodBn0W/XUZrdtVGore+AiuEN0y3hCr9GxuUN3I NeqvwmsxLPNc3YlCVlFDv1als2q7ZXPpHPV5aXX5wBjzm6x8NFAoOYR+hBQLo/1ul3+yU fL9J8kHKvJEdg3bGm5RvFlLwvdIr2r0H9iUHd977UKcDaXncep01Kz6zC9/J8oYzsMA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796385769; 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=pyE9jX6R3UhgMg5uMItT1QIYiJqTno3obNoyvctfn4c=; b=kPwYD38Cij6UE+iwWxZV8OExrgb3tOgRWcHIdQ9gXAlITbzAPQ5Ayb8NXiCtmgKZusEp c+auAUG/hbsbBYUHWf1FuBIRIaceEfPkZh7eNc6qcOBC2Xhx/ALtGdBIzAXkE0MNkV9s9 wueFGFwW3AVu3L+Ff7/2i4fZuDIkPBtguro2kjNNcZuA19UQH0fB4uw4lLLkMrFYyjOFC BLFasiqGVjo45hKT7Z9DpBKHJ5JNNekYl5lNXq7mX4/YZB81vgsS1FNo6NG+02KWEfNRJ HX0OvMEqD00rB/tjM3J0ZNRdUIi0xl4Bae2Sr7gKcLUJMdtv7XPg9KnUDdGkfxnwifQ== 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=DsP27pep; 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 8B5AC606A322; Fri, 4 Dec 2026 12:02:49 +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=DsP27pep Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0945B1F000C2; Fri, 4 Dec 2026 12:02:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796385769; bh=pyE9jX6R3UhgMg5uMItT1QIYiJqTno3obNoyvctfn4c=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=DsP27pepMxswT6SARhUqTpia7MnO/Zzcv/2pzsamR/JjbEWm/43q1Z9UIMw2XKRkF 6tghqconPfR5PR/AAb2+Q5QVU0fuXKuN1CQfF1J7KJK/lBhgzpDmL55yV8SO7KL3a9 bYgVZ+v6DwJ5gg5z2x/VhKJmxgIGZyIeivBYTCFE= 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.6 0688/1167] iio: imu: inv_mpu6050: fix magnetometer scale of Y and Z axes Date: Fri, 4 Dec 2026 19:01:55 +0900 Message-ID: <20261204100719.987131994@linuxfoundation.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261204100702.047403948@linuxfoundation.org> References: <20261204100702.047403948@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.6-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 @@ -1171,6 +1171,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, \