diff options
author | Takashi Iwai <tiwai@suse.de> | 2018-07-11 09:17:22 -0400 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2018-07-17 16:25:19 -0400 |
commit | ae891abe7c2ccf75b69ca8330225e37ecc06924e (patch) | |
tree | b5b8e9c886221b22ae76e7a3480cad15fa1086b4 | |
parent | 9a9b13dd275dfe49ee0cf3ae5dc931069eb41475 (diff) |
drm/i915: Split audio component to a generic type
For allowing other drivers to use the DRM audio component, rename the
i915_audio_component_* with drm_audio_component_*, and split the
generic part into drm_audio_component.h. The i915 specific stuff
remains in struct i915_audio_component, which contains
drm_audio_component as the base.
The license of drm_audio_component.h is kept to MIT as same as the the
original i915_component.h.
This is a preliminary change for further development, and no
functional changes by this patch itself, merely code-split and
renames.
v1->v2: Use SPDX for drm_audio_component.h, fix remaining i915
argument in drm_audio_component.h
Reviewed-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
-rw-r--r-- | drivers/gpu/drm/i915/intel_audio.c | 22 | ||||
-rw-r--r-- | include/drm/drm_audio_component.h | 95 | ||||
-rw-r--r-- | include/drm/i915_component.h | 85 | ||||
-rw-r--r-- | include/sound/hda_i915.h | 6 | ||||
-rw-r--r-- | include/sound/hdaudio.h | 6 | ||||
-rw-r--r-- | sound/hda/hdac_i915.c | 40 | ||||
-rw-r--r-- | sound/pci/hda/patch_hdmi.c | 8 | ||||
-rw-r--r-- | sound/soc/codecs/hdac_hdmi.c | 2 |
8 files changed, 144 insertions, 120 deletions
diff --git a/drivers/gpu/drm/i915/intel_audio.c b/drivers/gpu/drm/i915/intel_audio.c index 3ea566f99450..7dd5605d94ae 100644 --- a/drivers/gpu/drm/i915/intel_audio.c +++ b/drivers/gpu/drm/i915/intel_audio.c | |||
@@ -639,11 +639,12 @@ void intel_audio_codec_enable(struct intel_encoder *encoder, | |||
639 | dev_priv->av_enc_map[pipe] = encoder; | 639 | dev_priv->av_enc_map[pipe] = encoder; |
640 | mutex_unlock(&dev_priv->av_mutex); | 640 | mutex_unlock(&dev_priv->av_mutex); |
641 | 641 | ||
642 | if (acomp && acomp->audio_ops && acomp->audio_ops->pin_eld_notify) { | 642 | if (acomp && acomp->base.audio_ops && |
643 | acomp->base.audio_ops->pin_eld_notify) { | ||
643 | /* audio drivers expect pipe = -1 to indicate Non-MST cases */ | 644 | /* audio drivers expect pipe = -1 to indicate Non-MST cases */ |
644 | if (!intel_crtc_has_type(crtc_state, INTEL_OUTPUT_DP_MST)) | 645 | if (!intel_crtc_has_type(crtc_state, INTEL_OUTPUT_DP_MST)) |
645 | pipe = -1; | 646 | pipe = -1; |
646 | acomp->audio_ops->pin_eld_notify(acomp->audio_ops->audio_ptr, | 647 | acomp->base.audio_ops->pin_eld_notify(acomp->base.audio_ops->audio_ptr, |
647 | (int) port, (int) pipe); | 648 | (int) port, (int) pipe); |
648 | } | 649 | } |
649 | 650 | ||
@@ -681,11 +682,12 @@ void intel_audio_codec_disable(struct intel_encoder *encoder, | |||
681 | dev_priv->av_enc_map[pipe] = NULL; | 682 | dev_priv->av_enc_map[pipe] = NULL; |
682 | mutex_unlock(&dev_priv->av_mutex); | 683 | mutex_unlock(&dev_priv->av_mutex); |
683 | 684 | ||
684 | if (acomp && acomp->audio_ops && acomp->audio_ops->pin_eld_notify) { | 685 | if (acomp && acomp->base.audio_ops && |
686 | acomp->base.audio_ops->pin_eld_notify) { | ||
685 | /* audio drivers expect pipe = -1 to indicate Non-MST cases */ | 687 | /* audio drivers expect pipe = -1 to indicate Non-MST cases */ |
686 | if (!intel_crtc_has_type(old_crtc_state, INTEL_OUTPUT_DP_MST)) | 688 | if (!intel_crtc_has_type(old_crtc_state, INTEL_OUTPUT_DP_MST)) |
687 | pipe = -1; | 689 | pipe = -1; |
688 | acomp->audio_ops->pin_eld_notify(acomp->audio_ops->audio_ptr, | 690 | acomp->base.audio_ops->pin_eld_notify(acomp->base.audio_ops->audio_ptr, |
689 | (int) port, (int) pipe); | 691 | (int) port, (int) pipe); |
690 | } | 692 | } |
691 | 693 | ||
@@ -880,7 +882,7 @@ static int i915_audio_component_get_eld(struct device *kdev, int port, | |||
880 | return ret; | 882 | return ret; |
881 | } | 883 | } |
882 | 884 | ||
883 | static const struct i915_audio_component_ops i915_audio_component_ops = { | 885 | static const struct drm_audio_component_ops i915_audio_component_ops = { |
884 | .owner = THIS_MODULE, | 886 | .owner = THIS_MODULE, |
885 | .get_power = i915_audio_component_get_power, | 887 | .get_power = i915_audio_component_get_power, |
886 | .put_power = i915_audio_component_put_power, | 888 | .put_power = i915_audio_component_put_power, |
@@ -897,12 +899,12 @@ static int i915_audio_component_bind(struct device *i915_kdev, | |||
897 | struct drm_i915_private *dev_priv = kdev_to_i915(i915_kdev); | 899 | struct drm_i915_private *dev_priv = kdev_to_i915(i915_kdev); |
898 | int i; | 900 | int i; |
899 | 901 | ||
900 | if (WARN_ON(acomp->ops || acomp->dev)) | 902 | if (WARN_ON(acomp->base.ops || acomp->base.dev)) |
901 | return -EEXIST; | 903 | return -EEXIST; |
902 | 904 | ||
903 | drm_modeset_lock_all(&dev_priv->drm); | 905 | drm_modeset_lock_all(&dev_priv->drm); |
904 | acomp->ops = &i915_audio_component_ops; | 906 | acomp->base.ops = &i915_audio_component_ops; |
905 | acomp->dev = i915_kdev; | 907 | acomp->base.dev = i915_kdev; |
906 | BUILD_BUG_ON(MAX_PORTS != I915_MAX_PORTS); | 908 | BUILD_BUG_ON(MAX_PORTS != I915_MAX_PORTS); |
907 | for (i = 0; i < ARRAY_SIZE(acomp->aud_sample_rate); i++) | 909 | for (i = 0; i < ARRAY_SIZE(acomp->aud_sample_rate); i++) |
908 | acomp->aud_sample_rate[i] = 0; | 910 | acomp->aud_sample_rate[i] = 0; |
@@ -919,8 +921,8 @@ static void i915_audio_component_unbind(struct device *i915_kdev, | |||
919 | struct drm_i915_private *dev_priv = kdev_to_i915(i915_kdev); | 921 | struct drm_i915_private *dev_priv = kdev_to_i915(i915_kdev); |
920 | 922 | ||
921 | drm_modeset_lock_all(&dev_priv->drm); | 923 | drm_modeset_lock_all(&dev_priv->drm); |
922 | acomp->ops = NULL; | 924 | acomp->base.ops = NULL; |
923 | acomp->dev = NULL; | 925 | acomp->base.dev = NULL; |
924 | dev_priv->audio_component = NULL; | 926 | dev_priv->audio_component = NULL; |
925 | drm_modeset_unlock_all(&dev_priv->drm); | 927 | drm_modeset_unlock_all(&dev_priv->drm); |
926 | } | 928 | } |
diff --git a/include/drm/drm_audio_component.h b/include/drm/drm_audio_component.h new file mode 100644 index 000000000000..e85689f212c2 --- /dev/null +++ b/include/drm/drm_audio_component.h | |||
@@ -0,0 +1,95 @@ | |||
1 | // SPDX-License-Identifier: MIT | ||
2 | // Copyright © 2014 Intel Corporation | ||
3 | |||
4 | #ifndef _DRM_AUDIO_COMPONENT_H_ | ||
5 | #define _DRM_AUDIO_COMPONENT_H_ | ||
6 | |||
7 | /** | ||
8 | * struct drm_audio_component_ops - Ops implemented by DRM driver, called by hda driver | ||
9 | */ | ||
10 | struct drm_audio_component_ops { | ||
11 | /** | ||
12 | * @owner: drm module to pin down | ||
13 | */ | ||
14 | struct module *owner; | ||
15 | /** | ||
16 | * @get_power: get the POWER_DOMAIN_AUDIO power well | ||
17 | * | ||
18 | * Request the power well to be turned on. | ||
19 | */ | ||
20 | void (*get_power)(struct device *); | ||
21 | /** | ||
22 | * @put_power: put the POWER_DOMAIN_AUDIO power well | ||
23 | * | ||
24 | * Allow the power well to be turned off. | ||
25 | */ | ||
26 | void (*put_power)(struct device *); | ||
27 | /** | ||
28 | * @codec_wake_override: Enable/disable codec wake signal | ||
29 | */ | ||
30 | void (*codec_wake_override)(struct device *, bool enable); | ||
31 | /** | ||
32 | * @get_cdclk_freq: Get the Core Display Clock in kHz | ||
33 | */ | ||
34 | int (*get_cdclk_freq)(struct device *); | ||
35 | /** | ||
36 | * @sync_audio_rate: set n/cts based on the sample rate | ||
37 | * | ||
38 | * Called from audio driver. After audio driver sets the | ||
39 | * sample rate, it will call this function to set n/cts | ||
40 | */ | ||
41 | int (*sync_audio_rate)(struct device *, int port, int pipe, int rate); | ||
42 | /** | ||
43 | * @get_eld: fill the audio state and ELD bytes for the given port | ||
44 | * | ||
45 | * Called from audio driver to get the HDMI/DP audio state of the given | ||
46 | * digital port, and also fetch ELD bytes to the given pointer. | ||
47 | * | ||
48 | * It returns the byte size of the original ELD (not the actually | ||
49 | * copied size), zero for an invalid ELD, or a negative error code. | ||
50 | * | ||
51 | * Note that the returned size may be over @max_bytes. Then it | ||
52 | * implies that only a part of ELD has been copied to the buffer. | ||
53 | */ | ||
54 | int (*get_eld)(struct device *, int port, int pipe, bool *enabled, | ||
55 | unsigned char *buf, int max_bytes); | ||
56 | }; | ||
57 | |||
58 | /** | ||
59 | * struct drm_audio_component_audio_ops - Ops implemented by hda driver, called by DRM driver | ||
60 | */ | ||
61 | struct drm_audio_component_audio_ops { | ||
62 | /** | ||
63 | * @audio_ptr: Pointer to be used in call to pin_eld_notify | ||
64 | */ | ||
65 | void *audio_ptr; | ||
66 | /** | ||
67 | * @pin_eld_notify: Notify the HDA driver that pin sense and/or ELD information has changed | ||
68 | * | ||
69 | * Called when the DRM driver has set up audio pipeline or has just | ||
70 | * begun to tear it down. This allows the HDA driver to update its | ||
71 | * status accordingly (even when the HDA controller is in power save | ||
72 | * mode). | ||
73 | */ | ||
74 | void (*pin_eld_notify)(void *audio_ptr, int port, int pipe); | ||
75 | }; | ||
76 | |||
77 | /** | ||
78 | * struct drm_audio_component - Used for direct communication between DRM and hda drivers | ||
79 | */ | ||
80 | struct drm_audio_component { | ||
81 | /** | ||
82 | * @dev: DRM device, used as parameter for ops | ||
83 | */ | ||
84 | struct device *dev; | ||
85 | /** | ||
86 | * @ops: Ops implemented by DRM driver, called by hda driver | ||
87 | */ | ||
88 | const struct drm_audio_component_ops *ops; | ||
89 | /** | ||
90 | * @audio_ops: Ops implemented by hda driver, called by DRM driver | ||
91 | */ | ||
92 | const struct drm_audio_component_audio_ops *audio_ops; | ||
93 | }; | ||
94 | |||
95 | #endif /* _DRM_AUDIO_COMPONENT_H_ */ | ||
diff --git a/include/drm/i915_component.h b/include/drm/i915_component.h index 346b1f5cb180..fca22d463e1b 100644 --- a/include/drm/i915_component.h +++ b/include/drm/i915_component.h | |||
@@ -24,101 +24,26 @@ | |||
24 | #ifndef _I915_COMPONENT_H_ | 24 | #ifndef _I915_COMPONENT_H_ |
25 | #define _I915_COMPONENT_H_ | 25 | #define _I915_COMPONENT_H_ |
26 | 26 | ||
27 | #include "drm_audio_component.h" | ||
28 | |||
27 | /* MAX_PORT is the number of port | 29 | /* MAX_PORT is the number of port |
28 | * It must be sync with I915_MAX_PORTS defined i915_drv.h | 30 | * It must be sync with I915_MAX_PORTS defined i915_drv.h |
29 | */ | 31 | */ |
30 | #define MAX_PORTS 6 | 32 | #define MAX_PORTS 6 |
31 | 33 | ||
32 | /** | 34 | /** |
33 | * struct i915_audio_component_ops - Ops implemented by i915 driver, called by hda driver | ||
34 | */ | ||
35 | struct i915_audio_component_ops { | ||
36 | /** | ||
37 | * @owner: i915 module | ||
38 | */ | ||
39 | struct module *owner; | ||
40 | /** | ||
41 | * @get_power: get the POWER_DOMAIN_AUDIO power well | ||
42 | * | ||
43 | * Request the power well to be turned on. | ||
44 | */ | ||
45 | void (*get_power)(struct device *); | ||
46 | /** | ||
47 | * @put_power: put the POWER_DOMAIN_AUDIO power well | ||
48 | * | ||
49 | * Allow the power well to be turned off. | ||
50 | */ | ||
51 | void (*put_power)(struct device *); | ||
52 | /** | ||
53 | * @codec_wake_override: Enable/disable codec wake signal | ||
54 | */ | ||
55 | void (*codec_wake_override)(struct device *, bool enable); | ||
56 | /** | ||
57 | * @get_cdclk_freq: Get the Core Display Clock in kHz | ||
58 | */ | ||
59 | int (*get_cdclk_freq)(struct device *); | ||
60 | /** | ||
61 | * @sync_audio_rate: set n/cts based on the sample rate | ||
62 | * | ||
63 | * Called from audio driver. After audio driver sets the | ||
64 | * sample rate, it will call this function to set n/cts | ||
65 | */ | ||
66 | int (*sync_audio_rate)(struct device *, int port, int pipe, int rate); | ||
67 | /** | ||
68 | * @get_eld: fill the audio state and ELD bytes for the given port | ||
69 | * | ||
70 | * Called from audio driver to get the HDMI/DP audio state of the given | ||
71 | * digital port, and also fetch ELD bytes to the given pointer. | ||
72 | * | ||
73 | * It returns the byte size of the original ELD (not the actually | ||
74 | * copied size), zero for an invalid ELD, or a negative error code. | ||
75 | * | ||
76 | * Note that the returned size may be over @max_bytes. Then it | ||
77 | * implies that only a part of ELD has been copied to the buffer. | ||
78 | */ | ||
79 | int (*get_eld)(struct device *, int port, int pipe, bool *enabled, | ||
80 | unsigned char *buf, int max_bytes); | ||
81 | }; | ||
82 | |||
83 | /** | ||
84 | * struct i915_audio_component_audio_ops - Ops implemented by hda driver, called by i915 driver | ||
85 | */ | ||
86 | struct i915_audio_component_audio_ops { | ||
87 | /** | ||
88 | * @audio_ptr: Pointer to be used in call to pin_eld_notify | ||
89 | */ | ||
90 | void *audio_ptr; | ||
91 | /** | ||
92 | * @pin_eld_notify: Notify the HDA driver that pin sense and/or ELD information has changed | ||
93 | * | ||
94 | * Called when the i915 driver has set up audio pipeline or has just | ||
95 | * begun to tear it down. This allows the HDA driver to update its | ||
96 | * status accordingly (even when the HDA controller is in power save | ||
97 | * mode). | ||
98 | */ | ||
99 | void (*pin_eld_notify)(void *audio_ptr, int port, int pipe); | ||
100 | }; | ||
101 | |||
102 | /** | ||
103 | * struct i915_audio_component - Used for direct communication between i915 and hda drivers | 35 | * struct i915_audio_component - Used for direct communication between i915 and hda drivers |
104 | */ | 36 | */ |
105 | struct i915_audio_component { | 37 | struct i915_audio_component { |
106 | /** | 38 | /** |
107 | * @dev: i915 device, used as parameter for ops | 39 | * @base: the drm_audio_component base class |
108 | */ | 40 | */ |
109 | struct device *dev; | 41 | struct drm_audio_component base; |
42 | |||
110 | /** | 43 | /** |
111 | * @aud_sample_rate: the array of audio sample rate per port | 44 | * @aud_sample_rate: the array of audio sample rate per port |
112 | */ | 45 | */ |
113 | int aud_sample_rate[MAX_PORTS]; | 46 | int aud_sample_rate[MAX_PORTS]; |
114 | /** | ||
115 | * @ops: Ops implemented by i915 driver, called by hda driver | ||
116 | */ | ||
117 | const struct i915_audio_component_ops *ops; | ||
118 | /** | ||
119 | * @audio_ops: Ops implemented by hda driver, called by i915 driver | ||
120 | */ | ||
121 | const struct i915_audio_component_audio_ops *audio_ops; | ||
122 | }; | 47 | }; |
123 | 48 | ||
124 | #endif /* _I915_COMPONENT_H_ */ | 49 | #endif /* _I915_COMPONENT_H_ */ |
diff --git a/include/sound/hda_i915.h b/include/sound/hda_i915.h index a94f5b6f92ac..f69ea84e7b65 100644 --- a/include/sound/hda_i915.h +++ b/include/sound/hda_i915.h | |||
@@ -5,7 +5,7 @@ | |||
5 | #ifndef __SOUND_HDA_I915_H | 5 | #ifndef __SOUND_HDA_I915_H |
6 | #define __SOUND_HDA_I915_H | 6 | #define __SOUND_HDA_I915_H |
7 | 7 | ||
8 | #include <drm/i915_component.h> | 8 | #include <drm/drm_audio_component.h> |
9 | 9 | ||
10 | #ifdef CONFIG_SND_HDA_I915 | 10 | #ifdef CONFIG_SND_HDA_I915 |
11 | int snd_hdac_set_codec_wakeup(struct hdac_bus *bus, bool enable); | 11 | int snd_hdac_set_codec_wakeup(struct hdac_bus *bus, bool enable); |
@@ -17,7 +17,7 @@ int snd_hdac_acomp_get_eld(struct hdac_device *codec, hda_nid_t nid, int dev_id, | |||
17 | bool *audio_enabled, char *buffer, int max_bytes); | 17 | bool *audio_enabled, char *buffer, int max_bytes); |
18 | int snd_hdac_i915_init(struct hdac_bus *bus); | 18 | int snd_hdac_i915_init(struct hdac_bus *bus); |
19 | int snd_hdac_i915_exit(struct hdac_bus *bus); | 19 | int snd_hdac_i915_exit(struct hdac_bus *bus); |
20 | int snd_hdac_i915_register_notifier(const struct i915_audio_component_audio_ops *); | 20 | int snd_hdac_i915_register_notifier(const struct drm_audio_component_audio_ops *); |
21 | #else | 21 | #else |
22 | static inline int snd_hdac_set_codec_wakeup(struct hdac_bus *bus, bool enable) | 22 | static inline int snd_hdac_set_codec_wakeup(struct hdac_bus *bus, bool enable) |
23 | { | 23 | { |
@@ -49,7 +49,7 @@ static inline int snd_hdac_i915_exit(struct hdac_bus *bus) | |||
49 | { | 49 | { |
50 | return 0; | 50 | return 0; |
51 | } | 51 | } |
52 | static inline int snd_hdac_i915_register_notifier(const struct i915_audio_component_audio_ops *ops) | 52 | static inline int snd_hdac_i915_register_notifier(const struct drm_audio_component_audio_ops *ops) |
53 | { | 53 | { |
54 | return -ENODEV; | 54 | return -ENODEV; |
55 | } | 55 | } |
diff --git a/include/sound/hdaudio.h b/include/sound/hdaudio.h index f1baaa88e766..ab5ee3ef2198 100644 --- a/include/sound/hdaudio.h +++ b/include/sound/hdaudio.h | |||
@@ -333,9 +333,9 @@ struct hdac_bus { | |||
333 | spinlock_t reg_lock; | 333 | spinlock_t reg_lock; |
334 | struct mutex cmd_mutex; | 334 | struct mutex cmd_mutex; |
335 | 335 | ||
336 | /* i915 component interface */ | 336 | /* DRM component interface */ |
337 | struct i915_audio_component *audio_component; | 337 | struct drm_audio_component *audio_component; |
338 | int i915_power_refcount; | 338 | int drm_power_refcount; |
339 | 339 | ||
340 | /* parameters required for enhanced capabilities */ | 340 | /* parameters required for enhanced capabilities */ |
341 | int num_streams; | 341 | int num_streams; |
diff --git a/sound/hda/hdac_i915.c b/sound/hda/hdac_i915.c index cbe818eda336..1a88c1aaf9bb 100644 --- a/sound/hda/hdac_i915.c +++ b/sound/hda/hdac_i915.c | |||
@@ -16,13 +16,13 @@ | |||
16 | #include <linux/module.h> | 16 | #include <linux/module.h> |
17 | #include <linux/pci.h> | 17 | #include <linux/pci.h> |
18 | #include <linux/component.h> | 18 | #include <linux/component.h> |
19 | #include <drm/i915_component.h> | 19 | #include <drm/drm_audio_component.h> |
20 | #include <sound/core.h> | 20 | #include <sound/core.h> |
21 | #include <sound/hdaudio.h> | 21 | #include <sound/hdaudio.h> |
22 | #include <sound/hda_i915.h> | 22 | #include <sound/hda_i915.h> |
23 | #include <sound/hda_register.h> | 23 | #include <sound/hda_register.h> |
24 | 24 | ||
25 | static struct i915_audio_component *hdac_acomp; | 25 | static struct drm_audio_component *hdac_acomp; |
26 | 26 | ||
27 | /** | 27 | /** |
28 | * snd_hdac_set_codec_wakeup - Enable / disable HDMI/DP codec wakeup | 28 | * snd_hdac_set_codec_wakeup - Enable / disable HDMI/DP codec wakeup |
@@ -39,7 +39,7 @@ static struct i915_audio_component *hdac_acomp; | |||
39 | */ | 39 | */ |
40 | int snd_hdac_set_codec_wakeup(struct hdac_bus *bus, bool enable) | 40 | int snd_hdac_set_codec_wakeup(struct hdac_bus *bus, bool enable) |
41 | { | 41 | { |
42 | struct i915_audio_component *acomp = bus->audio_component; | 42 | struct drm_audio_component *acomp = bus->audio_component; |
43 | 43 | ||
44 | if (!acomp || !acomp->ops) | 44 | if (!acomp || !acomp->ops) |
45 | return -ENODEV; | 45 | return -ENODEV; |
@@ -74,7 +74,7 @@ EXPORT_SYMBOL_GPL(snd_hdac_set_codec_wakeup); | |||
74 | */ | 74 | */ |
75 | int snd_hdac_display_power(struct hdac_bus *bus, bool enable) | 75 | int snd_hdac_display_power(struct hdac_bus *bus, bool enable) |
76 | { | 76 | { |
77 | struct i915_audio_component *acomp = bus->audio_component; | 77 | struct drm_audio_component *acomp = bus->audio_component; |
78 | 78 | ||
79 | if (!acomp || !acomp->ops) | 79 | if (!acomp || !acomp->ops) |
80 | return -ENODEV; | 80 | return -ENODEV; |
@@ -83,14 +83,14 @@ int snd_hdac_display_power(struct hdac_bus *bus, bool enable) | |||
83 | enable ? "enable" : "disable"); | 83 | enable ? "enable" : "disable"); |
84 | 84 | ||
85 | if (enable) { | 85 | if (enable) { |
86 | if (!bus->i915_power_refcount++) { | 86 | if (!bus->drm_power_refcount++) { |
87 | acomp->ops->get_power(acomp->dev); | 87 | acomp->ops->get_power(acomp->dev); |
88 | snd_hdac_set_codec_wakeup(bus, true); | 88 | snd_hdac_set_codec_wakeup(bus, true); |
89 | snd_hdac_set_codec_wakeup(bus, false); | 89 | snd_hdac_set_codec_wakeup(bus, false); |
90 | } | 90 | } |
91 | } else { | 91 | } else { |
92 | WARN_ON(!bus->i915_power_refcount); | 92 | WARN_ON(!bus->drm_power_refcount); |
93 | if (!--bus->i915_power_refcount) | 93 | if (!--bus->drm_power_refcount) |
94 | acomp->ops->put_power(acomp->dev); | 94 | acomp->ops->put_power(acomp->dev); |
95 | } | 95 | } |
96 | 96 | ||
@@ -119,7 +119,7 @@ EXPORT_SYMBOL_GPL(snd_hdac_display_power); | |||
119 | */ | 119 | */ |
120 | void snd_hdac_i915_set_bclk(struct hdac_bus *bus) | 120 | void snd_hdac_i915_set_bclk(struct hdac_bus *bus) |
121 | { | 121 | { |
122 | struct i915_audio_component *acomp = bus->audio_component; | 122 | struct drm_audio_component *acomp = bus->audio_component; |
123 | struct pci_dev *pci = to_pci_dev(bus->dev); | 123 | struct pci_dev *pci = to_pci_dev(bus->dev); |
124 | int cdclk_freq; | 124 | int cdclk_freq; |
125 | unsigned int bclk_m, bclk_n; | 125 | unsigned int bclk_m, bclk_n; |
@@ -206,7 +206,7 @@ int snd_hdac_sync_audio_rate(struct hdac_device *codec, hda_nid_t nid, | |||
206 | int dev_id, int rate) | 206 | int dev_id, int rate) |
207 | { | 207 | { |
208 | struct hdac_bus *bus = codec->bus; | 208 | struct hdac_bus *bus = codec->bus; |
209 | struct i915_audio_component *acomp = bus->audio_component; | 209 | struct drm_audio_component *acomp = bus->audio_component; |
210 | int port, pipe; | 210 | int port, pipe; |
211 | 211 | ||
212 | if (!acomp || !acomp->ops || !acomp->ops->sync_audio_rate) | 212 | if (!acomp || !acomp->ops || !acomp->ops->sync_audio_rate) |
@@ -244,7 +244,7 @@ int snd_hdac_acomp_get_eld(struct hdac_device *codec, hda_nid_t nid, int dev_id, | |||
244 | bool *audio_enabled, char *buffer, int max_bytes) | 244 | bool *audio_enabled, char *buffer, int max_bytes) |
245 | { | 245 | { |
246 | struct hdac_bus *bus = codec->bus; | 246 | struct hdac_bus *bus = codec->bus; |
247 | struct i915_audio_component *acomp = bus->audio_component; | 247 | struct drm_audio_component *acomp = bus->audio_component; |
248 | int port, pipe; | 248 | int port, pipe; |
249 | 249 | ||
250 | if (!acomp || !acomp->ops || !acomp->ops->get_eld) | 250 | if (!acomp || !acomp->ops || !acomp->ops->get_eld) |
@@ -262,7 +262,7 @@ EXPORT_SYMBOL_GPL(snd_hdac_acomp_get_eld); | |||
262 | 262 | ||
263 | static int hdac_component_master_bind(struct device *dev) | 263 | static int hdac_component_master_bind(struct device *dev) |
264 | { | 264 | { |
265 | struct i915_audio_component *acomp = hdac_acomp; | 265 | struct drm_audio_component *acomp = hdac_acomp; |
266 | int ret; | 266 | int ret; |
267 | 267 | ||
268 | ret = component_bind_all(dev, acomp); | 268 | ret = component_bind_all(dev, acomp); |
@@ -294,7 +294,7 @@ out_unbind: | |||
294 | 294 | ||
295 | static void hdac_component_master_unbind(struct device *dev) | 295 | static void hdac_component_master_unbind(struct device *dev) |
296 | { | 296 | { |
297 | struct i915_audio_component *acomp = hdac_acomp; | 297 | struct drm_audio_component *acomp = hdac_acomp; |
298 | 298 | ||
299 | module_put(acomp->ops->owner); | 299 | module_put(acomp->ops->owner); |
300 | component_unbind_all(dev, acomp); | 300 | component_unbind_all(dev, acomp); |
@@ -323,7 +323,7 @@ static int hdac_component_master_match(struct device *dev, void *data) | |||
323 | * | 323 | * |
324 | * Returns zero for success or a negative error code. | 324 | * Returns zero for success or a negative error code. |
325 | */ | 325 | */ |
326 | int snd_hdac_i915_register_notifier(const struct i915_audio_component_audio_ops *aops) | 326 | int snd_hdac_i915_register_notifier(const struct drm_audio_component_audio_ops *aops) |
327 | { | 327 | { |
328 | if (!hdac_acomp) | 328 | if (!hdac_acomp) |
329 | return -ENODEV; | 329 | return -ENODEV; |
@@ -361,7 +361,8 @@ int snd_hdac_i915_init(struct hdac_bus *bus) | |||
361 | { | 361 | { |
362 | struct component_match *match = NULL; | 362 | struct component_match *match = NULL; |
363 | struct device *dev = bus->dev; | 363 | struct device *dev = bus->dev; |
364 | struct i915_audio_component *acomp; | 364 | struct i915_audio_component *i915_acomp; |
365 | struct drm_audio_component *acomp; | ||
365 | int ret; | 366 | int ret; |
366 | 367 | ||
367 | if (WARN_ON(hdac_acomp)) | 368 | if (WARN_ON(hdac_acomp)) |
@@ -370,9 +371,10 @@ int snd_hdac_i915_init(struct hdac_bus *bus) | |||
370 | if (!i915_gfx_present()) | 371 | if (!i915_gfx_present()) |
371 | return -ENODEV; | 372 | return -ENODEV; |
372 | 373 | ||
373 | acomp = kzalloc(sizeof(*acomp), GFP_KERNEL); | 374 | i915_acomp = kzalloc(sizeof(*i915_acomp), GFP_KERNEL); |
374 | if (!acomp) | 375 | if (!i915_acomp) |
375 | return -ENOMEM; | 376 | return -ENOMEM; |
377 | acomp = &i915_acomp->base; | ||
376 | bus->audio_component = acomp; | 378 | bus->audio_component = acomp; |
377 | hdac_acomp = acomp; | 379 | hdac_acomp = acomp; |
378 | 380 | ||
@@ -421,13 +423,13 @@ EXPORT_SYMBOL_GPL(snd_hdac_i915_init); | |||
421 | int snd_hdac_i915_exit(struct hdac_bus *bus) | 423 | int snd_hdac_i915_exit(struct hdac_bus *bus) |
422 | { | 424 | { |
423 | struct device *dev = bus->dev; | 425 | struct device *dev = bus->dev; |
424 | struct i915_audio_component *acomp = bus->audio_component; | 426 | struct drm_audio_component *acomp = bus->audio_component; |
425 | 427 | ||
426 | if (!acomp) | 428 | if (!acomp) |
427 | return 0; | 429 | return 0; |
428 | 430 | ||
429 | WARN_ON(bus->i915_power_refcount); | 431 | WARN_ON(bus->drm_power_refcount); |
430 | if (bus->i915_power_refcount > 0 && acomp->ops) | 432 | if (bus->drm_power_refcount > 0 && acomp->ops) |
431 | acomp->ops->put_power(acomp->dev); | 433 | acomp->ops->put_power(acomp->dev); |
432 | 434 | ||
433 | component_master_del(dev, &hdac_component_master_ops); | 435 | component_master_del(dev, &hdac_component_master_ops); |
diff --git a/sound/pci/hda/patch_hdmi.c b/sound/pci/hda/patch_hdmi.c index 8a49415aebac..c0847017114c 100644 --- a/sound/pci/hda/patch_hdmi.c +++ b/sound/pci/hda/patch_hdmi.c | |||
@@ -177,7 +177,7 @@ struct hdmi_spec { | |||
177 | 177 | ||
178 | /* i915/powerwell (Haswell+/Valleyview+) specific */ | 178 | /* i915/powerwell (Haswell+/Valleyview+) specific */ |
179 | bool use_acomp_notifier; /* use i915 eld_notify callback for hotplug */ | 179 | bool use_acomp_notifier; /* use i915 eld_notify callback for hotplug */ |
180 | struct i915_audio_component_audio_ops i915_audio_ops; | 180 | struct drm_audio_component_audio_ops drm_audio_ops; |
181 | 181 | ||
182 | struct hdac_chmap chmap; | 182 | struct hdac_chmap chmap; |
183 | hda_nid_t vendor_nid; | 183 | hda_nid_t vendor_nid; |
@@ -2511,14 +2511,14 @@ static void register_i915_notifier(struct hda_codec *codec) | |||
2511 | struct hdmi_spec *spec = codec->spec; | 2511 | struct hdmi_spec *spec = codec->spec; |
2512 | 2512 | ||
2513 | spec->use_acomp_notifier = true; | 2513 | spec->use_acomp_notifier = true; |
2514 | spec->i915_audio_ops.audio_ptr = codec; | 2514 | spec->drm_audio_ops.audio_ptr = codec; |
2515 | /* intel_audio_codec_enable() or intel_audio_codec_disable() | 2515 | /* intel_audio_codec_enable() or intel_audio_codec_disable() |
2516 | * will call pin_eld_notify with using audio_ptr pointer | 2516 | * will call pin_eld_notify with using audio_ptr pointer |
2517 | * We need make sure audio_ptr is really setup | 2517 | * We need make sure audio_ptr is really setup |
2518 | */ | 2518 | */ |
2519 | wmb(); | 2519 | wmb(); |
2520 | spec->i915_audio_ops.pin_eld_notify = intel_pin_eld_notify; | 2520 | spec->drm_audio_ops.pin_eld_notify = intel_pin_eld_notify; |
2521 | snd_hdac_i915_register_notifier(&spec->i915_audio_ops); | 2521 | snd_hdac_i915_register_notifier(&spec->drm_audio_ops); |
2522 | } | 2522 | } |
2523 | 2523 | ||
2524 | /* setup_stream ops override for HSW+ */ | 2524 | /* setup_stream ops override for HSW+ */ |
diff --git a/sound/soc/codecs/hdac_hdmi.c b/sound/soc/codecs/hdac_hdmi.c index 3e3a2a9ef310..460075475f20 100644 --- a/sound/soc/codecs/hdac_hdmi.c +++ b/sound/soc/codecs/hdac_hdmi.c | |||
@@ -1583,7 +1583,7 @@ static void hdac_hdmi_eld_notify_cb(void *aptr, int port, int pipe) | |||
1583 | 1583 | ||
1584 | } | 1584 | } |
1585 | 1585 | ||
1586 | static struct i915_audio_component_audio_ops aops = { | 1586 | static struct drm_audio_component_audio_ops aops = { |
1587 | .pin_eld_notify = hdac_hdmi_eld_notify_cb, | 1587 | .pin_eld_notify = hdac_hdmi_eld_notify_cb, |
1588 | }; | 1588 | }; |
1589 | 1589 | ||