diff options
Diffstat (limited to 'sound/soc/codecs/arizona.h')
| -rw-r--r-- | sound/soc/codecs/arizona.h | 81 |
1 files changed, 63 insertions, 18 deletions
diff --git a/sound/soc/codecs/arizona.h b/sound/soc/codecs/arizona.h index 1822e3b3de80..ecd8890eefc1 100644 --- a/sound/soc/codecs/arizona.h +++ b/sound/soc/codecs/arizona.h @@ -1,13 +1,10 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ /* * arizona.h - Wolfson Arizona class device shared support * * Copyright 2012 Wolfson Microelectronics plc * * Author: Mark Brown <broonie@opensource.wolfsonmicro.com> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. */ #ifndef _ASOC_ARIZONA_H @@ -94,6 +91,41 @@ struct arizona_priv { unsigned int dvfs_reqs; struct mutex dvfs_lock; bool dvfs_cached; + + /* Variables used by arizona-jack.c code */ + struct mutex lock; + struct delayed_work hpdet_work; + struct delayed_work micd_detect_work; + struct delayed_work micd_timeout_work; + struct snd_soc_jack *jack; + struct regulator *micvdd; + struct gpio_desc *micd_pol_gpio; + + u16 last_jackdet; + + int micd_mode; + const struct arizona_micd_config *micd_modes; + int micd_num_modes; + + int micd_button_mask; + const struct arizona_micd_range *micd_ranges; + int num_micd_ranges; + + bool micd_reva; + bool micd_clamp; + + bool hpdet_active; + bool hpdet_done; + bool hpdet_retried; + + bool mic; + bool detecting; + + int num_hpdet_res; + unsigned int hpdet_res[3]; + + int jack_flips; + int hpdet_ip_version; }; struct arizona_voice_trigger_info { @@ -225,6 +257,9 @@ extern unsigned int arizona_mixer_values[ARIZONA_NUM_MIXER_INPUTS]; #define ARIZONA_RATE_ENUM_SIZE 4 #define ARIZONA_SAMPLE_RATE_ENUM_SIZE 14 +/* SND_JACK_* mask for supported cable/switch types */ +#define ARIZONA_JACK_MASK (SND_JACK_HEADSET | SND_JACK_LINEOUT | SND_JACK_MECHANICAL) + extern const char * const arizona_rate_text[ARIZONA_RATE_ENUM_SIZE]; extern const unsigned int arizona_rate_val[ARIZONA_RATE_ENUM_SIZE]; extern const char * const arizona_sample_rate_text[ARIZONA_SAMPLE_RATE_ENUM_SIZE]; @@ -273,7 +308,7 @@ int arizona_lhpf_coeff_put(struct snd_kcontrol *kcontrol, int arizona_clk_ev(struct snd_soc_dapm_widget *w, struct snd_kcontrol *kcontrol, int event); -int arizona_set_sysclk(struct snd_soc_codec *codec, int clk_id, int source, +int arizona_set_sysclk(struct snd_soc_component *component, int clk_id, int source, unsigned int freq, int dir); extern const struct snd_soc_dai_ops arizona_dai_ops; @@ -297,8 +332,8 @@ struct arizona_fll { char clock_ok_name[ARIZONA_FLL_NAME_LEN]; }; -int arizona_dvfs_up(struct snd_soc_codec *codec, unsigned int flags); -int arizona_dvfs_down(struct snd_soc_codec *codec, unsigned int flags); +int arizona_dvfs_up(struct snd_soc_component *component, unsigned int flags); +int arizona_dvfs_down(struct snd_soc_component *component, unsigned int flags); int arizona_dvfs_sysclk_ev(struct snd_soc_dapm_widget *w, struct snd_kcontrol *kcontrol, int event); void arizona_init_dvfs(struct arizona_priv *priv); @@ -310,30 +345,32 @@ int arizona_set_fll_refclk(struct arizona_fll *fll, int source, int arizona_set_fll(struct arizona_fll *fll, int source, unsigned int Fref, unsigned int Fout); -int arizona_init_spk(struct snd_soc_codec *codec); -int arizona_init_gpio(struct snd_soc_codec *codec); -int arizona_init_mono(struct snd_soc_codec *codec); -int arizona_init_notifiers(struct snd_soc_codec *codec); +int arizona_init_spk(struct snd_soc_component *component); +int arizona_init_gpio(struct snd_soc_component *component); +int arizona_init_mono(struct snd_soc_component *component); + +int arizona_init_common(struct arizona *arizona); +int arizona_init_vol_limit(struct arizona *arizona); int arizona_init_spk_irqs(struct arizona *arizona); int arizona_free_spk_irqs(struct arizona *arizona); -int arizona_init_dai(struct arizona_priv *priv, int dai); +int arizona_init_dai(struct arizona_priv *priv, int id); -int arizona_set_output_mode(struct snd_soc_codec *codec, int output, +int arizona_set_output_mode(struct snd_soc_component *component, int output, bool diff); -bool arizona_input_analog(struct snd_soc_codec *codec, int shift); +bool arizona_input_analog(struct snd_soc_component *component, int shift); const char *arizona_sample_rate_val_to_name(unsigned int rate_val); -static inline int arizona_register_notifier(struct snd_soc_codec *codec, +static inline int arizona_register_notifier(struct snd_soc_component *component, 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_priv *priv = snd_soc_component_get_drvdata(component); struct arizona *arizona = priv->arizona; nb->notifier_call = notify; @@ -341,13 +378,21 @@ static inline int arizona_register_notifier(struct snd_soc_codec *codec, return blocking_notifier_chain_register(&arizona->notifier, nb); } -static inline int arizona_unregister_notifier(struct snd_soc_codec *codec, +static inline int arizona_unregister_notifier(struct snd_soc_component *component, struct notifier_block *nb) { - struct arizona_priv *priv = snd_soc_codec_get_drvdata(codec); + struct arizona_priv *priv = snd_soc_component_get_drvdata(component); struct arizona *arizona = priv->arizona; return blocking_notifier_chain_unregister(&arizona->notifier, nb); } +int arizona_of_get_audio_pdata(struct arizona *arizona); + +int arizona_jack_codec_dev_probe(struct arizona_priv *info, struct device *dev); +int arizona_jack_codec_dev_remove(struct arizona_priv *info); + +int arizona_jack_set_jack(struct snd_soc_component *component, + struct snd_soc_jack *jack, void *data); + #endif |
