OSDN Git Service

ASoC: da7219: Use clk_round_rate to handle enabled bclk/wclk case
authorAdam Thomson <Adam.Thomson.Opensource@diasemi.com>
Mon, 29 Apr 2019 10:57:33 +0000 (11:57 +0100)
committerMark Brown <broonie@kernel.org>
Thu, 2 May 2019 02:37:08 +0000 (11:37 +0900)
commit1cd472d2ac1654f939ae01164b29e81fc76e0a93
treee24eaf36fb45f41dccf510804bd5489afc543ef8
parent406dcbc55a0a20fd155be889a4a0c4b812f7c18e
ASoC: da7219: Use clk_round_rate to handle enabled bclk/wclk case

For some platforms where DA7219 is the DAI clock master, BCLK/WCLK
will be set and enabled prior to the codec's hw_params() function
being called. It is possible the platform requires a different
BCLK configuration than would be chosen by hw_params(), for
example S16_LE format needed with a 64-bit frame to satisfy certain
devices using the clocks.

To handle those kinds of scenarios, the use of clk_round_rate() is
now employed as part of hw_params(). If BCLK is already enabled
then this function will just return the currently set rate, if it
is valid for the desired frame size, so the subsequent call to
clk_set_rate() will succeed and nothing changes with regards to
clocking. In addition the specific BCLK & WCLK recalc_rate()
implementations needed updating to always give back a real value,
as those functions are called as part of the clk init code and a
real value is needed for the clk_round_rate() call to work as
expected.

Signed-off-by: Adam Thomson <Adam.Thomson.Opensource@diasemi.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/codecs/da7219.c