Re: [RFC PATCH 1/3] ASoC: simple-card-utils: add support for componants provideing jack events via set_jack

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Carl

Thank you for your patch.

> This allows componants that want a jack to report state on to do so by calling
> set_jack on components implementing this function.
>
> Im not entirely sure this is the right way to do this so RFC
(snip)
> +	for_each_rtd_components(rtd, i, component) {
> +		if (component->driver->set_jack) {
> +			if (!priv->hp_jack) {
> +				priv->hp_jack = devm_kzalloc(priv->snd_card.dev,
> +					sizeof(*priv->hp_jack), GFP_KERNEL);
> +				snd_soc_card_jack_new(&priv->snd_card,
> +					"Headphones",
> +					SND_JACK_HEADPHONE,
> +					&priv->hp_jack->jack,
> +					NULL, 0);
> +			}
> +			snd_soc_component_set_jack(component, &priv->hp_jack->jack, NULL);
> +		}
> +	}

I'm sorry but I don't understand what you want to do by this patch.
Is main code of this patch asoc_simple_dai_init() update
(= call set_jack() for all component) ?

>  int asoc_simple_init_jack(struct snd_soc_card *card,
> -			       struct asoc_simple_jack *sjack,
> +			       struct asoc_simple_jack **sjack,
>  			       int is_hp, char *prefix, char *pin);

${LINUX}/sound/soc/fsl/fsl-asoc-card.c is using this function, too.
We will have compile error without update it.

>  int asoc_simple_init_jack(struct snd_soc_card *card,
> -			  struct asoc_simple_jack *sjack,
> +			  struct asoc_simple_jack **sjack,
>  			  int is_hp, char *prefix,
>  			  char *pin)
(snip)
>  	if (gpio_is_valid(det)) {
> -		sjack->pin.pin		= pin_name;
> -		sjack->pin.mask		= mask;
> +		struct asoc_simple_jack *sjack_d;
> +
> +		sjack = devm_kzalloc(dev, sizeof(*(*sjack)), GFP_KERNEL);
> +		sjack_d = *sjack;

Am I misunderstanding ?
I think you need to do here is this ?

	-	sjack = devm_kzalloc(dev, sizeof(*(*sjack)), GFP_KERNEL);	
	+	*sjack = devm_kzalloc(dev, sizeof(*(*sjack)), GFP_KERNEL);

Thank you for your help !!

Best regards
---
Kuninori Morimoto



[Index of Archives]     [Linux Arm (vger)]     [ARM Kernel]     [ARM MSM]     [Linux Tegra]     [Linux WPAN Networking]     [Linux Wireless Networking]     [Maemo Users]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Trails]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux