Re: [PATCH 4.19 121/243] ASoC: rsnd: tidyup registering method for rsnd_kctrl_new()

Nobuhiro Iwamatsu
2019-12-11T22:59:51Z

Hi,

On Wed, Dec 11, 2019 at 04:04:43PM +0100, Greg Kroah-Hartman wrote:
> From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
>
> [ Upstream commit 9c698e8481a15237a5b1db5f8391dd66d59e42a4 ]
>
> Current rsnd dvc.c is using flags to avoid duplicating register for
> MIXer case. OTOH, commit e894efef9ac7 ("ASoC: core: add support to card
> rebind") allows to rebind sound card without rebinding all drivers.
>
> Because of above patch and dvc.c flags, it can't re-register kctrl if
> only sound card was rebinded, because dvc is keeping old flags.
> (Of course it will be no problem if rsnd driver also be rebinded,
> but it is not purpose of above patch).
>
> This patch checks current card registered kctrl when registering.
> In MIXer case, it can avoid duplicate register if card already has same
> kctrl. In rebind case, it can re-register kctrl because card registered
> kctl had been removed when unbinding.
>
> This patch is updated version of commit b918f1bc7f1ce ("ASoC: rsnd: DVC
> kctrl sets once")
>
> Reported-by: Nguyen Viet Dung <dung.nguyen.aj@renesas.com>
> Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
> Tested-by: Nguyen Viet Dung <dung.nguyen.aj@renesas.com>
> Cc: Hiroyuki Yokoyama <hiroyuki.yokoyama.vx@renesas.com>
> Signed-off-by: Mark Brown <broonie@kernel.org>
> Signed-off-by: Sasha Levin <sashal@kernel.org>

This commit also requires the following commit:

commit 7aea8a9d71d54f449f49e20324df06341cc18395
Author: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Date: Fri Feb 1 16:49:30 2019 +0900

ASoC: rsnd: fixup MIX kctrl registration

Renesas sound device has many IPs and many situations.
If platform/board uses MIXer, situation will be more complex.
To avoid duplicate DVC kctrl registration when MIXer was used,
it had original flags.
But it was issue when sound card was re-binded, because
no one can't cleanup this flags then.

To solve this issue, commit 9c698e8481a15237a ("ASoC: rsnd: tidyup
registering method for rsnd_kctrl_new()") checks registered
card->controls, because if card was re-binded, these were cleanuped
automatically. This patch could solve re-binding issue.
But, it start to avoid MIX kctrl.

To solve these issues, we need below.
To avoid card re-binding issue: check registered card->controls
To avoid duplicate DVC registration: check registered rsnd_kctrl_cfg
To allow multiple MIX registration: check registered rsnd_kctrl_cfg
This patch do it.

Fixes: 9c698e8481a15237a ("ASoC: rsnd: tidyup registering method for rsnd_kctrl_new()")
Reported-by: Jiada Wang <jiada_wang@mentor.com>
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Tested-By: Jiada Wang <jiada_wang@mentor.com>
Signed-off-by: Mark Brown <broonie@kernel.org>

Please apply this to 4.19.y and 4.14.y.

Best regards,
Nobuhiro