]> git.baikalelectronics.ru Git - kernel.git/commit
ASoC: sun4i-i2s: Change set_chan_cfg() params
authorClément Péron <peron.clem@gmail.com>
Fri, 30 Oct 2020 14:46:35 +0000 (15:46 +0100)
committerMark Brown <broonie@kernel.org>
Fri, 30 Oct 2020 17:58:51 +0000 (17:58 +0000)
commitb8c40d4c30e5ec7a3d1044089abaf0cc9854b9ce
tree5a4954756603f2d2bcf96134f8bf75e37c029207
parentaf9cd35ac87609332ff7f12226947000a5655c67
ASoC: sun4i-i2s: Change set_chan_cfg() params

As slots and slot_width can be set manually using set_tdm().
These values are then kept in sun4i_i2s struct.
So we need to check if these values are set or not.

This is not done actually and will trigger a bug.
For example, if we set to the simple soundcard in the device-tree
dai-tdm-slot-width = <32> and then start a stream using S16_LE,
currently we would calculate BCLK for 32-bit slots, but program
lrck_period for 16-bit slots, making the sample rate double what we
expected.

To fix this, we need to check if these values are set or not but as
this logic is already done by the caller. Avoid duplicating this
logic and just pass the required values as params to set_chan_cfg().

Suggested-by: Samuel Holland <samuel@sholland.org>
Acked-by: Maxime Ripard <mripard@kernel.org>
Signed-off-by: Clément Péron <peron.clem@gmail.com>
Link: https://lore.kernel.org/r/20201030144648.397824-3-peron.clem@gmail.com
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/sunxi/sun4i-i2s.c