Make the audio component binding more generic
Subsystems (5)
v2 cover Make the audio component binding more generic
Hi,
this is a preliminiary patch set to convert the existing i915 / HD-audio component binding to be applicable to other drivers like radeon / amdgpu. This patchset itself doesn't change the functionality but only renames and split to a new drm_audio_component stuff from i915_audio_component.
The actual usage of the new API will follow once after this one gets reviewed / accepted. The whole patches (including this patchset) are found in topic/hda-acomp branch of sound.git tree.
BTW, since the whole stuff is about the audio binding, I suppose these will go through sound git tree. Let me know if anyone has concerns.
Thanks!
Takashi
===
v1->v2:
* Change to SPDX for the new drm_audio_component.h
* Fix remaining i915 word in drm_audio_component.h comments
* Fix NULL dereference in master_bind / _unbind ops
===
Takashi Iwai (3):
drm/i915: Split audio component to a generic type
ALSA: hda/i915: Associate audio component with devres
ALSA: hda: Make audio component support more generic
drivers/gpu/drm/i915/Kconfig | 1 + drivers/gpu/drm/i915/intel_audio.c | 22 +- include/drm/drm_audio_component.h | 118 ++++++++++ include/drm/i915_component.h | 85 +------- include/sound/hda_component.h | 61 ++++++ include/sound/hda_i915.h | 37 +--- include/sound/hdaudio.h | 6 +- sound/hda/Kconfig | 7 +- sound/hda/Makefile | 1 + sound/hda/hdac_component.c | 335 +++++++++++++++++++++++++++++ sound/hda/hdac_i915.c | 335 ++--------------------------- sound/pci/hda/patch_hdmi.c | 57 +++-- sound/soc/codecs/hdac_hdmi.c | 10 +- 13 files changed, 607 insertions(+), 468 deletions(-) create mode 100644 include/drm/drm_audio_component.h create mode 100644 include/sound/hda_component.h create mode 100644 sound/hda/hdac_component.c
Signature · 1 line
2.18.0
PATCH v2 1/3 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
--- drivers/gpu/drm/i915/intel_audio.c | 22 +++---- include/drm/drm_audio_component.h | 95 ++++++++++++++++++++++++++++++ include/drm/i915_component.h | 85 ++------------------------ include/sound/hda_i915.h | 6 +- include/sound/hdaudio.h | 6 +- sound/hda/hdac_i915.c | 40 +++++++------ sound/pci/hda/patch_hdmi.c | 8 +-- sound/soc/codecs/hdac_hdmi.c | 2 +- 8 files changed, 144 insertions(+), 120 deletions(-) create mode 100644 include/drm/drm_audio_component.h
drivers/gpu/drm/i915/intel_audio.c +12 -10
@@ -639,11 +639,12 @@ void intel_audio_codec_enable(struct intel_encoder *encoder, dev_priv->av_enc_map[pipe] = encoder;mutex_unlock (&dev_priv->av_mutex); -if (acomp && acomp->audio_ops && acomp->audio_ops->pin_eld_notify) { +if (acomp && acomp->base.audio_ops && + acomp->base.audio_ops->pin_eld_notify) {/* audio drivers expect pipe = -1 to indicate Non-MST cases */ if (!intel_crtc_has_type (crtc_state,INTEL_OUTPUT_DP_MST )) pipe =-1 ; - acomp->audio_ops->pin_eld_notify (acomp->audio_ops->audio_ptr, + acomp->base.audio_ops->pin_eld_notify (acomp->base.audio_ops->audio_ptr, (int ) port, (int ) pipe); }
@@ -681,11 +682,12 @@ void intel_audio_codec_disable(struct intel_encoder *encoder, dev_priv->av_enc_map[pipe] =NULL ;mutex_unlock (&dev_priv->av_mutex); -if (acomp && acomp->audio_ops && acomp->audio_ops->pin_eld_notify) { +if (acomp && acomp->base.audio_ops && + acomp->base.audio_ops->pin_eld_notify) {/* audio drivers expect pipe = -1 to indicate Non-MST cases */ if (!intel_crtc_has_type (old_crtc_state,INTEL_OUTPUT_DP_MST )) pipe =-1 ; - acomp->audio_ops->pin_eld_notify (acomp->audio_ops->audio_ptr, + acomp->base.audio_ops->pin_eld_notify (acomp->base.audio_ops->audio_ptr, (int ) port, (int ) pipe); }
@@ -880,7 +882,7 @@ static int i915_audio_component_get_eld(struct device *kdev, int port,return ret; } -static const struct i915_audio_component_ops i915_audio_component_ops = { +static const struct drm_audio_component_ops i915_audio_component_ops = { .owner =THIS_MODULE , .get_power = i915_audio_component_get_power, .put_power = i915_audio_component_put_power,
@@ -897,12 +899,12 @@ static int i915_audio_component_bind(struct device *i915_kdev,struct drm_i915_private *dev_priv =kdev_to_i915 (i915_kdev);int i; -if (WARN_ON (acomp->ops || acomp->dev)) +if (WARN_ON (acomp->base.ops || acomp->base.dev))return -EEXIST ;drm_modeset_lock_all (&dev_priv->drm); - acomp->ops = &i915_audio_component_ops; - acomp->dev = i915_kdev; + acomp->base.ops = &i915_audio_component_ops; + acomp->base.dev = i915_kdev;BUILD_BUG_ON (MAX_PORTS !=I915_MAX_PORTS );for (i =0 ; i <ARRAY_SIZE (acomp->aud_sample_rate); i++) acomp->aud_sample_rate[i] =0 ;
@@ -919,8 +921,8 @@ static void i915_audio_component_unbind(struct device *i915_kdev,struct drm_i915_private *dev_priv =kdev_to_i915 (i915_kdev);drm_modeset_lock_all (&dev_priv->drm); - acomp->ops =NULL ; - acomp->dev =NULL ; + acomp->base.ops =NULL ; + acomp->base.dev =NULL ; dev_priv->audio_component =NULL ;drm_modeset_unlock_all (&dev_priv->drm); }
include/drm/drm_audio_component.h new file +95 -0
95 lines not on this page · raw message
include/drm/i915_component.h +5 -80
106 lines not on this page · raw message
include/sound/hda_i915.h +3 -3
@@ -5,7 +5,7 @@#ifndef __SOUND_HDA_I915_H#define __SOUND_HDA_I915_H -#include <drm/i915_component.h> +#include <drm/drm_audio_component.h> #ifdef CONFIG_SND_HDA_I915 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, 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); -int snd_hdac_i915_register_notifier (const struct i915_audio_component_audio_ops *); +int snd_hdac_i915_register_notifier (const struct drm_audio_component_audio_ops *);#else static inline int snd_hdac_set_codec_wakeup (struct hdac_bus *bus,bool enable) {
@@ -49,7 +49,7 @@ 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 (const struct drm_audio_component_audio_ops *ops) {return -ENODEV ; }
include/sound/hdaudio.h +3 -3
@@ -333,9 +333,9 @@ struct hdac_bus {spinlock_t reg_lock;struct mutex cmd_mutex; -/* i915 component interface */ -struct i915_audio_component *audio_component; -int i915_power_refcount; +/* DRM component interface */ +struct drm_audio_component *audio_component; +int drm_power_refcount;/* parameters required for enhanced capabilities */ int num_streams;
sound/hda/hdac_i915.c +21 -19
@@ -16,13 +16,13 @@#include <linux/module.h> #include <linux/pci.h> #include <linux/component.h> -#include <drm/i915_component.h> +#include <drm/drm_audio_component.h> #include <sound/core.h> #include <sound/hdaudio.h> #include <sound/hda_i915.h> #include <sound/hda_register.h> -static struct i915_audio_component *hdac_acomp; +static struct drm_audio_component *hdac_acomp;/** * snd_hdac_set_codec_wakeup - Enable / disable HDMI/DP codec wakeup
@@ -39,7 +39,7 @@ 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; +struct drm_audio_component *acomp = bus->audio_component;if (!acomp || !acomp->ops)return -ENODEV ;
@@ -74,7 +74,7 @@ EXPORT_SYMBOL_GPL(snd_hdac_set_codec_wakeup);*/ int snd_hdac_display_power (struct hdac_bus *bus,bool enable) { -struct i915_audio_component *acomp = bus->audio_component; +struct drm_audio_component *acomp = bus->audio_component;if (!acomp || !acomp->ops)return -ENODEV ;
@@ -83,14 +83,14 @@ int snd_hdac_display_power(struct hdac_bus *bus, bool enable) enable ? "enable" : "disable");if (enable) { -if (!bus->i915_power_refcount++) { +if (!bus->drm_power_refcount++) { acomp->ops->get_power (acomp->dev);snd_hdac_set_codec_wakeup (bus, true);snd_hdac_set_codec_wakeup (bus, false); } }else { -WARN_ON (!bus->i915_power_refcount); -if (!--bus->i915_power_refcount) +WARN_ON (!bus->drm_power_refcount); +if (!--bus->drm_power_refcount) acomp->ops->put_power (acomp->dev); }
@@ -119,7 +119,7 @@ EXPORT_SYMBOL_GPL(snd_hdac_display_power);*/ void snd_hdac_i915_set_bclk (struct hdac_bus *bus) { -struct i915_audio_component *acomp = bus->audio_component; +struct drm_audio_component *acomp = bus->audio_component;struct pci_dev *pci =to_pci_dev (bus->dev);int cdclk_freq;unsigned int bclk_m, bclk_n;
@@ -206,7 +206,7 @@ int snd_hdac_sync_audio_rate(struct hdac_device *codec, hda_nid_t nid, int dev_id, int rate) {struct hdac_bus *bus = codec->bus; -struct i915_audio_component *acomp = bus->audio_component; +struct drm_audio_component *acomp = bus->audio_component;int port, pipe;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, bool *audio_enabled, char *buffer, int max_bytes) { struct hdac_bus *bus = codec->bus; -struct i915_audio_component *acomp = bus->audio_component; +struct drm_audio_component *acomp = bus->audio_component;int port, pipe;if (!acomp || !acomp->ops || !acomp->ops->get_eld)
@@ -262,7 +262,7 @@ EXPORT_SYMBOL_GPL(snd_hdac_acomp_get_eld);static int hdac_component_master_bind (struct device *dev) { -struct i915_audio_component *acomp = hdac_acomp; +struct drm_audio_component *acomp = hdac_acomp;int ret; ret =component_bind_all (dev, acomp);
@@ -294,7 +294,7 @@ static int hdac_component_master_bind(struct device *dev)static void hdac_component_master_unbind (struct device *dev) { -struct i915_audio_component *acomp = hdac_acomp; +struct drm_audio_component *acomp = hdac_acomp;module_put (acomp->ops->owner);component_unbind_all (dev, acomp);
@@ -323,7 +323,7 @@ static int hdac_component_master_match(struct device *dev, void *data)* * Returns zero for success or a negative error code. */ -int snd_hdac_i915_register_notifier (const struct i915_audio_component_audio_ops *aops) +int snd_hdac_i915_register_notifier (const struct drm_audio_component_audio_ops *aops) {if (!hdac_acomp)return -ENODEV ;
@@ -361,7 +361,8 @@ int snd_hdac_i915_init(struct hdac_bus *bus) {struct component_match *match =NULL ;struct device *dev = bus->dev; -struct i915_audio_component *acomp; +struct i915_audio_component *i915_acomp; +struct drm_audio_component *acomp;int ret;if (WARN_ON (hdac_acomp))
@@ -370,9 +371,10 @@ int snd_hdac_i915_init(struct hdac_bus *bus)if (!i915_gfx_present ())return -ENODEV ; - acomp =kzalloc (sizeof (*acomp),GFP_KERNEL ); -if (!acomp) + i915_acomp =kzalloc (sizeof (*i915_acomp),GFP_KERNEL ); +if (!i915_acomp)return -ENOMEM ; + acomp = &i915_acomp->base; bus->audio_component = acomp; hdac_acomp = acomp;
@@ -421,13 +423,13 @@ EXPORT_SYMBOL_GPL(snd_hdac_i915_init);int snd_hdac_i915_exit (struct hdac_bus *bus) {struct device *dev = bus->dev; -struct i915_audio_component *acomp = bus->audio_component; +struct drm_audio_component *acomp = bus->audio_component;if (!acomp)return 0 ; -WARN_ON (bus->i915_power_refcount); -if (bus->i915_power_refcount >0 && acomp->ops) +WARN_ON (bus->drm_power_refcount); +if (bus->drm_power_refcount >0 && acomp->ops) acomp->ops->put_power (acomp->dev);component_master_del (dev, &hdac_component_master_ops);
sound/pci/hda/patch_hdmi.c +4 -4
@@ -177,7 +177,7 @@ struct hdmi_spec {/* i915/powerwell (Haswell+/Valleyview+) specific */ bool use_acomp_notifier;/* use i915 eld_notify callback for hotplug */ -struct i915_audio_component_audio_ops i915_audio_ops; +struct drm_audio_component_audio_ops drm_audio_ops;struct hdac_chmap chmap;hda_nid_t vendor_nid;
@@ -2511,14 +2511,14 @@ static void register_i915_notifier(struct hda_codec *codec)struct hdmi_spec *spec = codec->spec; spec->use_acomp_notifier = true; - spec->i915_audio_ops.audio_ptr = codec; + spec->drm_audio_ops.audio_ptr = codec;/* intel_audio_codec_enable() or intel_audio_codec_disable() * will call pin_eld_notify with using audio_ptr pointer * We need make sure audio_ptr is really setup */ wmb (); - spec->i915_audio_ops.pin_eld_notify = intel_pin_eld_notify; -snd_hdac_i915_register_notifier (&spec->i915_audio_ops); + spec->drm_audio_ops.pin_eld_notify = intel_pin_eld_notify; +snd_hdac_i915_register_notifier (&spec->drm_audio_ops); }/* setup_stream ops override for HSW+ */
sound/soc/codecs/hdac_hdmi.c +1 -1
@@ -1583,7 +1583,7 @@ static void hdac_hdmi_eld_notify_cb(void *aptr, int port, int pipe) } -static struct i915_audio_component_audio_ops aops = { +static struct drm_audio_component_audio_ops aops = { .pin_eld_notify = hdac_hdmi_eld_notify_cb, };
Signature · 6 lines
2.18.0 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH v2 1/3] drm/i915: Split audio component to a generic type
Quoted 9 lines · Takashi Iwai
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 structi915_audio_component, which containsdrm_audio_componentas the base.The license of
drm_audio_component.his kept to MIT as same as the the originali915_component.h.
Quoted 8 lines
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 fordrm_audio_component.h, fix remaining i915
argument indrm_audio_component.hSigned-off-by Takashi Iwai <[email protected]>
Quoted 539 lines
--- drivers/gpu/drm/i915/intel_audio.c | 22 +++---- include/drm/drm_audio_component.h | 95 ++++++++++++++++++++++++++++++ include/drm/i915_component.h | 85 ++------------------------ include/sound/hda_i915.h | 6 +- include/sound/hdaudio.h | 6 +- sound/hda/hdac_i915.c | 40 +++++++------ sound/pci/hda/patch_hdmi.c | 8 +-- sound/soc/codecs/hdac_hdmi.c | 2 +- 8 files changed, 144 insertions(+), 120 deletions(-) create mode 100644 include/drm/drm_audio_component.hdrivers/gpu/drm/i915/intel_audio.c +12
-10@@ -639,11 +639,12 @@ void intel_audio_codec_enable(struct intel_encoder *encoder, dev_priv->av_enc_map[pipe] = encoder;mutex_unlock (&dev_priv->av_mutex); -if (acomp && acomp->audio_ops && acomp->audio_ops->pin_eld_notify) { +if (acomp && acomp->base.audio_ops && + acomp->base.audio_ops->pin_eld_notify) {/* audio drivers expect pipe = -1 to indicate Non-MST cases */ if (!intel_crtc_has_type (crtc_state,INTEL_OUTPUT_DP_MST )) pipe =-1 ; - acomp->audio_ops->pin_eld_notify (acomp->audio_ops->audio_ptr, + acomp->base.audio_ops->pin_eld_notify (acomp->base.audio_ops->audio_ptr, (int ) port, (int ) pipe); }@@ -681,11 +682,12 @@ void intel_audio_codec_disable(struct intel_encoder *encoder, dev_priv->av_enc_map[pipe] =NULL ;mutex_unlock (&dev_priv->av_mutex); -if (acomp && acomp->audio_ops && acomp->audio_ops->pin_eld_notify) { +if (acomp && acomp->base.audio_ops && + acomp->base.audio_ops->pin_eld_notify) {/* audio drivers expect pipe = -1 to indicate Non-MST cases */ if (!intel_crtc_has_type (old_crtc_state,INTEL_OUTPUT_DP_MST )) pipe =-1 ; - acomp->audio_ops->pin_eld_notify (acomp->audio_ops->audio_ptr, + acomp->base.audio_ops->pin_eld_notify (acomp->base.audio_ops->audio_ptr, (int ) port, (int ) pipe); }@@ -880,7 +882,7 @@ static int i915_audio_component_get_eld(struct device *kdev, int port,return ret; } -static const struct i915_audio_component_ops i915_audio_component_ops = { +static const struct drm_audio_component_ops i915_audio_component_ops = { .owner =THIS_MODULE , .get_power = i915_audio_component_get_power, .put_power = i915_audio_component_put_power,@@ -897,12 +899,12 @@ static int i915_audio_component_bind(struct device *i915_kdev,struct drm_i915_private *dev_priv =kdev_to_i915 (i915_kdev);int i; -if (WARN_ON (acomp->ops || acomp->dev)) +if (WARN_ON (acomp->base.ops || acomp->base.dev))return -EEXIST ;drm_modeset_lock_all (&dev_priv->drm); - acomp->ops = &i915_audio_component_ops; - acomp->dev = i915_kdev; + acomp->base.ops = &i915_audio_component_ops; + acomp->base.dev = i915_kdev;BUILD_BUG_ON (MAX_PORTS !=I915_MAX_PORTS );for (i =0 ; i <ARRAY_SIZE (acomp->aud_sample_rate); i++) acomp->aud_sample_rate[i] =0 ;@@ -919,8 +921,8 @@ static void i915_audio_component_unbind(struct device *i915_kdev,struct drm_i915_private *dev_priv =kdev_to_i915 (i915_kdev);drm_modeset_lock_all (&dev_priv->drm); - acomp->ops =NULL ; - acomp->dev =NULL ; + acomp->base.ops =NULL ; + acomp->base.dev =NULL ; dev_priv->audio_component =NULL ;drm_modeset_unlock_all (&dev_priv->drm); }include/drm/drm_audio_component.h new file +95
-0@@ -0,0 +1,95 @@ +// SPDX-License-Identifier: MIT +// Copyright © 2014 Intel Corporation + +#ifndef _DRM_AUDIO_COMPONENT_H_ +#define _DRM_AUDIO_COMPONENT_H_ + +/** +* struct drm_audio_component_ops - Ops implemented by DRM driver, called by hda driver +*/ +struct drm_audio_component_ops { +/** +* @owner: drm module to pin down +*/ +struct module *owner; +/** +* @get_power: get the POWER_DOMAIN_AUDIO power well +* +* Request the power well to be turned on. +*/ +void (*get_power)(struct device *); +/** +* @put_power: put the POWER_DOMAIN_AUDIO power well +* +* Allow the power well to be turned off. +*/ +void (*put_power)(struct device *); +/** +* @codec_wake_override: Enable/disable codec wake signal +*/ +void (*codec_wake_override)(struct device *,bool enable); +/** +* @get_cdclk_freq: Get the Core Display Clock in kHz +*/ +int (*get_cdclk_freq)(struct device *); +/** +* @sync_audio_rate: set n/cts based on the sample rate +* +* Called from audio driver. After audio driver sets the +* sample rate, it will call this function to set n/cts +*/ +int (*sync_audio_rate)(struct device *,int port,int pipe,int rate); +/** +* @get_eld: fill the audio state and ELD bytes for the given port +* +* Called from audio driver to get the HDMI/DP audio state of the given +* digital port, and also fetch ELD bytes to the given pointer. +* +* It returns the byte size of the original ELD (not the actually +* copied size), zero for an invalid ELD, or a negative error code. +* +* 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,int pipe,bool *enabled, +unsigned char *buf,int max_bytes); +}; + +/** +* struct drm_audio_component_audio_ops - Ops implemented by hda driver, called by DRM driver +*/ +struct drm_audio_component_audio_ops { +/** +* @audio_ptr: Pointer to be used in call to pin_eld_notify +*/ +void *audio_ptr; +/** +* @pin_eld_notify: Notify the HDA driver that pin sense and/or ELD information has changed +* +* Called when the DRM driver has set up audio pipeline or has just +* begun to tear it down. This allows the HDA driver to update its +* status accordingly (even when the HDA controller is in power save +* mode). +*/ +void (*pin_eld_notify)(void *audio_ptr,int port,int pipe); +}; + +/** +* struct drm_audio_component - Used for direct communication between DRM and hda drivers +*/ +struct drm_audio_component { +/** +* @dev: DRM device, used as parameter for ops +*/ +struct device *dev; +/** +* @ops: Ops implemented by DRM driver, called by hda driver +*/ +const struct drm_audio_component_ops *ops; +/** +* @audio_ops: Ops implemented by hda driver, called by DRM driver +*/ +const struct drm_audio_component_audio_ops *audio_ops; +}; + +#endif /* _DRM_AUDIO_COMPONENT_H_ */ include/drm/i915_component.h +5
-80@@ -24,101 +24,26 @@#ifndef _I915_COMPONENT_H_#define _I915_COMPONENT_H_ +#include "drm_audio_component.h" +/* MAX_PORT is the number of port * It must be sync with I915_MAX_PORTS defined i915_drv.h */ #define MAX_PORTS 6 -/** -* struct i915_audio_component_ops - Ops implemented by i915 driver, called by hda driver -*/ -struct i915_audio_component_ops { -/** -* @owner: i915 module -*/ -struct module *owner; -/** -* @get_power: get the POWER_DOMAIN_AUDIO power well -* -* Request the power well to be turned on. -*/ -void (*get_power)(struct device *); -/** -* @put_power: put the POWER_DOMAIN_AUDIO power well -* -* Allow the power well to be turned off. -*/ -void (*put_power)(struct device *); -/** -* @codec_wake_override: Enable/disable codec wake signal -*/ -void (*codec_wake_override)(struct device *,bool enable); -/** -* @get_cdclk_freq: Get the Core Display Clock in kHz -*/ -int (*get_cdclk_freq)(struct device *); -/** -* @sync_audio_rate: set n/cts based on the sample rate -* -* Called from audio driver. After audio driver sets the -* sample rate, it will call this function to set n/cts -*/ -int (*sync_audio_rate)(struct device *,int port,int pipe,int rate); -/** -* @get_eld: fill the audio state and ELD bytes for the given port -* -* Called from audio driver to get the HDMI/DP audio state of the given -* digital port, and also fetch ELD bytes to the given pointer. -* -* It returns the byte size of the original ELD (not the actually -* copied size), zero for an invalid ELD, or a negative error code. -* -* 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,int pipe,bool *enabled, -unsigned char *buf,int max_bytes); -}; - -/** -* struct i915_audio_component_audio_ops - Ops implemented by hda driver, called by i915 driver -*/ -struct i915_audio_component_audio_ops { -/** -* @audio_ptr: Pointer to be used in call to pin_eld_notify -*/ -void *audio_ptr; -/** -* @pin_eld_notify: Notify the HDA driver that pin sense and/or ELD information has changed -* -* Called when the i915 driver has set up audio pipeline or has just -* begun to tear it down. This allows the HDA driver to update its -* status accordingly (even when the HDA controller is in power save -* mode). -*/ -void (*pin_eld_notify)(void *audio_ptr,int port,int pipe); -}; -/** * struct i915_audio_component - Used for direct communication between i915 and hda drivers */ struct i915_audio_component {/** -* @dev: i915 device, used as parameter for ops +* @base: the drm_audio_component base class */ -struct device *dev; +struct drm_audio_component base; +/** * @aud_sample_rate: the array of audio sample rate per port */ int aud_sample_rate[MAX_PORTS ]; -/** -* @ops: Ops implemented by i915 driver, called by hda driver -*/ -const struct i915_audio_component_ops *ops; -/** -* @audio_ops: Ops implemented by hda driver, called by i915 driver -*/ -const struct i915_audio_component_audio_ops *audio_ops; };#endif /* _I915_COMPONENT_H_ */ include/sound/hda_i915.h +3
-3@@ -5,7 +5,7 @@#ifndef __SOUND_HDA_I915_H#define __SOUND_HDA_I915_H -#include <drm/i915_component.h> +#include <drm/drm_audio_component.h> #ifdef CONFIG_SND_HDA_I915 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, 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); -int snd_hdac_i915_register_notifier (const struct i915_audio_component_audio_ops *); +int snd_hdac_i915_register_notifier (const struct drm_audio_component_audio_ops *);#else static inline int snd_hdac_set_codec_wakeup (struct hdac_bus *bus,bool enable) {@@ -49,7 +49,7 @@ 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 (const struct drm_audio_component_audio_ops *ops) {return -ENODEV ; }include/sound/hdaudio.h +3
-3@@ -333,9 +333,9 @@ struct hdac_bus {spinlock_t reg_lock;struct mutex cmd_mutex; -/* i915 component interface */ -struct i915_audio_component *audio_component; -int i915_power_refcount; +/* DRM component interface */ +struct drm_audio_component *audio_component; +int drm_power_refcount;/* parameters required for enhanced capabilities */ int num_streams;sound/hda/hdac_i915.c +21
-19@@ -16,13 +16,13 @@#include <linux/module.h> #include <linux/pci.h> #include <linux/component.h> -#include <drm/i915_component.h> +#include <drm/drm_audio_component.h> #include <sound/core.h> #include <sound/hdaudio.h> #include <sound/hda_i915.h> #include <sound/hda_register.h> -static struct i915_audio_component *hdac_acomp; +static struct drm_audio_component *hdac_acomp;/** * snd_hdac_set_codec_wakeup - Enable / disable HDMI/DP codec wakeup @@ -39,7 +39,7 @@ 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; +struct drm_audio_component *acomp = bus->audio_component;if (!acomp || !acomp->ops)return -ENODEV ;@@ -74,7 +74,7 @@ EXPORT_SYMBOL_GPL(snd_hdac_set_codec_wakeup);*/ int snd_hdac_display_power (struct hdac_bus *bus,bool enable) { -struct i915_audio_component *acomp = bus->audio_component; +struct drm_audio_component *acomp = bus->audio_component;if (!acomp || !acomp->ops)return -ENODEV ;@@ -83,14 +83,14 @@ int snd_hdac_display_power(struct hdac_bus *bus, bool enable) enable ? "enable" : "disable");if (enable) { -if (!bus->i915_power_refcount++) { +if (!bus->drm_power_refcount++) { acomp->ops->get_power (acomp->dev);snd_hdac_set_codec_wakeup (bus, true);snd_hdac_set_codec_wakeup (bus, false); } }else { -WARN_ON (!bus->i915_power_refcount); -if (!--bus->i915_power_refcount) +WARN_ON (!bus->drm_power_refcount); +if (!--bus->drm_power_refcount) acomp->ops->put_power (acomp->dev); }@@ -119,7 +119,7 @@ EXPORT_SYMBOL_GPL(snd_hdac_display_power);*/ void snd_hdac_i915_set_bclk (struct hdac_bus *bus) { -struct i915_audio_component *acomp = bus->audio_component; +struct drm_audio_component *acomp = bus->audio_component;struct pci_dev *pci =to_pci_dev (bus->dev);int cdclk_freq;unsigned int bclk_m, bclk_n;@@ -206,7 +206,7 @@ int snd_hdac_sync_audio_rate(struct hdac_device *codec, hda_nid_t nid, int dev_id, int rate) {struct hdac_bus *bus = codec->bus; -struct i915_audio_component *acomp = bus->audio_component; +struct drm_audio_component *acomp = bus->audio_component;int port, pipe;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, bool *audio_enabled, char *buffer, int max_bytes) { struct hdac_bus *bus = codec->bus; -struct i915_audio_component *acomp = bus->audio_component; +struct drm_audio_component *acomp = bus->audio_component;int port, pipe;if (!acomp || !acomp->ops || !acomp->ops->get_eld)@@ -262,7 +262,7 @@ EXPORT_SYMBOL_GPL(snd_hdac_acomp_get_eld);static int hdac_component_master_bind (struct device *dev) { -struct i915_audio_component *acomp = hdac_acomp; +struct drm_audio_component *acomp = hdac_acomp;int ret; ret =component_bind_all (dev, acomp);@@ -294,7 +294,7 @@ static int hdac_component_master_bind(struct device *dev)static void hdac_component_master_unbind (struct device *dev) { -struct i915_audio_component *acomp = hdac_acomp; +struct drm_audio_component *acomp = hdac_acomp;module_put (acomp->ops->owner);component_unbind_all (dev, acomp);@@ -323,7 +323,7 @@ static int hdac_component_master_match(struct device *dev, void *data)* * Returns zero for success or a negative error code. */ -int snd_hdac_i915_register_notifier (const struct i915_audio_component_audio_ops *aops) +int snd_hdac_i915_register_notifier (const struct drm_audio_component_audio_ops *aops) {if (!hdac_acomp)return -ENODEV ;@@ -361,7 +361,8 @@ int snd_hdac_i915_init(struct hdac_bus *bus) {struct component_match *match =NULL ;struct device *dev = bus->dev; -struct i915_audio_component *acomp; +struct i915_audio_component *i915_acomp; +struct drm_audio_component *acomp;int ret;if (WARN_ON (hdac_acomp))@@ -370,9 +371,10 @@ int snd_hdac_i915_init(struct hdac_bus *bus)if (!i915_gfx_present ())return -ENODEV ; - acomp =kzalloc (sizeof (*acomp),GFP_KERNEL ); -if (!acomp) + i915_acomp =kzalloc (sizeof (*i915_acomp),GFP_KERNEL ); +if (!i915_acomp)return -ENOMEM ; + acomp = &i915_acomp->base; bus->audio_component = acomp; hdac_acomp = acomp;@@ -421,13 +423,13 @@ EXPORT_SYMBOL_GPL(snd_hdac_i915_init);int snd_hdac_i915_exit (struct hdac_bus *bus) {struct device *dev = bus->dev; -struct i915_audio_component *acomp = bus->audio_component; +struct drm_audio_component *acomp = bus->audio_component;if (!acomp)return 0 ; -WARN_ON (bus->i915_power_refcount); -if (bus->i915_power_refcount >0 && acomp->ops) +WARN_ON (bus->drm_power_refcount); +if (bus->drm_power_refcount >0 && acomp->ops) acomp->ops->put_power (acomp->dev);component_master_del (dev, &hdac_component_master_ops);sound/pci/hda/patch_hdmi.c +4
-4@@ -177,7 +177,7 @@ struct hdmi_spec {/* i915/powerwell (Haswell+/Valleyview+) specific */ bool use_acomp_notifier;/* use i915 eld_notify callback for hotplug */ -struct i915_audio_component_audio_ops i915_audio_ops; +struct drm_audio_component_audio_ops drm_audio_ops;struct hdac_chmap chmap;hda_nid_t vendor_nid;@@ -2511,14 +2511,14 @@ static void register_i915_notifier(struct hda_codec *codec)struct hdmi_spec *spec = codec->spec; spec->use_acomp_notifier = true; - spec->i915_audio_ops.audio_ptr = codec; + spec->drm_audio_ops.audio_ptr = codec;/* intel_audio_codec_enable() or intel_audio_codec_disable() * will call pin_eld_notify with using audio_ptr pointer * We need make sure audio_ptr is really setup */ wmb (); - spec->i915_audio_ops.pin_eld_notify = intel_pin_eld_notify; -snd_hdac_i915_register_notifier (&spec->i915_audio_ops); + spec->drm_audio_ops.pin_eld_notify = intel_pin_eld_notify; +snd_hdac_i915_register_notifier (&spec->drm_audio_ops); }/* setup_stream ops override for HSW+ */ sound/soc/codecs/hdac_hdmi.c +1
-1@@ -1583,7 +1583,7 @@ static void hdac_hdmi_eld_notify_cb(void *aptr, int port, int pipe) } -static struct i915_audio_component_audio_ops aops = { +static struct drm_audio_component_audio_ops aops = { .pin_eld_notify = hdac_hdmi_eld_notify_cb, };Signature · 1 line
2.18.0
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH v2 2/3 ALSA: hda/i915: Associate audio component with devres
In reply to Takashi IwaiThe HD-audio i915 binding code contains a single pointer, hdac_acomp, for allowing the access to audio component from the master bind/unbind callbacks. This was needed because the callbacks pass only the device pointer and we can't guarantee the object type assigned to the drvdata (which is free for each controller driver implementation). And this implementation will be a problem if we support multiple components for different DRM drivers, not only i915.
As a solution, allocate the audio component object via devres and associate it with the given device, so that the component callbacks can refer to it via devres_find().
The removal of the object is still done half-manually via devres_destroy() to make the code consistent (although it may work without the explicit call).
Also, the snd_hda_i915_register_notifier() had the reference to hdac_acomp as well. In this patch, the corresponding code is removed by passing hdac_bus object to the function, too.
--- include/sound/hda_i915.h | 6 ++++-- sound/hda/hdac_i915.c | 34 +++++++++++++++++++++------------- sound/pci/hda/patch_hdmi.c | 5 +++-- sound/soc/codecs/hdac_hdmi.c | 2 +- 4 files changed, 29 insertions(+), 18 deletions(-)
include/sound/hda_i915.h +4 -2
@@ -17,7 +17,8 @@ int snd_hdac_acomp_get_eld(struct hdac_device *codec, 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); -int snd_hdac_i915_register_notifier (const struct drm_audio_component_audio_ops *); +int snd_hdac_i915_register_notifier (struct hdac_bus *bus, +const struct drm_audio_component_audio_ops *ops);#else static inline int snd_hdac_set_codec_wakeup (struct hdac_bus *bus,bool enable) {
@@ -49,7 +50,8 @@ static inline int snd_hdac_i915_exit(struct hdac_bus *bus) {return 0 ; } -static inline int snd_hdac_i915_register_notifier (const struct drm_audio_component_audio_ops *ops) +static inline int snd_hdac_i915_register_notifier (struct hdac_bus *bus, +const struct drm_audio_component_audio_ops *ops) {return -ENODEV ; }
sound/hda/hdac_i915.c +21 -13
@@ -22,7 +22,14 @@#include <sound/hda_i915.h> #include <sound/hda_register.h> -static struct drm_audio_component *hdac_acomp; +static void hdac_acomp_release (struct device *dev,void *res) +{ +} + +static struct drm_audio_component *hdac_get_acomp (struct device *dev) +{ +return devres_find (dev, hdac_acomp_release,NULL ,NULL ); +}/** * snd_hdac_set_codec_wakeup - Enable / disable HDMI/DP codec wakeup
@@ -262,7 +269,7 @@ EXPORT_SYMBOL_GPL(snd_hdac_acomp_get_eld);static int hdac_component_master_bind (struct device *dev) { -struct drm_audio_component *acomp = hdac_acomp; +struct drm_audio_component *acomp =hdac_get_acomp (dev);int ret; ret =component_bind_all (dev, acomp);
@@ -294,7 +301,7 @@ static int hdac_component_master_bind(struct device *dev)static void hdac_component_master_unbind (struct device *dev) { -struct drm_audio_component *acomp = hdac_acomp; +struct drm_audio_component *acomp =hdac_get_acomp (dev);module_put (acomp->ops->owner);component_unbind_all (dev, acomp);
@@ -314,6 +321,7 @@ static int hdac_component_master_match(struct device *dev, void *data)/** * snd_hdac_i915_register_notifier - Register i915 audio component ops +* @bus: HDA core bus * @aops: i915 audio component ops * * This function is supposed to be used only by a HD-audio controller
@@ -323,12 +331,13 @@ static int hdac_component_master_match(struct device *dev, void *data)* * Returns zero for success or a negative error code. */ -int snd_hdac_i915_register_notifier (const struct drm_audio_component_audio_ops *aops) +int snd_hdac_i915_register_notifier (struct hdac_bus *bus, +const struct drm_audio_component_audio_ops *aops) { -if (!hdac_acomp) +if (!bus->audio_component)return -ENODEV ; - hdac_acomp->audio_ops = aops; + bus->audio_component->audio_ops = aops;return 0 ; }EXPORT_SYMBOL_GPL (snd_hdac_i915_register_notifier);
@@ -365,18 +374,19 @@ int snd_hdac_i915_init(struct hdac_bus *bus)struct drm_audio_component *acomp;int ret; -if (WARN_ON (hdac_acomp)) +if (WARN_ON (hdac_get_acomp (dev)))return -EBUSY ;if (!i915_gfx_present ())return -ENODEV ; - i915_acomp =kzalloc (sizeof (*i915_acomp),GFP_KERNEL ); + i915_acomp =devres_alloc (hdac_acomp_release,sizeof (*i915_acomp), +GFP_KERNEL );if (!i915_acomp)return -ENOMEM ; acomp = &i915_acomp->base; bus->audio_component = acomp; - hdac_acomp = acomp; +devres_add (dev, acomp);component_match_add (dev, &match, hdac_component_master_match, bus); ret = component_master_add_with_match(dev, &hdac_component_master_ops,
@@ -400,9 +410,8 @@ int snd_hdac_i915_init(struct hdac_bus *bus) out_master_del:component_master_del (dev, &hdac_component_master_ops); out_err: -kfree (acomp); bus->audio_component =NULL ; - hdac_acomp =NULL ; +devres_destroy (dev, hdac_acomp_release,NULL ,NULL );dev_info (dev,"failed to add i915 component master (%d)\n" , ret);return ret;
@@ -434,9 +443,8 @@ int snd_hdac_i915_exit(struct hdac_bus *bus)component_master_del (dev, &hdac_component_master_ops); -kfree (acomp); bus->audio_component =NULL ; - hdac_acomp =NULL ; +devres_destroy (dev, hdac_acomp_release,NULL ,NULL );return 0 ; }
sound/pci/hda/patch_hdmi.c +3 -2
@@ -2288,7 +2288,7 @@ static void generic_hdmi_free(struct hda_codec *codec)int pin_idx, pcm_idx;if (codec_has_acomp (codec)) -snd_hdac_i915_register_notifier (NULL ); +snd_hdac_i915_register_notifier (&codec->bus->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);
@@ -2518,7 +2518,8 @@ static void register_i915_notifier(struct hda_codec *codec)*/ wmb (); spec->drm_audio_ops.pin_eld_notify = intel_pin_eld_notify; -snd_hdac_i915_register_notifier (&spec->drm_audio_ops); +snd_hdac_i915_register_notifier (&codec->bus->core, + &spec->drm_audio_ops); }/* setup_stream ops override for HSW+ */
sound/soc/codecs/hdac_hdmi.c +1 -1
@@ -1812,7 +1812,7 @@ static int hdmi_codec_probe(struct snd_soc_component *component)return ret; aops.audio_ptr = hdev; - ret =snd_hdac_i915_register_notifier (&aops); + ret =snd_hdac_i915_register_notifier (hdev->bus, &aops);if (ret <0 ) {dev_err (&hdev->dev,"notifier register failed: err: %d\n" , ret);return ret;
Signature · 6 lines
2.18.0 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH v2 3/3 ALSA: hda: Make audio component support more generic
In reply to Takashi IwaiThis is the final step for more generic support of DRM audio component. The generic audio component code is now moved to its own file, and the symbols are renamed from snd_hac_i915_* to snd_hdac_acomp_*, respectively. The generic code is enabled via the new kconfig, CONFIG_SND_HDA_COMPONENT, while CONFIG_SND_HDA_I915 is kept as the super-class.
Along with the split, three new callbacks are added to audio_ops:
pin2port is for providing the conversion between the pin number and the widget id, and master_bind/master_unbin are called at binding / unbinding the master component, respectively. All these are optional, but used in i915 implementation and also other later implementations.
A note about the new snd_hdac_acomp_init() function: there is a slight difference between this and the old snd_hdac_i915_init(). The latter (still) synchronizes with the master component binding, i.e. it assures that the relevant DRM component gets bound when it returns, or gives a negative error. Meanwhile the new function doesn't synchronize but just leaves as is. It's the responsibility by the caller's side to synchronize, or the caller may accept the asynchronous binding on the fly.
v1->v2: Fix missing NULL check in master_bind/unbind
--- drivers/gpu/drm/i915/Kconfig | 1 + include/drm/drm_audio_component.h | 23 ++ include/sound/hda_component.h | 61 ++++++ include/sound/hda_i915.h | 39 +--- sound/hda/Kconfig | 7 +- sound/hda/Makefile | 1 + sound/hda/hdac_component.c | 335 +++++++++++++++++++++++++++++ sound/hda/hdac_i915.c | 343 ++---------------------------- sound/pci/hda/patch_hdmi.c | 50 +++-- sound/soc/codecs/hdac_hdmi.c | 8 +- 10 files changed, 486 insertions(+), 382 deletions(-) create mode 100644 include/sound/hda_component.h create mode 100644 sound/hda/hdac_component.c
drivers/gpu/drm/i915/Kconfig +1 -0
@@ -23,6 +23,7 @@ config DRM_I915 select SYNC_FILE select IOSF_MBI select CRC32 + select SND_HDA_I915 if SND_HDA_CORE help Choose this option if you have a system that has "Intel Graphics Media Accelerator" or "HD Graphics" integrated graphics,
include/drm/drm_audio_component.h +23 -0
@@ -4,6 +4,8 @@#ifndef _DRM_AUDIO_COMPONENT_H_#define _DRM_AUDIO_COMPONENT_H_ +struct drm_audio_component ; +/** * struct drm_audio_component_ops - Ops implemented by DRM driver, called by hda driver */
@@ -72,6 +74,27 @@ struct drm_audio_component_audio_ops {* mode). */ void (*pin_eld_notify)(void *audio_ptr,int port,int pipe); +/** +* @pin2port: Check and convert from pin node to port number +* +* Called by HDA driver to check and convert from the pin widget node +* number to a port number in the graphics side. +*/ +int (*pin2port)(void *audio_ptr,int pin); +/** +* @master_bind: (Optional) component master bind callback +* +* Called at binding master component, for HDA codec-specific +* handling of dynamic binding. +*/ +int (*master_bind)(struct device *dev,struct drm_audio_component *); +/** +* @master_unbind: (Optional) component master unbind callback +* +* Called at unbinding master component, for HDA codec-specific +* handling of dynamic unbinding. +*/ +void (*master_unbind)(struct device *dev,struct drm_audio_component *); };/**
include/sound/hda_component.h new file +61 -0
61 lines not on this page · raw message
include/sound/hda_i915.h +3 -36
@@ -5,56 +5,23 @@#ifndef __SOUND_HDA_I915_H#define __SOUND_HDA_I915_H -#include <drm/drm_audio_component.h> +#include "hda_component.h" #ifdef CONFIG_SND_HDA_I915 -int snd_hdac_set_codec_wakeup (struct hdac_bus *bus,bool enable); -int snd_hdac_display_power (struct hdac_bus *bus,bool enable);void snd_hdac_i915_set_bclk (struct hdac_bus *bus); -int snd_hdac_sync_audio_rate (struct hdac_device *codec,hda_nid_t nid, -int dev_id,int rate); -int snd_hdac_acomp_get_eld (struct hdac_device *codec,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); -int snd_hdac_i915_register_notifier (struct hdac_bus *bus, -const struct drm_audio_component_audio_ops *ops);#else -static inline int snd_hdac_set_codec_wakeup (struct hdac_bus *bus,bool enable) -{ -return 0 ; -} -static inline int snd_hdac_display_power (struct hdac_bus *bus,bool enable) -{ -return 0 ; -}static inline void snd_hdac_i915_set_bclk (struct hdac_bus *bus) { } -static inline int snd_hdac_sync_audio_rate (struct hdac_device *codec, -hda_nid_t nid,int dev_id,int rate) -{ -return 0 ; -} -static inline int snd_hdac_acomp_get_eld (struct hdac_device *codec,hda_nid_t nid, -int dev_id,bool *audio_enabled, -char *buffer,int max_bytes) -{ -return -ENODEV ; -}static inline int snd_hdac_i915_init (struct hdac_bus *bus) {return -ENODEV ; } +#endif static inline int snd_hdac_i915_exit (struct hdac_bus *bus) { -return 0 ; +return snd_hdac_acomp_exit (bus); } -static inline int snd_hdac_i915_register_notifier (struct hdac_bus *bus, -const struct drm_audio_component_audio_ops *ops) -{ -return -ENODEV ; -} -#endif #endif /* __SOUND_HDA_I915_H */
sound/hda/Kconfig +4 -3
@@ -5,11 +5,12 @@ config SND_HDA_CORE config SND_HDA_DSP_LOADER bool +config SND_HDA_COMPONENT + bool + config SND_HDA_I915 bool - default y - depends on DRM_I915 - depends on SND_HDA_CORE + select SND_HDA_COMPONENT config SND_HDA_EXT_CORE tristate
sound/hda/Makefile +1 -0
@@ -6,6 +6,7 @@ snd-hda-core-objs += trace.o CFLAGS_trace.o := -I$(src) # for sync with i915 gfx driver +snd-hda-core-$(CONFIG_SND_HDA_COMPONENT) += hdac_component.o snd-hda-core-$(CONFIG_SND_HDA_I915) += hdac_i915.o obj-$(CONFIG_SND_HDA_CORE) += snd-hda-core.o
sound/hda/hdac_component.c new file +335 -0
335 lines not on this page · raw message
sound/hda/hdac_i915.c +14 -329
377 lines not on this page · raw message
sound/pci/hda/patch_hdmi.c +37 -13
81 lines not on this page · raw message
sound/soc/codecs/hdac_hdmi.c +7 -1
@@ -1530,6 +1530,11 @@ static int hdac_hdmi_parse_and_map_nid(struct hdac_device *hdev,return ret; } +static int hdac_hdmi_pin2port (void *aptr,int pin) +{ +return pin -4 ;/* map NID 0x05 -> port #1 */ +} +static void hdac_hdmi_eld_notify_cb (void *aptr,int port,int pipe) {struct hdac_device *hdev = aptr;
@@ -1584,6 +1589,7 @@ static void hdac_hdmi_eld_notify_cb(void *aptr, int port, int pipe) }static struct drm_audio_component_audio_ops aops = { + .pin2port = hdac_hdmi_pin2port, .pin_eld_notify = hdac_hdmi_eld_notify_cb, };
@@ -1812,7 +1818,7 @@ static int hdmi_codec_probe(struct snd_soc_component *component)return ret; aops.audio_ptr = hdev; - ret =snd_hdac_i915_register_notifier (hdev->bus, &aops); + ret =snd_hdac_acomp_register_notifier (hdev->bus, &aops);if (ret <0 ) {dev_err (&hdev->dev,"notifier register failed: err: %d\n" , ret);return ret;
Signature · 6 lines
2.18.0 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Patchwork
CI✗ Fi.CI.CHECKPATCH: warning for Make the audio component binding more generic (rev2)
In reply to Takashi Iwai== Series Details ==
== Series Details ==
Series: Make the audio component binding more generic (rev2)
URL : https://patchwork.freedesktop.org/series/46603/
State : warning
== Summary ==
$ dim checkpatch origin/drm-tip 0158d4c929db drm/i915: Split audio component to a generic type -:95: WARNING:FILE_PATH_CHANGES: added, moved or deleted file(s), does MAINTAINERS need updating? #95: new file mode 100644
-:100: WARNING:SPDX_LICENSE_TAG: Missing or malformed SPDX-License-Identifier tag in line 1 #100: FILE: include/drm/drm_audio_component.h:1:
+// SPDX-License-Identifier: MIT
-:119: WARNING:FUNCTION_ARGUMENTS: function definition argument 'struct device *' should also have an identifier name #119: FILE: include/drm/drm_audio_component.h:20:
+ void (*get_power)(struct device *);
-:125: WARNING:FUNCTION_ARGUMENTS: function definition argument 'struct device *' should also have an identifier name #125: FILE: include/drm/drm_audio_component.h:26:
+ void (*put_power)(struct device *);
-:129: WARNING:FUNCTION_ARGUMENTS: function definition argument 'struct device *' should also have an identifier name #129: FILE: include/drm/drm_audio_component.h:30:
+ void (*codec_wake_override)(struct device *, bool enable);
-:133: WARNING:FUNCTION_ARGUMENTS: function definition argument 'struct device *' should also have an identifier name #133: FILE: include/drm/drm_audio_component.h:34:
+ int (*get_cdclk_freq)(struct device *);
-:140: WARNING:FUNCTION_ARGUMENTS: function definition argument 'struct device *' should also have an identifier name #140: FILE: include/drm/drm_audio_component.h:41:
+ int (*sync_audio_rate)(struct device *, int port, int pipe, int rate);
-:153: WARNING:FUNCTION_ARGUMENTS: function definition argument 'struct device *' should also have an identifier name #153: FILE: include/drm/drm_audio_component.h:54:
+ int (*get_eld)(struct device *, int port, int pipe, bool *enabled,
-:324: WARNING:FUNCTION_ARGUMENTS: function definition argument 'const struct drm_audio_component_audio_ops *' should also have an identifier name #324: FILE: include/sound/hda_i915.h:20:
+int snd_hdac_i915_register_notifier(const struct drm_audio_component_audio_ops *);
-:333: CHECK:LINE_SPACING: Please use a blank line after function/struct/union/enum declarations #333: FILE: include/sound/hda_i915.h:52:
}
+static inline int snd_hdac_i915_register_notifier(const struct drm_audio_component_audio_ops *ops)
total: 0 errors, 9 warnings, 1 checks, 464 lines checked2b8e8a3a1c0e ALSA: hda/i915: Associate audio component with devres
-:47: CHECK:LINE_SPACING: Please use a blank line after function/struct/union/enum declarations #47: FILE: include/sound/hda_i915.h:53:
}
+static inline int snd_hdac_i915_register_notifier(struct hdac_bus *bus,
total: 0 errors, 0 warnings, 1 checks, 139 lines checked8b0e4bd689b6 ALSA: hda: Make audio component support more generic
-:74: WARNING:FUNCTION_ARGUMENTS: function definition argument 'struct drm_audio_component *' should also have an identifier name #74: FILE: include/drm/drm_audio_component.h:90:
+ int (*master_bind)(struct device *dev, struct drm_audio_component *);
-:81: WARNING:FUNCTION_ARGUMENTS: function definition argument 'struct drm_audio_component *' should also have an identifier name #81: FILE: include/drm/drm_audio_component.h:97:
+ void (*master_unbind)(struct device *dev, struct drm_audio_component *);
-:86: WARNING:FILE_PATH_CHANGES: added, moved or deleted file(s), does MAINTAINERS need updating? #86:
new file mode 100644
-:91: WARNING:SPDX_LICENSE_TAG: Missing or malformed SPDX-License-Identifier tag in line 1 #91: FILE: include/sound/hda_component.h:1:
+// SPDX-License-Identifier: GPL-2.0
-:112: CHECK:PARENTHESIS_ALIGNMENT: Alignment should match open parenthesis #112: FILE: include/sound/hda_component.h:22:
+int snd_hdac_acomp_register_notifier(struct hdac_bus *bus,
+ const struct drm_audio_component_audio_ops *ops);
-:118: CHECK:LINE_SPACING: Please use a blank line after function/struct/union/enum declarations #118: FILE: include/sound/hda_component.h:28:
+}
+static inline int snd_hdac_display_power(struct hdac_bus *bus, bool enable)
-:122: CHECK:LINE_SPACING: Please use a blank line after function/struct/union/enum declarations #122: FILE: include/sound/hda_component.h:32:
+}
+static inline int snd_hdac_sync_audio_rate(struct hdac_device *codec,
-:127: CHECK:LINE_SPACING: Please use a blank line after function/struct/union/enum declarations #127: FILE: include/sound/hda_component.h:37:
+}
+static inline int snd_hdac_acomp_get_eld(struct hdac_device *codec, hda_nid_t nid,
-:133: CHECK:LINE_SPACING: Please use a blank line after function/struct/union/enum declarations #133: FILE: include/sound/hda_component.h:43:
+}
+static inline int snd_hdac_acomp_init(struct hdac_bus *bus,
-:140: CHECK:LINE_SPACING: Please use a blank line after function/struct/union/enum declarations #140: FILE: include/sound/hda_component.h:50:
+}
+static inline int snd_hdac_acomp_exit(struct hdac_bus *bus)
-:144: CHECK:LINE_SPACING: Please use a blank line after function/struct/union/enum declarations #144: FILE: include/sound/hda_component.h:54:
+}
+static inline int snd_hdac_acomp_register_notifier(struct hdac_bus *bus,
-:145: CHECK:PARENTHESIS_ALIGNMENT: Alignment should match open parenthesis #145: FILE: include/sound/hda_component.h:55:
+static inline int snd_hdac_acomp_register_notifier(struct hdac_bus *bus,
+ const struct drm_audio_component_audio_ops *ops)
-:492: CHECK:PARENTHESIS_ALIGNMENT: Alignment should match open parenthesis #492: FILE: sound/hda/hdac_component.c:239:
+int snd_hdac_acomp_register_notifier(struct hdac_bus *bus,
+ const struct drm_audio_component_audio_ops *aops)
-:1060: CHECK:PARENTHESIS_ALIGNMENT: Alignment should match open parenthesis #1060: FILE: sound/pci/hda/patch_hdmi.c:2546:
+ snd_hdac_acomp_register_notifier(&codec->bus->core,
&spec->drm_audio_ops);
total: 0 errors, 4 warnings, 10 checks, 971 lines checked
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Patchwork
CI✓ Fi.CI.BAT: success for Make the audio component binding more generic (rev2)
In reply to Takashi Iwai== Series Details ==
== Series Details ==
Series: Make the audio component binding more generic (rev2)
URL : https://patchwork.freedesktop.org/series/46603/
State : success
== Summary ==
= CI Bug Log - changes from CI_DRM_4501 -> Patchwork_9685 =
== Summary - WARNING ==
Minor unknown changes coming with Patchwork_9685 need to be verified manually.
If you think the reported changes have nothing to do with the changes introduced in Patchwork_9685, please notify your bug team to allow them to document this new failure mode, which will reduce false positives in CI.
External URL: https://patchwork.freedesktop.org/api/1.0/series/46603/revisions/2/mbox/
== Possible new issues ==
Here are the unknown changes that may have been introduced in Patchwork_9685:
=== IGT changes ===
==== Warnings ====
igt@gem_exec_gttfill@basic:
fi-pnv-d510: PASS -> SKIP== Known issues ==
Here are the changes found in Patchwork_9685 that come from known issues:
=== IGT changes ===
==== Issues hit ====
igt@kms_flip@basic-flip-vs-dpms:
fi-skl-6700hq: PASS -> DMESG-WARN (fdo#105998)
==== Possible fixes ====
igt@gem_exec_suspend@basic-s4-devices:
fi-kbl-7500u: DMESG-WARN (fdo#105128, fdo#107139) -> PASS
igt@kms_busy@basic-flip-b:
fi-skl-6700hq: DMESG-WARN (fdo#105998) -> PASS +1
igt@prime_vgem@basic-fence-flip:
fi-ilk-650: FAIL (fdo#104008) -> PASS fdo#104008 https://bugs.freedesktop.org/show_bug.cgi?id=104008
fdo#105128 https://bugs.freedesktop.org/show_bug.cgi?id=105128
fdo#105998 https://bugs.freedesktop.org/show_bug.cgi?id=105998
fdo#107139 https://bugs.freedesktop.org/show_bug.cgi?id=107139
== Participating hosts (46 -> 42) ==
Additional (1): fi-cfl-8109u
Missing (5): fi-ctg-p8600 fi-ilk-m540 fi-byt-squawks fi-bsw-cyan fi-hsw-4200u
== Build changes ==
* Linux: CI_DRM_4501 -> Patchwork_9685
CI_DRM_4501: 692d13f7b75baf0bb8c58b9784569c52d68f01e2 @ git://anongit.freedesktop.org/gfx-ci/linux
IGT_4559: 6d341aac2124836443ce74e8e97a4508ac8d5095 @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
Patchwork_9685: 8b0e4bd689b6f7b994f8215a41ca3ee84cc6a639 @ git://anongit.freedesktop.org/gfx-ci/linux
== Linux commits ==
8b0e4bd689b6 ALSA: hda: Make audio component support more generic 2b8e8a3a1c0e ALSA: hda/i915: Associate audio component with devres 0158d4c929db drm/i915: Split audio component to a generic type
== Logs ==
For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_9685/issues.html
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Patchwork
CI✓ Fi.CI.IGT: success for Make the audio component binding more generic (rev2)
In reply to Takashi Iwai== Series Details ==
== Series Details ==
Series: Make the audio component binding more generic (rev2)
URL : https://patchwork.freedesktop.org/series/46603/
State : success
== Summary ==
= CI Bug Log - changes from CI_DRM_4501_full -> Patchwork_9685_full =
== Summary - WARNING ==
Minor unknown changes coming with Patchwork_9685_full need to be verified manually.
If you think the reported changes have nothing to do with the changes introduced in Patchwork_9685_full, please notify your bug team to allow them to document this new failure mode, which will reduce false positives in CI.
== Possible new issues ==
Here are the unknown changes that may have been introduced in Patchwork_9685_full:
=== IGT changes ===
==== Warnings ====
igt@gem_exec_schedule@deep-bsd1:
shard-kbl: SKIP -> PASS +1
igt@gem_exec_schedule@deep-bsd2:
shard-kbl: PASS -> SKIP +1== Known issues ==
Here are the changes found in Patchwork_9685_full that come from known issues:
=== IGT changes ===
==== Issues hit ====
igt@kms_flip@flip-vs-expired-vblank:
shard-kbl: PASS -> FAIL (fdo#105363, fdo#102887)
igt@kms_flip@plain-flip-fb-recreate-interruptible:
shard-glk: PASS -> FAIL (fdo#100368)
igt@perf@blocking:
shard-hsw: PASS -> FAIL (fdo#102252)
==== Possible fixes ====
igt@gem_cs_tlb@render:
shard-snb: INCOMPLETE (fdo#105411) -> PASS
igt@kms_flip@plain-flip-fb-recreate:
shard-glk: FAIL (fdo#100368) -> PASS
igt@perf_pmu@rc6-runtime-pm-long:
shard-hsw: FAIL (fdo#105010) -> PASS fdo#100368 https://bugs.freedesktop.org/show_bug.cgi?id=100368
fdo#102252 https://bugs.freedesktop.org/show_bug.cgi?id=102252
fdo#102887 https://bugs.freedesktop.org/show_bug.cgi?id=102887
fdo#105010 https://bugs.freedesktop.org/show_bug.cgi?id=105010
fdo#105363 https://bugs.freedesktop.org/show_bug.cgi?id=105363
fdo#105411 https://bugs.freedesktop.org/show_bug.cgi?id=105411
== Participating hosts (5 -> 5) ==
No changes in participating hosts
== Build changes ==
* Linux: CI_DRM_4501 -> Patchwork_9685
CI_DRM_4501: 692d13f7b75baf0bb8c58b9784569c52d68f01e2 @ git://anongit.freedesktop.org/gfx-ci/linux
IGT_4559: 6d341aac2124836443ce74e8e97a4508ac8d5095 @ git://anongit.freedesktop.org/xorg/app/intel-gpu-tools
Patchwork_9685: 8b0e4bd689b6f7b994f8215a41ca3ee84cc6a639 @ git://anongit.freedesktop.org/gfx-ci/linux
piglit_4509: fdc5a4ca11124ab8413c7988896eec4c97336694 @ git://anongit.freedesktop.org/piglit
== Logs ==
For more details see: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_9685/shards.html
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoted 8 lines · Takashi Iwai
Hi,
this is a preliminiary patch set to convert the existing i915 / HD-audio component binding to be applicable to other drivers like radeon / amdgpu. This patchset itself doesn't change the functionality but only renames and split to a new
drm_audio_componentstuff fromi915_audio_component.
Quoted 6 lines
The actual usage of the new API will follow once after this one gets reviewed / accepted. The whole patches (including this patchset) are found in topic/hda-acomp branch of sound.git tree.
BTW, since the whole stuff is about the audio binding, I suppose these will go through sound git tree. Let me know if anyone has concerns.
No objections but a slight concern that this will conflict with the HDAudio+DSP patches that I was about to resubmit on top of your topic/hda-core-intel branch. the two series touch the same files so it'd be a miracle if there is no issue. How do you want to deal with this?
Quoted 34 lines
Thanks!
Takashi
===
v1->v2:
* Change to SPDX for the newdrm_audio_component.h
* Fix remaining i915 word indrm_audio_component.hcomments
* Fix NULL dereference inmaster_bind/_unbindops===
Takashi Iwai (3):
drm/i915: Split audio component to a generic type
ALSA: hda/i915: Associate audio component with devres
ALSA: hda: Make audio component support more genericdrivers/gpu/drm/i915/Kconfig | 1 + drivers/gpu/drm/i915/intel_audio.c | 22 +- include/drm/drm_audio_component.h | 118 ++++++++++ include/drm/i915_component.h | 85 +------- include/sound/hda_component.h | 61 ++++++ include/sound/hda_i915.h | 37 +--- include/sound/hdaudio.h | 6 +- sound/hda/Kconfig | 7 +- sound/hda/Makefile | 1 + sound/hda/hdac_component.c | 335 +++++++++++++++++++++++++++++ sound/hda/hdac_i915.c | 335 ++--------------------------- sound/pci/hda/patch_hdmi.c | 57 +++-- sound/soc/codecs/hdac_hdmi.c | 10 +- 13 files changed, 607 insertions(+), 468 deletions(-)
Quoted 4 lines
create mode 100644
include/drm/drm_audio_component.hcreate mode 100644include/sound/hda_component.hcreate mode 100644sound/hda/hdac_component.c
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoted 16 lines · Pierre-Louis Bossart
Quoted 12 lines · Takashi Iwai
Hi,
this is a preliminiary patch set to convert the existing i915 / HD-audio component binding to be applicable to other drivers like radeon / amdgpu. This patchset itself doesn't change the functionality but only renames and split to a new
drm_audio_componentstuff fromi915_audio_component.The actual usage of the new API will follow once after this one gets reviewed / accepted. The whole patches (including this patchset) are found in topic/hda-acomp branch of sound.git tree.
Quoted 7 lines
Quoted 2 lines
BTW, since the whole stuff is about the audio binding, I suppose these will go through sound git tree. Let me know if anyone has concerns.
No objections but a slight concern that this will conflict with the HDAudio+DSP patches that I was about to resubmit on top of your topic/hda-core-intel branch. the two series touch the same files so it'd be a miracle if there is no issue.
How do you want to deal with this?
Does it conflict severely? If it's trivial, it can be resolved at merge time, too. The changes in my patchset are fairly trivial, so it shouldn't be too hard.
thanks,
Takashi
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoted 26 lines · Takashi Iwai
Quoted 16 lines · Pierre-Louis Bossart
Quoted 12 lines · Takashi Iwai
Hi,
this is a preliminiary patch set to convert the existing i915 / HD-audio component binding to be applicable to other drivers like radeon / amdgpu. This patchset itself doesn't change the functionality but only renames and split to a new
drm_audio_componentstuff fromi915_audio_component.The actual usage of the new API will follow once after this one gets reviewed / accepted. The whole patches (including this patchset) are found in topic/hda-acomp branch of sound.git tree.
Quoted 7 lines
Quoted 2 lines
BTW, since the whole stuff is about the audio binding, I suppose these will go through sound git tree. Let me know if anyone has concerns.
No objections but a slight concern that this will conflict with the HDAudio+DSP patches that I was about to resubmit on top of your topic/hda-core-intel branch. the two series touch the same files so it'd be a miracle if there is no issue.
How do you want to deal with this?
Quoted 3 lines
Does it conflict severely? If it's trivial, it can be resolved at merge time, too. The changes in my patchset are fairly trivial, so it shouldn't be too hard.
I was able to make things work by taking your topic/hda-core-intel, merge it on Mark's for-next, then add my additional changes and these DRM changes. The last two can be done in any order. But I am getting some conflicts if I try to apply these DRM changes first, not sure why git is complaining though, the changes look trivial enough. So yes it looks possible to deal with the two series in parallel, will send my update later today.
Thanks
-Pierre
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoted 32 lines · Pierre-Louis Bossart
Quoted 26 lines · Takashi Iwai
Quoted 16 lines · Pierre-Louis Bossart
Quoted 12 lines · Takashi Iwai
Hi,
this is a preliminiary patch set to convert the existing i915 / HD-audio component binding to be applicable to other drivers like radeon / amdgpu. This patchset itself doesn't change the functionality but only renames and split to a new
drm_audio_componentstuff fromi915_audio_component.The actual usage of the new API will follow once after this one gets reviewed / accepted. The whole patches (including this patchset) are found in topic/hda-acomp branch of sound.git tree.
Quoted 7 lines
Quoted 2 lines
BTW, since the whole stuff is about the audio binding, I suppose these will go through sound git tree. Let me know if anyone has concerns.
No objections but a slight concern that this will conflict with the HDAudio+DSP patches that I was about to resubmit on top of your topic/hda-core-intel branch. the two series touch the same files so it'd be a miracle if there is no issue.
How do you want to deal with this?Quoted 3 lines
Does it conflict severely? If it's trivial, it can be resolved at merge time, too. The changes in my patchset are fairly trivial, so it shouldn't be too hard.
Quoted 7 lines
I was able to make things work by taking your topic/hda-core-intel, merge it on Mark's for-next, then add my additional changes and these DRM changes. The last two can be done in any order. But I am getting some conflicts if I try to apply these DRM changes first, not sure why git is complaining though, the changes look trivial enough. So yes it looks possible to deal with the two series in parallel, will send my update later today.
OK, since my changes are relatively trivial to deal with, I merge the changes to for-next branch now.
If your patches can be respinned, maybe it's easier to be rebased on top of these merges.
Mark, could you merge topic/drm_audio_component branch into yours, if Pierre's patchset won't go in immediately? It's an immutable branch, including already topic/hda-core-intel in itself.
thanks,
Takashi
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoted 42 lines · Takashi Iwai
Quoted 32 lines · Pierre-Louis Bossart
Quoted 26 lines · Takashi Iwai
Quoted 16 lines · Pierre-Louis Bossart
Quoted 12 lines · Takashi Iwai
Hi,
this is a preliminiary patch set to convert the existing i915 / HD-audio component binding to be applicable to other drivers like radeon / amdgpu. This patchset itself doesn't change the functionality but only renames and split to a new
drm_audio_componentstuff fromi915_audio_component.The actual usage of the new API will follow once after this one gets reviewed / accepted. The whole patches (including this patchset) are found in topic/hda-acomp branch of sound.git tree.
Quoted 7 lines
Quoted 2 lines
BTW, since the whole stuff is about the audio binding, I suppose these will go through sound git tree. Let me know if anyone has concerns.
No objections but a slight concern that this will conflict with the HDAudio+DSP patches that I was about to resubmit on top of your topic/hda-core-intel branch. the two series touch the same files so it'd be a miracle if there is no issue.
How do you want to deal with this?Quoted 3 lines
Does it conflict severely? If it's trivial, it can be resolved at merge time, too. The changes in my patchset are fairly trivial, so it shouldn't be too hard.
Quoted 7 lines
I was able to make things work by taking your topic/hda-core-intel, merge it on Mark's for-next, then add my additional changes and these DRM changes. The last two can be done in any order. But I am getting some conflicts if I try to apply these DRM changes first, not sure why git is complaining though, the changes look trivial enough. So yes it looks possible to deal with the two series in parallel, will send my update later today.
Quoted 5 lines
OK, since my changes are relatively trivial to deal with, I merge the changes to for-next branch now.
If your patches can be respinned, maybe it's easier to be rebased on top of these merges.
I was planning to resend them tomorrow after internal reviews (mostly changes in the detection/enablement of the HDaudio+DSP case). If you want to take a look in the mean time the patches are here: https://github.com/plbossart/sound/commits/upstream/hda2
I can rebase them as needed, no big deal.
Thanks
-Pierre
Quoted 10 lines
Mark, could you merge topic/drm_audio_component branch into yours, if Pierre's patchset won't go in immediately? It's an immutable branch, including already topic/hda-core-intel in itself.
thanks,
Takashi
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx