2012-06-18 20:08:44 +00:00
|
|
|
/*
|
|
|
|
* 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
|
|
|
|
#define _ASOC_ARIZONA_H
|
|
|
|
|
|
|
|
#include <linux/completion.h>
|
|
|
|
|
|
|
|
#include <sound/soc.h>
|
|
|
|
|
2012-10-11 02:31:35 +00:00
|
|
|
#include "wm_adsp.h"
|
|
|
|
|
2012-08-08 16:52:44 +00:00
|
|
|
#define ARIZONA_CLK_SYSCLK 1
|
|
|
|
#define ARIZONA_CLK_ASYNCCLK 2
|
|
|
|
#define ARIZONA_CLK_OPCLK 3
|
|
|
|
#define ARIZONA_CLK_ASYNC_OPCLK 4
|
2012-06-18 20:08:44 +00:00
|
|
|
|
|
|
|
#define ARIZONA_CLK_SRC_MCLK1 0x0
|
|
|
|
#define ARIZONA_CLK_SRC_MCLK2 0x1
|
|
|
|
#define ARIZONA_CLK_SRC_FLL1 0x4
|
|
|
|
#define ARIZONA_CLK_SRC_FLL2 0x5
|
|
|
|
#define ARIZONA_CLK_SRC_AIF1BCLK 0x8
|
|
|
|
#define ARIZONA_CLK_SRC_AIF2BCLK 0x9
|
|
|
|
#define ARIZONA_CLK_SRC_AIF3BCLK 0xa
|
|
|
|
|
2013-02-20 17:28:41 +00:00
|
|
|
#define ARIZONA_FLL_SRC_NONE -1
|
2012-06-18 20:08:44 +00:00
|
|
|
#define ARIZONA_FLL_SRC_MCLK1 0
|
|
|
|
#define ARIZONA_FLL_SRC_MCLK2 1
|
2012-12-18 14:05:01 +00:00
|
|
|
#define ARIZONA_FLL_SRC_SLIMCLK 3
|
|
|
|
#define ARIZONA_FLL_SRC_FLL1 4
|
|
|
|
#define ARIZONA_FLL_SRC_FLL2 5
|
|
|
|
#define ARIZONA_FLL_SRC_AIF1BCLK 8
|
|
|
|
#define ARIZONA_FLL_SRC_AIF2BCLK 9
|
|
|
|
#define ARIZONA_FLL_SRC_AIF3BCLK 10
|
|
|
|
#define ARIZONA_FLL_SRC_AIF1LRCLK 12
|
|
|
|
#define ARIZONA_FLL_SRC_AIF2LRCLK 13
|
|
|
|
#define ARIZONA_FLL_SRC_AIF3LRCLK 14
|
2012-06-18 20:08:44 +00:00
|
|
|
|
|
|
|
#define ARIZONA_MIXER_VOL_MASK 0x00FE
|
|
|
|
#define ARIZONA_MIXER_VOL_SHIFT 1
|
|
|
|
#define ARIZONA_MIXER_VOL_WIDTH 7
|
|
|
|
|
2013-03-08 07:22:29 +00:00
|
|
|
#define ARIZONA_CLK_6MHZ 0
|
|
|
|
#define ARIZONA_CLK_12MHZ 1
|
|
|
|
#define ARIZONA_CLK_24MHZ 2
|
|
|
|
#define ARIZONA_CLK_49MHZ 3
|
|
|
|
#define ARIZONA_CLK_73MHZ 4
|
|
|
|
#define ARIZONA_CLK_98MHZ 5
|
|
|
|
#define ARIZONA_CLK_147MHZ 6
|
|
|
|
|
2013-05-17 12:29:03 +00:00
|
|
|
#define ARIZONA_MAX_DAI 6
|
2012-10-11 02:31:35 +00:00
|
|
|
#define ARIZONA_MAX_ADSP 4
|
2012-07-04 16:32:05 +00:00
|
|
|
|
2012-06-18 20:08:44 +00:00
|
|
|
struct arizona;
|
2012-10-11 02:31:35 +00:00
|
|
|
struct wm_adsp;
|
2012-06-18 20:08:44 +00:00
|
|
|
|
2012-07-04 16:32:05 +00:00
|
|
|
struct arizona_dai_priv {
|
|
|
|
int clk;
|
|
|
|
};
|
|
|
|
|
2012-06-18 20:08:44 +00:00
|
|
|
struct arizona_priv {
|
2012-10-11 02:31:35 +00:00
|
|
|
struct wm_adsp adsp[ARIZONA_MAX_ADSP];
|
2012-06-18 20:08:44 +00:00
|
|
|
struct arizona *arizona;
|
|
|
|
int sysclk;
|
|
|
|
int asyncclk;
|
2012-07-04 16:32:05 +00:00
|
|
|
struct arizona_dai_priv dai[ARIZONA_MAX_DAI];
|
2013-02-15 17:27:22 +00:00
|
|
|
|
|
|
|
int num_inputs;
|
|
|
|
unsigned int in_pending;
|
2013-01-10 14:45:58 +00:00
|
|
|
|
|
|
|
unsigned int spk_ena:2;
|
|
|
|
unsigned int spk_ena_pending:1;
|
2012-06-18 20:08:44 +00:00
|
|
|
};
|
|
|
|
|
2012-12-05 11:35:24 +00:00
|
|
|
#define ARIZONA_NUM_MIXER_INPUTS 99
|
2012-06-18 20:08:44 +00:00
|
|
|
|
|
|
|
extern const unsigned int arizona_mixer_tlv[];
|
|
|
|
extern const char *arizona_mixer_texts[ARIZONA_NUM_MIXER_INPUTS];
|
|
|
|
extern int arizona_mixer_values[ARIZONA_NUM_MIXER_INPUTS];
|
|
|
|
|
|
|
|
#define ARIZONA_MIXER_CONTROLS(name, base) \
|
|
|
|
SOC_SINGLE_RANGE_TLV(name " Input 1 Volume", base + 1, \
|
|
|
|
ARIZONA_MIXER_VOL_SHIFT, 0x20, 0x50, 0, \
|
|
|
|
arizona_mixer_tlv), \
|
|
|
|
SOC_SINGLE_RANGE_TLV(name " Input 2 Volume", base + 3, \
|
|
|
|
ARIZONA_MIXER_VOL_SHIFT, 0x20, 0x50, 0, \
|
|
|
|
arizona_mixer_tlv), \
|
|
|
|
SOC_SINGLE_RANGE_TLV(name " Input 3 Volume", base + 5, \
|
|
|
|
ARIZONA_MIXER_VOL_SHIFT, 0x20, 0x50, 0, \
|
|
|
|
arizona_mixer_tlv), \
|
|
|
|
SOC_SINGLE_RANGE_TLV(name " Input 4 Volume", base + 7, \
|
|
|
|
ARIZONA_MIXER_VOL_SHIFT, 0x20, 0x50, 0, \
|
|
|
|
arizona_mixer_tlv)
|
|
|
|
|
|
|
|
#define ARIZONA_MUX_ENUM_DECL(name, reg) \
|
|
|
|
SOC_VALUE_ENUM_SINGLE_DECL(name, reg, 0, 0xff, \
|
|
|
|
arizona_mixer_texts, arizona_mixer_values)
|
|
|
|
|
|
|
|
#define ARIZONA_MUX_CTL_DECL(name) \
|
|
|
|
const struct snd_kcontrol_new name##_mux = \
|
|
|
|
SOC_DAPM_VALUE_ENUM("Route", name##_enum)
|
|
|
|
|
2012-11-13 16:40:32 +00:00
|
|
|
#define ARIZONA_MUX_ENUMS(name, base_reg) \
|
|
|
|
static ARIZONA_MUX_ENUM_DECL(name##_enum, base_reg); \
|
|
|
|
static ARIZONA_MUX_CTL_DECL(name)
|
|
|
|
|
2012-06-18 20:08:44 +00:00
|
|
|
#define ARIZONA_MIXER_ENUMS(name, base_reg) \
|
2012-11-13 16:40:32 +00:00
|
|
|
ARIZONA_MUX_ENUMS(name##_in1, base_reg); \
|
|
|
|
ARIZONA_MUX_ENUMS(name##_in2, base_reg + 2); \
|
|
|
|
ARIZONA_MUX_ENUMS(name##_in3, base_reg + 4); \
|
|
|
|
ARIZONA_MUX_ENUMS(name##_in4, base_reg + 6)
|
2012-06-18 20:08:44 +00:00
|
|
|
|
2012-10-11 02:31:35 +00:00
|
|
|
#define ARIZONA_DSP_AUX_ENUMS(name, base_reg) \
|
2012-11-13 16:40:32 +00:00
|
|
|
ARIZONA_MUX_ENUMS(name##_aux1, base_reg); \
|
|
|
|
ARIZONA_MUX_ENUMS(name##_aux2, base_reg + 8); \
|
|
|
|
ARIZONA_MUX_ENUMS(name##_aux3, base_reg + 16); \
|
|
|
|
ARIZONA_MUX_ENUMS(name##_aux4, base_reg + 24); \
|
|
|
|
ARIZONA_MUX_ENUMS(name##_aux5, base_reg + 32); \
|
|
|
|
ARIZONA_MUX_ENUMS(name##_aux6, base_reg + 40)
|
2012-10-11 02:31:35 +00:00
|
|
|
|
2012-06-18 20:08:44 +00:00
|
|
|
#define ARIZONA_MUX(name, ctrl) \
|
|
|
|
SND_SOC_DAPM_VALUE_MUX(name, SND_SOC_NOPM, 0, 0, ctrl)
|
|
|
|
|
2012-11-13 16:40:32 +00:00
|
|
|
#define ARIZONA_MUX_WIDGETS(name, name_str) \
|
|
|
|
ARIZONA_MUX(name_str " Input", &name##_mux)
|
|
|
|
|
2012-06-18 20:08:44 +00:00
|
|
|
#define ARIZONA_MIXER_WIDGETS(name, name_str) \
|
|
|
|
ARIZONA_MUX(name_str " Input 1", &name##_in1_mux), \
|
|
|
|
ARIZONA_MUX(name_str " Input 2", &name##_in2_mux), \
|
|
|
|
ARIZONA_MUX(name_str " Input 3", &name##_in3_mux), \
|
|
|
|
ARIZONA_MUX(name_str " Input 4", &name##_in4_mux), \
|
|
|
|
SND_SOC_DAPM_MIXER(name_str " Mixer", SND_SOC_NOPM, 0, 0, NULL, 0)
|
|
|
|
|
2012-10-11 02:31:35 +00:00
|
|
|
#define ARIZONA_DSP_WIDGETS(name, name_str) \
|
|
|
|
ARIZONA_MIXER_WIDGETS(name##L, name_str "L"), \
|
|
|
|
ARIZONA_MIXER_WIDGETS(name##R, name_str "R"), \
|
|
|
|
ARIZONA_MUX(name_str " Aux 1", &name##_aux1_mux), \
|
|
|
|
ARIZONA_MUX(name_str " Aux 2", &name##_aux2_mux), \
|
|
|
|
ARIZONA_MUX(name_str " Aux 3", &name##_aux3_mux), \
|
|
|
|
ARIZONA_MUX(name_str " Aux 4", &name##_aux4_mux), \
|
|
|
|
ARIZONA_MUX(name_str " Aux 5", &name##_aux5_mux), \
|
|
|
|
ARIZONA_MUX(name_str " Aux 6", &name##_aux6_mux)
|
|
|
|
|
2012-11-13 16:40:32 +00:00
|
|
|
#define ARIZONA_MUX_ROUTES(name) \
|
|
|
|
ARIZONA_MIXER_INPUT_ROUTES(name " Input")
|
|
|
|
|
2012-06-18 20:08:44 +00:00
|
|
|
#define ARIZONA_MIXER_ROUTES(widget, name) \
|
|
|
|
{ widget, NULL, name " Mixer" }, \
|
|
|
|
{ name " Mixer", NULL, name " Input 1" }, \
|
|
|
|
{ name " Mixer", NULL, name " Input 2" }, \
|
|
|
|
{ name " Mixer", NULL, name " Input 3" }, \
|
|
|
|
{ name " Mixer", NULL, name " Input 4" }, \
|
|
|
|
ARIZONA_MIXER_INPUT_ROUTES(name " Input 1"), \
|
|
|
|
ARIZONA_MIXER_INPUT_ROUTES(name " Input 2"), \
|
|
|
|
ARIZONA_MIXER_INPUT_ROUTES(name " Input 3"), \
|
|
|
|
ARIZONA_MIXER_INPUT_ROUTES(name " Input 4")
|
|
|
|
|
2012-10-11 02:31:35 +00:00
|
|
|
#define ARIZONA_DSP_ROUTES(name) \
|
|
|
|
{ name, NULL, name " Aux 1" }, \
|
|
|
|
{ name, NULL, name " Aux 2" }, \
|
|
|
|
{ name, NULL, name " Aux 3" }, \
|
|
|
|
{ name, NULL, name " Aux 4" }, \
|
|
|
|
{ name, NULL, name " Aux 5" }, \
|
|
|
|
{ name, NULL, name " Aux 6" }, \
|
|
|
|
ARIZONA_MIXER_INPUT_ROUTES(name " Aux 1"), \
|
|
|
|
ARIZONA_MIXER_INPUT_ROUTES(name " Aux 2"), \
|
|
|
|
ARIZONA_MIXER_INPUT_ROUTES(name " Aux 3"), \
|
|
|
|
ARIZONA_MIXER_INPUT_ROUTES(name " Aux 4"), \
|
|
|
|
ARIZONA_MIXER_INPUT_ROUTES(name " Aux 5"), \
|
|
|
|
ARIZONA_MIXER_INPUT_ROUTES(name " Aux 6"), \
|
|
|
|
ARIZONA_MIXER_ROUTES(name, name "L"), \
|
|
|
|
ARIZONA_MIXER_ROUTES(name, name "R")
|
|
|
|
|
2013-02-18 19:09:23 +00:00
|
|
|
#define ARIZONA_RATE_ENUM_SIZE 4
|
|
|
|
extern const char *arizona_rate_text[ARIZONA_RATE_ENUM_SIZE];
|
|
|
|
extern const int arizona_rate_val[ARIZONA_RATE_ENUM_SIZE];
|
|
|
|
|
|
|
|
extern const struct soc_enum arizona_isrc_fsl[];
|
|
|
|
|
2012-12-09 03:25:52 +00:00
|
|
|
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;
|
|
|
|
|
2012-06-18 20:08:44 +00:00
|
|
|
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;
|
|
|
|
|
2012-12-18 13:47:57 +00:00
|
|
|
extern const struct soc_enum arizona_ng_hold;
|
|
|
|
|
2012-06-18 20:08:44 +00:00
|
|
|
extern int arizona_in_ev(struct snd_soc_dapm_widget *w,
|
|
|
|
struct snd_kcontrol *kcontrol,
|
|
|
|
int event);
|
|
|
|
extern int arizona_out_ev(struct snd_soc_dapm_widget *w,
|
|
|
|
struct snd_kcontrol *kcontrol,
|
|
|
|
int event);
|
2013-02-22 18:36:53 +00:00
|
|
|
extern int arizona_hp_ev(struct snd_soc_dapm_widget *w,
|
|
|
|
struct snd_kcontrol *kcontrol,
|
|
|
|
int event);
|
2012-06-18 20:08:44 +00:00
|
|
|
|
|
|
|
extern int arizona_set_sysclk(struct snd_soc_codec *codec, int clk_id,
|
|
|
|
int source, unsigned int freq, int dir);
|
|
|
|
|
|
|
|
extern const struct snd_soc_dai_ops arizona_dai_ops;
|
2013-05-17 12:29:03 +00:00
|
|
|
extern const struct snd_soc_dai_ops arizona_simple_dai_ops;
|
2012-06-18 20:08:44 +00:00
|
|
|
|
|
|
|
#define ARIZONA_FLL_NAME_LEN 20
|
|
|
|
|
|
|
|
struct arizona_fll {
|
|
|
|
struct arizona *arizona;
|
|
|
|
int id;
|
|
|
|
unsigned int base;
|
2012-07-10 16:03:46 +00:00
|
|
|
unsigned int vco_mult;
|
2012-06-18 20:08:44 +00:00
|
|
|
struct completion ok;
|
|
|
|
|
2013-02-20 17:28:39 +00:00
|
|
|
unsigned int fout;
|
2013-02-20 17:28:35 +00:00
|
|
|
int sync_src;
|
|
|
|
unsigned int sync_freq;
|
2013-02-20 17:28:34 +00:00
|
|
|
int ref_src;
|
|
|
|
unsigned int ref_freq;
|
|
|
|
|
2012-06-18 20:08:44 +00:00
|
|
|
char lock_name[ARIZONA_FLL_NAME_LEN];
|
|
|
|
char clock_ok_name[ARIZONA_FLL_NAME_LEN];
|
|
|
|
};
|
|
|
|
|
|
|
|
extern int arizona_init_fll(struct arizona *arizona, int id, int base,
|
|
|
|
int lock_irq, int ok_irq, struct arizona_fll *fll);
|
2013-02-20 17:28:40 +00:00
|
|
|
extern int arizona_set_fll_refclk(struct arizona_fll *fll, int source,
|
|
|
|
unsigned int Fref, unsigned int Fout);
|
2012-06-18 20:08:44 +00:00
|
|
|
extern int arizona_set_fll(struct arizona_fll *fll, int source,
|
|
|
|
unsigned int Fref, unsigned int Fout);
|
|
|
|
|
2013-01-10 14:45:58 +00:00
|
|
|
extern int arizona_init_spk(struct snd_soc_codec *codec);
|
|
|
|
|
2012-07-04 16:32:05 +00:00
|
|
|
extern int arizona_init_dai(struct arizona_priv *priv, int dai);
|
|
|
|
|
2013-01-04 19:31:00 +00:00
|
|
|
int arizona_set_output_mode(struct snd_soc_codec *codec, int output,
|
|
|
|
bool diff);
|
|
|
|
|
2012-06-18 20:08:44 +00:00
|
|
|
#endif
|