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