1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2 /*
3  * Driver for ADAU1361/ADAU1461/ADAU1761/ADAU1961/ADAU1381/ADAU1781 codecs
4  *
5  * Copyright 2011-2014 Analog Devices Inc.
6  * Author: Lars-Peter Clausen <lars@metafoo.de>
7  */
8 
9 #ifndef __LINUX_PLATFORM_DATA_ADAU17X1_H__
10 #define __LINUX_PLATFORM_DATA_ADAU17X1_H__
11 
12 /**
13  * enum adau17x1_micbias_voltage - Microphone bias voltage
14  * @ADAU17X1_MICBIAS_0_90_AVDD: 0.9 * AVDD
15  * @ADAU17X1_MICBIAS_0_65_AVDD: 0.65 * AVDD
16  */
17 enum adau17x1_micbias_voltage {
18 	ADAU17X1_MICBIAS_0_90_AVDD = 0,
19 	ADAU17X1_MICBIAS_0_65_AVDD = 1,
20 };
21 
22 /**
23  * enum adau1761_digmic_jackdet_pin_mode - Configuration of the JACKDET/MICIN pin
24  * @ADAU1761_DIGMIC_JACKDET_PIN_MODE_NONE: Disable the pin
25  * @ADAU1761_DIGMIC_JACKDET_PIN_MODE_DIGMIC: Configure the pin for usage as
26  *   digital microphone input.
27  * @ADAU1761_DIGMIC_JACKDET_PIN_MODE_JACKDETECT: Configure the pin for jack
28  *  insertion detection.
29  */
30 enum adau1761_digmic_jackdet_pin_mode {
31 	ADAU1761_DIGMIC_JACKDET_PIN_MODE_NONE,
32 	ADAU1761_DIGMIC_JACKDET_PIN_MODE_DIGMIC,
33 	ADAU1761_DIGMIC_JACKDET_PIN_MODE_JACKDETECT,
34 };
35 
36 /**
37  * adau1761_jackdetect_debounce_time - Jack insertion detection debounce time
38  * @ADAU1761_JACKDETECT_DEBOUNCE_5MS: 5 milliseconds
39  * @ADAU1761_JACKDETECT_DEBOUNCE_10MS: 10 milliseconds
40  * @ADAU1761_JACKDETECT_DEBOUNCE_20MS: 20 milliseconds
41  * @ADAU1761_JACKDETECT_DEBOUNCE_40MS: 40 milliseconds
42  */
43 enum adau1761_jackdetect_debounce_time {
44 	ADAU1761_JACKDETECT_DEBOUNCE_5MS = 0,
45 	ADAU1761_JACKDETECT_DEBOUNCE_10MS = 1,
46 	ADAU1761_JACKDETECT_DEBOUNCE_20MS = 2,
47 	ADAU1761_JACKDETECT_DEBOUNCE_40MS = 3,
48 };
49 
50 /**
51  * enum adau1761_output_mode - Output mode configuration
52  * @ADAU1761_OUTPUT_MODE_HEADPHONE: Headphone output
53  * @ADAU1761_OUTPUT_MODE_HEADPHONE_CAPLESS: Capless headphone output
54  * @ADAU1761_OUTPUT_MODE_LINE: Line output
55  */
56 enum adau1761_output_mode {
57 	ADAU1761_OUTPUT_MODE_HEADPHONE,
58 	ADAU1761_OUTPUT_MODE_HEADPHONE_CAPLESS,
59 	ADAU1761_OUTPUT_MODE_LINE,
60 };
61 
62 /**
63  * struct adau1761_platform_data - ADAU1761 Codec driver platform data
64  * @input_differential: If true the input pins will be configured in
65  *  differential mode.
66  * @lineout_mode: Output mode for the LOUT/ROUT pins
67  * @headphone_mode: Output mode for the LHP/RHP pins
68  * @digmic_jackdetect_pin_mode: JACKDET/MICIN pin configuration
69  * @jackdetect_debounce_time: Jack insertion detection debounce time.
70  *  Note: This value will only be used, if the JACKDET/MICIN pin is configured
71  *  for jack insertion detection.
72  * @jackdetect_active_low: If true the jack insertion detection is active low.
73  *  Othwise it will be active high.
74  * @micbias_voltage: Microphone voltage bias
75  */
76 struct adau1761_platform_data {
77 	bool input_differential;
78 	enum adau1761_output_mode lineout_mode;
79 	enum adau1761_output_mode headphone_mode;
80 
81 	enum adau1761_digmic_jackdet_pin_mode digmic_jackdetect_pin_mode;
82 
83 	enum adau1761_jackdetect_debounce_time jackdetect_debounce_time;
84 	bool jackdetect_active_low;
85 
86 	enum adau17x1_micbias_voltage micbias_voltage;
87 };
88 
89 /**
90  * struct adau1781_platform_data - ADAU1781 Codec driver platform data
91  * @left_input_differential: If true configure the left input as
92  * differential input.
93  * @right_input_differential: If true configure the right input as differntial
94  *  input.
95  * @use_dmic: If true configure the MIC pins as digital microphone pins instead
96  *  of analog microphone pins.
97  * @micbias_voltage: Microphone voltage bias
98  */
99 struct adau1781_platform_data {
100 	bool left_input_differential;
101 	bool right_input_differential;
102 
103 	bool use_dmic;
104 
105 	enum adau17x1_micbias_voltage micbias_voltage;
106 };
107 
108 #endif
109