Received: by 2002:a5d:925a:0:0:0:0:0 with SMTP id e26csp561510iol; Thu, 9 Jun 2022 09:06:27 -0700 (PDT) X-Google-Smtp-Source: ABdhPJypPWM5zwd2PUDLxtXirP2zzVPPyx53dxQk1QPVhP1gI0Peq6IaZNyGZzYfj8cLVdPf/ftc X-Received: by 2002:a17:902:b7c3:b0:167:7ca8:7f24 with SMTP id v3-20020a170902b7c300b001677ca87f24mr22063933plz.51.1654790787043; Thu, 09 Jun 2022 09:06:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654790787; cv=none; d=google.com; s=arc-20160816; b=mM03P/hflmaeRSKga5CM8XsSaNVO9VFRRA2EweyrWPwIR6lnCgr4858GobTmMq4Odk v2PlZrGl+xQReGq/oQPkFih2a4gdvRx8kuYuKtJxo+egIqR4uwUpzIkR8sYJKAHOKrrR dQ1AKPcK3+YeDWuaxWcpEjnVhzqA1hTRB/Y60+82LFoJH8mZpdgMs7pMJzNbJwomM22c qFh4em+nH39WZbeu6NvpPN53fet80FDW4J2chTKWQSQMpxlxw58ZvgpLY9YwMl4fR2nw Zzq1w/oIvBdIhJMl+bRDy9ULTL8AQPqWQKN6qYu4In99DYCUtJl/9pM/F0whAHfPMGGc eFKQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:to:references:message-id :content-transfer-encoding:cc:date:in-reply-to:from:subject :mime-version:dkim-signature; bh=tALHUrTOMSE2jyi1V2Vz4netgKaq9LwC6aSHlEUoNCQ=; b=v2g3R0VRtpWDWRwgDmf+hHOTQLpHStyDxKjsWLREXgH6X3yePnCqAbDRQAbcVEE8MH IHFnwfRxdG8QYWsO/uqk5h/gR38qHCeRO1HSsTOv6wrFKTWGAJTjyCiC7XUJTLzMYMO3 gYqm3EJv2tavetplsDURmy1wLTlIan9pONQlOzpghIzqox2cKz3MM/5G4i4OF1GHs5Pa V/cqAM8FC+AGwK1RkRzz58If87RCEqOOzd4cbx+RFUOrXecRUvhmtnZBsU/kuyg2Qs44 1o7pTmk8XfjUwZ9k3pdEAeJHSmE4yYnYQ0KINxQaCNDf4ehFBVJ/FpF1hcH5c0G9FK+X Mp3Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@cutebit.org header.s=mail header.b=N2XIV2T7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=cutebit.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id oj2-20020a17090b4d8200b001e82e1ec1adsi26165893pjb.3.2022.06.09.09.05.56; Thu, 09 Jun 2022 09:06:26 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@cutebit.org header.s=mail header.b=N2XIV2T7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=cutebit.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344483AbiFIP1X (ORCPT + 99 others); Thu, 9 Jun 2022 11:27:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35450 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344419AbiFIP1V (ORCPT ); Thu, 9 Jun 2022 11:27:21 -0400 Received: from hutie.ust.cz (unknown [IPv6:2a03:3b40:fe:f0::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 251CA2CDC1; Thu, 9 Jun 2022 08:27:16 -0700 (PDT) Content-Type: text/plain; charset=utf-8 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cutebit.org; s=mail; t=1654788433; bh=tALHUrTOMSE2jyi1V2Vz4netgKaq9LwC6aSHlEUoNCQ=; h=Subject:From:In-Reply-To:Date:Cc:References:To; b=N2XIV2T7wzMQm8Zsocz031ygN/7fCfeKvkIJIfo7sFoe5ROn34/ORCn1pzggJdOQf hg60OOlz9D+EuA2Knk9b1qFrtn6/zSDrXarDHfHqmwaeHdo8vfJllnnh5INpeE6SXJ rZzElq51cuoAyHVf/Hnkt/un+Bz+L6RhXR2imqfI= Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3696.80.82.1.1\)) Subject: Re: [RFC PATCH v2 5/5] ASoC: apple: Add macaudio machine driver From: =?utf-8?Q?Martin_Povi=C5=A1er?= In-Reply-To: Date: Thu, 9 Jun 2022 17:27:12 +0200 Cc: Liam Girdwood , Rob Herring , Krzysztof Kozlowski , Jaroslav Kysela , Takashi Iwai , alsa-devel@alsa-project.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Mark Kettenis , Hector Martin , Sven Peter , asahi@lists.linux.dev Content-Transfer-Encoding: quoted-printable Message-Id: <7F1B2324-4376-4776-BA6D-FBC8892F10C2@cutebit.org> References: <20220606191910.16580-1-povik+lin@cutebit.org> <20220606191910.16580-6-povik+lin@cutebit.org> <8961DDD2-93FF-4A18-BCA2-90FCE298F517@cutebit.org> To: Mark Brown X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_FAIL,SPF_HELO_NONE, T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED 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 9. 6. 2022, at 17:16, Mark Brown wrote: >=20 > On Thu, Jun 09, 2022 at 04:09:57PM +0200, Martin Povi=C5=A1er wrote: >>> On 9. 6. 2022, at 15:33, Mark Brown wrote: >=20 >>>> + /* >>>> + * Primary FE >>>> + * >>>> + * The mclk/fs ratio at 64 for the primary frontend is = important >>>> + * to ensure that the headphones codec's idea of left = and right >>>> + * in a stereo stream over I2S fits in nicely with = everyone else's. >>>> + * (This is until the headphones codec's driver supports >>>> + * set_tdm_slot.) >>>> + * >>>> + * The low mclk/fs ratio precludes transmitting more = than two >>>> + * channels over I2S, but that's okay since there is the = secondary >>>> + * FE for speaker arrays anyway. >>>> + */ >>>> + .mclk_fs =3D 64, >>>> + }, >=20 >>> This seems weird - it looks like it's confusing MCLK and the bit = clock >>> for the audio bus. These are two different clocks. Note that it's = very >>> common for devices to require a higher MCLK/fs ratio to deliver the = best >>> audio performance, 256fs is standard. >=20 >> On these machines we are not producing any other clock for the codecs >> besides the bit clock, so I am using MCLK interchangeably for it. (It = is >> what the sample rate is derived from after all.) >=20 > Please don't do this, you're just making everything needlessly hard to > understand by using standard terminology inappropriately and there's a > risk of breakage further down the line with drivers implementing the > standard ops. OK >> One of the codec drivers this is to be used with (cs42l42) expects to = be >> given the I2S bit clock with >=20 >> snd_soc_dai_set_sysclk(dai, 0, mclk, SND_SOC_CLOCK_IN); >=20 > That's very, very non-standard... >=20 >> I can rename mclk to bclk in all of the code to make it clearer = maybe. >> Also the platform driver can take the bit clock value from = set_bclk_ratio, >> instead of set_sysclk from where it takes it now. The cs42l42 driver = I can >> patch too to accept set_bclk_ratio. >=20 > ...indeed, set_bclk_ratio() is a better interface for setting the bclk > ratio - the CODEC driver should really be doing that as well. OK, adding that to my TODOs. >>> This shouldn't be open coded in a driver, please factor it out into = the >>> core so we've got an API for "set limit X on control Y" then call = that. >=20 >> There=E2=80=99s already snd_soc_limit_volume, but it takes a fixed = control name. >> Can I extend it to understand patterns beginning with a wildcard, = like >> '* Amp Gain Volume=E2=80=99? >=20 > Or add a new call that does that. OK