Skip to content

Commit 074ea66

Browse files
mwaskodeb-intel
authored andcommitted
arch: fw: sof-zephyr dmic io driver
dmic io driver architecture chapter Signed-off-by: Michal Wasko <[email protected]>
1 parent 0c8fa85 commit 074ea66

File tree

6 files changed

+140
-0
lines changed

6 files changed

+140
-0
lines changed
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
.. _dmic_driver:
2+
3+
DMIC IO Driver
4+
##############
5+
6+
.. uml:: images/dmic_diagram.pu
7+
:caption: DMIC IO Driver overview
8+
9+
Gateway Initialization
10+
**********************
11+
12+
.. uml:: images/dmic_gateway_init.pu
13+
:caption: DMIC Input Gateway Initialization
14+
15+
DMIC HW is initialized as follows:
16+
17+
1. Mute microphones.
18+
2. Enable clock on microphones (also enable CIC and FIRs).
19+
3. Wait for clock stabilization (SoC defined delay).
20+
4. Unmute microphones using a curved ramp until the DC offset is gone and
21+
replaced with the live stream.
22+
23+
Configuration BLOB
24+
******************
25+
26+
DMIC IO Driver is prepared for the configuration BLOB to come in context of any
27+
instance of the DmicInput at any time. The configuration may be rejected if the
28+
current state of PDM controllers and FIFOs is inappropriate. Accepting the
29+
configuration does not always mean that it is immediately programmed to the HW.
30+
The configuration is global, so when sent by an instance of DmicInput while
31+
another instance is already running it is just compared with already programmed
32+
data for the sake of consistency.
33+
34+
Gateway Release
35+
***************
36+
37+
.. uml:: images/dmic_gateway_release.pu
38+
:caption: DMIC Input Gateway Release
39+
40+
State Transitions
41+
*****************
42+
43+
.. uml:: images/dmic_gateway_state_transitions.pu
44+
:caption: DMIC Input Gateway State Transition
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
@startuml
2+
3+
hide methods
4+
hide attributes
5+
6+
component Zephyr {
7+
class DmicDriver
8+
interface dai_dmic_ops
9+
interface dai_driver_api
10+
}
11+
12+
component MPP {
13+
interface Gateway
14+
15+
interface IoDriver
16+
class DmicManager
17+
class DmicInput
18+
}
19+
20+
DmicDriver -up- dai_dmic_ops
21+
22+
dai_dmic_ops -left-|> dai_driver_api : implements
23+
24+
DmicManager -up- IoDriver
25+
DmicManager -left-> DmicInput : manages
26+
DmicInput -up- Gateway
27+
DmicInput -down-> dai_dmic_ops : calls
28+
DmicDriver --* DmicInput
29+
30+
@enduml
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
@startuml
2+
3+
participant "DMIC Manager" as dmic_manager
4+
participant "Zephyr PM Subsystem" as zephyr_pm
5+
participant "DMIC Driver" as dmic_driver
6+
7+
-> dmic_manager : gateway_allocate()
8+
activate dmic_manager
9+
dmic_manager -> zephyr_pm : pm_runtime_device_get (dmic)
10+
11+
activate zephyr_pm
12+
zephyr_pm -> zephyr_pm : increase usage count
13+
opt if usage == 1
14+
zephyr_pm -> dmic_driver : pm_device_resume
15+
activate dmic_driver
16+
return
17+
end
18+
return
19+
20+
deactivate dmic_manager
21+
<-- dmic_manager
22+
23+
@enduml
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
@startuml
2+
3+
participant "DMIC Manager" as dmic_manager
4+
participant "Zephyr PM Subsystem" as zephyr_pm
5+
participant "DMIC Driver" as dmic_driver
6+
7+
-> dmic_manager : gateway_release()
8+
activate dmic_manager
9+
dmic_manager -> zephyr_pm : pm_runtime_device_put (dmic)
10+
11+
activate zephyr_pm
12+
zephyr_pm -> zephyr_pm : decrease usage count
13+
opt if usage == 0
14+
zephyr_pm -> dmic_driver : pm_device_suspend
15+
activate dmic_driver
16+
return
17+
end
18+
return
19+
20+
deactivate dmic_manager
21+
<-- dmic_manager
22+
23+
@enduml
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
2+
participant "Dmic Input\nGateway" as dmic_input
3+
participant "DMA" as dma
4+
5+
== Dmic Input : STOPPED ==
6+
7+
-> dmic_input : STOPPED
8+
dmic_input -> dma : stop()
9+
10+
== Dmic Input : PAUSED ==
11+
12+
-> dmic_input : PAUSED
13+
dmic_input -> dma : init_transfer()
14+
dmic_input -> dma : pause()
15+
16+
== Dmic Input : RUNNING ==
17+
18+
-> dmic_input : RUNNING
19+
dmic_input -> dma : start()

architectures/firmware/sof-zephyr/rtos_layer/io_drivers/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,3 +28,4 @@ Drivers
2828

2929
hda/hda_driver
3030
i2s/i2s_driver
31+
dmic/dmic_driver

0 commit comments

Comments
 (0)