From patchwork Sun Jul 3 22:02:39 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jakob Hauser X-Patchwork-Id: 12904501 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 ADE1EC433EF for ; Sun, 3 Jul 2022 22:03:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232313AbiGCWD1 (ORCPT ); Sun, 3 Jul 2022 18:03:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50394 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232354AbiGCWDZ (ORCPT ); Sun, 3 Jul 2022 18:03:25 -0400 Received: from sonic310-12.consmr.mail.ir2.yahoo.com (sonic310-12.consmr.mail.ir2.yahoo.com [77.238.177.33]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 432DE2AD4 for ; Sun, 3 Jul 2022 15:03:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rocketmail.com; s=s2048; t=1656885800; bh=GR8ksOaf4DkPasL6sXDaIM2/cMoDf6p7jL0ro40UYps=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From:Subject:Reply-To; b=QcxjmgEmKbifpS+q5qYZ1YFmYVtcKoh8osHXMh799LO+2qqczgyECl37e8GQlNMwddw+8Ye3yuml8q82CEQJzHLVvys6oAABqdycWvb2ZyU/XZeKffcjH5EZ9zZOfQzJkkyK3LXD/1QwFGrXl5KHLmnV/nlQa5H5GQHabgyqw0PkabkaVlAyOR5sfkhoHhIZ8nQ0UAKIWW7olYKYXV0BIWfm3r/G+QxluXdbhoEs0/j24Kt/wAy1OhY4EGh2ezleEzIBB31WbvwSNZxIKtX7aLB6UXsZri6W3dietSu2N8ZkSMGJBjvfu9GNg6qB8yFk+GxXbOWnyPImdgCfbmowDQ== X-SONIC-DKIM-SIGN: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1656885800; bh=GXq8UhEZp6WTWu3YrUwCUOAJg6BORGMf779gHVoSqQb=; h=X-Sonic-MF:From:To:Subject:Date:From:Subject; b=kzA1FjG5KvFyAvLDWvacoyYfUppa1FTyY9wbZQE1NaffafduPN+iXzRDj3Hw89t1OXRJZxwAwu2K2ToP0GVyjDQzUB1rzaYXsIQ+xdCiwhXnh4cQDJO2EuFeAlTOvRqcl58l1i3Re6POAOTj2DxIJ5gnWPW0POZnqSxh9jnkuNMau522ouARxNOR/S5TslOdbserOZTnOsNda5Tyk56EE6UujzIg3vnqWpAySdIK4mqCWABKJ8gmFKj5jf8UvzbRitT7NRe+13aw1gGqdUcMozxBkEU8NtLMmbCeYuhqibiBey36atSMHSv2hjTbZOGWWrsQXV56oDDi0HO+00jEeg== X-YMail-OSG: fmZSPZIVM1m4UsPp2Z6HJntg8k5AUw1ySzkrwvClhGy3unqI.OcI5O4kO0IMVp0 utki4VN91B2nF21rr8abi0sYz2GkiOXcvOWNV_tGqLF_O6gLHkKnudd7.xByPnh0eMQ0XCjLnStS xufMRQqZR.UIzeyESUL2.Xw6YzdbXNdIp6YroQAe_1tdMT8HNYhNATLC1U5WnJ8BOWT1YXqApLS4 8T6ZLk.whRe6xE57SlSWoY30KFy998lV_tmPycEnmTstvnNx7V3O2g3Hiqc5He2WItvXmMEMOgex z.RjGratdc.uP_6D2GF4pim_H1EAB_YCy6sDOddxU4bS8VrlR0No7a7JzlUIFu9IpMNb1gnPeKOO VuqEQUmKuE1lSqEDXHhbrhEi5SKzixGXERBnZURPJ8_Lc7iRcTPmezYitXZqB7jXmbI4D8hBZAXP E9Wnu0rlimJU7l4qNNEVf2T9WRQHOP419UHSToiZ2TaD4aLj8XakW0p0P7UmdwLtn.FZ5F034q5J EVgP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FMzA_PZhPOMzFwiHJNe5cRvi.LMIy8R.rZzMPKzRipCKgSqza6Suozg_mD7n7FKtI Np8ELamAMgSYa3ZTbQw7l5LBB.grfD2h9bNCfudybAraDp3a3U4qFw7IdXNK_2wPzIDc3ZHgj0IP YRgMcCo78Mma9fRvC9M94.y5qgAvHFD77OtMCX3Ao4o98BJi3DrILdr8vEVQN8vNeN0z32Iykrhy nkPBNa7kLEKyTy9kNG47emR9LhpkD.jbZUHs07.pT2JhosYrtb7Vos3WWrzKoEPZ_3E8d7PydbLi YqJPnC7lZ5YuDVPiFgLroMXT_Ecfn24mYgzLPth4DQU_tk8QYZG4G70vMXeyhsCHFyD6KQZmbLsp s6CDi7VIRcienHuNNJ05AkgoyaQg4TTK8z1S5rj68e6D1CF35.NBwaozT.mc3CtyZzsy6fUC7BUg czzDpFT9DZxYybYBfKvc0WgftqQbmgrgSpSwH7D5wUB13VZJScGvbINvMzaaTpWiVLv_I.0t4BCY FLJZ4sryGuydDRaukZd9xiQoI4KR6G2JYtvxzT1SYQQiUBuUBT_P25XRsyQT1sxVeKmbiRnM_MlI LupuIiT9Hcd3IuGgV0kjKbDcHpYeGp61FqZ0ZNatkYwFbQ9miYzyKhK1yq3FEOocB4eZGpqIsXIV jpYmaJZly7uw6HvRWGY7ZEQjAzceoQlpXNVq5oejZ9PCYcpvIfjYfNSJX5korCoVZLczrKILQx3S 2q6o4IwOPSPNN_QKKtw-- X-Sonic-MF: Received: from sonic.gate.mail.ne1.yahoo.com by sonic310.consmr.mail.ir2.yahoo.com with HTTP; Sun, 3 Jul 2022 22:03:20 +0000 Received: by hermes--canary-production-ir2-74b4d6d794-tv8mb (Yahoo Inc. Hermes SMTP Server) with ESMTPA ID 0849bd8970b52a790a5a1bb96f2e336c; Sun, 03 Jul 2022 22:03:16 +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 v4 05/10] iio: magnetometer: yas530: Change data type of calibration coefficients Date: Mon, 4 Jul 2022 00:02:39 +0200 Message-Id: <502f2d4425af785efe49c9e3841cbfe90fd1b713.1656883851.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 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 c6889a30a1b5..839baeca673a 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; };