From patchwork Sat Jun 18 00:13:13 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jakob Hauser X-Patchwork-Id: 12886141 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 09FE9C433EF for ; Sat, 18 Jun 2022 00:15:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1356130AbiFRAPJ (ORCPT ); Fri, 17 Jun 2022 20:15:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37158 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236835AbiFRAPI (ORCPT ); Fri, 17 Jun 2022 20:15:08 -0400 Received: from sonic302-21.consmr.mail.ir2.yahoo.com (sonic302-21.consmr.mail.ir2.yahoo.com [87.248.110.84]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5F94E1ADB8 for ; Fri, 17 Jun 2022 17:15:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rocketmail.com; s=s2048; t=1655511305; bh=s8wR7NVG2hJ7U7KQaWy5POGWhS7BSCCGW2GyzhwYZk4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From:Subject:Reply-To; b=jU3cNvkxptia1+tDmB3Wlo0JtPEWo4Kbchs7m5dXYGIf8RqNNVsYkWb8tAwBJYXiyporta8cGCY/Hlq1h/PiyEZmACmSM3WpJNBsocmifzfMrPgRh9qidEYniA4HrzzXOMM0vEMryix+KvRPnBZOZ5J5GbLEyLwhcuqH7eAXdGf/mlv2rDB1AWCdEHpCCiKu9d8ZvwXsovSAhOwovE8YYEC36nyblpHBs5w4AqabPYDDs2psw/mVgKmJFPuXcjnnq64FR1Z3SA5jRLQv99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rTVoKXKm4v Mf43M6WjdiHzi2jtyTOdfG2DRvvzgSYDkXx2aOft5SQN6sXQ2TJv3fOOGFKiH_4Hh.Q5F3zij5HE nddjeTrFbVbr1AgXfnC6pwxz6jyIFEcOhgrTpqwo1bnEbyyyFVwfjr1Eesce0pSK_Y1OsUFPCYBm VBUFv7in8E9g8xIu_N4AgHvyIL2KUpMsxdKm2IVPv2Du_A86B32x0VExUxWS6znU1YVq2OSdBxp2 tIhsayHY1xOy8jWVW.UFqLcSUby8zRJ2YD5hUO8bVsDMPjbtSBAD.smC5GvlbOf8E2hVHvMQ.zxZ bYpsOnVvqixXsXNn9T6btdkumLQWT6jPiJSxpcWApyL44BRL.xYQv09._uPvpjO1H_nNzIzwRdFj iEjAGXSMxjrnqIlP08.FkDzIEUlOubABOO8hXF_YmbFeUKMpcPHZknqdLT9QAwzdz9HH0HinOqeA i_FXmqJ9DbPrUkiCVO0upbFAN8NDLeT3hO_25G9F_7fDAc.7JmZkwMwzFn3EyV_yLOoULs1kB5mw SPSKGs0.EFucpIvmZ198cPGqnexdR2cJfMuC8rXl9eRerNOlJnCN9JbF_FBoAqxwSilU_UuZj_2H IPUJ3d2c8lxqj2jSQMid_fmoDs2DIu0VvcourHJFOD4.iHwYFP5wHQbKT3aFALzyj5nG5BCldXHA 5HJ.k4qwHkWNhfhE8qJgsKBEIabZ9CA8vmyjJiWSVAOSnBldZt437S6zAhT62laBoX6m9eBfbjHh gvGLscYSu.zK.A.Ql X-Sonic-MF: Received: from sonic.gate.mail.ne1.yahoo.com by sonic302.consmr.mail.ir2.yahoo.com with HTTP; Sat, 18 Jun 2022 00:15:05 +0000 Received: by hermes--canary-production-ir2-c9bf9d9bc-74fwm (Yahoo Inc. Hermes SMTP Server) with ESMTPA ID 8b08f14069c990c2ed22165f3e3da032; Sat, 18 Jun 2022 00:15:01 +0000 (UTC) From: Jakob Hauser To: Jonathan Cameron Cc: Lars-Peter Clausen , Linus Walleij , Andy Shevchenko , Hans de Goede , linux-iio@vger.kernel.org, devicetree@vger.kernel.org, phone-devel@vger.kernel.org, ~postmarketos/upstreaming@lists.sr.ht, Jakob Hauser Subject: [PATCH v3 5/8] iio: magnetometer: yas530: Change data type of calibration coefficients Date: Sat, 18 Jun 2022 02:13:13 +0200 Message-Id: <18f223776f6942d52af2e41dd10160e220a23311.1655509425.git.jahau@rocketmail.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org 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 Signed-off-by: Jakob Hauser Reviewed-by: Linus Walleij Reviewed-by: Andy Shevchenko --- drivers/iio/magnetometer/yamaha-yas530.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/iio/magnetometer/yamaha-yas530.c b/drivers/iio/magnetometer/yamaha-yas530.c index 9b45a550f31e..c6f5f25793c4 100644 --- a/drivers/iio/magnetometer/yamaha-yas530.c +++ b/drivers/iio/magnetometer/yamaha-yas530.c @@ -103,9 +103,11 @@ struct yas5xx_calibration { s32 r[3]; u32 f[3]; /* Temperature compensation calibration */ - s32 Cx, Cy1, Cy2; + s16 Cx, Cy1, Cy2; /* Misc calibration coefficients */ - s32 a2, a3, a4, a5, a6, a7, a8, a9, k; + s8 a2, a3, a4, a6, a7, a8; + s16 a5, a9; + u8 k; /* clock divider */ u8 dck; };