From patchwork Wed Oct 21 16:50:35 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Takashi Iwai X-Patchwork-Id: 7458901 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 BC740BEEA4 for ; Wed, 21 Oct 2015 16:50:55 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id B7E2B2087D for ; Wed, 21 Oct 2015 16:50:54 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id 5C9E620850 for ; Wed, 21 Oct 2015 16:50:53 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id 482AA2651ED; Wed, 21 Oct 2015 18:50:52 +0200 (CEST) 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 [IPv6:::1]) by alsa0.perex.cz (Postfix) with ESMTP id E49672606F5; Wed, 21 Oct 2015 18:50:43 +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 2A3D52608B1; Wed, 21 Oct 2015 18:50:43 +0200 (CEST) Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) by alsa0.perex.cz (Postfix) with ESMTP id 16BDD26047F for ; Wed, 21 Oct 2015 18:50:36 +0200 (CEST) X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id C0436AD06; Wed, 21 Oct 2015 16:50:34 +0000 (UTC) Date: Wed, 21 Oct 2015 18:50:35 +0200 Message-ID: From: Takashi Iwai To: Daniel Vetter In-Reply-To: References: <20151018171641.GV32532@n2100.arm.linux.org.uk> <20151020033809.GZ27370@localhost> <20151020080800.GU32532@n2100.arm.linux.org.uk> <20151020140148.GC27370@localhost> <20151021092744.GC32532@n2100.arm.linux.org.uk> <20151021140307.GE32532@n2100.arm.linux.org.uk> <20151021153601.GH16848@phenom.ffwll.local> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI/1.14.6 (Maruoka) FLIM/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL/10.8 Emacs/24.5 (x86_64-suse-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Cc: alsa-devel@alsa-project.org, Russell King - ARM Linux , Vinod Koul , broonie@kernel.org, Arnaud Pouliquen , lgirdwood@gmail.com, dri-devel@lists.freedesktop.org, peter.ujfalusi@ti.com, tomi.valkeinen@ti.com, Jyri Sarha Subject: Re: [alsa-devel] HDMI codec, way forward? 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 On Wed, 21 Oct 2015 18:48:06 +0200, Takashi Iwai wrote: > > On Wed, 21 Oct 2015 18:46:23 +0200, > Takashi Iwai wrote: > > > > Below is a test patch I cooked quickly. This is the third patch > > applied after other two more patches: a cleanup patch and a patch for > > deferred probe of HD-audio with component. > > And this is the patch to defer the probe. ... and the first patch, a sort of cleanup, is here (sorry for the mess). I put these three in test/hda-i915 branch of my sound git tree. Takashi ---- 8< ---- From: Takashi Iwai Subject: [PATCH 1/3] ALSA: hda - Pass hdac_device object at notifier registration For dropping the local static variable in hdac_i915.c, add an argument to pass the hdac_device object to snd-Hdac_i915_register_notifier(). This allows us (in theory) having individual audio component per bus. Signed-off-by: Takashi Iwai --- include/sound/hda_i915.h | 6 ++++-- sound/hda/hdac_i915.c | 21 +++++++++++++-------- sound/pci/hda/patch_hdmi.c | 5 +++-- 3 files changed, 20 insertions(+), 12 deletions(-) diff --git a/include/sound/hda_i915.h b/include/sound/hda_i915.h index 930b41e5acf4..7b19f1f8cc23 100644 --- a/include/sound/hda_i915.h +++ b/include/sound/hda_i915.h @@ -12,7 +12,8 @@ int snd_hdac_display_power(struct hdac_bus *bus, bool enable); int snd_hdac_get_display_clk(struct hdac_bus *bus); int snd_hdac_i915_init(struct hdac_bus *bus); int snd_hdac_i915_exit(struct hdac_bus *bus); -int snd_hdac_i915_register_notifier(const struct i915_audio_component_audio_ops *); +int snd_hdac_i915_register_notifier(struct hdac_device *codec, + const struct i915_audio_component_audio_ops *); #else static inline int snd_hdac_set_codec_wakeup(struct hdac_bus *bus, bool enable) { @@ -34,7 +35,8 @@ static inline int snd_hdac_i915_exit(struct hdac_bus *bus) { return 0; } -static inline int snd_hdac_i915_register_notifier(const struct i915_audio_component_audio_ops *ops) +static inline int snd_hdac_i915_register_notifier(struct hdac_device *codec, + const struct i915_audio_component_audio_ops *ops) { return -ENODEV; } diff --git a/sound/hda/hdac_i915.c b/sound/hda/hdac_i915.c index 55c3df4458f7..e36ed18f23c4 100644 --- a/sound/hda/hdac_i915.c +++ b/sound/hda/hdac_i915.c @@ -21,8 +21,6 @@ #include #include -static struct i915_audio_component *hdac_acomp; - int snd_hdac_set_codec_wakeup(struct hdac_bus *bus, bool enable) { struct i915_audio_component *acomp = bus->audio_component; @@ -84,7 +82,9 @@ EXPORT_SYMBOL_GPL(snd_hdac_get_display_clk); static int hdac_component_master_bind(struct device *dev) { - struct i915_audio_component *acomp = hdac_acomp; + struct hdac_device *codec = dev_to_hdac_dev(dev); + struct hdac_bus *bus = codec->bus; + struct i915_audio_component *acomp = bus->audio_component; int ret; ret = component_bind_all(dev, acomp); @@ -116,7 +116,9 @@ out_unbind: static void hdac_component_master_unbind(struct device *dev) { - struct i915_audio_component *acomp = hdac_acomp; + struct hdac_device *codec = dev_to_hdac_dev(dev); + struct hdac_bus *bus = codec->bus; + struct i915_audio_component *acomp = bus->audio_component; module_put(acomp->ops->owner); component_unbind_all(dev, acomp); @@ -134,12 +136,16 @@ static int hdac_component_master_match(struct device *dev, void *data) return !strcmp(dev->driver->name, "i915"); } -int snd_hdac_i915_register_notifier(const struct i915_audio_component_audio_ops *aops) +int snd_hdac_i915_register_notifier(struct hdac_device *codec, + const struct i915_audio_component_audio_ops *aops) { - if (WARN_ON(!hdac_acomp)) + struct hdac_bus *bus = codec->bus; + struct i915_audio_component *acomp = bus->audio_component; + + if (WARN_ON(!acomp)) return -ENODEV; - hdac_acomp->audio_ops = aops; + acomp->audio_ops = aops; return 0; } EXPORT_SYMBOL_GPL(snd_hdac_i915_register_notifier); @@ -155,7 +161,6 @@ int snd_hdac_i915_init(struct hdac_bus *bus) if (!acomp) return -ENOMEM; bus->audio_component = acomp; - hdac_acomp = acomp; component_match_add(dev, &match, hdac_component_master_match, bus); ret = component_master_add_with_match(dev, &hdac_component_master_ops, diff --git a/sound/pci/hda/patch_hdmi.c b/sound/pci/hda/patch_hdmi.c index f503a883bef3..fbd60ea98f19 100644 --- a/sound/pci/hda/patch_hdmi.c +++ b/sound/pci/hda/patch_hdmi.c @@ -2216,7 +2216,7 @@ static void generic_hdmi_free(struct hda_codec *codec) int pin_idx; if (is_haswell_plus(codec) || is_valleyview_plus(codec)) - snd_hdac_i915_register_notifier(NULL); + snd_hdac_i915_register_notifier(&codec->core, NULL); for (pin_idx = 0; pin_idx < spec->num_pins; pin_idx++) { struct hdmi_spec_per_pin *per_pin = get_pin(spec, pin_idx); @@ -2381,7 +2381,8 @@ static int patch_generic_hdmi(struct hda_codec *codec) codec->depop_delay = 0; spec->i915_audio_ops.audio_ptr = codec; spec->i915_audio_ops.pin_eld_notify = intel_pin_eld_notify; - snd_hdac_i915_register_notifier(&spec->i915_audio_ops); + snd_hdac_i915_register_notifier(&codec->core, + &spec->i915_audio_ops); } if (hdmi_parse_codec(codec) < 0) {