linux/sound/soc/codecs/arizona.h

/* SPDX-License-Identifier: GPL-2.0-only */
/*
 * arizona.h - Wolfson Arizona class device shared support
 *
 * Copyright 2012 Wolfson Microelectronics plc
 *
 * Author: Mark Brown <[email protected]>
 */

#ifndef _ASOC_ARIZONA_H
#define _ASOC_ARIZONA_H

#include <linux/completion.h>
#include <linux/notifier.h>
#include <linux/mfd/arizona/core.h>

#include <sound/soc.h>

#include "wm_adsp.h"

#define ARIZONA_CLK_SYSCLK
#define ARIZONA_CLK_ASYNCCLK
#define ARIZONA_CLK_OPCLK
#define ARIZONA_CLK_ASYNC_OPCLK

#define ARIZONA_CLK_SRC_MCLK1
#define ARIZONA_CLK_SRC_MCLK2
#define ARIZONA_CLK_SRC_FLL1
#define ARIZONA_CLK_SRC_FLL2
#define ARIZONA_CLK_SRC_AIF1BCLK
#define ARIZONA_CLK_SRC_AIF2BCLK
#define ARIZONA_CLK_SRC_AIF3BCLK

#define ARIZONA_FLL_SRC_NONE
#define ARIZONA_FLL_SRC_MCLK1
#define ARIZONA_FLL_SRC_MCLK2
#define ARIZONA_FLL_SRC_SLIMCLK
#define ARIZONA_FLL_SRC_FLL1
#define ARIZONA_FLL_SRC_FLL2
#define ARIZONA_FLL_SRC_AIF1BCLK
#define ARIZONA_FLL_SRC_AIF2BCLK
#define ARIZONA_FLL_SRC_AIF3BCLK
#define ARIZONA_FLL_SRC_AIF1LRCLK
#define ARIZONA_FLL_SRC_AIF2LRCLK
#define ARIZONA_FLL_SRC_AIF3LRCLK

#define ARIZONA_MIXER_VOL_MASK
#define ARIZONA_MIXER_VOL_SHIFT
#define ARIZONA_MIXER_VOL_WIDTH

#define ARIZONA_CLK_6MHZ
#define ARIZONA_CLK_12MHZ
#define ARIZONA_CLK_24MHZ
#define ARIZONA_CLK_49MHZ
#define ARIZONA_CLK_73MHZ
#define ARIZONA_CLK_98MHZ
#define ARIZONA_CLK_147MHZ

#define ARIZONA_MAX_DAI
#define ARIZONA_MAX_ADSP

#define ARIZONA_DVFS_SR1_RQ
#define ARIZONA_DVFS_ADSP1_RQ

/* Notifier events */
#define ARIZONA_NOTIFY_VOICE_TRIGGER

struct wm_adsp;

struct arizona_dai_priv {};

struct arizona_priv {};

struct arizona_voice_trigger_info {};

#define ARIZONA_NUM_MIXER_INPUTS

extern const unsigned int arizona_mixer_tlv[];
extern const char * const arizona_mixer_texts[ARIZONA_NUM_MIXER_INPUTS];
extern unsigned int arizona_mixer_values[ARIZONA_NUM_MIXER_INPUTS];

#define ARIZONA_GAINMUX_CONTROLS(name, base)

#define ARIZONA_MIXER_CONTROLS(name, base)

#define ARIZONA_MUX_ENUM_DECL(name, reg)

#define ARIZONA_MUX_CTL_DECL(name)

#define ARIZONA_MUX_ENUMS(name, base_reg)

#define ARIZONA_MIXER_ENUMS(name, base_reg)

#define ARIZONA_DSP_AUX_ENUMS(name, base_reg)

#define ARIZONA_MUX(name, ctrl)

#define ARIZONA_MUX_WIDGETS(name, name_str)

#define ARIZONA_MIXER_WIDGETS(name, name_str)

#define ARIZONA_DSP_WIDGETS(name, name_str)

#define ARIZONA_MUX_ROUTES(widget, name)

#define ARIZONA_MIXER_ROUTES(widget, name)

#define ARIZONA_DSP_ROUTES(name)

#define ARIZONA_EQ_CONTROL(xname, xbase)

#define ARIZONA_LHPF_CONTROL(xname, xbase)

#define ARIZONA_RATE_ENUM_SIZE
#define ARIZONA_SAMPLE_RATE_ENUM_SIZE

/* SND_JACK_* mask for supported cable/switch types */
#define ARIZONA_JACK_MASK

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];
extern const unsigned int arizona_sample_rate_val[ARIZONA_SAMPLE_RATE_ENUM_SIZE];

extern const struct soc_enum arizona_isrc_fsl[];
extern const struct soc_enum arizona_isrc_fsh[];
extern const struct soc_enum arizona_asrc_rate1;

extern const struct soc_enum arizona_in_vi_ramp;
extern const struct soc_enum arizona_in_vd_ramp;

extern const struct soc_enum arizona_out_vi_ramp;
extern const struct soc_enum arizona_out_vd_ramp;

extern const struct soc_enum arizona_lhpf1_mode;
extern const struct soc_enum arizona_lhpf2_mode;
extern const struct soc_enum arizona_lhpf3_mode;
extern const struct soc_enum arizona_lhpf4_mode;

extern const struct soc_enum arizona_ng_hold;
extern const struct soc_enum arizona_in_hpf_cut_enum;
extern const struct soc_enum arizona_in_dmic_osr[];

extern const struct snd_kcontrol_new arizona_adsp2_rate_controls[];

extern const struct soc_enum arizona_anc_input_src[];
extern const struct soc_enum arizona_anc_ng_enum;
extern const struct soc_enum arizona_output_anc_src[];

extern const struct snd_kcontrol_new arizona_voice_trigger_switch[];

int arizona_in_ev(struct snd_soc_dapm_widget *w, struct snd_kcontrol *kcontrol,
		  int event);
int arizona_out_ev(struct snd_soc_dapm_widget *w, struct snd_kcontrol *kcontrol,
		   int event);
int arizona_hp_ev(struct snd_soc_dapm_widget *w, struct snd_kcontrol *kcontrol,
		  int event);
int arizona_anc_ev(struct snd_soc_dapm_widget *w, struct snd_kcontrol *kcontrol,
		   int event);

int arizona_eq_coeff_put(struct snd_kcontrol *kcontrol,
			 struct snd_ctl_elem_value *ucontrol);
int arizona_lhpf_coeff_put(struct snd_kcontrol *kcontrol,
			   struct snd_ctl_elem_value *ucontrol);

int arizona_clk_ev(struct snd_soc_dapm_widget *w, struct snd_kcontrol *kcontrol,
		   int event);
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;
extern const struct snd_soc_dai_ops arizona_simple_dai_ops;

#define ARIZONA_FLL_NAME_LEN

struct arizona_fll {};

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);

int arizona_init_fll(struct arizona *arizona, int id, int base,
		     int lock_irq, int ok_irq, struct arizona_fll *fll);
int arizona_set_fll_refclk(struct arizona_fll *fll, int source,
			   unsigned int Fref, unsigned int Fout);
int arizona_set_fll(struct arizona_fll *fll, int source,
		    unsigned int Fref, unsigned int Fout);

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 id);

int arizona_set_output_mode(struct snd_soc_component *component, int output,
			    bool diff);

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_component *component,
					    struct notifier_block *nb,
					    int (*notify)
					    (struct notifier_block *nb,
					    unsigned long action, void *data))
{}

static inline int arizona_unregister_notifier(struct snd_soc_component *component,
					      struct notifier_block *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