From patchwork Wed Apr 6 04:43:22 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: han.lu@intel.com X-Patchwork-Id: 8757981 Return-Path: X-Original-To: patchwork-alsa-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 378119F39A for ; Wed, 6 Apr 2016 04:43:47 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 68365202F0 for ; Wed, 6 Apr 2016 04:43:46 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id 22B06200D0 for ; Wed, 6 Apr 2016 04:43:45 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id 29DA9265AF0; Wed, 6 Apr 2016 06:43:44 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,NO_DNS_FOR_FROM, RCVD_IN_DNSWL_NONE,UNPARSEABLE_RELAY autolearn=no version=3.3.1 Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id 226C0265B52; Wed, 6 Apr 2016 06:43:04 +0200 (CEST) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa0.perex.cz (Postfix, from userid 1000) id F0178265B3F; Wed, 6 Apr 2016 06:43:02 +0200 (CEST) Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by alsa0.perex.cz (Postfix) with ESMTP id 04F2C2659E3 for ; Wed, 6 Apr 2016 06:42:33 +0200 (CEST) Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga101.jf.intel.com with ESMTP; 05 Apr 2016 21:42:33 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.24,446,1455004800"; d="scan'208";a="952614496" Received: from hanlu-optiplex-9020.sh.intel.com ([10.239.13.11]) by fmsmga002.fm.intel.com with ESMTP; 05 Apr 2016 21:42:31 -0700 From: han.lu@intel.com To: broonie@kernel.org, tiwai@suse.de, vinod.koul@intel.com, pierre-louis.bossart@linux.intel.com, liam.r.girdwood@linux.intel.com, alsa-devel@alsa-project.org Date: Wed, 6 Apr 2016 12:43:22 +0800 Message-Id: <1cb291dc87f36b778ee6e3cc6520c930ce32aafe.1459917632.git.han.lu@intel.com> X-Mailer: git-send-email 2.5.0 In-Reply-To: References: In-Reply-To: References: Cc: "Lu, Han" Subject: [alsa-devel] [PATCH V6 2/2] ASoC: bytcr-rt5640: register DMI names for card X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP From: "Lu, Han" Register DMI names for products using bytcr-rt5640 driver, such as ASUS T100TA and Dell Venue 8 Pro 5830, for user space utils to distinguish different products. For example, previously on T100TA: $ cat /proc/asound/cards 0 [bytcrrt5640 ]: bytcr-rt5640 - bytcr-rt5640 bytcr-rt5640 $ amixer -c0 info Card hw:0 'bytcrrt5640'/'bytcr-rt5640' Mixer name : '' Components : '' Controls : 256 Simple ctrls : 228 After apply the patch: $ cat /proc/asound/cards 0 [T100TA ]: bytcr-rt5640 - T100TA T100TA;bytcr-rt5640;ASUSTek COMPUTER INC.;intel/fw_ sst_0f28.bin $ amixer -c0 info Card hw:0 'T100TA'/'T100TA;bytcr-rt5640;ASUSTek COMPUTER INC.;intel/fw_ sst_0f28.bin' Mixer name : '' Components : 'T100TA;bytcr-rt5640;ASUSTek COMPUTER INC.;intel/fw_s st_0f28.bin' Controls : 256 Simple ctrls : 228 Signed-off-by: Lu, Han diff --git a/sound/soc/intel/boards/bytcr_rt5640.c b/sound/soc/intel/boards/bytcr_rt5640.c index 032a2e7..014b549 100644 --- a/sound/soc/intel/boards/bytcr_rt5640.c +++ b/sound/soc/intel/boards/bytcr_rt5640.c @@ -152,6 +152,8 @@ static const struct dmi_system_id byt_rt5640_quirk_table[] = { {} }; +static struct snd_soc_card byt_rt5640_card; + static int byt_rt5640_init(struct snd_soc_pcm_runtime *runtime) { int ret; @@ -159,6 +161,13 @@ static int byt_rt5640_init(struct snd_soc_pcm_runtime *runtime) struct snd_soc_card *card = runtime->card; const struct snd_soc_dapm_route *custom_map; int num_routes; + struct sst_acpi_mach *mach = byt_rt5640_card.dev->platform_data; + + ret = snd_soc_set_card_names(card, mach->fw_filename); + if (ret < 0) { + dev_err(card->dev, "unable to register card names\n"); + return ret; + } card->dapm.idle_bias_off = true; @@ -380,12 +389,21 @@ static int snd_byt_rt5640_mc_probe(struct platform_device *pdev) return ret_val; } +static int snd_byt_rt5640_mc_remove(struct platform_device *pdev) +{ + struct snd_soc_card *card = &byt_rt5640_card; + + snd_soc_cleanup_card_names(card); + return 0; +} + static struct platform_driver snd_byt_rt5640_mc_driver = { .driver = { .name = "bytcr_rt5640", .pm = &snd_soc_pm_ops, }, .probe = snd_byt_rt5640_mc_probe, + .remove = snd_byt_rt5640_mc_remove, }; module_platform_driver(snd_byt_rt5640_mc_driver);