@@ -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;
}
@@ -21,8 +21,6 @@
#include <sound/hdaudio.h>
#include <sound/hda_i915.h>
-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,
@@ -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) {