From patchwork Tue Sep 20 13:46:12 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeeja KP X-Patchwork-Id: 9342229 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id BB010607D0 for ; Tue, 20 Sep 2016 17:45:30 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B202D295CD for ; Tue, 20 Sep 2016 17:45:30 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A6DB8295D2; Tue, 20 Sep 2016 17:45:30 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 27545295CD for ; Tue, 20 Sep 2016 17:45:28 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id 6AB05266DDC; Tue, 20 Sep 2016 19:45:27 +0200 (CEST) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id 07425266DCC; Tue, 20 Sep 2016 19:43:03 +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 3E245266D1B; Tue, 20 Sep 2016 15:38:12 +0200 (CEST) Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by alsa0.perex.cz (Postfix) with ESMTP id 60A762666AA for ; Tue, 20 Sep 2016 15:38:06 +0200 (CEST) Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga104.jf.intel.com with ESMTP; 20 Sep 2016 06:38:05 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.30,368,1470726000"; d="scan'208";a="763719717" Received: from kpjeeja-desk.iind.intel.com ([10.223.96.110]) by FMSMGA003.fm.intel.com with ESMTP; 20 Sep 2016 06:38:04 -0700 From: jeeja.kp@intel.com To: alsa-devel@alsa-project.org Date: Tue, 20 Sep 2016 19:16:12 +0530 Message-Id: <1474379180-7132-9-git-send-email-jeeja.kp@intel.com> X-Mailer: git-send-email 2.5.0 In-Reply-To: <1474379180-7132-1-git-send-email-jeeja.kp@intel.com> References: <1474379180-7132-1-git-send-email-jeeja.kp@intel.com> Cc: tiwai@suse.de, patches.audio@intel.com, broonie@kernel.org, liam.r.girdwood@intel.com, Jeeja KP Subject: [alsa-devel] [RFC 08/16] ASoC: hdac_hdmi: Add support to handle MST capable pin 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: Jeeja KP To handle Jack event and Configure the Pin widget for MST capable pin, this patch adds: 1. Flag to identify the pin is MST capable. 2. In notify callback(), based on the pipe and port information marks if the port is mst_capable. In case of Non MST, port is defaulted to zero. Signed-off-by: Jeeja KP --- sound/soc/codecs/hdac_hdmi.c | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/sound/soc/codecs/hdac_hdmi.c b/sound/soc/codecs/hdac_hdmi.c index 88d6dae..c9f4d4a 100644 --- a/sound/soc/codecs/hdac_hdmi.c +++ b/sound/soc/codecs/hdac_hdmi.c @@ -81,6 +81,7 @@ struct hdac_hdmi_eld { struct hdac_hdmi_pin { struct list_head head; hda_nid_t nid; + bool is_mst_capable; struct hdac_hdmi_port *ports; int num_ports; struct hdac_ext_device *edev; @@ -1057,6 +1058,7 @@ static void hdac_hdmi_present_sense(struct hdac_hdmi_pin *pin, struct hdac_hdmi_priv *hdmi = edev->private_data; struct hdac_hdmi_pcm *pcm; int size = 0; + int port_id; if (!hdmi) return; @@ -1064,7 +1066,9 @@ static void hdac_hdmi_present_sense(struct hdac_hdmi_pin *pin, mutex_lock(&hdmi->pin_mutex); port->eld.monitor_present = false; - size = snd_hdac_acomp_get_eld(&edev->hdac, pin->nid, -1, + port_id = (pin->is_mst_capable)? port->id: -1; + + size = snd_hdac_acomp_get_eld(&edev->hdac, pin->nid, port_id, &port->eld.monitor_present, port->eld.eld_buffer, ELD_MAX_SIZE); @@ -1154,6 +1158,7 @@ static int hdac_hdmi_add_pin(struct hdac_ext_device *edev, hda_nid_t nid) return -ENOMEM; pin->nid = nid; + pin->is_mst_capable = false; pin->edev = edev; ret = hdac_hdmi_add_ports(hdmi, pin); if (ret < 0) @@ -1352,6 +1357,7 @@ static void hdac_hdmi_eld_notify_cb(void *aptr, int dport, int pipe) struct hdac_hdmi_pin *pin = NULL; struct hdac_hdmi_port *port = NULL; struct snd_soc_codec *codec = edev->scodec; + int i; /* Don't know how this mapping is derived */ hda_nid_t pin_nid = dport + 0x04; @@ -1377,13 +1383,23 @@ static void hdac_hdmi_eld_notify_cb(void *aptr, int dport, int pipe) continue; if (pipe == -1) { + pin->is_mst_capable = false; /* if not MST, default is port[0] */ port = &pin->ports[0]; - break; + goto out; + } else { + for (i=0; i < pin->num_ports; i++) { + pin->is_mst_capable = true; + if (pin->ports[i].id == pipe) { + port = &pin->ports[i]; + goto out; + } + } } } - if (port) +out: + if (pin && port) hdac_hdmi_present_sense(pin, port); }