5.10-stable review patch. If anyone has any objections, please let me know. ------------------ From: Maximilian Czirr commit c72dcaeaabd60e164e7324f80ccb037e879eefdd upstream. hid_sensor_format_scale() applies the HID unit exponent only when the usage and unit match an entry in unit_conversion[]. Rotation-from-north support uses HID_USAGE_SENSOR_ORIENT_COMP_MAGN_NORTH, but that usage has no entry in the conversion table. As a result, the unit exponent is ignored and the heading can be exposed with a scale of 1 instead of the scale specified by the HID descriptor. Add a unitless conversion entry so the HID unit exponent is applied to the magnetic north heading. A sensor reporting an exponent of -5 then correctly exposes a scale of 0.00001 instead of 1. Fixes: abea9c62c32f ("iio: hid-sensor-magn-3d: Add support for rotation from north") Cc: stable@vger.kernel.org Signed-off-by: Maximilian Czirr Acked-by: Srinivas Pandruvada Signed-off-by: Jonathan Cameron Signed-off-by: Greg Kroah-Hartman --- drivers/iio/common/hid-sensors/hid-sensor-attributes.c | 2 ++ 1 file changed, 2 insertions(+) --- a/drivers/iio/common/hid-sensors/hid-sensor-attributes.c +++ b/drivers/iio/common/hid-sensors/hid-sensor-attributes.c @@ -45,6 +45,8 @@ static struct { {HID_USAGE_SENSOR_COMPASS_3D, 0, 0, 1000000}, {HID_USAGE_SENSOR_COMPASS_3D, HID_USAGE_SENSOR_UNITS_GAUSS, 1, 0}, + {HID_USAGE_SENSOR_ORIENT_COMP_MAGN_NORTH, 0, 1, 0}, + {HID_USAGE_SENSOR_INCLINOMETER_3D, 0, 0, 17453293}, {HID_USAGE_SENSOR_INCLINOMETER_3D, HID_USAGE_SENSOR_UNITS_DEGREES, 0, 17453293},