Skip to content

Commit ab02337

Browse files
morimotobroonie
authored andcommitted
ASoC: rsnd: remove default division of clock out
Current adg has default division for BRRA/BRRB, but it was created at very beginning of the driver implementation, and is now an unnecessary settings. Because it has this default division, unexpected clockout might be selected. For example if it requests only 44.1kHz base clockout, unrequested 48kHz base clockout also will be selected. This patch remove default division of clock out Reported-by: Vincenzo De Michele <vincenzo.michele@davinci.de> Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Link: https://lore.kernel.org/r/87il96zlep.wl-kuninori.morimoto.gx@renesas.com Signed-off-by: Mark Brown <broonie@kernel.org>
1 parent 80d4984 commit ab02337

File tree

1 file changed

+6
-9
lines changed

1 file changed

+6
-9
lines changed

sound/soc/sh/rcar/adg.c

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -485,7 +485,6 @@ static int rsnd_adg_get_clkout(struct rsnd_priv *priv)
485485
struct device_node *np = dev->of_node;
486486
struct property *prop;
487487
u32 ckr, brgx, brga, brgb;
488-
u32 rate, div;
489488
u32 req_rate[ADG_HZ_SIZE] = {};
490489
uint32_t count = 0;
491490
unsigned long req_Hz[ADG_HZ_SIZE];
@@ -559,6 +558,8 @@ static int rsnd_adg_get_clkout(struct rsnd_priv *priv)
559558
* clock-frequency = <22579200 24576000>;
560559
*/
561560
for_each_rsnd_clkin(clk, adg, i) {
561+
u32 rate, div;
562+
562563
rate = clk_get_rate(clk);
563564

564565
if (0 == rate) /* not used */
@@ -569,10 +570,8 @@ static int rsnd_adg_get_clkout(struct rsnd_priv *priv)
569570
if (i == CLKI)
570571
/* see [APPROXIMATE] */
571572
rate = (clk_get_rate(clk) / req_Hz[ADG_HZ_441]) * req_Hz[ADG_HZ_441];
572-
if (!adg->brg_rate[ADG_HZ_441] && (0 == rate % 44100)) {
573-
div = 6;
574-
if (req_Hz[ADG_HZ_441])
575-
div = rate / req_Hz[ADG_HZ_441];
573+
if (!adg->brg_rate[ADG_HZ_441] && req_Hz[ADG_HZ_441] && (0 == rate % 44100)) {
574+
div = rate / req_Hz[ADG_HZ_441];
576575
brgx = rsnd_adg_calculate_brgx(div);
577576
if (BRRx_MASK(brgx) == brgx) {
578577
brga = brgx;
@@ -590,10 +589,8 @@ static int rsnd_adg_get_clkout(struct rsnd_priv *priv)
590589
if (i == CLKI)
591590
/* see [APPROXIMATE] */
592591
rate = (clk_get_rate(clk) / req_Hz[ADG_HZ_48]) * req_Hz[ADG_HZ_48];
593-
if (!adg->brg_rate[ADG_HZ_48] && (0 == rate % 48000)) {
594-
div = 6;
595-
if (req_Hz[ADG_HZ_48])
596-
div = rate / req_Hz[ADG_HZ_48];
592+
if (!adg->brg_rate[ADG_HZ_48] && req_Hz[ADG_HZ_48] && (0 == rate % 48000)) {
593+
div = rate / req_Hz[ADG_HZ_48];
597594
brgx = rsnd_adg_calculate_brgx(div);
598595
if (BRRx_MASK(brgx) == brgx) {
599596
brgb = brgx;

0 commit comments

Comments
 (0)