From patchwork Fri Aug 12 21:54:10 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jakob Hauser X-Patchwork-Id: 12942569 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 E5DAEC3F6B0 for ; Fri, 12 Aug 2022 21:57:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233820AbiHLV5C (ORCPT ); Fri, 12 Aug 2022 17:57:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41922 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231698AbiHLV5A (ORCPT ); Fri, 12 Aug 2022 17:57:00 -0400 Received: from sonic305-21.consmr.mail.ir2.yahoo.com (sonic305-21.consmr.mail.ir2.yahoo.com [77.238.177.83]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 880F899259 for ; Fri, 12 Aug 2022 14:56:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rocketmail.com; s=s2048; t=1660341417; bh=nuMoHzZRdeYccWIDIyDSTJ5ryNgtfIJF3s4M09Vr0oU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From:Subject:Reply-To; b=Ge9a8lac4zAhLE4Son5FO/CXCn5kc/dPGgAmtDa1eslF83nMlJOj2zsFABmMukogxqOmb9kawtGsI4F2sD0pvkjS2Dm6IXcFJY03WGfk3bBqXW62KaNQT0rkf9+v7Fov82s+QpbNhw5wyY9Bj4EOBTrnPBXlineiqH/0aX3K83xQRnyMwGwz6tAApTRVmWCx4RS6Xj1oCHwiXxqNDHoQ1+9y4yPgtZrky9l1WKutqMCNYYudz+eTgl6xnDhM2wBfuviiQNpjQD0C+HSxpuEIQLsHTJbMVixaZhVctC9S7lrIqQkDFs4rR9qRTCrkGV0RMO7DW3ivqnaBy/ta3HCYVA== X-SONIC-DKIM-SIGN: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1660341417; bh=zqqrR3UrpbrRMJ+HiDCFCWJ9rnoFujiaifHyhdHHE7p=; h=X-Sonic-MF:From:To:Subject:Date:From:Subject; b=pPoE9OE+gHzY4EWbA++xNxoenUueMWFD15d4ZRUJOzW2xZplchO20uA6JyVIBZfSDapANnDVNqxQdpRXa2SZyEmnZ36TgF53luuwYTwMrxP6Ll9tbhoSHiDX8CuuznPM8dpguxtN0BxYVrh41zyzge3jgmA+Z0ncwsXpAWElTzRmzq5YjmNgd4Ges1Z8LwvreLz9eem208kwWj2HOUlU59rq+G5S8al8/g8O5DMsKXbnxAj5N4i1rZWt7XpcGZCSdDEjyC30Ck7gncrxkixKZk5MHojBrDuB9HkyEYuk0vE8uHGRD5Zy3NVfx4XQI618wJtF0U65Ao33kVVxypQdaw== X-YMail-OSG: uahWN0oVM1lwyiDRffZTeqLsZUZsqWqUZcQdgfiCH2GyTj4dTIa.BaD9_yZHHNH uxi01oLrPiDjpS.mjt0dlx8otNuVwecG4cKhynPEFduY_ZnD26URYMndC_N.JSgHzDFQ8PnQA1Fr r8TfGHRLnwya_6VZ.zd_F_YEwtkhzXFf0Go41k_Wvlh52WRTKXhyRdapIEprgxLvrOhqyVTJDw.Y YFwY5p8qL0obzU.BcfyNNf5AFhieVxAnoeJ87z.5Hr_CnZDN5ONU9zaxRXnUFb7i3aNmuidRz2LY Qy98wwbX75tmYLeh9jlzVwJpkW.ZP7cwBCM0EWE_1BWqFUMHfN_PtvcQ4hVj0tpuVZPX8_83XcPC iqnysAnD4y..5kJUB6jdKmPuTSvVjc.j3lBLVISuXF4bbhHZEZLIqPECKY6_vzrDVoNzgHrzpd4y I57gJ5mYyqeYTEmWMCRap4S4z6cHL3VXH6BrGFGW.0qyUGeGgd2NI_DBcW69g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z4g3MQuL YEJqS0L5bY_5EE82ixKCuDgO5G6bXWWsOhjHwjmcu.jxYspLvV2d2zVTVae_oSqLGHT8MWd8FEzb RRAIug3GgqtwXHEaH7xlL1_VZEhduib6bwpytPJ3BFtzJWjkbc57A5_jarSY8SqmvxC3g.x2zIym o_FWBhRw2_05aSXolDmZQZSW3D1RSFHGUeRjAu6Dm0M_WJxJ6oLaEG8fINONxXh8KbFwY3wccVKu .zvKOVSNCpgz9tbYJ70SGv96QFgDSGSSTUIMCqNx2iBWTiPVCzUWmaHs5F954PoSOONQF2kli1Ka 6tNfDQPBXA4KpzPDK_s0PGHgqiSXumGuXioeY_kLPOonk3hF25tcnaobJ1KGWHMIKXfQxj34E8X5 wgurRG.ZUyCYLpYMJMFQtFZLJHy0HqXxyCZC6aZh.w_bPHpVLcPxX3zg0Q_OH83kd_4JOiIWIZ_j CHnF1snDTQpKuxOKwIU5zy4.r77Gar7ad2WJtvqyYOPbUZGqvMIdd0Zr9d3YFCJM27A.zVmIy9ky nVNSHZSv8LSPu6u3IV_X99VvIiy41wApSLCIYrLjUrXbiYXmCDG_5nlR85.2KeGuzVt7ySV0ZXhB hLtUclcrH3TW4vnSuMeFk_hC.FT.PwWeak4hmvHyAkA2AknX3EHl_A04T1xXvFS90W2l7O1eRlBr H7RdSR4Iq9IHGNl9asnaPh6Z20uvdr1.4Y31rLjRJjN3SQZFakGAYI_VXBM0BtjiTfTY2Pkq_i3D dHDLaeKnIwZygOw-- X-Sonic-MF: Received: from sonic.gate.mail.ne1.yahoo.com by sonic305.consmr.mail.ir2.yahoo.com with HTTP; Fri, 12 Aug 2022 21:56:57 +0000 Received: by hermes--canary-production-ir2-f74ffc99c-2vqg6 (Yahoo Inc. Hermes SMTP Server) with ESMTPA ID 15f5a750f82727a3561822ee8056ab25; Fri, 12 Aug 2022 21:56:53 +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 v6 05/14] iio: magnetometer: yas530: Change data type of calibration coefficients Date: Fri, 12 Aug 2022 23:54:10 +0200 Message-Id: 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 6296ea3140ef..a9d7cf3ad77f 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; };