diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2018-06-05 19:20:22 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2018-06-05 19:20:22 -0400 |
commit | abf7dba7c4f77d781f6df50fefb19a64c5dc331f (patch) | |
tree | 38648731b502d5aec508f3b33f6616190e598eb6 /Documentation/driver-api | |
parent | 07c4dd3435aa387d3b58f4e941dc516513f14507 (diff) | |
parent | b23220fe054e92f616b82450fae8cd3ab176cc60 (diff) |
Merge tag 'char-misc-4.18-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc
Pull char/misc driver updates from Greg KH:
"Here is the "big" char and misc driver patches for 4.18-rc1.
It's not a lot of stuff here, but there are some highlights:
- coreboot driver updates
- soundwire driver updates
- android binder updates
- fpga big sync, mostly documentation
- lots of minor driver updates
All of these have been in linux-next for a while with no reported
issues"
* tag 'char-misc-4.18-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc: (81 commits)
vmw_balloon: fixing double free when batching mode is off
MAINTAINERS: Add driver-api/fpga path
fpga: clarify that unregister functions also free
documentation: fpga: move fpga-region.txt to driver-api
documentation: fpga: add bridge document to driver-api
documentation: fpga: move fpga-mgr.txt to driver-api
Documentation: fpga: move fpga overview to driver-api
fpga: region: kernel-doc fixes
fpga: bridge: kernel-doc fixes
fpga: mgr: kernel-doc fixes
fpga: use SPDX
fpga: region: change api, add fpga_region_create/free
fpga: bridge: change api, don't use drvdata
fpga: manager: change api, don't use drvdata
fpga: region: don't use drvdata in common fpga code
Drivers: hv: vmbus: Removed an unnecessary cast from void *
ver_linux: Drop redundant calls to system() to test if file is readable
ver_linux: Move stderr redirection from function parameter to function body
misc: IBM Virtual Management Channel Driver (VMC)
rpmsg: Correct support for MODULE_DEVICE_TABLE()
...
Diffstat (limited to 'Documentation/driver-api')
-rw-r--r-- | Documentation/driver-api/fpga/fpga-bridge.rst | 49 | ||||
-rw-r--r-- | Documentation/driver-api/fpga/fpga-mgr.rst | 220 | ||||
-rw-r--r-- | Documentation/driver-api/fpga/fpga-region.rst | 102 | ||||
-rw-r--r-- | Documentation/driver-api/fpga/index.rst | 13 | ||||
-rw-r--r-- | Documentation/driver-api/fpga/intro.rst | 54 | ||||
-rw-r--r-- | Documentation/driver-api/index.rst | 1 | ||||
-rw-r--r-- | Documentation/driver-api/soundwire/error_handling.rst | 65 | ||||
-rw-r--r-- | Documentation/driver-api/soundwire/index.rst | 3 | ||||
-rw-r--r-- | Documentation/driver-api/soundwire/locking.rst | 106 | ||||
-rw-r--r-- | Documentation/driver-api/soundwire/stream.rst | 372 |
10 files changed, 985 insertions, 0 deletions
diff --git a/Documentation/driver-api/fpga/fpga-bridge.rst b/Documentation/driver-api/fpga/fpga-bridge.rst new file mode 100644 index 000000000000..2c2aaca894bf --- /dev/null +++ b/Documentation/driver-api/fpga/fpga-bridge.rst | |||
@@ -0,0 +1,49 @@ | |||
1 | FPGA Bridge | ||
2 | =========== | ||
3 | |||
4 | API to implement a new FPGA bridge | ||
5 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
6 | |||
7 | .. kernel-doc:: include/linux/fpga/fpga-bridge.h | ||
8 | :functions: fpga_bridge | ||
9 | |||
10 | .. kernel-doc:: include/linux/fpga/fpga-bridge.h | ||
11 | :functions: fpga_bridge_ops | ||
12 | |||
13 | .. kernel-doc:: drivers/fpga/fpga-bridge.c | ||
14 | :functions: fpga_bridge_create | ||
15 | |||
16 | .. kernel-doc:: drivers/fpga/fpga-bridge.c | ||
17 | :functions: fpga_bridge_free | ||
18 | |||
19 | .. kernel-doc:: drivers/fpga/fpga-bridge.c | ||
20 | :functions: fpga_bridge_register | ||
21 | |||
22 | .. kernel-doc:: drivers/fpga/fpga-bridge.c | ||
23 | :functions: fpga_bridge_unregister | ||
24 | |||
25 | API to control an FPGA bridge | ||
26 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
27 | |||
28 | You probably won't need these directly. FPGA regions should handle this. | ||
29 | |||
30 | .. kernel-doc:: drivers/fpga/fpga-bridge.c | ||
31 | :functions: of_fpga_bridge_get | ||
32 | |||
33 | .. kernel-doc:: drivers/fpga/fpga-bridge.c | ||
34 | :functions: fpga_bridge_get | ||
35 | |||
36 | .. kernel-doc:: drivers/fpga/fpga-bridge.c | ||
37 | :functions: fpga_bridge_put | ||
38 | |||
39 | .. kernel-doc:: drivers/fpga/fpga-bridge.c | ||
40 | :functions: fpga_bridge_get_to_list | ||
41 | |||
42 | .. kernel-doc:: drivers/fpga/fpga-bridge.c | ||
43 | :functions: of_fpga_bridge_get_to_list | ||
44 | |||
45 | .. kernel-doc:: drivers/fpga/fpga-bridge.c | ||
46 | :functions: fpga_bridge_enable | ||
47 | |||
48 | .. kernel-doc:: drivers/fpga/fpga-bridge.c | ||
49 | :functions: fpga_bridge_disable | ||
diff --git a/Documentation/driver-api/fpga/fpga-mgr.rst b/Documentation/driver-api/fpga/fpga-mgr.rst new file mode 100644 index 000000000000..bcf2dd24e179 --- /dev/null +++ b/Documentation/driver-api/fpga/fpga-mgr.rst | |||
@@ -0,0 +1,220 @@ | |||
1 | FPGA Manager | ||
2 | ============ | ||
3 | |||
4 | Overview | ||
5 | -------- | ||
6 | |||
7 | The FPGA manager core exports a set of functions for programming an FPGA with | ||
8 | an image. The API is manufacturer agnostic. All manufacturer specifics are | ||
9 | hidden away in a low level driver which registers a set of ops with the core. | ||
10 | The FPGA image data itself is very manufacturer specific, but for our purposes | ||
11 | it's just binary data. The FPGA manager core won't parse it. | ||
12 | |||
13 | The FPGA image to be programmed can be in a scatter gather list, a single | ||
14 | contiguous buffer, or a firmware file. Because allocating contiguous kernel | ||
15 | memory for the buffer should be avoided, users are encouraged to use a scatter | ||
16 | gather list instead if possible. | ||
17 | |||
18 | The particulars for programming the image are presented in a structure (struct | ||
19 | fpga_image_info). This struct contains parameters such as pointers to the | ||
20 | FPGA image as well as image-specific particulars such as whether the image was | ||
21 | built for full or partial reconfiguration. | ||
22 | |||
23 | How to support a new FPGA device | ||
24 | -------------------------------- | ||
25 | |||
26 | To add another FPGA manager, write a driver that implements a set of ops. The | ||
27 | probe function calls fpga_mgr_register(), such as:: | ||
28 | |||
29 | static const struct fpga_manager_ops socfpga_fpga_ops = { | ||
30 | .write_init = socfpga_fpga_ops_configure_init, | ||
31 | .write = socfpga_fpga_ops_configure_write, | ||
32 | .write_complete = socfpga_fpga_ops_configure_complete, | ||
33 | .state = socfpga_fpga_ops_state, | ||
34 | }; | ||
35 | |||
36 | static int socfpga_fpga_probe(struct platform_device *pdev) | ||
37 | { | ||
38 | struct device *dev = &pdev->dev; | ||
39 | struct socfpga_fpga_priv *priv; | ||
40 | struct fpga_manager *mgr; | ||
41 | int ret; | ||
42 | |||
43 | priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); | ||
44 | if (!priv) | ||
45 | return -ENOMEM; | ||
46 | |||
47 | /* | ||
48 | * do ioremaps, get interrupts, etc. and save | ||
49 | * them in priv | ||
50 | */ | ||
51 | |||
52 | mgr = fpga_mgr_create(dev, "Altera SOCFPGA FPGA Manager", | ||
53 | &socfpga_fpga_ops, priv); | ||
54 | if (!mgr) | ||
55 | return -ENOMEM; | ||
56 | |||
57 | platform_set_drvdata(pdev, mgr); | ||
58 | |||
59 | ret = fpga_mgr_register(mgr); | ||
60 | if (ret) | ||
61 | fpga_mgr_free(mgr); | ||
62 | |||
63 | return ret; | ||
64 | } | ||
65 | |||
66 | static int socfpga_fpga_remove(struct platform_device *pdev) | ||
67 | { | ||
68 | struct fpga_manager *mgr = platform_get_drvdata(pdev); | ||
69 | |||
70 | fpga_mgr_unregister(mgr); | ||
71 | |||
72 | return 0; | ||
73 | } | ||
74 | |||
75 | |||
76 | The ops will implement whatever device specific register writes are needed to | ||
77 | do the programming sequence for this particular FPGA. These ops return 0 for | ||
78 | success or negative error codes otherwise. | ||
79 | |||
80 | The programming sequence is:: | ||
81 | 1. .write_init | ||
82 | 2. .write or .write_sg (may be called once or multiple times) | ||
83 | 3. .write_complete | ||
84 | |||
85 | The .write_init function will prepare the FPGA to receive the image data. The | ||
86 | buffer passed into .write_init will be atmost .initial_header_size bytes long, | ||
87 | if the whole bitstream is not immediately available then the core code will | ||
88 | buffer up at least this much before starting. | ||
89 | |||
90 | The .write function writes a buffer to the FPGA. The buffer may be contain the | ||
91 | whole FPGA image or may be a smaller chunk of an FPGA image. In the latter | ||
92 | case, this function is called multiple times for successive chunks. This interface | ||
93 | is suitable for drivers which use PIO. | ||
94 | |||
95 | The .write_sg version behaves the same as .write except the input is a sg_table | ||
96 | scatter list. This interface is suitable for drivers which use DMA. | ||
97 | |||
98 | The .write_complete function is called after all the image has been written | ||
99 | to put the FPGA into operating mode. | ||
100 | |||
101 | The ops include a .state function which will read the hardware FPGA manager and | ||
102 | return a code of type enum fpga_mgr_states. It doesn't result in a change in | ||
103 | hardware state. | ||
104 | |||
105 | How to write an image buffer to a supported FPGA | ||
106 | ------------------------------------------------ | ||
107 | |||
108 | Some sample code:: | ||
109 | |||
110 | #include <linux/fpga/fpga-mgr.h> | ||
111 | |||
112 | struct fpga_manager *mgr; | ||
113 | struct fpga_image_info *info; | ||
114 | int ret; | ||
115 | |||
116 | /* | ||
117 | * Get a reference to FPGA manager. The manager is not locked, so you can | ||
118 | * hold onto this reference without it preventing programming. | ||
119 | * | ||
120 | * This example uses the device node of the manager. Alternatively, use | ||
121 | * fpga_mgr_get(dev) instead if you have the device. | ||
122 | */ | ||
123 | mgr = of_fpga_mgr_get(mgr_node); | ||
124 | |||
125 | /* struct with information about the FPGA image to program. */ | ||
126 | info = fpga_image_info_alloc(dev); | ||
127 | |||
128 | /* flags indicates whether to do full or partial reconfiguration */ | ||
129 | info->flags = FPGA_MGR_PARTIAL_RECONFIG; | ||
130 | |||
131 | /* | ||
132 | * At this point, indicate where the image is. This is pseudo-code; you're | ||
133 | * going to use one of these three. | ||
134 | */ | ||
135 | if (image is in a scatter gather table) { | ||
136 | |||
137 | info->sgt = [your scatter gather table] | ||
138 | |||
139 | } else if (image is in a buffer) { | ||
140 | |||
141 | info->buf = [your image buffer] | ||
142 | info->count = [image buffer size] | ||
143 | |||
144 | } else if (image is in a firmware file) { | ||
145 | |||
146 | info->firmware_name = devm_kstrdup(dev, firmware_name, GFP_KERNEL); | ||
147 | |||
148 | } | ||
149 | |||
150 | /* Get exclusive control of FPGA manager */ | ||
151 | ret = fpga_mgr_lock(mgr); | ||
152 | |||
153 | /* Load the buffer to the FPGA */ | ||
154 | ret = fpga_mgr_buf_load(mgr, &info, buf, count); | ||
155 | |||
156 | /* Release the FPGA manager */ | ||
157 | fpga_mgr_unlock(mgr); | ||
158 | fpga_mgr_put(mgr); | ||
159 | |||
160 | /* Deallocate the image info if you're done with it */ | ||
161 | fpga_image_info_free(info); | ||
162 | |||
163 | API for implementing a new FPGA Manager driver | ||
164 | ---------------------------------------------- | ||
165 | |||
166 | .. kernel-doc:: include/linux/fpga/fpga-mgr.h | ||
167 | :functions: fpga_manager | ||
168 | |||
169 | .. kernel-doc:: include/linux/fpga/fpga-mgr.h | ||
170 | :functions: fpga_manager_ops | ||
171 | |||
172 | .. kernel-doc:: drivers/fpga/fpga-mgr.c | ||
173 | :functions: fpga_mgr_create | ||
174 | |||
175 | .. kernel-doc:: drivers/fpga/fpga-mgr.c | ||
176 | :functions: fpga_mgr_free | ||
177 | |||
178 | .. kernel-doc:: drivers/fpga/fpga-mgr.c | ||
179 | :functions: fpga_mgr_register | ||
180 | |||
181 | .. kernel-doc:: drivers/fpga/fpga-mgr.c | ||
182 | :functions: fpga_mgr_unregister | ||
183 | |||
184 | API for programming a FPGA | ||
185 | -------------------------- | ||
186 | |||
187 | .. kernel-doc:: include/linux/fpga/fpga-mgr.h | ||
188 | :functions: fpga_image_info | ||
189 | |||
190 | .. kernel-doc:: include/linux/fpga/fpga-mgr.h | ||
191 | :functions: fpga_mgr_states | ||
192 | |||
193 | .. kernel-doc:: drivers/fpga/fpga-mgr.c | ||
194 | :functions: fpga_image_info_alloc | ||
195 | |||
196 | .. kernel-doc:: drivers/fpga/fpga-mgr.c | ||
197 | :functions: fpga_image_info_free | ||
198 | |||
199 | .. kernel-doc:: drivers/fpga/fpga-mgr.c | ||
200 | :functions: of_fpga_mgr_get | ||
201 | |||
202 | .. kernel-doc:: drivers/fpga/fpga-mgr.c | ||
203 | :functions: fpga_mgr_get | ||
204 | |||
205 | .. kernel-doc:: drivers/fpga/fpga-mgr.c | ||
206 | :functions: fpga_mgr_put | ||
207 | |||
208 | .. kernel-doc:: drivers/fpga/fpga-mgr.c | ||
209 | :functions: fpga_mgr_lock | ||
210 | |||
211 | .. kernel-doc:: drivers/fpga/fpga-mgr.c | ||
212 | :functions: fpga_mgr_unlock | ||
213 | |||
214 | .. kernel-doc:: include/linux/fpga/fpga-mgr.h | ||
215 | :functions: fpga_mgr_states | ||
216 | |||
217 | Note - use :c:func:`fpga_region_program_fpga()` instead of :c:func:`fpga_mgr_load()` | ||
218 | |||
219 | .. kernel-doc:: drivers/fpga/fpga-mgr.c | ||
220 | :functions: fpga_mgr_load | ||
diff --git a/Documentation/driver-api/fpga/fpga-region.rst b/Documentation/driver-api/fpga/fpga-region.rst new file mode 100644 index 000000000000..f89e4a311722 --- /dev/null +++ b/Documentation/driver-api/fpga/fpga-region.rst | |||
@@ -0,0 +1,102 @@ | |||
1 | FPGA Region | ||
2 | =========== | ||
3 | |||
4 | Overview | ||
5 | -------- | ||
6 | |||
7 | This document is meant to be an brief overview of the FPGA region API usage. A | ||
8 | more conceptual look at regions can be found in the Device Tree binding | ||
9 | document [#f1]_. | ||
10 | |||
11 | For the purposes of this API document, let's just say that a region associates | ||
12 | an FPGA Manager and a bridge (or bridges) with a reprogrammable region of an | ||
13 | FPGA or the whole FPGA. The API provides a way to register a region and to | ||
14 | program a region. | ||
15 | |||
16 | Currently the only layer above fpga-region.c in the kernel is the Device Tree | ||
17 | support (of-fpga-region.c) described in [#f1]_. The DT support layer uses regions | ||
18 | to program the FPGA and then DT to handle enumeration. The common region code | ||
19 | is intended to be used by other schemes that have other ways of accomplishing | ||
20 | enumeration after programming. | ||
21 | |||
22 | An fpga-region can be set up to know the following things: | ||
23 | |||
24 | * which FPGA manager to use to do the programming | ||
25 | |||
26 | * which bridges to disable before programming and enable afterwards. | ||
27 | |||
28 | Additional info needed to program the FPGA image is passed in the struct | ||
29 | fpga_image_info including: | ||
30 | |||
31 | * pointers to the image as either a scatter-gather buffer, a contiguous | ||
32 | buffer, or the name of firmware file | ||
33 | |||
34 | * flags indicating specifics such as whether the image if for partial | ||
35 | reconfiguration. | ||
36 | |||
37 | How to program a FPGA using a region | ||
38 | ------------------------------------ | ||
39 | |||
40 | First, allocate the info struct:: | ||
41 | |||
42 | info = fpga_image_info_alloc(dev); | ||
43 | if (!info) | ||
44 | return -ENOMEM; | ||
45 | |||
46 | Set flags as needed, i.e.:: | ||
47 | |||
48 | info->flags |= FPGA_MGR_PARTIAL_RECONFIG; | ||
49 | |||
50 | Point to your FPGA image, such as:: | ||
51 | |||
52 | info->sgt = &sgt; | ||
53 | |||
54 | Add info to region and do the programming:: | ||
55 | |||
56 | region->info = info; | ||
57 | ret = fpga_region_program_fpga(region); | ||
58 | |||
59 | :c:func:`fpga_region_program_fpga()` operates on info passed in the | ||
60 | fpga_image_info (region->info). This function will attempt to: | ||
61 | |||
62 | * lock the region's mutex | ||
63 | * lock the region's FPGA manager | ||
64 | * build a list of FPGA bridges if a method has been specified to do so | ||
65 | * disable the bridges | ||
66 | * program the FPGA | ||
67 | * re-enable the bridges | ||
68 | * release the locks | ||
69 | |||
70 | Then you will want to enumerate whatever hardware has appeared in the FPGA. | ||
71 | |||
72 | How to add a new FPGA region | ||
73 | ---------------------------- | ||
74 | |||
75 | An example of usage can be seen in the probe function of [#f2]_. | ||
76 | |||
77 | .. [#f1] ../devicetree/bindings/fpga/fpga-region.txt | ||
78 | .. [#f2] ../../drivers/fpga/of-fpga-region.c | ||
79 | |||
80 | API to program a FGPA | ||
81 | --------------------- | ||
82 | |||
83 | .. kernel-doc:: drivers/fpga/fpga-region.c | ||
84 | :functions: fpga_region_program_fpga | ||
85 | |||
86 | API to add a new FPGA region | ||
87 | ---------------------------- | ||
88 | |||
89 | .. kernel-doc:: include/linux/fpga/fpga-region.h | ||
90 | :functions: fpga_region | ||
91 | |||
92 | .. kernel-doc:: drivers/fpga/fpga-region.c | ||
93 | :functions: fpga_region_create | ||
94 | |||
95 | .. kernel-doc:: drivers/fpga/fpga-region.c | ||
96 | :functions: fpga_region_free | ||
97 | |||
98 | .. kernel-doc:: drivers/fpga/fpga-region.c | ||
99 | :functions: fpga_region_register | ||
100 | |||
101 | .. kernel-doc:: drivers/fpga/fpga-region.c | ||
102 | :functions: fpga_region_unregister | ||
diff --git a/Documentation/driver-api/fpga/index.rst b/Documentation/driver-api/fpga/index.rst new file mode 100644 index 000000000000..c51e5ebd544a --- /dev/null +++ b/Documentation/driver-api/fpga/index.rst | |||
@@ -0,0 +1,13 @@ | |||
1 | ============== | ||
2 | FPGA Subsystem | ||
3 | ============== | ||
4 | |||
5 | :Author: Alan Tull | ||
6 | |||
7 | .. toctree:: | ||
8 | :maxdepth: 2 | ||
9 | |||
10 | intro | ||
11 | fpga-mgr | ||
12 | fpga-bridge | ||
13 | fpga-region | ||
diff --git a/Documentation/driver-api/fpga/intro.rst b/Documentation/driver-api/fpga/intro.rst new file mode 100644 index 000000000000..51cd81dbb4dc --- /dev/null +++ b/Documentation/driver-api/fpga/intro.rst | |||
@@ -0,0 +1,54 @@ | |||
1 | Introduction | ||
2 | ============ | ||
3 | |||
4 | The FPGA subsystem supports reprogramming FPGAs dynamically under | ||
5 | Linux. Some of the core intentions of the FPGA subsystems are: | ||
6 | |||
7 | * The FPGA subsystem is vendor agnostic. | ||
8 | |||
9 | * The FPGA subsystem separates upper layers (userspace interfaces and | ||
10 | enumeration) from lower layers that know how to program a specific | ||
11 | FPGA. | ||
12 | |||
13 | * Code should not be shared between upper and lower layers. This | ||
14 | should go without saying. If that seems necessary, there's probably | ||
15 | framework functionality that that can be added that will benefit | ||
16 | other users. Write the linux-fpga mailing list and maintainers and | ||
17 | seek out a solution that expands the framework for broad reuse. | ||
18 | |||
19 | * Generally, when adding code, think of the future. Plan for re-use. | ||
20 | |||
21 | The framework in the kernel is divided into: | ||
22 | |||
23 | FPGA Manager | ||
24 | ------------ | ||
25 | |||
26 | If you are adding a new FPGA or a new method of programming a FPGA, | ||
27 | this is the subsystem for you. Low level FPGA manager drivers contain | ||
28 | the knowledge of how to program a specific device. This subsystem | ||
29 | includes the framework in fpga-mgr.c and the low level drivers that | ||
30 | are registered with it. | ||
31 | |||
32 | FPGA Bridge | ||
33 | ----------- | ||
34 | |||
35 | FPGA Bridges prevent spurious signals from going out of a FPGA or a | ||
36 | region of a FPGA during programming. They are disabled before | ||
37 | programming begins and re-enabled afterwards. An FPGA bridge may be | ||
38 | actual hard hardware that gates a bus to a cpu or a soft ("freeze") | ||
39 | bridge in FPGA fabric that surrounds a partial reconfiguration region | ||
40 | of an FPGA. This subsystem includes fpga-bridge.c and the low level | ||
41 | drivers that are registered with it. | ||
42 | |||
43 | FPGA Region | ||
44 | ----------- | ||
45 | |||
46 | If you are adding a new interface to the FPGA framework, add it on top | ||
47 | of a FPGA region to allow the most reuse of your interface. | ||
48 | |||
49 | The FPGA Region framework (fpga-region.c) associates managers and | ||
50 | bridges as reconfigurable regions. A region may refer to the whole | ||
51 | FPGA in full reconfiguration or to a partial reconfiguration region. | ||
52 | |||
53 | The Device Tree FPGA Region support (of-fpga-region.c) handles | ||
54 | reprogramming FPGAs when device tree overlays are applied. | ||
diff --git a/Documentation/driver-api/index.rst b/Documentation/driver-api/index.rst index 5d04296f5ce0..f4180e7c7ed5 100644 --- a/Documentation/driver-api/index.rst +++ b/Documentation/driver-api/index.rst | |||
@@ -51,6 +51,7 @@ available subsections can be seen below. | |||
51 | dmaengine/index | 51 | dmaengine/index |
52 | slimbus | 52 | slimbus |
53 | soundwire/index | 53 | soundwire/index |
54 | fpga/index | ||
54 | 55 | ||
55 | .. only:: subproject and html | 56 | .. only:: subproject and html |
56 | 57 | ||
diff --git a/Documentation/driver-api/soundwire/error_handling.rst b/Documentation/driver-api/soundwire/error_handling.rst new file mode 100644 index 000000000000..aa3a0a23a066 --- /dev/null +++ b/Documentation/driver-api/soundwire/error_handling.rst | |||
@@ -0,0 +1,65 @@ | |||
1 | ======================== | ||
2 | SoundWire Error Handling | ||
3 | ======================== | ||
4 | |||
5 | The SoundWire PHY was designed with care and errors on the bus are going to | ||
6 | be very unlikely, and if they happen it should be limited to single bit | ||
7 | errors. Examples of this design can be found in the synchronization | ||
8 | mechanism (sync loss after two errors) and short CRCs used for the Bulk | ||
9 | Register Access. | ||
10 | |||
11 | The errors can be detected with multiple mechanisms: | ||
12 | |||
13 | 1. Bus clash or parity errors: This mechanism relies on low-level detectors | ||
14 | that are independent of the payload and usages, and they cover both control | ||
15 | and audio data. The current implementation only logs such errors. | ||
16 | Improvements could be invalidating an entire programming sequence and | ||
17 | restarting from a known position. In the case of such errors outside of a | ||
18 | control/command sequence, there is no concealment or recovery for audio | ||
19 | data enabled by the SoundWire protocol, the location of the error will also | ||
20 | impact its audibility (most-significant bits will be more impacted in PCM), | ||
21 | and after a number of such errors are detected the bus might be reset. Note | ||
22 | that bus clashes due to programming errors (two streams using the same bit | ||
23 | slots) or electrical issues during the transmit/receive transition cannot | ||
24 | be distinguished, although a recurring bus clash when audio is enabled is a | ||
25 | indication of a bus allocation issue. The interrupt mechanism can also help | ||
26 | identify Slaves which detected a Bus Clash or a Parity Error, but they may | ||
27 | not be responsible for the errors so resetting them individually is not a | ||
28 | viable recovery strategy. | ||
29 | |||
30 | 2. Command status: Each command is associated with a status, which only | ||
31 | covers transmission of the data between devices. The ACK status indicates | ||
32 | that the command was received and will be executed by the end of the | ||
33 | current frame. A NAK indicates that the command was in error and will not | ||
34 | be applied. In case of a bad programming (command sent to non-existent | ||
35 | Slave or to a non-implemented register) or electrical issue, no response | ||
36 | signals the command was ignored. Some Master implementations allow for a | ||
37 | command to be retransmitted several times. If the retransmission fails, | ||
38 | backtracking and restarting the entire programming sequence might be a | ||
39 | solution. Alternatively some implementations might directly issue a bus | ||
40 | reset and re-enumerate all devices. | ||
41 | |||
42 | 3. Timeouts: In a number of cases such as ChannelPrepare or | ||
43 | ClockStopPrepare, the bus driver is supposed to poll a register field until | ||
44 | it transitions to a NotFinished value of zero. The MIPI SoundWire spec 1.1 | ||
45 | does not define timeouts but the MIPI SoundWire DisCo document adds | ||
46 | recommendation on timeouts. If such configurations do not complete, the | ||
47 | driver will return a -ETIMEOUT. Such timeouts are symptoms of a faulty | ||
48 | Slave device and are likely impossible to recover from. | ||
49 | |||
50 | Errors during global reconfiguration sequences are extremely difficult to | ||
51 | handle: | ||
52 | |||
53 | 1. BankSwitch: An error during the last command issuing a BankSwitch is | ||
54 | difficult to backtrack from. Retransmitting the Bank Switch command may be | ||
55 | possible in a single segment setup, but this can lead to synchronization | ||
56 | problems when enabling multiple bus segments (a command with side effects | ||
57 | such as frame reconfiguration would be handled at different times). A global | ||
58 | hard-reset might be the best solution. | ||
59 | |||
60 | Note that SoundWire does not provide a mechanism to detect illegal values | ||
61 | written in valid registers. In a number of cases the standard even mentions | ||
62 | that the Slave might behave in implementation-defined ways. The bus | ||
63 | implementation does not provide a recovery mechanism for such errors, Slave | ||
64 | or Master driver implementers are responsible for writing valid values in | ||
65 | valid registers and implement additional range checking if needed. | ||
diff --git a/Documentation/driver-api/soundwire/index.rst b/Documentation/driver-api/soundwire/index.rst index 647e94654752..6db026028f27 100644 --- a/Documentation/driver-api/soundwire/index.rst +++ b/Documentation/driver-api/soundwire/index.rst | |||
@@ -6,6 +6,9 @@ SoundWire Documentation | |||
6 | :maxdepth: 1 | 6 | :maxdepth: 1 |
7 | 7 | ||
8 | summary | 8 | summary |
9 | stream | ||
10 | error_handling | ||
11 | locking | ||
9 | 12 | ||
10 | .. only:: subproject | 13 | .. only:: subproject |
11 | 14 | ||
diff --git a/Documentation/driver-api/soundwire/locking.rst b/Documentation/driver-api/soundwire/locking.rst new file mode 100644 index 000000000000..253f73555255 --- /dev/null +++ b/Documentation/driver-api/soundwire/locking.rst | |||
@@ -0,0 +1,106 @@ | |||
1 | ================= | ||
2 | SoundWire Locking | ||
3 | ================= | ||
4 | |||
5 | This document explains locking mechanism of the SoundWire Bus. Bus uses | ||
6 | following locks in order to avoid race conditions in Bus operations on | ||
7 | shared resources. | ||
8 | |||
9 | - Bus lock | ||
10 | |||
11 | - Message lock | ||
12 | |||
13 | Bus lock | ||
14 | ======== | ||
15 | |||
16 | SoundWire Bus lock is a mutex and is part of Bus data structure | ||
17 | (sdw_bus) which is used for every Bus instance. This lock is used to | ||
18 | serialize each of the following operations(s) within SoundWire Bus instance. | ||
19 | |||
20 | - Addition and removal of Slave(s), changing Slave status. | ||
21 | |||
22 | - Prepare, Enable, Disable and De-prepare stream operations. | ||
23 | |||
24 | - Access of Stream data structure. | ||
25 | |||
26 | Message lock | ||
27 | ============ | ||
28 | |||
29 | SoundWire message transfer lock. This mutex is part of | ||
30 | Bus data structure (sdw_bus). This lock is used to serialize the message | ||
31 | transfers (read/write) within a SoundWire Bus instance. | ||
32 | |||
33 | Below examples show how locks are acquired. | ||
34 | |||
35 | Example 1 | ||
36 | --------- | ||
37 | |||
38 | Message transfer. | ||
39 | |||
40 | 1. For every message transfer | ||
41 | |||
42 | a. Acquire Message lock. | ||
43 | |||
44 | b. Transfer message (Read/Write) to Slave1 or broadcast message on | ||
45 | Bus in case of bank switch. | ||
46 | |||
47 | c. Release Message lock :: | ||
48 | |||
49 | +----------+ +---------+ | ||
50 | | | | | | ||
51 | | Bus | | Master | | ||
52 | | | | Driver | | ||
53 | | | | | | ||
54 | +----+-----+ +----+----+ | ||
55 | | | | ||
56 | | bus->ops->xfer_msg() | | ||
57 | <-------------------------------+ a. Acquire Message lock | ||
58 | | | b. Transfer message | ||
59 | | | | ||
60 | +-------------------------------> c. Release Message lock | ||
61 | | return success/error | d. Return success/error | ||
62 | | | | ||
63 | + + | ||
64 | |||
65 | Example 2 | ||
66 | --------- | ||
67 | |||
68 | Prepare operation. | ||
69 | |||
70 | 1. Acquire lock for Bus instance associated with Master 1. | ||
71 | |||
72 | 2. For every message transfer in Prepare operation | ||
73 | |||
74 | a. Acquire Message lock. | ||
75 | |||
76 | b. Transfer message (Read/Write) to Slave1 or broadcast message on | ||
77 | Bus in case of bank switch. | ||
78 | |||
79 | c. Release Message lock. | ||
80 | |||
81 | 3. Release lock for Bus instance associated with Master 1 :: | ||
82 | |||
83 | +----------+ +---------+ | ||
84 | | | | | | ||
85 | | Bus | | Master | | ||
86 | | | | Driver | | ||
87 | | | | | | ||
88 | +----+-----+ +----+----+ | ||
89 | | | | ||
90 | | sdw_prepare_stream() | | ||
91 | <-------------------------------+ 1. Acquire bus lock | ||
92 | | | 2. Perform stream prepare | ||
93 | | | | ||
94 | | | | ||
95 | | bus->ops->xfer_msg() | | ||
96 | <-------------------------------+ a. Acquire Message lock | ||
97 | | | b. Transfer message | ||
98 | | | | ||
99 | +-------------------------------> c. Release Message lock | ||
100 | | return success/error | d. Return success/error | ||
101 | | | | ||
102 | | | | ||
103 | | return success/error | 3. Release bus lock | ||
104 | +-------------------------------> 4. Return success/error | ||
105 | | | | ||
106 | + + | ||
diff --git a/Documentation/driver-api/soundwire/stream.rst b/Documentation/driver-api/soundwire/stream.rst new file mode 100644 index 000000000000..29121aa55fb9 --- /dev/null +++ b/Documentation/driver-api/soundwire/stream.rst | |||
@@ -0,0 +1,372 @@ | |||
1 | ========================= | ||
2 | Audio Stream in SoundWire | ||
3 | ========================= | ||
4 | |||
5 | An audio stream is a logical or virtual connection created between | ||
6 | |||
7 | (1) System memory buffer(s) and Codec(s) | ||
8 | |||
9 | (2) DSP memory buffer(s) and Codec(s) | ||
10 | |||
11 | (3) FIFO(s) and Codec(s) | ||
12 | |||
13 | (4) Codec(s) and Codec(s) | ||
14 | |||
15 | which is typically driven by a DMA(s) channel through the data link. An | ||
16 | audio stream contains one or more channels of data. All channels within | ||
17 | stream must have same sample rate and same sample size. | ||
18 | |||
19 | Assume a stream with two channels (Left & Right) is opened using SoundWire | ||
20 | interface. Below are some ways a stream can be represented in SoundWire. | ||
21 | |||
22 | Stream Sample in memory (System memory, DSP memory or FIFOs) :: | ||
23 | |||
24 | ------------------------- | ||
25 | | L | R | L | R | L | R | | ||
26 | ------------------------- | ||
27 | |||
28 | Example 1: Stereo Stream with L and R channels is rendered from Master to | ||
29 | Slave. Both Master and Slave is using single port. :: | ||
30 | |||
31 | +---------------+ Clock Signal +---------------+ | ||
32 | | Master +----------------------------------+ Slave | | ||
33 | | Interface | | Interface | | ||
34 | | | | 1 | | ||
35 | | | Data Signal | | | ||
36 | | L + R +----------------------------------+ L + R | | ||
37 | | (Data) | Data Direction | (Data) | | ||
38 | +---------------+ +-----------------------> +---------------+ | ||
39 | |||
40 | |||
41 | Example 2: Stereo Stream with L and R channels is captured from Slave to | ||
42 | Master. Both Master and Slave is using single port. :: | ||
43 | |||
44 | |||
45 | +---------------+ Clock Signal +---------------+ | ||
46 | | Master +----------------------------------+ Slave | | ||
47 | | Interface | | Interface | | ||
48 | | | | 1 | | ||
49 | | | Data Signal | | | ||
50 | | L + R +----------------------------------+ L + R | | ||
51 | | (Data) | Data Direction | (Data) | | ||
52 | +---------------+ <-----------------------+ +---------------+ | ||
53 | |||
54 | |||
55 | Example 3: Stereo Stream with L and R channels is rendered by Master. Each | ||
56 | of the L and R channel is received by two different Slaves. Master and both | ||
57 | Slaves are using single port. :: | ||
58 | |||
59 | +---------------+ Clock Signal +---------------+ | ||
60 | | Master +---------+------------------------+ Slave | | ||
61 | | Interface | | | Interface | | ||
62 | | | | | 1 | | ||
63 | | | | Data Signal | | | ||
64 | | L + R +---+------------------------------+ L | | ||
65 | | (Data) | | | Data Direction | (Data) | | ||
66 | +---------------+ | | +-------------> +---------------+ | ||
67 | | | | ||
68 | | | | ||
69 | | | +---------------+ | ||
70 | | +----------------------> | Slave | | ||
71 | | | Interface | | ||
72 | | | 2 | | ||
73 | | | | | ||
74 | +----------------------------> | R | | ||
75 | | (Data) | | ||
76 | +---------------+ | ||
77 | |||
78 | |||
79 | Example 4: Stereo Stream with L and R channel is rendered by two different | ||
80 | Ports of the Master and is received by only single Port of the Slave | ||
81 | interface. :: | ||
82 | |||
83 | +--------------------+ | ||
84 | | | | ||
85 | | +--------------+ +----------------+ | ||
86 | | | || | | | ||
87 | | | Data Port || L Channel | | | ||
88 | | | 1 |------------+ | | | ||
89 | | | L Channel || | +-----+----+ | | ||
90 | | | (Data) || | L + R Channel || Data | | | ||
91 | | Master +----------+ | +---+---------> || Port | | | ||
92 | | Interface | | || 1 | | | ||
93 | | +--------------+ | || | | | ||
94 | | | || | +----------+ | | ||
95 | | | Data Port |------------+ | | | ||
96 | | | 2 || R Channel | Slave | | ||
97 | | | R Channel || | Interface | | ||
98 | | | (Data) || | 1 | | ||
99 | | +--------------+ Clock Signal | L + R | | ||
100 | | +---------------------------> | (Data) | | ||
101 | +--------------------+ | | | ||
102 | +----------------+ | ||
103 | |||
104 | SoundWire Stream Management flow | ||
105 | ================================ | ||
106 | |||
107 | Stream definitions | ||
108 | ------------------ | ||
109 | |||
110 | (1) Current stream: This is classified as the stream on which operation has | ||
111 | to be performed like prepare, enable, disable, de-prepare etc. | ||
112 | |||
113 | (2) Active stream: This is classified as the stream which is already active | ||
114 | on Bus other than current stream. There can be multiple active streams | ||
115 | on the Bus. | ||
116 | |||
117 | SoundWire Bus manages stream operations for each stream getting | ||
118 | rendered/captured on the SoundWire Bus. This section explains Bus operations | ||
119 | done for each of the stream allocated/released on Bus. Following are the | ||
120 | stream states maintained by the Bus for each of the audio stream. | ||
121 | |||
122 | |||
123 | SoundWire stream states | ||
124 | ----------------------- | ||
125 | |||
126 | Below shows the SoundWire stream states and state transition diagram. :: | ||
127 | |||
128 | +-----------+ +------------+ +----------+ +----------+ | ||
129 | | ALLOCATED +---->| CONFIGURED +---->| PREPARED +---->| ENABLED | | ||
130 | | STATE | | STATE | | STATE | | STATE | | ||
131 | +-----------+ +------------+ +----------+ +----+-----+ | ||
132 | ^ | ||
133 | | | ||
134 | | | ||
135 | v | ||
136 | +----------+ +------------+ +----+-----+ | ||
137 | | RELEASED |<----------+ DEPREPARED |<-------+ DISABLED | | ||
138 | | STATE | | STATE | | STATE | | ||
139 | +----------+ +------------+ +----------+ | ||
140 | |||
141 | NOTE: State transition between prepare and deprepare is supported in Spec | ||
142 | but not in the software (subsystem) | ||
143 | |||
144 | NOTE2: Stream state transition checks need to be handled by caller | ||
145 | framework, for example ALSA/ASoC. No checks for stream transition exist in | ||
146 | SoundWire subsystem. | ||
147 | |||
148 | Stream State Operations | ||
149 | ----------------------- | ||
150 | |||
151 | Below section explains the operations done by the Bus on Master(s) and | ||
152 | Slave(s) as part of stream state transitions. | ||
153 | |||
154 | SDW_STREAM_ALLOCATED | ||
155 | ~~~~~~~~~~~~~~~~~~~~ | ||
156 | |||
157 | Allocation state for stream. This is the entry state | ||
158 | of the stream. Operations performed before entering in this state: | ||
159 | |||
160 | (1) A stream runtime is allocated for the stream. This stream | ||
161 | runtime is used as a reference for all the operations performed | ||
162 | on the stream. | ||
163 | |||
164 | (2) The resources required for holding stream runtime information are | ||
165 | allocated and initialized. This holds all stream related information | ||
166 | such as stream type (PCM/PDM) and parameters, Master and Slave | ||
167 | interface associated with the stream, stream state etc. | ||
168 | |||
169 | After all above operations are successful, stream state is set to | ||
170 | ``SDW_STREAM_ALLOCATED``. | ||
171 | |||
172 | Bus implements below API for allocate a stream which needs to be called once | ||
173 | per stream. From ASoC DPCM framework, this stream state maybe linked to | ||
174 | .startup() operation. | ||
175 | |||
176 | .. code-block:: c | ||
177 | int sdw_alloc_stream(char * stream_name); | ||
178 | |||
179 | |||
180 | SDW_STREAM_CONFIGURED | ||
181 | ~~~~~~~~~~~~~~~~~~~~~ | ||
182 | |||
183 | Configuration state of stream. Operations performed before entering in | ||
184 | this state: | ||
185 | |||
186 | (1) The resources allocated for stream information in SDW_STREAM_ALLOCATED | ||
187 | state are updated here. This includes stream parameters, Master(s) | ||
188 | and Slave(s) runtime information associated with current stream. | ||
189 | |||
190 | (2) All the Master(s) and Slave(s) associated with current stream provide | ||
191 | the port information to Bus which includes port numbers allocated by | ||
192 | Master(s) and Slave(s) for current stream and their channel mask. | ||
193 | |||
194 | After all above operations are successful, stream state is set to | ||
195 | ``SDW_STREAM_CONFIGURED``. | ||
196 | |||
197 | Bus implements below APIs for CONFIG state which needs to be called by | ||
198 | the respective Master(s) and Slave(s) associated with stream. These APIs can | ||
199 | only be invoked once by respective Master(s) and Slave(s). From ASoC DPCM | ||
200 | framework, this stream state is linked to .hw_params() operation. | ||
201 | |||
202 | .. code-block:: c | ||
203 | int sdw_stream_add_master(struct sdw_bus * bus, | ||
204 | struct sdw_stream_config * stream_config, | ||
205 | struct sdw_ports_config * ports_config, | ||
206 | struct sdw_stream_runtime * stream); | ||
207 | |||
208 | int sdw_stream_add_slave(struct sdw_slave * slave, | ||
209 | struct sdw_stream_config * stream_config, | ||
210 | struct sdw_ports_config * ports_config, | ||
211 | struct sdw_stream_runtime * stream); | ||
212 | |||
213 | |||
214 | SDW_STREAM_PREPARED | ||
215 | ~~~~~~~~~~~~~~~~~~~ | ||
216 | |||
217 | Prepare state of stream. Operations performed before entering in this state: | ||
218 | |||
219 | (1) Bus parameters such as bandwidth, frame shape, clock frequency, | ||
220 | are computed based on current stream as well as already active | ||
221 | stream(s) on Bus. Re-computation is required to accommodate current | ||
222 | stream on the Bus. | ||
223 | |||
224 | (2) Transport and port parameters of all Master(s) and Slave(s) port(s) are | ||
225 | computed for the current as well as already active stream based on frame | ||
226 | shape and clock frequency computed in step 1. | ||
227 | |||
228 | (3) Computed Bus and transport parameters are programmed in Master(s) and | ||
229 | Slave(s) registers. The banked registers programming is done on the | ||
230 | alternate bank (bank currently unused). Port(s) are enabled for the | ||
231 | already active stream(s) on the alternate bank (bank currently unused). | ||
232 | This is done in order to not disrupt already active stream(s). | ||
233 | |||
234 | (4) Once all the values are programmed, Bus initiates switch to alternate | ||
235 | bank where all new values programmed gets into effect. | ||
236 | |||
237 | (5) Ports of Master(s) and Slave(s) for current stream are prepared by | ||
238 | programming PrepareCtrl register. | ||
239 | |||
240 | After all above operations are successful, stream state is set to | ||
241 | ``SDW_STREAM_PREPARED``. | ||
242 | |||
243 | Bus implements below API for PREPARE state which needs to be called once per | ||
244 | stream. From ASoC DPCM framework, this stream state is linked to | ||
245 | .prepare() operation. | ||
246 | |||
247 | .. code-block:: c | ||
248 | int sdw_prepare_stream(struct sdw_stream_runtime * stream); | ||
249 | |||
250 | |||
251 | SDW_STREAM_ENABLED | ||
252 | ~~~~~~~~~~~~~~~~~~ | ||
253 | |||
254 | Enable state of stream. The data port(s) are enabled upon entering this state. | ||
255 | Operations performed before entering in this state: | ||
256 | |||
257 | (1) All the values computed in SDW_STREAM_PREPARED state are programmed | ||
258 | in alternate bank (bank currently unused). It includes programming of | ||
259 | already active stream(s) as well. | ||
260 | |||
261 | (2) All the Master(s) and Slave(s) port(s) for the current stream are | ||
262 | enabled on alternate bank (bank currently unused) by programming | ||
263 | ChannelEn register. | ||
264 | |||
265 | (3) Once all the values are programmed, Bus initiates switch to alternate | ||
266 | bank where all new values programmed gets into effect and port(s) | ||
267 | associated with current stream are enabled. | ||
268 | |||
269 | After all above operations are successful, stream state is set to | ||
270 | ``SDW_STREAM_ENABLED``. | ||
271 | |||
272 | Bus implements below API for ENABLE state which needs to be called once per | ||
273 | stream. From ASoC DPCM framework, this stream state is linked to | ||
274 | .trigger() start operation. | ||
275 | |||
276 | .. code-block:: c | ||
277 | int sdw_enable_stream(struct sdw_stream_runtime * stream); | ||
278 | |||
279 | SDW_STREAM_DISABLED | ||
280 | ~~~~~~~~~~~~~~~~~~~ | ||
281 | |||
282 | Disable state of stream. The data port(s) are disabled upon exiting this state. | ||
283 | Operations performed before entering in this state: | ||
284 | |||
285 | (1) All the Master(s) and Slave(s) port(s) for the current stream are | ||
286 | disabled on alternate bank (bank currently unused) by programming | ||
287 | ChannelEn register. | ||
288 | |||
289 | (2) All the current configuration of Bus and active stream(s) are programmed | ||
290 | into alternate bank (bank currently unused). | ||
291 | |||
292 | (3) Once all the values are programmed, Bus initiates switch to alternate | ||
293 | bank where all new values programmed gets into effect and port(s) associated | ||
294 | with current stream are disabled. | ||
295 | |||
296 | After all above operations are successful, stream state is set to | ||
297 | ``SDW_STREAM_DISABLED``. | ||
298 | |||
299 | Bus implements below API for DISABLED state which needs to be called once | ||
300 | per stream. From ASoC DPCM framework, this stream state is linked to | ||
301 | .trigger() stop operation. | ||
302 | |||
303 | .. code-block:: c | ||
304 | int sdw_disable_stream(struct sdw_stream_runtime * stream); | ||
305 | |||
306 | |||
307 | SDW_STREAM_DEPREPARED | ||
308 | ~~~~~~~~~~~~~~~~~~~~~ | ||
309 | |||
310 | De-prepare state of stream. Operations performed before entering in this | ||
311 | state: | ||
312 | |||
313 | (1) All the port(s) of Master(s) and Slave(s) for current stream are | ||
314 | de-prepared by programming PrepareCtrl register. | ||
315 | |||
316 | (2) The payload bandwidth of current stream is reduced from the total | ||
317 | bandwidth requirement of bus and new parameters calculated and | ||
318 | applied by performing bank switch etc. | ||
319 | |||
320 | After all above operations are successful, stream state is set to | ||
321 | ``SDW_STREAM_DEPREPARED``. | ||
322 | |||
323 | Bus implements below API for DEPREPARED state which needs to be called once | ||
324 | per stream. From ASoC DPCM framework, this stream state is linked to | ||
325 | .trigger() stop operation. | ||
326 | |||
327 | .. code-block:: c | ||
328 | int sdw_deprepare_stream(struct sdw_stream_runtime * stream); | ||
329 | |||
330 | |||
331 | SDW_STREAM_RELEASED | ||
332 | ~~~~~~~~~~~~~~~~~~~ | ||
333 | |||
334 | Release state of stream. Operations performed before entering in this state: | ||
335 | |||
336 | (1) Release port resources for all Master(s) and Slave(s) port(s) | ||
337 | associated with current stream. | ||
338 | |||
339 | (2) Release Master(s) and Slave(s) runtime resources associated with | ||
340 | current stream. | ||
341 | |||
342 | (3) Release stream runtime resources associated with current stream. | ||
343 | |||
344 | After all above operations are successful, stream state is set to | ||
345 | ``SDW_STREAM_RELEASED``. | ||
346 | |||
347 | Bus implements below APIs for RELEASE state which needs to be called by | ||
348 | all the Master(s) and Slave(s) associated with stream. From ASoC DPCM | ||
349 | framework, this stream state is linked to .hw_free() operation. | ||
350 | |||
351 | .. code-block:: c | ||
352 | int sdw_stream_remove_master(struct sdw_bus * bus, | ||
353 | struct sdw_stream_runtime * stream); | ||
354 | int sdw_stream_remove_slave(struct sdw_slave * slave, | ||
355 | struct sdw_stream_runtime * stream); | ||
356 | |||
357 | |||
358 | The .shutdown() ASoC DPCM operation calls below Bus API to release | ||
359 | stream assigned as part of ALLOCATED state. | ||
360 | |||
361 | In .shutdown() the data structure maintaining stream state are freed up. | ||
362 | |||
363 | .. code-block:: c | ||
364 | void sdw_release_stream(struct sdw_stream_runtime * stream); | ||
365 | |||
366 | Not Supported | ||
367 | ============= | ||
368 | |||
369 | 1. A single port with multiple channels supported cannot be used between two | ||
370 | streams or across stream. For example a port with 4 channels cannot be used | ||
371 | to handle 2 independent stereo streams even though it's possible in theory | ||
372 | in SoundWire. | ||