On Thu, Jun 9, 2022 at 1:39 AM Jakob Hauser <jahau@xxxxxxxxxxxxxx> wrote: > This is a preparation for adding YAS537 variant. > > YAS537 uses other data types on the calibration coefficients [1] than YAS530 [2] > and YAS532 [3]. > > On YAS537, at least for a4 and a7 this could matter because 8-bit unsigned data > from the register gets stored into a signed data type, therefore this should be > 8-bit as well. > > For YAS530/532, on the other hand, it doesn't seem to matter. The size of a2-a9 > and k is smaller than 8-bit at extraction, also the applied math is low. And > Cx/Cy1/Cy2, now being defined as signed 16-bit, are extracted as unsigned 8-bit > and undergo only minor math. > > [1] https://github.com/msm8916-mainline/android_kernel_qcom_msm8916/blob/GT-I9195I/drivers/iio/magnetometer/yas_mag_drv-yas537.c#L76-L78 > [2] https://github.com/NovaFusion/android_kernel_samsung_golden/blob/cm-12.1/drivers/sensor/compass/yas_mag_driver-yas530.c#L526-L527 > [3] https://github.com/msm8916-mainline/android_kernel_qcom_msm8916/blob/GT-I9195I/drivers/iio/magnetometer/yas_mag_drv-yas532.c#L76-L77 > > Cc: Linus Walleij <linus.walleij@xxxxxxxxxx> > Signed-off-by: Jakob Hauser <jahau@xxxxxxxxxxxxxx> Reviewed-by: Linus Walleij <linus.walleij@xxxxxxxxxx> Yours, Linus Walleij