Skip to content

Commit efe30e2

Browse files
rfvirgilbroonie
authored andcommitted
ASoC: soc-utils: Improve kerneldoc for snd_soc_tdm_params_to_bclk()
The statement that snd_soc_tdm_params_to_bclk() is equivalent to snd_soc_params_to_bclk() if tdm_width==tdm_slots==0 is not accurate, it is only true is slot_multiple is also <2. However, the description of special-case behaviour in terms of pairs of tdm_width and tdm_slot values is not particularly helpful so we might as well take the opportunity to rework the description to say the same thing in a simpler way. The behaviour of a pair of values is obvious from a description of each argument. At the same time make a few edits to clarify the rest of the description. Signed-off-by: Richard Fitzgerald <rf@opensource.cirrus.com> Link: https://lore.kernel.org/r/20220815113346.3805075-1-rf@opensource.cirrus.com Signed-off-by: Mark Brown <broonie@kernel.org>
1 parent 36b9994 commit efe30e2

File tree

1 file changed

+12
-11
lines changed

1 file changed

+12
-11
lines changed

sound/soc/soc-utils.c

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -56,23 +56,24 @@ EXPORT_SYMBOL_GPL(snd_soc_params_to_bclk);
5656
/**
5757
* snd_soc_tdm_params_to_bclk - calculate bclk from params and tdm slot info.
5858
*
59-
* Calculate the bclk from the params sample rate and the tdm slot count and
60-
* tdm slot width. Either or both of tdm_width and tdm_slots can be 0.
59+
* Calculate the bclk from the params sample rate, the tdm slot count and the
60+
* tdm slot width. Optionally round-up the slot count to a given multiple.
61+
* Either or both of tdm_width and tdm_slots can be 0.
6162
*
62-
* If tdm_width == 0 and tdm_slots > 0: the params_width will be used.
63-
* If tdm_width > 0 and tdm_slots == 0: the params_channels will be used
64-
* as the slot count.
65-
* Both tdm_width and tdm_slots are 0: this is equivalent to calling
66-
* snd_soc_params_to_bclk().
63+
* If tdm_width == 0: use params_width() as the slot width.
64+
* If tdm_slots == 0: use params_channels() as the slot count.
6765
*
68-
* If slot_multiple > 1 the slot count (or params_channels if tdm_slots == 0)
69-
* will be rounded up to a multiple of this value. This is mainly useful for
66+
* If slot_multiple > 1 the slot count (or params_channels() if tdm_slots == 0)
67+
* will be rounded up to a multiple of slot_multiple. This is mainly useful for
7068
* I2S mode, which has a left and right phase so the number of slots is always
7169
* a multiple of 2.
7270
*
71+
* If tdm_width == 0 && tdm_slots == 0 && slot_multiple < 2, this is equivalent
72+
* to calling snd_soc_params_to_bclk().
73+
*
7374
* @params: Pointer to struct_pcm_hw_params.
74-
* @tdm_width: Width in bits of the tdm slots.
75-
* @tdm_slots: Number of tdm slots per frame.
75+
* @tdm_width: Width in bits of the tdm slots. Must be >= 0.
76+
* @tdm_slots: Number of tdm slots per frame. Must be >= 0.
7677
* @slot_multiple: If >1 roundup slot count to a multiple of this value.
7778
*
7879
* Return: bclk frequency in Hz, else a negative error code if params format

0 commit comments

Comments
 (0)