linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sameer Pujar <spujar@nvidia.com>
To: <broonie@kernel.org>, <robh@kernel.org>
Cc: <jonathanh@nvidia.com>, <kuninori.morimoto.gx@renesas.com>,
	<alsa-devel@alsa-project.org>, <devicetree@vger.kernel.org>,
	<linux-kernel@vger.kernel.org>, Sameer Pujar <spujar@nvidia.com>
Subject: [RFC PATCH 3/5] ASoC: audio-graph-card: Add bindings for sysclk and pll
Date: Thu, 25 Feb 2021 23:36:02 +0530	[thread overview]
Message-ID: <1614276364-13655-4-git-send-email-spujar@nvidia.com> (raw)
In-Reply-To: <1614276364-13655-1-git-send-email-spujar@nvidia.com>

ASoC core provides callbacks snd_soc_dai_set_sysclk() and
snd_soc_dai_set_pll() for system clock (sysclk) and pll configurations
respectively. Add bindings for flexible sysclk or pll configurations
which can be driven from CPU/Codec DAI or endpoint subnode from DT.
This in turn helps to avoid hard codings in driver and makes it more
generic.

Also add system-clock related bindings, "system-clock-direction-out"
and "system-clock-frequency", which are already supported.

Cc: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Cc: Rob Herring <robh@kernel.org>
Signed-off-by: Sameer Pujar <spujar@nvidia.com>
---
 .../bindings/sound/audio-graph-port.yaml           | 71 ++++++++++++++++++++++
 1 file changed, 71 insertions(+)

diff --git a/Documentation/devicetree/bindings/sound/audio-graph-port.yaml b/Documentation/devicetree/bindings/sound/audio-graph-port.yaml
index 766e910..4f50291 100644
--- a/Documentation/devicetree/bindings/sound/audio-graph-port.yaml
+++ b/Documentation/devicetree/bindings/sound/audio-graph-port.yaml
@@ -71,6 +71,77 @@ properties:
             description: CPU to Codec rate channels.
             $ref: /schemas/types.yaml#/definitions/uint32
 
+          system-clock-frequency:
+            description: |
+              Specify system clock (sysclk) frequency for CPU or Codec
+              component. Or if a clock is specified in the CPU or Codec
+              device node and a scaling factor is given with "mclk-fs",
+              sysclk will be calculated as a multiple of stream sample
+              rate and "mclk-fs". The rate is updated when stream starts.
+            $ref: /schemas/types.yaml#/definitions/uint32
+
+          system-clock-direction-out:
+            description: |
+              Specifies clock direction as "out" on initialization. It
+              is useful for some CPUs with fixed clocks.
+            $ref: /schemas/types.yaml#/definitions/flag
+
+          system-clock-id:
+            description: |
+              CPU or Codec component may have multiple clocks. A specific
+              clock may have to be configured. In such cases the clock
+              ID needs to be specified.
+            $ref: /schemas/types.yaml#/definitions/uint32
+
+          system-clock-source:
+            description: |
+              CPU or Codec component may have multiple sources for its
+              system clock (sysclk). In such cases the sysclk source
+              needs to be specified.
+            $ref: /schemas/types.yaml#/definitions/uint32
+
+          pll-id:
+            description: |
+              Specify PLL that needs to be configured. This is useful
+              when the CPU or Codec component has multiple PLLs.
+            $ref: /schemas/types.yaml#/definitions/uint32
+
+          pll-source:
+            description: |
+              When PLL has multiple reference clock sources, the exact
+              source needs to be specified for the required configuration.
+            $ref: /schemas/types.yaml#/definitions/uint32
+
+          pll-input-reference:
+            description: |
+              Specify how to calculate input frequency for the PLL.
+              Depending on the identifier, input frequency can be
+              calculated at runtime. For example if I2S bit clock is used
+              as reference, rate depends on actual PCM parameters (rate,
+              channels and bits) during an audio session. If a fixed rate
+              is used, then "pll-input-frequency" can be used instead.
+            $ref: /schemas/types.yaml#/definitions/uint32
+            const: 2
+
+          pll-input-frequency:
+            description: Specify fixed input frequency
+            $ref: /schemas/types.yaml#/definitions/uint32
+
+          pll-output-reference:
+            description: |
+              Specify how to calculate output frequency for the PLL.
+              Depending on the identifier, output frequency can be
+              calculated at runtime. If output clock is used for MCLK purpose,
+              then it may depend on "mclk-fs" scale factor. In such cases it
+              needs to be calculated at runtime. If a fixed output frequency
+              is needed, then "pll-output-frequency" can be used instead.
+            $ref: /schemas/types.yaml#/definitions/uint32
+            const: 1
+
+          pll-output-frequency:
+            description: Specify fixed output frequency
+            $ref: /schemas/types.yaml#/definitions/uint32
+
   ports:
     description: multi OF-Graph subnode
     type: object
-- 
2.7.4


  parent reply	other threads:[~2021-02-25 18:09 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-25 18:05 [RFC PATCH 0/5] Flexible sysclk/pll configuration Sameer Pujar
2021-02-25 18:06 ` [RFC PATCH 1/5] ASoC: soc-component: Fix return value of snd_soc_component_set_pll() Sameer Pujar
2021-02-25 18:06 ` [RFC PATCH 2/5] ASoC: soc-dai: Add sysclk source to snd_soc_dai_set_sysclk() Sameer Pujar
2021-02-25 18:06 ` Sameer Pujar [this message]
2021-03-02  2:10   ` [RFC PATCH 3/5] ASoC: audio-graph-card: Add bindings for sysclk and pll Rob Herring
2021-03-02  7:03     ` Sameer Pujar
2021-03-02 16:12       ` Mark Brown
2021-02-25 18:06 ` [RFC PATCH 4/5] ASoC: simple-card-utils: Parse sysclk id and source Sameer Pujar
2021-02-25 18:06 ` [RFC PATCH 5/5] ASoC: simple-card-utils: Support pll configuration Sameer Pujar
2021-02-26  5:24 ` [RFC PATCH 0/5] Flexible sysclk/pll configuration Sameer Pujar

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1614276364-13655-4-git-send-email-spujar@nvidia.com \
    --to=spujar@nvidia.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=jonathanh@nvidia.com \
    --cc=kuninori.morimoto.gx@renesas.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=robh@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).