From patchwork Fri Nov 11 14:39:17 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rasmus Villemoes X-Patchwork-Id: 18863 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp783707wru; Fri, 11 Nov 2022 06:51:02 -0800 (PST) X-Google-Smtp-Source: AA0mqf5sx7HcNToT7GuEqFDPIeSYuLZKPHnBzBbHICDSAAFK9qKY/p/TxVjp64zM1D1dcueirlvR X-Received: by 2002:a17:907:962a:b0:7ae:39b4:7208 with SMTP id gb42-20020a170907962a00b007ae39b47208mr2029776ejc.766.1668178262431; Fri, 11 Nov 2022 06:51:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668178262; cv=none; d=google.com; s=arc-20160816; b=nzUz5gsqMd0vLIrlzmyYYnJL5vnAw8SZ0KFemZaVVaB8LOMsxtndSzKnWg0vGjrS6W CAFF07uuTMaG6w3EsHW9EMIEvC+c6zfN+ePIdgGMbTnjAtbPBolAgfdpZG2f3jGEEZgI OS9lk1UruuGDUCDnuJQm5oES2jmX5JxPIrXyY8N/EmWJpG5enw9kyA0Sps2O5O08nFtG jDh6xNt9I2dUJl2PqpckCQfZiUt/oqX71coY6u6aW3S0fJ3o3jQSYJaFt/1mOUNnWupQ EfZLxVXWXgcQ8QpZPdzfjAOgFnEIOSZfuTBD0QP54G1DbUqtP6p90u8dbyDKvupB8zfs EELA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=3BpIqKmaepR1SpUgklkTdQKDocBg8CsmOhHMlVS5EHA=; b=lx5Mcdyf3L4Sm968DmMkCUZV8m1h/5VYAtsixqQZV2WEpqw8gaTiSkeBClxtikPkjD pkEnSBfb61adfWKyZCC8e2JK0Zl9vl9ZNFPCFI8t6AhpdgH1aVQXR1Ey3JDy1vMrOLX9 ogSR+r6RcqDIAMuwRCySy6nUhGT9P0PSsVdGJGtLhfQD/xsFBLeCdTtETLAncPSjVhM0 SCJfIey93zC4l/IrVp/WE5EliUuwDOf0+PrGu2yDV3u+ycsSCZx0nyPO05OpZfKwBUap CtysNJgRIOKZXxh7a6fNdLZjnj5XI2kOSyOfhJ1yNwRmzW52eO5sCxtja+8krUe3ZHzX BC4Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@rasmusvillemoes.dk header.s=google header.b=DrM+gnHh; 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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id p27-20020a17090635db00b00780488c11bbsi1556035ejb.388.2022.11.11.06.50.35; Fri, 11 Nov 2022 06:51:02 -0800 (PST) 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=pass header.i=@rasmusvillemoes.dk header.s=google header.b=DrM+gnHh; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234698AbiKKOjv (ORCPT + 99 others); Fri, 11 Nov 2022 09:39:51 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48618 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234206AbiKKOjg (ORCPT ); Fri, 11 Nov 2022 09:39:36 -0500 Received: from mail-ej1-x62c.google.com (mail-ej1-x62c.google.com [IPv6:2a00:1450:4864:20::62c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2A7E060372 for ; Fri, 11 Nov 2022 06:39:27 -0800 (PST) Received: by mail-ej1-x62c.google.com with SMTP id kt23so12993251ejc.7 for ; Fri, 11 Nov 2022 06:39:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rasmusvillemoes.dk; s=google; 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=3BpIqKmaepR1SpUgklkTdQKDocBg8CsmOhHMlVS5EHA=; b=DrM+gnHh97vdiwSHvs4Vlne0TO7c7w6abdslmDlScfvk00Y2RXCkV1/198Pr+SVcbm n84m7ML0SQY10/bU7IEnnEcKIHqkZ20R7/yCuFd2+jYTc3uRCe18o/7sh7Ix2V05Gdge f0lgC7FK/NGYosoVXQ1uY9SHIUGtr4TPm7JrI= 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=3BpIqKmaepR1SpUgklkTdQKDocBg8CsmOhHMlVS5EHA=; b=SZ7b+yz4MhkPUMybVeSZD2qjZ4LCs13/FtsQoZ2ZbmJP5Pn5A8Uc57+K1GqVTksNVN GbpjD8pFy4Mocv46P7py6fxgJPmvM/5t/m/CrmhHBEfodb7S24erW5QFepjAcoP6bUsr rFT/XFFUKpiCKAHqNHJkmyz/U4vK0UDyjsiTQmDuqUwFta42SmH0/k/CLbxsOXt/zKjf UF/5/TlvfQtKSV5TiPjewrmlP0hWQ5f1XdExSzfCPsqPEK4GzH++avMST0cxa/lVvY6g I3oSDVJGuUGWa/STtNIpAeQK+CICnzuS/xkli/ppsyb1b2gPjU5TNExOl9y/6mE+gW1x 3ltQ== X-Gm-Message-State: ANoB5pnD5IT9b0hSSCV7JcWmEtyDCA37kOhNSKU5W7idD06y50q0WYp3 jU+oN3Q4Kpc0Zo0yjBxrMAPcZg== X-Received: by 2002:a17:906:388c:b0:7aa:97c7:2c04 with SMTP id q12-20020a170906388c00b007aa97c72c04mr2100956ejd.191.1668177566016; Fri, 11 Nov 2022 06:39:26 -0800 (PST) Received: from prevas-ravi.tritech.se ([80.208.71.65]) by smtp.gmail.com with ESMTPSA id jt4-20020a170906dfc400b007a1d4944d45sm945886ejc.142.2022.11.11.06.39.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 11 Nov 2022 06:39:25 -0800 (PST) From: Rasmus Villemoes To: Cosmin Tanislav , Lars-Peter Clausen , Michael Hennerich , Jonathan Cameron Cc: devicetree@vger.kernel.org, Rob Herring , Rasmus Villemoes , linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 1/5] iio: addac: ad74413r: add spi_device_id table Date: Fri, 11 Nov 2022 15:39:17 +0100 Message-Id: <20221111143921.742194-2-linux@rasmusvillemoes.dk> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20221111143921.742194-1-linux@rasmusvillemoes.dk> References: <20221111143921.742194-1-linux@rasmusvillemoes.dk> 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,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net 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?1749211689456435612?= X-GMAIL-MSGID: =?utf-8?q?1749211689456435612?= Silence the run-time warning SPI driver ad74413r has no spi_device_id for adi,ad74412r Signed-off-by: Rasmus Villemoes --- drivers/iio/addac/ad74413r.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/drivers/iio/addac/ad74413r.c b/drivers/iio/addac/ad74413r.c index 899bcd83f40b..37485be88a63 100644 --- a/drivers/iio/addac/ad74413r.c +++ b/drivers/iio/addac/ad74413r.c @@ -1457,12 +1457,20 @@ static const struct of_device_id ad74413r_dt_id[] = { }; MODULE_DEVICE_TABLE(of, ad74413r_dt_id); +static const struct spi_device_id ad74413r_spi_id[] = { + { .name = "ad74412r", .driver_data = (kernel_ulong_t)&ad74412r_chip_info_data }, + { .name = "ad74413r", .driver_data = (kernel_ulong_t)&ad74413r_chip_info_data }, + {}, +}; +MODULE_DEVICE_TABLE(spi, ad74413r_spi_id); + static struct spi_driver ad74413r_driver = { .driver = { .name = "ad74413r", .of_match_table = ad74413r_dt_id, }, .probe = ad74413r_probe, + .id_table = ad74413r_spi_id, }; module_driver(ad74413r_driver, From patchwork Fri Nov 11 14:39:18 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rasmus Villemoes X-Patchwork-Id: 18864 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp784539wru; Fri, 11 Nov 2022 06:52:34 -0800 (PST) X-Google-Smtp-Source: AA0mqf4O2pYRE63nWJBfChsKrklghNSl5TyU9dDMBUaztogHr0hjz4p8WrTrZSLwQjRPB4RfpmRx X-Received: by 2002:a05:6402:3715:b0:462:32bf:613a with SMTP id ek21-20020a056402371500b0046232bf613amr1716140edb.78.1668178353858; Fri, 11 Nov 2022 06:52:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668178353; cv=none; d=google.com; s=arc-20160816; b=U7R1C3msVmbb5oNLKp4m2ECRvgLa4GBp1/gU6LmbXtjlfmK8w6jPKZqhgdEaYaQfEQ nyGKnrnm+J65nhMtWMl3lw4ZQjzXRo1ELfdxVxs1zSEt0wi2c8orlHFw8NoZ+TL8KArQ O9sOnTnd3ZwLnVmZyFPCZ4nsdxUAmgcLiDmvJURCfqt9NadDOcATR/GbszoQPsiT8RES AGxF8/42kS596LA3Uo0krq2Xmy136tzMC5KDZ5jAln7v40Vb71toP4omuYdBKICmSkti gHghY9N6WjkBgdGdZW0TVHzD4fQvAE1eg0WIm+MEaXmJ+gcbJdhmr/PIAeiCWCg+wvLK rLIQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=2lxqynGN1zb3SeT8QyXA1+0ZwfAUv0vy1HULeEAsp+0=; b=CP6gSeQKWKKNf3ImLCGKbUCQZLDLZG1cjHzOCRjhIIrP1BYu3+S/mh0nCrAxmfrltn FJV27ewfx8k0yHPd5UsQiltIho4hENERUHQ+wEYHDwiWAOOGOJ5hVF86z7c4Ybtb6Bnu 1PycgQfi/ToM8w/4X0n7k9Yn4bfxknqssEVu/385Vxp4vKlWAp93GxWptllTPW1ddZ0A A7ZfZFTQSW3uK6jeMHdPrEX8QZu50co8DAo7Oi8cGACFpnZ6RLkkuOOE7E+VakXGlmZm ULkQ0deIx0Phm0eoQF5yQIIWhNnnh30Z7up/tgi93kh76AJTUbYPl/7pBd03LNY+EpFC xX4A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@rasmusvillemoes.dk header.s=google header.b=BY47XsVm; 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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l3-20020a170906794300b007aed286a00dsi672919ejo.814.2022.11.11.06.52.09; Fri, 11 Nov 2022 06:52:33 -0800 (PST) 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=pass header.i=@rasmusvillemoes.dk header.s=google header.b=BY47XsVm; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234734AbiKKOkG (ORCPT + 99 others); Fri, 11 Nov 2022 09:40:06 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48600 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234654AbiKKOji (ORCPT ); Fri, 11 Nov 2022 09:39:38 -0500 Received: from mail-ej1-x635.google.com (mail-ej1-x635.google.com [IPv6:2a00:1450:4864:20::635]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5D60D63BB7 for ; Fri, 11 Nov 2022 06:39:28 -0800 (PST) Received: by mail-ej1-x635.google.com with SMTP id n12so12941956eja.11 for ; Fri, 11 Nov 2022 06:39:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rasmusvillemoes.dk; s=google; 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=2lxqynGN1zb3SeT8QyXA1+0ZwfAUv0vy1HULeEAsp+0=; b=BY47XsVmK51QERSuv9y2eWZAjkN5DPflYrv9P/kAP1nvo563DsVXnrBG2y65QznhVM SJJXYc3oBd5budwHsKVFz1tIAxtTFQHFuRjvG2Qow3zmfnhU4p6vdjvcEJwBKzhZFQac supnDkrsavwNMIaDcwLsbcfXTXa6D3sSBou3Y= 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=2lxqynGN1zb3SeT8QyXA1+0ZwfAUv0vy1HULeEAsp+0=; b=uXPduAlC9CAbVgpx1xS51WedVg+gkUZ/QF03PhzMZ8s0/wt4stvLrnsZRY24piDcrM jdhlaOEW/vcSL8PF0GzDrmIUg6y0o0h6vo1nsZdI99luM6ViHc/aCOrH9aFnfJM3a9KF M5fEnpN6lVYmSIshG//yUBjJpXFKCkjL4Hlm5EE3mkPvYvI1JZg3AOtxXFMRRdMwOyi/ 0jyc6xecXAYcZ7yRRhcQotHDYjGhE9MetvSbeajNem9QWMg+Kfh72wyrh5g/oGJHk+bB Z2gfgkG6aKdhcoufdyuzjsiStmMbBrbjfur5SmzxTLQ3ByzLXBmire6hXKQZGUqlJ2WE TQzg== X-Gm-Message-State: ANoB5pmmOuglyphidh1QgpaDs9RLWYJEYdmFHOuXowniC/8nLGKWfCKm 0mgOHe6xSEu5lp6qVoCR20ow34mC3h5wyCwHEwk= X-Received: by 2002:a17:906:8cf:b0:7ae:59dd:e3f4 with SMTP id o15-20020a17090608cf00b007ae59dde3f4mr2017438eje.755.1668177567004; Fri, 11 Nov 2022 06:39:27 -0800 (PST) Received: from prevas-ravi.tritech.se ([80.208.71.65]) by smtp.gmail.com with ESMTPSA id jt4-20020a170906dfc400b007a1d4944d45sm945886ejc.142.2022.11.11.06.39.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 11 Nov 2022 06:39:26 -0800 (PST) From: Rasmus Villemoes To: Cosmin Tanislav , Lars-Peter Clausen , Michael Hennerich , Jonathan Cameron Cc: devicetree@vger.kernel.org, Rob Herring , Rasmus Villemoes , linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 2/5] dt-bindings: iio: ad74413r: make refin-supply optional Date: Fri, 11 Nov 2022 15:39:18 +0100 Message-Id: <20221111143921.742194-3-linux@rasmusvillemoes.dk> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20221111143921.742194-1-linux@rasmusvillemoes.dk> References: <20221111143921.742194-1-linux@rasmusvillemoes.dk> 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,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net 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?1749211785598641092?= X-GMAIL-MSGID: =?utf-8?q?1749211785598641092?= The ad74412r/ad74413r has an internal 2.5V reference output, which (by tying the REFOUT pin to the REFIN pin) can be used in lieu of an external 2.5V input reference. So stop marking refin-supply as required. Signed-off-by: Rasmus Villemoes --- Documentation/devicetree/bindings/iio/addac/adi,ad74413r.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/Documentation/devicetree/bindings/iio/addac/adi,ad74413r.yaml b/Documentation/devicetree/bindings/iio/addac/adi,ad74413r.yaml index 03bb90a7f4f8..e954d5ae4f4f 100644 --- a/Documentation/devicetree/bindings/iio/addac/adi,ad74413r.yaml +++ b/Documentation/devicetree/bindings/iio/addac/adi,ad74413r.yaml @@ -56,7 +56,6 @@ required: - reg - spi-max-frequency - spi-cpol - - refin-supply additionalProperties: false From patchwork Fri Nov 11 14:39:19 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rasmus Villemoes X-Patchwork-Id: 18866 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp785279wru; Fri, 11 Nov 2022 06:54:12 -0800 (PST) X-Google-Smtp-Source: AA0mqf5CDr44JdOmqfKfZIU5bq5oz57izZYmqSVY+ZuNq9LfqXqvYnjWJV0gOklhmeQirC8PQYQE X-Received: by 2002:a05:6402:3891:b0:459:2c26:5da3 with SMTP id fd17-20020a056402389100b004592c265da3mr1834160edb.100.1668178452315; Fri, 11 Nov 2022 06:54:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668178452; cv=none; d=google.com; s=arc-20160816; b=qTRzJnYjNGSqwTgJ9ttR7Hn8yU6/2+5YmOJ67/HCSXC5yFF391jkSVSbfRq7eufY6o 0gA0+l5/sK7argHENstk4sW0E9iZvnPZSPU+6d46SqDxLJnmBwWrxqEKiZDxlGjGqfhK 4EwienSPESVTZKo4RvU12hMFa6Qww2W3aZkIL2hzjRw98rTJA40fm9QWMveZPAUuJxVe 6ReeTrhb38umZxVS387GnbAvoAs2KmO9HN6JeFodi1HzYb2YSNIKrqDP7FdJcgJTLEYx Gzgh0OyE68zjr7XIMaYG8C4uwMmZBwNKYPZxHprfsZLUnDuddqS1BhUuTOf/RV7bqU65 qs+w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=NMEYouN33VXJnGj1szjoBs9S5kXWzk4pLlmEmqoZFno=; b=ZxHYMxuCe5rqCzIzaeBNMwqxjq/ifqV5MHEXgA+L3JTVVuwOqLIyHOHkLp9xz/TfTC cr/IUpPfYQK945zb128iBiBXwnI+If9ywmwI2TJDicBgijTa5Cdr5jpth3lXEEoCQI7x H/M3AbroTkGUBlP24YOdifpSccERWGYAofskAsUV7q/u0N+/UqiOdbKWU7YN5j+dxa4h qWKLcttMJt5Wu1cnpxKTR99xx67Z3ZqA0I9gnjMCAkcdkY18IaBIcYdT33HEN6/ZUsYs nKfF07G9IudraXUZusxmCBBsNTPrRTps8o97q9B+8Zq4U5Go8ks2TM2EKsYaswJr0tRc mC/Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@rasmusvillemoes.dk header.s=google header.b=aYLheQpY; 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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b15-20020a056402350f00b0045945eed10asi2966644edd.5.2022.11.11.06.53.48; Fri, 11 Nov 2022 06:54:12 -0800 (PST) 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=pass header.i=@rasmusvillemoes.dk header.s=google header.b=aYLheQpY; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234686AbiKKOkd (ORCPT + 99 others); Fri, 11 Nov 2022 09:40:33 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48744 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234660AbiKKOjj (ORCPT ); Fri, 11 Nov 2022 09:39:39 -0500 Received: from mail-ed1-x52f.google.com (mail-ed1-x52f.google.com [IPv6:2a00:1450:4864:20::52f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5F2BE6584D for ; Fri, 11 Nov 2022 06:39:29 -0800 (PST) Received: by mail-ed1-x52f.google.com with SMTP id l11so7907503edb.4 for ; Fri, 11 Nov 2022 06:39:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rasmusvillemoes.dk; s=google; 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=NMEYouN33VXJnGj1szjoBs9S5kXWzk4pLlmEmqoZFno=; b=aYLheQpYSAA+nvIa8jyxXle6dr+WMfHP/Q3Xc7+2lnehrlu5Uxzb2AighHNYmghKXh XCQvPKImeoie67r83OOlpg4Jg4N7ZI4I9oCgVyQ/O2crwjrallGtflR058/P8LymOWzZ e+vsF5mXlwN57u+OUIx04kLjRfdzkol9U6gDM= 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=NMEYouN33VXJnGj1szjoBs9S5kXWzk4pLlmEmqoZFno=; b=6F1TaUsjO9d2o0cY5Gf1gQZlW+vh29VfMU+FjsHzwztWwDkV/uvIfUr/3dlD49AFZe 1PwE4+IpJsMF42eVdl3Jz4F86vqA3evlxRDZzQU8X8W3n5TAoUvIVYlA8LyowY4ryM1l 6JPKpTpPN5FtVxqCEXeF79Ku1GQSGY4B+K2lWL1Cebz/W0QhwKSFbjFConehUY5SuR2f EZcdF+ddZOy9l2nyv7mEu16XH2nE4pOdF6A80P1YmR5gQcnbFpi3iuxkObMPOUZhKoje 7ISZGsN71iT2myB4DkKhioA3f36GfzrBWSBhw7jkS4Qht+oKawKQ0jKT6Mbc9fInNZPg WmQA== X-Gm-Message-State: ANoB5pkf4FbGwaH+sOkaMY60NvqrPbC9meZKVrIB4DYiJL78z8FWd85c z/DAn3+6Jw4/TcS84TNAMIXuXQ== X-Received: by 2002:a05:6402:158c:b0:463:19ca:a573 with SMTP id c12-20020a056402158c00b0046319caa573mr1727365edv.31.1668177567955; Fri, 11 Nov 2022 06:39:27 -0800 (PST) Received: from prevas-ravi.tritech.se ([80.208.71.65]) by smtp.gmail.com with ESMTPSA id jt4-20020a170906dfc400b007a1d4944d45sm945886ejc.142.2022.11.11.06.39.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 11 Nov 2022 06:39:27 -0800 (PST) From: Rasmus Villemoes To: Cosmin Tanislav , Lars-Peter Clausen , Michael Hennerich , Jonathan Cameron Cc: devicetree@vger.kernel.org, Rob Herring , Rasmus Villemoes , linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 3/5] iio: addac: ad74413r: implement support for optional refin-supply Date: Fri, 11 Nov 2022 15:39:19 +0100 Message-Id: <20221111143921.742194-4-linux@rasmusvillemoes.dk> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20221111143921.742194-1-linux@rasmusvillemoes.dk> References: <20221111143921.742194-1-linux@rasmusvillemoes.dk> 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,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 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?1749211888777602961?= X-GMAIL-MSGID: =?utf-8?q?1749211888777602961?= The ad74412r/ad74413r has an internal 2.5V reference output, which (by tying the REFOUT pin to the REFIN pin) can be used in lieu of an external 2.5V input reference. Support that case by using devm_regulator_get_optional(), and simply hardcode the 2500000 uV in ad74413r_get_output_current_scale(). I'm not sure this is completely correct, but it's certainly better than the current behaviour, where when refin-supply is not defined in device tree, the regulator framework helpfully does its supply refin not found, using dummy regulator thing. When we then do the regulator_get_voltage(), that dummy regulator of course doesn't support that operation and thus returns -22 (-EINVAL) which is used without being checked. Signed-off-by: Rasmus Villemoes --- drivers/iio/addac/ad74413r.c | 31 ++++++++++++++++++++----------- 1 file changed, 20 insertions(+), 11 deletions(-) diff --git a/drivers/iio/addac/ad74413r.c b/drivers/iio/addac/ad74413r.c index 37485be88a63..9f77d2f514de 100644 --- a/drivers/iio/addac/ad74413r.c +++ b/drivers/iio/addac/ad74413r.c @@ -608,7 +608,10 @@ static int ad74413r_get_output_voltage_scale(struct ad74413r_state *st, static int ad74413r_get_output_current_scale(struct ad74413r_state *st, int *val, int *val2) { - *val = regulator_get_voltage(st->refin_reg); + if (st->refin_reg) + *val = regulator_get_voltage(st->refin_reg); + else + *val = 2500000; *val2 = st->sense_resistor_ohms * AD74413R_DAC_CODE_MAX * 1000; return IIO_VAL_FRACTIONAL; @@ -1313,19 +1316,25 @@ static int ad74413r_probe(struct spi_device *spi) if (IS_ERR(st->regmap)) return PTR_ERR(st->regmap); - st->refin_reg = devm_regulator_get(st->dev, "refin"); - if (IS_ERR(st->refin_reg)) - return dev_err_probe(st->dev, PTR_ERR(st->refin_reg), - "Failed to get refin regulator\n"); + st->refin_reg = devm_regulator_get_optional(st->dev, "refin"); + if (IS_ERR(st->refin_reg)) { + ret = PTR_ERR(st->refin_reg); + if (ret != -ENODEV) + return dev_err_probe(st->dev, ret, + "Failed to get refin regulator\n"); + st->refin_reg = NULL; + } - ret = regulator_enable(st->refin_reg); - if (ret) - return ret; + if (st->refin_reg) { + ret = regulator_enable(st->refin_reg); + if (ret) + return ret; - ret = devm_add_action_or_reset(st->dev, ad74413r_regulator_disable, + ret = devm_add_action_or_reset(st->dev, ad74413r_regulator_disable, st->refin_reg); - if (ret) - return ret; + if (ret) + return ret; + } st->sense_resistor_ohms = 100000000; device_property_read_u32(st->dev, "shunt-resistor-micro-ohms", From patchwork Fri Nov 11 14:39:20 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rasmus Villemoes X-Patchwork-Id: 18865 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp785000wru; Fri, 11 Nov 2022 06:53:34 -0800 (PST) X-Google-Smtp-Source: AA0mqf6WXO/YiFrhEV6emvDkkrUzXPElMUOX0/FPrAzyeXQ0YXmfosVETTTpXSRGVgXaNRgRbqwh X-Received: by 2002:a17:906:d82:b0:7ad:8a7a:2343 with SMTP id m2-20020a1709060d8200b007ad8a7a2343mr2063494eji.225.1668178414147; Fri, 11 Nov 2022 06:53:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668178414; cv=none; d=google.com; s=arc-20160816; b=jNT6rmzGXZ87AnIBzVBrVlp025uU/aJKDqyuSsTPKeAzXx06DdQjVSVIOBI2M5pVZ0 VFItWcoR3PeVfkPNV32Bb6Kh95iQ8//vpBc3i2PWKRXj2NBNUIsMeLLMN4PFQENIBmxk bklruWk/p9TcPv9l7Tgh2LogRFGEJ6PFX6hRr2XclZX4nrL/Kp72nsh4fP+8eUo/5MwT i1xpEFTRlIwt2WS+fZJYWHk0kj9LsYKy4ZKr+CaNKQs6kXTI1vPrlp9CmzyWu0Bxo2b9 TJbRCQIr7iyB7aubRC59BGHkfixLV5LXXC4rLhVO0Rqwl48RPDuhH0i2XS02LNh0lS5I JohA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=8nUDZC72vgUX/+mjOceon1Lp8omkXG06DLgI5cBosnQ=; b=lKbf9bve+T9HstQVhuyOrAZlEng5i87BZ8yF50oKEwye+VjPECGIKkCwn2vxqwIVHm vWCQtf+COy2ZrLj/qUSyfNXbY6B327Btsm67JzX2Jutlj6HcRFIOceBZQndXAmxvLCfX vuZBnb1hnEWCZQFMMk7nB2QEfHYr1T0OoIbr0ZRnsnRA1LV3cPEdDNyjY3+YH/EldL55 R0dUQpfcDoGwNsZiXNk2DYWO893SUPyhihAizisvGuRsuXSnDVjgh7Dqkc0hRW7UvlrR wAUItHEiWdYBCzMWqk48XUvi8jDSJ/9/gmlIovB+KZJ99uI+xn5LGE1wiaym+56e2EJh CVTQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@rasmusvillemoes.dk header.s=google header.b=iFvwZclf; 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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q1-20020a17090676c100b0079e1916c11asi1562748ejn.703.2022.11.11.06.53.09; Fri, 11 Nov 2022 06:53:34 -0800 (PST) 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=pass header.i=@rasmusvillemoes.dk header.s=google header.b=iFvwZclf; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234765AbiKKOkT (ORCPT + 99 others); Fri, 11 Nov 2022 09:40:19 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48866 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234666AbiKKOjq (ORCPT ); Fri, 11 Nov 2022 09:39:46 -0500 Received: from mail-ej1-x630.google.com (mail-ej1-x630.google.com [IPv6:2a00:1450:4864:20::630]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 064BC65870 for ; Fri, 11 Nov 2022 06:39:30 -0800 (PST) Received: by mail-ej1-x630.google.com with SMTP id n12so12942164eja.11 for ; Fri, 11 Nov 2022 06:39:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rasmusvillemoes.dk; s=google; 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=8nUDZC72vgUX/+mjOceon1Lp8omkXG06DLgI5cBosnQ=; b=iFvwZclfbIiKwXP++pqGCXBltsjAlYxG6Eg2T2fA6LMnFCV5dUD1qVPwaeCSWErf33 ekEzJFjqde0fdpIQCgmDy2gvE8PG82AcoO12V0spWo0LUtjPIH7vdyx9dsRZoPmkZNYf 604eIeEENYz2NPWEJYYEBCQKKihY8U4xDLRDE= 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=8nUDZC72vgUX/+mjOceon1Lp8omkXG06DLgI5cBosnQ=; b=MeaRanbZ5dmVZEcr7uMA93xraNjcSokRrTGNNLwx3Dt9q8+I4K1iSF6WyY/Nb+bWXI Sb+eNKyhXhaJl3NpqoP41YcIE+Gd0olvArosX4DwW5o1IhUUDvqPUkGTPega8533pxuE 7cNUlvqjp44Bcv1h+ApglhLW+vc95tKwRXe5p9sW77fLiaqmY9bfmqfyTnpv7jXtg5mA 90qAZn+EfZiYD8+FM+0l9otB76JNdq9ZF7q67ZFOuZOXr8IIqnCU7FYPEVJ+jQ7vsTBm z3jOzCNf2hyC92mFeHaq81RPNit4Pv+GDIBn23nkM2eZTfE2fGAsXDfL+A1BBvxMcNkQ Hykw== X-Gm-Message-State: ANoB5pnRiSP/rpqnDHVEtHepKewIceK2FSLPaoEL8ZZgpt/YLEyFtyE/ UbSkhnK8W0VljKCkgpav58Q1DA== X-Received: by 2002:a17:906:3d52:b0:7ae:44b2:cb7f with SMTP id q18-20020a1709063d5200b007ae44b2cb7fmr1982156ejf.437.1668177568980; Fri, 11 Nov 2022 06:39:28 -0800 (PST) Received: from prevas-ravi.tritech.se ([80.208.71.65]) by smtp.gmail.com with ESMTPSA id jt4-20020a170906dfc400b007a1d4944d45sm945886ejc.142.2022.11.11.06.39.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 11 Nov 2022 06:39:28 -0800 (PST) From: Rasmus Villemoes To: Cosmin Tanislav , Lars-Peter Clausen , Michael Hennerich , Jonathan Cameron Cc: devicetree@vger.kernel.org, Rob Herring , Rasmus Villemoes , linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 4/5] dt-bindings: iio: ad74413r: add optional reset-gpios Date: Fri, 11 Nov 2022 15:39:20 +0100 Message-Id: <20221111143921.742194-5-linux@rasmusvillemoes.dk> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20221111143921.742194-1-linux@rasmusvillemoes.dk> References: <20221111143921.742194-1-linux@rasmusvillemoes.dk> 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,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 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?1749211848931783871?= X-GMAIL-MSGID: =?utf-8?q?1749211848931783871?= The ad74412 and ad74413 devices have an active-low reset pin. Add a binding allowing one to specify a gpio tied to that. Signed-off-by: Rasmus Villemoes --- Documentation/devicetree/bindings/iio/addac/adi,ad74413r.yaml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Documentation/devicetree/bindings/iio/addac/adi,ad74413r.yaml b/Documentation/devicetree/bindings/iio/addac/adi,ad74413r.yaml index e954d5ae4f4f..70f82cc716ae 100644 --- a/Documentation/devicetree/bindings/iio/addac/adi,ad74413r.yaml +++ b/Documentation/devicetree/bindings/iio/addac/adi,ad74413r.yaml @@ -51,6 +51,9 @@ properties: Shunt (sense) resistor value in micro-Ohms. default: 100000000 + reset-gpios: + maxItems: 1 + required: - compatible - reg From patchwork Fri Nov 11 14:39:21 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rasmus Villemoes X-Patchwork-Id: 18867 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp785939wru; Fri, 11 Nov 2022 06:55:40 -0800 (PST) X-Google-Smtp-Source: AA0mqf6btP8UXJsiJyjRuJklP1oYmgS3+m2lKxfOJ56j+vagQtetwO/jCPq/FI0Grr3vxhJjZexE X-Received: by 2002:a17:907:8745:b0:78d:b4f1:1b29 with SMTP id qo5-20020a170907874500b0078db4f11b29mr2013907ejc.375.1668178540264; Fri, 11 Nov 2022 06:55:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668178540; cv=none; d=google.com; s=arc-20160816; b=Q7L2VtuGXOpTxnfONMoyVCl4JC3EzS5UixdZD5lEW0/ZddmBGPa5yCF0sCosatLZaV yu4pT/+MTpqtwJd4FjRLZoFlO66bO1FSVWGylmBXz12WaSg9+W+UiHaHjQ4CfO6GYe8z Rnl+LSiZ7Vy01+bEr3U8F+iarU8hvY8ZCwlyL73Waddf1C/303Jmju7FLXyPUrqBWkI/ f8vu3309cXknBrJUHYrV74s6lkW4fx6zBGWDxtZH8E0ws+ReuLEmBXmv7dq2yqeCChpL A/82wFhAOVdSrllvRPVdHJpkYs3Hw34v5PQ3UYXKFOQwhGqDfJ/NNwZLOf5eGJM9oXaa ruVw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=JAMGBaW4DNgnbxHPENr1NAw38Yk5iEpRnIys3RSCUnE=; b=o1fsOUSPpc+CJyxdL7m46CBIB8em/VWoGoJXXxe8F2ODf1z9gPsnjohYtZI2SuK0Jo GNyN8DL2RW3UucE/s4eR85C3Q+YSZLIgft/WsDbwiOzQil4nmDjInI5AX3j2py9aim5l YI5pLVmT8ZHl6/akxUYs+9WTl2gbDjJou2H0TMGZdQGZscZinL5QjYVhXwZaVkP2Bdro Qn2zKYCkNwc1gTq4FkiA7LtaICHFAaez0azO1r2K6y+ZyzFfILTxGx29PeFJHpe6URRy vU7yGATdOEHESB3/BqSmou7FmecFhpKuuZV2TSaur4xnL9tNiz3KUjDTPYpgyJivHg1m Q4CA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@rasmusvillemoes.dk header.s=google header.b=DVseHuqQ; 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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id dc26-20020a170906c7da00b0077b6ecac099si1537996ejb.287.2022.11.11.06.55.16; Fri, 11 Nov 2022 06:55:40 -0800 (PST) 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=pass header.i=@rasmusvillemoes.dk header.s=google header.b=DVseHuqQ; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234724AbiKKOk2 (ORCPT + 99 others); Fri, 11 Nov 2022 09:40:28 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48948 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234684AbiKKOju (ORCPT ); Fri, 11 Nov 2022 09:39:50 -0500 Received: from mail-ej1-x634.google.com (mail-ej1-x634.google.com [IPv6:2a00:1450:4864:20::634]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D378D5CD05 for ; Fri, 11 Nov 2022 06:39:31 -0800 (PST) Received: by mail-ej1-x634.google.com with SMTP id bj12so12909143ejb.13 for ; Fri, 11 Nov 2022 06:39:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rasmusvillemoes.dk; s=google; 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=JAMGBaW4DNgnbxHPENr1NAw38Yk5iEpRnIys3RSCUnE=; b=DVseHuqQ+fdeqFq/cg5i/yOGTG4qIR6mwKQlbApHL7hGPLZtwKD+3PuBn6DEtxZjzU SCj3NzZbHwsYr6cAIdX0AtIDt+EioB8psnFybSyTkN0Os88giBjtV7Je58ZV2J9NqiGM BK8t6Pl/+wsQ9rzJbLDdqP2UxZQGL4OEuiVos= 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=JAMGBaW4DNgnbxHPENr1NAw38Yk5iEpRnIys3RSCUnE=; b=hKFFEURWs/9vi4tV8E6fvLg6YR7cc3LeegBVSTwnWeeWvEgvDiZjF/R98hWwjNjNmb q2icrdku9gcCL81VQ0cipqnoefCifsuO/19BtbGLVxiOb06uHSk8BM3CGmca2/dUn+at niyA9+pNm3rrgWF+rM92THlpqT5SiHTWxVj4bwBZoyh6xvUqhdbZkUiMxyLjvPKH8C6i U8SBSfg/Pw4HKnTIYpwRTJdD69JtHBHig5WtNZddGcYiDwVmQ+Cq/6mAK7tCO9ACpgDd ZZS/FwRZoCZcrfvsbFczCBGswG0duo66V/T4kVvyhNHKw/bpyTa4ugMOYjvS5kxe66n3 u2Eg== X-Gm-Message-State: ANoB5plLetj7yIbP6p9XvzYO7EvFAlpBmb43hazDQhk9aVtXIcsER/vR oyW6loEUJvzkpJh/QE+ISw9J0oEK8qsQB1wjTvQ= X-Received: by 2002:a17:906:f113:b0:78d:addf:67c1 with SMTP id gv19-20020a170906f11300b0078daddf67c1mr2043542ejb.272.1668177569930; Fri, 11 Nov 2022 06:39:29 -0800 (PST) Received: from prevas-ravi.tritech.se ([80.208.71.65]) by smtp.gmail.com with ESMTPSA id jt4-20020a170906dfc400b007a1d4944d45sm945886ejc.142.2022.11.11.06.39.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 11 Nov 2022 06:39:29 -0800 (PST) From: Rasmus Villemoes To: Cosmin Tanislav , Lars-Peter Clausen , Michael Hennerich , Jonathan Cameron Cc: devicetree@vger.kernel.org, Rob Herring , Rasmus Villemoes , linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 5/5] iio: addac: ad74413r: add support for reset-gpio Date: Fri, 11 Nov 2022 15:39:21 +0100 Message-Id: <20221111143921.742194-6-linux@rasmusvillemoes.dk> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20221111143921.742194-1-linux@rasmusvillemoes.dk> References: <20221111143921.742194-1-linux@rasmusvillemoes.dk> 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,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 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?1749211981022590176?= X-GMAIL-MSGID: =?utf-8?q?1749211981022590176?= We have a board where the reset pin of the ad74412 is connected to a gpio, but also pulled low by default. Hence to get the chip out of reset, the driver needs to know about that gpio and set it high before attempting to communicate with it. When a reset-gpio is given in device tree, use that instead of the software reset. According to the data sheet, the two methods are functionally equivalent. Signed-off-by: Rasmus Villemoes --- drivers/iio/addac/ad74413r.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/drivers/iio/addac/ad74413r.c b/drivers/iio/addac/ad74413r.c index 9f77d2f514de..af09d43f921c 100644 --- a/drivers/iio/addac/ad74413r.c +++ b/drivers/iio/addac/ad74413r.c @@ -71,6 +71,7 @@ struct ad74413r_state { struct regmap *regmap; struct device *dev; struct iio_trigger *trig; + struct gpio_desc *reset_gpio; size_t adc_active_channels; struct spi_message adc_samples_msg; @@ -393,6 +394,13 @@ static int ad74413r_reset(struct ad74413r_state *st) { int ret; + if (st->reset_gpio) { + gpiod_set_value_cansleep(st->reset_gpio, 1); + fsleep(50); + gpiod_set_value_cansleep(st->reset_gpio, 0); + return 0; + } + ret = regmap_write(st->regmap, AD74413R_REG_CMD_KEY, AD74413R_CMD_KEY_RESET1); if (ret) @@ -1316,6 +1324,10 @@ static int ad74413r_probe(struct spi_device *spi) if (IS_ERR(st->regmap)) return PTR_ERR(st->regmap); + st->reset_gpio = devm_gpiod_get_optional(st->dev, "reset", GPIOD_OUT_LOW); + if (IS_ERR(st->reset_gpio)) + return PTR_ERR(st->reset_gpio); + st->refin_reg = devm_regulator_get_optional(st->dev, "refin"); if (IS_ERR(st->refin_reg)) { ret = PTR_ERR(st->refin_reg);