xref: /openbmc/linux/include/sound/madera-pdata.h (revision 55fd7e02)
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 /*
3  * Platform data for Madera codec driver
4  *
5  * Copyright (C) 2016-2019 Cirrus Logic, Inc. and
6  *                         Cirrus Logic International Semiconductor Ltd.
7  */
8 
9 #ifndef MADERA_CODEC_PDATA_H
10 #define MADERA_CODEC_PDATA_H
11 
12 #include <linux/kernel.h>
13 
14 #define MADERA_MAX_INPUT		6
15 #define MADERA_MAX_MUXED_CHANNELS	4
16 #define MADERA_MAX_OUTPUT		6
17 #define MADERA_MAX_AIF			4
18 #define MADERA_MAX_PDM_SPK		2
19 #define MADERA_MAX_DSP			7
20 
21 /**
22  * struct madera_codec_pdata
23  *
24  * @max_channels_clocked: Maximum number of channels that I2S clocks will be
25  *			  generated for. Useful when clock master for systems
26  *			  where the I2S bus has multiple data lines.
27  * @dmic_ref:		  Indicates how the MICBIAS pins have been externally
28  *			  connected to DMICs on each input. A value of 0
29  *			  indicates MICVDD and is the default. Other values are:
30  *			  For CS47L35 one of the CS47L35_DMIC_REF_xxx values
31  *			  For all other codecs one of the MADERA_DMIC_REF_xxx
32  *			  Also see the datasheet for a description of the
33  *			  INn_DMIC_SUP field.
34  * @inmode:		  Mode for the ADC inputs. One of the MADERA_INMODE_xxx
35  *			  values. Two-dimensional array
36  *			  [input_number][channel number], with four slots per
37  *			  input in the order
38  *			  [n][0]=INnAL [n][1]=INnAR [n][2]=INnBL [n][3]=INnBR
39  * @out_mono:		  For each output set the value to TRUE to indicate that
40  *			  the output is mono. [0]=OUT1, [1]=OUT2, ...
41  * @pdm_fmt:		  PDM speaker data format. See the PDM_SPKn_FMT field in
42  *			  the datasheet for a description of this value.
43  * @pdm_mute:		  PDM mute format. See the PDM_SPKn_CTRL_1 register
44  *			  in the datasheet for a description of this value.
45  */
46 struct madera_codec_pdata {
47 	u32 max_channels_clocked[MADERA_MAX_AIF];
48 
49 	u32 dmic_ref[MADERA_MAX_INPUT];
50 
51 	u32 inmode[MADERA_MAX_INPUT][MADERA_MAX_MUXED_CHANNELS];
52 
53 	bool out_mono[MADERA_MAX_OUTPUT];
54 
55 	u32 pdm_fmt[MADERA_MAX_PDM_SPK];
56 	u32 pdm_mute[MADERA_MAX_PDM_SPK];
57 };
58 
59 #endif
60