Received: by 2002:a05:7412:b10a:b0:f3:1519:9f41 with SMTP id az10csp2861730rdb; Mon, 4 Dec 2023 09:22:47 -0800 (PST) X-Google-Smtp-Source: AGHT+IFdsQMSU1fhYgvICqQ8XkbhlfBj6gjyw2hRolKGgyOr/e/41X8MeLOyPPvKfmyhhKzmQnAk X-Received: by 2002:a05:6a20:9785:b0:18f:97c:824b with SMTP id hx5-20020a056a20978500b0018f097c824bmr2270067pzc.85.1701710567029; Mon, 04 Dec 2023 09:22:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701710567; cv=none; d=google.com; s=arc-20160816; b=lCQlKl9GVoK+ZkditKUDFArxYukWFWTDHiWYIWEXtJKaSmyv8WlFJglsuRnFSjZPfi YVjj7mndYkJNZkGGRO9ILEQsIUAkTqiad/oWf+lhM/qGUH5oow3zv8qQWct97GLNVOah Rexu4uOdOz1k3Fwpm/k42nSNpmM09oViJRuNjAjsIBTUVEl73UMozniN7ccQhQ7w+6Ft TToIOYl3zEVMhwtj3m9O/YHnqGR+7gjxkUDX4ZaWLPstaa2nB7pe1+Bq7IesCwvgXpvp AHUF3QvqTyt0w8tFk5L7VQvoexpnagDZaVmBN60PPrnCQIqqP4+frDFODmMMUBlt7H3a 3ceg== 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:subject:cc:to:from:date :dkim-signature; bh=ewAgbS0CFBlBpDTdD3e+KsAfZwQ1eubLrJB3XSzdAws=; fh=yODF6bxXo2A9TG2kCZ9ffceZZ9ub3epIuKC2p5j7XgY=; b=odugu8d/p9cFKy4gx7kmn7k0iiJ45iRy20NN7Nxnti0fmSuReGXqJ74dbf2Fy464CB /R9NdknmbcalPCNXVprG4yy0fGkShPDJuER3G67++kSMFTP5iAhAX/JNz+GVz5pNE2o9 Lso+D2dKOtM1mCN7SvG8rVav0I5cMrcUvPqlB9UMdYMKGE/ykuJMlACyUdS6dAxmS7q+ jus1fsS2c8Ja8fpo4j+o8u36+jkt7piolsaoOGNHKbNAdb/8/6le3EuVqr3Re9CoXvpt E5sQz9U2EZjUM7XETxQZhR+FVxZpZlymR6lY1p/k/6vX3MVznR/8dRncBhbOWXHTjaal Tcrw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=plB2EjoZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from morse.vger.email (morse.vger.email. [2620:137:e000::3:1]) by mx.google.com with ESMTPS id o14-20020a056a00214e00b006ce4e9187b4si2132932pfk.370.2023.12.04.09.22.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Dec 2023 09:22:47 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) client-ip=2620:137:e000::3:1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=plB2EjoZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by morse.vger.email (Postfix) with ESMTP id 989BA805197F; Mon, 4 Dec 2023 09:22:44 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234869AbjLDRW2 (ORCPT + 99 others); Mon, 4 Dec 2023 12:22:28 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38976 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229477AbjLDRWY (ORCPT ); Mon, 4 Dec 2023 12:22:24 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 41DD383 for ; Mon, 4 Dec 2023 09:22:31 -0800 (PST) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EC89FC433C8; Mon, 4 Dec 2023 17:22:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1701710550; bh=fISovsUAugtGVbrmngMLVuIQZSTyx2zTDMISleFijck=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=plB2EjoZ+u/2syhFMHyNS5e/d88O7CerbI1EU1u4/BiPpQfkSJvSn4B97CmuDCFsp L6H+kucPJ9VYXMxMfyW16EMFywm2q2a0rxJj2AasuwrIagBWlNHRuhoerrRdRaryKn cpa+gyDxggZNMIPaKcJLzE9O/s94aywh5Hdb2YEzBwEqvsX6rY4KoRrfZfv44H4M0h zXBO9wApaoD+ATliMWLwEszY1GHhc/wkft2QFbIxm8N1hzJte8AeI1LxAFleXCRf6v 3NCJ9u6JP638aZN5ZjEpSoVEaIQ99nAihmRHTqUc7npqXH7IFBxnEmP4sNUNmBEKie 0aCDnrfskgJcw== Date: Mon, 4 Dec 2023 17:22:17 +0000 From: Jonathan Cameron To: Ceclan Dumitru Cc: linus.walleij@linaro.org, brgl@bgdev.pl, andy@kernel.org, linux-gpio@vger.kernel.org, Lars-Peter Clausen , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Michael Walle , Andy Shevchenko , Arnd Bergmann , ChiaEn Wu , Niklas Schnelle , Leonard =?UTF-8?B?R8O2aHJz?= , Mike Looijmans , Haibo Chen , Hugo Villeneuve , Ceclan Dumitru , linux-iio@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v6 2/2] iio: adc: ad7173: add AD7173 driver Message-ID: <20231204172217.6be90ae4@jic23-huawei> In-Reply-To: <9dbb81f8-7c75-411d-a77c-b670302f0dfe@gmail.com> References: <20231123152331.5751-1-user@HYB-hhAwRlzzMZb> <20231123152331.5751-2-user@HYB-hhAwRlzzMZb> <20231125172125.1b0f1ae7@jic23-huawei> <9dbb81f8-7c75-411d-a77c-b670302f0dfe@gmail.com> X-Mailer: Claws Mail 4.1.1 (GTK 3.24.38; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-1.2 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on morse.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (morse.vger.email [0.0.0.0]); Mon, 04 Dec 2023 09:22:44 -0800 (PST) On Mon, 4 Dec 2023 18:49:21 +0200 Ceclan Dumitru wrote: > On 11/25/23 19:21, Jonathan Cameron wrote: > > On Thu, 23 Nov 2023 17:23:22 +0200 > > mitrutzceclan wrote: > > > >> From: Dumitru Ceclan > > ... > >> + st->regulators[0].supply = ad7173_ref_sel_str[AD7173_SETUP_REF_SEL_EXT_REF]; > >> + st->regulators[1].supply = ad7173_ref_sel_str[AD7173_SETUP_REF_SEL_EXT_REF2]; > >> + st->regulators[2].supply = ad7173_ref_sel_str[AD7173_SETUP_REF_SEL_AVDD1_AVSS]; > >> + > >> + ret = devm_regulator_bulk_get(dev, ARRAY_SIZE(st->regulators), > >> + st->regulators); > > > > If only some of them are supplied, the driver works fine as long as no channel is using them? > > If so should probably get the optionally then check for availability of the ones you > > want. I'm sure someone will just wire up ref. Incidentally, ref2 isn't there for all chips > > I think, so we should not get it on the ones where it can't exist. > > > > > This sets a dummy regulator in place if no proper supply is found. Then > the call regulator_get_voltage() on the dummy will fail. About getting > ref2, sure, I'll set the string only with the right ID. > > ... > >> + ret = ad7173_get_ref_voltage_milli(st, (u8)ref_sel); > >> + if (ret < 0) > >> + return dev_err_probe(dev, ret, > >> + "Cannot use reference %u", ref_sel); > > Here the probe would not continue if a channel selects a supply that is > not available in the DT. Ok. It's a little ugly though - so maybe a comment at the bulk_get to say it will fail cleanly a bit later.