lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Mon, 6 May 2024 08:30:29 +0200
From: Krzysztof Kozlowski <krzk@...nel.org>
To: Artur Weber <aweber.kernel@...il.com>,
 Sylwester Nawrocki <s.nawrocki@...sung.com>,
 Krzysztof Kozlowski <krzk+dt@...nel.org>
Cc: Liam Girdwood <lgirdwood@...il.com>, Mark Brown <broonie@...nel.org>,
 Rob Herring <robh@...nel.org>, Conor Dooley <conor+dt@...nel.org>,
 Jaroslav Kysela <perex@...ex.cz>, Takashi Iwai <tiwai@...e.com>,
 Alim Akhtar <alim.akhtar@...sung.com>, alsa-devel@...a-project.org,
 linux-sound@...r.kernel.org, devicetree@...r.kernel.org,
 linux-kernel@...r.kernel.org, linux-arm-kernel@...ts.infradead.org,
 linux-samsung-soc@...r.kernel.org, ~postmarketos/upstreaming@...ts.sr.ht
Subject: Re: [PATCH 2/3] ASoC: samsung: midas_wm1811: Add GPIO-based headset
 jack detection

On 03/05/2024 20:55, Artur Weber wrote:
> Some Samsung devices that use the midas_wm1811 driver use a GPIO-based
> method for detecting whether the headset jack is plugged in, as well as
> detecting which headset buttons are pressed. There are two GPIOs:
> a "headset detect" GPIO responsible for detecting jack insertion, and
> a "headset key" GPIO which triggers when a button on the headset is
> pressed. The plug type and the button pressed are determined based
> on information from an ADC channel.

..

>  
> @@ -433,6 +590,9 @@ static int midas_probe(struct platform_device *pdev)
>  	struct snd_soc_card *card = &midas_card;
>  	struct device *dev = &pdev->dev;
>  	static struct snd_soc_dai_link *dai_link;
> +	enum iio_chan_type channel_type;
> +	u32 fourpole_threshold[2];
> +	u32 button_threshold[3];
>  	struct midas_priv *priv;
>  	int ret, i;
>  
> @@ -468,6 +628,91 @@ static int midas_probe(struct platform_device *pdev)
>  		return PTR_ERR(priv->gpio_lineout_sel);
>  	}
>  
> +	priv->gpio_headset_detect = devm_gpiod_get_optional(dev,
> +				"headset-detect", GPIOD_IN);
> +	if (IS_ERR(priv->gpio_headset_detect)) {
> +		dev_err(dev, "Failed to get headset jack detect GPIO\n");

syntax is:
return dev_err_probe()

> +		return PTR_ERR(priv->gpio_headset_detect);
> +	}
> +
> +	if (priv->gpio_headset_detect) {
> +		priv->adc_headset_detect = devm_iio_channel_get(dev,
> +							"headset-detect");
> +		if (IS_ERR(priv->adc_headset_detect)) {
> +			dev_err(dev, "Failed to get ADC channel\n");

return dev_err_probe()

> +			return PTR_ERR(priv->adc_headset_detect);
> +		}
> +

> +		ret = iio_get_channel_type(priv->adc_headset_detect,
> +					   &channel_type);
> +		if (ret) {
> +			dev_err(dev, "Failed to get ADC channel type\n");
> +			return ret;
> +		}
> +
> +		if (channel_type != IIO_VOLTAGE) {
> +			dev_err(dev, "ADC channel is not voltage\n");
> +			return ret;
> +		}
> +
> +		priv->gpio_headset_key = devm_gpiod_get(dev, "headset-key",
> +							GPIOD_IN);
> +		if (IS_ERR(priv->gpio_headset_key)) {
> +			dev_err(dev, "Failed to get headset key gpio\n");

return dev_err_probe()



Best regards,
Krzysztof


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