xref: /openbmc/linux/include/sound/da7218.h (revision c67e8ec0)
1 /*
2  * da7218.h - DA7218 ASoC Codec Driver Platform Data
3  *
4  * Copyright (c) 2015 Dialog Semiconductor
5  *
6  * Author: Adam Thomson <Adam.Thomson.Opensource@diasemi.com>
7  *
8  * This program is free software; you can redistribute  it and/or modify it
9  * under  the terms of  the GNU General  Public License as published by the
10  * Free Software Foundation;  either version 2 of the  License, or (at your
11  * option) any later version.
12  */
13 
14 #ifndef _DA7218_PDATA_H
15 #define _DA7218_PDATA_H
16 
17 /* Mic Bias */
18 enum da7218_micbias_voltage {
19 	DA7218_MICBIAS_1_2V = -1,
20 	DA7218_MICBIAS_1_6V,
21 	DA7218_MICBIAS_1_8V,
22 	DA7218_MICBIAS_2_0V,
23 	DA7218_MICBIAS_2_2V,
24 	DA7218_MICBIAS_2_4V,
25 	DA7218_MICBIAS_2_6V,
26 	DA7218_MICBIAS_2_8V,
27 	DA7218_MICBIAS_3_0V,
28 };
29 
30 enum da7218_mic_amp_in_sel {
31 	DA7218_MIC_AMP_IN_SEL_DIFF = 0,
32 	DA7218_MIC_AMP_IN_SEL_SE_P,
33 	DA7218_MIC_AMP_IN_SEL_SE_N,
34 };
35 
36 /* DMIC */
37 enum da7218_dmic_data_sel {
38 	DA7218_DMIC_DATA_LRISE_RFALL = 0,
39 	DA7218_DMIC_DATA_LFALL_RRISE,
40 };
41 
42 enum da7218_dmic_samplephase {
43 	DA7218_DMIC_SAMPLE_ON_CLKEDGE = 0,
44 	DA7218_DMIC_SAMPLE_BETWEEN_CLKEDGE,
45 };
46 
47 enum da7218_dmic_clk_rate {
48 	DA7218_DMIC_CLK_3_0MHZ = 0,
49 	DA7218_DMIC_CLK_1_5MHZ,
50 };
51 
52 /* Headphone Detect */
53 enum da7218_hpldet_jack_rate {
54 	DA7218_HPLDET_JACK_RATE_5US = 0,
55 	DA7218_HPLDET_JACK_RATE_10US,
56 	DA7218_HPLDET_JACK_RATE_20US,
57 	DA7218_HPLDET_JACK_RATE_40US,
58 	DA7218_HPLDET_JACK_RATE_80US,
59 	DA7218_HPLDET_JACK_RATE_160US,
60 	DA7218_HPLDET_JACK_RATE_320US,
61 	DA7218_HPLDET_JACK_RATE_640US,
62 };
63 
64 enum da7218_hpldet_jack_debounce {
65 	DA7218_HPLDET_JACK_DEBOUNCE_OFF = 0,
66 	DA7218_HPLDET_JACK_DEBOUNCE_2,
67 	DA7218_HPLDET_JACK_DEBOUNCE_3,
68 	DA7218_HPLDET_JACK_DEBOUNCE_4,
69 };
70 
71 enum da7218_hpldet_jack_thr {
72 	DA7218_HPLDET_JACK_THR_84PCT = 0,
73 	DA7218_HPLDET_JACK_THR_88PCT,
74 	DA7218_HPLDET_JACK_THR_92PCT,
75 	DA7218_HPLDET_JACK_THR_96PCT,
76 };
77 
78 struct da7218_hpldet_pdata {
79 	enum da7218_hpldet_jack_rate jack_rate;
80 	enum da7218_hpldet_jack_debounce jack_debounce;
81 	enum da7218_hpldet_jack_thr jack_thr;
82 	bool comp_inv;
83 	bool hyst;
84 	bool discharge;
85 };
86 
87 struct da7218_pdata {
88 	/* Mic */
89 	enum da7218_micbias_voltage micbias1_lvl;
90 	enum da7218_micbias_voltage micbias2_lvl;
91 	enum da7218_mic_amp_in_sel mic1_amp_in_sel;
92 	enum da7218_mic_amp_in_sel mic2_amp_in_sel;
93 
94 	/* DMIC */
95 	enum da7218_dmic_data_sel dmic1_data_sel;
96 	enum da7218_dmic_data_sel dmic2_data_sel;
97 	enum da7218_dmic_samplephase dmic1_samplephase;
98 	enum da7218_dmic_samplephase dmic2_samplephase;
99 	enum da7218_dmic_clk_rate dmic1_clk_rate;
100 	enum da7218_dmic_clk_rate dmic2_clk_rate;
101 
102 	/* HP Diff Supply - DA7217 only */
103 	bool hp_diff_single_supply;
104 
105 	/* HP Detect - DA7218 only */
106 	struct da7218_hpldet_pdata *hpldet_pdata;
107 };
108 
109 #endif /* _DA7218_PDATA_H */
110