From patchwork Mon Feb 24 01:45:49 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hui Wang X-Patchwork-Id: 1242783 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.ubuntu.com (client-ip=91.189.94.19; helo=huckleberry.canonical.com; envelope-from=kernel-team-bounces@lists.ubuntu.com; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=canonical.com Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 48QlK9059Gz9sRh; Mon, 24 Feb 2020 12:46:18 +1100 (AEDT) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.86_2) (envelope-from ) id 1j62p4-0007mC-Ax; Mon, 24 Feb 2020 01:46:14 +0000 Received: from youngberry.canonical.com ([91.189.89.112]) by huckleberry.canonical.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1j62p1-0007le-IG for kernel-team@lists.ubuntu.com; Mon, 24 Feb 2020 01:46:11 +0000 Received: from [123.112.111.131] (helo=localhost.localdomain) by youngberry.canonical.com with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1j62p0-0002RI-Kt for kernel-team@lists.ubuntu.com; Mon, 24 Feb 2020 01:46:11 +0000 From: Hui Wang To: kernel-team@lists.ubuntu.com Subject: [SRU][Focal][PATCH 1/2] ASoC: add control components management Date: Mon, 24 Feb 2020 09:45:49 +0800 Message-Id: <20200224014550.8197-2-hui.wang@canonical.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200224014550.8197-1-hui.wang@canonical.com> References: <20200224014550.8197-1-hui.wang@canonical.com> X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: "kernel-team" From: Jaroslav Kysela BugLink: https://bugs.launchpad.net/bugs/1864400 This ASCII string can carry additional information about soundcard components or configuration. Add the possibility to set this string via the ASoC card. Signed-off-by: Jaroslav Kysela Cc: Mark Brown Link: https://lore.kernel.org/r/20191119174933.25526-1-perex@perex.cz Signed-off-by: Mark Brown (cherry picked from commit dc73d73aa7145f55412611f3eead1e85ae026785) Signed-off-by: Hui Wang --- include/sound/soc.h | 1 + sound/soc/soc-core.c | 13 +++++++++++++ 2 files changed, 14 insertions(+) diff --git a/include/sound/soc.h b/include/sound/soc.h index f264c6509f00..efc5fb8f3d64 100644 --- a/include/sound/soc.h +++ b/include/sound/soc.h @@ -978,6 +978,7 @@ struct snd_soc_card { const char *name; const char *long_name; const char *driver_name; + const char *components; char dmi_longname[80]; char topology_shortname[32]; diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c index 68dc29670b93..f61e5b50a66f 100644 --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c @@ -2082,6 +2082,19 @@ static int snd_soc_instantiate_card(struct snd_soc_card *card) } } + if (card->components) { + /* the current implementation of snd_component_add() accepts */ + /* multiple components in the string separated by space, */ + /* but the string collision (identical string) check might */ + /* not work correctly */ + ret = snd_component_add(card->snd_card, card->components); + if (ret < 0) { + dev_err(card->dev, "ASoC: %s snd_component_add() failed: %d\n", + card->name, ret); + goto probe_end; + } + } + if (card->late_probe) { ret = card->late_probe(card); if (ret < 0) {