From mboxrd@z Thu Jan 1 00:00:00 1970 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 5AEC0C139; Sat, 28 Sep 2024 12:20:36 +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=1727526037; cv=none; b=nDlMqqjApIX77510U06Y5m0s9jKBei2l4kc/V8fOy/ZxkIYjuhBycDLFrEevNM1kCVyC6GBSQuSAh//4D3zMof0zLaQxRezpjCSnnLE7SLyAPvf4c9rsRdcmpas7QJQvgPIhtisw5eBjzPvqlJxvE0UsbvPheUJ76/StkTY+NrQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727526037; c=relaxed/simple; bh=VlJucxXTuioDoY6O7y4XDszULEPjMWJaI+McDBEM6kY=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=biDu1IT11ZqgIOIr9iPhhf+/tmV1Vk+6FFMTHnxhc6+lZSTJyRPxNpgL2ShVKBcre7wG1eX/nfhIV1IAzDfBJcIAKUX8BQY6ZAiZAVoYcIPesMZFUzEAJUDQrCzEcAwqKRicSuyeNpd9xfDcYVaRbRD5U7DA9/v+J+7++dnjHvU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=bojNiA6l; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="bojNiA6l" Received: by smtp.kernel.org (Postfix) with ESMTPSA id E97E3C4CEC3; Sat, 28 Sep 2024 12:20:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1727526036; bh=VlJucxXTuioDoY6O7y4XDszULEPjMWJaI+McDBEM6kY=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=bojNiA6ldaXTfYQI641aopuu8I3gzz3B56wd5VCZFUU7dpKOdCb0pGe2qtCooYt9W UaJK+CkzjQ/A+uAvMrpm06/mJC9uN1oVlFcAsEmwBsm6Qq1oMft0tEF9Zaj3tEdtiR /Kjp/5kBwTocZR73VJlHysszOcqLNtjNkD3y2VwRyGR46ifZI5E/XZ/ZcMRmOuZhd/ GeeMoF9v4rycVIvqpVXy45rOKFOug9d7Y4d5Oj57TA+H5GSz3byB4iLjn233O5RBoW 26E/nWBSPg2MpIav7n+rgnH+c8ThCHZc6viD7jeUAHdVrNrHuDALwFFSjyYeUCtpVj 63PtPfCM9A++w== Message-ID: <28834db1-3e9e-47f4-b00e-a548589d77e9@kernel.org> Date: Sat, 28 Sep 2024 14:20:29 +0200 Precedence: bulk X-Mailing-List: devicetree@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v3 04/10] dt-bindings: iio: dac: ad3552r: add io-backend support To: =?UTF-8?Q?Nuno_S=C3=A1?= , Angelo Dureghello Cc: Lars-Peter Clausen , Michael Hennerich , Nuno Sa , Jonathan Cameron , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Olivier Moysan , linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, dlechner@baylibre.com References: <20240919-wip-bl-ad3552r-axi-v0-iio-testing-v3-0-a17b9b3d05d9@baylibre.com> <20240919-wip-bl-ad3552r-axi-v0-iio-testing-v3-4-a17b9b3d05d9@baylibre.com> <418a8a9b-3bcf-4b8f-92a0-619a3bf26ab5@baylibre.com> <0279203b6cd9f1312d9c03654c262c04ac12fbd9.camel@gmail.com> From: Krzysztof Kozlowski Content-Language: en-US Autocrypt: addr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X1hHFVKmvl3VBHIsBv0oDcsQWXqY+NaFahT0lRPjYtrTa1v3tem/ JoFzZ4B0p27K+qQCF2R96hVvuEyjzBmdq2esyE6zIqftdo4MOJho8uctOiWbwNNq2U9pPWmu 4vXVFBYIGmpyNPYzRm0QPwARAQABwsF8BBgBCgAmAhsMFiEEm9B+DgxR+NWWd7dUG5NDfTtB YpsFAmA872oFCRRflLYACgkQG5NDfTtBYpvScw/9GrqBrVLuJoJ52qBBKUBDo4E+5fU1bjt0 Gv0nh/hNJuecuRY6aemU6HOPNc2t8QHMSvwbSF+Vp9ZkOvrM36yUOufctoqON+wXrliEY0J4 ksR89ZILRRAold9Mh0YDqEJc1HmuxYLJ7lnbLYH1oui8bLbMBM8S2Uo9RKqV2GROLi44enVt vdrDvo+CxKj2K+d4cleCNiz5qbTxPUW/cgkwG0lJc4I4sso7l4XMDKn95c7JtNsuzqKvhEVS oic5by3fbUnuI0cemeizF4QdtX2uQxrP7RwHFBd+YUia7zCcz0//rv6FZmAxWZGy5arNl6Vm lQqNo7/Poh8WWfRS+xegBxc6hBXahpyUKphAKYkah+m+I0QToCfnGKnPqyYIMDEHCS/RfqA5 t8F+O56+oyLBAeWX7XcmyM6TGeVfb+OZVMJnZzK0s2VYAuI0Rl87FBFYgULdgqKV7R7WHzwD uZwJCLykjad45hsWcOGk3OcaAGQS6NDlfhM6O9aYNwGL6tGt/6BkRikNOs7VDEa4/HlbaSJo 7FgndGw1kWmkeL6oQh7wBvYll2buKod4qYntmNKEicoHGU+x91Gcan8mCoqhJkbqrL7+nXG2 5Q/GS5M9RFWS+nYyJh+c3OcfKqVcZQNANItt7+ULzdNJuhvTRRdC3g9hmCEuNSr+CLMdnRBY fv0= In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit On 25/09/2024 13:55, Nuno Sá wrote: > On Wed, 2024-09-25 at 09:22 +0200, Krzysztof Kozlowski wrote: >> On 24/09/2024 14:27, Nuno Sá wrote: >>> On Tue, 2024-09-24 at 10:02 +0200, Krzysztof Kozlowski wrote: >>>> On 23/09/2024 17:50, Angelo Dureghello wrote: >>>>> Hi Krzysztof, >>>>> >>>>> On 22/09/24 23:02, Krzysztof Kozlowski wrote: >>>>>> On Thu, Sep 19, 2024 at 11:20:00AM +0200, Angelo Dureghello wrote: >>>>>>> From: Angelo Dureghello >>>>>>> >>>>>>> There is a version AXI DAC IP block (for FPGAs) that provides >>>>>>> a physical bus for AD3552R and similar chips, and acts as >>>>>>> an SPI controller. >>>>>>> >>>>>>> For this case, the binding is modified to include some >>>>>>> additional properties. >>>>>>> >>>>>>> Signed-off-by: Angelo Dureghello >>>>>>> --- >>>>>>>   .../devicetree/bindings/iio/dac/adi,ad3552r.yaml   | 42 >>>>>>> ++++++++++++++++++++++ >>>>>>>   1 file changed, 42 insertions(+) >>>>>>> >>>>>>> diff --git >>>>>>> a/Documentation/devicetree/bindings/iio/dac/adi,ad3552r.yaml >>>>>>> b/Documentation/devicetree/bindings/iio/dac/adi,ad3552r.yaml >>>>>>> index 41fe00034742..aca4a41c2633 100644 >>>>>>> --- a/Documentation/devicetree/bindings/iio/dac/adi,ad3552r.yaml >>>>>>> +++ b/Documentation/devicetree/bindings/iio/dac/adi,ad3552r.yaml >>>>>>> @@ -60,6 +60,18 @@ properties: >>>>>>>       $ref: /schemas/types.yaml#/definitions/uint32 >>>>>>>       enum: [0, 1, 2, 3] >>>>>>>   >>>>>>> +  io-backends: >>>>>>> +    description: The iio backend reference. >>>>>>> +      An example backend can be found at >>>>>>> +        >>>>>>> https://analogdevicesinc.github.io/hdl/library/axi_ad3552r/index.html >>>>>>> +    maxItems: 1 >>>>>>> + >>>>>>> +  adi,synchronous-mode: >>>>>>> +    description: Enable waiting for external synchronization >>>>>>> signal. >>>>>>> +      Some AXI IP configuration can implement a dual-IP layout, >>>>>>> with >>>>>>> internal >>>>>>> +      wirings for streaming synchronization. >>>>>>> +    type: boolean >>>>>>> + >>>>>>>     '#address-cells': >>>>>>>       const: 1 >>>>>>>   >>>>>>> @@ -128,6 +140,7 @@ patternProperties: >>>>>>>             - custom-output-range-config >>>>>>>   >>>>>>>   allOf: >>>>>>> +  - $ref: /schemas/spi/spi-peripheral-props.yaml# >>>>>>>     - if: >>>>>>>         properties: >>>>>>>           compatible: >>>>>>> @@ -238,4 +251,33 @@ examples: >>>>>>>               }; >>>>>>>           }; >>>>>>>       }; >>>>>>> + >>>>>>> +  - | >>>>>>> +    axi_dac: spi@44a70000 { >>>>>>> +        compatible = "adi,axi-ad3552r"; >>>>>> That is either redundant or entire example should go to the parent >>>>>> node, >>>>>> if this device is fixed child of complex device (IOW, adi,ad3552r >>>>>> cannot >>>>>> be used outside of adi,axi-ad3552r). >>>>> >>>>> ad3552r can still be used by a generic "classic" spi >>>>> controller (SCLK/CS/MISO) but at a slower samplerate, fpga >>>>> controller only (axi-ad3552r) can reach 33MUPS. >>>> >>>> OK, then this is just redundant. Drop the node. Parent example should >>>> contain the children, though. >>>>> >>>>>> >>>>>>> +        reg = <0x44a70000 0x1000>; >>>>>>> +        dmas = <&dac_tx_dma 0>; >>>>>>> +        dma-names = "tx"; >>>>>>> +        #io-backend-cells = <0>; >>>>>>> +        clocks = <&ref_clk>; >>>>>>> + >>>>>>> +        #address-cells = <1>; >>>>>>> +        #size-cells = <0>; >>>>>>> + >>>>>>> +        dac@0 { >>>>>>> +            compatible = "adi,ad3552r"; >>>>>>> +            reg = <0>; >>>>>>> +            reset-gpios = <&gpio0 92 0>; >>>>>> Use standard defines for GPIO flags. >>>>> >>>>> fixed, thanks >>>>> >>>>>>> +            io-backends = <&axi_dac>; >>>>>> Why do you need to point to the parent? How much coupled are these >>>>>> devices? Child pointing to parent is not usually expected, because >>>>>> that's obvious. >>>>> >>>>> >>>>> "io-backends" is actually the way to refer to the backend module, >>>>> (used already for i.e. ad9739a), >>>>> it is needed because the backend is not only acting as spi-controller, >>>>> but is also providing some APIs for synchronization and bus setup >>>>> support. >>>> >>>> >>>> But if backend is the parent, then this is redundant. You can take it >>>> from the child-parent relationship. Is this pointing to other devices >>>> (non-parent) in other ad3552r configurations? >>>> >>> >>> The backend is a provider-consumer type of API. On the consumer side (which >>> is the >>> driver the child node will probe on), we need to call devm_iio_backend_get() >>> to get >>> the backend object (which obviously is the parent). For that, 'io-backends' >>> is being >> >> You described the driver, so how does it matter? Driver can call >> get_backend_from_parent(), right? Or get_backend_from_fwnode(parent)? > > Well yes, just stating what the framework (also in terms of bindings) is > expecting. Of course that on the driver side we can paper around it the way we > want. But my main point was that we can only paper around it if we use code that > is meant not to be used. > > And, FWIW, I was (trying) replying to your comment > > "You can take it from the child-parent relationship" > > Again, we can only do that by introducing new code or use code that's not meant > to be used. The way we're supposed to reference backends is by explicitly using > the proper FW property. > > Put it in another way and a completely hypothetical case. If we have a spi > controller which happens to export some clock and one of it's peripherals ends > up using that clock, wouldn't we still use 'clocks' to reference that clock? I asked how coupled are these devices. Never got the answer and you are reflecting with question. Depends. Please do not create hypothetical, generic scenarios and then apply them to your one particular opposite case. Best regards, Krzysztof