Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp5602145pxb; Mon, 28 Mar 2022 14:49:44 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwbQGBlk0/JnnFrqvoRNX0/kQWf3WTW/rCJF1UA59XV7F5oDWBB8VqRcdLO7QYYgKc1YDqE X-Received: by 2002:a05:6870:e99f:b0:dd:9ac0:309e with SMTP id r31-20020a056870e99f00b000dd9ac0309emr596667oao.123.1648504184352; Mon, 28 Mar 2022 14:49:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1648504184; cv=none; d=google.com; s=arc-20160816; b=C+T0SU6LcwvL+6v8g40ZDAMO+Pl+mgGPUurdCciOc5i9Uz7TuaXUyPLdIPi/FSq5eh EBDNSLsuD7GxPHrddNhcGMIiUtYPJIXHoVYbTTq0wHpNRewZxtkAgeDn8DdD/3nXnNMw gtYNl0jt7JqkJxgGup2BRlwQ3KuqbQUQ/IrJSFinxvKFE7HgcZ6ZScQGqqBhNKDDt0Ks AUnFoMjOjm7EtG79A4XlVFn6nTOqJdex0WeSutlknbxtB8hhn4d2oF3mhpBLCiJH8rVS NPx2lmPl1OMc9YCGVOXaXxfdLwXC8LlHFz2QtbdsA3ofNiS7Ei0SAq8lIpOcUnTprBUA Oh8Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id; bh=uLvcnNGD7orwMt3H7FvAzNbV1+jVVtO3wV/gzqZo0EQ=; b=MV6zNcvUiyxOekDIGG3pOn/l7mMa2iGawLWoLid01vHoB3zPG3+K5vgAiiRb63vMFu jKw0K3dr5eUdKXRIuR4M155ibWnoEKrPlgUeQC1mSWl44dvWJBHwCjO1UN/cSBBsc/bL ADcznhQo3E8EGIEHDgRPf+6iNJIxHWvC6N4QSA6WsRNIKk+OduFDpo93u/ulYubwd/Nl xNS6ch1Q8fAiWfbBya/IFr1SSerTwZkqtHlHtx2tf4MB4ZWc6i9SHy+Iwihzf5reYCnW qvUdvIv0NJ/VrnqYKSDh3dEzKzJvEhH5WEIssNndWAlde1eIbKJ19BBKQ/ndHnMO3+uv bolQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 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 lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id f14-20020a056830204e00b005c43e2627e2si11359229otp.1.2022.03.28.14.49.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 28 Mar 2022 14:49:44 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 7EA51118618; Mon, 28 Mar 2022 14:21:34 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243216AbiC1Nas (ORCPT + 99 others); Mon, 28 Mar 2022 09:30:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33022 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243240AbiC1Nap (ORCPT ); Mon, 28 Mar 2022 09:30:45 -0400 Received: from mail-wm1-f41.google.com (mail-wm1-f41.google.com [209.85.128.41]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D62FB5E167; Mon, 28 Mar 2022 06:29:02 -0700 (PDT) Received: by mail-wm1-f41.google.com with SMTP id r64so8393568wmr.4; Mon, 28 Mar 2022 06:29:02 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent:subject :content-language:to:cc:references:from:in-reply-to :content-transfer-encoding; bh=uLvcnNGD7orwMt3H7FvAzNbV1+jVVtO3wV/gzqZo0EQ=; b=dyHP+PwLbxiYYVnxiHYNbDIWC8X79p6vkPrgpbflAwQVgIC7U881QRdLBrPekkO3EA ZXqpZbE21r2rGaPJ/zebhvw33HIGV3jlrEbYsa5kiqxNCw6RIEdTkhZvfQnKuXbtbN+M PX1Ti6VrlyzlTjkE9ogkDvEPCKqYMYibCGy9ZHl5iX2azy/ANM66lKsX7SskS5PKunlj hECzY88l71xgbu5mos2IKUb6nYZUbzTNK4BO6Vt3rg8yhj7M0mOP8M5JkVLoqbHG4kNZ S3D0TlXj9hB68YTNiBy2PcuLD8bCj6NZ5pEzvYe8QZ1vltf1U982g7wmypYbC2g7jTSd q9ig== X-Gm-Message-State: AOAM5330+op9inXcO9vC9VJbeEpzrO9AxUOQCnp0WdL1WpimQCqDc8Z2 aiC/80VhwArod9aDniS80gc= X-Received: by 2002:a05:600c:2e02:b0:38c:8390:d8ca with SMTP id o2-20020a05600c2e0200b0038c8390d8camr26669786wmf.15.1648474141242; Mon, 28 Mar 2022 06:29:01 -0700 (PDT) Received: from [192.168.0.162] (xdsl-188-155-201-27.adslplus.ch. [188.155.201.27]) by smtp.googlemail.com with ESMTPSA id l9-20020a5d6d89000000b00203d62072c4sm13608526wrs.43.2022.03.28.06.28.59 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 28 Mar 2022 06:29:00 -0700 (PDT) Message-ID: Date: Mon, 28 Mar 2022 15:28:59 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.5.0 Subject: Re: [RFC PATCH v2 3/6] ASoC: dt-bindings: Extend clock bindings of rt5659 Content-Language: en-US To: Sameer Pujar , broonie@kernel.org, lgirdwood@gmail.com, robh+dt@kernel.org, krzk+dt@kernel.org, perex@perex.cz, tiwai@suse.com, peter.ujfalusi@linux.intel.com, pierre-louis.bossart@linux.intel.com Cc: oder_chiou@realtek.com, thierry.reding@gmail.com, jonathanh@nvidia.com, alsa-devel@alsa-project.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-tegra@vger.kernel.org References: <1648448050-15237-1-git-send-email-spujar@nvidia.com> <1648448050-15237-4-git-send-email-spujar@nvidia.com> <53d77f33-27e8-3446-d758-3e545eea2db4@nvidia.com> <5e4e11b5-02b8-e03e-2924-c9f2882921be@kernel.org> From: Krzysztof Kozlowski In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,MAILING_LIST_MULTI, NICE_REPLY_A,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 28/03/2022 15:19, Sameer Pujar wrote: > > On 28-03-2022 13:37, Krzysztof Kozlowski wrote: >> On 28/03/2022 09:58, Sameer Pujar wrote: >>> On 28-03-2022 12:36, Krzysztof Kozlowski wrote: >>>> External email: Use caution opening links or attachments >>>> >>>> >>>> On 28/03/2022 08:14, Sameer Pujar wrote: >>>>> The rt5658 or rt5659 CODEC system clock (SYSCLK) can be derived from >>>>> various clock sources. For example it can be derived either from master >>>>> clock (MCLK) or by internal PLL. The internal PLL again can take input >>>>> clock references from bit clocks (BCLKs) and MCLK. To enable a flexible >>>>> clocking configuration the DT binding is extended here. >>>>> >>>>> It makes use of standard clock bindings and sets up the clock relation >>>>> via DT. >>>>> >>>>> Signed-off-by: Sameer Pujar >>>>> Cc: Oder Chiou >>>>> --- >>>>> .../devicetree/bindings/sound/realtek,rt5659.yaml | 53 ++++++++++++++++++++-- >>>>> 1 file changed, 49 insertions(+), 4 deletions(-) >>>>> >>>>> diff --git a/Documentation/devicetree/bindings/sound/realtek,rt5659.yaml b/Documentation/devicetree/bindings/sound/realtek,rt5659.yaml >>>>> index b0485b8..0c2f3cb 100644 >>>>> --- a/Documentation/devicetree/bindings/sound/realtek,rt5659.yaml >>>>> +++ b/Documentation/devicetree/bindings/sound/realtek,rt5659.yaml >>>>> @@ -29,12 +29,28 @@ properties: >>>>> maxItems: 1 >>>>> >>>>> clocks: >>>>> - items: >>>>> - - description: Master clock (MCLK) to the CODEC >>>>> + description: | >>>>> + CODEC can receive multiple clock inputs like Master >>>>> + clock (MCLK), I2S bit clocks (BCLK1, BCLK2, BCLK3, >>>>> + BCLK4). The CODEC SYSCLK can be generated from MCLK >>>>> + or internal PLL. In turn PLL can reference from MCLK >>>>> + and BCLKs. >>>>> >>>>> clock-names: >>>>> - items: >>>>> - - const: mclk >>>>> + description: | >>>>> + The clock names can be combination of following: >>>>> + "mclk" : Master clock >>>>> + "pll_ref" : Reference to CODEC PLL clock >>>>> + "sysclk" : CODEC SYSCLK >>>>> + "^bclk[1-4]$" : Bit clocks to CODEC >>>> No, that does not look correct. You allow anything as clock input (even >>>> 20 clocks, different names, any order). That's not how DT schema should >>>> work and that's not how hardware looks like. >>>> Usually the clock inputs are always there which also you mentioned in >>>> description - "multiple clock inputs". All these clocks should be >>>> expected, unless really the wires (physical wires) can be left disconnected. >>> The CODEC can receive multiple clocks but all the input clocks need not >>> be present or connected always. If a specific configuration is needed >>> and platform supports such an input, then all these inputs can be added. >>> I don't know how to define this detail in the schema. If I make all of >>> them expected, then binding check throws errors. If I were to list all >>> the possible combinations, the list is going to be big (not sure if this >>> would be OK?). >> Thanks for explanation. Please differentiate between these two: >> 1. clock inputs connected, but unused (not needed for driver or for >> particular use case), >> 2. clock inputs really not connected. >> >> For the 1. above, such clock inputs should still be listed in the >> bindings and DTS. For the 2. above, such clocks should actually not be >> there. > > Thank you for the suggestion. > >> How to achieve this depends on number of your combinations. IOW, >> how many clocks are physically optional. > > From CODEC point of view all these clock inputs are possible and a > platform may choose to connect a subset of it depending on the > application. The binding is expected to support all such cases. To > support all possibilities, the total combinations can be very big (100+). > >> For some small number of >> variations this can be: >> oneOf: >> - const: mclk >> - items: >> - const: mclk >> - enum: >> - bclk1 >> - bclk2 >> - bclk3 >> - bclk4 >> - items: >> - const: mclk >> - const: pll_ref >> - enum: >> - bclk1 >> - bclk2 >> - bclk3 >> - bclk4 >> >> For a total flexibility that any clock input can be disconnected, this >> should be a list of enums I guess (with minItems). However please find >> the clocks always connected and include them if possible in a fixed way >> (like this oneOf above). > > May be I can list the most commonly required combinations like below and > extend it whenever there is a need for specific combination? Yes, this would work. Relaxing such constraints is possible. Best regards, Krzysztof