public inbox for linux-mediatek@lists.infradead.org
 help / color / mirror / Atom feed
From: Alexandre Mergnat <amergnat@baylibre.com>
To: "Krzysztof Kozlowski" <krzysztof.kozlowski@linaro.org>,
	"Liam Girdwood" <lgirdwood@gmail.com>,
	"Mark Brown" <broonie@kernel.org>,
	"Rob Herring" <robh+dt@kernel.org>,
	"Krzysztof Kozlowski" <krzysztof.kozlowski+dt@linaro.org>,
	"Conor Dooley" <conor+dt@kernel.org>,
	"Matthias Brugger" <matthias.bgg@gmail.com>,
	"AngeloGioacchino Del Regno"
	<angelogioacchino.delregno@collabora.com>,
	"Lee Jones" <lee@kernel.org>, "Flora Fu" <flora.fu@mediatek.com>,
	"Jaroslav Kysela" <perex@perex.cz>,
	"Takashi Iwai" <tiwai@suse.com>,
	"Sumit Semwal" <sumit.semwal@linaro.org>,
	"Christian König" <christian.koenig@amd.com>,
	"Catalin Marinas" <catalin.marinas@arm.com>,
	"Will Deacon" <will@kernel.org>
Cc: linux-sound@vger.kernel.org, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	linux-mediatek@lists.infradead.org, linux-media@vger.kernel.org,
	dri-devel@lists.freedesktop.org, linaro-mm-sig@lists.linaro.org
Subject: Re: [PATCH 01/18] ASoC: dt-bindings: mediatek,mt8365-afe: Add audio afe document
Date: Tue, 27 Feb 2024 16:18:32 +0100	[thread overview]
Message-ID: <eeb3329b-0558-4237-8343-4e11f65a6a35@baylibre.com> (raw)
In-Reply-To: <ce5f71a9-1b5f-4724-89db-dae2f64e8008@linaro.org>



On 27/02/2024 10:01, Krzysztof Kozlowski wrote:
> On 26/02/2024 15:01, Alexandre Mergnat wrote:
>> Add MT8365 audio front-end bindings
>>
>> Signed-off-by: Alexandre Mergnat <amergnat@baylibre.com>
>> ---
>>   .../bindings/sound/mediatek,mt8365-afe.yaml        | 164 +++++++++++++++++++++
>>   1 file changed, 164 insertions(+)
>>
>> diff --git a/Documentation/devicetree/bindings/sound/mediatek,mt8365-afe.yaml b/Documentation/devicetree/bindings/sound/mediatek,mt8365-afe.yaml
>> new file mode 100644
>> index 000000000000..1d7eb2532ad2
>> --- /dev/null
>> +++ b/Documentation/devicetree/bindings/sound/mediatek,mt8365-afe.yaml
>> @@ -0,0 +1,164 @@
>> +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
>> +%YAML 1.2
>> +---
>> +$id: http://devicetree.org/schemas/sound/mediatek,mt8365-afe.yaml#
>> +$schema: http://devicetree.org/meta-schemas/core.yaml#
>> +
>> +title: MediaTek AFE PCM controller for MT8365
>> +
>> +maintainers:
>> +  - Alexandre Mergnat <amergnat@baylibre.com>
>> +
>> +properties:
>> +  compatible:
>> +    const: mediatek,mt8365-afe-pcm
>> +
>> +  reg:
>> +    maxItems: 2
> 
> You must describe the items.

Actually, I've took downstream code that I'm not able to explain because 
the second reg isn't on my MTK documentation.
So I've remove the second reg and passed all functional tests 
successfully. Then I will remove the extra reg for v2.

> 
>> +
>> +  interrupts:
>> +    maxItems: 1
>> +
>> +  mediatek,topckgen:
>> +    $ref: /schemas/types.yaml#/definitions/phandle
>> +    description: The phandle of the mediatek topckgen controller
> 
> What for? Don't repeat the property name. Say something useful.

got it

