From patchwork Fri Apr 9 18:50:10 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lucas Stankus X-Patchwork-Id: 12194825 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 38E0AC43460 for ; Fri, 9 Apr 2021 18:50:18 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 177306115B for ; Fri, 9 Apr 2021 18:50:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234662AbhDISua (ORCPT ); Fri, 9 Apr 2021 14:50:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57886 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233332AbhDISu3 (ORCPT ); Fri, 9 Apr 2021 14:50:29 -0400 Received: from mail-qk1-x733.google.com (mail-qk1-x733.google.com [IPv6:2607:f8b0:4864:20::733]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8F479C061762; Fri, 9 Apr 2021 11:50:15 -0700 (PDT) Received: by mail-qk1-x733.google.com with SMTP id c3so6863333qkc.5; Fri, 09 Apr 2021 11:50:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=TxCHjocfvolgLMKcJMUAXR2MQWXiJcrJ6XGdnV3UFSQ=; b=ojboIib+LAJLAK2R8WPLMMcSqk+duxlFCwkfYsg9J1bKE8gUkzMQqCqRLq0H6K+yl3 pbhzBrbhRrg6OuSvzamOvj6kwcyqFhGPnfTfXTZOQ8/PpbL/S1gukY53VzZZUY+U0Md3 XB2U82/29krHpOWRH35hesUBKWShbwez+UJeH72RQq8HdVJHcFcP9+HJlIJpHON3K/Qw iGyLrK9p9Wk9re3dsgV3XuZPokr00Ip5i9zdmB/vnZ79OitE6rM1fS84og6tFNKwGYPl J2RF1mzWKZ3GKtfSMcQIUulzby/dxVaiYssy+l0C7k1BvA/YDXW42KV9VW4lD0v2N/Ih E1dw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=TxCHjocfvolgLMKcJMUAXR2MQWXiJcrJ6XGdnV3UFSQ=; b=nwPL/IuUp0vH6Rvxajot2FXHr+sKboPwoEQy65tdS2EmWFluSw9dpwmPX2QAng+6vG DnP7s9AKAREmZ4ptnfqIavynQ/92IXOG9SAZnxZnY8HqQ8vR2czopVWiwAYc7vSsda9E DwHbE8GnAiYf3PoMnyFX7BaUxXPthSO7dvET7+nWbUxWg0mQp+VDWa75HRyK90A+20J7 laCircWymZqjIKNQbk4al01lVGL7uMNa4y3XC6bHdcpGAaLO78SuZvZwPrmEv1fquk6i kjwVgQAK0sAXj/ZfhMhJHUd2nNeSf0QxBfW385Jxm7TGXFxp8eJXuvmpZ2ILJgTs6UiC Tnpg== X-Gm-Message-State: AOAM531llr3Wd31gv1y2ZaR6UjCq/NjL0O8CHUc9hJK3F3ABFBVKWwTR /RpMSDuZAL6XzkV40BTNuGdV0I6LZ2UI8YWh X-Google-Smtp-Source: ABdhPJwplwfUkzNEF2GL+6/qzxFO2fQsmh1/BJO08c880AYwwprUUfBzaG8l2b2S9+xiMJaqpqpNyQ== X-Received: by 2002:a37:7147:: with SMTP id m68mr14899919qkc.286.1617994214783; Fri, 09 Apr 2021 11:50:14 -0700 (PDT) Received: from smtp.gmail.com ([2804:14c:73:9a01:86f3:17eb:e23c:86fd]) by smtp.gmail.com with ESMTPSA id h62sm2347198qkf.116.2021.04.09.11.50.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 09 Apr 2021 11:50:14 -0700 (PDT) Date: Fri, 9 Apr 2021 15:50:10 -0300 From: Lucas Stankus To: lars@metafoo.de, Michael.Hennerich@analog.com, jic23@kernel.org, gregkh@linuxfoundation.org Cc: linux-iio@vger.kernel.org, linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org Subject: [PATCH 1/3] dt-bindings: staging: iio: cdc: ad7746: add binding documentation for AD7746 Message-ID: <4be8e3e40794474d8622192c6a5ea0fb4af527e1.1617993776.git.lucas.p.stankus@gmail.com> References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org Add device tree binding documentation for AD7746 cdc in YAML format. Signed-off-by: Lucas Stankus --- .../bindings/iio/cdc/adi,ad7746.yaml | 79 +++++++++++++++++++ 1 file changed, 79 insertions(+) create mode 100644 Documentation/devicetree/bindings/iio/cdc/adi,ad7746.yaml diff --git a/Documentation/devicetree/bindings/iio/cdc/adi,ad7746.yaml b/Documentation/devicetree/bindings/iio/cdc/adi,ad7746.yaml new file mode 100644 index 000000000000..5de86f4374e1 --- /dev/null +++ b/Documentation/devicetree/bindings/iio/cdc/adi,ad7746.yaml @@ -0,0 +1,79 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/iio/cdc/adi,ad7746.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: AD7746 24-Bit Capacitance-to-Digital Converter with Temperature Sensor + +maintainers: + - Michael Hennerich + +description: | + AD7746 24-Bit Capacitance-to-Digital Converter with Temperature Sensor + + Specifications about the part can be found at: + https://www.analog.com/media/en/technical-documentation/data-sheets/ad7291.pdf + +properties: + compatible: + enum: + - adi,ad7745 + - adi,ad7746 + - adi,ad7747 + + reg: + description: | + Physiscal address of the EXC set-up register. + maxItems: 1 + + adi,excitation-voltage-level: + description: | + Select the reference excitation voltage level used by the device. + With VDD being the power supply voltage, valid values are: + 0: +-VDD / 8 + 1: +-VDD / 4 + 2: +-VDD * 3 / 8 + 3: +-VDD / 2 + If left empty option 3 is selected. + $ref: /schemas/types.yaml#/definitions/uint32 + enum: [0, 1, 2, 3] + + adi,exca-output: + description: | + Sets the excitation output in the exca pin. + Valid values are: + 0: Disables output in the EXCA pin. + 1: Enables EXCA pin as the excitation output. + 2: Enables EXCA pin as the inverted excitation output. + If left empty the output is disabled. + $ref: /schemas/types.yaml#/definitions/uint32 + enum: [0, 1, 2] + + adi,excb-output: + description: | + Analoguos to the adi,exca-output for the EXCB pin. + $ref: /schemas/types.yaml#/definitions/uint32 + enum: [0, 1, 2] + +required: + - compatible + - reg + +additionalProperties: false + +examples: + - | + i2c { + #address-cells = <1>; + #size-cells = <0>; + + ad7746: cdc@0 { + compatible = "adi,ad7746"; + reg = <0>; + adi,excitation-voltage-level = <3>; + adi,exca-output = <0>; + adi,excb-output = <0>; + }; + }; +... From patchwork Fri Apr 9 18:50:27 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lucas Stankus X-Patchwork-Id: 12194827 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4706AC433B4 for ; Fri, 9 Apr 2021 18:50:35 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 16BFB61178 for ; Fri, 9 Apr 2021 18:50:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234548AbhDISur (ORCPT ); Fri, 9 Apr 2021 14:50:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57952 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234367AbhDISup (ORCPT ); Fri, 9 Apr 2021 14:50:45 -0400 Received: from mail-qk1-x72f.google.com (mail-qk1-x72f.google.com [IPv6:2607:f8b0:4864:20::72f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6B80DC061762; Fri, 9 Apr 2021 11:50:32 -0700 (PDT) Received: by mail-qk1-x72f.google.com with SMTP id q26so6855227qkm.6; Fri, 09 Apr 2021 11:50:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=V06g/V1PyEv48SI7Hy2SrXRWy5uxigOGYLsg44Gvu+0=; b=flQtyr4g7O0z7R1besBKPwzFccbfZHeZo/r1YD03lAB0h2S4w+etAKkwk9039/e5TW 9hlM1xt1pUzntNZ73KIfw9Be26WhjVs5RR8LGpM+9mdG13KXoOcMUosrLxbFs0RJYrg2 cOcpYZmb4rZAjcno68WG7NBtIOdPxKd2AckokMiKZN1kdYIgjDKXPgmzHNvaUIHSNzeO 7f30TmhSszH/z6huOOTnRgeqfSWrltgxM7e3r2D/5Vj6b23DnySSCrYyYzJbKxX6r4br oZXyq3D0l9fPUFr/iCO5yuzMuqJdyFEjeqHuSdlp+2GgTkEeaKcUjrAbC70K3sI9Hw1e xrdQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=V06g/V1PyEv48SI7Hy2SrXRWy5uxigOGYLsg44Gvu+0=; b=sT3WyB7WWJZCQajSKMIkkoMCAOk9ra6bH8bWnNqbH1anBQeuKyQWMWd8DlRS4gF5m1 q7+b09xoLak/9nzPHS+xENGNGqFbWtAQ0YpPEJ0R6NtfjnPQtLkDI3ETF1noUfTPsoey FKi6roFKBD21DiDrfk1vXWHRCQsUmM+fPhfgkOIWbSV8WbBW9tUFu9Jma5fGmTDZw6ME iDLfwGIHMOyPCDxC6sZLwRm8R/pWf2Slaemy4zBYm/i1/VFm+qka22ZCj199nOsc+Q3p SLZrBidsDOnlAphfM17/JkboO03QmDZQ7J64Vfg4d5QzpZkALuxTUMYPsrEvxxrSuEnI VvRA== X-Gm-Message-State: AOAM5334sm2kle01kcJeZGokzr/WU8UjBV2Jq7MdRh4r6TynShXyJfKK cGauRBOUVjPg5iAc181iQt0= X-Google-Smtp-Source: ABdhPJyNkvxUdZ444gfxFwAZsyO1t3IEaIvmxGRhVd2xNTTWfiYLHqfkW6o8JphngO0hLlvc6uuFKg== X-Received: by 2002:a37:5ce:: with SMTP id 197mr1236863qkf.23.1617994231748; Fri, 09 Apr 2021 11:50:31 -0700 (PDT) Received: from smtp.gmail.com ([2804:14c:73:9a01:86f3:17eb:e23c:86fd]) by smtp.gmail.com with ESMTPSA id n136sm2379730qke.123.2021.04.09.11.50.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 09 Apr 2021 11:50:31 -0700 (PDT) Date: Fri, 9 Apr 2021 15:50:27 -0300 From: Lucas Stankus To: lars@metafoo.de, Michael.Hennerich@analog.com, jic23@kernel.org, gregkh@linuxfoundation.org Cc: linux-iio@vger.kernel.org, linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org Subject: [PATCH 2/3] staging: iio: cdc: ad7746: use dt bindings to set the EXCx pins output Message-ID: <39486895e4e985d0220342f3accfd98a1e149ea7.1617993776.git.lucas.p.stankus@gmail.com> References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org Ditch platform_data fields in favor of device tree properties for configuring EXCA and EXCB output. This also removes the fields from the platform_data struct, since they're not used anymore. Signed-off-by: Lucas Stankus --- drivers/staging/iio/cdc/ad7746.c | 33 +++++++++++++++++--------------- drivers/staging/iio/cdc/ad7746.h | 4 ---- 2 files changed, 18 insertions(+), 19 deletions(-) diff --git a/drivers/staging/iio/cdc/ad7746.c b/drivers/staging/iio/cdc/ad7746.c index dfd71e99e872..63041b164dbe 100644 --- a/drivers/staging/iio/cdc/ad7746.c +++ b/drivers/staging/iio/cdc/ad7746.c @@ -677,8 +677,10 @@ static int ad7746_probe(struct i2c_client *client, const struct i2c_device_id *id) { struct ad7746_platform_data *pdata = client->dev.platform_data; + struct device_node *np = client->dev.of_node; struct ad7746_chip_info *chip; struct iio_dev *indio_dev; + unsigned int exca_en, excb_en; unsigned char regval = 0; int ret = 0; @@ -703,26 +705,27 @@ static int ad7746_probe(struct i2c_client *client, indio_dev->num_channels = ARRAY_SIZE(ad7746_channels); indio_dev->modes = INDIO_DIRECT_MODE; - if (pdata) { - if (pdata->exca_en) { - if (pdata->exca_inv_en) - regval |= AD7746_EXCSETUP_NEXCA; - else - regval |= AD7746_EXCSETUP_EXCA; - } + ret = of_property_read_u32(np, "adi,exca-output", &exca_en); + if (!ret && exca_en) { + if (exca_en == 1) + regval |= AD7746_EXCSETUP_EXCA; + else + regval |= AD7746_EXCSETUP_NEXCA; + } - if (pdata->excb_en) { - if (pdata->excb_inv_en) - regval |= AD7746_EXCSETUP_NEXCB; - else - regval |= AD7746_EXCSETUP_EXCB; - } + ret = of_property_read_u32(np, "adi,excb-output", &excb_en); + if (!ret && excb_en) { + if (excb_en == 1) + regval |= AD7746_EXCSETUP_EXCB; + else + regval |= AD7746_EXCSETUP_NEXCB; + } + if (pdata) { regval |= AD7746_EXCSETUP_EXCLVL(pdata->exclvl); } else { dev_warn(&client->dev, "No platform data? using default\n"); - regval = AD7746_EXCSETUP_EXCA | AD7746_EXCSETUP_EXCB | - AD7746_EXCSETUP_EXCLVL(3); + regval = AD7746_EXCSETUP_EXCLVL(3); } ret = i2c_smbus_write_byte_data(chip->client, diff --git a/drivers/staging/iio/cdc/ad7746.h b/drivers/staging/iio/cdc/ad7746.h index 8bdbd732dbbd..6cae4ecf779e 100644 --- a/drivers/staging/iio/cdc/ad7746.h +++ b/drivers/staging/iio/cdc/ad7746.h @@ -19,10 +19,6 @@ struct ad7746_platform_data { unsigned char exclvl; /*Excitation Voltage Level */ - bool exca_en; /* enables EXCA pin as the excitation output */ - bool exca_inv_en; /* enables /EXCA pin as the excitation output */ - bool excb_en; /* enables EXCB pin as the excitation output */ - bool excb_inv_en; /* enables /EXCB pin as the excitation output */ }; #endif /* IIO_CDC_AD7746_H_ */ From patchwork Fri Apr 9 18:50:42 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lucas Stankus X-Patchwork-Id: 12194829 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id CE7ACC43461 for ; Fri, 9 Apr 2021 18:50:50 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 987766113A for ; Fri, 9 Apr 2021 18:50:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234692AbhDISvC (ORCPT ); Fri, 9 Apr 2021 14:51:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58016 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233332AbhDISvC (ORCPT ); Fri, 9 Apr 2021 14:51:02 -0400 Received: from mail-qt1-x82a.google.com (mail-qt1-x82a.google.com [IPv6:2607:f8b0:4864:20::82a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A459EC061762; Fri, 9 Apr 2021 11:50:47 -0700 (PDT) Received: by mail-qt1-x82a.google.com with SMTP id f12so4977636qtf.2; Fri, 09 Apr 2021 11:50:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=x5UZWC8zVAh94JSKCovtgfLgGs7oIt1cZDdRs8Arpcc=; b=mz1SSsG7XNZLlQ6clNY1SSAcig7F9uj6Fk38/Fomw/Nho88ffCzoo0OAQR3FUuS7EP 5ZYEliG11XcYlQfQJ4s9rKZvb2KwZkS1HOEA+j3bzMbouTn/dILs+d7XXpKyXEai41CQ XPDKTXPj8feMcTCJgAg6kwCe30awp6TMOjn1r3c0o7qYQQjdes+FB33cldMAnOFCxHac kTuYDSrdJC+qd9pJgGURRDAdC5Fm6S3friCfhLA5UauNE7xSWoDbR6/XratCUULLzXuM YNaQ6SfWomeNgo9yBT15De1JsZKwYtgmaUVE36Ti+e9NKdCmsgEq+b2bHLyBSzpQBc6N Oj9g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=x5UZWC8zVAh94JSKCovtgfLgGs7oIt1cZDdRs8Arpcc=; b=Crgn9Nwdj9tjsyqkzVeG33doDhuWBs3Na42Lb6EA5UcR40kofgI7CHpbC14NJlUfV1 w79w35nrTVcSXUjL7+beNn3fuMjLcThrMHaJzjlqhIr341eBYXCh2Kya1tAeoD1Yr/nt P3zMoy53hfO4HmRYifE/DKWx4N/+92R9+l7VSAPaj8z4JWFJEJ+Bh7fDbJGzDJKCCbdO kBzocBHSf0HFYifr7lEgnZwRV/5l0N3EKhYCc13+4jgIflzsT/9lkLiDP53UQorggOPN Y4n64GTcHxhUvaKho1eF7vxVTmtR0nVigf3dZ+KyrnJ7tRGEcqQpMy2xmIiT9ruYHd6n dSqg== X-Gm-Message-State: AOAM532zlX4aNAg9cbH9vGtXVOvxmaxBEDXxcpbW3eE6iHbOJlg/ri3Q ZDMjrnYG83BFwT09YwBvAKY= X-Google-Smtp-Source: ABdhPJy273/ixAJu7iZq8qTlqMCsfrqWgXHmiFQOfi8j6E2Ns1onoQVgkb52060W1ljv4Gty9/KdUA== X-Received: by 2002:ac8:6c5d:: with SMTP id z29mr14302222qtu.99.1617994246940; Fri, 09 Apr 2021 11:50:46 -0700 (PDT) Received: from smtp.gmail.com ([2804:14c:73:9a01:86f3:17eb:e23c:86fd]) by smtp.gmail.com with ESMTPSA id 184sm2376583qki.97.2021.04.09.11.50.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 09 Apr 2021 11:50:46 -0700 (PDT) Date: Fri, 9 Apr 2021 15:50:42 -0300 From: Lucas Stankus To: lars@metafoo.de, Michael.Hennerich@analog.com, jic23@kernel.org, gregkh@linuxfoundation.org Cc: linux-iio@vger.kernel.org, linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org Subject: [PATCH 3/3] staging: iio: cdc: ad7746: use dt binding to set the excitation level Message-ID: <07b173e1d823dbdde40dc9ea31bb699b48043278.1617993776.git.lucas.p.stankus@gmail.com> References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org Set device excitation level using properties from device tree binding instead of using platform_data. As this replaces the last instance where the platform_data struct was used, remove ad7746.h header file since it's no longer needed. Signed-off-by: Lucas Stankus --- drivers/staging/iio/cdc/ad7746.c | 16 ++++++---------- drivers/staging/iio/cdc/ad7746.h | 24 ------------------------ 2 files changed, 6 insertions(+), 34 deletions(-) delete mode 100644 drivers/staging/iio/cdc/ad7746.h diff --git a/drivers/staging/iio/cdc/ad7746.c b/drivers/staging/iio/cdc/ad7746.c index 63041b164dbe..3c75d147c3dd 100644 --- a/drivers/staging/iio/cdc/ad7746.c +++ b/drivers/staging/iio/cdc/ad7746.c @@ -18,8 +18,6 @@ #include #include -#include "ad7746.h" - /* * AD7746 Register Definition */ @@ -676,11 +674,10 @@ static const struct iio_info ad7746_info = { static int ad7746_probe(struct i2c_client *client, const struct i2c_device_id *id) { - struct ad7746_platform_data *pdata = client->dev.platform_data; struct device_node *np = client->dev.of_node; struct ad7746_chip_info *chip; struct iio_dev *indio_dev; - unsigned int exca_en, excb_en; + unsigned int exca_en, excb_en, exclvl; unsigned char regval = 0; int ret = 0; @@ -721,12 +718,11 @@ static int ad7746_probe(struct i2c_client *client, regval |= AD7746_EXCSETUP_NEXCB; } - if (pdata) { - regval |= AD7746_EXCSETUP_EXCLVL(pdata->exclvl); - } else { - dev_warn(&client->dev, "No platform data? using default\n"); - regval = AD7746_EXCSETUP_EXCLVL(3); - } + ret = of_property_read_u32(np, "adi,excitation-voltage-level", &exclvl); + if (!ret) + regval |= AD7746_EXCSETUP_EXCLVL(exclvl); + else + regval |= AD7746_EXCSETUP_EXCLVL(3); ret = i2c_smbus_write_byte_data(chip->client, AD7746_REG_EXC_SETUP, regval); diff --git a/drivers/staging/iio/cdc/ad7746.h b/drivers/staging/iio/cdc/ad7746.h deleted file mode 100644 index 6cae4ecf779e..000000000000 --- a/drivers/staging/iio/cdc/ad7746.h +++ /dev/null @@ -1,24 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -/* - * AD7746 capacitive sensor driver supporting AD7745, AD7746 and AD7747 - * - * Copyright 2011 Analog Devices Inc. - */ - -#ifndef IIO_CDC_AD7746_H_ -#define IIO_CDC_AD7746_H_ - -/* - * TODO: struct ad7746_platform_data needs to go into include/linux/iio - */ - -#define AD7466_EXCLVL_0 0 /* +-VDD/8 */ -#define AD7466_EXCLVL_1 1 /* +-VDD/4 */ -#define AD7466_EXCLVL_2 2 /* +-VDD * 3/8 */ -#define AD7466_EXCLVL_3 3 /* +-VDD/2 */ - -struct ad7746_platform_data { - unsigned char exclvl; /*Excitation Voltage Level */ -}; - -#endif /* IIO_CDC_AD7746_H_ */