From patchwork Wed Jul 15 00:33:59 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shuah Khan X-Patchwork-Id: 6790661 Return-Path: X-Original-To: patchwork-linux-media@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 BAD939F2E8 for ; Wed, 15 Jul 2015 00:34:26 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id D3F48206B8 for ; Wed, 15 Jul 2015 00:34:25 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id D1BEC206A6 for ; Wed, 15 Jul 2015 00:34:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752027AbbGOAeW (ORCPT ); Tue, 14 Jul 2015 20:34:22 -0400 Received: from resqmta-po-07v.sys.comcast.net ([96.114.154.166]:53120 "EHLO resqmta-po-07v.sys.comcast.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751904AbbGOAeW (ORCPT ); Tue, 14 Jul 2015 20:34:22 -0400 Received: from resomta-po-16v.sys.comcast.net ([96.114.154.240]) by resqmta-po-07v.sys.comcast.net with comcast id sQZN1q0035BUCh401QaMX6; Wed, 15 Jul 2015 00:34:21 +0000 Received: from mail.gonehiking.org ([73.181.52.62]) by resomta-po-16v.sys.comcast.net with comcast id sQaL1q00Q1LXgTt01QaMb4; Wed, 15 Jul 2015 00:34:21 +0000 Received: from lorien.internal (lorien-wl.internal [192.168.1.40]) by mail.gonehiking.org (Postfix) with ESMTP id 9CAAC120418; Tue, 14 Jul 2015 18:34:20 -0600 (MDT) From: Shuah Khan To: mchehab@osg.samsung.com, hans.verkuil@cisco.com, laurent.pinchart@ideasonboard.com, tiwai@suse.de, sakari.ailus@linux.intel.com Cc: Shuah Khan , linux-media@vger.kernel.org Subject: [PATCH] media-ctl: Update to add support for ALSA devices Date: Tue, 14 Jul 2015 18:33:59 -0600 Message-Id: <1436920452-7548-1-git-send-email-shuahkh@osg.samsung.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: References: DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=comcast.net; s=q20140121; t=1436920461; bh=mLhMOHOjE0bHAtrF13K4jnQb7amxJI3gPcq3ROWVsp0=; h=Received:Received:Received:From:To:Subject:Date:Message-Id; b=i+21J96/dj23/YsTaGhPcz0PFoD2utDfuA7kz/Xf9J5MQrLPYD/gJ0sJEOvPMw1Ar z+EQr7p1vaw1O85Akhph5OlCgCb889aZ0JBpnsJFFStnLDvKgxevy8tfT4EhyU5gPF +3Gq4gT9ZPP8mnjul40UKpqCDGrjV1PKLecCjmKoFTrEM2cuA95cytrZk7C2ocdu0Q Xn33Q8T+dTPMKKcwUtauf+NrYseRNTCL4Mh6gUKXNx+2LeJbDkBodCyOGzKvYHEoUq jkz2TcKEKRZ63waTVweLnZEb5UFx6b3yh9HaujhEBP9IDmn58vmiOQy2KcsFoSF8SC g5w7/KcNg2EAQ== Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Spam-Status: No, score=-8.2 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD,T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Add support to recognize ALSA media nodes and generate media graph that includes ALSA pcm and mixer devices. This patch depends on kernel Media Controller changes to support ALSA. Signed-off-by: Shuah Khan --- utils/media-ctl/libmediactl.c | 18 ++++++++++++------ utils/media-ctl/media-ctl.c | 3 +++ utils/media-ctl/mediactl.h | 4 +++- 3 files changed, 18 insertions(+), 7 deletions(-) diff --git a/utils/media-ctl/libmediactl.c b/utils/media-ctl/libmediactl.c index dce8eeb..329a41a 100644 --- a/utils/media-ctl/libmediactl.c +++ b/utils/media-ctl/libmediactl.c @@ -153,7 +153,9 @@ struct media_entity *media_get_default_entity(struct media_device *media, return media->def.v4l; case MEDIA_ENT_T_DEVNODE_FB: return media->def.fb; - case MEDIA_ENT_T_DEVNODE_ALSA: + case MEDIA_ENT_T_DEVNODE_ALSA_CAPTURE: + case MEDIA_ENT_T_DEVNODE_ALSA_PLAYBACK: + case MEDIA_ENT_T_DEVNODE_ALSA_MIXER: return media->def.alsa; case MEDIA_ENT_T_DEVNODE_DVB_FE: case MEDIA_ENT_T_DEVNODE_DVB_DEMUX: @@ -481,7 +483,6 @@ static int media_get_devname_sysfs(struct media_entity *entity) if (p == NULL) return -EINVAL; - sprintf(devname, "/dev/%s", p + 1); if (strstr(p + 1, "dvb")) { char *s = p + 1; @@ -493,6 +494,8 @@ static int media_get_devname_sysfs(struct media_entity *entity) return -EINVAL; *p = '/'; sprintf(devname, "/dev/dvb/adapter%s", s); + } else if (strstr(p + 1, "pcm") || strstr(p + 1, "control")) { + sprintf(devname, "/dev/snd/%s", p + 1); } else { sprintf(devname, "/dev/%s", p + 1); } @@ -562,7 +565,9 @@ static int media_enum_entities(struct media_device *media) case MEDIA_ENT_T_DEVNODE_FB: media->def.fb = entity; break; - case MEDIA_ENT_T_DEVNODE_ALSA: + case MEDIA_ENT_T_DEVNODE_ALSA_CAPTURE: + case MEDIA_ENT_T_DEVNODE_ALSA_PLAYBACK: + case MEDIA_ENT_T_DEVNODE_ALSA_MIXER: media->def.alsa = entity; break; case MEDIA_ENT_T_DEVNODE_DVB_FE: @@ -577,8 +582,7 @@ static int media_enum_entities(struct media_device *media) /* Find the corresponding device name. */ if (media_entity_type(entity) != MEDIA_ENT_T_DEVNODE && - media_entity_type(entity) != MEDIA_ENT_T_V4L2_SUBDEV && - entity->info.type == MEDIA_ENT_T_DEVNODE_ALSA) + media_entity_type(entity) != MEDIA_ENT_T_V4L2_SUBDEV) continue; /* Try to get the device name via udev */ @@ -774,7 +778,9 @@ int media_device_add_entity(struct media_device *media, defent = &media->def.fb; entity->info.fb = desc->fb; break; - case MEDIA_ENT_T_DEVNODE_ALSA: + case MEDIA_ENT_T_DEVNODE_ALSA_CAPTURE: + case MEDIA_ENT_T_DEVNODE_ALSA_PLAYBACK: + case MEDIA_ENT_T_DEVNODE_ALSA_MIXER: defent = &media->def.alsa; entity->info.alsa = desc->alsa; break; diff --git a/utils/media-ctl/media-ctl.c b/utils/media-ctl/media-ctl.c index 602486f..85151b5 100644 --- a/utils/media-ctl/media-ctl.c +++ b/utils/media-ctl/media-ctl.c @@ -290,6 +290,9 @@ static const char *media_entity_subtype_to_string(unsigned type) "DVB DVR", "DVB CA", "DVB NET", + "ALSA CAPTURE", + "ALSA PLAYBACK", + "ALSA MIXER", }; static const char *subdev_types[] = { "Unknown", diff --git a/utils/media-ctl/mediactl.h b/utils/media-ctl/mediactl.h index 03d9f70..3ac91eb 100644 --- a/utils/media-ctl/mediactl.h +++ b/utils/media-ctl/mediactl.h @@ -305,7 +305,9 @@ struct media_entity *media_get_entity(struct media_device *media, unsigned int i * * MEDIA_ENT_T_DEVNODE_V4L * MEDIA_ENT_T_DEVNODE_FB - * MEDIA_ENT_T_DEVNODE_ALSA + * MEDIA_ENT_T_DEVNODE_ALSA_CAPTURE + * MEDIA_ENT_T_DEVNODE_ALSA_PLAYBACK + * MEDIA_ENT_T_DEVNODE_ALSA_MIXER * MEDIA_ENT_T_DEVNODE_DVB_FE * MEDIA_ENT_T_DEVNODE_DVB_DEMUX * MEDIA_ENT_T_DEVNODE_DVB_DVR