> 
>> +
>> +  power-domains:
>> +    maxItems: 1
>> +
>> +  "#sound-dai-cells":
>> +    const: 0
>> +
>> +  clocks:
>> +    items:
>> +      - description: 26M clock
>> +      - description: mux for audio clock
>> +      - description: audio i2s0 mck
>> +      - description: audio i2s1 mck
>> +      - description: audio i2s2 mck
>> +      - description: audio i2s3 mck
>> +      - description: engen 1 clock
>> +      - description: engen 2 clock
>> +      - description: audio 1 clock
>> +      - description: audio 2 clock
>> +      - description: mux for i2s0
>> +      - description: mux for i2s1
>> +      - description: mux for i2s2
>> +      - description: mux for i2s3
>> +
>> +  clock-names:
>> +    items:
>> +      - const: top_clk26m_clk
>> +      - const: top_audio_sel
>> +      - const: audio_i2s0_m
>> +      - const: audio_i2s1_m
>> +      - const: audio_i2s2_m
>> +      - const: audio_i2s3_m
>> +      - const: engen1
>> +      - const: engen2
>> +      - const: aud1
>> +      - const: aud2
>> +      - const: i2s0_m_sel
>> +      - const: i2s1_m_sel
>> +      - const: i2s2_m_sel
>> +      - const: i2s3_m_sel
>> +
>> +  mediatek,i2s-shared-clock:
> 
> Why do you need this property? Linux (and other systems) handle sharing
> clocks properly.

Indeed, not needed. It was used by the downstream code driver but I 
remove it for v2.

> 
>> +    description:
>> +      i2s modules can share the same external clock pin.
>> +      If this property is not present the clock mode is separrate.
> 
> Typo
> 
>> +    type: boolean
>> +
>> +  mediatek,dmic-iir-on:
>> +    description:
>> +      Boolean which specifies whether the DMIC IIR is enabled.
>> +      If this property is not present the IIR is disabled.
> 
> "is enabled" or "enable it"?
> 
> You described the desired Linux feature or behavior, not the actual
> hardware. The bindings are about the latter, so instead you need to
> rephrase the property and its description to match actual hardware
> capabilities/features/configuration etc.

I will rephrase:

True to enable the Infinite Impulse Response (IIR) filter
on the digital microphone inputs.

> 
>> +    type: boolean
>> +
>> +  mediatek,dmic-irr-mode:
>> +    $ref: /schemas/types.yaml#/definitions/uint32
>> +    description:
>> +      Selects stop band of IIR DC-removal filter.
>> +      0 = Software programmable custom coeff loaded by the driver.
> 
> Bindings are for hardware, not drivers. Why is this a property of board DTS?

Actually this is a hardware feature. Mode 1 t 5 are predefined filters. 
Mode 0, the HW will read some "coef filter registers" to setup the 
custom filter. the "coef filter regs" are written by the driver. 
Currently the coef values are hardcoded in the driver.

> 
>> +      1 = 5Hz if 48KHz mode.
>> +      2 = 10Hz if 48KHz mode.
>> +      3 = 25Hz if 48KHz mode.
>> +      4 = 50Hz if 48KHz mode.
>> +      5 = 65Hz if 48KHz mode.
> 
> Use proper unit suffixes - hz.
> 
> 
>> +    enum:
>> +      - 0
>> +      - 1
>> +      - 2
>> +      - 3
>> +      - 4
>> +      - 5
>> +
>> +  mediatek,dmic-two-wire-mode:
>> +    description:
>> +      Boolean which turns on digital microphone for two wire mode.
>> +      If this property is not present the two wire mode is disabled.
> 
> This looks like hardware property, but the naming looks like SW. Again
> you instruct what driver should do. Standard disclaimer:
> 
> You described the desired Linux feature or behavior, not the actual
> hardware. The bindings are about the latter, so instead you need to
> rephrase the property and its description to match actual hardware
> capabilities/features/configuration etc.

Actually this is a hardware feature. This is ALL I have to describe the 
HW behavior from the datasheet:
"
bit name: ul_dmic_two_wire_ctl
Turns on digital microphone for two wire mode.
0: Turn off
1: Turn on
"

