[PATCH 03/10] ASoC: ak4118: Update to use new component control notify helper

Charles Keepax posted 10 patches 2 years, 9 months ago
There is a newer version of this series
[PATCH 03/10] ASoC: ak4118: Update to use new component control notify helper
Posted by Charles Keepax 2 years, 9 months ago
Update the driver to use the new ASoC core control notify helper.
This also fixes a bug where the control would not be found if the
CODEC was given a name prefix.

Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
---
 sound/soc/codecs/ak4118.c | 11 ++---------
 1 file changed, 2 insertions(+), 9 deletions(-)

diff --git a/sound/soc/codecs/ak4118.c b/sound/soc/codecs/ak4118.c
index b6d9a10bdccdc..74ccfb0d921d6 100644
--- a/sound/soc/codecs/ak4118.c
+++ b/sound/soc/codecs/ak4118.c
@@ -264,8 +264,6 @@ static irqreturn_t ak4118_irq_handler(int irq, void *data)
 	struct ak4118_priv *ak4118 = data;
 	struct snd_soc_component *component = ak4118->component;
 	struct snd_kcontrol_new *kctl_new;
-	struct snd_kcontrol *kctl;
-	struct snd_ctl_elem_id *id;
 	unsigned int i;
 
 	if (!component)
@@ -273,13 +271,8 @@ static irqreturn_t ak4118_irq_handler(int irq, void *data)
 
 	for (i = 0; i < ARRAY_SIZE(ak4118_iec958_controls); i++) {
 		kctl_new = &ak4118_iec958_controls[i];
-		kctl = snd_soc_card_get_kcontrol(component->card,
-						 kctl_new->name);
-		if (!kctl)
-			continue;
-		id = &kctl->id;
-		snd_ctl_notify(component->card->snd_card,
-			       SNDRV_CTL_EVENT_MASK_VALUE, id);
+
+		snd_soc_component_notify_control(component, kctl_new->name);
 	}
 
 	return IRQ_HANDLED;
-- 
2.30.2
Re: [PATCH 03/10] ASoC: ak4118: Update to use new component control notify helper
Posted by Pierre-Louis Bossart 2 years, 9 months ago

On 5/12/23 07:28, Charles Keepax wrote:
> Update the driver to use the new ASoC core control notify helper.
> This also fixes a bug where the control would not be found if the
> CODEC was given a name prefix.
> 
> Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
> ---
>  sound/soc/codecs/ak4118.c | 11 ++---------
>  1 file changed, 2 insertions(+), 9 deletions(-)
> 
> diff --git a/sound/soc/codecs/ak4118.c b/sound/soc/codecs/ak4118.c

should patches 2, 3, 4 be part of a separate series, they really have
nothing to do with the Cirrus CS32L43?

> index b6d9a10bdccdc..74ccfb0d921d6 100644
> --- a/sound/soc/codecs/ak4118.c
> +++ b/sound/soc/codecs/ak4118.c
> @@ -264,8 +264,6 @@ static irqreturn_t ak4118_irq_handler(int irq, void *data)
>  	struct ak4118_priv *ak4118 = data;
>  	struct snd_soc_component *component = ak4118->component;
>  	struct snd_kcontrol_new *kctl_new;
> -	struct snd_kcontrol *kctl;
> -	struct snd_ctl_elem_id *id;
>  	unsigned int i;
>  
>  	if (!component)
> @@ -273,13 +271,8 @@ static irqreturn_t ak4118_irq_handler(int irq, void *data)
>  
>  	for (i = 0; i < ARRAY_SIZE(ak4118_iec958_controls); i++) {
>  		kctl_new = &ak4118_iec958_controls[i];
> -		kctl = snd_soc_card_get_kcontrol(component->card,
> -						 kctl_new->name);
> -		if (!kctl)
> -			continue;
> -		id = &kctl->id;
> -		snd_ctl_notify(component->card->snd_card,
> -			       SNDRV_CTL_EVENT_MASK_VALUE, id);
> +
> +		snd_soc_component_notify_control(component, kctl_new->name);
>  	}
>  
>  	return IRQ_HANDLED;
Re: [PATCH 03/10] ASoC: ak4118: Update to use new component control notify helper
Posted by Charles Keepax 2 years, 9 months ago
On Fri, May 12, 2023 at 08:48:40AM -0500, Pierre-Louis Bossart wrote:
> On 5/12/23 07:28, Charles Keepax wrote:
> > Update the driver to use the new ASoC core control notify helper.
> > This also fixes a bug where the control would not be found if the
> > CODEC was given a name prefix.
> > 
> > Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
> > ---
> >  sound/soc/codecs/ak4118.c | 11 ++---------
> >  1 file changed, 2 insertions(+), 9 deletions(-)
> > 
> > diff --git a/sound/soc/codecs/ak4118.c b/sound/soc/codecs/ak4118.c
> 
> should patches 2, 3, 4 be part of a separate series, they really have
> nothing to do with the Cirrus CS32L43?

Patch 2 has a build dependency on the CODEC patch, 3/4 are
debatable. I could do the series without these patches and do a
seperate chain with those three patches and an extra patch to
convert the cs42l43, if that is preferred to shrink the chain.

Thanks,
Charles