mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
synced 2025-01-17 22:05:08 +00:00
ASoC: arizona: Add a notifier chain for CODEC events
Add a notifier chain that can be used from the machine driver to catch events generated by the CODEC. Signed-off-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com> Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
parent
1a695a905c
commit
2230c49f09
@ -14,6 +14,7 @@
|
|||||||
#define _WM_ARIZONA_CORE_H
|
#define _WM_ARIZONA_CORE_H
|
||||||
|
|
||||||
#include <linux/interrupt.h>
|
#include <linux/interrupt.h>
|
||||||
|
#include <linux/notifier.h>
|
||||||
#include <linux/regmap.h>
|
#include <linux/regmap.h>
|
||||||
#include <linux/regulator/consumer.h>
|
#include <linux/regulator/consumer.h>
|
||||||
#include <linux/mfd/arizona/pdata.h>
|
#include <linux/mfd/arizona/pdata.h>
|
||||||
@ -148,8 +149,17 @@ struct arizona {
|
|||||||
uint16_t dac_comp_coeff;
|
uint16_t dac_comp_coeff;
|
||||||
uint8_t dac_comp_enabled;
|
uint8_t dac_comp_enabled;
|
||||||
struct mutex dac_comp_lock;
|
struct mutex dac_comp_lock;
|
||||||
|
|
||||||
|
struct blocking_notifier_head notifier;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static inline int arizona_call_notifiers(struct arizona *arizona,
|
||||||
|
unsigned long event,
|
||||||
|
void *data)
|
||||||
|
{
|
||||||
|
return blocking_notifier_call_chain(&arizona->notifier, event, data);
|
||||||
|
}
|
||||||
|
|
||||||
int arizona_clk32k_enable(struct arizona *arizona);
|
int arizona_clk32k_enable(struct arizona *arizona);
|
||||||
int arizona_clk32k_disable(struct arizona *arizona);
|
int arizona_clk32k_disable(struct arizona *arizona);
|
||||||
|
|
||||||
|
@ -324,6 +324,17 @@ int arizona_init_gpio(struct snd_soc_codec *codec)
|
|||||||
}
|
}
|
||||||
EXPORT_SYMBOL_GPL(arizona_init_gpio);
|
EXPORT_SYMBOL_GPL(arizona_init_gpio);
|
||||||
|
|
||||||
|
int arizona_init_notifiers(struct snd_soc_codec *codec)
|
||||||
|
{
|
||||||
|
struct arizona_priv *priv = snd_soc_codec_get_drvdata(codec);
|
||||||
|
struct arizona *arizona = priv->arizona;
|
||||||
|
|
||||||
|
BLOCKING_INIT_NOTIFIER_HEAD(&arizona->notifier);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
EXPORT_SYMBOL_GPL(arizona_init_notifiers);
|
||||||
|
|
||||||
const char * const arizona_mixer_texts[ARIZONA_NUM_MIXER_INPUTS] = {
|
const char * const arizona_mixer_texts[ARIZONA_NUM_MIXER_INPUTS] = {
|
||||||
"None",
|
"None",
|
||||||
"Tone Generator 1",
|
"Tone Generator 1",
|
||||||
@ -2573,6 +2584,30 @@ int arizona_lhpf_coeff_put(struct snd_kcontrol *kcontrol,
|
|||||||
}
|
}
|
||||||
EXPORT_SYMBOL_GPL(arizona_lhpf_coeff_put);
|
EXPORT_SYMBOL_GPL(arizona_lhpf_coeff_put);
|
||||||
|
|
||||||
|
int arizona_register_notifier(struct snd_soc_codec *codec,
|
||||||
|
struct notifier_block *nb,
|
||||||
|
int (*notify)(struct notifier_block *nb,
|
||||||
|
unsigned long action, void *data))
|
||||||
|
{
|
||||||
|
struct arizona_priv *priv = snd_soc_codec_get_drvdata(codec);
|
||||||
|
struct arizona *arizona = priv->arizona;
|
||||||
|
|
||||||
|
nb->notifier_call = notify;
|
||||||
|
|
||||||
|
return blocking_notifier_chain_register(&arizona->notifier, nb);
|
||||||
|
}
|
||||||
|
EXPORT_SYMBOL_GPL(arizona_register_notifier);
|
||||||
|
|
||||||
|
int arizona_unregister_notifier(struct snd_soc_codec *codec,
|
||||||
|
struct notifier_block *nb)
|
||||||
|
{
|
||||||
|
struct arizona_priv *priv = snd_soc_codec_get_drvdata(codec);
|
||||||
|
struct arizona *arizona = priv->arizona;
|
||||||
|
|
||||||
|
return blocking_notifier_chain_unregister(&arizona->notifier, nb);
|
||||||
|
}
|
||||||
|
EXPORT_SYMBOL_GPL(arizona_unregister_notifier);
|
||||||
|
|
||||||
MODULE_DESCRIPTION("ASoC Wolfson Arizona class device support");
|
MODULE_DESCRIPTION("ASoC Wolfson Arizona class device support");
|
||||||
MODULE_AUTHOR("Mark Brown <broonie@opensource.wolfsonmicro.com>");
|
MODULE_AUTHOR("Mark Brown <broonie@opensource.wolfsonmicro.com>");
|
||||||
MODULE_LICENSE("GPL");
|
MODULE_LICENSE("GPL");
|
||||||
|
@ -306,6 +306,7 @@ extern int arizona_set_fll(struct arizona_fll *fll, int source,
|
|||||||
extern int arizona_init_spk(struct snd_soc_codec *codec);
|
extern int arizona_init_spk(struct snd_soc_codec *codec);
|
||||||
extern int arizona_init_gpio(struct snd_soc_codec *codec);
|
extern int arizona_init_gpio(struct snd_soc_codec *codec);
|
||||||
extern int arizona_init_mono(struct snd_soc_codec *codec);
|
extern int arizona_init_mono(struct snd_soc_codec *codec);
|
||||||
|
extern int arizona_init_notifiers(struct snd_soc_codec *codec);
|
||||||
|
|
||||||
extern int arizona_free_spk(struct snd_soc_codec *codec);
|
extern int arizona_free_spk(struct snd_soc_codec *codec);
|
||||||
|
|
||||||
@ -317,4 +318,13 @@ int arizona_set_output_mode(struct snd_soc_codec *codec, int output,
|
|||||||
extern bool arizona_input_analog(struct snd_soc_codec *codec, int shift);
|
extern bool arizona_input_analog(struct snd_soc_codec *codec, int shift);
|
||||||
|
|
||||||
extern const char *arizona_sample_rate_val_to_name(unsigned int rate_val);
|
extern const char *arizona_sample_rate_val_to_name(unsigned int rate_val);
|
||||||
|
|
||||||
|
extern int arizona_register_notifier(struct snd_soc_codec *codec,
|
||||||
|
struct notifier_block *nb,
|
||||||
|
int (*notify)(struct notifier_block *nb,
|
||||||
|
unsigned long action,
|
||||||
|
void *data));
|
||||||
|
extern int arizona_unregister_notifier(struct snd_soc_codec *codec,
|
||||||
|
struct notifier_block *nb);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -1096,6 +1096,7 @@ static int cs47l24_codec_probe(struct snd_soc_codec *codec)
|
|||||||
arizona_init_spk(codec);
|
arizona_init_spk(codec);
|
||||||
arizona_init_gpio(codec);
|
arizona_init_gpio(codec);
|
||||||
arizona_init_mono(codec);
|
arizona_init_mono(codec);
|
||||||
|
arizona_init_notifiers(codec);
|
||||||
|
|
||||||
ret = arizona_request_irq(arizona, ARIZONA_IRQ_DSP_IRQ1,
|
ret = arizona_request_irq(arizona, ARIZONA_IRQ_DSP_IRQ1,
|
||||||
"ADSP2 Compressed IRQ", cs47l24_adsp2_irq,
|
"ADSP2 Compressed IRQ", cs47l24_adsp2_irq,
|
||||||
|
@ -2251,6 +2251,7 @@ static int wm5110_codec_probe(struct snd_soc_codec *codec)
|
|||||||
arizona_init_spk(codec);
|
arizona_init_spk(codec);
|
||||||
arizona_init_gpio(codec);
|
arizona_init_gpio(codec);
|
||||||
arizona_init_mono(codec);
|
arizona_init_mono(codec);
|
||||||
|
arizona_init_notifiers(codec);
|
||||||
|
|
||||||
ret = arizona_request_irq(arizona, ARIZONA_IRQ_DSP_IRQ1,
|
ret = arizona_request_irq(arizona, ARIZONA_IRQ_DSP_IRQ1,
|
||||||
"ADSP2 Compressed IRQ", wm5110_adsp2_irq,
|
"ADSP2 Compressed IRQ", wm5110_adsp2_irq,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user