From patchwork Sat Apr 18 10:04:20 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Jie, Yang" X-Patchwork-Id: 6236821 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 6F6FE9F1C4 for ; Sat, 18 Apr 2015 10:04:32 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 9F1F4203A0 for ; Sat, 18 Apr 2015 10:04:31 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id 76A552038E for ; Sat, 18 Apr 2015 10:04:30 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id A07542619FA; Sat, 18 Apr 2015 12:04:29 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,NO_DNS_FOR_FROM, UNPARSEABLE_RELAY autolearn=no version=3.3.1 Received: from alsa0.perex.cz (localhost [IPv6:::1]) by alsa0.perex.cz (Postfix) with ESMTP id 013342659F9; Sat, 18 Apr 2015 12:01:44 +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 3F9742659F0; Sat, 18 Apr 2015 12:01:43 +0200 (CEST) Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by alsa0.perex.cz (Postfix) with ESMTP id 4BE482619FA for ; Sat, 18 Apr 2015 12:01:10 +0200 (CEST) Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga102.fm.intel.com with ESMTP; 18 Apr 2015 03:01:09 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.11,599,1422950400"; d="scan'208";a="711346035" Received: from keyon-u1310.sh.intel.com ([10.239.13.15]) by fmsmga002.fm.intel.com with ESMTP; 18 Apr 2015 03:01:08 -0700 From: Jie Yang To: tiwai@suse.de Date: Sat, 18 Apr 2015 18:04:20 +0800 Message-Id: <1429351460-15932-7-git-send-email-yang.jie@intel.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1429351460-15932-1-git-send-email-yang.jie@intel.com> References: <1429351460-15932-1-git-send-email-yang.jie@intel.com> Cc: alsa-devel@alsa-project.org, broonie@kernel.org, tanu.kaskinen@linux.intel.com, liam.r.girdwood@intel.com Subject: [alsa-devel] [PATCH v6 6/6] ALSA: Docs: Add documentation for Jack kcontrols 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 Add documentation describing Jack embedded kcontrols, and how to use it on HD-Audio and ASoC case. Signed-off-by: Jie Yang --- Documentation/sound/alsa/Jack-Controls.txt | 48 ++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 Documentation/sound/alsa/Jack-Controls.txt diff --git a/Documentation/sound/alsa/Jack-Controls.txt b/Documentation/sound/alsa/Jack-Controls.txt new file mode 100644 index 0000000..9e93947 --- /dev/null +++ b/Documentation/sound/alsa/Jack-Controls.txt @@ -0,0 +1,48 @@ +Why we need kcontrols for Jack? +=============================== + +ALSA using kcontrols to export controlling(switch, volume, Mux, ...) to +user space, e.g. pulseaudio can switch off headphone and switch on +speaker when no heaphone is pluged in. + +For each physical jack, there may be dynamic pluged in/out status which +upper layer may be interested in. Currently the ALSA jack core registers +only input devices for each jack registered. These jack input devices +are not readable by userspace devices that run as non root. + +So we create embeded kcontrols for each jack, report jack event via +these kcontrols, userspace switch them to ack on these event, to +implement what they are wanna to. + +Combining with ucm machanism, userpace can do fantasic controlling as +they want to. + +Jack and kcontrols +================== + +Each jack will have a kcontrol list, we can create a kcontrol and attach +it to the jack, at jack creating stage. Also, we can add kcontrol to an +exist jack, at anytime when you are happy. + +Those kcontrols will be freed automatically when the Jack is freed. + +How to create kcontrol embedded jack? +===================================== + +To be compatible with previous HD-Audio jack and ASoC jack, we modify +snd_jack_new() with adding two params: + + - @phantom_jack: for phantom jack, only create needed kctl, won't create + real jack device. + - @jjack_kctl: create kctl if non-NULL pointer passed in, and provide + it to the caller. also add it to the non-phantom jack kctl list. + +For HDA jack, we can use phantom_jack = true for phantom jack creating, +and the jack kctl pointer will be filled with the new created kcontrol. + +For ASoC jack, usually, we create kcontrols after jack is created, with +calling snd_hda_jack_add_kctl() for each jack pins. And, the pin name +will be assigned to the corresponding kcontrol name. So, to make +userspace understand and recognize it, please assign proper name for +each jack pin. +