On the board schematic, SoC and DMIC and linked by 3 pins:
- clk
- data0
- data1

IMHO, "two-wire-mode" means the HW use 2 pins for data, and the SoC must 
be aware of that by reading the register value written by the driver, 
using the value found in the DTS.

I don't get why you think it wouldn't be hardware behavior.

Rephrase description:
"True to enable the two wire mode of the digital microphone"
Is it better ?

About the property name, "mediatek,dmic-two-wire-ctl" sound better for you ?

> 
> 
>> +    type: boolean
>> +
>> +
> 
> Just one blank line.
> 
>> +required:
>> +  - compatible
>> +  - reg
>> +  - interrupts
>> +  - power-domains
>> +  - mediatek,topckgen
>> +  - clocks
>> +  - clock-names
>> +
>> +additionalProperties: false
>> +
>> +examples:
>> +  - |
>> +    #include <dt-bindings/clock/mediatek,mt8365-clk.h>
>> +    #include <dt-bindings/interrupt-controller/arm-gic.h>
>> +    #include <dt-bindings/interrupt-controller/irq.h>
>> +    #include <dt-bindings/power/mediatek,mt8365-power.h>
>> +
>> +    soc {
>> +        #address-cells = <2>;
>> +        #size-cells = <2>;
>> +
>> +        afe@11220000 {
> 
> What is AFE?

Audio Front End, this is the same name used for other MTK SoC, to be 
consistent.

Cook a new patch serie to change "afe" by "audio-controller" for all MTK 
SoC would be great.

> 
> https://devicetree-specification.readthedocs.io/en/latest/chapter2-devicetree-basics.html#generic-names-recommendation
> 
> 
>> +            compatible = "mediatek,mt8365-afe-pcm";
> 
> 
> Best regards,
> Krzysztof
> 

-- 
Regards,
Alexandre


  reply	other threads:[~2024-02-27 15:18 UTC|newest]

Thread overview: 59+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-26 14:01 [PATCH 00/18] Add audio support for the MediaTek Genio 350-evk board Alexandre Mergnat
2024-02-26 14:01 ` [PATCH 01/18] ASoC: dt-bindings: mediatek,mt8365-afe: Add audio afe document Alexandre Mergnat
2024-02-27  9:01   ` Krzysztof Kozlowski
2024-02-27 15:18     ` Alexandre Mergnat [this message]
2024-02-28  7:28       ` Krzysztof Kozlowski
2024-02-28  9:57         ` Alexandre Mergnat
2024-02-28 10:25           ` AngeloGioacchino Del Regno
2024-02-28 11:48             ` Alexandre Mergnat
2024-02-28 12:09             ` Krzysztof Kozlowski
2024-02-26 14:01 ` [PATCH 02/18] ASoC: dt-bindings: mediatek,mt8365-mt6357: Add audio sound card document Alexandre Mergnat
2024-02-26 15:30   ` AngeloGioacchino Del Regno
2024-02-27 10:23     ` Alexandre Mergnat
2024-02-27 10:31       ` Krzysztof Kozlowski
2024-02-27 12:38       ` AngeloGioacchino Del Regno
2024-02-28  9:18         ` Alexandre Mergnat
2024-02-27  9:06   ` Krzysztof Kozlowski
2024-02-26 14:01 ` [PATCH 03/18] dt-bindings: mfd: mediatek: Add codec property for MT6357 PMIC Alexandre Mergnat
2024-02-27  9:08   ` Krzysztof Kozlowski
2024-02-26 14:01 ` [PATCH 04/18] ASoC: mediatek: mt8365: Add common header Alexandre Mergnat
2024-02-26 14:01 ` [PATCH 05/18] SoC: mediatek: mt8365: support audio clock control Alexandre Mergnat
2024-02-26 14:01 ` [PATCH 06/18] ASoC: mediatek: mt8365: Add I2S DAI support Alexandre Mergnat
2024-02-26 14:01 ` [PATCH 07/18] ASoC: mediatek: mt8365: Add ADDA " Alexandre Mergnat
2024-02-26 14:01 ` [PATCH 08/18] ASoC: mediatek: mt8365: Add DMIC " Alexandre Mergnat
2024-02-27  9:10   ` Krzysztof Kozlowski
2024-02-26 14:01 ` [PATCH 09/18] ASoC: mediatek: mt8365: Add PCM " Alexandre Mergnat
2024-02-26 14:01 ` [PATCH 10/18] ASoc: mediatek: mt8365: Add a specific soundcard for EVK amergnat
2024-02-26 15:10   ` AngeloGioacchino Del Regno
2024-02-27  8:43   ` Krzysztof Kozlowski
2024-02-26 14:01 ` [PATCH 11/18] ASoC: mediatek: mt8365: Add platform driver Alexandre Mergnat
2024-02-27  8:50   ` Krzysztof Kozlowski
2024-02-26 14:01 ` [PATCH 12/18] ASoC: codecs: mt6357: add MT6357 codec amergnat
2024-02-26 15:25   ` AngeloGioacchino Del Regno
2024-03-12 14:50     ` Alexandre Mergnat
2024-03-12 14:54       ` AngeloGioacchino Del Regno
2024-02-26 16:09   ` Mark Brown
2024-03-12 18:03     ` Alexandre Mergnat
2024-03-13 17:23       ` Mark Brown
2024-03-15 11:01         ` Alexandre Mergnat
2024-03-15 14:30           ` Mark Brown
2024-03-15 15:05             ` Alexandre Mergnat
2024-03-15 15:15               ` Mark Brown
2024-03-15 17:36                 ` Alexandre Mergnat
2024-03-15 18:09                   ` Mark Brown
2024-03-13 17:11     ` Alexandre Mergnat
2024-03-13 17:24       ` Mark Brown
2024-02-26 14:01 ` [PATCH 13/18] mfd: mt6397-core: register mt6357 sound codec amergnat
2024-02-26 15:26   ` AngeloGioacchino Del Regno
2024-02-29 17:45   ` (subset) " Lee Jones
2024-02-26 14:01 ` [PATCH 14/18] ASoC: mediatek: Add MT8365 support Alexandre Mergnat
2024-02-26 14:01 ` [PATCH 15/18] arm64: defconfig: enable mt8365 sound Alexandre Mergnat
2024-02-26 14:01 ` [PATCH 16/18] arm64: dts: mediatek: add mt6357 audio codec support Alexandre Mergnat
2024-02-26 14:01 ` [PATCH 17/18] arm64: dts: mediatek: add afe support for mt8365 SoC Alexandre Mergnat
2024-02-26 14:01 ` [PATCH 18/18] arm64: dts: mediatek: add audio support for mt8365-evk Alexandre Mergnat
2024-02-26 14:54 ` [PATCH 00/18] Add audio support for the MediaTek Genio 350-evk board AngeloGioacchino Del Regno
2024-03-28 10:09   ` Alexandre Mergnat
2024-02-27 15:06 ` Mark Brown
2024-03-12  8:58   ` Alexandre Mergnat
2024-03-15 14:38     ` Mark Brown
2024-03-15 15:28       ` Alexandre Mergnat

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=eeb3329b-0558-4237-8343-4e11f65a6a35@baylibre.com \
    --to=amergnat@baylibre.com \
    --cc=angelogioacchino.delregno@collabora.com \
    --cc=broonie@kernel.org \
    --cc=catalin.marinas@arm.com \
    --cc=christian.koenig@amd.com \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=flora.fu@mediatek.com \
    --cc=krzysztof.kozlowski+dt@linaro.org \
    --cc=krzysztof.kozlowski@linaro.org \
    --cc=lee@kernel.org \
    --cc=lgirdwood@gmail.com \
    --cc=linaro-mm-sig@lists.linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=linux-sound@vger.kernel.org \
    --cc=matthias.bgg@gmail.com \
    --cc=perex@perex.cz \
    --cc=robh+dt@kernel.org \
    --cc=sumit.semwal@linaro.org \
    --cc=tiwai@suse.com \
    --cc=will@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