From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0E1FDC77B7C for ; Thu, 11 May 2023 17:58:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239081AbjEKR61 (ORCPT ); Thu, 11 May 2023 13:58:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50314 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239093AbjEKR6I (ORCPT ); Thu, 11 May 2023 13:58:08 -0400 Received: from mail-ej1-x629.google.com (mail-ej1-x629.google.com [IPv6:2a00:1450:4864:20::629]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4CC11A24A for ; Thu, 11 May 2023 10:57:45 -0700 (PDT) Received: by mail-ej1-x629.google.com with SMTP id a640c23a62f3a-9661047f8b8so1232008966b.0 for ; Thu, 11 May 2023 10:57:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1683827862; x=1686419862; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=KKEWKy4QsgEP6Phxafvcaa/nk7o4U4bQeym+7fv4t84=; b=dxc9baUC6WhtT9/YH80Q5hWdOF98PVdFTsDiFwUaP4ZAZECOdsk4dUleu/VKs7W+rU cGzxrfVHuxZCfHjNv59oXotQ1x1X+SZE1i4CdPll9Ct+0J6YHP+r/gVSf2SVWEDbw2PI VDmHW8kvLjURCuVuitM5NAlb7BKLhsd3jUZPkG70RO28Q+fCCYG3ioGD4XU2XZozrQ2T ZwrF+tW2r5n0xAgYIkBrsU0ylfqkdH9JgxKsWa8gwE9SdICFTHBQJ/YmJTYTQDmwbEiv hN3XRYNVxP9XVTH1qLPAKSBH2UB697r1x9zPDA97RunKTDawO4CqAxS0mcE/Qc03K6tF y1gQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1683827862; x=1686419862; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=KKEWKy4QsgEP6Phxafvcaa/nk7o4U4bQeym+7fv4t84=; b=BARtCGaT9h/Ll1tsy5RnNKXUhH+p0ZFAYmUKVfU5akEdBK5CaatJxO1OB2p+wiha1z P3JjNs5RzpuB4arGJrPVPM29OyrXqgm7mi+7G3fmELNUQgXpQjgZPbL2uzHBTLFBcV88 bhaZ47buip+huB+CkHZASnjxoe5M06q6uf9vr5+EeFKlcvsEI6bBbhrGuKd+LF+dMv7/ N4kvsN/PJqCXTstO/yP0AYcDGD5unP+JZtysgDEgyB2mf5gdEOBLcfVXMLp2bNTkcOeH cBlavLFeyIenWc8LqcZDS+64ebbWwwpfAlmMc+gawhm/ENaUez0rlPSVXxmRyDxTB/KP 8DrQ== X-Gm-Message-State: AC+VfDymZZV4FLO2bNqODabFbOCKAqd08+p4+MB4wz3CRnhk13Jlv3d/ 0TEFh0E4m3yEhaqY43SlzXGMtg== X-Google-Smtp-Source: ACHHUZ6ZNYNy8A+C05L0Pkvx8jTChxFxNF9aHHsbShC3/zp+v6BL8/lv3zW1fvRU9umtfIqfzDbPsA== X-Received: by 2002:a17:907:7b9c:b0:966:7a0a:28c0 with SMTP id ne28-20020a1709077b9c00b009667a0a28c0mr15820879ejc.58.1683827862247; Thu, 11 May 2023 10:57:42 -0700 (PDT) Received: from ?IPV6:2a02:810d:15c0:828:d7cd:1be6:f89d:7218? ([2a02:810d:15c0:828:d7cd:1be6:f89d:7218]) by smtp.gmail.com with ESMTPSA id nr1-20020a1709068b8100b0094f1b8901e1sm4351538ejc.68.2023.05.11.10.57.41 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 11 May 2023 10:57:41 -0700 (PDT) Message-ID: <3c131132-35ce-e5da-2608-36d53abc6c83@linaro.org> Date: Thu, 11 May 2023 19:57:40 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.11.0 Subject: Re: [PATCH v1 3/3] dt-bindings: ASoC: Add ESS ES9218P codec bindings Content-Language: en-US To: Aidan MacDonald Cc: lgirdwood@gmail.com, broonie@kernel.org, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, conor+dt@kernel.org, perex@perex.cz, tiwai@suse.com, alsa-devel@alsa-project.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org References: <20230510112349.939991-1-aidanmacdonald.0x0@gmail.com> <20230510112349.939991-3-aidanmacdonald.0x0@gmail.com> <7b3a37e8-0210-c539-5b5b-bf8e587707ea@linaro.org> <7Zga7RBqLNcaG5ylTIY4Qn7CUdE1IJsW@localhost> <8e98b31a-ef4d-a8bd-32f3-e6f496f2b138@linaro.org> From: Krzysztof Kozlowski In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org On 11/05/2023 13:26, Aidan MacDonald wrote: > > Krzysztof Kozlowski writes: > >> On 11/05/2023 12:15, Aidan MacDonald wrote: >>> >>> Krzysztof Kozlowski writes: >>> >>>> On 10/05/2023 13:23, Aidan MacDonald wrote: >>>>> ... >>>>> + ess,max-clock-div: >>>>> + $ref: /schemas/types.yaml#/definitions/uint32 >>>>> + description: >>>>> + Sets the maximum MCLK divider for generating the internal CLK. >>>>> + CLK must be at least 20x the I2C bus speed or I2C transactions >>>>> + will fail. The maximum divider should be chosen to ensure that >>>>> + CLK will not fall below the limit. >>>>> + enum: >>>>> + - 1 >>>>> + - 2 >>>>> + - 4 >>>>> + - 8 >>>>> + default: 1 >>>> >>>> Why do you need to customize it per board? >>>> >>> >>> There's no generic API to read or change the bus speed (SCL frequency) >>> for I2C adapters, so it's impossible to calculate a limit on the MCLK >>> divider automatically. >>> >>> Defaulting to 1 is always safe, but means wasting power at lower sample >>> rates. If you know what the bus speed is you can use a higher divider >>> limit to save power, and it has to be done at the board/firmware level >>> because that's the only place where the bus speed is known. >> >> If I understand correctly, you only miss a way to get bus_freq_hz from >> i2c_timings to calculate the divider by yourself? This looks like Linux >> limitation, so we shouldn't push it into DT, but rather fix Linux. The >> I2C bus rate is known, the MCLK rate as well, so divider is possible to >> deduce. >> >> I am actually surprised that I2C core does not store the timings >> anywhere and each bus host has to deal with it on its own. >> >> Best regards, >> Krzysztof > > I agree it'd be better if Linux provided access the bus frequency, but > even if that API was added it will take time for every I2C adapter to > support it. So in that case we would still need a DT property to provide > a safe limit or use a safe default, and miss potential power savings. > > I'd prefer to add the DT property to allow power savings to be had now, > and drop it if/when the kernel gets an API for bus frequency. That will > be safe from a compatibility point of view -- the property won't be > providing any useful information so it won't matter if old DTs have it. OK, sounds good. Best regards, Krzysztof