Received: by 2002:a05:7412:ba23:b0:fa:4c10:6cad with SMTP id jp35csp2107164rdb; Sun, 21 Jan 2024 07:42:35 -0800 (PST) X-Google-Smtp-Source: AGHT+IHKvwYl9JdeAr8P+gejAJCrfNPSSpjjM0wxEwZu6A/u9PsNNYjVzQbXU5ivQDe/lX6MzYS3 X-Received: by 2002:a50:a6dd:0:b0:559:d87a:b438 with SMTP id f29-20020a50a6dd000000b00559d87ab438mr950394edc.122.1705851754864; Sun, 21 Jan 2024 07:42:34 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1705851754; cv=pass; d=google.com; s=arc-20160816; b=wg6nHjyvt2GM1GXPzq68kpWem9WjJDULnLHB4DTDkmgbeIHolU2LaR3IO+vmAgC8c5 PEI5+Z3ICKA7N82jnOlIr9R0tYGrdOpnligopt1ntAs0Op55iDgECDF6mm7OrCTdHRum GtS2O/+vO4lH/2Hc4YQtSV6UFrj+PTWGhzoPrV1OtHQtkKu8Jkd8g2RcqTrSM33V2/2h A/3Szu1+PiDUUSYbCU/+zToZixFu+hn9ul4EHu/8hOjTp+F3N82HRuGKhP2linpRNpUH LlPzSd3E9iOVw+iYI9R9dussXp60AjUnfv8NwG2SpA8lDdFGPekh4dapGjKnk46RGa0j IANw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :subject:cc:to:from:date:dkim-signature; bh=NW5w/Xf3kRYwyOZTMT3Rnzyf1111uQvA10mmDvv6ecE=; fh=gvMMPZAo5IuonR7P9uXXhKLGy93Mct2Rt8Nd11qdFOY=; b=Y27D0Kixvqtvyca8PBQ4tQlgc7fa3x6Iyy4hcWgEFtOdGrmnT3O0AecHwpdpDM0KyQ PWXFI86CQFOuAdnUfZE/QUcr/LNN+wv/vqAr46K6aEFb4EQx02c5+zUGQ8MC759U+bSK ZNjLn58WnkfMs7h/UIMpawrn2DAt1NBQuGEHKImSYnScBb4yOR/e2fpZa2qtvMUmgUOT 7+jO9DwCzZmvs6g51tATFvzx52PZBYl/xR4eVvUfRdJsNV9KuS4t9q+YmJRMVEO1EhEN xsuyRgl2fEIlPTv32GntSgnQeSddfiRiNMH1ORN8A2XEt60H1tBqklhaxAcBLZWCP7Wm 6uFQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=SA0tpgjL; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-32102-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-32102-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id y23-20020a50e617000000b0055a393e15a7si3413077edm.173.2024.01.21.07.42.34 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 21 Jan 2024 07:42:34 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-32102-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=SA0tpgjL; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-32102-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-32102-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 9EC061F22EA8 for ; Sun, 21 Jan 2024 15:42:34 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 407DD3839B; Sun, 21 Jan 2024 15:41:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="SA0tpgjL" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 54AE938391; Sun, 21 Jan 2024 15:41:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705851694; cv=none; b=MlxTvYC8IqHVQiqRvNDpwB873vZSMC+FpK+rqKp0sEdA+ulH+TbYQZo/vaeTSEtnO0pAVbfQtsL89Nk+hk/O7Bsx4eiZZxU2BWhN4MfYVkzR5MJfvYEcXsWsRsWEXzBPCsxIk/NFKXwBPWQ7in/WQN0k+n+oGzQaQki4avOKR1Y= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705851694; c=relaxed/simple; bh=j+llwv0+BWawFUWk0sHZ0w+WckOFi7ovlWd7fHU8QTs=; h=Date:From:To:Cc:Subject:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=bJjtFeUEP38ZCyCP68ASNTX89MqLKWps3JqRTtt9cScpioAre64MNx5KWxyaNil8oWG71KInmg7Q4nXDUirLxAuUId9a0cMuCvl+hVIywGMdmZwKjWJLFGW4neMtRbO1iWSMrIJwvBVUboW5hcV72joivFZ8goclXW9VVRXeLxc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=SA0tpgjL; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0D2BDC433C7; Sun, 21 Jan 2024 15:41:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1705851693; bh=j+llwv0+BWawFUWk0sHZ0w+WckOFi7ovlWd7fHU8QTs=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=SA0tpgjL4kc2w/jC5DjEML6+dvuDSvPa3zcUrtzFkLl4H+0QQrkqiyHmYJU1OmJUT wmKLe8nSbbpHPCam9zg0Hw98jz/FRPYUyE8IDXcDq3TQlAt8A+F7GfhBkRdJkLknUR lPdcUApZ6d1yNWekeCpWJqlta0Q2QcODt7U0eslBjnjgygCQijamRpfECXKdHpt8h8 yBGqhC9qz1kEEf5mxfaO99EknfarKa7f9qyFSrzg4Pi/YS/OCRrT9IMTRt8Nf43Nve nA3q1U53YWyqoCUKcTaku5kks3LLYVR+PxKfGxT0rk1bmXbZSnB8QziSMmfoO2ND32 TF0/n/YaenTtg== Date: Sun, 21 Jan 2024 15:41:18 +0000 From: Jonathan Cameron To: Conor Dooley Cc: Ceclan Dumitru , 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 , David Lechner , Ceclan Dumitru , linux-iio@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v12 1/2] dt-bindings: adc: add AD7173 Message-ID: <20240121154118.389e4e87@jic23-huawei> In-Reply-To: <20240118-freebase-uptake-ec5fdf786d20@spud> References: <20240118125001.12809-1-mitrutzceclan@gmail.com> <20240118-lunar-anthem-31bf3b9b351d@spud> <20240118-freebase-uptake-ec5fdf786d20@spud> X-Mailer: Claws Mail 4.2.0 (GTK 3.24.40; x86_64-pc-linux-gnu) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit On Thu, 18 Jan 2024 16:06:29 +0000 Conor Dooley wrote: > On Thu, Jan 18, 2024 at 05:51:20PM +0200, Ceclan Dumitru wrote: > > > > > > On 1/18/24 17:23, Conor Dooley wrote: > > > On Thu, Jan 18, 2024 at 02:49:22PM +0200, Dumitru Ceclan wrote: > > > > ... > > > > >> + adi,clock-select: > > >> + description: | > > >> + Select the ADC clock source. Valid values are: > > >> + int : Internal oscillator > > >> + int-out : Internal oscillator with output on XTAL2 pin > > >> + ext-clk : External clock input on XTAL2 pin > > >> + xtal : External crystal on XTAL1 and XTAL2 pins > > >> + > > >> + $ref: /schemas/types.yaml#/definitions/string > > >> + enum: > > >> + - int > > >> + - int-out > > >> + - ext-clk > > >> + - xtal > > >> + default: int > > > I am not a fan of properties like this one, that in my view reimplement > > > things that are supported by the regular clocks properties. I've got > > > some questions for you so I can understand whether or not this custom > > > property is required. > > > > > > Whether or not the ext-clk or xtal is used is known based on > > > clock-names - why is the custom property required to determine that? > > > > If neither of those clocks are present, then the internal clock would be > > > used. Choosing to use the internal clock if an external one is provided > > > sounds to me like a software policy decision made by the operating > > > system. > > > > If there was no int-out, sure. I considered that the choice between int > > and int-out could be made here. So better for driver to choose int/int-out? > > This part of my comments was specifically about choosing between use of > the internal clock when ext-clk or xtal are provided, which I think > excludes the possibility of using int-out, since the XTAL2 pin is an > input. > > There's 3 situations: > - no external clock provided > - ext-clk provided > - xtal provided > > For the former, you know you're in that state when no "clocks" property > is present. The latter two you can differentiate based on "clock-names". > > Choosing to use the internal clock if an external clock is provided > seems to be a software policy decision, unless I am mistaken. Agreed, though it rarely makes sense as if someone put down a precision clock they normally wanted you to use it! So as a general rule we don't both providing policy controls beyond if there is extra hardware (external clock source) then use that. If someone has a good reason to want to do something else then we can probably figure out a reasonable way to control it. > > > > > > > Finally, if the ADC has a clock output, why can that not be represented > > > by making the ADC a clock-controller? > > > > > > > Was not familiar with this/did not cross my mind. So if xtal/ext-clk is > > present, the driver should detect it and disable the option for clock > > output? (Common pin XTAL2) > > Yeah, if those clocks are provided you would not register as a clock > controller. If there is a user of the output clock, it should have its > own "clocks" property that references the ADC's output. > > Your dt-binding could also make clocks/clock-names & clock-controller > mutually exclusive. That would indeed be the nicest solution. How this has been done in drivers has somewhat 'evolved' over time, but this is the nicest option from point of view of standard bindings and clarity over what is going on. > > Cheers, > Conor.