From patchwork Fri Oct 14 12:37:22 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cosmin Tanislav X-Patchwork-Id: 2691 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp165478wrs; Fri, 14 Oct 2022 05:52:11 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5vyVs6w22RKn5OYQfbuodfUqUcx4OWJBdtfYQcULGG6L3IeYksanR9boCIyr7QUdH1qfYp X-Received: by 2002:a17:906:da86:b0:740:7120:c6e6 with SMTP id xh6-20020a170906da8600b007407120c6e6mr3368100ejb.44.1665751931533; Fri, 14 Oct 2022 05:52:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1665751931; cv=none; d=google.com; s=arc-20160816; b=saVzcpFEKqMcSpdw9z1lQch+7x1Y1ai9TKFpnrB7kw07QaAq/8A+9QUHMo5iTCYozM Fg8b9cxPE2mX/xG8nyn5iiXLq7cvbxrefY5qhMyLlRmuGSTMHNez2c4SAqb3PIr+/Ylc eETpxKlfyNix3wPWW8aAAUm6TXNlF5TPUqwCpwQFr807PM24i9cfbJ8SQhlnR3/CmcZU OLz7AA3h9N03wwYwtIrWsWI+cIR8nGAgwpxqLHMmuuyTNvdr1BJ9yHtP0mj3GHghmGNT MHhdMk72TQa6A5nVnRJ/at7g9aWzOnz5u8aNUiQ/klkWoS7CDAA3+8KGyVJbYiiDmM+O Wtsg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:to:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:from :dkim-signature; bh=P7mYLPEPKWu9N8919p7W8oTtu1bgP16uSXO3O83LxDg=; b=jzWoqR9BUGQV1MKKnsV7SHX3AVUlUgPlzsYcYrZfym6mQGhaxjuFq4VgyjyGnqwJX0 3WXwzoPW0z/Ne60WOxWLJVgXurntVTBlfh5Oj1Eo8evCVY932SzrWneLc5xxTqGu+bgL zgUs390QugDTlOdUF0NyBEVzTApn9Foa5tAvGWnL2Ks3Hz8XTOFlnvkTI9Ztf33myisT qPVG1nvK02c9jdniBmVc/Un0CSpYSpu28VA8zUn1GfQ3C8eh3xqBrzOK89nFczMmRE9+ 0G5qpnW5Q992qZ9axVaH3xJ7G52QB2E+K+QYG8yQ8ouePxD14if9rE6XqvWTZ5yi2aUg Mt8w== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20210112 header.b="T/OcKc4i"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id jg30-20020a170907971e00b0073c0169863dsi2383144ejc.465.2022.10.14.05.51.43; Fri, 14 Oct 2022 05:52:11 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=fail header.i=@gmail.com header.s=20210112 header.b="T/OcKc4i"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229852AbiJNMiI (ORCPT + 99 others); Fri, 14 Oct 2022 08:38:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56030 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229567AbiJNMiF (ORCPT ); Fri, 14 Oct 2022 08:38:05 -0400 Received: from mail-ej1-x62a.google.com (mail-ej1-x62a.google.com [IPv6:2a00:1450:4864:20::62a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EFD64181CBB; Fri, 14 Oct 2022 05:38:04 -0700 (PDT) Received: by mail-ej1-x62a.google.com with SMTP id bj12so10129373ejb.13; Fri, 14 Oct 2022 05:38:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=P7mYLPEPKWu9N8919p7W8oTtu1bgP16uSXO3O83LxDg=; b=T/OcKc4ihARIGSuKyeS9MHQ/l6zc2O88xzLIjNnid1vjQCK+mOicR6ObKIJRPHJ4Ns Qz4upE+/NBcHtjZ3ZC+LLw7cM5jYgK2gx3Efff3GwGWgtgZ/Q8IWbVz3ROeqTss3hXLT fXm+M6r8H79P2XXeNo6xosnN0hJS89/IQT9ULWiYfakQKLtDcXbxFQQ1KQueulDduW1D fqam+IRW0qHaapRDGUbWwrPEkLSS3J5EWF3U7t/i8NQRBCinL/UuzOqDXnB58WSsW0F1 n+JgQRpbw+GWPuCRW1JCtSV6u5M3ejut5/LTK5CKgK0XKoyuD1p6JWp1/A0j+Cond6BF Y5yA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=P7mYLPEPKWu9N8919p7W8oTtu1bgP16uSXO3O83LxDg=; b=0m5jaDzN7aGhJrqKmZUEBa0MgzXlxfpfKnc6oWQxJsKD+fQxgrcyEmErFD34K5weKp +IsW3adfSm990W/n6Vr/tA2t4MUC0NC8SE00OVhI9pPmXI7TAAUD37OXyFaoMAUX1nZl oBeojCrDI0wKPZIT9dKkNgL6ek7Oy3Fg8lZClveYREtMRYAbYSK+2bUoDOQihV9dCxib ENNw380zCR9fIGQd3TJPBuvLS4zSImXIVaEr+krHy+0yY8YEdp85st5wJQpvAQ6aU7HM 50VLDdhG87HRxHYc/KRm6mf3yhVziiVeeXiTPn2ONtcm0SMp6BYqVCRs1N1nz2HridEc 2SVg== X-Gm-Message-State: ACrzQf2UCPH2puCrvsgUhHibeDEa9TruLsxKhjR9LhhWXL7bm67thSLj 4Vm3rpQqclG1XO54O0hdIok= X-Received: by 2002:a17:907:75dc:b0:783:9c71:5e20 with SMTP id jl28-20020a17090775dc00b007839c715e20mr3402589ejc.125.1665751083450; Fri, 14 Oct 2022 05:38:03 -0700 (PDT) Received: from localhost.localdomain ([5.2.194.157]) by smtp.gmail.com with ESMTPSA id dk24-20020a0564021d9800b0045b910b0542sm1774756edb.15.2022.10.14.05.38.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 14 Oct 2022 05:38:03 -0700 (PDT) From: Cosmin Tanislav Cc: =?utf-8?q?Nuno_S=C3=A1?= , Lars-Peter Clausen , Michael Hennerich , Jonathan Cameron , Rob Herring , Krzysztof Kozlowski , linux-iio@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Cosmin Tanislav Subject: [PATCH 1/3] iio: temperature: ltc2983: allocate iio channels once Date: Fri, 14 Oct 2022 15:37:22 +0300 Message-Id: <20221014123724.1401011-2-demonsingur@gmail.com> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20221014123724.1401011-1-demonsingur@gmail.com> References: <20221014123724.1401011-1-demonsingur@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net To: unlisted-recipients:; (no To-header on input) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1746667497708940063?= X-GMAIL-MSGID: =?utf-8?q?1746667497708940063?= From: Cosmin Tanislav Currently, every time the device wakes up from sleep, the iio_chan array is reallocated, leaking the previous one until the device is removed (basically never). Move the allocation to the probe function to avoid this. Signed-off-by: Cosmin Tanislav --- drivers/iio/temperature/ltc2983.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/drivers/iio/temperature/ltc2983.c b/drivers/iio/temperature/ltc2983.c index b652d2b39bcf..a60ccf183687 100644 --- a/drivers/iio/temperature/ltc2983.c +++ b/drivers/iio/temperature/ltc2983.c @@ -1385,13 +1385,6 @@ static int ltc2983_setup(struct ltc2983_data *st, bool assign_iio) return ret; } - st->iio_chan = devm_kzalloc(&st->spi->dev, - st->iio_channels * sizeof(*st->iio_chan), - GFP_KERNEL); - - if (!st->iio_chan) - return -ENOMEM; - ret = regmap_update_bits(st->regmap, LTC2983_GLOBAL_CONFIG_REG, LTC2983_NOTCH_FREQ_MASK, LTC2983_NOTCH_FREQ(st->filter_notch_freq)); @@ -1514,6 +1507,12 @@ static int ltc2983_probe(struct spi_device *spi) gpiod_set_value_cansleep(gpio, 0); } + st->iio_chan = devm_kzalloc(&spi->dev, + st->iio_channels * sizeof(*st->iio_chan), + GFP_KERNEL); + if (!st->iio_chan) + return -ENOMEM; + ret = ltc2983_setup(st, true); if (ret) return ret; From patchwork Fri Oct 14 12:37:23 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Cosmin Tanislav X-Patchwork-Id: 2692 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp165831wrs; Fri, 14 Oct 2022 05:53:22 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6QzlOc6d8AXXvD2LVGK7btNamBZ6utqw+tJt1mZ1j78W10y/bziJpltfh0nTvvx58LK34e X-Received: by 2002:a17:906:ee8e:b0:730:4a24:f311 with SMTP id wt14-20020a170906ee8e00b007304a24f311mr3561840ejb.420.1665752002389; Fri, 14 Oct 2022 05:53:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1665752002; cv=none; d=google.com; s=arc-20160816; b=dalXbeo6eFoKo7fgvIQxb0yX+X7oYStfObbtzdFUYrLFh7FYrvyEm2IQX3T1IOcPaO QaPUnbNB2Hi+ia1SCDTun63FVONkgWX+6xkAHR6Li9CdDKP4d46vxhfXPQroilKvB9Xk mnLde2OKXC2iE4umRwNeWIk+aQFBMf4AaQoBtHW0ipR2u/Imb1FifpCEb9INCyRqrcLk 34EQyXL9iHnBBvxh3hizXI4soaE3fJ4/bIZhaFw3SEE344n2ztQ25QF20qS5ttiFlwIO ZBgziMKJhR0+Mc5RJoyo2VAxL+JAPwo8ipAB/hEw7dnBL4Dde96xU9Vy/8+sEy2UdCkf iprg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:to:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:from :dkim-signature; bh=oOue6b/tBUVpJACBkl/SKLRZywbGEtbM4CPUrofCxvQ=; b=HFqCyTE5gQ9ipzQKJ1afV4pY/2DHCAPeH9qP48IIr9fngPZktuxQfRa1saSg7Ghci2 9zvGH/R83LHVRc+1L4wRY7dqzMM150s4gr76Rvm6lFHEZwCf5MD2ijPvUJFNkAVFltvv idc8x4+nMsx/An3plPacWSbcR6dZ3kaHZHYe6BEbYBe2k2irIjGDIPvIaXnIDtkAH/Cw gyEQbFISWmJWXXudCTRJx0uyn8v9GgasjzhvHenMnnyqFlJ9gvoQkudPcLHCUCuexnBl hZ+1adPv93suk/S2+BzzqPJ1/e/FXr1uXlePJs7N1VbAP3aNN8S81VXlVkfVVQMjNBLZ ABsw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20210112 header.b=NoK7UUub; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i21-20020a170906251500b00780ada0f8easi1650765ejb.865.2022.10.14.05.52.54; Fri, 14 Oct 2022 05:53:22 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=fail header.i=@gmail.com header.s=20210112 header.b=NoK7UUub; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229947AbiJNMiM (ORCPT + 99 others); Fri, 14 Oct 2022 08:38:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56084 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229887AbiJNMiJ (ORCPT ); Fri, 14 Oct 2022 08:38:09 -0400 Received: from mail-ed1-x52b.google.com (mail-ed1-x52b.google.com [IPv6:2a00:1450:4864:20::52b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4FE1C181D85; Fri, 14 Oct 2022 05:38:08 -0700 (PDT) Received: by mail-ed1-x52b.google.com with SMTP id q19so6637536edd.10; Fri, 14 Oct 2022 05:38:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=oOue6b/tBUVpJACBkl/SKLRZywbGEtbM4CPUrofCxvQ=; b=NoK7UUubQgssBL2LUy2GZI6v9wzTst4ZIY7T0pV/j7Pk+uRCxiJrHGc2+0yuMGq12w 9VUdmUO9ETXR1y550pklE5XcElyuDrNL/4jCJwoGCM4bav8qqiCGGeIK012pFGMwzgvd tfZgoRZTSLTBn6pcWqGxxutpOa4KE3nxp3U6WJFjlxc6rtXEB8+UyDLD0Isi/iKbUtUa 6NLjtNBlqKxn3qBJy58ew20OhfEjESSF/Wbld2FCQHj0KvsOS0migoHzcDcBMfTpeeEr ypMKPGxFVuWFPZXOtt+oQnUdHqWjOeNlcYMxm3xcwfQF2j92AF3zKMMR8yCSTeOvHlYe FNJw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=oOue6b/tBUVpJACBkl/SKLRZywbGEtbM4CPUrofCxvQ=; b=6zAUddIfiuDAxSgQLUBZfEeX9y7lAIYbP5uEzck85czeb1Y29yoXdQBo/YmyYusGAF /5ikf/8GdNdG9su7xvxOwprp7Shll76u7XYjd/earCopwoDxMDgsrPA4H8X9lG5fXje6 RzmzVa9bai9OAKu/4H1U5jE8l+ilUiPiN5l1kfGVWaszBvs00PhVK/w61SpiBB+dRbFf ixogDLbT4C4sR0BnupwSX0kZav+j7bJSlOusVtK/U3XTFI3bI8l8zr2GhLYg2TxTL68F VPG7I4bxT1fKQ/t2ThXVFIl4uaRuG54RvdRmKEGf5v6x3cStMtzI9Fx6pZqzpOdzaE+m VtTw== X-Gm-Message-State: ACrzQf0/k6GU8Kr922cII9sS9fbboho8KOT4sTToex+i7JDhDse4H+hA ARrIUWx2ZMFLvCdbNh9j2ec= X-Received: by 2002:a05:6402:27c8:b0:458:ecf7:7248 with SMTP id c8-20020a05640227c800b00458ecf77248mr4215937ede.67.1665751086788; Fri, 14 Oct 2022 05:38:06 -0700 (PDT) Received: from localhost.localdomain ([5.2.194.157]) by smtp.gmail.com with ESMTPSA id dk24-20020a0564021d9800b0045b910b0542sm1774756edb.15.2022.10.14.05.38.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 14 Oct 2022 05:38:06 -0700 (PDT) From: Cosmin Tanislav Cc: =?utf-8?q?Nuno_S=C3=A1?= , Lars-Peter Clausen , Michael Hennerich , Jonathan Cameron , Rob Herring , Krzysztof Kozlowski , linux-iio@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Cosmin Tanislav Subject: [PATCH 2/3] dt-bindings: iio: temperature: ltc2983: support more parts Date: Fri, 14 Oct 2022 15:37:23 +0300 Message-Id: <20221014123724.1401011-3-demonsingur@gmail.com> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20221014123724.1401011-1-demonsingur@gmail.com> References: <20221014123724.1401011-1-demonsingur@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net To: unlisted-recipients:; (no To-header on input) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1746667571762227595?= X-GMAIL-MSGID: =?utf-8?q?1746667571762227595?= From: Cosmin Tanislav Add support for the following parts: * LTC2984 * LTC2986 * LTM2985 The LTC2984 is a variant of the LTC2983 with EEPROM. The LTC2986 is a variant of the LTC2983 with only 10 channels, EEPROM and support for active analog temperature sensors. The LTM2985 is software-compatible with the LTC2986. Signed-off-by: Cosmin Tanislav --- .../bindings/iio/temperature/adi,ltc2983.yaml | 63 +++++++++++++++++-- 1 file changed, 59 insertions(+), 4 deletions(-) diff --git a/Documentation/devicetree/bindings/iio/temperature/adi,ltc2983.yaml b/Documentation/devicetree/bindings/iio/temperature/adi,ltc2983.yaml index 722781aa4697..c33ab524fb64 100644 --- a/Documentation/devicetree/bindings/iio/temperature/adi,ltc2983.yaml +++ b/Documentation/devicetree/bindings/iio/temperature/adi,ltc2983.yaml @@ -4,19 +4,27 @@ $id: http://devicetree.org/schemas/iio/temperature/adi,ltc2983.yaml# $schema: http://devicetree.org/meta-schemas/core.yaml# -title: Analog Devices LTC2983 Multi-sensor Temperature system +title: Analog Devices LTC2983, LTC2986, LTM2985 Multi-sensor Temperature system maintainers: - Nuno Sá description: | - Analog Devices LTC2983 Multi-Sensor Digital Temperature Measurement System + Analog Devices LTC2983, LTC2984, LTC2986, LTM2985 Multi-Sensor Digital + Temperature Measurement Systems + https://www.analog.com/media/en/technical-documentation/data-sheets/2983fc.pdf + https://www.analog.com/media/en/technical-documentation/data-sheets/2984fb.pdf + https://www.analog.com/media/en/technical-documentation/data-sheets/29861fa.pdf + https://www.analog.com/media/en/technical-documentation/data-sheets/ltm2985.pdf properties: compatible: enum: - adi,ltc2983 + - adi,ltc2984 + - adi,ltc2986 + - adi,ltm2985 reg: maxItems: 1 @@ -26,7 +34,7 @@ properties: adi,mux-delay-config-us: description: - The LTC2983 performs 2 or 3 internal conversion cycles per temperature + The device performs 2 or 3 internal conversion cycles per temperature result. Each conversion cycle is performed with different excitation and input multiplexer configurations. Prior to each conversion, these excitation circuits and input switch configurations are changed and an @@ -145,7 +153,7 @@ patternProperties: adi,three-conversion-cycles: description: Boolean property which set's three conversion cycles removing - parasitic resistance effects between the LTC2983 and the diode. + parasitic resistance effects between the device and the diode. type: boolean adi,average-on: @@ -353,6 +361,41 @@ patternProperties: description: Boolean property which set's the adc as single-ended. type: boolean + "^temp@": + type: object + description: + Represents a channel which is being used as an active analog temperature + sensor. + + properties: + adi,sensor-type: + description: + Identifies the sensor as an active analog temperature sensor. + $ref: /schemas/types.yaml#/definitions/uint32 + const: 31 + + adi,single-ended: + description: Boolean property which sets the sensor as single-ended. + type: boolean + + adi,custom-temp: + description: + This is a table, where each entry should be a pair of + voltage(mv)-temperature(K). The entries must be given in nv and uK + so that, the original values must be multiplied by 1000000. For + more details look at table 71 and 72. + Note should be signed, but dtc doesn't currently maintain the + sign. + $ref: /schemas/types.yaml#/definitions/uint64-matrix + minItems: 3 + maxItems: 64 + items: + minItems: 2 + maxItems: 2 + + required: + - adi,custom-temp + "^rsense@": type: object description: @@ -382,6 +425,18 @@ required: - reg - interrupts +allOf: + - if: + properties: + compatible: + contains: + enum: + - adi,ltc2983 + - adi,ltc2984 + then: + patternProperties: + "^temp@": false + additionalProperties: false examples: From patchwork Fri Oct 14 12:37:24 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cosmin Tanislav X-Patchwork-Id: 2693 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4ac7:0:0:0:0:0 with SMTP id y7csp166759wrs; Fri, 14 Oct 2022 05:56:02 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7AQ3kcJ/gG7pHTfDmfVmyrj2SR0k/HqAr0boBAfvx0SQ74RVlIq746T+tzQSYtu8s7ONA5 X-Received: by 2002:a05:6402:400f:b0:45c:a52d:8f04 with SMTP id d15-20020a056402400f00b0045ca52d8f04mr4142265eda.39.1665752162260; Fri, 14 Oct 2022 05:56:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1665752162; cv=none; d=google.com; s=arc-20160816; b=kDMqnChndRMF/NMFmcNkCWlIzTOPNDSznr/uABI8xPm6l0NOMEzCuBWc/H3XkLYfH7 aUgw6K0db9+Hqpg+o6RyfZvjHKsWeeswLX1YX/f6OdLZKQ6v+PZZPlhsMlE2OdrRFWCr 8yTPHOAc7YlwD5GVKi2Nt12+eDMf7Qv5Dj21xIUEk5XHbVe47EYoPoU0IP5wzgM3S2a/ HqdTjX7NshvlCbDysmpsBWf7SBrCZrDhBNL42McP0Mbm2TBed3c9AnuUXDhvmjFGK5fr 32oo31yvSzypzdxYPjpyWePsJ3InTLgFJkgj3fHPsyVttlrBsm7NCmb48gfKkB+XECFQ fE9g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:to:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:from :dkim-signature; bh=5DbSTqMtmil4bDo/7Sw0Chebj9TIzPLTvQ9p9KgLL5Y=; b=0BsxKHL6MqzlD31+K3rkzTPHwUQmkkON/iTBdNO5copQlW1je12GfadGiA18hQfdM1 j4UyYhENCBtoxkKvEJX4IgdrjNIQWnDPmi2XeSEnzMLZWfnjQBUzIv9tc2//FzlTjPtO p/XfVRSAn7hFYh2xpOWs+iisomoh49u2LGeMd8XIn8sAPy3Akh9TFUGJELZ3w8y95zhm mR5OvQ9dUZc4ZGUy8ODiz7cgACOCvhYiWmIyQidZltpVxpf9tiZv9e26j1/nYk7so7hC eKAxBY4tyES4wamj64LSzDj8K0FVtMej+h4iS3RfuM5mmeJzwMKeoTnS898XhRx60vmh qLKQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20210112 header.b=T0VZsdUu; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id gn28-20020a1709070d1c00b00732fa13e848si2644669ejc.597.2022.10.14.05.55.37; Fri, 14 Oct 2022 05:56:02 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=fail header.i=@gmail.com header.s=20210112 header.b=T0VZsdUu; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230013AbiJNMiS (ORCPT + 99 others); Fri, 14 Oct 2022 08:38:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56156 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229940AbiJNMiM (ORCPT ); Fri, 14 Oct 2022 08:38:12 -0400 Received: from mail-ej1-x62e.google.com (mail-ej1-x62e.google.com [IPv6:2a00:1450:4864:20::62e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 72694181D85; Fri, 14 Oct 2022 05:38:10 -0700 (PDT) Received: by mail-ej1-x62e.google.com with SMTP id sc25so10141428ejc.12; Fri, 14 Oct 2022 05:38:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=5DbSTqMtmil4bDo/7Sw0Chebj9TIzPLTvQ9p9KgLL5Y=; b=T0VZsdUuPTSLZ0K7P1QzKvHL6TAjTRhahbUJdFGS1sn15HDxubQShC+Uf/9f/qciTN S/0OdVW/050dRCMNeCo0QpcZi1bgl8pVnmkIHwGZph1FEDXO/58+i6bQhCLu24rEVmkO gAN4RoDNiZUhdIOR3DHNTbZ3QM8JCsdyU5itY9MwHco1na4f7DZoTynGHY5KaZ4Y7nav 8LeQZQ6dCZefZRulX08qDgF1UBytYqxCEVXBpdC70uPJ1DGvxL7EZknGbvF2H7c66p+O ZZ9WED3QHAW9Azln4m8IGFDvIAQ91G7oLfR/bBN/TdeWV9OdV3/1p9YtxRVFlu3u//dU wOfg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=5DbSTqMtmil4bDo/7Sw0Chebj9TIzPLTvQ9p9KgLL5Y=; b=I7zrwhRH0w6bHS8BX1RPYa0PjY0jxZS+fx+NX/1lGnozG2fonsQN8laBLirF6OTKow Yt+P43HUFYU3XJon+jZ4aXTj60AuHKBk+aLC+p8UVP8ZIFs9t8OxULaKdivYcVQc1McF sEReKI6X1/co4AhyV2VW73qaVoMNZxWoeW3JayrSO4XMjAG764v3M1UoveS4FUXC/Q25 OB3R2WZUTg7UWYkyFf+aJPyiEwEohE1mWlLOCuRXE5oPt4YR8fENbW6uFsAN0nA+39Ae P/xQn6bIHdWy7o+foGPhK59yDY4qHCABcIDXZqX83si450uWHG+Q02hiPbtU5ZZn3zTe Aanw== X-Gm-Message-State: ACrzQf0WNj+Juk4PfrR17VCqWFGzXfjH2w+56OLjFW0zQKvexmR/9xkM 9lMW9I+1wav9QsbufmP/RZ8= X-Received: by 2002:a17:907:8a1c:b0:78d:ef44:7759 with SMTP id sc28-20020a1709078a1c00b0078def447759mr3469886ejc.441.1665751088914; Fri, 14 Oct 2022 05:38:08 -0700 (PDT) Received: from localhost.localdomain ([5.2.194.157]) by smtp.gmail.com with ESMTPSA id dk24-20020a0564021d9800b0045b910b0542sm1774756edb.15.2022.10.14.05.38.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 14 Oct 2022 05:38:08 -0700 (PDT) From: Cosmin Tanislav Cc: =?utf-8?q?Nuno_S=C3=A1?= , Lars-Peter Clausen , Michael Hennerich , Jonathan Cameron , Rob Herring , Krzysztof Kozlowski , linux-iio@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Cosmin Tanislav Subject: [PATCH 3/3] iio: temperature: ltc2983: support more parts Date: Fri, 14 Oct 2022 15:37:24 +0300 Message-Id: <20221014123724.1401011-4-demonsingur@gmail.com> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20221014123724.1401011-1-demonsingur@gmail.com> References: <20221014123724.1401011-1-demonsingur@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net To: unlisted-recipients:; (no To-header on input) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1746667739130764375?= X-GMAIL-MSGID: =?utf-8?q?1746667739130764375?= From: Cosmin Tanislav Add support for the following parts: * LTC2984 * LTC2986 * LTM2985 The LTC2984 is a variant of the LTC2983 with EEPROM. The LTC2986 is a variant of the LTC2983 with only 10 channels, EEPROM and support for active analog temperature sensors. The LTM2985 is software-compatible with the LTC2986. Signed-off-by: Cosmin Tanislav --- drivers/iio/temperature/ltc2983.c | 182 ++++++++++++++++++++++++++++-- 1 file changed, 175 insertions(+), 7 deletions(-) diff --git a/drivers/iio/temperature/ltc2983.c b/drivers/iio/temperature/ltc2983.c index a60ccf183687..22977bcdd2a3 100644 --- a/drivers/iio/temperature/ltc2983.c +++ b/drivers/iio/temperature/ltc2983.c @@ -25,9 +25,12 @@ #define LTC2983_STATUS_REG 0x0000 #define LTC2983_TEMP_RES_START_REG 0x0010 #define LTC2983_TEMP_RES_END_REG 0x005F +#define LTC2983_EEPROM_KEY_REG 0x00B0 +#define LTC2983_EEPROM_READ_STATUS_REG 0x00D0 #define LTC2983_GLOBAL_CONFIG_REG 0x00F0 #define LTC2983_MULT_CHANNEL_START_REG 0x00F4 #define LTC2983_MULT_CHANNEL_END_REG 0x00F7 +#define LTC2986_EEPROM_STATUS_REG 0x00F9 #define LTC2983_MUX_CONFIG_REG 0x00FF #define LTC2983_CHAN_ASSIGN_START_REG 0x0200 #define LTC2983_CHAN_ASSIGN_END_REG 0x024F @@ -35,13 +38,21 @@ #define LTC2983_CUST_SENS_TBL_END_REG 0x03CF #define LTC2983_DIFFERENTIAL_CHAN_MIN 2 -#define LTC2983_MAX_CHANNELS_NR 20 #define LTC2983_MIN_CHANNELS_NR 1 #define LTC2983_SLEEP 0x97 #define LTC2983_CUSTOM_STEINHART_SIZE 24 #define LTC2983_CUSTOM_SENSOR_ENTRY_SZ 6 #define LTC2983_CUSTOM_STEINHART_ENTRY_SZ 4 +#define LTC2983_EEPROM_KEY 0xA53C0F5A +#define LTC2983_EEPROM_WRITE_CMD 0x15 +#define LTC2983_EEPROM_READ_CMD 0x16 +#define LTC2983_EEPROM_STATUS_FAILURE_MASK GENMASK(3, 1) +#define LTC2983_EEPROM_READ_FAILURE_MASK GENMASK(7, 0) + +#define LTC2983_EEPROM_WRITE_TIME_MS 2600 +#define LTC2983_EEPROM_READ_TIME_MS 20 + #define LTC2983_CHAN_START_ADDR(chan) \ (((chan - 1) * 4) + LTC2983_CHAN_ASSIGN_START_REG) #define LTC2983_CHAN_RES_ADDR(chan) \ @@ -171,6 +182,7 @@ enum { LTC2983_SENSOR_DIODE = 28, LTC2983_SENSOR_SENSE_RESISTOR = 29, LTC2983_SENSOR_DIRECT_ADC = 30, + LTC2983_SENSOR_ACTIVE_TEMP = 31, }; #define to_thermocouple(_sensor) \ @@ -191,7 +203,17 @@ enum { #define to_adc(_sensor) \ container_of(_sensor, struct ltc2983_adc, sensor) +#define to_temp(_sensor) \ + container_of(_sensor, struct ltc2983_temp, sensor) + +struct ltc2983_chip_info { + unsigned int max_channels_nr; + bool has_temp; + bool has_eeprom; +}; + struct ltc2983_data { + const struct ltc2983_chip_info *info; struct regmap *regmap; struct spi_device *spi; struct mutex lock; @@ -271,6 +293,12 @@ struct ltc2983_adc { bool single_ended; }; +struct ltc2983_temp { + struct ltc2983_sensor sensor; + struct ltc2983_custom_sensor *custom; + bool single_ended; +}; + /* * Convert to Q format numbers. These number's are integers where * the number of integer and fractional bits are specified. The resolution @@ -606,6 +634,22 @@ static int ltc2983_adc_assign_chan(struct ltc2983_data *st, return __ltc2983_chan_assign_common(st, sensor, chan_val); } +static int ltc2983_temp_assign_chan(struct ltc2983_data *st, + const struct ltc2983_sensor *sensor) +{ + struct ltc2983_temp *temp = to_temp(sensor); + u32 chan_val; + int ret; + + chan_val = LTC2983_ADC_SINGLE_ENDED(temp->single_ended); + + ret = __ltc2983_chan_custom_sensor_assign(st, temp->custom, &chan_val); + if (ret) + return ret; + + return __ltc2983_chan_assign_common(st, sensor, chan_val); +} + static struct ltc2983_sensor * ltc2983_thermocouple_new(const struct fwnode_handle *child, struct ltc2983_data *st, const struct ltc2983_sensor *sensor) @@ -771,10 +815,10 @@ ltc2983_rtd_new(const struct fwnode_handle *child, struct ltc2983_data *st, if (rtd->sensor_config & LTC2983_RTD_4_WIRE_MASK) { /* 4-wire */ u8 min = LTC2983_DIFFERENTIAL_CHAN_MIN, - max = LTC2983_MAX_CHANNELS_NR; + max = st->info->max_channels_nr; if (rtd->sensor_config & LTC2983_RTD_ROTATION_MASK) - max = LTC2983_MAX_CHANNELS_NR - 1; + max = st->info->max_channels_nr - 1; if (((rtd->sensor_config & LTC2983_RTD_KELVIN_R_SENSE_MASK) == LTC2983_RTD_KELVIN_R_SENSE_MASK) && @@ -1143,6 +1187,38 @@ static struct ltc2983_sensor *ltc2983_adc_new(struct fwnode_handle *child, return &adc->sensor; } +static struct ltc2983_sensor *ltc2983_temp_new(struct fwnode_handle *child, + struct ltc2983_data *st, + const struct ltc2983_sensor *sensor) +{ + struct ltc2983_temp *temp; + + temp = devm_kzalloc(&st->spi->dev, sizeof(*temp), GFP_KERNEL); + if (!temp) + return ERR_PTR(-ENOMEM); + + if (fwnode_property_read_bool(child, "adi,single-ended")) + temp->single_ended = true; + + if (!temp->single_ended && + sensor->chan < LTC2983_DIFFERENTIAL_CHAN_MIN) { + dev_err(&st->spi->dev, "Invalid chan:%d for differential temp\n", + sensor->chan); + return ERR_PTR(-EINVAL); + } + + temp->custom = __ltc2983_custom_sensor_new(st, child, "adi,custom-temp", + false, 4096, true); + if (IS_ERR(temp->custom)) + return ERR_CAST(temp->custom); + + /* set common parameters */ + temp->sensor.assign_chan = ltc2983_temp_assign_chan; + temp->sensor.fault_handler = ltc2983_common_fault_handler; + + return &temp->sensor; +} + static int ltc2983_chan_read(struct ltc2983_data *st, const struct ltc2983_sensor *sensor, int *val) { @@ -1302,10 +1378,10 @@ static int ltc2983_parse_dt(struct ltc2983_data *st) /* check if we have a valid channel */ if (sensor.chan < LTC2983_MIN_CHANNELS_NR || - sensor.chan > LTC2983_MAX_CHANNELS_NR) { + sensor.chan > st->info->max_channels_nr) { ret = -EINVAL; dev_err(dev, "chan:%d must be from %u to %u\n", sensor.chan, - LTC2983_MIN_CHANNELS_NR, LTC2983_MAX_CHANNELS_NR); + LTC2983_MIN_CHANNELS_NR, st->info->max_channels_nr); goto put_child; } else if (channel_avail_mask & BIT(sensor.chan)) { ret = -EINVAL; @@ -1345,6 +1421,9 @@ static int ltc2983_parse_dt(struct ltc2983_data *st) st->iio_channels--; } else if (sensor.type == LTC2983_SENSOR_DIRECT_ADC) { st->sensors[chan] = ltc2983_adc_new(child, st, &sensor); + } else if (st->info->has_temp && + sensor.type == LTC2983_SENSOR_ACTIVE_TEMP) { + st->sensors[chan] = ltc2983_temp_new(child, st, &sensor); } else { dev_err(dev, "Unknown sensor type %d\n", sensor.type); ret = -EINVAL; @@ -1371,6 +1450,46 @@ static int ltc2983_parse_dt(struct ltc2983_data *st) return ret; } +static int ltc2983_eeprom_cmd(struct ltc2983_data *st, unsigned int cmd, + unsigned int wait_time, unsigned int status_reg, + unsigned long status_fail_mask) +{ + __be32 bval = cpu_to_be32(LTC2983_EEPROM_KEY); + unsigned long time; + unsigned int val; + int ret; + + ret = regmap_bulk_write(st->regmap, LTC2983_EEPROM_KEY_REG, &bval, + sizeof(bval)); + if (ret) + return ret; + + reinit_completion(&st->completion); + + ret = regmap_write(st->regmap, LTC2983_STATUS_REG, + LTC2983_STATUS_START(true) | cmd); + if (ret) + return ret; + + time = wait_for_completion_timeout(&st->completion, + msecs_to_jiffies(wait_time)); + if (!time) { + dev_err(&st->spi->dev, "EEPROM command timed out\n"); + return -ETIMEDOUT; + } + + ret = regmap_read(st->regmap, status_reg, &val); + if (ret) + return ret; + + if (val & status_fail_mask) { + dev_err(&st->spi->dev, "EEPROM command failed: 0x%02X\n", val); + return -EINVAL; + } + + return 0; +} + static int ltc2983_setup(struct ltc2983_data *st, bool assign_iio) { u32 iio_chan_t = 0, iio_chan_v = 0, chan, iio_idx = 0, status; @@ -1396,6 +1515,15 @@ static int ltc2983_setup(struct ltc2983_data *st, bool assign_iio) if (ret) return ret; + if (st->info->has_eeprom && !assign_iio) { + ret = ltc2983_eeprom_cmd(st, LTC2983_EEPROM_READ_CMD, + LTC2983_EEPROM_READ_TIME_MS, + LTC2983_EEPROM_READ_STATUS_REG, + LTC2983_EEPROM_READ_FAILURE_MASK); + if (!ret) + return 0; + } + for (chan = 0; chan < st->num_channels; chan++) { u32 chan_type = 0, *iio_chan; @@ -1435,9 +1563,13 @@ static int ltc2983_setup(struct ltc2983_data *st, bool assign_iio) static const struct regmap_range ltc2983_reg_ranges[] = { regmap_reg_range(LTC2983_STATUS_REG, LTC2983_STATUS_REG), regmap_reg_range(LTC2983_TEMP_RES_START_REG, LTC2983_TEMP_RES_END_REG), + regmap_reg_range(LTC2983_EEPROM_KEY_REG, LTC2983_EEPROM_KEY_REG), + regmap_reg_range(LTC2983_EEPROM_READ_STATUS_REG, + LTC2983_EEPROM_READ_STATUS_REG), regmap_reg_range(LTC2983_GLOBAL_CONFIG_REG, LTC2983_GLOBAL_CONFIG_REG), regmap_reg_range(LTC2983_MULT_CHANNEL_START_REG, LTC2983_MULT_CHANNEL_END_REG), + regmap_reg_range(LTC2986_EEPROM_STATUS_REG, LTC2986_EEPROM_STATUS_REG), regmap_reg_range(LTC2983_MUX_CONFIG_REG, LTC2983_MUX_CONFIG_REG), regmap_reg_range(LTC2983_CHAN_ASSIGN_START_REG, LTC2983_CHAN_ASSIGN_END_REG), @@ -1482,6 +1614,12 @@ static int ltc2983_probe(struct spi_device *spi) st = iio_priv(indio_dev); + st->info = device_get_match_data(&spi->dev); + if (!st->info) + st->info = (void *)spi_get_device_id(spi)->driver_data; + if (!st->info) + return -ENODEV; + st->regmap = devm_regmap_init_spi(spi, <c2983_regmap_config); if (IS_ERR(st->regmap)) { dev_err(&spi->dev, "Failed to initialize regmap\n"); @@ -1524,6 +1662,15 @@ static int ltc2983_probe(struct spi_device *spi) return ret; } + if (st->info->has_eeprom) { + ret = ltc2983_eeprom_cmd(st, LTC2983_EEPROM_WRITE_CMD, + LTC2983_EEPROM_WRITE_TIME_MS, + LTC2986_EEPROM_STATUS_REG, + LTC2983_EEPROM_STATUS_FAILURE_MASK); + if (ret) + return ret; + } + indio_dev->name = name; indio_dev->num_channels = st->iio_channels; indio_dev->channels = st->iio_chan; @@ -1554,14 +1701,35 @@ static int ltc2983_suspend(struct device *dev) static DEFINE_SIMPLE_DEV_PM_OPS(ltc2983_pm_ops, ltc2983_suspend, ltc2983_resume); +static const struct ltc2983_chip_info ltc2983_chip_info_data = { + .max_channels_nr = 20, +}; + +static const struct ltc2983_chip_info ltc2984_chip_info_data = { + .max_channels_nr = 20, + .has_eeprom = true, +}; + +static const struct ltc2983_chip_info ltc2986_chip_info_data = { + .max_channels_nr = 10, + .has_temp = true, + .has_eeprom = true, +}; + static const struct spi_device_id ltc2983_id_table[] = { - { "ltc2983" }, + { "ltc2983", (kernel_ulong_t)<c2983_chip_info_data }, + { "ltc2984", (kernel_ulong_t)<c2984_chip_info_data }, + { "ltc2986", (kernel_ulong_t)<c2986_chip_info_data }, + { "ltm2985", (kernel_ulong_t)<c2986_chip_info_data }, {}, }; MODULE_DEVICE_TABLE(spi, ltc2983_id_table); static const struct of_device_id ltc2983_of_match[] = { - { .compatible = "adi,ltc2983" }, + { .compatible = "adi,ltc2983", .data = <c2983_chip_info_data }, + { .compatible = "adi,ltc2984", .data = <c2984_chip_info_data }, + { .compatible = "adi,ltc2986", .data = <c2986_chip_info_data }, + { .compatible = "adi,ltm2985", .data = <c2986_chip_info_data }, {}, }; MODULE_DEVICE_TABLE(of, ltc2983_of_match);