From patchwork Mon Mar 21 08:37:55 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: libin.yang@linux.intel.com X-Patchwork-Id: 8630341 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 04969C0553 for ; Mon, 21 Mar 2016 08:40:38 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 0D88E20279 for ; Mon, 21 Mar 2016 08:40:37 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id 9E0F720270 for ; Mon, 21 Mar 2016 08:40:35 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id D64E42614FD; Mon, 21 Mar 2016 09:40:31 +0100 (CET) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id 7489726516A; Mon, 21 Mar 2016 09:39:16 +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 11619265176; Mon, 21 Mar 2016 09:39:14 +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=-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 mga02.intel.com (mga02.intel.com [134.134.136.20]) by alsa0.perex.cz (Postfix) with ESMTP id 2A1752614FD for ; Mon, 21 Mar 2016 09:39:06 +0100 (CET) Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga101.jf.intel.com with ESMTP; 21 Mar 2016 01:39:06 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.24,370,1455004800"; d="scan'208";a="768074642" Received: from younglee-grantley.sh.intel.com ([10.239.159.22]) by orsmga003.jf.intel.com with ESMTP; 21 Mar 2016 01:39:04 -0700 From: libin.yang@linux.intel.com To: alsa-devel@alsa-project.org, tiwai@suse.de Date: Mon, 21 Mar 2016 16:37:55 +0800 Message-Id: <1458549476-77040-3-git-send-email-libin.yang@linux.intel.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1458549476-77040-1-git-send-email-libin.yang@linux.intel.com> References: <1458549476-77040-1-git-send-email-libin.yang@linux.intel.com> Cc: libin.yang@intel.com, mengdong.lin@intel.com, Libin Yang Subject: [alsa-devel] [RFC PATCH v2 2/3] ALSA - hda: add devid support in acom 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: Libin Yang This is a tmp API patch for gfx. Detail is still in discussion --- drivers/gpu/drm/i915/intel_audio.c | 2 +- include/drm/i915_component.h | 2 +- include/sound/hda_i915.h | 6 +++--- sound/hda/hdac_i915.c | 7 ++++--- sound/pci/hda/patch_hdmi.c | 5 +++-- 5 files changed, 12 insertions(+), 10 deletions(-) diff --git a/drivers/gpu/drm/i915/intel_audio.c b/drivers/gpu/drm/i915/intel_audio.c index 31f6d21..3fdb6d9 100644 --- a/drivers/gpu/drm/i915/intel_audio.c +++ b/drivers/gpu/drm/i915/intel_audio.c @@ -710,7 +710,7 @@ static int i915_audio_component_sync_audio_rate(struct device *dev, } static int i915_audio_component_get_eld(struct device *dev, int port, - bool *enabled, + int dev_id, bool *enabled, unsigned char *buf, int max_bytes) { struct drm_i915_private *dev_priv = dev_to_i915(dev); diff --git a/include/drm/i915_component.h b/include/drm/i915_component.h index b46fa0e..3c4475a 100644 --- a/include/drm/i915_component.h +++ b/include/drm/i915_component.h @@ -77,7 +77,7 @@ struct i915_audio_component_ops { * Note that the returned size may be over @max_bytes. Then it * implies that only a part of ELD has been copied to the buffer. */ - int (*get_eld)(struct device *, int port, bool *enabled, + int (*get_eld)(struct device *, int port, int dev_id, bool *enabled, unsigned char *buf, int max_bytes); }; diff --git a/include/sound/hda_i915.h b/include/sound/hda_i915.h index fa341fc..07403f7 100644 --- a/include/sound/hda_i915.h +++ b/include/sound/hda_i915.h @@ -11,7 +11,7 @@ int snd_hdac_set_codec_wakeup(struct hdac_bus *bus, bool enable); int snd_hdac_display_power(struct hdac_bus *bus, bool enable); int snd_hdac_get_display_clk(struct hdac_bus *bus); int snd_hdac_sync_audio_rate(struct hdac_bus *bus, hda_nid_t nid, int rate); -int snd_hdac_acomp_get_eld(struct hdac_bus *bus, hda_nid_t nid, +int snd_hdac_acomp_get_eld(struct hdac_bus *bus, hda_nid_t nid, int dev_id, bool *audio_enabled, char *buffer, int max_bytes); int snd_hdac_i915_init(struct hdac_bus *bus); int snd_hdac_i915_exit(struct hdac_bus *bus); @@ -35,8 +35,8 @@ static inline int snd_hdac_sync_audio_rate(struct hdac_bus *bus, hda_nid_t nid, return 0; } static inline int snd_hdac_acomp_get_eld(struct hdac_bus *bus, hda_nid_t nid, - bool *audio_enabled, char *buffer, - int max_bytes) + int dev_id, bool *audio_enabled, + char *buffer, int max_bytes) { return -ENODEV; } diff --git a/sound/hda/hdac_i915.c b/sound/hda/hdac_i915.c index f6854db..18173c7 100644 --- a/sound/hda/hdac_i915.c +++ b/sound/hda/hdac_i915.c @@ -155,6 +155,7 @@ EXPORT_SYMBOL_GPL(snd_hdac_sync_audio_rate); * snd_hdac_acomp_get_eld - Get the audio state and ELD via component * @bus: HDA core bus * @nid: the pin widget NID + * @dev_id: the device entry id * @audio_enabled: the pointer to store the current audio state * @buffer: the buffer pointer to store ELD bytes * @max_bytes: the max bytes to be stored on @buffer @@ -171,7 +172,7 @@ EXPORT_SYMBOL_GPL(snd_hdac_sync_audio_rate); * thus it may be over @max_bytes. If it's over @max_bytes, it implies * that only a part of ELD bytes have been fetched. */ -int snd_hdac_acomp_get_eld(struct hdac_bus *bus, hda_nid_t nid, +int snd_hdac_acomp_get_eld(struct hdac_bus *bus, hda_nid_t nid, int dev_id, bool *audio_enabled, char *buffer, int max_bytes) { struct i915_audio_component *acomp = bus->audio_component; @@ -179,8 +180,8 @@ int snd_hdac_acomp_get_eld(struct hdac_bus *bus, hda_nid_t nid, if (!acomp || !acomp->ops || !acomp->ops->get_eld) return -ENODEV; - return acomp->ops->get_eld(acomp->dev, pin2port(nid), audio_enabled, - buffer, max_bytes); + return acomp->ops->get_eld(acomp->dev, pin2port(nid), dev_id, + audio_enabled, buffer, max_bytes); } EXPORT_SYMBOL_GPL(snd_hdac_acomp_get_eld); diff --git a/sound/pci/hda/patch_hdmi.c b/sound/pci/hda/patch_hdmi.c index 7e03200..5987a31 100644 --- a/sound/pci/hda/patch_hdmi.c +++ b/sound/pci/hda/patch_hdmi.c @@ -75,6 +75,7 @@ struct hdmi_spec_per_cvt { struct hdmi_spec_per_pin { hda_nid_t pin_nid; + int dev_id; /* pin idx, different device entries on the same pin use the same idx */ int pin_nid_idx; int num_mux_nids; @@ -2013,8 +2014,8 @@ static void sync_eld_via_acomp(struct hda_codec *codec, mutex_lock(&per_pin->lock); size = snd_hdac_acomp_get_eld(&codec->bus->core, per_pin->pin_nid, - &eld->monitor_present, eld->eld_buffer, - ELD_MAX_SIZE); + per_pin->dev_id, &eld->monitor_present, + eld->eld_buffer, ELD_MAX_SIZE); if (size < 0) goto unlock; if (size > 0) {