From patchwork Sat Apr 21 06:47:30 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matt Ranostay X-Patchwork-Id: 10353967 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 6D3AD6019C for ; Sat, 21 Apr 2018 06:47:28 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 52C45288F4 for ; Sat, 21 Apr 2018 06:47:28 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 47183288FD; Sat, 21 Apr 2018 06:47:28 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AD07C288F4 for ; Sat, 21 Apr 2018 06:47:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751364AbeDUGr0 (ORCPT ); Sat, 21 Apr 2018 02:47:26 -0400 Received: from mail-pl0-f67.google.com ([209.85.160.67]:39314 "EHLO mail-pl0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751223AbeDUGr0 (ORCPT ); Sat, 21 Apr 2018 02:47:26 -0400 Received: by mail-pl0-f67.google.com with SMTP id e7-v6so6416169plt.6 for ; Fri, 20 Apr 2018 23:47:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=konsulko.com; s=google; h=from:to:cc:subject:date:message-id; bh=09i5A97VS8mNVCeWK9pchgiybJrUxJELtTMxlxDRkTc=; b=I/n/JqxKw8a8JKkHYFKMrmuDz1c95DPRGfEaOnvSbfh56ZGlyZ3V/s6nyxoo8Gt4Mf LM0pN6uRyJ9JuuCNfJQVRCedXdRPgeK10CYlh6ofTiQHD2QUBrMbyyNQO0FR8gQyredJ rfs5z7HvlzmtlPt4r5eRYCgrR1BDfcd+WQN5M= 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; bh=09i5A97VS8mNVCeWK9pchgiybJrUxJELtTMxlxDRkTc=; b=ksU+igwegJutlQ5C9fbqu5hEHN6BCh7Tr6GwJfoV9u1AYRsjMh4qM7PqUhE1VKp8b5 xHt83SU1M+enMyQhQSmUjl/ZlkKIfmic2/nB74kvSyDb1of0R6QNEWk7ymyl9dVhUd6w VJKz2SD2ABjpuVPUvpFbLIl+Kf9EMfKdWfjyLFDXQipIPpPiExDkQ/FbJ490TKgjzjEN JJ3UqJhhkw4ybLEuPl3K3FFIgdAumHmjPs2TtQs1ik3R3jUSqeo9ErRFq+Aj5IOBe/8R CNiS74hDrW9M7vuoRTF4iMAAuSFY0hHcb3le9rvuvqIaz+lRjCv5qPY9df3+3D+KbMfk TNPg== X-Gm-Message-State: ALQs6tBuaiBpEPdxRbhGDg07JIlIXMB7jv+lXYYiwGI6/CVqBsvfu5Ka wuIQE7PqjD1iwv1oEUxIxkT0UMziSDw= X-Google-Smtp-Source: AIpwx48WWRFEIkBO5B3H6Ig42+rPmEJgj9NELDyPQircLSoK6Y2jbM8sqDLQ7qeOORkZ/l+lv54oCg== X-Received: by 2002:a17:902:2f:: with SMTP id 44-v6mr13064825pla.187.1524293245513; Fri, 20 Apr 2018 23:47:25 -0700 (PDT) Received: from niteshade.hsd1.or.comcast.net ([2601:1c2:5000:8d45::3f0e]) by smtp.gmail.com with ESMTPSA id n8sm13430832pfj.24.2018.04.20.23.47.24 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 20 Apr 2018 23:47:24 -0700 (PDT) From: Matt Ranostay To: jic23@kernel.org Cc: linux-iio@vger.kernel.org, Matt Ranostay Subject: [PATCH] iio: potentiostat: lmp91000: remove lookup table for temperature values Date: Fri, 20 Apr 2018 23:47:30 -0700 Message-Id: <20180421064730.11358-1-matt.ranostay@konsulko.com> X-Mailer: git-send-email 2.14.1 Sender: linux-iio-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Lookup table was highly dependent on using the LMP91000EVM which had an 16-bit TI ADC161S626 but it is mistake to assume all applications will be using that ADC part. Any processing should be done in the respective userspace application. Signed-off-by: Matt Ranostay --- drivers/iio/potentiostat/lmp91000.c | 38 ++++--------------------------------- 1 file changed, 4 insertions(+), 34 deletions(-) diff --git a/drivers/iio/potentiostat/lmp91000.c b/drivers/iio/potentiostat/lmp91000.c index 85714055cc74..e464f72b144b 100644 --- a/drivers/iio/potentiostat/lmp91000.c +++ b/drivers/iio/potentiostat/lmp91000.c @@ -41,21 +41,6 @@ static const int lmp91000_rload[] = { 10, 33, 50, 100 }; #define LMP91000_TEMP_BASE -40 -static const u16 lmp91000_temp_lut[] = { - 1875, 1867, 1860, 1852, 1844, 1836, 1828, 1821, 1813, 1805, - 1797, 1789, 1782, 1774, 1766, 1758, 1750, 1742, 1734, 1727, - 1719, 1711, 1703, 1695, 1687, 1679, 1671, 1663, 1656, 1648, - 1640, 1632, 1624, 1616, 1608, 1600, 1592, 1584, 1576, 1568, - 1560, 1552, 1544, 1536, 1528, 1520, 1512, 1504, 1496, 1488, - 1480, 1472, 1464, 1456, 1448, 1440, 1432, 1424, 1415, 1407, - 1399, 1391, 1383, 1375, 1367, 1359, 1351, 1342, 1334, 1326, - 1318, 1310, 1302, 1293, 1285, 1277, 1269, 1261, 1253, 1244, - 1236, 1228, 1220, 1212, 1203, 1195, 1187, 1179, 1170, 1162, - 1154, 1146, 1137, 1129, 1121, 1112, 1104, 1096, 1087, 1079, - 1071, 1063, 1054, 1046, 1038, 1029, 1021, 1012, 1004, 996, - 987, 979, 971, 962, 954, 945, 937, 929, 920, 912, - 903, 895, 886, 878, 870, 861 }; - static const struct regmap_config lmp91000_regmap_config = { .reg_bits = 8, .val_bits = 8, @@ -95,7 +80,7 @@ static const struct iio_chan_spec lmp91000_channels[] = { .type = IIO_TEMP, .channel = 1, .address = LMP91000_REG_MODECN_TEMP, - .info_mask_separate = BIT(IIO_CHAN_INFO_PROCESSED), + .info_mask_separate = BIT(IIO_CHAN_INFO_RAW), .scan_index = -1, }, }; @@ -157,11 +142,11 @@ static int lmp91000_read_raw(struct iio_dev *indio_dev, int *val, int *val2, long mask) { struct lmp91000_data *data = iio_priv(indio_dev); + int ret = -EINVAL; switch (mask) { case IIO_CHAN_INFO_RAW: - case IIO_CHAN_INFO_PROCESSED: { - int ret = iio_channel_start_all_cb(data->cb_buffer); + ret = iio_channel_start_all_cb(data->cb_buffer); if (ret) return ret; @@ -173,29 +158,14 @@ static int lmp91000_read_raw(struct iio_dev *indio_dev, if (ret) return ret; - if (mask == IIO_CHAN_INFO_PROCESSED) { - int tmp, i; - - ret = iio_convert_raw_to_processed(data->adc_chan, - *val, &tmp, 1); - if (ret) - return ret; - - for (i = 0; i < ARRAY_SIZE(lmp91000_temp_lut); i++) - if (lmp91000_temp_lut[i] < tmp) - break; - - *val = (LMP91000_TEMP_BASE + i) * 1000; - } return IIO_VAL_INT; - } case IIO_CHAN_INFO_OFFSET: return iio_read_channel_offset(data->adc_chan, val, val2); case IIO_CHAN_INFO_SCALE: return iio_read_channel_scale(data->adc_chan, val, val2); } - return -EINVAL; + return ret; } static const struct iio_info lmp91000_info = {