xref: /openbmc/linux/include/sound/da7218.h (revision 4d50934a)
14d50934aSAdam Thomson /*
24d50934aSAdam Thomson  * da7218.h - DA7218 ASoC Codec Driver Platform Data
34d50934aSAdam Thomson  *
44d50934aSAdam Thomson  * Copyright (c) 2015 Dialog Semiconductor
54d50934aSAdam Thomson  *
64d50934aSAdam Thomson  * Author: Adam Thomson <Adam.Thomson.Opensource@diasemi.com>
74d50934aSAdam Thomson  *
84d50934aSAdam Thomson  * This program is free software; you can redistribute  it and/or modify it
94d50934aSAdam Thomson  * under  the terms of  the GNU General  Public License as published by the
104d50934aSAdam Thomson  * Free Software Foundation;  either version 2 of the  License, or (at your
114d50934aSAdam Thomson  * option) any later version.
124d50934aSAdam Thomson  */
134d50934aSAdam Thomson 
144d50934aSAdam Thomson #ifndef _DA7218_PDATA_H
154d50934aSAdam Thomson #define _DA7218_PDATA_H
164d50934aSAdam Thomson 
174d50934aSAdam Thomson /* Mic Bias */
184d50934aSAdam Thomson enum da7218_micbias_voltage {
194d50934aSAdam Thomson 	DA7218_MICBIAS_1_2V = -1,
204d50934aSAdam Thomson 	DA7218_MICBIAS_1_6V,
214d50934aSAdam Thomson 	DA7218_MICBIAS_1_8V,
224d50934aSAdam Thomson 	DA7218_MICBIAS_2_0V,
234d50934aSAdam Thomson 	DA7218_MICBIAS_2_2V,
244d50934aSAdam Thomson 	DA7218_MICBIAS_2_4V,
254d50934aSAdam Thomson 	DA7218_MICBIAS_2_6V,
264d50934aSAdam Thomson 	DA7218_MICBIAS_2_8V,
274d50934aSAdam Thomson 	DA7218_MICBIAS_3_0V,
284d50934aSAdam Thomson };
294d50934aSAdam Thomson 
304d50934aSAdam Thomson enum da7218_mic_amp_in_sel {
314d50934aSAdam Thomson 	DA7218_MIC_AMP_IN_SEL_DIFF = 0,
324d50934aSAdam Thomson 	DA7218_MIC_AMP_IN_SEL_SE_P,
334d50934aSAdam Thomson 	DA7218_MIC_AMP_IN_SEL_SE_N,
344d50934aSAdam Thomson };
354d50934aSAdam Thomson 
364d50934aSAdam Thomson /* DMIC */
374d50934aSAdam Thomson enum da7218_dmic_data_sel {
384d50934aSAdam Thomson 	DA7218_DMIC_DATA_LRISE_RFALL = 0,
394d50934aSAdam Thomson 	DA7218_DMIC_DATA_LFALL_RRISE,
404d50934aSAdam Thomson };
414d50934aSAdam Thomson 
424d50934aSAdam Thomson enum da7218_dmic_samplephase {
434d50934aSAdam Thomson 	DA7218_DMIC_SAMPLE_ON_CLKEDGE = 0,
444d50934aSAdam Thomson 	DA7218_DMIC_SAMPLE_BETWEEN_CLKEDGE,
454d50934aSAdam Thomson };
464d50934aSAdam Thomson 
474d50934aSAdam Thomson enum da7218_dmic_clk_rate {
484d50934aSAdam Thomson 	DA7218_DMIC_CLK_3_0MHZ = 0,
494d50934aSAdam Thomson 	DA7218_DMIC_CLK_1_5MHZ,
504d50934aSAdam Thomson };
514d50934aSAdam Thomson 
524d50934aSAdam Thomson /* Headphone Detect */
534d50934aSAdam Thomson enum da7218_hpldet_jack_rate {
544d50934aSAdam Thomson 	DA7218_HPLDET_JACK_RATE_5US = 0,
554d50934aSAdam Thomson 	DA7218_HPLDET_JACK_RATE_10US,
564d50934aSAdam Thomson 	DA7218_HPLDET_JACK_RATE_20US,
574d50934aSAdam Thomson 	DA7218_HPLDET_JACK_RATE_40US,
584d50934aSAdam Thomson 	DA7218_HPLDET_JACK_RATE_80US,
594d50934aSAdam Thomson 	DA7218_HPLDET_JACK_RATE_160US,
604d50934aSAdam Thomson 	DA7218_HPLDET_JACK_RATE_320US,
614d50934aSAdam Thomson 	DA7218_HPLDET_JACK_RATE_640US,
624d50934aSAdam Thomson };
634d50934aSAdam Thomson 
644d50934aSAdam Thomson enum da7218_hpldet_jack_debounce {
654d50934aSAdam Thomson 	DA7218_HPLDET_JACK_DEBOUNCE_OFF = 0,
664d50934aSAdam Thomson 	DA7218_HPLDET_JACK_DEBOUNCE_2,
674d50934aSAdam Thomson 	DA7218_HPLDET_JACK_DEBOUNCE_3,
684d50934aSAdam Thomson 	DA7218_HPLDET_JACK_DEBOUNCE_4,
694d50934aSAdam Thomson };
704d50934aSAdam Thomson 
714d50934aSAdam Thomson enum da7218_hpldet_jack_thr {
724d50934aSAdam Thomson 	DA7218_HPLDET_JACK_THR_84PCT = 0,
734d50934aSAdam Thomson 	DA7218_HPLDET_JACK_THR_88PCT,
744d50934aSAdam Thomson 	DA7218_HPLDET_JACK_THR_92PCT,
754d50934aSAdam Thomson 	DA7218_HPLDET_JACK_THR_96PCT,
764d50934aSAdam Thomson };
774d50934aSAdam Thomson 
784d50934aSAdam Thomson struct da7218_hpldet_pdata {
794d50934aSAdam Thomson 	enum da7218_hpldet_jack_rate jack_rate;
804d50934aSAdam Thomson 	enum da7218_hpldet_jack_debounce jack_debounce;
814d50934aSAdam Thomson 	enum da7218_hpldet_jack_thr jack_thr;
824d50934aSAdam Thomson 	bool comp_inv;
834d50934aSAdam Thomson 	bool hyst;
844d50934aSAdam Thomson 	bool discharge;
854d50934aSAdam Thomson };
864d50934aSAdam Thomson 
874d50934aSAdam Thomson struct da7218_pdata {
884d50934aSAdam Thomson 	/* Mic */
894d50934aSAdam Thomson 	enum da7218_micbias_voltage micbias1_lvl;
904d50934aSAdam Thomson 	enum da7218_micbias_voltage micbias2_lvl;
914d50934aSAdam Thomson 	enum da7218_mic_amp_in_sel mic1_amp_in_sel;
924d50934aSAdam Thomson 	enum da7218_mic_amp_in_sel mic2_amp_in_sel;
934d50934aSAdam Thomson 
944d50934aSAdam Thomson 	/* DMIC */
954d50934aSAdam Thomson 	enum da7218_dmic_data_sel dmic1_data_sel;
964d50934aSAdam Thomson 	enum da7218_dmic_data_sel dmic2_data_sel;
974d50934aSAdam Thomson 	enum da7218_dmic_samplephase dmic1_samplephase;
984d50934aSAdam Thomson 	enum da7218_dmic_samplephase dmic2_samplephase;
994d50934aSAdam Thomson 	enum da7218_dmic_clk_rate dmic1_clk_rate;
1004d50934aSAdam Thomson 	enum da7218_dmic_clk_rate dmic2_clk_rate;
1014d50934aSAdam Thomson 
1024d50934aSAdam Thomson 	/* HP Diff Supply - DA7217 only */
1034d50934aSAdam Thomson 	bool hp_diff_single_supply;
1044d50934aSAdam Thomson 
1054d50934aSAdam Thomson 	/* HP Detect - DA7218 only */
1064d50934aSAdam Thomson 	struct da7218_hpldet_pdata *hpldet_pdata;
1074d50934aSAdam Thomson };
1084d50934aSAdam Thomson 
1094d50934aSAdam Thomson #endif /* _DA7218_PDATA_H */
110