.. | .. |
---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
---|
1 | 2 | /* |
---|
2 | 3 | * sst-atom-controls.c - Intel MID Platform driver DPCM ALSA controls for Mrfld |
---|
3 | 4 | * |
---|
.. | .. |
---|
5 | 6 | * Author: Omair Mohammed Abdullah <omair.m.abdullah@intel.com> |
---|
6 | 7 | * Vinod Koul <vinod.koul@intel.com> |
---|
7 | 8 | * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
---|
8 | | - * |
---|
9 | | - * This program is free software; you can redistribute it and/or modify |
---|
10 | | - * it under the terms of the GNU General Public License as published by |
---|
11 | | - * the Free Software Foundation; version 2 of the License. |
---|
12 | | - * |
---|
13 | | - * This program is distributed in the hope that it will be useful, but |
---|
14 | | - * WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
15 | | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
---|
16 | | - * General Public License for more details. |
---|
17 | 9 | * |
---|
18 | 10 | * In the dpcm driver modelling when a particular FE/BE/Mixer/Pipe is active |
---|
19 | 11 | * we forward the settings and parameters, rest we keep the values in |
---|
.. | .. |
---|
58 | 50 | { |
---|
59 | 51 | int ret = 0; |
---|
60 | 52 | |
---|
| 53 | + WARN_ON(!mutex_is_locked(&drv->lock)); |
---|
| 54 | + |
---|
61 | 55 | ret = sst_fill_byte_control(drv, ipc_msg, |
---|
62 | 56 | block, task_id, pipe_id, len, cmd_data); |
---|
63 | 57 | if (ret < 0) |
---|
.. | .. |
---|
67 | 61 | |
---|
68 | 62 | /** |
---|
69 | 63 | * sst_fill_and_send_cmd - generate the IPC message and send it to the FW |
---|
70 | | - * @ipc_msg: type of IPC (CMD, SET_PARAMS, GET_PARAMS) |
---|
71 | | - * @cmd_data: the IPC payload |
---|
| 64 | + * @drv: sst_data |
---|
| 65 | + * @ipc_msg: type of IPC (CMD, SET_PARAMS, GET_PARAMS) |
---|
| 66 | + * @block: block index |
---|
| 67 | + * @task_id: task index |
---|
| 68 | + * @pipe_id: pipe index |
---|
| 69 | + * @cmd_data: the IPC payload |
---|
| 70 | + * @len: length of data to be sent |
---|
72 | 71 | */ |
---|
73 | 72 | static int sst_fill_and_send_cmd(struct sst_data *drv, |
---|
74 | 73 | u8 ipc_msg, u8 block, u8 task_id, u8 pipe_id, |
---|
.. | .. |
---|
84 | 83 | return ret; |
---|
85 | 84 | } |
---|
86 | 85 | |
---|
87 | | -/** |
---|
| 86 | +/* |
---|
88 | 87 | * tx map value is a bitfield where each bit represents a FW channel |
---|
89 | 88 | * |
---|
90 | 89 | * 3 2 1 0 # 0 = codec0, 1 = codec1 |
---|
.. | .. |
---|
96 | 95 | 0x1, 0x2, 0x4, 0x8, 0x10, 0x20, 0x40, 0x80, /* default rx map */ |
---|
97 | 96 | }; |
---|
98 | 97 | |
---|
99 | | -/** |
---|
| 98 | +/* |
---|
100 | 99 | * rx map value is a bitfield where each bit represents a slot |
---|
101 | 100 | * |
---|
102 | 101 | * 76543210 # 0 = slot 0, 1 = slot 1 |
---|
.. | .. |
---|
107 | 106 | 0x1, 0x2, 0x4, 0x8, 0x10, 0x20, 0x40, 0x80, /* default tx map */ |
---|
108 | 107 | }; |
---|
109 | 108 | |
---|
110 | | -/** |
---|
| 109 | +/* |
---|
111 | 110 | * NOTE: this is invoked with lock held |
---|
112 | 111 | */ |
---|
113 | 112 | static int sst_send_slot_map(struct sst_data *drv) |
---|
.. | .. |
---|
151 | 150 | |
---|
152 | 151 | /** |
---|
153 | 152 | * sst_slot_get - get the status of the interleaver/deinterleaver control |
---|
154 | | - * |
---|
| 153 | + * @kcontrol: control pointer |
---|
| 154 | + * @ucontrol: User data |
---|
155 | 155 | * Searches the map where the control status is stored, and gets the |
---|
156 | 156 | * channel/slot which is currently set for this enumerated control. Since it is |
---|
157 | 157 | * an enumerated control, there is only one possible value. |
---|
.. | .. |
---|
203 | 203 | |
---|
204 | 204 | /** |
---|
205 | 205 | * sst_slot_put - set the status of interleaver/deinterleaver control |
---|
206 | | - * |
---|
| 206 | + * @kcontrol: control pointer |
---|
| 207 | + * @ucontrol: User data |
---|
207 | 208 | * (de)interleaver controls are defined in opposite sense to be user-friendly |
---|
208 | 209 | * |
---|
209 | 210 | * Instead of the enum value being the value written to the register, it is the |
---|
.. | .. |
---|
286 | 287 | |
---|
287 | 288 | /** |
---|
288 | 289 | * sst_find_and_send_pipe_algo - send all the algo parameters for a pipe |
---|
289 | | - * |
---|
| 290 | + * @drv: sst_data |
---|
| 291 | + * @pipe: string identifier |
---|
| 292 | + * @ids: list of algorithms |
---|
290 | 293 | * The algos which are in each pipeline are sent to the firmware one by one |
---|
291 | 294 | * |
---|
292 | 295 | * Called with lock held |
---|
.. | .. |
---|
296 | 299 | { |
---|
297 | 300 | int ret = 0; |
---|
298 | 301 | struct sst_algo_control *bc; |
---|
299 | | - struct sst_module *algo = NULL; |
---|
| 302 | + struct sst_module *algo; |
---|
300 | 303 | |
---|
301 | 304 | dev_dbg(&drv->pdev->dev, "Enter: widget=%s\n", pipe); |
---|
302 | 305 | |
---|
.. | .. |
---|
385 | 388 | |
---|
386 | 389 | /** |
---|
387 | 390 | * sst_send_gain_cmd - send the gain algorithm IPC to the FW |
---|
388 | | - * @gv: the stored value of gain (also contains rampduration) |
---|
389 | | - * @mute: flag that indicates whether this was called from the |
---|
390 | | - * digital_mute callback or directly. If called from the |
---|
391 | | - * digital_mute callback, module will be muted/unmuted based on this |
---|
392 | | - * flag. The flag is always 0 if called directly. |
---|
| 391 | + * @drv: sst_data |
---|
| 392 | + * @gv:the stored value of gain (also contains rampduration) |
---|
| 393 | + * @task_id: task index |
---|
| 394 | + * @loc_id: location/position index |
---|
| 395 | + * @module_id: module index |
---|
| 396 | + * @mute: flag that indicates whether this was called from the |
---|
| 397 | + * digital_mute callback or directly. If called from the |
---|
| 398 | + * digital_mute callback, module will be muted/unmuted based on this |
---|
| 399 | + * flag. The flag is always 0 if called directly. |
---|
393 | 400 | * |
---|
394 | 401 | * Called with sst_data.lock held |
---|
395 | 402 | * |
---|
.. | .. |
---|
550 | 557 | |
---|
551 | 558 | /** |
---|
552 | 559 | * fill_swm_input - fill in the SWM input ids given the register |
---|
| 560 | + * @cmpnt: ASoC component |
---|
| 561 | + * @swm_input: array of swm_input_ids |
---|
| 562 | + * @reg: the register value is a bit-field inicated which mixer inputs are ON. |
---|
553 | 563 | * |
---|
554 | | - * The register value is a bit-field inicated which mixer inputs are ON. Use the |
---|
555 | | - * lookup table to get the input-id and fill it in the structure. |
---|
| 564 | + * Use the lookup table to get the input-id and fill it in the |
---|
| 565 | + * structure. |
---|
556 | 566 | */ |
---|
557 | 567 | static int fill_swm_input(struct snd_soc_component *cmpnt, |
---|
558 | 568 | struct swm_input_ids *swm_input, unsigned int reg) |
---|
.. | .. |
---|
583 | 593 | } |
---|
584 | 594 | |
---|
585 | 595 | |
---|
586 | | -/** |
---|
| 596 | +/* |
---|
587 | 597 | * called with lock held |
---|
588 | 598 | */ |
---|
589 | 599 | static int sst_set_pipe_gain(struct sst_ids *ids, |
---|
.. | .. |
---|
592 | 602 | int ret = 0; |
---|
593 | 603 | struct sst_gain_mixer_control *mc; |
---|
594 | 604 | struct sst_gain_value *gv; |
---|
595 | | - struct sst_module *gain = NULL; |
---|
| 605 | + struct sst_module *gain; |
---|
596 | 606 | |
---|
597 | 607 | list_for_each_entry(gain, &ids->gain_list, node) { |
---|
598 | 608 | struct snd_kcontrol *kctl = gain->kctl; |
---|
.. | .. |
---|
647 | 657 | set_mixer = false; |
---|
648 | 658 | } |
---|
649 | 659 | |
---|
650 | | - if (set_mixer == false) |
---|
| 660 | + if (!set_mixer) |
---|
651 | 661 | return 0; |
---|
652 | 662 | |
---|
653 | 663 | if (SND_SOC_DAPM_EVENT_ON(event) || |
---|
.. | .. |
---|
713 | 723 | SST_SBA_DECLARE_MIX_CONTROLS(sst_mix_sprot_l0_controls); |
---|
714 | 724 | SST_SBA_DECLARE_MIX_CONTROLS(sst_mix_media_l1_controls); |
---|
715 | 725 | SST_SBA_DECLARE_MIX_CONTROLS(sst_mix_media_l2_controls); |
---|
716 | | -SST_SBA_DECLARE_MIX_CONTROLS(sst_mix_voip_controls); |
---|
| 726 | +SST_SBA_DECLARE_MIX_CONTROLS(__maybe_unused sst_mix_voip_controls); |
---|
717 | 727 | SST_SBA_DECLARE_MIX_CONTROLS(sst_mix_codec0_controls); |
---|
718 | 728 | SST_SBA_DECLARE_MIX_CONTROLS(sst_mix_codec1_controls); |
---|
719 | 729 | SST_SBA_DECLARE_MIX_CONTROLS(sst_mix_modem_controls); |
---|
.. | .. |
---|
887 | 897 | return 0; |
---|
888 | 898 | } |
---|
889 | 899 | |
---|
890 | | -/** |
---|
| 900 | +/* |
---|
891 | 901 | * sst_ssp_config - contains SSP configuration for media UC |
---|
892 | 902 | * this can be overwritten by set_dai_xxx APIs |
---|
893 | 903 | */ |
---|
.. | .. |
---|
1306 | 1316 | |
---|
1307 | 1317 | /** |
---|
1308 | 1318 | * sst_send_pipe_gains - send gains for the front-end DAIs |
---|
| 1319 | + * @dai: front-end dai |
---|
| 1320 | + * @stream: direction |
---|
| 1321 | + * @mute: boolean indicating mute status |
---|
1309 | 1322 | * |
---|
1310 | 1323 | * The gains in the pipes connected to the front-ends are muted/unmuted |
---|
1311 | 1324 | * automatically via the digital_mute() DAPM callback. This function sends the |
---|
.. | .. |
---|
1363 | 1376 | |
---|
1364 | 1377 | /** |
---|
1365 | 1378 | * sst_fill_module_list - populate the list of modules/gains for a pipe |
---|
1366 | | - * |
---|
| 1379 | + * @kctl: kcontrol pointer |
---|
| 1380 | + * @w: dapm widget |
---|
| 1381 | + * @type: widget type |
---|
1367 | 1382 | * |
---|
1368 | 1383 | * Fills the widget pointer in the kcontrol private data, and also fills the |
---|
1369 | 1384 | * kcontrol pointer in the widget private data. |
---|
.. | .. |
---|
1409 | 1424 | |
---|
1410 | 1425 | /** |
---|
1411 | 1426 | * sst_fill_widget_module_info - fill list of gains/algos for the pipe |
---|
1412 | | - * @widget: pipe modelled as a DAPM widget |
---|
| 1427 | + * @w: pipe modeled as a DAPM widget |
---|
| 1428 | + * @component: ASoC component |
---|
1413 | 1429 | * |
---|
1414 | 1430 | * Fill the list of gains/algos for the widget by looking at all the card |
---|
1415 | 1431 | * controls and comparing the name of the widget with the first part of control |
---|
.. | .. |
---|
1469 | 1485 | |
---|
1470 | 1486 | /** |
---|
1471 | 1487 | * sst_fill_linked_widgets - fill the parent pointer for the linked widget |
---|
| 1488 | + * @component: ASoC component |
---|
| 1489 | + * @ids: sst_ids array |
---|
1472 | 1490 | */ |
---|
1473 | 1491 | static void sst_fill_linked_widgets(struct snd_soc_component *component, |
---|
1474 | 1492 | struct sst_ids *ids) |
---|
.. | .. |
---|
1486 | 1504 | |
---|
1487 | 1505 | /** |
---|
1488 | 1506 | * sst_map_modules_to_pipe - fill algo/gains list for all pipes |
---|
| 1507 | + * @component: ASoC component |
---|
1489 | 1508 | */ |
---|
1490 | 1509 | static int sst_map_modules_to_pipe(struct snd_soc_component *component) |
---|
1491 | 1510 | { |
---|