[PATCH v1 06/11] ALSA: hda: hda_component: Add pre and post playback hooks to hda_component

Stefan Binding posted 11 patches 2 years, 6 months ago
There is a newer version of this series
[PATCH v1 06/11] ALSA: hda: hda_component: Add pre and post playback hooks to hda_component
Posted by Stefan Binding 2 years, 6 months ago
These hooks can be used to add callbacks that would be run before and after
the main playback hooks. These hooks would be called for all amps, before
moving on to the next hook, i.e. pre_playback_hook would be called for
all amps, before the playback_hook is called for all amps, then finally
the post_playback_hook is called for all amps.

Signed-off-by: Stefan Binding <sbinding@opensource.cirrus.com>
---
 sound/pci/hda/hda_component.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/sound/pci/hda/hda_component.h b/sound/pci/hda/hda_component.h
index 534e845b9cd1d..f170aec967c18 100644
--- a/sound/pci/hda/hda_component.h
+++ b/sound/pci/hda/hda_component.h
@@ -15,5 +15,7 @@ struct hda_component {
 	struct device *dev;
 	char name[HDA_MAX_NAME_SIZE];
 	struct hda_codec *codec;
+	void (*pre_playback_hook)(struct device *dev, int action);
 	void (*playback_hook)(struct device *dev, int action);
+	void (*post_playback_hook)(struct device *dev, int action);
 };
-- 
2.34.1
Re: [PATCH v1 06/11] ALSA: hda: hda_component: Add pre and post playback hooks to hda_component
Posted by Takashi Iwai 2 years, 6 months ago
On Thu, 20 Jul 2023 15:31:42 +0200,
Stefan Binding wrote:
> 
> These hooks can be used to add callbacks that would be run before and after
> the main playback hooks. These hooks would be called for all amps, before
> moving on to the next hook, i.e. pre_playback_hook would be called for
> all amps, before the playback_hook is called for all amps, then finally
> the post_playback_hook is called for all amps.
> 
> Signed-off-by: Stefan Binding <sbinding@opensource.cirrus.com>

It's better to combine this and patch 9 for the actual calls, so that
we know the full effect of the changes.


thanks,

Takashi

> ---
>  sound/pci/hda/hda_component.h | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/sound/pci/hda/hda_component.h b/sound/pci/hda/hda_component.h
> index 534e845b9cd1d..f170aec967c18 100644
> --- a/sound/pci/hda/hda_component.h
> +++ b/sound/pci/hda/hda_component.h
> @@ -15,5 +15,7 @@ struct hda_component {
>  	struct device *dev;
>  	char name[HDA_MAX_NAME_SIZE];
>  	struct hda_codec *codec;
> +	void (*pre_playback_hook)(struct device *dev, int action);
>  	void (*playback_hook)(struct device *dev, int action);
> +	void (*post_playback_hook)(struct device *dev, int action);
>  };
> -- 
> 2.34.1
>