Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp982151pxb; Fri, 1 Apr 2022 01:03:38 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz1bSWwatbbAU3kyNf1qQJ2zB0kxz5sZd88PrJ5HPKmiud3IevqzqYuIZkXQgC9tgRdf7+b X-Received: by 2002:a05:6402:2816:b0:419:2a8e:6d3e with SMTP id h22-20020a056402281600b004192a8e6d3emr19678600ede.47.1648800218529; Fri, 01 Apr 2022 01:03:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1648800218; cv=none; d=google.com; s=arc-20160816; b=xgW65jM8VZGdnzzdvNdY1A5Bpg/yZO7HySY1DFRF6X0ttmzV53av79yoq465dmYOIx 0kuMlPWxYAu0VmnCoA7LbeP5xZ6rhG6z5pvDX4YkPpC62EuArISr14NB1oYoYVM3iqFO 89RQE8YxCO1qk8fnsHyjEjYZIfeAqQs/RbMkMyxvs5dsfw0h+V5xRkmjL31QL5mF+8e3 80Qk9KewAvSsJlrpRHZSQWtynTJytv9EztUblbNJNAi/J7aCtxUuavOjewey9i7foyfR vLeaGZVHRG0FTgR/4FlUp7KywBSDc3Ce+T4wcA5T+GRRcy/HIiovhjFITbrr40I0YN37 eKag== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=Xxh3Ar4yqRujGIAYmSTztIcssQt000TUyqB14Q6PGQ8=; b=H6FynhyMqU0x3XL2k8St5f8Lkux9XuU7pu9ZbA59XPcMW2C2kNSxjCeEhP3330+8mI NFkGF2tXtfDPamM24a/5EvfrpcDk2Lfn3YYYAw2975RWsKyQEONHcuFdiFCcI+TrHLfi idibFhypin/Lg0WJdx85XR/4eD2ZtYaIVt9vDmZQzqqwcATxr60NydsC+IgBo0a8gIXB WUCkAI42Qcq956+2oFpLXX/W6f71TDYq0KMgkb9/OFaMnYcxAv7jFk7XF/gXABawoFgT FB5tjf0C9DwaSYD1CyeVHEi07YVL6/yHWrnXTbkbrGLgEN49LSVbEIGu51eOeRiFAcV+ yPog== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=swJP9pqi; 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=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id oq9-20020a170906cc8900b006df76385d95si1149676ejb.565.2022.04.01.01.03.13; Fri, 01 Apr 2022 01:03:38 -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=@kernel.org header.s=k20201202 header.b=swJP9pqi; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235643AbiCaMDy (ORCPT + 99 others); Thu, 31 Mar 2022 08:03:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48720 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235880AbiCaMC5 (ORCPT ); Thu, 31 Mar 2022 08:02:57 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2C11CC6EED; Thu, 31 Mar 2022 04:59:57 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 8CF00616BF; Thu, 31 Mar 2022 11:59:54 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 67C23C340EE; Thu, 31 Mar 2022 11:59:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1648727994; bh=adnfpVD7oqXHj4mfPH8O1DTjb8aRLseC4Dvlx5i6vF0=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=swJP9pqiZw1PBslMi6kbCZdmGGEiPUICuHiBfiDTo4t2rDC46yANqiK8ahb1iwCkX DUKLDUtfxGiKLaeh1DnLq0GkGDygdI+QfwlZG51KvYHQzsyJ6ZQr1rB+RRYqmz62aH xxAoeYM0TzoLffX/gwbxmZUy80qqN92o7WT69od3BeuS7D6GHl9mDzFz4hto9EWKsN rk3i8v7+tcoCKMWomAkTTUtSqgCzrxXiXFtQwE32YwMtNtwcWuJAeDSogo2RTVCSKX 1/DffffixgiTFrqYd0HJ3aGu4c6IHkp47snP0VeE1Iahf9juWMpgZK5qkX/ZMSNpZN cBvqxDx9+y6qQ== Date: Thu, 31 Mar 2022 12:59:47 +0100 From: Mark Brown To: Martin =?utf-8?Q?Povi=C5=A1er?= 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 Subject: Re: [RFC PATCH 5/5] ASoC: Add macaudio machine driver Message-ID: References: <20220331000449.41062-1-povik+lin@cutebit.org> <20220331000449.41062-6-povik+lin@cutebit.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="+MLBZhiivx60M6iZ" Content-Disposition: inline In-Reply-To: <20220331000449.41062-6-povik+lin@cutebit.org> X-Cookie: Reunite Gondwondaland! X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham 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 --+MLBZhiivx60M6iZ Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, Mar 31, 2022 at 02:04:49AM +0200, Martin Povi=C5=A1er wrote: > --- /dev/null > +++ b/sound/soc/apple/macaudio.c > @@ -0,0 +1,597 @@ > +// SPDX-License-Identifier: GPL-2.0-only > +/* > + * ASoC machine driver for Apple Silicon Macs > + * Please make the entire comment a C++ one so things look more intentional. > + /* CPU side is bit and frame clock master, I2S with both clocks invert= ed */ Please refer to clock providers here. > + ret =3D of_property_read_string(np, "link-name", &link->name); > + if (ret) { > + dev_err(card->dev, "Missing link name\n"); > + goto err_put_np; > + } This doesn't look like it's mandatory in the binding. > +static int macaudio_init(struct snd_soc_pcm_runtime *rtd) > +{ > + struct snd_soc_card *card =3D rtd->card; > + struct macaudio_snd_data *ma =3D snd_soc_card_get_drvdata(card); > + struct snd_soc_component *component; > + int ret, i; > + > + if (rtd->num_codecs > 1) { > + ret =3D macaudio_assign_tdm(rtd); > + if (ret < 0) > + return ret; > + } > + > + for_each_rtd_components(rtd, i, component) > + snd_soc_component_set_jack(component, &ma->jack, NULL); What is the jack configuration this is attempting to describe? It looks like you have some dedicated speaker driver devices which are going to get attached to jacks here for example. > +} macaudio_kctlfixes[] =3D { > + {"* ASI1 Sel", "Left"}, > + {"* ISENSE Switch", "Off"}, > + {"* VSENSE Switch", "Off"}, > + { } > +}; > + > +static bool macaudio_kctlfix_matches(const char *pattern, const char *na= me) > +{ > + if (pattern[0] =3D=3D '*') { > + int namelen, patternlen; > + > + pattern++; > + if (pattern[0] =3D=3D ' ') > + pattern++; > + > + namelen =3D strlen(name); > + patternlen =3D strlen(pattern); > + > + if (namelen > patternlen) > + name +=3D (namelen - patternlen); > + } > + > + return !strcmp(name, pattern); > +} This looks worryingly like use case configuration. > +/* > + * Maybe this could be a general ASoC function? > + */ > +static void snd_soc_kcontrol_set_strval(struct snd_soc_card *card, > + struct snd_kcontrol *kcontrol, const char *strvalue) No, we should not be setting user visible control values from the kernel. This shouldn't be a machine driver function either. What are you trying to accomplish here? --+MLBZhiivx60M6iZ Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAABCgAdFiEEreZoqmdXGLWf4p/qJNaLcl1Uh9AFAmJFl7MACgkQJNaLcl1U h9AvpQf+NQTe35sa2gGAL6J5r3unBmmRuUI+0Lmize/e9oyklq/3LgUI3zy2In6m gWr5laQlG/Eq41KJZecdtZ5BrY+BENGZ4PzCtR06uc8hM7KJV17O6hdRXrK3VSWZ 9Tl8uSSh2xNqw6bwflA6XyfULttxC6NLsKP1RxCOaHJGG4cU1G5GkvT9sTpcQH9/ bi7Y9TzxUi6Q7zgK6vVHXygqusZ4UTHdt5fyxX4ou1tV2V1fYAO64eMJ4pA+8jUA 0ZafQA1BVTbkHK7JZjbc2ILGcu5NBR1eJK/hbv9X0OknpKrRsafaQQTRywE1hWb5 NM2xv163DU7RQTC8vqYC+rKBiQ/ypQ== =dyOa -----END PGP SIGNATURE----- --+MLBZhiivx60M6iZ--