From patchwork Wed Nov 25 13:00:24 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Fitzgerald X-Patchwork-Id: 7699221 Return-Path: X-Original-To: patchwork-alsa-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 201CBBF90C for ; Wed, 25 Nov 2015 13:09:11 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 44CE6208F7 for ; Wed, 25 Nov 2015 13:09:09 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id 090AD208F2 for ; Wed, 25 Nov 2015 13:09:06 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id EE4502666E1; Wed, 25 Nov 2015 14:09:04 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_LOW, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id C33FC26656C; Wed, 25 Nov 2015 14:03:50 +0100 (CET) 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 6759F2667BF; Wed, 25 Nov 2015 14:03:49 +0100 (CET) Received: from mx0a-001ae601.pphosted.com (mx0a-001ae601.pphosted.com [67.231.149.25]) by alsa0.perex.cz (Postfix) with ESMTP id 211BF26656C for ; Wed, 25 Nov 2015 14:00:36 +0100 (CET) Received: from pps.filterd (m0077473.ppops.net [127.0.0.1]) by mx0a-001ae601.pphosted.com (8.15.0.59/8.15.0.59) with SMTP id tAPD0aYw015876; Wed, 25 Nov 2015 07:00:36 -0600 Received: from mail1.cirrus.com (mail1.cirrus.com [141.131.3.20]) by mx0a-001ae601.pphosted.com with ESMTP id 1yd3grgras-1; Wed, 25 Nov 2015 07:00:36 -0600 Received: from EX12.ad.cirrus.com (unknown [172.19.9.182]) by mail1.cirrus.com (Postfix) with ESMTP id 7844834036; Wed, 25 Nov 2015 07:00:49 -0600 (CST) Received: from imbe.wolfsonmicro.main (172.20.9.178) by EX12.ad.cirrus.com (172.19.9.182) with Microsoft SMTP Server id 14.3.248.2; Wed, 25 Nov 2015 13:00:34 +0000 Received: from rf-debian.wolfsonmicro.main ([172.22.20.23]) by imbe.wolfsonmicro.main (8.14.4/8.14.4) with ESMTP id tAPD0Ohf005932; Wed, 25 Nov 2015 13:00:25 GMT From: Richard Fitzgerald To: , , Date: Wed, 25 Nov 2015 13:00:24 +0000 Message-ID: <1448456424-6794-3-git-send-email-rf@opensource.wolfsonmicro.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1448456424-6794-1-git-send-email-rf@opensource.wolfsonmicro.com> References: <1448456424-6794-1-git-send-email-rf@opensource.wolfsonmicro.com> MIME-Version: 1.0 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 suspectscore=2 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1507310000 definitions=main-1511250223 Cc: linux-kernel@vger.kernel.org, alsa-devel@alsa-project.org, patches@opensource.wolfsonmicro.com, lgirdwood@gmail.com Subject: [alsa-devel] [PATCH v3 2/2] ALSA: compress: Pass id string to snd_compress_new 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: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP Make snd_compress_new take an id string (like snd_pcm_new). This string can be included in the procfs info. This patch also updates soc_new_compress() to create an ID based on the stream and dai name, as done for PCM streams. Signed-off-by: Richard Fitzgerald --- include/sound/compress_driver.h | 2 +- sound/core/compress_offload.c | 13 ++++++++++++- sound/soc/soc-compress.c | 8 +++++++- 3 files changed, 20 insertions(+), 3 deletions(-) diff --git a/include/sound/compress_driver.h b/include/sound/compress_driver.h index 85c4237..c0abcdc 100644 --- a/include/sound/compress_driver.h +++ b/include/sound/compress_driver.h @@ -163,7 +163,7 @@ struct snd_compr { int snd_compress_register(struct snd_compr *device); int snd_compress_deregister(struct snd_compr *device); int snd_compress_new(struct snd_card *card, int device, - int type, struct snd_compr *compr); + int type, const char *id, struct snd_compr *compr); /* dsp driver callback apis * For playback: driver should call snd_compress_fragment_elapsed() to let the diff --git a/sound/core/compress_offload.c b/sound/core/compress_offload.c index 1258e9d..2c52510 100644 --- a/sound/core/compress_offload.c +++ b/sound/core/compress_offload.c @@ -945,6 +945,11 @@ static void snd_compress_proc_done(struct snd_compr *compr) snd_info_free_entry(compr->proc_root); compr->proc_root = NULL; } + +static inline void snd_compress_set_id(struct snd_compr *compr, const char *id) +{ + strlcpy(compr->id, id, sizeof(compr->id)); +} #else static inline int snd_compress_proc_init(struct snd_compr *compr) { @@ -954,6 +959,10 @@ static inline int snd_compress_proc_init(struct snd_compr *compr) static inline void snd_compress_proc_done(struct snd_compr *compr) { } + +static inline void snd_compress_set_id(struct snd_compr *compr, const char *id) +{ +} #endif static int snd_compress_dev_free(struct snd_device *device) @@ -974,7 +983,7 @@ static int snd_compress_dev_free(struct snd_device *device) * @compr: compress device pointer */ int snd_compress_new(struct snd_card *card, int device, - int dirn, struct snd_compr *compr) + int dirn, const char *id, struct snd_compr *compr) { static struct snd_device_ops ops = { .dev_free = snd_compress_dev_free, @@ -987,6 +996,8 @@ int snd_compress_new(struct snd_card *card, int device, compr->device = device; compr->direction = dirn; + snd_compress_set_id(compr, id); + snd_device_initialize(&compr->dev, card); dev_set_name(&compr->dev, "comprC%iD%i", card->number, device); diff --git a/sound/soc/soc-compress.c b/sound/soc/soc-compress.c index 12a9820..fffbe6f 100644 --- a/sound/soc/soc-compress.c +++ b/sound/soc/soc-compress.c @@ -689,7 +689,13 @@ int snd_soc_new_compress(struct snd_soc_pcm_runtime *rtd, int num) compr->ops->copy = soc_compr_copy; mutex_init(&compr->lock); - ret = snd_compress_new(rtd->card->snd_card, num, direction, compr); + + snprintf(new_name, sizeof(new_name), "%s %s-%d", + rtd->dai_link->stream_name, + rtd->codec_dai->name, num); + + ret = snd_compress_new(rtd->card->snd_card, num, direction, + new_name, compr); if (ret < 0) { pr_err("compress asoc: can't create compress for codec %s\n", codec->component.name);