Received: by 2002:a5d:925a:0:0:0:0:0 with SMTP id e26csp431412iol; Thu, 9 Jun 2022 06:45:35 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz6568JtmrMQSoDVoBZI4+k1yS+i2w/4ls+yughi/oTrhhWkAu3DDm+g8pdHX/wyUeyclmQ X-Received: by 2002:a63:2b87:0:b0:3fd:31d6:6a0e with SMTP id r129-20020a632b87000000b003fd31d66a0emr27945028pgr.488.1654782335400; Thu, 09 Jun 2022 06:45:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654782335; cv=none; d=google.com; s=arc-20160816; b=pvzOvqqwwapikiBaNJgrH1yybBoL8kO05dzcZRjBDG46mI8JlyAsHBPXaxCD5gdS0Z iNIjaREhOqiaBbWUtFpGF9bzPaQEOT+DiZKaEJH/SAhVdB1e7WZ4lc7gOys8Kuv8b6DF UTL4Gzk0nJ2GdVKJNUqa93B5RegFec//7iI4UG8HB+fzqH+Ccwq2xmcO+CMXcMCfvjSO hh5jGWb3SMg4KlAp2pFEyPI38fpZj8Q7Bok7g1bzaNDWV1B8I5v0kk3zCf/ISDKVilRi iXCNENbo2E0Pcil4HPFAnblSlyaF94H1gymzHwVkxd3sAK6k303+hC6xqMMYGwdaBNn5 Wshg== 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=BTvOeMHWNh9w1mMDqLqnXxJpf2roqB6knFpCeV+P7S0=; b=fARHjvEMcYjoIDWtAx4l+zpXAsSmOD4jqhYNlVxpG+pNhXLqWCi/tPkhOSC4ykPXOb aNdIDXQrLiOnpQ3npdx7blcBNPEmFvSh+gnMARktrjJF3f+1dr1f+vec5UVEdaVEX+ul 9fHiKL3+znNdO7FnXTbH+3AkET3fiTcfccXxs2eR0qiI3UtYkr9pGEoomS+zaesLqaRS eX6bA1A7NLHS5qvGFt9zzwxw/3UH4z+lTL/J32HPleTzvmwGNmt16xJNA/ONi6nCAygc ttgOD9oc1atFrf6TkPsQzfy+2sfmCSJWZye4gECNCQrFlVQmAMgt7bWQSqovCni62rsr Q6Rw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="WYPI/dFW"; 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 e62-20020a636941000000b003fdac19f9easi16914751pgc.733.2022.06.09.06.45.22; Thu, 09 Jun 2022 06:45:35 -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="WYPI/dFW"; 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 S239103AbiFINQQ (ORCPT + 99 others); Thu, 9 Jun 2022 09:16:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39212 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233763AbiFINQM (ORCPT ); Thu, 9 Jun 2022 09:16:12 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A00973BB299; Thu, 9 Jun 2022 06:16:11 -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 3E6EA61CE3; Thu, 9 Jun 2022 13:16:11 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 08F2FC34114; Thu, 9 Jun 2022 13:16:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1654780570; bh=adIY73cUSCNwOEj4s+9TfwrvjgCT5vabHNIojXe/1uY=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=WYPI/dFW/4u4zTXC/IoaW+gqiph/U3f8dUrIV74OlJs0SAnkbFcVND+snhWDy+MYh 6ioLbFofSxMV7wfxsQubzFcp7eTHg3LR3D+RM3LC975VPbwms9sD1u0fzMbkuK+7aZ Hq6J0DhKtzTC3IsvGKX9eswrN40xD110OJDrNfNDsCNKB94cTJL53JgZBEcnqbkddT lLTbP/uNM2VCh5PIs/E4J25prK2pS1ggzPizFluCG2fNfVAlxsCvzIncZN5RMqgVXo sxWPPRxk2eVKbDsvcyXmElZHZvHsWOE8mcZOC/F3x32x/sWUjeGTGdnynKF84hiXFL 9k55FZrg5hBdg== Date: Thu, 9 Jun 2022 14:16:04 +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 , asahi@lists.linux.dev Subject: Re: [RFC PATCH v2 5/5] ASoC: apple: Add macaudio machine driver Message-ID: References: <20220606191910.16580-1-povik+lin@cutebit.org> <20220606191910.16580-6-povik+lin@cutebit.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="zP4ArPesiXfS095U" Content-Disposition: inline In-Reply-To: <20220606191910.16580-6-povik+lin@cutebit.org> X-Cookie: Space is limited. X-Spam-Status: No, score=-8.3 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 --zP4ArPesiXfS095U Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Jun 06, 2022 at 09:19:10PM +0200, Martin Povi=C5=A1er wrote: > + * =E2=94=8C=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2= =94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=90 =E2=94=8C=E2=94=80=E2=94= =80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80= =E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=96=BA =E2=94=8C=E2=94=80= =E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=90 =E2=94=8C=E2=94=80=E2=94= =80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80= =E2=94=90 > + * =E2=94=82 Primary =E2=94=9C=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2= =94=80=E2=94=80=E2=94=80=E2=94=A4 =E2=94=82 Mux =E2=94=82 = =E2=94=80=E2=94=80=E2=96=BA =E2=94=82 Speakers =E2=94=82 > + * =E2=94=94=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2= =94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=98 =E2=94=82 =E2=94=8C=E2= =94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94= =80=E2=94=80=E2=96=BA =E2=94=94=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94= =80=E2=94=98 =E2=94=94=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2= =94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=98 > + * =E2=94=8C=E2=94=80=E2=94=80=E2=94=80 =E2=94=82 =E2=94= =80=E2=94=80=E2=94=80=E2=94=98 =E2=96=B2 > + * =E2=94=8C=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2= =94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=90 =E2=94=82 =E2=94=82 = =E2=94=82 > + * =E2=94=82Secondary =E2=94=9C=E2=94=80=E2=94=80=E2=94=98 =E2=94=82= =E2=94=8C=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94= =80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=B4=E2=94=90 > + * =E2=94=94=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2= =94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=98 =E2=94=9C=E2=94=80=E2=94= =80=E2=94=80=E2=94=80=E2=96=BA=E2=94=82Plug-in Demux=E2=94=82 > + * =E2=94=82 =E2=94=94=E2=94=80=E2=94=80=E2=94= =80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80= =E2=94=80=E2=94=AC=E2=94=98 > + * =E2=94=82 =E2=94=82 > + * =E2=94=82 =E2=96=BC > + * =E2=94=82 =E2=94=8C=E2=94=80=E2= =94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=90 =E2=94=8C=E2=94=80=E2=94=80= =E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2= =94=90 > + * =E2=94=94=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2= =94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94= =80=E2=94=80=E2=94=80=E2=96=BA =E2=94=82 Mux =E2=94=82 =E2=94=80=E2=94=80= =E2=96=BA =E2=94=82Headphones=E2=94=82 > + * =E2=94=94=E2=94=80=E2=94=80=E2= =94=80=E2=94=80=E2=94=80=E2=94=98 =E2=94=94=E2=94=80=E2=94=80=E2=94=80= =E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=80=E2=94=98 As far as I can tell this demux is entirely software based - why not just expose the routing control to userspace and let it handle switching (which I suspect may be more featureful than what's implemented here)? > +static int macaudio_jack_event(struct notifier_block *nb, unsigned long = event, > + void *data) > +{ > + struct snd_soc_jack *jack =3D data; > + struct macaudio_snd_data *ma =3D snd_soc_card_get_drvdata(jack->c= ard); > + > + ma->jack_plugin_state =3D !!event; > + > + if (!ma->plugin_demux_kcontrol) > + return 0; > + > + snd_soc_dapm_mux_update_power(&ma->card.dapm, ma->plugin_demux_kc= ontrol, > + ma->jack_plugin_state, > + (struct soc_enum *) &macaudio_plugi= n_demux_enum, NULL); > + > + return 0; > +} This should be integrated with the core jack detection stuff in soc-jack.c and/or the core stuff that's wrapping - that way you'll ensure that events are generated and status readable via all the interfaces userspace might be looking for. The ASoC stuff also has some DAPM integration for turning on/off outputs which might DTRT for you if you do need it in kernel. --zP4ArPesiXfS095U Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAABCgAdFiEEreZoqmdXGLWf4p/qJNaLcl1Uh9AFAmKh8pQACgkQJNaLcl1U h9A35AgAhc/b4LJ2GElO9+hrXTNIF0hkl2AmactD2FfUXkE/CAfoLDtaK/5RtjeR 4ybKT5miFOnvG5bzMVTQV8BtLKiT9AI3ABDsuj2QMvaTZ95Y3tgqZh738EQAYB5l Qrie4m9HHqjp1dLdqvNcgVTg1QWzIddKaMB7bI0FHITUZVqgcq5qZiAtAZ3GGBeP ZIdkYMVLhyEIUpjXpYOlHjgxo2wKs+ixIyN9BonMvX6aSOLNXmI/vuqVPYp8uuvn u+WXjidw0QlG2gU2kgnncbugvKNMKm4YcCd+CcQ7q4wrwQbH12DT7uD0X2m1/kVE py9WhKEDlJiKgkRkR7GjmWGf2OmarA== =P1Mm -----END PGP SIGNATURE----- --zP4ArPesiXfS095U--