From patchwork Tue Aug 18 21:37:33 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Crt Mori X-Patchwork-Id: 11722215 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 076E3913 for ; Tue, 18 Aug 2020 21:38:17 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E2E14207BB for ; Tue, 18 Aug 2020 21:38:16 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=melexis.com header.i=@melexis.com header.b="WLwkvH0X" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725554AbgHRViO (ORCPT ); Tue, 18 Aug 2020 17:38:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34694 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726711AbgHRViN (ORCPT ); Tue, 18 Aug 2020 17:38:13 -0400 Received: from mail-wr1-x42f.google.com (mail-wr1-x42f.google.com [IPv6:2a00:1450:4864:20::42f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A9F2BC061389 for ; Tue, 18 Aug 2020 14:38:12 -0700 (PDT) Received: by mail-wr1-x42f.google.com with SMTP id r2so19592822wrs.8 for ; Tue, 18 Aug 2020 14:38:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=melexis.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=/CQP6Mp+jMuAdeJV/E9lJgqu50DuZ6HxUkaNbDh+BH8=; b=WLwkvH0X34iEz89yjYbiz9Pnl2Xb2a4TL2wKrUbnaXz9CeFlqMZ82f2i/dUPQ8TZsm BA93t7gmcpGQT4hjzxtmTr4e50mTi5oxht7xTmCW/5o+NxvhCKd7C2Dx+anOgMN2KtOJ K5LAdJH0zgM0K36ZZHxTOtCqcXdTjsggQBtxcbJ23CjL8eT42LUz8kgDnQDjNaZhSFF2 h7mNmKlwn8+WGcuqo14+Y8IJMjiV6WV9yUcOB2BdD10lUWCs6RvL66H5lmxb1N446VRE KNhxU19b4kG2Bq8iczJDmqWriLfhauF62eakCeGzbDwHJdvZz8mWlmT5HjU+QT/Xwrez 1y3w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=/CQP6Mp+jMuAdeJV/E9lJgqu50DuZ6HxUkaNbDh+BH8=; b=gDlES5x4kaS6HlLNLnMBedsjad4zpQpv2PxJBbVdbK+QY/aX7JjVt+JScgCYIqAjYO iNmWw7FkSyjeSDYIFFCNy1HMT0a3UbpP0WKc1PclBvWjkWkPDBlMm/5tj9PM3a5U6Wo6 5Mz5b6A9plo7VBgLVShtS5onZa0avfCQ42jautvuxhS36oHdu65LAkstavnKiU/KRMSo vULr4Hrx5ee6QTsOJ1jm32IQ2gGciCmIMV2Zw9NQPnjj/JjxGRbRNjqIXRn5eodAoBQq sbVDQz4qw9KG5jiUUyLgcTZcqD7SvhUE7mxJMzbht43PfuIxMceIhwLNE9VW7XXjTU2g 9QxQ== X-Gm-Message-State: AOAM532ZZeBZ1zOwH9aVrdtXBH5c3pirFdJae0DcCCvj6Bj5J/dEPxbE q9yBLI8ryk/PZbguANCi2DpNdg== X-Google-Smtp-Source: ABdhPJx9hnLhvEEH1s0BzrqxMiQii6rmDst21X83uvV5CPQZKW28aixXL62YUtPpWR5oV0/TuKGg3A== X-Received: by 2002:adf:df08:: with SMTP id y8mr23448704wrl.152.1597786690523; Tue, 18 Aug 2020 14:38:10 -0700 (PDT) Received: from localhost.localdomain ([88.116.83.106]) by smtp.gmail.com with ESMTPSA id z207sm1797860wmc.2.2020.08.18.14.38.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 18 Aug 2020 14:38:09 -0700 (PDT) From: Crt Mori To: Jonathan Cameron Cc: linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org, Crt Mori , Andy Shevchenko Subject: [PATCH v6 1/5] iio:temperature:mlx90632: Reduce number of equal calulcations Date: Tue, 18 Aug 2020 23:37:33 +0200 Message-Id: <20200818213737.140613-2-cmo@melexis.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200818213737.140613-1-cmo@melexis.com> References: <20200818213737.140613-1-cmo@melexis.com> MIME-Version: 1.0 Sender: linux-iio-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org TAdut4 was calculated each iteration although it did not change. In light of near future additions of the Extended range DSP calculations, this function refactoring will help reduce unrelated changes in that series as well as reduce the number of new functions needed. Signed-off-by: Crt Mori Reviewed-by: Andy Shevchenko --- drivers/iio/temperature/mlx90632.c | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/drivers/iio/temperature/mlx90632.c b/drivers/iio/temperature/mlx90632.c index 51b812bcff2e..c3de10ba5b1e 100644 --- a/drivers/iio/temperature/mlx90632.c +++ b/drivers/iio/temperature/mlx90632.c @@ -374,11 +374,11 @@ static s32 mlx90632_calc_temp_ambient(s16 ambient_new_raw, s16 ambient_old_raw, } static s32 mlx90632_calc_temp_object_iteration(s32 prev_object_temp, s64 object, - s64 TAdut, s32 Fa, s32 Fb, + s64 TAdut, s64 TAdut4, s32 Fa, s32 Fb, s32 Ga, s16 Ha, s16 Hb, u16 emissivity) { - s64 calcedKsTO, calcedKsTA, ir_Alpha, TAdut4, Alpha_corr; + s64 calcedKsTO, calcedKsTA, ir_Alpha, Alpha_corr; s64 Ha_customer, Hb_customer; Ha_customer = ((s64)Ha * 1000000LL) >> 14ULL; @@ -393,30 +393,35 @@ static s32 mlx90632_calc_temp_object_iteration(s32 prev_object_temp, s64 object, Alpha_corr = emissivity * div64_s64(Alpha_corr, 100000LL); Alpha_corr = div64_s64(Alpha_corr, 1000LL); ir_Alpha = div64_s64((s64)object * 10000000LL, Alpha_corr); - TAdut4 = (div64_s64(TAdut, 10000LL) + 27315) * - (div64_s64(TAdut, 10000LL) + 27315) * - (div64_s64(TAdut, 10000LL) + 27315) * - (div64_s64(TAdut, 10000LL) + 27315); return (int_sqrt64(int_sqrt64(ir_Alpha * 1000000000000LL + TAdut4)) - 27315 - Hb_customer) * 10; } +static s64 mlx90632_calc_ta4(s64 TAdut, s64 scale) +{ + return (div64_s64(TAdut, scale) + 27315) * + (div64_s64(TAdut, scale) + 27315) * + (div64_s64(TAdut, scale) + 27315) * + (div64_s64(TAdut, scale) + 27315); +} + static s32 mlx90632_calc_temp_object(s64 object, s64 ambient, s32 Ea, s32 Eb, s32 Fa, s32 Fb, s32 Ga, s16 Ha, s16 Hb, u16 tmp_emi) { - s64 kTA, kTA0, TAdut; + s64 kTA, kTA0, TAdut, TAdut4; s64 temp = 25000; s8 i; kTA = (Ea * 1000LL) >> 16LL; kTA0 = (Eb * 1000LL) >> 8LL; TAdut = div64_s64(((ambient - kTA0) * 1000000LL), kTA) + 25 * 1000000LL; + TAdut4 = mlx90632_calc_ta4(TAdut, 10000LL); /* Iterations of calculation as described in datasheet */ for (i = 0; i < 5; ++i) { - temp = mlx90632_calc_temp_object_iteration(temp, object, TAdut, + temp = mlx90632_calc_temp_object_iteration(temp, object, TAdut, TAdut4, Fa, Fb, Ga, Ha, Hb, tmp_emi); } From patchwork Tue Aug 18 21:37:34 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Crt Mori X-Patchwork-Id: 11722219 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id E198F913 for ; Tue, 18 Aug 2020 21:38:28 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C92BF206DA for ; Tue, 18 Aug 2020 21:38:28 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=melexis.com header.i=@melexis.com header.b="Te28b6Gr" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726711AbgHRVi0 (ORCPT ); Tue, 18 Aug 2020 17:38:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34704 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726790AbgHRViP (ORCPT ); Tue, 18 Aug 2020 17:38:15 -0400 Received: from mail-wr1-x442.google.com (mail-wr1-x442.google.com [IPv6:2a00:1450:4864:20::442]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A4079C061389 for ; Tue, 18 Aug 2020 14:38:13 -0700 (PDT) Received: by mail-wr1-x442.google.com with SMTP id c15so19557128wrs.11 for ; Tue, 18 Aug 2020 14:38:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=melexis.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=kCKkfI4KUgwhE7z/MGIgFuxJr6A36cU9I1dFPpHRlos=; b=Te28b6GraM5AAO5E5d9a7pbomPCfaBFiUh1IlgdWQp7iRYae5+R+sV3xKyOn2oDIkV odfxpeWDKt1Ai24PpuW+Vvf0tFwI9ePJXbAZUUPJcQ4CzcmcxN7XzzgZDmLrLQAxwYjE JLldjyhrcJZXeiaRA67gLVd4z+2AjSQBruM9vzoLITm7SzsXnawRjrIz72s0ovegdXNw x7O5PbRwiCWiXBH2AOihqu4w5Dr65r927pDIqLSlrmTJIL2ZgoaxBJzGtmOzKwn91Pth uUSKINmo6BsCWKj0/lEi+/bHL05g0JnoO+5C5qhziEBt3qjqqBPCw3yDaBiFb5L02z2C SIpA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=kCKkfI4KUgwhE7z/MGIgFuxJr6A36cU9I1dFPpHRlos=; b=StHbUsRh7CrhBnKp+Drr8rrWagdUDch9ij3Ujtz1tREPqGJtU/q3bY1VDRNmtbhbSW FXSYXHPojNtkGFmZOKjsiWKqvGko2hC4uG612PL5z4+lfuCttSYUwHnoE9tJgYB+tpo/ M1ssVuSVniixq1+vqbO/93R3RRl1249tLV3FHndqguDES0LTxASw4r7JlgADHOXL8CvZ lfMVheh7fIW6+BDq8Z50BTKNp4ZAFeSD2+nkVhKJ9/BHgOstZr/GcgzsIj+b4F7snh4t ozs0/PuxRhamVcRcpsEhNw8z8f70CRGMwAD+ZibSnMJNSmMsmalFivzB+FQnKyXiRAUm zP3w== X-Gm-Message-State: AOAM532If8ptPCr8f1OUBJST1a3R4rzVaMTUJNwsByZTtWFEbHm6Ywzs n3yDlGhwWmKv914qV5vSqThlcg== X-Google-Smtp-Source: ABdhPJzzLziDaSiiV6C5/msWuEDrAjETq4OW0ouB5eldrg1N+W3o2BnVXNTMG2xvY3VpZFRIcS6cuA== X-Received: by 2002:a5d:6a4a:: with SMTP id t10mr23083894wrw.360.1597786692207; Tue, 18 Aug 2020 14:38:12 -0700 (PDT) Received: from localhost.localdomain ([88.116.83.106]) by smtp.gmail.com with ESMTPSA id z207sm1797860wmc.2.2020.08.18.14.38.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 18 Aug 2020 14:38:11 -0700 (PDT) From: Crt Mori To: Jonathan Cameron Cc: linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org, Crt Mori , Andy Shevchenko Subject: [PATCH v6 2/5] iio:temperature:mlx90632: Add kerneldoc to the internal struct Date: Tue, 18 Aug 2020 23:37:34 +0200 Message-Id: <20200818213737.140613-3-cmo@melexis.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200818213737.140613-1-cmo@melexis.com> References: <20200818213737.140613-1-cmo@melexis.com> MIME-Version: 1.0 Sender: linux-iio-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org Document internal/private struct for mlx90632 device. Signed-off-by: Crt Mori Reviewed-by: Andy Shevchenko --- drivers/iio/temperature/mlx90632.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/drivers/iio/temperature/mlx90632.c b/drivers/iio/temperature/mlx90632.c index c3de10ba5b1e..ce75f5a3486b 100644 --- a/drivers/iio/temperature/mlx90632.c +++ b/drivers/iio/temperature/mlx90632.c @@ -89,9 +89,16 @@ #define MLX90632_MAX_MEAS_NUM 31 /**< Maximum measurements in list */ #define MLX90632_SLEEP_DELAY_MS 3000 /**< Autosleep delay */ +/** + * struct mlx90632_data - private data for the MLX90632 device + * @client: I2C client of the device + * @lock: Internal mutex for multiple reads for single measurement + * @regmap: Regmap of the device + * @emissivity: Object emissivity from 0 to 1000 where 1000 = 1. + */ struct mlx90632_data { struct i2c_client *client; - struct mutex lock; /* Multiple reads for single measurement */ + struct mutex lock; struct regmap *regmap; u16 emissivity; }; From patchwork Tue Aug 18 21:37:35 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Crt Mori X-Patchwork-Id: 11722217 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 061751392 for ; Tue, 18 Aug 2020 21:38:28 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E1D8A206DA for ; Tue, 18 Aug 2020 21:38:27 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=melexis.com header.i=@melexis.com header.b="kzHVtPt8" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726702AbgHRViZ (ORCPT ); Tue, 18 Aug 2020 17:38:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34714 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726711AbgHRViQ (ORCPT ); Tue, 18 Aug 2020 17:38:16 -0400 Received: from mail-wm1-x342.google.com (mail-wm1-x342.google.com [IPv6:2a00:1450:4864:20::342]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4FCB7C061344 for ; Tue, 18 Aug 2020 14:38:16 -0700 (PDT) Received: by mail-wm1-x342.google.com with SMTP id 3so281571wmi.1 for ; Tue, 18 Aug 2020 14:38:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=melexis.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=hkVI01i3TLrSdzKf7VYHhdEqSltEGddTXnsWOh1/YsM=; b=kzHVtPt8wp9IvYy2NsG64JKyRoeMhnQnWw85I3YKjzRSCv6mgX0LH3CfjOgiyDy1Rt jiqCP81k0b4FIp3mr8ZL4u83pWoMjn8PW4CzWPVz2GXk/IORCQ9k7s7hLT+efg4xxnoL Nmwp/zanRQXQwz1sKT14w4hshTFcQGQXsuEDuqX7fREYtQ3OeP1e1dW2j05zJbBKtizp AdRAn3okhMJx4YSg4zDT6OKIzhaZv0bGsTIjPg/apb4UE2vVSjnruRxTB/e2wUiuHCLW AvKlYc6yRqtPYBS00BqBkfix/gJU7qYBCo3LH92y208jrSsTTOqmcjdcZ9/bnzrRfwaV T3gA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=hkVI01i3TLrSdzKf7VYHhdEqSltEGddTXnsWOh1/YsM=; b=dcLENczGIuyR/Fs0UHzR8ik9T0rqfUhGn+CkX+QEuZxB+imf+2sq0+bh8PkhTucbrw 2H5YNBFF/g64Vk6DPrfkuIIsOpA2+bcC4rse3s9blF6KnKSM30a80ofma1xmp/NsE+yn DaswWDGHv/m7jmGnBo0waYlKipApEuUdhrKW8/UdgJpZpnXhcCy31kqQUlk4o12ZDsFl KJBdyu3X7Ls/hSjVsUuKVzqsY41hKQXqqF4UHfORqzFfVHGQfn42ui/9a72H78lLmB84 h7btRNEzqHpjiUF5xp9tcLqkbD6nTK2kkQHFVAGyfLBM4InkNMyPiPbwZ1k1A+y5UG/V pLwA== X-Gm-Message-State: AOAM532CLa1gwoFNN5DR7FPL8X201Vw1XnPSEB5E0u0IPDuqcPo5/S7Y uWzl49zpRqka5N+gLkx4RSuNOIsY/k0CQyFgygQ= X-Google-Smtp-Source: ABdhPJx4EC1L4toYDnBar1k9GU/hYpSFfkJ9zKqSzKre3qXIAEhjZNwhivgC93vIWCtrIUABE3vcqw== X-Received: by 2002:a1c:8195:: with SMTP id c143mr1767857wmd.85.1597786693841; Tue, 18 Aug 2020 14:38:13 -0700 (PDT) Received: from localhost.localdomain ([88.116.83.106]) by smtp.gmail.com with ESMTPSA id z207sm1797860wmc.2.2020.08.18.14.38.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 18 Aug 2020 14:38:12 -0700 (PDT) From: Crt Mori To: Jonathan Cameron Cc: linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org, Crt Mori , Andy Shevchenko Subject: [PATCH v6 3/5] iio:temperature:mlx90632: Convert polling while loop to regmap Date: Tue, 18 Aug 2020 23:37:35 +0200 Message-Id: <20200818213737.140613-4-cmo@melexis.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200818213737.140613-1-cmo@melexis.com> References: <20200818213737.140613-1-cmo@melexis.com> MIME-Version: 1.0 Sender: linux-iio-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org Reduce number of lines and improve readability to convert polling while loops to regmap_read_poll_timeout. Signed-off-by: Crt Mori Reviewed-by: Andy Shevchenko --- drivers/iio/temperature/mlx90632.c | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/drivers/iio/temperature/mlx90632.c b/drivers/iio/temperature/mlx90632.c index ce75f5a3486b..d782634c107f 100644 --- a/drivers/iio/temperature/mlx90632.c +++ b/drivers/iio/temperature/mlx90632.c @@ -180,25 +180,19 @@ static s32 mlx90632_pwr_continuous(struct regmap *regmap) */ static int mlx90632_perform_measurement(struct mlx90632_data *data) { - int ret, tries = 100; unsigned int reg_status; + int ret; ret = regmap_update_bits(data->regmap, MLX90632_REG_STATUS, MLX90632_STAT_DATA_RDY, 0); if (ret < 0) return ret; - while (tries-- > 0) { - ret = regmap_read(data->regmap, MLX90632_REG_STATUS, - ®_status); - if (ret < 0) - return ret; - if (reg_status & MLX90632_STAT_DATA_RDY) - break; - usleep_range(10000, 11000); - } + ret = regmap_read_poll_timeout(data->regmap, MLX90632_REG_STATUS, reg_status, + !(reg_status & MLX90632_STAT_DATA_RDY), 10000, + 100 * 10000); - if (tries < 0) { + if (ret < 0) { dev_err(&data->client->dev, "data not ready"); return -ETIMEDOUT; } From patchwork Tue Aug 18 21:37:36 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Crt Mori X-Patchwork-Id: 11722223 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 02EF8913 for ; Tue, 18 Aug 2020 21:38:49 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id D324C206DA for ; Tue, 18 Aug 2020 21:38:48 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=melexis.com header.i=@melexis.com header.b="c+nfgegD" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726963AbgHRVik (ORCPT ); Tue, 18 Aug 2020 17:38:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34724 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726840AbgHRViS (ORCPT ); Tue, 18 Aug 2020 17:38:18 -0400 Received: from mail-wm1-x344.google.com (mail-wm1-x344.google.com [IPv6:2a00:1450:4864:20::344]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0F45EC061346 for ; Tue, 18 Aug 2020 14:38:17 -0700 (PDT) Received: by mail-wm1-x344.google.com with SMTP id 3so281632wmi.1 for ; Tue, 18 Aug 2020 14:38:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=melexis.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=roaHGPcG+M84dI1liAU3VQyf0x1c7p+0kdIrfMudPWY=; b=c+nfgegD9TKDNxBsxqcdWyapf7BcK3qHXluI9eJYAnVjO24k8PsocCLIASkcoaDt9k CovMtJFXgGNZpFwkONKH5+oc6krAwOhAbTxfS/yKhs31tmTPzOpG6gvt15UYHGW5Muhv fUvkG5u7lKE7D3lioSQXYePLZN5SHPUfv+GS4RouHMO1SSsnRhSou+zEpDpG//UPtFiM FjNC7ODGdFwsg5uBzWwyZPlFbPk4UN+/roLf2WYOcWDOMhRw5YsxjhLPXDha/ILZango XIHApfHQ7VdXIkMQnEMT/FfPh/C2Du+Y7PNDooFAQ+bBh85BjetrrV2YDFLEIia3AY4j Uj0A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=roaHGPcG+M84dI1liAU3VQyf0x1c7p+0kdIrfMudPWY=; b=sh5fnG6fu62cfDz3EXb+qayd/rsoHbUlp9rUF3h+taZaBwsH0rbPf/suLvpW13iOWb EfiFF9/4e6CWZdxgrdbQ+S5fVo6FhEqTtzqtXbj5IZFB8HUmqSSWUwS4wtdyfP21rOzr yVshU3Gwk+WWnJPpSKPmypU3JjXDV5+GzwEgd5lGtv6SJgx/TogX39DlddaWYSZL3RRI ePu06MSuLi75MXFj0CHOCEs6+S4I75UfLsf6k+wF9Y++H2bitdgOTO4HDsYvs1rw5RDe jCYW/uSq+TyBWyBbxf/ZfEY7oxcQEfgGKgmVVRKHZulKFr4H2IN+pQnInD4N7I/eaftv fOzg== X-Gm-Message-State: AOAM531smINDcFOleOVSEzh5VWlsWZUcKjl3qsh/2cjVEFfjsrG0LHNA E3ltFkMGPOBViPXmKoexGzYVSixcfNoYCsSrpU8= X-Google-Smtp-Source: ABdhPJzcmvb5TkhQctGavvSUBsbfNxSdl+c6Mk9qsXgKPtSmRAmBebMgWgcw3V2jid92/BkhS7/TXg== X-Received: by 2002:a7b:cb4d:: with SMTP id v13mr1868707wmj.56.1597786695538; Tue, 18 Aug 2020 14:38:15 -0700 (PDT) Received: from localhost.localdomain ([88.116.83.106]) by smtp.gmail.com with ESMTPSA id z207sm1797860wmc.2.2020.08.18.14.38.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 18 Aug 2020 14:38:14 -0700 (PDT) From: Crt Mori To: Jonathan Cameron Cc: linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org, Crt Mori , Andy Shevchenko Subject: [PATCH v6 4/5] iio:temperature:mlx90632: Adding extended calibration option Date: Tue, 18 Aug 2020 23:37:36 +0200 Message-Id: <20200818213737.140613-5-cmo@melexis.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200818213737.140613-1-cmo@melexis.com> References: <20200818213737.140613-1-cmo@melexis.com> MIME-Version: 1.0 Sender: linux-iio-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org For some time the market wants medical grade accuracy in medical range, while still retaining the declared accuracy outside of the medical range within the same sensor. That is why we created extended calibration which is automatically switched to when object temperature is too high. This patch also introduces the object_ambient_temperature variable which is needed for more accurate calculation of the object infra-red footprint as sensor's ambient temperature might be totally different than what the ambient temperature is at object and that is why we can have some more errors which can be eliminated. Currently this temperature is fixed at 25, but the interface to adjust it by user (with external sensor or just IR measurement of the other object which acts as ambient), will be introduced in another commit. Signed-off-by: Crt Mori Reviewed-by: Andy Shevchenko --- drivers/iio/temperature/mlx90632.c | 218 ++++++++++++++++++++++++++++- 1 file changed, 216 insertions(+), 2 deletions(-) diff --git a/drivers/iio/temperature/mlx90632.c b/drivers/iio/temperature/mlx90632.c index d782634c107f..94bca2b2866a 100644 --- a/drivers/iio/temperature/mlx90632.c +++ b/drivers/iio/temperature/mlx90632.c @@ -10,7 +10,9 @@ #include #include #include +#include #include +#include #include #include #include @@ -58,6 +60,8 @@ /* Control register address - volatile */ #define MLX90632_REG_CONTROL 0x3001 /* Control Register address */ #define MLX90632_CFG_PWR_MASK GENMASK(2, 1) /* PowerMode Mask */ +#define MLX90632_CFG_MTYP_MASK GENMASK(8, 4) /* Meas select Mask */ + /* PowerModes statuses */ #define MLX90632_PWR_STATUS(ctrl_val) (ctrl_val << 1) #define MLX90632_PWR_STATUS_HALT MLX90632_PWR_STATUS(0) /* hold */ @@ -65,6 +69,18 @@ #define MLX90632_PWR_STATUS_STEP MLX90632_PWR_STATUS(2) /* step */ #define MLX90632_PWR_STATUS_CONTINUOUS MLX90632_PWR_STATUS(3) /* continuous*/ +/* Measurement types */ +#define MLX90632_MTYP_MEDICAL 0 +#define MLX90632_MTYP_EXTENDED 17 + +/* Measurement type select*/ +#define MLX90632_MTYP_STATUS(ctrl_val) (ctrl_val << 4) +#define MLX90632_MTYP_STATUS_MEDICAL MLX90632_MTYP_STATUS(MLX90632_MTYP_MEDICAL) +#define MLX90632_MTYP_STATUS_EXTENDED MLX90632_MTYP_STATUS(MLX90632_MTYP_EXTENDED) + +/* I2C command register - volatile */ +#define MLX90632_REG_I2C_CMD 0x3005 /* I2C command Register address */ + /* Device status register - volatile */ #define MLX90632_REG_STATUS 0x3fff /* Device status register */ #define MLX90632_STAT_BUSY BIT(10) /* Device busy indicator */ @@ -78,9 +94,21 @@ #define MLX90632_RAM_2(meas_num) (MLX90632_ADDR_RAM + 3 * meas_num + 1) #define MLX90632_RAM_3(meas_num) (MLX90632_ADDR_RAM + 3 * meas_num + 2) +/* Name important RAM_MEAS channels */ +#define MLX90632_RAM_DSP5_EXTENDED_AMBIENT_1 MLX90632_RAM_3(17) +#define MLX90632_RAM_DSP5_EXTENDED_AMBIENT_2 MLX90632_RAM_3(18) +#define MLX90632_RAM_DSP5_EXTENDED_OBJECT_1 MLX90632_RAM_1(17) +#define MLX90632_RAM_DSP5_EXTENDED_OBJECT_2 MLX90632_RAM_2(17) +#define MLX90632_RAM_DSP5_EXTENDED_OBJECT_3 MLX90632_RAM_1(18) +#define MLX90632_RAM_DSP5_EXTENDED_OBJECT_4 MLX90632_RAM_2(18) +#define MLX90632_RAM_DSP5_EXTENDED_OBJECT_5 MLX90632_RAM_1(19) +#define MLX90632_RAM_DSP5_EXTENDED_OBJECT_6 MLX90632_RAM_2(19) + /* Magic constants */ #define MLX90632_ID_MEDICAL 0x0105 /* EEPROM DSPv5 Medical device id */ #define MLX90632_ID_CONSUMER 0x0205 /* EEPROM DSPv5 Consumer device id */ +#define MLX90632_ID_EXTENDED 0x0505 /* EEPROM DSPv5 Extended range device id */ +#define MLX90632_ID_MASK GENMASK(14, 0) /* DSP version and device ID in EE_VERSION */ #define MLX90632_DSP_VERSION 5 /* DSP version */ #define MLX90632_DSP_MASK GENMASK(7, 0) /* DSP version in EE_VERSION */ #define MLX90632_RESET_CMD 0x0006 /* Reset sensor (address or global) */ @@ -88,6 +116,7 @@ #define MLX90632_REF_3 12LL /**< ResCtrlRef value of Channel 3 */ #define MLX90632_MAX_MEAS_NUM 31 /**< Maximum measurements in list */ #define MLX90632_SLEEP_DELAY_MS 3000 /**< Autosleep delay */ +#define MLX90632_EXTENDED_LIMIT 27000 /* Extended mode raw value limit */ /** * struct mlx90632_data - private data for the MLX90632 device @@ -95,16 +124,23 @@ * @lock: Internal mutex for multiple reads for single measurement * @regmap: Regmap of the device * @emissivity: Object emissivity from 0 to 1000 where 1000 = 1. + * @mtyp: Measurement type physical sensor configuration for extended range + * calculations + * @object_ambient_temperature: Ambient temperature at object (might differ of + * the ambient temperature of sensor. */ struct mlx90632_data { struct i2c_client *client; struct mutex lock; struct regmap *regmap; u16 emissivity; + u8 mtyp; + u32 object_ambient_temperature; }; static const struct regmap_range mlx90632_volatile_reg_range[] = { regmap_reg_range(MLX90632_REG_I2C_ADDR, MLX90632_REG_CONTROL), + regmap_reg_range(MLX90632_REG_I2C_CMD, MLX90632_REG_I2C_CMD), regmap_reg_range(MLX90632_REG_STATUS, MLX90632_REG_STATUS), regmap_reg_range(MLX90632_RAM_1(0), MLX90632_RAM_3(MLX90632_MAX_MEAS_NUM)), @@ -120,6 +156,7 @@ static const struct regmap_range mlx90632_read_reg_range[] = { regmap_reg_range(MLX90632_EE_CTRL, MLX90632_EE_I2C_ADDR), regmap_reg_range(MLX90632_EE_Ha, MLX90632_EE_Hb), regmap_reg_range(MLX90632_REG_I2C_ADDR, MLX90632_REG_CONTROL), + regmap_reg_range(MLX90632_REG_I2C_CMD, MLX90632_REG_I2C_CMD), regmap_reg_range(MLX90632_REG_STATUS, MLX90632_REG_STATUS), regmap_reg_range(MLX90632_RAM_1(0), MLX90632_RAM_3(MLX90632_MAX_MEAS_NUM)), @@ -200,6 +237,26 @@ static int mlx90632_perform_measurement(struct mlx90632_data *data) return (reg_status & MLX90632_STAT_CYCLE_POS) >> 2; } +static int mlx90632_set_meas_type(struct regmap *regmap, u8 type) +{ + int ret; + + if ((type != MLX90632_MTYP_MEDICAL) && (type != MLX90632_MTYP_EXTENDED)) + return -EINVAL; + + ret = regmap_write(regmap, MLX90632_REG_I2C_CMD, MLX90632_RESET_CMD); + if (ret < 0) + return ret; + + ret = regmap_write_bits(regmap, MLX90632_REG_CONTROL, + (MLX90632_CFG_MTYP_MASK | MLX90632_CFG_PWR_MASK), + (MLX90632_MTYP_STATUS(type) | MLX90632_PWR_STATUS_HALT)); + if (ret < 0) + return ret; + + return mlx90632_pwr_continuous(regmap); +} + static int mlx90632_channel_new_select(int perform_ret, uint8_t *channel_new, uint8_t *channel_old) { @@ -301,6 +358,97 @@ static int mlx90632_read_all_channel(struct mlx90632_data *data, return ret; } +static int mlx90632_read_ambient_raw_extended(struct regmap *regmap, + s16 *ambient_new_raw, s16 *ambient_old_raw) +{ + unsigned int read_tmp; + int ret; + + ret = regmap_read(regmap, MLX90632_RAM_DSP5_EXTENDED_AMBIENT_1, &read_tmp); + if (ret < 0) + return ret; + *ambient_new_raw = (s16)read_tmp; + + ret = regmap_read(regmap, MLX90632_RAM_DSP5_EXTENDED_AMBIENT_2, &read_tmp); + if (ret < 0) + return ret; + *ambient_old_raw = (s16)read_tmp; + + return 0; +} + +static int mlx90632_read_object_raw_extended(struct regmap *regmap, s16 *object_new_raw) +{ + unsigned int read_tmp; + s32 read; + int ret; + + ret = regmap_read(regmap, MLX90632_RAM_DSP5_EXTENDED_OBJECT_1, &read_tmp); + if (ret < 0) + return ret; + read = (s16)read_tmp; + + ret = regmap_read(regmap, MLX90632_RAM_DSP5_EXTENDED_OBJECT_2, &read_tmp); + if (ret < 0) + return ret; + read = read - (s16)read_tmp; + + ret = regmap_read(regmap, MLX90632_RAM_DSP5_EXTENDED_OBJECT_3, &read_tmp); + if (ret < 0) + return ret; + read = read - (s16)read_tmp; + + ret = regmap_read(regmap, MLX90632_RAM_DSP5_EXTENDED_OBJECT_4, &read_tmp); + if (ret < 0) + return ret; + read = (read + (s16)read_tmp) / 2; + + ret = regmap_read(regmap, MLX90632_RAM_DSP5_EXTENDED_OBJECT_5, &read_tmp); + if (ret < 0) + return ret; + read = read + (s16)read_tmp; + + ret = regmap_read(regmap, MLX90632_RAM_DSP5_EXTENDED_OBJECT_6, &read_tmp); + if (ret < 0) + return ret; + read = read + (s16)read_tmp; + + if (read > S16_MAX || read < S16_MIN) + return -ERANGE; + + *object_new_raw = read; + + return 0; +} + +static int mlx90632_read_all_channel_extended(struct mlx90632_data *data, s16 *object_new_raw, + s16 *ambient_new_raw, s16 *ambient_old_raw) +{ + s32 ret, meas; + + mutex_lock(&data->lock); + ret = mlx90632_set_meas_type(data->regmap, MLX90632_MTYP_EXTENDED); + if (ret < 0) + goto read_unlock; + + ret = read_poll_timeout(mlx90632_perform_measurement, meas, meas == 19, + 50000, 800000, false, data); + if (ret != 0) + goto read_unlock; + + ret = mlx90632_read_object_raw_extended(data->regmap, object_new_raw); + if (ret < 0) + goto read_unlock; + + ret = mlx90632_read_ambient_raw_extended(data->regmap, ambient_new_raw, ambient_old_raw); + +read_unlock: + (void) mlx90632_set_meas_type(data->regmap, MLX90632_MTYP_MEDICAL); + + mutex_unlock(&data->lock); + return ret; +} + static int mlx90632_read_ee_register(struct regmap *regmap, u16 reg_lsb, s32 *reg_value) { @@ -355,9 +503,23 @@ static s64 mlx90632_preprocess_temp_obj(s16 object_new_raw, s16 object_old_raw, return div64_s64((tmp << 19ULL), 1000LL); } +static s64 mlx90632_preprocess_temp_obj_extended(s16 object_new_raw, s16 ambient_new_raw, + s16 ambient_old_raw, s16 Ka) +{ + s64 VR_IR, kKa, tmp; + + kKa = ((s64)Ka * 1000LL) >> 10ULL; + VR_IR = (s64)ambient_old_raw * 1000000LL + + kKa * div64_s64((s64)ambient_new_raw * 1000LL, + MLX90632_REF_3); + tmp = div64_s64( + div64_s64((s64) object_new_raw * 1000000000000LL, MLX90632_REF_12), + VR_IR); + return div64_s64(tmp << 19ULL, 1000LL); +} + static s32 mlx90632_calc_temp_ambient(s16 ambient_new_raw, s16 ambient_old_raw, - s32 P_T, s32 P_R, s32 P_G, s32 P_O, - s16 Gb) + s32 P_T, s32 P_R, s32 P_G, s32 P_O, s16 Gb) { s64 Asub, Bsub, Ablock, Bblock, Cblock, AMB, sum; @@ -429,6 +591,31 @@ static s32 mlx90632_calc_temp_object(s64 object, s64 ambient, s32 Ea, s32 Eb, return temp; } +static s32 mlx90632_calc_temp_object_extended(s64 object, s64 ambient, s64 reflected, + s32 Ea, s32 Eb, s32 Fa, s32 Fb, s32 Ga, + s16 Ha, s16 Hb, u16 tmp_emi) +{ + s64 kTA, kTA0, TAdut, TAdut4, Tr4, TaTr4; + s64 temp = 25000; + s8 i; + + kTA = (Ea * 1000LL) >> 16LL; + kTA0 = (Eb * 1000LL) >> 8LL; + TAdut = div64_s64((ambient - kTA0) * 1000000LL, kTA) + 25 * 1000000LL; + Tr4 = mlx90632_calc_ta4(reflected, 10); + TAdut4 = mlx90632_calc_ta4(TAdut, 10000LL); + TaTr4 = Tr4 - div64_s64(Tr4 - TAdut4, tmp_emi) * 1000; + + /* Iterations of calculation as described in datasheet */ + for (i = 0; i < 5; ++i) { + temp = mlx90632_calc_temp_object_iteration(temp, object, TAdut, TaTr4, + Fa / 2, Fb, Ga, Ha, Hb, + tmp_emi); + } + + return temp; +} + static int mlx90632_calc_object_dsp105(struct mlx90632_data *data, int *val) { s32 ret; @@ -476,6 +663,26 @@ static int mlx90632_calc_object_dsp105(struct mlx90632_data *data, int *val) if (ret < 0) return ret; + if (object_new_raw > MLX90632_EXTENDED_LIMIT && + data->mtyp == MLX90632_MTYP_EXTENDED) { + ret = mlx90632_read_all_channel_extended(data, &object_new_raw, + &ambient_new_raw, &ambient_old_raw); + if (ret < 0) + return ret; + + /* Use extended mode calculations */ + ambient = mlx90632_preprocess_temp_amb(ambient_new_raw, + ambient_old_raw, Gb); + object = mlx90632_preprocess_temp_obj_extended(object_new_raw, + ambient_new_raw, + ambient_old_raw, Ka); + *val = mlx90632_calc_temp_object_extended(object, ambient, + data->object_ambient_temperature, + Ea, Eb, Fa, Fb, Ga, + Ha, Hb, data->emissivity); + return 0; + } + ambient = mlx90632_preprocess_temp_amb(ambient_new_raw, ambient_old_raw, Gb); object = mlx90632_preprocess_temp_obj(object_new_raw, @@ -649,6 +856,7 @@ static int mlx90632_probe(struct i2c_client *client, i2c_set_clientdata(client, indio_dev); mlx90632->client = client; mlx90632->regmap = regmap; + mlx90632->mtyp = MLX90632_MTYP_MEDICAL; mutex_init(&mlx90632->lock); indio_dev->name = id->name; @@ -668,12 +876,17 @@ static int mlx90632_probe(struct i2c_client *client, dev_err(&client->dev, "read of version failed: %d\n", ret); return ret; } + read = read & MLX90632_ID_MASK; if (read == MLX90632_ID_MEDICAL) { dev_dbg(&client->dev, "Detected Medical EEPROM calibration %x\n", read); } else if (read == MLX90632_ID_CONSUMER) { dev_dbg(&client->dev, "Detected Consumer EEPROM calibration %x\n", read); + } else if (read == MLX90632_ID_EXTENDED) { + dev_dbg(&client->dev, + "Detected Extended range EEPROM calibration %x\n", read); + mlx90632->mtyp = MLX90632_MTYP_EXTENDED; } else if ((read & MLX90632_DSP_MASK) == MLX90632_DSP_VERSION) { dev_dbg(&client->dev, "Detected Unknown EEPROM calibration %x\n", read); @@ -685,6 +898,7 @@ static int mlx90632_probe(struct i2c_client *client, } mlx90632->emissivity = 1000; + mlx90632->object_ambient_temperature = 25000; /* 25 degrees milliCelsius */ pm_runtime_disable(&client->dev); ret = pm_runtime_set_active(&client->dev); From patchwork Tue Aug 18 21:37:37 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Crt Mori X-Patchwork-Id: 11722221 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 663BB913 for ; Tue, 18 Aug 2020 21:38:43 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 4E9ED206DA for ; Tue, 18 Aug 2020 21:38:43 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=melexis.com header.i=@melexis.com header.b="Q5dJyq9k" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726968AbgHRVim (ORCPT ); Tue, 18 Aug 2020 17:38:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34726 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726735AbgHRViT (ORCPT ); Tue, 18 Aug 2020 17:38:19 -0400 Received: from mail-wm1-x343.google.com (mail-wm1-x343.google.com [IPv6:2a00:1450:4864:20::343]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9BBDEC061347 for ; Tue, 18 Aug 2020 14:38:18 -0700 (PDT) Received: by mail-wm1-x343.google.com with SMTP id x5so269018wmi.2 for ; Tue, 18 Aug 2020 14:38:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=melexis.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=KGbYgC10yEAQ0N/WNh4ekyP+m4b8XDZy+5vjdPR5yp4=; b=Q5dJyq9kIvH/s+LzOxf3acSRtCSjwRnYzmzPenCx+Kfw1xbvH5cXWbrQwhRa7CUTxe sJQoq7jg6pEyh++m2GKDyixMuE5tk1xemCoc0XPpnFQkoRsZxOPbJxqw3XTO5flm62uB ZoTVmg2M241qfE+HfdvxFB8VyyrYJ6kLRfAzY8BSAzMK4kzaOtR9fFMTZ7mAZ3+q7Bxp JBK+NRv0dTxIs/YCfqPS0LNi6fXyYArsfBk18uPdrGqpRoYnty3caLiaV6ahfBeuPkps elGRhNfajX5YNnnhgaJxmGLXjavt7GtIPktdH13cP1l4C9sSJvdlXNFbE3VcNskm8Tni kDjg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=KGbYgC10yEAQ0N/WNh4ekyP+m4b8XDZy+5vjdPR5yp4=; b=BRV5u4VD9okF1h0TL7QYjgFB59T/DA5kDtqfOLuyVpMj1k806u0mJLZF6vjrL+Kq4R NZvcYgocL4FTWbG5/sMoLGVGqbiBjfc+CsAgTOybtOPZOGspKoZ0wYdhLXGYtt9SMmzD +UJpRnMQNNpD2OQIbUvTWATX0O+95LWxIXDauigdRauPkotBTBhtKkrr6tJYApY9zl8O OiswdBKLODDtxfKAPsXjo3lOQhxvkSkNpIseUdazsGZME/hC85lvs/RBBUEvRybSZUCP KYJeEdQzbdSHlnIb14jMMSBeXr4YmoO9utNSF59mqSmWof/FOTXdox6Ih8F186qREEVU Bcbw== X-Gm-Message-State: AOAM533bCS9paYrsuA2X6GgHsEq8rA57h0sJW7VaVjQwND7/S+8hs9qm 00IraQskPRX63q1gYQa2wn/VxQ== X-Google-Smtp-Source: ABdhPJx63POYH5gXMHacZ8NmF7VSSR4RXWfPc1Q5bl7FQgmjkhB04gL1Q2InO4pZKZTdbCjIVlBz1Q== X-Received: by 2002:a1c:dc86:: with SMTP id t128mr1841138wmg.6.1597786697216; Tue, 18 Aug 2020 14:38:17 -0700 (PDT) Received: from localhost.localdomain ([88.116.83.106]) by smtp.gmail.com with ESMTPSA id z207sm1797860wmc.2.2020.08.18.14.38.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 18 Aug 2020 14:38:16 -0700 (PDT) From: Crt Mori To: Jonathan Cameron Cc: linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org, Crt Mori , Andy Shevchenko Subject: [PATCH v6 5/5] iio:temperature:mlx90632: Some stylefixing leftovers Date: Tue, 18 Aug 2020 23:37:37 +0200 Message-Id: <20200818213737.140613-6-cmo@melexis.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200818213737.140613-1-cmo@melexis.com> References: <20200818213737.140613-1-cmo@melexis.com> MIME-Version: 1.0 Sender: linux-iio-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org There is some inconsistency and whitespace cleanup performed in this patch. It was done on top of my other patches, but I can rebase to head of the togreg branch if it would go in sooner. Signed-off-by: Crt Mori Reviewed-by: Andy Shevchenko --- drivers/iio/temperature/mlx90632.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/iio/temperature/mlx90632.c b/drivers/iio/temperature/mlx90632.c index 94bca2b2866a..472a7fb20615 100644 --- a/drivers/iio/temperature/mlx90632.c +++ b/drivers/iio/temperature/mlx90632.c @@ -112,10 +112,10 @@ #define MLX90632_DSP_VERSION 5 /* DSP version */ #define MLX90632_DSP_MASK GENMASK(7, 0) /* DSP version in EE_VERSION */ #define MLX90632_RESET_CMD 0x0006 /* Reset sensor (address or global) */ -#define MLX90632_REF_12 12LL /**< ResCtrlRef value of Ch 1 or Ch 2 */ -#define MLX90632_REF_3 12LL /**< ResCtrlRef value of Channel 3 */ -#define MLX90632_MAX_MEAS_NUM 31 /**< Maximum measurements in list */ -#define MLX90632_SLEEP_DELAY_MS 3000 /**< Autosleep delay */ +#define MLX90632_REF_12 12LL /* ResCtrlRef value of Ch 1 or Ch 2 */ +#define MLX90632_REF_3 12LL /* ResCtrlRef value of Channel 3 */ +#define MLX90632_MAX_MEAS_NUM 31 /* Maximum measurements in list */ +#define MLX90632_SLEEP_DELAY_MS 3000 /* Autosleep delay */ #define MLX90632_EXTENDED_LIMIT 27000 /* Extended mode raw value limit */ /** @@ -889,7 +889,7 @@ static int mlx90632_probe(struct i2c_client *client, mlx90632->mtyp = MLX90632_MTYP_EXTENDED; } else if ((read & MLX90632_DSP_MASK) == MLX90632_DSP_VERSION) { dev_dbg(&client->dev, - "Detected Unknown EEPROM calibration %x\n", read); + "Detected Unknown EEPROM calibration %x\n", read); } else { dev_err(&client->dev, "Wrong DSP version %x (expected %x)\n",