[alsa-devel] [PATCH] AsoC: tegra_max98090: honor headphone detect GPIO polarity

Stephen Warren swarren at wwwdotorg.org
Thu Mar 3 19:37:14 CET 2016


On 03/02/2016 10:43 AM, Jonathan Tinkham wrote:
> Set the invert property for the headphone jack depending on the GPIO polarity
> in the device-tree.
>
> Signed-off-by: Jonathan Tinkham <sctincman at gmail.com>
> ---

I think this is an updatd version of a previous patch, so it should say 
"[PATCH V2]" in the subject, and have a description of the changes you 
made between the versions here, below the --- line.

> diff --git a/sound/soc/tegra/tegra_max98090.c b/sound/soc/tegra/tegra_max98090.c
> index 902da36..da4e8d1 100644
> --- a/sound/soc/tegra/tegra_max98090.c
> +++ b/sound/soc/tegra/tegra_max98090.c
> @@ -42,6 +42,7 @@
>   struct tegra_max98090 {
>   	struct tegra_asoc_utils_data util_data;
>   	int gpio_hp_det;
> +	enum of_gpio_flags gpio_hp_det_flags;
>   	int gpio_mic_det;
>   };
>
> @@ -155,6 +156,8 @@ static int tegra_max98090_asoc_init(struct snd_soc_pcm_runtime *rtd)
>   				      ARRAY_SIZE(tegra_max98090_hp_jack_pins));
>
>   		tegra_max98090_hp_jack_gpio.gpio = machine->gpio_hp_det;
> +		tegra_max98090_hp_jack_gpio.invert =
> +			machine->gpio_hp_det_flags & OF_GPIO_ACTIVE_LOW;

So now, this .invert flag is always set directly based on the GPIO 
flags. That's good.

I believe this means you should remove the .invert assignment from 
static struct snd_soc_jack_gpio tegra_max98090_hp_jack_gpio too, since 
it's always over-written, so doesn't need a default value.

Question: Should we make the same change for DT property 
nvidia,mic-det-gpios and value tegra_max98090_mic_jack_gpio.invert? 
tegra124-nyan.dts currently says GPIO_ACTIVE_HIGH for both hp-det-gpios 
and mic-det-gpios. I don't know if the DT is correct for both of those 
(and hence making the same change for the mic-det-gpios would break 
Nyan) or not.


More information about the Alsa-devel mailing list