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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 57A32CD1292 for ; Mon, 8 Apr 2024 19:00:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-ID:In-reply-to: Date:Subject:Cc:To:From:References:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=emIqOy5pOmIm9GBMBkLiPC71Iu8NyVaNPjMHa81aDTY=; b=Au30wUWR21zV2M BbRQm0TU0yn6zevLutqRrcdu3KzJlyAMSTWhG0+e7av1k31+WF7VS8ZijGBnSdfRZe2xGW/2/r65D 2no9NXJ9Pgt2+iNXT3BD57OaM87+uLfJWEaPQ6zVEMjrudCU95R9kRxnK1qDfnka8p8+Gq1q4jWcx jdhObY6JBfE2aPDh0muE2cJW5bytqH6JMCL3+0lDwwwR0/vNCedipi7dQUaiXVmAxwMekr4zujS1z cC3A0WeW5ICKSjVRJTp1F1G2pDYpVsEg+MkrCU/bt3b84cSnCVuyQ1jf1rNL1o5G266daIWNbPamy 72VUZj8wFhmSKSE90jOQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rtuEJ-0000000GaEz-3EPg; Mon, 08 Apr 2024 19:00:32 +0000 Received: from mail-wm1-x32d.google.com ([2a00:1450:4864:20::32d]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rtuEC-0000000GaB4-0z1G for linux-arm-kernel@lists.infradead.org; Mon, 08 Apr 2024 19:00:29 +0000 Received: by mail-wm1-x32d.google.com with SMTP id 5b1f17b1804b1-4163de295f9so10979475e9.2 for ; Mon, 08 Apr 2024 12:00:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20230601.gappssmtp.com; s=20230601; t=1712602823; x=1713207623; darn=lists.infradead.org; h=mime-version:message-id:in-reply-to:date:subject:cc:to:from :user-agent:references:from:to:cc:subject:date:message-id:reply-to; bh=H+B+dIHSb8yRhnSvIGZyYqGXJXmpVr8yjlKl3yu6l4I=; b=gyGGi50xkvCLpEFxr7gF1e7dD1G4wREUwHuSS/DFM+E/Hoxofre3J9a7MnNeVuq0g6 0On2hpKk8b5d4S7zIncpOZTyAYgEtDeKnC9xc3j1esXgDSuqrU7HzOzyb8DGn4exrlUO wnjPfQeo7JRFuc+Vg+gLVqViyPnHwRjFPUqbV73a+L2bcR1OEsVQA8MSFWtlSBJRpfEu 32xz8WWS0PL7VCZfuFks9RNOHeh832BAReeQM3/WEUPFCjkK8k6TPcvAnxl3NSPuwnGd vJ2UyOd5abUB43ZZsaqdMyu1c3EqgWpNORh/43RYRoIGaACwPg9CPECbhi9KX1ZCz/pY 24gQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712602823; x=1713207623; h=mime-version:message-id:in-reply-to:date:subject:cc:to:from :user-agent:references:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=H+B+dIHSb8yRhnSvIGZyYqGXJXmpVr8yjlKl3yu6l4I=; b=NFy6qVQjB2rsn+n//3lHYhy+8bCfcxd2Pwi18QgHkrey3cLX4PIQZzSb7gh7OAe2ql YMB7I8n0SJTKDEYijZQzFzEBy5BuiQ2IdHwZrzIeyZyeSHMvi2ncEX1yEcRffSgxJW8F tsaCd2tng/x4MYQCS5VJT+K3NtBvgaGfS8h5FfzqK6cKf81smPQJioa0llG0QZrmdO11 8OCmeVCiwWAVq33BRz8BbTCGBp5e8zQD5g39wMQMBQ/EdeBVB0rbuNKpdtOkeIlBmD5z OGHkyUbG72DACjinMd1juH3qVHngbojW6we7Y3AhiRm9Ny7oMq1IQ/ZczSqVFjksYv5o EgGQ== X-Forwarded-Encrypted: i=1; AJvYcCU9jS4l3uZLYP4VS3/6pNGF/9my+fLWDp12bRUefO7odJ8LinxfcIUWB6HfUDacS9pQ/K4DNGiRQAJCiP31kvRH3Sr3nU5KvpvwTe4Ta+6odQO4PKQ= X-Gm-Message-State: AOJu0YwZ9ZukreCdowS2G2DLX+QPeCzsbLCf2RZeFyNtberqp71nYipl EMqvf62mkUqhhOlclTXd1VGoPAKmjHFA4To0UGJPpXK2wdcIOOAl7MCHsES2F8I= X-Google-Smtp-Source: AGHT+IGP2XX1WCI1/h92HKpEVxqSPYGzlO2h896WkQD9sJo7lY2DOrCu08c0YYaiv8QAmxpQYmTAyg== X-Received: by 2002:a05:600c:1c8a:b0:415:666e:9438 with SMTP id k10-20020a05600c1c8a00b00415666e9438mr7600760wms.3.1712602822639; Mon, 08 Apr 2024 12:00:22 -0700 (PDT) Received: from localhost ([2a01:e0a:3c5:5fb1:90bc:1f0d:aae2:3c66]) by smtp.gmail.com with ESMTPSA id j22-20020a05600c1c1600b004165315d885sm7177799wms.11.2024.04.08.12.00.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 08 Apr 2024 12:00:22 -0700 (PDT) References: <20240408164947.30717-1-ddrokosov@salutedevices.com> <20240408164947.30717-3-ddrokosov@salutedevices.com> <1j1q7fpv1n.fsf@starbuckisacylon.baylibre.com> <20240408184041.3jcav5tabxiblpn4@CAB-WSD-L081021> User-agent: mu4e 1.10.8; emacs 29.2 From: Jerome Brunet To: Dmitry Rokosov Cc: Jerome Brunet , neil.armstrong@linaro.org, lgirdwood@gmail.com, broonie@kernel.org, conor+dt@kernel.org, robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org, perex@perex.cz, tiwai@suse.com, khilman@baylibre.com, martin.blumenstingl@googlemail.com, kernel@salutedevices.com, rockosov@gmail.com, linux-amlogic@lists.infradead.org, alsa-devel@alsa-project.org, linux-sound@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: Re: [PATCH v1 2/2] ASoC: meson: implement link-name optional property in meson card utils Date: Mon, 08 Apr 2024 20:53:42 +0200 In-reply-to: <20240408184041.3jcav5tabxiblpn4@CAB-WSD-L081021> Message-ID: <1jo7ajof22.fsf@starbuckisacylon.baylibre.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240408_120024_416483_FBFCA555 X-CRM114-Status: GOOD ( 35.03 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Mon 08 Apr 2024 at 21:40, Dmitry Rokosov wrote: > On Mon, Apr 08, 2024 at 08:15:54PM +0200, Jerome Brunet wrote: >> >> On Mon 08 Apr 2024 at 19:49, Dmitry Rokosov wrote: >> >> > The 'link-name' property presents an optional DT feature that empowers >> > users to customize the name associated with the DAI link and PCM stream. >> > This functionality reflects the approach often employed in Qualcomm >> > audio cards, providing enhanced flexibility in DAI naming conventions >> > for improved system integration and userspace experience. >> > >> > It allows userspace program to easy determine PCM stream purpose, e.g.: >> > ~ # cat /proc/asound/pcm >> > 00-00: speaker (*) : : playback 1 >> > 00-01: mics (*) : : capture 1 >> > 00-02: loopback (*) : : capture 1 >> >> The example above is exactly what you should not do with link names, at >> least with the amlogic audio system. >> >> Userspace pcm, otherwise known as DPCM frontend, are merely that: >> frontends. What they do is entirely defined by the routing defined by >> the userspace (amixer and friends) >> >> So naming the interface in DT (the FW describing the HW) after what the >> the userspace SW could possibly set later on is wrong. >> >> Bottom line: I have mixed feeling about this change. It could allow all >> sort of bad names to be set. >> >> The only way it could make sense HW wise is if the only allowed names >> where (fr|to)ddr_[abcd], which could help maps the interface and the >> kcontrol. >> >> Such restriction should be documented in the binding doc. >> > > The link-name is an optional parameter. Yes, you are right, it can be > routed in a way that it no longer functions as a speaker in most cases. > However, if you plan to use your board's dt for common purposes, you > should not change the common names for DAI links. But if you know that > you have a static setup for speakers, microphones, loopback, or other > references (you 100% know it, because you are HW developer of this > board), why not help the user understand the PCM device assignment in > the easiest way? > > Ultimately, it is the responsibility of the DT board developer to define > specific DAIs and name them based on their own knowledge about HW and > understanding of the board's usage purposes. Speaker and mics are NOT statically tied to a frontend. They are tied to a codec (... possibly). The routing from the frontend to the backend is dynamic, even while streaming. So defining FW names based on usage in wrong. As Mark pointed out as well, DT is not the place for this. > >> > >> > The previous naming approach using auto-generated fe or be strings >> > continues to be utilized as a fallback. >> > >> > Signed-off-by: Dmitry Rokosov >> > --- >> > sound/soc/meson/meson-card-utils.c | 12 ++++++++---- >> > 1 file changed, 8 insertions(+), 4 deletions(-) >> > >> > diff --git a/sound/soc/meson/meson-card-utils.c b/sound/soc/meson/meson-card-utils.c >> > index ed6c7e2f609c..7bae72905a9b 100644 >> > --- a/sound/soc/meson/meson-card-utils.c >> > +++ b/sound/soc/meson/meson-card-utils.c >> > @@ -94,10 +94,14 @@ static int meson_card_set_link_name(struct snd_soc_card *card, >> > struct device_node *node, >> > const char *prefix) >> > { >> > - char *name = devm_kasprintf(card->dev, GFP_KERNEL, "%s.%s", >> > - prefix, node->full_name); >> > - if (!name) >> > - return -ENOMEM; >> > + const char *name; >> > + >> > + if (of_property_read_string(node, "link-name", &name)) { >> > + name = devm_kasprintf(card->dev, GFP_KERNEL, "%s.%s", >> > + prefix, node->full_name); >> > + if (!name) >> > + return -ENOMEM; >> > + } >> > >> > link->name = name; >> > link->stream_name = name; >> >> >> -- >> Jerome -- Jerome _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel