summaryrefstree
path: root/kernel/Documentation/sound/alsa/soc/wolfson-arizona.txt
blob: f8195db8642345bc67d7c83c603e2ca4f00c9bac (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
This document lists the features of the Cirrus Logic / Wolfson Microelectronics
'Arizona' class SmartCodecs that are supported by the kernel drivers.
Note that some features are covered by other classes of driver (extcon,
regulator, etc.), the list below shows the full set of features related
to sound:

'-' means not relevant for that audio hub model

                                                                WM8280
Feature                                    WM8997 WM8998 WM5102 WM8281 CS47L24 CS47L85 CS47L35
----------------------------------------------------------------------------------------------
32-bit samples                                Y      Y      Y      Y      Y      Y        Y
24-bit samples                                Y      Y      Y      Y      Y      Y        Y
192kHz sample rate                            Y      Y      Y      Y      Y      Y        Y
Routing controlled via ALSA controls          Y      Y      Y      Y      Y      Y        Y
Volume control on all mixer inputs            Y      Y      Y      Y      Y      Y        Y
Volume control on all outputs                 Y      Y      Y      Y      Y      Y        Y
Mute control on all outputs                   Y      Y      Y      Y      Y      Y        Y
Output DRE control                            -      Y      Y      Y      -      Y        Y
Output OSR control                            Y      -      Y      Y      Y      Y        N
Input ramp control                            Y      Y      Y      Y      Y      Y        Y
Output ramp control                           Y      Y      Y      Y      Y      Y        Y
Route any audio input to any mixer input      Y      Y      Y      Y      Y      Y        Y
Route internal signals to mixer inputs        Y      Y      Y      Y      Y      Y        Y
Route audio path through ISRC                 Y      Y      Y      Y      Y      Y        Y
Route audio path through ASRC                 -      Y      Y      Y      Y      Y        -
Route audio path through EQs                  Y      Y      Y      Y      Y      Y        Y
Route audio path through LHPFs                Y      Y      Y      Y      Y      Y        Y
Route audio path through DRCs                 Y      Y      Y      Y      Y      Y        Y
Route audio path through ADSP cores           -      -      Y      Y      Y      Y        Y
Set EQ coefficient through ALSA controls      Y      Y      Y      Y      Y      Y        Y
Set LHPF coeffs through ALSA controls         Y      Y      Y      Y      Y      Y        Y
Set DRC coefficient through ALSA controls     Y      Y      Y      Y      Y      Y        Y
Set Noise Gates through ALSA controls         Y      Y      Y      Y      Y      Y        Y
Config inputs analogue/digital mode [note 1]  Y      Y      Y      Y      -      Y        Y
Input HPF control                             -      Y      -      Y      Y      Y        Y
Input mux controls [note 8]                   -      Y      -      -      -      Y        Y
Config analogue inputs as single-ended
          or differential [note 1]            Y      Y      Y      Y      -      Y        Y
Host I2S routing to any AIF                   Y      Y      Y      Y      Y      Y        Y
I2S TDM (multi-channel) [note 2]              Y      Y      Y      Y      Y      Y        Y
Configure TDM active slots [note 2]           Y      Y      Y      Y      Y      Y        Y
Configure TDM slot size [note 2]              Y      Y      Y      Y      Y      Y        Y
AEC loopback control                          Y      Y      Y      Y      Y      Y        Y
ANC block control                             -      -      -      Y      -      Y        -
Select firmware by ALSA control [note 6]      -      -      Y      Y      Y      Y        Y
Load ADSP firmware via DAPM power-up          -      -      Y      Y      Y      Y        Y
Load tuning data (.bin) with firmware         -      -      Y      Y      Y      Y        Y
Expose firmware controls via ALSA             -      -      Y      Y      Y      Y        Y
Set sample-rate domain frequencies [note 4]   Y      Y      Y      Y      Y      Y        Y
Auto sample-rate detection                    N      N      N      N      N      N        N
Codec control over SPI                        -      -      Y      Y      Y      Y        Y
Codec control over I2C                        Y      Y      Y      Y      -      Y        Y
DAPM-based power up/down                      Y      Y      Y      Y      Y      Y        Y
Jack insert detection                         Y      Y      Y      Y      -      Y        Y
Headset mic detection                         Y      Y      Y      Y      -      Y        Y
Headset button detection                      Y      Y      Y      Y      -      Y        Y
Headphone speaker impedance detection         Y      Y      Y      Y      -      Y        Y
Codec internal LDOVDD regulator control       Y      Y      Y      Y      -      Y        -
Support for external DCVDD regulator          Y      Y      Y      Y      Y      Y        Y
Build as loadable module                      Y      Y      Y      Y      Y      Y        Y
Configure via pdata                           Y      Y      Y      Y      Y      Y        Y
Configure via device tree [note 7]            Y      Y      Y      Y      Y      Y        Y
Configure via ACPI                            N      N      N      N      N      N        N
Configure SYSCLK rate [note 5]                Y      Y      Y      Y      Y      Y        Y
Configure ASYNCCLK rate [note 5]              Y      Y      Y      Y      Y      Y        -
Configure analogue mic bias [note 1]          Y      Y      Y      Y      -      Y        Y
Configure mapping of headset button
    resistance to key event [note 1]          Y      Y      Y      Y      -      Y        Y
Configure available firmwares [note 3]        -      -      Y      Y      Y      Y        Y
Support SoundClear Control                    -      -      N      Y      Y      Y        Y

Notes:
1. Integration-time configuration. Not possible to change at runtime
2. TDM is only possible if host I2S controller and I2S driver support TDM
    The set_tdm_slot() function is implemented to enable configuration of the
    slot size and which slots the codec will use. Codec channels are mapped in
    ascending order to the active slots - for example if the active TX slots in
    the I2S frame are 0, 1, and 7 then they will be mapped
    0->AIFTX1 1->AIFTX2 7->AIFTX3
3. Default firmware list can be overidden by device tree
4. Limited control of domain 2/3 frequency
5. Configured in ASoC machine driver
6. Firmware can be set by host but cannot be changed while ADSP is powered-up,
        it must be removed from an active path to power-down and the new
        firmware will be loaded when it is next powered-up as part of an
        active path
7. Configuration from device tree is work-in-progress so there may be some
        pdata settings that have not yet been migrated to device tree
8. See below for a description of the input mux routing.


INPUT MUXES
===========
Some SmartCodecs have input paths with input muxes to select between two
possible external input sources for that path.

For example on the WM8998:
  - The IN1 path can be selected between IN1A or IN1B pins. The left and right
    channels have separate mux controls
  - The IN2 path can be selected between IN2A or IN2B and is mono

A diagram of the route through the input muxes on the WM8998 is shown below
(the other SmartCodecs with input muxes are similar):

Input pin      ALSA control      Internal signal path
-------------------------------------------------------

               +------------+
IN1AL ---> "A" |            |
               | "IN1L Mux" | --> IN1L
IN1BL ---> "B" |            |
               +------------+

               +------------+
IN1AR ---> "A" |            |
               | "IN1R Mux" | --> IN1R
IN1BR ---> "B" |            |
               +------------+

               +------------+
IN2A  ---> "A" |            |
               | "IN2 Mux"  | --> IN2L
IN2B  ---> "B" |            |
               +------------+


WM8998 input muxes
------------------
IN1A and IN2A can be set as digital. IN1B and IN2B are analogue only.

It is important to note that although the left and right paths of IN1 have
separate mux controls, these are only separate for analogue paths. The setting
of digital/analogue applies jointly to both channels of IN1. Because of this,
if IN1A is digital _both_ the left and right mux are ganged together and
changing the mux on one channel will automatically change the other.

The input mode pdata for WM8998 is defined as:

 pdata      affects  legal values            behaviour
 inmode[0]  IN1      ARIZONA_INMODE_DIFF (0) IN1A and IN1B analogue differential
                     ARIZONA_INMODE_SE   (1) IN1A and IN1B analogue single-ended
                     ARIZONA_INMODE_DMIC (2) IN1A digital, IN1B analogue differential
                     ARIZONA_INMODE_DMIC |
                       ARIZONA_INMODE_SE (3) IN1A digital, IN1B analogue single-ended

 inmode[1]  IN2      ARIZONA_INMODE_DIFF (0) IN2A and IN2B analogue differential
                     ARIZONA_INMODE_SE   (1) IN2A and IN2B analogue single-ended
                     ARIZONA_INMODE_DMIC (2) IN2A digital, IN2B analogue differential
                     ARIZONA_INMODE_DMIC |
                       ARIZONA_INMODE_SE (3) IN2A digital, IN2B analogue single-ended

How firmwares are loaded
========================
The driver exposes an ALSA control to set the firmware for each ADSP on the
codec. These are named:

    DSP1 Firmware
    DSP2 Firmware
    ... etc.

The control is an enumeration of the available firmwares by function. It does
not directly set the actual filename of the firmware to be loaded. The mapping
between control values and actual firmware filename can be found in the file
sound/soc/codecs/wm_adsp.c

Setting this control tells the driver what firmware to load WHEN THE ADSP IS
NEXT POWERED UP. Setting the control does not force the firmware to be loaded
immediately, nor does it reboot the ADSP if it is currently running a different
firmware.

To load a firmware, or to reboot the ADSP with different firmware you must:
    - Disconnect the ADSP from any active audio path so that it will be powered-down
    - Set the firmware control to the firmware you want to load
    - Connect the ADSP to an active audio path so it will be powered-up

Firmware files can have an associated file called a "bin file". This has the
same name as the firmware file, but with the extension .bin, and goes in the
same directory as the firmware file. The bin file contains settings to be
patched in the ADSP memory after the firmware has been loaded. When the driver
loads a firmware it will look for a bin file and if found will apply the patches
from that bin file.

The purpose of the bin file is to allow tuning data to be applied to the firmware
without the need to rebuild the firmware to include this data. For example,
some audio algorithms must be tuned to the acoustic properties of the enclosure
the microphones or speakers are in - it would be impractical to build a new
firmware for each device with its unique parameters; instead the device is tuned
and the tuning data is put into the bin file.

The bin file is not intended for setting parameters that are runtime-modifiable,
such as volume controls, since the bin file is a one-shot set of parameters
that are patched when the firmware is loaded. Runtime modifiable controls should
be exposed by the firmware as such and the driver will create ALSA controls for
them.